@worm-print-platform/canvas 1.6.4 → 1.6.6

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 (67) hide show
  1. package/README.md +1 -1
  2. package/dist/browser-bundle.d.ts +1 -1
  3. package/dist/canvas.js +96 -60
  4. package/dist/core/default-template.d.ts +1 -1
  5. package/dist/core/element-definitions.d.ts +1 -1
  6. package/dist/core/format.d.ts +1 -1
  7. package/dist/core/h.d.ts +1 -1
  8. package/dist/core/icons.d.ts +1 -1
  9. package/dist/core/plugin.d.ts +1 -1
  10. package/dist/core/store.d.ts +1 -1
  11. package/dist/host-contract.d.ts +1 -1
  12. package/dist/index.cjs +41 -5
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1011 -949
  15. package/dist/print-designer.d.ts +4 -1
  16. package/dist/shell/binding.d.ts +1 -1
  17. package/dist/shell/canvas.d.ts +1 -1
  18. package/dist/shell/code.d.ts +1 -1
  19. package/dist/shell/color-picker.d.ts +1 -1
  20. package/dist/shell/controls.d.ts +1 -1
  21. package/dist/shell/crop-anchor.d.ts +1 -1
  22. package/dist/shell/elements.d.ts +1 -1
  23. package/dist/shell/expression-editor.d.ts +1 -1
  24. package/dist/shell/flow-list.d.ts +1 -1
  25. package/dist/shell/font-select.d.ts +1 -1
  26. package/dist/shell/format-bar.d.ts +1 -1
  27. package/dist/shell/help-content/en-US/advanced-settings.d.ts +1 -1
  28. package/dist/shell/help-content/en-US/changelog.d.ts +1 -1
  29. package/dist/shell/help-content/en-US/faq.d.ts +1 -1
  30. package/dist/shell/help-content/en-US/features.d.ts +1 -1
  31. package/dist/shell/help-content/en-US/getting-started.d.ts +1 -1
  32. package/dist/shell/help-content/en-US/shortcuts.d.ts +1 -1
  33. package/dist/shell/help-content/index.d.ts +1 -1
  34. package/dist/shell/help-content/th-TH/advanced-settings.d.ts +1 -1
  35. package/dist/shell/help-content/th-TH/changelog.d.ts +1 -1
  36. package/dist/shell/help-content/th-TH/faq.d.ts +1 -1
  37. package/dist/shell/help-content/th-TH/features.d.ts +1 -1
  38. package/dist/shell/help-content/th-TH/getting-started.d.ts +1 -1
  39. package/dist/shell/help-content/th-TH/shortcuts.d.ts +1 -1
  40. package/dist/shell/help-content/zh-CN/advanced-settings.d.ts +1 -1
  41. package/dist/shell/help-content/zh-CN/changelog.d.ts +1 -1
  42. package/dist/shell/help-content/zh-CN/faq.d.ts +1 -1
  43. package/dist/shell/help-content/zh-CN/features.d.ts +1 -1
  44. package/dist/shell/help-content/zh-CN/getting-started.d.ts +1 -1
  45. package/dist/shell/help-content/zh-CN/shortcuts.d.ts +1 -1
  46. package/dist/shell/help-modal.d.ts +1 -1
  47. package/dist/shell/page-extras.d.ts +1 -1
  48. package/dist/shell/panels.d.ts +1 -1
  49. package/dist/shell/plugin-ui.d.ts +1 -1
  50. package/dist/shell/prop-group.d.ts +1 -1
  51. package/dist/shell/property-panel.d.ts +1 -1
  52. package/dist/shell/property-search.d.ts +1 -1
  53. package/dist/shell/ruler.d.ts +1 -1
  54. package/dist/shell/table-props.d.ts +1 -1
  55. package/dist/shell/table.d.ts +1 -1
  56. package/dist/shell/toolbar-overflow.d.ts +1 -1
  57. package/dist/shell/toolbar.d.ts +1 -1
  58. package/dist/shell/watermark.d.ts +1 -1
  59. package/dist/test-setup.d.ts +1 -1
  60. package/dist/theme-tokens.d.ts +1 -1
  61. package/dist/version.d.ts +2 -2
  62. package/dist/vue3/PrintDesigner.d.ts +1 -1
  63. package/dist/vue3/PrintHtmlPreview.d.ts +1 -1
  64. package/dist/vue3/index.d.ts +1 -1
  65. package/dist/vue3/previewStyle.d.ts +1 -1
  66. package/dist/vue3/toolbarOverflow.d.ts +1 -1
  67. 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 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)return Array.isArray(h.DEFAULT_DEMO_DATA[t])?h.DEFAULT_DEMO_DATA[t]:void 0;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.4";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:`
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"),hn=require("jsbarcode");function l(e,t={},o=[]){return{tag:e,props:t,children:o}}var Pr="http://www.w3.org/2000/svg",Ma=new Set(["draggable","contenteditable","spellcheck"]),_a=new Set(["indeterminate"]);function Ra(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="g"}function Fa(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=Ra(o)||Fa(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 _a.has(s)?n[s]=!0:typeof d=="boolean"?d&&n.setAttribute(s,Ma.has(s)?"true":""):n.setAttribute(s,String(d));for(const s of i)Se(s,n);return t.appendChild(n),n}function un(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var Ia=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 La="开启拼版后只能有一个设计页面",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 fn(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 gn{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(fn),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"]),za=["top","right","bottom","left"],Oa={on:!0,off:!1,mixed:yt};function mi(e){const t=h.resolveBorderEdgeStates(e),o={};for(const r of za)o[r]=Oa[t[r]];return o}const Na=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];class Ba{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(Na.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 Ha={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=Ha[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?mn(t):"#000000"}function mn({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 Ua(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 $a(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 Wa(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 Ka(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(),Va(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 Va(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(ja(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),Ga(n),qa(n),vt=n,e.setAttribute("aria-expanded","true")}function Ga(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 qa(e){const t=i=>{const n=Ya(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 Ya(e){const t=typeof e.composedPath=="function"?e.composedPath():[];return t.length?t:[e.target]}function ja(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=>Za(e,o.target.value)})]),l("div",{class:"picker-area","aria-label":t("colorPicker.customColor"),tabindex:0,onPointerdown:o=>Qa(e,o),onKeydown:o=>Ja(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=>el(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:()=>Xa(e,o)})))])}function Rr(e){return mn($a(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=Ua(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=Wa(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 Xa(e,t){Fr(e,t),uo(e,t)}function Za(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 Qa(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 Ja(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 el(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 tl(e,t){const o=Ft;Ft=e;try{t()}finally{Ft=o}}function B(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 U(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:B("controls.k28"),"aria-label":B("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:B("controls.k30"),"aria-label":B("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":B("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?B("controls.k33"):B("controls.k34",{v0:e.tipValue,v1:e.tipUnit?" "+e.tipUnit:""})),n=e.force?B("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=B("controls.k36"),r){return Ka({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 bn(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 ol="propertyPanel.k328",rl=()=>B(ol);function yn(){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 yn().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=rl();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:B("elementDefinitions.k553"),icon:"Type",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"barcode",label:B("elementDefinitions.k554"),icon:"Barcode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"qrcode",label:B("elementDefinitions.k555"),icon:"QrCode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"image",label:B("elementDefinitions.k556"),icon:"Image",material:!0,propertyGroup:"general",dblEditableField:"src",origin:"builtin"},{type:"table",label:B("elementDefinitions.k557"),icon:"Table",material:!0,propertyGroup:"table",origin:"builtin"},{type:"longText",label:B("elementDefinitions.k558"),icon:"TextAlignStart",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"flowList",label:B("elementDefinitions.k559"),icon:"List",material:!0,propertyGroup:"general",dblEditableField:"formatter",origin:"builtin"},{type:"hline",label:B("elementDefinitions.k560"),icon:"Minus",material:!0,propertyGroup:"general",origin:"builtin"},{type:"vline",label:B("elementDefinitions.k561"),icon:"SeparatorVertical",material:!0,propertyGroup:"general",origin:"builtin"},{type:"rect",label:B("elementDefinitions.k562"),icon:"Square",material:!0,propertyGroup:"general",origin:"builtin"},{type:"oval",label:B("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:B("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 vn(e){const t=Ue();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function il(){return new Map(xo.map(e=>[e.type,e]))}function nl(e){if(!e?.type||typeof e.type!="string")throw new Error(B("elementDefinitions.k565"));if(!e.label||typeof e.label!="string")throw new Error(B("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 al(e,t){if(!e||typeof t!="function")throw new Error(B("elementDefinitions.k567"));return Ue().rendererOverrides.set(e,t),qt(),()=>{const r=Ue();r.rendererOverrides.get(e)===t&&(r.rendererOverrides.delete(e),qt())}}function xn(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 ll(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)??il().get(e)??ll(e);if(!o)return;const r=t.rendererOverrides.get(e)??t.builtinRenderers.get(e);return r?{...o,renderContent:r}:o}function wn(){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 yn()){if(o.has(i.type))continue;const n=pt(i.type);n&&t.push(n),o.add(i.type)}return t}function kn(){return wn().filter(e=>e.material)}function En(e){return pt(e)?.propertyGroup??"general"}function Sn(e){return pt(e)?.dblEditableField}function Tn(e){return pt(e)?.icon??"Shapes"}function sl(){const e=Ue();e.overrides.clear(),e.rendererOverrides.clear(),e.seq.clear(),e.nextSeq=0,qt()}const zr="1.4.0",Cn="print-designer",Or=["template","fields","name","fonts","design-data","theme","theme-config","field-display","lang"],Dn=["is-edit","show-help","show-preview","show-save"],dl=Object.freeze({bubbles:!0,composed:!0}),Nr=["container","toolbar","format-bar","left-panel","canvas-area","property-panel","status-bar","page-tabs"],Pn=["--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"],An=["getTemplateJson","loadTemplate","save","validateTemplate","getGeometryWarnings","setLocale"],Mn=["template","fields","fonts","designData","isEdit","showHelp","showPreview","showSave","theme","themeConfig","uploadImage","uploadDesignBackground","fieldDisplay","lang","messages"],He=Object.freeze({save:"save",preview:"preview",help:"help",dblclickElement:"dblclick-element",dblclickCell:"dblclick-cell"}),_n=[He.save,He.preview,He.help,He.dblclickElement,He.dblclickCell];function yr(){return{version:zr,tag:Cn,attributes:Or,booleanAttributes:Dn,events:_n,parts:Nr,themeTokens:Pn,methods:An,properties:Mn}}const pl={"--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 cl(e){if(Array.isArray(e))return e}function hl(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 ul(){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 fl(e,t){return cl(e)||hl(e,t)||gl(e,t)||ul()}function gl(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 Rn=Object.entries,ml=Object.keys,wi=Object.setPrototypeOf,bl=Object.isFrozen,Fn=Object.getPrototypeOf,In=Object.getOwnPropertyDescriptor;let me=Object.freeze,pe=Object.seal,st=Object.create,Ln=typeof Reflect<"u"&&Reflect,go=Ln.apply,vr=Ln.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),yl=oe(Array.prototype.lastIndexOf),ki=oe(Array.prototype.pop),Nt=oe(Array.prototype.push),vl=oe(Array.prototype.slice),xl=oe(Array.prototype.splice),It=Array.isArray,Zo=zn(Set),Qo=oe(Set.prototype.add),Bt=oe(Set.prototype.has),mt=oe(String.prototype.toLowerCase),Jo=oe(String.prototype.toString),wl=oe(String.prototype.match),no=oe(String.prototype.replace),er=oe(String.prototype.indexOf),kl=oe(String.prototype.trim),El=oe(Number.prototype.toString),Sl=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),Ht=oe(Object.prototype.toString),Tl=RegExp.prototype.test,fe=function(t,o){return t instanceof RegExp&&(t.lastIndex=0),go(Tl,t,[o])},Qe=zn(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 zn(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&&(bl(t)||(t[r]=n),i=n)}e[i]=!0}return e}function Cl(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 Rn(e)){var o=fl(r,2);const i=o[0],n=o[1];Ee(e,i)&&(It(n)?t[i]=Cl(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=ml(e);let r=o.length;for(;r--;)t[o[r]]=e[o[r]];return t}function Dl(e){switch(typeof e){case"string":return e;case"number":return El(e);case"boolean":return Sl(e);case"bigint":return Ei?Ei(e):"0";case"symbol":return Si?Si(e):"Symbol()";case"undefined":return Ht(e);case"function":case"object":{if(e===null)return Ht(e);const t=e,o=_e(t,"toString");if(typeof o=="function"){const r=o(t);return typeof r=="string"?r:Ht(r)}return Ht(e)}default:return Ht(e)}}function _e(e,t){for(;e!==null;){const r=In(e,t);if(r){if(r.get)return oe(r.get);if(typeof r.value=="function")return oe(r.value)}e=Fn(e)}function o(){return null}return o}function Pl(e,t){for(;e!==null;){const o=In(e,t);if(o)return o.get?oe(o.get):null;e=Fn(e)}return null}function Al(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"]),Ml=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"]),_l=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"]),Rl=pe(/{{[\w\W]*|^[\w\W]*}}/g),Fl=pe(/<%[\w\W]*|^[\w\W]*%>/g),Il=pe(/\${[\w\W]*/g),Ll=pe(/{{|}}|\${|<%|%>|&lt;%|%&gt;/),zl=pe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ol=pe(/^aria-[\-\w]+$/),Ai=pe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nl=pe(/^(?:\w+script|data):/i),Bl=pe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Hl=pe(/^html$/i),Ul=pe(/^[a-z][.\w]*(-[.\w]+)+$/i),nr=pe(/<[/\w!]/g),Mi=pe(/<[/\w]/g),$l=pe(/<\/no(script|embed|frames)/i),_i=pe(/\/>/i),Wl=pe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),Kl=pe(/^[\r\n\t ]+/),se={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},Vl=me(j({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Gl=function(){return typeof window>"u"?null:window},ql=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 On(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gl();const t=k=>On(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"),P=s&&s.prototype?_e(s.prototype,"nodeType"):null,I=s&&s.prototype?_e(s.prototype,"nodeName"):null,$=s&&s.prototype?_e(s.prototype,"ownerDocument"):null,O=function(p){return P?P(p):p.nodeType},L=function(p){return I?I(p):p.nodeName},H=Pl(b,"namespaceURI"),re=function(p){return H?H(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},$e=function(p){v(),ke++;try{return V.createScriptURL(p)}finally{ke--}},K=function(){return Ce||(ie=ql(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 Rn=="function"&&typeof S=="function"&&Re&&Re.createHTMLDocument!==void 0;const To=Rl,ct=Fl,De=Il,Me=zl,Co=Ol,Do=Nl,Po=Bl,Ao=Ul;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",We="http://www.w3.org/1999/xhtml";let Tt=We,Lo=!1,ei=null;const na=j({},[Jt,eo,We],Jo),aa=me(j({},["mi","mo","mn","ms","mtext"]));let zo=null;const la=me(j({},["annotation-xml"]));let Oo=null;const sa=me(st(null)),da=j({},["title","style","font","a","script"]);let zt=null;const pa=["application/xhtml+xml","text/html"],ca="text/html";let le=null,to=null;const ha=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=pa.indexOf(p.PARSER_MEDIA_TYPE)===-1?ca: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",na,{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=Al(p.ALLOWED_URI_REGEXP)?p.ALLOWED_URI_REGEXP:Ai,Tt=typeof p.NAMESPACE=="string"?p.NAMESPACE:We,zo=ar(p,"MATHML_TEXT_INTEGRATION_POINTS",aa),Oo=ar(p,"HTML_INTEGRATION_POINTS",la);const g=ar(p,"CUSTOM_ELEMENT_HANDLING",sa);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=K()),V&&typeof he=="string"&&(he=ee("")));to=me(p)},oi=j({},[...tr,...or,...Ml]),ri=j({},[...rr,..._l]),ua=function(p,g,w){return g===We?p==="svg":g===Jt?p==="svg"&&(w==="annotation-xml"||zo[w]):!!oi[p]},fa=function(p,g,w){return g===We?p==="math":g===eo?p==="math"&&Oo[w]:!!ri[p]},ga=function(p,g,w){return g===eo&&!Oo[w]||g===Jt&&!zo[w]?!1:!ri[p]&&(da[p]||!oi[p])},ma=function(p){const g=re(p),w=mt(L(p)),T=S(p);let F=Tt,N="template";return T&&O(T)===se.element&&(F=re(T),N=mt(L(T))),ei[g]?g===eo?ua(w,F,N):g===Jt?fa(w,F,N):g===We?ga(w,F,N):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(vl(g),w=>{try{E(w)}catch{}}),O(p)===se.element&&Ho(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{}},Ho=function(p,g){const w=z(p);if(w)for(let T=w.length-1;T>=0;--T){const F=w[T],N=F&&F.name;typeof N=="string"&&!(g&&J[le(N)])&&ii(p,F,N)}},Uo=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&&O(F)===se.element){const W=_(F);Dt(W)&&T.push(W)}const N=D(F);if(N)for(let W=N.length-1;W>=0;--W)T.push(N[W])}},$o=function(p){Uo(p,g=>{O(g)===se.element&&Ho(g,!0)})},Wo=function(p){const g=[];return Uo(p,w=>{g.push(w)},!0),g},ba=function(p,g){const w=Zo();Ze(Wo(p),T=>{O(T)===se.element&&Qo(w,T)}),Ze(g,T=>{O(T)===se.element&&!Bt(w,T)&&Ho(T,!0)})},ni=function(p,g){let w=!1;return Ze(t.removed,T=>{T.element&&(w=w||T.element===p,$o(T.element))}),ba(p,g),w},ya=8,va=function(p,g){const w=ut;let T=null;const F=()=>(T||(T=Zo(),Ze(g,N=>{Qo(T,N)})),T);for(let N=0;;N++){const W=Wo(p),ce=[p];let Xe=!1;if(Ze(W,Oe=>{O(Oe)===se.documentFragment?Nt(ce,Oe):!Xe&&!Bt(w,Oe)&&(Xe=Bt(F(),Oe))}),!Xe)return;if(N>=ya)throw Qe("the tree kept changing during in-place sanitization; refusing to return it");Ze(ce,(Oe,Pe)=>{xa(Oe,Pe>0,p,F())})}},xa=function(p,g,w,T){const F=oo(p);let N;for(;N=F.nextNode();)!Bt(T,N)||Bt(ut,N)||(g&&ze(Z.uponSanitizeShadowNode,N,null),qo(N,w))},wa=function(p){ut&&Qo(ut,p)},ai=function(p,g){return Le?p==="patchsrc"?!0:p==="for"&&g!=="label"&&g!=="output":!1},ka=function(p){Le&&Uo(p,g=>{const w=O(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 N=wl(p,Kl);w=N&&N[0]}zt==="application/xhtml+xml"&&Tt===We&&(p='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+p+"</body></html>");const T=V?ee(p):p;if(Tt===We)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===We?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=$?$(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!==P(p)||p.childNodes!==D(p)},si=function(p){if(!P||typeof p!="object"||p===null)return null;try{const g=P(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 Ea=function(p,g,w){return!!(Le&&w===se.element&&p.hasChildNodes()&&!Ot(p.firstElementChild)&&fe(nr,p.textContent)&&fe(nr,p.innerHTML)||Le&&Vl[g]&&w===se.element&&re(p)===We&&(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},Sa=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 N=F.length;for(let W=N-1;W>=0;--W){const ce=p===w?m(F[W],!0):F[W];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)},Ta=function(p,g){if(wa(p),ze(Z.beforeSanitizeElements,p,null),Pt(p,g))return!0;if(ro(p))return nt(p),!0;const w=le(L(p)),T=O(p);if(Q=di(Z.uponSanitizeElement,Q,rt,Xt),ze(Z.uponSanitizeElement,p,{tagName:w,allowedTags:Q}),Pt(p,g))return!0;if(Ea(p,w,T))return nt(p),!0;if(ht[w]||!(Ie.tagCheck instanceof Function&&Ie.tagCheck(w))&&!Q[w]){const F=Sa(p,w,g);return F===!1&&(ze(Z.afterSanitizeElements,p,null),Pt(p,g))?!0:F}if(T===se.element&&!ma(p)||(w==="noscript"||w==="noembed"||w==="noframes")&&fe($l,p.innerHTML))return nt(p),!0;if(te&&T===se.text){const F=p.textContent,N=Ko(F);F!==N&&(Nt(t.removed,{element:p.cloneNode()}),p.textContent=N)}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 ha))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},Ca=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!Ca[mt(p)]&&fe(Ao,p)},Da=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 $e(T)}return T},Pa=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(Wl,g)?!0:mt(p)==="attributename"&&er(g,"href")!==-1},Aa=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 N=le(L(p));for(;F--;){const W=w[F],ce=W.name,Xe=W.namespaceURI,Oe=W.value,Pe=le(ce),Ke=Oe;let ve=ce==="value"?Ke:kl(Ke),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,W),ve=Yr+ve,ui=!0),hi(ce,ve)){Ct(ce,p,W);continue}if(!T.forceKeepAttr){if(!T.keepAttr){Ct(ce,p,W);continue}if(!ye&&fe(_i,ve)){Ct(ce,p,W);continue}if(te&&(ve=Ko(ve)),!pi(N,Pe,ve)){Ct(ce,p,W);continue}ve=Da(N,Pe,Xe,ve),ve!==Ke&&Pa(p,ce,Xe,ve)&&ui&&ki(t.removed)}}ze(Z.afterSanitizeAttributes,p,null),Pt(p,g)},qo=function(p,g){Ta(p,g),Aa(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),O(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=O(T)===se.element,N=D(T);if(N)for(let W=N.length-1;W>=0;--W)g.push({node:N[W],shadow:null});if(F){const W=I?I(T):null;if(typeof W=="string"&&le(W)==="template"){const ce=T.content;Dt(ce)&&g.push({node:ce,shadow:null})}}if(F){const W=_(T);Dt(W)&&g.push({node:null,shadow:W},{node:W,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=Dl(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 N=Io&&typeof k!="string"&&Ot(k);let W=[];const ce=ut;if(N){ka(k);const Ke=L(k);if(typeof Ke=="string"){const ve=le(Ke);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");W=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=N?k:g;try{N&&jo(k);const Ke=oo(Xe);for(;T=Ke.nextNode();)qo(T,Xe);N&&va(k,W)}catch(Ke){throw N&&(Bo(k),ni(k,W)),Ke}finally{ut=ce}if(N){if(ni(k,W))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(Ll,Pe)&&(Go(g),Pe=Oe()),je&&Q["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&fe(Hl,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=yl(Z[k],p);return g===-1?void 0:xl(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 Yl=On();const jl={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function Xl(e,t){const o=e.options;return h.resolveBarcodeDesignValue(o.formatter,t,String(o.testData||o.title||""))||"1234567890128"}function Zl(e){return l("div",{class:"print-qrcode",dataset:{codeId:e.id,codeKind:"qrcode"}})}function Ql(e){const t=e.options;return l("div",{class:"print-barcode",dataset:{codeId:e.id,codeKind:"barcode"}},[l("svg",{preserveAspectRatio:jl[String(t.fit||"contain")]??"xMidYMid meet",style:{maxWidth:"100%",maxHeight:"100%"}})])}function Jl(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 es(e,t,o){const r=e.options,i=h.barcodeUnitsPerModule(r.barWidth),n=h.barcodeQuietZoneModules(r.barQuietZone),s=d=>{hn(t,Xl(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=Jl(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 ts(e,t,o){const r=e.options,i=h.resolveBarcodeDesignValue(r.formatter,o,String(r.testData||r.title||""))||B("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 os(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&&es(n,s,o)}else ts(n,r,o)}}const bo=new Map;function rs(e){return typeof Node<"u"&&e instanceof Node}function Nn(e,t,o){if(Bn(e),typeof t=="string"){o.innerHTML=t;return}if(rs(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 Bn(e){const t=bo.get(e);if(t){bo.delete(e);try{t()}catch{}}}function Fi(){for(const e of[...bo.keys()])Bn(e)}const is={header:"table.k450",data:"table.k451",subtotal:"table.k452",summary:"table.k453"},ns=[{value:"header",labelKey:"table.k454"},{value:"data",labelKey:"table.k455"},{value:"subtotal",labelKey:"table.k456"},{value:"summary",labelKey:"table.k457"}],co=3.7795275591,as=.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 ls(e,t){const o=e.tableSelection;return!o||o.elementId!==t.id?null:e.selectedElement?.id!==t.id?(e.tableSelection=null,null):o}function Hn(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:ls(e,o),maxTableWidth:Un(e),designData:r}}function Un(e){return e.paperSize.width-e.templateData.margins.left-e.templateData.margins.right}function Br(e){return e.options.tableDefaultFontSize??10}function $n(e){return e.options.tableDefaultColor??"#333333"}function ss(e,t){let o=0;for(let r=0;r<t;r++)o+=e.rows[r].height;return o}function ds(e,t){return ot(e.store).layouts.get(e.el.id)?.[t]?.top??ss(e,t)}function ps(e,t){return ot(e.store).layouts.get(e.el.id)?.[t]?.height??e.rows[t]?.height??0}function cs(e){const t=e.options.dataSource;if(t)return Array.isArray(h.DEFAULT_DEMO_DATA[t])?h.DEFAULT_DEMO_DATA[t]:void 0;for(const o of Object.values(h.DEFAULT_DEMO_DATA))if(Array.isArray(o))return o}function Wn(e){return e.cellType==="barcode"||e.cellType==="qrcode"}function Kn(e,t){return Wn(t)?h.resolveBarcodeDesignValue(t.formatter,cs(e)):t.formatter||""}function hs(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??$n(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 us(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 Vn(e){return h.resolveCellTextFit(e)}function fs(e){return Vn(e)!=="autoHeight"}function gs(e,t){return t.fontSize??Br(e)}function wo(e,t,o){return h.cellFitCapMm(e.rows,t,o,e.options.tableDefaultPadding??1)}function ms(e,t,o){return h.cellFitWidthMm(e.colWidths,t,o,e.options.tableDefaultPadding??1)}function bs(e,t,o){return{maxHeight:wo(e,o,t)+"mm",overflow:"hidden",...t.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}function ys(e,t,o){const r={fitBase:String(gs(e,t)),fitMin:String(h.resolveShrinkMinFontSize(t.shrinkMinFontSize)),fitMm:String(wo(e,o,t))};return Vn(t)==="shrink"&&(r.fit="shrink"),r}function vs(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 xs={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function ws(e,t,o,r){const i=document.createElement("div");i.className="cell-barcode";const n=document.createElementNS(Ia,"svg");i.appendChild(n);const s=Kn(e,r);if(r.cellType==="barcode"){n.setAttribute("preserveAspectRatio",xs[r.fit||"contain"]??"xMidYMid meet");const d=h.barcodeUnitsPerModule(r.barWidth),c=h.barcodeQuietZoneModules(r.barQuietZone),u=m=>{hn(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=vs(n);return E?{widthUnits:E.width,heightUnits:E.height}:null};let f=null;try{f=h.layoutBarcodeSize({barHeightMm:r.barHeight,boxWidthMm:h.barcodeAvailableBoxMm(ms(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=B("table.k459"),e}function ks(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 Es(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=ks(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 Ss(e,t,o,r,i){if(Wn(i))return ws(e,o,r,i);if(i.cellType==="image")return Es(e,o,i);const n=Kn(e,i),s=()=>t.type==="data"?l("span",{class:"data-placeholder",text:n}):n;return fs(i)?l("div",{class:"cell-fit",style:bs(e,i,o),dataset:ys(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 Ts(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 Cs(e,t,o){const r=ot(e.store).anchor;r&&yo(e,r,{r:t,c:o})}function Hr(e,t){const o=ot(e);o.menu?.visible&&(o.menu.visible=!1,t("table-menu-close",{elementId:o.menuElId}),e.emit(!1))}function Ds(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",()=>Hr(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?B("table.k460",{v0:Math.round(r*10)/10,v1:o}):null}function Ps(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){Hr(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&&Ps(e,i)&&e.fire(`table-${t}`,{elementId:e.el.id,...o?{type:o}:{}})}function As(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 Ms(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}),Hr(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 Ve(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 _s(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=Hn(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()},[Ve(a(n,"table.k467"),()=>Je(n,"insert-row-above")),Ve(a(n,"table.k468"),()=>Je(n,"insert-row-below")),Ve(a(n,"table.k469"),()=>Je(n,"delete-row"),{disabled:n.rows.length<=1}),lr(),Ve(a(n,"table.k470"),()=>Je(n,"insert-col-left")),Ve(a(n,"table.k471"),()=>Je(n,"insert-col-right")),Ve(a(n,"table.k472"),()=>Je(n,"delete-col"),{disabled:n.colWidths.length<=1}),lr(),Ve(a(n,"table.k473"),()=>Je(n,"merge"),{disabled:!!s,title:s||""}),Ve(a(n,"table.k474"),()=>Je(n,"split"),{disabled:!As(n)}),Ve(a(n,"table.k475"),()=>Ms(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")}),...ns.map(c=>Ve(B(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 Gn(){xt&&(document.removeEventListener("mousemove",Ur),document.removeEventListener("mouseup",$r),xt.handle.classList.remove("dragging"),xt=null)}function Rs(e,t){const o=e.closest(".hiprint-printPaper");return(o&&o.offsetWidth>0?o.getBoundingClientRect().width/o.offsetWidth:0)||(t.scale||100)/100}function Fs(e,t,o){if(o.button!==0)return;const r=o.currentTarget,i=r.closest(".print-table");if(!i)return;Gn();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:Rs(i,e.store),root:i,wrapper:r.closest(".print-element"),handle:r},r.classList.add("dragging"),e.store.recordHistory(),document.addEventListener("mousemove",Ur),document.addEventListener("mouseup",$r)}function Ur(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,Un(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",Ur),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 Is(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))>as&&(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);Ls(f.layouts.get(t),u)||(f.layouts.set(t,u),s=!0),s&&e.emit(!1)}function Ls(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 zs(e,t){const o=document.createComment("pd-table-measure");return requestAnimationFrame(()=>{if(!o.isConnected)return;const r=o.parentElement;r&&Is(e,t,r)}),o}function Os(e){return e.isSelected&&!e.real.options.locked&&e.colWidths.length>=1}function Ns(e){return Array.from({length:e.colWidths.length},(t,o)=>o+1)}function Bs(e,t){return e.colWidths.slice(0,t).reduce((o,r)=>o+r,0)}function Hs(e,t,o,r){const i=Hn(t,o,e,r);if(!i)return l("div",{class:"print-table"});const n=[l("table",{style:{fontSize:`${Br(i)}pt`,color:$n(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:us(i,d,u),style:hs(i,c),onMousedown:f=>Ts(i,d,u,c.id,f),onMouseenter:()=>Cs(i,d,u),onContextmenu:f=>Ds(i,d,u,f)},[Ss(i,s,d,u,c)])).filter(Boolean))))])];return Os(i)&&n.push(l("div",{class:"col-resize-layer"},Ns(i).map(s=>l("div",{class:"col-resize-handle",role:"separator","aria-label":a(i,"table.k477",{v0:s}),style:{left:Bs(i,s)+"mm"},onMousedown:d=>{d.stopPropagation(),d.preventDefault(),Fs(i,s,d)}})))),i.isSelected&&n.push(l("div",{class:"row-badges"},i.rows.map((s,d)=>l("span",{class:"row-badge",style:{top:ds(i,d)+"mm",height:ps(i,d)+"mm"},text:B(is[s.type])})))),n.push(zs(t,e.id)),l("div",{class:"print-table design-mode",dataset:{tableId:e.id},onContextmenu:s=>s.preventDefault()},n)}const Us=["flowList.k44","flowList.k45","flowList.k46","flowList.k47","flowList.k48","flowList.k49","flowList.k50"];function $s(){return Us.map(e=>B(e))}function wr(e){return Array.isArray(e)&&e.length>0?e:[]}function Ws(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 Ks(e,t){const o=e.options,r=typeof o.formatter=="string"?o.formatter:"",i=wr(t)[0],n=Ws(r,i);if(n.length===0)return $s();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 Vs=3.7795275591,Gs=.1;function qs(e,t){return e.templateData.elements.find(o=>o.id===t)??null}function Ys(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 js(e,t,o){const r=o.offsetHeight+Ys(o);if(r<=0)return;const i=qs(e,t);if(!i)return;const n=r/Vs;Math.abs(n-(i.options.height??0))>Gs&&(i.options.height=Math.round(n*100)/100,e.emit(!1))}function Xs(e,t){const o=document.createComment("pd-flowlist-measure");return requestAnimationFrame(()=>{if(!o.isConnected)return;const r=o.parentElement;r&&js(e,t,r)}),o}function Zs(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=Ks(e,t).map(b=>l("div",{class:"print-flow-cell",text:b}));return d&&o&&f.push(Xs(o,e.id)),l("div",{class:"print-flowlist",style:u},f)}const Bi={top:"flex-start",middle:"center",bottom:"flex-end"},Qs={left:"flex-start",center:"center",right:"flex-end"};function Js(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,...ed(e,t)}}function ed(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 Hi(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=Qs[t.textAlign||"left"]??"flex-start")),{style:s,fit:r}}function Ui(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 td(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 od={text:e=>{const{style:t}=Hi(e),o=e.options;return l("div",{class:"print-text",style:t,dataset:Wi(e),text:String(o.testData||o.formatter||"")||B("elements.k41")})},longText:e=>{const{style:t}=Hi(e),o=e.options;return l("div",{class:"print-longtext",style:t,dataset:Wi(e),text:String(o.formatter||"")||B("elements.k42")})},hline:e=>l("div",{class:"print-line",style:Ui(e)}),vline:e=>l("div",{class:"print-line",style:Ui(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:td(e)}):l("div",{class:"image-placeholder",text:B("elements.k43")})])},qrcode:e=>Zl(e),barcode:e=>Ql(e),html:e=>{const t=e.options,o=String(t.formatter??""),r=o?Yl.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?Hs(e,o.store,o.fire,o.designData):l("div",{class:"print-table"}),flowList:(e,t,o)=>Zs(e,void 0,o?.store)};xn(od);function rd(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{Nn(`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 qn(e){return`x:${Math.round(e.left)} y:${Math.round(e.top)} ${Math.round(e.width)}×${Math.round(e.height)}mm`}function id(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=[rd(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:qn(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:Js(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 nd='<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 ad(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=>id(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 ld(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?B("canvas.k13"):t.dataset.dropLabelIntent?B("canvas.k14"):B("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 Yn(e){e&&(e.querySelector(".drop-hint")?.remove(),delete e.dataset.dropLabelIntent)}function sd(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(nd)}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}}):"",...r.watermark&&Object.keys(r.watermark).length?[ad(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"),ld(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";Yn(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 dd(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??B("fontSelect.k51"),r=`font-select-list-${e.id}`,i=L=>{const H=L?.trim();return H?R.findFontOption(t,H)?.label??H:""},n=L=>{const H=R.normalizeFontQuery(L);return t.find(V=>V.label&&R.normalizeFontQuery(V.label)===H)?.family??L},s=()=>{const L=e.value?.trim();return L?R.findFontOption(t,L)?"":L:""},d=L=>{const H=(e.value??"").trim(),re=(ie,Ce,ke,v)=>({kind:ie,key:Ce,label:ke,value:v,selected:(v??"")===H}),V=L.trim();if(!V){const ie=[re("clear","__clear__",o)],Ce=s();Ce&&ie.push(re("unknown","__unknown__",B("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__",B("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(H=>(H.value??"")===L)},C=()=>{const L=u.getBoundingClientRect(),H=dd(u);f.classList.toggle("is-up",h.resolveOverlayPlacement({triggerTop:L.top,triggerBottom:L.bottom,overlayHeight:f.getBoundingClientRect().height,boundaryTop:H.top,boundaryBottom:H.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((H,re)=>{const V=document.createElement("li");return V.id=`${r}-${re}`,V.className="font-select-option"+(re===m.highlighted?" is-active":"")+(H.kind==="unknown"||H.kind==="free"?" is-muted":""),V.setAttribute("role","option"),V.setAttribute("aria-selected",String(H.selected)),V.textContent=H.label,V.addEventListener("mousedown",he=>{he.preventDefault(),$(H)}),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()},P=L=>{if(!m.open){S();return}const H=d(m.query).length-1;if(H<0)return;m.highlighted=Math.min(Math.max(m.highlighted+L,0),H),E(),D(),f.children[m.highlighted]?.scrollIntoView?.({block:"nearest"})},I=()=>{if(!m.open)return;const L=d(m.query)[m.highlighted];if(L){$(L);return}const H=m.query.trim();if(H){const re=n(H);$({value:re})}},$=L=>{m.open=!1,m.query="",m.highlighted=-1,E(),u.value=i(L.value),D(),e.onChange(L.value)},O=()=>{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",O),u.addEventListener("keydown",L=>{const H=L;H.key==="ArrowDown"?(H.preventDefault(),P(1)):H.key==="ArrowUp"?(H.preventDefault(),P(-1)):H.key==="Enter"?(H.preventDefault(),I()):H.key==="Escape"&&(H.preventDefault(),O())}),c.append(u),D(),m.open&&(u.focus(),u.setSelectionRange(m.query.length,m.query.length)),c}const pd=[{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"}],cd={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 hd(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"},pd.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"},[U({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"}},[U({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:cd[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 ud="1.6.6";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 fd(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",bd(e),"material-grid"),o("fields",[yd(e)]),o("layers",[xd(e)])])])}function Gi(e,t,o){return l("button",{type:"button",class:"collapse-btn",title:t,html:Eo(e,14),onClick:o})}const jn={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"},gd={barChart:"elementGroup.chart"};function md(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 bd(e){const t=[];let o;for(const r of kn()){const i=r.group;if(i&&i!==o){const c=gd[r.type];t.push(l("div",{class:"material-group-title",text:c?a(e,c):i}))}i&&(o=i);const n=jn[r.type],s=n?a(e,n):void 0,d=s&&s!==n?s:void 0;t.push(md(r.type,r.label,r.icon,d))}return[l("div",{class:"panel-title",text:a(e,"panels.k146")}),...t]}function yd(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 vd(e,t){if(e.options.title)return e.options.title;const o=jn[e.printElementType.type];return o?a(t,o):e.printElementType.title||e.printElementType.type}function xd(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=Tn(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:vd(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 wd(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 kd(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${ud}`}),l("span",{class:"status-item status-paper",text:c})])}const Ed=Object.keys(h.PAPER_PRESETS).filter(e=>e!=="CUSTOM"&&!h.PAPER_PRESETS[e]?.continuous);function Sd(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 Td(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})})])]:Sd(e)].flat())}function Cd(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})}},[...Ed.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"},[U({value:Number(i.sheetCustomWidth??0),min:25,max:2e3,onCommit:y=>s({sheetCustomWidth:y})}),l("span",{class:"custom-size-x",text:"×"}),U({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"),U({value:i.sheetMargin.top??0,min:0,max:100,onCommit:y=>u("top",y)}),void 0,c("top")),q(a(e,"pageExtras.k130"),U({value:i.sheetMargin.bottom??0,min:0,max:100,onCommit:y=>u("bottom",y)}),void 0,c("bottom")),q(a(e,"pageExtras.k131"),U({value:i.sheetMargin.left??0,min:0,max:100,onCommit:y=>u("left",y)}),void 0,c("left")),q(a(e,"pageExtras.k132"),U({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"),U({value:i.gapX??0,min:0,max:50,onCommit:y=>s({gapX:y??0})}),void 0,d("gapX")),q(a(e,"pageExtras.k135"),U({value:i.gapY??0,min:0,max:50,onCommit:y=>s({gapY:y??0})}),void 0,d("gapY")),q(a(e,"pageExtras.k136"),U({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 Dd=new Set(h.PROPERTY_REGISTRY.map(e=>e.group)),Pd={"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=Pd[e]??e;return Dd.has(t)?t:""}function Ad(e,t){const o=Wr(e.state.propSearch);if(!o.searching)return!0;const r=Kr(t);return!r||o.groups.includes(r)}function Md(e,t){const o=Wr(e.state.propSearch);return!o.searching||o.keys.has(t)}function Xn(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},Xn(o,Md(e,t))}function _d(e,t,o){const r=Kr(t);if(!r)return o;const i=o.props.dataset??{};return o.props.dataset={...i,propGroup:r},Xn(o,Ad(e,t))}function Zn(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 Rd(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,Zn(o.getRootNode(),r)}})])}const Fd={Document:"≡",Brush:"◧",Setting:"⚙"};function Id(e,t){try{const o=window.localStorage.getItem(`property-group-${e}`);return o===null?t:o==="true"}catch{return t}}function Ld(e,t){try{window.localStorage.setItem(`property-group-${e}`,String(t))}catch{}}function Te(e,t,o,r,i,n=!0,s=[]){const d=Id(t,n);return _d(e,t,l("div",{class:`property-group${d?" is-expanded":""}`},[l("div",{class:"group-header",onClick:()=>{Ld(t,!d),e.repaint()}},[l("span",{class:"group-icon",text:Fd[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 Qn(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 Qn(t).reduce((i,n)=>i==null?"":i[n],e)??""}function Vr(e,t,o,r){const i=Qn(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 zd(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 Od(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 Nd(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",[...zd(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"?Od(e,t):""].filter(Boolean))}const Ut=new Map;function lo(e){return`${Math.round(e*1e4)/1e4}%`}function Jn(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=Ut.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)),U({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}),U({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=Ut.get(s.src);S&&S.width===D.naturalWidth&&S.height===D.naturalHeight||(Ut.set(s.src,{width:D.naturalWidth,height:D.naturalHeight}),e.repaint())},onError:()=>{Ut.has(s.src)&&(Ut.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 ea(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)),bn(t,o,r,{className:"pd-select",...i.full?{width:"100%"}:{}})])}const _t=e=>l("p",{class:"pd-hint",text:e});function ta(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 Bd="tableProps.k330",Hd=[{value:"header",labelKey:"tableProps.k331"},{value:"data",labelKey:"tableProps.k332"},{value:"subtotal",labelKey:"tableProps.k333"},{value:"summary",labelKey:"tableProps.k334"}],Ud=[{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"}],$d=[{value:"L",labelKey:"tableProps.k337"},{value:"M",labelKey:"tableProps.k338"},{value:"Q",label:"Q"},{value:"H",labelKey:"tableProps.k339"}],Wd=[{value:"clip",labelKey:"tableProps.k340"},{value:"shrink",labelKey:"tableProps.k341"},{value:"autoHeight",labelKey:"tableProps.k342"}],Kd={value:"__multi__",labelKey:"tableProps.k343",disabled:!0};function Vd(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([ea(a(e,"tableProps.k346"),n.type,ta(Hd,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")}),U({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,Bd)):""])])}function Gd(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([ea(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")]),U({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")]),U({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})}),U({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 qd(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 Yd(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,P=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)),$=!f&&!I,O={width:$?0:typeof P.width=="number"?P.width:h.DEFAULT_BORDER.width,style:$?"none":typeof P.style=="string"&&P.style!=="mixed"?P.style:h.DEFAULT_BORDER.style,color:typeof P.color=="string"&&P.color!=="mixed"?P.color:h.DEFAULT_BORDER.color,...E.border},L="__mixed__",H={style:!f&&P.style==="mixed",width:!f&&P.width==="mixed",color:!f&&P.color==="mixed"},re=H.style&&!("style"in E.border),V=H.width&&!("width"in E.border),he=H.color&&!("color"in E.border),ie=re||V||he,Ce=re?L:O.style,ke=V?void 0:O.width,v=he?void 0:O.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=()=>({...O}),$e=f?ji.reduce((x,G)=>(x[G.value]=E.edges[G.value]?"on":"off",x),{}):h.resolveBorderEdgeStates(d().map(x=>x.borders)),K=f?"cellType"in E.values?E.values.cellType??"text":h.resolveSharedCellType(i,r):s.cellType??"text",ae=K==="barcode",Re=K==="qrcode",Fe=K==="image",qe=K==="text",Y=ae&&!!_("printerDpi"),Ye=h.barcodeBarWidthRecommendText(_("printerDpi"),_("barWidth"),e.t??B),Z=f?E.values.textFit:h.resolveCellTextFit(s),To=f?"cellType"in E.values?E.values.cellType??"text":"":s.cellType||"text",ct=x=>ta(f?[Kd,...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)),U({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(Ud),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"),U({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"),U({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($d),x=>{x!=="__multi__"&&S("qrCodeLevel",x||void 0)},{reset:X("qrCodeLevel")}):"",Re?xe(a(e,"tableProps.k400"),U({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??B)),x=>{x!=="__multi__"&&S("fit",x)},{reset:X("fit")}):"",Fe&&!f&&s.fit==="cover"?Jn(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"},[bn(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"}},[U({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,O.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:$e[x.value]==="on",indeterminate:$e[x.value]==="mixed",onChange:G=>{const te=G.target.checked&&O.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(Wd),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 jd(e){return e?e.mode==="binding"?e.binding??"":e.content??"":""}function Xd(e){const t=e.store.templateData.watermark,o=jd(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,U({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 Zd=[{value:"all",labelKey:"propertyPanel.k177"},{value:"outer",labelKey:"propertyPanel.k178"},{value:"inner",labelKey:"propertyPanel.k179"},{value:"none",labelKey:"propertyPanel.k180"}],Qd=[{value:"top",labelKey:"propertyPanel.k181"},{value:"right",labelKey:"propertyPanel.k182"},{value:"bottom",labelKey:"propertyPanel.k183"},{value:"left",labelKey:"propertyPanel.k184"}];function Jd(e,t){const o=e.store,r=t.options,i=t.printElementType.type,n=v=>o.updateElement(t.id,v),s=En(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(Nd(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"},[U({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"))),P=_||S?"":l("p",{class:"pd-hint pd-rotate-note",text:h.codeObliqueNote(e.t??B)});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"),U({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"),U({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,P]:[i==="image"?M(e,"ap-img-fit",et(e,a(e,"propertyPanel.k230"),String(r.fit??"contain"),h.imageFitOptions(e.t??B),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",Jn(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,P,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):"",$e=h.barcodeBarWidthRecommendText(r.printerDpi,r.barWidth,e.t??B);m.push(Te(e,"code",a(e,"propertyPanel.k233"),"Postcard",[l("form",{class:"pd-form",onSubmit:K=>K.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"}],K=>n({barcodeType:K==="CODE128"?void 0:K}))),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")}],K=>n({printerDpi:Number(K)>0?Number(K):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,K=>n({barWidth:K}),{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"))+($e?`。${$e}`:"")})),M(e,"cd-bar-quiet-zone",xe(a(e,"propertyPanel.k246"),U({value:r.barQuietZone,min:0,max:20,placeholder:a(e,"propertyPanel.k247"),onCommit:K=>n({barQuietZone:K})}),a(e,"propertyTips.cd-bar-quiet-zone"),y("barQuietZone","cd-bar-quiet-zone"))),M(e,"cd-bar-height",xe(a(e,"propertyPanel.k248"),U({value:r.barHeight,min:1,max:100,placeholder:a(e,"propertyPanel.k249"),onCommit:K=>n({barHeight:K??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,K=>n({hideTitle:K?void 0:!0}),y("hideTitle","cd-show-text"))),M(e,"cd-font-size",q(a(e,"propertyPanel.k251"),U({value:r.fontSize,min:5,max:24,placeholder:a(e,"propertyPanel.k252"),onCommit:K=>n({fontSize:K||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")}],K=>n({qrCodeLevel:K}),void 0,y("qrCodeLevel","cd-ec-level"))),M(e,"cd-quiet-zone",xe(a(e,"propertyPanel.k257"),U({value:r.qrQuietZone,min:0,max:8,placeholder:a(e,"propertyPanel.k258"),onCommit:K=>n({qrQuietZone:K})}),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??B),K=>n({fit:K||void 0}),void 0,y("fit","cd-fit"))),M(e,"cd-max-width",q(a(e,"propertyPanel.k262"),U({value:r.maxWidth,min:1,max:200,placeholder:a(e,"propertyPanel.k263"),onCommit:K=>n({maxWidth:K||void 0})}),void 0,y("maxWidth","cd-max-width"))),M(e,"cd-max-height",q(a(e,"propertyPanel.k264"),U({value:r.maxHeight,min:1,max:200,placeholder:a(e,"propertyPanel.k265"),onCommit:K=>n({maxHeight:K||void 0})}),void 0,y("maxHeight","cd-max-height")))].flat().filter(Boolean))]))}if(f&&(m.push(Vd(e,t)),m.push(Yd(e,t))),u&&m.push(Gd(e,t)),i==="flowList"){const v=h.resolveFlowColumns(r.flowColumns),ee=h.resolveFlowRowHeight(r.flowRowHeight),be=h.resolveFlowGapX(r.flowGapX),$e=h.resolveFlowMaxSpan(r.flowMaxSpan,v),K=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"),U({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"),U({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"),U({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"),U({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"),U({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"),U({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"),U({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:$e}:{flowAutoSpan:Y})})),r.flowAutoSpan===!0?M(e,"fl-max-span",xe(a(e,"propertyPanel.k278"),U({value:$e,min:1,max:v,onCommit:Y=>n({flowMaxSpan:h.resolveFlowMaxSpan(Y,v)})}),a(e,"propertyTips.fl-max-span"))):"",v>K?l("p",{class:"pd-hint",text:a(e,"propertyPanel.k279",{v0:v,v1:K,v2:v})}):""].flat().filter(Boolean))]))}const I=()=>({borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:r.borders}),$=v=>{const ee=I();h.applyElementBorderPreset(ee,v,h.effectiveElementBorderSpec(ee)),n(ee)},O=v=>{const ee=I();h.setElementBorderEdgeVisible(ee,v,!h.elementBorderEdgeVisible(ee,v)),n(ee)},L=h.resolveElementBorderDisplay(r),H=L.style==="mixed",re=typeof L.width=="number"?L.width:void 0,V=H||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=H?[{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"},Zd.map(v=>l("button",{type:"button",class:"pd-button small",text:a(e,v.labelKey),disabled:v.value==="inner",onClick:()=>$(v.value)}))),l("div",{class:"pd-checkbox-group"},Qd.map(v=>l("label",{class:"pd-checkbox"},[l("input",{type:"checkbox",checked:h.elementBorderEdgeVisible(r,v.value),onChange:()=>O(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(qd(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 ep(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"},[U({value:Number(o.customWidth??0),min:25,max:2e3,onCommit:c=>r({customWidth:c})}),...s?[l("span",{class:"custom-size-x",text:"×"}),U({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})})),Td(e),t.pages.length>1?"":Cd(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}),Xd(e)].filter(Boolean))}function tp(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{Nn(`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(),openExpression:(s,d)=>e.fire("open-plugin-expression",{target:s,onApply:d}),t:e.t??B}),n)}catch{}return l("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:custom"},style:e.state.propTab==="custom"?"":{display:"none"}},[n])}function op(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?tp(e,r,i):"",l("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:element"},style:n==="element"?"":{display:"none"}},r?[Rd(e),Jd(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"}},[ep(e)])].filter(Boolean))])}var A=we.t,rp={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 ip(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">${rp[e]??""}</svg>`}function ho(e){const t=typeof e=="string"?e.trim().toLowerCase():"";return t==="label"||t==="key"||t==="both"?t:"both"}function cr(e=!1){const t=[{key:"field",text:A("expression.tabField")},{key:"variable",text:A("expression.tabVariable")},{key:"function",text:A("expression.tabFunction")}];return e?t.slice(0,1):t}function Xi(){return{field:A("expression.placeholderField"),variable:A("expression.placeholderVariable"),function:A("expression.placeholderFunction")}}function np(){return[{name:"SUM",label:A("expression.fnSum"),template:"SUM()"},{name:"AVG",label:A("expression.fnAvg"),template:"AVG()"},{name:"COUNT",label:A("expression.fnCount"),template:"COUNT()"},{name:"MIN",label:A("expression.fnMin"),template:"MIN()"},{name:"MAX",label:A("expression.fnMax"),template:"MAX()"}]}function ap(){return[{name:"ADD",label:A("expression.fnAdd"),template:"ADD()"},{name:"SUB",label:A("expression.fnSub"),template:"SUB()"},{name:"MUL",label:A("expression.fnMul"),template:"MUL()"},{name:"DIV",label:A("expression.fnDiv"),template:"DIV()"},{name:"ROUND",label:A("expression.fnRound"),template:"ROUND()"},{name:"ROUNDUP",label:A("expression.fnRoundUp"),template:"ROUNDUP()"},{name:"ROUNDDOWN",label:A("expression.fnRoundDown"),template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:A("expression.fnRoundBank"),template:"ROUNDBANK()"}]}function lp(){return[{name:"MONEY",label:A("expression.fnMoney"),template:"MONEY()"},{name:"DATE",label:A("expression.fnDate"),template:"DATE()"},{name:"UPPER",label:A("expression.fnUpper"),template:"UPPER()"},{name:"IF",label:A("expression.fnIf"),template:"IF()"}]}function sp(){return[{name:"pageIndex",label:A("expression.varPageIndex"),template:"{pageIndex}"},{name:"totalPages",label:A("expression.varTotalPages"),template:"{totalPages}"},{name:"printDate",label:A("expression.varPrintDate"),template:"{printDate}"},{name:"printTime",label:A("expression.varPrintTime"),template:"{printTime}"}]}function dp(){return[{title:A("expression.groupAggregate"),items:np()},{title:A("expression.groupMath"),items:ap()},{title:A("expression.groupFormat"),items:lp()}]}var pp="expression.previewEmpty",cp="expression.previewNoValue",Tr="expression.previewError";function Zi(e,t){if(!e.trim())return A(pp);try{const o={...h.DEFAULT_DEMO_DATA,...t??{},...R.resolveSystemVariables()},r=h.evaluateTemplate(e,o);return r==null?A(cp):String(r)}catch{return A(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 hp(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 Ji=e=>/[\u4e00-\u9fff]/.test(e),en=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 Be(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:A("expression.k1")}),l("div",{class:"ee-help-grid"},[so("ee-help-field",A("expression.k2"),[A("expression.k3"),A("expression.k4"),A("expression.k5"),A("expression.k6"),A("expression.k7"),A("expression.k8"),A("expression.k9")]),so("ee-help-function",A("expression.k10"),[A("expression.k11"),A("expression.k12"),A("expression.k13"),A("expression.k14"),A("expression.k15"),A("expression.k16")]),so("ee-help-variable",A("expression.k17"),[A("expression.k18"),A("expression.k19"),A("expression.k20")]),so("ee-help-conditional",A("expression.k21"),[A("expression.k22"),A("expression.k23"),A("expression.k24"),A("expression.k25"),A("expression.k26")])])])}function gp(e,t){A=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===A(Tr))},s=S=>{const _=i(S,".ee-key-hint");_&&(_.textContent=r.keyHint,_.style.display=r.keyHint?"":"none")},d=()=>{if(r.activeTab==="variable")return Qi(sp(),r.searchText).map(z=>l("div",{class:"ee-list-item",onDblclick:P=>{const{insideParens:I}=f(P);b(Be(P),I?z.template.replace(/^\{|\}$/g,""):z.template,void 0,"")}},[hr(z.label,z.template)]));if(r.activeTab==="function")return dp().map(z=>l("div",{class:"ee-func-group"},[l("div",{class:"ee-func-group-title",text:z.title}),...Qi(z.items,r.searchText).map(P=>l("div",{class:"ee-list-item",onDblclick:I=>{const{insideBlock:$}=f(I),O=$?P.template:`{${P.template}}`;b(Be(I),O,O.indexOf("(")+1,"")}},[hr(P.label,`${P.name}()`)]))]));const S=h.filterGroups(h.groupFields(e.fields??[]),r.searchText);if(!S.length)return[l("p",{class:"pd-empty",text:A("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 P of z.fields)_.push(l("div",{class:"ee-list-item ee-field-item",style:{paddingLeft:z.key?"22px":"10px"},onClick:I=>{if(!t.fieldOnly)return;r.expression=`{${P.fieldKey}}`;const $=Be(I),O=i($,".ee-textarea");O&&(O.value=r.expression,O.focus(),O.selectionStart=O.selectionEnd=r.expression.length),r.keyHint=Ji(P.fieldKey)?en(P.fieldKey):"",n($),s($)},onDblclick:I=>{if(t.fieldOnly)return;const{insideParens:$}=f(I),O=I;if(O.ctrlKey||O.metaKey){const L=P.fieldLabel||P.fieldKey;b(Be(I),$?`"${L}"`:L,void 0,"");return}b(Be(I),$?P.fieldKey:`{${P.fieldKey}}`,void 0,Ji(P.fieldKey)?en(P.fieldKey):"")}},[hr(P.fieldLabel||P.fieldKey,P.fieldKey,o),l("button",{type:"button",class:`ee-copy-btn${r.copiedFieldKey===P.fieldKey?" is-copied":""}`,"data-tip":r.copiedFieldKey===P.fieldKey?A("expression.k28"):`复制字段名「${P.fieldLabel}」`,"aria-label":`复制字段名 ${P.fieldLabel}`,html:ip(r.copiedFieldKey===P.fieldKey?"Check":"Copy",13),onClick:I=>{I.stopPropagation(),u(I,P)},onDblclick:I=>I.stopPropagation()})]))}return _},c=S=>{Array.from(S.querySelectorAll(".ee-nav-tab")).forEach(($,O)=>$.classList.toggle("active",cr(t.fieldOnly)[O]?.key===r.activeTab));const z=i(S,".ee-content-search .pd-input");if(z){const $=Xi()[r.activeTab];z.placeholder!==$&&(z.placeholder=$),z.value!==r.searchText&&(z.value=r.searchText)}const P=i(S,".ee-textarea");P&&P.value!==r.expression&&(P.value=r.expression);const I=i(S,".ee-content-list");if(I){un(I);for(const $ of d())Se($,I)}n(S),s(S)};function u(S,_){const z=Be(S);h.copyTextToClipboard(_.fieldLabel||_.fieldKey).then(P=>{P&&(r.copiedFieldKey=_.fieldKey,c(z),setTimeout(()=>{r.copiedFieldKey===_.fieldKey&&(r.copiedFieldKey="",c(z))},1200))})}const f=S=>{const z=i(Be(S),".ee-textarea")?.selectionStart??r.expression.length;return hp(r.expression,z)},b=(S,_,z=_.length,P)=>{P!==void 0&&(r.keyHint=P);const I=i(S,".ee-textarea");if(!I){r.expression+=_,n(S),s(S);return}const $=I.selectionStart??r.expression.length,O=I.selectionEnd??$;r.expression=r.expression.substring(0,$)+_+r.expression.substring(O);const L=$+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:A("expression.k29")}),l("div",{class:"ee-nav-tabs"},cr(t.fieldOnly).map((S,_)=>l("div",{class:`ee-nav-tab${r.activeTab===S.key?" active":""}`,text:S.text,onClick:z=>{r.activeTab=cr(t.fieldOnly)[_].key,c(Be(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(Be(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:A("expression.k30")}),l("textarea",{class:"ee-textarea",rows:6,placeholder:A("expression.k31"),text:r.expression,onInput:S=>{r.expression=S.target.value,r.keyHint="",n(Be(S)),s(Be(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:A("expression.k32")}),l("div",{class:`ee-preview${C===A(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:A("expression.k33")}),l("button",{type:"button",class:"pd-close","aria-label":A("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:A("expression.k35"),onClick:()=>e.onClose()}),l("button",{type:"button",class:"pd-button primary",text:A("expression.k36"),onClick:()=>m()})])])])}const mp={id:"getting-started",title:"快速入门",content:`
4
4
  <h2>界面布局</h2>
5
5
  <p>打印模板设计器采用三栏布局:</p>
6
6
  <ul>
@@ -464,6 +464,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
464
464
  <p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
465
465
  </blockquote>
466
466
  `},wp={id:"changelog",title:"更新记录",content:`
467
+ <h2>V1.6.5<small>(2026-11-25)</small></h2>
468
+
469
+ <h3>修复</h3>
470
+ <ul>
471
+ <li><strong>混合方向多页预览</strong>:预览截图按目标页纸张出图,消除 page=N 串页与纸张尺寸按首页计算的问题;单页路径回退行为不变。</li>
472
+ </ul>
473
+
474
+ <h3>改进</h3>
475
+ <ul>
476
+ <li><strong>图表字段选择</strong>:统一为表达式弹框(仅字段页签),取消默认赋值,避免未绑定字段被写入模板。</li>
477
+ </ul>
478
+
467
479
  <h2>V1.6.4<small>(2026-11-24)</small></h2>
468
480
 
469
481
  <h3>修复</h3>
@@ -1273,6 +1285,18 @@ to keep a number of decimals use <code>ROUND</code> (half up), <code>ROUNDUP</co
1273
1285
  <h2>Can I use charts and other custom elements?</h2>
1274
1286
  <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>
1275
1287
  `},Dp={id:"changelog",title:"Release Notes",content:`
1288
+ <h2>V1.6.5<small>(2026-11-25)</small></h2>
1289
+
1290
+ <h3>Fixed</h3>
1291
+ <ul>
1292
+ <li><strong>Mixed-orientation previews</strong>: screenshots now use the target page's paper size, eliminating cross-page results and wrong dimensions when requesting page=N; single-page behavior is unchanged.</li>
1293
+ </ul>
1294
+
1295
+ <h3>Changed</h3>
1296
+ <ul>
1297
+ <li><strong>Chart field selection</strong>: unified into the expression editor dialog (field tab only), with no default values assigned automatically.</li>
1298
+ </ul>
1299
+
1276
1300
  <h2>V1.6.4<small>(2026-11-24)</small></h2>
1277
1301
 
1278
1302
  <h3>Fixed</h3>
@@ -1799,6 +1823,18 @@ to keep a number of decimals use <code>ROUND</code> (half up), <code>ROUNDUP</co
1799
1823
  <h2>ฉันสามารถใช้แผนภูมิและองค์ประกอบกำหนดเองอื่นได้หรือไม่?</h2>
1800
1824
  <p>ได้ ปลั๊กอินเสริมเช่นชุดแผนภูมิ ECharts จะลงทะเบียนประเภทองค์ประกอบเพิ่มเติม เมื่อติดตั้งแล้วจะปรากฏในแผงทรัพยากรและมีแท็บ "คุณสมบัติที่กำหนดเอง" เมื่อเลือก</p>
1801
1825
  `},Fp={id:"changelog",title:"บันทึกการเปิดตัว",content:`
1826
+ <h2>V1.6.5<small>(2026-11-25)</small></h2>
1827
+
1828
+ <h3>แก้ไข</h3>
1829
+ <ul>
1830
+ <li><strong>ตัวอย่างหน้าหลายหน้าแบบผสมทิศทาง</strong>: ภาพตัวอย่างใช้ขนาดกระดาษของหน้าที่ต้องการ แก้ปัญหาผลลัพธ์ข้ามหน้าและขนาดกระดาษผิดเมื่อระบุ page=N; การทำงานของหน้าเดียวยังคงเดิม</li>
1831
+ </ul>
1832
+
1833
+ <h3>เปลี่ยนแปลง</h3>
1834
+ <ul>
1835
+ <li><strong>การเลือกฟิลด์แผนภูมิ</strong>: รวมเป็นหน้าต่างตัวแสดงนิพจน์ (เฉพาะแท็บฟิลด์) และไม่กำหนดค่าเริ่มต้นโดยอัตโนมัติ</li>
1836
+ </ul>
1837
+
1802
1838
  <h2>V1.6.4<small>(2026-11-24)</small></h2>
1803
1839
 
1804
1840
  <h3>แก้ไข</h3>
@@ -2021,5 +2057,5 @@ to keep a number of decimals use <code>ROUND</code> (half up), <code>ROUNDUP</co
2021
2057
  <ul>
2022
2058
  <li>เปิดตัวครั้งแรกของตัวออกแบบเทมเพลตการพิมพ์</li>
2023
2059
  </ul>
2024
- `},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(`
2025
- `)})))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;
2060
+ `},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 oa="worm-print-help-tab",Np="getting-started";function tn(e,t){return e.some(o=>o.id===t)?String(t):""}function Bp(e,t){let o=null;try{o=window.localStorage.getItem(oa)}catch{o=null}return tn(e,t)||tn(e,o)||Np}function Hp(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(oa,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 Up(e,t){const o=Se(Hp(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 on=new WeakMap;function rn(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")&&on.set(C,{parent:D,next:C.nextSibling}),s.set(C.dataset.unit,C)}for(const C of s.values()){const D=on.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,_);nn(C,z,b,!0),nn(C,z,b,!1),an(C,0,m),an(C,t.paperLengthMM,m);const P=t.cursorPx??null;if(P!==null&&P>=0&&P<=d){if(n.strokeStyle=m,n.lineWidth=1.5,n.beginPath(),o){const I=Math.round(P)+.5;n.moveTo(I,0),n.lineTo(I,c)}else{const I=Math.round(P)+.5;n.moveTo(0,I),n.lineTo(c,I)}n.stroke()}}function ra(e,t){return Math.round(e.originPx+t*e.pxPerMM)+.5}function nn(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=ra(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 an(e,t,o){const{ctx:r,horizontal:i,thickness:n,viewportPx:s}=e,d=ra(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 ln(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"]),sn="print-studio:left",dn="print-studio:right";function pn(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function cn(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;exprApply;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"?ln(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?ln(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 gn(t),this.format=new Ba(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(pl))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=pn(sn),this.state.propCollapsed=pn(dn),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,cn(sn,this.state.leftCollapsed),cn(dn,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),Gn(),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=vn(()=>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(`
2061
+ `)})))return;const i=JSON.stringify(o);this.store.dirty=!1,this.repaint(),this.dispatchEvent(new CustomEvent(He.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,o){this.exprTarget=t,this.exprApply=o,this.syncExpression()}closeExpression(){this.exprTarget=null,this.exprApply=void 0,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:[...o.fields??this.store.fields],fieldDisplay:this.state.fieldDisplay,t:this.ctx.t,onClose:()=>this.closeExpression(),onApply:r=>{this.exprApply?this.exprApply(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=Up(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=Sn(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(){tl(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);un(o);const r=this.ctx;Se(Vp(r,hd(r)),o),Se(wd(r),o),Se(l("div",{class:"designer-body"},[fd(r),sd(r,this.canvasUi()),op(r)]),o),Se(kd(r),o),rn(o),!this.toolbarRo&&typeof ResizeObserver<"u"&&(this.toolbarRo=new ResizeObserver(()=>rn(o)),this.toolbarRo.observe(o));const i=_s(this.store,(s,d)=>this.fire(s,d),this.tableMenu);i&&Se(i,o),os(this.root,this.store.elements,this.designData),Zn(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=qn(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(He.preview,{detail:this.getTemplateJson(),bubbles:!0,composed:!0}));break;case"save":this.save();break;case"help":this.dispatchEvent(new CustomEvent(He.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(He.dblclickElement,{detail:i,bubbles:!0,composed:!0}));break}case"table-cell-dblclick":{const i=o;this.dblEditCell(i),this.dispatchEvent(new CustomEvent(He.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"open-plugin-expression":{const i=o;this.openExpression(i.target,i.onApply);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}}isOnScrollbar(t,o){const r=o.getBoundingClientRect(),i=t.clientX-r.left,n=t.clientY-r.top,s=o.offsetHeight-o.clientHeight,d=o.offsetWidth-o.clientWidth,c=o.clientTop+o.clientHeight,u=o.clientLeft+o.clientWidth;return(s>0?n>=c:n>=c-12)||(d>0?i>=u:i>=u-12)}onCanvasMouseDown(t){const o=t.target,r=this.root.querySelector(".canvas-area");r&&o===r&&this.isOnScrollbar(t,r)||!(o===r||["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()),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)};const s=this.root.querySelector(".canvas-area");if(!s)return;let d=s.querySelector(".marquee-selection");d||(d=document.createElement("div"),d.className="marquee-selection",s.appendChild(d)),d.style.left=`${this.marquee.x}px`,d.style.top=`${this.marquee.y}px`,d.style.width=`${this.marquee.w}px`,d.style.height=`${this.marquee.h}px`},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(P=>P.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 P=d.elements.filter(O=>!this.drag.ids.includes(O.id)&&(O.zone||"content")===this.drag.zone).map(O=>({id:O.id,...h.resolveElementBoxes(O.options).margin})),I=kr(d.templateData,d.paperSize)[this.drag.zone],$=h.computeAdsorb(C,P,this.manualGuides());D={left:$.left,top:$.top},d.adsorbGuides=($.lines??[]).filter(O=>O.position>=0&&O.position<=(O.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 P of this.drag.ids){const I=this.drag.origin.get(P);if(!I)continue;const $={left:I.left+_,top:I.top+z};this.drag.movedPositions.set(P,$),d.livePatch(P,$)}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=()=>Yn(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 ia(e="print-designer"){return customElements.get(e)||customElements.define(e,tt),e}function Xp(){return ia()}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=gn;exports.PRINT_DESIGNER_ATTRIBUTES=Or;exports.PRINT_DESIGNER_BOOLEAN_ATTRIBUTES=Dn;exports.PRINT_DESIGNER_CONTRACT_VERSION=zr;exports.PRINT_DESIGNER_EVENT=He;exports.PRINT_DESIGNER_EVENTS=_n;exports.PRINT_DESIGNER_EVENT_OPTIONS=dl;exports.PRINT_DESIGNER_METHODS=An;exports.PRINT_DESIGNER_PARTS=Nr;exports.PRINT_DESIGNER_PROPERTY_NAMES=Mn;exports.PRINT_DESIGNER_TAG=Cn;exports.PRINT_DESIGNER_THEME_TOKENS=Pn;exports.PrintDesignerElement=tt;exports.TILING_SINGLE_PAGE_TIP=La;exports.createDefaultTemplate=Vt;exports.definePrintDesigner=ia;exports.getElementDblEditableField=Sn;exports.getElementDefinition=pt;exports.getElementDefinitions=wn;exports.getElementLayerIcon=Tn;exports.getElementPropertyGroup=En;exports.getHostContract=yr;exports.getMaterialElementDefinitions=kn;exports.registerAll=Xp;exports.registerElementDefinition=nl;exports.registerElementRenderer=al;exports.registerElementRenderers=xn;exports.resetElementDefinitions=sl;exports.serializePage=fn;exports.subscribeElementDefinitions=vn;exports.toRuntimePool=Ar;