@worm-print-platform/canvas 1.5.0 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -355
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/canvas.css +2 -2
- package/dist/canvas.js +119 -81
- package/dist/core/default-template.d.ts +1 -1
- package/dist/core/element-definitions.d.ts +1 -1
- package/dist/core/format.d.ts +1 -1
- package/dist/core/h.d.ts +1 -1
- package/dist/core/icons.d.ts +1 -1
- package/dist/core/plugin.d.ts +1 -1
- package/dist/core/store.d.ts +1 -1
- package/dist/host-contract.d.ts +24 -8
- package/dist/index.cjs +49 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1918 -1678
- package/dist/print-designer.d.ts +32 -5
- package/dist/shell/binding.d.ts +1 -1
- package/dist/shell/canvas.d.ts +1 -1
- package/dist/shell/code.d.ts +1 -1
- package/dist/shell/color-picker.d.ts +1 -1
- package/dist/shell/controls.d.ts +4 -1
- package/dist/shell/crop-anchor.d.ts +1 -1
- package/dist/shell/elements.d.ts +1 -1
- package/dist/shell/expression-editor.d.ts +1 -1
- package/dist/shell/flow-list.d.ts +1 -1
- package/dist/shell/font-select.d.ts +1 -1
- package/dist/shell/format-bar.d.ts +1 -1
- package/dist/shell/help-content/advanced-settings.d.ts +1 -1
- package/dist/shell/help-content/changelog.d.ts +1 -1
- package/dist/shell/help-content/faq.d.ts +1 -1
- package/dist/shell/help-content/features.d.ts +1 -1
- package/dist/shell/help-content/getting-started.d.ts +1 -1
- package/dist/shell/help-content/index.d.ts +1 -1
- package/dist/shell/help-content/shortcuts.d.ts +1 -1
- package/dist/shell/help-modal.d.ts +1 -1
- package/dist/shell/page-extras.d.ts +1 -1
- package/dist/shell/panels.d.ts +1 -1
- package/dist/shell/plugin-ui.d.ts +1 -1
- package/dist/shell/prop-group.d.ts +1 -1
- package/dist/shell/property-panel.d.ts +1 -1
- package/dist/shell/property-search.d.ts +1 -1
- package/dist/shell/ruler.d.ts +1 -1
- package/dist/shell/table-props.d.ts +1 -1
- package/dist/shell/table.d.ts +2 -2
- package/dist/shell/toolbar-overflow.d.ts +1 -1
- package/dist/shell/toolbar.d.ts +1 -1
- package/dist/shell/watermark.d.ts +1 -1
- package/dist/theme-tokens.d.ts +21 -0
- package/dist/version.d.ts +8 -0
- package/dist/vue3/PrintDesigner.d.ts +46 -1
- package/dist/vue3/PrintHtmlPreview.d.ts +1 -1
- package/dist/vue3/index.cjs +2 -2
- package/dist/vue3/index.d.ts +1 -1
- package/dist/vue3/index.js +153 -133
- package/dist/vue3/previewStyle.d.ts +1 -1
- package/dist/vue3/toolbarOverflow.d.ts +1 -1
- package/package.json +5 -5
package/dist/canvas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(io){typeof define=="function"&&define.amd?define(io):io()})((function(){"use strict";function io(){let e=0;return function(){return e+=1,`cell-${Date.now().toString(36)}-${e}`}}function Tg(){let e=0;return function(){return e+=1,`row-${Date.now().toString(36)}-${e}`}}const kg=io(),Cg=Tg(),Vt={width:.75,style:"solid",color:"#333333"};function Ji(e){return JSON.parse(JSON.stringify(e))}function Qi(e){return{id:kg(),borders:{top:{...Vt},right:{...Vt},bottom:{...Vt},left:{...Vt}},...e}}function Ag(){const e=[50,50,50],t=(r,o)=>({id:Cg(),type:r,height:8,...o!==void 0?{repeatOnPage:o}:{},cells:e.map(()=>Qi())}),n=t("header",!0);return n.cells.forEach((r,o)=>{r.formatter=`列${o+1}`,r.align="center",r.fontWeight="bold"}),{rows:[n,t("data"),t("subtotal"),t("summary")],colWidths:e}}function or(e,t,n){if(!e[t].cells[n].merged)return{r:t,c:n};for(let r=t;r>=0;r--)for(let o=n;o>=0;o--){const i=e[r].cells[o];if(i.merged)continue;const a=i.rowspan??1,l=i.colspan??1;if(r+a-1>=t&&o+l-1>=n)return{r,c:o}}return{r:t,c:n}}function ln(e,t,n){const r=or(e,t,n),o=e[r.r].cells[r.c];return{r1:r.r,c1:r.c,r2:r.r+(o.rowspan??1)-1,c2:r.c+(o.colspan??1)-1}}function Ql(e,t,n){let r={r1:Math.min(t.r,n.r),c1:Math.min(t.c,n.c),r2:Math.max(t.r,n.r),c2:Math.max(t.c,n.c)};for(;;){let o=!1;for(let i=r.r1;i<=r.r2;i++)for(let a=r.c1;a<=r.c2;a++){const l=ln(e,i,a),c={r1:Math.min(r.r1,l.r1),c1:Math.min(r.c1,l.c1),r2:Math.max(r.r2,l.r2),c2:Math.max(r.c2,l.c2)};(c.r1!==r.r1||c.c1!==r.c1||c.r2!==r.r2||c.c2!==r.c2)&&(r=c,o=!0)}if(!o)return r}}function ec(e,t){if((t.r2-t.r1+1)*(t.c2-t.c1+1)<2)return"至少选择 2 个单元格";const r=new Set;for(let i=t.r1;i<=t.r2;i++)r.add(e[i].type);if(r.size>1)return"合并区域不能跨越不同类型的行";if(t.r2>t.r1&&r.has("data"))return"数据行将按列表展开,纵向合并请使用单元格属性「按值合并」";const o=Ql(e,{r:t.r1,c:t.c1},{r:t.r2,c:t.c2});return o.r1!==t.r1||o.c1!==t.c1||o.r2!==t.r2||o.c2!==t.c2?"选区与已有合并区域部分重叠":null}function tc(e,t){const n=e[t.r1].cells[t.c1],r=[];for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=e[o].cells[i];a.formatter&&r.push(a.formatter),!(o===t.r1&&i===t.c1)&&(a.merged=!0,a.rowspan=1,a.colspan=1,a.formatter="")}n.rowspan=t.r2-t.r1+1,n.colspan=t.c2-t.c1+1,n.formatter=r.join(" ")}function nc(e,t){for(let n=t.r1;n<=t.r2;n++)for(let r=t.c1;r<=t.c2;r++){const o=e[n].cells[r];if(!o.merged&&((o.rowspan??1)>1||(o.colspan??1)>1)){const i=ln(e,n,r),a=o;for(let l=i.r1;l<=i.r2;l++)for(let c=i.c1;c<=i.c2;c++){const s=e[l].cells[c];s.merged=!1,s.rowspan=1,s.colspan=1,Og(a,s)}o.rowspan=1,o.colspan=1}}}function Og(e,t){e!==t&&(t.align=e.align,t.valign=e.valign,t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.fontWeight=e.fontWeight,t.color=e.color,t.backgroundColor=e.backgroundColor,t.borders=e.borders?Ji(e.borders):void 0,t.padding=e.padding,t.wordWrap=e.wordWrap)}function rc(e,t,n){const r=n==="above"?t:t+1,o=e[t],i=o.cells.length,a=o.type==="data"?"header":o.type,l={id:`row-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,type:a,height:o.height,...a==="header"?{repeatOnPage:[e[r-1],e[r]].find(c=>c?.type==="header")?.repeatOnPage===!0}:{},cells:Array.from({length:i},()=>Qi())};for(let c=0;c<i;c++)if(r>0&&r<e.length){const s=ln(e,r-1,c);if(s.r1<r&&s.r2>=r){const d=e[s.r1].cells[s.c1];d.rowspan=(d.rowspan??1)+1,l.cells[c].merged=!0}}e.splice(r,0,l)}function Ig(e,t){if(e.length<=1)return"不能删除最后一行";const n=e[t],r=n.cells.length;for(let o=0;o<r;o++){const i=n.cells[o];if(!i.merged&&(i.rowspan??1)>1){const a=e[t+1].cells[o];Object.assign(a,Ji(i),{id:a.id}),a.rowspan=(i.rowspan??1)-1,a.merged=!1}else if(i.merged){const a=ln(e,t,o);if(a.r1<t&&a.c1===o){const l=e[a.r1].cells[a.c1];l.rowspan=(l.rowspan??1)-1}}}return e.splice(t,1),null}function oc(e,t,n,r){const o=r==="left"?n:n+1;t.splice(o,0,t[n]);for(const i of e){const a=Qi();if(o>0&&o<i.cells.length){const l=e.indexOf(i),c=ln(e,l,o-1);if(c.c1<o&&c.c2>=o){const s=e[c.r1].cells[c.c1];l===c.r1&&(s.colspan=(s.colspan??1)+1),a.merged=!0}}i.cells.splice(o,0,a)}}function Rg(e,t,n){if(t.length<=1)return"不能删除最后一列";for(let r=0;r<e.length;r++){const o=e[r].cells[n];if(!o.merged&&(o.colspan??1)>1){const i=e[r].cells[n+1];Object.assign(i,Ji(o),{id:i.id}),i.colspan=(o.colspan??1)-1,i.merged=!1}else if(o.merged){const i=ln(e,r,n);if(i.c1<n&&i.r1===r){const a=e[i.r1].cells[i.c1];a.colspan=(a.colspan??1)-1}}}for(const r of e)r.cells.splice(n,1);return t.splice(n,1),null}function ea(e,t,n){if(n==="data"){const r=e.findIndex((o,i)=>o.type==="data"&&i!==t);if(r>=0)return`数据行已存在(第 ${r+1} 行),全表最多一行`}if(n==="header"){for(let r=0;r<t;r++)if(e[r].type!=="header")return"标题行必须从表格顶部连续设置"}if(n==="subtotal"||n==="summary"){const r=e.findIndex(o=>o.type==="data");if(r<0)return"请先设置数据行,小计/汇总行必须位于数据行之后";if(t<r)return"小计/汇总行必须位于数据行之后"}if(n==="subtotal"&&e.slice(0,t).some(r=>r.type==="summary"))return"小计行必须位于汇总行之前";if(n==="summary"&&e.slice(t+1).some(r=>r.type==="subtotal"))return"汇总行必须位于小计行之后";if(e[t].type==="header"&&n!=="header"){for(let r=t+1;r<e.length;r++)if(e[r].type==="header")return"取消该标题行会导致标题行不连续,请先调整后续标题行"}if(e[t].type=n,n==="header"){const r=[e[t-1],e[t+1]].find(o=>o?.type==="header");e[t].repeatOnPage=e[t].repeatOnPage!==void 0?e[t].repeatOnPage===!0:r?.repeatOnPage===!0}else delete e[t].repeatOnPage;return null}function Pg(e,t){for(const n of e){if(n.type!=="header")break;n.repeatOnPage=t}}function ic(e,t,n,r){for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=e[o].cells[i];if(a.merged)continue;if(n==="none"){delete a.borders;continue}const l=ln(e,o,i),c=l.r1===t.r1,s=l.r2===t.r2,d=l.c1===t.c1,p=l.c2===t.c2,u={...a.borders??{}};n==="all"?(u.top={...r},u.bottom={...r},u.left={...r},u.right={...r}):n==="outer"?(c&&(u.top={...r}),s&&(u.bottom={...r}),d&&(u.left={...r}),p&&(u.right={...r})):n==="inner"&&(c||(u.top={...r}),s||(u.bottom={...r}),d||(u.left={...r}),p||(u.right={...r})),a.borders=u}}const Dg="线型 / 宽度 / 颜色是待应用规格:选中格已有的边框规格一致时会填进这三行;四边不一致的项显示「混合」,一条边都没有时显示「无 / 0」。改完点「全部 / 外侧 / 内部」或勾选上、下、左、右某条边才会写入选中的单元格;「无」是清除边框",$g="多选时不回显单格边框:线型 / 宽度 / 颜色按当前设置作为批写规格,点「全部 / 外侧 / 内部」或勾选某条边后写入所有选中格;「无」是清除边框",Ng="当前单元格四边边框规格不一致:带「混合」的项不谎报,未改项在点「全部 / 外侧 / 内部」或勾选单边时按缺省档(实线 0.75pt)写入,改任一项即按该值批写";function ac(e,t,n){const r={...e.borders??{}};n?r[t]={...n}:delete r[t],e.borders=r.top||r.right||r.bottom||r.left?r:void 0}function ao(e,t){const n=[];for(let r=t.r1;r<=t.r2;r++)for(let o=t.c1;o<=t.c2;o++){const i=e[r]?.cells[o];i&&!i.merged&&n.push(i)}return n}function ta(e,t){const n=ao(e,t).length;return{mode:n>1?"multi":"single",count:n}}function Lg(e,t){const n=ao(e,t);if(!n.length)return null;const r=n[0].cellType??"text";return n.every(o=>(o.cellType??"text")===r)?r:null}function sc(e,t){const n=[];for(const o of ao(e,t))for(const i of["top","right","bottom","left"]){const a=o.borders?.[i];a&&n.push(a)}const r=o=>{if(!n.length)return;const i=o(n[0]);return n.every(a=>o(a)===i)?i:"mixed"};return{width:r(o=>o.width),style:r(o=>o.style),color:r(o=>o.color)}}const Fg="1px dashed rgba(0,0,0,0.18)";function so(e,t={}){return e&&e.style!=="none"?`${e.width}pt ${e.style} ${e.color}`:t.designMode&&t.showGhostBorder!==!1?Fg:"none"}function ir(e){const t=(e.tableColWidths??[]).reduce((r,o)=>r+o,0),n=(e.tableRows??[]).reduce((r,o)=>r+o.height,0);e.width=Math.round(t*100)/100,e.height=Math.round(n*100)/100}const lc=5;function zg(e,t,n,r){const o=e.reduce((l,c,s)=>s===t?l:l+c,0),i=r===1/0?1/0:Math.max(lc,r-o),a=Math.round(n*10)/10;return Math.min(Math.max(a,lc),i)}const cc=Symbol.for("worm-print-platform.element-capabilities.v1"),dc=globalThis;function cn(){const e=dc[cc];if(e)return e;const t={entries:new Map,nextSeq:0,bootstrapped:!1};return dc[cc]=t,uc(t),t}const Bg={left:7,top:17.6,width:42.3,height:7.1},ar=Object.freeze({text:{zoneAllowed:!0,defaultTextFit:"clip",bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],defaultOptions:()=>({formatter:"文本",fontSize:12,textAlign:"left",height:5.3}),title:"文本"},longText:{defaultTextFit:"autoHeight",bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"},{targetPath:"options.styler",label:"样式",dataSource:"main"}],defaultOptions:()=>({width:141.1,height:28.2,fontSize:12,lineHeight:18}),title:"长文"},barcode:{zoneAllowed:!0,codeRotationDpiGated:!0,bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],defaultOptions:()=>({width:56.4,height:14.1,title:"条形码",barcodeType:"code128",testData:"12345678"}),title:"条形码"},qrcode:{zoneAllowed:!0,codeRotationDpiGated:!0,bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],defaultOptions:()=>({width:28.2,height:28.2,title:"二维码",testData:"qrcode"}),title:"二维码"},image:{zoneAllowed:!0,bindings:[{targetPath:"options.src",label:"内容",dataSource:"main",placeholder:"输入图片路径,支持 /docfiles/... 相对路径、绝对 URL 或 {字段} 表达式"}],defaultOptions:()=>({width:28.2,height:28.2,fit:"contain"}),title:"图片"},table:{rotationExcluded:!0,acceptsElementBorder:!1,bindings:[],defaultOptions:()=>{const{rows:e,colWidths:t}=Ag(),n=t.reduce((o,i)=>o+i,0),r=e.reduce((o,i)=>o+i.height,0);return{width:n,height:r,tableMode:"dynamic",tableRows:e,tableColWidths:t,tableDefaultFontSize:10,tableDefaultColor:"#333333",tableDefaultPadding:1,fields:[],tablePagination:{enabled:!0}}},title:"表格"},flowList:{rotationExcluded:!0,defaultTextFit:"clip",bindings:[{targetPath:"options.formatter",label:"单元模板",dataSource:"main",placeholder:"{drugs.name} {drugs.spec}"}],defaultOptions:()=>({width:141.1,height:21.2,fontSize:12,formatter:"{name} {spec}",flowColumns:4,flowRowHeight:8,flowGapX:4,flowAutoSpan:!1,flowMaxSpan:2,flowLayoutMode:"fixed",flowPaddingTop:0,flowPaddingRight:0,flowPaddingBottom:0,flowPaddingLeft:0}),title:"流式列表"},hline:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:70.6,height:1.8,borderWidth:.75}),title:"横线"},vline:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:1.8,height:35.3,borderWidth:.75}),title:"竖线"},rect:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:28.2,height:28.2,borderWidth:1,borderColor:"#333"}),title:"矩形"},oval:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:28.2,height:28.2,borderWidth:1,borderColor:"#333"}),title:"椭圆"},html:{blocked:!0,defaultOptions:()=>({width:28.2,height:28.2}),title:"HTML"},pageNumber:{title:"页码"}});function uc(e){if(!e.bootstrapped){e.bootstrapped=!0;for(const[t,n]of Object.entries(ar))e.entries.has(t)||e.entries.set(t,{caps:n,seq:e.nextSeq++})}}function Hg(e,t){if(!e||typeof e!="string")throw new Error("registerElementCapabilities: type 必须是非空字符串");if(!t||typeof t!="object")throw new Error("registerElementCapabilities: caps 必须是对象");const n=cn(),r=n.nextSeq++;return n.entries.set(e,{caps:t,seq:r}),()=>{if(cn().entries.get(e)?.caps!==t)return;const i=ar[e];i?cn().entries.set(e,{caps:i,seq:r}):cn().entries.delete(e)}}function dt(e){return e?{...cn().entries.get(e)?.caps??{},type:e}:{type:""}}function na(){return[...cn().entries.entries()].sort((e,t)=>e[1].seq-t[1].seq).map(([e])=>e)}function Ug(){const e=cn();e.entries.clear(),e.nextSeq=0,e.bootstrapped=!1,uc(e)}function qg(){return{...Bg}}const pc=Symbol.for("worm-print-platform.element-plugin-registry.v1"),fc=globalThis;function ra(){const e=fc[pc];if(e)return e;const t={plugins:new Map,typeIndex:new Map,configs:new Map,legacyAliases:new Map};return fc[pc]=t,t}function Wg(e,t){const n=e.render||t.render?{...e.render,...t.render}:void 0,r=e.designer||t.designer?{...e.designer,...t.designer}:void 0;return{...e,kind:t,binding:t.binding??e.binding,render:n,designer:r}}function Rn(e){const t=ra().typeIndex.get(e);return t?Wg(t.plugin,t.kind):void 0}function hc(){return[...ra().typeIndex.values()]}function jg(){return Object.fromEntries(ra().legacyAliases)}function sr(e){return e/2.83464566929}function lo(e){return e*(25.4/96)}function dn(e){return e*(96/25.4)}const gc=6,Gg=1,Vg=["clip","shrink","autoHeight"];function mc(e){return typeof e=="string"&&Vg.includes(e)?e:void 0}const Yg={text:"clip",longText:"autoHeight",flowList:"clip"};function co(e,t){const n=dt(e).defaultTextFit;return mc(t?.textFit)??n??Yg[e]??"clip"}function bc(e){if(e?.keepLineBreaks===!0&&e.wordWrap!==!1)return"pre-wrap"}function yc(e){return e?.wordWrap===!1?"nowrap":void 0}function oa(e){return mc(e?.textFit)??(e?.wordWrap===!1?"clip":"autoHeight")}function lr(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?gc:Math.max(e,Gg)}function ia(e){return Math.round(e*100)/100}function Kg(e){return Math.floor(e*100)/100}function Xg(e,t,n,r){return`${e}#${t}#${n}:${r}`}function Zg(e){const t=e.indexOf("#");if(t<0)return;const n=e.lastIndexOf("#"),r=e.slice(t+1,n);if(r!=="b"&&r!=="st"&&r!=="sm")return;const[o,i]=e.slice(n+1).split(":").map(Number);if(!(!Number.isFinite(o)||!Number.isFinite(i)))return{elementId:e.slice(0,t),kind:r,rowIndex:o,colIndex:i}}function vc(e,t){return(e||"contain")==="cover"?t:void 0}function aa(e,t,n,r=1){const o=Math.max(n?.colspan??1,1);let i=0;for(let c=0;c<o;c++)i+=e[t+c]??0;if(i<=0)return 0;const a=n?.padding??r,l=(sr(n?.borders?.left?.width??0)+sr(n?.borders?.right?.width??0))/2;return Math.max(i-a*2-l,.5)}function cr(e,t,n,r=1){const o=Math.max(n?.rowspan??1,1);let i=0;for(let c=0;c<o;c++)i+=e[t+c]?.height??8;const a=n?.padding??r,l=(sr(n?.borders?.top?.width??0)+sr(n?.borders?.bottom?.width??0))/2;return Math.max(i-a*2-l,.5)}const sa=1,wc=12,Jg=3,Qg=100,em=0,tm=50;function un(e){return e==="dynamic"?"dynamic":"fixed"}function Pn(e){const t=n=>{const r=e[n];return typeof r=="number"&&Number.isFinite(r)&&r>0?r:0};return{top:t("flowPaddingTop"),right:t("flowPaddingRight"),bottom:t("flowPaddingBottom"),left:t("flowPaddingLeft")}}function xc(e,t){return Math.max(0,e-t.left-t.right)}const Ec=25.4/72;function nm(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?r:Math.min(n,Math.max(t,Math.round(e)))}function ut(e){return nm(e,sa,wc,4)}function bt(e){return typeof e!="number"||!Number.isFinite(e)?4:Math.min(tm,Math.max(em,e))}function Yt(e){return typeof e!="number"||!Number.isFinite(e)?8:Math.min(Qg,Math.max(Jg,e))}function pn(e,t){const n=ut(t),r=Math.min(2,n);return typeof e!="number"||!Number.isFinite(e)?r:Math.min(n,Math.max(1,Math.round(e)))}function rm(e,t,n){const r=ut(t),o=bt(n),i=e-o*(r-1);return i<=0?0:i/r}function om(e,t,n){const r=Math.max(1,Math.floor(n));return e*r+t*(r-1)}function Sc(e,t){if(!e)return 0;const n=typeof t=="number"&&Number.isFinite(t)&&t>0?t*Ec:12*Ec;let r=0;for(const o of e){if(o===" "){r+=.28;continue}const i=o.codePointAt(0)??0;i>=12288&&i<=12351||i>=13312&&i<=19903||i>=19968&&i<=40959||i>=63744&&i<=64255||i>=65280&&i<=65376||i>=65504&&i<=65510||i>=131072?r+=1:/^[0-9A-Z]$/.test(o)?r+=.6:/^[a-z]$/.test(o)?r+=.5:/^[\u0020-\u007f]$/.test(o)?r+=.4:r+=.75}return r*n}function im(e,t){if(!t.autoSpan)return 1;const n=pn(t.maxSpan,t.columns);if(n<=1||t.colUnitMm<=0)return 1;const r=Sc(e,t.fontSizePt);for(let o=1;o<=n;o++)if(r<=om(t.colUnitMm,t.gapX,o))return o;return n}function la(e,t){const n=ut(t.columns),r=bt(t.gapX),o=rm(t.width,n,r),i=pn(t.maxSpan,n),a=[];let l=[],c=0;for(const s of e){const d=String(s??""),p=im(d,{...t,columns:n,gapX:r,maxSpan:i,colUnitMm:o});l.length>0&&c+p>n&&(a.push({cells:l}),l=[],c=0),l.push({text:d,span:p}),c+=p}return l.length>0&&a.push({cells:l}),a}function uo(e,t){if(typeof e!="string"||!e.includes("{")||!t)return;const n=new Set;for(const r of e.matchAll(/\{([^{}]*)\}/g))for(const o of(r[1]??"").split(/[^A-Za-z0-9_\u4e00-\u9fa5.]/)){const i=o.split(".")[0];i&&!/^\d/.test(i)&&n.add(i)}for(const r of n)if(Array.isArray(t[r]))return r}function am(e,t,n){const r=bt(t),o=Sc("一",n);if(o<=0||e<=0)return sa;const i=Math.floor((e+r)/(o+r));return Math.min(wc,Math.max(sa,i))}const _c=e=>`${Math.round(e*1e3)/1e3}mm`;function sm(e){const t=ut(e.columns),n=bt(e.gapX),r=Yt(e.rowHeight);return["display:grid",`grid-template-columns:repeat(${t},minmax(0,1fr))`,`column-gap:${_c(n)}`,`grid-auto-rows:minmax(${_c(r)},auto)`].join(";")}const dr=25.4,Mc=10;function ca(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):Mc}const Kt=30,po=10,da=2,Tc=0,lm=.25,ua=.254;function cm(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e/dr;for(let n=2;n<=8;n+=.5){const r=Math.max(1,Math.round(fo(n)*t)),o=r/t;if(o>=ua-1e-9)return{barWidth:n,dotsPerModule:r,moduleWidthMm:o}}return null}function kc(e,t){const n=cm(e);if(!n)return"";const r=s=>String(Number(s.toFixed(3))),o=`按 ${e}dpi 推荐条宽倍率 ${n.barWidth}(每模块 ${n.dotsPerModule} 个打印点 = ${r(n.moduleWidthMm)}mm,取达到 ${r(ua)}mm 下限的最小档)`,i=fo(t??2),a=Math.max(1,Math.round(i*e/dr)),l=a/(e/dr),c=l>=ua-1e-9?`当前倍率 ${t??2} 折算为 ${a} 点 / ${r(l)}mm,已达标`:`当前倍率 ${t??2} 只有 ${a} 点 / ${r(l)}mm,低于下限`;return`${o};${c}。这里只提示,不会替你改值`}function ur(e){const t=typeof e=="number"&&Number.isFinite(e)?e:2;return Math.max(1,t/2)}function fo(e){return ur(e)*lm}function dm(e){const{barHeightMm:t,moduleWidthMm:n,boxHeightMm:r,textModules:o}=e,i=typeof t=="number"&&Number.isFinite(t)&&t>0,a=typeof n=="number"&&Number.isFinite(n)&&n>0;if(!i||!a)return Kt;const l=Math.max(1,Math.round(t/n));if(!(typeof r=="number"&&Number.isFinite(r)&&r>0))return l;const s=typeof o=="number"&&Number.isFinite(o)&&o>0?o:0,d=Math.floor((r-s*n)/n);return Math.max(1,Math.min(l,d))}function Cc(e,t,n){const r=Math.max(1,Math.round(e*n)),o=Math.floor(t*n);if(o<1)return null;const i=Math.min(r,o);return{dotsPerModule:i,preferredDots:r,moduleWidthMm:i/n}}function um(e){const t=fo(e.barWidth),n=Math.max(1,Math.ceil(e.unitWidth)),r=e.boxWidthMm>0?e.boxWidthMm/n:Number.POSITIVE_INFINITY,o=e.dpi;if(typeof o=="number"&&Number.isFinite(o)&&o>0){const i=Cc(t,r,o/dr);if(i)return i.moduleWidthMm}return Math.min(t,r)}function Dn(e,t){const n=typeof e=="number"&&e>0?e:Number.POSITIVE_INFINITY,r=typeof t=="number"&&t>0?Math.min(n,t):n;return Number.isFinite(r)?r:0}function pm(e){const t=Math.max(1,Math.ceil(e.unitWidth)),n=Math.max(1,Math.ceil(e.unitHeight)),r=fo(e.barWidth),o=Math.min(e.boxWidthMm>0?e.boxWidthMm/t:Number.POSITIVE_INFINITY,e.boxHeightMm>0?e.boxHeightMm/n:Number.POSITIVE_INFINITY),i=e.dpi;if(typeof i=="number"&&Number.isFinite(i)&&i>0){const l=Cc(r,o,i/dr);if(l)return{moduleWidthMm:l.moduleWidthMm,widthMm:t*l.moduleWidthMm,heightMm:n*l.moduleWidthMm,dotsPerModule:l.dotsPerModule,scaledDown:l.dotsPerModule<l.preferredDots}}const a=Math.min(r,o);return{moduleWidthMm:a,widthMm:t*a,heightMm:n*a,dotsPerModule:null,scaledDown:a<r}}function pa(e){const t=ur(e.barWidth),n=c=>pm({unitWidth:c.widthUnits/t,unitHeight:c.heightUnits/t,boxWidthMm:e.boxWidthMm,boxHeightMm:e.boxHeightMm,dpi:e.dpi,barWidth:e.barWidth}),r=e.measure(Kt);if(!r)return{barHeightModules:Kt,size:null};if(!(typeof e.barHeightMm=="number"&&Number.isFinite(e.barHeightMm)&&e.barHeightMm>0))return{barHeightModules:Kt,size:n(r)};const i=Math.max(0,r.heightUnits/t-Kt),a=dm({barHeightMm:e.barHeightMm,moduleWidthMm:um({unitWidth:r.widthUnits/t,boxWidthMm:e.boxWidthMm,dpi:e.dpi,barWidth:e.barWidth}),boxHeightMm:e.boxHeightMm,textModules:i});if(a===Kt)return{barHeightModules:a,size:n(r)};const l=e.measure(a);return l?{barHeightModules:a,size:n(l)}:{barHeightModules:Kt,size:null}}const pr=["top","right","bottom","left"],fm=new Set(["rect","oval","hline","vline","table"]);function ho(e){if(!e)return!1;const t=dt(e).acceptsElementBorder;return t===void 0?!fm.has(e):t}const hm=new Set(["solid","dashed","dotted","double"]);function Ac(e,t,n){return typeof e!="number"||!Number.isFinite(e)||e<=0||t==="none"?null:{borderWidth:`${e}pt`,borderStyle:typeof t=="string"&&hm.has(t)?t:"solid",borderColor:n||"#000"}}function go(e,t){if(!ho(e))return null;const n=Ac(t?.borderWidth,t?.borderStyle,t?.borderColor),r={},o=t?.borders;if(o)for(const i of pr){const a=o[i];if(!a)continue;const l=Ac(a.width,a.style,a.color);l&&(r[i]=l)}return!n&&Object.keys(r).length===0?null:{all:n,edges:r}}const gm=/[;"'<>\\(){}\[\]@!#]/,mm=64,fr=100,Oc=400;function bm(e){const t=(e??"").trim();return!t||t.length>mm||gm.test(t)?"":t}function Ic(e,t){if((e||"contain")!=="cover"||typeof t!="number"||!Number.isFinite(t))return;const n=Math.round(t);if(!(n<=fr))return Math.min(n,Oc)}function fa(e,t,n){const r=bm(n),o={};r&&(o.objectPosition=r);const i=Ic(e,t);return i!==void 0&&(o.transform=`scale(${Number((i/100).toFixed(2))})`,o.transformOrigin=r||"50% 50%"),o}function hr(e){return typeof e!="number"||!Number.isFinite(e)?0:(e%360+360)%360}function Rc(e,t,n){const r=e.width,o=t,i=hr(n);let a,l;if(i===0||i===180)a=r,l=o;else if(i===90||i===270)a=o,l=r;else{const c=i*Math.PI/180;a=r*Math.abs(Math.cos(c))+o*Math.abs(Math.sin(c)),l=r*Math.abs(Math.sin(c))+o*Math.abs(Math.cos(c))}return{left:e.left-(a-r)/2,top:e.top-(l-o)/2,width:a,height:l}}const Pc=385,ym=new Set(["table","flowList"]);function Dc(e){const t=dt(e).rotationExcluded;return t===void 0?ym.has(e):t}function $c(e){const t=dt(e).codeRotationDpiGated;return t===void 0?e==="barcode"||e==="qrcode":t}const vm="条码与二维码仅支持 90° 步进;任意角度需 385dpi 以上打印头";function wm(e,t){if(!$c(e))return!0;const n=t?.printerDpi;return typeof n=="number"&&n>0&&n>=Pc}function ha(e,t,n){const r=t?.rotate;if(typeof r!="number"||!Number.isFinite(r))return;const o=hr(r);if(o!==0&&!Dc(e)){if($c(e)){if(o===90||o===180||o===270)return o;const i=t?.printerDpi;if(typeof i=="number"&&i>0&&i<Pc){const a=hr(Math.round(o/90)*90);return a===0?void 0:a}}return o}}const mo=e=>typeof e=="number"&&Number.isFinite(e)?e:0;function pt(e){const t=e??{};return{top:mo(t.marginTop),right:mo(t.marginRight),bottom:mo(t.marginBottom),left:mo(t.marginLeft)}}function bo(e){const t=pt(e);return["top","right","bottom","left"].filter(n=>t[n]!==0).map(n=>`margin-${n}:${t[n]}mm`).join(";")}function je(e={},t=e.height??0){const n=pt(e),r=e.left??0,o=e.top??0,i=e.width??100,a=t,l={left:r+n.left,top:o+n.top,right:r+n.left+i,bottom:o+n.top+a,width:i,height:a},c={left:r,top:o,right:r+n.left+i+n.right,bottom:o+n.top+a+n.bottom,width:Math.max(0,n.left+i+n.right),height:Math.max(0,n.top+a+n.bottom)};return{border:l,margin:c}}const fn={A4:{width:210,height:297},A3:{width:297,height:420},A5:{width:148,height:210},Letter:{width:216,height:279},Legal:{width:216,height:356},DOT_FULL:{width:241,height:279.4},DOT_HALF:{width:241,height:139.7},DOT_THIRD:{width:241,height:93.1},LABEL_80X60:{width:80,height:60},LABEL_60X40:{width:60,height:40},LABEL_40X30:{width:40,height:30},THERMAL_57:{width:57,height:297},THERMAL_80:{width:80,height:297},THERMAL_110:{width:110,height:297},CUSTOM:{width:210,height:297},CONTINUOUS:{width:80,height:297}},xm=new Set(["CONTINUOUS","THERMAL_57","THERMAL_80","THERMAL_110"]);function $n(e){return xm.has(e)}function ft(e){const t=$n(e.paperSize),n=e.paperSize==="CUSTOM"||t?{width:e.customWidth??fn[e.paperSize].width,height:e.customHeight??fn[e.paperSize].height}:fn[e.paperSize];return e.orientation==="landscape"&&!t?{width:n.height,height:n.width}:{...n}}function Nn(e){if($n(e.paperSize))return ft(e);const n=ft(e);return e.outputRotation===90||e.outputRotation===270?{width:n.height,height:n.width}:n}function ga(e){return $n(e.paperSize)?0:e.outputRotation??0}function kt(e){return $n(e.paperSize)}function yo(e){return e.options?.pagination??e.pagination}function Em(e){return e.options?.tablePagination??e.tablePagination}const Sm=2;function vo(e){return e.type==="table"||e.printElementType?.type==="table"}function gr(e){return(e.type||e.printElementType?.type||"text")==="flowList"&&un(e.options?.flowLayoutMode)==="dynamic"}function ma(e){return vo(e)||gr(e)}function wo(e){return e.options?.fixed!==!0&&e.options?.repeatOnEveryPage===!0}function ba(e){return e.options?.fixed===!0}function Nc(e){return e.type||e.printElementType?.type||"text"}function Lc(e){return ha(Nc(e),e.options)}function hn(e,t){const n=t.get(e.id)?.measuredHeight??e.options?.height??0,r=pt(e.options),{border:o}=je({left:e.options?.left??0,top:e.options?.top??0,width:e.options?.width??100,height:n,...e.options},n),i=Lc(e),a=i===void 0?o:Rc(o,n,i);return{height:a.height,shift:o.top-a.top,top:a.top,rot:i,outerTop:a.top-r.top,outerBottom:a.top+a.height+r.bottom,outerHeight:Math.max(0,r.top+a.height+r.bottom)}}function _m(e,t){const n=e.options?.tableColWidths??[],r=vo(e)&&n.length>0?n.reduce((c,s)=>c+s,0):e.options?.width??0,o=t.get(e.id)?.measuredHeight??e.options?.height??0,{border:i}=je({...e.options,left:e.options?.left??0,top:e.options?.top??0,width:r,height:o},o),a=Lc(e);if(a===void 0)return{left:i.left,width:i.width};const l=Rc(i,o,a);return{left:l.left,width:l.width}}function Mm(e){const t=e.options??{},n=t.top??0,o=(t.tableRows??[]).reduce((a,l)=>a+(l.height??0),0),i=Math.max(t.height??0,o);return n+pt(t).top+i}function mr(e){if(gr(e)){const t=e.options??{};return(t.top??0)+pt(t).top+Math.max(t.height??0,0)}return Mm(e)}function Fc(e){return(t,n)=>{const r=t.options?.top??0,o=n.options?.top??0;if(r!==o)return r-o;const i=t.options?.zIndex??0,a=n.options?.zIndex??0;return i!==a?i-a:(e.get(t.id)??0)-(e.get(n.id)??0)}}function zc(e){const n=e.filter(l=>typeof l.id=="string").map(l=>l).filter(l=>!wo(l)&&!ba(l)),r=new Map;n.forEach((l,c)=>r.set(l.id,c));const o=[...n].sort(Fc(r)),i=new Set;for(const l of o)ma(l)||l.options?.groupId&&i.add(l.id);const a=new Set;for(const l of Bc(o,i).values())for(const c of l)a.add(c);return a}function Bc(e,t){const n=new Map;let r=null,o=-1,i=0,a=0;for(const l of e){if(ma(l)){r=l.id,o=mr(l)+pt(l.options).bottom;const d=l.options?.tableColWidths??[],p=d.length>0?d.reduce((f,g)=>f+g,0):l.options?.width??0,u=je({...l.options,width:p}).margin;i=u.left,a=u.right,n.set(l.id,[]);continue}if(t?.has(l.id)||!r||(l.options?.top??0)<o)continue;const s=je({width:0,...l.options}).margin;s.right<=i||s.left>=a||n.get(r).push(l.id)}return n}function ya(e,t,n,r){const o=mr(e)+pt(e.options).bottom;let i=o;for(const a of t){const l=n.elements.find(c=>c.id===a);l&&(i=Math.max(i,je({width:0,...l.options}).margin.bottom))}return Math.max(i-o,0)}function Hc(e,t){return Math.max(e.options?.height??0,t.get(e.id)?.measuredHeight??0)}const Uc=25.4/72;function qc(e){const t=e.options??{};if((e.type||e.printElementType?.type||"text")!=="vline")return{width:100,...t};const o=(t.borderWidth??.75)*Uc/2+.05;return{...t,left:(t.left??0)-o,width:o*2}}function gn(e){const t=je(qc(e)).margin;return[t.left,t.right]}function Tm(e){const t=je(qc(e)).border;return[t.left,t.right]}function va(e,t){return e[0]<t[1]&&t[0]<e[1]}function Wc(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function km(e,t,n){const r=new Map;for(const f of n.values()){if(f.length<2)continue;const g={anchorId:f[0].id,ids:f.map(m=>m.id),forceFirstPage:f.some(m=>yo(m)?.pageable===!1),band:f.map(gn).reduce(Wc)};for(const m of f)r.set(m.id,g)}const o=e.filter(f=>!vo(f)&&!gr(f)&&!f.options?.groupId&&yo(f)?.pageable!==!1),i=new Map;o.forEach(f=>i.set(f.id,f.id));const a=f=>{let g=f;for(;i.get(g)!==g;)g=i.get(g);let m=f;for(;i.get(m)!==g;){const b=i.get(m);i.set(m,g),m=b}return g},l=(f,g)=>{const m=a(f),b=a(g);m!==b&&i.set(b,m)},c=[],s=f=>je({width:100,...f.options,height:Hc(f,t)},Hc(f,t)).border,d=[...o].sort((f,g)=>s(f).top-s(g).top);for(const f of d){const g=s(f),m=g.top;for(let w=c.length-1;w>=0;w--)c[w].bottom<=m&&c.splice(w,1);const b=g.bottom,v=Tm(f);for(const w of c)w.bottom>m&&va(w.x,v)&&l(f.id,w.id);c.push({id:f.id,top:m,bottom:b,x:v})}const p=new Map(o.map(f=>[f.id,f])),u=new Map;for(const f of o){const g=a(f.id),m=u.get(g);m?m.push(f.id):u.set(g,[f.id])}for(const f of u.values()){if(f.length<2)continue;const g={anchorId:f[0],ids:f,forceFirstPage:!1,band:f.map(m=>gn(p.get(m))).reduce(Wc)};for(const m of f)r.set(m,g)}return r}function wa(e,t){const n=ft(e),{top:r,bottom:o}=e.margins,i=e.header?.height??0,a=e.footer?.height??0,l=kt(e),c=l?Number.POSITIVE_INFINITY:n.height-r-o-i-a;if(!l&&c<=0)throw new Error(`页面可用高度不足: paper=${n.height}mm, margins=${r+o}mm, header=${i}mm, footer=${a}mm`);const s=new Map;e.elements.forEach((k,z)=>s.set(k.id,z));const d=[...e.elements].sort(Fc(s)),p=d.filter(wo),u=d.filter(ba),f=d.filter(k=>!wo(k)&&!ba(k)),g=p.reduce((k,z)=>{const W=hn(z,t);return{minTop:Math.min(k.minTop,W.outerTop),maxBottom:Math.max(k.maxBottom,W.outerBottom)}},{minTop:Number.POSITIVE_INFINITY,maxBottom:Number.NEGATIVE_INFINITY}),m=!l&&p.length>0,b=m?g.minTop:0,v=m?Math.max(0,g.maxBottom-b):0,w=new Set,E=new Map;for(const k of f){if(ma(k))continue;const z=k.options?.groupId;if(!z)continue;w.add(k.id);const W=E.get(z);W?W.push(k):E.set(z,[k])}const C=Bc(f,w),F=new Map;for(const[k,z]of C)for(const W of z)F.set(W,k);const N=new Set,P=k=>{for(const z of k)N.add(z)},O=new Map;for(const k of d)O.set(k.id,k);const T=km(f,t,E),I=[];let S=[],$=[],D=[],B=!1;function _(){return c-Sm-(B?v:0)}function ie(k){let z=0;for(const W of $)va(k,[W.x0,W.x1])&&(z+=W.height);return Math.max(0,z)}function pe(k,z,W){D.push({x0:k[0],x1:k[1],renderBottom:z,designBottom:W})}function Ve(k){let z;for(const W of D)va(k,[W.x0,W.x1])&&(!z||W.renderBottom>=z.renderBottom)&&(z=W);return z}function ee(k,z){const W=k.options?.top??0;if(B)return{top:Ie(z),extra:0};const H=Ve(z);if(!H||H.renderBottom<=W)return{top:W,extra:0};const Y=Math.max(W,H.renderBottom+W-H.designBottom);return{top:Y,extra:Math.max(0,Y-H.renderBottom)}}function Te(k){return _()-ie(k)}function ne(k,z){$.push({x0:k[0],x1:k[1],height:z})}function me(k,z=gn(k)){return B?Ie(z):k.options?.top??0}function Ie(k){return(B?v:0)+ie(k)}let te=!1,ze=[];function St(k,z,W){W<=0||ze.push(`元素 ${k.id} 旋转 ${z}° 后顶部超出页首 ${Math.round(W*100)/100}mm,打印将被裁切`)}function re(){I.push(te||ze.length>0?{pageIndex:I.length,sections:[...S],...te?{overflow:!0}:{},...ze.length>0?{warnings:[...ze]}:{}}:{pageIndex:I.length,sections:[...S]})}function Be(k){k>c&&(te=!0)}function ye(k=!1){if(S.length===0){te=te||k;return}re(),S=[],$=[],D=[],B=!0,te=!1,ze=[]}let de=0;for(;de<f.length;){const k=f[de];if(F.has(k.id)&&N.has(k.id)){de++;continue}const z=T.get(k.id);if(z&&z.anchorId!==k.id){de++;continue}if(yo(k)?.pageable===!1||z?.forceFirstPage){const W=I[0],H=W?.sections??S,Y=(U,Z,Q)=>{W?Q>0&&(W.warnings=[...W.warnings??[],`元素 ${U.id} 旋转 ${Z}° 后顶部超出页首 ${Math.round(Q*100)/100}mm,打印将被裁切`]):St(U,Z,Q)};if(z){let U=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,M;for(const q of z.ids){const le=O.get(q);if(!le)continue;const X=hn(le,t);U=Math.min(U,X.top),Z=Math.max(Z,X.outerBottom),Q=Math.max(Q,je({width:0,...le.options}).margin.bottom),X.rot!==void 0&&(M={el:le,rot:X.rot})}M&&Y(M.el,M.rot,-U);for(const q of z.ids)H.push({elementId:q,type:"element",renderTop:O.get(q)?.options?.top??0});!W&&Q>Number.NEGATIVE_INFINITY&&pe(z.band,Math.max(Z,0),Q)}else{const U=hn(k,t),Z=je({width:0,...k.options}).margin.bottom;W||pe(gn(k),U.outerBottom,Z),U.rot!==void 0&&Y(k,U.rot,-U.top),H.push({elementId:k.id,type:"element",renderTop:k.options?.top??0})}de++;continue}vo(k)?de=to(k,t,de):gr(k)?de=Qn(k,t,de):z?de=eo(z,de):de=Qr(k,t,f,de)}S.length>0&&re(),I.length===0&&I.push({pageIndex:0,sections:[]});const Qe=new Map(d.map((k,z)=>[k.id,z]));for(const k of I){const z=k.pageIndex>0?-b:0,W=p.map(Y=>({elementId:Y.id,type:"element",renderTop:(Y.options?.top??0)+z})),H=u.map(Y=>({elementId:Y.id,type:"element",renderTop:Y.options?.top??0}));k.sections=[...k.sections,...W,...H].sort((Y,U)=>(Qe.get(Y.elementId)??Number.MAX_SAFE_INTEGER)-(Qe.get(U.elementId)??Number.MAX_SAFE_INTEGER));for(const Y of[...p,...u]){const U=hn(Y,t),Z=wo(Y)?z:0;if(U.outerBottom+Z>c&&(k.overflow=!0),U.rot!==void 0&&U.top+Z<0){const Q=Math.round(-(U.top+Z)*100)/100;k.warnings=[...k.warnings??[],`元素 ${Y.id} 旋转 ${U.rot}° 后顶部超出页首 ${Q}mm,打印将被裁切`]}}}return Jr(),I;function Jr(){if(l)return;const k=e.margins.left;for(const z of I){const W=[];for(const H of z.sections){if(H.type==="flow-group")continue;const Y=O.get(H.elementId);if(!Y)continue;const{left:U,width:Z}=_m(Y,t),Q=k+U,M=Q+Z-n.width,q=-Q;M>.01?W.push(`元素 ${Y.id} 超出纸面右侧 ${Math.round(M*100)/100}mm,打印将被裁切`):q>.01&&W.push(`元素 ${Y.id} 超出纸面左侧 ${Math.round(q*100)/100}mm,打印将被裁切`)}W.length>0&&(z.warnings=[...z.warnings??[],...W])}}function Qr(k,z,W,H){const Y=gn(k),U=hn(k,z),Z=U.outerHeight,Q=()=>{const M=me(k,Y),q=B?M+U.shift:M,le=q-(k.options?.top??0);Be(U.outerBottom+le),U.rot!==void 0&&!B&&St(k,U.rot,-U.top),S.push({elementId:k.id,type:"element",renderTop:q}),ne(Y,Z),pe(Y,q+U.outerHeight,je({width:0,...k.options}).margin.bottom)};if(Z<=Te(Y)){if(Q(),yo(k)?.keepWithNext&&H+1<W.length){const M=W[H+1],q=hn(M,z).outerHeight;if(Z+q>_())return H+1;q>Te(Y)&&(S.pop(),$.pop(),ye(),Q())}return H+1}return ye(),Q(),H+1}function eo(k,z){const W=k.ids.map(X=>O.get(X)).filter(X=>!!X);let H=Number.POSITIVE_INFINITY,Y=Number.NEGATIVE_INFINITY,U=Number.NEGATIVE_INFINITY,Z;for(const X of W){const he=hn(X,t);H=Math.min(H,he.outerTop),Y=Math.max(Y,he.outerBottom),U=Math.max(U,je({width:0,...X.options}).margin.bottom),he.rot!==void 0&&(Z={el:X,rot:he.rot})}const Q=Math.max(Y-H,0),M=k.band,q=()=>{const X=B?Ie(M)-H:0;Be(H+X+Q),Z&&!B&&St(Z.el,Z.rot,-H);for(const he of W)S.push({elementId:he.id,type:"element",renderTop:(he.options?.top??0)+X});ne(M,Q),pe(M,H+X+Q,U)};if(Q<=Te(M))return q(),z+1;const le=Ie(M)+(B?0:H);return ye(le+Q>c),q(),z+1}function to(k,z,W){const H=k.options??{},Y=H._renderRows??[],U=z.get(k.id)?.measuredRowHeights??[],Z=(H._subtotalTemplates?.length??0)>0,Q=(H._summaryRows?.length??0)>0,M=Z?jc(Y,U,"subtotal"):0,q=Q?jc(Y,U,"summary"):0,le=ae=>Z&&ae.type==="subtotal"||Q&&ae.type==="summary",X=Y.filter(ae=>!le(ae)),he=U.filter((ae,we)=>!le(Y[we]));H._renderRows=X;const ge=Math.min(X.length,he.length),Ye=H._repeatHeaderCount??0,et=z.get(k.id)?.repeatHeaderHeight??U.slice(0,Ye).reduce((ae,we)=>ae+we,0),Re=_(),$t=pt(H),be=$t.top+$t.bottom,ve=gn(k),{top:mt,extra:On}=ee(k,ve);!B&&On>0&&ne(ve,On);let lt=mt,_e=0;const Nt=()=>{fe(k,z,ve);const ae=C.get(k.id)??[],we=ae.length>0?ya(k,ae,e):0,qe=mr(k)+pt(H).bottom,Ke=S[S.length-1],er=Ke?.type==="flow-group"&&Ke.elementId===k.id,Vi=er?Ke.groupTop??H.top??0:lt,Fl=er&&(Ke.startRow??0)===(Ke.endRow??0)&&!(Ke.subtotal||Ke.summary)?0:_e;return pe(ve,Vi+Fl+we,qe+we),W+1};if(et>Re)throw new Error(`表格 ${k.id} 的重复表头高度 (${et.toFixed(1)}mm) 超过页面可用高度 (${Re.toFixed(1)}mm),请减少重复表头行`);if(ge===0)return S.push({elementId:k.id,type:"table-slice",startRow:0,endRow:0,summary:q>0,renderTop:mt}),lt=mt,_e=Math.max(0,q),ne(ve,Math.max(0,q+be)),Nt();const on=he.slice(0,ge).reduce((ae,we)=>ae+we,0),Ue=Math.max(0,on+M+q+be);if(Em(k)?.enabled===!1){Ue>Te(ve)&&S.length>0&&ye();const ae=B?me(k,ve):mt;return S.push({elementId:k.id,type:"table-slice",startRow:0,endRow:ge,subtotal:M>0,summary:q>0,renderTop:ae}),lt=ae,_e=Math.max(0,Ue),ne(ve,Ue),Nt()}const _t=Cm(X,ge);let nt=0,an=!0,Pe=mt,$e=be;const In=()=>Te(ve)-$e,no=(ae,we)=>{S.push({elementId:k.id,type:"table-slice",startRow:nt,endRow:ae,subtotal:M>0,...!an&&we?{repeatHeader:!0}:{},renderTop:Pe}),ne(ve,Math.max(0,$e)),lt=Pe,_e=Math.max(0,$e),$e=0};for(const ae of _t){const we=he.slice(ae.start,ae.end).reduce((qe,Ke)=>qe+Ke,0);if(we+M<=In()){$e+=we;continue}ae.start>nt&&(no(ae.start,Ye>0),an=!1,nt=ae.start),ye(),Pe=me(k,ve),$e=be,an||($e+=et),$e+=we}if(nt<ge&&no(ge,Ye>0),q>0)if(q<=In()){const ae=S.length-1,we=S[ae];if(we&&we.type==="table-slice"&&we.elementId===k.id)S[ae]={...we,summary:!0},ne(ve,q),_e+=q;else{ye();const qe=me(k,ve);S.push({elementId:k.id,type:"table-slice",startRow:ge,endRow:ge,summary:!0,renderTop:qe}),lt=qe,_e=Math.max(0,q+be),ne(ve,Math.max(0,q+be))}}else{ye();const ae=me(k,ve);S.push({elementId:k.id,type:"table-slice",startRow:ge,endRow:ge,summary:!0,renderTop:ae}),lt=ae,_e=Math.max(0,q+be),ne(ve,Math.max(0,q+be))}return Nt()}function Qn(k,z,W){const H=k.options??{},Y=z.get(k.id)?.measuredFlowRowHeights??[],Z=(Array.isArray(H._flowRows)?H._flowRows:[]).length,Q=Yt(H.flowRowHeight);if(Z===0)return W+1;const M=Pn(H),q=go(Nc(k),H),le=Pe=>{if(!Pe)return 0;const $e=Number.parseFloat(Pe.borderWidth);return Number.isFinite($e)?$e*Uc:0},X=Pe=>{const $e=q?.edges?.[Pe];return le($e||(q?.all??void 0))},he=pt(H),ge=he.top+he.bottom+M.top+M.bottom+X("top")+X("bottom"),Ye=gn(k);let et=0,Re=ee(k,Ye).top,$t=B?0:Re,be=0,ve=Re,mt=0;const On=()=>(B?Te(Ye):_()-$t)-be-ge,lt=Pe=>{S.push({elementId:k.id,type:"flow-list-slice",startFlowRow:et,endFlowRow:Pe,renderTop:Re});const $e=B?Re:ie(Ye),In=Re+ge+be;ne(Ye,Math.max(0,In-$e)),ve=Re,mt=ge+be,be=0};let _e=0;for(;_e<Z;){const Pe=Y[_e]??Q;if(Pe<=On()){be+=Pe,_e++;continue}if(Pe+ge>_()){_e>et&&(lt(_e),et=_e),S.length>0&&ye(),Re=me(k,Ye),$t=B?0:Re,be=Pe,Be(Re+ge+be),_e++;continue}if(S.length===0&&be===0&&!B){be+=Pe,Be(Re+ge+be),_e++;continue}_e>et&&(lt(_e),et=_e),ye(),Re=me(k,Ye),$t=B?0:Re}et<Z&<(Z),fe(k,z,Ye);const Nt=C.get(k.id)??[],on=Nt.length>0?ya(k,Nt,e):0,Ue=S[S.length-1],_t=Ue?.type==="flow-group"&&Ue.elementId===k.id,nt=_t?Ue.groupTop??H.top??0:ve,an=_t&&(Ue.startFlowRow??0)===(Ue.endFlowRow??0)?0:mt;return pe(Ye,nt+an+on,mr(k)+he.bottom+on),W+1}function fe(k,z,W){const H=C.get(k.id)??[];if(H.length===0)return;const Y=ya(k,H,e),U=k.options??{};if(Y<=Te(W)){const Z=S.length-1,Q=S[Z];if(Q&&(Q.type==="table-slice"||Q.type==="flow-list-slice")&&Q.elementId===k.id){S[Z]={...Q,type:"flow-group",followElementIds:H,groupTop:Q.renderTop??U.top??0},ne(W,Y),P(H);return}}ye(),S.push({elementId:k.id,type:"flow-group",startRow:0,endRow:0,...gr(k)?{startFlowRow:0,endFlowRow:0}:{},followElementIds:H,groupTop:me(k,W)}),ne(W,Y),P(H)}}function Cm(e,t){const n=[];let r=0,o=1;for(let i=0;i<t;i++){for(const a of e[i]?.cells??[])!a.merged&&(a.rowspan??1)>1&&(o=Math.max(o,i+a.rowspan));i+1>=o&&(n.push({start:r,end:i+1}),r=i+1,o=r+1)}return n}function jc(e,t,n){let r=0;for(let o=0;o<e.length;o++)e[o]?.type===n&&(r+=t[o]??0);return r}const xo=25,Gc=5;function Am(e){return Math.max(xo,e)}function Vc(e,t,n=1.1){const r=t>0?e*n:e/n;return Am(Math.round(r))}function Om(e,t,n,r,o=.9){if(n<=0||r<=0)return 100;const i=Math.min(e/n,t/r)*o,a=Math.round(i*100);return Math.max(Gc,a)}const Im=2;function Yc(e){const t=e.gap??Im,n=[...e.units].sort((i,a)=>i.order-a.order);if(e.available<=0)return{movedIds:[],overflowRemains:!1};if(n.some(i=>i.width<=0))return{movedIds:[],overflowRemains:!1};const r=i=>{const a=n.filter(c=>!i.has(c.id));return e.pinned+a.reduce((c,s)=>c+s.width+t,0)+(i.size>0?e.moreTriggerWidth+t:0)<=e.available};if(r(new Set))return{movedIds:[],overflowRemains:!1};const o=new Set;for(const i of n)if(o.add(i.id),r(o))return{movedIds:[...o],overflowRemains:!1};return{movedIds:[...o],overflowRemains:!0}}function Rm(e){const t=e.gap??4,n=e.boundaryBottom-e.triggerBottom-t,r=e.triggerTop-e.boundaryTop-t;return n>=e.overlayHeight?"down":r>n?"up":"down"}function Pm(){return na().filter(e=>dt(e).blocked===!0)}Pm();function Dm(e){if(!e)return!1;const t=dt(e).blocked;return t===void 0?ar[e]?.blocked===!0:t}function Ln(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function xa(e){const t=qg(),n=dt(e).defaultOptions?.();if(n)return{...t,...n};const r=Rn(e)?.kind.defaultOptions?.();return r?{...t,...r}:t}function Ea(e,t){return{id:Ln(),options:{...xa(e),...t},printElementType:{type:e,title:dt(e).title||Rn(e)?.kind.label||String(e)}}}const $m=["left","top","width","height","marginTop","marginRight","marginBottom","marginLeft"];function Nm(e){return e.type??e.printElementType?.type}function Lm(e){const t=n=>(n??[]).filter(r=>!Dm(Nm(r)));return{...e,elements:t(e.elements),header:e.header?{...e.header,elements:t(e.header.elements)}:e.header,footer:e.footer?{...e.footer,elements:t(e.footer.elements)}:e.footer}}function Fm(e){const t={...e.options};for(const n of $m){const r=t[n];typeof r=="number"&&Number.isFinite(r)&&(t[n]=zm(sr(r)))}return{...e,options:t}}function zm(e){return Math.round(e*100)/100}function Bm(e){const t={...e};delete t.firstPageOverlay;const n=Lm(t);if(n.unit==="mm")return n;const r=n,o=i=>i?.map(Fm)??[];return{...r,unit:"mm",elements:o(r.elements),header:r.header?{...r.header,elements:o(r.header.elements)}:r.header,footer:r.footer?{...r.footer,elements:o(r.footer.elements)}:r.footer}}const Sa="标签纸",Ct={A4:{width:210,height:297,label:"A4 210×297mm",group:"常用纸张"},A3:{width:297,height:420,label:"A3 297×420mm",group:"常用纸张"},A5:{width:148,height:210,label:"A5 148×210mm",group:"常用纸张"},Letter:{width:216,height:279,label:"Letter 216×279mm",group:"常用纸张"},Legal:{width:216,height:356,label:"Legal 216×356mm",group:"常用纸张"},DOT_FULL:{width:241,height:279.4,label:"全等分 241×279.4mm",group:"针式打印纸"},DOT_HALF:{width:241,height:139.7,label:"二等分 241×139.7mm",group:"针式打印纸"},DOT_THIRD:{width:241,height:93.1,label:"三等分 241×93.1mm",group:"针式打印纸"},LABEL_80X60:{width:80,height:60,label:"80×60mm",group:Sa},LABEL_60X40:{width:60,height:40,label:"60×40mm",group:Sa},LABEL_40X30:{width:40,height:30,label:"40×30mm",group:Sa},THERMAL_57:{width:57,height:297,continuous:!0,label:"57mm",group:"小票纸"},THERMAL_80:{width:80,height:297,continuous:!0,label:"80mm",group:"小票纸"},THERMAL_110:{width:110,height:297,continuous:!0,label:"110mm",group:"小票纸"},CONTINUOUS:{width:80,height:297,continuous:!0,label:"连续纸(自定义宽度)",group:"连续纸"}};function _a(e){return!!e&&Ct[e]?.continuous===!0}function Xt(e){const t=_a(e.paperSize);let n;if(e.paperSize==="CUSTOM"||t){const r=Ct[e.paperSize];n={width:e.customWidth??r?.width??210,height:e.customHeight??r?.height??297}}else{const r=Ct[e.paperSize]||Ct.A4;n={width:r.width,height:r.height}}return e.orientation==="landscape"&&!t?{width:n.height,height:n.width}:n}const Ma=.75,Hm="线型 / 宽度 / 颜色即时生效,这三行显示的就是当前生效规格:已有边框时任改一行都会按新规格铺满四边并清掉单边覆盖;上、下、左、右只给选中的边加框,撤掉一边会把它其余三边落成单边;「无」清除边框,「内部」仅表格单元格可用",br=["top","right","bottom","left"];function Kc(e){const t={};for(const n of br){const r=e.map(o=>!!o?.[n]);t[n]=r.length>0&&r.every(Boolean)?"on":r.some(Boolean)?"mixed":"off"}return t}const Ta=[{value:"none",label:"无"},{value:"solid",label:"实线"},{value:"dashed",label:"虚线"},{value:"dotted",label:"点线"},{value:"double",label:"双线"}],Um=new Set(["solid","dashed","dotted","double"]),Fn="none";function yr(e,t){const n=e.borders?.[t];if(n&&n.style!==Fn&&typeof n.width=="number"&&Number.isFinite(n.width)&&n.width>0)return!0;const r=e.borderWidth;return e.borderStyle!==Fn&&typeof r=="number"&&Number.isFinite(r)&&r>0}function qm(e){const t={};for(const n of br)yr(e,n)&&(t[n]=e.borders?.[n]??{width:e.borderWidth});return t}function Wm(e){const t=e.borderWidth;return{width:typeof t=="number"&&Number.isFinite(t)&&t>0?t:Ma,style:e.borderStyle||"solid",color:e.borderColor||"#333333"}}function Xc(e,t,n){if(t!=="inner"){if(e.borders=void 0,t==="none"){e.borderWidth=0;return}e.borderWidth=n.width,e.borderStyle=n.style,e.borderColor=n.color}}function Zc(e){return br.some(t=>yr(e,t))}function ka(e,t){if(!e.length)return;const n=e[0]?.[t];return e.every(r=>r[t]===n)?n:"mixed"}function jm(e){if(!e)return;const t=typeof e.style=="string"&&Um.has(e.style)?e.style:"solid";return{width:e.width,style:e.style===void 0?void 0:t,color:e.color}}function Gm(e){const t=br.map(r=>e.borders?.[r]).filter(r=>typeof r?.width=="number"&&Number.isFinite(r.width)&&r.width>0).map(r=>jm(r));if(!t.length)return;const n=ka(t,"style");return{width:ka(t,"width"),style:n===void 0?"solid":n,color:ka(t,"color")}}function Jc(e){const t=e.borderWidth,n=typeof t=="number"&&Number.isFinite(t),r=Gm(e),o=n&&t>0;if(r&&!o)return r;const i=o?e.borderStyle||"solid":Fn;return n?{width:t,style:i,color:e.borderColor}:{width:void 0,style:i,color:void 0}}function Qc(e){const t=Jc(e);return{width:typeof t.width=="number"&&t.width>0?t.width:Ma,style:typeof t.style=="string"&&t.style!==Fn?t.style:"solid",color:typeof t.color=="string"?t.color:"#333333"}}function Vm(e,t){e.borderWidth=t.width,e.borderStyle=t.style,e.borderColor=t.color,e.borders=void 0}function Ym(e,t,n){if(t==="borderStyle"&&n===Fn){const r=Zc(e);e.borderStyle=Fn,r&&(e.borderWidth=0,e.borders=void 0);return}if(!Zc(e)){if(t==="borderStyle"){e.borderStyle=n,e.borderWidth=Ma;return}Object.assign(e,{[t]:n});return}if(t==="borderWidth"&&(typeof n!="number"||!(n>0))){e.borderWidth=typeof n=="number"&&n<0?0:n,e.borders=void 0;return}Vm(e,Wm({...e,[t]:n}))}function Ca(e,t,n,r){if(n!==yr(e,t)){if(!n){const o=e.borderWidth;if(typeof o!="number"||!(o>0)){ed(e,t,null);return}const i={};for(const a of br){if(a===t)continue;const l=e.borders?.[a];i[a]={width:l?.width??o,...l?.style!==void 0?{style:l.style}:e.borderStyle!==void 0?{style:e.borderStyle}:{},...l?.color!==void 0?{color:l.color}:e.borderColor!==void 0?{color:e.borderColor}:{}}}e.borders=i,e.borderWidth=0;return}ed(e,t,r??Qc(e))}}function ed(e,t,n){const r={...e.borders??{}};n?r[t]={width:n.width,style:n.style,color:n.color}:delete r[t],e.borders=r}const td=96/25.4,nd=1,Km=8,Xm=210;function Aa(e,t){if(!e||typeof e!="object")return;if(Array.isArray(e)){for(const r of e)Aa(r,t);return}const n=e;typeof n.printerDpi=="number"&&n.printerDpi>0&&t.add(n.printerDpi);for(const r of Object.keys(n)){if(r==="printerDpi")continue;const o=n[r];o&&typeof o=="object"&&Aa(o,t)}}function Zm(e){if(!e)return null;const t=new Set;return Aa(e,t),t.size?Math.max(...t):null}function Jm(e){const t=e?.pages?.[0]??e;return t?Xt(t).width*td:Xm*td}function Qm(e,t){return e<=0||t<=0?nd:Math.min(Km,Math.max(nd,Math.floor(e/t)))}function e0(e,t,n){const r=[];return e&&r.push({key:"dots",value:e/96,label:`点阵 ${e}dpi`,tip:`1 屏幕像素 = 1 个打印点(${e}dpi ÷ 96dpi)。条与间隙按纸面逐点显示,不会在屏幕上糊成一片`}),r.push({key:"fit",value:Qm(t,n),label:"适配",tip:"按容器宽放大到放得下整页的最大整数倍"},{key:"100",value:1,label:"100%",tip:"按 CSS 真实尺寸显示(1mm = 3.78 屏幕像素),热敏点距在此档不可分辨"},{key:"200",value:2,label:"200%",tip:"整数倍放大,避免非整数缩放带来的半像素边"},{key:"400",value:4,label:"400%",tip:"整数倍放大,避免非整数缩放带来的半像素边"}),r}function rd(e){return"100"}function t0(e,t){return!e||t==="dots"?"":`条码看不清?切「点阵 ${e}dpi」档(1 屏幕像素 = 1 打印点)`}const od="print-preview-zoom-guard";function n0(e,t){if(!e?.documentElement)return;let n=e.getElementById(od);n||(n=e.createElement("style"),n.id=od,(e.head??e.documentElement).appendChild(n)),n.textContent=`html{zoom:${t}}@media print{html{zoom:1 !important}}`}function r0(e,t,n){return e.some(r=>r.key===t)?t:rd()}function o0(e,t){return e.find(n=>n.key===t)?.value??1}function i0(){return na().filter(e=>dt(e).zoneAllowed===!0)}i0();function id(e){return dt(e).zoneAllowed===!0}function a0(e){return Xt(e)}function Oa(e){const t=a0(e),n=e.margins,r=e.header.height,o=e.footer.height,i=t.width-n.left-n.right,a=t.height-n.top-n.bottom-r-o,l=(c,s,d,p)=>({left:c,top:s,width:d,height:p});return{header:l(n.left,n.top,i,r),content:l(n.left,n.top+r,i,a),footer:l(n.left,t.height-n.bottom-o,i,o)}}function ad(e,t,n){const r=Oa(e);return r.footer.height>0&&n>=r.footer.top?"footer":r.header.height>0&&n<r.header.top+r.header.height?"header":"content"}function Ia(e,t){const n=e.options;n.width=Math.min(n.width,t.width),n.height=Math.min(n.height,t.height),n.left=Math.min(Math.max(0,n.left),t.width-n.width),n.top=Math.min(Math.max(0,n.top),t.height-n.height)}function s0(e,t){const n=Oa(t),r=e.zone||"content",o=n[r],i=o.left+e.options.left+e.options.width/2,a=o.top+e.options.top+e.options.height/2;let l=ad(t,i,a),c=!1;if(l!=="content"&&!id(e.printElementType.type)&&(l="content",c=!0),l!==r){const s=n[l];e.options.left=o.left+e.options.left-s.left,e.options.top=o.top+e.options.top-s.top,e.zone=l}return l!=="content"?Ia(e,n[l]):c&&Ia(e,n.content),{rejected:c}}const Ra=22,Pa=[1,2,5,10,20,50,100,200,500,1e3];function l0(e,t=64){const n=e*3.7795275590551185;for(const r of Pa)if(r*n>=t)return r;return Pa[Pa.length-1]}function c0(e){const t=Math.floor(Math.log10(e)+1e-9),n=e/10**t;return n===5||n===1&&e>=10?e/5:n===2?e/2:null}function d0(e){return Math.round(e*1e3)/1e3}function u0(e,t,n){if(t<e||n<=0)return[];const o=c0(n)??n,i=Math.ceil(e/o-1e-9)*o,a=Math.floor((t-i)/o+1e-9),l=[];for(let c=0;c<=a;c++){const s=d0(i+c*o);Math.abs(s/n-Math.round(s/n))<1e-6?l.push({mm:s,major:!0,label:String(s)}):l.push({mm:s,major:!1})}return l}const sd=["#000000","#333333","#666666","#999999","#cccccc","#ffffff","#e53935","#fb8c00","#1e88e5","#43a047","#8d6e63","#00acc1"],Eo=[{group:"position-size",groupLabel:"位置与尺寸",items:[{key:"ps-left",keywords:["X","横坐标","left","位置"]},{key:"ps-top",keywords:["Y","纵坐标","top","位置"]},{key:"ps-width",keywords:["W","宽度","width","尺寸"]},{key:"ps-height",keywords:["H","高度","height","尺寸"]},{key:"ps-margin-top",keywords:["上外边距","外边距","margintop"],default:0,defaultUnit:"mm"},{key:"ps-margin-right",keywords:["右外边距","外边距","marginright"],default:0,defaultUnit:"mm"},{key:"ps-margin-bottom",keywords:["下外边距","外边距","marginbottom"],default:0,defaultUnit:"mm"},{key:"ps-margin-left",keywords:["左外边距","外边距","marginleft"],default:0,defaultUnit:"mm"}]},{group:"appearance",groupLabel:"外观",items:[{key:"ap-font-family",keywords:["字体","字体名","字体族","fontfamily"]},{key:"ap-font-size",keywords:["字体大小","fontsize","字号"]},{key:"ap-font-weight",keywords:["字体粗细","粗体","bold"]},{key:"ap-align",keywords:["对齐","align"]},{key:"ap-vertical-align",keywords:["垂直对齐","verticalalign","顶对齐","底对齐"]},{key:"ap-color",keywords:["颜色","color"]},{key:"ap-bg-color",keywords:["背景色","background"]},{key:"ap-line-height",keywords:["行高","lineheight"]},{key:"ap-letter-spacing",keywords:["字间距","letterspacing"]},{key:"ap-text-fit",keywords:["溢出","溢出显示","截断","自动缩小","自适应行高","textfit","overflow"]},{key:"ap-shrink-min",keywords:["最小字号","缩放下限","shrinkminfontsize"],default:gc,defaultUnit:"pt"},{key:"ap-word-wrap",keywords:["自动换行","不换行","wordwrap"]},{key:"ap-keep-line-breaks",keywords:["保留换行符","换行符","手动换行","保留空格","连续空格","行首空格","keeplinebreaks"]},{key:"ap-long-text-indent",keywords:["首行缩进","缩进","indent","longtextindent","两字符","段首"],tip:"长文本每段首行空出的宽度,单位「字符」:填 2 即缩进两个汉字宽(中文排版惯例),按 em 落纸——字号被「自动缩小」压小时缩进同步变窄。仅长文本元素生效,写在普通文本上不生效"},{key:"ap-img-fit",keywords:["缩放模式","拉伸","等比","fit","contain","cover","填充","裁剪","剪裁","锚点"],tip:"图片在元素框内的缩放方式:包含=完整显示、可能留白;剪裁=铺满框并按「裁剪锚点」取一块;拉伸=填满框会变形;原始尺寸与缩小不放大。画布与三条出纸链路同一口径(缺省包含)"},{key:"ap-img-object-position",keywords:["裁剪锚点","剪裁锚点","锚点","objectposition","object-position","对齐点","上移","头顶"],tip:"取位(仅「剪裁」档有这一行):剪裁把图等比铺满元素框,多出来的那一条边按这里选的位置取舍。先选位置档(贴边/居中/贴另一头),再按百分比微调,0 贴左/贴顶,100 挪到另一头,水平与垂直各自独立;缺省取正中间(保住证件照头顶就选顶部)。其余缩放模式图比框小或刚好铺满,没有可裁的边,所以不出本行"},{key:"ap-img-fit-scale",keywords:["放大比例","剪裁放大","放大倍数","取景","裁切范围","fitscale","zoom"],default:fr,defaultUnit:"%",tip:"剪裁放大:等比铺满之后把画面再推大这么多,两轴才真的各多出一条边可裁——图与框同比例时不放大就什么都裁不掉。100=不放大(缺省),上限 400;超出框的部分由元素框裁掉。锚点选中的那一点既是取位的钉住点、也是放大的中心,两者共用同一个值。仅「剪裁」档生效,其余缩放模式不出本行"},{key:"ap-rotate",keywords:["旋转","角度","rotate","angle","顺时针","逆时针","90度","直角"],tip:"元素绕自身中心旋转的角度(度,0~359):出纸时按旋转后外接盒分页与结算,底部放不下自动移页,超出纸面左右缘或顶部会被裁切并给出纸提示。表格、流式列表与表格下方跟随区的元素不支持旋转(这三类不出本行);条码与二维码的任意角度需 385dpi 以上打印头,低分辨率打印机只按 90° 步进出纸"}]},{group:"flow-list",groupLabel:"流式列表",items:[{key:"fl-columns",keywords:["每行列数","列数","栏数","几列","flowcolumns"],tip:"一行排几个单元,必须由你指定——不随内容自动算列数。填的列数乘单元宽放不下元素框时只给提示、不改你的数,出纸按你填的排"},{key:"fl-row-height",keywords:["行高","每行高度","单元高度","flowrowheight"],tip:"每个单元行的最低高度(毫米),与表格行高同一口径:内容比它高时这一行会撑高,不会裁字"},{key:"fl-gap-x",keywords:["单元间距","横向间距","格间距","列间距","flowgapx"],tip:"相邻单元之间的横向留白(毫米);纵向不留缝,行与行的距离由行高承担"},{key:"fl-auto-span",keywords:["自适应","跨列","内容过长","占两列","自动换行","flowsautspan","flowautospan"],tip:"单元内容比一列还宽时,让它占掉两个或更多列位;当前行剩不够放就把整个单元挪到下一行行首(绝不把词切两半)。默认关——开着时出纸栏数由字号与框宽决定"},{key:"fl-max-span",keywords:["最多跨几列","跨列上限","flowmaxspan"],tip:"跨列的列数上限,最大只能等于「每行列数」:把每行列数改小时,这里会被一并顶回去"},{key:"fl-layout-mode",default:"fixed",keywords:["布局模式","容器模式","固定高度","动态分页","自动高度","flowlayoutmode"],tip:"容器高度由谁决定:固定高度=维持设计高度、一框一页,超高裁切(存量模板默认值,输出不变);动态分页=容器高度由内容撑开,内容满页后按行续页,每一页都画完整边框,元素下方的跟随区与表格同一套规则"},{key:"fl-padding-top",keywords:["上内边距","内边距","顶边距","flowpaddingtop"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器顶部与第一行内容之间的留白(毫米),仅动态模式生效;每页切片都按它留白并计入分页预算,负值与非法值按 0 处理"},{key:"fl-padding-right",keywords:["右内边距","内边距","右边距","flowpaddingright"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器右侧与内容之间的留白(毫米),会压缩参与列宽估算的内容宽度,仅动态模式生效"},{key:"fl-padding-bottom",keywords:["下内边距","内边距","底边距","flowpaddingbottom"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器底部与最后一行内容之间的留白(毫米),每页切片都按它留白并计入分页预算,仅动态模式生效"},{key:"fl-padding-left",keywords:["左内边距","内边距","左边距","flowpaddingleft"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器左侧与内容之间的留白(毫米),会压缩参与列宽估算的内容宽度,仅动态模式生效"}]},{group:"code",groupLabel:"条码设置",items:[{key:"cd-type",keywords:["码制","条码类型","条形码类型","barcodetype","code128","ean13","code39","itf14"]},{key:"cd-dpi",keywords:["打印机分辨率","dpi","打印点","点阵对齐","203","300"]},{key:"cd-bar-width",keywords:["条宽","条粗细","barwidth","模块宽"]},{key:"cd-bar-quiet-zone",keywords:["条码静区","条码白边","条形码留白","条码空白边","barquietzone"],default:Mc,defaultUnit:"模块",tip:"条形码左右两端的空白格数(1 格 = 1 条宽):缺省 10,正是一维码码制要求的下限;数值越小白边越窄、同样的框内条越粗(可放大)。填 0 即不留白边,但静区参与「条→空→条」跳变,紧邻文字或表格线时可能扫不出,需实打验证"},{key:"cd-bar-height",keywords:["条高","条码高度","条区高度","条码多高","barheight"],default:Kt,defaultUnit:"模块",tip:"黑白条本体的目标高度(mm,不含下方文字):折算粒度就是每模块物理宽,所以只能精确到它的整数倍。条宽优先——可用框高装不下时期望条高让位,绝不把条宽挤窄(热敏出纸清晰度靠条宽)。与「最大高度」分工不同:那条限的是整图(含文字)的上限"},{key:"cd-show-text",keywords:["显示文本","条码文本","显示数字"]},{key:"cd-font-size",keywords:["条码字号","文本字号"],default:po,defaultUnit:"模块"},{key:"cd-ec-level",keywords:["纠错级别","容错","qrcodelevel"]},{key:"cd-quiet-zone",keywords:["静区","静区宽度","白边","空白边","留白","铺满","quietzone"],default:Tc,defaultUnit:"模块",tip:"二维码四周留出的空白格数:0 即不留白边、码面等比铺满元素框(此时靠框外的白纸充当静区);数值越大白边越宽、码面在框内越小(缺省 0,需 ISO/IEC 18004 推荐静区时填 4)"},{key:"cd-fit",keywords:["缩放模式","拉伸","等比","fit","contain","cover"]},{key:"cd-max-width",keywords:["最大宽度","最大宽","maxwidth"]},{key:"cd-max-height",keywords:["最大高度","最大高","maxheight"]}]},{group:"content",groupLabel:"内容",items:[{key:"ct-title",keywords:["内容","文本","title"]},{key:"ct-formatter",keywords:["格式化","表达式","formatter"]},{key:"ct-table-mode",keywords:["数据模式","静态布局","动态数据"]},{key:"ct-table-source",keywords:["数据源","列表字段"]},{key:"ct-table-font",keywords:["默认字号","默认颜色","默认内边距"]},{key:"ct-table-cols",keywords:["列宽","表格列"]}]},{group:"border-bg",groupLabel:"边框与背景",items:[{key:"bb-border-style",keywords:["线型","边框线型","实线","虚线","点线","双线","borderstyle"]},{key:"bb-border-width",keywords:["边框宽度","border"]},{key:"bb-border-color",keywords:["边框颜色"]},{key:"bb-bg-color",keywords:["背景色","background"]}]},{group:"binding",groupLabel:"字段绑定",items:[{key:"bd-formatter",keywords:["格式化","表达式","formatter","fx","字段","绑定","field"]},{key:"bd-content",keywords:["内容","表达式","文本","变量"]}]},{group:"pagination",groupLabel:"分页",items:[{key:"pg-enabled",keywords:["分页","pagination","启用分页"]},{key:"pg-pageable",keywords:["参与分页","pageable"]},{key:"pg-keep-with-next",keywords:["同页","keepWithNext"]}]},{group:"advanced",groupLabel:"高级",items:[{key:"ad-locked",keywords:["锁定","lock"]},{key:"ad-fixed",keywords:["每页重复","repeat"]},{key:"ad-fixed-position",keywords:["固定","每页固定","fixed"]},{key:"ad-z-index",keywords:["层级","zindex"]},{key:"ad-delete",keywords:["删除"]}]}];function Ce(e){for(const t of Eo){const n=t.items.find(r=>r.key===e);if(n)return n.tip??""}return""}function ld(e,t){const n=e.trim().toLowerCase();return n?t.some(r=>r.toLowerCase().includes(n)):!0}function p0(e){const t=[],n=new Set;for(const r of Eo){const o=r.items.filter(i=>ld(e,[...i.keywords,r.groupLabel]));if(o.length>0){t.push(r.group);for(const i of o)n.add(i.key)}}return{groups:t,itemKeys:n}}function f0(e){for(const t of Eo)for(const n of t.items)if(n.key===e&&n.default!==void 0)return{value:n.default,unit:n.defaultUnit}}function h0(e){return/[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6]/.test(e)}function g0(e){let t=0;for(const n of e)t+=h0(n)?1:.55;return t}function m0(e){return g0(e)>=4}const b0=new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),y0=new Set(["new","function","class","this","delete","typeof","void","in","of","var","let","const","return","if","while","for"]);function Da(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e[n];if(/\s/.test(o)){n++;continue}if(/[0-9]/.test(o)||o==="."&&n+1<r&&/[0-9]/.test(e[n+1])){let l=n;for(;l<r&&/[0-9.]/.test(e[l]);)l++;t.push({type:"num",value:e.slice(n,l),position:n}),n=l;continue}if(o==="'"||o==='"'){let l=n+1,c="";for(;l<r&&e[l]!==o;)e[l]==="\\"&&l+1<r?(c+=e[l+1],l+=2):(c+=e[l],l++);if(l>=r)throw new Error("字符串未闭合");t.push({type:"str",value:c,position:n}),n=l+1;continue}if(/[A-Za-z_$]/.test(o)){let l=n;for(;l<r&&/[A-Za-z0-9_$]/.test(e[l]);)l++;const c=e.slice(n,l);if(y0.has(c))throw new Error(`不允许使用关键字: ${c}`);if(b0.has(c))throw new Error(`禁止访问: ${c}`);c==="true"||c==="false"?t.push({type:"bool",value:c,position:n}):t.push({type:"ident",value:c,position:n}),n=l;continue}const i=e.slice(n,n+3);if(i==="==="||i==="!=="){t.push({type:"punc",value:i,position:n}),n+=3;continue}const a=e.slice(n,n+2);if(a==="=>")throw new Error("不允许函数定义");if(["==","!=","<=",">=","&&","||"].includes(a)){t.push({type:"punc",value:a,position:n}),n+=2;continue}if(o==="=")throw new Error("不允许赋值");if(o===";")throw new Error("不允许多条语句");if("+-*/%()[]{},:.?!<>".includes(o)){t.push({type:"punc",value:o,position:n}),n++;continue}throw new Error(`非法字符: ${o}`)}return t}function $a(e){return new v0(e).parse()}class v0{constructor(t){this.pos=0,this.tokens=t}parse(){const t=this.parseTernary();if(this.pos<this.tokens.length)throw new Error(`表达式存在多余内容: ${this.tokens[this.pos].value}`);return t}peek(){return this.tokens[this.pos]}next(){const t=this.tokens[this.pos++];if(!t)throw new Error("表达式意外结束");return t}eatPunc(t){const n=this.peek();return n&&n.type==="punc"&&n.value===t?(this.pos++,!0):!1}expectPunc(t){if(!this.eatPunc(t)){const n=this.peek()?.position??0;throw new Error(`位置 ${n}: 期望 "${t}"`)}}parseTernary(){const t=this.parseLogicalOr();if(this.eatPunc("?")){const n=this.parseTernary();this.expectPunc(":");const r=this.parseTernary();return{type:"ternary",cond:t,consequent:n,alternate:r}}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.eatPunc("||");){const n=this.parseLogicalAnd();t={type:"binary",op:"||",left:t,right:n}}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.eatPunc("&&");){const n=this.parseEquality();t={type:"binary",op:"&&",left:t,right:n}}return t}parseEquality(){let t=this.parseRelational();for(;;){const n=this.peek();if(n?.type==="punc"&&["==","!=","===","!=="].includes(n.value)){this.pos++;const r=this.parseRelational();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseRelational(){let t=this.parseAdditive();for(;;){const n=this.peek();if(n?.type==="punc"&&["<",">","<=",">="].includes(n.value)){this.pos++;const r=this.parseAdditive();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseAdditive(){let t=this.parseMultiplicative();for(;;){const n=this.peek();if(n?.type==="punc"&&(n.value==="+"||n.value==="-")){this.pos++;const r=this.parseMultiplicative();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseMultiplicative(){let t=this.parseUnary();for(;;){const n=this.peek();if(n?.type==="punc"&&["*","/","%"].includes(n.value)){this.pos++;const r=this.parseUnary();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseUnary(){const t=this.peek();if(t?.type==="punc"&&["!","-","+"].includes(t.value)){this.pos++;const n=this.parseUnary();return{type:"unary",op:t.value,arg:n,prefix:!0}}return this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.eatPunc(".")){const n=this.next();if(n.type!=="ident")throw new Error(`位置 ${n.position}: 成员访问需要属性名`);t={type:"member",object:t,property:n.value,computed:!1}}else if(this.eatPunc("[")){const n=this.parseTernary();this.expectPunc("]"),n.type==="str"?t={type:"member",object:t,property:n.value,computed:!1}:t={type:"member",object:t,property:n.name??String(n.value),computed:!0}}else if(this.peek()?.type==="punc"&&this.peek()?.value==="("&&(t.type==="ident"||t.type==="member")){this.pos++;const n=this.parseArgs();t={type:"call",callee:t,args:n}}else return t}parseArgs(){const t=[];if(this.eatPunc(")"))return t;for(;;){if(t.push(this.parseTernary()),this.eatPunc(")"))return t;this.expectPunc(",")}}parsePrimary(){const t=this.next();if(t.type==="num"){const n=Number(t.value);if(isNaN(n))throw new Error(`非法数字: ${t.value}`);return{type:"num",value:n}}if(t.type==="str")return{type:"str",value:t.value};if(t.type==="bool")return{type:"bool",value:t.value==="true"};if(t.type==="ident")return{type:"ident",name:t.value};if(t.value==="("){const n=this.parseTernary();return this.expectPunc(")"),n}if(t.value==="["){const n=[];if(!this.eatPunc("]"))for(;n.push(this.parseTernary()),!this.eatPunc("]");)this.expectPunc(",");return{type:"array",elements:n}}if(t.value==="{"){const n=[];if(!this.eatPunc("}"))for(;;){const r=this.next();if(r.type!=="ident"&&r.type!=="str")throw new Error(`位置 ${r.position}: 对象键必须是标识符或字符串`);if(this.expectPunc(":"),n.push({key:r.value,value:this.parseTernary()}),this.eatPunc("}"))break;this.expectPunc(",")}return{type:"object",properties:n}}throw new Error(`位置 ${t.position}: 意外的符号: ${t.value}`)}}const cd=20,w0=8;function rt(e,t=0){if(typeof e=="number")return Number.isFinite(e)?e:t;if(typeof e=="string"){const n=e.trim();if(n==="")return t;const r=Number(n);return Number.isFinite(r)?r:t}return e==null?t:typeof e=="boolean"?e?1:0:t}function x0(e){if(typeof e=="number")return Number.isFinite(e);if(typeof e=="string"){const t=e.trim();return t!==""&&Number.isFinite(Number(t))}return!1}function zn(e){return!Number.isFinite(e)||Number.isInteger(e)||Math.abs(e)>=1e15?e:Number(e.toPrecision(12))}function Bn(e){if(!Number.isFinite(e)||Number.isInteger(e))return 0;const t=String(e);if(t.includes("e")||t.includes("E"))return 0;const n=t.indexOf(".");return n===-1?0:t.length-n-1}function Na(e,t){if(!Number.isFinite(e))return 0;const n=Math.min(Math.max(t,0),12);if(n===0)return Math.round(e);const r=10**n,o=e*r;return!Number.isFinite(o)||Math.abs(o)>=1e15?zn(e):Math.round(o)/r}function La(e,t){const n=rt(e),r=rt(t),o=n+r;return Na(o,Math.max(Bn(n),Bn(r)))}function Fa(e,t){const n=rt(e),r=rt(t),o=n-r;return Na(o,Math.max(Bn(n),Bn(r)))}function dd(e,t){const n=rt(e),r=rt(t),o=n*r;return Na(o,Bn(n)+Bn(r))}function ud(e,t){const n=rt(e),r=rt(t);return r===0?0:zn(n/r)}function E0(e,t){const n=rt(e),r=rt(t);return r===0?0:zn(n%r)}function S0(e){if(e==null)return 2;const t=Math.trunc(rt(e,2));return Number.isFinite(t)?Math.min(Math.max(t,-cd),cd):2}function So(e,t,n){const r=rt(e,0),o=S0(t);if(r===0)return 0;if(Math.abs(r)>=1e21)return zn(r);const i=Math.max(o,0)+w0,a=r.toFixed(i);if(!/^-?\d+(\.\d+)?$/.test(a))return zn(r);const l=a.startsWith("-"),c=a.replace("-","").replace(".","");let s=BigInt(c||"0");l&&(s=-s);const d=10n**BigInt(i-o),p=s<0n?-1n:1n,u=s<0n?-s:s;let f=u/d;const g=u%d,m=2n*g;n==="up"?g!==0n&&(f+=1n):n!=="down"&&m>=d&&(m>d||n==="half-up"||f%2n===1n)&&(f+=1n);const b=p*f;return zn(o>=0?Number(b)/10**o:Number(b)*10**-o)}const za={Math,Number,String,Boolean,parseInt,parseFloat,isNaN,true:!0,false:!1,null:null,undefined:void 0},_0=new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),M0=new Set(["Number","String","Boolean","parseInt","parseFloat","isNaN"]);function Xe(e,t,n={}){switch(e.type){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"ident":return T0(e.name,t);case"binary":return k0(e,t,n);case"unary":return C0(e,t,n);case"ternary":return Xe(e.cond,t,n)?Xe(e.consequent,t,n):Xe(e.alternate,t,n);case"member":return I0(e,t,n);case"call":return R0(e,t,n);case"array":return e.elements.map(r=>Xe(r,t,n));case"object":return Object.fromEntries(e.properties.map(r=>[r.key,Xe(r.value,t,n)]))}}function T0(e,t,n){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];if(Object.prototype.hasOwnProperty.call(za,e))return za[e];throw new Error(`未定义的标识符: ${e}`)}function k0(e,t,n){const r=Xe(e.left,t,n),o=Xe(e.right,t,n);switch(e.op){case"+":return O0(r,o)?La(r,o):A0(r,o);case"-":return Fa(r,o);case"*":return dd(r,o);case"/":return ud(r,o);case"%":return E0(r,o);case"<":return r<o;case">":return r>o;case"<=":return r<=o;case">=":return r>=o;case"==":return r==o;case"!=":return r!=o;case"===":return r===o;case"!==":return r!==o;case"&&":return r&&o;case"||":return r||o;default:throw new Error(`未知运算符: ${e.op}`)}}function C0(e,t,n){const r=Xe(e.arg,t,n);switch(e.op){case"-":return Fa(0,r);case"+":return rt(r);case"!":return!r;default:throw new Error(`未知一元运算符: ${e.op}`)}}function A0(e,t){return`${e==null?"":String(e)}${t==null?"":String(t)}`}function O0(e,t){const n=pd(e),r=pd(t);return n==="other"||r==="other"?!1:n==="num"||r==="num"}function pd(e){return e==null||e===""?"neutral":x0(e)?"num":"other"}function I0(e,t,n){const r=Xe(e.object,t,n);if(r==null)throw new Error("无法访问空值的属性");if(_0.has(e.property))throw new Error(`禁止访问属性: ${e.property}`);return r[e.property]}function R0(e,t,n){if(e.callee.type==="ident"&&M0.has(e.callee.name)){const o=za[e.callee.name],i=e.args.map(a=>Xe(a,t,n));return o(...i)}if(e.callee.type==="member"&&e.callee.object.type==="ident"&&e.callee.object.name==="Math"){const o=Math[e.callee.property];if(typeof o!="function")throw new Error(`Math.${e.callee.property} 不是方法`);const i=e.args.map(a=>Xe(a,t,n));return o(...i)}let r;if(e.callee.type==="ident")r=e.callee.name;else if(e.callee.type==="member")throw new Error("不支持方法调用,请使用顶级函数");if(r&&n[r]){const o=e.args.map(i=>Xe(i,t,n));return n[r](...o)}throw r&&Object.prototype.hasOwnProperty.call(t,r)?new Error(`${r} 不是函数`):new Error(`不允许调用: ${r??"表达式"}`)}function P0(e){const t=[];let n=0;const r=e.length;for(;n<r;){if(e[n]==="{"){let i=1,a=n+1;for(;a<r&&i>0;)e[a]==="{"?i++:e[a]==="}"&&i--,a++;if(i!==0)throw new Error(`位置 ${n}: 花括号未闭合`);const l=e.slice(n+1,a-1);if(l.trim()==="")throw new Error(`位置 ${n}: 空表达式`);const c=Da(l),s=$a(c);t.push({type:"expr",expression:s}),n=a;continue}let o=n;for(;o<r&&e[o]!=="{";)e[o]==="\\"&&o+1<r&&(e[o+1]==="{"||e[o+1]==="}")?o+=2:o++;t.push({type:"text",value:e.slice(n,o).replace(/\\([{}])/g,"$1")}),n=o}return{type:"template",parts:t}}function D0(e,t,n={}){let r="";for(const o of e.parts)if(o.type==="text")r+=o.value;else{const i=Xe(o.expression,t,n);r+=String(i??"")}return r}function fd(e,t={}){const n=P0(e);return r=>D0(n,r,t)}function vr(e,t){if(e==null||t==null)return;if(typeof e=="object"&&t in e)return e[t];const n=t.split(".");let r=e;for(const o of n){if(r==null)return;r=r[o]}return r}function hd(e){const t=Number(e);if(isNaN(t))return String(e);const n=t<0?"-":"",r=Math.abs(t),[o,i]=r.toFixed(2).split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return`${n}${a}.${i}`}function gd(e,t){let n;if(e instanceof Date)n=e;else if(typeof e=="number")n=new Date(e);else if(typeof e=="string")n=new Date(e);else return String(e);if(isNaN(n.getTime()))return String(e);const r=o=>String(o).padStart(2,"0");return t.replace("YYYY",String(n.getFullYear())).replace("MM",r(n.getMonth()+1)).replace("DD",r(n.getDate())).replace("HH",r(n.getHours())).replace("mm",r(n.getMinutes())).replace("ss",r(n.getSeconds()))}const Ba=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],$0=["","拾","佰","仟"],N0=["","万","亿","万亿","亿亿"];function L0(e){let t="",n=!1;for(let r=3;r>=0;r--){const o=Math.floor(e/10**r)%10;if(o===0){t&&(n=!0);continue}n&&(t+="零",n=!1),t+=Ba[o]+$0[r]}return t}function md(e){const t=Number(e);if(isNaN(t))return String(e);if(t===0)return"零元整";const n=t<0?"负":"",[r,o]=Math.abs(t).toFixed(2).split("."),i=Math.ceil(r.length/4);let a="",l=!1;for(let d=i-1;d>=0;d--){const p=r.length-d*4,u=parseInt(r.slice(Math.max(0,p-4),p),10);if(u===0){a&&(l=!0);continue}a&&(l||u<1e3)&&(a+="零"),l=!1,a+=L0(u)+(N0[d]??"")}a=`${a||"零"}元`;const c=parseInt(o[0],10),s=parseInt(o[1],10);return c===0&&s===0?a+="整":(c===0?a+="零":a+=Ba[c]+"角",s>0&&(a+=Ba[s]+"分")),n+a}function bd(e,t,n){return e?t:n}function Ha(e,t){return e.reduce((n,r)=>n+(Number(vr(r,t))||0),0)}function yd(e,t){return e.length===0?0:Ha(e,t)/e.length}function vd(e,t){return e.length}function wd(e,t){return e.length===0?0:Math.min(...e.map(n=>Number(vr(n,t))||0))}function xd(e,t){return e.length===0?0:Math.max(...e.map(n=>Number(vr(n,t))||0))}function Ed(...e){return e.reduce((t,n)=>La(t,n),0)}function Sd(...e){return e.length===0?0:e.slice(1).reduce((t,n)=>Fa(t,n),La(e[0],0))}function _d(...e){return e.length===0?0:e.reduce((t,n)=>dd(t,n),1)}function Md(e,t){return ud(e,t)}function Td(e,t){return So(e,t,"half-up")}function _o(e,t){return So(e,t,"up")}function Mo(e,t){return So(e,t,"down")}function kd(e,t){return So(e,t,"half-even")}class F0{constructor(){this.functions={}}registerFunction(t,n){this.functions[t]=n}evaluate(t,n){const r=Da(t),o=$a(r);return Xe(o,n,this.functions)}render(t,n){return fd(t,this.functions)(n)}}const Ua=new F0,z0={MONEY:hd,DATE:gd,UPPER:md,IF:bd,CONCAT:(...e)=>e.filter(t=>t!=null).map(String).join(""),IFEMPTY:(e,t)=>e!=null&&e!==""?String(e):t,LEN:e=>String(e).length,ADD:Ed,SUB:Sd,MUL:_d,DIV:Md,ROUND:Td,ROUNDUP:_o,CEIL:_o,ROUNDDOWN:Mo,FLOOR:Mo,ROUNDBANK:kd};for(const[e,t]of Object.entries(z0))Ua.registerFunction(e,t);function B0(e,t,n){switch(e.toUpperCase()){case"SUM":return Ha(n,t);case"AVG":return yd(n,t);case"COUNT":return vd(n);case"MIN":return wd(n,t);case"MAX":return xd(n,t);default:return 0}}function H0(e,t){return Ua.evaluate(e,t)}function Zt(e,t){if(!e)return"";if(!e.includes("{"))return e;const n=Array.isArray(t.rows)?t.rows:[],r=e.replace(/\{([^}]+)\}/g,(o,i)=>{let a=i.trim();return a=a.replace(/\b(SUM|AVG|COUNT|MIN|MAX)\(([^)]+)\)/g,(l,c,s)=>{const d=s.trim().replace(/^['"]|['"]$/g,"");return String(B0(c,d,n))}),`{${a}}`});try{return Ua.render(r,t)}catch{return e}}function Cd(e,t,n,r){const o={...Co(),...t??{}},i=JSON.parse(JSON.stringify(e));i.header?.elements&&(i.header.elements=i.header.elements.map(l=>qa(l,o,n))),i.footer?.elements&&(i.footer.elements=i.footer.elements.map(l=>qa(l,o,n))),i.elements=i.elements.map(l=>qa(l,o,n));const a=r??n;if(a&&i.fonts?.length){const l=a.replace(/\/+$/,"");i.fonts=i.fonts.map(c=>({...c,files:(c.files??[]).map(s=>({...s,url:s.url?.startsWith("/")&&!s.url.startsWith("//")?l+s.url:s.url}))}))}return i}function qa(e,t,n){const r={...e,options:{...e.options}};if(!(r.type==="flowList"||r.printElementType?.type==="flowList")&&typeof r.options.formatter=="string"){const c=r.options.formatter;xr(c)?r.options.rawFormatter=c:r.options.formatter=Zt(c,t)}if((r.type==="image"||r.printElementType?.type==="image")&&typeof r.options.src=="string"){let c=r.options.src;c.includes("{")&&(c=Zt(c,t)),c&&n&&!/^([a-z][a-z\d+\-.]*:|\/\/)/i.test(c)&&(c=n.replace(/\/+$/,"")+(c.startsWith("/")?c:`/${c}`)),r.options.src=c}(r.type==="table"||r.printElementType?.type==="table")&&q0(r,t),(r.type==="flowList"||r.printElementType?.type==="flowList")&&U0(r,t);const a=r.type||r.printElementType?.type||"text",l=Rn(a)?.binding?.bind;if(l){const c=l(r.options,t);c&&typeof c=="object"&&Object.assign(r.options,c)}return r}function U0(e,t){const n=typeof e.options.formatter=="string"?e.options.formatter:"",r={...e.options,dataSource:e.options.dataSource??uo(n,t)},{list:o,key:i}=Ad(r,t),a=c=>i?{...t,...c,[i]:c}:{...t,...c},l=o.map(c=>n?xr(n)?n:Zt(n,a(c)):String(c??""));if(e.options._flowItems=l,e.options._flowRawFormatter=xr(n)?n:void 0,un(e.options.flowLayoutMode)==="dynamic"){const c=xc(e.options.width??0,Pn(e.options)),s=l.length>0?l:String(e.options.testData??"").split(/\r?\n/).map(d=>d.trim()).filter(Boolean);e.options._flowRows=la(s,{width:c,columns:ut(e.options.flowColumns),gapX:bt(e.options.flowGapX),fontSizePt:e.options.fontSize??12,autoSpan:e.options.flowAutoSpan===!0,maxSpan:pn(e.options.flowMaxSpan,e.options.flowColumns)})}}function Ad(e,t){const n=e.dataSource??e.fields?.[0]?.dataSource??e.fields?.[0]?.field;if(n&&Array.isArray(t[n]))return{list:t[n],key:n};for(const[r,o]of Object.entries(t))if(Array.isArray(o))return{list:o,key:r};return{list:[],key:n}}function q0(e,t){const n=e.options,r=n.tableRows;if(!Array.isArray(r)||r.length===0)return;const o=n.tableMode??"dynamic",{list:i,key:a}=o==="dynamic"?Ad(n,t):{list:[],key:void 0},l=g=>a?{...t,...g,[a]:g}:{...t,...g},c=a?i.map(g=>({...g,[a]:g})):i,s=[],d=[],p=[],u=[];let f=-1;for(const g of r){if(o==="dynamic"&&g.type==="data"){W0(g.cells);for(const m of i){f<0&&(f=s.length);const b=l(m);s.push(ko(g,v=>To(v,b))),d.push(b)}continue}if(o==="dynamic"&&g.type==="subtotal"){const m=ko(g,b=>To(b,{rows:c,...t}),!0);p.push(m),s.push(m);continue}if(o==="dynamic"&&g.type==="summary"){const m=ko(g,b=>To(b,{rows:c,...t}));u.push(m),s.push(m);continue}s.push(ko(g,m=>To(m,t)))}n._renderRows=s,n._repeatHeaderCount=j0(r),n._dataRowCtx=d,n._dataStartIdx=f<0?s.length:f,n._subtotalTemplates=p,n._summaryRows=u,n._mainData=t}function W0(e){const t=new Set;e.forEach((n,r)=>{if(!n||n.merged)return;const o=Math.max(n.colspan??1,1);for(let i=1;i<o;i++)t.add(r+i)}),e.forEach((n,r)=>{n.rowspan&&(n.rowspan=1),n.merged&&!t.has(r)&&(n.merged=!1)})}function To(e,t){const n=e.formatter;return n?xr(n)?n:Zt(n,t):""}function ko(e,t,n=!1){return{type:e.type,height:e.height??8,cells:e.cells.map(r=>({content:r.merged?"":t(r),...(n||xr(r.formatter))&&!r.merged?{rawFormatter:r.formatter??""}:{},cellType:r.cellType,barcodeType:r.barcodeType,qrCodeLevel:r.qrCodeLevel,qrQuietZone:r.qrQuietZone,barQuietZone:r.barQuietZone,barHeight:r.barHeight,barWidth:r.barWidth,barFontSize:r.barFontSize,showBarcodeText:r.showBarcodeText,printerDpi:r.printerDpi,fit:r.fit,objectPosition:r.objectPosition,fitScale:r.fitScale,maxWidth:r.maxWidth,maxHeight:r.maxHeight,rowspan:r.rowspan??1,colspan:r.colspan??1,merged:r.merged===!0,...r.mergeSameValue===!0?{mergeSameValue:!0}:{},align:r.align,valign:r.valign,fontSize:r.fontSize,fontFamily:r.fontFamily,fontWeight:r.fontWeight,color:r.color,backgroundColor:r.backgroundColor,borders:r.borders,padding:r.padding,wordWrap:r.wordWrap,textFit:r.textFit,shrinkMinFontSize:r.shrinkMinFontSize}))}}function j0(e){const t=G0(e);return t===0||!e.slice(0,t).some(r=>r.repeatOnPage===!0)?0:Y0(e,t)}function G0(e){let t=0;for(const n of e){if(n?.type!=="header")break;t++}return t}function V0(e,t){for(let n=0;n<t;n++)for(const r of e[n]?.cells??[])if(!r?.merged&&n+(r?.rowspan??1)>t)return!1;return!0}function Y0(e,t){for(let n=t;n>=1;n--)if(V0(e,n))return n;return 1}const wr=e=>String(e).padStart(2,"0");function Co(e=new Date,t={}){return{printDate:`${e.getFullYear()}-${wr(e.getMonth()+1)}-${wr(e.getDate())}`,printTime:`${wr(e.getHours())}:${wr(e.getMinutes())}:${wr(e.getSeconds())}`,pageIndex:t.pageIndex??1,totalPages:t.totalPages??1}}function xr(e){return typeof e=="string"&&/\b(pageIndex|totalPages)\b/.test(e)}function Wa(e,t=new Date){const{printDate:n,printTime:r}=Co(t);return e.replace(/\{printDate\}/g,n).replace(/\{printTime\}/g,r)}function Er(e){const t=[];for(const n of e??[]){const r=n?.family?.trim();if(!r)continue;const o=`"${r.replace(/"/g,"")}"`;for(const i of n.files??[]){const a=i?.url?.trim();if(!a)continue;const l=Number.isFinite(i.weight)?Number(i.weight):400,c=i.style==="italic"?"italic":"normal";t.push(`@font-face{font-family:${o};src:url("${a}")${K0(a)};font-weight:${l};font-style:${c};font-display:block;}`)}}return t.length?`${t.join("")}
|
|
2
|
-
`:""}function
|
|
1
|
+
(function(so){typeof define=="function"&&define.amd?define(so):so()})((function(){"use strict";function so(){let e=0;return function(){return e+=1,`cell-${Date.now().toString(36)}-${e}`}}function Cg(){let e=0;return function(){return e+=1,`row-${Date.now().toString(36)}-${e}`}}const Ag=so(),Og=Cg(),Kt={width:.75,style:"solid",color:"#333333"};function ea(e){return JSON.parse(JSON.stringify(e))}function ta(e){return{id:Ag(),borders:{top:{...Kt},right:{...Kt},bottom:{...Kt},left:{...Kt}},...e}}function Ig(){const e=[50,50,50],t=(r,o)=>({id:Og(),type:r,height:8,...o!==void 0?{repeatOnPage:o}:{},cells:e.map(()=>ta())}),n=t("header",!0);return n.cells.forEach((r,o)=>{r.formatter=`列${o+1}`,r.align="center",r.fontWeight="bold"}),{rows:[n,t("data"),t("subtotal"),t("summary")],colWidths:e}}function ar(e,t,n){if(!e[t].cells[n].merged)return{r:t,c:n};for(let r=t;r>=0;r--)for(let o=n;o>=0;o--){const i=e[r].cells[o];if(i.merged)continue;const a=i.rowspan??1,l=i.colspan??1;if(r+a-1>=t&&o+l-1>=n)return{r,c:o}}return{r:t,c:n}}function cn(e,t,n){const r=ar(e,t,n),o=e[r.r].cells[r.c];return{r1:r.r,c1:r.c,r2:r.r+(o.rowspan??1)-1,c2:r.c+(o.colspan??1)-1}}function ec(e,t,n){let r={r1:Math.min(t.r,n.r),c1:Math.min(t.c,n.c),r2:Math.max(t.r,n.r),c2:Math.max(t.c,n.c)};for(;;){let o=!1;for(let i=r.r1;i<=r.r2;i++)for(let a=r.c1;a<=r.c2;a++){const l=cn(e,i,a),c={r1:Math.min(r.r1,l.r1),c1:Math.min(r.c1,l.c1),r2:Math.max(r.r2,l.r2),c2:Math.max(r.c2,l.c2)};(c.r1!==r.r1||c.c1!==r.c1||c.r2!==r.r2||c.c2!==r.c2)&&(r=c,o=!0)}if(!o)return r}}function tc(e,t){if((t.r2-t.r1+1)*(t.c2-t.c1+1)<2)return"至少选择 2 个单元格";const r=new Set;for(let i=t.r1;i<=t.r2;i++)r.add(e[i].type);if(r.size>1)return"合并区域不能跨越不同类型的行";if(t.r2>t.r1&&r.has("data"))return"数据行将按列表展开,纵向合并请使用单元格属性「按值合并」";const o=ec(e,{r:t.r1,c:t.c1},{r:t.r2,c:t.c2});return o.r1!==t.r1||o.c1!==t.c1||o.r2!==t.r2||o.c2!==t.c2?"选区与已有合并区域部分重叠":null}function nc(e,t){const n=e[t.r1].cells[t.c1],r=[];for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=e[o].cells[i];a.formatter&&r.push(a.formatter),!(o===t.r1&&i===t.c1)&&(a.merged=!0,a.rowspan=1,a.colspan=1,a.formatter="")}n.rowspan=t.r2-t.r1+1,n.colspan=t.c2-t.c1+1,n.formatter=r.join(" ")}function rc(e,t){for(let n=t.r1;n<=t.r2;n++)for(let r=t.c1;r<=t.c2;r++){const o=e[n].cells[r];if(!o.merged&&((o.rowspan??1)>1||(o.colspan??1)>1)){const i=cn(e,n,r),a=o;for(let l=i.r1;l<=i.r2;l++)for(let c=i.c1;c<=i.c2;c++){const s=e[l].cells[c];s.merged=!1,s.rowspan=1,s.colspan=1,Pg(a,s)}o.rowspan=1,o.colspan=1}}}function Pg(e,t){e!==t&&(t.align=e.align,t.valign=e.valign,t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.fontWeight=e.fontWeight,t.color=e.color,t.backgroundColor=e.backgroundColor,t.borders=e.borders?ea(e.borders):void 0,t.padding=e.padding,t.wordWrap=e.wordWrap)}function oc(e,t,n){const r=n==="above"?t:t+1,o=e[t],i=o.cells.length,a=o.type==="data"?"header":o.type,l={id:`row-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,type:a,height:o.height,...a==="header"?{repeatOnPage:[e[r-1],e[r]].find(c=>c?.type==="header")?.repeatOnPage===!0}:{},cells:Array.from({length:i},()=>ta())};for(let c=0;c<i;c++)if(r>0&&r<e.length){const s=cn(e,r-1,c);if(s.r1<r&&s.r2>=r){const d=e[s.r1].cells[s.c1];d.rowspan=(d.rowspan??1)+1,l.cells[c].merged=!0}}e.splice(r,0,l)}function Rg(e,t){if(e.length<=1)return"不能删除最后一行";const n=e[t],r=n.cells.length;for(let o=0;o<r;o++){const i=n.cells[o];if(!i.merged&&(i.rowspan??1)>1){const a=e[t+1].cells[o];Object.assign(a,ea(i),{id:a.id}),a.rowspan=(i.rowspan??1)-1,a.merged=!1}else if(i.merged){const a=cn(e,t,o);if(a.r1<t&&a.c1===o){const l=e[a.r1].cells[a.c1];l.rowspan=(l.rowspan??1)-1}}}return e.splice(t,1),null}function ic(e,t,n,r){const o=r==="left"?n:n+1;t.splice(o,0,t[n]);for(const i of e){const a=ta();if(o>0&&o<i.cells.length){const l=e.indexOf(i),c=cn(e,l,o-1);if(c.c1<o&&c.c2>=o){const s=e[c.r1].cells[c.c1];l===c.r1&&(s.colspan=(s.colspan??1)+1),a.merged=!0}}i.cells.splice(o,0,a)}}function Dg(e,t,n){if(t.length<=1)return"不能删除最后一列";for(let r=0;r<e.length;r++){const o=e[r].cells[n];if(!o.merged&&(o.colspan??1)>1){const i=e[r].cells[n+1];Object.assign(i,ea(o),{id:i.id}),i.colspan=(o.colspan??1)-1,i.merged=!1}else if(o.merged){const i=cn(e,r,n);if(i.c1<n&&i.r1===r){const a=e[i.r1].cells[i.c1];a.colspan=(a.colspan??1)-1}}}for(const r of e)r.cells.splice(n,1);return t.splice(n,1),null}function na(e,t,n){if(n==="data"){const r=e.findIndex((o,i)=>o.type==="data"&&i!==t);if(r>=0)return`数据行已存在(第 ${r+1} 行),全表最多一行`}if(n==="header"){for(let r=0;r<t;r++)if(e[r].type!=="header")return"标题行必须从表格顶部连续设置"}if(n==="subtotal"||n==="summary"){const r=e.findIndex(o=>o.type==="data");if(r<0)return"请先设置数据行,小计/汇总行必须位于数据行之后";if(t<r)return"小计/汇总行必须位于数据行之后"}if(n==="subtotal"&&e.slice(0,t).some(r=>r.type==="summary"))return"小计行必须位于汇总行之前";if(n==="summary"&&e.slice(t+1).some(r=>r.type==="subtotal"))return"汇总行必须位于小计行之后";if(e[t].type==="header"&&n!=="header"){for(let r=t+1;r<e.length;r++)if(e[r].type==="header")return"取消该标题行会导致标题行不连续,请先调整后续标题行"}if(e[t].type=n,n==="header"){const r=[e[t-1],e[t+1]].find(o=>o?.type==="header");e[t].repeatOnPage=e[t].repeatOnPage!==void 0?e[t].repeatOnPage===!0:r?.repeatOnPage===!0}else delete e[t].repeatOnPage;return null}function $g(e,t){for(const n of e){if(n.type!=="header")break;n.repeatOnPage=t}}function ac(e,t,n,r){for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=e[o].cells[i];if(a.merged)continue;if(n==="none"){delete a.borders;continue}const l=cn(e,o,i),c=l.r1===t.r1,s=l.r2===t.r2,d=l.c1===t.c1,p=l.c2===t.c2,u={...a.borders??{}};n==="all"?(u.top={...r},u.bottom={...r},u.left={...r},u.right={...r}):n==="outer"?(c&&(u.top={...r}),s&&(u.bottom={...r}),d&&(u.left={...r}),p&&(u.right={...r})):n==="inner"&&(c||(u.top={...r}),s||(u.bottom={...r}),d||(u.left={...r}),p||(u.right={...r})),a.borders=u}}const Ng="线型 / 宽度 / 颜色是待应用规格:选中格已有的边框规格一致时会填进这三行;四边不一致的项显示「混合」,一条边都没有时显示「无 / 0」。改完点「全部 / 外侧 / 内部」或勾选上、下、左、右某条边才会写入选中的单元格;「无」是清除边框",Lg="多选时不回显单格边框:线型 / 宽度 / 颜色按当前设置作为批写规格,点「全部 / 外侧 / 内部」或勾选某条边后写入所有选中格;「无」是清除边框",Fg="当前单元格四边边框规格不一致:带「混合」的项不谎报,未改项在点「全部 / 外侧 / 内部」或勾选单边时按缺省档(实线 0.75pt)写入,改任一项即按该值批写";function sc(e,t,n){const r={...e.borders??{}};n?r[t]={...n}:delete r[t],e.borders=r.top||r.right||r.bottom||r.left?r:void 0}function lo(e,t){const n=[];for(let r=t.r1;r<=t.r2;r++)for(let o=t.c1;o<=t.c2;o++){const i=e[r]?.cells[o];i&&!i.merged&&n.push(i)}return n}function ra(e,t){const n=lo(e,t).length;return{mode:n>1?"multi":"single",count:n}}function zg(e,t){const n=lo(e,t);if(!n.length)return null;const r=n[0].cellType??"text";return n.every(o=>(o.cellType??"text")===r)?r:null}function lc(e,t){const n=[];for(const o of lo(e,t))for(const i of["top","right","bottom","left"]){const a=o.borders?.[i];a&&n.push(a)}const r=o=>{if(!n.length)return;const i=o(n[0]);return n.every(a=>o(a)===i)?i:"mixed"};return{width:r(o=>o.width),style:r(o=>o.style),color:r(o=>o.color)}}const Bg="1px dashed rgba(0,0,0,0.18)";function co(e,t={}){return e&&e.style!=="none"?`${e.width}pt ${e.style} ${e.color}`:t.designMode&&t.showGhostBorder!==!1?Bg:"none"}function sr(e){const t=(e.tableColWidths??[]).reduce((r,o)=>r+o,0),n=(e.tableRows??[]).reduce((r,o)=>r+o.height,0);e.width=Math.round(t*100)/100,e.height=Math.round(n*100)/100}const cc=5;function Hg(e,t,n,r){const o=e.reduce((l,c,s)=>s===t?l:l+c,0),i=r===1/0?1/0:Math.max(cc,r-o),a=Math.round(n*10)/10;return Math.min(Math.max(a,cc),i)}const dc=Symbol.for("worm-print-platform.element-capabilities.v1"),uc=globalThis;function dn(){const e=uc[dc];if(e)return e;const t={entries:new Map,nextSeq:0,bootstrapped:!1};return uc[dc]=t,pc(t),t}const Ug={left:7,top:17.6,width:42.3,height:7.1},qg=Object.freeze({text:"示例文本",longText:"示例长文本内容",barcode:"12345678",qrcode:"qrcode"});function Wg(e){if(e)return qg[e]}const lr=Object.freeze({text:{zoneAllowed:!0,defaultTextFit:"clip",bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],defaultOptions:()=>({formatter:"文本",exampleValue:"示例文本",fontSize:12,textAlign:"left",height:5.3}),title:"文本"},longText:{defaultTextFit:"autoHeight",bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"},{targetPath:"options.styler",label:"样式",dataSource:"main"}],defaultOptions:()=>({width:141.1,height:28.2,fontSize:12,lineHeight:18,exampleValue:"示例长文本内容"}),title:"长文"},barcode:{zoneAllowed:!0,codeRotationDpiGated:!0,bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],defaultOptions:()=>({width:56.4,height:14.1,title:"条形码",barcodeType:"code128",testData:"12345678",exampleValue:"12345678"}),title:"条形码"},qrcode:{zoneAllowed:!0,codeRotationDpiGated:!0,bindings:[{targetPath:"options.formatter",label:"内容",dataSource:"main"}],defaultOptions:()=>({width:28.2,height:28.2,title:"二维码",testData:"qrcode",exampleValue:"qrcode"}),title:"二维码"},image:{zoneAllowed:!0,bindings:[{targetPath:"options.src",label:"内容",dataSource:"main",placeholder:"输入图片路径,支持 /docfiles/... 相对路径、绝对 URL 或 {字段} 表达式"}],defaultOptions:()=>({width:28.2,height:28.2,fit:"contain"}),title:"图片"},table:{rotationExcluded:!0,acceptsElementBorder:!1,bindings:[],defaultOptions:()=>{const{rows:e,colWidths:t}=Ig(),n=t.reduce((o,i)=>o+i,0),r=e.reduce((o,i)=>o+i.height,0);return{width:n,height:r,tableMode:"dynamic",tableRows:e,tableColWidths:t,tableDefaultFontSize:10,tableDefaultColor:"#333333",tableDefaultPadding:1,fields:[],tablePagination:{enabled:!0}}},title:"表格"},flowList:{rotationExcluded:!0,defaultTextFit:"clip",bindings:[{targetPath:"options.formatter",label:"单元模板",dataSource:"main",placeholder:"{drugs.name} {drugs.spec}"}],defaultOptions:()=>({width:141.1,height:21.2,fontSize:12,formatter:"{name} {spec}",flowColumns:4,flowRowHeight:8,flowGapX:4,flowAutoSpan:!1,flowMaxSpan:2,flowLayoutMode:"fixed",flowPaddingTop:0,flowPaddingRight:0,flowPaddingBottom:0,flowPaddingLeft:0}),title:"流式列表"},hline:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:70.6,height:1.8,borderWidth:.75}),title:"横线"},vline:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:1.8,height:35.3,borderWidth:.75}),title:"竖线"},rect:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:28.2,height:28.2,borderWidth:1,borderColor:"#333"}),title:"矩形"},oval:{zoneAllowed:!0,acceptsElementBorder:!1,defaultOptions:()=>({width:28.2,height:28.2,borderWidth:1,borderColor:"#333"}),title:"椭圆"},html:{blocked:!0,defaultOptions:()=>({width:28.2,height:28.2}),title:"HTML"},pageNumber:{title:"页码"}});function pc(e){if(!e.bootstrapped){e.bootstrapped=!0;for(const[t,n]of Object.entries(lr))e.entries.has(t)||e.entries.set(t,{caps:n,seq:e.nextSeq++})}}function jg(e,t){if(!e||typeof e!="string")throw new Error("registerElementCapabilities: type 必须是非空字符串");if(!t||typeof t!="object")throw new Error("registerElementCapabilities: caps 必须是对象");const n=dn(),r=n.nextSeq++;return n.entries.set(e,{caps:t,seq:r}),()=>{if(dn().entries.get(e)?.caps!==t)return;const i=lr[e];i?dn().entries.set(e,{caps:i,seq:r}):dn().entries.delete(e)}}function ut(e){return e?{...dn().entries.get(e)?.caps??{},type:e}:{type:""}}function oa(){return[...dn().entries.entries()].sort((e,t)=>e[1].seq-t[1].seq).map(([e])=>e)}function Gg(){const e=dn();e.entries.clear(),e.nextSeq=0,e.bootstrapped=!1,pc(e)}function Vg(){return{...Ug}}const fc=Symbol.for("worm-print-platform.element-plugin-registry.v1"),hc=globalThis;function ia(){const e=hc[fc];if(e)return e;const t={plugins:new Map,typeIndex:new Map,configs:new Map,legacyAliases:new Map};return hc[fc]=t,t}function Yg(e,t){const n=e.render||t.render?{...e.render,...t.render}:void 0,r=e.designer||t.designer?{...e.designer,...t.designer}:void 0;return{...e,kind:t,binding:t.binding??e.binding,render:n,designer:r}}function $n(e){const t=ia().typeIndex.get(e);return t?Yg(t.plugin,t.kind):void 0}function gc(){return[...ia().typeIndex.values()]}function Kg(){return Object.fromEntries(ia().legacyAliases)}function cr(e){return e/2.83464566929}function uo(e){return e*(25.4/96)}function un(e){return e*(96/25.4)}const mc=6,Xg=1,Zg=["clip","shrink","autoHeight"];function bc(e){return typeof e=="string"&&Zg.includes(e)?e:void 0}const Jg={text:"clip",longText:"autoHeight",flowList:"clip"};function po(e,t){const n=ut(e).defaultTextFit;return bc(t?.textFit)??n??Jg[e]??"clip"}function yc(e){if(e?.keepLineBreaks===!0&&e.wordWrap!==!1)return"pre-wrap"}function vc(e){return e?.wordWrap===!1?"nowrap":void 0}function aa(e){return bc(e?.textFit)??(e?.wordWrap===!1?"clip":"autoHeight")}function dr(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?mc:Math.max(e,Xg)}function sa(e){return Math.round(e*100)/100}function Qg(e){return Math.floor(e*100)/100}function em(e,t,n,r){return`${e}#${t}#${n}:${r}`}function tm(e){const t=e.indexOf("#");if(t<0)return;const n=e.lastIndexOf("#"),r=e.slice(t+1,n);if(r!=="b"&&r!=="st"&&r!=="sm")return;const[o,i]=e.slice(n+1).split(":").map(Number);if(!(!Number.isFinite(o)||!Number.isFinite(i)))return{elementId:e.slice(0,t),kind:r,rowIndex:o,colIndex:i}}function wc(e,t){return(e||"contain")==="cover"?t:void 0}function la(e,t,n,r=1){const o=Math.max(n?.colspan??1,1);let i=0;for(let c=0;c<o;c++)i+=e[t+c]??0;if(i<=0)return 0;const a=n?.padding??r,l=(cr(n?.borders?.left?.width??0)+cr(n?.borders?.right?.width??0))/2;return Math.max(i-a*2-l,.5)}function ur(e,t,n,r=1){const o=Math.max(n?.rowspan??1,1);let i=0;for(let c=0;c<o;c++)i+=e[t+c]?.height??8;const a=n?.padding??r,l=(cr(n?.borders?.top?.width??0)+cr(n?.borders?.bottom?.width??0))/2;return Math.max(i-a*2-l,.5)}const ca=1,xc=12,nm=3,rm=100,om=0,im=50;function pn(e){return e==="dynamic"?"dynamic":"fixed"}function Nn(e){const t=n=>{const r=e[n];return typeof r=="number"&&Number.isFinite(r)&&r>0?r:0};return{top:t("flowPaddingTop"),right:t("flowPaddingRight"),bottom:t("flowPaddingBottom"),left:t("flowPaddingLeft")}}function Ec(e,t){return Math.max(0,e-t.left-t.right)}const Sc=25.4/72;function am(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?r:Math.min(n,Math.max(t,Math.round(e)))}function pt(e){return am(e,ca,xc,4)}function vt(e){return typeof e!="number"||!Number.isFinite(e)?4:Math.min(im,Math.max(om,e))}function Xt(e){return typeof e!="number"||!Number.isFinite(e)?8:Math.min(rm,Math.max(nm,e))}function fn(e,t){const n=pt(t),r=Math.min(2,n);return typeof e!="number"||!Number.isFinite(e)?r:Math.min(n,Math.max(1,Math.round(e)))}function sm(e,t,n){const r=pt(t),o=vt(n),i=e-o*(r-1);return i<=0?0:i/r}function lm(e,t,n){const r=Math.max(1,Math.floor(n));return e*r+t*(r-1)}function _c(e,t){if(!e)return 0;const n=typeof t=="number"&&Number.isFinite(t)&&t>0?t*Sc:12*Sc;let r=0;for(const o of e){if(o===" "){r+=.28;continue}const i=o.codePointAt(0)??0;i>=12288&&i<=12351||i>=13312&&i<=19903||i>=19968&&i<=40959||i>=63744&&i<=64255||i>=65280&&i<=65376||i>=65504&&i<=65510||i>=131072?r+=1:/^[0-9A-Z]$/.test(o)?r+=.6:/^[a-z]$/.test(o)?r+=.5:/^[\u0020-\u007f]$/.test(o)?r+=.4:r+=.75}return r*n}function cm(e,t){if(!t.autoSpan)return 1;const n=fn(t.maxSpan,t.columns);if(n<=1||t.colUnitMm<=0)return 1;const r=_c(e,t.fontSizePt);for(let o=1;o<=n;o++)if(r<=lm(t.colUnitMm,t.gapX,o))return o;return n}function da(e,t){const n=pt(t.columns),r=vt(t.gapX),o=sm(t.width,n,r),i=fn(t.maxSpan,n),a=[];let l=[],c=0;for(const s of e){const d=String(s??""),p=cm(d,{...t,columns:n,gapX:r,maxSpan:i,colUnitMm:o});l.length>0&&c+p>n&&(a.push({cells:l}),l=[],c=0),l.push({text:d,span:p}),c+=p}return l.length>0&&a.push({cells:l}),a}function fo(e,t){if(typeof e!="string"||!e.includes("{")||!t)return;const n=new Set;for(const r of e.matchAll(/\{([^{}]*)\}/g))for(const o of(r[1]??"").split(/[^A-Za-z0-9_\u4e00-\u9fa5.]/)){const i=o.split(".")[0];i&&!/^\d/.test(i)&&n.add(i)}for(const r of n)if(Array.isArray(t[r]))return r}function dm(e,t,n){const r=vt(t),o=_c("一",n);if(o<=0||e<=0)return ca;const i=Math.floor((e+r)/(o+r));return Math.min(xc,Math.max(ca,i))}const Mc=e=>`${Math.round(e*1e3)/1e3}mm`;function um(e){const t=pt(e.columns),n=vt(e.gapX),r=Xt(e.rowHeight);return["display:grid",`grid-template-columns:repeat(${t},minmax(0,1fr))`,`column-gap:${Mc(n)}`,`grid-auto-rows:minmax(${Mc(r)},auto)`].join(";")}const pr=25.4,Tc=10;function ua(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):Tc}const Zt=30,ho=10,pa=2,kc=0,pm=.25,fa=.254;function fm(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e/pr;for(let n=2;n<=8;n+=.5){const r=Math.max(1,Math.round(go(n)*t)),o=r/t;if(o>=fa-1e-9)return{barWidth:n,dotsPerModule:r,moduleWidthMm:o}}return null}function Cc(e,t){const n=fm(e);if(!n)return"";const r=s=>String(Number(s.toFixed(3))),o=`按 ${e}dpi 推荐条宽倍率 ${n.barWidth}(每模块 ${n.dotsPerModule} 个打印点 = ${r(n.moduleWidthMm)}mm,取达到 ${r(fa)}mm 下限的最小档)`,i=go(t??2),a=Math.max(1,Math.round(i*e/pr)),l=a/(e/pr),c=l>=fa-1e-9?`当前倍率 ${t??2} 折算为 ${a} 点 / ${r(l)}mm,已达标`:`当前倍率 ${t??2} 只有 ${a} 点 / ${r(l)}mm,低于下限`;return`${o};${c}。这里只提示,不会替你改值`}function fr(e){const t=typeof e=="number"&&Number.isFinite(e)?e:2;return Math.max(1,t/2)}function go(e){return fr(e)*pm}function hm(e){const{barHeightMm:t,moduleWidthMm:n,boxHeightMm:r,textModules:o}=e,i=typeof t=="number"&&Number.isFinite(t)&&t>0,a=typeof n=="number"&&Number.isFinite(n)&&n>0;if(!i||!a)return Zt;const l=Math.max(1,Math.round(t/n));if(!(typeof r=="number"&&Number.isFinite(r)&&r>0))return l;const s=typeof o=="number"&&Number.isFinite(o)&&o>0?o:0,d=Math.floor((r-s*n)/n);return Math.max(1,Math.min(l,d))}function Ac(e,t,n){const r=Math.max(1,Math.round(e*n)),o=Math.floor(t*n);if(o<1)return null;const i=Math.min(r,o);return{dotsPerModule:i,preferredDots:r,moduleWidthMm:i/n}}function gm(e){const t=go(e.barWidth),n=Math.max(1,Math.ceil(e.unitWidth)),r=e.boxWidthMm>0?e.boxWidthMm/n:Number.POSITIVE_INFINITY,o=e.dpi;if(typeof o=="number"&&Number.isFinite(o)&&o>0){const i=Ac(t,r,o/pr);if(i)return i.moduleWidthMm}return Math.min(t,r)}function Ln(e,t){const n=typeof e=="number"&&e>0?e:Number.POSITIVE_INFINITY,r=typeof t=="number"&&t>0?Math.min(n,t):n;return Number.isFinite(r)?r:0}function mm(e){const t=Math.max(1,Math.ceil(e.unitWidth)),n=Math.max(1,Math.ceil(e.unitHeight)),r=go(e.barWidth),o=Math.min(e.boxWidthMm>0?e.boxWidthMm/t:Number.POSITIVE_INFINITY,e.boxHeightMm>0?e.boxHeightMm/n:Number.POSITIVE_INFINITY),i=e.dpi;if(typeof i=="number"&&Number.isFinite(i)&&i>0){const l=Ac(r,o,i/pr);if(l)return{moduleWidthMm:l.moduleWidthMm,widthMm:t*l.moduleWidthMm,heightMm:n*l.moduleWidthMm,dotsPerModule:l.dotsPerModule,scaledDown:l.dotsPerModule<l.preferredDots}}const a=Math.min(r,o);return{moduleWidthMm:a,widthMm:t*a,heightMm:n*a,dotsPerModule:null,scaledDown:a<r}}function ha(e){const t=fr(e.barWidth),n=c=>mm({unitWidth:c.widthUnits/t,unitHeight:c.heightUnits/t,boxWidthMm:e.boxWidthMm,boxHeightMm:e.boxHeightMm,dpi:e.dpi,barWidth:e.barWidth}),r=e.measure(Zt);if(!r)return{barHeightModules:Zt,size:null};if(!(typeof e.barHeightMm=="number"&&Number.isFinite(e.barHeightMm)&&e.barHeightMm>0))return{barHeightModules:Zt,size:n(r)};const i=Math.max(0,r.heightUnits/t-Zt),a=hm({barHeightMm:e.barHeightMm,moduleWidthMm:gm({unitWidth:r.widthUnits/t,boxWidthMm:e.boxWidthMm,dpi:e.dpi,barWidth:e.barWidth}),boxHeightMm:e.boxHeightMm,textModules:i});if(a===Zt)return{barHeightModules:a,size:n(r)};const l=e.measure(a);return l?{barHeightModules:a,size:n(l)}:{barHeightModules:Zt,size:null}}const hr=["top","right","bottom","left"],bm=new Set(["rect","oval","hline","vline","table"]);function mo(e){if(!e)return!1;const t=ut(e).acceptsElementBorder;return t===void 0?!bm.has(e):t}const ym=new Set(["solid","dashed","dotted","double"]);function Oc(e,t,n){return typeof e!="number"||!Number.isFinite(e)||e<=0||t==="none"?null:{borderWidth:`${e}pt`,borderStyle:typeof t=="string"&&ym.has(t)?t:"solid",borderColor:n||"#000"}}function bo(e,t){if(!mo(e))return null;const n=Oc(t?.borderWidth,t?.borderStyle,t?.borderColor),r={},o=t?.borders;if(o)for(const i of hr){const a=o[i];if(!a)continue;const l=Oc(a.width,a.style,a.color);l&&(r[i]=l)}return!n&&Object.keys(r).length===0?null:{all:n,edges:r}}const vm=/[;"'<>\\(){}\[\]@!#]/,wm=64,gr=100,Ic=400;function xm(e){const t=(e??"").trim();return!t||t.length>wm||vm.test(t)?"":t}function Pc(e,t){if((e||"contain")!=="cover"||typeof t!="number"||!Number.isFinite(t))return;const n=Math.round(t);if(!(n<=gr))return Math.min(n,Ic)}function ga(e,t,n){const r=xm(n),o={};r&&(o.objectPosition=r);const i=Pc(e,t);return i!==void 0&&(o.transform=`scale(${Number((i/100).toFixed(2))})`,o.transformOrigin=r||"50% 50%"),o}function mr(e){return typeof e!="number"||!Number.isFinite(e)?0:(e%360+360)%360}function Rc(e,t,n){const r=e.width,o=t,i=mr(n);let a,l;if(i===0||i===180)a=r,l=o;else if(i===90||i===270)a=o,l=r;else{const c=i*Math.PI/180;a=r*Math.abs(Math.cos(c))+o*Math.abs(Math.sin(c)),l=r*Math.abs(Math.sin(c))+o*Math.abs(Math.cos(c))}return{left:e.left-(a-r)/2,top:e.top-(l-o)/2,width:a,height:l}}const Dc=385,Em=new Set(["table","flowList"]);function $c(e){const t=ut(e).rotationExcluded;return t===void 0?Em.has(e):t}function Nc(e){const t=ut(e).codeRotationDpiGated;return t===void 0?e==="barcode"||e==="qrcode":t}const Sm="条码与二维码仅支持 90° 步进;任意角度需 385dpi 以上打印头";function _m(e,t){if(!Nc(e))return!0;const n=t?.printerDpi;return typeof n=="number"&&n>0&&n>=Dc}function ma(e,t,n){const r=t?.rotate;if(typeof r!="number"||!Number.isFinite(r))return;const o=mr(r);if(o!==0&&!$c(e)){if(Nc(e)){if(o===90||o===180||o===270)return o;const i=t?.printerDpi;if(typeof i=="number"&&i>0&&i<Dc){const a=mr(Math.round(o/90)*90);return a===0?void 0:a}}return o}}const yo=e=>typeof e=="number"&&Number.isFinite(e)?e:0;function ft(e){const t=e??{};return{top:yo(t.marginTop),right:yo(t.marginRight),bottom:yo(t.marginBottom),left:yo(t.marginLeft)}}function vo(e){const t=ft(e);return["top","right","bottom","left"].filter(n=>t[n]!==0).map(n=>`margin-${n}:${t[n]}mm`).join(";")}function We(e={},t=e.height??0){const n=ft(e),r=e.left??0,o=e.top??0,i=e.width??100,a=t,l={left:r+n.left,top:o+n.top,right:r+n.left+i,bottom:o+n.top+a,width:i,height:a},c={left:r,top:o,right:r+n.left+i+n.right,bottom:o+n.top+a+n.bottom,width:Math.max(0,n.left+i+n.right),height:Math.max(0,n.top+a+n.bottom)};return{border:l,margin:c}}const hn={A4:{width:210,height:297},A3:{width:297,height:420},A5:{width:148,height:210},Letter:{width:216,height:279},Legal:{width:216,height:356},DOT_FULL:{width:241,height:279.4},DOT_HALF:{width:241,height:139.7},DOT_THIRD:{width:241,height:93.1},LABEL_80X60:{width:80,height:60},LABEL_60X40:{width:60,height:40},LABEL_40X30:{width:40,height:30},THERMAL_57:{width:57,height:297},THERMAL_80:{width:80,height:297},THERMAL_110:{width:110,height:297},CUSTOM:{width:210,height:297},CONTINUOUS:{width:80,height:297}},Mm=new Set(["CONTINUOUS","THERMAL_57","THERMAL_80","THERMAL_110"]);function Fn(e){return Mm.has(e)}function ht(e){const t=Fn(e.paperSize),n=e.paperSize==="CUSTOM"||t?{width:e.customWidth??hn[e.paperSize].width,height:e.customHeight??hn[e.paperSize].height}:hn[e.paperSize];return e.orientation==="landscape"&&!t?{width:n.height,height:n.width}:{...n}}function gn(e){if(Fn(e.paperSize))return ht(e);const n=ht(e);return e.outputRotation===90||e.outputRotation===270?{width:n.height,height:n.width}:n}function ba(e){return Fn(e.paperSize)?0:e.outputRotation??0}function At(e){return Fn(e.paperSize)}function wo(e){return e.options?.pagination??e.pagination}function Tm(e){return e.options?.tablePagination??e.tablePagination}const km=2;function xo(e){return e.type==="table"||e.printElementType?.type==="table"}function br(e){return(e.type||e.printElementType?.type||"text")==="flowList"&&pn(e.options?.flowLayoutMode)==="dynamic"}function ya(e){return xo(e)||br(e)}function Eo(e){return e.options?.fixed!==!0&&e.options?.repeatOnEveryPage===!0}function va(e){return e.options?.fixed===!0}function Lc(e){return e.type||e.printElementType?.type||"text"}function Fc(e){return ma(Lc(e),e.options)}function mn(e,t){const n=t.get(e.id)?.measuredHeight??e.options?.height??0,r=ft(e.options),{border:o}=We({left:e.options?.left??0,top:e.options?.top??0,width:e.options?.width??100,height:n,...e.options},n),i=Fc(e),a=i===void 0?o:Rc(o,n,i);return{height:a.height,shift:o.top-a.top,top:a.top,rot:i,outerTop:a.top-r.top,outerBottom:a.top+a.height+r.bottom,outerHeight:Math.max(0,r.top+a.height+r.bottom)}}function Cm(e,t){const n=e.options?.tableColWidths??[],r=xo(e)&&n.length>0?n.reduce((c,s)=>c+s,0):e.options?.width??0,o=t.get(e.id)?.measuredHeight??e.options?.height??0,{border:i}=We({...e.options,left:e.options?.left??0,top:e.options?.top??0,width:r,height:o},o),a=Fc(e);if(a===void 0)return{left:i.left,width:i.width};const l=Rc(i,o,a);return{left:l.left,width:l.width}}function Am(e){const t=e.options??{},n=t.top??0,o=(t.tableRows??[]).reduce((a,l)=>a+(l.height??0),0),i=Math.max(t.height??0,o);return n+ft(t).top+i}function yr(e){if(br(e)){const t=e.options??{};return(t.top??0)+ft(t).top+Math.max(t.height??0,0)}return Am(e)}function zc(e){return(t,n)=>{const r=t.options?.top??0,o=n.options?.top??0;if(r!==o)return r-o;const i=t.options?.zIndex??0,a=n.options?.zIndex??0;return i!==a?i-a:(e.get(t.id)??0)-(e.get(n.id)??0)}}function Bc(e){const n=e.filter(l=>typeof l.id=="string").map(l=>l).filter(l=>!Eo(l)&&!va(l)),r=new Map;n.forEach((l,c)=>r.set(l.id,c));const o=[...n].sort(zc(r)),i=new Set;for(const l of o)ya(l)||l.options?.groupId&&i.add(l.id);const a=new Set;for(const l of Hc(o,i).values())for(const c of l)a.add(c);return a}function Hc(e,t){const n=new Map;let r=null,o=-1,i=0,a=0;for(const l of e){if(ya(l)){r=l.id,o=yr(l)+ft(l.options).bottom;const d=l.options?.tableColWidths??[],p=d.length>0?d.reduce((f,g)=>f+g,0):l.options?.width??0,u=We({...l.options,width:p}).margin;i=u.left,a=u.right,n.set(l.id,[]);continue}if(t?.has(l.id)||!r||(l.options?.top??0)<o)continue;const s=We({width:0,...l.options}).margin;s.right<=i||s.left>=a||n.get(r).push(l.id)}return n}function wa(e,t,n,r){const o=yr(e)+ft(e.options).bottom;let i=o;for(const a of t){const l=n.elements.find(c=>c.id===a);l&&(i=Math.max(i,We({width:0,...l.options}).margin.bottom))}return Math.max(i-o,0)}function Uc(e,t){return Math.max(e.options?.height??0,t.get(e.id)?.measuredHeight??0)}const qc=25.4/72;function Wc(e){const t=e.options??{};if((e.type||e.printElementType?.type||"text")!=="vline")return{width:100,...t};const o=(t.borderWidth??.75)*qc/2+.05;return{...t,left:(t.left??0)-o,width:o*2}}function bn(e){const t=We(Wc(e)).margin;return[t.left,t.right]}function Om(e){const t=We(Wc(e)).border;return[t.left,t.right]}function vr(e,t){return e[0]<t[1]&&t[0]<e[1]}function jc(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Im(e,t,n){const r=new Map;for(const f of n.values()){if(f.length<2)continue;const g={anchorId:f[0].id,ids:f.map(m=>m.id),forceFirstPage:f.some(m=>wo(m)?.pageable===!1),band:f.map(bn).reduce(jc)};for(const m of f)r.set(m.id,g)}const o=e.filter(f=>!xo(f)&&!br(f)&&!f.options?.groupId&&wo(f)?.pageable!==!1),i=new Map;o.forEach(f=>i.set(f.id,f.id));const a=f=>{let g=f;for(;i.get(g)!==g;)g=i.get(g);let m=f;for(;i.get(m)!==g;){const b=i.get(m);i.set(m,g),m=b}return g},l=(f,g)=>{const m=a(f),b=a(g);m!==b&&i.set(b,m)},c=[],s=f=>We({width:100,...f.options,height:Uc(f,t)},Uc(f,t)).border,d=[...o].sort((f,g)=>s(f).top-s(g).top);for(const f of d){const g=s(f),m=g.top;for(let w=c.length-1;w>=0;w--)c[w].bottom<=m&&c.splice(w,1);const b=g.bottom,v=Om(f);for(const w of c)w.bottom>m&&vr(w.x,v)&&l(f.id,w.id);c.push({id:f.id,top:m,bottom:b,x:v})}const p=new Map(o.map(f=>[f.id,f])),u=new Map;for(const f of o){const g=a(f.id),m=u.get(g);m?m.push(f.id):u.set(g,[f.id])}for(const f of u.values()){if(f.length<2)continue;const g={anchorId:f[0],ids:f,forceFirstPage:!1,band:f.map(m=>bn(p.get(m))).reduce(jc)};for(const m of f)r.set(m,g)}return r}function xa(e,t){const n=ht(e),{top:r,bottom:o}=e.margins,i=e.header?.height??0,a=e.footer?.height??0,l=At(e),c=l?Number.POSITIVE_INFINITY:n.height-r-o-i-a;if(!l&&c<=0)throw new Error(`页面可用高度不足: paper=${n.height}mm, margins=${r+o}mm, header=${i}mm, footer=${a}mm`);const s=new Map;e.elements.forEach((M,H)=>s.set(M.id,H));const d=[...e.elements].sort(zc(s)),p=d.filter(Eo),u=d.filter(va),f=d.filter(M=>!Eo(M)&&!va(M)),g=p.reduce((M,H)=>{const B=mn(H,t);return{minTop:Math.min(M.minTop,B.outerTop),maxBottom:Math.max(M.maxBottom,B.outerBottom)}},{minTop:Number.POSITIVE_INFINITY,maxBottom:Number.NEGATIVE_INFINITY}),m=!l&&p.length>0,b=m?g.minTop:0,v=m?Math.max(0,g.maxBottom-b):0,w=new Set,E=new Map;for(const M of f){if(ya(M))continue;const H=M.options?.groupId;if(!H)continue;w.add(M.id);const B=E.get(H);B?B.push(M):E.set(H,[M])}const k=Hc(f,w),L=new Map;for(const[M,H]of k)for(const B of H)L.set(B,M);const R=new Set,P=M=>{for(const H of M)R.add(H)},O=new Map;for(const M of d)O.set(M.id,M);const C=Im(f,t,E),I=[];let S=[],$=[],N=[],z=!1;function T(){return c-km-(z?v:0)}function ie(M){let H=0;for(const B of $)vr(M,[B.x0,B.x1])&&(H+=B.height);return Math.max(0,H)}function pe(M,H,B){N.push({x0:M[0],x1:M[1],renderBottom:H,designBottom:B})}function Ge(M){let H;for(const B of N)vr(M,[B.x0,B.x1])&&(!H||B.renderBottom>=H.renderBottom)&&(H=B);return H}function Q(M,H){const B=M.options?.top??0;if(z)return{top:ne(H),extra:0};const q=Ge(H);if(!q||q.renderBottom<=B)return{top:B,extra:0};const U=Math.max(B,q.renderBottom+B-q.designBottom);return{top:U,extra:Math.max(0,U-q.renderBottom)}}function Te(M){return T()-ie(M)}function he(M){const H=$.filter(B=>vr(M,[B.x0,B.x1]));for(let B=0;B<H.length;B++)for(let q=B+1;q<H.length;q++)if(!vr([H[B].x0,H[B].x1],[H[q].x0,H[q].x1]))return!0;return!1}function de(M,H){$.push({x0:M[0],x1:M[1],height:H})}function ye(M,H=bn(M)){return z?ne(H):M.options?.top??0}function ne(M){return(z?v:0)+ie(M)}let De=!1,it=[];function te(M,H,B){B<=0||it.push(`元素 ${M.id} 旋转 ${H}° 后顶部超出页首 ${Math.round(B*100)/100}mm,打印将被裁切`)}function Ve(){I.push(De||it.length>0?{pageIndex:I.length,sections:[...S],...De?{overflow:!0}:{},...it.length>0?{warnings:[...it]}:{}}:{pageIndex:I.length,sections:[...S]})}function $e(M){M>c&&(De=!0)}function fe(M=!1){if(S.length===0){De=De||M;return}Ve(),S=[],$=[],N=[],z=!0,De=!1,it=[]}let me=0;for(;me<f.length;){const M=f[me];if(L.has(M.id)&&R.has(M.id)){me++;continue}const H=C.get(M.id);if(H&&H.anchorId!==M.id){me++;continue}if(wo(M)?.pageable===!1||H?.forceFirstPage){const B=I[0],q=B?.sections??S,U=(V,ee,_)=>{B?_>0&&(B.warnings=[...B.warnings??[],`元素 ${V.id} 旋转 ${ee}° 后顶部超出页首 ${Math.round(_*100)/100}mm,打印将被裁切`]):te(V,ee,_)};if(H){let V=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,_=Number.NEGATIVE_INFINITY,G;for(const K of H.ids){const Z=O.get(K);if(!Z)continue;const oe=mn(Z,t);V=Math.min(V,oe.top),ee=Math.max(ee,oe.outerBottom),_=Math.max(_,We({width:0,...Z.options}).margin.bottom),oe.rot!==void 0&&(G={el:Z,rot:oe.rot})}G&&U(G.el,G.rot,-V);for(const K of H.ids)q.push({elementId:K,type:"element",renderTop:O.get(K)?.options?.top??0});!B&&_>Number.NEGATIVE_INFINITY&&pe(H.band,Math.max(ee,0),_)}else{const V=mn(M,t),ee=We({width:0,...M.options}).margin.bottom;B||pe(bn(M),V.outerBottom,ee),V.rot!==void 0&&U(M,V.rot,-V.top),q.push({elementId:M.id,type:"element",renderTop:M.options?.top??0})}me++;continue}xo(M)?me=nr(M,t,me):br(M)?me=ge(M,t,me):H?me=ro(H,me):me=no(M,t,f,me)}S.length>0&&Ve(),I.length===0&&I.push({pageIndex:0,sections:[]});const tr=new Map(d.map((M,H)=>[M.id,H]));for(const M of I){const H=M.pageIndex>0?-b:0,B=p.map(U=>({elementId:U.id,type:"element",renderTop:(U.options?.top??0)+H})),q=u.map(U=>({elementId:U.id,type:"element",renderTop:U.options?.top??0}));M.sections=[...M.sections,...B,...q].sort((U,V)=>(tr.get(U.elementId)??Number.MAX_SAFE_INTEGER)-(tr.get(V.elementId)??Number.MAX_SAFE_INTEGER));for(const U of[...p,...u]){const V=mn(U,t),ee=Eo(U)?H:0;if(V.outerBottom+ee>c&&(M.overflow=!0),V.rot!==void 0&&V.top+ee<0){const _=Math.round(-(V.top+ee)*100)/100;M.warnings=[...M.warnings??[],`元素 ${U.id} 旋转 ${V.rot}° 后顶部超出页首 ${_}mm,打印将被裁切`]}}}return to(),I;function to(){if(l)return;const M=e.margins.left;for(const H of I){const B=[];for(const q of H.sections){if(q.type==="flow-group")continue;const U=O.get(q.elementId);if(!U)continue;const{left:V,width:ee}=Cm(U,t),_=M+V,G=_+ee-n.width,K=-_;G>.01?B.push(`元素 ${U.id} 超出纸面右侧 ${Math.round(G*100)/100}mm,打印将被裁切`):K>.01&&B.push(`元素 ${U.id} 超出纸面左侧 ${Math.round(K*100)/100}mm,打印将被裁切`)}B.length>0&&(H.warnings=[...H.warnings??[],...B])}}function no(M,H,B,q){const U=bn(M),V=mn(M,H),ee=V.outerHeight,_=()=>{const K=ye(M,U),Z=z?K+V.shift:K,oe=Z-(M.options?.top??0);$e(V.outerBottom+oe),V.rot!==void 0&&!z&&te(M,V.rot,-V.top),S.push({elementId:M.id,type:"element",renderTop:Z}),de(U,ee),pe(U,Z+V.outerHeight,We({width:0,...M.options}).margin.bottom)};if(!z&&V.outerBottom<=c&&he(U)||ee<=Te(U)){if(_(),wo(M)?.keepWithNext&&q+1<B.length){const K=B[q+1],Z=mn(K,H).outerHeight;if(ee+Z>T())return q+1;Z>Te(U)&&(S.pop(),$.pop(),fe(),_())}return q+1}return fe(),_(),q+1}function ro(M,H){const B=M.ids.map(oe=>O.get(oe)).filter(oe=>!!oe);let q=Number.POSITIVE_INFINITY,U=Number.NEGATIVE_INFINITY,V=Number.NEGATIVE_INFINITY,ee;for(const oe of B){const be=mn(oe,t);q=Math.min(q,be.outerTop),U=Math.max(U,be.outerBottom),V=Math.max(V,We({width:0,...oe.options}).margin.bottom),be.rot!==void 0&&(ee={el:oe,rot:be.rot})}const _=Math.max(U-q,0),G=M.band,K=()=>{const oe=z?ne(G)-q:0;$e(q+oe+_),ee&&!z&&te(ee.el,ee.rot,-q);for(const be of B)S.push({elementId:be.id,type:"element",renderTop:(be.options?.top??0)+oe});de(G,_),pe(G,q+oe+_,V)};if(_<=Te(G))return K(),H+1;const Z=ne(G)+(z?0:q);return fe(Z+_>c),K(),H+1}function nr(M,H,B){const q=M.options??{},U=q._renderRows??[],V=H.get(M.id)?.measuredRowHeights??[],ee=(q._subtotalTemplates?.length??0)>0,_=(q._summaryRows?.length??0)>0,G=ee?Gc(U,V,"subtotal"):0,K=_?Gc(U,V,"summary"):0,Z=ae=>ee&&ae.type==="subtotal"||_&&ae.type==="summary",oe=U.filter(ae=>!Z(ae)),be=V.filter((ae,ue)=>!Z(U[ue]));q._renderRows=oe;const ke=Math.min(oe.length,be.length),Ue=q._repeatHeaderCount??0,Je=H.get(M.id)?.repeatHeaderHeight??V.slice(0,Ue).reduce((ae,ue)=>ae+ue,0),Ne=T(),at=ft(q),ve=at.top+at.bottom,xe=bn(M),{top:Tt,extra:Pn}=Q(M,xe);!z&&Pn>0&&de(xe,Pn);let st=Tt,Ee=0;const Ft=()=>{Mt(M,H,xe);const ae=k.get(M.id)??[],ue=ae.length>0?wa(M,ae,e):0,lt=yr(M)+ft(q).bottom,ct=S[S.length-1],oo=ct?.type==="flow-group"&&ct.elementId===M.id,Fl=oo?ct.groupTop??q.top??0:st,zl=oo&&(ct.startRow??0)===(ct.endRow??0)&&!(ct.subtotal||ct.summary)?0:Ee;return pe(xe,Fl+zl+ue,lt+ue),B+1};if(Je>Ne)throw new Error(`表格 ${M.id} 的重复表头高度 (${Je.toFixed(1)}mm) 超过页面可用高度 (${Ne.toFixed(1)}mm),请减少重复表头行`);if(ke===0)return S.push({elementId:M.id,type:"table-slice",startRow:0,endRow:0,summary:K>0,renderTop:Tt}),st=Tt,Ee=Math.max(0,K),de(xe,Math.max(0,K+ve)),Ft();const bt=be.slice(0,ke).reduce((ae,ue)=>ae+ue,0),Ye=Math.max(0,bt+G+K+ve);if(Tm(M)?.enabled===!1){Ye>Te(xe)&&S.length>0&&fe();const ae=z?ye(M,xe):Tt;return S.push({elementId:M.id,type:"table-slice",startRow:0,endRow:ke,subtotal:G>0,summary:K>0,renderTop:ae}),st=ae,Ee=Math.max(0,Ye),de(xe,Ye),Ft()}const yt=Pm(oe,ke);let Vt=0,sn=!0,Pe=Tt,Le=ve;const Rn=()=>Te(xe)-Le,Dn=(ae,ue)=>{S.push({elementId:M.id,type:"table-slice",startRow:Vt,endRow:ae,subtotal:G>0,...!sn&&ue?{repeatHeader:!0}:{},renderTop:Pe}),de(xe,Math.max(0,Le)),st=Pe,Ee=Math.max(0,Le),Le=0};for(const ae of yt){const ue=be.slice(ae.start,ae.end).reduce((lt,ct)=>lt+ct,0);if(ue+G<=Rn()){Le+=ue;continue}ae.start>Vt&&(Dn(ae.start,Ue>0),sn=!1,Vt=ae.start),fe(),Pe=ye(M,xe),Le=ve,sn||(Le+=Je),Le+=ue}if(Vt<ke&&Dn(ke,Ue>0),K>0)if(K<=Rn()){const ae=S.length-1,ue=S[ae];if(ue&&ue.type==="table-slice"&&ue.elementId===M.id)S[ae]={...ue,summary:!0},de(xe,K),Ee+=K;else{fe();const lt=ye(M,xe);S.push({elementId:M.id,type:"table-slice",startRow:ke,endRow:ke,summary:!0,renderTop:lt}),st=lt,Ee=Math.max(0,K+ve),de(xe,Math.max(0,K+ve))}}else{fe();const ae=ye(M,xe);S.push({elementId:M.id,type:"table-slice",startRow:ke,endRow:ke,summary:!0,renderTop:ae}),st=ae,Ee=Math.max(0,K+ve),de(xe,Math.max(0,K+ve))}return Ft()}function ge(M,H,B){const q=M.options??{},U=H.get(M.id)?.measuredFlowRowHeights??[],ee=(Array.isArray(q._flowRows)?q._flowRows:[]).length,_=Xt(q.flowRowHeight);if(ee===0)return B+1;const G=Nn(q),K=bo(Lc(M),q),Z=Pe=>{if(!Pe)return 0;const Le=Number.parseFloat(Pe.borderWidth);return Number.isFinite(Le)?Le*qc:0},oe=Pe=>{const Le=K?.edges?.[Pe];return Z(Le||(K?.all??void 0))},be=ft(q),ke=be.top+be.bottom+G.top+G.bottom+oe("top")+oe("bottom"),Ue=bn(M);let Je=0,Ne=Q(M,Ue).top,at=z?0:Ne,ve=0,xe=Ne,Tt=0;const Pn=()=>(z?Te(Ue):T()-at)-ve-ke,st=Pe=>{S.push({elementId:M.id,type:"flow-list-slice",startFlowRow:Je,endFlowRow:Pe,renderTop:Ne});const Le=z?Ne:ie(Ue),Rn=Ne+ke+ve;de(Ue,Math.max(0,Rn-Le)),xe=Ne,Tt=ke+ve,ve=0};let Ee=0;for(;Ee<ee;){const Pe=U[Ee]??_;if(Pe<=Pn()){ve+=Pe,Ee++;continue}if(Pe+ke>T()){Ee>Je&&(st(Ee),Je=Ee),S.length>0&&fe(),Ne=ye(M,Ue),at=z?0:Ne,ve=Pe,$e(Ne+ke+ve),Ee++;continue}if(S.length===0&&ve===0&&!z){ve+=Pe,$e(Ne+ke+ve),Ee++;continue}Ee>Je&&(st(Ee),Je=Ee),fe(),Ne=ye(M,Ue),at=z?0:Ne}Je<ee&&st(ee),Mt(M,H,Ue);const Ft=k.get(M.id)??[],bt=Ft.length>0?wa(M,Ft,e):0,Ye=S[S.length-1],yt=Ye?.type==="flow-group"&&Ye.elementId===M.id,Vt=yt?Ye.groupTop??q.top??0:xe,sn=yt&&(Ye.startFlowRow??0)===(Ye.endFlowRow??0)?0:Tt;return pe(Ue,Vt+sn+bt,yr(M)+be.bottom+bt),B+1}function Mt(M,H,B){const q=k.get(M.id)??[];if(q.length===0)return;const U=wa(M,q,e),V=M.options??{};if(U<=Te(B)){const ee=S.length-1,_=S[ee];if(_&&(_.type==="table-slice"||_.type==="flow-list-slice")&&_.elementId===M.id){S[ee]={..._,type:"flow-group",followElementIds:q,groupTop:_.renderTop??V.top??0},de(B,U),P(q);return}}fe(),S.push({elementId:M.id,type:"flow-group",startRow:0,endRow:0,...br(M)?{startFlowRow:0,endFlowRow:0}:{},followElementIds:q,groupTop:ye(M,B)}),de(B,U),P(q)}}function Pm(e,t){const n=[];let r=0,o=1;for(let i=0;i<t;i++){for(const a of e[i]?.cells??[])!a.merged&&(a.rowspan??1)>1&&(o=Math.max(o,i+a.rowspan));i+1>=o&&(n.push({start:r,end:i+1}),r=i+1,o=r+1)}return n}function Gc(e,t,n){let r=0;for(let o=0;o<e.length;o++)e[o]?.type===n&&(r+=t[o]??0);return r}const So=25,Vc=5;function Rm(e){return Math.max(So,e)}function Yc(e,t,n=1.1){const r=t>0?e*n:e/n;return Rm(Math.round(r))}function Dm(e,t,n,r,o=.9){if(n<=0||r<=0)return 100;const i=Math.min(e/n,t/r)*o,a=Math.round(i*100);return Math.max(Vc,a)}const $m=2;function Kc(e){const t=e.gap??$m,n=[...e.units].sort((i,a)=>i.order-a.order);if(e.available<=0)return{movedIds:[],overflowRemains:!1};if(n.some(i=>i.width<=0))return{movedIds:[],overflowRemains:!1};const r=i=>{const a=n.filter(c=>!i.has(c.id));return e.pinned+a.reduce((c,s)=>c+s.width+t,0)+(i.size>0?e.moreTriggerWidth+t:0)<=e.available};if(r(new Set))return{movedIds:[],overflowRemains:!1};const o=new Set;for(const i of n)if(o.add(i.id),r(o))return{movedIds:[...o],overflowRemains:!1};return{movedIds:[...o],overflowRemains:!0}}function Nm(e){const t=e.gap??4,n=e.boundaryBottom-e.triggerBottom-t,r=e.triggerTop-e.boundaryTop-t;return n>=e.overlayHeight?"down":r>n?"up":"down"}function Lm(){return oa().filter(e=>ut(e).blocked===!0)}Lm();function Fm(e){if(!e)return!1;const t=ut(e).blocked;return t===void 0?lr[e]?.blocked===!0:t}function zn(){return`el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Ea(e){const t=Vg(),n=ut(e).defaultOptions?.();if(n)return{...t,...n};const r=$n(e)?.kind.defaultOptions?.();return r?{...t,...r}:t}function Sa(e,t){return{id:zn(),options:{...Ea(e),...t},printElementType:{type:e,title:ut(e).title||$n(e)?.kind.label||String(e)}}}const zm=["left","top","width","height","marginTop","marginRight","marginBottom","marginLeft"];function Bm(e){return e.type??e.printElementType?.type}function Hm(e){const t=n=>(n??[]).filter(r=>!Fm(Bm(r)));return{...e,elements:t(e.elements),header:e.header?{...e.header,elements:t(e.header.elements)}:e.header,footer:e.footer?{...e.footer,elements:t(e.footer.elements)}:e.footer}}function Um(e){const t={...e.options};for(const n of zm){const r=t[n];typeof r=="number"&&Number.isFinite(r)&&(t[n]=qm(cr(r)))}return{...e,options:t}}function qm(e){return Math.round(e*100)/100}function Wm(e){const t={...e};delete t.firstPageOverlay;const n=Hm(t);if(n.unit==="mm")return n;const r=n,o=i=>i?.map(Um)??[];return{...r,unit:"mm",elements:o(r.elements),header:r.header?{...r.header,elements:o(r.header.elements)}:r.header,footer:r.footer?{...r.footer,elements:o(r.footer.elements)}:r.footer}}const _a="标签纸",Ot={A4:{width:210,height:297,label:"A4 210×297mm",group:"常用纸张"},A3:{width:297,height:420,label:"A3 297×420mm",group:"常用纸张"},A5:{width:148,height:210,label:"A5 148×210mm",group:"常用纸张"},Letter:{width:216,height:279,label:"Letter 216×279mm",group:"常用纸张"},Legal:{width:216,height:356,label:"Legal 216×356mm",group:"常用纸张"},DOT_FULL:{width:241,height:279.4,label:"全等分 241×279.4mm",group:"针式打印纸"},DOT_HALF:{width:241,height:139.7,label:"二等分 241×139.7mm",group:"针式打印纸"},DOT_THIRD:{width:241,height:93.1,label:"三等分 241×93.1mm",group:"针式打印纸"},LABEL_80X60:{width:80,height:60,label:"80×60mm",group:_a},LABEL_60X40:{width:60,height:40,label:"60×40mm",group:_a},LABEL_40X30:{width:40,height:30,label:"40×30mm",group:_a},THERMAL_57:{width:57,height:297,continuous:!0,label:"57mm",group:"小票纸"},THERMAL_80:{width:80,height:297,continuous:!0,label:"80mm",group:"小票纸"},THERMAL_110:{width:110,height:297,continuous:!0,label:"110mm",group:"小票纸"},CONTINUOUS:{width:80,height:297,continuous:!0,label:"连续纸(自定义宽度)",group:"连续纸"}};function _o(e){return!!e&&Ot[e]?.continuous===!0}function Jt(e){const t=_o(e.paperSize);let n;if(e.paperSize==="CUSTOM"||t){const r=Ot[e.paperSize];n={width:e.customWidth??r?.width??210,height:e.customHeight??r?.height??297}}else{const r=Ot[e.paperSize]||Ot.A4;n={width:r.width,height:r.height}}return e.orientation==="landscape"&&!t?{width:n.height,height:n.width}:n}const Ma=.75,jm="线型 / 宽度 / 颜色即时生效,这三行显示的就是当前生效规格:已有边框时任改一行都会按新规格铺满四边并清掉单边覆盖;上、下、左、右只给选中的边加框,撤掉一边会把它其余三边落成单边;「无」清除边框,「内部」仅表格单元格可用",wr=["top","right","bottom","left"];function Xc(e){const t={};for(const n of wr){const r=e.map(o=>!!o?.[n]);t[n]=r.length>0&&r.every(Boolean)?"on":r.some(Boolean)?"mixed":"off"}return t}const Ta=[{value:"none",label:"无"},{value:"solid",label:"实线"},{value:"dashed",label:"虚线"},{value:"dotted",label:"点线"},{value:"double",label:"双线"}],Gm=new Set(["solid","dashed","dotted","double"]),Bn="none";function xr(e,t){const n=e.borders?.[t];if(n&&n.style!==Bn&&typeof n.width=="number"&&Number.isFinite(n.width)&&n.width>0)return!0;const r=e.borderWidth;return e.borderStyle!==Bn&&typeof r=="number"&&Number.isFinite(r)&&r>0}function Vm(e){const t={};for(const n of wr)xr(e,n)&&(t[n]=e.borders?.[n]??{width:e.borderWidth});return t}function Ym(e){const t=e.borderWidth;return{width:typeof t=="number"&&Number.isFinite(t)&&t>0?t:Ma,style:e.borderStyle||"solid",color:e.borderColor||"#333333"}}function Zc(e,t,n){if(t!=="inner"){if(e.borders=void 0,t==="none"){e.borderWidth=0;return}e.borderWidth=n.width,e.borderStyle=n.style,e.borderColor=n.color}}function Jc(e){return wr.some(t=>xr(e,t))}function ka(e,t){if(!e.length)return;const n=e[0]?.[t];return e.every(r=>r[t]===n)?n:"mixed"}function Km(e){if(!e)return;const t=typeof e.style=="string"&&Gm.has(e.style)?e.style:"solid";return{width:e.width,style:e.style===void 0?void 0:t,color:e.color}}function Xm(e){const t=wr.map(r=>e.borders?.[r]).filter(r=>typeof r?.width=="number"&&Number.isFinite(r.width)&&r.width>0).map(r=>Km(r));if(!t.length)return;const n=ka(t,"style");return{width:ka(t,"width"),style:n===void 0?"solid":n,color:ka(t,"color")}}function Qc(e){const t=e.borderWidth,n=typeof t=="number"&&Number.isFinite(t),r=Xm(e),o=n&&t>0;if(r&&!o)return r;const i=o?e.borderStyle||"solid":Bn;return n?{width:t,style:i,color:e.borderColor}:{width:void 0,style:i,color:void 0}}function ed(e){const t=Qc(e);return{width:typeof t.width=="number"&&t.width>0?t.width:Ma,style:typeof t.style=="string"&&t.style!==Bn?t.style:"solid",color:typeof t.color=="string"?t.color:"#333333"}}function Zm(e,t){e.borderWidth=t.width,e.borderStyle=t.style,e.borderColor=t.color,e.borders=void 0}function Jm(e,t,n){if(t==="borderStyle"&&n===Bn){const r=Jc(e);e.borderStyle=Bn,r&&(e.borderWidth=0,e.borders=void 0);return}if(!Jc(e)){if(t==="borderStyle"){e.borderStyle=n,e.borderWidth=Ma;return}Object.assign(e,{[t]:n});return}if(t==="borderWidth"&&(typeof n!="number"||!(n>0))){e.borderWidth=typeof n=="number"&&n<0?0:n,e.borders=void 0;return}Zm(e,Ym({...e,[t]:n}))}function Ca(e,t,n,r){if(n!==xr(e,t)){if(!n){const o=e.borderWidth;if(typeof o!="number"||!(o>0)){td(e,t,null);return}const i={};for(const a of wr){if(a===t)continue;const l=e.borders?.[a];i[a]={width:l?.width??o,...l?.style!==void 0?{style:l.style}:e.borderStyle!==void 0?{style:e.borderStyle}:{},...l?.color!==void 0?{color:l.color}:e.borderColor!==void 0?{color:e.borderColor}:{}}}e.borders=i,e.borderWidth=0;return}td(e,t,r??ed(e))}}function td(e,t,n){const r={...e.borders??{}};n?r[t]={width:n.width,style:n.style,color:n.color}:delete r[t],e.borders=r}const nd=96/25.4,rd=1,Qm=8,e0=210;function Aa(e,t){if(!e||typeof e!="object")return;if(Array.isArray(e)){for(const r of e)Aa(r,t);return}const n=e;typeof n.printerDpi=="number"&&n.printerDpi>0&&t.add(n.printerDpi);for(const r of Object.keys(n)){if(r==="printerDpi")continue;const o=n[r];o&&typeof o=="object"&&Aa(o,t)}}function t0(e){if(!e)return null;const t=new Set;return Aa(e,t),t.size?Math.max(...t):null}function n0(e){if(!e)return e0*nd;const t=e.pages?.length?e.pages:[e];return Math.max(...t.map(n=>{const r=Jt(n);return((n.outputRotation===90||n.outputRotation===270)&&!_o(n.paperSize)?r.height:r.width)*nd}))}function r0(e,t){return e<=0||t<=0?rd:Math.min(Qm,Math.max(rd,Math.floor(e/t)))}function o0(e,t,n){const r=[];return e&&r.push({key:"dots",value:e/96,label:`点阵 ${e}dpi`,tip:`1 屏幕像素 = 1 个打印点(${e}dpi ÷ 96dpi)。条与间隙按纸面逐点显示,不会在屏幕上糊成一片`}),r.push({key:"fit",value:r0(t,n),label:"适配",tip:"按容器宽放大到放得下整页的最大整数倍"},{key:"100",value:1,label:"100%",tip:"按 CSS 真实尺寸显示(1mm = 3.78 屏幕像素),热敏点距在此档不可分辨"},{key:"200",value:2,label:"200%",tip:"整数倍放大,避免非整数缩放带来的半像素边"},{key:"400",value:4,label:"400%",tip:"整数倍放大,避免非整数缩放带来的半像素边"}),r}function od(e){return"100"}function i0(e,t){return!e||t==="dots"?"":`条码看不清?切「点阵 ${e}dpi」档(1 屏幕像素 = 1 打印点)`}const id="print-preview-zoom-guard";function a0(e,t){if(!e?.documentElement)return;let n=e.getElementById(id);n||(n=e.createElement("style"),n.id=id,(e.head??e.documentElement).appendChild(n)),n.textContent=`html{zoom:${t}}@media print{html{zoom:1 !important}}`}function s0(e,t,n){return e.some(r=>r.key===t)?t:od()}function l0(e,t){return e.find(n=>n.key===t)?.value??1}function c0(){return oa().filter(e=>ut(e).zoneAllowed===!0)}c0();function ad(e){return ut(e).zoneAllowed===!0}function d0(e){return Jt(e)}function Oa(e){const t=d0(e),n=e.margins,r=e.header.height,o=e.footer.height,i=t.width-n.left-n.right,a=t.height-n.top-n.bottom-r-o,l=(c,s,d,p)=>({left:c,top:s,width:d,height:p});return{header:l(n.left,n.top,i,r),content:l(n.left,n.top+r,i,a),footer:l(n.left,t.height-n.bottom-o,i,o)}}function sd(e,t,n){const r=Oa(e);return r.footer.height>0&&n>=r.footer.top?"footer":r.header.height>0&&n<r.header.top+r.header.height?"header":"content"}function Ia(e,t){const n=e.options;n.width=Math.min(n.width,t.width),n.height=Math.min(n.height,t.height),n.left=Math.min(Math.max(0,n.left),t.width-n.width),n.top=Math.min(Math.max(0,n.top),t.height-n.height)}function u0(e,t){const n=Oa(t),r=e.zone||"content",o=n[r],i=o.left+e.options.left+e.options.width/2,a=o.top+e.options.top+e.options.height/2;let l=sd(t,i,a),c=!1;if(l!=="content"&&!ad(e.printElementType.type)&&(l="content",c=!0),l!==r){const s=n[l];e.options.left=o.left+e.options.left-s.left,e.options.top=o.top+e.options.top-s.top,e.zone=l}return l!=="content"?Ia(e,n[l]):c&&Ia(e,n.content),{rejected:c}}const Pa=22,Ra=[1,2,5,10,20,50,100,200,500,1e3];function p0(e,t=64){const n=e*3.7795275590551185;for(const r of Ra)if(r*n>=t)return r;return Ra[Ra.length-1]}function f0(e){const t=Math.floor(Math.log10(e)+1e-9),n=e/10**t;return n===5||n===1&&e>=10?e/5:n===2?e/2:null}function h0(e){return Math.round(e*1e3)/1e3}function g0(e,t,n){if(t<e||n<=0)return[];const o=f0(n)??n,i=Math.ceil(e/o-1e-9)*o,a=Math.floor((t-i)/o+1e-9),l=[];for(let c=0;c<=a;c++){const s=h0(i+c*o);Math.abs(s/n-Math.round(s/n))<1e-6?l.push({mm:s,major:!0,label:String(s)}):l.push({mm:s,major:!1})}return l}const ld=["#000000","#333333","#666666","#999999","#cccccc","#ffffff","#e53935","#fb8c00","#1e88e5","#43a047","#8d6e63","#00acc1"],Mo=[{group:"position-size",groupLabel:"位置与尺寸",items:[{key:"ps-left",keywords:["X","横坐标","left","位置"]},{key:"ps-top",keywords:["Y","纵坐标","top","位置"]},{key:"ps-width",keywords:["W","宽度","width","尺寸"]},{key:"ps-height",keywords:["H","高度","height","尺寸"]},{key:"ps-margin-top",keywords:["上外边距","外边距","margintop"],default:0,defaultUnit:"mm"},{key:"ps-margin-right",keywords:["右外边距","外边距","marginright"],default:0,defaultUnit:"mm"},{key:"ps-margin-bottom",keywords:["下外边距","外边距","marginbottom"],default:0,defaultUnit:"mm"},{key:"ps-margin-left",keywords:["左外边距","外边距","marginleft"],default:0,defaultUnit:"mm"}]},{group:"appearance",groupLabel:"外观",items:[{key:"ap-font-family",keywords:["字体","字体名","字体族","fontfamily"]},{key:"ap-font-size",keywords:["字体大小","fontsize","字号"]},{key:"ap-font-weight",keywords:["字体粗细","粗体","bold"]},{key:"ap-align",keywords:["对齐","align"]},{key:"ap-vertical-align",keywords:["垂直对齐","verticalalign","顶对齐","底对齐"]},{key:"ap-color",keywords:["颜色","color"]},{key:"ap-bg-color",keywords:["背景色","background"]},{key:"ap-line-height",keywords:["行高","lineheight"]},{key:"ap-letter-spacing",keywords:["字间距","letterspacing"]},{key:"ap-text-fit",keywords:["溢出","溢出显示","截断","自动缩小","自适应行高","textfit","overflow"]},{key:"ap-shrink-min",keywords:["最小字号","缩放下限","shrinkminfontsize"],default:mc,defaultUnit:"pt"},{key:"ap-word-wrap",keywords:["自动换行","不换行","wordwrap"]},{key:"ap-keep-line-breaks",keywords:["保留换行符","换行符","手动换行","保留空格","连续空格","行首空格","keeplinebreaks"]},{key:"ap-long-text-indent",keywords:["首行缩进","缩进","indent","longtextindent","两字符","段首"],tip:"长文本每段首行空出的宽度,单位「字符」:填 2 即缩进两个汉字宽(中文排版惯例),按 em 落纸——字号被「自动缩小」压小时缩进同步变窄。仅长文本元素生效,写在普通文本上不生效"},{key:"ap-img-fit",keywords:["缩放模式","拉伸","等比","fit","contain","cover","填充","裁剪","剪裁","锚点"],tip:"图片在元素框内的缩放方式:包含=完整显示、可能留白;剪裁=铺满框并按「裁剪锚点」取一块;拉伸=填满框会变形;原始尺寸与缩小不放大。画布与三条出纸链路同一口径(缺省包含)"},{key:"ap-img-object-position",keywords:["裁剪锚点","剪裁锚点","锚点","objectposition","object-position","对齐点","上移","头顶"],tip:"取位(仅「剪裁」档有这一行):剪裁把图等比铺满元素框,多出来的那一条边按这里选的位置取舍。先选位置档(贴边/居中/贴另一头),再按百分比微调,0 贴左/贴顶,100 挪到另一头,水平与垂直各自独立;缺省取正中间(保住证件照头顶就选顶部)。其余缩放模式图比框小或刚好铺满,没有可裁的边,所以不出本行"},{key:"ap-img-fit-scale",keywords:["放大比例","剪裁放大","放大倍数","取景","裁切范围","fitscale","zoom"],default:gr,defaultUnit:"%",tip:"剪裁放大:等比铺满之后把画面再推大这么多,两轴才真的各多出一条边可裁——图与框同比例时不放大就什么都裁不掉。100=不放大(缺省),上限 400;超出框的部分由元素框裁掉。锚点选中的那一点既是取位的钉住点、也是放大的中心,两者共用同一个值。仅「剪裁」档生效,其余缩放模式不出本行"},{key:"ap-rotate",keywords:["旋转","角度","rotate","angle","顺时针","逆时针","90度","直角"],tip:"元素绕自身中心旋转的角度(度,0~359):出纸时按旋转后外接盒分页与结算,底部放不下自动移页,超出纸面左右缘或顶部会被裁切并给出纸提示。表格、流式列表与表格下方跟随区的元素不支持旋转(这三类不出本行);条码与二维码的任意角度需 385dpi 以上打印头,低分辨率打印机只按 90° 步进出纸"}]},{group:"flow-list",groupLabel:"流式列表",items:[{key:"fl-columns",keywords:["每行列数","列数","栏数","几列","flowcolumns"],tip:"一行排几个单元,必须由你指定——不随内容自动算列数。填的列数乘单元宽放不下元素框时只给提示、不改你的数,出纸按你填的排"},{key:"fl-row-height",keywords:["行高","每行高度","单元高度","flowrowheight"],tip:"每个单元行的最低高度(毫米),与表格行高同一口径:内容比它高时这一行会撑高,不会裁字"},{key:"fl-gap-x",keywords:["单元间距","横向间距","格间距","列间距","flowgapx"],tip:"相邻单元之间的横向留白(毫米);纵向不留缝,行与行的距离由行高承担"},{key:"fl-auto-span",keywords:["自适应","跨列","内容过长","占两列","自动换行","flowsautspan","flowautospan"],tip:"单元内容比一列还宽时,让它占掉两个或更多列位;当前行剩不够放就把整个单元挪到下一行行首(绝不把词切两半)。默认关——开着时出纸栏数由字号与框宽决定"},{key:"fl-max-span",keywords:["最多跨几列","跨列上限","flowmaxspan"],tip:"跨列的列数上限,最大只能等于「每行列数」:把每行列数改小时,这里会被一并顶回去"},{key:"fl-layout-mode",default:"fixed",keywords:["布局模式","容器模式","固定高度","动态分页","自动高度","flowlayoutmode"],tip:"容器高度由谁决定:固定高度=维持设计高度、一框一页,超高裁切(存量模板默认值,输出不变);动态分页=容器高度由内容撑开,内容满页后按行续页,每一页都画完整边框,元素下方的跟随区与表格同一套规则"},{key:"fl-padding-top",keywords:["上内边距","内边距","顶边距","flowpaddingtop"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器顶部与第一行内容之间的留白(毫米),仅动态模式生效;每页切片都按它留白并计入分页预算,负值与非法值按 0 处理"},{key:"fl-padding-right",keywords:["右内边距","内边距","右边距","flowpaddingright"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器右侧与内容之间的留白(毫米),会压缩参与列宽估算的内容宽度,仅动态模式生效"},{key:"fl-padding-bottom",keywords:["下内边距","内边距","底边距","flowpaddingbottom"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器底部与最后一行内容之间的留白(毫米),每页切片都按它留白并计入分页预算,仅动态模式生效"},{key:"fl-padding-left",keywords:["左内边距","内边距","左边距","flowpaddingleft"],default:0,defaultUnit:"mm",tip:"动态分页模式下容器左侧与内容之间的留白(毫米),会压缩参与列宽估算的内容宽度,仅动态模式生效"}]},{group:"code",groupLabel:"条码设置",items:[{key:"cd-type",keywords:["码制","条码类型","条形码类型","barcodetype","code128","ean13","code39","itf14"]},{key:"cd-dpi",keywords:["打印机分辨率","dpi","打印点","点阵对齐","203","300"]},{key:"cd-bar-width",keywords:["条宽","条粗细","barwidth","模块宽"]},{key:"cd-bar-quiet-zone",keywords:["条码静区","条码白边","条形码留白","条码空白边","barquietzone"],default:Tc,defaultUnit:"模块",tip:"条形码左右两端的空白格数(1 格 = 1 条宽):缺省 10,正是一维码码制要求的下限;数值越小白边越窄、同样的框内条越粗(可放大)。填 0 即不留白边,但静区参与「条→空→条」跳变,紧邻文字或表格线时可能扫不出,需实打验证"},{key:"cd-bar-height",keywords:["条高","条码高度","条区高度","条码多高","barheight"],default:Zt,defaultUnit:"模块",tip:"黑白条本体的目标高度(mm,不含下方文字):折算粒度就是每模块物理宽,所以只能精确到它的整数倍。条宽优先——可用框高装不下时期望条高让位,绝不把条宽挤窄(热敏出纸清晰度靠条宽)。与「最大高度」分工不同:那条限的是整图(含文字)的上限"},{key:"cd-show-text",keywords:["显示文本","条码文本","显示数字"]},{key:"cd-font-size",keywords:["条码字号","文本字号"],default:ho,defaultUnit:"模块"},{key:"cd-ec-level",keywords:["纠错级别","容错","qrcodelevel"]},{key:"cd-quiet-zone",keywords:["静区","静区宽度","白边","空白边","留白","铺满","quietzone"],default:kc,defaultUnit:"模块",tip:"二维码四周留出的空白格数:0 即不留白边、码面等比铺满元素框(此时靠框外的白纸充当静区);数值越大白边越宽、码面在框内越小(缺省 0,需 ISO/IEC 18004 推荐静区时填 4)"},{key:"cd-fit",keywords:["缩放模式","拉伸","等比","fit","contain","cover"]},{key:"cd-max-width",keywords:["最大宽度","最大宽","maxwidth"]},{key:"cd-max-height",keywords:["最大高度","最大高","maxheight"]}]},{group:"content",groupLabel:"内容",items:[{key:"ct-title",keywords:["内容","文本","title"]},{key:"ct-formatter",keywords:["格式化","表达式","formatter"]},{key:"ct-table-mode",keywords:["数据模式","静态布局","动态数据"]},{key:"ct-table-source",keywords:["数据源","列表字段"]},{key:"ct-table-font",keywords:["默认字号","默认颜色","默认内边距"]},{key:"ct-table-cols",keywords:["列宽","表格列"]}]},{group:"border-bg",groupLabel:"边框与背景",items:[{key:"bb-border-style",keywords:["线型","边框线型","实线","虚线","点线","双线","borderstyle"]},{key:"bb-border-width",keywords:["边框宽度","border"]},{key:"bb-border-color",keywords:["边框颜色"]},{key:"bb-bg-color",keywords:["背景色","background"]}]},{group:"binding",groupLabel:"字段绑定",items:[{key:"bd-formatter",keywords:["格式化","表达式","formatter","fx","字段","绑定","field"]},{key:"bd-content",keywords:["内容","表达式","文本","变量"]}]},{group:"pagination",groupLabel:"分页",items:[{key:"pg-enabled",keywords:["分页","pagination","启用分页"]},{key:"pg-pageable",keywords:["参与分页","pageable"]},{key:"pg-keep-with-next",keywords:["同页","keepWithNext"]}]},{group:"advanced",groupLabel:"高级",items:[{key:"ad-locked",keywords:["锁定","lock"]},{key:"ad-fixed",keywords:["每页重复","repeat"]},{key:"ad-fixed-position",keywords:["固定","每页固定","fixed"]},{key:"ad-z-index",keywords:["层级","zindex"]},{key:"ad-delete",keywords:["删除"]}]}];function Ae(e){for(const t of Mo){const n=t.items.find(r=>r.key===e);if(n)return n.tip??""}return""}function cd(e,t){const n=e.trim().toLowerCase();return n?t.some(r=>r.toLowerCase().includes(n)):!0}function m0(e){const t=[],n=new Set;for(const r of Mo){const o=r.items.filter(i=>cd(e,[...i.keywords,r.groupLabel]));if(o.length>0){t.push(r.group);for(const i of o)n.add(i.key)}}return{groups:t,itemKeys:n}}function b0(e){for(const t of Mo)for(const n of t.items)if(n.key===e&&n.default!==void 0)return{value:n.default,unit:n.defaultUnit}}function y0(e){return/[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6]/.test(e)}function v0(e){let t=0;for(const n of e)t+=y0(n)?1:.55;return t}function w0(e){return v0(e)>=4}const x0=new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),E0=new Set(["new","function","class","this","delete","typeof","void","in","of","var","let","const","return","if","while","for"]);function Da(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e[n];if(/\s/.test(o)){n++;continue}if(/[0-9]/.test(o)||o==="."&&n+1<r&&/[0-9]/.test(e[n+1])){let l=n;for(;l<r&&/[0-9.]/.test(e[l]);)l++;t.push({type:"num",value:e.slice(n,l),position:n}),n=l;continue}if(o==="'"||o==='"'){let l=n+1,c="";for(;l<r&&e[l]!==o;)e[l]==="\\"&&l+1<r?(c+=e[l+1],l+=2):(c+=e[l],l++);if(l>=r)throw new Error("字符串未闭合");t.push({type:"str",value:c,position:n}),n=l+1;continue}if(/[A-Za-z_$\u4e00-\u9fff]/.test(o)){let l=n;for(;l<r&&/[A-Za-z0-9_$\u4e00-\u9fff]/.test(e[l]);)l++;const c=e.slice(n,l);if(E0.has(c))throw new Error(`不允许使用关键字: ${c}`);if(x0.has(c))throw new Error(`禁止访问: ${c}`);c==="true"||c==="false"?t.push({type:"bool",value:c,position:n}):t.push({type:"ident",value:c,position:n}),n=l;continue}const i=e.slice(n,n+3);if(i==="==="||i==="!=="){t.push({type:"punc",value:i,position:n}),n+=3;continue}const a=e.slice(n,n+2);if(a==="=>")throw new Error("不允许函数定义");if(["==","!=","<=",">=","&&","||"].includes(a)){t.push({type:"punc",value:a,position:n}),n+=2;continue}if(o==="=")throw new Error("不允许赋值");if(o===";")throw new Error("不允许多条语句");if("+-*/%()[]{},:.?!<>".includes(o)){t.push({type:"punc",value:o,position:n}),n++;continue}throw new Error(`非法字符: ${o}`)}return t}function $a(e){return new S0(e).parse()}class S0{constructor(t){this.pos=0,this.tokens=t}parse(){const t=this.parseTernary();if(this.pos<this.tokens.length)throw new Error(`表达式存在多余内容: ${this.tokens[this.pos].value}`);return t}peek(){return this.tokens[this.pos]}next(){const t=this.tokens[this.pos++];if(!t)throw new Error("表达式意外结束");return t}eatPunc(t){const n=this.peek();return n&&n.type==="punc"&&n.value===t?(this.pos++,!0):!1}expectPunc(t){if(!this.eatPunc(t)){const n=this.peek()?.position??0;throw new Error(`位置 ${n}: 期望 "${t}"`)}}parseTernary(){const t=this.parseLogicalOr();if(this.eatPunc("?")){const n=this.parseTernary();this.expectPunc(":");const r=this.parseTernary();return{type:"ternary",cond:t,consequent:n,alternate:r}}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.eatPunc("||");){const n=this.parseLogicalAnd();t={type:"binary",op:"||",left:t,right:n}}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.eatPunc("&&");){const n=this.parseEquality();t={type:"binary",op:"&&",left:t,right:n}}return t}parseEquality(){let t=this.parseRelational();for(;;){const n=this.peek();if(n?.type==="punc"&&["==","!=","===","!=="].includes(n.value)){this.pos++;const r=this.parseRelational();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseRelational(){let t=this.parseAdditive();for(;;){const n=this.peek();if(n?.type==="punc"&&["<",">","<=",">="].includes(n.value)){this.pos++;const r=this.parseAdditive();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseAdditive(){let t=this.parseMultiplicative();for(;;){const n=this.peek();if(n?.type==="punc"&&(n.value==="+"||n.value==="-")){this.pos++;const r=this.parseMultiplicative();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseMultiplicative(){let t=this.parseUnary();for(;;){const n=this.peek();if(n?.type==="punc"&&["*","/","%"].includes(n.value)){this.pos++;const r=this.parseUnary();t={type:"binary",op:n.value,left:t,right:r}}else return t}}parseUnary(){const t=this.peek();if(t?.type==="punc"&&["!","-","+"].includes(t.value)){this.pos++;const n=this.parseUnary();return{type:"unary",op:t.value,arg:n,prefix:!0}}return this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.eatPunc(".")){const n=this.next();if(n.type!=="ident")throw new Error(`位置 ${n.position}: 成员访问需要属性名`);t={type:"member",object:t,property:n.value,computed:!1}}else if(this.eatPunc("[")){const n=this.parseTernary();this.expectPunc("]"),n.type==="str"?t={type:"member",object:t,property:n.value,computed:!1}:t={type:"member",object:t,property:n.name??String(n.value),computed:!0}}else if(this.peek()?.type==="punc"&&this.peek()?.value==="("&&(t.type==="ident"||t.type==="member")){this.pos++;const n=this.parseArgs();t={type:"call",callee:t,args:n}}else return t}parseArgs(){const t=[];if(this.eatPunc(")"))return t;for(;;){if(t.push(this.parseTernary()),this.eatPunc(")"))return t;this.expectPunc(",")}}parsePrimary(){const t=this.next();if(t.type==="num"){const n=Number(t.value);if(isNaN(n))throw new Error(`非法数字: ${t.value}`);return{type:"num",value:n}}if(t.type==="str")return{type:"str",value:t.value};if(t.type==="bool")return{type:"bool",value:t.value==="true"};if(t.type==="ident")return{type:"ident",name:t.value};if(t.value==="("){const n=this.parseTernary();return this.expectPunc(")"),n}if(t.value==="["){const n=[];if(!this.eatPunc("]"))for(;n.push(this.parseTernary()),!this.eatPunc("]");)this.expectPunc(",");return{type:"array",elements:n}}if(t.value==="{"){const n=[];if(!this.eatPunc("}"))for(;;){const r=this.next();if(r.type!=="ident"&&r.type!=="str")throw new Error(`位置 ${r.position}: 对象键必须是标识符或字符串`);if(this.expectPunc(":"),n.push({key:r.value,value:this.parseTernary()}),this.eatPunc("}"))break;this.expectPunc(",")}return{type:"object",properties:n}}throw new Error(`位置 ${t.position}: 意外的符号: ${t.value}`)}}const dd=20,_0=8;function et(e,t=0){if(typeof e=="number")return Number.isFinite(e)?e:t;if(typeof e=="string"){const n=e.trim();if(n==="")return t;const r=Number(n);return Number.isFinite(r)?r:t}return e==null?t:typeof e=="boolean"?e?1:0:t}function M0(e){if(typeof e=="number")return Number.isFinite(e);if(typeof e=="string"){const t=e.trim();return t!==""&&Number.isFinite(Number(t))}return!1}function Hn(e){return!Number.isFinite(e)||Number.isInteger(e)||Math.abs(e)>=1e15?e:Number(e.toPrecision(12))}function Un(e){if(!Number.isFinite(e)||Number.isInteger(e))return 0;const t=String(e);if(t.includes("e")||t.includes("E"))return 0;const n=t.indexOf(".");return n===-1?0:t.length-n-1}function Na(e,t){if(!Number.isFinite(e))return 0;const n=Math.min(Math.max(t,0),12);if(n===0)return Math.round(e);const r=10**n,o=e*r;return!Number.isFinite(o)||Math.abs(o)>=1e15?Hn(e):Math.round(o)/r}function La(e,t){const n=et(e),r=et(t),o=n+r;return Na(o,Math.max(Un(n),Un(r)))}function Fa(e,t){const n=et(e),r=et(t),o=n-r;return Na(o,Math.max(Un(n),Un(r)))}function ud(e,t){const n=et(e),r=et(t),o=n*r;return Na(o,Un(n)+Un(r))}function pd(e,t){const n=et(e),r=et(t);return r===0?0:Hn(n/r)}function T0(e,t){const n=et(e),r=et(t);return r===0?0:Hn(n%r)}function k0(e){if(e==null)return 2;const t=Math.trunc(et(e,2));return Number.isFinite(t)?Math.min(Math.max(t,-dd),dd):2}function To(e,t,n){const r=et(e,0),o=k0(t);if(r===0)return 0;if(Math.abs(r)>=1e21)return Hn(r);const i=Math.max(o,0)+_0,a=r.toFixed(i);if(!/^-?\d+(\.\d+)?$/.test(a))return Hn(r);const l=a.startsWith("-"),c=a.replace("-","").replace(".","");let s=BigInt(c||"0");l&&(s=-s);const d=10n**BigInt(i-o),p=s<0n?-1n:1n,u=s<0n?-s:s;let f=u/d;const g=u%d,m=2n*g;n==="up"?g!==0n&&(f+=1n):n!=="down"&&m>=d&&(m>d||n==="half-up"||f%2n===1n)&&(f+=1n);const b=p*f;return Hn(o>=0?Number(b)/10**o:Number(b)*10**-o)}const za={Math,Number,String,Boolean,parseInt,parseFloat,isNaN,true:!0,false:!1,null:null,undefined:void 0},C0=new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),A0=new Set(["Number","String","Boolean","parseInt","parseFloat","isNaN"]);function Ke(e,t,n={}){switch(e.type){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"ident":return O0(e.name,t);case"binary":return I0(e,t,n);case"unary":return P0(e,t,n);case"ternary":return Ke(e.cond,t,n)?Ke(e.consequent,t,n):Ke(e.alternate,t,n);case"member":return $0(e,t,n);case"call":return N0(e,t,n);case"array":return e.elements.map(r=>Ke(r,t,n));case"object":return Object.fromEntries(e.properties.map(r=>[r.key,Ke(r.value,t,n)]))}}function O0(e,t,n){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];if(Object.prototype.hasOwnProperty.call(za,e))return za[e];throw new Error(`未定义的标识符: ${e}`)}function I0(e,t,n){const r=Ke(e.left,t,n),o=Ke(e.right,t,n);switch(e.op){case"+":return D0(r,o)?La(r,o):R0(r,o);case"-":return Fa(r,o);case"*":return ud(r,o);case"/":return pd(r,o);case"%":return T0(r,o);case"<":return r<o;case">":return r>o;case"<=":return r<=o;case">=":return r>=o;case"==":return r==o;case"!=":return r!=o;case"===":return r===o;case"!==":return r!==o;case"&&":return r&&o;case"||":return r||o;default:throw new Error(`未知运算符: ${e.op}`)}}function P0(e,t,n){const r=Ke(e.arg,t,n);switch(e.op){case"-":return Fa(0,r);case"+":return et(r);case"!":return!r;default:throw new Error(`未知一元运算符: ${e.op}`)}}function R0(e,t){return`${e==null?"":String(e)}${t==null?"":String(t)}`}function D0(e,t){const n=fd(e),r=fd(t);return n==="other"||r==="other"?!1:n==="num"||r==="num"}function fd(e){return e==null||e===""?"neutral":M0(e)?"num":"other"}function $0(e,t,n){const r=Ke(e.object,t,n);if(r==null)throw new Error("无法访问空值的属性");if(C0.has(e.property))throw new Error(`禁止访问属性: ${e.property}`);return r[e.property]}function N0(e,t,n){if(e.callee.type==="ident"&&A0.has(e.callee.name)){const o=za[e.callee.name],i=e.args.map(a=>Ke(a,t,n));return o(...i)}if(e.callee.type==="member"&&e.callee.object.type==="ident"&&e.callee.object.name==="Math"){const o=Math[e.callee.property];if(typeof o!="function")throw new Error(`Math.${e.callee.property} 不是方法`);const i=e.args.map(a=>Ke(a,t,n));return o(...i)}let r;if(e.callee.type==="ident")r=e.callee.name;else if(e.callee.type==="member")throw new Error("不支持方法调用,请使用顶级函数");if(r&&n[r]){const o=e.args.map(i=>Ke(i,t,n));return n[r](...o)}throw r&&Object.prototype.hasOwnProperty.call(t,r)?new Error(`${r} 不是函数`):new Error(`不允许调用: ${r??"表达式"}`)}function L0(e){const t=[];let n=0;const r=e.length;for(;n<r;){if(e[n]==="{"){let i=1,a=n+1;for(;a<r&&i>0;)e[a]==="{"?i++:e[a]==="}"&&i--,a++;if(i!==0)throw new Error(`位置 ${n}: 花括号未闭合`);const l=e.slice(n+1,a-1);if(l.trim()==="")throw new Error(`位置 ${n}: 空表达式`);const c=Da(l),s=$a(c);t.push({type:"expr",expression:s}),n=a;continue}let o=n;for(;o<r&&e[o]!=="{";)e[o]==="\\"&&o+1<r&&(e[o+1]==="{"||e[o+1]==="}")?o+=2:o++;t.push({type:"text",value:e.slice(n,o).replace(/\\([{}])/g,"$1")}),n=o}return{type:"template",parts:t}}function F0(e,t,n={}){let r="";for(const o of e.parts)if(o.type==="text")r+=o.value;else{const i=Ke(o.expression,t,n);r+=String(i??"")}return r}function hd(e,t={}){const n=L0(e);return r=>F0(n,r,t)}function Er(e,t){if(e==null||t==null)return;if(typeof e=="object"&&t in e)return e[t];const n=t.split(".");let r=e;for(const o of n){if(r==null)return;r=r[o]}return r}function gd(e){const t=Number(e);if(isNaN(t))return String(e);const n=t<0?"-":"",r=Math.abs(t),[o,i]=r.toFixed(2).split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return`${n}${a}.${i}`}function md(e,t){let n;if(e instanceof Date)n=e;else if(typeof e=="number")n=new Date(e);else if(typeof e=="string")n=new Date(e);else return String(e);if(isNaN(n.getTime()))return String(e);const r=o=>String(o).padStart(2,"0");return t.replace("YYYY",String(n.getFullYear())).replace("MM",r(n.getMonth()+1)).replace("DD",r(n.getDate())).replace("HH",r(n.getHours())).replace("mm",r(n.getMinutes())).replace("ss",r(n.getSeconds()))}const Ba=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],z0=["","拾","佰","仟"],B0=["","万","亿","万亿","亿亿"];function H0(e){let t="",n=!1;for(let r=3;r>=0;r--){const o=Math.floor(e/10**r)%10;if(o===0){t&&(n=!0);continue}n&&(t+="零",n=!1),t+=Ba[o]+z0[r]}return t}function bd(e){const t=Number(e);if(isNaN(t))return String(e);if(t===0)return"零元整";const n=t<0?"负":"",[r,o]=Math.abs(t).toFixed(2).split("."),i=Math.ceil(r.length/4);let a="",l=!1;for(let d=i-1;d>=0;d--){const p=r.length-d*4,u=parseInt(r.slice(Math.max(0,p-4),p),10);if(u===0){a&&(l=!0);continue}a&&(l||u<1e3)&&(a+="零"),l=!1,a+=H0(u)+(B0[d]??"")}a=`${a||"零"}元`;const c=parseInt(o[0],10),s=parseInt(o[1],10);return c===0&&s===0?a+="整":(c===0?a+="零":a+=Ba[c]+"角",s>0&&(a+=Ba[s]+"分")),n+a}function yd(e,t,n){return e?t:n}function Ha(e,t){return e.reduce((n,r)=>n+(Number(Er(r,t))||0),0)}function vd(e,t){return e.length===0?0:Ha(e,t)/e.length}function wd(e,t){return e.length}function xd(e,t){return e.length===0?0:Math.min(...e.map(n=>Number(Er(n,t))||0))}function Ed(e,t){return e.length===0?0:Math.max(...e.map(n=>Number(Er(n,t))||0))}function Sd(...e){return e.reduce((t,n)=>La(t,n),0)}function _d(...e){return e.length===0?0:e.slice(1).reduce((t,n)=>Fa(t,n),La(e[0],0))}function Md(...e){return e.length===0?0:e.reduce((t,n)=>ud(t,n),1)}function Td(e,t){return pd(e,t)}function kd(e,t){return To(e,t,"half-up")}function ko(e,t){return To(e,t,"up")}function Co(e,t){return To(e,t,"down")}function Cd(e,t){return To(e,t,"half-even")}class U0{constructor(){this.functions={}}registerFunction(t,n){this.functions[t]=n}evaluate(t,n){const r=Da(t),o=$a(r);return Ke(o,n,this.functions)}render(t,n){return hd(t,this.functions)(n)}}const Ua=new U0,q0={MONEY:gd,DATE:md,UPPER:bd,IF:yd,CONCAT:(...e)=>e.filter(t=>t!=null).map(String).join(""),IFEMPTY:(e,t)=>e!=null&&e!==""?String(e):t,LEN:e=>String(e).length,ADD:Sd,SUB:_d,MUL:Md,DIV:Td,ROUND:kd,ROUNDUP:ko,CEIL:ko,ROUNDDOWN:Co,FLOOR:Co,ROUNDBANK:Cd};for(const[e,t]of Object.entries(q0))Ua.registerFunction(e,t);function W0(e,t,n){switch(e.toUpperCase()){case"SUM":return Ha(n,t);case"AVG":return vd(n,t);case"COUNT":return wd(n);case"MIN":return xd(n,t);case"MAX":return Ed(n,t);default:return 0}}function j0(e,t){return Ua.evaluate(e,t)}function Qt(e,t,n){if(!e)return"";if(!e.includes("{"))return e;const r=Array.isArray(t.rows)?t.rows:[],o=e.replace(/\{([^}]+)\}/g,(i,a)=>{let l=a.trim();return l=l.replace(/\b(SUM|AVG|COUNT|MIN|MAX)\(([^)]+)\)/g,(c,s,d)=>{const p=d.trim().replace(/^['"]|['"]$/g,"");return String(W0(s,p,r))}),`{${l}}`});try{return Ua.render(o,t)}catch{return n??e}}function Ad(e,t,n,r){const o={...Io(),...t??{}},i=JSON.parse(JSON.stringify(e));i.header?.elements&&(i.header.elements=i.header.elements.map(l=>qa(l,o,n))),i.footer?.elements&&(i.footer.elements=i.footer.elements.map(l=>qa(l,o,n))),i.elements=i.elements.map(l=>qa(l,o,n));const a=r??n;if(a&&i.fonts?.length){const l=a.replace(/\/+$/,"");i.fonts=i.fonts.map(c=>({...c,files:(c.files??[]).map(s=>({...s,url:s.url?.startsWith("/")&&!s.url.startsWith("//")?l+s.url:s.url}))}))}return i}function qa(e,t,n){const r={...e,options:{...e.options}};if(!(r.type==="flowList"||r.printElementType?.type==="flowList")&&typeof r.options.formatter=="string"){const c=r.options.formatter;if(_r(c))r.options.rawFormatter=c;else{const s=r.type||r.printElementType?.type,d=typeof r.options.exampleValue=="string"?r.options.exampleValue:Wg(s);r.options.formatter=Qt(c,t,d)}}if((r.type==="image"||r.printElementType?.type==="image")&&typeof r.options.src=="string"){let c=r.options.src;c.includes("{")&&(c=Qt(c,t)),c&&n&&!/^([a-z][a-z\d+\-.]*:|\/\/)/i.test(c)&&(c=n.replace(/\/+$/,"")+(c.startsWith("/")?c:`/${c}`)),r.options.src=c}(r.type==="table"||r.printElementType?.type==="table")&&V0(r,t),(r.type==="flowList"||r.printElementType?.type==="flowList")&&G0(r,t);const a=r.type||r.printElementType?.type||"text",l=$n(a)?.binding?.bind;if(l){const c=l(r.options,t);c&&typeof c=="object"&&Object.assign(r.options,c)}return r}function G0(e,t){const n=typeof e.options.formatter=="string"?e.options.formatter:"",r={...e.options,dataSource:e.options.dataSource??fo(n,t)},{list:o,key:i}=Od(r,t),a=c=>i?{...t,...c,[i]:c}:{...t,...c},l=o.map(c=>n?_r(n)?n:Qt(n,a(c)):String(c??""));if(e.options._flowItems=l,e.options._flowRawFormatter=_r(n)?n:void 0,pn(e.options.flowLayoutMode)==="dynamic"){const c=Ec(e.options.width??0,Nn(e.options)),s=l.length>0?l:String(e.options.testData??"").split(/\r?\n/).map(d=>d.trim()).filter(Boolean);e.options._flowRows=da(s,{width:c,columns:pt(e.options.flowColumns),gapX:vt(e.options.flowGapX),fontSizePt:e.options.fontSize??12,autoSpan:e.options.flowAutoSpan===!0,maxSpan:fn(e.options.flowMaxSpan,e.options.flowColumns)})}}function Od(e,t){const n=e.dataSource??e.fields?.[0]?.dataSource??e.fields?.[0]?.field;if(n&&Array.isArray(t[n]))return{list:t[n],key:n};for(const[r,o]of Object.entries(t))if(Array.isArray(o))return{list:o,key:r};return{list:[],key:n}}function V0(e,t){const n=e.options,r=n.tableRows;if(!Array.isArray(r)||r.length===0)return;const o=n.tableMode??"dynamic",{list:i,key:a}=o==="dynamic"?Od(n,t):{list:[],key:void 0},l=g=>a?{...t,...g,[a]:g}:{...t,...g},c=a?i.map(g=>({...g,[a]:g})):i,s=[],d=[],p=[],u=[];let f=-1;for(const g of r){if(o==="dynamic"&&g.type==="data"){Y0(g.cells);for(const m of i){f<0&&(f=s.length);const b=l(m);s.push(Oo(g,v=>Ao(v,b))),d.push(b)}continue}if(o==="dynamic"&&g.type==="subtotal"){const m=Oo(g,b=>Ao(b,{rows:c,...t}),!0);p.push(m),s.push(m);continue}if(o==="dynamic"&&g.type==="summary"){const m=Oo(g,b=>Ao(b,{rows:c,...t}));u.push(m),s.push(m);continue}s.push(Oo(g,m=>Ao(m,t)))}n._renderRows=s,n._repeatHeaderCount=K0(r),n._dataRowCtx=d,n._dataStartIdx=f<0?s.length:f,n._subtotalTemplates=p,n._summaryRows=u,n._mainData=t}function Y0(e){const t=new Set;e.forEach((n,r)=>{if(!n||n.merged)return;const o=Math.max(n.colspan??1,1);for(let i=1;i<o;i++)t.add(r+i)}),e.forEach((n,r)=>{n.rowspan&&(n.rowspan=1),n.merged&&!t.has(r)&&(n.merged=!1)})}function Ao(e,t){const n=e.formatter;return n?_r(n)?n:Qt(n,t):""}function Oo(e,t,n=!1){return{type:e.type,height:e.height??8,cells:e.cells.map(r=>({content:r.merged?"":t(r),...(n||_r(r.formatter))&&!r.merged?{rawFormatter:r.formatter??""}:{},cellType:r.cellType,barcodeType:r.barcodeType,qrCodeLevel:r.qrCodeLevel,qrQuietZone:r.qrQuietZone,barQuietZone:r.barQuietZone,barHeight:r.barHeight,barWidth:r.barWidth,barFontSize:r.barFontSize,showBarcodeText:r.showBarcodeText,printerDpi:r.printerDpi,fit:r.fit,objectPosition:r.objectPosition,fitScale:r.fitScale,maxWidth:r.maxWidth,maxHeight:r.maxHeight,rowspan:r.rowspan??1,colspan:r.colspan??1,merged:r.merged===!0,...r.mergeSameValue===!0?{mergeSameValue:!0}:{},align:r.align,valign:r.valign,fontSize:r.fontSize,fontFamily:r.fontFamily,fontWeight:r.fontWeight,color:r.color,backgroundColor:r.backgroundColor,borders:r.borders,padding:r.padding,wordWrap:r.wordWrap,textFit:r.textFit,shrinkMinFontSize:r.shrinkMinFontSize}))}}function K0(e){const t=X0(e);return t===0||!e.slice(0,t).some(r=>r.repeatOnPage===!0)?0:J0(e,t)}function X0(e){let t=0;for(const n of e){if(n?.type!=="header")break;t++}return t}function Z0(e,t){for(let n=0;n<t;n++)for(const r of e[n]?.cells??[])if(!r?.merged&&n+(r?.rowspan??1)>t)return!1;return!0}function J0(e,t){for(let n=t;n>=1;n--)if(Z0(e,n))return n;return 1}const Sr=e=>String(e).padStart(2,"0");function Io(e=new Date,t={}){return{printDate:`${e.getFullYear()}-${Sr(e.getMonth()+1)}-${Sr(e.getDate())}`,printTime:`${Sr(e.getHours())}:${Sr(e.getMinutes())}:${Sr(e.getSeconds())}`,pageIndex:t.pageIndex??1,totalPages:t.totalPages??1}}function _r(e){return typeof e=="string"&&/\b(pageIndex|totalPages)\b/.test(e)}function Wa(e,t=new Date){const{printDate:n,printTime:r}=Io(t);return e.replace(/\{printDate\}/g,n).replace(/\{printTime\}/g,r)}function Mr(e){const t=[];for(const n of e??[]){const r=n?.family?.trim();if(!r)continue;const o=`"${r.replace(/"/g,"")}"`;for(const i of n.files??[]){const a=i?.url?.trim();if(!a)continue;const l=Number.isFinite(i.weight)?Number(i.weight):400,c=i.style==="italic"?"italic":"normal";t.push(`@font-face{font-family:${o};src:url("${a}")${Q0(a)};font-weight:${l};font-style:${c};font-display:block;}`)}}return t.length?`${t.join("")}
|
|
2
|
+
`:""}function Q0(e){const t=e.split(/[?#]/)[0].toLowerCase();return t.endsWith(".woff2")?' format("woff2")':t.endsWith(".woff")?' format("woff")':t.endsWith(".ttf")?' format("truetype")':t.endsWith(".otf")?' format("opentype")':""}const ja=['"Microsoft YaHei"','"PingFang SC"','"Helvetica Neue"',"Arial","sans-serif"];function Ga(e){return e.replace(/&/g,"&").replace(/"/g,""")}function Va(e){const t=e?.trim();return t?[t.includes(",")?t:`"${t.replace(/"/g,"")}"`,...ja].join(", "):ja.join(", ")}function Ya(e){return e?Va(e):"inherit"}function eb(e){const t=[],n=new Set;for(const r of e??[]){const o=r?.family?.trim();if(!o)continue;const i=o.toLowerCase();if(n.has(i))continue;n.add(i);const a=r?.label?.trim();t.push(a?{family:o,label:a}:{family:o})}return t}function Id(e,t){const n=t?.trim().toLowerCase();if(n)return e.find(r=>r.family.trim().toLowerCase()===n)}function Pd(e){return e.label?`${e.label}(${e.family})`:e.family}function Tr(e){return e.toLowerCase().replace(/\s+/g,"")}function Rd(e,t){if(e===t)return 0;if(e.startsWith(t))return 1;if(e.includes(t))return 2;let n=0;for(const r of e)if(r===t[n]&&n++,n===t.length)return 3;return-1}function tb(e,t){const n=Rd(Tr(e.family),t);if(!e.label)return n;const r=Rd(Tr(e.label),t);return n<0?r:r<0?n:Math.min(n,r)}function nb(e,t){const n=Tr(t.trim());return n?e.map((r,o)=>({font:r,index:o,rank:tb(r,n)})).filter(r=>r.rank>=0).sort((r,o)=>r.rank-o.rank||r.index-o.index).map(r=>r.font):[...e]}function Y(e){return`${e}mm`}function Ka(e,t){const n=gn(e);return t&&t>0&&At(e)?{width:n.width,height:t}:n}function Dd(e,t){const n=ht(e);return t&&t>0&&At(e)?{width:n.width,height:t}:n}function $d(){return`
|
|
3
3
|
/* ── 全局重置 ── */
|
|
4
4
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ body { font-family: ${ja.join(", ")}; }
|
|
|
17
17
|
body { background: #fff; }
|
|
18
18
|
.print-page { margin: 0; box-shadow: none; }
|
|
19
19
|
}
|
|
20
|
-
`}function
|
|
20
|
+
`}function Nd(){return`
|
|
21
21
|
/* ── 水印层:覆盖整页、位于所有内容之下(显式矢量瓦片,禁止用 CSS 平铺背景:
|
|
22
22
|
Chromium 会把它编译成 PDF 平铺图案,出纸链路的 RIP 会忽略图案矩阵导致水印放大/错位) ── */
|
|
23
23
|
.watermark-layer {
|
|
@@ -35,7 +35,7 @@ body { font-family: ${ja.join(", ")}; }
|
|
|
35
35
|
position: absolute;
|
|
36
36
|
pointer-events: none;
|
|
37
37
|
}
|
|
38
|
-
`}function
|
|
38
|
+
`}function Ld(){return`
|
|
39
39
|
/* ── 元素通用定位 ── */
|
|
40
40
|
.print-element {
|
|
41
41
|
position: absolute;
|
|
@@ -71,28 +71,28 @@ body { font-family: ${ja.join(", ")}; }
|
|
|
71
71
|
height: auto;
|
|
72
72
|
overflow: visible;
|
|
73
73
|
}
|
|
74
|
-
`}function
|
|
74
|
+
`}function Fd(e,t){return`
|
|
75
75
|
/* ── 打印纸张:浏览器原生打印按此尺寸分页(Playwright page.pdf 以显式宽高为准,无副作用) ── */
|
|
76
|
-
@page { size: ${
|
|
77
|
-
`}function
|
|
76
|
+
@page${t?` ${t}`:""} { size: ${Y(e.width)} ${Y(e.height)}; margin: 0; }
|
|
77
|
+
`}function zd(e,t,n,r=""){const o=`
|
|
78
78
|
/* ── 出纸转子:设计稿整页旋转 ${n}° 填入出纸纸张 ── */
|
|
79
|
-
.print-page-rotor {
|
|
79
|
+
${r}.print-page-rotor {
|
|
80
80
|
position: absolute;
|
|
81
81
|
top: 0;
|
|
82
82
|
left: 0;
|
|
83
|
-
width: ${
|
|
84
|
-
height: ${
|
|
85
|
-
padding: ${
|
|
83
|
+
width: ${Y(e.width)};
|
|
84
|
+
height: ${Y(e.height)};
|
|
85
|
+
padding: ${Y(t.top)} ${Y(t.right)} ${Y(t.bottom)} ${Y(t.left)};
|
|
86
86
|
box-sizing: border-box;
|
|
87
87
|
transform-origin: 0 0;
|
|
88
|
-
}`;if(n===0)return
|
|
89
|
-
transform: ${
|
|
88
|
+
}`;if(n===0)return o.trim();const a={90:`translate(${Y(e.height)}, 0mm) rotate(90deg)`,180:`translate(${Y(e.width)}, ${Y(e.height)}) rotate(180deg)`,270:`translate(0mm, ${Y(e.width)}) rotate(270deg)`}[n];return[o.trim(),`${r}.print-page-rotor-${n} {
|
|
89
|
+
transform: ${a};
|
|
90
90
|
}`].join(`
|
|
91
|
-
`)}function
|
|
91
|
+
`)}function Bd(e,t,n,r){const{top:o,right:i,bottom:a,left:l}=e.margins,c=r?"0":`${Y(o)} ${Y(i)} ${Y(a)} ${Y(l)}`;return`
|
|
92
92
|
/* ── 纸张页面 ── */
|
|
93
93
|
${n} {
|
|
94
|
-
width: ${
|
|
95
|
-
min-height: ${
|
|
94
|
+
width: ${Y(t.width)};
|
|
95
|
+
min-height: ${Y(t.height)};
|
|
96
96
|
background: ${e.pageBackground??"#fff"};
|
|
97
97
|
padding: ${c};
|
|
98
98
|
position: relative;
|
|
@@ -102,11 +102,11 @@ ${n} {
|
|
|
102
102
|
.print-page:last-child {
|
|
103
103
|
page-break-after: auto;
|
|
104
104
|
}
|
|
105
|
-
`}function
|
|
105
|
+
`}function Hd(e,t,n){const{right:r,left:o}=e.margins,{bottom:i}=e.margins,a=e.header?.height??0,l=e.footer?.height??0,c=t.width-o-r;return`
|
|
106
106
|
/* ── 页眉 ── */
|
|
107
107
|
${n}.page-header {
|
|
108
|
-
width: ${
|
|
109
|
-
height: ${
|
|
108
|
+
width: ${Y(c)};
|
|
109
|
+
height: ${Y(a)};
|
|
110
110
|
position: relative;
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -115,33 +115,33 @@ ${n}.page-header {
|
|
|
115
115
|
与设计器 CanvasPaper 的三区几何一致。
|
|
116
116
|
绝对定位的包含块是 padding box 外缘(= 纸面),left 须显式补左边距。 */
|
|
117
117
|
${n}.page-footer {
|
|
118
|
-
width: ${
|
|
119
|
-
height: ${
|
|
118
|
+
width: ${Y(c)};
|
|
119
|
+
height: ${Y(l)};
|
|
120
120
|
position: absolute;
|
|
121
|
-
top: ${
|
|
122
|
-
left: ${
|
|
121
|
+
top: ${Y(t.height-i-l)};
|
|
122
|
+
left: ${Y(o)};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/* ── 内容区 ── */
|
|
126
126
|
${n}.content-area {
|
|
127
|
-
width: ${
|
|
127
|
+
width: ${Y(c)};
|
|
128
128
|
position: relative;
|
|
129
129
|
overflow: visible;
|
|
130
130
|
}
|
|
131
|
-
`}function
|
|
132
|
-
${Xa}`;const{bottom:n}=e.margins,r=e.footer?.height??0,o=
|
|
131
|
+
`}function rb(){return[$d(),Nd(),Ld()].join("").trim()}function ob(e,t,n){return Fd(Ka(e,t),n).trim()}function ib(e,t,n){const r=ba(e),o=r!==0,i=Ka(e,n),a=Dd(e,n),l=t?`${t}.print-page`:".print-page",c=t?`${t} `:"";return[Bd(e,i,l,o),Hd(e,a,c),...o?[zd(a,e.margins,r,c)]:[]].join("").trim()}function kr(e,t){const n=ba(e),r=n!==0,o=Ka(e,t),i=Dd(e,t);return[Fd(o),$d(),Bd(e,o,".print-page",r),Nd(),Hd(e,i,""),Ld(),...r?[zd(i,e.margins,n)]:[]].join("").trim()}const Xa=".print-copy:not(:last-child){break-after:page;page-break-after:always;}";function ab(e,t){if(!At(e))return`${kr(e)}
|
|
132
|
+
${Xa}`;const{bottom:n}=e.margins,r=e.footer?.height??0,o=ht(e).width,i=kr(e,t[0]?.heightMm),a=t.map((l,c)=>{const s=l.heightMm,d=[`@page copy${c} { size: ${Y(o)} ${s?Y(s):"auto"}; margin: 0; }`,`.print-copy-${c} { page: copy${c}; }`];return s&&(d.push(`.print-copy-${c} .print-page { min-height: ${Y(s)}; }`),d.push(`.print-copy-${c} .page-footer { top: ${Y(s-n-r)}; }`)),d.join(`
|
|
133
133
|
`)}).join(`
|
|
134
134
|
`);return`${i}
|
|
135
135
|
${a}
|
|
136
|
-
${Xa}`}function
|
|
136
|
+
${Xa}`}function sb(e){return`
|
|
137
137
|
/* ── 拼版纸张:@page 尺寸 = 目标纸。服务端/客户端链路以 paperMm 显式定尺寸、不看这里,
|
|
138
138
|
但浏览器链路只看 @page,故这条是硬需求 ── */
|
|
139
|
-
@page { size: ${
|
|
139
|
+
@page { size: ${Y(e.sheet.width)} ${Y(e.sheet.height)}; margin: 0; }
|
|
140
140
|
|
|
141
141
|
/* ── 一张目标纸 ── */
|
|
142
142
|
.print-sheet {
|
|
143
|
-
width: ${
|
|
144
|
-
height: ${
|
|
143
|
+
width: ${Y(e.sheet.width)};
|
|
144
|
+
height: ${Y(e.sheet.height)};
|
|
145
145
|
position: relative;
|
|
146
146
|
overflow: hidden;
|
|
147
147
|
break-after: page;
|
|
@@ -152,8 +152,8 @@ ${Xa}`}function rb(e){return`
|
|
|
152
152
|
/* ── 一格:绝对定位,位置由 tilePosition() 以行内 style 给出 ── */
|
|
153
153
|
.print-tile {
|
|
154
154
|
position: absolute;
|
|
155
|
-
width: ${
|
|
156
|
-
height: ${
|
|
155
|
+
width: ${Y(e.tile.width)};
|
|
156
|
+
height: ${Y(e.tile.height)};
|
|
157
157
|
overflow: hidden;
|
|
158
158
|
}
|
|
159
159
|
/* 防御性声明:绝对定位 + overflow:hidden 容器内的后代不产生分页点,当前布局下无实际作用;
|
|
@@ -166,11 +166,11 @@ ${Xa}`}function rb(e){return`
|
|
|
166
166
|
否则设计器预览错位 3.17mm、与出纸不一致 */
|
|
167
167
|
.print-tile > .print-page { margin: 0; box-shadow: none; }
|
|
168
168
|
}
|
|
169
|
-
`}function
|
|
169
|
+
`}function Po(e,t,n,r,o,i){const a=["position:absolute",`left:${Y(e)}`,`top:${Y(t)}`,`width:${Y(n)}`];r!==void 0&&r>0&&a.push(`height:${Y(r)}`),o!==void 0&&a.push(`z-index:${o}`);const l=vo(i);return l&&a.push(l),a.join(";")+";"}const Ud=25.4/96,le={color:"#cccccc",opacity:.15,rotate:-30,tileWidth:260,tileHeight:180,minTileWidth:140,minTileHeight:100,fontSize:16},lb={dense:{width:200,height:120,label:"密"},medium:{width:260,height:180,label:"中(默认)"},loose:{width:340,height:260,label:"疏"}};function qd(e,t,n){const r=typeof e=="number"&&Number.isFinite(e)?e:t;return Math.max(n,Math.round(r))}function cb(e){return{width:qd(e?.tileWidth,le.tileWidth,le.minTileWidth),height:qd(e?.tileHeight,le.tileHeight,le.minTileHeight)}}function db(e){return e?!e.mode||e.mode==="fixed"?!!e.content&&e.content.trim().length>0:!!e.binding&&e.binding.trim().length>0:!1}function ub(e,t,n){if(!e)return"";let r="";if(!e.mode||e.mode==="fixed")r=e.content??"";else if(typeof e.binding=="string"&&e.binding.trim()){const o=e.binding.trim(),i=Array.isArray(t)?t[0]??{}:t??{},a={...Io(),...n,...i};let l;if(o.includes("{"))l=Qt(o,a);else{try{l=j0(o,a)}catch{l=void 0}(l==null||typeof l=="object")&&(l=Er(i,o))}l!=null&&typeof l!="object"&&String(l)!==o?r=String(l):r=(typeof e.testData=="string"?e.testData.trim():"")?e.testData:`[${e.binding}]`}return e.timestamp&&r&&(r=`${r} ${pb(e.format)}`),r}function Cr(e){return String(e).padStart(2,"0")}function pb(e){const t=e&&e.trim()?e:"YYYY-MM-DD HH:mm",n=new Date,r={YYYY:String(n.getFullYear()),MM:Cr(n.getMonth()+1),DD:Cr(n.getDate()),HH:Cr(n.getHours()),mm:Cr(n.getMinutes()),ss:Cr(n.getSeconds())};return t.replace(/YYYY|MM|DD|HH|mm|ss/g,o=>r[o]??o)}function Ro(e){return Math.round(e*1e4)/1e4}function fb(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Wd(e,t,n,r){if(!db(e))return null;const o=ub(e,t,r);if(!o)return null;const i=cb(e),a=Ro(i.width*Ud),l=Ro(i.height*Ud),c={width:Math.max(0,Number.isFinite(n?.width)?n.width:0),height:Math.max(0,Number.isFinite(n?.height)?n.height:0)},s=Math.max(1,Math.ceil(c.width/a)),d=Math.max(1,Math.ceil(c.height/l)),p=[];for(let u=0;u<d;u++)for(let f=0;f<s;f++)p.push({leftMm:Ro(f*a),topMm:Ro(u*l),widthMm:a,heightMm:l});return{text:o,color:e?.color||le.color,rotate:e?.rotate??le.rotate,opacity:e?.opacity??le.opacity,fontSizePx:le.fontSize,tileWidthPx:i.width,tileHeightPx:i.height,tileWidthMm:a,tileHeightMm:l,columns:s,rows:d,tiles:p}}function hb(e,t){const n=e.tileWidthPx,r=e.tileHeightPx,o=n/2,i=r/2;return`<svg class="watermark-tile" style="${`left:${t.leftMm}mm;top:${t.topMm}mm;width:${t.widthMm}mm;height:${t.heightMm}mm`}" viewBox="0 0 ${n} ${r}" xmlns="http://www.w3.org/2000/svg"><text x="${o}" y="${i}" font-size="${e.fontSizePx}" fill="${e.color}" text-anchor="middle" dominant-baseline="middle" transform="rotate(${e.rotate},${o},${i})">${fb(e.text)}</text></svg>`}function jd(e,t,n,r){const o=Wd(e,t,n,r);if(!o)return"";const i=o.tiles.map(a=>hb(o,a)).join(`
|
|
170
170
|
`);return`
|
|
171
171
|
<div class="watermark-layer" style="opacity:${o.opacity}">
|
|
172
172
|
${i}
|
|
173
|
-
</div>`}const
|
|
173
|
+
</div>`}const Gd=(e,t)=>`${e}:${t}`;function gb(e,t,n){if(n-t<2)return;const r=new Set;for(let i=t;i<n;i++){const a=e[i];a?.type==="data"&&a.cells.forEach((l,c)=>{l?.mergeSameValue===!0&&r.add(c)})}if(r.size===0)return;const o={rowspan:new Map,merged:new Set};for(const i of r){let a=!1;for(let c=t;c<n&&!a;c++)e[c]?.cells[i]?.rawFormatter&&(a=!0);if(a)continue;let l=t;for(;l<n;){if(!mb(e[l],i)){l++;continue}const c=e[l].cells[i].content;let s=l;for(;s+1<n&&bb(e[s+1],i,c);)s++;if(s>l){o.rowspan.set(Gd(l,i),s-l+1);for(let d=l+1;d<=s;d++)o.merged.add(Gd(d,i))}l=s+1}}return o.rowspan.size>0?o:void 0}function mb(e,t){if(!e||e.type!=="data")return!1;const n=e.cells[t];return!n||n.merged||n.mergeSameValue!==!0?!1:(n.content??"").trim()!==""}function bb(e,t,n){if(!e||e.type!=="data")return!1;const r=e.cells[t];return!r||r.merged||r.mergeSameValue!==!0?!1:r.content===n}class qn extends Error{constructor(t,n,r){super(n),this.name="PrintFailure",this.code=t,this.cause=r}}function yb(e,t,n){if(e instanceof qn)return e;const r=e instanceof Error?e.message:String(e);return new qn(t,`${n}:${r}`,e)}async function Ar(e,t,n,r){let o;try{return await Promise.race([e,new Promise((i,a)=>{o=setTimeout(()=>a(new qn(n,r)),t)})])}finally{o&&clearTimeout(o)}}function Vd(e){try{return JSON.stringify(e)}catch{return`__unserializable__:${Object.keys(e).sort().join(",")}`}}function Yd(e){return e.key??Vd(e)}function vb(e){const t=new Map;return{renderer:{render(n){const r=Yd(n),o=e?.get(r);if(o)return o;throw t.set(r,{...n,key:r}),new Error("collect")}},takeSpecs(){const n=[...t.values()];return t.clear(),n}}}function wb(e){return{render(t){const n=e.get(Yd(t));if(!n)throw new Error("扩展元素未渲染");return n}}}function Kd(...e){const t=new Map;for(const n of e)for(const[r,o]of n)t.set(r,o);return t}function Xd(e,t){const n={};for(const r of t)n[r]=e;return n}function xb(){return gc().filter(({plugin:e,kind:t})=>{const n=t.render??e.render;return!!(n?.createRenderer||n?.executorBundle)}).map(({kind:e})=>e.type)}function Eb(e){const t=new Map,n=new Map;for(const r of e){const o=r.type??"";if(!o)continue;let i=n.get(o);if(!i){if(i=$n(o)?.render?.createRenderer?.(),!i)continue;n.set(o,i)}try{t.set(r.key,i.render(r))}catch{}}return t}async function Sb(e,t){if(e.length===0)return new Map;const n=Eb(e),r=e.filter(l=>!n.has(l.key));if(r.length===0||!t?.renderAssets)return n;const o=await t.renderAssets(r),i=Kd(n,o),a=r.find(l=>!i.has(l.key)&&_b(String(l.type??"")));if(a)throw new qn("UNSUPPORTED_RUNTIME",`缺少扩展元素执行器产物(${String(a.type)}):请确认宿主已装配 collectExecutorBundles() 收集的插件执行器`);return i}function _b(e){return!!$n(e)?.render?.executorBundle}function Mb(e){return Object.entries(Kg()).filter(([,n])=>n===e).map(([n])=>n).sort()[0]??e}function Za(e){return{...e.data??{},pageIndex:e.pageIndex,totalPages:e.totalPages}}function Tb(e){return Array.isArray(e)?e[0]??{}:e??{}}function Do(e,t,n,r){const o=Mr(e.fonts)+kr(e,r?.pageHeightMm),i=r?.isMeasurementPass===!0,a=i?1:r?.totalPageCount??t.length,l={codeRenderer:r?.codeRenderer,renderers:r?.renderers,pageHeightMm:r?.pageHeightMm};return i?kb(e,o,l,n):Cb(e,t,o,a,l,n)}function kb(e,t,n,r){const i=rs(e).width-e.margins.left-e.margins.right,a=e.elements.map(s=>Lo(s,!0,void 0,void 0,n)).join(`
|
|
174
174
|
`),l=ts(e.header?.elements??[],i,0,0,n);let c=`<!DOCTYPE html>
|
|
175
175
|
<html lang="zh-CN">
|
|
176
176
|
<head>
|
|
@@ -179,15 +179,15 @@ ${i}
|
|
|
179
179
|
</head>
|
|
180
180
|
<body class="measure-mode">
|
|
181
181
|
<section class="print-page" data-measure-page="0">
|
|
182
|
-
${
|
|
182
|
+
${jd(e.watermark,r,rs(e))}
|
|
183
183
|
<div class="page-header">${l}</div>
|
|
184
184
|
<div class="content-area" style="height:auto;overflow:visible;">
|
|
185
185
|
${a}
|
|
186
186
|
</div>
|
|
187
187
|
</section>
|
|
188
188
|
</body>
|
|
189
|
-
</html>`;return c=Wa(c),c}function
|
|
190
|
-
`);return Wa(l)}function
|
|
189
|
+
</html>`;return c=Wa(c),c}function $o(e,t,n,r,o){const i=o?.pageOffset??0,a=o?.totalPages??t.length,l=t.map(c=>{const s=c.pageIndex+1+i;return Ab(e,c,s,a,r,n,o?.pageClass)}).join(`
|
|
190
|
+
`);return Wa(l)}function No(e,t,n){const r=`<!DOCTYPE html>
|
|
191
191
|
<html lang="zh-CN">
|
|
192
192
|
<head>
|
|
193
193
|
<meta charset="UTF-8">
|
|
@@ -196,80 +196,80 @@ ${i}
|
|
|
196
196
|
<body${n?` class="${n}"`:""}>
|
|
197
197
|
${t}
|
|
198
198
|
</body>
|
|
199
|
-
</html>`;return Wa(r)}function
|
|
199
|
+
</html>`;return Wa(r)}function Cb(e,t,n,r,o,i){const a=$o(e,t,i??{},o,{totalPages:r});return No(n,a,At(e)?"continuous":void 0)}function Ab(e,t,n,r,o,i,a){const l=rs(e),c={width:l.width,height:o.pageHeightMm&&o.pageHeightMm>0?o.pageHeightMm:l.height},s=l.width-e.margins.left-e.margins.right,d={pageIndex:n,totalPages:r,data:Tb(i)},p=Ob(e,d),u={...o,pageVars:d},f=ts(p.header?.elements??[],s,n,r,u),g=ts(p.footer?.elements??[],s,n,r,u);let m=t.sections.map(E=>Pb(E,p,u)).join(`
|
|
200
200
|
`);m=m.replace(/\{pageIndex\}/g,String(n)),m=m.replace(/\{totalPages\}/g,String(r));const b=`
|
|
201
|
-
${
|
|
201
|
+
${jd(e.watermark,i,c,{pageIndex:n,totalPages:r})}
|
|
202
202
|
<div class="page-header">${f}</div>
|
|
203
203
|
<div class="content-area">
|
|
204
204
|
${m}
|
|
205
205
|
</div>
|
|
206
|
-
<div class="page-footer">${g}</div>`,v=
|
|
206
|
+
<div class="page-footer">${g}</div>`,v=ba(e),w=v!==0?`<div class="print-page-rotor print-page-rotor-${v}">${b}</div>`:b;return`<section class="print-page${a?` ${a}`:""}" data-page="${n}">
|
|
207
207
|
${w}
|
|
208
|
-
</section>`}function
|
|
209
|
-
<img src="${
|
|
208
|
+
</section>`}function Ob(e,t){if(!Ib(e))return e;const n=Za(t),r=i=>{const a=i.options?.rawFormatter;return typeof a!="string"?i:{...i,options:{...i.options,formatter:Qt(a,n)}}},o=i=>i&&{...i,elements:(i.elements??[]).map(r)};return{...e,elements:e.elements.map(r),header:o(e.header),footer:o(e.footer)}}function Ib(e){return[e.elements,e.header?.elements,e.footer?.elements].some(n=>(n??[]).some(r=>typeof r.options?.rawFormatter=="string"))}function Ja(e,t){const n=e.rawFormatter;return typeof n=="string"&&n!==""&&t?.pageVars?Qt(n,Za(t.pageVars)):e.content}function Pb(e,t,n){const r=ns(t,e.elementId);return r?e.type==="table-slice"?Ub(r,e,n):e.type==="flow-list-slice"?Lb(r,e):e.type==="flow-group"?qb(r,e,t,n):Lo(r,!1,void 0,e.renderTop,n):`<!-- element not found: ${e.elementId} -->`}const Zd={top:"flex-start",middle:"center",bottom:"flex-end"},Rb={left:"flex-start",center:"center",right:"flex-end"};function Or(e,t){const n=[],r=e._fitFontSize===void 0?e.fontSize:sa(e._fitFontSize);return r&&n.push(`font-size:${r}pt`),e.fontFamily&&n.push(`font-family:${Ga(Va(e.fontFamily))}`),e.fontWeight&&n.push(`font-weight:${e.fontWeight}`),e.color&&n.push(`color:${e.color}`),e.backgroundColor&&n.push(`background-color:${e.backgroundColor}`),e.lineHeight?n.push(`line-height:${e.lineHeight}pt`):t&&n.push(`line-height:${t}`),e.letterSpacing&&n.push(`letter-spacing:${e.letterSpacing}pt`),e.verticalAlign&&(e.textAlign==="justify"?n.push(`display:flex;flex-direction:column;justify-content:${Zd[e.verticalAlign]??"flex-start"}`):(n.push(`display:flex;align-items:${Zd[e.verticalAlign]??"flex-start"}`),n.push(`justify-content:${Rb[e.textAlign??"left"]??"flex-start"}`))),e.textAlign&&n.push(`text-align:${e.textAlign}`),e.textAlign==="justify"&&n.push("text-align-last:justify"),n.length?n.join(";")+";":""}function Db(e){return e.longTextIndent?`text-indent:${e.longTextIndent}em;`:""}function Jd(e){const t=yc(e);return t?`white-space:${t};`:""}function Qd(e,t,n){return Object.entries(ga(e,t,n)).map(([r,o])=>`${r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)}:${Ga(o)};`).join("")}function eu(e,t){const n=vc(t)?"white-space:nowrap;text-overflow:ellipsis;":"";return e==="autoHeight"?`overflow:visible;${n}`:n}function $b(e,t,n,r){if(e!=="shrink")return"";const o=dr(r.shrinkMinFontSize);return` data-fit="shrink" data-fit-key="${wt(t)}" data-fit-base="${n}" data-fit-min="${o}"`}function Lo(e,t,n,r,o){const i=e.options??{},a=i.left??0,l=r??i.top??0,c=i.width??100,s=i.height??void 0,d=e.type||e.printElementType?.type||"text",p=po(d,i),u=d==="flowList"&&pn(i.flowLayoutMode)==="dynamic",f=p==="autoHeight"||u?void 0:s,g=n??Po(a,l,c,f,i.zIndex,i),m=bo(d,i);let b=g;if(m?.all&&(b+=`border:${m.all.borderWidth} ${m.all.borderStyle} ${m.all.borderColor};`),m)for(const E of hr){const k=m.edges[E];k&&(b+=`border-${E}:${k.borderWidth} ${k.borderStyle} ${k.borderColor};`)}if(!t&&n===void 0){const E=ma(d,i);E!==void 0&&(b+=`rotate:${E}deg;`)}const v=t?` data-measure-id="${e.id}"`:` data-element-id="${e.id}"`,w=$b(p,e.id,i.fontSize??12,i);switch(d){case"table":return Hb(e,t,t?v:"",o,r);case"image":return`<div class="print-element" style="${b}"${v}>
|
|
209
|
+
<img src="${wt(i.src??"")}" style="width:100%;height:100%;object-fit:${i.fit||"contain"};${Qd(i.fit,i.fitScale,i.objectPosition)}" />
|
|
210
210
|
</div>`;case"barcode":case"qrcode":{const E=String(i.formatter??i.testData??"").trim();return`<div class="print-element" style="${b}"${v}>
|
|
211
|
-
${
|
|
212
|
-
</div>`}case"hline":return`<div class="print-element" style="${b};border-top:${i.borderWidth||.75}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};height:0;"${v}></div>`;case"vline":return`<div class="print-element" style="${b};border-left:${i.borderWidth||.75}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};width:0;"${v}></div>`;case"rect":return`<div class="print-element" style="${b};border:${i.borderWidth||1}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};"${v}></div>`;case"oval":return`<div class="print-element" style="${b};border:${i.borderWidth||1}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};border-radius:50%;"${v}></div>`;case"longText":return`<div class="print-element" style="${b}${
|
|
213
|
-
${Qa($,E,
|
|
214
|
-
</div>`}const I=
|
|
215
|
-
`);return`<div class="print-element" style="${b}${
|
|
211
|
+
${nu(E,d,i,{fallback:`<span>${wt(E)}</span>`,codeRenderer:o?.codeRenderer,fit:i.fit,maxWidth:i.maxWidth,maxHeight:i.maxHeight,printerDpi:i.printerDpi,targetWidthMm:i.width,targetHeightMm:i.height})}
|
|
212
|
+
</div>`}case"hline":return`<div class="print-element" style="${b};border-top:${i.borderWidth||.75}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};height:0;"${v}></div>`;case"vline":return`<div class="print-element" style="${b};border-left:${i.borderWidth||.75}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};width:0;"${v}></div>`;case"rect":return`<div class="print-element" style="${b};border:${i.borderWidth||1}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};"${v}></div>`;case"oval":return`<div class="print-element" style="${b};border:${i.borderWidth||1}pt ${i.borderStyle||"solid"} ${i.borderColor||"#333"};border-radius:50%;"${v}></div>`;case"longText":return`<div class="print-element" style="${b}${Or(i,"1.5")}${Db(i)}${Jd(i)}${eu(p,i)}"${v}${w}>${wt(i.formatter??i.testData??"")}</div>`;case"flowList":{const E=pt(i.flowColumns),k=vt(i.flowGapX),L=Xt(i.flowRowHeight),R=fn(i.flowMaxSpan,E),P=Array.isArray(i._flowItems)?i._flowItems:void 0,O=P&&P.length>0?P:String(i.testData??"").split(/\r?\n/).map(S=>S.trim()).filter(Boolean),C={width:c,columns:E,gapX:k,rowHeight:L,maxSpan:R,fontSizePt:i.fontSize??12,autoSpan:i.flowAutoSpan===!0};if(u){const S=Nn(i),$=Array.isArray(i._flowRows)?i._flowRows:da(O,{...C,width:Ec(c,S)});return`<div class="print-element" style="${b}${Or(i)}display:block;box-sizing:border-box;height:auto;overflow:visible;padding:${It(S.top)} ${It(S.right)} ${It(S.bottom)} ${It(S.left)};"${v}${w}>
|
|
213
|
+
${Qa($,E,k,L)}
|
|
214
|
+
</div>`}const I=da(O,C).flatMap(S=>S.cells).map(S=>`<div class="print-flow-cell"${S.span>1?` style="grid-column:span ${S.span};"`:""}>${wt(S.text)}</div>`).join(`
|
|
215
|
+
`);return`<div class="print-element" style="${b}${Or(i)}overflow:hidden;${um(C)};"${v}${w}>
|
|
216
216
|
${I}
|
|
217
|
-
</div>`}case"html":return`<div class="print-element" style="${b}"${v}>${i.testData??i.title??""}</div>`;default:{const E
|
|
218
|
-
`);return`<div class="print-flow-row" data-flow-row-index="${o+a}" style="${
|
|
217
|
+
</div>`}case"html":return`<div class="print-element" style="${b}"${v}>${i.testData??i.title??""}</div>`;default:{const E=$n(d);if(E?.render){const k={type:d,...i,widthMm:c,heightMm:f??s??0,fontFamily:i.fontFamily,key:Vd({type:d,...i})},L=o?.renderers?.[d];try{const R=L?L.render(k):E.render.html?.(k);if(typeof R=="string"&&R.length>0)return`<div class="print-element" style="${b}"${v}>${R}</div>`}catch{}}return`<div class="print-element" style="${b}${Or(i)}${Jd(i)}${eu(p,i)}"${v}${w}>${wt(i.formatter??i.testData??"")}</div>`}}}function It(e){return`${Math.round(e*1e3)/1e3}mm`}function Nb(e,t,n){return["display:grid",`grid-template-columns:repeat(${e},minmax(0,1fr))`,`column-gap:${It(t)}`,`min-height:${It(n)}`].join(";")}function Qa(e,t,n,r,o=0){return e.map((i,a)=>{const l=i.cells.map(c=>`<div class="print-flow-cell"${c.span>1?` style="grid-column:span ${c.span};"`:""}>${wt(c.text)}</div>`).join(`
|
|
218
|
+
`);return`<div class="print-flow-row" data-flow-row-index="${o+a}" style="${Nb(t,n,r)};">
|
|
219
219
|
${l}
|
|
220
220
|
</div>`}).join(`
|
|
221
|
-
`)}function
|
|
221
|
+
`)}function tu(e,t){let n="";const r=bo(e,t);if(r?.all&&(n+=`border:${r.all.borderWidth} ${r.all.borderStyle} ${r.all.borderColor};`),r)for(const i of hr){const a=r.edges[i];a&&(n+=`border-${i}:${a.borderWidth} ${a.borderStyle} ${a.borderColor};`)}const o=Nn(t);return n+=`${Or(t)}display:block;box-sizing:border-box;height:auto;overflow:visible;padding:${It(o.top)} ${It(o.right)} ${It(o.bottom)} ${It(o.left)};`,n}function Lb(e,t,n){const r=e.options??{},o=Array.isArray(r._flowRows)?r._flowRows:[],i=t.startFlowRow??0,a=t.endFlowRow??o.length;if(i>=a)return"";const l=e.type||e.printElementType?.type||"flowList",c=Po(r.left??0,t.renderTop??r.top??0,r.width??100,void 0,r.zIndex,r),s=pt(r.flowColumns),d=vt(r.flowGapX),p=Xt(r.flowRowHeight);return`<div class="print-flowlist-slice" style="${c}${tu(l,r)}">
|
|
222
222
|
${Qa(o.slice(i,a),s,d,p,i)}
|
|
223
|
-
</div>`}function
|
|
224
|
-
`)}function
|
|
223
|
+
</div>`}function nu(e,t,n,r){if(!e||!r.codeRenderer)return r.fallback;const{fallback:o,codeRenderer:i,fit:a,maxWidth:l,maxHeight:c}=r,s=t==="barcode";try{const d=i.render(e,t,{barcodeType:n.barcodeType,qrCodeLevel:n.qrCodeLevel!=null?String(n.qrCodeLevel):void 0,qrQuietZone:typeof n.qrQuietZone=="number"?n.qrQuietZone:void 0,barQuietZone:typeof n.barQuietZone=="number"?n.barQuietZone:void 0,barHeightMm:typeof n.barHeight=="number"?n.barHeight:void 0,showText:n.hideTitle!==void 0?!n.hideTitle:n.showBarcodeText,barWidth:typeof n.barWidth=="number"?n.barWidth:void 0,fontSize:typeof(n.barFontSize??n.fontSize)=="number"?n.barFontSize??n.fontSize:void 0,printerDpi:s?r.printerDpi:void 0,targetWidthMm:s?Ln(r.targetWidthMm,l):void 0,targetHeightMm:s?Ln(r.targetHeightMm,c):void 0});if(s&&/^<svg[\s>]/i.test(d))return Fb(d);const p=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,u=[];u.push("width:100%","height:100%","max-width:100%","max-height:100%","display:block","margin:auto"),u.push(`object-fit:${a||"contain"}`),l&&u.push(`max-width:${l}mm`),c&&u.push(`max-height:${c}mm`);const f=u.join(";");return`<img src="${p}" style="${f}" />`}catch{return o}}function Fb(e){return`<div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;">${e.replace(/<svg\b/,'<svg style="display:block"')}</div>`}function zb(e,t){const n=[],r=e.fittedFontSize??e.fontSize??t.tableDefaultFontSize,o=e.color??t.tableDefaultColor,i=e.padding??t.tableDefaultPadding??1,a=e.fontFamily??t.tableDefaultFontFamily;r&&n.push(`font-size:${r}pt`),a&&n.push(`font-family:${Ga(Va(a))}`),e.fontWeight&&n.push(`font-weight:${e.fontWeight}`),o&&n.push(`color:${o}`),e.backgroundColor&&n.push(`background-color:${e.backgroundColor}`),n.push(`text-align:${e.align??"left"}`),e.align==="justify"&&n.push("text-align-last:justify"),n.push(`vertical-align:${e.valign??"middle"}`),n.push(`padding:${i}mm`),n.push(e.wordWrap===!1?"white-space:nowrap;overflow:hidden":"white-space:pre-wrap;word-break:normal;overflow-wrap:break-word");const l=e.borders??{},c=t.tableDefaultBorders??{};for(const s of["top","right","bottom","left"]){const d=l[s]??c[s];n.push(d?`border-${s}:${d.width}pt ${d.style} ${d.color}`:`border-${s}:none`)}return n.join(";")}function yn(e,t,n,r,o,i,a={elementId:"",kind:"b"},l){const c=[],s=r.tableDefaultPadding??1,d=gb(e,t,n);for(let p=t;p<n;p++){const u=e[p];if(!u)continue;const f=o?` data-row-index="${p}"`:"",g=u.cells.map((m,b)=>({cell:m,ci:b})).filter(({cell:m,ci:b})=>!m.merged&&!d?.merged.has(`${p}:${b}`)).map(({cell:m,ci:b})=>{const v=d?.rowspan.get(`${p}:${b}`),w=v??(l===void 0?m.rowspan??1:Math.max(1,Math.min(m.rowspan??1,l-p))),E=v===void 0?m:{...m,rowspan:v},k=`${w>1?` rowspan="${w}"`:""}${m.colspan>1?` colspan="${m.colspan}"`:""}`,L=b;let R;if(m.cellType==="barcode"||m.cellType==="qrcode"){const P=Ja(m,i);R=`<div style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;">${nu(P,m.cellType,m,{fallback:wt(P),codeRenderer:i?.codeRenderer,fit:m.fit,maxWidth:m.maxWidth,maxHeight:m.maxHeight,printerDpi:m.printerDpi,targetWidthMm:la(r.tableColWidths??[],b,m,s),targetHeightMm:ur(e,p,E,s)})}</div>`}else if(m.cellType==="image"){const P=m.fit||"contain",O=m.maxWidth?`max-width:${m.maxWidth}mm;`:"max-width:100%;",C=m.maxHeight?`max-height:${m.maxHeight}mm;`:"max-height:100%;",I=wc(P,ur(e,p,E,s)),S=I===void 0?"height:100%":`height:${I}mm`,$=I===void 0?"":"width:100%;height:100%;";R=`<div style="width:100%;${S};display:flex;align-items:center;justify-content:center;overflow:hidden;"><img src="${wt(Ja(m,i))}" style="${$}object-fit:${P};${Qd(P,m.fitScale,m.objectPosition)}${O}${C}display:block;" /></div>`}else R=Bb(e,p,L,E,r,a,s,i);return`<td${k} style="${zb(m,r)}">${R}</td>`}).join("");c.push(`<tr${f} style="height:${u.height}mm;">${g}</tr>`)}return c.join(`
|
|
224
|
+
`)}function Bb(e,t,n,r,o,i,a,l){const c=aa(r),s=wt(Ja(r,l));if(c==="autoHeight")return s;const d=ur(e,t,r,a),p=r.wordWrap===!1,u=[`max-height:${d}mm`,"overflow:hidden",...p?["white-space:nowrap","text-overflow:ellipsis"]:[]].join(";"),f=c==="shrink"&&i.elementId?` data-fit="shrink" data-fit-key="${wt(em(i.elementId,i.kind,t,n))}" data-fit-base="${r.fontSize??o.tableDefaultFontSize??12}" data-fit-min="${dr(r.shrinkMinFontSize)}" data-fit-mm="${d}"`:"";return`<div class="cell-fit" style="${u}"${f}>${s}</div>`}function es(e,t){const r=e.options.tableColWidths??[],o=r.map(a=>`<col style="width:${a}mm;">`).join(""),i=r.reduce((a,l)=>a+l,0);return`<table class="print-table" data-element-id="${e.id}" style="border-collapse:collapse;table-layout:fixed;width:${i}mm;">
|
|
225
225
|
<colgroup>${o}</colgroup>
|
|
226
226
|
<tbody>${t}</tbody>
|
|
227
|
-
</table>`}function
|
|
227
|
+
</table>`}function Hb(e,t,n,r,o){const i=e.options,a=Po(i.left??0,o??i.top??0,i.width??100,void 0,i.zIndex,i),l=i._renderRows??[],c=yn(l,0,l.length,i,t,r,{elementId:e.id,kind:"b"});return`<div class="print-element" style="${a};overflow:visible;"${n}>
|
|
228
228
|
${es(e,c)}
|
|
229
|
-
</div>`}function
|
|
229
|
+
</div>`}function Ub(e,t,n){const r=e.options,o=Po(r.left??0,t.renderTop??r.top??0,r.width??100,void 0,r.zIndex,r),i=r._renderRows??[],a=t.startRow??0,l=t.endRow??i.length,c=r._repeatHeaderCount??0,s=t.repeatHeader&&c>0?yn(i,0,c,r,!1,n,{elementId:e.id,kind:"b"},c):"",d=yn(i,a,l,r,!1,n,{elementId:e.id,kind:"b"}),p=t.subtotal?ru(e,t,r,n):"",u=t.summary?ou(e,r,n):"";return`<div class="print-element" style="${o};overflow:visible;">
|
|
230
230
|
${es(e,`${s}
|
|
231
231
|
${d}${p}${u}`)}
|
|
232
|
-
</div>`}function
|
|
232
|
+
</div>`}function ru(e,t,n,r){const o=n._subtotalTemplates??[];if(o.length===0)return"";const i=n._dataRowCtx??[],a=n._dataStartIdx??0,l=n._mainData??{},c=n._renderRows?.length??0,s=t.startRow??0,d=t.endRow??c,p=Math.max(s,a),u=Math.max(d,p),f=u>a?i.slice(Math.max(p-a,0),u-a):[],g=r?.pageVars?Za(r.pageVars):{},m=o.map(b=>({...b,cells:b.cells.map(v=>v.rawFormatter?{...v,content:Qt(v.rawFormatter,{rows:f,...l,...g}),rawFormatter:""}:v)}));return yn(m,0,m.length,n,!1,r,{elementId:e.id,kind:"st"})}function ou(e,t,n){const r=t._summaryRows??[];return r.length===0?"":yn(r,0,r.length,t,!1,n,{elementId:e.id,kind:"sm"})}function qb(e,t,n,r){const o=e.options??{},a=(e.type||e.printElementType?.type||"text")==="flowList"&&pn(o.flowLayoutMode)==="dynamic",l=o.left??0,c=o.width??100,s=t.groupTop??o.top??0,d=yr(e)+ft(o).bottom,p=vo(o),u=p?`${p};`:"",f=typeof o.zIndex=="number"?`z-index:${o.zIndex};`:"",g=`position:absolute;left:${Y(l)};top:${Y(s)};width:${Y(c)};overflow:visible;${f}`;let m="";if(a)m=Wb(e,t);else{const k=t.startRow??0,L=t.endRow??0;if(L>k||t.subtotal||t.summary){const R=o._renderRows??[],P=o._repeatHeaderCount??0,O=t.repeatHeader&&P>0?yn(R,0,P,o,!1,r,{elementId:e.id,kind:"b"},P):"",C=yn(R,k,L,o,!1,r,{elementId:e.id,kind:"b"}),I=t.subtotal?ru(e,t,o,r):"",S=t.summary?ou(e,o,r):"";m=`<div class="flow-slice" style="position:relative;width:${Y(c)};overflow:visible;${u}">
|
|
233
233
|
${es(e,`${O}
|
|
234
|
-
${
|
|
235
|
-
</div>`}}const b=t.followElementIds??[],v=b.reduce((
|
|
236
|
-
`),E=b.length>0?`<div class="flow-follow" style="position:relative;width:${
|
|
234
|
+
${C}${I}${S}`)}
|
|
235
|
+
</div>`}}const b=t.followElementIds??[],v=b.reduce((k,L)=>{const R=ns(n,L);return R?Math.max(k,We({width:0,...R.options}).margin.bottom):k},d),w=b.map(k=>{const L=ns(n,k);if(!L)return"";const R=L.options?.top??0,P=L.options?.left??0,O=L.options?.width??c,C=L.options?.height??0,I=L.options?.zIndex,S=L.type||L.printElementType?.type||"text",$=S==="rect"||S==="oval"||S==="image"||S==="vline",N=vo(L.options),z=["position:absolute",`left:${Y(P-l)}`,`top:${Y(R-d)}`,`width:${Y(O)}`,...$&&C>0?[`height:${Y(C)}`]:[],...typeof I=="number"?[`z-index:${I}`]:[],"overflow:visible",...N?[N]:[]].join(";")+";";return Lo(L,!1,z,void 0,r)}).join(`
|
|
236
|
+
`),E=b.length>0?`<div class="flow-follow" style="position:relative;width:${Y(c)};height:${Y(Math.max(v-d,0))};overflow:visible;">
|
|
237
237
|
${w}
|
|
238
238
|
</div>`:"";return`<div class="flow-group" style="${g}">
|
|
239
239
|
${m}
|
|
240
240
|
${E}
|
|
241
|
-
</div>`}function
|
|
242
|
-
<div class="print-flowlist-slice" style="position:relative;width:${
|
|
241
|
+
</div>`}function Wb(e,t){const n=e.options??{},r=Array.isArray(n._flowRows)?n._flowRows:[],o=t.startFlowRow??0,i=t.endFlowRow??0;if(o>=i)return"";const a=e.type||e.printElementType?.type||"flowList",l=pt(n.flowColumns),c=vt(n.flowGapX),s=Xt(n.flowRowHeight),d=vo(n),p=d?`${d};`:"";return`<div class="flow-slice" style="position:relative;width:${Y(n.width??100)};overflow:visible;${p}">
|
|
242
|
+
<div class="print-flowlist-slice" style="position:relative;width:${Y(n.width??100)};${tu(a,n)}">
|
|
243
243
|
${Qa(r.slice(o,i),l,c,s,o)}
|
|
244
244
|
</div>
|
|
245
|
-
</div>`}function ts(e,t,n,r,o){return e.map(i=>{let a=
|
|
246
|
-
`)}function
|
|
245
|
+
</div>`}function ts(e,t,n,r,o){return e.map(i=>{let a=jb(i,o);return n!==void 0&&(a=a.replace(/\{pageIndex\}/g,String(n))),r!==void 0&&(a=a.replace(/\{totalPages\}/g,String(r))),a}).join(`
|
|
246
|
+
`)}function jb(e,t){return Lo(e,!1,void 0,void 0,t)}function ns(e,t){return e.elements.find(n=>n.id===t)}function rs(e){return ht(e)}function wt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const Gb=25.4;function Vb(e,t){const n=e.margins?.bottom??0,r=e.footer?.height??0,o=Math.max(t,0)+r+n;return Math.max(Gb,Math.round(o*100)/100)}const iu=3.7795275591;function os(e){return e/iu}function Fo(e){return Math.round(e*iu)}function zo(e){return typeof e=="number"&&e>0?e:void 0}function Yb(e){return zo(e.paperHeightMm)??zo(e.override?.height)}function Kb(e){const t=zo(e.override?.width)??e.paperMm.width,n=zo(e.override?.height);return e.continuous?n?{paperMm:{width:t,height:n},heightSource:"config"}:{paperMm:{width:t,height:e.paperMm.height},heightSource:"derived"}:{paperMm:{width:t,height:n??e.paperMm.height},heightSource:"config"}}function au(e){return{width:Fo(e.width),height:Fo(e.height)}}function Xb(e){return(e?.type??e?.printElementType?.type)!=="flowList"?!1:pn(e?.options?.flowLayoutMode)==="dynamic"}function su(e,t){const n=new Map(t.elements.map(o=>[o.id,o])),r=new Map;for(const o of e){const i=n.get(o.id),a=i?.options?._repeatHeaderCount??0,l=o.rowHeightsPx?.map(os),c=Xb(i);r.set(o.id,{id:o.id,measuredHeight:os(o.heightPx),...c?{measuredFlowRowHeights:l}:{measuredRowHeights:l},repeatHeaderHeight:l&&l.length>0&&a>0?l.slice(0,a).reduce((s,d)=>s+d,0):0})}return r}const Zb={b:"_renderRows",st:"_subtotalTemplates",sm:"_summaryRows"};function lu(e,t){if(!t||t.length===0)return;const n=new Map,r=o=>{for(const i of o??[])n.set(i.id,i)};r(e.elements),r(e.header?.elements),r(e.footer?.elements);for(const o of t){const i=tm(o.key);if(!i){const s=n.get(o.key);s&&(s.options._fitFontSize=sa(o.fontSizePt));continue}const c=n.get(i.elementId)?.options?.[Zb[i.kind]]?.[i.rowIndex]?.cells?.[i.colIndex];c&&(c.fittedFontSize=sa(o.fontSizePt))}}function cu(e,t,n={}){return JSON.stringify([e,t,n.barcodeType??null,n.qrCodeLevel??null,n.showText??null,n.barWidth??null,n.fontSize??null,n.qrQuietZone??null,n.barQuietZone??null,n.barHeightMm??null])}function Jb(e){return{render(t,n,r){const o=e.get(cu(t,n,r));if(!o)throw new Error(`码值未渲染:${t}`);return o}}}function Qb(e){const t=new Map;return{renderer:{render(n,r,o={}){const i=cu(n,r,o),a=e?.get(i);if(a)return a;throw t.set(i,{key:i,value:n,cellType:r,opts:o}),new Error("collect")}},takeSpecs(){const n=[...t.values()];return t.clear(),n}}}function e1(...e){const t=new Map;for(const n of e)for(const[r,o]of n)t.set(r,o);return t}const t1={waitReady:"window",readMeasurements:"document",readContentBottom:"document",readElementRects:"document",renderCodes:"none",renderAssets:"none",applyTextFit:"document"},n1=3e4,r1=5e3;function o1(e,t,n=[]){return{async withSession(r,o){const i=await e.createDriver(),a=Date.now()+(r.timeoutMs??n1),l=r.readinessMs??r1,c=()=>Math.max(1,a-Date.now()),s=(b,v,w)=>yb(b,v,w);let d=!1,p=!1;const u=async()=>{if(!d){if(i.requiresExecutor===!1){d=!0;return}throw new qn("INTERNAL","缺少 core DOM 执行器产物")}},f=async()=>{if(p)return;if(i.requiresExecutor===!1){p=!0;return}const b=new Set;for(const v of n)b.has(v.version)||(b.add(v.version),await i.injectExecutor(v));p=!0},g=async(b,v)=>{await i.open(v),await i.setContent(b),d=!1,p=!1,await u(),await i.evaluate("waitReady",[l])},m={async renderCodes(b){if(b.length===0)return new Map;const v=c();return Ar((async()=>{try{await u();const w=await i.evaluate("renderCodes",[b]);return new Map(Object.entries(w))}catch(w){throw s(w,"INTERNAL","码值渲染失败")}})(),v,"RENDER_TIMEOUT",`码值渲染超过 ${v}ms`)},async renderAssets(b){if(b.length===0)return new Map;const v=c();return Ar((async()=>{try{await u(),await f();const w=Mb("renderAssets"),E=await i.evaluate(w,[b]);return new Map(Object.entries(E??{}))}catch(w){throw s(w,"INTERNAL","扩展元素渲染失败")}})(),v,"RENDER_TIMEOUT",`扩展元素渲染超过 ${v}ms`)},async measure(b,v){const w=c();return Ar((async()=>{try{await g(b,v);const E=await i.evaluate("applyTextFit")??[];return{measurements:await i.evaluate("readMeasurements"),fits:E}}catch(E){throw s(E,"MEASURE_FAILED","测量失败")}})(),w,"RENDER_TIMEOUT",`测量超过 ${w}ms`)},async probeContentBottom(b,v){const w=c();return Ar((async()=>{try{return await g(b,v),await i.evaluate("readContentBottom")}catch(E){throw s(E,"MEASURE_FAILED","连续纸探针失败")}})(),w,"RENDER_TIMEOUT",`连续纸探针超过 ${w}ms`)},async toPdf(b,v,w){if(!i.pdf)throw new qn("UNSUPPORTED_RUNTIME","当前宿主不支持生成 PDF");const E=c();return Ar((async()=>{try{return await g(b,w),await i.pdf(b,v)}catch(k){throw s(k,"PDF_FAILED","PDF 生成失败")}})(),E,"RENDER_TIMEOUT",`PDF 生成超过 ${E}ms`)}};try{return await o(m)}finally{try{await i.close()}catch{}}}}}const du=500;function i1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function uu(e){if(e===void 0)return{mode:"single",data:{}};if(!Array.isArray(e))return{mode:"single",data:e};if(e.length===0)throw new Error("批量打印数据必须是非空对象数组");if(e.length>du)throw new Error(`批量打印最多支持 ${du} 份,当前 ${e.length} 份`);for(let t=0;t<e.length;t++)if(!i1(e[t]))throw new Error(`批量打印数据第 ${t+1} 项必须是对象`);return{mode:"batch",dataList:e}}function a1(e){const t=e[0].bound,n=At(t),r=e.map((a,l)=>{const c=n?`print-copy print-copy-${l}`:"print-copy",s=$o(a.bound,a.pageLayouts,a.data,{codeRenderer:a.codeRenderer,renderers:a.renderers,pageHeightMm:a.derivedHeightMm});return`<section class="${c}">
|
|
247
247
|
${s}
|
|
248
248
|
</section>`}).join(`
|
|
249
|
-
`),o=n?
|
|
250
|
-
.print-copy:not(:last-child){break-after:page;page-break-after:always;}`,i=
|
|
249
|
+
`),o=n?ab(t,e.map(a=>({heightMm:a.derivedHeightMm}))):`${kr(t)}
|
|
250
|
+
.print-copy:not(:last-child){break-after:page;page-break-after:always;}`,i=Mr(t.fonts)+o;return{html:No(i,r,n?"continuous":void 0),pageCount:e.reduce((a,l)=>a+l.pageLayouts.length,0),copyPaperMm:e.map(a=>a.paperMm)}}const Pt={enabled:!0,sheetPaperSize:"A4",sheetOrientation:"portrait",sheetMargin:{top:10,right:10,bottom:10,left:10},gapX:2,gapY:2,columns:2};class s1 extends Error{constructor(t,n){super(n),this.name="TilingError",this.code=t}}function vn(e){return Math.round(e*10)/10}function pu(e,t){const n=e.outputRotation;return n===90||n===270?`(内容旋转 ${n}°,每格 ${t.width}×${t.height}mm)`:""}function Bo(e){const t=e.tiling;return{...Pt,...t,sheetMargin:{...Pt.sheetMargin,...t?.sheetMargin??{}}}}function Ir(e,t){const n=Bo(e),r=t?.paperOverride;if(r&&typeof r.width=="number"&&r.width>0&&typeof r.height=="number"&&r.height>0)return{width:r.width,height:r.height};if(n.sheetPaperSize==="CUSTOM")return{width:n.sheetCustomWidth??hn.A4.width,height:n.sheetCustomHeight??hn.A4.height};const o=n.sheetPaperSize??"A4",i=hn[o]??hn.A4;return n.sheetOrientation==="landscape"?{width:i.height,height:i.width}:{...i}}function fu(e,t){return{w:e.width-t.left-t.right,h:e.height-t.top-t.bottom}}function is(e,t,n){return Math.max(0,Math.floor((e+n)/(t+n)))}function hu(e,t){const n=as(e,t);if(n.length)throw new s1(n[0].code,n[0].message);const r=Bo(e),o=Ir(e,t),i=gn(e),a=fu(o,r.sheetMargin),l=Math.floor((a.h+r.gapY)/(i.height+r.gapY));return{tile:{width:i.width,height:i.height},sheet:o,columns:r.columns,rows:l,perSheet:r.columns*l,maxColumns:is(a.w,i.width,r.gapX),margin:{...r.sheetMargin},gapX:r.gapX,gapY:r.gapY}}function l1(e,t){const n=t%e.perSheet,r=n%e.columns,o=Math.floor(n/e.columns);return{left:vn(e.margin.left+r*(e.tile.width+e.gapX)),top:vn(e.margin.top+o*(e.tile.height+e.gapY))}}function gu(e,t){const n=Bo(e),r=Ir(e,t),o=gn(e),i=r.width-n.sheetMargin.left-n.sheetMargin.right;return is(i,o.width,n.gapX)}function as(e,t){const n=[],r=Bo(e);At(e)&&n.push({code:"CONTINUOUS_UNSUPPORTED",message:"连续纸不支持拼版打印,请将模板纸张改为固定纸张或关闭拼版"});const o=r.sheetPaperSize,i=Fn(o??"");i&&n.push({code:"SHEET_CONTINUOUS",message:"拼版目标纸张不能是连续纸"});const a=r.sheetPaperSize==="CUSTOM"&&!((r.sheetCustomWidth??0)>0&&(r.sheetCustomHeight??0)>0);if(a&&n.push({code:"SHEET_SIZE_INVALID",message:"拼版自定义纸张宽高必须是大于 0 的数值(mm)"}),a||i)return n;const l=Ir(e,t),c=gn(e),s=fu(l,r.sheetMargin),d=vn(r.sheetMargin.left+r.sheetMargin.right);if(!Number.isInteger(r.columns)||r.columns<1)return n.push({code:"COLUMNS_INVALID",message:"拼版列数必须是大于 0 的整数"}),n;const p=is(s.w,c.width,r.gapX);if(r.columns>p){const u=vn(r.columns*c.width+(r.columns-1)*r.gapX);n.push({code:"COLUMNS_OVERFLOW",message:"拼版列数 "+r.columns+" 超出纸面可用宽度:"+vn(l.width)+"mm − 左右留白 "+d+"mm = "+vn(s.w)+"mm,最多可放 "+p+" 列;当前 "+r.columns+" 列 "+c.width+"mm 标签含间距需要 "+u+"mm"+pu(e,c)})}return Math.floor((s.h+r.gapY)/(c.height+r.gapY))<1&&n.push({code:"LABEL_TOO_TALL",message:"标签高度 "+c.height+"mm 超出纸面可用高度 "+vn(s.h)+"mm,拼版每张 0 行;请缩小标签高度或改用横向纸"+pu(e,c)}),n}function c1(e){const t=[],n=new Set;for(const r of e)for(const o of r.warnings??[])n.has(o)||(n.add(o),t.push(o));return t}function d1(e){const t=Array.isArray(e.pages)?e.pages:[e],n=[];for(const r of t)try{n.push(...xa(r,new Map))}catch{}return c1(n)}function u1(e){const{copies:t,layout:n}=e,r=t[0].bound,o=[];for(let a=0;a<t.length;a+=n.perSheet){const l=t.slice(a,a+n.perSheet).map((c,s)=>{const d=l1(n,s),p=$o(c.bound,c.pageLayouts,c.data,{codeRenderer:c.codeRenderer,renderers:c.renderers});return`<div class="print-tile" style="left:${d.left}mm;top:${d.top}mm">
|
|
251
251
|
${p}
|
|
252
252
|
</div>`}).join(`
|
|
253
253
|
`);o.push(`<section class="print-sheet">
|
|
254
254
|
${l}
|
|
255
|
-
</section>`)}const i=
|
|
256
|
-
`+
|
|
257
|
-
`)),sheetCount:o.length,perSheet:n.perSheet}}function ss(e,t){return e.name?`第 ${t+1} 页「${e.name}」`:`第 ${t+1} 页`}function ls(e){const t=
|
|
255
|
+
</section>`)}const i=Mr(r.fonts)+kr(r)+`
|
|
256
|
+
`+sb(n);return{html:No(i,o.join(`
|
|
257
|
+
`)),sheetCount:o.length,perSheet:n.perSheet}}function ss(e,t){return e.name?`第 ${t+1} 页「${e.name}」`:`第 ${t+1} 页`}function ls(e){const t=p1(e)?e.pages:[e];if(t.length===0)throw new Error("多页面模板至少需要一页");if(t.length===1)return t;const n=ht(t[0]);return t.forEach((r,o)=>{if(At(r))throw new Error(`多页面模板不支持连续纸(${ss(r,o)})`);if(r.tiling?.enabled===!0)throw new Error(`多页面模板不支持标签拼版(${ss(r,o)})`);const i=ht(r),a=i.width===n.width&&i.height===n.height,l=i.width===n.height&&i.height===n.width;if(!a&&!l)throw new Error(`多页面模板各页纸张尺寸必须一致(${ss(r,o)} ${i.width}×${i.height}mm 与首页 ${n.width}×${n.height}mm 不同)`)}),t}function p1(e){return Array.isArray(e.pages)}function f1(e){const t=new Set,n=[];for(const r of e)for(const o of r.fonts??[]){const i=o.family;t.has(i)||(t.add(i),n.push(o))}return n}function h1(e){if(e.length===0)throw new Error("多页面模板至少需要一份数据");const t=e[0].boundPages,n=Mr(f1(t))+[rb(),...t.flatMap((c,s)=>[ob(c,void 0,`mt-${s}`),`.mt-${s}.print-page { page: mt-${s}; }`,ib(c,`.mt-${s}`)]),...e.length>1?[Xa]:[]].join(`
|
|
258
258
|
|
|
259
|
-
`),r=e.map(
|
|
259
|
+
`),r=e.map(c=>{const s=c.layoutsPerPage.reduce((f,g)=>f+g.length,0);let d=0;const u=c.layoutsPerPage.map((f,g)=>{const m=$o(c.boundPages[g],f,c.data,{codeRenderer:c.codeRenderers?.[g],renderers:c.renderersPerPage?.[g]},{pageOffset:d,totalPages:s,pageClass:`mt-${g}`});return d+=f.length,m}).join(`
|
|
260
260
|
`);return e.length>1?`<section class="print-copy">
|
|
261
|
-
${
|
|
262
|
-
</section>`:
|
|
263
|
-
`),o=e.reduce((l,c)=>l+c.layoutsPerPage.reduce((s,d)=>s+d.length,0),0),i=[];let a=0;for(const l of e)for(const c of l.layoutsPerPage)for(const s of c)i.push({...s,pageIndex:a++});return{html:Po(n,r),pageCount:o,pageLayouts:i}}async function u1(e,t){return t.withSession(e,n=>p1(e,n))}async function p1(e,t){const n=ls(e.templateJson);if(n.length>1){const c=du(e.printData),s=c.mode==="batch"?c.dataList:[c.data],d=[];for(let u=0;u<s.length;u++)try{d.push(await h1(e,t,s[u]))}catch(f){const g=f instanceof Error?f.message:String(f);throw new Error(`第 ${u+1} 份渲染失败:${g}`)}const p=d1(d);return{html:p.html,pageCount:p.pageCount,paperMm:Nn(n[0]),continuous:!1,heightSource:"config",pageLayouts:p.pageLayouts,copies:d.length}}const r=n[0]!==e.templateJson?{...e,templateJson:n[0]}:e,o=n[0],i=du(r.printData);if(i.mode==="single"){const c=await mu(r,t,i.data);return o.tiling?.enabled===!0?gu(r,[{bound:c.bound,pageLayouts:c.pageLayouts,data:i.data,codeRenderer:c.codeRenderer,renderers:c.renderers,derivedHeightMm:c.derivedHeightMm,paperMm:c.paperMm,heightSource:c.heightSource}]):f1(c)}const a=[];for(let c=0;c<i.dataList.length;c++)try{const s=await mu(r,t,i.dataList[c]);a.push({bound:s.bound,pageLayouts:s.pageLayouts,data:i.dataList[c],codeRenderer:s.codeRenderer,renderers:s.renderers,derivedHeightMm:s.derivedHeightMm,paperMm:s.paperMm,heightSource:s.heightSource})}catch(s){const d=s instanceof Error?s.message:String(s);throw new Error(`第 ${c+1} 份渲染失败:${d}`)}if(o.tiling?.enabled===!0)return gu(r,a);const l=n1(a);return{html:l.html,pageCount:l.pageCount,paperMm:a[0].paperMm,continuous:kt(a[0].bound),heightSource:a[0].heightSource,pageLayouts:a.flatMap(c=>c.pageLayouts),copies:a.length,copyPaperMm:l.copyPaperMm}}function f1(e){return{html:e.html,pageCount:e.pageCount,paperMm:e.paperMm,continuous:e.continuous,heightSource:e.heightSource,pageLayouts:e.pageLayouts,copies:1}}function gu(e,t){const n=t[0].bound,r=fu(n,{paperOverride:e.paperOverride});t.forEach((i,a)=>{const l=i.pageLayouts[0]?.overflow===!0;if(i.pageLayouts.length!==1||l){const c=l?"内容超出纸张高度":`渲染出 ${i.pageLayouts.length} 页`;throw new Error(`拼版要求每份标签恰好 1 页,第 ${a+1} 份${c};请缩小内容或调整标签纸张高度`)}});const o=s1({copies:t.map(i=>({bound:i.bound,pageLayouts:i.pageLayouts,data:i.data,codeRenderer:i.codeRenderer,renderers:i.renderers})),layout:r});return{html:o.html,pageCount:o.sheetCount,paperMm:{width:r.sheet.width,height:r.sheet.height},continuous:!1,heightSource:"config",pageLayouts:t.flatMap(i=>i.pageLayouts),copies:t.length}}async function mu(e,t,n){const r=Cd(e.templateJson,n,e.baseUrl,e.fontBaseUrl),o=kt(r),i=ft(r),a=iu(i),l=Wb({paperHeightMm:e.paperHeightMm,override:e.paperOverride}),c=await Fo({bound:r,job:e,session:t,data:n,pageLayouts:[],isMeasurementPass:!0}),s=await t.measure(c.html,a);su(r,s.fits);const d=wa(r,au(s.measurements,r)),p=await Fo({bound:r,job:e,session:t,data:n,pageLayouts:d,isMeasurementPass:!1,codeBaseMap:c.codeMap,assetBaseMap:c.assetMap});let u=p.html,f;if(o){if(l&&l>0)f=l;else{const w=await t.probeContentBottom(u,a);f=qb(r,os(w))}u=Io(r,d,n,{codeRenderer:p.codeRenderer,renderers:p.renderers,pageHeightMm:f})}const g=o&&l?{...e.paperOverride,height:l}:e.paperOverride,m=Nn(r),{paperMm:b,heightSource:v}=jb({paperMm:{width:m.width,height:f??m.height},continuous:o,override:g});return{html:u,pageCount:d.length,paperMm:b,continuous:o,heightSource:v,pageLayouts:d,copies:1,bound:r,codeRenderer:p.codeRenderer,renderers:p.renderers,derivedHeightMm:f}}async function h1(e,t,n){const r=ls(e.templateJson),o=iu(ft(r[0])),i=[],a=[],l=[],c=[];for(const s of r){const d=Cd(s,n,e.baseUrl,e.fontBaseUrl),p=await Fo({bound:d,job:e,session:t,data:n,pageLayouts:[],isMeasurementPass:!0}),u=await t.measure(p.html,o);su(d,u.fits);const f=wa(d,au(u.measurements,d)),g=await Fo({bound:d,job:e,session:t,data:n,pageLayouts:f,isMeasurementPass:!1,codeBaseMap:p.codeMap,assetBaseMap:p.assetMap});i.push(d),a.push(f),l.push(g.codeRenderer),c.push(g.renderers)}return{boundPages:i,layoutsPerPage:a,data:n,codeRenderers:l,renderersPerPage:c}}async function Fo(e){const t=e.codeBaseMap??new Map,n=e.assetBaseMap??new Map,{job:r}=e,o=bb(),i=r.renderers;if(r.codeRenderer&&(o.length===0||i))return{html:Io(e.bound,e.pageLayouts,e.data,{isMeasurementPass:e.isMeasurementPass,codeRenderer:r.codeRenderer,renderers:i}),codeRenderer:r.codeRenderer,renderers:i,codeMap:t,assetMap:n};const a=Kb(t),l=gb(n),c=r.codeRenderer??a.renderer,s=i??(o.length>0?Kd(l.renderer,o):void 0),d=Io(e.bound,e.pageLayouts,e.data,{isMeasurementPass:e.isMeasurementPass,codeRenderer:c,renderers:s}),p=r.codeRenderer?[]:a.takeSpecs(),u=i?[]:l.takeSpecs(),[f,g]=await Promise.all([p.length>0?e.session.renderCodes(p):Promise.resolve(new Map),vb(u,e.session)]),m=Xb(t,f),b=Yd(n,g),v=r.codeRenderer??(m.size>0?Yb(m):void 0),w=i??(b.size>0?Kd(mb(b),o):s);return p.length===0&&u.length===0?{html:d,codeRenderer:v,renderers:w,codeMap:m,assetMap:b}:{html:Io(e.bound,e.pageLayouts,e.data,{isMeasurementPass:e.isMeasurementPass,codeRenderer:v,renderers:w}),codeRenderer:v,renderers:w,codeMap:m,assetMap:b}}class g1{constructor(t){this.functions={},t?.functions&&(this.functions={...t.functions})}registerFunction(t,n){this.functions[t]=n}evaluate(t,n){const r=Da(t),o=$a(r);return Xe(o,n,this.functions)}render(t,n){return fd(t,this.functions)(n)}}const bu=new g1,m1={MONEY:hd,CONCAT:(...e)=>e.filter(t=>t!=null).join(""),IF:bd,FORMAT:e=>typeof e!="number"?String(e):e.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2}),SUBSTR:(e,t,n)=>String(e).slice(t,n?t+n:void 0),LEN:e=>String(e).length,ADD:Ed,SUB:Sd,MUL:_d,DIV:Md,ROUND:Td,ROUNDUP:_o,CEIL:_o,ROUNDDOWN:Mo,FLOOR:Mo,ROUNDBANK:kd,NOW:()=>new Date().toISOString().split("T")[0],IFEMPTY:(e,t)=>e!=null&&e!==""?String(e):t,PAD:(e,t,n)=>String(e).padStart(t,n),REPLACE:(e,t,n)=>String(e).replace(new RegExp(t,"g"),n),JSON:e=>JSON.stringify(e,null,2),DATE:gd,UPPER:md};for(const[e,t]of Object.entries(m1))bu.registerFunction(e,t);function b1(e,t,n){switch(e.toUpperCase()){case"SUM":return Ha(n,t);case"AVG":return yd(n,t);case"COUNT":return vd(n);case"MIN":return wd(n,t);case"MAX":return xd(n,t);default:return 0}}function Un(e,t){if(!e)return"";if(!e.includes("{"))return e;const n=Array.isArray(t.rows)?t.rows:[];let r=e.replace(/\{([^}]+)\}/g,(o,i)=>{let a=i.trim();return a=a.replace(/\b(SUM|AVG|COUNT|MIN|MAX)\(([^)]+)\)/g,(l,c,s)=>{const d=s.trim().replace(/^['"]|['"]$/g,"");return String(b1(c,d,n))}),`{${a}}`});try{return bu.render(r,t)}catch{return e}}const ht={supplier:{name:"鑫达五金有限公司",phone:"0571-88776655",address:"杭州市萧山区经济开发区88号"},receiver:{name:"李四",phone:"13912345678",address:"杭州市余杭区文一西路998号"},order:{no:"PO20260801001",date:"2026-08-01",total:69543.75},goods:[{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:100,price:.5,amount:50,remark:"A级"},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:117,price:.75,amount:87.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:134,price:1,amount:134,remark:""},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:151,price:1.25,amount:188.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:168,price:1.5,amount:252,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:185,price:1.75,amount:323.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:202,price:2,amount:404,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:219,price:2.25,amount:492.75,remark:"A级"},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:236,price:2.5,amount:590,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:253,price:2.75,amount:695.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×20",unit:"个",qty:270,price:3,amount:810,remark:""},{name:"不锈钢螺母 M10",spec:"M16×21",unit:"套",qty:287,price:3.25,amount:932.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×22",unit:"盒",qty:304,price:3.5,amount:1064,remark:""},{name:"六角螺栓 M14",spec:"M5×23",unit:"支",qty:321,price:3.75,amount:1203.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×24",unit:"袋",qty:338,price:4,amount:1352,remark:"A级"},{name:"平垫圈 M6",spec:"M4×25",unit:"件",qty:355,price:4.25,amount:1508.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×26",unit:"根",qty:372,price:4.5,amount:1674,remark:""},{name:"双头螺柱 M20",spec:"M8×27",unit:"包",qty:389,price:4.75,amount:1847.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×28",unit:"只",qty:406,price:5,amount:2030,remark:""},{name:"十字盘头钉 M3",spec:"M12×29",unit:"组",qty:423,price:5.25,amount:2220.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×30",unit:"个",qty:440,price:.5,amount:220,remark:""},{name:"不锈钢螺母 M10",spec:"M16×31",unit:"套",qty:457,price:.75,amount:342.75,remark:"A级"},{name:"弹簧垫圈 M12",spec:"M6×32",unit:"盒",qty:474,price:1,amount:474,remark:""},{name:"六角螺栓 M14",spec:"M5×33",unit:"支",qty:491,price:1.25,amount:613.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×34",unit:"袋",qty:508,price:1.5,amount:762,remark:""},{name:"平垫圈 M6",spec:"M4×35",unit:"件",qty:525,price:1.75,amount:918.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×36",unit:"根",qty:542,price:2,amount:1084,remark:""},{name:"双头螺柱 M20",spec:"M8×37",unit:"包",qty:559,price:2.25,amount:1257.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×38",unit:"只",qty:576,price:2.5,amount:1440,remark:"A级"},{name:"十字盘头钉 M3",spec:"M12×39",unit:"组",qty:593,price:2.75,amount:1630.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×40",unit:"个",qty:610,price:3,amount:1830,remark:""},{name:"不锈钢螺母 M10",spec:"M16×41",unit:"套",qty:627,price:3.25,amount:2037.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×42",unit:"盒",qty:644,price:3.5,amount:2254,remark:""},{name:"六角螺栓 M14",spec:"M5×43",unit:"支",qty:661,price:3.75,amount:2478.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×44",unit:"袋",qty:678,price:4,amount:2712,remark:""},{name:"平垫圈 M6",spec:"M4×45",unit:"件",qty:695,price:4.25,amount:2953.75,remark:"A级"},{name:"自攻螺钉 M5",spec:"M3×46",unit:"根",qty:712,price:4.5,amount:3204,remark:""},{name:"双头螺柱 M20",spec:"M8×47",unit:"包",qty:729,price:4.75,amount:3462.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×48",unit:"只",qty:746,price:5,amount:3730,remark:""},{name:"十字盘头钉 M3",spec:"M12×49",unit:"组",qty:763,price:5.25,amount:4005.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:780,price:.5,amount:390,remark:""},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:797,price:.75,amount:597.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:814,price:1,amount:814,remark:"A级"},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:831,price:1.25,amount:1038.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:848,price:1.5,amount:1272,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:865,price:1.75,amount:1513.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:882,price:2,amount:1764,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:899,price:2.25,amount:2022.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:916,price:2.5,amount:2290,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:933,price:2.75,amount:2565.75,remark:"A级"}]},zo={left:0,center:50,right:100},Bo={top:0,center:50,bottom:100};function qn(e){return Number.isFinite(e)?Math.round(Math.min(100,Math.max(0,e))):50}function yu(e){return Math.round(e*100)/100}function vu(e,t){const n=qn(e),r=qn(t);if(!(n===50&&r===50))return`${n}% ${r}%`}function y1(e){return/^\d+(?:\.\d+)?%$/.test(e)?parseFloat(e):void 0}function v1(e){const t=(e??"").trim();if(!t)return{kind:"empty"};const n=t.toLowerCase().split(/\s+/);let r,o;for(let i=0;i<n.length;i++){const a=n[i],l=y1(a);if(i===0)if(a in zo)r=zo[a];else if(l!==void 0)r=l;else if(a in Bo)o=Bo[a];else return{kind:"custom",raw:e};else if(a in Bo&&o===void 0)o=Bo[a];else if(l!==void 0&&r===void 0)r=l;else if(l!==void 0&&o===void 0)o=l;else if(a in zo&&r===void 0)r=zo[a];else return{kind:"custom",raw:e}}return{kind:"axes",x:qn(r??50),y:qn(o??50)}}const wu=25.4/96;function xu(e){const{widthMm:t,heightMm:n,naturalWidth:r,naturalHeight:o}=e;if(!r||!o||!t||!n)return null;const i=t/r,a=n/o,l=(Ic(e.fit,e.scalePct)??fr)/100;switch(e.fit||"contain"){case"fill":return{w:t,h:n};case"cover":{const c=Math.max(i,a)*l;return{w:r*c,h:o*c}}case"none":return{w:r*wu,h:o*wu};case"scale-down":{const c=Math.min(1,Math.min(i,a));return{w:r*c,h:o*c}}default:{const c=Math.min(i,a);return{w:r*c,h:o*c}}}}function w1(e){const t=xu(e);return t?{x:yu(Math.abs(e.widthMm-t.w)),y:yu(Math.abs(e.heightMm-t.h))}:{x:null,y:null}}function x1(e,t,n){const r=xu(e);if(!r)return null;const o=Math.min(1,e.widthMm/r.w),i=Math.min(1,e.heightMm/r.h);return{leftPct:(1-o)*qn(t),topPct:(1-i)*qn(n),widthPct:o*100,heightPct:i*100}}function Eu(e){const t=String(e??"");return t?t.includes("{")?String(Un(t,ht)):t:""}const Su={vertical:[{value:0,label:"顶部"},{value:50,label:"居中"},{value:100,label:"底部"}],horizontal:[{value:0,label:"左侧"},{value:50,label:"居中"},{value:100,label:"右侧"}]},E1=[{x:0,y:0,label:"左上"},{x:50,y:0,label:"上中"},{x:100,y:0,label:"右上"},{x:0,y:50,label:"左中"},{x:50,y:50,label:"居中"},{x:100,y:50,label:"右中"},{x:0,y:100,label:"左下"},{x:50,y:100,label:"下中"},{x:100,y:100,label:"右下"}],cs=[{value:"contain",label:"包含(保持比例)"},{value:"cover",label:"剪裁(等比铺满后裁边)"},{value:"fill",label:"拉伸填满"},{value:"none",label:"原始尺寸"},{value:"scale-down",label:"缩小(保持比例)"}],S1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+PHJlY3Qgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIGZpbGw9IiNmZmZmZmYiLz48cGF0aCBkPSJNNDAgMFYxMjBNODAgMFYxMjBNMCA0MEgxMjBNMCA4MEgxMjAiIHN0cm9rZT0iI2VlZjFmNiIgc3Ryb2tlLXdpZHRoPSIxIi8+PGNpcmNsZSBjeD0iMjAiIGN5PSIyMCIgcj0iMy41IiBmaWxsPSIjOGI5NWE1Ii8+PGNpcmNsZSBjeD0iMTAwIiBjeT0iMjAiIHI9IjMuNSIgZmlsbD0iIzhiOTVhNSIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iMTAwIiByPSIzLjUiIGZpbGw9IiM4Yjk1YTUiLz48Y2lyY2xlIGN4PSIxMDAiIGN5PSIxMDAiIHI9IjMuNSIgZmlsbD0iIzhiOTVhNSIvPjxjaXJjbGUgY3g9IjYwIiBjeT0iMjAiIHI9IjciIGZpbGw9IiNjMDM5MmIiLz48Y2lyY2xlIGN4PSI2MCIgY3k9IjEwMCIgcj0iNyIgZmlsbD0iIzFmNGZhMyIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iNjAiIHI9IjciIGZpbGw9IiMyYzdhNGEiLz48Y2lyY2xlIGN4PSIxMDAiIGN5PSI2MCIgcj0iNyIgZmlsbD0iI2UwN2EyMCIvPjxjaXJjbGUgY3g9IjYwIiBjeT0iNjAiIHI9IjE0IiBmaWxsPSJub25lIiBzdHJva2U9IiMyZjNhNGEiIHN0cm9rZS13aWR0aD0iNCIvPjxjaXJjbGUgY3g9IjYwIiBjeT0iNjAiIHI9IjYiIGZpbGw9IiMyZjNhNGEiLz48L3N2Zz4=",_1="图片还没设置,上面按内置示例图演示取位;换上真图后档位与可挪量按真图重算";function M1(e){const t=String(e??"").trim();return!t||t.includes("{")||t.includes("}")?{src:S1,isSample:!0}:{src:t,isSample:!1}}function _u(e){return e==="vertical"?"垂直位置 (%)":"水平位置 (%)"}const T1="放大比例 (%)";function k1(e,t=!1){if(t)return"已保留模板里的原值;改动下面任一项就整体替换成新的取位";const{x:n,y:r}=e;return n===null||r===null?"":n>0&&r>0?`水平可挪 ${n}mm、垂直可挪 ${r}mm:0 贴左/贴顶,100 贴右/贴底`:n>0?`水平可挪 ${n}mm;垂直这一轴已贴满,挪不动`:r>0?`垂直可挪 ${r}mm;水平这一轴已贴满,挪不动`:"这个缩放下图与框正好一样大,两轴都没有可挪的余量"}function C1(e,t,n){return[{name:"horizontal",label:_u("horizontal"),value:t,travelMm:e.x},{name:"vertical",label:_u("vertical"),value:n,travelMm:e.y}]}function A1(e,t,n){const r=e.x!==null&&e.x>0,o=e.y!==null&&e.y>0;return o&&!r?Su.vertical.map(i=>({value:`${t},${i.value}`,label:i.label})):r&&!o?Su.horizontal.map(i=>({value:`${i.value},${n}`,label:i.label})):E1.map(i=>({value:`${i.x},${i.y}`,label:i.label}))}function Mu(e){const t=[...e].sort((a,l)=>(a.sortOrder??0)-(l.sortOrder??0)),n=new Map,r=[];for(const a of t){const l=a.fieldKey.indexOf(".");if(l===-1)continue;const c=a.fieldKey.slice(0,l);let s=n.get(c);s||(s={key:c,label:c,isList:!1,fields:[]},n.set(c,s),r.push(c)),s.fields.push(a)}const o=[],i=[];for(const a of t){if(a.fieldKey.includes("."))continue;const l=n.get(a.fieldKey);l?(l.label=a.fieldLabel,l.isList=a.fieldType==="list"):i.push(a)}i.length&&o.push({key:"",label:"",isList:!1,fields:i});for(const a of r)o.push(n.get(a));return o}function O1(e,t){const n=t.trim().toLowerCase();return n?e.map(r=>({...r,fields:r.fields.filter(o=>o.fieldLabel.toLowerCase().includes(n)||o.fieldKey.toLowerCase().includes(n))})).filter(r=>r.fields.length>0):e}async function Tu(e){if(!e)return!1;const t=typeof navigator>"u"?void 0:navigator;if(t?.clipboard?.writeText)try{return await t.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.top="-1000px",n.style.opacity="0",document.body.appendChild(n);try{return n.select(),typeof document.execCommand=="function"&&document.execCommand("copy")}catch{return!1}finally{n.remove()}}const I1=Object.fromEntries(Object.entries(ar).filter(([,e])=>e.bindings!==void 0).map(([e,t])=>[e,[...t.bindings??[]]]));function ku(e,t,n,r){return e==="data"?[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"list",listField:r,placeholder:"{name}"}]:e==="subtotal"?[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"subtotal",placeholder:"{MONEY(SUM(amount))}"}]:e==="summary"?[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"summary",placeholder:"{MONEY(SUM(amount))}"}]:[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"main",placeholder:"合计: {order.total}"}]}function R1(e){const t=e.printElementType.type,n=dt(t).bindings??I1[t]??[],r=[];if(t==="table"){const o=e.options.dataSource;for(const[i,a]of(e.options.tableRows??[]).entries())for(const[l,c]of a.cells.entries())c.merged||r.push(...ku(a.type,i,l,o))}return[...n,...r]}function P1(e){return Ea("text",{formatter:`{${e.fieldKey}}`,title:e.fieldLabel})}function D1(e){const t=e.fieldLabel||e.fieldKey;return Ea("text",{formatter:t,title:t})}function Cu(e,t){let n=e;for(const r of t.split(".")){if(n==null)return;n=Array.isArray(n)?n[0]?.[r]:n[r]}return n}function Au(e){return Cu(ht,e)}function ds(e,t,n="1234567890128"){const r=t?.[0];return(e??"").replace(/\{([^{}]+)\}/g,(i,a)=>{const l=a.trim(),c=l.includes(".")?Cu(r,l)??Au(l):r?.[l]??Au(l);return c==null?"":String(c)}).trim()||n}const Ho={left:"#3b82f6",center:"#10b981",right:"#f59e0b",top:"#3b82f6",middle:"#10b981",bottom:"#f59e0b"};function Ou(e){return e==="vCenter"?Ho.center:e==="hCenter"?Ho.middle:Ho[e]??Ho.left}function $1(e,t,n,r={}){const o=r.adsorbMin??1,i=r.adsorbLineMin??2,a=r.showAdsorbLine??!0;let l=e.left,c=e.top;const s=[],d={left:e.left,right:e.left+e.width,vCenter:e.left+e.width/2,top:e.top,bottom:e.top+e.height,hCenter:e.top+e.height/2};let p=1/0;for(const f of t){if(f.id===e.id)continue;const g={left:f.left,right:f.left+f.width,vCenter:f.left+f.width/2,top:f.top,bottom:f.top+f.height,hCenter:f.top+f.height/2},m=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],b=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[v,w]of m){const E=Math.abs(d[v]-g[w]);E<=o&&E<p&&(p=E,l=e.left+(g[w]-d[v]))}for(const[v,w]of b){const E=Math.abs(d[v]-g[w]);E<=o&&E<p&&(p=E,c=e.top+(g[w]-d[v]))}}if(n){const f={left:l,right:l+e.width,vCenter:l+e.width/2,top:c,bottom:c+e.height,hCenter:c+e.height/2},g=["left","vCenter","right"];for(const b of n.vertical)for(const v of g){const w=Math.abs(f[v]-b);w<=o&&w<p&&(p=w,l=e.left+(b-f[v]))}const m=["top","hCenter","bottom"];for(const b of n.horizontal)for(const v of m){const w=Math.abs(f[v]-b);w<=o&&w<p&&(p=w,c=e.top+(b-f[v]))}}const u={left:l,right:l+e.width,vCenter:l+e.width/2,top:c,bottom:c+e.height,hCenter:c+e.height/2};if(a){const f=new Set;for(const g of t){if(g.id===e.id)continue;const m={left:g.left,right:g.left+g.width,vCenter:g.left+g.width/2,top:g.top,bottom:g.top+g.height,hCenter:g.top+g.height/2},b=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],v=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[w,E]of b)if(Math.abs(u[w]-m[E])<=i){const F=`v:${m[E]}`;f.has(F)||(f.add(F),s.push({type:"vertical",position:m[E],id:g.id,color:Ou(w)}))}for(const[w,E]of v)if(Math.abs(u[w]-m[E])<=i){const F=`h:${m[E]}`;f.has(F)||(f.add(F),s.push({type:"horizontal",position:m[E],id:g.id,color:Ou(w)}))}}}if(n){for(const f of n.vertical)s.some(g=>g.type==="vertical"&&g.position===f)||s.push({type:"vertical",position:f});for(const f of n.horizontal)s.some(g=>g.type==="horizontal"&&g.position===f)||s.push({type:"horizontal",position:f})}return{left:l,top:c,lines:s}}function N1(){function e(t,n){if(t.length<2)return;const r=t.map(i=>je(i.options).margin),o={minLeft:Math.min(...r.map(i=>i.left)),maxRight:Math.max(...r.map(i=>i.right)),minTop:Math.min(...r.map(i=>i.top)),maxBottom:Math.max(...r.map(i=>i.bottom))};switch(n){case"left":t.forEach(i=>{i.options.left=o.minLeft});break;case"right":t.forEach((i,a)=>{i.options.left=o.maxRight-r[a].width});break;case"top":t.forEach(i=>{i.options.top=o.minTop});break;case"bottom":t.forEach((i,a)=>{i.options.top=o.maxBottom-r[a].height});break;case"vertical":{const i=o.minLeft+(o.maxRight-o.minLeft)/2;t.forEach((a,l)=>{a.options.left=i-r[l].width/2});break}case"horizontal":{const i=o.minTop+(o.maxBottom-o.minTop)/2;t.forEach((a,l)=>{a.options.top=i-r[l].height/2});break}case"distributeHor":{const i=t.map((s,d)=>({element:s,box:r[d]})).sort((s,d)=>s.box.left-d.box.left),a=i.reduce((s,d)=>s+d.box.width,0),l=(o.maxRight-o.minLeft-a)/(i.length-1);let c=o.minLeft;i.forEach(s=>{s.element.options.left=c,c+=s.box.width+l});break}case"distributeVer":{const i=t.map((s,d)=>({element:s,box:r[d]})).sort((s,d)=>s.box.top-d.box.top),a=i.reduce((s,d)=>s+d.box.height,0),l=(o.maxBottom-o.minTop-a)/(i.length-1);let c=o.minTop;i.forEach(s=>{s.element.options.top=c,c+=s.box.height+l});break}}}return{align:e}}function Iu(){return`grp-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function L1(){function e(r,o){if(r.filter(l=>o.has(l.id)).length<2)return r;const a=Iu();return r.map(l=>o.has(l.id)?{...l,options:{...l.options,groupId:a}}:l)}function t(r,o){const i=r.filter(l=>o.has(l.id)),a=new Set(i.map(l=>l.options.groupId).filter(Boolean));return r.map(l=>l.options.groupId&&a.has(l.options.groupId)?{...l,options:{...l.options,groupId:void 0}}:l)}function n(r,o){const i=r.find(l=>l.id===o);if(!i?.options.groupId)return new Set([o]);const a=new Set;for(const l of r)l.options.groupId===i.options.groupId&&a.add(l.id);return a}return{group:e,ungroup:t,getGroupedIds:n}}const F1=["nw","n","ne","e","se","s","sw","w"];function z1(e,t,n,r,o,i){let{left:a,top:l,width:c,height:s}=t;switch(e){case"e":c=Math.max(o,t.width+n);break;case"w":c=Math.max(o,t.width-n),a=t.left+t.width-c;break;case"s":s=Math.max(i,t.height+r);break;case"n":s=Math.max(i,t.height-r),l=t.top+t.height-s;break;case"se":c=Math.max(o,t.width+n),s=Math.max(i,t.height+r);break;case"sw":c=Math.max(o,t.width-n),a=t.left+t.width-c,s=Math.max(i,t.height+r);break;case"ne":c=Math.max(o,t.width+n),s=Math.max(i,t.height-r),l=t.top+t.height-s;break;case"nw":c=Math.max(o,t.width-n),a=t.left+t.width-c,s=Math.max(i,t.height-r),l=t.top+t.height-s;break}return{left:a,top:l,width:c,height:s}}function Ru(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={},Ar={},qo={},Pu;function ot(){if(Pu)return qo;Pu=1,Object.defineProperty(qo,"__esModule",{value:!0});function e(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}var t=function n(r,o){e(this,n),this.data=r,this.text=o.text||r,this.options=o};return qo.default=t,qo}var Du;function B1(){if(Du)return Ar;Du=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.CODE39=void 0;var e=(function(){function m(b,v){for(var w=0;w<v.length;w++){var E=v[w];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(b,E.key,E)}}return function(b,v,w){return v&&m(b.prototype,v),w&&m(b,w),b}})(),t=ot(),n=r(t);function r(m){return m&&m.__esModule?m:{default:m}}function o(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function i(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function a(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var l=(function(m){a(b,m);function b(v,w){return o(this,b),v=v.toUpperCase(),w.mod43&&(v+=u(g(v))),i(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,w))}return e(b,[{key:"encode",value:function(){for(var w=d("*"),E=0;E<this.data.length;E++)w+=d(this.data[E])+"0";return w+=d("*"),{data:w,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),b})(n.default),c=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],s=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(m){return p(f(m))}function p(m){return s[m].toString(2)}function u(m){return c[m]}function f(m){return c.indexOf(m)}function g(m){for(var b=0,v=0;v<m.length;v++)b+=f(m[v]);return b=b%43,b}return Ar.CODE39=l,Ar}var vt={},Wo={},jo={},Ee={},$u;function Or(){if($u)return Ee;$u=1,Object.defineProperty(Ee,"__esModule",{value:!0});var e;function t(c,s,d){return s in c?Object.defineProperty(c,s,{value:d,enumerable:!0,configurable:!0,writable:!0}):c[s]=d,c}var n=Ee.SET_A=0,r=Ee.SET_B=1,o=Ee.SET_C=2;Ee.SHIFT=98;var i=Ee.START_A=103,a=Ee.START_B=104,l=Ee.START_C=105;return Ee.MODULO=103,Ee.STOP=106,Ee.FNC1=207,Ee.SET_BY_CODE=(e={},t(e,i,n),t(e,a,r),t(e,l,o),e),Ee.SWAP={101:n,100:r,99:o},Ee.A_START_CHAR="Ð",Ee.B_START_CHAR="Ñ",Ee.C_START_CHAR="Ò",Ee.A_CHARS="[\0-_È-Ï]",Ee.B_CHARS="[ -È-Ï]",Ee.C_CHARS="(Ï*[0-9]{2}Ï*)",Ee.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],Ee}var Nu;function Go(){if(Nu)return jo;Nu=1,Object.defineProperty(jo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=ot(),n=o(t),r=Or();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){i(this,d);var f=a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p.substring(1),u));return f.bytes=p.split("").map(function(g){return g.charCodeAt(0)}),f}return e(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var u=this.bytes,f=u.shift()-105,g=r.SET_BY_CODE[f];if(g===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&u.unshift(r.FNC1);var m=d.next(u,1,g);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(f)+m.result+d.getBar((m.checksum+f)%r.MODULO)+d.getBar(r.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var u=this.options.ean128||!1;return typeof u=="string"&&(u=u.toLowerCase()==="true"),u}}],[{key:"getBar",value:function(u){return r.BARS[u]?r.BARS[u].toString():""}},{key:"correctIndex",value:function(u,f){if(f===r.SET_A){var g=u.shift();return g<32?g+64:g-32}else return f===r.SET_B?u.shift()-32:(u.shift()-48)*10+u.shift()-48}},{key:"next",value:function(u,f,g){if(!u.length)return{result:"",checksum:0};var m=void 0,b=void 0;if(u[0]>=200){b=u.shift()-105;var v=r.SWAP[b];v!==void 0?m=d.next(u,f+1,v):((g===r.SET_A||g===r.SET_B)&&b===r.SHIFT&&(u[0]=g===r.SET_A?u[0]>95?u[0]-96:u[0]:u[0]<32?u[0]+96:u[0]),m=d.next(u,f+1,g))}else b=d.correctIndex(u,g),m=d.next(u,f+1,g);var w=d.getBar(b),E=b*f;return{result:w+m.result,checksum:E+m.checksum}}}]),d})(n.default);return jo.default=c,jo}var Vo={},Lu;function H1(){if(Lu)return Vo;Lu=1,Object.defineProperty(Vo,"__esModule",{value:!0});var e=Or(),t=function(l){return l.match(new RegExp("^"+e.A_CHARS+"*"))[0].length},n=function(l){return l.match(new RegExp("^"+e.B_CHARS+"*"))[0].length},r=function(l){return l.match(new RegExp("^"+e.C_CHARS+"*"))[0]};function o(a,l){var c=l?e.A_CHARS:e.B_CHARS,s=a.match(new RegExp("^("+c+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(s)return s[1]+"Ì"+i(a.substring(s[1].length));var d=a.match(new RegExp("^"+c+"+"))[0];return d.length===a.length?a:d+String.fromCharCode(l?205:206)+o(a.substring(d.length),!l)}function i(a){var l=r(a),c=l.length;if(c===a.length)return a;a=a.substring(c);var s=t(a)>=n(a);return l+String.fromCharCode(s?206:205)+o(a,s)}return Vo.default=function(a){var l=void 0,c=r(a).length;if(c>=2)l=e.C_START_CHAR+i(a);else{var s=t(a)>n(a);l=(s?e.A_START_CHAR:e.B_START_CHAR)+o(a,s)}return l.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,p){return"Ë"+p})},Vo}var Fu;function U1(){if(Fu)return Wo;Fu=1,Object.defineProperty(Wo,"__esModule",{value:!0});var e=Go(),t=o(e),n=H1(),r=o(n);function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){if(i(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(p))var f=a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,r.default)(p),u));else var f=a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u));return a(f)}return d})(t.default);return Wo.default=c,Wo}var Yo={},zu;function q1(){if(zu)return Yo;zu=1,Object.defineProperty(Yo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Go(),n=o(t),r=Or();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,r.A_START_CHAR+p,u))}return e(d,[{key:"valid",value:function(){return new RegExp("^"+r.A_CHARS+"+$").test(this.data)}}]),d})(n.default);return Yo.default=c,Yo}var Ko={},Bu;function W1(){if(Bu)return Ko;Bu=1,Object.defineProperty(Ko,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Go(),n=o(t),r=Or();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,r.B_START_CHAR+p,u))}return e(d,[{key:"valid",value:function(){return new RegExp("^"+r.B_CHARS+"+$").test(this.data)}}]),d})(n.default);return Ko.default=c,Ko}var Xo={},Hu;function j1(){if(Hu)return Xo;Hu=1,Object.defineProperty(Xo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Go(),n=o(t),r=Or();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,r.C_START_CHAR+p,u))}return e(d,[{key:"valid",value:function(){return new RegExp("^"+r.C_CHARS+"+$").test(this.data)}}]),d})(n.default);return Xo.default=c,Xo}var Uu;function G1(){if(Uu)return vt;Uu=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.CODE128C=vt.CODE128B=vt.CODE128A=vt.CODE128=void 0;var e=U1(),t=c(e),n=q1(),r=c(n),o=W1(),i=c(o),a=j1(),l=c(a);function c(s){return s&&s.__esModule?s:{default:s}}return vt.CODE128=t.default,vt.CODE128A=r.default,vt.CODE128B=i.default,vt.CODE128C=l.default,vt}var Ze={},Zo={},Ft={},qu;function Ir(){return qu||(qu=1,Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.SIDE_BIN="101",Ft.MIDDLE_BIN="01010",Ft.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Ft.EAN2_STRUCTURE=["LL","LG","GL","GG"],Ft.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Ft.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Ft}var Jo={},Qo={},Wu;function Rr(){if(Wu)return Qo;Wu=1,Object.defineProperty(Qo,"__esModule",{value:!0});var e=Ir(),t=function(r,o,i){var a=r.split("").map(function(c,s){return e.BINARIES[o[s]]}).map(function(c,s){return c?c[r[s]]:""});if(i){var l=r.length-1;a=a.map(function(c,s){return s<l?c+i:c})}return a.join("")};return Qo.default=t,Qo}var ju;function Gu(){if(ju)return Jo;ju=1,Object.defineProperty(Jo,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})(),t=Ir(),n=Rr(),r=a(n),o=ot(),i=a(o);function a(p){return p&&p.__esModule?p:{default:p}}function l(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function c(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function s(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var d=(function(p){s(u,p);function u(f,g){l(this,u);var m=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g));return m.fontSize=!g.flat&&g.fontSize>g.width*10?g.width*10:g.fontSize,m.guardHeight=g.height+m.fontSize/2+g.textMargin,m}return e(u,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(g,m){return this.text.substr(g,m)}},{key:"leftEncode",value:function(g,m){return(0,r.default)(g,m)}},{key:"rightText",value:function(g,m){return this.text.substr(g,m)}},{key:"rightEncode",value:function(g,m){return(0,r.default)(g,m)}},{key:"encodeGuarded",value:function(){var g={fontSize:this.fontSize},m={height:this.guardHeight};return[{data:t.SIDE_BIN,options:m},{data:this.leftEncode(),text:this.leftText(),options:g},{data:t.MIDDLE_BIN,options:m},{data:this.rightEncode(),text:this.rightText(),options:g},{data:t.SIDE_BIN,options:m}]}},{key:"encodeFlat",value:function(){var g=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:g.join(""),text:this.text}}}]),u})(i.default);return Jo.default=d,Jo}var Vu;function V1(){if(Vu)return Zo;Vu=1,Object.defineProperty(Zo,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})(),t=function p(u,f,g){u===null&&(u=Function.prototype);var m=Object.getOwnPropertyDescriptor(u,f);if(m===void 0){var b=Object.getPrototypeOf(u);return b===null?void 0:p(b,f,g)}else{if("value"in m)return m.value;var v=m.get;return v===void 0?void 0:v.call(g)}},n=Ir(),r=Gu(),o=i(r);function i(p){return p&&p.__esModule?p:{default:p}}function a(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function l(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function c(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var s=function(u){var f=u.substr(0,12).split("").map(function(g){return+g}).reduce(function(g,m,b){return b%2?g+m*3:g+m},0);return(10-f%10)%10},d=(function(p){c(u,p);function u(f,g){a(this,u),f.search(/^[0-9]{12}$/)!==-1&&(f+=s(f));var m=l(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g));return m.lastChar=g.lastChar,m}return e(u,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===s(this.data)}},{key:"leftText",value:function(){return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var g=this.data.substr(1,6),m=n.EAN13_STRUCTURE[this.data[0]];return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"leftEncode",this).call(this,g,m)}},{key:"rightText",value:function(){return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var g=this.data.substr(7,6);return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"rightEncode",this).call(this,g,"RRRRRR")}},{key:"encodeGuarded",value:function(){var g=t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(g.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(g.push({data:"00"}),g.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),g}}]),u})(o.default);return Zo.default=d,Zo}var ei={},Yu;function Y1(){if(Yu)return ei;Yu=1,Object.defineProperty(ei,"__esModule",{value:!0});var e=(function(){function d(p,u){for(var f=0;f<u.length;f++){var g=u[f];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}return function(p,u,f){return u&&d(p.prototype,u),f&&d(p,f),p}})(),t=function d(p,u,f){p===null&&(p=Function.prototype);var g=Object.getOwnPropertyDescriptor(p,u);if(g===void 0){var m=Object.getPrototypeOf(p);return m===null?void 0:d(m,u,f)}else{if("value"in g)return g.value;var b=g.get;return b===void 0?void 0:b.call(f)}},n=Gu(),r=o(n);function o(d){return d&&d.__esModule?d:{default:d}}function i(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function a(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function l(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var c=function(p){var u=p.substr(0,7).split("").map(function(f){return+f}).reduce(function(f,g,m){return m%2?f+g:f+g*3},0);return(10-u%10)%10},s=(function(d){l(p,d);function p(u,f){return i(this,p),u.search(/^[0-9]{7}$/)!==-1&&(u+=c(u)),a(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,u,f))}return e(p,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===c(this.data)}},{key:"leftText",value:function(){return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var f=this.data.substr(0,4);return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"leftEncode",this).call(this,f,"LLLL")}},{key:"rightText",value:function(){return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var f=this.data.substr(4,4);return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"rightEncode",this).call(this,f,"RRRR")}}]),p})(r.default);return ei.default=s,ei}var ti={},Ku;function K1(){if(Ku)return ti;Ku=1,Object.defineProperty(ti,"__esModule",{value:!0});var e=(function(){function u(f,g){for(var m=0;m<g.length;m++){var b=g[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(f,b.key,b)}}return function(f,g,m){return g&&u(f.prototype,g),m&&u(f,m),f}})(),t=Ir(),n=Rr(),r=a(n),o=ot(),i=a(o);function a(u){return u&&u.__esModule?u:{default:u}}function l(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}function c(u,f){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:u}function s(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);u.prototype=Object.create(f&&f.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(u,f):u.__proto__=f)}var d=function(f){var g=f.split("").map(function(m){return+m}).reduce(function(m,b,v){return v%2?m+b*9:m+b*3},0);return g%10},p=(function(u){s(f,u);function f(g,m){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,g,m))}return e(f,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var m=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,r.default)(this.data,m,"01"),text:this.text}}}]),f})(i.default);return ti.default=p,ti}var ni={},Xu;function X1(){if(Xu)return ni;Xu=1,Object.defineProperty(ni,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})(),t=Ir(),n=Rr(),r=a(n),o=ot(),i=a(o);function a(p){return p&&p.__esModule?p:{default:p}}function l(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function c(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function s(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var d=(function(p){s(u,p);function u(f,g){return l(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g))}return e(u,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var g=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,r.default)(this.data,g,"01"),text:this.text}}}]),u})(i.default);return ni.default=d,ni}var Pr={},Zu;function Ju(){if(Zu)return Pr;Zu=1,Object.defineProperty(Pr,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})();Pr.checksum=d;var t=Rr(),n=i(t),r=ot(),o=i(r);function i(p){return p&&p.__esModule?p:{default:p}}function a(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function l(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function c(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var s=(function(p){c(u,p);function u(f,g){a(this,u),f.search(/^[0-9]{11}$/)!==-1&&(f+=d(f));var m=l(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g));return m.displayValue=g.displayValue,g.fontSize>g.width*10?m.fontSize=g.width*10:m.fontSize=g.fontSize,m.guardHeight=g.height+m.fontSize/2+g.textMargin,m}return e(u,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var g="";return g+="101",g+=(0,n.default)(this.data.substr(0,6),"LLLLLL"),g+="01010",g+=(0,n.default)(this.data.substr(6,6),"RRRRRR"),g+="101",{data:g,text:this.text}}},{key:"guardedEncoding",value:function(){var g=[];return this.displayValue&&g.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),g.push({data:"101"+(0,n.default)(this.data[0],"L"),options:{height:this.guardHeight}}),g.push({data:(0,n.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),g.push({data:"01010",options:{height:this.guardHeight}}),g.push({data:(0,n.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),g.push({data:(0,n.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&g.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),g}}]),u})(o.default);function d(p){var u=0,f;for(f=1;f<11;f+=2)u+=parseInt(p[f]);for(f=0;f<11;f+=2)u+=parseInt(p[f])*3;return(10-u%10)%10}return Pr.default=s,Pr}var ri={},Qu;function Z1(){if(Qu)return ri;Qu=1,Object.defineProperty(ri,"__esModule",{value:!0});var e=(function(){function g(m,b){for(var v=0;v<b.length;v++){var w=b[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,v){return b&&g(m.prototype,b),v&&g(m,v),m}})(),t=Rr(),n=a(t),r=ot(),o=a(r),i=Ju();function a(g){return g&&g.__esModule?g:{default:g}}function l(g,m){if(!(g instanceof m))throw new TypeError("Cannot call a class as a function")}function c(g,m){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:g}function s(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);g.prototype=Object.create(m&&m.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(g,m):g.__proto__=m)}var d=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],p=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],u=(function(g){s(m,g);function m(b,v){l(this,m);var w=c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v));if(w.isValid=!1,b.search(/^[0-9]{6}$/)!==-1)w.middleDigits=b,w.upcA=f(b,"0"),w.text=v.text||""+w.upcA[0]+b+w.upcA[w.upcA.length-1],w.isValid=!0;else if(b.search(/^[01][0-9]{7}$/)!==-1)if(w.middleDigits=b.substring(1,b.length-1),w.upcA=f(w.middleDigits,b[0]),w.upcA[w.upcA.length-1]===b[b.length-1])w.isValid=!0;else return c(w);else return c(w);return w.displayValue=v.displayValue,v.fontSize>v.width*10?w.fontSize=v.width*10:w.fontSize=v.fontSize,w.guardHeight=v.height+w.fontSize/2+v.textMargin,w}return e(m,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var v="";return v+="101",v+=this.encodeMiddleDigits(),v+="010101",{data:v,text:this.text}}},{key:"guardedEncoding",value:function(){var v=[];return this.displayValue&&v.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),v.push({data:"101",options:{height:this.guardHeight}}),v.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),v.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&v.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),v}},{key:"encodeMiddleDigits",value:function(){var v=this.upcA[0],w=this.upcA[this.upcA.length-1],E=p[parseInt(w)][parseInt(v)];return(0,n.default)(this.middleDigits,E)}}]),m})(o.default);function f(g,m){for(var b=parseInt(g[g.length-1]),v=d[b],w="",E=0,C=0;C<v.length;C++){var F=v[C];F==="X"?w+=g[E++]:w+=F}return w=""+m+w,""+w+(0,i.checksum)(w)}return ri.default=u,ri}var ep;function J1(){if(ep)return Ze;ep=1,Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.UPCE=Ze.UPC=Ze.EAN2=Ze.EAN5=Ze.EAN8=Ze.EAN13=void 0;var e=V1(),t=u(e),n=Y1(),r=u(n),o=K1(),i=u(o),a=X1(),l=u(a),c=Ju(),s=u(c),d=Z1(),p=u(d);function u(f){return f&&f.__esModule?f:{default:f}}return Ze.EAN13=t.default,Ze.EAN8=r.default,Ze.EAN5=i.default,Ze.EAN2=l.default,Ze.UPC=s.default,Ze.UPCE=p.default,Ze}var yn={},oi={},Wn={},tp;function Q1(){return tp||(tp=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.START_BIN="1010",Wn.END_BIN="11101",Wn.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Wn}var np;function rp(){if(np)return oi;np=1,Object.defineProperty(oi,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Q1(),n=ot(),r=o(n);function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return e(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var u=this,f=this.data.match(/.{2}/g).map(function(g){return u.encodePair(g)}).join("");return{data:t.START_BIN+f+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(u){var f=t.BINARIES[u[1]];return t.BINARIES[u[0]].split("").map(function(g,m){return(g==="1"?"111":"1")+(f[m]==="1"?"000":"0")}).join("")}}]),d})(r.default);return oi.default=c,oi}var ii={},op;function ey(){if(op)return ii;op=1,Object.defineProperty(ii,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=rp(),n=r(t);function r(s){return s&&s.__esModule?s:{default:s}}function o(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function i(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function a(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var l=function(d){var p=d.substr(0,13).split("").map(function(u){return parseInt(u,10)}).reduce(function(u,f,g){return u+f*(3-g%2*2)},0);return Math.ceil(p/10)*10-p},c=(function(s){a(d,s);function d(p,u){return o(this,d),p.search(/^[0-9]{13}$/)!==-1&&(p+=l(p)),i(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u))}return e(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===l(this.data)}}]),d})(n.default);return ii.default=c,ii}var ip;function ty(){if(ip)return yn;ip=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.ITF14=yn.ITF=void 0;var e=rp(),t=o(e),n=ey(),r=o(n);function o(i){return i&&i.__esModule?i:{default:i}}return yn.ITF=t.default,yn.ITF14=r.default,yn}var it={},ai={},ap;function Dr(){if(ap)return ai;ap=1,Object.defineProperty(ai,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=ot(),n=r(t);function r(s){return s&&s.__esModule?s:{default:s}}function o(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function i(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function a(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var l=(function(s){a(d,s);function d(p,u){return o(this,d),i(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u))}return e(d,[{key:"encode",value:function(){for(var u="110",f=0;f<this.data.length;f++){var g=parseInt(this.data[f]),m=g.toString(2);m=c(m,4-m.length);for(var b=0;b<m.length;b++)u+=m[b]=="0"?"100":"110"}return u+="1001",{data:u,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(n.default);function c(s,d){for(var p=0;p<d;p++)s="0"+s;return s}return ai.default=l,ai}var si={},$r={},sp;function li(){if(sp)return $r;sp=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.mod10=e,$r.mod11=t;function e(n){for(var r=0,o=0;o<n.length;o++){var i=parseInt(n[o]);(o+n.length)%2===0?r+=i:r+=i*2%10+Math.floor(i*2/10)}return(10-r%10)%10}function t(n){for(var r=0,o=[2,3,4,5,6,7],i=0;i<n.length;i++){var a=parseInt(n[n.length-1-i]);r+=o[i%o.length]*a}return(11-r%11)%11}return $r}var lp;function ny(){if(lp)return si;lp=1,Object.defineProperty(si,"__esModule",{value:!0});var e=Dr(),t=r(e),n=li();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d+(0,n.mod10)(d),p))}return s})(t.default);return si.default=l,si}var ci={},cp;function ry(){if(cp)return ci;cp=1,Object.defineProperty(ci,"__esModule",{value:!0});var e=Dr(),t=r(e),n=li();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d+(0,n.mod11)(d),p))}return s})(t.default);return ci.default=l,ci}var di={},dp;function oy(){if(dp)return di;dp=1,Object.defineProperty(di,"__esModule",{value:!0});var e=Dr(),t=r(e),n=li();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),d+=(0,n.mod10)(d),d+=(0,n.mod10)(d),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return s})(t.default);return di.default=l,di}var ui={},up;function iy(){if(up)return ui;up=1,Object.defineProperty(ui,"__esModule",{value:!0});var e=Dr(),t=r(e),n=li();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),d+=(0,n.mod11)(d),d+=(0,n.mod10)(d),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return s})(t.default);return ui.default=l,ui}var pp;function ay(){if(pp)return it;pp=1,Object.defineProperty(it,"__esModule",{value:!0}),it.MSI1110=it.MSI1010=it.MSI11=it.MSI10=it.MSI=void 0;var e=Dr(),t=d(e),n=ny(),r=d(n),o=ry(),i=d(o),a=oy(),l=d(a),c=iy(),s=d(c);function d(p){return p&&p.__esModule?p:{default:p}}return it.MSI=t.default,it.MSI10=r.default,it.MSI11=i.default,it.MSI1010=l.default,it.MSI1110=s.default,it}var Nr={},fp;function sy(){if(fp)return Nr;fp=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.pharmacode=void 0;var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=ot(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){o(this,s);var u=i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p));return u.number=parseInt(d,10),u}return e(s,[{key:"encode",value:function(){for(var p=this.number,u="";!isNaN(p)&&p!=0;)p%2===0?(u="11100"+u,p=(p-2)/2):(u="100"+u,p=(p-1)/2);return u=u.slice(0,-2),{data:u,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),s})(n.default);return Nr.pharmacode=l,Nr}var Lr={},hp;function ly(){if(hp)return Lr;hp=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.codabar=void 0;var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=ot(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){o(this,s),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var u=i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d.toUpperCase(),p));return u.text=u.options.text||u.text.replace(/[A-D]/g,""),u}return e(s,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var p=[],u=this.getEncodings(),f=0;f<this.data.length;f++)p.push(u[this.data.charAt(f)]),f!==this.data.length-1&&p.push("0");return{text:this.text,data:p.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),s})(n.default);return Lr.codabar=l,Lr}var vn={},pi={},jn={},gp;function cy(){return gp||(gp=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],jn.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],jn.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),jn}var mp;function bp(){if(mp)return pi;mp=1,Object.defineProperty(pi,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=cy(),n=ot(),r=o(n);function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u))}return e(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var u=this.data.split("").flatMap(function(b){return t.MULTI_SYMBOLS[b]||b}),f=u.map(function(b){return d.getEncoding(b)}).join(""),g=d.checksum(u,20),m=d.checksum(u.concat(g),15);return{text:this.text,data:d.getEncoding("ÿ")+f+d.getEncoding(g)+d.getEncoding(m)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(u){return t.BINARIES[d.symbolValue(u)]}},{key:"getSymbol",value:function(u){return t.SYMBOLS[u]}},{key:"symbolValue",value:function(u){return t.SYMBOLS.indexOf(u)}},{key:"checksum",value:function(u,f){var g=u.slice().reverse().reduce(function(m,b,v){var w=v%f+1;return m+d.symbolValue(b)*w},0);return d.getSymbol(g%47)}}]),d})(r.default);return pi.default=c,pi}var fi={},yp;function dy(){if(yp)return fi;yp=1,Object.defineProperty(fi,"__esModule",{value:!0});var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=bp(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return e(s,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),s})(n.default);return fi.default=l,fi}var vp;function uy(){if(vp)return vn;vp=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.CODE93FullASCII=vn.CODE93=void 0;var e=bp(),t=o(e),n=dy(),r=o(n);function o(i){return i&&i.__esModule?i:{default:i}}return vn.CODE93=t.default,vn.CODE93FullASCII=r.default,vn}var Fr={},wp;function py(){if(wp)return Fr;wp=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.GenericBarcode=void 0;var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=ot(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return e(s,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),s})(n.default);return Fr.GenericBarcode=l,Fr}var xp;function fy(){if(xp)return Uo;xp=1,Object.defineProperty(Uo,"__esModule",{value:!0});var e=B1(),t=G1(),n=J1(),r=ty(),o=ay(),i=sy(),a=ly(),l=uy(),c=py();return Uo.default={CODE39:e.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:n.EAN13,EAN8:n.EAN8,EAN5:n.EAN5,EAN2:n.EAN2,UPC:n.UPC,UPCE:n.UPCE,ITF14:r.ITF14,ITF:r.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:i.pharmacode,codabar:a.codabar,CODE93:l.CODE93,CODE93FullASCII:l.CODE93FullASCII,GenericBarcode:c.GenericBarcode},Uo}var hi={},Ep;function gi(){if(Ep)return hi;Ep=1,Object.defineProperty(hi,"__esModule",{value:!0});var e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t};return hi.default=function(t,n){return e({},t,n)},hi}var mi={},Sp;function hy(){if(Sp)return mi;Sp=1,Object.defineProperty(mi,"__esModule",{value:!0}),mi.default=e;function e(t){var n=[];function r(o){if(Array.isArray(o))for(var i=0;i<o.length;i++)r(o[i]);else o.text=o.text||"",o.data=o.data||"",n.push(o)}return r(t),n}return mi}var bi={},_p;function gy(){if(_p)return bi;_p=1,Object.defineProperty(bi,"__esModule",{value:!0}),bi.default=e;function e(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return bi}var yi={},vi={},wi={},Mp;function Tp(){if(Mp)return wi;Mp=1,Object.defineProperty(wi,"__esModule",{value:!0}),wi.default=e;function e(t){var n=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var r in n)n.hasOwnProperty(r)&&(r=n[r],typeof t[r]=="string"&&(t[r]=parseInt(t[r],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return wi}var xi={},kp;function Cp(){if(kp)return xi;kp=1,Object.defineProperty(xi,"__esModule",{value:!0});var e={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return xi.default=e,xi}var Ap;function my(){if(Ap)return vi;Ap=1,Object.defineProperty(vi,"__esModule",{value:!0});var e=Tp(),t=o(e),n=Cp(),r=o(n);function o(a){return a&&a.__esModule?a:{default:a}}function i(a){var l={};for(var c in r.default)r.default.hasOwnProperty(c)&&(a.hasAttribute("jsbarcode-"+c.toLowerCase())&&(l[c]=a.getAttribute("jsbarcode-"+c.toLowerCase())),a.hasAttribute("data-"+c.toLowerCase())&&(l[c]=a.getAttribute("data-"+c.toLowerCase())));return l.value=a.getAttribute("jsbarcode-value")||a.getAttribute("data-value"),l=(0,t.default)(l),l}return vi.default=i,vi}var Ei={},Si={},at={},Op;function Ip(){if(Op)return at;Op=1,Object.defineProperty(at,"__esModule",{value:!0}),at.getTotalWidthOfEncodings=at.calculateEncodingAttributes=at.getBarcodePadding=at.getEncodingHeight=at.getMaximumHeightOfEncodings=void 0;var e=gi(),t=n(e);function n(s){return s&&s.__esModule?s:{default:s}}function r(s,d){return d.height+(d.displayValue&&s.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function o(s,d,p){if(p.displayValue&&d<s){if(p.textAlign=="center")return Math.floor((s-d)/2);if(p.textAlign=="left")return 0;if(p.textAlign=="right")return Math.floor(s-d)}return 0}function i(s,d,p){for(var u=0;u<s.length;u++){var f=s[u],g=(0,t.default)(d,f.options),m;g.displayValue?m=c(f.text,g,p):m=0;var b=f.data.length*g.width;f.width=Math.ceil(Math.max(m,b)),f.height=r(f,g),f.barcodePadding=o(m,b,g)}}function a(s){for(var d=0,p=0;p<s.length;p++)d+=s[p].width;return d}function l(s){for(var d=0,p=0;p<s.length;p++)s[p].height>d&&(d=s[p].height);return d}function c(s,d,p){var u;if(p)u=p;else if(typeof document<"u")u=document.createElement("canvas").getContext("2d");else return 0;u.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var f=u.measureText(s);if(!f)return 0;var g=f.width;return g}return at.getMaximumHeightOfEncodings=l,at.getEncodingHeight=r,at.getBarcodePadding=o,at.calculateEncodingAttributes=i,at.getTotalWidthOfEncodings=a,at}var Rp;function by(){if(Rp)return Si;Rp=1,Object.defineProperty(Si,"__esModule",{value:!0});var e=(function(){function l(c,s){for(var d=0;d<s.length;d++){var p=s[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}return function(c,s,d){return s&&l(c.prototype,s),d&&l(c,d),c}})(),t=gi(),n=o(t),r=Ip();function o(l){return l&&l.__esModule?l:{default:l}}function i(l,c){if(!(l instanceof c))throw new TypeError("Cannot call a class as a function")}var a=(function(){function l(c,s,d){i(this,l),this.canvas=c,this.encodings=s,this.options=d}return e(l,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var s=0;s<this.encodings.length;s++){var d=(0,n.default)(this.options,this.encodings[s].options);this.drawCanvasBarcode(d,this.encodings[s]),this.drawCanvasText(d,this.encodings[s]),this.moveCanvasDrawing(this.encodings[s])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var s=this.canvas.getContext("2d");s.save(),(0,r.calculateEncodingAttributes)(this.encodings,this.options,s);var d=(0,r.getTotalWidthOfEncodings)(this.encodings),p=(0,r.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=p,s.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(s.fillStyle=this.options.background,s.fillRect(0,0,this.canvas.width,this.canvas.height)),s.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(s,d){var p=this.canvas.getContext("2d"),u=d.data,f;s.textPosition=="top"?f=s.marginTop+s.fontSize+s.textMargin:f=s.marginTop,p.fillStyle=s.lineColor;for(var g=0;g<u.length;g++){var m=g*s.width+d.barcodePadding;u[g]==="1"?p.fillRect(m,f,s.width,s.height):u[g]&&p.fillRect(m,f,s.width,s.height*u[g])}}},{key:"drawCanvasText",value:function(s,d){var p=this.canvas.getContext("2d"),u=s.fontOptions+" "+s.fontSize+"px "+s.font;if(s.displayValue){var f,g;s.textPosition=="top"?g=s.marginTop+s.fontSize-s.textMargin:g=s.height+s.textMargin+s.marginTop+s.fontSize,p.font=u,s.textAlign=="left"||d.barcodePadding>0?(f=0,p.textAlign="left"):s.textAlign=="right"?(f=d.width-1,p.textAlign="right"):(f=d.width/2,p.textAlign="center"),p.fillText(d.text,f,g)}}},{key:"moveCanvasDrawing",value:function(s){var d=this.canvas.getContext("2d");d.translate(s.width,0)}},{key:"restoreCanvas",value:function(){var s=this.canvas.getContext("2d");s.restore()}}]),l})();return Si.default=a,Si}var _i={},Pp;function yy(){if(Pp)return _i;Pp=1,Object.defineProperty(_i,"__esModule",{value:!0});var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=gi(),n=o(t),r=Ip();function o(c){return c&&c.__esModule?c:{default:c}}function i(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}var a="http://www.w3.org/2000/svg",l=(function(){function c(s,d,p){i(this,c),this.svg=s,this.encodings=d,this.options=p,this.document=p.xmlDocument||document}return e(c,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var p=0;p<this.encodings.length;p++){var u=this.encodings[p],f=(0,n.default)(this.options,u.options),g=this.createGroup(d,f.marginTop,this.svg);this.setGroupOptions(g,f),this.drawSvgBarcode(g,f,u),this.drawSVGText(g,f,u),d+=u.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,r.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,r.getTotalWidthOfEncodings)(this.encodings),p=(0,r.getMaximumHeightOfEncodings)(this.encodings),u=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(u,p),this.options.background&&this.drawRect(0,0,u,p,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,p,u){var f=u.data,g;p.textPosition=="top"?g=p.fontSize+p.textMargin:g=0;for(var m=0,b=0,v=0;v<f.length;v++)b=v*p.width+u.barcodePadding,f[v]==="1"?m++:m>0&&(this.drawRect(b-p.width*m,g,p.width*m,p.height,d),m=0);m>0&&this.drawRect(b-p.width*(m-1),g,p.width*m,p.height,d)}},{key:"drawSVGText",value:function(d,p,u){var f=this.document.createElementNS(a,"text");if(p.displayValue){var g,m;f.setAttribute("font-family",p.font),f.setAttribute("font-size",p.fontSize),p.fontOptions.includes("bold")&&f.setAttribute("font-weight","bold"),p.fontOptions.includes("italic")&&f.setAttribute("font-style","italic"),p.textPosition=="top"?m=p.fontSize-p.textMargin:m=p.height+p.textMargin+p.fontSize,p.textAlign=="left"||u.barcodePadding>0?(g=0,f.setAttribute("text-anchor","start")):p.textAlign=="right"?(g=u.width-1,f.setAttribute("text-anchor","end")):(g=u.width/2,f.setAttribute("text-anchor","middle")),f.setAttribute("x",g),f.setAttribute("y",m),f.appendChild(this.document.createTextNode(u.text)),d.appendChild(f)}}},{key:"setSvgAttributes",value:function(d,p){var u=this.svg;u.setAttribute("width",d+"px"),u.setAttribute("height",p+"px"),u.setAttribute("x","0px"),u.setAttribute("y","0px"),u.setAttribute("viewBox","0 0 "+d+" "+p),u.setAttribute("xmlns",a),u.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,p,u){var f=this.document.createElementNS(a,"g");return f.setAttribute("transform","translate("+d+", "+p+")"),u.appendChild(f),f}},{key:"setGroupOptions",value:function(d,p){d.setAttribute("fill",p.lineColor)}},{key:"drawRect",value:function(d,p,u,f,g){var m=this.document.createElementNS(a,"rect");return m.setAttribute("x",d),m.setAttribute("y",p),m.setAttribute("width",u),m.setAttribute("height",f),g.appendChild(m),m}}]),c})();return _i.default=l,_i}var Mi={},Dp;function vy(){if(Dp)return Mi;Dp=1,Object.defineProperty(Mi,"__esModule",{value:!0});var e=(function(){function r(o,i){for(var a=0;a<i.length;a++){var l=i[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}return function(o,i,a){return i&&r(o.prototype,i),a&&r(o,a),o}})();function t(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}var n=(function(){function r(o,i,a){t(this,r),this.object=o,this.encodings=i,this.options=a}return e(r,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),r})();return Mi.default=n,Mi}var $p;function wy(){if($p)return Ei;$p=1,Object.defineProperty(Ei,"__esModule",{value:!0});var e=by(),t=a(e),n=yy(),r=a(n),o=vy(),i=a(o);function a(l){return l&&l.__esModule?l:{default:l}}return Ei.default={CanvasRenderer:t.default,SVGRenderer:r.default,ObjectRenderer:i.default},Ei}var Gn={},Np;function Lp(){if(Np)return Gn;Np=1,Object.defineProperty(Gn,"__esModule",{value:!0});function e(a,l){if(!(a instanceof l))throw new TypeError("Cannot call a class as a function")}function t(a,l){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l&&(typeof l=="object"||typeof l=="function")?l:a}function n(a,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof l);a.prototype=Object.create(l&&l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(a,l):a.__proto__=l)}var r=(function(a){n(l,a);function l(c,s){e(this,l);var d=t(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return d.name="InvalidInputException",d.symbology=c,d.input=s,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return l})(Error),o=(function(a){n(l,a);function l(){e(this,l);var c=t(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return c.name="InvalidElementException",c.message="Not supported type to render on",c}return l})(Error),i=(function(a){n(l,a);function l(){e(this,l);var c=t(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return c.name="NoElementException",c.message="No element to render on.",c}return l})(Error);return Gn.InvalidInputException=r,Gn.InvalidElementException=o,Gn.NoElementException=i,Gn}var Fp;function xy(){if(Fp)return yi;Fp=1,Object.defineProperty(yi,"__esModule",{value:!0});var e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=my(),n=a(t),r=wy(),o=a(r),i=Lp();function a(d){return d&&d.__esModule?d:{default:d}}function l(d){if(typeof d=="string")return c(d);if(Array.isArray(d)){for(var p=[],u=0;u<d.length;u++)p.push(l(d[u]));return p}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return s(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,n.default)(d),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,n.default)(d),renderer:o.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:o.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":e(d))==="object"&&!d.nodeName)return{element:d,renderer:o.default.ObjectRenderer};throw new i.InvalidElementException}}function c(d){var p=document.querySelectorAll(d);if(p.length!==0){for(var u=[],f=0;f<p.length;f++)u.push(l(p[f]));return u}}function s(d){var p=document.createElement("canvas");return{element:p,options:(0,n.default)(d),renderer:o.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",p.toDataURL())}}}return yi.default=l,yi}var Ti={},zp;function Ey(){if(zp)return Ti;zp=1,Object.defineProperty(Ti,"__esModule",{value:!0});var e=(function(){function r(o,i){for(var a=0;a<i.length;a++){var l=i[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}return function(o,i,a){return i&&r(o.prototype,i),a&&r(o,a),o}})();function t(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}var n=(function(){function r(o){t(this,r),this.api=o}return e(r,[{key:"handleCatch",value:function(i){if(i.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw i.message;else throw i;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(i){try{var a=i.apply(void 0,arguments);return this.api._options.valid(!0),a}catch(l){return this.handleCatch(l),this.api}}}]),r})();return Ti.default=n,Ti}var us,Bp;function Sy(){if(Bp)return us;Bp=1;var e=fy(),t=v(e),n=gi(),r=v(n),o=hy(),i=v(o),a=gy(),l=v(a),c=xy(),s=v(c),d=Tp(),p=v(d),u=Ey(),f=v(u),g=Lp(),m=Cp(),b=v(m);function v(T){return T&&T.__esModule?T:{default:T}}var w=function(){},E=function(I,S,$){var D=new w;if(typeof I>"u")throw Error("No element to render on was provided.");return D._renderProperties=(0,s.default)(I),D._encodings=[],D._options=b.default,D._errorHandler=new f.default(D),typeof S<"u"&&($=$||{},$.format||($.format=P()),D.options($)[$.format](S,$).render()),D};E.getModule=function(T){return t.default[T]};for(var C in t.default)t.default.hasOwnProperty(C)&&F(t.default,C);function F(T,I){w.prototype[I]=w.prototype[I.toUpperCase()]=w.prototype[I.toLowerCase()]=function(S,$){var D=this;return D._errorHandler.wrapBarcodeCall(function(){$.text=typeof $.text>"u"?void 0:""+$.text;var B=(0,r.default)(D._options,$);B=(0,p.default)(B);var _=T[I],ie=N(S,_,B);return D._encodings.push(ie),D})}}function N(T,I,S){T=""+T;var $=new I(T,S);if(!$.valid())throw new g.InvalidInputException($.constructor.name,T);var D=$.encode();D=(0,i.default)(D);for(var B=0;B<D.length;B++)D[B].options=(0,r.default)(S,D[B].options);return D}function P(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}w.prototype.options=function(T){return this._options=(0,r.default)(this._options,T),this},w.prototype.blank=function(T){var I=new Array(T+1).join("0");return this._encodings.push({data:I}),this},w.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var T;for(var I in this._renderProperties){T=this._renderProperties[I];var S=(0,r.default)(this._options,T.options);S.format=="auto"&&(S.format=P()),this._errorHandler.wrapBarcodeCall(function(){var $=S.value,D=t.default[S.format.toUpperCase()],B=N($,D,S);O(T,B,S)})}}},w.prototype.render=function(){if(!this._renderProperties)throw new g.NoElementException;if(Array.isArray(this._renderProperties))for(var T=0;T<this._renderProperties.length;T++)O(this._renderProperties[T],this._encodings,this._options);else O(this._renderProperties,this._encodings,this._options);return this},w.prototype._defaults=b.default;function O(T,I,S){I=(0,i.default)(I);for(var $=0;$<I.length;$++)I[$].options=(0,r.default)(S,I[$].options),(0,l.default)(I[$].options);(0,l.default)(S);var D=T.renderer,B=new D(T.element,I,S);B.render(),T.afterRender&&T.afterRender()}return typeof window<"u"&&(window.JsBarcode=E),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(T,I){var S=[];return jQuery(this).each(function(){S.push(this)}),E(S,T,I)}),us=E,us}var _y=Sy();const ps=Ru(_y);var Vn={},fs,Hp;function My(){return Hp||(Hp=1,fs=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),fs}var hs={},Jt={},Up;function wn(){if(Up)return Jt;Up=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Jt.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},Jt.getSymbolTotalCodewords=function(r){return t[r]},Jt.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},Jt.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},Jt.isKanjiModeEnabled=function(){return typeof e<"u"},Jt.toSJIS=function(r){return e(r)},Jt}var gs={},qp;function ms(){return qp||(qp=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,o){if(e.isValid(r))return r;try{return t(r)}catch{return o}}})(gs)),gs}var bs,Wp;function Ty(){if(Wp)return bs;Wp=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},bs=e,bs}var ys,jp;function ky(){if(jp)return ys;jp=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,r,o){const i=t*this.size+n;this.data[i]=r,o&&(this.reservedBit[i]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},ys=e,ys}var vs={},Gp;function Cy(){return Gp||(Gp=1,(function(e){const t=wn().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,i=t(r),a=i===145?26:Math.ceil((i-13)/(2*o-2))*2,l=[i-7];for(let c=1;c<o-1;c++)l[c]=l[c-1]-a;return l.push(6),l.reverse()},e.getPositions=function(r){const o=[],i=e.getRowColCoords(r),a=i.length;for(let l=0;l<a;l++)for(let c=0;c<a;c++)l===0&&c===0||l===0&&c===a-1||l===a-1&&c===0||o.push([i[l],i[c]]);return o}})(vs)),vs}var ws={},Vp;function Ay(){if(Vp)return ws;Vp=1;const e=wn().getSymbolSize,t=7;return ws.getPositions=function(r){const o=e(r);return[[0,0],[o-t,0],[0,o-t]]},ws}var xs={},Yp;function Oy(){return Yp||(Yp=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const i=o.size;let a=0,l=0,c=0,s=null,d=null;for(let p=0;p<i;p++){l=c=0,s=d=null;for(let u=0;u<i;u++){let f=o.get(p,u);f===s?l++:(l>=5&&(a+=t.N1+(l-5)),s=f,l=1),f=o.get(u,p),f===d?c++:(c>=5&&(a+=t.N1+(c-5)),d=f,c=1)}l>=5&&(a+=t.N1+(l-5)),c>=5&&(a+=t.N1+(c-5))}return a},e.getPenaltyN2=function(o){const i=o.size;let a=0;for(let l=0;l<i-1;l++)for(let c=0;c<i-1;c++){const s=o.get(l,c)+o.get(l,c+1)+o.get(l+1,c)+o.get(l+1,c+1);(s===4||s===0)&&a++}return a*t.N2},e.getPenaltyN3=function(o){const i=o.size;let a=0,l=0,c=0;for(let s=0;s<i;s++){l=c=0;for(let d=0;d<i;d++)l=l<<1&2047|o.get(s,d),d>=10&&(l===1488||l===93)&&a++,c=c<<1&2047|o.get(d,s),d>=10&&(c===1488||c===93)&&a++}return a*t.N3},e.getPenaltyN4=function(o){let i=0;const a=o.data.length;for(let c=0;c<a;c++)i+=o.data[c];return Math.abs(Math.ceil(i*100/a/5)-10)*t.N4};function n(r,o,i){switch(r){case e.Patterns.PATTERN000:return(o+i)%2===0;case e.Patterns.PATTERN001:return o%2===0;case e.Patterns.PATTERN010:return i%3===0;case e.Patterns.PATTERN011:return(o+i)%3===0;case e.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(i/3))%2===0;case e.Patterns.PATTERN101:return o*i%2+o*i%3===0;case e.Patterns.PATTERN110:return(o*i%2+o*i%3)%2===0;case e.Patterns.PATTERN111:return(o*i%3+(o+i)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(o,i){const a=i.size;for(let l=0;l<a;l++)for(let c=0;c<a;c++)i.isReserved(c,l)||i.xor(c,l,n(o,c,l))},e.getBestMask=function(o,i){const a=Object.keys(e.Patterns).length;let l=0,c=1/0;for(let s=0;s<a;s++){i(s),e.applyMask(s,o);const d=e.getPenaltyN1(o)+e.getPenaltyN2(o)+e.getPenaltyN3(o)+e.getPenaltyN4(o);e.applyMask(s,o),d<c&&(c=d,l=s)}return l}})(xs)),xs}var ki={},Kp;function Xp(){if(Kp)return ki;Kp=1;const e=ms(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return ki.getBlocksCount=function(o,i){switch(i){case e.L:return t[(o-1)*4+0];case e.M:return t[(o-1)*4+1];case e.Q:return t[(o-1)*4+2];case e.H:return t[(o-1)*4+3];default:return}},ki.getTotalCodewordsCount=function(o,i){switch(i){case e.L:return n[(o-1)*4+0];case e.M:return n[(o-1)*4+1];case e.Q:return n[(o-1)*4+2];case e.H:return n[(o-1)*4+3];default:return}},ki}var Es={},zr={},Zp;function Iy(){if(Zp)return zr;Zp=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let o=0;o<255;o++)e[o]=r,t[r]=o,r<<=1,r&256&&(r^=285);for(let o=255;o<512;o++)e[o]=e[o-255]})(),zr.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},zr.exp=function(r){return e[r]},zr.mul=function(r,o){return r===0||o===0?0:e[t[r]+t[o]]},zr}var Jp;function Ry(){return Jp||(Jp=1,(function(e){const t=Iy();e.mul=function(r,o){const i=new Uint8Array(r.length+o.length-1);for(let a=0;a<r.length;a++)for(let l=0;l<o.length;l++)i[a+l]^=t.mul(r[a],o[l]);return i},e.mod=function(r,o){let i=new Uint8Array(r);for(;i.length-o.length>=0;){const a=i[0];for(let c=0;c<o.length;c++)i[c]^=t.mul(o[c],a);let l=0;for(;l<i.length&&i[l]===0;)l++;i=i.slice(l)}return i},e.generateECPolynomial=function(r){let o=new Uint8Array([1]);for(let i=0;i<r;i++)o=e.mul(o,new Uint8Array([1,t.exp(i)]));return o}})(Es)),Es}var Ss,Qp;function Py(){if(Qp)return Ss;Qp=1;const e=Ry();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(r.length+this.degree);o.set(r);const i=e.mod(o,this.genPoly),a=this.degree-i.length;if(a>0){const l=new Uint8Array(this.degree);return l.set(i,a),l}return i},Ss=t,Ss}var _s={},Ms={},Ts={},ef;function tf(){return ef||(ef=1,Ts.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ts}var It={},nf;function rf(){if(nf)return It;nf=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
|
|
264
|
-
]))+`;
|
|
265
|
-
Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),r.put(i,13)}},
|
|
266
|
-
Suggested mode is: `+t.toString(
|
|
261
|
+
${u}
|
|
262
|
+
</section>`:u}).join(`
|
|
263
|
+
`),o=e.reduce((c,s)=>c+s.layoutsPerPage.reduce((d,p)=>d+p.length,0),0),i=[],a=[];let l=0;for(const c of e)for(const[s,d]of c.layoutsPerPage.entries()){const p=gn(c.boundPages[s]);for(const u of d)i.push({...u,pageIndex:l++}),a.push({...p})}return{html:No(n,r),pageCount:o,pagePaperMm:a,pageLayouts:i}}async function g1(e,t){return t.withSession(e,n=>m1(e,n))}async function m1(e,t){const n=ls(e.templateJson);if(n.length>1){const c=uu(e.printData),s=c.mode==="batch"?c.dataList:[c.data],d=[];for(let u=0;u<s.length;u++)try{d.push(await y1(e,t,s[u]))}catch(f){const g=f instanceof Error?f.message:String(f);throw new Error(`第 ${u+1} 份渲染失败:${g}`)}const p=h1(d);return{html:p.html,pageCount:p.pageCount,paperMm:gn(n[0]),pagePaperMm:p.pagePaperMm,continuous:!1,heightSource:"config",pageLayouts:p.pageLayouts,copies:d.length}}const r=n[0]!==e.templateJson?{...e,templateJson:n[0]}:e,o=n[0],i=uu(r.printData);if(i.mode==="single"){const c=await bu(r,t,i.data);return o.tiling?.enabled===!0?mu(r,[{bound:c.bound,pageLayouts:c.pageLayouts,data:i.data,codeRenderer:c.codeRenderer,renderers:c.renderers,derivedHeightMm:c.derivedHeightMm,paperMm:c.paperMm,heightSource:c.heightSource}]):b1(c)}const a=[];for(let c=0;c<i.dataList.length;c++)try{const s=await bu(r,t,i.dataList[c]);a.push({bound:s.bound,pageLayouts:s.pageLayouts,data:i.dataList[c],codeRenderer:s.codeRenderer,renderers:s.renderers,derivedHeightMm:s.derivedHeightMm,paperMm:s.paperMm,heightSource:s.heightSource})}catch(s){const d=s instanceof Error?s.message:String(s);throw new Error(`第 ${c+1} 份渲染失败:${d}`)}if(o.tiling?.enabled===!0)return mu(r,a);const l=a1(a);return{html:l.html,pageCount:l.pageCount,paperMm:a[0].paperMm,continuous:At(a[0].bound),heightSource:a[0].heightSource,pageLayouts:a.flatMap(c=>c.pageLayouts),copies:a.length,copyPaperMm:l.copyPaperMm}}function b1(e){return{html:e.html,pageCount:e.pageCount,paperMm:e.paperMm,continuous:e.continuous,heightSource:e.heightSource,pageLayouts:e.pageLayouts,copies:1}}function mu(e,t){const n=t[0].bound,r=hu(n,{paperOverride:e.paperOverride});t.forEach((i,a)=>{const l=i.pageLayouts[0]?.overflow===!0;if(i.pageLayouts.length!==1||l){const c=l?"内容超出纸张高度":`渲染出 ${i.pageLayouts.length} 页`;throw new Error(`拼版要求每份标签恰好 1 页,第 ${a+1} 份${c};请缩小内容或调整标签纸张高度`)}});const o=u1({copies:t.map(i=>({bound:i.bound,pageLayouts:i.pageLayouts,data:i.data,codeRenderer:i.codeRenderer,renderers:i.renderers})),layout:r});return{html:o.html,pageCount:o.sheetCount,paperMm:{width:r.sheet.width,height:r.sheet.height},continuous:!1,heightSource:"config",pageLayouts:t.flatMap(i=>i.pageLayouts),copies:t.length}}async function bu(e,t,n){const r=Ad(e.templateJson,n,e.baseUrl,e.fontBaseUrl),o=At(r),i=ht(r),a=au(i),l=Yb({paperHeightMm:e.paperHeightMm,override:e.paperOverride}),c=await Ho({bound:r,job:e,session:t,data:n,pageLayouts:[],isMeasurementPass:!0}),s=await t.measure(c.html,a);lu(r,s.fits);const d=xa(r,su(s.measurements,r)),p=await Ho({bound:r,job:e,session:t,data:n,pageLayouts:d,isMeasurementPass:!1,codeBaseMap:c.codeMap,assetBaseMap:c.assetMap});let u=p.html,f;if(o){if(l&&l>0)f=l;else{const w=await t.probeContentBottom(u,a);f=Vb(r,os(w))}u=Do(r,d,n,{codeRenderer:p.codeRenderer,renderers:p.renderers,pageHeightMm:f})}const g=o&&l?{...e.paperOverride,height:l}:e.paperOverride,m=gn(r),{paperMm:b,heightSource:v}=Kb({paperMm:{width:m.width,height:f??m.height},continuous:o,override:g});return{html:u,pageCount:d.length,paperMm:b,continuous:o,heightSource:v,pageLayouts:d,copies:1,bound:r,codeRenderer:p.codeRenderer,renderers:p.renderers,derivedHeightMm:f}}async function y1(e,t,n){const r=ls(e.templateJson),o=[],i=[],a=[],l=[];for(const c of r){const s=au(ht(c)),d=Ad(c,n,e.baseUrl,e.fontBaseUrl),p=await Ho({bound:d,job:e,session:t,data:n,pageLayouts:[],isMeasurementPass:!0}),u=await t.measure(p.html,s);lu(d,u.fits);const f=xa(d,su(u.measurements,d)),g=await Ho({bound:d,job:e,session:t,data:n,pageLayouts:f,isMeasurementPass:!1,codeBaseMap:p.codeMap,assetBaseMap:p.assetMap});o.push(d),i.push(f),a.push(g.codeRenderer),l.push(g.renderers)}return{boundPages:o,layoutsPerPage:i,data:n,codeRenderers:a,renderersPerPage:l}}async function Ho(e){const t=e.codeBaseMap??new Map,n=e.assetBaseMap??new Map,{job:r}=e,o=xb(),i=r.renderers;if(r.codeRenderer&&(o.length===0||i))return{html:Do(e.bound,e.pageLayouts,e.data,{isMeasurementPass:e.isMeasurementPass,codeRenderer:r.codeRenderer,renderers:i}),codeRenderer:r.codeRenderer,renderers:i,codeMap:t,assetMap:n};const a=Qb(t),l=vb(n),c=r.codeRenderer??a.renderer,s=i??(o.length>0?Xd(l.renderer,o):void 0),d=Do(e.bound,e.pageLayouts,e.data,{isMeasurementPass:e.isMeasurementPass,codeRenderer:c,renderers:s}),p=r.codeRenderer?[]:a.takeSpecs(),u=i?[]:l.takeSpecs(),[f,g]=await Promise.all([p.length>0?e.session.renderCodes(p):Promise.resolve(new Map),Sb(u,e.session)]),m=e1(t,f),b=Kd(n,g),v=r.codeRenderer??(m.size>0?Jb(m):void 0),w=i??(b.size>0?Xd(wb(b),o):s);return p.length===0&&u.length===0?{html:d,codeRenderer:v,renderers:w,codeMap:m,assetMap:b}:{html:Do(e.bound,e.pageLayouts,e.data,{isMeasurementPass:e.isMeasurementPass,codeRenderer:v,renderers:w}),codeRenderer:v,renderers:w,codeMap:m,assetMap:b}}class v1{constructor(t){this.functions={},t?.functions&&(this.functions={...t.functions})}registerFunction(t,n){this.functions[t]=n}evaluate(t,n){const r=Da(t),o=$a(r);return Ke(o,n,this.functions)}render(t,n){return hd(t,this.functions)(n)}}const yu=new v1,w1={MONEY:gd,CONCAT:(...e)=>e.filter(t=>t!=null).join(""),IF:yd,FORMAT:e=>typeof e!="number"?String(e):e.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2}),SUBSTR:(e,t,n)=>String(e).slice(t,n?t+n:void 0),LEN:e=>String(e).length,ADD:Sd,SUB:_d,MUL:Md,DIV:Td,ROUND:kd,ROUNDUP:ko,CEIL:ko,ROUNDDOWN:Co,FLOOR:Co,ROUNDBANK:Cd,NOW:()=>new Date().toISOString().split("T")[0],IFEMPTY:(e,t)=>e!=null&&e!==""?String(e):t,PAD:(e,t,n)=>String(e).padStart(t,n),REPLACE:(e,t,n)=>String(e).replace(new RegExp(t,"g"),n),JSON:e=>JSON.stringify(e,null,2),DATE:md,UPPER:bd};for(const[e,t]of Object.entries(w1))yu.registerFunction(e,t);function x1(e,t,n){switch(e.toUpperCase()){case"SUM":return Ha(n,t);case"AVG":return vd(n,t);case"COUNT":return wd(n);case"MIN":return xd(n,t);case"MAX":return Ed(n,t);default:return 0}}function Wn(e,t){if(!e)return"";if(!e.includes("{"))return e;const n=Array.isArray(t.rows)?t.rows:[];let r=e.replace(/\{([^}]+)\}/g,(o,i)=>{let a=i.trim();return a=a.replace(/\b(SUM|AVG|COUNT|MIN|MAX)\(([^)]+)\)/g,(l,c,s)=>{const d=s.trim().replace(/^['"]|['"]$/g,"");return String(x1(c,d,n))}),`{${a}}`});try{return yu.render(r,t)}catch{return e}}const gt={supplier:{name:"鑫达五金有限公司",phone:"0571-88776655",address:"杭州市萧山区经济开发区88号"},receiver:{name:"李四",phone:"13912345678",address:"杭州市余杭区文一西路998号"},order:{no:"PO20260801001",date:"2026-08-01",total:69543.75},goods:[{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:100,price:.5,amount:50,remark:"A级"},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:117,price:.75,amount:87.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:134,price:1,amount:134,remark:""},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:151,price:1.25,amount:188.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:168,price:1.5,amount:252,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:185,price:1.75,amount:323.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:202,price:2,amount:404,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:219,price:2.25,amount:492.75,remark:"A级"},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:236,price:2.5,amount:590,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:253,price:2.75,amount:695.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×20",unit:"个",qty:270,price:3,amount:810,remark:""},{name:"不锈钢螺母 M10",spec:"M16×21",unit:"套",qty:287,price:3.25,amount:932.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×22",unit:"盒",qty:304,price:3.5,amount:1064,remark:""},{name:"六角螺栓 M14",spec:"M5×23",unit:"支",qty:321,price:3.75,amount:1203.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×24",unit:"袋",qty:338,price:4,amount:1352,remark:"A级"},{name:"平垫圈 M6",spec:"M4×25",unit:"件",qty:355,price:4.25,amount:1508.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×26",unit:"根",qty:372,price:4.5,amount:1674,remark:""},{name:"双头螺柱 M20",spec:"M8×27",unit:"包",qty:389,price:4.75,amount:1847.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×28",unit:"只",qty:406,price:5,amount:2030,remark:""},{name:"十字盘头钉 M3",spec:"M12×29",unit:"组",qty:423,price:5.25,amount:2220.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×30",unit:"个",qty:440,price:.5,amount:220,remark:""},{name:"不锈钢螺母 M10",spec:"M16×31",unit:"套",qty:457,price:.75,amount:342.75,remark:"A级"},{name:"弹簧垫圈 M12",spec:"M6×32",unit:"盒",qty:474,price:1,amount:474,remark:""},{name:"六角螺栓 M14",spec:"M5×33",unit:"支",qty:491,price:1.25,amount:613.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×34",unit:"袋",qty:508,price:1.5,amount:762,remark:""},{name:"平垫圈 M6",spec:"M4×35",unit:"件",qty:525,price:1.75,amount:918.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×36",unit:"根",qty:542,price:2,amount:1084,remark:""},{name:"双头螺柱 M20",spec:"M8×37",unit:"包",qty:559,price:2.25,amount:1257.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×38",unit:"只",qty:576,price:2.5,amount:1440,remark:"A级"},{name:"十字盘头钉 M3",spec:"M12×39",unit:"组",qty:593,price:2.75,amount:1630.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×40",unit:"个",qty:610,price:3,amount:1830,remark:""},{name:"不锈钢螺母 M10",spec:"M16×41",unit:"套",qty:627,price:3.25,amount:2037.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×42",unit:"盒",qty:644,price:3.5,amount:2254,remark:""},{name:"六角螺栓 M14",spec:"M5×43",unit:"支",qty:661,price:3.75,amount:2478.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×44",unit:"袋",qty:678,price:4,amount:2712,remark:""},{name:"平垫圈 M6",spec:"M4×45",unit:"件",qty:695,price:4.25,amount:2953.75,remark:"A级"},{name:"自攻螺钉 M5",spec:"M3×46",unit:"根",qty:712,price:4.5,amount:3204,remark:""},{name:"双头螺柱 M20",spec:"M8×47",unit:"包",qty:729,price:4.75,amount:3462.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×48",unit:"只",qty:746,price:5,amount:3730,remark:""},{name:"十字盘头钉 M3",spec:"M12×49",unit:"组",qty:763,price:5.25,amount:4005.75,remark:""},{name:"碳钢螺丝 M8",spec:"M14×10",unit:"个",qty:780,price:.5,amount:390,remark:""},{name:"不锈钢螺母 M10",spec:"M16×11",unit:"套",qty:797,price:.75,amount:597.75,remark:""},{name:"弹簧垫圈 M12",spec:"M6×12",unit:"盒",qty:814,price:1,amount:814,remark:"A级"},{name:"六角螺栓 M14",spec:"M5×13",unit:"支",qty:831,price:1.25,amount:1038.75,remark:""},{name:"内六角螺钉 M16",spec:"M20×14",unit:"袋",qty:848,price:1.5,amount:1272,remark:""},{name:"平垫圈 M6",spec:"M4×15",unit:"件",qty:865,price:1.75,amount:1513.75,remark:""},{name:"自攻螺钉 M5",spec:"M3×16",unit:"根",qty:882,price:2,amount:1764,remark:""},{name:"双头螺柱 M20",spec:"M8×17",unit:"包",qty:899,price:2.25,amount:2022.75,remark:""},{name:"紧定螺钉 M4",spec:"M10×18",unit:"只",qty:916,price:2.5,amount:2290,remark:""},{name:"十字盘头钉 M3",spec:"M12×19",unit:"组",qty:933,price:2.75,amount:2565.75,remark:"A级"}]},Uo={left:0,center:50,right:100},qo={top:0,center:50,bottom:100};function jn(e){return Number.isFinite(e)?Math.round(Math.min(100,Math.max(0,e))):50}function vu(e){return Math.round(e*100)/100}function wu(e,t){const n=jn(e),r=jn(t);if(!(n===50&&r===50))return`${n}% ${r}%`}function E1(e){return/^\d+(?:\.\d+)?%$/.test(e)?parseFloat(e):void 0}function S1(e){const t=(e??"").trim();if(!t)return{kind:"empty"};const n=t.toLowerCase().split(/\s+/);let r,o;for(let i=0;i<n.length;i++){const a=n[i],l=E1(a);if(i===0)if(a in Uo)r=Uo[a];else if(l!==void 0)r=l;else if(a in qo)o=qo[a];else return{kind:"custom",raw:e};else if(a in qo&&o===void 0)o=qo[a];else if(l!==void 0&&r===void 0)r=l;else if(l!==void 0&&o===void 0)o=l;else if(a in Uo&&r===void 0)r=Uo[a];else return{kind:"custom",raw:e}}return{kind:"axes",x:jn(r??50),y:jn(o??50)}}const xu=25.4/96;function Eu(e){const{widthMm:t,heightMm:n,naturalWidth:r,naturalHeight:o}=e;if(!r||!o||!t||!n)return null;const i=t/r,a=n/o,l=(Pc(e.fit,e.scalePct)??gr)/100;switch(e.fit||"contain"){case"fill":return{w:t,h:n};case"cover":{const c=Math.max(i,a)*l;return{w:r*c,h:o*c}}case"none":return{w:r*xu,h:o*xu};case"scale-down":{const c=Math.min(1,Math.min(i,a));return{w:r*c,h:o*c}}default:{const c=Math.min(i,a);return{w:r*c,h:o*c}}}}function _1(e){const t=Eu(e);return t?{x:vu(Math.abs(e.widthMm-t.w)),y:vu(Math.abs(e.heightMm-t.h))}:{x:null,y:null}}function M1(e,t,n){const r=Eu(e);if(!r)return null;const o=Math.min(1,e.widthMm/r.w),i=Math.min(1,e.heightMm/r.h);return{leftPct:(1-o)*jn(t),topPct:(1-i)*jn(n),widthPct:o*100,heightPct:i*100}}function Su(e){const t=String(e??"");return t?t.includes("{")?String(Wn(t,gt)):t:""}const _u={vertical:[{value:0,label:"顶部"},{value:50,label:"居中"},{value:100,label:"底部"}],horizontal:[{value:0,label:"左侧"},{value:50,label:"居中"},{value:100,label:"右侧"}]},T1=[{x:0,y:0,label:"左上"},{x:50,y:0,label:"上中"},{x:100,y:0,label:"右上"},{x:0,y:50,label:"左中"},{x:50,y:50,label:"居中"},{x:100,y:50,label:"右中"},{x:0,y:100,label:"左下"},{x:50,y:100,label:"下中"},{x:100,y:100,label:"右下"}],cs=[{value:"contain",label:"包含(保持比例)"},{value:"cover",label:"剪裁(等比铺满后裁边)"},{value:"fill",label:"拉伸填满"},{value:"none",label:"原始尺寸"},{value:"scale-down",label:"缩小(保持比例)"}],k1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+PHJlY3Qgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIGZpbGw9IiNmZmZmZmYiLz48cGF0aCBkPSJNNDAgMFYxMjBNODAgMFYxMjBNMCA0MEgxMjBNMCA4MEgxMjAiIHN0cm9rZT0iI2VlZjFmNiIgc3Ryb2tlLXdpZHRoPSIxIi8+PGNpcmNsZSBjeD0iMjAiIGN5PSIyMCIgcj0iMy41IiBmaWxsPSIjOGI5NWE1Ii8+PGNpcmNsZSBjeD0iMTAwIiBjeT0iMjAiIHI9IjMuNSIgZmlsbD0iIzhiOTVhNSIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iMTAwIiByPSIzLjUiIGZpbGw9IiM4Yjk1YTUiLz48Y2lyY2xlIGN4PSIxMDAiIGN5PSIxMDAiIHI9IjMuNSIgZmlsbD0iIzhiOTVhNSIvPjxjaXJjbGUgY3g9IjYwIiBjeT0iMjAiIHI9IjciIGZpbGw9IiNjMDM5MmIiLz48Y2lyY2xlIGN4PSI2MCIgY3k9IjEwMCIgcj0iNyIgZmlsbD0iIzFmNGZhMyIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iNjAiIHI9IjciIGZpbGw9IiMyYzdhNGEiLz48Y2lyY2xlIGN4PSIxMDAiIGN5PSI2MCIgcj0iNyIgZmlsbD0iI2UwN2EyMCIvPjxjaXJjbGUgY3g9IjYwIiBjeT0iNjAiIHI9IjE0IiBmaWxsPSJub25lIiBzdHJva2U9IiMyZjNhNGEiIHN0cm9rZS13aWR0aD0iNCIvPjxjaXJjbGUgY3g9IjYwIiBjeT0iNjAiIHI9IjYiIGZpbGw9IiMyZjNhNGEiLz48L3N2Zz4=",C1="图片还没设置,上面按内置示例图演示取位;换上真图后档位与可挪量按真图重算";function A1(e){const t=String(e??"").trim();return!t||t.includes("{")||t.includes("}")?{src:k1,isSample:!0}:{src:t,isSample:!1}}function Mu(e){return e==="vertical"?"垂直位置 (%)":"水平位置 (%)"}const O1="放大比例 (%)";function I1(e,t=!1){if(t)return"已保留模板里的原值;改动下面任一项就整体替换成新的取位";const{x:n,y:r}=e;return n===null||r===null?"":n>0&&r>0?`水平可挪 ${n}mm、垂直可挪 ${r}mm:0 贴左/贴顶,100 贴右/贴底`:n>0?`水平可挪 ${n}mm;垂直这一轴已贴满,挪不动`:r>0?`垂直可挪 ${r}mm;水平这一轴已贴满,挪不动`:"这个缩放下图与框正好一样大,两轴都没有可挪的余量"}function P1(e,t,n){return[{name:"horizontal",label:Mu("horizontal"),value:t,travelMm:e.x},{name:"vertical",label:Mu("vertical"),value:n,travelMm:e.y}]}function R1(e,t,n){const r=e.x!==null&&e.x>0,o=e.y!==null&&e.y>0;return o&&!r?_u.vertical.map(i=>({value:`${t},${i.value}`,label:i.label})):r&&!o?_u.horizontal.map(i=>({value:`${i.value},${n}`,label:i.label})):T1.map(i=>({value:`${i.x},${i.y}`,label:i.label}))}function Tu(e){const t=[...e].sort((a,l)=>(a.sortOrder??0)-(l.sortOrder??0)),n=new Map,r=[];for(const a of t){const l=a.fieldKey.indexOf(".");if(l===-1)continue;const c=a.fieldKey.slice(0,l);let s=n.get(c);s||(s={key:c,label:c,isList:!1,fields:[]},n.set(c,s),r.push(c)),s.fields.push(a)}const o=[],i=[];for(const a of t){if(a.fieldKey.includes("."))continue;const l=n.get(a.fieldKey);l?(l.label=a.fieldLabel,l.isList=a.fieldType==="list"):i.push(a)}i.length&&o.push({key:"",label:"",isList:!1,fields:i});for(const a of r)o.push(n.get(a));return o}function D1(e,t){const n=t.trim().toLowerCase();return n?e.map(r=>({...r,fields:r.fields.filter(o=>o.fieldLabel.toLowerCase().includes(n)||o.fieldKey.toLowerCase().includes(n))})).filter(r=>r.fields.length>0):e}async function ku(e){if(!e)return!1;const t=typeof navigator>"u"?void 0:navigator;if(t?.clipboard?.writeText)try{return await t.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.top="-1000px",n.style.opacity="0",document.body.appendChild(n);try{return n.select(),typeof document.execCommand=="function"&&document.execCommand("copy")}catch{return!1}finally{n.remove()}}const $1=Object.fromEntries(Object.entries(lr).filter(([,e])=>e.bindings!==void 0).map(([e,t])=>[e,[...t.bindings??[]]]));function Cu(e,t,n,r){return e==="data"?[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"list",listField:r,placeholder:"{name}"}]:e==="subtotal"?[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"subtotal",placeholder:"{MONEY(SUM(amount))}"}]:e==="summary"?[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"summary",placeholder:"{MONEY(SUM(amount))}"}]:[{targetPath:`options.tableRows[${t}].cells[${n}].formatter`,label:"内容",dataSource:"main",placeholder:"合计: {order.total}"}]}function N1(e){const t=e.printElementType.type,n=ut(t).bindings??$1[t]??[],r=[];if(t==="table"){const o=e.options.dataSource;for(const[i,a]of(e.options.tableRows??[]).entries())for(const[l,c]of a.cells.entries())c.merged||r.push(...Cu(a.type,i,l,o))}return[...n,...r]}function L1(e){return Sa("text",{formatter:`{${e.fieldKey}}`,title:e.fieldLabel})}function F1(e){const t=e.fieldLabel||e.fieldKey;return Sa("text",{formatter:t,title:t})}function Au(e,t){let n=e;for(const r of t.split(".")){if(n==null)return;n=Array.isArray(n)?n[0]?.[r]:n[r]}return n}function Ou(e){return Au(gt,e)}function ds(e,t,n="1234567890128"){const r=t?.[0];return(e??"").replace(/\{([^{}]+)\}/g,(i,a)=>{const l=a.trim(),c=l.includes(".")?Au(r,l)??Ou(l):r?.[l]??Ou(l);return c==null?"":String(c)}).trim()||n}const Wo={left:"#3b82f6",center:"#10b981",right:"#f59e0b",top:"#3b82f6",middle:"#10b981",bottom:"#f59e0b"};function Iu(e){return e==="vCenter"?Wo.center:e==="hCenter"?Wo.middle:Wo[e]??Wo.left}function z1(e,t,n,r={}){const o=r.adsorbMin??1,i=r.adsorbLineMin??2,a=r.showAdsorbLine??!0;let l=e.left,c=e.top;const s=[],d={left:e.left,right:e.left+e.width,vCenter:e.left+e.width/2,top:e.top,bottom:e.top+e.height,hCenter:e.top+e.height/2};let p=1/0;for(const f of t){if(f.id===e.id)continue;const g={left:f.left,right:f.left+f.width,vCenter:f.left+f.width/2,top:f.top,bottom:f.top+f.height,hCenter:f.top+f.height/2},m=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],b=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[v,w]of m){const E=Math.abs(d[v]-g[w]);E<=o&&E<p&&(p=E,l=e.left+(g[w]-d[v]))}for(const[v,w]of b){const E=Math.abs(d[v]-g[w]);E<=o&&E<p&&(p=E,c=e.top+(g[w]-d[v]))}}if(n){const f={left:l,right:l+e.width,vCenter:l+e.width/2,top:c,bottom:c+e.height,hCenter:c+e.height/2},g=["left","vCenter","right"];for(const b of n.vertical)for(const v of g){const w=Math.abs(f[v]-b);w<=o&&w<p&&(p=w,l=e.left+(b-f[v]))}const m=["top","hCenter","bottom"];for(const b of n.horizontal)for(const v of m){const w=Math.abs(f[v]-b);w<=o&&w<p&&(p=w,c=e.top+(b-f[v]))}}const u={left:l,right:l+e.width,vCenter:l+e.width/2,top:c,bottom:c+e.height,hCenter:c+e.height/2};if(a){const f=new Set;for(const g of t){if(g.id===e.id)continue;const m={left:g.left,right:g.left+g.width,vCenter:g.left+g.width/2,top:g.top,bottom:g.top+g.height,hCenter:g.top+g.height/2},b=[["left","left"],["left","vCenter"],["left","right"],["vCenter","left"],["vCenter","vCenter"],["vCenter","right"],["right","left"],["right","vCenter"],["right","right"]],v=[["top","top"],["top","hCenter"],["top","bottom"],["hCenter","top"],["hCenter","hCenter"],["hCenter","bottom"],["bottom","top"],["bottom","hCenter"],["bottom","bottom"]];for(const[w,E]of b)if(Math.abs(u[w]-m[E])<=i){const L=`v:${m[E]}`;f.has(L)||(f.add(L),s.push({type:"vertical",position:m[E],id:g.id,color:Iu(w)}))}for(const[w,E]of v)if(Math.abs(u[w]-m[E])<=i){const L=`h:${m[E]}`;f.has(L)||(f.add(L),s.push({type:"horizontal",position:m[E],id:g.id,color:Iu(w)}))}}}if(n){for(const f of n.vertical)s.some(g=>g.type==="vertical"&&g.position===f)||s.push({type:"vertical",position:f});for(const f of n.horizontal)s.some(g=>g.type==="horizontal"&&g.position===f)||s.push({type:"horizontal",position:f})}return{left:l,top:c,lines:s}}function B1(){function e(t,n){if(t.length<2)return;const r=t.map(i=>We(i.options).margin),o={minLeft:Math.min(...r.map(i=>i.left)),maxRight:Math.max(...r.map(i=>i.right)),minTop:Math.min(...r.map(i=>i.top)),maxBottom:Math.max(...r.map(i=>i.bottom))};switch(n){case"left":t.forEach(i=>{i.options.left=o.minLeft});break;case"right":t.forEach((i,a)=>{i.options.left=o.maxRight-r[a].width});break;case"top":t.forEach(i=>{i.options.top=o.minTop});break;case"bottom":t.forEach((i,a)=>{i.options.top=o.maxBottom-r[a].height});break;case"vertical":{const i=o.minLeft+(o.maxRight-o.minLeft)/2;t.forEach((a,l)=>{a.options.left=i-r[l].width/2});break}case"horizontal":{const i=o.minTop+(o.maxBottom-o.minTop)/2;t.forEach((a,l)=>{a.options.top=i-r[l].height/2});break}case"distributeHor":{const i=t.map((s,d)=>({element:s,box:r[d]})).sort((s,d)=>s.box.left-d.box.left),a=i.reduce((s,d)=>s+d.box.width,0),l=(o.maxRight-o.minLeft-a)/(i.length-1);let c=o.minLeft;i.forEach(s=>{s.element.options.left=c,c+=s.box.width+l});break}case"distributeVer":{const i=t.map((s,d)=>({element:s,box:r[d]})).sort((s,d)=>s.box.top-d.box.top),a=i.reduce((s,d)=>s+d.box.height,0),l=(o.maxBottom-o.minTop-a)/(i.length-1);let c=o.minTop;i.forEach(s=>{s.element.options.top=c,c+=s.box.height+l});break}}}return{align:e}}function Pu(){return`grp-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function H1(){function e(r,o){if(r.filter(l=>o.has(l.id)).length<2)return r;const a=Pu();return r.map(l=>o.has(l.id)?{...l,options:{...l.options,groupId:a}}:l)}function t(r,o){const i=r.filter(l=>o.has(l.id)),a=new Set(i.map(l=>l.options.groupId).filter(Boolean));return r.map(l=>l.options.groupId&&a.has(l.options.groupId)?{...l,options:{...l.options,groupId:void 0}}:l)}function n(r,o){const i=r.find(l=>l.id===o);if(!i?.options.groupId)return new Set([o]);const a=new Set;for(const l of r)l.options.groupId===i.options.groupId&&a.add(l.id);return a}return{group:e,ungroup:t,getGroupedIds:n}}const U1=["nw","n","ne","e","se","s","sw","w"];function q1(e,t,n,r,o,i){let{left:a,top:l,width:c,height:s}=t;switch(e){case"e":c=Math.max(o,t.width+n);break;case"w":c=Math.max(o,t.width-n),a=t.left+t.width-c;break;case"s":s=Math.max(i,t.height+r);break;case"n":s=Math.max(i,t.height-r),l=t.top+t.height-s;break;case"se":c=Math.max(o,t.width+n),s=Math.max(i,t.height+r);break;case"sw":c=Math.max(o,t.width-n),a=t.left+t.width-c,s=Math.max(i,t.height+r);break;case"ne":c=Math.max(o,t.width+n),s=Math.max(i,t.height-r),l=t.top+t.height-s;break;case"nw":c=Math.max(o,t.width-n),a=t.left+t.width-c,s=Math.max(i,t.height-r),l=t.top+t.height-s;break}return{left:a,top:l,width:c,height:s}}function Ru(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jo={},Pr={},Go={},Du;function tt(){if(Du)return Go;Du=1,Object.defineProperty(Go,"__esModule",{value:!0});function e(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}var t=function n(r,o){e(this,n),this.data=r,this.text=o.text||r,this.options=o};return Go.default=t,Go}var $u;function W1(){if($u)return Pr;$u=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.CODE39=void 0;var e=(function(){function m(b,v){for(var w=0;w<v.length;w++){var E=v[w];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(b,E.key,E)}}return function(b,v,w){return v&&m(b.prototype,v),w&&m(b,w),b}})(),t=tt(),n=r(t);function r(m){return m&&m.__esModule?m:{default:m}}function o(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function i(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function a(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var l=(function(m){a(b,m);function b(v,w){return o(this,b),v=v.toUpperCase(),w.mod43&&(v+=u(g(v))),i(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,v,w))}return e(b,[{key:"encode",value:function(){for(var w=d("*"),E=0;E<this.data.length;E++)w+=d(this.data[E])+"0";return w+=d("*"),{data:w,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),b})(n.default),c=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],s=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function d(m){return p(f(m))}function p(m){return s[m].toString(2)}function u(m){return c[m]}function f(m){return c.indexOf(m)}function g(m){for(var b=0,v=0;v<m.length;v++)b+=f(m[v]);return b=b%43,b}return Pr.CODE39=l,Pr}var xt={},Vo={},Yo={},Se={},Nu;function Rr(){if(Nu)return Se;Nu=1,Object.defineProperty(Se,"__esModule",{value:!0});var e;function t(c,s,d){return s in c?Object.defineProperty(c,s,{value:d,enumerable:!0,configurable:!0,writable:!0}):c[s]=d,c}var n=Se.SET_A=0,r=Se.SET_B=1,o=Se.SET_C=2;Se.SHIFT=98;var i=Se.START_A=103,a=Se.START_B=104,l=Se.START_C=105;return Se.MODULO=103,Se.STOP=106,Se.FNC1=207,Se.SET_BY_CODE=(e={},t(e,i,n),t(e,a,r),t(e,l,o),e),Se.SWAP={101:n,100:r,99:o},Se.A_START_CHAR="Ð",Se.B_START_CHAR="Ñ",Se.C_START_CHAR="Ò",Se.A_CHARS="[\0-_È-Ï]",Se.B_CHARS="[ -È-Ï]",Se.C_CHARS="(Ï*[0-9]{2}Ï*)",Se.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011],Se}var Lu;function Ko(){if(Lu)return Yo;Lu=1,Object.defineProperty(Yo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=tt(),n=o(t),r=Rr();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){i(this,d);var f=a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p.substring(1),u));return f.bytes=p.split("").map(function(g){return g.charCodeAt(0)}),f}return e(d,[{key:"valid",value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:"encode",value:function(){var u=this.bytes,f=u.shift()-105,g=r.SET_BY_CODE[f];if(g===void 0)throw new RangeError("The encoding does not start with a start character.");this.shouldEncodeAsEan128()===!0&&u.unshift(r.FNC1);var m=d.next(u,1,g);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,""):this.text,data:d.getBar(f)+m.result+d.getBar((m.checksum+f)%r.MODULO)+d.getBar(r.STOP)}}},{key:"shouldEncodeAsEan128",value:function(){var u=this.options.ean128||!1;return typeof u=="string"&&(u=u.toLowerCase()==="true"),u}}],[{key:"getBar",value:function(u){return r.BARS[u]?r.BARS[u].toString():""}},{key:"correctIndex",value:function(u,f){if(f===r.SET_A){var g=u.shift();return g<32?g+64:g-32}else return f===r.SET_B?u.shift()-32:(u.shift()-48)*10+u.shift()-48}},{key:"next",value:function(u,f,g){if(!u.length)return{result:"",checksum:0};var m=void 0,b=void 0;if(u[0]>=200){b=u.shift()-105;var v=r.SWAP[b];v!==void 0?m=d.next(u,f+1,v):((g===r.SET_A||g===r.SET_B)&&b===r.SHIFT&&(u[0]=g===r.SET_A?u[0]>95?u[0]-96:u[0]:u[0]<32?u[0]+96:u[0]),m=d.next(u,f+1,g))}else b=d.correctIndex(u,g),m=d.next(u,f+1,g);var w=d.getBar(b),E=b*f;return{result:w+m.result,checksum:E+m.checksum}}}]),d})(n.default);return Yo.default=c,Yo}var Xo={},Fu;function j1(){if(Fu)return Xo;Fu=1,Object.defineProperty(Xo,"__esModule",{value:!0});var e=Rr(),t=function(l){return l.match(new RegExp("^"+e.A_CHARS+"*"))[0].length},n=function(l){return l.match(new RegExp("^"+e.B_CHARS+"*"))[0].length},r=function(l){return l.match(new RegExp("^"+e.C_CHARS+"*"))[0]};function o(a,l){var c=l?e.A_CHARS:e.B_CHARS,s=a.match(new RegExp("^("+c+"+?)(([0-9]{2}){2,})([^0-9]|$)"));if(s)return s[1]+"Ì"+i(a.substring(s[1].length));var d=a.match(new RegExp("^"+c+"+"))[0];return d.length===a.length?a:d+String.fromCharCode(l?205:206)+o(a.substring(d.length),!l)}function i(a){var l=r(a),c=l.length;if(c===a.length)return a;a=a.substring(c);var s=t(a)>=n(a);return l+String.fromCharCode(s?206:205)+o(a,s)}return Xo.default=function(a){var l=void 0,c=r(a).length;if(c>=2)l=e.C_START_CHAR+i(a);else{var s=t(a)>n(a);l=(s?e.A_START_CHAR:e.B_START_CHAR)+o(a,s)}return l.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(d,p){return"Ë"+p})},Xo}var zu;function G1(){if(zu)return Vo;zu=1,Object.defineProperty(Vo,"__esModule",{value:!0});var e=Ko(),t=o(e),n=j1(),r=o(n);function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){if(i(this,d),/^[\x00-\x7F\xC8-\xD3]+$/.test(p))var f=a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,(0,r.default)(p),u));else var f=a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u));return a(f)}return d})(t.default);return Vo.default=c,Vo}var Zo={},Bu;function V1(){if(Bu)return Zo;Bu=1,Object.defineProperty(Zo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Ko(),n=o(t),r=Rr();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,r.A_START_CHAR+p,u))}return e(d,[{key:"valid",value:function(){return new RegExp("^"+r.A_CHARS+"+$").test(this.data)}}]),d})(n.default);return Zo.default=c,Zo}var Jo={},Hu;function Y1(){if(Hu)return Jo;Hu=1,Object.defineProperty(Jo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Ko(),n=o(t),r=Rr();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,r.B_START_CHAR+p,u))}return e(d,[{key:"valid",value:function(){return new RegExp("^"+r.B_CHARS+"+$").test(this.data)}}]),d})(n.default);return Jo.default=c,Jo}var Qo={},Uu;function K1(){if(Uu)return Qo;Uu=1,Object.defineProperty(Qo,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=Ko(),n=o(t),r=Rr();function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,r.C_START_CHAR+p,u))}return e(d,[{key:"valid",value:function(){return new RegExp("^"+r.C_CHARS+"+$").test(this.data)}}]),d})(n.default);return Qo.default=c,Qo}var qu;function X1(){if(qu)return xt;qu=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.CODE128C=xt.CODE128B=xt.CODE128A=xt.CODE128=void 0;var e=G1(),t=c(e),n=V1(),r=c(n),o=Y1(),i=c(o),a=K1(),l=c(a);function c(s){return s&&s.__esModule?s:{default:s}}return xt.CODE128=t.default,xt.CODE128A=r.default,xt.CODE128B=i.default,xt.CODE128C=l.default,xt}var Xe={},ei={},Bt={},Wu;function Dr(){return Wu||(Wu=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.SIDE_BIN="101",Bt.MIDDLE_BIN="01010",Bt.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},Bt.EAN2_STRUCTURE=["LL","LG","GL","GG"],Bt.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],Bt.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]),Bt}var ti={},ni={},ju;function $r(){if(ju)return ni;ju=1,Object.defineProperty(ni,"__esModule",{value:!0});var e=Dr(),t=function(r,o,i){var a=r.split("").map(function(c,s){return e.BINARIES[o[s]]}).map(function(c,s){return c?c[r[s]]:""});if(i){var l=r.length-1;a=a.map(function(c,s){return s<l?c+i:c})}return a.join("")};return ni.default=t,ni}var Gu;function Vu(){if(Gu)return ti;Gu=1,Object.defineProperty(ti,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})(),t=Dr(),n=$r(),r=a(n),o=tt(),i=a(o);function a(p){return p&&p.__esModule?p:{default:p}}function l(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function c(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function s(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var d=(function(p){s(u,p);function u(f,g){l(this,u);var m=c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g));return m.fontSize=!g.flat&&g.fontSize>g.width*10?g.width*10:g.fontSize,m.guardHeight=g.height+m.fontSize/2+g.textMargin,m}return e(u,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(g,m){return this.text.substr(g,m)}},{key:"leftEncode",value:function(g,m){return(0,r.default)(g,m)}},{key:"rightText",value:function(g,m){return this.text.substr(g,m)}},{key:"rightEncode",value:function(g,m){return(0,r.default)(g,m)}},{key:"encodeGuarded",value:function(){var g={fontSize:this.fontSize},m={height:this.guardHeight};return[{data:t.SIDE_BIN,options:m},{data:this.leftEncode(),text:this.leftText(),options:g},{data:t.MIDDLE_BIN,options:m},{data:this.rightEncode(),text:this.rightText(),options:g},{data:t.SIDE_BIN,options:m}]}},{key:"encodeFlat",value:function(){var g=[t.SIDE_BIN,this.leftEncode(),t.MIDDLE_BIN,this.rightEncode(),t.SIDE_BIN];return{data:g.join(""),text:this.text}}}]),u})(i.default);return ti.default=d,ti}var Yu;function Z1(){if(Yu)return ei;Yu=1,Object.defineProperty(ei,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})(),t=function p(u,f,g){u===null&&(u=Function.prototype);var m=Object.getOwnPropertyDescriptor(u,f);if(m===void 0){var b=Object.getPrototypeOf(u);return b===null?void 0:p(b,f,g)}else{if("value"in m)return m.value;var v=m.get;return v===void 0?void 0:v.call(g)}},n=Dr(),r=Vu(),o=i(r);function i(p){return p&&p.__esModule?p:{default:p}}function a(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function l(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function c(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var s=function(u){var f=u.substr(0,12).split("").map(function(g){return+g}).reduce(function(g,m,b){return b%2?g+m*3:g+m},0);return(10-f%10)%10},d=(function(p){c(u,p);function u(f,g){a(this,u),f.search(/^[0-9]{12}$/)!==-1&&(f+=s(f));var m=l(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g));return m.lastChar=g.lastChar,m}return e(u,[{key:"valid",value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===s(this.data)}},{key:"leftText",value:function(){return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"leftText",this).call(this,1,6)}},{key:"leftEncode",value:function(){var g=this.data.substr(1,6),m=n.EAN13_STRUCTURE[this.data[0]];return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"leftEncode",this).call(this,g,m)}},{key:"rightText",value:function(){return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"rightText",this).call(this,7,6)}},{key:"rightEncode",value:function(){var g=this.data.substr(7,6);return t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"rightEncode",this).call(this,g,"RRRRRR")}},{key:"encodeGuarded",value:function(){var g=t(u.prototype.__proto__||Object.getPrototypeOf(u.prototype),"encodeGuarded",this).call(this);return this.options.displayValue&&(g.unshift({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),this.options.lastChar&&(g.push({data:"00"}),g.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}}))),g}}]),u})(o.default);return ei.default=d,ei}var ri={},Ku;function J1(){if(Ku)return ri;Ku=1,Object.defineProperty(ri,"__esModule",{value:!0});var e=(function(){function d(p,u){for(var f=0;f<u.length;f++){var g=u[f];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}return function(p,u,f){return u&&d(p.prototype,u),f&&d(p,f),p}})(),t=function d(p,u,f){p===null&&(p=Function.prototype);var g=Object.getOwnPropertyDescriptor(p,u);if(g===void 0){var m=Object.getPrototypeOf(p);return m===null?void 0:d(m,u,f)}else{if("value"in g)return g.value;var b=g.get;return b===void 0?void 0:b.call(f)}},n=Vu(),r=o(n);function o(d){return d&&d.__esModule?d:{default:d}}function i(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")}function a(d,p){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:d}function l(d,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);d.prototype=Object.create(p&&p.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(d,p):d.__proto__=p)}var c=function(p){var u=p.substr(0,7).split("").map(function(f){return+f}).reduce(function(f,g,m){return m%2?f+g:f+g*3},0);return(10-u%10)%10},s=(function(d){l(p,d);function p(u,f){return i(this,p),u.search(/^[0-9]{7}$/)!==-1&&(u+=c(u)),a(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,u,f))}return e(p,[{key:"valid",value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===c(this.data)}},{key:"leftText",value:function(){return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"leftText",this).call(this,0,4)}},{key:"leftEncode",value:function(){var f=this.data.substr(0,4);return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"leftEncode",this).call(this,f,"LLLL")}},{key:"rightText",value:function(){return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"rightText",this).call(this,4,4)}},{key:"rightEncode",value:function(){var f=this.data.substr(4,4);return t(p.prototype.__proto__||Object.getPrototypeOf(p.prototype),"rightEncode",this).call(this,f,"RRRR")}}]),p})(r.default);return ri.default=s,ri}var oi={},Xu;function Q1(){if(Xu)return oi;Xu=1,Object.defineProperty(oi,"__esModule",{value:!0});var e=(function(){function u(f,g){for(var m=0;m<g.length;m++){var b=g[m];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(f,b.key,b)}}return function(f,g,m){return g&&u(f.prototype,g),m&&u(f,m),f}})(),t=Dr(),n=$r(),r=a(n),o=tt(),i=a(o);function a(u){return u&&u.__esModule?u:{default:u}}function l(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}function c(u,f){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:u}function s(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);u.prototype=Object.create(f&&f.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(u,f):u.__proto__=f)}var d=function(f){var g=f.split("").map(function(m){return+m}).reduce(function(m,b,v){return v%2?m+b*9:m+b*3},0);return g%10},p=(function(u){s(f,u);function f(g,m){return l(this,f),c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,g,m))}return e(f,[{key:"valid",value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:"encode",value:function(){var m=t.EAN5_STRUCTURE[d(this.data)];return{data:"1011"+(0,r.default)(this.data,m,"01"),text:this.text}}}]),f})(i.default);return oi.default=p,oi}var ii={},Zu;function ey(){if(Zu)return ii;Zu=1,Object.defineProperty(ii,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})(),t=Dr(),n=$r(),r=a(n),o=tt(),i=a(o);function a(p){return p&&p.__esModule?p:{default:p}}function l(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function c(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function s(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var d=(function(p){s(u,p);function u(f,g){return l(this,u),c(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g))}return e(u,[{key:"valid",value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:"encode",value:function(){var g=t.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:"1011"+(0,r.default)(this.data,g,"01"),text:this.text}}}]),u})(i.default);return ii.default=d,ii}var Nr={},Ju;function Qu(){if(Ju)return Nr;Ju=1,Object.defineProperty(Nr,"__esModule",{value:!0});var e=(function(){function p(u,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}return function(u,f,g){return f&&p(u.prototype,f),g&&p(u,g),u}})();Nr.checksum=d;var t=$r(),n=i(t),r=tt(),o=i(r);function i(p){return p&&p.__esModule?p:{default:p}}function a(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function l(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function c(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var s=(function(p){c(u,p);function u(f,g){a(this,u),f.search(/^[0-9]{11}$/)!==-1&&(f+=d(f));var m=l(this,(u.__proto__||Object.getPrototypeOf(u)).call(this,f,g));return m.displayValue=g.displayValue,g.fontSize>g.width*10?m.fontSize=g.width*10:m.fontSize=g.fontSize,m.guardHeight=g.height+m.fontSize/2+g.textMargin,m}return e(u,[{key:"valid",value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==d(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var g="";return g+="101",g+=(0,n.default)(this.data.substr(0,6),"LLLLLL"),g+="01010",g+=(0,n.default)(this.data.substr(6,6),"RRRRRR"),g+="101",{data:g,text:this.text}}},{key:"guardedEncoding",value:function(){var g=[];return this.displayValue&&g.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),g.push({data:"101"+(0,n.default)(this.data[0],"L"),options:{height:this.guardHeight}}),g.push({data:(0,n.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),g.push({data:"01010",options:{height:this.guardHeight}}),g.push({data:(0,n.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),g.push({data:(0,n.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&g.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),g}}]),u})(o.default);function d(p){var u=0,f;for(f=1;f<11;f+=2)u+=parseInt(p[f]);for(f=0;f<11;f+=2)u+=parseInt(p[f])*3;return(10-u%10)%10}return Nr.default=s,Nr}var ai={},ep;function ty(){if(ep)return ai;ep=1,Object.defineProperty(ai,"__esModule",{value:!0});var e=(function(){function g(m,b){for(var v=0;v<b.length;v++){var w=b[v];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,v){return b&&g(m.prototype,b),v&&g(m,v),m}})(),t=$r(),n=a(t),r=tt(),o=a(r),i=Qu();function a(g){return g&&g.__esModule?g:{default:g}}function l(g,m){if(!(g instanceof m))throw new TypeError("Cannot call a class as a function")}function c(g,m){if(!g)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:g}function s(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);g.prototype=Object.create(m&&m.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(g,m):g.__proto__=m)}var d=["XX00000XXX","XX10000XXX","XX20000XXX","XXX00000XX","XXXX00000X","XXXXX00005","XXXXX00006","XXXXX00007","XXXXX00008","XXXXX00009"],p=[["EEEOOO","OOOEEE"],["EEOEOO","OOEOEE"],["EEOOEO","OOEEOE"],["EEOOOE","OOEEEO"],["EOEEOO","OEOOEE"],["EOOEEO","OEEOOE"],["EOOOEE","OEEEOO"],["EOEOEO","OEOEOE"],["EOEOOE","OEOEEO"],["EOOEOE","OEEOEO"]],u=(function(g){s(m,g);function m(b,v){l(this,m);var w=c(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b,v));if(w.isValid=!1,b.search(/^[0-9]{6}$/)!==-1)w.middleDigits=b,w.upcA=f(b,"0"),w.text=v.text||""+w.upcA[0]+b+w.upcA[w.upcA.length-1],w.isValid=!0;else if(b.search(/^[01][0-9]{7}$/)!==-1)if(w.middleDigits=b.substring(1,b.length-1),w.upcA=f(w.middleDigits,b[0]),w.upcA[w.upcA.length-1]===b[b.length-1])w.isValid=!0;else return c(w);else return c(w);return w.displayValue=v.displayValue,v.fontSize>v.width*10?w.fontSize=v.width*10:w.fontSize=v.fontSize,w.guardHeight=v.height+w.fontSize/2+v.textMargin,w}return e(m,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var v="";return v+="101",v+=this.encodeMiddleDigits(),v+="010101",{data:v,text:this.text}}},{key:"guardedEncoding",value:function(){var v=[];return this.displayValue&&v.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),v.push({data:"101",options:{height:this.guardHeight}}),v.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),v.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&v.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),v}},{key:"encodeMiddleDigits",value:function(){var v=this.upcA[0],w=this.upcA[this.upcA.length-1],E=p[parseInt(w)][parseInt(v)];return(0,n.default)(this.middleDigits,E)}}]),m})(o.default);function f(g,m){for(var b=parseInt(g[g.length-1]),v=d[b],w="",E=0,k=0;k<v.length;k++){var L=v[k];L==="X"?w+=g[E++]:w+=L}return w=""+m+w,""+w+(0,i.checksum)(w)}return ai.default=u,ai}var tp;function ny(){if(tp)return Xe;tp=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.UPCE=Xe.UPC=Xe.EAN2=Xe.EAN5=Xe.EAN8=Xe.EAN13=void 0;var e=Z1(),t=u(e),n=J1(),r=u(n),o=Q1(),i=u(o),a=ey(),l=u(a),c=Qu(),s=u(c),d=ty(),p=u(d);function u(f){return f&&f.__esModule?f:{default:f}}return Xe.EAN13=t.default,Xe.EAN8=r.default,Xe.EAN5=i.default,Xe.EAN2=l.default,Xe.UPC=s.default,Xe.UPCE=p.default,Xe}var wn={},si={},Gn={},np;function ry(){return np||(np=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.START_BIN="1010",Gn.END_BIN="11101",Gn.BINARIES=["00110","10001","01001","11000","00101","10100","01100","00011","10010","01010"]),Gn}var rp;function op(){if(rp)return si;rp=1,Object.defineProperty(si,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=ry(),n=tt(),r=o(n);function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}return e(d,[{key:"valid",value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:"encode",value:function(){var u=this,f=this.data.match(/.{2}/g).map(function(g){return u.encodePair(g)}).join("");return{data:t.START_BIN+f+t.END_BIN,text:this.text}}},{key:"encodePair",value:function(u){var f=t.BINARIES[u[1]];return t.BINARIES[u[0]].split("").map(function(g,m){return(g==="1"?"111":"1")+(f[m]==="1"?"000":"0")}).join("")}}]),d})(r.default);return si.default=c,si}var li={},ip;function oy(){if(ip)return li;ip=1,Object.defineProperty(li,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=op(),n=r(t);function r(s){return s&&s.__esModule?s:{default:s}}function o(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function i(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function a(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var l=function(d){var p=d.substr(0,13).split("").map(function(u){return parseInt(u,10)}).reduce(function(u,f,g){return u+f*(3-g%2*2)},0);return Math.ceil(p/10)*10-p},c=(function(s){a(d,s);function d(p,u){return o(this,d),p.search(/^[0-9]{13}$/)!==-1&&(p+=l(p)),i(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u))}return e(d,[{key:"valid",value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===l(this.data)}}]),d})(n.default);return li.default=c,li}var ap;function iy(){if(ap)return wn;ap=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.ITF14=wn.ITF=void 0;var e=op(),t=o(e),n=oy(),r=o(n);function o(i){return i&&i.__esModule?i:{default:i}}return wn.ITF=t.default,wn.ITF14=r.default,wn}var nt={},ci={},sp;function Lr(){if(sp)return ci;sp=1,Object.defineProperty(ci,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=tt(),n=r(t);function r(s){return s&&s.__esModule?s:{default:s}}function o(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function i(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function a(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var l=(function(s){a(d,s);function d(p,u){return o(this,d),i(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u))}return e(d,[{key:"encode",value:function(){for(var u="110",f=0;f<this.data.length;f++){var g=parseInt(this.data[f]),m=g.toString(2);m=c(m,4-m.length);for(var b=0;b<m.length;b++)u+=m[b]=="0"?"100":"110"}return u+="1001",{data:u,text:this.text}}},{key:"valid",value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),d})(n.default);function c(s,d){for(var p=0;p<d;p++)s="0"+s;return s}return ci.default=l,ci}var di={},Fr={},lp;function ui(){if(lp)return Fr;lp=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.mod10=e,Fr.mod11=t;function e(n){for(var r=0,o=0;o<n.length;o++){var i=parseInt(n[o]);(o+n.length)%2===0?r+=i:r+=i*2%10+Math.floor(i*2/10)}return(10-r%10)%10}function t(n){for(var r=0,o=[2,3,4,5,6,7],i=0;i<n.length;i++){var a=parseInt(n[n.length-1-i]);r+=o[i%o.length]*a}return(11-r%11)%11}return Fr}var cp;function ay(){if(cp)return di;cp=1,Object.defineProperty(di,"__esModule",{value:!0});var e=Lr(),t=r(e),n=ui();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d+(0,n.mod10)(d),p))}return s})(t.default);return di.default=l,di}var pi={},dp;function sy(){if(dp)return pi;dp=1,Object.defineProperty(pi,"__esModule",{value:!0});var e=Lr(),t=r(e),n=ui();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d+(0,n.mod11)(d),p))}return s})(t.default);return pi.default=l,pi}var fi={},up;function ly(){if(up)return fi;up=1,Object.defineProperty(fi,"__esModule",{value:!0});var e=Lr(),t=r(e),n=ui();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),d+=(0,n.mod10)(d),d+=(0,n.mod10)(d),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return s})(t.default);return fi.default=l,fi}var hi={},pp;function cy(){if(pp)return hi;pp=1,Object.defineProperty(hi,"__esModule",{value:!0});var e=Lr(),t=r(e),n=ui();function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),d+=(0,n.mod11)(d),d+=(0,n.mod10)(d),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return s})(t.default);return hi.default=l,hi}var fp;function dy(){if(fp)return nt;fp=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.MSI1110=nt.MSI1010=nt.MSI11=nt.MSI10=nt.MSI=void 0;var e=Lr(),t=d(e),n=ay(),r=d(n),o=sy(),i=d(o),a=ly(),l=d(a),c=cy(),s=d(c);function d(p){return p&&p.__esModule?p:{default:p}}return nt.MSI=t.default,nt.MSI10=r.default,nt.MSI11=i.default,nt.MSI1010=l.default,nt.MSI1110=s.default,nt}var zr={},hp;function uy(){if(hp)return zr;hp=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.pharmacode=void 0;var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=tt(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){o(this,s);var u=i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p));return u.number=parseInt(d,10),u}return e(s,[{key:"encode",value:function(){for(var p=this.number,u="";!isNaN(p)&&p!=0;)p%2===0?(u="11100"+u,p=(p-2)/2):(u="100"+u,p=(p-1)/2);return u=u.slice(0,-2),{data:u,text:this.text}}},{key:"valid",value:function(){return this.number>=3&&this.number<=131070}}]),s})(n.default);return zr.pharmacode=l,zr}var Br={},gp;function py(){if(gp)return Br;gp=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.codabar=void 0;var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=tt(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){o(this,s),d.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(d="A"+d+"A");var u=i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d.toUpperCase(),p));return u.text=u.options.text||u.text.replace(/[A-D]/g,""),u}return e(s,[{key:"valid",value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:"encode",value:function(){for(var p=[],u=this.getEncodings(),f=0;f<this.data.length;f++)p.push(u[this.data.charAt(f)]),f!==this.data.length-1&&p.push("0");return{text:this.text,data:p.join("")}}},{key:"getEncodings",value:function(){return{0:"101010011",1:"101011001",2:"101001011",3:"110010101",4:"101101001",5:"110101001",6:"100101011",7:"100101101",8:"100110101",9:"110100101","-":"101001101",$:"101100101",":":"1101011011","/":"1101101011",".":"1101101101","+":"1011011011",A:"1011001001",B:"1001001011",C:"1010010011",D:"1010011001"}}}]),s})(n.default);return Br.codabar=l,Br}var xn={},gi={},Vn={},mp;function fy(){return mp||(mp=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.SYMBOLS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","($)","(%)","(/)","(+)","ÿ"],Vn.BINARIES=["100010100","101001000","101000100","101000010","100101000","100100100","100100010","101010000","100010010","100001010","110101000","110100100","110100010","110010100","110010010","110001010","101101000","101100100","101100010","100110100","100011010","101011000","101001100","101000110","100101100","100010110","110110100","110110010","110101100","110100110","110010110","110011010","101101100","101100110","100110110","100111010","100101110","111010100","111010010","111001010","101101110","101110110","110101110","100100110","111011010","111010110","100110010","101011110"],Vn.MULTI_SYMBOLS={"\0":["(%)","U"],"":["($)","A"],"":["($)","B"],"":["($)","C"],"":["($)","D"],"":["($)","E"],"":["($)","F"],"\x07":["($)","G"],"\b":["($)","H"]," ":["($)","I"],"\n":["($)","J"],"\v":["($)","K"],"\f":["($)","L"],"\r":["($)","M"],"":["($)","N"],"":["($)","O"],"":["($)","P"],"":["($)","Q"],"":["($)","R"],"":["($)","S"],"":["($)","T"],"":["($)","U"],"":["($)","V"],"":["($)","W"],"":["($)","X"],"":["($)","Y"],"":["($)","Z"],"\x1B":["(%)","A"],"":["(%)","B"],"":["(%)","C"],"":["(%)","D"],"":["(%)","E"],"!":["(/)","A"],'"':["(/)","B"],"#":["(/)","C"],"&":["(/)","F"],"'":["(/)","G"],"(":["(/)","H"],")":["(/)","I"],"*":["(/)","J"],",":["(/)","L"],":":["(/)","Z"],";":["(%)","F"],"<":["(%)","G"],"=":["(%)","H"],">":["(%)","I"],"?":["(%)","J"],"@":["(%)","V"],"[":["(%)","K"],"\\":["(%)","L"],"]":["(%)","M"],"^":["(%)","N"],_:["(%)","O"],"`":["(%)","W"],a:["(+)","A"],b:["(+)","B"],c:["(+)","C"],d:["(+)","D"],e:["(+)","E"],f:["(+)","F"],g:["(+)","G"],h:["(+)","H"],i:["(+)","I"],j:["(+)","J"],k:["(+)","K"],l:["(+)","L"],m:["(+)","M"],n:["(+)","N"],o:["(+)","O"],p:["(+)","P"],q:["(+)","Q"],r:["(+)","R"],s:["(+)","S"],t:["(+)","T"],u:["(+)","U"],v:["(+)","V"],w:["(+)","W"],x:["(+)","X"],y:["(+)","Y"],z:["(+)","Z"],"{":["(%)","P"],"|":["(%)","Q"],"}":["(%)","R"],"~":["(%)","S"],"":["(%)","T"]}),Vn}var bp;function yp(){if(bp)return gi;bp=1,Object.defineProperty(gi,"__esModule",{value:!0});var e=(function(){function s(d,p){for(var u=0;u<p.length;u++){var f=p[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}return function(d,p,u){return p&&s(d.prototype,p),u&&s(d,u),d}})(),t=fy(),n=tt(),r=o(n);function o(s){return s&&s.__esModule?s:{default:s}}function i(s,d){if(!(s instanceof d))throw new TypeError("Cannot call a class as a function")}function a(s,d){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d&&(typeof d=="object"||typeof d=="function")?d:s}function l(s,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);s.prototype=Object.create(d&&d.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(s,d):s.__proto__=d)}var c=(function(s){l(d,s);function d(p,u){return i(this,d),a(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,p,u))}return e(d,[{key:"valid",value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:"encode",value:function(){var u=this.data.split("").flatMap(function(b){return t.MULTI_SYMBOLS[b]||b}),f=u.map(function(b){return d.getEncoding(b)}).join(""),g=d.checksum(u,20),m=d.checksum(u.concat(g),15);return{text:this.text,data:d.getEncoding("ÿ")+f+d.getEncoding(g)+d.getEncoding(m)+d.getEncoding("ÿ")+"1"}}}],[{key:"getEncoding",value:function(u){return t.BINARIES[d.symbolValue(u)]}},{key:"getSymbol",value:function(u){return t.SYMBOLS[u]}},{key:"symbolValue",value:function(u){return t.SYMBOLS.indexOf(u)}},{key:"checksum",value:function(u,f){var g=u.slice().reverse().reduce(function(m,b,v){var w=v%f+1;return m+d.symbolValue(b)*w},0);return d.getSymbol(g%47)}}]),d})(r.default);return gi.default=c,gi}var mi={},vp;function hy(){if(vp)return mi;vp=1,Object.defineProperty(mi,"__esModule",{value:!0});var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=yp(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return e(s,[{key:"valid",value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),s})(n.default);return mi.default=l,mi}var wp;function gy(){if(wp)return xn;wp=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.CODE93FullASCII=xn.CODE93=void 0;var e=yp(),t=o(e),n=hy(),r=o(n);function o(i){return i&&i.__esModule?i:{default:i}}return xn.CODE93=t.default,xn.CODE93FullASCII=r.default,xn}var Hr={},xp;function my(){if(xp)return Hr;xp=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.GenericBarcode=void 0;var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=tt(),n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function o(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}function i(c,s){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:c}function a(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);c.prototype=Object.create(s&&s.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(c,s):c.__proto__=s)}var l=(function(c){a(s,c);function s(d,p){return o(this,s),i(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,d,p))}return e(s,[{key:"encode",value:function(){return{data:"10101010101010101010101010101010101010101",text:this.text}}},{key:"valid",value:function(){return!0}}]),s})(n.default);return Hr.GenericBarcode=l,Hr}var Ep;function by(){if(Ep)return jo;Ep=1,Object.defineProperty(jo,"__esModule",{value:!0});var e=W1(),t=X1(),n=ny(),r=iy(),o=dy(),i=uy(),a=py(),l=gy(),c=my();return jo.default={CODE39:e.CODE39,CODE128:t.CODE128,CODE128A:t.CODE128A,CODE128B:t.CODE128B,CODE128C:t.CODE128C,EAN13:n.EAN13,EAN8:n.EAN8,EAN5:n.EAN5,EAN2:n.EAN2,UPC:n.UPC,UPCE:n.UPCE,ITF14:r.ITF14,ITF:r.ITF,MSI:o.MSI,MSI10:o.MSI10,MSI11:o.MSI11,MSI1010:o.MSI1010,MSI1110:o.MSI1110,pharmacode:i.pharmacode,codabar:a.codabar,CODE93:l.CODE93,CODE93FullASCII:l.CODE93FullASCII,GenericBarcode:c.GenericBarcode},jo}var bi={},Sp;function yi(){if(Sp)return bi;Sp=1,Object.defineProperty(bi,"__esModule",{value:!0});var e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t};return bi.default=function(t,n){return e({},t,n)},bi}var vi={},_p;function yy(){if(_p)return vi;_p=1,Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=e;function e(t){var n=[];function r(o){if(Array.isArray(o))for(var i=0;i<o.length;i++)r(o[i]);else o.text=o.text||"",o.data=o.data||"",n.push(o)}return r(t),n}return vi}var wi={},Mp;function vy(){if(Mp)return wi;Mp=1,Object.defineProperty(wi,"__esModule",{value:!0}),wi.default=e;function e(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}return wi}var xi={},Ei={},Si={},Tp;function kp(){if(Tp)return Si;Tp=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.default=e;function e(t){var n=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var r in n)n.hasOwnProperty(r)&&(r=n[r],typeof t[r]=="string"&&(t[r]=parseInt(t[r],10)));return typeof t.displayValue=="string"&&(t.displayValue=t.displayValue!="false"),t}return Si}var _i={},Cp;function Ap(){if(Cp)return _i;Cp=1,Object.defineProperty(_i,"__esModule",{value:!0});var e={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};return _i.default=e,_i}var Op;function wy(){if(Op)return Ei;Op=1,Object.defineProperty(Ei,"__esModule",{value:!0});var e=kp(),t=o(e),n=Ap(),r=o(n);function o(a){return a&&a.__esModule?a:{default:a}}function i(a){var l={};for(var c in r.default)r.default.hasOwnProperty(c)&&(a.hasAttribute("jsbarcode-"+c.toLowerCase())&&(l[c]=a.getAttribute("jsbarcode-"+c.toLowerCase())),a.hasAttribute("data-"+c.toLowerCase())&&(l[c]=a.getAttribute("data-"+c.toLowerCase())));return l.value=a.getAttribute("jsbarcode-value")||a.getAttribute("data-value"),l=(0,t.default)(l),l}return Ei.default=i,Ei}var Mi={},Ti={},rt={},Ip;function Pp(){if(Ip)return rt;Ip=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.getTotalWidthOfEncodings=rt.calculateEncodingAttributes=rt.getBarcodePadding=rt.getEncodingHeight=rt.getMaximumHeightOfEncodings=void 0;var e=yi(),t=n(e);function n(s){return s&&s.__esModule?s:{default:s}}function r(s,d){return d.height+(d.displayValue&&s.text.length>0?d.fontSize+d.textMargin:0)+d.marginTop+d.marginBottom}function o(s,d,p){if(p.displayValue&&d<s){if(p.textAlign=="center")return Math.floor((s-d)/2);if(p.textAlign=="left")return 0;if(p.textAlign=="right")return Math.floor(s-d)}return 0}function i(s,d,p){for(var u=0;u<s.length;u++){var f=s[u],g=(0,t.default)(d,f.options),m;g.displayValue?m=c(f.text,g,p):m=0;var b=f.data.length*g.width;f.width=Math.ceil(Math.max(m,b)),f.height=r(f,g),f.barcodePadding=o(m,b,g)}}function a(s){for(var d=0,p=0;p<s.length;p++)d+=s[p].width;return d}function l(s){for(var d=0,p=0;p<s.length;p++)s[p].height>d&&(d=s[p].height);return d}function c(s,d,p){var u;if(p)u=p;else if(typeof document<"u")u=document.createElement("canvas").getContext("2d");else return 0;u.font=d.fontOptions+" "+d.fontSize+"px "+d.font;var f=u.measureText(s);if(!f)return 0;var g=f.width;return g}return rt.getMaximumHeightOfEncodings=l,rt.getEncodingHeight=r,rt.getBarcodePadding=o,rt.calculateEncodingAttributes=i,rt.getTotalWidthOfEncodings=a,rt}var Rp;function xy(){if(Rp)return Ti;Rp=1,Object.defineProperty(Ti,"__esModule",{value:!0});var e=(function(){function l(c,s){for(var d=0;d<s.length;d++){var p=s[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}return function(c,s,d){return s&&l(c.prototype,s),d&&l(c,d),c}})(),t=yi(),n=o(t),r=Pp();function o(l){return l&&l.__esModule?l:{default:l}}function i(l,c){if(!(l instanceof c))throw new TypeError("Cannot call a class as a function")}var a=(function(){function l(c,s,d){i(this,l),this.canvas=c,this.encodings=s,this.options=d}return e(l,[{key:"render",value:function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var s=0;s<this.encodings.length;s++){var d=(0,n.default)(this.options,this.encodings[s].options);this.drawCanvasBarcode(d,this.encodings[s]),this.drawCanvasText(d,this.encodings[s]),this.moveCanvasDrawing(this.encodings[s])}this.restoreCanvas()}},{key:"prepareCanvas",value:function(){var s=this.canvas.getContext("2d");s.save(),(0,r.calculateEncodingAttributes)(this.encodings,this.options,s);var d=(0,r.getTotalWidthOfEncodings)(this.encodings),p=(0,r.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=d+this.options.marginLeft+this.options.marginRight,this.canvas.height=p,s.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(s.fillStyle=this.options.background,s.fillRect(0,0,this.canvas.width,this.canvas.height)),s.translate(this.options.marginLeft,0)}},{key:"drawCanvasBarcode",value:function(s,d){var p=this.canvas.getContext("2d"),u=d.data,f;s.textPosition=="top"?f=s.marginTop+s.fontSize+s.textMargin:f=s.marginTop,p.fillStyle=s.lineColor;for(var g=0;g<u.length;g++){var m=g*s.width+d.barcodePadding;u[g]==="1"?p.fillRect(m,f,s.width,s.height):u[g]&&p.fillRect(m,f,s.width,s.height*u[g])}}},{key:"drawCanvasText",value:function(s,d){var p=this.canvas.getContext("2d"),u=s.fontOptions+" "+s.fontSize+"px "+s.font;if(s.displayValue){var f,g;s.textPosition=="top"?g=s.marginTop+s.fontSize-s.textMargin:g=s.height+s.textMargin+s.marginTop+s.fontSize,p.font=u,s.textAlign=="left"||d.barcodePadding>0?(f=0,p.textAlign="left"):s.textAlign=="right"?(f=d.width-1,p.textAlign="right"):(f=d.width/2,p.textAlign="center"),p.fillText(d.text,f,g)}}},{key:"moveCanvasDrawing",value:function(s){var d=this.canvas.getContext("2d");d.translate(s.width,0)}},{key:"restoreCanvas",value:function(){var s=this.canvas.getContext("2d");s.restore()}}]),l})();return Ti.default=a,Ti}var ki={},Dp;function Ey(){if(Dp)return ki;Dp=1,Object.defineProperty(ki,"__esModule",{value:!0});var e=(function(){function c(s,d){for(var p=0;p<d.length;p++){var u=d[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,d,p){return d&&c(s.prototype,d),p&&c(s,p),s}})(),t=yi(),n=o(t),r=Pp();function o(c){return c&&c.__esModule?c:{default:c}}function i(c,s){if(!(c instanceof s))throw new TypeError("Cannot call a class as a function")}var a="http://www.w3.org/2000/svg",l=(function(){function c(s,d,p){i(this,c),this.svg=s,this.encodings=d,this.options=p,this.document=p.xmlDocument||document}return e(c,[{key:"render",value:function(){var d=this.options.marginLeft;this.prepareSVG();for(var p=0;p<this.encodings.length;p++){var u=this.encodings[p],f=(0,n.default)(this.options,u.options),g=this.createGroup(d,f.marginTop,this.svg);this.setGroupOptions(g,f),this.drawSvgBarcode(g,f,u),this.drawSVGText(g,f,u),d+=u.width}}},{key:"prepareSVG",value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,r.calculateEncodingAttributes)(this.encodings,this.options);var d=(0,r.getTotalWidthOfEncodings)(this.encodings),p=(0,r.getMaximumHeightOfEncodings)(this.encodings),u=d+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(u,p),this.options.background&&this.drawRect(0,0,u,p,this.svg).setAttribute("fill",this.options.background)}},{key:"drawSvgBarcode",value:function(d,p,u){var f=u.data,g;p.textPosition=="top"?g=p.fontSize+p.textMargin:g=0;for(var m=0,b=0,v=0;v<f.length;v++)b=v*p.width+u.barcodePadding,f[v]==="1"?m++:m>0&&(this.drawRect(b-p.width*m,g,p.width*m,p.height,d),m=0);m>0&&this.drawRect(b-p.width*(m-1),g,p.width*m,p.height,d)}},{key:"drawSVGText",value:function(d,p,u){var f=this.document.createElementNS(a,"text");if(p.displayValue){var g,m;f.setAttribute("font-family",p.font),f.setAttribute("font-size",p.fontSize),p.fontOptions.includes("bold")&&f.setAttribute("font-weight","bold"),p.fontOptions.includes("italic")&&f.setAttribute("font-style","italic"),p.textPosition=="top"?m=p.fontSize-p.textMargin:m=p.height+p.textMargin+p.fontSize,p.textAlign=="left"||u.barcodePadding>0?(g=0,f.setAttribute("text-anchor","start")):p.textAlign=="right"?(g=u.width-1,f.setAttribute("text-anchor","end")):(g=u.width/2,f.setAttribute("text-anchor","middle")),f.setAttribute("x",g),f.setAttribute("y",m),f.appendChild(this.document.createTextNode(u.text)),d.appendChild(f)}}},{key:"setSvgAttributes",value:function(d,p){var u=this.svg;u.setAttribute("width",d+"px"),u.setAttribute("height",p+"px"),u.setAttribute("x","0px"),u.setAttribute("y","0px"),u.setAttribute("viewBox","0 0 "+d+" "+p),u.setAttribute("xmlns",a),u.setAttribute("version","1.1")}},{key:"createGroup",value:function(d,p,u){var f=this.document.createElementNS(a,"g");return f.setAttribute("transform","translate("+d+", "+p+")"),u.appendChild(f),f}},{key:"setGroupOptions",value:function(d,p){d.setAttribute("fill",p.lineColor)}},{key:"drawRect",value:function(d,p,u,f,g){var m=this.document.createElementNS(a,"rect");return m.setAttribute("x",d),m.setAttribute("y",p),m.setAttribute("width",u),m.setAttribute("height",f),g.appendChild(m),m}}]),c})();return ki.default=l,ki}var Ci={},$p;function Sy(){if($p)return Ci;$p=1,Object.defineProperty(Ci,"__esModule",{value:!0});var e=(function(){function r(o,i){for(var a=0;a<i.length;a++){var l=i[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}return function(o,i,a){return i&&r(o.prototype,i),a&&r(o,a),o}})();function t(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}var n=(function(){function r(o,i,a){t(this,r),this.object=o,this.encodings=i,this.options=a}return e(r,[{key:"render",value:function(){this.object.encodings=this.encodings}}]),r})();return Ci.default=n,Ci}var Np;function _y(){if(Np)return Mi;Np=1,Object.defineProperty(Mi,"__esModule",{value:!0});var e=xy(),t=a(e),n=Ey(),r=a(n),o=Sy(),i=a(o);function a(l){return l&&l.__esModule?l:{default:l}}return Mi.default={CanvasRenderer:t.default,SVGRenderer:r.default,ObjectRenderer:i.default},Mi}var Yn={},Lp;function Fp(){if(Lp)return Yn;Lp=1,Object.defineProperty(Yn,"__esModule",{value:!0});function e(a,l){if(!(a instanceof l))throw new TypeError("Cannot call a class as a function")}function t(a,l){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l&&(typeof l=="object"||typeof l=="function")?l:a}function n(a,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof l);a.prototype=Object.create(l&&l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(a,l):a.__proto__=l)}var r=(function(a){n(l,a);function l(c,s){e(this,l);var d=t(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return d.name="InvalidInputException",d.symbology=c,d.input=s,d.message='"'+d.input+'" is not a valid input for '+d.symbology,d}return l})(Error),o=(function(a){n(l,a);function l(){e(this,l);var c=t(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return c.name="InvalidElementException",c.message="Not supported type to render on",c}return l})(Error),i=(function(a){n(l,a);function l(){e(this,l);var c=t(this,(l.__proto__||Object.getPrototypeOf(l)).call(this));return c.name="NoElementException",c.message="No element to render on.",c}return l})(Error);return Yn.InvalidInputException=r,Yn.InvalidElementException=o,Yn.NoElementException=i,Yn}var zp;function My(){if(zp)return xi;zp=1,Object.defineProperty(xi,"__esModule",{value:!0});var e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},t=wy(),n=a(t),r=_y(),o=a(r),i=Fp();function a(d){return d&&d.__esModule?d:{default:d}}function l(d){if(typeof d=="string")return c(d);if(Array.isArray(d)){for(var p=[],u=0;u<d.length;u++)p.push(l(d[u]));return p}else{if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLImageElement)return s(d);if(d&&d.nodeName&&d.nodeName.toLowerCase()==="svg"||typeof SVGElement<"u"&&d instanceof SVGElement)return{element:d,options:(0,n.default)(d),renderer:o.default.SVGRenderer};if(typeof HTMLCanvasElement<"u"&&d instanceof HTMLCanvasElement)return{element:d,options:(0,n.default)(d),renderer:o.default.CanvasRenderer};if(d&&d.getContext)return{element:d,renderer:o.default.CanvasRenderer};if(d&&(typeof d>"u"?"undefined":e(d))==="object"&&!d.nodeName)return{element:d,renderer:o.default.ObjectRenderer};throw new i.InvalidElementException}}function c(d){var p=document.querySelectorAll(d);if(p.length!==0){for(var u=[],f=0;f<p.length;f++)u.push(l(p[f]));return u}}function s(d){var p=document.createElement("canvas");return{element:p,options:(0,n.default)(d),renderer:o.default.CanvasRenderer,afterRender:function(){d.setAttribute("src",p.toDataURL())}}}return xi.default=l,xi}var Ai={},Bp;function Ty(){if(Bp)return Ai;Bp=1,Object.defineProperty(Ai,"__esModule",{value:!0});var e=(function(){function r(o,i){for(var a=0;a<i.length;a++){var l=i[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}return function(o,i,a){return i&&r(o.prototype,i),a&&r(o,a),o}})();function t(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}var n=(function(){function r(o){t(this,r),this.api=o}return e(r,[{key:"handleCatch",value:function(i){if(i.name==="InvalidInputException")if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw i.message;else throw i;this.api.render=function(){}}},{key:"wrapBarcodeCall",value:function(i){try{var a=i.apply(void 0,arguments);return this.api._options.valid(!0),a}catch(l){return this.handleCatch(l),this.api}}}]),r})();return Ai.default=n,Ai}var us,Hp;function ky(){if(Hp)return us;Hp=1;var e=by(),t=v(e),n=yi(),r=v(n),o=yy(),i=v(o),a=vy(),l=v(a),c=My(),s=v(c),d=kp(),p=v(d),u=Ty(),f=v(u),g=Fp(),m=Ap(),b=v(m);function v(C){return C&&C.__esModule?C:{default:C}}var w=function(){},E=function(I,S,$){var N=new w;if(typeof I>"u")throw Error("No element to render on was provided.");return N._renderProperties=(0,s.default)(I),N._encodings=[],N._options=b.default,N._errorHandler=new f.default(N),typeof S<"u"&&($=$||{},$.format||($.format=P()),N.options($)[$.format](S,$).render()),N};E.getModule=function(C){return t.default[C]};for(var k in t.default)t.default.hasOwnProperty(k)&&L(t.default,k);function L(C,I){w.prototype[I]=w.prototype[I.toUpperCase()]=w.prototype[I.toLowerCase()]=function(S,$){var N=this;return N._errorHandler.wrapBarcodeCall(function(){$.text=typeof $.text>"u"?void 0:""+$.text;var z=(0,r.default)(N._options,$);z=(0,p.default)(z);var T=C[I],ie=R(S,T,z);return N._encodings.push(ie),N})}}function R(C,I,S){C=""+C;var $=new I(C,S);if(!$.valid())throw new g.InvalidInputException($.constructor.name,C);var N=$.encode();N=(0,i.default)(N);for(var z=0;z<N.length;z++)N[z].options=(0,r.default)(S,N[z].options);return N}function P(){return t.default.CODE128?"CODE128":Object.keys(t.default)[0]}w.prototype.options=function(C){return this._options=(0,r.default)(this._options,C),this},w.prototype.blank=function(C){var I=new Array(C+1).join("0");return this._encodings.push({data:I}),this},w.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var C;for(var I in this._renderProperties){C=this._renderProperties[I];var S=(0,r.default)(this._options,C.options);S.format=="auto"&&(S.format=P()),this._errorHandler.wrapBarcodeCall(function(){var $=S.value,N=t.default[S.format.toUpperCase()],z=R($,N,S);O(C,z,S)})}}},w.prototype.render=function(){if(!this._renderProperties)throw new g.NoElementException;if(Array.isArray(this._renderProperties))for(var C=0;C<this._renderProperties.length;C++)O(this._renderProperties[C],this._encodings,this._options);else O(this._renderProperties,this._encodings,this._options);return this},w.prototype._defaults=b.default;function O(C,I,S){I=(0,i.default)(I);for(var $=0;$<I.length;$++)I[$].options=(0,r.default)(S,I[$].options),(0,l.default)(I[$].options);(0,l.default)(S);var N=C.renderer,z=new N(C.element,I,S);z.render(),C.afterRender&&C.afterRender()}return typeof window<"u"&&(window.JsBarcode=E),typeof jQuery<"u"&&(jQuery.fn.JsBarcode=function(C,I){var S=[];return jQuery(this).each(function(){S.push(this)}),E(S,C,I)}),us=E,us}var Cy=ky();const ps=Ru(Cy);var Kn={},fs,Up;function Ay(){return Up||(Up=1,fs=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),fs}var hs={},en={},qp;function En(){if(qp)return en;qp=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return en.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},en.getSymbolTotalCodewords=function(r){return t[r]},en.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},en.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},en.isKanjiModeEnabled=function(){return typeof e<"u"},en.toSJIS=function(r){return e(r)},en}var gs={},Wp;function ms(){return Wp||(Wp=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,o){if(e.isValid(r))return r;try{return t(r)}catch{return o}}})(gs)),gs}var bs,jp;function Oy(){if(jp)return bs;jp=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},bs=e,bs}var ys,Gp;function Iy(){if(Gp)return ys;Gp=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,r,o){const i=t*this.size+n;this.data[i]=r,o&&(this.reservedBit[i]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},ys=e,ys}var vs={},Vp;function Py(){return Vp||(Vp=1,(function(e){const t=En().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,i=t(r),a=i===145?26:Math.ceil((i-13)/(2*o-2))*2,l=[i-7];for(let c=1;c<o-1;c++)l[c]=l[c-1]-a;return l.push(6),l.reverse()},e.getPositions=function(r){const o=[],i=e.getRowColCoords(r),a=i.length;for(let l=0;l<a;l++)for(let c=0;c<a;c++)l===0&&c===0||l===0&&c===a-1||l===a-1&&c===0||o.push([i[l],i[c]]);return o}})(vs)),vs}var ws={},Yp;function Ry(){if(Yp)return ws;Yp=1;const e=En().getSymbolSize,t=7;return ws.getPositions=function(r){const o=e(r);return[[0,0],[o-t,0],[0,o-t]]},ws}var xs={},Kp;function Dy(){return Kp||(Kp=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const i=o.size;let a=0,l=0,c=0,s=null,d=null;for(let p=0;p<i;p++){l=c=0,s=d=null;for(let u=0;u<i;u++){let f=o.get(p,u);f===s?l++:(l>=5&&(a+=t.N1+(l-5)),s=f,l=1),f=o.get(u,p),f===d?c++:(c>=5&&(a+=t.N1+(c-5)),d=f,c=1)}l>=5&&(a+=t.N1+(l-5)),c>=5&&(a+=t.N1+(c-5))}return a},e.getPenaltyN2=function(o){const i=o.size;let a=0;for(let l=0;l<i-1;l++)for(let c=0;c<i-1;c++){const s=o.get(l,c)+o.get(l,c+1)+o.get(l+1,c)+o.get(l+1,c+1);(s===4||s===0)&&a++}return a*t.N2},e.getPenaltyN3=function(o){const i=o.size;let a=0,l=0,c=0;for(let s=0;s<i;s++){l=c=0;for(let d=0;d<i;d++)l=l<<1&2047|o.get(s,d),d>=10&&(l===1488||l===93)&&a++,c=c<<1&2047|o.get(d,s),d>=10&&(c===1488||c===93)&&a++}return a*t.N3},e.getPenaltyN4=function(o){let i=0;const a=o.data.length;for(let c=0;c<a;c++)i+=o.data[c];return Math.abs(Math.ceil(i*100/a/5)-10)*t.N4};function n(r,o,i){switch(r){case e.Patterns.PATTERN000:return(o+i)%2===0;case e.Patterns.PATTERN001:return o%2===0;case e.Patterns.PATTERN010:return i%3===0;case e.Patterns.PATTERN011:return(o+i)%3===0;case e.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(i/3))%2===0;case e.Patterns.PATTERN101:return o*i%2+o*i%3===0;case e.Patterns.PATTERN110:return(o*i%2+o*i%3)%2===0;case e.Patterns.PATTERN111:return(o*i%3+(o+i)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(o,i){const a=i.size;for(let l=0;l<a;l++)for(let c=0;c<a;c++)i.isReserved(c,l)||i.xor(c,l,n(o,c,l))},e.getBestMask=function(o,i){const a=Object.keys(e.Patterns).length;let l=0,c=1/0;for(let s=0;s<a;s++){i(s),e.applyMask(s,o);const d=e.getPenaltyN1(o)+e.getPenaltyN2(o)+e.getPenaltyN3(o)+e.getPenaltyN4(o);e.applyMask(s,o),d<c&&(c=d,l=s)}return l}})(xs)),xs}var Oi={},Xp;function Zp(){if(Xp)return Oi;Xp=1;const e=ms(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Oi.getBlocksCount=function(o,i){switch(i){case e.L:return t[(o-1)*4+0];case e.M:return t[(o-1)*4+1];case e.Q:return t[(o-1)*4+2];case e.H:return t[(o-1)*4+3];default:return}},Oi.getTotalCodewordsCount=function(o,i){switch(i){case e.L:return n[(o-1)*4+0];case e.M:return n[(o-1)*4+1];case e.Q:return n[(o-1)*4+2];case e.H:return n[(o-1)*4+3];default:return}},Oi}var Es={},Ur={},Jp;function $y(){if(Jp)return Ur;Jp=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let o=0;o<255;o++)e[o]=r,t[r]=o,r<<=1,r&256&&(r^=285);for(let o=255;o<512;o++)e[o]=e[o-255]})(),Ur.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},Ur.exp=function(r){return e[r]},Ur.mul=function(r,o){return r===0||o===0?0:e[t[r]+t[o]]},Ur}var Qp;function Ny(){return Qp||(Qp=1,(function(e){const t=$y();e.mul=function(r,o){const i=new Uint8Array(r.length+o.length-1);for(let a=0;a<r.length;a++)for(let l=0;l<o.length;l++)i[a+l]^=t.mul(r[a],o[l]);return i},e.mod=function(r,o){let i=new Uint8Array(r);for(;i.length-o.length>=0;){const a=i[0];for(let c=0;c<o.length;c++)i[c]^=t.mul(o[c],a);let l=0;for(;l<i.length&&i[l]===0;)l++;i=i.slice(l)}return i},e.generateECPolynomial=function(r){let o=new Uint8Array([1]);for(let i=0;i<r;i++)o=e.mul(o,new Uint8Array([1,t.exp(i)]));return o}})(Es)),Es}var Ss,ef;function Ly(){if(ef)return Ss;ef=1;const e=Ny();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(r.length+this.degree);o.set(r);const i=e.mod(o,this.genPoly),a=this.degree-i.length;if(a>0){const l=new Uint8Array(this.degree);return l.set(i,a),l}return i},Ss=t,Ss}var _s={},Ms={},Ts={},tf;function nf(){return tf||(tf=1,Ts.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ts}var Rt={},rf;function of(){if(rf)return Rt;rf=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
|
|
264
|
+
]))+`;Rt.KANJI=new RegExp(n,"g"),Rt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Rt.BYTE=new RegExp(r,"g"),Rt.NUMERIC=new RegExp(e,"g"),Rt.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+n+"$"),i=new RegExp("^"+e+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Rt.testKanji=function(c){return o.test(c)},Rt.testNumeric=function(c){return i.test(c)},Rt.testAlphanumeric=function(c){return a.test(c)},Rt}var af;function Sn(){return af||(af=1,(function(e){const t=nf(),n=of();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,a){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!t.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?i.ccBits[0]:a<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return n.testNumeric(i)?e.NUMERIC:n.testAlphanumeric(i)?e.ALPHANUMERIC:n.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function r(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+o)}}e.from=function(i,a){if(e.isValid(i))return i;try{return r(i)}catch{return a}}})(Ms)),Ms}var sf;function Fy(){return sf||(sf=1,(function(e){const t=En(),n=Zp(),r=ms(),o=Sn(),i=nf(),a=7973,l=t.getBCHDigit(a);function c(u,f,g){for(let m=1;m<=40;m++)if(f<=e.getCapacity(m,g,u))return m}function s(u,f){return o.getCharCountIndicator(u,f)+4}function d(u,f){let g=0;return u.forEach(function(m){const b=s(m.mode,f);g+=b+m.getBitsLength()}),g}function p(u,f){for(let g=1;g<=40;g++)if(d(u,g)<=e.getCapacity(g,f,o.MIXED))return g}e.from=function(f,g){return i.isValid(f)?parseInt(f,10):g},e.getCapacity=function(f,g,m){if(!i.isValid(f))throw new Error("Invalid QR Code version");typeof m>"u"&&(m=o.BYTE);const b=t.getSymbolTotalCodewords(f),v=n.getTotalCodewordsCount(f,g),w=(b-v)*8;if(m===o.MIXED)return w;const E=w-s(m,f);switch(m){case o.NUMERIC:return Math.floor(E/10*3);case o.ALPHANUMERIC:return Math.floor(E/11*2);case o.KANJI:return Math.floor(E/13);case o.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(f,g){let m;const b=r.from(g,r.M);if(Array.isArray(f)){if(f.length>1)return p(f,b);if(f.length===0)return 1;m=f[0]}else m=f;return c(m.mode,m.getLength(),b)},e.getEncodedBits=function(f){if(!i.isValid(f)||f<7)throw new Error("Invalid QR Code version");let g=f<<12;for(;t.getBCHDigit(g)-l>=0;)g^=a<<t.getBCHDigit(g)-l;return f<<12|g}})(_s)),_s}var ks={},lf;function zy(){if(lf)return ks;lf=1;const e=En(),t=1335,n=21522,r=e.getBCHDigit(t);return ks.getEncodedBits=function(i,a){const l=i.bit<<3|a;let c=l<<10;for(;e.getBCHDigit(c)-r>=0;)c^=t<<e.getBCHDigit(c)-r;return(l<<10|c)^n},ks}var Cs={},As,cf;function By(){if(cf)return As;cf=1;const e=Sn();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let o,i,a;for(o=0;o+3<=this.data.length;o+=3)i=this.data.substr(o,3),a=parseInt(i,10),r.put(a,10);const l=this.data.length-o;l>0&&(i=this.data.substr(o),a=parseInt(i,10),r.put(a,l*3+1))},As=t,As}var Os,df;function Hy(){if(df)return Os;df=1;const e=Sn(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(r){this.mode=e.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(o){let i;for(i=0;i+2<=this.data.length;i+=2){let a=t.indexOf(this.data[i])*45;a+=t.indexOf(this.data[i+1]),o.put(a,11)}this.data.length%2&&o.put(t.indexOf(this.data[i]),6)},Os=n,Os}var Is,uf;function Uy(){if(uf)return Is;uf=1;const e=Sn();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(r){return r*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let r=0,o=this.data.length;r<o;r++)n.put(this.data[r],8)},Is=t,Is}var Ps,pf;function qy(){if(pf)return Ps;pf=1;const e=Sn(),t=En();function n(r){this.mode=e.KANJI,this.data=r}return n.getBitsLength=function(o){return o*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let o;for(o=0;o<this.data.length;o++){let i=t.toSJIS(this.data[o]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
|
|
265
|
+
Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),r.put(i,13)}},Ps=n,Ps}var Rs={exports:{}},ff;function Wy(){return ff||(ff=1,(function(e){var t={single_source_shortest_paths:function(n,r,o){var i={},a={};a[r]=0;var l=t.PriorityQueue.make();l.push(r,0);for(var c,s,d,p,u,f,g,m,b;!l.empty();){c=l.pop(),s=c.value,p=c.cost,u=n[s]||{};for(d in u)u.hasOwnProperty(d)&&(f=u[d],g=p+f,m=a[d],b=typeof a[d]>"u",(b||m>g)&&(a[d]=g,l.push(d,g),i[d]=s))}if(typeof o<"u"&&typeof a[o]>"u"){var v=["Could not find a path from ",r," to ",o,"."].join("");throw new Error(v)}return i},extract_shortest_path_from_predecessor_list:function(n,r){for(var o=[],i=r;i;)o.push(i),n[i],i=n[i];return o.reverse(),o},find_path:function(n,r,o){var i=t.single_source_shortest_paths(n,r,o);return t.extract_shortest_path_from_predecessor_list(i,o)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,o={},i;n=n||{};for(i in r)r.hasOwnProperty(i)&&(o[i]=r[i]);return o.queue=[],o.sorter=n.sorter||r.default_sorter,o},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var o={value:n,cost:r};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Rs)),Rs.exports}var hf;function jy(){return hf||(hf=1,(function(e){const t=Sn(),n=By(),r=Hy(),o=Uy(),i=qy(),a=of(),l=En(),c=Wy();function s(v){return unescape(encodeURIComponent(v)).length}function d(v,w,E){const k=[];let L;for(;(L=v.exec(E))!==null;)k.push({data:L[0],index:L.index,mode:w,length:L[0].length});return k}function p(v){const w=d(a.NUMERIC,t.NUMERIC,v),E=d(a.ALPHANUMERIC,t.ALPHANUMERIC,v);let k,L;return l.isKanjiModeEnabled()?(k=d(a.BYTE,t.BYTE,v),L=d(a.KANJI,t.KANJI,v)):(k=d(a.BYTE_KANJI,t.BYTE,v),L=[]),w.concat(E,k,L).sort(function(P,O){return P.index-O.index}).map(function(P){return{data:P.data,mode:P.mode,length:P.length}})}function u(v,w){switch(w){case t.NUMERIC:return n.getBitsLength(v);case t.ALPHANUMERIC:return r.getBitsLength(v);case t.KANJI:return i.getBitsLength(v);case t.BYTE:return o.getBitsLength(v)}}function f(v){return v.reduce(function(w,E){const k=w.length-1>=0?w[w.length-1]:null;return k&&k.mode===E.mode?(w[w.length-1].data+=E.data,w):(w.push(E),w)},[])}function g(v){const w=[];for(let E=0;E<v.length;E++){const k=v[E];switch(k.mode){case t.NUMERIC:w.push([k,{data:k.data,mode:t.ALPHANUMERIC,length:k.length},{data:k.data,mode:t.BYTE,length:k.length}]);break;case t.ALPHANUMERIC:w.push([k,{data:k.data,mode:t.BYTE,length:k.length}]);break;case t.KANJI:w.push([k,{data:k.data,mode:t.BYTE,length:s(k.data)}]);break;case t.BYTE:w.push([{data:k.data,mode:t.BYTE,length:s(k.data)}])}}return w}function m(v,w){const E={},k={start:{}};let L=["start"];for(let R=0;R<v.length;R++){const P=v[R],O=[];for(let C=0;C<P.length;C++){const I=P[C],S=""+R+C;O.push(S),E[S]={node:I,lastCount:0},k[S]={};for(let $=0;$<L.length;$++){const N=L[$];E[N]&&E[N].node.mode===I.mode?(k[N][S]=u(E[N].lastCount+I.length,I.mode)-u(E[N].lastCount,I.mode),E[N].lastCount+=I.length):(E[N]&&(E[N].lastCount=I.length),k[N][S]=u(I.length,I.mode)+4+t.getCharCountIndicator(I.mode,w))}}L=O}for(let R=0;R<L.length;R++)k[L[R]].end=0;return{map:k,table:E}}function b(v,w){let E;const k=t.getBestModeForData(v);if(E=t.from(w,k),E!==t.BYTE&&E.bit<k.bit)throw new Error('"'+v+'" cannot be encoded with mode '+t.toString(E)+`.
|
|
266
|
+
Suggested mode is: `+t.toString(k));switch(E===t.KANJI&&!l.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new n(v);case t.ALPHANUMERIC:return new r(v);case t.KANJI:return new i(v);case t.BYTE:return new o(v)}}e.fromArray=function(w){return w.reduce(function(E,k){return typeof k=="string"?E.push(b(k,null)):k.data&&E.push(b(k.data,k.mode)),E},[])},e.fromString=function(w,E){const k=p(w,l.isKanjiModeEnabled()),L=g(k),R=m(L,E),P=c.find_path(R.map,"start","end"),O=[];for(let C=1;C<P.length-1;C++)O.push(R.table[P[C]].node);return e.fromArray(f(O))},e.rawSplit=function(w){return e.fromArray(p(w,l.isKanjiModeEnabled()))}})(Cs)),Cs}var gf;function Gy(){if(gf)return hs;gf=1;const e=En(),t=ms(),n=Oy(),r=Iy(),o=Py(),i=Ry(),a=Dy(),l=Zp(),c=Ly(),s=Fy(),d=zy(),p=Sn(),u=jy();function f(R,P){const O=R.size,C=i.getPositions(P);for(let I=0;I<C.length;I++){const S=C[I][0],$=C[I][1];for(let N=-1;N<=7;N++)if(!(S+N<=-1||O<=S+N))for(let z=-1;z<=7;z++)$+z<=-1||O<=$+z||(N>=0&&N<=6&&(z===0||z===6)||z>=0&&z<=6&&(N===0||N===6)||N>=2&&N<=4&&z>=2&&z<=4?R.set(S+N,$+z,!0,!0):R.set(S+N,$+z,!1,!0))}}function g(R){const P=R.size;for(let O=8;O<P-8;O++){const C=O%2===0;R.set(O,6,C,!0),R.set(6,O,C,!0)}}function m(R,P){const O=o.getPositions(P);for(let C=0;C<O.length;C++){const I=O[C][0],S=O[C][1];for(let $=-2;$<=2;$++)for(let N=-2;N<=2;N++)$===-2||$===2||N===-2||N===2||$===0&&N===0?R.set(I+$,S+N,!0,!0):R.set(I+$,S+N,!1,!0)}}function b(R,P){const O=R.size,C=s.getEncodedBits(P);let I,S,$;for(let N=0;N<18;N++)I=Math.floor(N/3),S=N%3+O-8-3,$=(C>>N&1)===1,R.set(I,S,$,!0),R.set(S,I,$,!0)}function v(R,P,O){const C=R.size,I=d.getEncodedBits(P,O);let S,$;for(S=0;S<15;S++)$=(I>>S&1)===1,S<6?R.set(S,8,$,!0):S<8?R.set(S+1,8,$,!0):R.set(C-15+S,8,$,!0),S<8?R.set(8,C-S-1,$,!0):S<9?R.set(8,15-S-1+1,$,!0):R.set(8,15-S-1,$,!0);R.set(C-8,8,1,!0)}function w(R,P){const O=R.size;let C=-1,I=O-1,S=7,$=0;for(let N=O-1;N>0;N-=2)for(N===6&&N--;;){for(let z=0;z<2;z++)if(!R.isReserved(I,N-z)){let T=!1;$<P.length&&(T=(P[$]>>>S&1)===1),R.set(I,N-z,T),S--,S===-1&&($++,S=7)}if(I+=C,I<0||O<=I){I-=C,C=-C;break}}}function E(R,P,O){const C=new n;O.forEach(function(z){C.put(z.mode.bit,4),C.put(z.getLength(),p.getCharCountIndicator(z.mode,R)),z.write(C)});const I=e.getSymbolTotalCodewords(R),S=l.getTotalCodewordsCount(R,P),$=(I-S)*8;for(C.getLengthInBits()+4<=$&&C.put(0,4);C.getLengthInBits()%8!==0;)C.putBit(0);const N=($-C.getLengthInBits())/8;for(let z=0;z<N;z++)C.put(z%2?17:236,8);return k(C,R,P)}function k(R,P,O){const C=e.getSymbolTotalCodewords(P),I=l.getTotalCodewordsCount(P,O),S=C-I,$=l.getBlocksCount(P,O),N=C%$,z=$-N,T=Math.floor(C/$),ie=Math.floor(S/$),pe=ie+1,Ge=T-ie,Q=new c(Ge);let Te=0;const he=new Array($),de=new Array($);let ye=0;const ne=new Uint8Array(R.buffer);for(let $e=0;$e<$;$e++){const fe=$e<z?ie:pe;he[$e]=ne.slice(Te,Te+fe),de[$e]=Q.encode(he[$e]),Te+=fe,ye=Math.max(ye,fe)}const De=new Uint8Array(C);let it=0,te,Ve;for(te=0;te<ye;te++)for(Ve=0;Ve<$;Ve++)te<he[Ve].length&&(De[it++]=he[Ve][te]);for(te=0;te<Ge;te++)for(Ve=0;Ve<$;Ve++)De[it++]=de[Ve][te];return De}function L(R,P,O,C){let I;if(Array.isArray(R))I=u.fromArray(R);else if(typeof R=="string"){let T=P;if(!T){const ie=u.rawSplit(R);T=s.getBestVersionForData(ie,O)}I=u.fromString(R,T||40)}else throw new Error("Invalid data");const S=s.getBestVersionForData(I,O);if(!S)throw new Error("The amount of data is too big to be stored in a QR Code");if(!P)P=S;else if(P<S)throw new Error(`
|
|
267
267
|
The chosen QR Code version cannot contain this amount of data.
|
|
268
268
|
Minimum version required to store current data is: `+S+`.
|
|
269
|
-
`);const $=E(P,O,I),
|
|
270
|
-
`;return typeof l=="function"&&l(null,b),b},Ns}var vf;function jy(){if(vf)return Vn;vf=1;const e=My(),t=Uy(),n=qy(),r=Wy();function o(i,a,l,c,s){const d=[].slice.call(arguments,1),p=d.length,u=typeof d[p-1]=="function";if(!u&&!e())throw new Error("Callback required as last argument");if(u){if(p<2)throw new Error("Too few arguments provided");p===2?(s=l,l=a,a=c=void 0):p===3&&(a.getContext&&typeof s>"u"?(s=c,c=void 0):(s=c,c=l,l=a,a=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(l=a,a=c=void 0):p===2&&!a.getContext&&(c=l,l=a,a=void 0),new Promise(function(f,g){try{const m=t.create(l,c);f(i(m,a,c))}catch(m){g(m)}})}try{const f=t.create(l,c);s(null,i(f,a,c))}catch(f){s(f)}}return Vn.create=t.create,Vn.toCanvas=o.bind(null,n.render),Vn.toDataURL=o.bind(null,n.renderToDataURL),Vn.toString=o.bind(null,function(i,a,l){return r.render(i,l)}),Vn}var Gy=jy();const Vy=Ru(Gy),wf="http://www.w3.org/2000/svg";function Yy(e){const t=e.getAttribute("viewBox");if(!t)return null;const n=t.trim().split(/[\s,]+/).map(Number);return n.length!==4||n.some(r=>!Number.isFinite(r))?null:{width:n[2],height:n[3]}}function Ky(e,t){const n=document.createElementNS(wf,"svg"),r=ur(t.barWidth),o=ca(t.barQuietZone),i=l=>{ps(n,e,{format:t.barcodeType||"CODE128",width:r,height:l*r,displayValue:t.showText!==!1,fontSize:(t.fontSize??po)*r,margin:0,marginLeft:o*r,marginRight:o*r,marginTop:0,marginBottom:da*r});const c=Yy(n);return c?{widthUnits:c.width,heightUnits:c.height}:null},a=pa({barHeightMm:t.barHeightMm,boxWidthMm:t.targetWidthMm??0,boxHeightMm:t.targetHeightMm??0,dpi:t.printerDpi,barWidth:t.barWidth,measure:i});return a.size&&(n.setAttribute("width",`${a.size.widthMm}mm`),n.setAttribute("height",`${a.size.heightMm}mm`)),n.setAttribute("shape-rendering","crispEdges"),n.outerHTML}function Xy(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):Tc}function Zy(e,t){const n=(t.qrCodeLevel??"M").toUpperCase(),o=Vy.create(e,{errorCorrectionLevel:["L","M","Q","H"].includes(n)?n:"M"}).modules,i=o.size,a=4,l=Xy(t.qrQuietZone)*a,c=i*a+l*2;let s="";for(let d=0;d<i;d++)for(let p=0;p<i;p++)o.get(p,d)&&(s+=`<rect x="${l+p*a}" y="${l+d*a}" width="${a}" height="${a}" fill="#000"/>`);return`<svg xmlns="${wf}" viewBox="0 0 ${c} ${c}" width="${c}" height="${c}" shape-rendering="crispEdges">${s}</svg>`}function xf(e,t,n={}){if(!e)throw new Error("empty barcode value");return t==="qrcode"?Zy(e,n):Ky(e,n)}const Ls={render(e,t,n={}){return xf(e,t,n)}},Fs=.5,Jy=12;function zs(e,t){const n=e.getAttribute(t);if(n===null||n==="")return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ef(e,t){if(e.scrollWidth>e.clientWidth+Fs)return!0;const n=e.scrollHeight;return t!==void 0?n>t+Fs:n>e.clientHeight+Fs}function Sf(e){if(e.getAttribute("data-fit")!=="shrink")return;const t=lr(zs(e,"data-fit-min")),n=Math.max(zs(e,"data-fit-base")??t,t),r=zs(e,"data-fit-mm"),o=r!==void 0&&r>0?dn(r):void 0,i=s=>{const d=Kg(s);return e.style.fontSize=`${d}pt`,e.setAttribute("data-fit-size",String(d)),d},a=i(n);if(!Ef(e,o)||n<=t)return a;let l=t,c=n;for(let s=0;s<Jy;s++){const d=(l+c)/2;i(d),Ef(e,o)?c=d:l=d}return i(l)}function Qy(e){const t=[];return e.querySelectorAll('[data-fit="shrink"]').forEach(n=>{const r=Sf(n),o=n.getAttribute("data-fit-key");r===void 0||!o||t.push({key:o,fontSizePt:r})}),t}const ev="2",tv=5e3;async function nv(e,t=tv){const n=e.document,r=i=>Promise.race([i,new Promise(a=>setTimeout(a,t))]),o=(async()=>{n.readyState!=="complete"&&await r(new Promise(a=>e.addEventListener("load",()=>a(),{once:!0})));const i=n.fonts;i&&(await r(Promise.all(rv(n).map(a=>i.load(`${a.style} ${a.weight} 16px "${a.family}"`).catch(()=>{})))),i.ready&&await r(i.ready)),await r(Promise.all(Array.from(n.images??[]).map(a=>a.complete?Promise.resolve():new Promise(l=>{a.addEventListener("load",()=>l(),{once:!0}),a.addEventListener("error",()=>l(),{once:!0})}))))})();await r(o)}function rv(e){const t=[];for(const r of Array.from(e.styleSheets??[])){let o;try{o=r.cssRules}catch{continue}for(const i of Array.from(o??[])){if(i.type!==5)continue;const a=i.style,l=(a.getPropertyValue("font-family")||"").replace(/^["']|["']$/g,"");l&&t.push({family:l,weight:a.getPropertyValue("font-weight")||"400",style:a.getPropertyValue("font-style")||"normal"})}}return t}function ov(e){const t=[];return e.querySelectorAll("[data-measure-id]").forEach(n=>{const r=n,o=r.getAttribute("data-measure-id");if(!o)return;const i=r.getBoundingClientRect().height,a=r.querySelector("table.print-table");if(!a){const c=r.querySelectorAll(".print-flow-row[data-flow-row-index]");if(c.length>0){const s=[];c.forEach(d=>s.push(d.getBoundingClientRect().height)),t.push({id:o,heightPx:i,rowHeightsPx:s});return}t.push({id:o,heightPx:i});return}const l=[];a.querySelectorAll("tbody > tr[data-row-index]").forEach(c=>{l.push(c.getBoundingClientRect().height)}),t.push({id:o,heightPx:i,rowHeightsPx:l})}),t}function iv(e){const t=e.querySelector(".print-page"),n=e.querySelector(".content-area");if(!t||!n)return 0;const r=t.getBoundingClientRect().top;let o=0;n.querySelectorAll("*").forEach(a=>{if(a.classList.contains("print-element"))return;const l=a.getBoundingClientRect();l.height>0&&(o=Math.max(o,l.bottom-r))}),n.querySelectorAll(".print-element").forEach(a=>{const l=a.getBoundingClientRect(),c=Number.parseFloat(e.defaultView?.getComputedStyle(a).marginBottom??"0")||0;l.height>0&&(o=Math.max(o,l.bottom-r+c))});const i=n.getBoundingClientRect();return i.height>0&&(o=Math.max(o,i.bottom-r)),o}function av(e,t=0){const r=e.querySelectorAll(".print-page")[t];if(!r)return[];const o=r.getBoundingClientRect(),i=e.defaultView?.getComputedStyle(r),a=Number.parseFloat(i?.paddingLeft??"0")||0,l=Number.parseFloat(i?.paddingTop??"0")||0,c=[];return r.querySelectorAll("[data-element-id]").forEach(s=>{if(s.querySelector("[data-element-id]"))return;const d=s.getAttribute("data-element-id");if(!d)return;const p=s.getBoundingClientRect(),u=sv(s,o,a,l);c.push({id:d,left:p.left-u.left,top:p.top-u.top,width:p.width,height:p.height,zone:u.zone})}),c}function sv(e,t,n,r){const o=(c,s)=>{const d=c.getBoundingClientRect();return{left:d.left,top:d.top,zone:s}},i=e.closest(".page-header");if(i)return o(i,"header");const a=e.closest(".page-footer");if(a)return o(a,"footer");const l=e.closest(".content-area");return l?o(l,"content"):{left:t.left+n,top:t.top+r,zone:"content"}}function lv(e){const t={};for(const n of e)try{t[n.key]=xf(n.value,n.cellType,n.opts)}catch{}return t}const cv={version:ev,waitReady:nv,readMeasurements:ov,readContentBottom:iv,readElementRects:av,renderCodes:lv,applyTextFit:Qy};function dv(){return{async createDriver(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;left:-10000px;top:0;border:0;visibility:hidden;pointer-events:none;",document.body.appendChild(e);let t=e.contentDocument??document;return{requiresExecutor:!1,async open(n){e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,t=e.contentDocument??document},async setContent(n){t=e.contentDocument??document,t.open(),t.write(n),t.close()},async injectExecutor(n){},async evaluate(n,r){const o=cv[n];if(typeof o!="function"){const s=(e.contentWindow?.__wormDom??globalThis.__wormDom)?.[n];if(typeof s!="function")throw new Error(`执行器方法 ${n} 未注入`);return s(...r??[])}const i=r??[],a=Zb[n],l=o;return a==="window"?l(e.contentWindow,...i):a==="document"?l(t,...i):l(...i)},async close(){e.remove()}}}}}function uv(){return e1(dv())}async function pv(e,t,n,r,o){const i=await u1({templateJson:e,printData:t,baseUrl:n,fontBaseUrl:o?.fontBaseUrl??"",paperHeightMm:o?.paperHeightMm,codeRenderer:r,renderers:o?.renderers},uv());return{html:i.html,pageCount:i.pageCount,pageLayouts:i.pageLayouts,paperMm:i.paperMm,continuous:i.continuous,copies:i.copies,copyPaperMm:i.copyPaperMm}}var _f=Symbol.for("worm-print-platform.element-ui-registry.v1"),Mf=globalThis;function Bs(){const e=Mf[_f];if(e)return e;const t={entries:new Map,listeners:new Set,nextSeq:0};return Mf[_f]=t,t}function fv(e){if(e)return Bs().entries.get(e)?.ui}function hv(){const e=[...Bs().entries.entries()];return e.sort((t,n)=>t[1].seq-n[1].seq),e.map(([t,n])=>({type:t,ui:n.ui}))}function gv(e){const t=Bs();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function h(e,t={},n=[]){return{tag:e,props:t,children:n}}const Hs="http://www.w3.org/2000/svg",mv=new Set(["draggable","contenteditable","spellcheck"]),bv=new Set(["indeterminate"]);function yv(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="g"}function vv(e){return e instanceof Element&&e.namespaceURI===Hs}function Je(e,t){if(typeof e=="string"){const a=document.createTextNode(e);return t.appendChild(a),a}if(e instanceof Node)return t.appendChild(e),e;const{tag:n,props:r,children:o}=e,i=yv(n)||vv(t)?document.createElementNS(Hs,n):document.createElement(n);for(const[a,l]of Object.entries(r))if(!(l==null||l===!1))if(a==="class")i.setAttribute("class",String(l));else if(a==="style")typeof l=="string"?i.style.cssText=l:Object.assign(i.style,l);else if(a==="html")i.innerHTML=String(l);else if(a==="text")i.textContent=String(l);else if(a.startsWith("on")&&typeof l=="function")i.addEventListener(a.slice(2).toLowerCase(),l);else if(a==="dataset")for(const[c,s]of Object.entries(l))i.dataset[c]=s;else bv.has(a)?i[a]=!0:typeof l=="boolean"?l&&i.setAttribute(a,mv.has(a)?"true":""):i.setAttribute(a,String(l));for(const a of o)Je(a,i);return t.appendChild(i),i}function Tf(e){for(;e.firstChild;)e.removeChild(e.firstChild)}const wv=Hs;function Br(){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 Us="开启拼版后只能有一个设计页面";function qs(e){const t=(n,r)=>(n??[]).map(o=>{const i={...o.options};return(o.printElementType?.type??o.type)==="table"&&ir(i),{id:o.id||Ln(),zone:r,options:i,printElementType:{...o.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 kf(e){const t=e.elements,n=r=>t.filter(o=>(o.zone||"content")===r).map(o=>({id:o.id,type:o.printElementType.type,options:{...o.options},printElementType:{...o.printElementType}}));return{unit:"mm",...e,header:{...e.header,elements:n("header")},footer:{...e.footer,elements:n("footer")},elements:n("content"),guides:[...e.guides??[]]}}function Cf(e){const t=(r,o)=>{const i=qs(Bm(r));return i.name||(i.name=`页面 ${o+1}`),i};if(!e)return[t(Br(),0)];const n=Array.isArray(e.pages)?e.pages:[e];return n.length?n.map(t):[t(Br(),0)]}const Yn=e=>JSON.parse(JSON.stringify(e));class Af{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=N1();group=L1();constructor(t={}){if(this.pages=Cf(t.initialTemplate),this.fields=t.initialFields??[],t.initialElements?.length){const n=this.pages[0];n.elements=[...n.elements,...t.initialElements]}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t=!0){t&&(this.dirty=!0);for(const n of[...this.listeners])n()}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(Us);return}this.recordHistory();const t=this.pages[this.activePageIndex]??Br();this.pages.push(qs({...Br(),paperSize:t.paperSize,orientation:t.orientation,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 n=this.pages.length+1;for(;t.has(`页面 ${n}`);)n++;return`页面 ${n}`}duplicatePage(t){if(this.tilingEnabled){window.alert(Us);return}this.recordHistory();const n=Yn(this.pages[t]);n.name=`${n.name??`页面 ${t+1}`} 副本`,n.elements=n.elements.map(r=>({...r,id:Ln()})),this.pages.splice(t+1,0,n),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,n){this.recordHistory(),this.pages[t].name=n,this.emit()}movePage(t,n){if(n<0||n>=this.pages.length||t===n)return;this.recordHistory();const[r]=this.pages.splice(t,1);this.pages.splice(n,0,r),this.activePageIndex=n,this.emit()}onSelectionChanged;setSelection(t){this.selectedIds=t,this.onSelectionChanged?.(),this.emit(!1)}select(t){this.setSelection(new Set(t))}selectOne(t,n=!1){if(n){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,n=!1){if(n){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(n=>n.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,n){const r=this.templateData.guides??[];this.templateData.guides=[...r,{id:Ln(),type:t,position:Math.round(n*10)/10}],this.emit()}moveGuide(t,n){const r=this.templateData.guides??[];this.templateData.guides=r.map(o=>o.id===t?{...o,position:Math.round(n*10)/10}:o),this.emit(!1)}removeGuide(t){this.templateData.guides=(this.templateData.guides??[]).filter(n=>n.id!==t),this.emit()}addElement(t,n={},r){const o=Ea(t,n);return r&&!this.placeAtDropPoint(o,r)||(this.recordHistory(),this.templateData.elements.push(o),this.select(new Set([o.id])),this.emit()),o}addFieldElement(t,n={},r,o=!1){const i=o?D1(t):P1(t);return Object.assign(i.options,n),r&&!this.placeAtDropPoint(i,r)||(this.recordHistory(),this.templateData.elements.push(i),this.select(new Set([i.id])),this.emit()),i}placeAtDropPoint(t,n){const r=this.templateData,o=ad(r,n.x,n.y);if(o!=="content"&&!id(t.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const i=Oa(r)[o];return t.zone=o,t.options.left=n.x-i.left,t.options.top=n.y-i.top,o!=="content"&&Ia(t,i),!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,n){const r=this.templateData.elements.find(i=>i.id===t);if(!r)return;const o=this.live.get(t)??r;this.live.set(t,{...o,options:{...o.options,...n}})}commitLive(){if(!this.live.size)return;this.recordHistory();const t=this.templateData.elements;for(const[n,r]of this.live){const o=t.find(i=>i.id===n);o&&Object.assign(o.options,r.options)}this.live.clear(),this.emit()}dragIds(t){const n=this.templateData.elements.find(r=>r.id===t);return!n||n.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 n=!1;for(const r of this.elements){const o=t.get(r.id);!o||o===this.geoSig(r)||s0(r,this.templateData).rejected&&(n=!0)}n&&alert("该元素类型不能放入页眉/页脚"),this.emit()}geoSig(t){return`${t.zone||"content"}:${t.options.left},${t.options.top},${t.options.width},${t.options.height}`}updateElement(t,n,r=!0){r&&this.recordHistory();const o=this.templateData.elements.find(i=>i.id===t);o&&(Object.assign(o.options,n),o.printElementType.type==="table"&&ir(o.options),this.emit())}updateTemplateData(t){this.recordHistory(),Object.assign(this.templateData,t),this.emit()}moveLayer(t){if(!this.selectedIds.size)return;this.recordHistory();const n=this.templateData.elements,r=n.filter(i=>this.selectedIds.has(i.id)),o=n.filter(i=>!this.selectedIds.has(i.id));if(t==="top")this.templateData.elements=[...o,...r];else if(t==="bottom")this.templateData.elements=[...r,...o];else{const i=n.findIndex(c=>this.selectedIds.has(c.id)),a=t==="up"?i+1:i-1;if(a<0||a>=n.length)return;const l=[...n];[l[i],l[a]]=[l[a],l[i]],this.templateData.elements=l}this.emit()}alignSelected(t){this.selectedIds.size<2||(this.recordHistory(),this.align.align(this.elements.filter(n=>this.selectedIds.has(n.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=Yn(this.selectedElements),this.emit(!1)}cutSelected(){this.copy(),this.deleteSelected()}paste(t=10){if(!this.clipboard.length)return;this.recordHistory();const n=new Map;for(const i of this.clipboard){const a=i.options.groupId;a&&n.set(a,(n.get(a)??0)+1)}const r=new Map;for(const[i,a]of n)r.set(i,a>=2?Iu():void 0);const o=this.templateData.elements;for(const i of this.clipboard){const a=Yn(i);a.id=Ln(),a.options.left+=t,a.options.top+=t,a.options.groupId=a.options.groupId?r.get(a.options.groupId):void 0,o.push(a)}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,n){const r=this.selectedElements.filter(o=>!o.options.locked);if(r.length){this.moveSessionActive||(this.moveSessionActive=!0,this.recordHistory());for(const o of r)o.options.left+=t,o.options.top+=n;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:Yn(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:Yn(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:Yn(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,n=xo){this.scale=Math.max(n,Math.round(t)),this.emit(!1)}getTemplateJson(){const t=this.pages.map(kf),n=t.length===1?t[0]:{version:1,pages:t};return JSON.stringify(n)}loadTemplate(t){this.pages=Cf(t),this.activePageIndex=0,this.resetSelection(),this.recordHistory(),this.emit()}get paperSize(){return Xt(this.templateData)}}const En=Symbol("mixed"),Ws=new Set(["text","longText"]),xv=["top","right","bottom","left"],Ev={on:!0,off:!1,mixed:En};function Of(e){const t=Kc(e),n={};for(const r of xv)n[r]=Ev[t[r]];return n}const Sv=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];class _v{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(n=>n.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,n=this.tableElement?.options.tableRows;if(!t||!n)return[];const r=[];for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=n[o]?.cells[i];a&&!a.merged&&r.push(a)}return r}get textTargets(){return this.selectedElements.filter(t=>Ws.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 n=t[0];return t.every(r=>r===n)?n:En}hasToken(t,n){return(t??"").split(/\s+/).includes(n)}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 n=t.map(o=>o.fontWeight==="bold"||o.fontWeight==="bolder"),r=t.map(o=>o.textDecoration);return{fontFamily:this.pick(t.map(o=>o.fontFamily)),fontSize:this.pick(t.map(o=>o.fontSize)),color:this.pick(t.map(o=>o.color)),backgroundColor:this.pick(t.map(o=>o.backgroundColor)),textAlign:this.pick(t.map(o=>this.context==="cells"?o.align:o.textAlign)),verticalAlign:this.pick(t.map(o=>this.context==="cells"?o.valign:o.verticalAlign)),bold:n.every(Boolean)?!0:n.some(Boolean)?En:!1,underline:r.map(o=>this.hasToken(o,"underline")).every(Boolean)?!0:r.some(o=>this.hasToken(o,"underline"))?En:!1,strike:r.map(o=>this.hasToken(o,"line-through")).every(Boolean)?!0:r.some(o=>this.hasToken(o,"line-through"))?En:!1}}commit(){this.store.recordHistory(),this.store.emit()}writeCells(t){const n=this.targetCells;n.length&&(n.forEach(t),this.commit())}applyStyle(t){if(this.context==="cells"){this.writeCells(l=>{"fontFamily"in t&&(l.fontFamily=t.fontFamily),"fontSize"in t&&(l.fontSize=t.fontSize),"color"in t&&(l.color=t.color),"backgroundColor"in t&&(l.backgroundColor=t.backgroundColor),"textAlign"in t&&(l.align=t.textAlign),"verticalAlign"in t&&(l.valign=t.verticalAlign)});return}const n=this.textTargets,r=this.selectedElements,i=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(l=>l in t),a="backgroundColor"in t;!(n.length&&i)&&!(r.length&&a)||(n.forEach(l=>{const c=l.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)}),a&&r.forEach(l=>{l.options.backgroundColor=t.backgroundColor}),this.commit())}toggleBold(){if(this.context==="cells"){const r=this.values.bold!==!0;this.writeCells(o=>{o.fontWeight=r?"bold":void 0});return}const t=this.values.bold!==!0,n=this.textTargets;n.length&&(n.forEach(r=>{r.options.fontWeight=t?"bold":"normal"}),this.commit())}toggleDecoration(t){if(this.context==="cells")return;const n=this.textTargets;if(!n.length)return;const r=this.values[t==="underline"?"underline":"strike"]!==!0;n.forEach(o=>{const i=(o.options.textDecoration??"").split(/\s+/).filter(Boolean),a=i.indexOf(t);r&&a<0&&i.push(t),!r&&a>=0&&i.splice(a,1),o.options.textDecoration=i.length?i.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,n=this.tableElement?.options.tableRows;if(!t||!n)return;const r=`cells:${t.elementId}:${t.r1}:${t.c1}:${t.r2}:${t.c2}`;if(r===this.borderDraftKey)return;if(this.borderDraftKey=r,ta(n,t).mode==="multi"){this.borderStyle="solid",this.borderWidth=.75,this.borderColor="#333333",this.borderMixed={style:!1,width:!1,color:!1};return}const o=sc(n,t);if(o.style===void 0&&o.width===void 0&&o.color===void 0){this.borderMixed={style:!1,width:!1,color:!1},this.borderStyle=null,this.borderWidth=0,this.borderColor="#333333";return}this.borderMixed={style:o.style==="mixed",width:o.width==="mixed",color:o.color==="mixed"},this.borderMixed.style?this.borderStyle=null:o.style===void 0?this.borderStyle="solid":o.style==="none"?this.borderStyle=null:this.borderStyle=o.style,this.borderWidth=this.borderMixed.width?void 0:typeof o.width=="number"?o.width:.75,this.borderColor=this.borderMixed.color?void 0:typeof o.color=="string"?o.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 n=this.borderStyle===t?null:t;this.borderMixed.style=!1,this.borderStyle=n,n===null?this.borderWidth=0:this.borderWidth===0&&(this.borderWidth=.75)}applyElementBorder(t,n){const r=this.selectedElements;r.length&&(r.forEach(o=>{Xc(o.options,t,n)}),this.commit())}applyCellBorderPreset(t,n){const r=this.store.tableSelection,o=this.tableElement?.options.tableRows;!r||!o||(ic(o,{r1:r.r1,c1:r.c1,r2:r.r2,c2:r.c2},t,n),this.commit())}applyCellBorderEdges(t,n,r){this.writeCells(o=>{for(const i of t)ac(o,i,r?n:null)})}get cellEdges(){if(this.context!=="cells")return null;const t=this.targetCells;return t.length?Of(t.map(n=>n.borders)):null}toggleCellEdge(t,n){const r=this.cellEdges?.[t]!==!0;this.applyCellBorderEdges([t],n,r)}get elementEdges(){if(this.context!=="elements")return null;const t=this.selectedElements;return t.length?Of(t.map(n=>qm(n.options))):null}toggleElementEdge(t,n){const r=this.selectedElements;if(!r.length)return;const o=this.elementEdges?.[t]!==!0;r.forEach(i=>Ca(i.options,t,o,n)),this.commit()}applyBorderPreset(t){const n=this.borderStyle===null;if(this.context==="cells"){const r=n&&!this.borderMixed.style;this.applyCellBorderPreset(r?"none":t,this.borderSpec()),this.settleBorderDraft()}else this.applyElementBorder(n||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 n=this.selectedElements;n.length&&(n.forEach(r=>Ca(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 n={};for(const r of pr){const o=t[r];o&&(n[r]={...o})}return n}pickPainterSource(t=!1){const n=this.selectedElements[0];if(!n)return!1;const r=n.options,o=n.printElementType.type;return this.painterSnapshot={text:Ws.has(o)?Object.fromEntries(Sv.map(i=>[i,r[i]])):null,backgroundColor:r.backgroundColor,border:ho(o)?{borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:this.clonePainterBorders(r.borders)}:null},this.painterSource=n.id,this.painterActive=!0,this.painterLocked=t,!0}cancelPainter(){this.painterActive=!1,this.painterLocked=!1,this.painterSource=null,this.painterSnapshot=null}applyPainter(t){const n=this.painterSnapshot;if(!n||t.options.locked||t.id===this.painterSource)return!1;const r=t.options,o=t.printElementType.type;return n.text&&Ws.has(o)&&Object.assign(r,n.text),r.backgroundColor=n.backgroundColor,n.border&&ho(o)&&(r.borderWidth=n.border.borderWidth,r.borderStyle=n.border.borderStyle,r.borderColor=n.border.borderColor,r.borders=this.clonePainterBorders(n.border.borders)),!0}painterSyncSelection(){if(!this.painterActive||!this.painterSnapshot)return;const t=this.selectedElements;if(!t.length){this.cancelPainter();return}let n=!1;t.forEach(r=>{n=this.applyPainter(r)||n}),n&&(this.commit(),this.painterLocked||this.cancelPainter())}handlePainterKeydown(t){if(t.key!=="Escape"||!this.painterActive)return;const n=t.target?.tagName;n==="INPUT"||n==="TEXTAREA"||n==="SELECT"||this.cancelPainter()}}const Mv="自定义属性";function If(){const e=[];for(const{plugin:t,kind:n}of hc()){const r=fv(n.type);if(!r)continue;const i=(n.designer??t.designer)?.materialCard;e.push({type:n.type,label:n.label,icon:n.icon??i?.icon??"Shapes",group:i?.group??r.group,ui:r})}return e}function js(e){if(e)return If().find(t=>t.type===e)}function Gs(e){if(!e)return;const t=js(e.printElementType.type);if(!t||!t.ui.renderProperty)return;const n=t.ui;if(n.hasProperties)try{if(!n.hasProperties(e))return}catch{return}const r=Mv;return{ui:n,label:r,icon:t.icon,searchKeywords:n.searchKeywords?[...n.searchKeywords]:[r,t.label,t.type]}}const Ci=Object.freeze([{type:"text",label:"文本",icon:"Type",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"barcode",label:"条形码",icon:"Barcode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"qrcode",label:"二维码",icon:"QrCode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"image",label:"图片",icon:"Image",material:!0,propertyGroup:"general",dblEditableField:"src",origin:"builtin"},{type:"table",label:"表格",icon:"Table",material:!0,propertyGroup:"table",origin:"builtin"},{type:"longText",label:"长文",icon:"TextAlignStart",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"flowList",label:"流式列表",icon:"List",material:!0,propertyGroup:"general",dblEditableField:"formatter",origin:"builtin"},{type:"hline",label:"横线",icon:"Minus",material:!0,propertyGroup:"general",origin:"builtin"},{type:"vline",label:"竖线",icon:"SeparatorVertical",material:!0,propertyGroup:"general",origin:"builtin"},{type:"rect",label:"矩形",icon:"Square",material:!0,propertyGroup:"general",origin:"builtin"},{type:"oval",label:"椭圆",icon:"Circle",material:!0,propertyGroup:"general",origin:"builtin"},{type:"html",label:"HTML",icon:"Code",material:!1,propertyGroup:"general",origin:"builtin"},{type:"pageNumber",label:"页码",icon:"Shapes",material:!1,propertyGroup:"general",origin:"builtin"}]),Rf=Symbol.for("worm-print-platform.element-definitions.v1"),Pf=globalThis;function wt(){const e=Pf[Rf];if(e)return e;const t={overrides:new Map,builtinRenderers:new Map,rendererOverrides:new Map,listeners:new Set,nextSeq:0,seq:new Map};return Pf[Rf]=t,t}function Hr(){for(const e of[...wt().listeners])try{e()}catch{}}function Df(e){const t=wt();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function Tv(){return new Map(Ci.map(e=>[e.type,e]))}function kv(e){if(!e?.type||typeof e.type!="string")throw new Error("registerElementDefinition: type 必须是非空字符串");if(!e.label||typeof e.label!="string")throw new Error("registerElementDefinition: label 必须是非空字符串");const t=wt(),n={...e,origin:e.origin??"custom"};return t.overrides.set(n.type,n),t.seq.set(n.type,t.nextSeq++),Hr(),()=>{const r=wt();r.overrides.get(n.type)===n&&(r.overrides.delete(n.type),Hr())}}function Cv(e,t){if(!e||typeof t!="function")throw new Error("registerElementRenderer: 需要 type 与渲染函数");return wt().rendererOverrides.set(e,t),Hr(),()=>{const r=wt();r.rendererOverrides.get(e)===t&&(r.rendererOverrides.delete(e),Hr())}}function $f(e){const t=wt();for(const[n,r]of Object.entries(e))t.builtinRenderers.set(n,r);return()=>{const n=wt();for(const[r,o]of Object.entries(e))n.builtinRenderers.get(r)===o&&n.builtinRenderers.delete(r)}}function Av(e){const t=js(e);if(t)return{type:t.type,label:t.label,icon:t.icon,group:t.group,material:!0,propertyGroup:"general",origin:"plugin"}}function Qt(e){if(!e)return;const t=wt(),n=t.overrides.get(e)??Tv().get(e)??Av(e);if(!n)return;const r=t.rendererOverrides.get(e)??t.builtinRenderers.get(e);return r?{...n,renderContent:r}:n}function Nf(){const e=wt(),t=[],n=new Set;for(const o of Ci)t.push(Qt(o.type)??o),n.add(o.type);const r=[...e.overrides.entries()].filter(([o])=>!n.has(o)).sort((o,i)=>(e.seq.get(o[0])??0)-(e.seq.get(i[0])??0));for(const[o]of r){const i=Qt(o);i&&t.push(i),n.add(o)}for(const o of If()){if(n.has(o.type))continue;const i=Qt(o.type);i&&t.push(i),n.add(o.type)}return t}function Lf(){return Nf().filter(e=>e.material)}function Ff(e){return Qt(e)?.propertyGroup??"general"}function zf(e){return Qt(e)?.dblEditableField}function Bf(e){return Qt(e)?.icon??"Shapes"}function Ov(){const e=wt();e.overrides.clear(),e.rendererOverrides.clear(),e.seq.clear(),e.nextSeq=0,Hr()}const Vs="1.0.0",Hf="print-designer",Ys=["template","fields","name","fonts","design-data"],Uf=["is-edit","show-help"],Iv=Object.freeze({bubbles:!0,composed:!0}),Ks=["container","toolbar","format-bar","left-panel","canvas-area","property-panel","status-bar","page-tabs"],qf=["--pd-bg","--pd-surface","--pd-sidebar","--pd-canvas-bg","--pd-paper","--pd-text","--pd-text-muted","--pd-text-faint","--pd-border","--pd-border-soft","--pd-accent","--pd-accent-soft","--pd-hover-tint","--pd-danger","--pd-radius"],Wf=["getTemplateJson","loadTemplate","save","validateTemplate","getGeometryWarnings"],jf=["template","fields","fonts","designData","isEdit","showHelp","uploadImage","uploadDesignBackground"],xt=Object.freeze({save:"save",preview:"preview",help:"help",dblclickElement:"dblclick-element",dblclickCell:"dblclick-cell"}),Gf=[xt.save,xt.preview,xt.help,xt.dblclickElement,xt.dblclickCell];function Xs(){return{version:Vs,tag:Hf,attributes:Ys,booleanAttributes:Uf,events:Gf,parts:Ks,themeTokens:qf,methods:Wf,properties:jf}}function Vf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Rv(e){if(Array.isArray(e))return e}function Pv(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){s=!0,o=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}function Dv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
271
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $v(e,t){return Rv(e)||Pv(e,t)||Nv(e,t)||Dv()}function Nv(e,t){if(e){if(typeof e=="string")return Vf(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vf(e,t):void 0}}const Yf=Object.entries,Lv=Object.keys,Kf=Object.setPrototypeOf,Fv=Object.isFrozen,Xf=Object.getPrototypeOf,Zf=Object.getOwnPropertyDescriptor;let Le=Object.freeze,Ae=Object.seal,en=Object.create,Jf=typeof Reflect<"u"&&Reflect,Ai=Jf.apply,Zs=Jf.construct;Le||(Le=function(t){return t}),Ae||(Ae=function(t){return t}),Ai||(Ai=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Zs||(Zs=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const zt=xe(Array.prototype.forEach),zv=xe(Array.prototype.lastIndexOf),Qf=xe(Array.prototype.pop),Ur=xe(Array.prototype.push),Bv=xe(Array.prototype.slice),Hv=xe(Array.prototype.splice),Kn=Array.isArray,Js=nh(Set),Qs=xe(Set.prototype.add),qr=xe(Set.prototype.has),Sn=xe(String.prototype.toLowerCase),el=xe(String.prototype.toString),Uv=xe(String.prototype.match),Oi=xe(String.prototype.replace),tl=xe(String.prototype.indexOf),qv=xe(String.prototype.trim),Wv=xe(Number.prototype.toString),jv=xe(Boolean.prototype.toString),eh=typeof BigInt>"u"?null:xe(BigInt.prototype.toString),th=typeof Symbol>"u"?null:xe(Symbol.prototype.toString),Ge=xe(Object.prototype.hasOwnProperty),Wr=xe(Object.prototype.toString),Gv=RegExp.prototype.test,Fe=function(t,n){return t instanceof RegExp&&(t.lastIndex=0),Ai(Gv,t,[n])},Bt=nh(TypeError);function xe(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ai(e,t,r)}}function nh(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Zs(e,n)}}function ue(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sn;if(Kf&&Kf(e,null),!Kn(t))return e;let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Fv(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Vv(e){for(let t=0;t<e.length;t++)Ge(e,t)||(e[t]=null);return e}function Ii(e){const t=en(null);for(const r of Yf(e)){var n=$v(r,2);const o=n[0],i=n[1];Ge(e,o)&&(Kn(i)?t[o]=Vv(i):i&&typeof i=="object"&&i.constructor===Object?t[o]=Ii(i):t[o]=i)}return t}function jr(e){const t=en(null),n=Lv(e);let r=n.length;for(;r--;)t[n[r]]=e[n[r]];return t}function Yv(e){switch(typeof e){case"string":return e;case"number":return Wv(e);case"boolean":return jv(e);case"bigint":return eh?eh(e):"0";case"symbol":return th?th(e):"Symbol()";case"undefined":return Wr(e);case"function":case"object":{if(e===null)return Wr(e);const t=e,n=gt(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Wr(r)}return Wr(e)}default:return Wr(e)}}function gt(e,t){for(;e!==null;){const r=Zf(e,t);if(r){if(r.get)return xe(r.get);if(typeof r.value=="function")return xe(r.value)}e=Xf(e)}function n(){return null}return n}function Kv(e,t){for(;e!==null;){const n=Zf(e,t);if(n)return n.get?xe(n.get):null;e=Xf(e)}return null}function Xv(e){if(!e)return!1;try{return Fe(e,""),!0}catch{return!1}}const rh=Le(["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"]),nl=Le(["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"]),rl=Le(["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"]),Zv=Le(["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"]),ol=Le(["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"]),Jv=Le(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),oh=Le(["#text"]),ih=Le(["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"]),il=Le(["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"]),ah=Le(["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"]),Ri=Le(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qv=Ae(/{{[\w\W]*|^[\w\W]*}}/g),ew=Ae(/<%[\w\W]*|^[\w\W]*%>/g),tw=Ae(/\${[\w\W]*/g),nw=Ae(/{{|}}|\${|<%|%>|<%|%>/),rw=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),ow=Ae(/^aria-[\-\w]+$/),sh=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iw=Ae(/^(?:\w+script|data):/i),aw=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sw=Ae(/^html$/i),lw=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i),al=Ae(/<[/\w!]/g),lh=Ae(/<[/\w]/g),cw=Ae(/<\/no(script|embed|frames)/i),ch=Ae(/\/>/i),dw=Ae(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),uw=Ae(/^[\r\n\t ]+/),Me={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},pw=Le(ue({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),fw=function(){return typeof window>"u"?null:window},hw=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},dh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},tn=function(t,n,r,o){return Ge(t,n)&&Kn(t[n])?ue(o.base?jr(o.base):{},t[n],o.transform):r},sl=function(t,n,r){const o=Ge(t,n)?t[n]:void 0;return o&&typeof o=="object"?Ii(o):r};function uh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fw();const t=R=>uh(R);if(t.version="3.4.18",t.removed=[],!e||!e.document||e.document.nodeType!==Me.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,o=r.currentScript,i=e.HTMLTemplateElement,a=e.Node,l=e.Element,c=e.NodeFilter,s=e.DOMParser,d=e.trustedTypes,p=l.prototype,u=gt(p,"cloneNode"),f=gt(p,"remove"),g=gt(p,"removeAttributeNode"),m=gt(p,"nextSibling"),b=gt(p,"childNodes"),v=gt(p,"parentNode"),w=gt(p,"shadowRoot"),E=gt(p,"attributes"),C=a&&a.prototype?gt(a.prototype,"nodeType"):null,F=a&&a.prototype?gt(a.prototype,"nodeName"):null,N=a&&a.prototype?gt(a.prototype,"ownerDocument"):null,P=function(y){return C?C(y):y.nodeType},O=function(y){return F?F(y):y.nodeName},T=Kv(p,"namespaceURI"),I=function(y){return T?T(y):y.namespaceURI};if(typeof i=="function"){const R=n.createElement("template");R.content&&R.content.ownerDocument&&(n=R.content.ownerDocument)}let S,$="",D,B=!1,_=0;const ie=function(){if(_>0)throw Bt('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.')},pe=function(y){ie(),_++;try{return S.createHTML(y)}finally{_--}},Ve=function(y){return S&&mt?pe(y):y},ee=function(y){ie(),_++;try{return S.createScriptURL(y)}finally{_--}},Te=function(){return B||(D=hw(d,o),B=!0),D},ne=n,me=ne.implementation,Ie=ne.createNodeIterator,te=ne.createDocumentFragment,ze=ne.getElementsByTagName,St=r.importNode;let re=dh();t.isSupported=typeof Yf=="function"&&typeof v=="function"&&me&&me.createHTMLDocument!==void 0;const Be=Qv,ye=ew,de=tw,Qe=rw,Jr=ow,Qr=iw,eo=aw,to=lw;let Qn=sh,fe=null;const k=ue({},[...rh,...nl,...rl,...ol,...oh]);let z=null;const W=ue({},[...ih,...il,...ah,...Ri]);let H=null,Y=null,U=null;const Z=Object.seal(en(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Q=!0,M=!0,q=!1,le=!0,X=!1,he=!0,ge=!1,Ye=!1,et=null,Re=null,$t=!1,be=!1,ve=!1,mt=!1,On=!0,lt=!1;const _e="user-content-";let Nt=!0,on=!1,Ue=null,_t=!1,nt=null;const an=ue({},["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 Pe=null;const $e=ue({},["audio","video","img","source","image","track"]);let In=null;const no=ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",we="http://www.w3.org/2000/svg",qe="http://www.w3.org/1999/xhtml";let Ke=qe,er=!1,Vi=null;const Fl=ue({},[ae,we,qe],el),fE=Le(ue({},["mi","mo","mn","ms","mtext"]));let zl=null;const hE=Le(ue({},["annotation-xml"]));let Bl=null;const gE=Le(en(null)),mE=ue({},["title","style","font","a","script"]);let ro=null;const bE=["application/xhtml+xml","text/html"],yE="text/html";let ke=null,Yi=null;const vE=n.createElement("form"),fg=function(y){return y instanceof RegExp||y instanceof Function},Hl=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(!y||typeof y!="object")&&(y={}),y=Ii(y),ro=bE.indexOf(y.PARSER_MEDIA_TYPE)===-1?yE:y.PARSER_MEDIA_TYPE,ke=ro==="application/xhtml+xml"?el:Sn,fe=tn(y,"ALLOWED_TAGS",k,{transform:ke}),z=tn(y,"ALLOWED_ATTR",W,{transform:ke}),Vi=tn(y,"ALLOWED_NAMESPACES",Fl,{transform:el}),In=tn(y,"ADD_URI_SAFE_ATTR",no,{transform:ke,base:no}),Pe=tn(y,"ADD_DATA_URI_TAGS",$e,{transform:ke,base:$e}),nt=tn(y,"FORBID_CONTENTS",an,{transform:ke}),Y=tn(y,"FORBID_TAGS",en(null),{transform:ke}),U=tn(y,"FORBID_ATTR",en(null),{transform:ke}),_t=Ge(y,"USE_PROFILES")?y.USE_PROFILES&&typeof y.USE_PROFILES=="object"?Ii(y.USE_PROFILES):y.USE_PROFILES:!1,Q=y.ALLOW_ARIA_ATTR!==!1,M=y.ALLOW_DATA_ATTR!==!1,q=y.ALLOW_UNKNOWN_PROTOCOLS||!1,le=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,X=y.SAFE_FOR_TEMPLATES||!1,he=y.SAFE_FOR_XML!==!1,ge=y.WHOLE_DOCUMENT||!1,be=y.RETURN_DOM||!1,ve=y.RETURN_DOM_FRAGMENT||!1,mt=y.RETURN_TRUSTED_TYPE||!1,$t=y.FORCE_BODY||!1,On=y.SANITIZE_DOM!==!1,lt=y.SANITIZE_NAMED_PROPS||!1,Nt=y.KEEP_CONTENT!==!1,on=y.IN_PLACE||!1,Qn=Xv(y.ALLOWED_URI_REGEXP)?y.ALLOWED_URI_REGEXP:sh,Ke=typeof y.NAMESPACE=="string"?y.NAMESPACE:qe,zl=sl(y,"MATHML_TEXT_INTEGRATION_POINTS",fE),Bl=sl(y,"HTML_INTEGRATION_POINTS",hE);const x=sl(y,"CUSTOM_ELEMENT_HANDLING",gE);if(H=en(null),Ge(x,"tagNameCheck")&&fg(x.tagNameCheck)&&(H.tagNameCheck=x.tagNameCheck),Ge(x,"attributeNameCheck")&&fg(x.attributeNameCheck)&&(H.attributeNameCheck=x.attributeNameCheck),Ge(x,"allowCustomizedBuiltInElements")&&typeof x.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=x.allowCustomizedBuiltInElements),Ae(H),X&&(M=!1),ve&&(be=!0),_t&&((Ge(y,"ALLOWED_TAGS")||Ge(y,"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."),fe=ue({},oh),z=en(null),_t.html===!0&&(ue(fe,rh),ue(z,ih)),_t.svg===!0&&(ue(fe,nl),ue(z,il),ue(z,Ri)),_t.svgFilters===!0&&(ue(fe,rl),ue(z,il),ue(z,Ri)),_t.mathMl===!0&&(ue(fe,ol),ue(z,ah),ue(z,Ri))),Z.tagCheck=null,Z.attributeCheck=null,Ge(y,"ADD_TAGS")&&(typeof y.ADD_TAGS=="function"?Z.tagCheck=y.ADD_TAGS:Kn(y.ADD_TAGS)&&(fe===k&&(fe=jr(fe)),ue(fe,y.ADD_TAGS,ke))),Ge(y,"ADD_ATTR")&&(typeof y.ADD_ATTR=="function"?Z.attributeCheck=y.ADD_ATTR:Kn(y.ADD_ATTR)&&(z===W&&(z=jr(z)),ue(z,y.ADD_ATTR,ke))),Ge(y,"ADD_FORBID_CONTENTS")&&Kn(y.ADD_FORBID_CONTENTS)&&(nt===an&&(nt=jr(nt)),ue(nt,y.ADD_FORBID_CONTENTS,ke)),Nt&&(fe["#text"]=!0),ge&&ue(fe,["html","head","body"]),fe.table&&(fe.tbody=!0,delete Y.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Bt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const A=S;S=y.TRUSTED_TYPES_POLICY;try{$=pe("")}catch(L){throw S=A,L}}else y.TRUSTED_TYPES_POLICY===null?(S=void 0,$=""):(S===void 0&&(S=Te()),S&&typeof $=="string"&&($=pe("")));Yi=Le(y)},hg=ue({},[...nl,...rl,...Zv]),gg=ue({},[...ol,...Jv]),wE=function(y,x,A){return x===qe?y==="svg":x===ae?y==="svg"&&(A==="annotation-xml"||zl[A]):!!hg[y]},xE=function(y,x,A){return x===qe?y==="math":x===we?y==="math"&&Bl[A]:!!gg[y]},EE=function(y,x,A){return x===we&&!Bl[A]||x===ae&&!zl[A]?!1:!gg[y]&&(mE[y]||!hg[y])},SE=function(y){const x=I(y),A=Sn(O(y)),L=v(y);let G=Ke,K="template";return L&&P(L)===Me.element&&(G=I(L),K=Sn(O(L))),Vi[x]?x===we?wE(A,G,K):x===ae?xE(A,G,K):x===qe?EE(A,G,K):ro==="application/xhtml+xml":!1},sn=function(y){Ur(t.removed,{element:y});try{v(y).removeChild(y)}catch{if(f(y),!v(y))throw Bt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},mg=function(y,x,A){try{g(y,x)}catch{try{y.removeAttribute(A)}catch{}}},Ul=function(y){jl(y);const x=b(y);x&&zt(Bv(x),A=>{try{f(A)}catch{}}),P(y)===Me.element&&ql(y,!1)},tr=function(y,x,A){if(!A)try{A=x.getAttributeNode(y)}catch{A=null}if(Ur(t.removed,{attribute:A||null,from:x}),A)mg(x,A,y);else try{x.removeAttribute(y)}catch{}if(y==="is")if(be||ve)try{sn(x)}catch{}else try{x.setAttribute(y,"")}catch{}},ql=function(y,x){const A=E(y);if(A)for(let L=A.length-1;L>=0;--L){const G=A[L],K=G&&G.name;typeof K=="string"&&!(x&&z[ke(K)])&&mg(y,G,K)}},Wl=function(y,x){let A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const L=[y];for(;L.length>0;){const G=L.pop();if(x(G)===!1)continue;if(A&&P(G)===Me.element){const oe=w(G);nr(oe)&&L.push(oe)}const K=b(G);if(K)for(let oe=K.length-1;oe>=0;--oe)L.push(K[oe])}},jl=function(y){Wl(y,x=>{P(x)===Me.element&&ql(x,!0)})},Gl=function(y){const x=[];return Wl(y,A=>{x.push(A)},!0),x},_E=function(y,x){const A=Js();zt(Gl(y),L=>{P(L)===Me.element&&Qs(A,L)}),zt(x,L=>{P(L)===Me.element&&!qr(A,L)&&ql(L,!0)})},bg=function(y,x){let A=!1;return zt(t.removed,L=>{L.element&&(A=A||L.element===y,jl(L.element))}),_E(y,x),A},ME=8,TE=function(y,x){const A=Ue;let L=null;const G=()=>(L||(L=Js(),zt(x,K=>{Qs(L,K)})),L);for(let K=0;;K++){const oe=Gl(y),Ne=[y];let Gt=!1;if(zt(oe,Tt=>{P(Tt)===Me.documentFragment?Ur(Ne,Tt):!Gt&&!qr(A,Tt)&&(Gt=qr(G(),Tt))}),!Gt)return;if(K>=ME)throw Bt("the tree kept changing during in-place sanitization; refusing to return it");zt(Ne,(Tt,ct)=>{kE(Tt,ct>0,y,G())})}},kE=function(y,x,A,L){const G=Ki(y);let K;for(;K=G.nextNode();)!qr(L,K)||qr(Ue,K)||(x&&Mt(re.uponSanitizeShadowNode,K,null),Xl(K,A))},CE=function(y){Ue&&Qs(Ue,y)},yg=function(y,x){return he?y==="patchsrc"?!0:y==="for"&&x!=="label"&&x!=="output":!1},AE=function(y){he&&Wl(y,x=>{const A=P(x);if(A===Me.processingInstruction||A===Me.comment&&Fe(lh,x.data)){try{f(x)}catch{}return!1}if(A===Me.element){const L=x,G=ke(O(x));try{L.hasAttribute&&L.hasAttribute("patchsrc")&&L.removeAttribute("patchsrc"),L.hasAttribute&&L.hasAttribute("for")&&yg("for",G)&&L.removeAttribute("for")}catch{}}return!0})},vg=function(y){let x=null,A=null;if($t)y="<remove></remove>"+y;else{const K=Uv(y,uw);A=K&&K[0]}ro==="application/xhtml+xml"&&Ke===qe&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const L=S?pe(y):y;if(Ke===qe)try{x=new s().parseFromString(L,ro)}catch{}if(!x||!x.documentElement){x=me.createDocument(Ke,"template",null);try{x.documentElement.innerHTML=er?$:L}catch{}}const G=x.body||x.documentElement;return y&&A&&G.insertBefore(n.createTextNode(A),G.childNodes[0]||null),Ke===qe?ze.call(x,ge?"html":"body")[0]:ge?x.documentElement:G},Ki=function(y){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const A=N?N(y):y.ownerDocument;return Ie.call(A||y,y,(x?0:c.SHOW_ELEMENT)|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Vl=function(y){return y=Oi(y,Be," "),y=Oi(y,ye," "),y=Oi(y,de," "),y},Yl=function(y){var x;Kl(y);const A=(x=y.querySelectorAll)===null||x===void 0?void 0:x.call(y,"template");A&&zt(A,L=>{nr(L.content)&&Yl(L.content)})},Kl=function(y){y.normalize();const x=Ki(y,!0);let A=x.nextNode();for(;A;)A.data=Vl(A.data),A=x.nextNode()},Xi=function(y){const x=F?F(y):null;return typeof x!="string"||ke(x)!=="form"?!1:typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||y.attributes!==E(y)||typeof y.removeAttribute!="function"||typeof y.removeAttributeNode!="function"||typeof y.getAttributeNode!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function"||y.nodeType!==C(y)||y.childNodes!==b(y)},wg=function(y){if(!C||typeof y!="object"||y===null)return null;try{const x=C(y);return typeof x=="number"?x:null}catch{return null}},nr=function(y){return wg(y)===Me.documentFragment},oo=function(y){return wg(y)!==null};function Mt(R,y,x){R.length!==0&&zt(R,A=>{A.call(t,y,x,Yi)})}const OE=function(y,x,A){return!!(he&&A===Me.element&&y.hasChildNodes()&&!oo(y.firstElementChild)&&Fe(al,y.textContent)&&Fe(al,y.innerHTML)||he&&pw[x]&&A===Me.element&&I(y)===qe&&(oo(y.firstElementChild)||typeof y.textContent=="string"&&Fe(al,y.textContent))||A===Me.processingInstruction||he&&A===Me.comment&&Fe(lh,y.data))},Zi=function(y,x){if(y instanceof RegExp)return Fe(y,x);if(y instanceof Function){for(var A=arguments.length,L=new Array(A>2?A-2:0),G=2;G<A;G++)L[G-2]=arguments[G];return!!y(x,...L)}return!1},IE=function(y,x,A){if(!Y[x]&&Sg(x)&&Zi(H.tagNameCheck,x))return!1;if(Nt&&!nt[x]&&!nt[Sn(x)]){const L=v(y),G=b(y);if(G&&L){const K=G.length;for(let oe=K-1;oe>=0;--oe){const Ne=y===A?u(G[oe],!0):G[oe];L.insertBefore(Ne,m(y))}}}return sn(y),!0},xg=function(y,x,A,L){return y.length===0?x:x===A||x===L?jr(x):x},rr=function(y,x){return y===x||v(y)!==null?!1:(on&&jl(y),!0)},RE=function(y,x){if(CE(y),Mt(re.beforeSanitizeElements,y,null),rr(y,x))return!0;if(Xi(y))return sn(y),!0;const A=ke(O(y)),L=P(y);if(fe=xg(re.uponSanitizeElement,fe,k,et),Mt(re.uponSanitizeElement,y,{tagName:A,allowedTags:fe}),rr(y,x))return!0;if(OE(y,A,L))return sn(y),!0;if(Y[A]||!(Z.tagCheck instanceof Function&&Z.tagCheck(A))&&!fe[A]){const G=IE(y,A,x);return G===!1&&(Mt(re.afterSanitizeElements,y,null),rr(y,x))?!0:G}if(L===Me.element&&!SE(y)||(A==="noscript"||A==="noembed"||A==="noframes")&&Fe(cw,y.innerHTML))return sn(y),!0;if(X&&L===Me.text){const G=y.textContent,K=Vl(G);G!==K&&(Ur(t.removed,{element:y.cloneNode()}),y.textContent=K)}return Mt(re.afterSanitizeElements,y,null),rr(y,x)},Eg=function(y,x,A){if(U[x]||yg(x,y)||On&&(x==="id"||x==="name")&&(A in n||A in vE))return!1;const L=z[x]||Z.attributeCheck instanceof Function&&Z.attributeCheck(x,y);if(M&&Fe(Qe,x)||Q&&Fe(Jr,x))return!0;if(!L)return Sg(y)&&Zi(H.tagNameCheck,y)&&Zi(H.attributeNameCheck,x,y)||x==="is"&&H.allowCustomizedBuiltInElements&&Zi(H.tagNameCheck,A);if(In[x])return!0;const G=Oi(A,eo,"");return Fe(Qn,G)||(x==="src"||x==="xlink:href"||x==="href")&&y!=="script"&&tl(A,"data:")===0&&Pe[y]||q&&!Fe(Qr,G)?!0:!A},PE=ue({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Sg=function(y){return!PE[Sn(y)]&&Fe(to,y)},DE=function(y,x,A,L){if(S&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!A)switch(d.getAttributeType(y,x)){case"TrustedHTML":return pe(L);case"TrustedScriptURL":return ee(L)}return L},$E=function(y,x,A,L){try{return A?y.setAttributeNS(A,x,L):y.setAttribute(x,L),Xi(y)?(sn(y),!1):!0}catch{return tr(x,y),!1}},_g=function(y,x){return he&&Fe(dw,x)?!0:Sn(y)==="attributename"&&tl(x,"href")!==-1},NE=function(y,x){if(Mt(re.beforeSanitizeAttributes,y,null),rr(y,x))return;const A=y.attributes;if(!A||Xi(y))return;z=xg(re.uponSanitizeAttribute,z,W,Re);const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let G=A.length;const K=ke(O(y));for(;G--;){const oe=A[G],Ne=oe.name,Gt=oe.namespaceURI,Tt=oe.value,ct=ke(Ne),Lt=Tt;let We=Ne==="value"?Lt:qv(Lt),Mg=!1;if(L.attrName=ct,L.attrValue=We,L.keepAttr=!0,L.forceKeepAttr=void 0,Mt(re.uponSanitizeAttribute,y,L),We=L.attrValue,lt&&(ct==="id"||ct==="name")&&tl(We,_e)!==0&&(tr(Ne,y,oe),We=_e+We,Mg=!0),_g(Ne,We)){tr(Ne,y,oe);continue}if(!L.forceKeepAttr){if(!L.keepAttr){tr(Ne,y,oe);continue}if(!le&&Fe(ch,We)){tr(Ne,y,oe);continue}if(X&&(We=Vl(We)),!Eg(K,ct,We)){tr(Ne,y,oe);continue}We=DE(K,ct,Gt,We),We!==Lt&&$E(y,Ne,Gt,We)&&Mg&&Qf(t.removed)}}Mt(re.afterSanitizeAttributes,y,null),rr(y,x)},Xl=function(y,x){RE(y,x),NE(y,x),nr(y.content)&&Zl(y.content)},Zl=function(y){let x=null;const A=Ki(y);for(Mt(re.beforeSanitizeShadowDOM,y,null);x=A.nextNode();)if(Mt(re.uponSanitizeShadowNode,x,null),Xl(x,y),P(x)===Me.element){const L=w(x);nr(L)&&(Jl(L),Zl(L))}X&&Kl(y),Mt(re.afterSanitizeShadowDOM,y,null)},Jl=function(y){const x=[{node:y,shadow:null}];for(;x.length>0;){const A=x.pop();if(A.shadow){Zl(A.shadow);continue}const L=A.node,G=P(L)===Me.element,K=b(L);if(K)for(let oe=K.length-1;oe>=0;--oe)x.push({node:K[oe],shadow:null});if(G){const oe=F?F(L):null;if(typeof oe=="string"&&ke(oe)==="template"){const Ne=L.content;nr(Ne)&&x.push({node:Ne,shadow:null})}}if(G){const oe=w(L);nr(oe)&&x.push({node:null,shadow:oe},{node:oe,shadow:null})}}};return t.sanitize=function(R){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,A=null,L=null,G=null;if(er=!R,er&&(R="<!-->"),typeof R!="string"&&!oo(R)&&(R=Yv(R),typeof R!="string"))throw Bt("dirty is not a string, aborting");if(!t.isSupported)return R;Ye?(fe=et,z=Re):Hl(y),t.removed=[];const K=on&&typeof R!="string"&&oo(R);let oe=[];const Ne=Ue;if(K){AE(R);const Lt=O(R);if(typeof Lt=="string"){const We=ke(Lt);if(!fe[We]||Y[We])throw Ul(R),Bt("root node is forbidden and cannot be sanitized in-place")}if(Xi(R))throw Ul(R),Bt("root node is clobbered and cannot be sanitized in-place");oe=Gl(R),Ue=Js()}else if(oo(R))x=vg("<!---->"),A=x.ownerDocument.importNode(R,!0),A.nodeType===Me.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?x=A:x.appendChild(A),Jl(x);else{if(!be&&!X&&!ge&&R.indexOf("<")===-1)return Ve(R);if(x=vg(R),!x)return be?null:mt?$:""}x&&$t&&sn(x.firstChild);const Gt=K?R:x;try{K&&Jl(R);const Lt=Ki(Gt);for(;L=Lt.nextNode();)Xl(L,Gt);K&&TE(R,oe)}catch(Lt){throw K&&(Ul(R),bg(R,oe)),Lt}finally{Ue=Ne}if(K){if(bg(R,oe))throw Bt("a node selected for removal could not be safely returned; refusing to sanitize in place");return X&&Yl(R),R}if(be){if(X&&Yl(x),ve)for(G=te.call(x.ownerDocument);x.firstChild;)G.appendChild(x.firstChild);else G=x;return(z.shadowroot||z.shadowrootmode)&&(G=St.call(r,G,!0)),G}const Tt=()=>ge?x.outerHTML:x.innerHTML;let ct=Tt();return X&&Fe(nw,ct)&&(Kl(x),ct=Tt()),ge&&fe["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Fe(sw,x.ownerDocument.doctype.name)&&(ct="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
272
|
-
`+ct),Ve(ct)},t.setConfig=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hl(R),Ye=!0,et=fe,Re=z},t.clearConfig=function(){Yi=null,Ye=!1,et=null,Re=null,S=D,$=""},t.isValidAttribute=function(R,y,x){Yi||Hl({});const A=ke(R),L=ke(y);return typeof x=="string"&&(_g(y,x)||!le&&Fe(ch,x))?!1:Eg(A,L,x)},t.addHook=function(R,y){typeof y=="function"&&Ge(re,R)&&Ur(re[R],y)},t.removeHook=function(R,y){if(Ge(re,R)){if(y!==void 0){const x=zv(re[R],y);return x===-1?void 0:Hv(re[R],x,1)[0]}return Qf(re[R])}},t.removeHooks=function(R){Ge(re,R)&&(re[R]=[])},t.removeAllHooks=function(){re=dh()},t}var gw=uh();const mw={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function bw(e,t){const n=e.options;return ds(n.formatter,t,String(n.testData||n.title||""))||"1234567890128"}function yw(e){return h("div",{class:"print-qrcode",dataset:{codeId:e.id,codeKind:"qrcode"}})}function vw(e){const t=e.options;return h("div",{class:"print-barcode",dataset:{codeId:e.id,codeKind:"barcode"}},[h("svg",{preserveAspectRatio:mw[String(t.fit||"contain")]??"xMidYMid meet",style:{maxWidth:"100%",maxHeight:"100%"}})])}function ww(e){const t=(e.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(n=>!Number.isFinite(n))?null:{width:t[2],height:t[3]}}function xw(e,t,n){const r=e.options,o=ur(r.barWidth),i=ca(r.barQuietZone),a=l=>{ps(t,bw(e,n),{format:String(r.barcodeType||"CODE128"),width:o,height:l*o,displayValue:!r.hideTitle,fontSize:(r.fontSize??po)*o,margin:0,marginLeft:i*o,marginRight:i*o,marginTop:0,marginBottom:da*o});const c=ww(t);return c?{widthUnits:c.width,heightUnits:c.height}:null};try{const l=pa({barHeightMm:r.barHeight,boxWidthMm:Dn(r.width,r.maxWidth),boxHeightMm:Dn(r.height,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth,measure:a});t.style.width=l.size?`${l.size.widthMm}mm`:"",t.style.height=l.size?`${l.size.heightMm}mm`:""}catch{t.replaceChildren();return}t.setAttribute("shape-rendering","crispEdges")}function Ew(e,t,n){const r=e.options,o=ds(r.formatter,n,String(r.testData||r.title||""))||"二维码";t.replaceChildren();try{const i=Ls.render(o,"qrcode",{qrCodeLevel:String(r.qrCodeLevel??"M"),qrQuietZone:typeof r.qrQuietZone=="number"?r.qrQuietZone:void 0}),a=document.createElement("img");a.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`,a.alt="qrcode",a.style.width="100%",a.style.height="100%",a.style.objectFit=String(r.fit||"contain"),a.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",a.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%",t.appendChild(a)}catch{}}function Sw(e,t,n){for(const r of Array.from(e.querySelectorAll("[data-code-kind]"))){const o=r.dataset.codeId,i=t.find(a=>a.id===o);if(i)if(r.dataset.codeKind==="barcode"){const a=r.querySelector("svg");a&&xw(i,a,n)}else Ew(i,r,n)}}const Pi=new Map;function _w(e){return typeof Node<"u"&&e instanceof Node}function ph(e,t,n){if(fh(e),typeof t=="string"){n.innerHTML=t;return}if(_w(t)){n.appendChild(t);return}typeof t.node=="string"?n.innerHTML=t.node:n.appendChild(t.node),typeof t.dispose=="function"&&Pi.set(e,t.dispose)}function fh(e){const t=Pi.get(e);if(t){Pi.delete(e);try{t()}catch{}}}function hh(){for(const e of[...Pi.keys()])fh(e)}const Mw={header:"题",data:"数",subtotal:"小",summary:"汇"},Tw=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],Di=3.7795275591,kw=.1,ll=e=>JSON.parse(JSON.stringify(e)),gh=new WeakMap;function Ht(e){let t=gh.get(e);return t||(t={menu:null,menuElId:null,anchor:null,layouts:new Map},gh.set(e,t)),t}function Gr(e,t){return e.templateData.elements.find(n=>n.id===t)??null}function Cw(e,t){const n=e.tableSelection;return!n||n.elementId!==t.id?null:e.selectedElement?.id!==t.id?(e.tableSelection=null,null):n}function mh(e,t,n){const r=Gr(e,n.id);if(!r)return null;const o=n.options;return{store:e,fire:t,el:n,real:r,options:o,rows:o.tableRows??[],colWidths:o.tableColWidths??[],isSelected:e.selectedIds.has(n.id),selection:Cw(e,n),maxTableWidth:bh(e)}}function bh(e){return e.paperSize.width-e.templateData.margins.left-e.templateData.margins.right}function cl(e){return e.options.tableDefaultFontSize??10}function yh(e){return e.options.tableDefaultColor??"#333333"}function Aw(e,t){let n=0;for(let r=0;r<t;r++)n+=e.rows[r].height;return n}function Ow(e,t){return Ht(e.store).layouts.get(e.el.id)?.[t]?.top??Aw(e,t)}function Iw(e,t){return Ht(e.store).layouts.get(e.el.id)?.[t]?.height??e.rows[t]?.height??0}function Rw(e){const t=e.options.dataSource;if(t&&Array.isArray(ht[t]))return ht[t];for(const n of Object.values(ht))if(Array.isArray(n))return n}function vh(e){return e.cellType==="barcode"||e.cellType==="qrcode"}function wh(e,t){return vh(t)?ds(t.formatter,Rw(e)):t.formatter||""}function Pw(e,t){const n={designMode:!0,showGhostBorder:e.store.showTableGhostBorder};return{fontFamily:Ya(t.fontFamily??e.options.tableDefaultFontFamily),textAlign:t.align??"left",...t.align==="justify"?{textAlignLast:"justify"}:{},verticalAlign:t.valign??"middle",fontSize:(t.fontSize??cl(e))+"pt",fontWeight:t.fontWeight??"normal",color:t.color??yh(e),backgroundColor:t.backgroundColor??"transparent",borderTop:so(t.borders?.top,n),borderRight:so(t.borders?.right,n),borderBottom:so(t.borders?.bottom,n),borderLeft:so(t.borders?.left,n),padding:(t.padding??e.options.tableDefaultPadding??1)+"mm",whiteSpace:t.wordWrap??!0?"pre-wrap":"nowrap",overflow:t.wordWrap??!0?"visible":"hidden"}}function Dw(e,t,n){const r=e.selection;return[!!r&&t>=r.r1&&t<=r.r2&&n>=r.c1&&n<=r.c2?"cell-selected":"",e.rows[t]?.type==="data"?"row-data-bg":""].filter(Boolean).join(" ")}function xh(e){return oa(e)}function $w(e){return xh(e)!=="autoHeight"}function Nw(e,t){return t.fontSize??cl(e)}function $i(e,t,n){return cr(e.rows,t,n,e.options.tableDefaultPadding??1)}function Lw(e,t,n){return aa(e.colWidths,t,n,e.options.tableDefaultPadding??1)}function Fw(e,t,n){return{maxHeight:$i(e,n,t)+"mm",overflow:"hidden",...t.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}function zw(e,t,n){const r={fitBase:String(Nw(e,t)),fitMin:String(lr(t.shrinkMinFontSize)),fitMm:String($i(e,n,t))};return xh(t)==="shrink"&&(r.fit="shrink"),r}function Bw(e){const t=(e.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(n=>!Number.isFinite(n))?null:{width:t[2],height:t[3]}}const Hw={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function Uw(e,t,n,r){const o=document.createElement("div");o.className="cell-barcode";const i=document.createElementNS(wv,"svg");o.appendChild(i);const a=wh(e,r);if(r.cellType==="barcode"){i.setAttribute("preserveAspectRatio",Hw[r.fit||"contain"]??"xMidYMid meet");const l=ur(r.barWidth),c=ca(r.barQuietZone),s=u=>{ps(i,a,{format:r.barcodeType||"CODE128",width:l,height:u*l,displayValue:r.showBarcodeText!==!1,fontSize:(r.barFontSize??po)*l,margin:0,marginLeft:c*l,marginRight:c*l,marginTop:0,marginBottom:da*l});const f=Bw(i);return f?{widthUnits:f.width,heightUnits:f.height}:null};let d=null;try{d=pa({barHeightMm:r.barHeight,boxWidthMm:Dn(Lw(e,n,r),r.maxWidth),boxHeightMm:Dn($i(e,t,r),r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth,measure:s})}catch{d=null}if(!d){i.style.display="none";const u=document.createElement("span");return u.className="cell-barcode-fallback",u.textContent=a||"条码",o.appendChild(u),o}const p=d.size;return p?(i.style.width=`${p.widthMm}mm`,i.style.height=`${p.heightMm}mm`):(i.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",i.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%"),i.setAttribute("shape-rendering","crispEdges"),o}if(i.style.display="none",!a)return o;try{const l=Ls.render(a,"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(l)}`),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%",o.appendChild(c)}catch{}return o}function Eh(){const e=document.createElement("div");return e.className="image-placeholder",e.textContent="图片",e}function qw(e){const t=e.formatter||"";return t?t.includes("{")?Un(t,ht):t:""}function Ww(e,t,n){const r=document.createElement("div");r.className="cell-image";const o=vc(n.fit,$i(e,t,n));o!==void 0&&(r.style.height=`${o}mm`);const i=qw(n);if(!i)return r.appendChild(Eh()),r;const a=document.createElement("img");a.setAttribute("src",i),o!==void 0&&(a.style.width="100%",a.style.height="100%"),a.style.objectFit=n.fit||"contain";for(const[l,c]of Object.entries(fa(n.fit,n.fitScale,n.objectPosition)))a.style[l]=c;return a.style.maxWidth=n.maxWidth?`${n.maxWidth}mm`:"100%",a.style.maxHeight=n.maxHeight?`${n.maxHeight}mm`:"100%",a.addEventListener("error",()=>{a.remove(),r.appendChild(Eh())},{once:!0}),r.appendChild(a),r}function jw(e,t,n,r,o){if(vh(o))return Uw(e,n,r,o);if(o.cellType==="image")return Ww(e,n,o);const i=wh(e,o),a=()=>t.type==="data"?h("span",{class:"data-placeholder",text:i}):i;return $w(o)?h("div",{class:"cell-fit",style:Fw(e,o,n),dataset:zw(e,o,n)},[a()]):a()}function Ni(e,t,n){const r={elementId:e.el.id,...Ql(e.rows,t,n)};e.store.setTableSelection(r),e.fire("table-selection-change",{elementId:e.el.id,selection:r})}function Gw(e,t,n,r,o){if(o.button!==0||(e.fire("table-cell-mousedown",{elementId:e.el.id,r:t,c:n,cellId:r,event:o}),!e.isSelected))return;o.stopPropagation();const i=Ht(e.store);o.shiftKey&&e.selection?Ni(e,{r:e.selection.r1,c:e.selection.c1},{r:t,c:n}):(i.anchor={r:t,c:n},Ni(e,{r:t,c:n},{r:t,c:n})),document.addEventListener("mouseup",()=>{Ht(e.store).anchor=null},{once:!0})}function Vw(e,t,n){const r=Ht(e.store).anchor;r&&Ni(e,r,{r:t,c:n})}function dl(e,t){const n=Ht(e);n.menu?.visible&&(n.menu.visible=!1,t("table-menu-close",{elementId:n.menuElId}),e.emit(!1))}function Yw(e,t,n,r){r.preventDefault(),r.stopPropagation(),e.isSelected||e.store.selectOne(e.el.id);const o=e.selection;o&&t>=o.r1&&t<=o.r2&&n>=o.c1&&n<=o.c2||Ni(e,{r:t,c:n},{r:t,c:n});const a=Ht(e.store);a.menuElId=e.el.id,a.menu&&(a.menu.x=r.clientX,a.menu.y=r.clientY,a.menu.visible=!0),e.fire("table-cell-contextmenu",{elementId:e.el.id,r:t,c:n,clientX:r.clientX,clientY:r.clientY}),e.store.emit(!1),document.addEventListener("mousedown",()=>dl(e.store,e.fire),{once:!0})}function Sh(e,t,n){const r=e.reduce((o,i)=>o+i,0)+(e[t]??0);return r>n?`插入后表格总宽 ${Math.round(r*10)/10}mm 超过打印范围宽度 ${n}mm,请先缩小列宽`:null}function Kw(e,t){const n=e.real.options.tableRows??[],r=e.real.options.tableColWidths??[],o=t(ll(n),ll(r));return o?(window.alert(o),!1):(e.store.recordHistory(),t(n,r),e.store.setTableSelection(null),ir(e.real.options),e.store.emit(),!0)}function Ut(e,t,n){dl(e.store,e.fire);const r=e.selection;if(!r)return;let o=null;switch(t){case"insert-row-above":o=i=>(rc(i,r.r1,"above"),null);break;case"insert-row-below":o=i=>(rc(i,r.r2,"below"),null);break;case"delete-row":o=i=>Ig(i,r.r1);break;case"insert-col-left":o=(i,a)=>{const l=Sh(a,r.c1,e.maxTableWidth);return l||(oc(i,a,r.c1,"left"),null)};break;case"insert-col-right":o=(i,a)=>{const l=Sh(a,r.c2,e.maxTableWidth);return l||(oc(i,a,r.c2,"right"),null)};break;case"delete-col":o=(i,a)=>Rg(i,a,r.c1);break;case"merge":o=i=>(tc(i,r),null);break;case"split":o=i=>(nc(i,r),null);break;case"set-row-type":o=i=>n?ea(i,r.r1,n):"未指定行类型";break}o&&Kw(e,o)&&e.fire(`table-${t}`,{elementId:e.el.id,...n?{type:n}:{}})}function Xw(e){const t=e.selection;if(!t)return!1;for(let n=t.r1;n<=t.r2;n++)for(let r=t.c1;r<=t.c2;r++){const o=e.rows[n]?.cells[r];if(o&&!o.merged&&((o.rowspan??1)>1||(o.colspan??1)>1))return!0}return!1}function Zw(e){const t=e.selection;if(!t)return;const n=or(e.rows,t.r1,t.c1),r=!e.rows[n.r]?.cells[n.c]?.mergeSameValue;for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=e.rows[o]?.cells[i];a&&!a.merged&&(a.mergeSameValue=r)}e.store.updateElement(e.el.id,{tableRows:e.rows}),dl(e.store,e.fire)}function _h(e){const t=e.selection;if(!t)return"未选择单元格";for(let n=t.r1;n<=t.r2;n++)if(e.rows[n]?.type!=="data")return"仅数据行(明细行)支持按值合并";return null}function Mh(e,t){const n=e.selection;return n?n.r1!==n.r2?"行类型仅支持单行设置":ea(ll(e.rows),n.r1,t):"未选择单元格"}function Rt(e,t,n={}){return h("div",{class:`menu-item${n.disabled?" disabled":""}${n.active?" active":""}`,title:n.title||"",text:e,onClick:()=>{n.disabled||t()}})}const ul=()=>h("div",{class:"menu-divider"});function Jw(e,t,n){const r=Ht(e);if(r.menu=n,!n.visible||!r.menuElId)return"";const o=Gr(e,r.menuElId);if(!o||o.printElementType.type!=="table")return"";const i=mh(e,t,o);if(!i)return"";const a=i.selection?ec(i.rows,i.selection):"未选择单元格",l=i.selection?i.rows[i.selection.r1]?.type??null:null;return h("div",{class:"table-ctx-menu",style:{left:n.x+"px",top:n.y+"px"},onMousedown:c=>c.stopPropagation()},[Rt("在上方插入行",()=>Ut(i,"insert-row-above")),Rt("在下方插入行",()=>Ut(i,"insert-row-below")),Rt("删除行",()=>Ut(i,"delete-row"),{disabled:i.rows.length<=1}),ul(),Rt("在左侧插入列",()=>Ut(i,"insert-col-left")),Rt("在右侧插入列",()=>Ut(i,"insert-col-right")),Rt("删除列",()=>Ut(i,"delete-col"),{disabled:i.colWidths.length<=1}),ul(),Rt("合并单元格",()=>Ut(i,"merge"),{disabled:!!a,title:a||""}),Rt("拆分单元格",()=>Ut(i,"split"),{disabled:!Xw(i)}),Rt("按值合并",()=>Zw(i),{disabled:!!_h(i),title:_h(i)||"",active:(()=>{const c=i.selection;if(!c)return!1;const s=or(i.rows,c.r1,c.c1);return i.rows[s.r]?.cells[s.c]?.mergeSameValue===!0})()}),ul(),h("div",{class:"menu-group-title",text:"行类型"}),...Tw.map(c=>Rt(c.label,()=>Ut(i,"set-row-type",c.value),{disabled:!!Mh(i,c.value),title:Mh(i,c.value)||"",active:l===c.value}))])}let _n=null;function Th(){_n&&(document.removeEventListener("mousemove",pl),document.removeEventListener("mouseup",fl),_n.handle.classList.remove("dragging"),_n=null)}function Qw(e,t){const n=e.closest(".hiprint-printPaper");return(n&&n.offsetWidth>0?n.getBoundingClientRect().width/n.offsetWidth:0)||(t.scale||100)/100}function ex(e,t,n){if(n.button!==0)return;const r=n.currentTarget,o=r.closest(".print-table");if(!o)return;Th();const i=e.real.options.tableColWidths??[];_n={store:e.store,fire:e.fire,elId:e.real.id,boundary:t,startX:n.clientX,startWidth:i[t-1]??0,scale:Qw(o,e.store),root:o,wrapper:r.closest(".print-element"),handle:r},r.classList.add("dragging"),e.store.recordHistory(),document.addEventListener("mousemove",pl),document.addEventListener("mouseup",fl)}function pl(e){const t=_n;if(!t)return;const n=Gr(t.store,t.elId),r=n?.options.tableColWidths;if(!n||!r)return;const o=(e.clientX-t.startX)/(t.scale*Di),i=t.boundary-1;r[i]=zg(r,i,t.startWidth+o,bh(t.store)),ir(n.options),r.forEach((a,l)=>{const c=t.root.querySelector(`colgroup col:nth-child(${l+1})`);c&&(c.style.width=`${a}mm`)}),t.root.querySelectorAll(".col-resize-handle").forEach((a,l)=>{a.style.left=`${r.slice(0,l+1).reduce((c,s)=>c+s,0)}mm`}),t.wrapper&&(t.wrapper.style.width=`${n.options.width}mm`,t.wrapper.style.height=`${n.options.height}mm`)}function fl(){document.removeEventListener("mousemove",pl),document.removeEventListener("mouseup",fl);const e=_n;if(!e)return;_n=null,e.handle.classList.remove("dragging");const t=Gr(e.store,e.elId);t&&ir(t.options),e.store.emit(),e.fire("table-col-resize-end",{elementId:e.elId})}function tx(e,t,n){const r=n.querySelector("table");if(!r)return;const o=r.offsetHeight;if(o<=0)return;const i=Gr(e,t);if(!i)return;let a=!1;const l=o/Di;Math.abs(l-(i.options.height??0))>kw&&(i.options.height=Math.round(l*100)/100,a=!0);const c=r.offsetTop,s=Array.from(r.rows).map(p=>({top:(p.offsetTop-c)/Di,height:p.offsetHeight/Di})),d=Ht(e);nx(d.layouts.get(t),s)||(d.layouts.set(t,s),a=!0),a&&e.emit(!1)}function nx(e,t){return!e||e.length!==t.length?!1:t.every((n,r)=>{const o=e[r];return Math.round(n.top*10)===Math.round(o.top*10)&&Math.round(n.height*10)===Math.round(o.height*10)})}function rx(e,t){const n=document.createComment("pd-table-measure");return requestAnimationFrame(()=>{if(!n.isConnected)return;const r=n.parentElement;r&&tx(e,t,r)}),n}function ox(e){return e.isSelected&&!e.real.options.locked&&e.colWidths.length>=1}function ix(e){return Array.from({length:e.colWidths.length},(t,n)=>n+1)}function ax(e,t){return e.colWidths.slice(0,t).reduce((n,r)=>n+r,0)}function sx(e,t,n){const r=mh(t,n,e);if(!r)return h("div",{class:"print-table"});const o=[h("table",{style:{fontSize:`${cl(r)}pt`,color:yh(r)}},[h("colgroup",{},r.colWidths.map(i=>h("col",{style:{width:i+"mm"}}))),h("tbody",{},r.rows.map((i,a)=>h("tr",{style:{height:i.height+"mm"}},i.cells.map((l,c)=>l.merged?"":h("td",{rowspan:l.rowspan||1,colspan:l.colspan||1,class:Dw(r,a,c),style:Pw(r,l),onMousedown:s=>Gw(r,a,c,l.id,s),onMouseenter:()=>Vw(r,a,c),onContextmenu:s=>Yw(r,a,c,s)},[jw(r,i,a,c,l)])).filter(Boolean))))])];return ox(r)&&o.push(h("div",{class:"col-resize-layer"},ix(r).map(i=>h("div",{class:"col-resize-handle",role:"separator","aria-label":`列宽手柄${i}`,style:{left:ax(r,i)+"mm"},onMousedown:a=>{a.stopPropagation(),a.preventDefault(),ex(r,i,a)}})))),r.isSelected&&o.push(h("div",{class:"row-badges"},r.rows.map((i,a)=>h("span",{class:"row-badge",style:{top:Ow(r,a)+"mm",height:Iw(r,a)+"mm"},text:Mw[i.type]})))),o.push(rx(t,e.id)),h("div",{class:"print-table design-mode",dataset:{tableId:e.id},onContextmenu:i=>i.preventDefault()},o)}const lx=["黄芪 20g","当归尾 15g","赤芍 10g","川芎 10g","地龙 10g","桃仁 10g","红花 10g"];function hl(e){return Array.isArray(e)&&e.length>0?e:[]}function cx(e,t){const n=uo(e,t)??(t?Object.keys(t).find(o=>Array.isArray(t[o])):void 0);if(n)return hl(t?.[n]);const r=uo(e,ht);return r?hl(ht[r]):[]}function dx(e,t){const n=e.options,r=typeof n.formatter=="string"?n.formatter:"",o=hl(t)[0],i=cx(r,o);if(i.length===0)return[...lx];if(!r)return i.map(c=>String(c?.name??JSON.stringify(c)));const a=o??{},l=uo(r,a)??Object.keys(a).find(c=>Array.isArray(a[c]));return i.map(c=>{try{return Un(r,{...a,...c,...l?{[l]:c}:{}})}catch{return r}})}const ux=3.7795275591,px=.1;function fx(e,t){return e.templateData.elements.find(n=>n.id===t)??null}function hx(e){const t=e.parentElement;if(!t?.classList.contains("print-element"))return 0;const n=getComputedStyle(t);return(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.borderBottomWidth)||0)}function gx(e,t,n){const r=n.offsetHeight+hx(n);if(r<=0)return;const o=fx(e,t);if(!o)return;const i=r/ux;Math.abs(i-(o.options.height??0))>px&&(o.options.height=Math.round(i*100)/100,e.emit(!1))}function mx(e,t){const n=document.createComment("pd-flowlist-measure");return requestAnimationFrame(()=>{if(!n.isConnected)return;const r=n.parentElement;r&&gx(e,t,r)}),n}function bx(e,t,n){const r=e.options,o=ut(r.flowColumns),i=bt(r.flowGapX),a=Yt(r.flowRowHeight),l=un(r.flowLayoutMode)==="dynamic",c=Pn(r),s={display:"grid",gridTemplateColumns:`repeat(${o},minmax(0,1fr))`,columnGap:`${i}mm`,gridAutoRows:`minmax(${a}mm,auto)`,width:"100%",...l?{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&&(s.fontFamily=String(r.fontFamily)),r.backgroundColor&&(s.backgroundColor=String(r.backgroundColor));const d=dx(e,t).map(p=>h("div",{class:"print-flow-cell",text:p}));return l&&n&&d.push(mx(n,e.id)),h("div",{class:"print-flowlist",style:s},d)}const kh={top:"flex-start",middle:"center",bottom:"flex-end"},yx={left:"flex-start",center:"center",right:"flex-end"};function vx(e,t){const n=e.options,r=pt(n),o=go(e.printElementType.type,n),i={};if(o?.all&&(i.border=`${o.all.borderWidth} ${o.all.borderStyle} ${o.all.borderColor}`),o)for(const a of pr){const l=o.edges[a];l&&(i[`border${a.charAt(0).toUpperCase()}${a.slice(1)}`]=`${l.borderWidth} ${l.borderStyle} ${l.borderColor}`)}return{position:"absolute",left:`${n.left}mm`,top:`${n.top}mm`,width:`${n.width}mm`,height:`${n.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(n.zIndex||"auto"),...i,...wx(e,t)}}function wx(e,t){if(t?.has(e.id))return{};const n=ha(e.printElementType.type,e.options);return n===void 0?{}:{rotate:`${n}deg`}}function Ch(e){const t=e.options,n=e.printElementType.type==="longText",r=co(e.printElementType.type,t),o=t.fontSize||12,i=r==="autoHeight",a={fontSize:`${o}pt`,fontWeight:t.fontWeight||"normal",fontFamily:Ya(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`:n?"1.5":"normal",letterSpacing:t.letterSpacing?`${t.letterSpacing}pt`:"normal",width:"100%",height:i?"auto":"100%",boxSizing:"border-box",overflow:i?"visible":"hidden",...n?{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`}};yc(t)&&(a.whiteSpace="nowrap",a.textOverflow="ellipsis");const l=bc(t);return l&&(a.whiteSpace=l),t.verticalAlign&&(a.display="flex",t.textAlign==="justify"?(a.flexDirection="column",a.justifyContent=kh[t.verticalAlign]??"flex-start"):(a.alignItems=kh[t.verticalAlign]??"flex-start",a.justifyContent=yx[t.textAlign||"left"]??"flex-start")),{style:a,fit:r}}function Ah(e){const t=e.options,n=`${t.borderWidth||.75}pt`,r=t.borderStyle||"solid",o=t.borderColor||"#333";return e.printElementType.type==="hline"?{width:"100%",height:"0",borderTop:`${n} ${r} ${o}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${n} ${r} ${o}`,boxSizing:"border-box"}}function Oh(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 xx(e){const t=e.options;return{objectFit:t.fit||"contain",...fa(t.fit,t.fitScale,t.objectPosition),maxWidth:t.maxWidth?`${t.maxWidth}mm`:"100%",maxHeight:t.maxHeight?`${t.maxHeight}mm`:"100%"}}function Ih(e){const t=e.options,n={fitBase:String(t.fontSize||12),fitMin:String(lr(t.shrinkMinFontSize))};return co(e.printElementType.type,t)==="shrink"&&(n.fit="shrink"),n}$f({text:e=>{const{style:t}=Ch(e),n=e.options;return h("div",{class:"print-text",style:t,dataset:Ih(e),text:String(n.testData||n.formatter||"")||"文本"})},longText:e=>{const{style:t}=Ch(e),n=e.options;return h("div",{class:"print-longtext",style:t,dataset:Ih(e),text:String(n.formatter||"")||"长文本内容"})},hline:e=>h("div",{class:"print-line",style:Ah(e)}),vline:e=>h("div",{class:"print-line",style:Ah(e)}),rect:e=>h("div",{class:"print-shape",style:Oh(e)}),oval:e=>h("div",{class:"print-shape",style:Oh(e)}),image:e=>{const t=e.options,n=String(t.src??""),r=n.includes("{")?Un(n,ht):n;return h("div",{class:"print-image"},[r?h("img",{src:r,style:xx(e)}):h("div",{class:"image-placeholder",text:"图片"})])},qrcode:e=>yw(e),barcode:e=>vw(e),html:e=>{const t=e.options,n=String(t.formatter??""),r=n?gw.sanitize(Un(n,{})):'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>';return h("div",{class:"print-html",html:r})},pageNumber:(e,t)=>{const n=e.options;return h("div",{class:"page-number-element",style:{fontSize:`${n.fontSize||12}pt`,fontWeight:n.fontWeight||"normal",fontFamily:Ya(n.fontFamily),color:n.color||"#333",textAlign:n.textAlign||"left",...n.textAlign==="justify"?{textAlignLast:"justify"}:{}},text:t?n.title||"{pageIndex}/{totalPages}":String(n.title||"")})},table:(e,t,n)=>n?sx(e,n.store,n.fire):h("div",{class:"print-table"}),flowList:(e,t,n)=>bx(e,void 0,n?.store)});function Ex(e,t,n){const r=e.printElementType.type,o=Qt(r)?.renderContent;if(o)return o(e,t,n);const i=js(r);if(!i)return h("div",{text:r});const a=document.createElement("div");a.className="plugin-kit-canvas",a.style.width="100%",a.style.height="100%";try{ph(`canvas:${e.id}`,i.ui.renderCanvas({element:e,data:n?.designData?.length?n.designData:[ht],designMode:!0}),a)}catch{a.textContent=String(r)}return a}function Rh(e){return`x:${Math.round(e.left)} y:${Math.round(e.top)} ${Math.round(e.width)}×${Math.round(e.height)}mm`}function Sx(e,t,n){const r=e.store,o=r.selectedIds.has(t.id),i=r.previewIds.has(t.id),a=t.options,l=t.zone||"content",c=[Ex(t,!0,{store:r,fire:e.fire,designData:e.host.designData})];return r.draggingIds.has(t.id)&&c.push(h("div",{class:"drag-preview"})),o&&(c.push(h("div",{class:"resize-handles"},F1.map(s=>h("div",{class:`resize-handle handle-${s}`,dataset:{point:s,elId:t.id},onMousedown:d=>e.fire("resize-start",{event:d,id:t.id,point:s})})))),c.push(h("div",{class:"selected-indicator"},[h("div",{class:"position-label",text:Rh(a)})]))),h("div",{class:["print-element",`type-${t.printElementType.type}`,`zone-${l}`,o?"selected":"",i?"previewed":"",r.draggingIds.has(t.id)?"drag-ghost":"","design-mode",a.locked?"locked":"",a.visible===!1?"hidden":""].filter(Boolean).join(" "),style:vx(t,n),dataset:{elId:t.id},onMousedown:s=>e.fire("element-mousedown",{event:s,id:t.id}),onContextmenu:s=>{s.preventDefault(),s.stopPropagation(),e.fire("contextmenu",{event:s,id:t.id})}},c)}function gl(e,t){const n=e.margins,r=e.header?.height??10,o=e.footer?.height??10,i=t.width-n.left-n.right;return{header:{left:n.left,top:n.top,width:i,height:r},content:{left:n.left,top:n.top+r,width:i,height:t.height-n.top-n.bottom-r-o},footer:{left:n.left,top:t.height-n.bottom-o,width:i,height:o}}}const _x='<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 Ph(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 Mx(e,t){const n=qd(e.watermark,[],t);return n?h("div",{class:"watermark-layer",style:{opacity:String(n.opacity)}},n.tiles.map(r=>h("svg",{class:"watermark-tile",width:`${r.widthMm}mm`,height:`${r.heightMm}mm`,viewBox:`0 0 ${n.tileWidthPx} ${n.tileHeightPx}`,style:{left:`${r.leftMm}mm`,top:`${r.topMm}mm`}},[h("text",{x:String(n.tileWidthPx/2),y:String(n.tileHeightPx/2),"font-size":String(n.fontSizePx),fill:n.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${n.rotate},${n.tileWidthPx/2},${n.tileHeightPx/2})`,text:n.text})]))):""}function ml(e,t,n,r,o,i){const a=e.store,l=[];n!=="content"&&l.push(h("span",{class:"zone-label",text:n==="header"?"页眉":"页脚"}));const c=n==="content"?zc(o):void 0;if(l.push(...o.map(s=>Sx(e,s,c))),n!=="content"){const s=n==="header"?"bottom":"top";l.push(h("div",{class:`zone-resize-handle handle-${s}`,dataset:{zone:n},onMousedown:d=>e.fire("zone-resize",{event:d,zone:n})},[t.zoneResizing===n?h("div",{class:"zone-height-tip",text:`${(n==="header"?a.templateData.header.height:a.templateData.footer.height).toFixed(1)}mm`}):""]))}return h("div",{class:`zone-layer zone-${n} design-mode`,style:{position:"absolute",left:`${r.left}mm`,top:`${r.top}mm`,width:`${r.width}mm`,height:`${r.height}mm`},dataset:{zone:n,paperWidth:String(i.width),paperHeight:String(i.height)}},l.filter(Boolean))}function Tx(e){const t=e.currentTarget,n=e.dataTransfer?.types??[],r=n.includes("fieldkey"),o=n.includes("elementtype");if(!r&&!o){t.querySelector(".drop-hint")?.remove();return}r&&(e.ctrlKey||e.metaKey)&&(t.dataset.dropLabelIntent="1");const i=o?"+ 元素":t.dataset.dropLabelIntent?"+ 静态文本":"+ 取值字段";let a=t.querySelector(".drop-hint");a||(a=document.createElement("div"),a.className="drop-hint",t.appendChild(a)),a.textContent=i,a.style.left=`${e.clientX+14}px`,a.style.top=`${e.clientY+18}px`}function Dh(e){e&&(e.querySelector(".drop-hint")?.remove(),delete e.dataset.dropLabelIntent)}function kx(e,t){const n=e.store,r=n.templateData,o=ft(r),i=(n.scale||100)/100,a=gl(r,o),l=p=>n.elements.filter(u=>(u.zone||"content")===p),c=h("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:`${o.height}mm`}},[n.showGrid?h("div",{class:"grid-bg",style:{backgroundImage:`url("data:image/svg+xml,${encodeURIComponent(_x)}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}}):"",...r.watermark&&Object.keys(r.watermark).length?[Mx(r,o)]:[],ml(e,t,"header",a.header,l("header"),o),ml(e,t,"content",a.content,l("content"),o),ml(e,t,"footer",a.footer,l("footer"),o),...n.adsorbGuides.map(p=>h("div",{class:`adsorb-guide guide-${p.type}`,style:Ph(p,o)})),...(r.guides??[]).map(p=>h("div",{class:`manual-guide guide-${p.type}`,style:{...Ph(p,o),"--guide-hit":`${8/i}px`},dataset:{guideId:String(p.id??"")},onMousedown:u=>e.fire("guide-mousedown",{event:u,id:p.id}),onDblclick:u=>{u.preventDefault(),e.fire("guide-remove",p.id)}}))].filter(Boolean)),s=h("div",{class:"hiprint-printPaper",dataset:{test:"paper"},style:{width:`${o.width}mm`,minHeight:`${o.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(${i})`,transformOrigin:"0 0"}},[...r.designBackground?.src?[h("div",{class:"design-background",style:{width:`${o.width}mm`,height:`${o.height}mm`,left:"0",top:"0",transform:r.designBackground.rotation?`rotate(${r.designBackground.rotation}deg)`:""}},[h("img",{src:r.designBackground.src,draggable:!1,alt:""})])]:[],c]),d=[h("div",{class:"canvas-scroll"},[h("div",{class:"paper-wrapper",style:{width:`${$o(o.width)*i}px`,height:`${$o(o.height)*i}px`,position:"relative"}},[s])])];if(n.showRuler&&d.push(h("div",{class:"ruler-overlay",style:{transform:`translate(${t.scrollX}px, ${t.scrollY}px)`}},[h("div",{class:"ruler-corner"}),h("canvas",{class:"pd-ruler is-horizontal",dataset:{ruler:"horizontal"},style:{width:`${t.geom.viewW}px`,height:"20px"},onMousedown:p=>e.fire("ruler-mousedown",{event:p,orientation:"horizontal"})}),h("canvas",{class:"pd-ruler is-vertical",dataset:{ruler:"vertical"},style:{width:"20px",height:`${t.geom.viewH}px`},onMousedown:p=>e.fire("ruler-mousedown",{event:p,orientation:"vertical"})})])),t.guidePreview&&d.push(h("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&&d.push(h("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 p=t.contextMenu;d.push(h("div",{class:"context-menu",style:{left:`${t.contextMenu.x+t.contextMenu.flipX}px`,top:`${t.contextMenu.y+t.contextMenu.flipY}px`}},t.contextMenu.targetId?[Et(e,p,"复制","copy"),Et(e,p,"剪切","cut"),Et(e,p,"粘贴","paste",!n.hasClipboard),Et(e,p,"删除","delete"),h("div",{class:"context-menu-sep"}),Et(e,p,"置顶","move-layer",!1,"top"),Et(e,p,"上移","move-layer",!1,"up"),Et(e,p,"下移","move-layer",!1,"down"),Et(e,p,"置底","move-layer",!1,"bottom")]:[Et(e,p,"粘贴","paste-at",!n.hasClipboard),Et(e,p,"全选","select-all"),Et(e,p,"取消选择","clear-selection")]))}return h("div",{class:"canvas-area",dataset:{test:"canvas-area"},onDragover:p=>{const u=p;u.preventDefault(),u.dataTransfer&&(u.dataTransfer.dropEffect="copy"),Tx(u)},onDragleave:p=>{const u=p.currentTarget,f=p.relatedTarget;(!f||!u.contains(f))&&u.querySelector(".drop-hint")?.remove()},onDrop:p=>{const u=p,f=p.currentTarget,g=f.dataset.dropLabelIntent==="1";Dh(f),g&&(u.labelIntent=!0),e.fire("drop",u)},onMousedown:p=>e.fire("canvas-mousedown",p),onMousemove:p=>e.fire("canvas-mousemove",p),onMouseleave:()=>e.fire("canvas-mouseleave"),onWheel:p=>e.fire("wheel",p),onScroll:p=>e.fire("scroll",p),onContextmenu:p=>{p.preventDefault(),e.fire("canvas-contextmenu",p)}},d.filter(Boolean))}function Et(e,t,n,r,o=!1,i){return h("div",{class:`context-menu-item${o?" disabled":""}`,text:n,onClick:()=>{t.visible=!1,o||e.fire(r,i),e.repaint()}})}const Cx={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 De(e,t=15,n){const r=Cx[e];return r?`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}"${n?` class="${n}"`:""} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${r}</svg>`:""}let Mn=null;function bl(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;const n=t[1],r=n.length===3?n.split("").map(o=>o+o).join(""):n;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 yl(e){const t=bl(e);return t?$h(t):"#000000"}function $h({r:e,g:t,b:n}){return`#${[e,t,n].map(r=>Math.round(Vr(r/255)*255).toString(16).padStart(2,"0")).join("")}`}function Ax(e,t,n){const r=e/255,o=t/255,i=n/255,a=Math.max(r,o,i),l=Math.min(r,o,i),c=a-l;let s=0;return c!==0&&(a===r?s=(o-i)/c%6:a===o?s=(i-r)/c+2:s=(r-o)/c+4,s*=60,s<0&&(s+=360)),{h:s,s:a===0?0:c/a,v:a}}function Ox(e,t,n){const r=n*t,o=(e%360+360)%360/60,i=r*(1-Math.abs(o%2-1)),[a,l,c]=o<1?[r,i,0]:o<2?[i,r,0]:o<3?[0,r,i]:o<4?[0,i,r]:o<5?[i,0,r]:[r,0,i],s=n-r;return{r:(a+s)*255,g:(l+s)*255,b:(c+s)*255}}function Ix(e){return((Number.isFinite(e)?e:0)%360+360)%360}function Vr(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Rx(e){const t=e.title??"颜色选择";return h("button",{type:"button",class:`preset-color-trigger${e.triggerClass?` ${e.triggerClass}`:""}`,"aria-expanded":"false","aria-haspopup":"dialog",title:t,onClick:n=>{const r=n.currentTarget??n.target,o=r.getRootNode();if(!!Mn&&Mn.root===o&&Mn.title===t&&Mn.trigger===r){Yr();return}Yr(),Px(r,e)}},[h("span",{class:"preset-color-swatch",style:e.value?{background:e.value}:{background:"transparent"}})])}function Yr(){const e=Mn;e&&(Mn=null,e.teardowns.forEach(t=>t()),e.trigger.setAttribute("aria-expanded","false"),e.panel.remove())}function Px(e,t){const n=e.getRootNode(),r=n instanceof ShadowRoot?n:document.body,o={root:n,title:t.title??"颜色选择",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,items:[],teardowns:[]};t.value&&wl(o,t.value)?o.hexText=yl(t.value).toUpperCase():o.hexText=t.value?String(t.value):"",o.panel=Je(Lx(o),r),o.current=o.panel.querySelector(".picker-current"),o.hex=o.panel.querySelector(".picker-hex"),o.area=o.panel.querySelector(".picker-area"),o.handle=o.panel.querySelector(".picker-handle"),o.hueRange=o.panel.querySelector(".picker-hue"),o.clearBtn=o.panel.querySelector(".picker-clear"),o.items=Array.from(o.panel.querySelectorAll(".preset-color-item")).map((i,a)=>({el:i,color:sd[a]})),Li(o),Dx(o),$x(o),Mn=o,e.setAttribute("aria-expanded","true")}function Dx(e){const t=e.trigger.getBoundingClientRect(),n=190,r=e.panel.offsetHeight||216,o=8,i=Math.max(o,Math.min(t.left,window.innerWidth-n-o)),a=t.bottom+6,l=a+r>window.innerHeight-o?Math.max(o,t.top-r-6):a;e.panel.style.left=`${i}px`,e.panel.style.top=`${l}px`}function $x(e){const t=o=>{const i=Nx(o);i.includes(e.trigger)||i.includes(e.panel)||Yr()},n=o=>{o.key==="Escape"&&Yr()},r=()=>Yr();document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",n),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",n),()=>window.removeEventListener("scroll",r,!0),()=>window.removeEventListener("resize",r),()=>e.root.removeEventListener("scroll",r,!0))}function Nx(e){const t=typeof e.composedPath=="function"?e.composedPath():[];return t.length?t:[e.target]}function Lx(e){return h("div",{class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:{position:"fixed"},onPointerdown:t=>t.stopPropagation()},[h("div",{class:"picker-preview"},[h("span",{class:"picker-current"}),h("input",{class:"picker-hex",type:"text",maxlength:7,spellcheck:"false","aria-label":"颜色值",onInput:t=>zx(e,t.target.value)})]),h("div",{class:"picker-area","aria-label":"自定义颜色",tabindex:0,onPointerdown:t=>Bx(e,t),onKeydown:t=>Hx(e,t)},[h("span",{class:"picker-handle"})]),h("input",{class:"picker-hue",type:"range",min:0,max:360,step:1,"aria-label":"色相",onInput:t=>Ux(e,Number(t.target.value)),onChange:()=>xl(e)}),h("div",{class:"picker-heading"},[h("span",{text:"常用颜色"}),e.clearable?h("button",{type:"button",class:"picker-clear",title:"清除选中的颜色",onClick:()=>Fi(e,void 0)},[h("svg",{viewBox:"0 0 16 16",width:12,height:12,"aria-hidden":"true"},[h("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})]),"清除"]):""].filter(Boolean)),h("div",{class:"preset-color-grid"},sd.map(t=>h("button",{type:"button",class:"preset-color-item",style:{background:t},title:t,"aria-label":t,onClick:()=>Fx(e,t)})))])}function vl(e){return $h(Ox(e.hue,e.saturation,e.value_))}function Li(e){const t=vl(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 n=String(Math.round(e.hue));e.hueRange.value!==n&&(e.hueRange.value=n),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 wl(e,t){const n=bl(t);if(!n)return!1;const r=Ax(n.r,n.g,n.b);return e.hue=r.h,e.saturation=r.s,e.value_=r.v,e.hexText=yl(t).toUpperCase(),!0}function Xn(e,t,n,r){e.hue=Ix(t),e.saturation=Vr(n),e.value_=Vr(r),e.hexText=vl(e).toUpperCase(),Li(e)}function xl(e){const t=vl(e);e.model=t,Li(e),e.onChange(t)}function Fi(e,t){e.model=t,t||(e.hexText=""),Li(e),e.onChange(t)}function Fx(e,t){wl(e,t),Fi(e,t)}function zx(e,t){const n=t.trim();if(!n){e.clearable&&Fi(e,void 0);return}bl(n)&&(wl(e,n),Fi(e,yl(n)))}function Bx(e,t){e.dragging=!0,Nh(e,t);const n=o=>{e.dragging&&Nh(e,o)},r=()=>{e.dragging&&(e.dragging=!1,document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",r),document.removeEventListener("pointercancel",r),xl(e))};document.addEventListener("pointermove",n),document.addEventListener("pointerup",r),document.addEventListener("pointercancel",r)}function Nh(e,t){const n=e.area.getBoundingClientRect();if(!n.width||!n.height)return;const r=Vr((t.clientX-n.left)/n.width),o=Vr(1-(t.clientY-n.top)/n.height);Xn(e,e.hue,r,o)}function Hx(e,t){const n=t.shiftKey?.1:.02;let r=!0;t.key==="ArrowLeft"?Xn(e,e.hue,e.saturation-n,e.value_):t.key==="ArrowRight"?Xn(e,e.hue,e.saturation+n,e.value_):t.key==="ArrowUp"?Xn(e,e.hue,e.saturation,e.value_+n):t.key==="ArrowDown"?Xn(e,e.hue,e.saturation,e.value_-n):r=!1,r&&(t.preventDefault(),xl(e))}function Ux(e,t){Xn(e,t,e.saturation,e.value_)}function Se(e,t,n,r){return h("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(n,r.arg),html:De(t)})}function zi(e,t,n,r){const o=e.state.openDd===t,i=()=>{e.state.openDd=o?null:t,e.repaint()};return h("div",{class:"tb-dd"},[h("button",{type:"button",class:`tb-dd-trigger${o?" on":""}`,disabled:!!n.disabled,dataset:{test:n.testId??t,tip:n.tip},onClick:i,html:`${n.icon?De(n.icon):""}${n.text?`<span class="${n.textClass??"tb-btn-text"}">${n.text}</span>`:""}${De("ChevronDown",12,`tb-dd-arrow${o?" up":""}`)}`}),o?h("div",{class:`tb-dd-panel${n.panelClass?` ${n.panelClass}`:""}`},r):""].filter(Boolean))}function J(e){const t=e.step??1,n=String(t),r=n.indexOf("."),o=r===-1?0:n.length-r-1,i=p=>Number.isFinite(p)?Number(p.toFixed(o)):0,a=p=>{let u=i(p);return e.min!==void 0&&u<e.min&&(u=e.min),e.max!==void 0&&u>e.max&&(u=e.max),u},l=e.value===void 0||e.value===null||!Number.isFinite(e.value)?void 0:i(e.value),c=l??e.min??0,s=p=>{p!==l&&e.onCommit(p)},d=h("input",{class:"pd-input pd-step-input",type:"number",value:l===void 0?"":String(l),min:e.min,max:e.max,step:t,placeholder:e.placeholder,disabled:!!e.disabled,onChange:p=>{const u=p.target,f=(u.value??"").trim();if(f===""){l!==void 0&&(u.value=String(l));return}const g=Number(f);if(!Number.isFinite(g)){u.value=l===void 0?"":String(l);return}const m=a(g);u.value=String(m),s(m)}});return h("div",{class:"pd-stepper"},[h("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:!!e.disabled||c<=(e.min??-1/0),title:"减小","aria-label":"减小",text:"−",onClick:()=>s(a(c-t))}),d,h("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:!!e.disabled||c>=(e.max??1/0),title:"增大","aria-label":"增大",text:"+",onClick:()=>s(a(c+t))})])}function se(e,t,n,r){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:e}),r??""]),t,n?h("p",{class:"pd-hint",text:n}):""].filter(Boolean))}const El=e=>h("button",{class:"pd-help",type:"button","data-tip":e,"aria-label":"字段说明"});function He(e,t,n,r){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t"},[e,El(n)]),r??""]),t])}function Tn(e){const t=e.base?.[e.propKey],n=e.target?.[e.propKey]!==t,r=e.force===!0||n,o=e.tipOverride??(e.tipValue===void 0?"恢复默认值":`恢复默认值(${e.tipValue}${e.tipUnit?" "+e.tipUnit:""})`),i=e.force?`${o}(应用到全部选中格)`:o;return h("button",{type:"button",class:`pd-reset-btn${n&&!e.force?" is-dirty":""}`,"data-tip":i,"aria-label":i,html:De("RotateCcw",13),onClick:()=>{r&&(e.write?e.write(t):e.target[e.propKey]=t,e.onReset?.())}})}const Pt=e=>h("h3",{class:"pd-divider",text:e});function st(e,t,n="颜色选择",r){return Rx({value:e,title:n,triggerClass:r,onChange:o=>t(o)})}function nn(e,t,n,r,o=!1){return h("div",{class:`pd-radio-group${o?" pd-radio-group--2col":""}`,role:"radiogroup"},t.map(i=>h("label",{class:"pd-radio"},[h("input",{type:"radio",name:e,value:i.value,checked:n===i.value,onChange:()=>r(i.value)}),h("span",{text:i.label})])))}function Lh(e,t,n,r={}){const o=document.createElement("select");o.className=r.className??"pd-select",r.width&&(o.style.width=r.width);for(const i of t){const a=document.createElement("option");a.value=i.value,a.textContent=i.label,i.disabled&&(a.disabled=!0),o.appendChild(a)}return o.value=e,t.some(i=>i.value===e)||(o.selectedIndex=-1),o.addEventListener("change",()=>n(o.value)),o}function qx(e){const t=window.innerHeight;for(let n=e.parentElement;n&&n!==document.body;n=n.parentElement){const r=getComputedStyle(n).overflowY;if(r==="auto"||r==="scroll"||r==="hidden"||r==="clip"){const o=n.getBoundingClientRect();return{top:Math.max(0,o.top),bottom:Math.min(t,o.bottom)}}}return{top:0,bottom:t}}function Bi(e){const t=X0(e.fonts),n=e.placeholder??"默认",r=`font-select-list-${e.id}`,o=O=>{const T=O?.trim();return T?Od(t,T)?.label??T:""},i=O=>{const T=Sr(O);return t.find(S=>S.label&&Sr(S.label)===T)?.family??O},a=()=>{const O=e.value?.trim();return O?Od(t,O)?"":O:""},l=O=>{const T=(e.value??"").trim(),I=(D,B,_,ie)=>({kind:D,key:B,label:_,value:ie,selected:(ie??"")===T}),S=O.trim();if(!S){const D=[I("clear","__clear__",n)],B=a();B&&D.push(I("unknown","__unknown__",`${B}(未知)`,B));for(const _ of t)D.push(I("font",_.family,Id(_),_.family));return D}const $=J0(t,S).map(D=>I("font",D.family,Id(D),D.family));if(!$.length){const D=i(S);$.push(I("free","__free__",`使用「${D}」`,D))}return $},c=document.createElement("div");c.className="font-select";const s=document.createElement("input");s.className="pd-input font-select-input",s.type="text",s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-controls",r),s.autocomplete="off",s.placeholder=n,s.disabled=!!e.disabled,s.value=o(e.value);const d=document.createElement("ul");d.id=r,d.className="font-select-list",d.setAttribute("role","listbox");const p=e.state.fontOpen?.id===e.id?e.state.fontOpen:null,u={open:!!p&&!e.disabled,query:p?.query??"",highlighted:p?.highlighted??-1};u.open&&(s.value=u.query);const f=()=>{e.state.fontOpen=u.open?{id:e.id,query:u.query,highlighted:u.highlighted}:null};f();const g=()=>{const O=(e.value??"").trim();return l(u.query).findIndex(T=>(T.value??"")===O)},m=()=>{const O=s.getBoundingClientRect(),T=qx(s);d.classList.toggle("is-up",Rm({triggerTop:O.top,triggerBottom:O.bottom,overlayHeight:d.getBoundingClientRect().height,boundaryTop:T.top,boundaryBottom:T.bottom})==="up")},b=()=>{if(!u.open){d.isConnected&&d.remove(),s.setAttribute("aria-expanded","false"),s.setAttribute("aria-activedescendant","");return}d.isConnected||c.appendChild(d);const O=l(u.query);d.replaceChildren(...O.map((T,I)=>{const S=document.createElement("li");return S.id=`${r}-${I}`,S.className="font-select-option"+(I===u.highlighted?" is-active":"")+(T.kind==="unknown"||T.kind==="free"?" is-muted":""),S.setAttribute("role","option"),S.setAttribute("aria-selected",String(T.selected)),S.textContent=T.label,S.addEventListener("mousedown",$=>{$.preventDefault(),N(T)}),S})),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-activedescendant",u.highlighted>=0?`${r}-${u.highlighted}`:""),m()},v=()=>{u.open||e.disabled||(u.open=!0,u.query="",u.highlighted=g(),f(),b())},w=()=>{u.open||v()},E=()=>{u.open=!0,u.query=s.value,u.highlighted=l(u.query).length?0:-1,f(),b()},C=O=>{if(!u.open){v();return}const T=l(u.query).length-1;if(T<0)return;u.highlighted=Math.min(Math.max(u.highlighted+O,0),T),f(),b(),d.children[u.highlighted]?.scrollIntoView?.({block:"nearest"})},F=()=>{if(!u.open)return;const O=l(u.query)[u.highlighted];if(O){N(O);return}const T=u.query.trim();if(T){const I=i(T);N({value:I})}},N=O=>{u.open=!1,u.query="",u.highlighted=-1,f(),s.value=o(O.value),b(),e.onChange(O.value)},P=()=>{u.open&&(u.open=!1,u.query="",u.highlighted=-1,f(),s.value=o(e.value),b())};return s.addEventListener("focus",v),s.addEventListener("click",w),s.addEventListener("input",E),s.addEventListener("blur",P),s.addEventListener("keydown",O=>{const T=O;T.key==="ArrowDown"?(T.preventDefault(),C(1)):T.key==="ArrowUp"?(T.preventDefault(),C(-1)):T.key==="Enter"?(T.preventDefault(),F()):T.key==="Escape"&&(T.preventDefault(),P())}),c.append(s),b(),u.open&&(s.focus(),s.setSelectionRange(u.query.length,u.query.length)),c}const Wx=[{key:"solid",label:"实线",preview:"1.5px solid currentColor"},{key:"dashed",label:"虚线",preview:"1.5px dashed currentColor"},{key:"dotted",label:"点线",preview:"1.5px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}],jx={left:"TextAlignStart",center:"TextAlignCenter",right:"TextAlignEnd",justify:"TextAlignJustify"};function rn(e,t,n,r,o={}){return h("button",{type:"button",class:`ft-cell-btn${o.on?" on":""}`,dataset:{test:e,tip:t},disabled:!!o.disabled,onClick:r,html:`<svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true">${n}</svg>`})}const Zn='<rect class="g-faint" x="2.5" y="2.5" width="13" height="13" />',Fh='<rect class="g-solid" x="2.5" y="2.5" width="13" height="13" fill="none" />';function Gx(e){const t=e.format;t.syncBorderDraft();const n=t.values,r=!t.fontEditable,o=r||t.context==="cells",i=t.context==="none",a=t.context==="cells",l=!t.painterActive&&(t.context==="none"||t.context==="cells"||!t.painterCapturable),c=t.painterActive?"退出格式刷(Esc)":t.context==="cells"?"格式刷(表格单元格暂不支持)":t.context==="none"?"格式刷(需选中元素)":t.painterCapturable?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)",s=u=>r?`${u}(需选中文本元素)`:u,d=[h("div",{class:"ft-border-panel",dataset:{test:"border-panel"}},[h("div",{class:"ft-border-grid"},[rn("preset-none","无边框",`${Zn}<line class="g-solid" x1="4" y1="14" x2="14" y2="4" />`,()=>t.applyBorderPreset("none")),rn("preset-all","所有边框",`${Fh}<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")),rn("preset-outer","外侧边框",Fh,()=>t.applyBorderPreset("outer")),rn("preset-inner",a?"内部边框":"内部边框(仅表格单元格可用)",`${Zn}<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:!a}),rn("edge-top","上边框",`${Zn}<line class="g-solid" x1="2" y1="3" x2="16" y2="3" />`,()=>t.applyEdge("top"),{on:t.edgeOn("top")}),rn("edge-bottom","下边框",`${Zn}<line class="g-solid" x1="2" y1="15" x2="16" y2="15" />`,()=>t.applyEdge("bottom"),{on:t.edgeOn("bottom")}),rn("edge-left","左边框",`${Zn}<line class="g-solid" x1="3" y1="2" x2="3" y2="16" />`,()=>t.applyEdge("left"),{on:t.edgeOn("left")}),rn("edge-right","右边框",`${Zn}<line class="g-solid" x1="15" y1="2" x2="15" y2="16" />`,()=>t.applyEdge("right"),{on:t.edgeOn("right")})]),h("div",{class:"ft-style-row"},Wx.map(u=>h("button",{type:"button",class:`ft-style-btn${t.borderStyle===u.key?" on":""}`,dataset:{test:`style-${u.key}`,tip:t.borderStyle===u.key?`${u.label}(再点一次取消,线型=无)`:u.label},onClick:()=>{t.toggleBorderStyle(u.key),e.repaint()}},[h("span",{class:"ft-style-line",style:{borderTop:u.preview}})]))),h("div",{class:"ft-border-style-row"},[h("span",{class:"ft-edge-label",text:"粗细"}),h("div",{class:"ft-line-width"},[J({value:t.borderWidth,min:.25,max:5,step:.25,placeholder:t.borderMixed.width?"混合":void 0,onCommit:u=>{t.setBorderWidth(u),e.repaint()}})])]),h("div",{class:"ft-border-style-row"},[h("span",{class:"ft-edge-label",text:"颜色"}),st(t.borderColor,u=>{t.setBorderColor(u),e.repaint()},"边框颜色")]),t.borderMixedAny?h("p",{class:"pd-hint",text:"当前单元格四边规格不一致:留空的项不谎报,点预设/单边时按缺省档(实线 0.75 / #333333)批写"}):""].filter(Boolean))],p=[h("div",{class:"ft-align-panel",dataset:{test:"align-panel"}},[h("div",{class:"ft-align-row"},[["left","左对齐","TextAlignStart"],["center","水平居中","TextAlignCenter"],["right","右对齐","TextAlignEnd"],["justify","两端对齐(撑满行宽,含末行)","TextAlignJustify"]].map(([u,f,g])=>h("button",{type:"button",class:`ft-cell-btn${n.textAlign===u?" on":""}`,dataset:{test:`align-${u}`,tip:f},disabled:r,onClick:()=>t.applyStyle({textAlign:u}),html:De(g)}))),h("div",{class:"ft-align-row"},[["top","顶端对齐","ArrowUpToLine"],["middle","垂直居中","ChevronsUpDown"],["bottom","底端对齐","ArrowDownToLine"]].map(([u,f,g])=>h("button",{type:"button",class:`ft-cell-btn${n.verticalAlign===u?" on":""}`,dataset:{test:`valign-${u}`,tip:f},disabled:r,onClick:()=>t.applyStyle({verticalAlign:u}),html:De(g)})))])];return h("div",{class:"format-toolbar"},[h("div",{class:"tb-ou ft-group",dataset:{unit:"painter"}},[h("button",{type:"button",class:`ft-btn${t.painterActive?" on":""}`,dataset:{test:"format-painter",tip:c},disabled:l,onClick:()=>{t.painterActive?t.cancelPainter():t.pickPainterSource(!1),e.repaint()},onDblclick:()=>{t.pickPainterSource(!0),e.repaint()},html:De("Paintbrush")})]),h("div",{class:"tb-ou ft-group",dataset:{unit:"font"}},[h("div",{class:"ft-font"},[Bi({id:"ft-font",state:e.state,fonts:e.host.fonts,value:typeof n.fontFamily=="string"?n.fontFamily:void 0,placeholder:n.fontFamily===En?"混合":"默认",disabled:r,onChange:u=>t.applyStyle({fontFamily:u})})]),h("div",{class:"ft-size",dataset:{test:"font-size"}},[J({value:typeof n.fontSize=="number"?n.fontSize:void 0,min:5,max:72,disabled:r,placeholder:n.fontSize===En?"混合":"默认",onCommit:u=>t.applyStyle({fontSize:u})})])]),h("div",{class:"tb-ou ft-group",dataset:{unit:"style"}},[...[["bold","Bold","加粗",()=>t.toggleBold()],["underline","Underline","下划线",()=>t.toggleUnderline()],["strike","Strikethrough","删除线",()=>t.toggleStrike()]].map(([u,f,g,m])=>h("button",{type:"button",class:`ft-btn${n[u]===!0?" on":""}`,dataset:{test:u,tip:s(g)},disabled:u==="bold"?r:o,onClick:m,html:De(f)}))]),h("div",{class:"tb-ou ft-group",dataset:{unit:"color"}},[h("span",{class:`ft-color-btn${r?" dim":""}`,title:`字体颜色${r?"(需选中或混选文本元素)":""}`},[st(typeof n.color=="string"?n.color:void 0,u=>t.applyStyle({color:u})),h("span",{class:"ft-glyph",text:"A"})]),h("span",{class:`ft-color-btn${i?" dim":""}`,title:"背景色"},[st(typeof n.backgroundColor=="string"?n.backgroundColor:void 0,u=>t.applyStyle({backgroundColor:u})),h("span",{class:"ft-glyph",html:De("PaintBucket",14)})])]),h("div",{class:"tb-ou ft-group",dataset:{unit:"align"}},[zi(e,"align",{icon:jx[String(n.textAlign)]??"TextAlignStart",text:"对齐",textClass:"ft-btn-text",tip:r?"对齐(需选中文本元素或单元格)":"对齐",disabled:r,testId:"align-dd"},p)]),h("div",{class:"tb-ou ft-group",dataset:{unit:"border"}},[zi(e,"border",{icon:"Grid3x3",text:"边框",textClass:"ft-btn-text",tip:i?"边框(需选中元素)":"边框",disabled:i,testId:"border"},d)])])}Ci.filter(e=>e.material).map(e=>({type:e.type,label:e.label,icon:e.icon}));function Hi(e,t){return De(e??"Shapes",t)||De("Shapes",t)}function Vx(e){const t=e.state;if(t.leftCollapsed)return h("div",{class:"left-panel collapsed"},[h("div",{class:"left-collapsed"},[zh("ChevronsRight","展开素材台",()=>{t.leftCollapsed=!1,e.repaint()}),...[["elements","元素","Table2"],["fields","字段","ListTree"],["layers","图层","Layers"]].map(([r,o,i])=>h("button",{type:"button",class:`lc-btn${t.leftTab===r?" on":""}`,title:o,html:Hi(i,14),onClick:()=>{t.leftTab=r,t.leftCollapsed=!1,e.repaint()}}))])]);const n=(r,o,i="")=>h("div",{class:`pd-tab-pane${i?` ${i}`:""}`,role:"tabpanel",dataset:{pane:`left:${r}`},style:t.leftTab===r?"":{display:"none"}},o);return h("div",{class:"left-panel"},[h("div",{class:"left-head"},[h("span",{class:"left-title",text:"素材台"}),zh("ChevronsLeft","收起素材台",()=>{t.leftCollapsed=!0,e.repaint()})]),h("div",{class:"pd-tabs left-tabs"},[h("div",{class:"pd-tab-bar",role:"tablist"},[...[["elements","元素"],["fields","字段"],["layers","图层"]].map(([r,o])=>h("button",{type:"button",class:`pd-tab${t.leftTab===r?" active":""}`,text:o,onClick:()=>{t.leftTab=r,e.repaint()}}))]),n("elements",Kx(),"material-grid"),n("fields",[Xx(e)]),n("layers",[Zx(e)])])])}function zh(e,t,n){return h("button",{type:"button",class:"collapse-btn",title:t,html:Hi(e,14),onClick:n})}function Yx(e,t,n){return h("div",{class:`material-card${m0(t)?" material-card--wide":""}`,draggable:!0,dataset:{test:`material-${e}`},onDragstart:r=>{const o=r.dataTransfer;o?.setData("elementType",e),o&&(o.effectAllowed="all")}},[h("span",{class:"material-icon","data-icon":n,html:Hi(n,14)}),h("span",{class:"material-label",text:t})])}function Kx(){const e=[];let t;for(const n of Lf()){const r=n.group;r&&r!==t&&e.push(h("div",{class:"material-group-title",text:r})),r&&(t=r),e.push(Yx(n.type,n.label,n.icon))}return[h("div",{class:"panel-title",text:"拖拽元素到画布"}),...e]}function Xx(e){const t=e.state,n=Mu(e.store.fields),r=(t.fieldSearch??"").trim().toLowerCase(),o=r?n.map(i=>({...i,fields:i.fields.filter(a=>`${a.fieldLabel}${a.fieldKey}`.toLowerCase().includes(r))})).filter(i=>i.fields.length):n;return h("div",{class:"field-tree-panel"},[h("div",{class:"panel-title",text:"业务字段"}),h("input",{class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段",value:t.fieldSearch??"",onInput:i=>{t.fieldSearch=i.target.value},onChange:()=>e.repaint()}),h("div",{class:"tree-container"},o.flatMap(i=>{const a=t.collapsedGroups.has(i.key)&&!r,l=i.key?h("div",{class:`field-group-header${i.isList?" is-list":""}`,onClick:()=>{a?t.collapsedGroups.delete(i.key):t.collapsedGroups.add(i.key),e.repaint()}},[h("span",{class:"expand-icon",text:a?"▶":"▼"}),h("span",{class:"node-icon",text:i.isList?"📋":"📁"}),h("span",{class:"group-label",text:i.label,"data-tip":i.label})]):"",c=a?[]:i.fields.map(s=>h("div",{class:"field-row",draggable:!0,"data-tip":`${s.fieldLabel} (${s.fieldKey}) · 单击复制字段名 · 拖动中按住 Ctrl(Mac 为 ⌘)切换为插入字段名`,style:{paddingLeft:`${i.key?22:8}px`},onDragstart:d=>{const p=d.dataTransfer;p?.setData("fieldKey",s.fieldKey),p&&(p.effectAllowed="all")},onClick:()=>{Tu(s.fieldLabel||s.fieldKey).then(d=>{d&&(t.copiedFieldKey=s.fieldKey,e.repaint(),setTimeout(()=>{t.copiedFieldKey===s.fieldKey&&(t.copiedFieldKey="",e.repaint())},1200))})}},[h("span",{class:"node-icon",text:"📄"}),h("span",{class:"node-meta"},[h("span",{class:"node-label",text:s.fieldLabel}),h("span",{class:"node-key",text:`(${s.fieldKey})`})]),t.copiedFieldKey===s.fieldKey?h("span",{class:"copy-hint",text:"已复制"}):""].filter(Boolean)));return[l,h("div",{},c.filter(Boolean))].filter(Boolean)})),o.length===0?h("p",{class:"pd-empty",text:"暂无字段"}):""].filter(Boolean))}function Zx(e){const t=e.store,n=[...t.elements].sort((l,c)=>(c.options.zIndex??0)-(l.options.zIndex??0)),r=t.elements.filter(l=>t.selectedIds.has(l.id)),o=r.length>=2,i=r.some(l=>!!l.options.groupId),a=l=>l.zone==="header"?"页眉":l.zone==="footer"?"页脚":"";return h("div",{class:"layer-panel"},[h("div",{class:"panel-title",text:"图层"}),...n.map(l=>{const c=Bf(l.printElementType.type);return h("div",{class:`layer-item${t.selectedIds.has(l.id)?" active":""}`,onClick:s=>t.selectElement(l.id,s.ctrlKey||s.metaKey)},[h("span",{class:"layer-icon","data-icon":c??"Shapes",html:Hi(c,12)}),h("span",{class:"layer-name",text:l.options.title||l.printElementType.title||l.printElementType.type}),a(l)?h("span",{class:"layer-zone",text:a(l)}):"",h("span",{class:"layer-zindex",text:`z:${l.options.zIndex??0}`})].filter(Boolean))}),n.length?h("div",{class:"layer-actions"},[...[["top","置顶","ArrowUpToLine"],["up","上移","ArrowUp"],["down","下移","ArrowDown"],["bottom","置底","ArrowDownToLine"]].map(([l,c,s])=>h("button",{type:"button",class:"pd-button small",title:c,html:De(s,14),onClick:()=>e.fire("move-layer",l)}))]):"",o||i?h("div",{class:"layer-actions"},[o?h("button",{type:"button",class:"pd-button small",title:"组合 (Ctrl+G)",html:De("Group",14),onClick:()=>e.fire("group")}):"",i?h("button",{type:"button",class:"pd-button small",title:"取消组合 (Ctrl+Shift+G)",html:De("Ungroup",14),onClick:()=>e.fire("ungroup")}):""].filter(Boolean)):""].filter(Boolean))}function Jx(e){const t=e.store,n=e.state,r=t.pages.length>1,o=t.pages[t.activePageIndex]?.name||`页面 ${t.activePageIndex+1}`,i=t.tilingEnabled;return h("div",{class:"page-tabs"},[h("div",{class:"page-tabs-list"},t.pages.map((l,c)=>n.renamingPage===c?h("input",{class:"page-tab-rename",dataset:{test:"page-rename-input"},value:n.renameText??"",onInput:s=>{n.renameText=s.target.value},onBlur:()=>a(),onKeydown:s=>{const d=s;if(d.key==="Enter"){a();return}d.key==="Escape"&&(n.renamingPage=null,e.repaint())}}):h("button",{type:"button",class:`page-tab${c===t.activePageIndex?" active":""}`,dataset:{tip:l.name?`${l.name}(双击重命名)`:"双击重命名"},text:l.name||`页面 ${c+1}`,onClick:()=>t.switchPage(c),onDblclick:()=>{n.renamingPage=c,n.renameText=l.name??"",e.repaint()}}))),h("div",{class:"page-tabs-actions"},[h("button",{type:"button",dataset:{test:"add-page",tip:i?"拼版模板仅允许一个设计页面":"新增页面(在当前页后追加空白页)"},disabled:i,text:"+",onClick:()=>e.fire("add-page")}),h("button",{type:"button",dataset:{test:"duplicate-page",tip:i?"拼版模板仅允许一个设计页面":`复制当前页「${o}」`},disabled:i,text:"⧉",onClick:()=>e.fire("duplicate-page")}),h("button",{type:"button",dataset:{test:"delete-page",tip:r?`删除当前页「${o}」`:"仅多页面模板可删除页面"},disabled:!r,text:"✕",onClick:()=>e.fire("delete-page")}),h("button",{type:"button",dataset:{test:"move-left",tip:`前移「${o}」`},disabled:t.activePageIndex<=0,text:"←",onClick:()=>e.fire("move-page",-1)}),h("button",{type:"button",dataset:{test:"move-right",tip:`后移「${o}」`},disabled:t.activePageIndex>=t.pages.length-1,text:"→",onClick:()=>e.fire("move-page",1)})])]);function a(){const l=(n.renameText??"").trim();n.renamingPage!==null&&l&&t.renamePage(n.renamingPage,l),n.renamingPage=null,e.repaint()}}function Qx(e){const t=e.store,n=t.templateData,r=Xt(n),o=n.orientation==="landscape"?"横向":"纵向",i=Ct[n.paperSize]?.label??n.paperSize,a=n.outputRotation,l=`${i} ${o} ${Math.round(r.width)}×${Math.round(r.height)}mm${a?`(旋转${a}°)`:""}`;return h("div",{class:"status-bar"},[h("span",{class:"status-item coord",dataset:{coord:""},style:{display:"none"}}),h("span",{class:"status-item",text:`缩放 ${t.scale}%`}),h("span",{class:"status-item",text:`元素 ${t.elements.length}${t.selectedIds.size?` (选中 ${t.selectedIds.size})`:""}`}),h("span",{class:`status-dirty${t.dirty?" on":""}`},[h("span",{class:"dirty-dot"}),t.dirty?"未保存":"已保存"]),h("span",{class:"status-item status-paper",text:l})])}const e2=Object.keys(Ct).filter(e=>e!=="CUSTOM"&&!Ct[e]?.continuous);function t2(e){const t=document.createElement("label");t.className="pd-button small upload-label";const n=document.createTextNode("上传背景图"),r=document.createElement("input");r.className="visually-hidden",r.type="file",r.accept="image/*",t.append(n,r);const o=i=>{t.className=`pd-button small upload-label${i?" disabled":""}`,r.disabled=i};return r.addEventListener("change",async()=>{const i=r.files?.[0];if(!i)return;if(!i.type.startsWith("image/")){alert("仅支持上传图片文件"),r.value="";return}const a=e.host.uploadDesignBackground;if(!a){alert("设计背景上传能力未配置"),r.value="";return}o(!0),n.textContent="上传中...";try{const l=await a(i);l?e.store.updateTemplateData({designBackground:{src:l,rotation:0}}):alert("设计背景上传失败")}catch(l){alert(l instanceof Error?l.message:"设计背景上传失败")}finally{n.textContent="上传背景图",o(!e.host.uploadDesignBackground),r.value=""}}),e.host.uploadDesignBackground||o(!0),t}function n2(e){const n=e.store.templateData.designBackground,r=n?.rotation??0;return h("div",{class:"design-background-config"},[Pt("设计背景"),h("p",{class:"design-background-tip",text:"仅设计器显示,用于套打定位,不会出现在预览和打印中"}),n?.src?[h("div",{class:"design-background-path",title:n.src,text:n.src}),h("div",{class:"design-background-actions"},[h("button",{type:"button",class:"pd-button small rotate-btn",text:`旋转(${(r+90)%360}°)`,onClick:()=>e.store.updateTemplateData({designBackground:{...n,rotation:(r+90)%360}})}),h("button",{type:"button",class:"pd-button small remove-btn",text:"移除",onClick:()=>e.store.updateTemplateData({designBackground:void 0})})])]:t2(e)].flat())}function r2(e){const t=e.store,n=t.templateData,r=n.tiling,o={...Ot,...r??{},enabled:r?.enabled??!1,sheetMargin:{...Ot.sheetMargin,...r?.sheetMargin??{}}},i=_a(n.paperSize),a=g=>t.updateTemplateData({tiling:{...o,...g}}),l=g=>Tn({target:o,base:Ot,propKey:g,write:()=>a({[g]:Ot[g]})}),c=g=>Tn({target:o.sheetMargin,base:Ot.sheetMargin,propKey:g,write:()=>s(g,Ot.sheetMargin[g])}),s=(g,m)=>a({sheetMargin:{...o.sheetMargin,[g]:m??0}}),d={...n,tiling:o},p=as(d),u=Math.max(hu(d),1);let f="";if(!p.length)try{const g=fu(d),m=Cr(d),b=o.sheetPaperSize==="CUSTOM"?"自定义":o.sheetPaperSize??"A4",v=o.sheetPaperSize==="CUSTOM"?"":o.sheetOrientation==="landscape"?" 横向":" 纵向";f=`目标纸 ${b}${v} ${m.width}×${m.height}mm · ${g.columns} 列 × ${g.rows} 行 = 每张 ${g.perSheet} 格 · 每格 ${g.tile.width}×${g.tile.height}mm`}catch{f=""}return h("div",{class:"tiling-config",dataset:{test:"tiling-config"}},[Pt("拼版打印"),h("p",{class:"pd-hint",text:"把标签按「列 × 行」铺到一张大纸上批量打印"}),h("div",{class:"pd-field"},[h("label",{class:"tiling-switch"},[h("input",{type:"checkbox",checked:o.enabled===!0,disabled:i,onChange:g=>{if(!g.target.checked){a({enabled:!1});return}a({...Ot,columns:Math.min(Ot.columns,Math.max(u,1))})}}),h("span",{text:"启用拼版"})]),i?h("p",{class:"pd-hint tiling-error",text:"连续纸不支持拼版"}):""].filter(Boolean)),o.enabled&&!i?[se("目标纸张",h("select",{class:"pd-select",style:{width:"100%"},onChange:g=>{const m=g.target.value;if(m!=="CUSTOM"){a({sheetPaperSize:m});return}const b=Cr(d);a({sheetPaperSize:"CUSTOM",sheetCustomWidth:o.sheetCustomWidth??b.width,sheetCustomHeight:o.sheetCustomHeight??b.height})}},[...e2.map(g=>h("option",{value:g,text:Ct[g]?.label??g,selected:(o.sheetPaperSize??"A4")===g})),h("option",{value:"CUSTOM",text:"自定义",selected:o.sheetPaperSize==="CUSTOM"})]),void 0,l("sheetPaperSize")),o.sheetPaperSize==="CUSTOM"?se("目标纸宽高 (mm)",h("div",{class:"custom-size-grid"},[J({value:Number(o.sheetCustomWidth??0),min:25,max:2e3,onCommit:g=>a({sheetCustomWidth:g})}),h("span",{class:"custom-size-x",text:"×"}),J({value:Number(o.sheetCustomHeight??0),min:25,max:2e3,onCommit:g=>a({sheetCustomHeight:g})})])):se("目标纸方向",nn("tiling-ori",[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],o.sheetOrientation==="landscape"?"landscape":"portrait",g=>a({sheetOrientation:g})),void 0,l("sheetOrientation")),Pt("拼版留白 (mm)"),h("div",{class:"margin-grid"},[se("上",J({value:o.sheetMargin.top??0,min:0,max:100,onCommit:g=>s("top",g)}),void 0,c("top")),se("下",J({value:o.sheetMargin.bottom??0,min:0,max:100,onCommit:g=>s("bottom",g)}),void 0,c("bottom")),se("左",J({value:o.sheetMargin.left??0,min:0,max:100,onCommit:g=>s("left",g)}),void 0,c("left")),se("右",J({value:o.sheetMargin.right??0,min:0,max:100,onCommit:g=>s("right",g)}),void 0,c("right"))]),Pt("格间距与列数"),se("横向间距",J({value:o.gapX??0,min:0,max:50,onCommit:g=>a({gapX:g??0})}),void 0,l("gapX")),se("纵向间距",J({value:o.gapY??0,min:0,max:50,onCommit:g=>a({gapY:g??0})}),void 0,l("gapY")),se("列数",J({value:o.columns??1,min:1,max:u,onCommit:g=>a({columns:g||1})})),...p.map(g=>h("p",{class:"pd-hint tiling-error",text:g.message})),!p.length&&f?h("p",{class:"pd-hint tiling-summary",text:f}):""]:""].flat().filter(Boolean))}const o2=new Set(Eo.map(e=>e.group)),i2={"table-settings":"content"},Bh=new Map;function Sl(e){const t=e??"";let n=Bh.get(t);if(!n){const{groups:r,itemKeys:o}=p0(t);n={groups:r,keys:o,searching:!!t.trim()},Bh.set(t,n)}return n}function _l(e){const t=i2[e]??e;return o2.has(t)?t:""}function a2(e,t){const n=Sl(e.state.propSearch);if(!n.searching)return!0;const r=_l(t);return!r||n.groups.includes(r)}function s2(e,t){const n=Sl(e.state.propSearch);return!n.searching||n.keys.has(t)}function Hh(e,t){const n=e.props.style??{};return e.props.style={...n,display:t?"":"none"},e}function j(e,t,n){const r=n.props.dataset??{};return n.props.dataset={...r,propKey:t},Hh(n,s2(e,t))}function l2(e,t,n){const r=_l(t);if(!r)return n;const o=n.props.dataset??{};return n.props.dataset={...o,propGroup:r},Hh(n,a2(e,t))}function Uh(e,t){const n=Sl(t);for(const r of Array.from(e.querySelectorAll("[data-prop-group]"))){const o=_l(r.dataset.propGroup??"");r.style.display=!n.searching||!o||n.groups.includes(o)?"":"none"}for(const r of Array.from(e.querySelectorAll("[data-prop-key]")))r.style.display=!n.searching||n.keys.has(r.dataset.propKey??"")?"":"none"}function c2(e){return h("div",{class:"property-search"},[h("input",{class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",value:e.state.propSearch??"",onInput:t=>{const n=t.target,r=n.value;e.state.propSearch=r,Uh(n.getRootNode(),r)}})])}const d2={Document:"≡",Brush:"◧",Setting:"⚙"};function u2(e,t){try{const n=window.localStorage.getItem(`property-group-${e}`);return n===null?t:n==="true"}catch{return t}}function p2(e,t){try{window.localStorage.setItem(`property-group-${e}`,String(t))}catch{}}function tt(e,t,n,r,o,i=!0,a=[]){const l=u2(t,i);return l2(e,t,h("div",{class:`property-group${l?" is-expanded":""}`},[h("div",{class:"group-header",onClick:()=>{p2(t,!l),e.repaint()}},[h("span",{class:"group-icon",text:d2[r]||"•"}),h("span",{class:"group-title",text:n}),...a,h("span",{class:"expand-icon",text:l?"▾":"▸"})]),h("div",{class:"group-content",style:l?"":{display:"none"}},o.filter(Boolean))]))}function Ui(e){return h("form",{class:"pd-form",onSubmit:t=>t.preventDefault()},e.filter(Boolean))}function qh(e){return e.split(".").flatMap(t=>{const n=t.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!n)return[t];const r=n[1],o=[...n[2].matchAll(/\[(\d+)\]/g)].map(i=>Number(i[1]));return[r,...o]})}function Wh(e,t){return qh(t).reduce((o,i)=>o==null?"":o[i],e)??""}function Ml(e,t,n,r){const o=qh(n),i=o.pop(),a=o.reduce((l,c)=>((l[c]===void 0||l[c]===null)&&(l[c]={}),l[c]),t);a[i]=r||void 0,e.recordHistory(),e.emit()}function f2(e,t){const n=e.store;if(t.printElementType.type==="table"&&n.tableSelection?.elementId===t.id){const{r1:r,c1:o}=n.tableSelection,i=(t.options.tableRows??[])[r];if(i)return ku(i.type,r,o,t.options.fields?.[0]?.dataSource)}return R1(t)}function h2(e,t){const n=document.createElement("label");n.className="pd-button small upload-label",Je(h("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})]),n);const r=document.createTextNode("上传图片"),o=document.createElement("input");o.className="visually-hidden",o.type="file",o.accept="image/*",n.append(r,o);const i=c=>{n.className=`pd-button small upload-label${c?" disabled":""}`,o.disabled=c};o.addEventListener("change",async()=>{const c=o.files?.[0];if(!c)return;if(!c.type.startsWith("image/")){alert("仅支持上传图片文件"),o.value="";return}const s=e.host.uploadImage;if(!s){alert("图片上传能力未配置"),o.value="";return}i(!0),r.textContent="上传中...";try{const d=await s(c);d?Ml(e.store,t,"options.src",d):alert("图片上传失败")}catch(d){alert(d instanceof Error?d.message:"图片上传失败")}finally{r.textContent="上传图片",i(!e.host.uploadImage),o.value=""}}),e.host.uploadImage||i(!0);const a=document.createElement("div");a.className="image-content-upload";const l=document.createElement("p");return l.className="upload-tip",l.textContent="支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",a.append(n,l),a}function g2(e,t){const n=r=>e.fire("open-expression",{elementId:t.id,targetPath:r.targetPath,value:Wh(t,r.targetPath)});return tt(e,"binding","内容","Document",[...f2(e,t).map(r=>se(r.label,h("input",{class:"pd-input",type:"text",value:Wh(t,r.targetPath),placeholder:r.placeholder||"输入内容,支持 {字段} 表达式",onChange:o=>Ml(e.store,t,r.targetPath,o.target.value),onDblclick:()=>n(r)}))),t.printElementType.type==="image"?h2(e,t):""].filter(Boolean))}const Kr=new Map;function qi(e){return`${Math.round(e*1e4)/1e4}%`}function jh(e,t){const n=v1(t.value),r=n.kind==="custom",o=n.kind==="axes"?n.x:50,i=n.kind==="axes"?n.y:50,a=M1(t.src),l=Kr.get(a.src),c={widthMm:t.widthMm,heightMm:t.heightMm,naturalWidth:l?.width,naturalHeight:l?.height,fit:t.fit,scalePct:t.scale},s=w1(c),d=x1(c,o,i),p=document.createElement("select");p.className="pd-select",p.style.width="100%";for(const m of A1(s,o,i)){const b=document.createElement("option");b.value=m.value,b.textContent=m.label,p.appendChild(b)}if(r){const m=document.createElement("option");m.value="custom",m.textContent="自定义(保留原值)",p.appendChild(m)}p.value=r?"custom":`${o},${i}`,p.selectedIndex<0&&(p.selectedIndex=r?p.options.length-1:0),p.addEventListener("change",()=>{if(p.value==="custom")return;const[m,b]=p.value.split(",").map(Number);t.onCommit(vu(m,b))});const u=Ce(t.fieldKey),f=[h("div",{class:"pd-field",dataset:{field:t.fieldKey}},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t"},[t.label,El(u)]),t.resetAnchor??""].filter(Boolean)),p])];f.push(h("div",{class:"pd-field",dataset:{field:"ap-img-fit-scale"}},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t"},[T1,El(Ce("ap-img-fit-scale"))]),t.resetScale??""].filter(Boolean)),J({value:t.scale,min:fr,max:Oc,step:5,placeholder:"默认 100",onCommit:m=>t.onScaleCommit(m>fr?m:void 0)})]));for(const m of C1(s,o,i))f.push(h("div",{class:"pd-field",dataset:{field:t.fieldKey}},[h("span",{class:"pd-label",text:m.label}),J({value:m.value,min:0,max:100,step:1,onCommit:b=>t.onCommit(vu(m.name==="horizontal"?b:o,m.name==="vertical"?b:i))})]));const g=k1(s,r);return g&&f.push(h("p",{class:"pd-crop-note",text:g})),a.isSample&&f.push(h("p",{class:"pd-crop-note",text:_1})),f.push(h("div",{class:"pd-crop-preview"},[h("img",{class:"pd-crop-thumb",src:a.src,alt:a.isSample?"示例图":"原图",onLoad:m=>{const b=m.target;if(!(b.naturalWidth>0&&b.naturalHeight>0))return;const v=Kr.get(a.src);v&&v.width===b.naturalWidth&&v.height===b.naturalHeight||(Kr.set(a.src,{width:b.naturalWidth,height:b.naturalHeight}),e.repaint())},onError:()=>{Kr.has(a.src)&&(Kr.delete(a.src),e.repaint())}}),d?h("div",{class:"pd-crop-win",style:{left:qi(d.leftPct),top:qi(d.topPct),width:qi(d.widthPct),height:qi(d.heightPct)}}):""])),h("div",{class:t.containerClass??"pd-crop-anchor"},f)}const kn=e=>Number(e??0),Tl=e=>e||void 0;function Cn(e,t,n,r,o,i){return h("div",{class:"pd-field"},[h("span",{class:"pd-label",...r?{title:r}:{}},[h("span",{class:"pd-label-t",text:e}),o??""].filter(Boolean)),h("input",{class:"pd-switch",type:"checkbox",checked:t,...i?{disabled:!0}:{},onChange:a=>n(a.target.checked)})])}function Gh(e,t,n,r,o=!1,i){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:e}),""].filter(Boolean)),h("select",{class:"pd-select",...o?{style:{width:"100%"}}:{},onChange:a=>r(a.target.value)},n.map(a=>h("option",{value:a.value,text:a.label,selected:a.value===t})))])}function Xr(e,t,n,r,o={}){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:e}),o.reset??""].filter(Boolean)),Lh(t,n,r,{className:"pd-select",...o.full?{width:"100%"}:{}})])}const Jn=e=>h("p",{class:"pd-hint",text:e}),m2="多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复",b2=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行(每页小计)"},{value:"summary",label:"汇总行"}],y2=[{value:"CODE128",label:"CODE128(通用)"},{value:"EAN13",label:"EAN13(商品码)"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],v2=[{value:"L",label:"L(最低,容量大)"},{value:"M",label:"M(推荐)"},{value:"Q",label:"Q"},{value:"H",label:"H(最高)"}],w2=[{value:"clip",label:"截断"},{value:"shrink",label:"自动缩小"},{value:"autoHeight",label:"自适应行高"}],x2={value:"__multi__",label:"多选",disabled:!0};function E2(e,t){const n=e.store,r=n.tableSelection,o=t.options.tableRows??[],i=r?o[r.r1]:void 0;if(!r||!i)return tt(e,"table-row","行属性","Grid",[]);const a=l=>n.updateElement(t.id,l);return tt(e,"table-row","行属性","Grid",[Ui([Gh("行类型",i.type,b2,l=>{const c=ea(o,r.r1,l);if(c){window.alert(c);return}a({tableRows:o})},!0),h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"行高 (mm)"}),J({value:i.height,min:3,max:100,step:.5,onCommit:l=>{i.height=l,a({tableRows:o})}})]),i.type==="header"?Cn("表头每页重复",i.repeatOnPage??!1,l=>{Pg(o,l),a({tableRows:o})},m2):""])])}function S2(e,t){const n=e.store,r=t.options,o=d=>n.updateElement(t.id,d),i=r.tableColWidths??[],a=n.paperSize.width-n.templateData.margins.left-n.templateData.margins.right,l=n.fields.filter(d=>d.fieldType==="list").map(d=>({value:d.fieldKey,label:d.fieldLabel})),c=xa("table"),s=d=>Tn({target:r,base:c,propKey:d,write:()=>o({[d]:c[d]})});return tt(e,"table-settings","表格设置","Grid",[Ui([Gh("列表数据源字段",r.dataSource??"",l,d=>o({dataSource:d||void 0}),!0),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认字体"}),s("tableDefaultFontFamily")]),Bi({id:"table-default-font",state:e.state,fonts:e.host.fonts,value:r.tableDefaultFontFamily,placeholder:"默认",onChange:d=>o({tableDefaultFontFamily:d||void 0})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认字号 (pt)"}),s("tableDefaultFontSize")]),J({value:kn(r.tableDefaultFontSize),min:0,max:72,placeholder:"默认",onCommit:d=>o({tableDefaultFontSize:Tl(d)})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认文字颜色"}),s("tableDefaultColor")]),st(r.tableDefaultColor,d=>o({tableDefaultColor:d}),"默认文字颜色")]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认内边距 (mm)"}),s("tableDefaultPadding")]),J({value:kn(r.tableDefaultPadding),min:0,max:10,step:.5,placeholder:"默认",onCommit:d=>o({tableDefaultPadding:Tl(d)})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"列宽 (mm)"}),...i.map((d,p)=>h("div",{class:"col-width-row"},[h("span",{style:{width:"60px"},text:`列${p+1}`}),J({value:d,min:5,max:200,onCommit:u=>{const f=i.reduce((g,m,b)=>b===p?g:g+m,0);if(f+u>a){const g=Math.max(5,Math.round((a-f)*10)/10);window.alert(`表格总宽不能超过打印范围宽度 ${a}mm,列${p+1} 已调整为 ${g}mm`),i[p]=g}else i[p]=u;o({tableColWidths:i})}})]))])])])}function _2(e,t){const n=e.store,r=t.options,o=t.printElementType.type==="table",i=l=>n.updateElement(t.id,l),a=[];if(o)a.push(j(e,"pg-enabled",Cn("启用分页",r.tablePagination?.enabled??!0,l=>i({tablePagination:{enabled:l}}))));else{const l=r.pagination?.pageable??!0,c=r.pagination?.keepWithNext??!1;a.push(j(e,"pg-pageable",Cn("参与分页",l,s=>i({pagination:{pageable:s,keepWithNext:c}})))),a.push(j(e,"pg-keep-with-next",Cn("与下元素同页",c,s=>i({pagination:{pageable:l,keepWithNext:s}}))))}return tt(e,"pagination","分页配置","Document",[Ui(a)],!1)}const kl=new WeakMap,Vh=[{value:"top",label:"上"},{value:"right",label:"右"},{value:"bottom",label:"下"},{value:"left",label:"左"}];function M2(e,t){const n=e.store,r=n.tableSelection,o=t.options.tableRows??[];if(!r)return tt(e,"table-cell","单元格","Menu",[]);const i=or(o,r.r1,r.c1),a=o[i.r]?.cells[i.c];if(!a)return tt(e,"table-cell","单元格","Menu",[]);const l=()=>ao(o,r),c=ta(o,r),s=c.count,d=c.mode==="multi",p=`${t.id}:${r.r1}:${r.c1}:${r.r2}:${r.c2}`,u=kl.get(n),f=u?.key===p?u:{key:p,border:{},values:{},edges:{}};u?.key!==p&&kl.set(n,f);const g=M=>{kl.set(n,{key:p,border:M.border??f.border,values:M.values??f.values,edges:M.edges??f.edges})},m=(M,q)=>{g({border:{...f.border,[M]:q}}),e.repaint()},b=(M,q)=>{l().forEach(M),d&&q&&g({values:{...f.values,...q}}),n.updateElement(t.id,{tableRows:o})},v=(M,q)=>{b(le=>{le[M]=q},{[M]:q})},w=M=>d?f.values[M]:a[M],E=M=>d&&M in f.values,C=d?{width:void 0,style:void 0,color:void 0}:sc(o,r),F=!d&&l().some(M=>!!M.borders&&!!(M.borders.top||M.borders.right||M.borders.bottom||M.borders.left)),N=!d&&!F,P={width:N?0:typeof C.width=="number"?C.width:Vt.width,style:N?"none":typeof C.style=="string"&&C.style!=="mixed"?C.style:Vt.style,color:typeof C.color=="string"&&C.color!=="mixed"?C.color:Vt.color,...f.border},O="__mixed__",T={style:!d&&C.style==="mixed",width:!d&&C.width==="mixed",color:!d&&C.color==="mixed"},I=T.style&&!("style"in f.border),S=T.width&&!("width"in f.border),$=T.color&&!("color"in f.border),D=I||S||$,B=I?O:P.style,_=S?void 0:P.width,ie=$?void 0:P.color,pe=M=>{const q={style:M};M!=="none"&&_===0?q.width=Vt.width:M==="none"&&!F&&(q.width=0),g({border:{...f.border,...q}}),e.repaint()},Ve=()=>({...P}),ee=d?Vh.reduce((M,q)=>(M[q.value]=f.edges[q.value]?"on":"off",M),{}):Kc(l().map(M=>M.borders)),Te=d?"cellType"in f.values?f.values.cellType??"text":Lg(o,r):a.cellType??"text",ne=Te==="barcode",me=Te==="qrcode",Ie=Te==="image",te=Te==="text",ze=ne&&!!w("printerDpi"),St=kc(w("printerDpi"),w("barWidth")),re=d?f.values.textFit:oa(a),Be=d?"cellType"in f.values?f.values.cellType??"text":"":a.cellType||"text",ye=M=>d?[x2,...M]:M,de=M=>d?"多选":M,Qe=(M,q)=>d?f.values[M]:q,Jr=d?w("barcodeType")??"__multi__":a.barcodeType||"CODE128",Qr=d?E("printerDpi")?w("printerDpi")?String(w("printerDpi")):"":"__multi__":a.printerDpi?String(a.printerDpi):"",eo=d?w("qrCodeLevel")??"__multi__":a.qrCodeLevel||"M",to=d?w("fit")??"__multi__":a.fit||"contain",Qn=re??"__multi__",fe=ec(o,r);let k=!0;for(let M=r.r1;M<=r.r2;M++)if(o[M]?.type!=="data"){k=!1;break}const z=k?"":"仅数据行(明细行)支持按值合并";let W=!1;for(let M=r.r1;M<=r.r2&&!W;M++)for(let q=r.c1;q<=r.c2&&!W;q++){const le=o[M]?.cells[q];le&&!le.merged&&((le.rowspan??1)>1||(le.colspan??1)>1)&&(W=!0)}const H=(M,q,le,X={},he)=>h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:M}),he??""].filter(Boolean)),J({value:q,...X,onCommit:ge=>v(le,Tl(ge))})]),Y="恢复默认值(跟随表格默认)",U=M=>Tn({target:a,base:{},propKey:M,tipOverride:Y,force:d,write:()=>v(M,void 0)}),Z=t.options.tableDefaultPadding??1,Q={width:aa(t.options.tableColWidths??[],i.c,a,Z),height:cr(o,i.r,a,Z)};return tt(e,"table-cell","单元格","Menu",[Ui([d?Jn(`已选 ${s} 格 · 批量设置:不显示单格配置,改动会应用到全部选中格`):"",h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"单元格类型"}),nn("cell-type",[{value:"text",label:"文本"},{value:"barcode",label:"条形码"},{value:"qrcode",label:"二维码"},{value:"image",label:"图片"}],Be,M=>{const q=M==="text"?void 0:M,le={cellType:M};M!=="barcode"&&Object.assign(le,{barcodeType:void 0,showBarcodeText:void 0,printerDpi:void 0,barQuietZone:void 0,barHeight:void 0}),M!=="qrcode"&&Object.assign(le,{qrCodeLevel:void 0,qrQuietZone:void 0}),b(X=>{X.cellType=q,M!=="barcode"&&(X.barcodeType=void 0,X.showBarcodeText=void 0,X.printerDpi=void 0,X.barQuietZone=void 0,X.barHeight=void 0),M!=="qrcode"&&(X.qrCodeLevel=void 0,X.qrQuietZone=void 0)},le)})]),ne?Xr("码制",Jr,ye(y2),M=>{M!=="__multi__"&&v("barcodeType",M||void 0)}):"",ne?Cn("显示文本",d?f.values.showBarcodeText===!0:a.showBarcodeText!==!1,M=>v("showBarcodeText",M),void 0,U("showBarcodeText")):"",ne?H("条宽(倍率)",Qe("barWidth",a.barWidth??2),"barWidth",{min:2,max:8,step:.5,placeholder:de("")},U("barWidth")):"",ne?Jn((ze?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定")+(St?`。${St}`:"")):"",ne?He("静区 (模块)",J({value:Qe("barQuietZone",a.barQuietZone),min:0,max:20,placeholder:de("默认 10"),onCommit:M=>v("barQuietZone",M)}),Ce("cd-bar-quiet-zone"),U("barQuietZone")):"",ne?He("条高 (mm)",J({value:Qe("barHeight",a.barHeight),min:1,max:100,placeholder:de("默认 30 模块"),onCommit:M=>v("barHeight",M??void 0)}),Ce("cd-bar-height"),U("barHeight")):"",ne?H("文本字号(相对条高,条高为 30)",Qe("barFontSize",a.barFontSize??10),"barFontSize",{min:5,max:24,placeholder:de("默认 10")},U("barFontSize")):"",ne?Xr("打印机分辨率",Qr,ye([{value:"",label:"不指定(按条宽渲染)"},{value:"203",label:"203 dpi(8 点/mm)"},{value:"300",label:"300 dpi(11.8 点/mm)"},{value:"600",label:"600 dpi(23.6 点/mm)"}]),M=>{if(M==="__multi__")return;const q=Number(M);v("printerDpi",q>0?q:void 0)},{reset:U("printerDpi")}):"",ne?Jn("填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小"):"",me?Xr("纠错级别",eo,ye(v2),M=>{M!=="__multi__"&&v("qrCodeLevel",M||void 0)},{reset:U("qrCodeLevel")}):"",me?He("静区 (模块)",J({value:Qe("qrQuietZone",a.qrQuietZone),min:0,max:8,placeholder:de("默认 0"),onCommit:M=>v("qrQuietZone",M)}),Ce("cd-quiet-zone"),U("qrQuietZone")):"",ne?Jn("单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限。要放大条码:先加条宽倍率,再收窄静区(左右白边会换成条宽),必要时关掉显示文本以让出文本区高度"):"",me||Ie?Xr("缩放模式",to,ye(cs),M=>{M!=="__multi__"&&v("fit",M)},{reset:U("fit")}):"",Ie&&!d&&a.fit==="cover"?jh(e,{fieldKey:"ap-img-object-position",label:"裁剪锚点",src:Eu(a.formatter),fit:a.fit,containerClass:"pd-cell-anchor",widthMm:Q.width,heightMm:Q.height,scale:a.fitScale,value:a.objectPosition,onCommit:M=>v("objectPosition",M),onScaleCommit:M=>v("fitScale",M),resetAnchor:U("objectPosition"),resetScale:U("fitScale")}):"",ne||me||Ie?H("最大宽度 (mm)",Qe("maxWidth",kn(a.maxWidth)),"maxWidth",{min:0,max:200,placeholder:de("默认")},U("maxWidth")):"",ne||me||Ie?H("最大高度 (mm)",Qe("maxHeight",kn(a.maxHeight)),"maxHeight",{min:0,max:200,placeholder:de("默认")},U("maxHeight")):"",h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"内容"}),h("input",{class:"pd-input",type:"text",value:d?w("formatter")??"":a.formatter||"",placeholder:d?"多选(输入后覆盖全部选中格)":"输入内容,支持 {字段} 表达式",onChange:M=>v("formatter",M.target.value||void 0),onDblclick:()=>e.fire("table-cell-dblclick",{elementId:t.id,r:i.r,c:i.c,cellId:a.id})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"水平对齐"}),U("align")]),nn("cell-align",[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"},{value:"justify",label:"两端"}],d?f.values.align??"":a.align||"left",M=>v("align",M))]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"垂直对齐"}),U("valign")]),nn("cell-valign",[{value:"top",label:"上"},{value:"middle",label:"中"},{value:"bottom",label:"下"}],d?f.values.valign??"":a.valign||"top",M=>v("valign",M))]),h("div",{class:"cell-style-grid"},[h("div",{class:"pd-field cell-font-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"字体"}),U("fontFamily")]),Bi({id:"cell-font",state:e.state,fonts:e.host.fonts,value:d?w("fontFamily"):a.fontFamily,placeholder:de("继承默认"),onChange:M=>v("fontFamily",M)})]),H("字号 (pt)",Qe("fontSize",kn(a.fontSize)),"fontSize",{min:0,max:72,placeholder:de("默认")},U("fontSize")),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"加粗"}),U("fontWeight")]),h("input",{class:"pd-switch",type:"checkbox",checked:d?f.values.fontWeight==="bold":a.fontWeight==="bold",onChange:M=>v("fontWeight",M.target.checked?"bold":void 0)})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"文字颜色"}),U("color")]),st(d?w("color"):a.color,M=>v("color",M),"文字颜色")]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"背景色"}),U("backgroundColor")]),st(d?w("backgroundColor"):a.backgroundColor,M=>v("backgroundColor",M),"背景颜色")])]),Pt("边框"),h("div",{class:"border-style-row"},[Lh(B,[...I?[{value:O,label:"混合",disabled:!0}]:[],...Ta],M=>{M!==O&&pe(M)},{width:"90px"}),h("div",{style:{width:"112px",flexShrink:"0"}},[J({value:_,min:.25,max:5,step:.25,placeholder:d?"多选":S?"混合":void 0,onCommit:M=>m("width",M)})]),st(ie,M=>m("color",M),"边框颜色")]),h("div",{class:"pd-button-group border-presets"},[["all","全部"],["outer","外侧"],["inner","内部"],["none","无"]].map(([M,q])=>h("button",{type:"button",class:"pd-button small",text:q,onClick:()=>{ic(o,r,P.style==="none"?"none":M,Ve()),n.updateElement(t.id,{tableRows:o})}}))),h("div",{class:"pd-checkbox-group"},Vh.map(M=>h("label",{class:"pd-checkbox"},[h("input",{type:"checkbox",value:M.value,checked:ee[M.value]==="on",indeterminate:ee[M.value]==="mixed",onChange:q=>{const X=q.target.checked&&P.style!=="none";d&&g({edges:{...f.edges,[M.value]:X}}),b(he=>{ac(he,M.value,X?Ve():null)})}}),h("span",{text:M.label})]))),Jn(d?$g:D?Ng:Dg),H("内边距 (mm)",Qe("padding",kn(a.padding)),"padding",{min:0,max:10,step:.5,placeholder:de("默认")},U("padding")),Cn("自动换行",d?f.values.wordWrap===!0:a.wordWrap??!0,M=>v("wordWrap",M),void 0,U("wordWrap")),te?Xr("文字溢出",Qn,ye(w2),M=>{M!=="__multi__"&&v("textFit",M)},{full:!0,reset:U("textFit")}):"",te&&re==="shrink"?H("最小字号 (pt)",Qe("shrinkMinFontSize",kn(a.shrinkMinFontSize)),"shrinkMinFontSize",{min:0,max:72,step:.5,placeholder:de("默认 6")},U("shrinkMinFontSize")):"",h("div",{class:"merge-card"},[h("div",{class:"merge-card-title",text:"单元格合并"}),h("div",{class:"merge-btns"},[h("button",{type:"button",class:"pd-button small",text:"合并单元格",disabled:!!fe,title:fe||"",onClick:()=>{tc(o,r),n.updateElement(t.id,{tableRows:o})}}),h("button",{type:"button",class:"pd-button small",text:"拆分单元格",disabled:!W,onClick:()=>{nc(o,r),n.updateElement(t.id,{tableRows:o})}})]),h("div",{class:"merge-card-divider"}),Cn("按值合并",d?f.values.mergeSameValue===!0:a.mergeSameValue===!0,M=>v("mergeSameValue",M),z||void 0,k?U("mergeSameValue"):void 0,!k),Jn("明细相邻行同值时自动纵向合并;跨页时在该页内成段,续页首行重放该值")])])])}const Cl=ob;function Al(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 T2(e){return e?e.mode==="binding"?e.binding??"":e.content??"":""}function k2(e){const t=e.store.templateData.watermark,n=T2(t),r=t?.mode==="binding"||n!==""&&Al(n),o=(()=>{const s=t?.tileWidth??ce.tileWidth,d=t?.tileHeight??ce.tileHeight;for(const[p,u]of Object.entries(Cl))if(u.width===s&&u.height===d)return p;return"custom"})(),i=s=>{const d={...t,testData:t?.testData??"",rotate:t?.rotate??ce.rotate,color:t?.color||ce.color,opacity:t?.opacity??ce.opacity,tileWidth:t?.tileWidth??ce.tileWidth,tileHeight:t?.tileHeight??ce.tileHeight};e.store.updateTemplateData({watermark:{...d,...s}})},a=()=>e.fire("open-expression",{elementId:"",targetPath:"watermark.content",value:n}),l={rotate:t?.rotate??ce.rotate,color:t?.color||ce.color,opacity:t?.opacity??ce.opacity,tileWidth:t?.tileWidth??ce.tileWidth,tileHeight:t?.tileHeight??ce.tileHeight},c=s=>Tn({target:l,base:ce,propKey:s,write:()=>i({[s]:ce[s]})});return h("div",{class:"watermark-config"},[Pt("水印"),h("form",{class:"pd-form",onSubmit:s=>s.preventDefault()},[h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"水印表达式"}),h("input",{class:"pd-input",type:"text",value:n,placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onChange:s=>{const d=s.target.value;i(Al(d)?{mode:"binding",binding:d,content:""}:{mode:"fixed",content:d,binding:""})},onDblclick:a}),h("button",{type:"button",class:"pd-button small",text:"编辑表达式",onClick:a})]),r?se("测试值",h("input",{class:"pd-input",type:"text",value:t?.testData??"",placeholder:"表达式取不到值时预览显示",onChange:s=>i({testData:s.target.value})})):"",h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"旋转角度"}),c("rotate")]),h("input",{type:"range",class:"pd-range",min:-90,max:90,step:5,value:String(t?.rotate??ce.rotate),onChange:s=>i({rotate:Number(s.target.value)})}),h("span",{class:"pd-hint",text:`${t?.rotate??ce.rotate}°`})]),se("颜色",st(t?.color||ce.color,s=>i({color:s}),"水印颜色"),void 0,c("color")),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"透明度"}),c("opacity")]),h("input",{type:"range",class:"pd-range",min:.05,max:.5,step:.05,value:String(t?.opacity??ce.opacity),onChange:s=>i({opacity:Number(s.target.value)})}),h("span",{class:"pd-hint",text:(t?.opacity??ce.opacity).toFixed(2)})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"密度"}),h("select",{class:"pd-select",style:{width:"100%"},onChange:s=>{const d=s.target.value,p=Cl[d];p&&i({tileWidth:p.width,tileHeight:p.height})}},[...Object.entries(Cl).map(([s,d])=>h("option",{value:s,text:`${d.label}(${d.width}×${d.height})`,selected:o===s})),h("option",{value:"custom",text:"自定义",selected:o==="custom"})])]),o==="custom"?h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"瓦片宽"}),c("tileWidth")]),h("input",{type:"number",class:"pd-input",min:ce.minTileWidth,step:10,value:String(t?.tileWidth??ce.tileWidth),onChange:s=>i({tileWidth:Number(s.target.value)})})]):"",o==="custom"?h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"瓦片高"}),c("tileHeight")]),h("input",{type:"number",class:"pd-input",min:ce.minTileHeight,step:10,value:String(t?.tileHeight??ce.tileHeight),onChange:s=>i({tileHeight:Number(s.target.value)})})]):""].filter(Boolean))])}function Oe(e,t,n,r,o={},i){return se(t,J({value:n,...o,onCommit:r}),void 0,i)}function qt(e,t,n,r,o,i,a){const l=document.createElement("select");l.className="pd-select",l.addEventListener("change",()=>o(l.value));for(const c of r){const s=document.createElement("option");s.value=c.value,s.textContent=c.label,l.appendChild(s)}return l.value=n,r.some(c=>c.value===n)||(l.selectedIndex=-1),i?He(t,l,i,a):se(t,l,void 0,a)}function An(e,t,n,r,o){return se(t,h("input",{type:"checkbox",class:"pd-switch",checked:n,onChange:i=>r(i.target.checked)}),void 0,o)}const C2=[{value:"all",label:"全部"},{value:"outer",label:"外侧"},{value:"inner",label:"内部"},{value:"none",label:"无"}],A2=[{value:"top",label:"上"},{value:"right",label:"右"},{value:"bottom",label:"下"},{value:"left",label:"左"}];function O2(e,t){const n=e.store,r=t.options,o=t.printElementType.type,i=_=>n.updateElement(t.id,_),a=Ff(o),l=a==="text",c=a==="code",s=a==="table",d=s&&n.tableSelection?.elementId===t.id,p=d&&ta(t.options.tableRows??[],n.tableSelection).mode==="multi",u=[];p||u.push(g2(e,t));const f=xa(o),g=(_,ie)=>{const pe=f0(ie);return Tn({target:r,base:f,propKey:_,tipValue:pe?.value,tipUnit:pe?.unit,write:()=>i({[_]:f[_]})})};d||u.push(tt(e,"position-size","位置与尺寸","Location",[h("form",{class:"pd-form",onSubmit:_=>_.preventDefault()},[h("div",{class:"position-grid"},[j(e,"ps-left",Oe(e,"X",r.left,_=>i({left:_}),{min:0})),j(e,"ps-top",Oe(e,"Y",r.top,_=>i({top:_}),{min:0})),j(e,"ps-width",Oe(e,"W",r.width,_=>i({width:_}),{min:4})),j(e,"ps-height",Oe(e,"H",r.height,_=>i({height:_}),{min:4}))]),h("h3",{class:"pd-divider",text:"外边距 (mm)"}),h("div",{class:"margin-grid"},[j(e,"ps-margin-top",Oe(e,"上",r.marginTop,_=>i({marginTop:_===0?void 0:_}),{},g("marginTop","ps-margin-top"))),j(e,"ps-margin-right",Oe(e,"右",r.marginRight,_=>i({marginRight:_===0?void 0:_}),{},g("marginRight","ps-margin-right"))),j(e,"ps-margin-bottom",Oe(e,"下",r.marginBottom,_=>i({marginBottom:_===0?void 0:_}),{},g("marginBottom","ps-margin-bottom"))),j(e,"ps-margin-left",Oe(e,"左",r.marginLeft,_=>i({marginLeft:_===0?void 0:_}),{},g("marginLeft","ps-margin-left")))])])]));const m=typeof r.rotate=="number"&&Number.isFinite(r.rotate)&&r.rotate!==0?hr(r.rotate):void 0,b=_=>i({rotate:_===void 0||_===0?void 0:hr(_)}),v=wm(o,r),w=Dc(o)||zc(n.elements).has(t.id),E=w?"":j(e,"ap-rotate",He("旋转 (°)",h("div",{class:"pd-rotate-row"},[h("button",{type:"button",class:"pd-rotate-btn",title:"逆时针 90°","aria-label":"逆时针旋转 90 度",text:"↺",onClick:()=>b((m??0)-90)}),h("div",{class:"pd-rotate-stepper"},[J({value:m,min:0,max:359,placeholder:"0",disabled:!v,onCommit:_=>b(_)})]),h("button",{type:"button",class:"pd-rotate-btn",title:"顺时针 90°","aria-label":"顺时针旋转 90 度",text:"↻",onClick:()=>b((m??0)+90)})]),Ce("ap-rotate"),g("rotate","ap-rotate"))),C=w||v?"":h("p",{class:"pd-hint pd-rotate-note",text:vm});if(u.push(tt(e,"appearance","外观","Brush",[h("form",{class:"pd-form",onSubmit:_=>_.preventDefault()},l?[j(e,"ap-font-family",se("字体",Bi({id:"prop-font",state:e.state,fonts:e.host.fonts,value:typeof r.fontFamily=="string"?r.fontFamily:void 0,placeholder:"默认",onChange:_=>i({fontFamily:_})}),void 0,g("fontFamily","ap-font-family"))),j(e,"ap-font-size",Oe(e,"字体大小",r.fontSize,_=>i({fontSize:_}),{min:8,max:72},g("fontSize","ap-font-size"))),j(e,"ap-font-weight",qt(e,"字体粗细",String(r.fontWeight??""),[{value:"normal",label:"正常"},{value:"bold",label:"粗体"},{value:"bolder",label:"更粗"},{value:"lighter",label:"细体"}],_=>i({fontWeight:_}),void 0,g("fontWeight","ap-font-weight"))),j(e,"ap-align",se("对齐",nn("ta",[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"},{value:"justify",label:"两端"}],r.textAlign||"left",_=>i({textAlign:_})),void 0,g("textAlign","ap-align"))),j(e,"ap-vertical-align",se("垂直对齐",nn("va",[{value:"top",label:"顶"},{value:"middle",label:"中"},{value:"bottom",label:"底"}],r.verticalAlign||"top",_=>i({verticalAlign:_})),void 0,g("verticalAlign","ap-vertical-align"))),h("div",{class:"color-row"},[j(e,"ap-color",se("颜色",st(r.color,_=>i({color:_}),"字体颜色"),void 0,g("color","ap-color"))),j(e,"ap-bg-color",se("背景色",st(r.backgroundColor,_=>i({backgroundColor:_}),"背景颜色"),void 0,g("backgroundColor","ap-bg-color")))]),j(e,"ap-line-height",Oe(e,"行高",r.lineHeight,_=>i({lineHeight:_||void 0}),{min:0,max:100},g("lineHeight","ap-line-height"))),j(e,"ap-letter-spacing",Oe(e,"字间距",r.letterSpacing,_=>i({letterSpacing:_||void 0}),{min:0,max:20,step:.5},g("letterSpacing","ap-letter-spacing"))),j(e,"ap-text-fit",qt(e,"文字溢出",co(o,r),[{value:"clip",label:"截断"},{value:"shrink",label:"自动缩小"},{value:"autoHeight",label:"自适应行高"}],_=>i({textFit:_}),void 0,g("textFit","ap-text-fit"))),r.textFit==="shrink"?j(e,"ap-shrink-min",se("最小字号 (pt)",J({value:r.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6",onCommit:_=>i({shrinkMinFontSize:_||void 0})}),void 0,g("shrinkMinFontSize","ap-shrink-min"))):"",o==="longText"?j(e,"ap-long-text-indent",He("首行缩进 (字符)",J({value:r.longTextIndent,min:0,max:10,placeholder:"默认 0",onCommit:_=>i({longTextIndent:_||void 0})}),Ce("ap-long-text-indent"),g("longTextIndent","ap-long-text-indent"))):"",j(e,"ap-word-wrap",An(e,"自动换行",r.wordWrap!==!1,_=>i({wordWrap:_?void 0:!1}),g("wordWrap","ap-word-wrap"))),j(e,"ap-keep-line-breaks",An(e,"保留换行符",r.keepLineBreaks===!0,_=>i({keepLineBreaks:_?!0:void 0}),g("keepLineBreaks","ap-keep-line-breaks"))),E,C]:[o==="image"?j(e,"ap-img-fit",qt(e,"缩放模式",String(r.fit??"contain"),cs,_=>i({fit:_}),Ce("ap-img-fit"),g("fit","ap-img-fit"))):"",o==="image"&&r.fit==="cover"?j(e,"ap-img-object-position",jh(e,{fieldKey:"ap-img-object-position",label:"裁剪锚点",src:Eu(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:_=>i({objectPosition:_}),onScaleCommit:_=>i({fitScale:_}),resetAnchor:g("objectPosition","ap-img-object-position"),resetScale:g("fitScale","ap-img-fit-scale")})):"",E,C,o==="flowList"?h("p",{class:"pd-empty",text:"当前元素不支持外观设置"}):""].filter(Boolean))])),c){const _=o==="barcode",ie=String(r.barcodeType||"CODE128").toUpperCase(),pe=r.printerDpi?String(r.printerDpi):"",Ve=kc(r.printerDpi,r.barWidth);u.push(tt(e,"code","条码设置","Postcard",[h("form",{class:"pd-form",onSubmit:ee=>ee.preventDefault()},[_?[j(e,"cd-type",qt(e,"码制",ie,[{value:"CODE128",label:"CODE128(通用)"},{value:"EAN13",label:"EAN13(商品码)"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],ee=>i({barcodeType:ee==="CODE128"?void 0:ee}))),j(e,"cd-dpi",qt(e,"打印机分辨率",pe,[{value:"",label:"不指定(按条宽渲染)"},{value:"203",label:"203 dpi(8 点/mm)"},{value:"300",label:"300 dpi(11.8 点/mm)"},{value:"600",label:"600 dpi(23.6 点/mm)"}],ee=>i({printerDpi:Number(ee)>0?Number(ee):void 0}),void 0,g("printerDpi","cd-dpi"))),j(e,"cd-dpi",h("p",{class:"pd-hint",text:"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小"})),j(e,"cd-bar-width",Oe(e,"条宽(倍率)",r.barWidth??2,ee=>i({barWidth:ee}),{min:2,max:8,step:.5},g("barWidth","cd-bar-width"))),j(e,"cd-bar-width",h("p",{class:"pd-hint",text:(pe?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定")+(Ve?`。${Ve}`:"")})),j(e,"cd-bar-quiet-zone",He("静区 (模块)",J({value:r.barQuietZone,min:0,max:20,placeholder:"默认 10",onCommit:ee=>i({barQuietZone:ee})}),Ce("cd-bar-quiet-zone"),g("barQuietZone","cd-bar-quiet-zone"))),j(e,"cd-bar-height",He("条高 (mm)",J({value:r.barHeight,min:1,max:100,placeholder:"默认 30 模块",onCommit:ee=>i({barHeight:ee??void 0})}),Ce("cd-bar-height"),g("barHeight","cd-bar-height"))),j(e,"cd-show-text",An(e,"显示文本",r.hideTitle!==!0,ee=>i({hideTitle:ee?void 0:!0}),g("hideTitle","cd-show-text"))),j(e,"cd-font-size",se("文本字号(相对条高,条高为 30)",J({value:r.fontSize,min:5,max:24,placeholder:"默认 10",onCommit:ee=>i({fontSize:ee||void 0})}),void 0,g("fontSize","cd-font-size")))]:[j(e,"cd-ec-level",qt(e,"纠错级别",String(r.qrCodeLevel??"M"),[{value:"L",label:"L(最低,容量大)"},{value:"M",label:"M(推荐)"},{value:"Q",label:"Q"},{value:"H",label:"H(最高)"}],ee=>i({qrCodeLevel:ee}),void 0,g("qrCodeLevel","cd-ec-level"))),j(e,"cd-quiet-zone",He("静区 (模块)",J({value:r.qrQuietZone,min:0,max:8,placeholder:"默认 0",onCommit:ee=>i({qrQuietZone:ee})}),Ce("cd-quiet-zone"),g("qrQuietZone","cd-quiet-zone")))],Pt("自定义设置"),_?h("p",{class:"pd-hint",text:"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限。要放大条码:先加条宽倍率,再收窄静区(左右白边会换成条宽),必要时关掉显示文本以让出文本区高度"}):"",_?"":j(e,"cd-fit",qt(e,"缩放模式",String(r.fit||"contain"),cs,ee=>i({fit:ee||void 0}),void 0,g("fit","cd-fit"))),j(e,"cd-max-width",se("最大宽度 (mm)",J({value:r.maxWidth,min:1,max:200,placeholder:"默认",onCommit:ee=>i({maxWidth:ee||void 0})}),void 0,g("maxWidth","cd-max-width"))),j(e,"cd-max-height",se("最大高度 (mm)",J({value:r.maxHeight,min:1,max:200,placeholder:"默认",onCommit:ee=>i({maxHeight:ee||void 0})}),void 0,g("maxHeight","cd-max-height")))].flat().filter(Boolean))]))}if(d&&(u.push(E2(e,t)),u.push(M2(e,t))),s&&u.push(S2(e,t)),o==="flowList"){const _=ut(r.flowColumns),ie=Yt(r.flowRowHeight),pe=bt(r.flowGapX),Ve=pn(r.flowMaxSpan,_),ee=am(r.width??0,pe,r.fontSize??12),Te=un(r.flowLayoutMode),ne=Te==="dynamic",me=Pn(r),Ie=(te,ze)=>{i({[te]:typeof ze=="number"&&Number.isFinite(ze)&&ze>0?ze:0})};u.push(tt(e,"flowList","流式列表","Grid3x3",[h("form",{class:"pd-form",onSubmit:te=>te.preventDefault()},[j(e,"fl-layout-mode",qt(e,"布局模式",Te,[{value:"fixed",label:"固定高度"},{value:"dynamic",label:"动态分页"}],te=>i({flowLayoutMode:te==="dynamic"?"dynamic":"fixed"}),Ce("fl-layout-mode"))),...ne?[j(e,"fl-padding-top",He("上内边距 (mm)",J({value:me.top,min:0,max:100,step:.5,onCommit:te=>Ie("flowPaddingTop",te)}),Ce("fl-padding-top"))),j(e,"fl-padding-right",He("右内边距 (mm)",J({value:me.right,min:0,max:100,step:.5,onCommit:te=>Ie("flowPaddingRight",te)}),Ce("fl-padding-right"))),j(e,"fl-padding-bottom",He("下内边距 (mm)",J({value:me.bottom,min:0,max:100,step:.5,onCommit:te=>Ie("flowPaddingBottom",te)}),Ce("fl-padding-bottom"))),j(e,"fl-padding-left",He("左内边距 (mm)",J({value:me.left,min:0,max:100,step:.5,onCommit:te=>Ie("flowPaddingLeft",te)}),Ce("fl-padding-left")))]:[],j(e,"fl-columns",He("每行列数",J({value:_,min:1,max:12,onCommit:te=>i({flowColumns:ut(te),flowMaxSpan:pn(r.flowMaxSpan,ut(te))})}),Ce("fl-columns"))),j(e,"fl-row-height",He("行高 (mm)",J({value:ie,min:3,max:100,step:.5,onCommit:te=>i({flowRowHeight:Yt(te)})}),Ce("fl-row-height"))),j(e,"fl-gap-x",He("单元横向间距 (mm)",J({value:pe,min:0,max:50,step:.5,onCommit:te=>i({flowGapX:bt(te)})}),Ce("fl-gap-x"))),j(e,"fl-auto-span",An(e,"内容过长时跨列",r.flowAutoSpan===!0,te=>{i(te?{flowAutoSpan:te,flowMaxSpan:Ve}:{flowAutoSpan:te})})),r.flowAutoSpan===!0?j(e,"fl-max-span",He("最多跨几列",J({value:Ve,min:1,max:_,onCommit:te=>i({flowMaxSpan:pn(te,_)})}),Ce("fl-max-span"))):"",_>ee?h("p",{class:"pd-hint",text:`按当前字号与框宽,${_} 列偏挤(可放约 ${ee} 列)。数值保持不变,出纸按 ${_} 列排。`}):""].flat().filter(Boolean))]))}const F=()=>({borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:r.borders}),N=_=>{const ie=F();Xc(ie,_,Qc(ie)),i(ie)},P=_=>{const ie=F();Ca(ie,_,!yr(ie,_)),i(ie)},O=Jc(r),T=O.style==="mixed",I=typeof O.width=="number"?O.width:void 0,S=T||O.style===void 0?"":O.style,$=typeof O.color=="string"?O.color:void 0,D=(_,ie)=>{const pe=F();Ym(pe,_,ie),i(pe)},B=T?[{value:"",label:"混合"},...Ta]:[...Ta];return u.push(tt(e,"border-bg","边框与背景","Picture",[h("form",{class:"pd-form",onSubmit:_=>_.preventDefault()},[j(e,"bb-border-style",qt(e,"线型",S,B,_=>D("borderStyle",_))),h("div",{class:"border-row"},[j(e,"bb-border-width",Oe(e,"边框宽度",I,_=>D("borderWidth",_),{min:0,max:20,step:.25,placeholder:O.width==="mixed"?"混合":void 0},g("borderWidth","bb-border-width"))),j(e,"bb-border-color",se("边框颜色",st($,_=>D("borderColor",_),"边框颜色"),void 0,g("borderColor","bb-border-color")))]),...ho(o)?[h("div",{class:"pd-button-group border-presets"},C2.map(_=>h("button",{type:"button",class:"pd-button small",text:_.label,disabled:_.value==="inner",onClick:()=>N(_.value)}))),h("div",{class:"pd-checkbox-group"},A2.map(_=>h("label",{class:"pd-checkbox"},[h("input",{type:"checkbox",checked:yr(r,_.value),onChange:()=>P(_.value)}),h("span",{text:_.label})]))),h("p",{class:"pd-hint",text:Hm})]:[],j(e,"bb-bg-color",se("背景色",st(r.backgroundColor,_=>i({backgroundColor:_}),"背景颜色"),void 0,g("backgroundColor","bb-bg-color")))])])),u.push(_2(e,t)),u.push(tt(e,"advanced","高级设置","Setting",[h("form",{class:"pd-form",onSubmit:_=>_.preventDefault()},[h("div",{class:"advanced-row"},[j(e,"ad-locked",An(e,"锁定",!!r.locked,_=>i({locked:_}),g("locked","ad-locked"))),j(e,"ad-fixed",An(e,"每页重复",!!r.repeatOnEveryPage,_=>i({repeatOnEveryPage:_}),g("repeatOnEveryPage","ad-fixed"))),j(e,"ad-fixed-position",An(e,"每页固定",!!r.fixed,_=>i({fixed:_}),g("fixed","ad-fixed-position")))]),j(e,"ad-z-index",Oe(e,"层级",r.zIndex,_=>i({zIndex:_}),{min:0,max:999},g("zIndex","ad-z-index"))),j(e,"ad-delete",h("div",{class:"pd-field"},[h("button",{type:"button",class:"pd-button danger",text:"删除元素",onClick:()=>n.deleteSelected()})]))])],!1,[h("button",{type:"button",class:"group-help",title:"高级设置说明","aria-label":"高级设置说明",text:"?",onClick:_=>{_.stopPropagation(),e.fire("help","advanced-settings")}})])),h("div",{class:"property-content"},u)}function I2(e){const t=e.store,n=t.templateData,r=c=>t.updateTemplateData(c),o=c=>{const s=n.tiling,d=p=>p===90||p===270;if(s?.enabled&&d(c)!==d(n.outputRotation)){const p=hu({...n,outputRotation:c});r({outputRotation:c,tiling:{...s,columns:Math.max(p,1)}});return}r({outputRotation:c})},i=[];for(const[c,s]of Object.entries(Ct)){const d=s.group??"其他";let p=i.find(u=>u.group===d);p||(p={group:d,items:[]},i.push(p)),p.items.push({key:c,label:s.label??c})}const a=!Ct[n.paperSize],l=_a(n.paperSize);return h("form",{class:"pd-form",onSubmit:c=>c.preventDefault()},[Pt("纸张设置"),se("纸张尺寸",h("select",{class:"pd-select",style:{width:"100%"},onChange:c=>r({paperSize:c.target.value})},[...i.map(c=>h("optgroup",{label:c.group},c.items.map(s=>h("option",{value:s.key,text:s.label,selected:n.paperSize===s.key})))),h("option",{value:"CUSTOM",text:"自定义宽高",selected:a})])),l||a?se(l?"纸宽 (mm)":"自定义宽高 (mm)",h("div",{class:"custom-size-grid"},[J({value:Number(n.customWidth??0),min:25,max:2e3,onCommit:c=>r({customWidth:c})}),...a?[h("span",{class:"custom-size-x",text:"×"}),J({value:Number(n.customHeight??0),min:25,max:2e3,onCommit:c=>r({customHeight:c})})]:[]])):"",l?"":se("纸张方向",nn("ori",[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],n.orientation==="landscape"?"landscape":"portrait",c=>r({orientation:c})),"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)"),l?"":se("内容旋转角度",nn("rot",[{value:"0",label:"0°"},{value:"90",label:"90°"},{value:"180",label:"180°"},{value:"270",label:"270°"}],String(n.outputRotation??0),c=>o(Number(c)),!0),n.tiling?.enabled?"拼版时每个标签的内容按该角度旋转;90°/270° 时每格占位宽高互换,列数自动铺满新档位上限,行数按互换后重算;0° 为不旋转(默认)":"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)"),se("页面背景色",h("div",{class:"page-bg-row"},[st(n.pageBackground,c=>r({pageBackground:c}),"页面背景色","page-bg-picker")]),void 0,Tn({target:n,base:{pageBackground:void 0},propKey:"pageBackground",write:()=>r({pageBackground:void 0})})),n2(e),t.pages.length>1?"":r2(e),Pt("页边距 (mm)"),h("div",{class:"margin-grid"},[Oe(e,"上",n.margins.top,c=>r({margins:{...n.margins,top:c}}),{min:0,max:50}),Oe(e,"下",n.margins.bottom,c=>r({margins:{...n.margins,bottom:c}}),{min:0,max:100}),Oe(e,"左",n.margins.left,c=>r({margins:{...n.margins,left:c}}),{min:0,max:50}),Oe(e,"右",n.margins.right,c=>r({margins:{...n.margins,right:c}}),{min:0,max:50})]),Pt("页眉/页脚高度 (mm)"),Oe(e,"页眉高度",n.header.height??10,c=>r({header:{...n.header,height:c}}),{min:0,max:100,step:.1}),Oe(e,"页脚高度",n.footer.height??10,c=>r({footer:{...n.footer,height:c}}),{min:0,max:100,step:.1}),k2(e)].filter(Boolean))}function R2(e,t,n){const r=(e.state.propSearch??"").trim(),o=!r||ld(r,[...n.searchKeywords,n.label]),i=document.createElement("div");if(i.className="property-content",o)try{ph(`property:${t.id}`,n.ui.renderProperty({element:t,data:e.host.designData?.length?e.host.designData:[ht],fields:e.host.fields??[],update:a=>e.store.updateElement(t.id,a),repaint:()=>e.repaint()}),i)}catch{}return h("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:custom"},style:e.state.propTab==="custom"?"":{display:"none"}},[i])}function P2(e){const t=e.store,n=e.state,r=t.selectedElement,o=r?Gs(r):void 0;if(n.propCollapsed)return h("div",{class:"property-panel collapsed"},[h("div",{class:"prop-collapsed"},[h("button",{type:"button",class:"pc-btn",title:"展开属性台",text:"«",onClick:()=>{n.propCollapsed=!1,e.repaint()}}),...o?[h("button",{type:"button",class:`pc-btn${n.propTab==="custom"?" on":""}`,title:o.label,html:De(o.icon,14)||De("Shapes",14),onClick:()=>{n.propTab="custom",n.propCollapsed=!1,e.repaint()}})]:[],...[["element","元素属性","▦"],["page","页面属性","▤"]].map(([a,l,c])=>h("button",{type:"button",class:`pc-btn${n.propTab===a?" on":""}`,title:l,text:c,onClick:()=>{n.propTab=a,n.propCollapsed=!1,e.repaint()}}))])]);const i=r?n.propTab==="custom"&&!o?"element":n.propTab:"page";return h("div",{class:"property-panel"},[h("div",{class:"prop-head"},[h("span",{class:"prop-title",text:"属性台"}),h("button",{type:"button",class:"collapse-btn",title:"收起属性台",text:"»",onClick:()=>{n.propCollapsed=!0,e.repaint()}})]),h("div",{class:"pd-tabs prop-tabs"},[h("div",{class:"pd-tab-bar",role:"tablist"},[...o?[h("button",{type:"button",class:`pd-tab${i==="custom"?" active":""}`,text:o.label,onClick:()=>{n.propTab="custom",e.repaint()}})]:[],h("button",{type:"button",class:`pd-tab${i==="element"?" active":""}`,text:"元素属性",onClick:()=>{n.propTab="element",e.repaint()}}),h("button",{type:"button",class:`pd-tab${i==="page"?" active":""}`,text:"页面属性",onClick:()=>{n.propTab="page",e.repaint()}})]),o&&r?R2(e,r,o):"",h("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:element"},style:i==="element"?"":{display:"none"}},r?[c2(e),O2(e,r)]:[h("p",{class:"pd-empty",text:"请在画布中选择一个元素"})]),h("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:page"},style:i==="page"?"":{display:"none"}},[I2(e)])].filter(Boolean))])}const Ol=[{key:"field",text:"📁 字段"},{key:"variable",text:"🔧 变量"},{key:"function",text:"⚡ 函数"}],Yh={field:"搜索字段...",variable:"搜索变量...",function:"搜索函数..."},D2=[{name:"SUM",label:"求和",template:"SUM()"},{name:"AVG",label:"平均值",template:"AVG()"},{name:"COUNT",label:"计数",template:"COUNT()"},{name:"MIN",label:"最小值",template:"MIN()"},{name:"MAX",label:"最大值",template:"MAX()"}],$2=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],N2=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],L2=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],F2=[{title:"聚合函数",items:D2},{title:"数值运算",items:$2},{title:"格式化函数",items:N2}],z2="(输入表达式后预览)",B2="(无法计算)",Il="(表达式错误)";function Kh(e,t){if(!e.trim())return z2;try{const n={...ht,...t??{},...Co()},r=Un(e,n);return r==null?B2:String(r)}catch{return Il}}function Xh(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.name.toLowerCase().includes(n)):e}function H2(e,t){const n=e.substring(0,t),r=n.lastIndexOf("{"),o=r!==-1&&!n.slice(r+1).includes("}"),i=n.lastIndexOf("("),a=i!==-1&&!n.slice(i+1).includes(")");return{insideBlock:o,insideParens:a}}function U2(e,t){const n=/^\{\s*([^{}]+?)\s*\}$/.exec(e.trim());if(!n)return null;const r=n[1]??"";return t.find(o=>o.fieldKey===r)??null}function Rl(e,t){return h("div",{class:"ee-field-info"},[h("span",{class:"ee-item-label",text:e}),h("span",{class:"ee-item-key",text:t})])}function Wt(e){return e.currentTarget.getRootNode()}function Wi(e,t,n){const r=[];return n.forEach((o,i)=>{r.push(o),i<n.length-1&&r.push(h("br"))}),h("div",{class:`ee-help-card ${e}`},[h("div",{class:"ee-help-card-title",text:t}),h("div",{class:"ee-help-card-content"},r)])}function q2(){return h("div",{class:"ee-help-section"},[h("div",{class:"ee-help-title",text:"帮助信息"}),h("div",{class:"ee-help-grid"},[Wi("ee-help-field","输入方式",["双击左侧字段、变量、函数即可插入到表达式输入框中","双击途中按住 Ctrl(Mac 为 ⌘)切换为插入字段名称,当静态文本用","静态数据直接输入即可,如:供应商名称","动态解析字段、变量、函数必须用 {} 包裹","示例:{SUM(supplier.name)}","注意:只能嵌套一层"]),Wi("ee-help-function","函数使用",["SUM(字段) - 求和","AVG(字段) - 平均值","COUNT(字段) - 计数","IF(条件, 真值, 假值) - 条件判断","四则运算:{qty * price}、{ADD(qty, 1)}","修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双"]),Wi("ee-help-variable","系统变量",["{pageIndex} - 当前页码","{totalPages} - 总页数","{printDate} - 打印日期"]),Wi("ee-help-conditional","示例",["静态文本:供应商名称","动态字段:{supplier.name}","函数调用:{SUM(amount)}",'条件判断:{IF(amount>1000, "大单", "小单")}',"运算并修约:{ROUND(qty * price, 2)}"])])])}function W2(e,t){const n={activeTab:"field",searchText:"",expression:t.value||"",binding:t.binding,copiedFieldKey:""},r=(m,b)=>m.querySelector(b),o=m=>{const b=r(m,".ee-preview");if(!b)return;const v=Kh(n.expression,e.demoData);b.textContent=v,b.classList.toggle("ee-preview-error",v===Il)},i=()=>{if(n.activeTab==="variable")return Xh(L2,n.searchText).map(v=>h("div",{class:"ee-list-item",onDblclick:w=>{const{insideParens:E}=c(w);s(Wt(w),E?v.template.replace(/^\{|\}$/g,""):v.template)}},[Rl(v.label,v.template)]));if(n.activeTab==="function")return F2.map(v=>h("div",{class:"ee-func-group"},[h("div",{class:"ee-func-group-title",text:v.title}),...Xh(v.items,n.searchText).map(w=>h("div",{class:"ee-list-item",onDblclick:E=>{const{insideBlock:C}=c(E),F=C?w.template:`{${w.template}}`;s(Wt(E),F,F.indexOf("(")+1)}},[Rl(w.label,`${w.name}()`)]))]));const m=O1(Mu(e.fields??[]),n.searchText);if(!m.length)return[h("p",{class:"pd-empty",text:"暂无字段"})];const b=[];for(const v of m){v.key&&b.push(h("div",{class:`ee-field-group${v.isList?" is-list":""}`},[h("span",{class:"ee-field-group-icon",text:v.isList?"📋":"📁"}),h("span",{text:v.label})]));for(const w of v.fields)b.push(h("div",{class:"ee-list-item ee-field-item",style:{paddingLeft:v.key?"22px":"10px"},onDblclick:E=>{const{insideParens:C}=c(E),F=E;if(F.ctrlKey||F.metaKey){const N=w.fieldLabel||w.fieldKey;s(Wt(E),C?`"${N}"`:N);return}s(Wt(E),C?w.fieldKey:`{${w.fieldKey}}`)}},[Rl(w.fieldLabel,w.fieldKey),h("button",{type:"button",class:`ee-copy-btn${n.copiedFieldKey===w.fieldKey?" is-copied":""}`,"data-tip":n.copiedFieldKey===w.fieldKey?"已复制":`复制字段名「${w.fieldLabel}」`,"aria-label":`复制字段名 ${w.fieldLabel}`,html:De(n.copiedFieldKey===w.fieldKey?"Check":"Copy",13),onClick:E=>{E.stopPropagation(),l(E,w)},onDblclick:E=>E.stopPropagation()})]))}return b},a=m=>{Array.from(m.querySelectorAll(".ee-nav-tab")).forEach((C,F)=>C.classList.toggle("active",Ol[F]?.key===n.activeTab));const v=r(m,".ee-content-search .pd-input");if(v){const C=Yh[n.activeTab];v.placeholder!==C&&(v.placeholder=C),v.value!==n.searchText&&(v.value=n.searchText)}const w=r(m,".ee-textarea");w&&w.value!==n.expression&&(w.value=n.expression);const E=r(m,".ee-content-list");if(E){Tf(E);for(const C of i())Je(C,E)}o(m)};function l(m,b){const v=Wt(m);Tu(b.fieldLabel||b.fieldKey).then(w=>{w&&(n.copiedFieldKey=b.fieldKey,a(v),setTimeout(()=>{n.copiedFieldKey===b.fieldKey&&(n.copiedFieldKey="",a(v))},1200))})}const c=m=>{const v=r(Wt(m),".ee-textarea")?.selectionStart??n.expression.length;return H2(n.expression,v)},s=(m,b,v=b.length)=>{const w=r(m,".ee-textarea");if(!w){n.expression+=b,o(m);return}const E=w.selectionStart??n.expression.length,C=w.selectionEnd??E;n.expression=n.expression.substring(0,E)+b+n.expression.substring(C);const F=E+v;w.value=n.expression,w.focus(),w.selectionStart=w.selectionEnd=F,o(m)},d=()=>{const m=n.expression;if(n.binding===void 0){e.onApply({formatter:m}),e.onClose();return}const b=U2(m,e.fields??[]);e.onApply(b?{formatter:m,binding:b.fieldKey,title:b.fieldLabel}:{formatter:m}),e.onClose()},p=h("div",{class:"ee-nav"},[h("div",{class:"ee-nav-title",text:"类型"}),h("div",{class:"ee-nav-tabs"},Ol.map((m,b)=>h("div",{class:`ee-nav-tab${n.activeTab===m.key?" active":""}`,text:m.text,onClick:v=>{n.activeTab=Ol[b].key,a(Wt(v))}})))]),u=h("div",{class:"ee-content"},[h("div",{class:"ee-content-search"},[h("input",{class:"pd-input",placeholder:Yh[n.activeTab],onInput:m=>{n.searchText=m.target.value,a(Wt(m))}})]),h("div",{class:"ee-content-list"},i())]),f=Kh(n.expression,e.demoData),g=h("div",{class:"ee-editor"},[h("div",{class:"ee-editor-section"},[h("div",{class:"ee-editor-title",text:"表达式编辑"}),h("textarea",{class:"ee-textarea",rows:6,placeholder:"双击左侧字段/变量/函数插入,双击途中按住 Ctrl(Mac 为 ⌘)切换为插入字段名,或直接输入静态内容",text:n.expression,onInput:m=>{n.expression=m.target.value,o(Wt(m))}})]),h("div",{class:"ee-editor-section"},[h("div",{class:"ee-editor-title",text:"预览结果"}),h("div",{class:`ee-preview${f===Il?" ee-preview-error":""}`,text:f})]),q2()]);return h("div",{class:"pd-dialog-overlay",onKeydown:m=>{m.key==="Escape"&&e.onClose()}},[h("section",{class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},[h("header",{class:"pd-dialog-header"},[h("strong",{id:"expression-editor-title",text:"编辑表达式"}),h("button",{type:"button",class:"pd-close","aria-label":"关闭",text:"×",onClick:()=>e.onClose()})]),h("div",{class:"expression-editor"},[p,u,g]),h("footer",{class:"pd-dialog-footer"},[h("button",{type:"button",class:"pd-button",text:"取消",onClick:()=>e.onClose()}),h("button",{type:"button",class:"pd-button primary",text:"确定",onClick:()=>d()})])])])}const ji=[{id:"getting-started",title:"快速入门",content:`
|
|
269
|
+
`);const $=E(P,O,I),N=e.getSymbolSize(P),z=new r(N);return f(z,P),g(z),m(z,P),v(z,O,0),P>=7&&b(z,P),w(z,$),isNaN(C)&&(C=a.getBestMask(z,v.bind(null,z,O))),a.applyMask(C,z),v(z,O,C),{modules:z,version:P,errorCorrectionLevel:O,maskPattern:C,segments:I}}return hs.create=function(P,O){if(typeof P>"u"||P==="")throw new Error("No input text");let C=t.M,I,S;return typeof O<"u"&&(C=t.from(O.errorCorrectionLevel,t.M),I=s.from(O.version),S=a.from(O.maskPattern),O.toSJISFunc&&e.setToSJISFunction(O.toSJISFunc)),L(P,I,C,S)},hs}var Ds={},$s={},mf;function bf(){return mf||(mf=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(i){return[i,i]}))),r.length===6&&r.push("F","F");const o=parseInt(r.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const o=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,i=r.width&&r.width>=21?r.width:void 0,a=r.scale||4;return{width:i,scale:i?4:a,margin:o,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,o){return o.width&&o.width>=r+o.margin*2?o.width/(r+o.margin*2):o.scale},e.getImageWidth=function(r,o){const i=e.getScale(r,o);return Math.floor((r+o.margin*2)*i)},e.qrToImageData=function(r,o,i){const a=o.modules.size,l=o.modules.data,c=e.getScale(a,i),s=Math.floor((a+i.margin*2)*c),d=i.margin*c,p=[i.color.light,i.color.dark];for(let u=0;u<s;u++)for(let f=0;f<s;f++){let g=(u*s+f)*4,m=i.color.light;if(u>=d&&f>=d&&u<s-d&&f<s-d){const b=Math.floor((u-d)/c),v=Math.floor((f-d)/c);m=p[l[b*a+v]?1:0]}r[g++]=m.r,r[g++]=m.g,r[g++]=m.b,r[g]=m.a}}})($s)),$s}var yf;function Vy(){return yf||(yf=1,(function(e){const t=bf();function n(o,i,a){o.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=a,i.width=a,i.style.height=a+"px",i.style.width=a+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(i,a,l){let c=l,s=a;typeof c>"u"&&(!a||!a.getContext)&&(c=a,a=void 0),a||(s=r()),c=t.getOptions(c);const d=t.getImageWidth(i.modules.size,c),p=s.getContext("2d"),u=p.createImageData(d,d);return t.qrToImageData(u.data,i,c),n(p,s,d),p.putImageData(u,0,0),s},e.renderToDataURL=function(i,a,l){let c=l;typeof c>"u"&&(!a||!a.getContext)&&(c=a,a=void 0),c||(c={});const s=e.render(i,a,c),d=c.type||"image/png",p=c.rendererOpts||{};return s.toDataURL(d,p.quality)}})(Ds)),Ds}var Ns={},vf;function Yy(){if(vf)return Ns;vf=1;const e=bf();function t(o,i){const a=o.a/255,l=i+'="'+o.hex+'"';return a<1?l+" "+i+'-opacity="'+a.toFixed(2).slice(1)+'"':l}function n(o,i,a){let l=o+i;return typeof a<"u"&&(l+=" "+a),l}function r(o,i,a){let l="",c=0,s=!1,d=0;for(let p=0;p<o.length;p++){const u=Math.floor(p%i),f=Math.floor(p/i);!u&&!s&&(s=!0),o[p]?(d++,p>0&&u>0&&o[p-1]||(l+=s?n("M",u+a,.5+f+a):n("m",c,0),c=0,s=!1),u+1<i&&o[p+1]||(l+=n("h",d),d=0)):c++}return l}return Ns.render=function(i,a,l){const c=e.getOptions(a),s=i.modules.size,d=i.modules.data,p=s+c.margin*2,u=c.color.light.a?"<path "+t(c.color.light,"fill")+' d="M0 0h'+p+"v"+p+'H0z"/>':"",f="<path "+t(c.color.dark,"stroke")+' d="'+r(d,s,c.margin)+'"/>',g='viewBox="0 0 '+p+" "+p+'"',b='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+g+' shape-rendering="crispEdges">'+u+f+`</svg>
|
|
270
|
+
`;return typeof l=="function"&&l(null,b),b},Ns}var wf;function Ky(){if(wf)return Kn;wf=1;const e=Ay(),t=Gy(),n=Vy(),r=Yy();function o(i,a,l,c,s){const d=[].slice.call(arguments,1),p=d.length,u=typeof d[p-1]=="function";if(!u&&!e())throw new Error("Callback required as last argument");if(u){if(p<2)throw new Error("Too few arguments provided");p===2?(s=l,l=a,a=c=void 0):p===3&&(a.getContext&&typeof s>"u"?(s=c,c=void 0):(s=c,c=l,l=a,a=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(l=a,a=c=void 0):p===2&&!a.getContext&&(c=l,l=a,a=void 0),new Promise(function(f,g){try{const m=t.create(l,c);f(i(m,a,c))}catch(m){g(m)}})}try{const f=t.create(l,c);s(null,i(f,a,c))}catch(f){s(f)}}return Kn.create=t.create,Kn.toCanvas=o.bind(null,n.render),Kn.toDataURL=o.bind(null,n.renderToDataURL),Kn.toString=o.bind(null,function(i,a,l){return r.render(i,l)}),Kn}var Xy=Ky();const Zy=Ru(Xy),xf="http://www.w3.org/2000/svg";function Jy(e){const t=e.getAttribute("viewBox");if(!t)return null;const n=t.trim().split(/[\s,]+/).map(Number);return n.length!==4||n.some(r=>!Number.isFinite(r))?null:{width:n[2],height:n[3]}}function Qy(e,t){const n=document.createElementNS(xf,"svg"),r=fr(t.barWidth),o=ua(t.barQuietZone),i=l=>{ps(n,e,{format:t.barcodeType||"CODE128",width:r,height:l*r,displayValue:t.showText!==!1,fontSize:(t.fontSize??ho)*r,margin:0,marginLeft:o*r,marginRight:o*r,marginTop:0,marginBottom:pa*r});const c=Jy(n);return c?{widthUnits:c.width,heightUnits:c.height}:null},a=ha({barHeightMm:t.barHeightMm,boxWidthMm:t.targetWidthMm??0,boxHeightMm:t.targetHeightMm??0,dpi:t.printerDpi,barWidth:t.barWidth,measure:i});return a.size&&(n.setAttribute("width",`${a.size.widthMm}mm`),n.setAttribute("height",`${a.size.heightMm}mm`)),n.setAttribute("shape-rendering","crispEdges"),n.outerHTML}function ev(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):kc}function tv(e,t){const n=(t.qrCodeLevel??"M").toUpperCase(),o=Zy.create(e,{errorCorrectionLevel:["L","M","Q","H"].includes(n)?n:"M"}).modules,i=o.size,a=4,l=ev(t.qrQuietZone)*a,c=i*a+l*2;let s="";for(let d=0;d<i;d++)for(let p=0;p<i;p++)o.get(p,d)&&(s+=`<rect x="${l+p*a}" y="${l+d*a}" width="${a}" height="${a}" fill="#000"/>`);return`<svg xmlns="${xf}" viewBox="0 0 ${c} ${c}" width="${c}" height="${c}" shape-rendering="crispEdges">${s}</svg>`}function Ef(e,t,n={}){if(!e)throw new Error("empty barcode value");return t==="qrcode"?tv(e,n):Qy(e,n)}const Ls={render(e,t,n={}){return Ef(e,t,n)}},Fs=.5,nv=12;function zs(e,t){const n=e.getAttribute(t);if(n===null||n==="")return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Sf(e,t){if(e.scrollWidth>e.clientWidth+Fs)return!0;const n=e.scrollHeight;return t!==void 0?n>t+Fs:n>e.clientHeight+Fs}function _f(e){if(e.getAttribute("data-fit")!=="shrink")return;const t=dr(zs(e,"data-fit-min")),n=Math.max(zs(e,"data-fit-base")??t,t),r=zs(e,"data-fit-mm"),o=r!==void 0&&r>0?un(r):void 0,i=s=>{const d=Qg(s);return e.style.fontSize=`${d}pt`,e.setAttribute("data-fit-size",String(d)),d},a=i(n);if(!Sf(e,o)||n<=t)return a;let l=t,c=n;for(let s=0;s<nv;s++){const d=(l+c)/2;i(d),Sf(e,o)?c=d:l=d}return i(l)}function rv(e){const t=[];return e.querySelectorAll('[data-fit="shrink"]').forEach(n=>{const r=_f(n),o=n.getAttribute("data-fit-key");r===void 0||!o||t.push({key:o,fontSizePt:r})}),t}const ov="2",iv=5e3;async function av(e,t=iv){const n=e.document,r=i=>Promise.race([i,new Promise(a=>setTimeout(a,t))]),o=(async()=>{n.readyState!=="complete"&&await r(new Promise(a=>e.addEventListener("load",()=>a(),{once:!0})));const i=n.fonts;i&&(await r(Promise.all(sv(n).map(a=>i.load(`${a.style} ${a.weight} 16px "${a.family}"`).catch(()=>{})))),i.ready&&await r(i.ready)),await r(Promise.all(Array.from(n.images??[]).map(a=>a.complete?Promise.resolve():new Promise(l=>{a.addEventListener("load",()=>l(),{once:!0}),a.addEventListener("error",()=>l(),{once:!0})}))))})();await r(o)}function sv(e){const t=[];for(const r of Array.from(e.styleSheets??[])){let o;try{o=r.cssRules}catch{continue}for(const i of Array.from(o??[])){if(i.type!==5)continue;const a=i.style,l=(a.getPropertyValue("font-family")||"").replace(/^["']|["']$/g,"");l&&t.push({family:l,weight:a.getPropertyValue("font-weight")||"400",style:a.getPropertyValue("font-style")||"normal"})}}return t}function lv(e){const t=[];return e.querySelectorAll("[data-measure-id]").forEach(n=>{const r=n,o=r.getAttribute("data-measure-id");if(!o)return;const i=r.getBoundingClientRect().height,a=r.querySelector("table.print-table");if(!a){const c=r.querySelectorAll(".print-flow-row[data-flow-row-index]");if(c.length>0){const s=[];c.forEach(d=>s.push(d.getBoundingClientRect().height)),t.push({id:o,heightPx:i,rowHeightsPx:s});return}t.push({id:o,heightPx:i});return}const l=[];a.querySelectorAll("tbody > tr[data-row-index]").forEach(c=>{l.push(c.getBoundingClientRect().height)}),t.push({id:o,heightPx:i,rowHeightsPx:l})}),t}function cv(e){const t=e.querySelector(".print-page"),n=e.querySelector(".content-area");if(!t||!n)return 0;const r=t.getBoundingClientRect().top;let o=0;n.querySelectorAll("*").forEach(a=>{if(a.classList.contains("print-element"))return;const l=a.getBoundingClientRect();l.height>0&&(o=Math.max(o,l.bottom-r))}),n.querySelectorAll(".print-element").forEach(a=>{const l=a.getBoundingClientRect(),c=Number.parseFloat(e.defaultView?.getComputedStyle(a).marginBottom??"0")||0;l.height>0&&(o=Math.max(o,l.bottom-r+c))});const i=n.getBoundingClientRect();return i.height>0&&(o=Math.max(o,i.bottom-r)),o}function dv(e,t=0){const r=e.querySelectorAll(".print-page")[t];if(!r)return[];const o=r.getBoundingClientRect(),i=e.defaultView?.getComputedStyle(r),a=Number.parseFloat(i?.paddingLeft??"0")||0,l=Number.parseFloat(i?.paddingTop??"0")||0,c=[];return r.querySelectorAll("[data-element-id]").forEach(s=>{if(s.querySelector("[data-element-id]"))return;const d=s.getAttribute("data-element-id");if(!d)return;const p=s.getBoundingClientRect(),u=uv(s,o,a,l);c.push({id:d,left:p.left-u.left,top:p.top-u.top,width:p.width,height:p.height,zone:u.zone})}),c}function uv(e,t,n,r){const o=(c,s)=>{const d=c.getBoundingClientRect();return{left:d.left,top:d.top,zone:s}},i=e.closest(".page-header");if(i)return o(i,"header");const a=e.closest(".page-footer");if(a)return o(a,"footer");const l=e.closest(".content-area");return l?o(l,"content"):{left:t.left+n,top:t.top+r,zone:"content"}}function pv(e){const t={};for(const n of e)try{t[n.key]=Ef(n.value,n.cellType,n.opts)}catch{}return t}const fv={version:ov,waitReady:av,readMeasurements:lv,readContentBottom:cv,readElementRects:dv,renderCodes:pv,applyTextFit:rv};function hv(){return{async createDriver(){const e=document.createElement("iframe");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;left:-10000px;top:0;border:0;visibility:hidden;pointer-events:none;",document.body.appendChild(e);let t=e.contentDocument??document;return{requiresExecutor:!1,async open(n){e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,t=e.contentDocument??document},async setContent(n){t=e.contentDocument??document,t.open(),t.write(n),t.close()},async injectExecutor(n){},async evaluate(n,r){const o=fv[n];if(typeof o!="function"){const s=(e.contentWindow?.__wormDom??globalThis.__wormDom)?.[n];if(typeof s!="function")throw new Error(`执行器方法 ${n} 未注入`);return s(...r??[])}const i=r??[],a=t1[n],l=o;return a==="window"?l(e.contentWindow,...i):a==="document"?l(t,...i):l(...i)},async close(){e.remove()}}}}}function gv(){return o1(hv())}async function mv(e,t,n,r,o){const i=await g1({templateJson:e,printData:t,baseUrl:n,fontBaseUrl:o?.fontBaseUrl??"",paperHeightMm:o?.paperHeightMm,codeRenderer:r,renderers:o?.renderers},gv());return{html:i.html,pageCount:i.pageCount,pageLayouts:i.pageLayouts,paperMm:i.paperMm,pagePaperMm:i.pagePaperMm,continuous:i.continuous,copies:i.copies,copyPaperMm:i.copyPaperMm}}var Mf=Symbol.for("worm-print-platform.element-ui-registry.v1"),Tf=globalThis;function Bs(){const e=Tf[Mf];if(e)return e;const t={entries:new Map,listeners:new Set,nextSeq:0};return Tf[Mf]=t,t}function bv(e){if(e)return Bs().entries.get(e)?.ui}function yv(){const e=[...Bs().entries.entries()];return e.sort((t,n)=>t[1].seq-n[1].seq),e.map(([t,n])=>({type:t,ui:n.ui}))}function vv(e){const t=Bs();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function h(e,t={},n=[]){return{tag:e,props:t,children:n}}const Hs="http://www.w3.org/2000/svg",wv=new Set(["draggable","contenteditable","spellcheck"]),xv=new Set(["indeterminate"]);function Ev(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="g"}function Sv(e){return e instanceof Element&&e.namespaceURI===Hs}function Ze(e,t){if(typeof e=="string"){const a=document.createTextNode(e);return t.appendChild(a),a}if(e instanceof Node)return t.appendChild(e),e;const{tag:n,props:r,children:o}=e,i=Ev(n)||Sv(t)?document.createElementNS(Hs,n):document.createElement(n);for(const[a,l]of Object.entries(r))if(!(l==null||l===!1))if(a==="class")i.setAttribute("class",String(l));else if(a==="style")typeof l=="string"?i.style.cssText=l:Object.assign(i.style,l);else if(a==="html")i.innerHTML=String(l);else if(a==="text")i.textContent=String(l);else if(a.startsWith("on")&&typeof l=="function")i.addEventListener(a.slice(2).toLowerCase(),l);else if(a==="dataset")for(const[c,s]of Object.entries(l))i.dataset[c]=s;else xv.has(a)?i[a]=!0:typeof l=="boolean"?l&&i.setAttribute(a,wv.has(a)?"true":""):i.setAttribute(a,String(l));for(const a of o)Ze(a,i);return t.appendChild(i),i}function kf(e){for(;e.firstChild;)e.removeChild(e.firstChild)}const _v=Hs;function qr(){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 Us="开启拼版后只能有一个设计页面";function qs(e){const t=(n,r)=>(n??[]).map(o=>{const i={...o.options};return(o.printElementType?.type??o.type)==="table"&&sr(i),{id:o.id||zn(),zone:r,options:i,printElementType:{...o.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 Cf(e){const t=e.elements,n=r=>t.filter(o=>(o.zone||"content")===r).map(o=>({id:o.id,type:o.printElementType.type,options:{...o.options},printElementType:{...o.printElementType}}));return{unit:"mm",...e,header:{...e.header,elements:n("header")},footer:{...e.footer,elements:n("footer")},elements:n("content"),guides:[...e.guides??[]]}}function Af(e){const t=(r,o)=>{const i=qs(Wm(r));return i.name||(i.name=`页面 ${o+1}`),i};if(!e)return[t(qr(),0)];const n=Array.isArray(e.pages)?e.pages:[e];return n.length?n.map(t):[t(qr(),0)]}const Xn=e=>JSON.parse(JSON.stringify(e));class Of{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=B1();group=H1();constructor(t={}){if(this.pages=Af(t.initialTemplate),this.fields=t.initialFields??[],t.initialElements?.length){const n=this.pages[0];n.elements=[...n.elements,...t.initialElements]}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t=!0){t&&(this.dirty=!0);for(const n of[...this.listeners])n()}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(Us);return}this.recordHistory();const t=this.pages[this.activePageIndex]??qr();this.pages.push(qs({...qr(),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 n=this.pages.length+1;for(;t.has(`页面 ${n}`);)n++;return`页面 ${n}`}duplicatePage(t){if(this.tilingEnabled){window.alert(Us);return}this.recordHistory();const n=Xn(this.pages[t]);n.name=`${n.name??`页面 ${t+1}`} 副本`,n.elements=n.elements.map(r=>({...r,id:zn()})),this.pages.splice(t+1,0,n),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,n){this.recordHistory(),this.pages[t].name=n,this.emit()}movePage(t,n){if(n<0||n>=this.pages.length||t===n)return;this.recordHistory();const[r]=this.pages.splice(t,1);this.pages.splice(n,0,r),this.activePageIndex=n,this.emit()}onSelectionChanged;setSelection(t){this.selectedIds=t,this.onSelectionChanged?.(),this.emit(!1)}select(t){this.setSelection(new Set(t))}selectOne(t,n=!1){if(n){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,n=!1){if(n){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(n=>n.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,n){const r=this.templateData.guides??[];this.templateData.guides=[...r,{id:zn(),type:t,position:Math.round(n*10)/10}],this.emit()}moveGuide(t,n){const r=this.templateData.guides??[];this.templateData.guides=r.map(o=>o.id===t?{...o,position:Math.round(n*10)/10}:o),this.emit(!1)}removeGuide(t){this.templateData.guides=(this.templateData.guides??[]).filter(n=>n.id!==t),this.emit()}addElement(t,n={},r){const o=Sa(t,n);return r&&!this.placeAtDropPoint(o,r)||(this.recordHistory(),this.templateData.elements.push(o),this.select(new Set([o.id])),this.emit()),o}addFieldElement(t,n={},r,o=!1){const i=o?F1(t):L1(t);return Object.assign(i.options,n),r&&!this.placeAtDropPoint(i,r)||(this.recordHistory(),this.templateData.elements.push(i),this.select(new Set([i.id])),this.emit()),i}placeAtDropPoint(t,n){const r=this.templateData,o=sd(r,n.x,n.y);if(o!=="content"&&!ad(t.printElementType.type))return alert("该元素类型不能放入页眉/页脚"),!1;const i=Oa(r)[o];return t.zone=o,t.options.left=n.x-i.left,t.options.top=n.y-i.top,o!=="content"&&Ia(t,i),!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,n){const r=this.templateData.elements.find(i=>i.id===t);if(!r)return;const o=this.live.get(t)??r;this.live.set(t,{...o,options:{...o.options,...n}})}commitLive(){if(!this.live.size)return;this.recordHistory();const t=this.templateData.elements;for(const[n,r]of this.live){const o=t.find(i=>i.id===n);o&&Object.assign(o.options,r.options)}this.live.clear(),this.emit()}dragIds(t){const n=this.templateData.elements.find(r=>r.id===t);return!n||n.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 n=!1;for(const r of this.elements){const o=t.get(r.id);!o||o===this.geoSig(r)||u0(r,this.templateData).rejected&&(n=!0)}n&&alert("该元素类型不能放入页眉/页脚"),this.emit()}geoSig(t){return`${t.zone||"content"}:${t.options.left},${t.options.top},${t.options.width},${t.options.height}`}updateElement(t,n,r=!0){r&&this.recordHistory();const o=this.templateData.elements.find(i=>i.id===t);o&&(Object.assign(o.options,n),o.printElementType.type==="table"&&sr(o.options),this.emit())}updateTemplateData(t){this.recordHistory(),Object.assign(this.templateData,t);for(const n of["paperSize","customWidth","customHeight"])if(n in t)for(const r of this.pages)Object.assign(r,{[n]:t[n]});this.emit()}moveLayer(t){if(!this.selectedIds.size)return;this.recordHistory();const n=this.templateData.elements,r=n.filter(i=>this.selectedIds.has(i.id)),o=n.filter(i=>!this.selectedIds.has(i.id));if(t==="top")this.templateData.elements=[...o,...r];else if(t==="bottom")this.templateData.elements=[...r,...o];else{const i=n.findIndex(c=>this.selectedIds.has(c.id)),a=t==="up"?i+1:i-1;if(a<0||a>=n.length)return;const l=[...n];[l[i],l[a]]=[l[a],l[i]],this.templateData.elements=l}this.emit()}alignSelected(t){this.selectedIds.size<2||(this.recordHistory(),this.align.align(this.elements.filter(n=>this.selectedIds.has(n.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=Xn(this.selectedElements),this.emit(!1)}cutSelected(){this.copy(),this.deleteSelected()}paste(t=10){if(!this.clipboard.length)return;this.recordHistory();const n=new Map;for(const i of this.clipboard){const a=i.options.groupId;a&&n.set(a,(n.get(a)??0)+1)}const r=new Map;for(const[i,a]of n)r.set(i,a>=2?Pu():void 0);const o=this.templateData.elements;for(const i of this.clipboard){const a=Xn(i);a.id=zn(),a.options.left+=t,a.options.top+=t,a.options.groupId=a.options.groupId?r.get(a.options.groupId):void 0,o.push(a)}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,n){const r=this.selectedElements.filter(o=>!o.options.locked);if(r.length){this.moveSessionActive||(this.moveSessionActive=!0,this.recordHistory());for(const o of r)o.options.left+=t,o.options.top+=n;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:Xn(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:Xn(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:Xn(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,n=So){this.scale=Math.max(n,Math.round(t)),this.emit(!1)}getTemplateJson(){const t=this.pages.map(Cf),n=t.length===1?t[0]:{version:1,pages:t};return JSON.stringify(n)}loadTemplate(t){this.pages=Af(t),this.activePageIndex=0,this.resetSelection(),this.recordHistory(),this.emit()}get paperSize(){return Jt(this.templateData)}}const _n=Symbol("mixed"),Ws=new Set(["text","longText"]),Mv=["top","right","bottom","left"],Tv={on:!0,off:!1,mixed:_n};function If(e){const t=Xc(e),n={};for(const r of Mv)n[r]=Tv[t[r]];return n}const kv=["fontFamily","fontSize","fontWeight","color","textAlign","verticalAlign","textDecoration"];class Cv{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(n=>n.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,n=this.tableElement?.options.tableRows;if(!t||!n)return[];const r=[];for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=n[o]?.cells[i];a&&!a.merged&&r.push(a)}return r}get textTargets(){return this.selectedElements.filter(t=>Ws.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 n=t[0];return t.every(r=>r===n)?n:_n}hasToken(t,n){return(t??"").split(/\s+/).includes(n)}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 n=t.map(o=>o.fontWeight==="bold"||o.fontWeight==="bolder"),r=t.map(o=>o.textDecoration);return{fontFamily:this.pick(t.map(o=>o.fontFamily)),fontSize:this.pick(t.map(o=>o.fontSize)),color:this.pick(t.map(o=>o.color)),backgroundColor:this.pick(t.map(o=>o.backgroundColor)),textAlign:this.pick(t.map(o=>this.context==="cells"?o.align:o.textAlign)),verticalAlign:this.pick(t.map(o=>this.context==="cells"?o.valign:o.verticalAlign)),bold:n.every(Boolean)?!0:n.some(Boolean)?_n:!1,underline:r.map(o=>this.hasToken(o,"underline")).every(Boolean)?!0:r.some(o=>this.hasToken(o,"underline"))?_n:!1,strike:r.map(o=>this.hasToken(o,"line-through")).every(Boolean)?!0:r.some(o=>this.hasToken(o,"line-through"))?_n:!1}}commit(){this.store.recordHistory(),this.store.emit()}writeCells(t){const n=this.targetCells;n.length&&(n.forEach(t),this.commit())}applyStyle(t){if(this.context==="cells"){this.writeCells(l=>{"fontFamily"in t&&(l.fontFamily=t.fontFamily),"fontSize"in t&&(l.fontSize=t.fontSize),"color"in t&&(l.color=t.color),"backgroundColor"in t&&(l.backgroundColor=t.backgroundColor),"textAlign"in t&&(l.align=t.textAlign),"verticalAlign"in t&&(l.valign=t.verticalAlign)});return}const n=this.textTargets,r=this.selectedElements,i=["fontFamily","fontSize","color","textAlign","verticalAlign"].some(l=>l in t),a="backgroundColor"in t;!(n.length&&i)&&!(r.length&&a)||(n.forEach(l=>{const c=l.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)}),a&&r.forEach(l=>{l.options.backgroundColor=t.backgroundColor}),this.commit())}toggleBold(){if(this.context==="cells"){const r=this.values.bold!==!0;this.writeCells(o=>{o.fontWeight=r?"bold":void 0});return}const t=this.values.bold!==!0,n=this.textTargets;n.length&&(n.forEach(r=>{r.options.fontWeight=t?"bold":"normal"}),this.commit())}toggleDecoration(t){if(this.context==="cells")return;const n=this.textTargets;if(!n.length)return;const r=this.values[t==="underline"?"underline":"strike"]!==!0;n.forEach(o=>{const i=(o.options.textDecoration??"").split(/\s+/).filter(Boolean),a=i.indexOf(t);r&&a<0&&i.push(t),!r&&a>=0&&i.splice(a,1),o.options.textDecoration=i.length?i.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,n=this.tableElement?.options.tableRows;if(!t||!n)return;const r=`cells:${t.elementId}:${t.r1}:${t.c1}:${t.r2}:${t.c2}`;if(r===this.borderDraftKey)return;if(this.borderDraftKey=r,ra(n,t).mode==="multi"){this.borderStyle="solid",this.borderWidth=.75,this.borderColor="#333333",this.borderMixed={style:!1,width:!1,color:!1};return}const o=lc(n,t);if(o.style===void 0&&o.width===void 0&&o.color===void 0){this.borderMixed={style:!1,width:!1,color:!1},this.borderStyle=null,this.borderWidth=0,this.borderColor="#333333";return}this.borderMixed={style:o.style==="mixed",width:o.width==="mixed",color:o.color==="mixed"},this.borderMixed.style?this.borderStyle=null:o.style===void 0?this.borderStyle="solid":o.style==="none"?this.borderStyle=null:this.borderStyle=o.style,this.borderWidth=this.borderMixed.width?void 0:typeof o.width=="number"?o.width:.75,this.borderColor=this.borderMixed.color?void 0:typeof o.color=="string"?o.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 n=this.borderStyle===t?null:t;this.borderMixed.style=!1,this.borderStyle=n,n===null?this.borderWidth=0:this.borderWidth===0&&(this.borderWidth=.75)}applyElementBorder(t,n){const r=this.selectedElements;r.length&&(r.forEach(o=>{Zc(o.options,t,n)}),this.commit())}applyCellBorderPreset(t,n){const r=this.store.tableSelection,o=this.tableElement?.options.tableRows;!r||!o||(ac(o,{r1:r.r1,c1:r.c1,r2:r.r2,c2:r.c2},t,n),this.commit())}applyCellBorderEdges(t,n,r){this.writeCells(o=>{for(const i of t)sc(o,i,r?n:null)})}get cellEdges(){if(this.context!=="cells")return null;const t=this.targetCells;return t.length?If(t.map(n=>n.borders)):null}toggleCellEdge(t,n){const r=this.cellEdges?.[t]!==!0;this.applyCellBorderEdges([t],n,r)}get elementEdges(){if(this.context!=="elements")return null;const t=this.selectedElements;return t.length?If(t.map(n=>Vm(n.options))):null}toggleElementEdge(t,n){const r=this.selectedElements;if(!r.length)return;const o=this.elementEdges?.[t]!==!0;r.forEach(i=>Ca(i.options,t,o,n)),this.commit()}applyBorderPreset(t){const n=this.borderStyle===null;if(this.context==="cells"){const r=n&&!this.borderMixed.style;this.applyCellBorderPreset(r?"none":t,this.borderSpec()),this.settleBorderDraft()}else this.applyElementBorder(n||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 n=this.selectedElements;n.length&&(n.forEach(r=>Ca(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 n={};for(const r of hr){const o=t[r];o&&(n[r]={...o})}return n}pickPainterSource(t=!1){const n=this.selectedElements[0];if(!n)return!1;const r=n.options,o=n.printElementType.type;return this.painterSnapshot={text:Ws.has(o)?Object.fromEntries(kv.map(i=>[i,r[i]])):null,backgroundColor:r.backgroundColor,border:mo(o)?{borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:this.clonePainterBorders(r.borders)}:null},this.painterSource=n.id,this.painterActive=!0,this.painterLocked=t,!0}cancelPainter(){this.painterActive=!1,this.painterLocked=!1,this.painterSource=null,this.painterSnapshot=null}applyPainter(t){const n=this.painterSnapshot;if(!n||t.options.locked||t.id===this.painterSource)return!1;const r=t.options,o=t.printElementType.type;return n.text&&Ws.has(o)&&Object.assign(r,n.text),r.backgroundColor=n.backgroundColor,n.border&&mo(o)&&(r.borderWidth=n.border.borderWidth,r.borderStyle=n.border.borderStyle,r.borderColor=n.border.borderColor,r.borders=this.clonePainterBorders(n.border.borders)),!0}painterSyncSelection(){if(!this.painterActive||!this.painterSnapshot)return;const t=this.selectedElements;if(!t.length){this.cancelPainter();return}let n=!1;t.forEach(r=>{n=this.applyPainter(r)||n}),n&&(this.commit(),this.painterLocked||this.cancelPainter())}handlePainterKeydown(t){if(t.key!=="Escape"||!this.painterActive)return;const n=t.target?.tagName;n==="INPUT"||n==="TEXTAREA"||n==="SELECT"||this.cancelPainter()}}const Av="自定义属性";function Pf(){const e=[];for(const{plugin:t,kind:n}of gc()){const r=bv(n.type);if(!r)continue;const i=(n.designer??t.designer)?.materialCard;e.push({type:n.type,label:n.label,icon:n.icon??i?.icon??"Shapes",group:i?.group??r.group,ui:r})}return e}function js(e){if(e)return Pf().find(t=>t.type===e)}function Gs(e){if(!e)return;const t=js(e.printElementType.type);if(!t||!t.ui.renderProperty)return;const n=t.ui;if(n.hasProperties)try{if(!n.hasProperties(e))return}catch{return}const r=Av;return{ui:n,label:r,icon:t.icon,searchKeywords:n.searchKeywords?[...n.searchKeywords]:[r,t.label,t.type]}}const Ii=Object.freeze([{type:"text",label:"文本",icon:"Type",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"barcode",label:"条形码",icon:"Barcode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"qrcode",label:"二维码",icon:"QrCode",material:!0,propertyGroup:"code",dblEditableField:"formatter",origin:"builtin"},{type:"image",label:"图片",icon:"Image",material:!0,propertyGroup:"general",dblEditableField:"src",origin:"builtin"},{type:"table",label:"表格",icon:"Table",material:!0,propertyGroup:"table",origin:"builtin"},{type:"longText",label:"长文",icon:"TextAlignStart",material:!0,propertyGroup:"text",dblEditableField:"formatter",origin:"builtin"},{type:"flowList",label:"流式列表",icon:"List",material:!0,propertyGroup:"general",dblEditableField:"formatter",origin:"builtin"},{type:"hline",label:"横线",icon:"Minus",material:!0,propertyGroup:"general",origin:"builtin"},{type:"vline",label:"竖线",icon:"SeparatorVertical",material:!0,propertyGroup:"general",origin:"builtin"},{type:"rect",label:"矩形",icon:"Square",material:!0,propertyGroup:"general",origin:"builtin"},{type:"oval",label:"椭圆",icon:"Circle",material:!0,propertyGroup:"general",origin:"builtin"},{type:"html",label:"HTML",icon:"Code",material:!1,propertyGroup:"general",origin:"builtin"},{type:"pageNumber",label:"页码",icon:"Shapes",material:!1,propertyGroup:"general",origin:"builtin"}]),Rf=Symbol.for("worm-print-platform.element-definitions.v1"),Df=globalThis;function Et(){const e=Df[Rf];if(e)return e;const t={overrides:new Map,builtinRenderers:new Map,rendererOverrides:new Map,listeners:new Set,nextSeq:0,seq:new Map};return Df[Rf]=t,t}function Wr(){for(const e of[...Et().listeners])try{e()}catch{}}function $f(e){const t=Et();return t.listeners.add(e),()=>{t.listeners.delete(e)}}function Ov(){return new Map(Ii.map(e=>[e.type,e]))}function Iv(e){if(!e?.type||typeof e.type!="string")throw new Error("registerElementDefinition: type 必须是非空字符串");if(!e.label||typeof e.label!="string")throw new Error("registerElementDefinition: label 必须是非空字符串");const t=Et(),n={...e,origin:e.origin??"custom"};return t.overrides.set(n.type,n),t.seq.set(n.type,t.nextSeq++),Wr(),()=>{const r=Et();r.overrides.get(n.type)===n&&(r.overrides.delete(n.type),Wr())}}function Pv(e,t){if(!e||typeof t!="function")throw new Error("registerElementRenderer: 需要 type 与渲染函数");return Et().rendererOverrides.set(e,t),Wr(),()=>{const r=Et();r.rendererOverrides.get(e)===t&&(r.rendererOverrides.delete(e),Wr())}}function Nf(e){const t=Et();for(const[n,r]of Object.entries(e))t.builtinRenderers.set(n,r);return()=>{const n=Et();for(const[r,o]of Object.entries(e))n.builtinRenderers.get(r)===o&&n.builtinRenderers.delete(r)}}function Rv(e){const t=js(e);if(t)return{type:t.type,label:t.label,icon:t.icon,group:t.group,material:!0,propertyGroup:"general",origin:"plugin"}}function tn(e){if(!e)return;const t=Et(),n=t.overrides.get(e)??Ov().get(e)??Rv(e);if(!n)return;const r=t.rendererOverrides.get(e)??t.builtinRenderers.get(e);return r?{...n,renderContent:r}:n}function Lf(){const e=Et(),t=[],n=new Set;for(const o of Ii)t.push(tn(o.type)??o),n.add(o.type);const r=[...e.overrides.entries()].filter(([o])=>!n.has(o)).sort((o,i)=>(e.seq.get(o[0])??0)-(e.seq.get(i[0])??0));for(const[o]of r){const i=tn(o);i&&t.push(i),n.add(o)}for(const o of Pf()){if(n.has(o.type))continue;const i=tn(o.type);i&&t.push(i),n.add(o.type)}return t}function Ff(){return Lf().filter(e=>e.material)}function zf(e){return tn(e)?.propertyGroup??"general"}function Bf(e){return tn(e)?.dblEditableField}function Hf(e){return tn(e)?.icon??"Shapes"}function Dv(){const e=Et();e.overrides.clear(),e.rendererOverrides.clear(),e.seq.clear(),e.nextSeq=0,Wr()}const Vs="1.2.0",Uf="print-designer",Ys=["template","fields","name","fonts","design-data","theme","theme-config"],qf=["is-edit","show-help","show-preview","show-save"],$v=Object.freeze({bubbles:!0,composed:!0}),Ks=["container","toolbar","format-bar","left-panel","canvas-area","property-panel","status-bar","page-tabs"],Wf=["--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"],jf=["getTemplateJson","loadTemplate","save","validateTemplate","getGeometryWarnings"],Gf=["template","fields","fonts","designData","isEdit","showHelp","showPreview","showSave","theme","themeConfig","uploadImage","uploadDesignBackground"],St=Object.freeze({save:"save",preview:"preview",help:"help",dblclickElement:"dblclick-element",dblclickCell:"dblclick-cell"}),Vf=[St.save,St.preview,St.help,St.dblclickElement,St.dblclickCell];function Xs(){return{version:Vs,tag:Uf,attributes:Ys,booleanAttributes:qf,events:Vf,parts:Ks,themeTokens:Wf,methods:jf,properties:Gf}}const Nv={"--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 Yf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lv(e){if(Array.isArray(e))return e}function Fv(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){s=!0,o=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}function zv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
271
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bv(e,t){return Lv(e)||Fv(e,t)||Hv(e,t)||zv()}function Hv(e,t){if(e){if(typeof e=="string")return Yf(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yf(e,t):void 0}}const Kf=Object.entries,Uv=Object.keys,Xf=Object.setPrototypeOf,qv=Object.isFrozen,Zf=Object.getPrototypeOf,Jf=Object.getOwnPropertyDescriptor;let ze=Object.freeze,Oe=Object.seal,nn=Object.create,Qf=typeof Reflect<"u"&&Reflect,Pi=Qf.apply,Zs=Qf.construct;ze||(ze=function(t){return t}),Oe||(Oe=function(t){return t}),Pi||(Pi=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Zs||(Zs=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const Ht=we(Array.prototype.forEach),Wv=we(Array.prototype.lastIndexOf),eh=we(Array.prototype.pop),jr=we(Array.prototype.push),jv=we(Array.prototype.slice),Gv=we(Array.prototype.splice),Zn=Array.isArray,Js=rh(Set),Qs=we(Set.prototype.add),Gr=we(Set.prototype.has),Mn=we(String.prototype.toLowerCase),el=we(String.prototype.toString),Vv=we(String.prototype.match),Ri=we(String.prototype.replace),tl=we(String.prototype.indexOf),Yv=we(String.prototype.trim),Kv=we(Number.prototype.toString),Xv=we(Boolean.prototype.toString),th=typeof BigInt>"u"?null:we(BigInt.prototype.toString),nh=typeof Symbol>"u"?null:we(Symbol.prototype.toString),je=we(Object.prototype.hasOwnProperty),Vr=we(Object.prototype.toString),Zv=RegExp.prototype.test,Be=function(t,n){return t instanceof RegExp&&(t.lastIndex=0),Pi(Zv,t,[n])},Ut=rh(TypeError);function we(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Pi(e,t,r)}}function rh(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Zs(e,n)}}function ce(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mn;if(Xf&&Xf(e,null),!Zn(t))return e;let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(qv(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Jv(e){for(let t=0;t<e.length;t++)je(e,t)||(e[t]=null);return e}function Di(e){const t=nn(null);for(const r of Kf(e)){var n=Bv(r,2);const o=n[0],i=n[1];je(e,o)&&(Zn(i)?t[o]=Jv(i):i&&typeof i=="object"&&i.constructor===Object?t[o]=Di(i):t[o]=i)}return t}function Yr(e){const t=nn(null),n=Uv(e);let r=n.length;for(;r--;)t[n[r]]=e[n[r]];return t}function Qv(e){switch(typeof e){case"string":return e;case"number":return Kv(e);case"boolean":return Xv(e);case"bigint":return th?th(e):"0";case"symbol":return nh?nh(e):"Symbol()";case"undefined":return Vr(e);case"function":case"object":{if(e===null)return Vr(e);const t=e,n=mt(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:Vr(r)}return Vr(e)}default:return Vr(e)}}function mt(e,t){for(;e!==null;){const r=Jf(e,t);if(r){if(r.get)return we(r.get);if(typeof r.value=="function")return we(r.value)}e=Zf(e)}function n(){return null}return n}function ew(e,t){for(;e!==null;){const n=Jf(e,t);if(n)return n.get?we(n.get):null;e=Zf(e)}return null}function tw(e){if(!e)return!1;try{return Be(e,""),!0}catch{return!1}}const oh=ze(["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"]),nl=ze(["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"]),rl=ze(["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"]),nw=ze(["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"]),ol=ze(["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"]),rw=ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ih=ze(["#text"]),ah=ze(["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"]),il=ze(["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"]),sh=ze(["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"]),$i=ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ow=Oe(/{{[\w\W]*|^[\w\W]*}}/g),iw=Oe(/<%[\w\W]*|^[\w\W]*%>/g),aw=Oe(/\${[\w\W]*/g),sw=Oe(/{{|}}|\${|<%|%>|<%|%>/),lw=Oe(/^data-[\-\w.\u00B7-\uFFFF]+$/),cw=Oe(/^aria-[\-\w]+$/),lh=Oe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dw=Oe(/^(?:\w+script|data):/i),uw=Oe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),pw=Oe(/^html$/i),fw=Oe(/^[a-z][.\w]*(-[.\w]+)+$/i),al=Oe(/<[/\w!]/g),ch=Oe(/<[/\w]/g),hw=Oe(/<\/no(script|embed|frames)/i),dh=Oe(/\/>/i),gw=Oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),mw=Oe(/^[\r\n\t ]+/),Me={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},bw=ze(ce({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),yw=function(){return typeof window>"u"?null:window},vw=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},uh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},rn=function(t,n,r,o){return je(t,n)&&Zn(t[n])?ce(o.base?Yr(o.base):{},t[n],o.transform):r},sl=function(t,n,r){const o=je(t,n)?t[n]:void 0;return o&&typeof o=="object"?Di(o):r};function ph(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yw();const t=D=>ph(D);if(t.version="3.4.18",t.removed=[],!e||!e.document||e.document.nodeType!==Me.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,o=r.currentScript,i=e.HTMLTemplateElement,a=e.Node,l=e.Element,c=e.NodeFilter,s=e.DOMParser,d=e.trustedTypes,p=l.prototype,u=mt(p,"cloneNode"),f=mt(p,"remove"),g=mt(p,"removeAttributeNode"),m=mt(p,"nextSibling"),b=mt(p,"childNodes"),v=mt(p,"parentNode"),w=mt(p,"shadowRoot"),E=mt(p,"attributes"),k=a&&a.prototype?mt(a.prototype,"nodeType"):null,L=a&&a.prototype?mt(a.prototype,"nodeName"):null,R=a&&a.prototype?mt(a.prototype,"ownerDocument"):null,P=function(y){return k?k(y):y.nodeType},O=function(y){return L?L(y):y.nodeName},C=ew(p,"namespaceURI"),I=function(y){return C?C(y):y.namespaceURI};if(typeof i=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let S,$="",N,z=!1,T=0;const ie=function(){if(T>0)throw Ut('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.')},pe=function(y){ie(),T++;try{return S.createHTML(y)}finally{T--}},Ge=function(y){return S&&xe?pe(y):y},Q=function(y){ie(),T++;try{return S.createScriptURL(y)}finally{T--}},Te=function(){return z||(N=vw(d,o),z=!0),N},he=n,de=he.implementation,ye=he.createNodeIterator,ne=he.createDocumentFragment,De=he.getElementsByTagName,it=r.importNode;let te=uh();t.isSupported=typeof Kf=="function"&&typeof v=="function"&&de&&de.createHTMLDocument!==void 0;const Ve=ow,$e=iw,fe=aw,me=lw,tr=cw,to=dw,no=uw,ro=fw;let nr=lh,ge=null;const Mt=ce({},[...oh,...nl,...rl,...ol,...ih]);let M=null;const H=ce({},[...ah,...il,...sh,...$i]);let B=null,q=null,U=null;const V=Object.seal(nn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,_=!0,G=!1,K=!0,Z=!1,oe=!0,be=!1,ke=!1,Ue=null,Je=null,Ne=!1,at=!1,ve=!1,xe=!1,Tt=!0,Pn=!1;const st="user-content-";let Ee=!0,Ft=!1,bt=null,Ye=!1,yt=null;const Vt=ce({},["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 sn=null;const Pe=ce({},["audio","video","img","source","image","track"]);let Le=null;const Rn=ce({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dn="http://www.w3.org/1998/Math/MathML",ae="http://www.w3.org/2000/svg",ue="http://www.w3.org/1999/xhtml";let lt=ue,ct=!1,oo=null;const Fl=ce({},[Dn,ae,ue],el),zl=ze(ce({},["mi","mo","mn","ms","mtext"]));let Bl=null;const xE=ze(ce({},["annotation-xml"]));let Hl=null;const EE=ze(nn(null)),SE=ce({},["title","style","font","a","script"]);let io=null;const _E=["application/xhtml+xml","text/html"],ME="text/html";let Ce=null,Xi=null;const TE=n.createElement("form"),gg=function(y){return y instanceof RegExp||y instanceof Function},Ul=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(!y||typeof y!="object")&&(y={}),y=Di(y),io=_E.indexOf(y.PARSER_MEDIA_TYPE)===-1?ME:y.PARSER_MEDIA_TYPE,Ce=io==="application/xhtml+xml"?el:Mn,ge=rn(y,"ALLOWED_TAGS",Mt,{transform:Ce}),M=rn(y,"ALLOWED_ATTR",H,{transform:Ce}),oo=rn(y,"ALLOWED_NAMESPACES",Fl,{transform:el}),Le=rn(y,"ADD_URI_SAFE_ATTR",Rn,{transform:Ce,base:Rn}),sn=rn(y,"ADD_DATA_URI_TAGS",Pe,{transform:Ce,base:Pe}),yt=rn(y,"FORBID_CONTENTS",Vt,{transform:Ce}),q=rn(y,"FORBID_TAGS",nn(null),{transform:Ce}),U=rn(y,"FORBID_ATTR",nn(null),{transform:Ce}),Ye=je(y,"USE_PROFILES")?y.USE_PROFILES&&typeof y.USE_PROFILES=="object"?Di(y.USE_PROFILES):y.USE_PROFILES:!1,ee=y.ALLOW_ARIA_ATTR!==!1,_=y.ALLOW_DATA_ATTR!==!1,G=y.ALLOW_UNKNOWN_PROTOCOLS||!1,K=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Z=y.SAFE_FOR_TEMPLATES||!1,oe=y.SAFE_FOR_XML!==!1,be=y.WHOLE_DOCUMENT||!1,at=y.RETURN_DOM||!1,ve=y.RETURN_DOM_FRAGMENT||!1,xe=y.RETURN_TRUSTED_TYPE||!1,Ne=y.FORCE_BODY||!1,Tt=y.SANITIZE_DOM!==!1,Pn=y.SANITIZE_NAMED_PROPS||!1,Ee=y.KEEP_CONTENT!==!1,Ft=y.IN_PLACE||!1,nr=tw(y.ALLOWED_URI_REGEXP)?y.ALLOWED_URI_REGEXP:lh,lt=typeof y.NAMESPACE=="string"?y.NAMESPACE:ue,Bl=sl(y,"MATHML_TEXT_INTEGRATION_POINTS",zl),Hl=sl(y,"HTML_INTEGRATION_POINTS",xE);const x=sl(y,"CUSTOM_ELEMENT_HANDLING",EE);if(B=nn(null),je(x,"tagNameCheck")&&gg(x.tagNameCheck)&&(B.tagNameCheck=x.tagNameCheck),je(x,"attributeNameCheck")&&gg(x.attributeNameCheck)&&(B.attributeNameCheck=x.attributeNameCheck),je(x,"allowCustomizedBuiltInElements")&&typeof x.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=x.allowCustomizedBuiltInElements),Oe(B),Z&&(_=!1),ve&&(at=!0),Ye&&((je(y,"ALLOWED_TAGS")||je(y,"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."),ge=ce({},ih),M=nn(null),Ye.html===!0&&(ce(ge,oh),ce(M,ah)),Ye.svg===!0&&(ce(ge,nl),ce(M,il),ce(M,$i)),Ye.svgFilters===!0&&(ce(ge,rl),ce(M,il),ce(M,$i)),Ye.mathMl===!0&&(ce(ge,ol),ce(M,sh),ce(M,$i))),V.tagCheck=null,V.attributeCheck=null,je(y,"ADD_TAGS")&&(typeof y.ADD_TAGS=="function"?V.tagCheck=y.ADD_TAGS:Zn(y.ADD_TAGS)&&(ge===Mt&&(ge=Yr(ge)),ce(ge,y.ADD_TAGS,Ce))),je(y,"ADD_ATTR")&&(typeof y.ADD_ATTR=="function"?V.attributeCheck=y.ADD_ATTR:Zn(y.ADD_ATTR)&&(M===H&&(M=Yr(M)),ce(M,y.ADD_ATTR,Ce))),je(y,"ADD_FORBID_CONTENTS")&&Zn(y.ADD_FORBID_CONTENTS)&&(yt===Vt&&(yt=Yr(yt)),ce(yt,y.ADD_FORBID_CONTENTS,Ce)),Ee&&(ge["#text"]=!0),be&&ce(ge,["html","head","body"]),ge.table&&(ge.tbody=!0,delete q.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const A=S;S=y.TRUSTED_TYPES_POLICY;try{$=pe("")}catch(F){throw S=A,F}}else y.TRUSTED_TYPES_POLICY===null?(S=void 0,$=""):(S===void 0&&(S=Te()),S&&typeof $=="string"&&($=pe("")));Xi=ze(y)},mg=ce({},[...nl,...rl,...nw]),bg=ce({},[...ol,...rw]),kE=function(y,x,A){return x===ue?y==="svg":x===Dn?y==="svg"&&(A==="annotation-xml"||Bl[A]):!!mg[y]},CE=function(y,x,A){return x===ue?y==="math":x===ae?y==="math"&&Hl[A]:!!bg[y]},AE=function(y,x,A){return x===ae&&!Hl[A]||x===Dn&&!Bl[A]?!1:!bg[y]&&(SE[y]||!mg[y])},OE=function(y){const x=I(y),A=Mn(O(y)),F=v(y);let j=lt,X="template";return F&&P(F)===Me.element&&(j=I(F),X=Mn(O(F))),oo[x]?x===ae?kE(A,j,X):x===Dn?CE(A,j,X):x===ue?AE(A,j,X):io==="application/xhtml+xml":!1},ln=function(y){jr(t.removed,{element:y});try{v(y).removeChild(y)}catch{if(f(y),!v(y))throw Ut("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},yg=function(y,x,A){try{g(y,x)}catch{try{y.removeAttribute(A)}catch{}}},ql=function(y){Gl(y);const x=b(y);x&&Ht(jv(x),A=>{try{f(A)}catch{}}),P(y)===Me.element&&Wl(y,!1)},rr=function(y,x,A){if(!A)try{A=x.getAttributeNode(y)}catch{A=null}if(jr(t.removed,{attribute:A||null,from:x}),A)yg(x,A,y);else try{x.removeAttribute(y)}catch{}if(y==="is")if(at||ve)try{ln(x)}catch{}else try{x.setAttribute(y,"")}catch{}},Wl=function(y,x){const A=E(y);if(A)for(let F=A.length-1;F>=0;--F){const j=A[F],X=j&&j.name;typeof X=="string"&&!(x&&M[Ce(X)])&&yg(y,j,X)}},jl=function(y,x){let A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const F=[y];for(;F.length>0;){const j=F.pop();if(x(j)===!1)continue;if(A&&P(j)===Me.element){const re=w(j);or(re)&&F.push(re)}const X=b(j);if(X)for(let re=X.length-1;re>=0;--re)F.push(X[re])}},Gl=function(y){jl(y,x=>{P(x)===Me.element&&Wl(x,!0)})},Vl=function(y){const x=[];return jl(y,A=>{x.push(A)},!0),x},IE=function(y,x){const A=Js();Ht(Vl(y),F=>{P(F)===Me.element&&Qs(A,F)}),Ht(x,F=>{P(F)===Me.element&&!Gr(A,F)&&Wl(F,!0)})},vg=function(y,x){let A=!1;return Ht(t.removed,F=>{F.element&&(A=A||F.element===y,Gl(F.element))}),IE(y,x),A},PE=8,RE=function(y,x){const A=bt;let F=null;const j=()=>(F||(F=Js(),Ht(x,X=>{Qs(F,X)})),F);for(let X=0;;X++){const re=Vl(y),Fe=[y];let Yt=!1;if(Ht(re,Ct=>{P(Ct)===Me.documentFragment?jr(Fe,Ct):!Yt&&!Gr(A,Ct)&&(Yt=Gr(j(),Ct))}),!Yt)return;if(X>=PE)throw Ut("the tree kept changing during in-place sanitization; refusing to return it");Ht(Fe,(Ct,dt)=>{DE(Ct,dt>0,y,j())})}},DE=function(y,x,A,F){const j=Zi(y);let X;for(;X=j.nextNode();)!Gr(F,X)||Gr(bt,X)||(x&&kt(te.uponSanitizeShadowNode,X,null),Zl(X,A))},$E=function(y){bt&&Qs(bt,y)},wg=function(y,x){return oe?y==="patchsrc"?!0:y==="for"&&x!=="label"&&x!=="output":!1},NE=function(y){oe&&jl(y,x=>{const A=P(x);if(A===Me.processingInstruction||A===Me.comment&&Be(ch,x.data)){try{f(x)}catch{}return!1}if(A===Me.element){const F=x,j=Ce(O(x));try{F.hasAttribute&&F.hasAttribute("patchsrc")&&F.removeAttribute("patchsrc"),F.hasAttribute&&F.hasAttribute("for")&&wg("for",j)&&F.removeAttribute("for")}catch{}}return!0})},xg=function(y){let x=null,A=null;if(Ne)y="<remove></remove>"+y;else{const X=Vv(y,mw);A=X&&X[0]}io==="application/xhtml+xml"&<===ue&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const F=S?pe(y):y;if(lt===ue)try{x=new s().parseFromString(F,io)}catch{}if(!x||!x.documentElement){x=de.createDocument(lt,"template",null);try{x.documentElement.innerHTML=ct?$:F}catch{}}const j=x.body||x.documentElement;return y&&A&&j.insertBefore(n.createTextNode(A),j.childNodes[0]||null),lt===ue?De.call(x,be?"html":"body")[0]:be?x.documentElement:j},Zi=function(y){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const A=R?R(y):y.ownerDocument;return ye.call(A||y,y,(x?0:c.SHOW_ELEMENT)|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Yl=function(y){return y=Ri(y,Ve," "),y=Ri(y,$e," "),y=Ri(y,fe," "),y},Kl=function(y){var x;Xl(y);const A=(x=y.querySelectorAll)===null||x===void 0?void 0:x.call(y,"template");A&&Ht(A,F=>{or(F.content)&&Kl(F.content)})},Xl=function(y){y.normalize();const x=Zi(y,!0);let A=x.nextNode();for(;A;)A.data=Yl(A.data),A=x.nextNode()},Ji=function(y){const x=L?L(y):null;return typeof x!="string"||Ce(x)!=="form"?!1:typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||y.attributes!==E(y)||typeof y.removeAttribute!="function"||typeof y.removeAttributeNode!="function"||typeof y.getAttributeNode!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function"||y.nodeType!==k(y)||y.childNodes!==b(y)},Eg=function(y){if(!k||typeof y!="object"||y===null)return null;try{const x=k(y);return typeof x=="number"?x:null}catch{return null}},or=function(y){return Eg(y)===Me.documentFragment},ao=function(y){return Eg(y)!==null};function kt(D,y,x){D.length!==0&&Ht(D,A=>{A.call(t,y,x,Xi)})}const LE=function(y,x,A){return!!(oe&&A===Me.element&&y.hasChildNodes()&&!ao(y.firstElementChild)&&Be(al,y.textContent)&&Be(al,y.innerHTML)||oe&&bw[x]&&A===Me.element&&I(y)===ue&&(ao(y.firstElementChild)||typeof y.textContent=="string"&&Be(al,y.textContent))||A===Me.processingInstruction||oe&&A===Me.comment&&Be(ch,y.data))},Qi=function(y,x){if(y instanceof RegExp)return Be(y,x);if(y instanceof Function){for(var A=arguments.length,F=new Array(A>2?A-2:0),j=2;j<A;j++)F[j-2]=arguments[j];return!!y(x,...F)}return!1},FE=function(y,x,A){if(!q[x]&&Mg(x)&&Qi(B.tagNameCheck,x))return!1;if(Ee&&!yt[x]&&!yt[Mn(x)]){const F=v(y),j=b(y);if(j&&F){const X=j.length;for(let re=X-1;re>=0;--re){const Fe=y===A?u(j[re],!0):j[re];F.insertBefore(Fe,m(y))}}}return ln(y),!0},Sg=function(y,x,A,F){return y.length===0?x:x===A||x===F?Yr(x):x},ir=function(y,x){return y===x||v(y)!==null?!1:(Ft&&Gl(y),!0)},zE=function(y,x){if($E(y),kt(te.beforeSanitizeElements,y,null),ir(y,x))return!0;if(Ji(y))return ln(y),!0;const A=Ce(O(y)),F=P(y);if(ge=Sg(te.uponSanitizeElement,ge,Mt,Ue),kt(te.uponSanitizeElement,y,{tagName:A,allowedTags:ge}),ir(y,x))return!0;if(LE(y,A,F))return ln(y),!0;if(q[A]||!(V.tagCheck instanceof Function&&V.tagCheck(A))&&!ge[A]){const j=FE(y,A,x);return j===!1&&(kt(te.afterSanitizeElements,y,null),ir(y,x))?!0:j}if(F===Me.element&&!OE(y)||(A==="noscript"||A==="noembed"||A==="noframes")&&Be(hw,y.innerHTML))return ln(y),!0;if(Z&&F===Me.text){const j=y.textContent,X=Yl(j);j!==X&&(jr(t.removed,{element:y.cloneNode()}),y.textContent=X)}return kt(te.afterSanitizeElements,y,null),ir(y,x)},_g=function(y,x,A){if(U[x]||wg(x,y)||Tt&&(x==="id"||x==="name")&&(A in n||A in TE))return!1;const F=M[x]||V.attributeCheck instanceof Function&&V.attributeCheck(x,y);if(_&&Be(me,x)||ee&&Be(tr,x))return!0;if(!F)return Mg(y)&&Qi(B.tagNameCheck,y)&&Qi(B.attributeNameCheck,x,y)||x==="is"&&B.allowCustomizedBuiltInElements&&Qi(B.tagNameCheck,A);if(Le[x])return!0;const j=Ri(A,no,"");return Be(nr,j)||(x==="src"||x==="xlink:href"||x==="href")&&y!=="script"&&tl(A,"data:")===0&&sn[y]||G&&!Be(to,j)?!0:!A},BE=ce({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Mg=function(y){return!BE[Mn(y)]&&Be(ro,y)},HE=function(y,x,A,F){if(S&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!A)switch(d.getAttributeType(y,x)){case"TrustedHTML":return pe(F);case"TrustedScriptURL":return Q(F)}return F},UE=function(y,x,A,F){try{return A?y.setAttributeNS(A,x,F):y.setAttribute(x,F),Ji(y)?(ln(y),!1):!0}catch{return rr(x,y),!1}},Tg=function(y,x){return oe&&Be(gw,x)?!0:Mn(y)==="attributename"&&tl(x,"href")!==-1},qE=function(y,x){if(kt(te.beforeSanitizeAttributes,y,null),ir(y,x))return;const A=y.attributes;if(!A||Ji(y))return;M=Sg(te.uponSanitizeAttribute,M,H,Je);const F={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0};let j=A.length;const X=Ce(O(y));for(;j--;){const re=A[j],Fe=re.name,Yt=re.namespaceURI,Ct=re.value,dt=Ce(Fe),zt=Ct;let qe=Fe==="value"?zt:Yv(zt),kg=!1;if(F.attrName=dt,F.attrValue=qe,F.keepAttr=!0,F.forceKeepAttr=void 0,kt(te.uponSanitizeAttribute,y,F),qe=F.attrValue,Pn&&(dt==="id"||dt==="name")&&tl(qe,st)!==0&&(rr(Fe,y,re),qe=st+qe,kg=!0),Tg(Fe,qe)){rr(Fe,y,re);continue}if(!F.forceKeepAttr){if(!F.keepAttr){rr(Fe,y,re);continue}if(!K&&Be(dh,qe)){rr(Fe,y,re);continue}if(Z&&(qe=Yl(qe)),!_g(X,dt,qe)){rr(Fe,y,re);continue}qe=HE(X,dt,Yt,qe),qe!==zt&&UE(y,Fe,Yt,qe)&&kg&&eh(t.removed)}}kt(te.afterSanitizeAttributes,y,null),ir(y,x)},Zl=function(y,x){zE(y,x),qE(y,x),or(y.content)&&Jl(y.content)},Jl=function(y){let x=null;const A=Zi(y);for(kt(te.beforeSanitizeShadowDOM,y,null);x=A.nextNode();)if(kt(te.uponSanitizeShadowNode,x,null),Zl(x,y),P(x)===Me.element){const F=w(x);or(F)&&(Ql(F),Jl(F))}Z&&Xl(y),kt(te.afterSanitizeShadowDOM,y,null)},Ql=function(y){const x=[{node:y,shadow:null}];for(;x.length>0;){const A=x.pop();if(A.shadow){Jl(A.shadow);continue}const F=A.node,j=P(F)===Me.element,X=b(F);if(X)for(let re=X.length-1;re>=0;--re)x.push({node:X[re],shadow:null});if(j){const re=L?L(F):null;if(typeof re=="string"&&Ce(re)==="template"){const Fe=F.content;or(Fe)&&x.push({node:Fe,shadow:null})}}if(j){const re=w(F);or(re)&&x.push({node:null,shadow:re},{node:re,shadow:null})}}};return t.sanitize=function(D){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,A=null,F=null,j=null;if(ct=!D,ct&&(D="<!-->"),typeof D!="string"&&!ao(D)&&(D=Qv(D),typeof D!="string"))throw Ut("dirty is not a string, aborting");if(!t.isSupported)return D;ke?(ge=Ue,M=Je):Ul(y),t.removed=[];const X=Ft&&typeof D!="string"&&ao(D);let re=[];const Fe=bt;if(X){NE(D);const zt=O(D);if(typeof zt=="string"){const qe=Ce(zt);if(!ge[qe]||q[qe])throw ql(D),Ut("root node is forbidden and cannot be sanitized in-place")}if(Ji(D))throw ql(D),Ut("root node is clobbered and cannot be sanitized in-place");re=Vl(D),bt=Js()}else if(ao(D))x=xg("<!---->"),A=x.ownerDocument.importNode(D,!0),A.nodeType===Me.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?x=A:x.appendChild(A),Ql(x);else{if(!at&&!Z&&!be&&D.indexOf("<")===-1)return Ge(D);if(x=xg(D),!x)return at?null:xe?$:""}x&&Ne&&ln(x.firstChild);const Yt=X?D:x;try{X&&Ql(D);const zt=Zi(Yt);for(;F=zt.nextNode();)Zl(F,Yt);X&&RE(D,re)}catch(zt){throw X&&(ql(D),vg(D,re)),zt}finally{bt=Fe}if(X){if(vg(D,re))throw Ut("a node selected for removal could not be safely returned; refusing to sanitize in place");return Z&&Kl(D),D}if(at){if(Z&&Kl(x),ve)for(j=ne.call(x.ownerDocument);x.firstChild;)j.appendChild(x.firstChild);else j=x;return(M.shadowroot||M.shadowrootmode)&&(j=it.call(r,j,!0)),j}const Ct=()=>be?x.outerHTML:x.innerHTML;let dt=Ct();return Z&&Be(sw,dt)&&(Xl(x),dt=Ct()),be&&ge["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Be(pw,x.ownerDocument.doctype.name)&&(dt="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
272
|
+
`+dt),Ge(dt)},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ul(D),ke=!0,Ue=ge,Je=M},t.clearConfig=function(){Xi=null,ke=!1,Ue=null,Je=null,S=N,$=""},t.isValidAttribute=function(D,y,x){Xi||Ul({});const A=Ce(D),F=Ce(y);return typeof x=="string"&&(Tg(y,x)||!K&&Be(dh,x))?!1:_g(A,F,x)},t.addHook=function(D,y){typeof y=="function"&&je(te,D)&&jr(te[D],y)},t.removeHook=function(D,y){if(je(te,D)){if(y!==void 0){const x=Wv(te[D],y);return x===-1?void 0:Gv(te[D],x,1)[0]}return eh(te[D])}},t.removeHooks=function(D){je(te,D)&&(te[D]=[])},t.removeAllHooks=function(){te=uh()},t}var ww=ph();const xw={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function Ew(e,t){const n=e.options;return ds(n.formatter,t,String(n.testData||n.title||""))||"1234567890128"}function Sw(e){return h("div",{class:"print-qrcode",dataset:{codeId:e.id,codeKind:"qrcode"}})}function _w(e){const t=e.options;return h("div",{class:"print-barcode",dataset:{codeId:e.id,codeKind:"barcode"}},[h("svg",{preserveAspectRatio:xw[String(t.fit||"contain")]??"xMidYMid meet",style:{maxWidth:"100%",maxHeight:"100%"}})])}function Mw(e){const t=(e.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(n=>!Number.isFinite(n))?null:{width:t[2],height:t[3]}}function Tw(e,t,n){const r=e.options,o=fr(r.barWidth),i=ua(r.barQuietZone),a=l=>{ps(t,Ew(e,n),{format:String(r.barcodeType||"CODE128"),width:o,height:l*o,displayValue:!r.hideTitle,fontSize:(r.fontSize??ho)*o,margin:0,marginLeft:i*o,marginRight:i*o,marginTop:0,marginBottom:pa*o});const c=Mw(t);return c?{widthUnits:c.width,heightUnits:c.height}:null};try{const l=ha({barHeightMm:r.barHeight,boxWidthMm:Ln(r.width,r.maxWidth),boxHeightMm:Ln(r.height,r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth,measure:a});t.style.width=l.size?`${l.size.widthMm}mm`:"",t.style.height=l.size?`${l.size.heightMm}mm`:""}catch{t.replaceChildren();return}t.setAttribute("shape-rendering","crispEdges")}function kw(e,t,n){const r=e.options,o=ds(r.formatter,n,String(r.testData||r.title||""))||"二维码";t.replaceChildren();try{const i=Ls.render(o,"qrcode",{qrCodeLevel:String(r.qrCodeLevel??"M"),qrQuietZone:typeof r.qrQuietZone=="number"?r.qrQuietZone:void 0}),a=document.createElement("img");a.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`,a.alt="qrcode",a.style.width="100%",a.style.height="100%",a.style.objectFit=String(r.fit||"contain"),a.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",a.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%",t.appendChild(a)}catch{}}function Cw(e,t,n){for(const r of Array.from(e.querySelectorAll("[data-code-kind]"))){const o=r.dataset.codeId,i=t.find(a=>a.id===o);if(i)if(r.dataset.codeKind==="barcode"){const a=r.querySelector("svg");a&&Tw(i,a,n)}else kw(i,r,n)}}const Ni=new Map;function Aw(e){return typeof Node<"u"&&e instanceof Node}function fh(e,t,n){if(hh(e),typeof t=="string"){n.innerHTML=t;return}if(Aw(t)){n.appendChild(t);return}typeof t.node=="string"?n.innerHTML=t.node:n.appendChild(t.node),typeof t.dispose=="function"&&Ni.set(e,t.dispose)}function hh(e){const t=Ni.get(e);if(t){Ni.delete(e);try{t()}catch{}}}function gh(){for(const e of[...Ni.keys()])hh(e)}const Ow={header:"题",data:"数",subtotal:"小",summary:"汇"},Iw=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行"},{value:"summary",label:"汇总行"}],Li=3.7795275591,Pw=.1,ll=e=>JSON.parse(JSON.stringify(e)),mh=new WeakMap;function qt(e){let t=mh.get(e);return t||(t={menu:null,menuElId:null,anchor:null,layouts:new Map},mh.set(e,t)),t}function Kr(e,t){return e.templateData.elements.find(n=>n.id===t)??null}function Rw(e,t){const n=e.tableSelection;return!n||n.elementId!==t.id?null:e.selectedElement?.id!==t.id?(e.tableSelection=null,null):n}function bh(e,t,n,r){const o=Kr(e,n.id);if(!o)return null;const i=n.options;return{store:e,fire:t,el:n,real:o,options:i,rows:i.tableRows??[],colWidths:i.tableColWidths??[],isSelected:e.selectedIds.has(n.id),selection:Rw(e,n),maxTableWidth:yh(e),designData:r}}function yh(e){return e.paperSize.width-e.templateData.margins.left-e.templateData.margins.right}function cl(e){return e.options.tableDefaultFontSize??10}function vh(e){return e.options.tableDefaultColor??"#333333"}function Dw(e,t){let n=0;for(let r=0;r<t;r++)n+=e.rows[r].height;return n}function $w(e,t){return qt(e.store).layouts.get(e.el.id)?.[t]?.top??Dw(e,t)}function Nw(e,t){return qt(e.store).layouts.get(e.el.id)?.[t]?.height??e.rows[t]?.height??0}function Lw(e){const t=e.options.dataSource;if(t&&Array.isArray(gt[t]))return gt[t];for(const n of Object.values(gt))if(Array.isArray(n))return n}function wh(e){return e.cellType==="barcode"||e.cellType==="qrcode"}function xh(e,t){return wh(t)?ds(t.formatter,Lw(e)):t.formatter||""}function Fw(e,t){const n={designMode:!0,showGhostBorder:e.store.showTableGhostBorder};return{fontFamily:Ya(t.fontFamily??e.options.tableDefaultFontFamily),textAlign:t.align??"left",...t.align==="justify"?{textAlignLast:"justify"}:{},verticalAlign:t.valign??"middle",fontSize:(t.fontSize??cl(e))+"pt",fontWeight:t.fontWeight??"normal",color:t.color??vh(e),backgroundColor:t.backgroundColor??"transparent",borderTop:co(t.borders?.top,n),borderRight:co(t.borders?.right,n),borderBottom:co(t.borders?.bottom,n),borderLeft:co(t.borders?.left,n),padding:(t.padding??e.options.tableDefaultPadding??1)+"mm",whiteSpace:t.wordWrap??!0?"pre-wrap":"nowrap",overflow:t.wordWrap??!0?"visible":"hidden"}}function zw(e,t,n){const r=e.selection;return[!!r&&t>=r.r1&&t<=r.r2&&n>=r.c1&&n<=r.c2?"cell-selected":"",e.rows[t]?.type==="data"?"row-data-bg":""].filter(Boolean).join(" ")}function Eh(e){return aa(e)}function Bw(e){return Eh(e)!=="autoHeight"}function Hw(e,t){return t.fontSize??cl(e)}function Fi(e,t,n){return ur(e.rows,t,n,e.options.tableDefaultPadding??1)}function Uw(e,t,n){return la(e.colWidths,t,n,e.options.tableDefaultPadding??1)}function qw(e,t,n){return{maxHeight:Fi(e,n,t)+"mm",overflow:"hidden",...t.wordWrap===!1?{whiteSpace:"nowrap",textOverflow:"ellipsis"}:{}}}function Ww(e,t,n){const r={fitBase:String(Hw(e,t)),fitMin:String(dr(t.shrinkMinFontSize)),fitMm:String(Fi(e,n,t))};return Eh(t)==="shrink"&&(r.fit="shrink"),r}function jw(e){const t=(e.getAttribute("viewBox")??"").trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(n=>!Number.isFinite(n))?null:{width:t[2],height:t[3]}}const Gw={contain:"xMidYMid meet",cover:"xMidYMid slice",fill:"none",none:"xMidYMid meet","scale-down":"xMidYMid meet"};function Vw(e,t,n,r){const o=document.createElement("div");o.className="cell-barcode";const i=document.createElementNS(_v,"svg");o.appendChild(i);const a=xh(e,r);if(r.cellType==="barcode"){i.setAttribute("preserveAspectRatio",Gw[r.fit||"contain"]??"xMidYMid meet");const l=fr(r.barWidth),c=ua(r.barQuietZone),s=u=>{ps(i,a,{format:r.barcodeType||"CODE128",width:l,height:u*l,displayValue:r.showBarcodeText!==!1,fontSize:(r.barFontSize??ho)*l,margin:0,marginLeft:c*l,marginRight:c*l,marginTop:0,marginBottom:pa*l});const f=jw(i);return f?{widthUnits:f.width,heightUnits:f.height}:null};let d=null;try{d=ha({barHeightMm:r.barHeight,boxWidthMm:Ln(Uw(e,n,r),r.maxWidth),boxHeightMm:Ln(Fi(e,t,r),r.maxHeight),dpi:r.printerDpi,barWidth:r.barWidth,measure:s})}catch{d=null}if(!d){i.style.display="none";const u=document.createElement("span");return u.className="cell-barcode-fallback",u.textContent=a||"条码",o.appendChild(u),o}const p=d.size;return p?(i.style.width=`${p.widthMm}mm`,i.style.height=`${p.heightMm}mm`):(i.style.maxWidth=r.maxWidth?`${r.maxWidth}mm`:"100%",i.style.maxHeight=r.maxHeight?`${r.maxHeight}mm`:"100%"),i.setAttribute("shape-rendering","crispEdges"),o}if(i.style.display="none",!a)return o;try{const l=Ls.render(a,"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(l)}`),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%",o.appendChild(c)}catch{}return o}function Sh(){const e=document.createElement("div");return e.className="image-placeholder",e.textContent="图片",e}function Yw(e,t){const n=e.formatter||"";if(!n)return"";if(!n.includes("{"))return n;const r=t.designData?.length?t.designData[0]:gt;return Wn(n,r)}function Kw(e,t,n){const r=document.createElement("div");r.className="cell-image";const o=wc(n.fit,Fi(e,t,n));o!==void 0&&(r.style.height=`${o}mm`);const i=Yw(n,e);if(!i)return r.appendChild(Sh()),r;const a=document.createElement("img");a.setAttribute("src",i),o!==void 0&&(a.style.width="100%",a.style.height="100%"),a.style.objectFit=n.fit||"contain";for(const[l,c]of Object.entries(ga(n.fit,n.fitScale,n.objectPosition)))a.style[l]=c;return a.style.maxWidth=n.maxWidth?`${n.maxWidth}mm`:"100%",a.style.maxHeight=n.maxHeight?`${n.maxHeight}mm`:"100%",a.addEventListener("error",()=>{a.remove(),r.appendChild(Sh())},{once:!0}),r.appendChild(a),r}function Xw(e,t,n,r,o){if(wh(o))return Vw(e,n,r,o);if(o.cellType==="image")return Kw(e,n,o);const i=xh(e,o),a=()=>t.type==="data"?h("span",{class:"data-placeholder",text:i}):i;return Bw(o)?h("div",{class:"cell-fit",style:qw(e,o,n),dataset:Ww(e,o,n)},[a()]):a()}function zi(e,t,n){const r={elementId:e.el.id,...ec(e.rows,t,n)};e.store.setTableSelection(r),e.fire("table-selection-change",{elementId:e.el.id,selection:r})}function Zw(e,t,n,r,o){if(o.button!==0||(e.fire("table-cell-mousedown",{elementId:e.el.id,r:t,c:n,cellId:r,event:o}),!e.isSelected))return;o.stopPropagation();const i=qt(e.store);o.shiftKey&&e.selection?zi(e,{r:e.selection.r1,c:e.selection.c1},{r:t,c:n}):(i.anchor={r:t,c:n},zi(e,{r:t,c:n},{r:t,c:n})),document.addEventListener("mouseup",()=>{qt(e.store).anchor=null},{once:!0})}function Jw(e,t,n){const r=qt(e.store).anchor;r&&zi(e,r,{r:t,c:n})}function dl(e,t){const n=qt(e);n.menu?.visible&&(n.menu.visible=!1,t("table-menu-close",{elementId:n.menuElId}),e.emit(!1))}function Qw(e,t,n,r){r.preventDefault(),r.stopPropagation(),e.isSelected||e.store.selectOne(e.el.id);const o=e.selection;o&&t>=o.r1&&t<=o.r2&&n>=o.c1&&n<=o.c2||zi(e,{r:t,c:n},{r:t,c:n});const a=qt(e.store);a.menuElId=e.el.id,a.menu&&(a.menu.x=r.clientX,a.menu.y=r.clientY,a.menu.visible=!0),e.fire("table-cell-contextmenu",{elementId:e.el.id,r:t,c:n,clientX:r.clientX,clientY:r.clientY}),e.store.emit(!1),document.addEventListener("mousedown",()=>dl(e.store,e.fire),{once:!0})}function _h(e,t,n){const r=e.reduce((o,i)=>o+i,0)+(e[t]??0);return r>n?`插入后表格总宽 ${Math.round(r*10)/10}mm 超过打印范围宽度 ${n}mm,请先缩小列宽`:null}function ex(e,t){const n=e.real.options.tableRows??[],r=e.real.options.tableColWidths??[],o=t(ll(n),ll(r));return o?(window.alert(o),!1):(e.store.recordHistory(),t(n,r),e.store.setTableSelection(null),sr(e.real.options),e.store.emit(),!0)}function Wt(e,t,n){dl(e.store,e.fire);const r=e.selection;if(!r)return;let o=null;switch(t){case"insert-row-above":o=i=>(oc(i,r.r1,"above"),null);break;case"insert-row-below":o=i=>(oc(i,r.r2,"below"),null);break;case"delete-row":o=i=>Rg(i,r.r1);break;case"insert-col-left":o=(i,a)=>{const l=_h(a,r.c1,e.maxTableWidth);return l||(ic(i,a,r.c1,"left"),null)};break;case"insert-col-right":o=(i,a)=>{const l=_h(a,r.c2,e.maxTableWidth);return l||(ic(i,a,r.c2,"right"),null)};break;case"delete-col":o=(i,a)=>Dg(i,a,r.c1);break;case"merge":o=i=>(nc(i,r),null);break;case"split":o=i=>(rc(i,r),null);break;case"set-row-type":o=i=>n?na(i,r.r1,n):"未指定行类型";break}o&&ex(e,o)&&e.fire(`table-${t}`,{elementId:e.el.id,...n?{type:n}:{}})}function tx(e){const t=e.selection;if(!t)return!1;for(let n=t.r1;n<=t.r2;n++)for(let r=t.c1;r<=t.c2;r++){const o=e.rows[n]?.cells[r];if(o&&!o.merged&&((o.rowspan??1)>1||(o.colspan??1)>1))return!0}return!1}function nx(e){const t=e.selection;if(!t)return;const n=ar(e.rows,t.r1,t.c1),r=!e.rows[n.r]?.cells[n.c]?.mergeSameValue;for(let o=t.r1;o<=t.r2;o++)for(let i=t.c1;i<=t.c2;i++){const a=e.rows[o]?.cells[i];a&&!a.merged&&(a.mergeSameValue=r)}e.store.updateElement(e.el.id,{tableRows:e.rows}),dl(e.store,e.fire)}function Mh(e){const t=e.selection;if(!t)return"未选择单元格";for(let n=t.r1;n<=t.r2;n++)if(e.rows[n]?.type!=="data")return"仅数据行(明细行)支持按值合并";return null}function Th(e,t){const n=e.selection;return n?n.r1!==n.r2?"行类型仅支持单行设置":na(ll(e.rows),n.r1,t):"未选择单元格"}function Dt(e,t,n={}){return h("div",{class:`menu-item${n.disabled?" disabled":""}${n.active?" active":""}`,title:n.title||"",text:e,onClick:()=>{n.disabled||t()}})}const ul=()=>h("div",{class:"menu-divider"});function rx(e,t,n){const r=qt(e);if(r.menu=n,!n.visible||!r.menuElId)return"";const o=Kr(e,r.menuElId);if(!o||o.printElementType.type!=="table")return"";const i=bh(e,t,o);if(!i)return"";const a=i.selection?tc(i.rows,i.selection):"未选择单元格",l=i.selection?i.rows[i.selection.r1]?.type??null:null;return h("div",{class:"table-ctx-menu",style:{left:n.x+"px",top:n.y+"px"},onMousedown:c=>c.stopPropagation()},[Dt("在上方插入行",()=>Wt(i,"insert-row-above")),Dt("在下方插入行",()=>Wt(i,"insert-row-below")),Dt("删除行",()=>Wt(i,"delete-row"),{disabled:i.rows.length<=1}),ul(),Dt("在左侧插入列",()=>Wt(i,"insert-col-left")),Dt("在右侧插入列",()=>Wt(i,"insert-col-right")),Dt("删除列",()=>Wt(i,"delete-col"),{disabled:i.colWidths.length<=1}),ul(),Dt("合并单元格",()=>Wt(i,"merge"),{disabled:!!a,title:a||""}),Dt("拆分单元格",()=>Wt(i,"split"),{disabled:!tx(i)}),Dt("按值合并",()=>nx(i),{disabled:!!Mh(i),title:Mh(i)||"",active:(()=>{const c=i.selection;if(!c)return!1;const s=ar(i.rows,c.r1,c.c1);return i.rows[s.r]?.cells[s.c]?.mergeSameValue===!0})()}),ul(),h("div",{class:"menu-group-title",text:"行类型"}),...Iw.map(c=>Dt(c.label,()=>Wt(i,"set-row-type",c.value),{disabled:!!Th(i,c.value),title:Th(i,c.value)||"",active:l===c.value}))])}let Tn=null;function kh(){Tn&&(document.removeEventListener("mousemove",pl),document.removeEventListener("mouseup",fl),Tn.handle.classList.remove("dragging"),Tn=null)}function ox(e,t){const n=e.closest(".hiprint-printPaper");return(n&&n.offsetWidth>0?n.getBoundingClientRect().width/n.offsetWidth:0)||(t.scale||100)/100}function ix(e,t,n){if(n.button!==0)return;const r=n.currentTarget,o=r.closest(".print-table");if(!o)return;kh();const i=e.real.options.tableColWidths??[];Tn={store:e.store,fire:e.fire,elId:e.real.id,boundary:t,startX:n.clientX,startWidth:i[t-1]??0,scale:ox(o,e.store),root:o,wrapper:r.closest(".print-element"),handle:r},r.classList.add("dragging"),e.store.recordHistory(),document.addEventListener("mousemove",pl),document.addEventListener("mouseup",fl)}function pl(e){const t=Tn;if(!t)return;const n=Kr(t.store,t.elId),r=n?.options.tableColWidths;if(!n||!r)return;const o=(e.clientX-t.startX)/(t.scale*Li),i=t.boundary-1;r[i]=Hg(r,i,t.startWidth+o,yh(t.store)),sr(n.options),r.forEach((a,l)=>{const c=t.root.querySelector(`colgroup col:nth-child(${l+1})`);c&&(c.style.width=`${a}mm`)}),t.root.querySelectorAll(".col-resize-handle").forEach((a,l)=>{a.style.left=`${r.slice(0,l+1).reduce((c,s)=>c+s,0)}mm`}),t.wrapper&&(t.wrapper.style.width=`${n.options.width}mm`,t.wrapper.style.height=`${n.options.height}mm`)}function fl(){document.removeEventListener("mousemove",pl),document.removeEventListener("mouseup",fl);const e=Tn;if(!e)return;Tn=null,e.handle.classList.remove("dragging");const t=Kr(e.store,e.elId);t&&sr(t.options),e.store.emit(),e.fire("table-col-resize-end",{elementId:e.elId})}function ax(e,t,n){const r=n.querySelector("table");if(!r)return;const o=r.offsetHeight;if(o<=0)return;const i=Kr(e,t);if(!i)return;let a=!1;const l=o/Li;Math.abs(l-(i.options.height??0))>Pw&&(i.options.height=Math.round(l*100)/100,a=!0);const c=r.offsetTop,s=Array.from(r.rows).map(p=>({top:(p.offsetTop-c)/Li,height:p.offsetHeight/Li})),d=qt(e);sx(d.layouts.get(t),s)||(d.layouts.set(t,s),a=!0),a&&e.emit(!1)}function sx(e,t){return!e||e.length!==t.length?!1:t.every((n,r)=>{const o=e[r];return Math.round(n.top*10)===Math.round(o.top*10)&&Math.round(n.height*10)===Math.round(o.height*10)})}function lx(e,t){const n=document.createComment("pd-table-measure");return requestAnimationFrame(()=>{if(!n.isConnected)return;const r=n.parentElement;r&&ax(e,t,r)}),n}function cx(e){return e.isSelected&&!e.real.options.locked&&e.colWidths.length>=1}function dx(e){return Array.from({length:e.colWidths.length},(t,n)=>n+1)}function ux(e,t){return e.colWidths.slice(0,t).reduce((n,r)=>n+r,0)}function px(e,t,n,r){const o=bh(t,n,e,r);if(!o)return h("div",{class:"print-table"});const i=[h("table",{style:{fontSize:`${cl(o)}pt`,color:vh(o)}},[h("colgroup",{},o.colWidths.map(a=>h("col",{style:{width:a+"mm"}}))),h("tbody",{},o.rows.map((a,l)=>h("tr",{style:{height:a.height+"mm"}},a.cells.map((c,s)=>c.merged?"":h("td",{rowspan:c.rowspan||1,colspan:c.colspan||1,class:zw(o,l,s),style:Fw(o,c),onMousedown:d=>Zw(o,l,s,c.id,d),onMouseenter:()=>Jw(o,l,s),onContextmenu:d=>Qw(o,l,s,d)},[Xw(o,a,l,s,c)])).filter(Boolean))))])];return cx(o)&&i.push(h("div",{class:"col-resize-layer"},dx(o).map(a=>h("div",{class:"col-resize-handle",role:"separator","aria-label":`列宽手柄${a}`,style:{left:ux(o,a)+"mm"},onMousedown:l=>{l.stopPropagation(),l.preventDefault(),ix(o,a,l)}})))),o.isSelected&&i.push(h("div",{class:"row-badges"},o.rows.map((a,l)=>h("span",{class:"row-badge",style:{top:$w(o,l)+"mm",height:Nw(o,l)+"mm"},text:Ow[a.type]})))),i.push(lx(t,e.id)),h("div",{class:"print-table design-mode",dataset:{tableId:e.id},onContextmenu:a=>a.preventDefault()},i)}const fx=["黄芪 20g","当归尾 15g","赤芍 10g","川芎 10g","地龙 10g","桃仁 10g","红花 10g"];function hl(e){return Array.isArray(e)&&e.length>0?e:[]}function hx(e,t){const n=fo(e,t)??(t?Object.keys(t).find(o=>Array.isArray(t[o])):void 0);if(n)return hl(t?.[n]);const r=fo(e,gt);return r?hl(gt[r]):[]}function gx(e,t){const n=e.options,r=typeof n.formatter=="string"?n.formatter:"",o=hl(t)[0],i=hx(r,o);if(i.length===0)return[...fx];if(!r)return i.map(c=>String(c?.name??JSON.stringify(c)));const a=o??{},l=fo(r,a)??Object.keys(a).find(c=>Array.isArray(a[c]));return i.map(c=>{try{return Wn(r,{...a,...c,...l?{[l]:c}:{}})}catch{return r}})}const mx=3.7795275591,bx=.1;function yx(e,t){return e.templateData.elements.find(n=>n.id===t)??null}function vx(e){const t=e.parentElement;if(!t?.classList.contains("print-element"))return 0;const n=getComputedStyle(t);return(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.borderBottomWidth)||0)}function wx(e,t,n){const r=n.offsetHeight+vx(n);if(r<=0)return;const o=yx(e,t);if(!o)return;const i=r/mx;Math.abs(i-(o.options.height??0))>bx&&(o.options.height=Math.round(i*100)/100,e.emit(!1))}function xx(e,t){const n=document.createComment("pd-flowlist-measure");return requestAnimationFrame(()=>{if(!n.isConnected)return;const r=n.parentElement;r&&wx(e,t,r)}),n}function Ex(e,t,n){const r=e.options,o=pt(r.flowColumns),i=vt(r.flowGapX),a=Xt(r.flowRowHeight),l=pn(r.flowLayoutMode)==="dynamic",c=Nn(r),s={display:"grid",gridTemplateColumns:`repeat(${o},minmax(0,1fr))`,columnGap:`${i}mm`,gridAutoRows:`minmax(${a}mm,auto)`,width:"100%",...l?{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&&(s.fontFamily=String(r.fontFamily)),r.backgroundColor&&(s.backgroundColor=String(r.backgroundColor));const d=gx(e,t).map(p=>h("div",{class:"print-flow-cell",text:p}));return l&&n&&d.push(xx(n,e.id)),h("div",{class:"print-flowlist",style:s},d)}const Ch={top:"flex-start",middle:"center",bottom:"flex-end"},Sx={left:"flex-start",center:"center",right:"flex-end"};function _x(e,t){const n=e.options,r=ft(n),o=bo(e.printElementType.type,n),i={};if(o?.all&&(i.border=`${o.all.borderWidth} ${o.all.borderStyle} ${o.all.borderColor}`),o)for(const a of hr){const l=o.edges[a];l&&(i[`border${a.charAt(0).toUpperCase()}${a.slice(1)}`]=`${l.borderWidth} ${l.borderStyle} ${l.borderColor}`)}return{position:"absolute",left:`${n.left}mm`,top:`${n.top}mm`,width:`${n.width}mm`,height:`${n.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(n.zIndex||"auto"),...i,...Mx(e,t)}}function Mx(e,t){if(t?.has(e.id))return{};const n=ma(e.printElementType.type,e.options);return n===void 0?{}:{rotate:`${n}deg`}}function Ah(e){const t=e.options,n=e.printElementType.type==="longText",r=po(e.printElementType.type,t),o=t.fontSize||12,i=r==="autoHeight",a={fontSize:`${o}pt`,fontWeight:t.fontWeight||"normal",fontFamily:Ya(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`:n?"1.5":"normal",letterSpacing:t.letterSpacing?`${t.letterSpacing}pt`:"normal",width:"100%",height:i?"auto":"100%",boxSizing:"border-box",overflow:i?"visible":"hidden",...n?{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`}};vc(t)&&(a.whiteSpace="nowrap",a.textOverflow="ellipsis");const l=yc(t);return l&&(a.whiteSpace=l),t.verticalAlign&&(a.display="flex",t.textAlign==="justify"?(a.flexDirection="column",a.justifyContent=Ch[t.verticalAlign]??"flex-start"):(a.alignItems=Ch[t.verticalAlign]??"flex-start",a.justifyContent=Sx[t.textAlign||"left"]??"flex-start")),{style:a,fit:r}}function Oh(e){const t=e.options,n=`${t.borderWidth||.75}pt`,r=t.borderStyle||"solid",o=t.borderColor||"#333";return e.printElementType.type==="hline"?{width:"100%",height:"0",borderTop:`${n} ${r} ${o}`,boxSizing:"border-box"}:{width:"0",height:"100%",borderLeft:`${n} ${r} ${o}`,boxSizing:"border-box"}}function Ih(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 Tx(e){const t=e.options;return{objectFit:t.fit||"contain",...ga(t.fit,t.fitScale,t.objectPosition),maxWidth:t.maxWidth?`${t.maxWidth}mm`:"100%",maxHeight:t.maxHeight?`${t.maxHeight}mm`:"100%"}}function Ph(e){const t=e.options,n={fitBase:String(t.fontSize||12),fitMin:String(dr(t.shrinkMinFontSize))};return po(e.printElementType.type,t)==="shrink"&&(n.fit="shrink"),n}Nf({text:e=>{const{style:t}=Ah(e),n=e.options;return h("div",{class:"print-text",style:t,dataset:Ph(e),text:String(n.testData||n.formatter||"")||"文本"})},longText:e=>{const{style:t}=Ah(e),n=e.options;return h("div",{class:"print-longtext",style:t,dataset:Ph(e),text:String(n.formatter||"")||"长文本内容"})},hline:e=>h("div",{class:"print-line",style:Oh(e)}),vline:e=>h("div",{class:"print-line",style:Oh(e)}),rect:e=>h("div",{class:"print-shape",style:Ih(e)}),oval:e=>h("div",{class:"print-shape",style:Ih(e)}),image:(e,t,n)=>{const r=e.options,o=String(r.src??""),i=n?.designData?.length?n.designData[0]:gt,a=o.includes("{")?Wn(o,i):o;return h("div",{class:"print-image"},[a?h("img",{src:a,style:Tx(e)}):h("div",{class:"image-placeholder",text:"图片"})])},qrcode:e=>Sw(e),barcode:e=>_w(e),html:e=>{const t=e.options,n=String(t.formatter??""),r=n?ww.sanitize(Wn(n,{})):'<div style="background:#e0e0e0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:10pt;color:#999">HTML</div>';return h("div",{class:"print-html",html:r})},pageNumber:(e,t)=>{const n=e.options;return h("div",{class:"page-number-element",style:{fontSize:`${n.fontSize||12}pt`,fontWeight:n.fontWeight||"normal",fontFamily:Ya(n.fontFamily),color:n.color||"#333",textAlign:n.textAlign||"left",...n.textAlign==="justify"?{textAlignLast:"justify"}:{}},text:t?n.title||"{pageIndex}/{totalPages}":String(n.title||"")})},table:(e,t,n)=>n?px(e,n.store,n.fire,n.designData):h("div",{class:"print-table"}),flowList:(e,t,n)=>Ex(e,void 0,n?.store)});function kx(e,t,n){const r=e.printElementType.type,o=tn(r)?.renderContent;if(o)return o(e,t,n);const i=js(r);if(!i)return h("div",{text:r});const a=document.createElement("div");a.className="plugin-kit-canvas",a.style.width="100%",a.style.height="100%";try{fh(`canvas:${e.id}`,i.ui.renderCanvas({element:e,data:n?.designData?.length?n.designData:[gt],designMode:!0}),a)}catch{a.textContent=String(r)}return a}function Rh(e){return`x:${Math.round(e.left)} y:${Math.round(e.top)} ${Math.round(e.width)}×${Math.round(e.height)}mm`}function Cx(e,t,n){const r=e.store,o=r.selectedIds.has(t.id),i=r.previewIds.has(t.id),a=t.options,l=t.zone||"content",c=[kx(t,!0,{store:r,fire:e.fire,designData:e.host.designData})];return r.draggingIds.has(t.id)&&c.push(h("div",{class:"drag-preview"})),o&&(c.push(h("div",{class:"resize-handles"},U1.map(s=>h("div",{class:`resize-handle handle-${s}`,dataset:{point:s,elId:t.id},onMousedown:d=>e.fire("resize-start",{event:d,id:t.id,point:s})})))),c.push(h("div",{class:"selected-indicator"},[h("div",{class:"position-label",text:Rh(a)})]))),h("div",{class:["print-element",`type-${t.printElementType.type}`,`zone-${l}`,o?"selected":"",i?"previewed":"",r.draggingIds.has(t.id)?"drag-ghost":"","design-mode",a.locked?"locked":"",a.visible===!1?"hidden":""].filter(Boolean).join(" "),style:_x(t,n),dataset:{elId:t.id},onMousedown:s=>e.fire("element-mousedown",{event:s,id:t.id}),onContextmenu:s=>{s.preventDefault(),s.stopPropagation(),e.fire("contextmenu",{event:s,id:t.id})}},c)}function gl(e,t){const n=e.margins,r=e.header?.height??10,o=e.footer?.height??10,i=t.width-n.left-n.right;return{header:{left:n.left,top:n.top,width:i,height:r},content:{left:n.left,top:n.top+r,width:i,height:t.height-n.top-n.bottom-r-o},footer:{left:n.left,top:t.height-n.bottom-o,width:i,height:o}}}const Ax='<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 Dh(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 Ox(e,t){const n=Wd(e.watermark,[],t);return n?h("div",{class:"watermark-layer",style:{opacity:String(n.opacity)}},n.tiles.map(r=>h("svg",{class:"watermark-tile",width:`${r.widthMm}mm`,height:`${r.heightMm}mm`,viewBox:`0 0 ${n.tileWidthPx} ${n.tileHeightPx}`,style:{left:`${r.leftMm}mm`,top:`${r.topMm}mm`}},[h("text",{x:String(n.tileWidthPx/2),y:String(n.tileHeightPx/2),"font-size":String(n.fontSizePx),fill:n.color,"text-anchor":"middle","dominant-baseline":"middle",transform:`rotate(${n.rotate},${n.tileWidthPx/2},${n.tileHeightPx/2})`,text:n.text})]))):""}function ml(e,t,n,r,o,i){const a=e.store,l=[];n!=="content"&&l.push(h("span",{class:"zone-label",text:n==="header"?"页眉":"页脚"}));const c=n==="content"?Bc(o):void 0;if(l.push(...o.map(s=>Cx(e,s,c))),n!=="content"){const s=n==="header"?"bottom":"top";l.push(h("div",{class:`zone-resize-handle handle-${s}`,dataset:{zone:n},onMousedown:d=>e.fire("zone-resize",{event:d,zone:n})},[t.zoneResizing===n?h("div",{class:"zone-height-tip",text:`${(n==="header"?a.templateData.header.height:a.templateData.footer.height).toFixed(1)}mm`}):""]))}return h("div",{class:`zone-layer zone-${n} design-mode`,style:{position:"absolute",left:`${r.left}mm`,top:`${r.top}mm`,width:`${r.width}mm`,height:`${r.height}mm`},dataset:{zone:n,paperWidth:String(i.width),paperHeight:String(i.height)}},l.filter(Boolean))}function Ix(e){const t=e.currentTarget,n=e.dataTransfer?.types??[],r=n.includes("fieldkey"),o=n.includes("elementtype");if(!r&&!o){t.querySelector(".drop-hint")?.remove();return}r&&(e.ctrlKey||e.metaKey)&&(t.dataset.dropLabelIntent="1");const i=o?"+ 元素":t.dataset.dropLabelIntent?"+ 静态文本":"+ 取值字段";let a=t.querySelector(".drop-hint");a||(a=document.createElement("div"),a.className="drop-hint",t.appendChild(a)),a.textContent=i,a.style.left=`${e.clientX+14}px`,a.style.top=`${e.clientY+18}px`}function $h(e){e&&(e.querySelector(".drop-hint")?.remove(),delete e.dataset.dropLabelIntent)}function Px(e,t){const n=e.store,r=n.templateData,o=ht(r),i=(n.scale||100)/100,a=gl(r,o),l=p=>n.elements.filter(u=>(u.zone||"content")===p),c=h("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:`${o.height}mm`}},[n.showGrid?h("div",{class:"grid-bg",style:{backgroundImage:`url("data:image/svg+xml,${encodeURIComponent(Ax)}")`,backgroundSize:"5mm 5mm",backgroundPosition:"0 0"}}):"",...r.watermark&&Object.keys(r.watermark).length?[Ox(r,o)]:[],ml(e,t,"header",a.header,l("header"),o),ml(e,t,"content",a.content,l("content"),o),ml(e,t,"footer",a.footer,l("footer"),o),...n.adsorbGuides.map(p=>h("div",{class:`adsorb-guide guide-${p.type}`,style:Dh(p,o)})),...(r.guides??[]).map(p=>h("div",{class:`manual-guide guide-${p.type}`,style:{...Dh(p,o),"--guide-hit":`${8/i}px`},dataset:{guideId:String(p.id??"")},onMousedown:u=>e.fire("guide-mousedown",{event:u,id:p.id}),onDblclick:u=>{u.preventDefault(),e.fire("guide-remove",p.id)}}))].filter(Boolean)),s=h("div",{class:"hiprint-printPaper",dataset:{test:"paper"},style:{width:`${o.width}mm`,minHeight:`${o.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(${i})`,transformOrigin:"0 0"}},[...r.designBackground?.src?[h("div",{class:"design-background",style:{width:`${o.width}mm`,height:`${o.height}mm`,left:"0",top:"0",transform:r.designBackground.rotation?`rotate(${r.designBackground.rotation}deg)`:""}},[h("img",{src:r.designBackground.src,draggable:!1,alt:""})])]:[],c]),d=[h("div",{class:"canvas-scroll"},[h("div",{class:"paper-wrapper",style:{width:`${Fo(o.width)*i}px`,height:`${Fo(o.height)*i}px`,position:"relative"}},[s])])];if(n.showRuler&&d.push(h("div",{class:"ruler-overlay",style:{transform:`translate(${t.scrollX}px, ${t.scrollY}px)`}},[h("div",{class:"ruler-corner"}),h("canvas",{class:"pd-ruler is-horizontal",dataset:{ruler:"horizontal"},style:{width:`${t.geom.viewW}px`,height:"20px"},onMousedown:p=>e.fire("ruler-mousedown",{event:p,orientation:"horizontal"})}),h("canvas",{class:"pd-ruler is-vertical",dataset:{ruler:"vertical"},style:{width:"20px",height:`${t.geom.viewH}px`},onMousedown:p=>e.fire("ruler-mousedown",{event:p,orientation:"vertical"})})])),t.guidePreview&&d.push(h("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&&d.push(h("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 p=t.contextMenu;d.push(h("div",{class:"context-menu",style:{left:`${t.contextMenu.x+t.contextMenu.flipX}px`,top:`${t.contextMenu.y+t.contextMenu.flipY}px`}},t.contextMenu.targetId?[_t(e,p,"复制","copy"),_t(e,p,"剪切","cut"),_t(e,p,"粘贴","paste",!n.hasClipboard),_t(e,p,"删除","delete"),h("div",{class:"context-menu-sep"}),_t(e,p,"置顶","move-layer",!1,"top"),_t(e,p,"上移","move-layer",!1,"up"),_t(e,p,"下移","move-layer",!1,"down"),_t(e,p,"置底","move-layer",!1,"bottom")]:[_t(e,p,"粘贴","paste-at",!n.hasClipboard),_t(e,p,"全选","select-all"),_t(e,p,"取消选择","clear-selection")]))}return h("div",{class:"canvas-area",dataset:{test:"canvas-area"},onDragover:p=>{const u=p;u.preventDefault(),u.dataTransfer&&(u.dataTransfer.dropEffect="copy"),Ix(u)},onDragleave:p=>{const u=p.currentTarget,f=p.relatedTarget;(!f||!u.contains(f))&&u.querySelector(".drop-hint")?.remove()},onDrop:p=>{const u=p,f=p.currentTarget,g=f.dataset.dropLabelIntent==="1";$h(f),g&&(u.labelIntent=!0),e.fire("drop",u)},onMousedown:p=>e.fire("canvas-mousedown",p),onMousemove:p=>e.fire("canvas-mousemove",p),onMouseleave:()=>e.fire("canvas-mouseleave"),onWheel:p=>e.fire("wheel",p),onScroll:p=>e.fire("scroll",p),onContextmenu:p=>{p.preventDefault(),e.fire("canvas-contextmenu",p)}},d.filter(Boolean))}function _t(e,t,n,r,o=!1,i){return h("div",{class:`context-menu-item${o?" disabled":""}`,text:n,onClick:()=>{t.visible=!1,o||e.fire(r,i),e.repaint()}})}const Rx={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 Re(e,t=15,n){const r=Rx[e];return r?`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}"${n?` class="${n}"`:""} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${r}</svg>`:""}let kn=null;function bl(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;const n=t[1],r=n.length===3?n.split("").map(o=>o+o).join(""):n;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 yl(e){const t=bl(e);return t?Nh(t):"#000000"}function Nh({r:e,g:t,b:n}){return`#${[e,t,n].map(r=>Math.round(Xr(r/255)*255).toString(16).padStart(2,"0")).join("")}`}function Dx(e,t,n){const r=e/255,o=t/255,i=n/255,a=Math.max(r,o,i),l=Math.min(r,o,i),c=a-l;let s=0;return c!==0&&(a===r?s=(o-i)/c%6:a===o?s=(i-r)/c+2:s=(r-o)/c+4,s*=60,s<0&&(s+=360)),{h:s,s:a===0?0:c/a,v:a}}function $x(e,t,n){const r=n*t,o=(e%360+360)%360/60,i=r*(1-Math.abs(o%2-1)),[a,l,c]=o<1?[r,i,0]:o<2?[i,r,0]:o<3?[0,r,i]:o<4?[0,i,r]:o<5?[i,0,r]:[r,0,i],s=n-r;return{r:(a+s)*255,g:(l+s)*255,b:(c+s)*255}}function Nx(e){return((Number.isFinite(e)?e:0)%360+360)%360}function Xr(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Lx(e){const t=e.title??"颜色选择";return h("button",{type:"button",class:`preset-color-trigger${e.triggerClass?` ${e.triggerClass}`:""}`,"aria-expanded":"false","aria-haspopup":"dialog",title:t,onClick:n=>{const r=n.currentTarget??n.target,o=r.getRootNode();if(!!kn&&kn.root===o&&kn.title===t&&kn.trigger===r){Zr();return}Zr(),Fx(r,e)}},[h("span",{class:"preset-color-swatch",style:e.value?{background:e.value}:{background:"transparent"}})])}function Zr(){const e=kn;e&&(kn=null,e.teardowns.forEach(t=>t()),e.trigger.setAttribute("aria-expanded","false"),e.panel.remove())}function Fx(e,t){const n=e.getRootNode(),r=n instanceof ShadowRoot?n:document.body,o={root:n,title:t.title??"颜色选择",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,items:[],teardowns:[]};t.value&&wl(o,t.value)?o.hexText=yl(t.value).toUpperCase():o.hexText=t.value?String(t.value):"",o.panel=Ze(Ux(o),r),o.current=o.panel.querySelector(".picker-current"),o.hex=o.panel.querySelector(".picker-hex"),o.area=o.panel.querySelector(".picker-area"),o.handle=o.panel.querySelector(".picker-handle"),o.hueRange=o.panel.querySelector(".picker-hue"),o.clearBtn=o.panel.querySelector(".picker-clear"),o.items=Array.from(o.panel.querySelectorAll(".preset-color-item")).map((i,a)=>({el:i,color:ld[a]})),Bi(o),zx(o),Bx(o),kn=o,e.setAttribute("aria-expanded","true")}function zx(e){const t=e.trigger.getBoundingClientRect(),n=190,r=e.panel.offsetHeight||216,o=8,i=Math.max(o,Math.min(t.left,window.innerWidth-n-o)),a=t.bottom+6,l=a+r>window.innerHeight-o?Math.max(o,t.top-r-6):a;e.panel.style.left=`${i}px`,e.panel.style.top=`${l}px`}function Bx(e){const t=o=>{const i=Hx(o);i.includes(e.trigger)||i.includes(e.panel)||Zr()},n=o=>{o.key==="Escape"&&Zr()},r=()=>Zr();document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",n),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",n),()=>window.removeEventListener("scroll",r,!0),()=>window.removeEventListener("resize",r),()=>e.root.removeEventListener("scroll",r,!0))}function Hx(e){const t=typeof e.composedPath=="function"?e.composedPath():[];return t.length?t:[e.target]}function Ux(e){return h("div",{class:"preset-color-panel",role:"dialog","aria-label":"颜色选择",style:{position:"fixed"},onPointerdown:t=>t.stopPropagation()},[h("div",{class:"picker-preview"},[h("span",{class:"picker-current"}),h("input",{class:"picker-hex",type:"text",maxlength:7,spellcheck:"false","aria-label":"颜色值",onInput:t=>Wx(e,t.target.value)})]),h("div",{class:"picker-area","aria-label":"自定义颜色",tabindex:0,onPointerdown:t=>jx(e,t),onKeydown:t=>Gx(e,t)},[h("span",{class:"picker-handle"})]),h("input",{class:"picker-hue",type:"range",min:0,max:360,step:1,"aria-label":"色相",onInput:t=>Vx(e,Number(t.target.value)),onChange:()=>xl(e)}),h("div",{class:"picker-heading"},[h("span",{text:"常用颜色"}),e.clearable?h("button",{type:"button",class:"picker-clear",title:"清除选中的颜色",onClick:()=>Hi(e,void 0)},[h("svg",{viewBox:"0 0 16 16",width:12,height:12,"aria-hidden":"true"},[h("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",fill:"none"})]),"清除"]):""].filter(Boolean)),h("div",{class:"preset-color-grid"},ld.map(t=>h("button",{type:"button",class:"preset-color-item",style:{background:t},title:t,"aria-label":t,onClick:()=>qx(e,t)})))])}function vl(e){return Nh($x(e.hue,e.saturation,e.value_))}function Bi(e){const t=vl(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 n=String(Math.round(e.hue));e.hueRange.value!==n&&(e.hueRange.value=n),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 wl(e,t){const n=bl(t);if(!n)return!1;const r=Dx(n.r,n.g,n.b);return e.hue=r.h,e.saturation=r.s,e.value_=r.v,e.hexText=yl(t).toUpperCase(),!0}function Jn(e,t,n,r){e.hue=Nx(t),e.saturation=Xr(n),e.value_=Xr(r),e.hexText=vl(e).toUpperCase(),Bi(e)}function xl(e){const t=vl(e);e.model=t,Bi(e),e.onChange(t)}function Hi(e,t){e.model=t,t||(e.hexText=""),Bi(e),e.onChange(t)}function qx(e,t){wl(e,t),Hi(e,t)}function Wx(e,t){const n=t.trim();if(!n){e.clearable&&Hi(e,void 0);return}bl(n)&&(wl(e,n),Hi(e,yl(n)))}function jx(e,t){e.dragging=!0,Lh(e,t);const n=o=>{e.dragging&&Lh(e,o)},r=()=>{e.dragging&&(e.dragging=!1,document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",r),document.removeEventListener("pointercancel",r),xl(e))};document.addEventListener("pointermove",n),document.addEventListener("pointerup",r),document.addEventListener("pointercancel",r)}function Lh(e,t){const n=e.area.getBoundingClientRect();if(!n.width||!n.height)return;const r=Xr((t.clientX-n.left)/n.width),o=Xr(1-(t.clientY-n.top)/n.height);Jn(e,e.hue,r,o)}function Gx(e,t){const n=t.shiftKey?.1:.02;let r=!0;t.key==="ArrowLeft"?Jn(e,e.hue,e.saturation-n,e.value_):t.key==="ArrowRight"?Jn(e,e.hue,e.saturation+n,e.value_):t.key==="ArrowUp"?Jn(e,e.hue,e.saturation,e.value_+n):t.key==="ArrowDown"?Jn(e,e.hue,e.saturation,e.value_-n):r=!1,r&&(t.preventDefault(),xl(e))}function Vx(e,t){Jn(e,t,e.saturation,e.value_)}function _e(e,t,n,r){return h("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(n,r.arg),html:Re(t)})}function Ui(e,t,n,r){const o=e.state.openDd===t,i=()=>{e.state.openDd=o?null:t,e.repaint()};return h("div",{class:"tb-dd"},[h("button",{type:"button",class:`tb-dd-trigger${o?" on":""}`,disabled:!!n.disabled,dataset:{test:n.testId??t,tip:n.tip},onClick:i,html:`${n.icon?Re(n.icon):""}${n.text?`<span class="${n.textClass??"tb-btn-text"}">${n.text}</span>`:""}${Re("ChevronDown",12,`tb-dd-arrow${o?" up":""}`)}`}),o?h("div",{class:`tb-dd-panel${n.panelClass?` ${n.panelClass}`:""}`},r):""].filter(Boolean))}function J(e){const t=e.step??1,n=String(t),r=n.indexOf("."),o=r===-1?0:n.length-r-1,i=p=>Number.isFinite(p)?Number(p.toFixed(o)):0,a=p=>{let u=i(p);return e.min!==void 0&&u<e.min&&(u=e.min),e.max!==void 0&&u>e.max&&(u=e.max),u},l=e.value===void 0||e.value===null||!Number.isFinite(e.value)?void 0:i(e.value),c=l??e.min??0,s=p=>{p!==l&&e.onCommit(p)},d=h("input",{class:"pd-input pd-step-input",type:"number",value:l===void 0?"":String(l),min:e.min,max:e.max,step:t,placeholder:e.placeholder,disabled:!!e.disabled,onChange:p=>{const u=p.target,f=(u.value??"").trim();if(f===""){l!==void 0&&(u.value=String(l));return}const g=Number(f);if(!Number.isFinite(g)){u.value=l===void 0?"":String(l);return}const m=a(g);u.value=String(m),s(m)}});return h("div",{class:"pd-stepper"},[h("button",{type:"button",class:"pd-step-btn pd-step-minus",disabled:!!e.disabled||c<=(e.min??-1/0),title:"减小","aria-label":"减小",text:"−",onClick:()=>s(a(c-t))}),d,h("button",{type:"button",class:"pd-step-btn pd-step-plus",disabled:!!e.disabled||c>=(e.max??1/0),title:"增大","aria-label":"增大",text:"+",onClick:()=>s(a(c+t))})])}function se(e,t,n,r){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:e}),r??""]),t,n?h("p",{class:"pd-hint",text:n}):""].filter(Boolean))}const El=e=>h("button",{class:"pd-help",type:"button","data-tip":e,"aria-label":"字段说明"});function He(e,t,n,r){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t"},[e,El(n)]),r??""]),t])}function Cn(e){const t=e.base?.[e.propKey],n=e.target?.[e.propKey]!==t,r=e.force===!0||n,o=e.tipOverride??(e.tipValue===void 0?"恢复默认值":`恢复默认值(${e.tipValue}${e.tipUnit?" "+e.tipUnit:""})`),i=e.force?`${o}(应用到全部选中格)`:o;return h("button",{type:"button",class:`pd-reset-btn${n&&!e.force?" is-dirty":""}`,"data-tip":i,"aria-label":i,html:Re("RotateCcw",13),onClick:()=>{r&&(e.write?e.write(t):e.target[e.propKey]=t,e.onReset?.())}})}const $t=e=>h("h3",{class:"pd-divider",text:e});function ot(e,t,n="颜色选择",r){return Lx({value:e,title:n,triggerClass:r,onChange:o=>t(o)})}function on(e,t,n,r,o=!1){return h("div",{class:`pd-radio-group${o?" pd-radio-group--2col":""}`,role:"radiogroup"},t.map(i=>h("label",{class:"pd-radio"},[h("input",{type:"radio",name:e,value:i.value,checked:n===i.value,onChange:()=>r(i.value)}),h("span",{text:i.label})])))}function Fh(e,t,n,r={}){const o=document.createElement("select");o.className=r.className??"pd-select",r.width&&(o.style.width=r.width);for(const i of t){const a=document.createElement("option");a.value=i.value,a.textContent=i.label,i.disabled&&(a.disabled=!0),o.appendChild(a)}return o.value=e,t.some(i=>i.value===e)||(o.selectedIndex=-1),o.addEventListener("change",()=>n(o.value)),o}function Yx(e){const t=window.innerHeight;for(let n=e.parentElement;n&&n!==document.body;n=n.parentElement){const r=getComputedStyle(n).overflowY;if(r==="auto"||r==="scroll"||r==="hidden"||r==="clip"){const o=n.getBoundingClientRect();return{top:Math.max(0,o.top),bottom:Math.min(t,o.bottom)}}}return{top:0,bottom:t}}function qi(e){const t=eb(e.fonts),n=e.placeholder??"默认",r=`font-select-list-${e.id}`,o=O=>{const C=O?.trim();return C?Id(t,C)?.label??C:""},i=O=>{const C=Tr(O);return t.find(S=>S.label&&Tr(S.label)===C)?.family??O},a=()=>{const O=e.value?.trim();return O?Id(t,O)?"":O:""},l=O=>{const C=(e.value??"").trim(),I=(N,z,T,ie)=>({kind:N,key:z,label:T,value:ie,selected:(ie??"")===C}),S=O.trim();if(!S){const N=[I("clear","__clear__",n)],z=a();z&&N.push(I("unknown","__unknown__",`${z}(未知)`,z));for(const T of t)N.push(I("font",T.family,Pd(T),T.family));return N}const $=nb(t,S).map(N=>I("font",N.family,Pd(N),N.family));if(!$.length){const N=i(S);$.push(I("free","__free__",`使用「${N}」`,N))}return $},c=document.createElement("div");c.className="font-select";const s=document.createElement("input");s.className="pd-input font-select-input",s.type="text",s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-controls",r),s.autocomplete="off",s.placeholder=n,s.disabled=!!e.disabled,s.value=o(e.value);const d=document.createElement("ul");d.id=r,d.className="font-select-list",d.setAttribute("role","listbox");const p=e.state.fontOpen?.id===e.id?e.state.fontOpen:null,u={open:!!p&&!e.disabled,query:p?.query??"",highlighted:p?.highlighted??-1};u.open&&(s.value=u.query);const f=()=>{e.state.fontOpen=u.open?{id:e.id,query:u.query,highlighted:u.highlighted}:null};f();const g=()=>{const O=(e.value??"").trim();return l(u.query).findIndex(C=>(C.value??"")===O)},m=()=>{const O=s.getBoundingClientRect(),C=Yx(s);d.classList.toggle("is-up",Nm({triggerTop:O.top,triggerBottom:O.bottom,overlayHeight:d.getBoundingClientRect().height,boundaryTop:C.top,boundaryBottom:C.bottom})==="up")},b=()=>{if(!u.open){d.isConnected&&d.remove(),s.setAttribute("aria-expanded","false"),s.setAttribute("aria-activedescendant","");return}d.isConnected||c.appendChild(d);const O=l(u.query);d.replaceChildren(...O.map((C,I)=>{const S=document.createElement("li");return S.id=`${r}-${I}`,S.className="font-select-option"+(I===u.highlighted?" is-active":"")+(C.kind==="unknown"||C.kind==="free"?" is-muted":""),S.setAttribute("role","option"),S.setAttribute("aria-selected",String(C.selected)),S.textContent=C.label,S.addEventListener("mousedown",$=>{$.preventDefault(),R(C)}),S})),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-activedescendant",u.highlighted>=0?`${r}-${u.highlighted}`:""),m()},v=()=>{u.open||e.disabled||(u.open=!0,u.query="",u.highlighted=g(),f(),b())},w=()=>{u.open||v()},E=()=>{u.open=!0,u.query=s.value,u.highlighted=l(u.query).length?0:-1,f(),b()},k=O=>{if(!u.open){v();return}const C=l(u.query).length-1;if(C<0)return;u.highlighted=Math.min(Math.max(u.highlighted+O,0),C),f(),b(),d.children[u.highlighted]?.scrollIntoView?.({block:"nearest"})},L=()=>{if(!u.open)return;const O=l(u.query)[u.highlighted];if(O){R(O);return}const C=u.query.trim();if(C){const I=i(C);R({value:I})}},R=O=>{u.open=!1,u.query="",u.highlighted=-1,f(),s.value=o(O.value),b(),e.onChange(O.value)},P=()=>{u.open&&(u.open=!1,u.query="",u.highlighted=-1,f(),s.value=o(e.value),b())};return s.addEventListener("focus",v),s.addEventListener("click",w),s.addEventListener("input",E),s.addEventListener("blur",P),s.addEventListener("keydown",O=>{const C=O;C.key==="ArrowDown"?(C.preventDefault(),k(1)):C.key==="ArrowUp"?(C.preventDefault(),k(-1)):C.key==="Enter"?(C.preventDefault(),L()):C.key==="Escape"&&(C.preventDefault(),P())}),c.append(s),b(),u.open&&(s.focus(),s.setSelectionRange(u.query.length,u.query.length)),c}const Kx=[{key:"solid",label:"实线",preview:"1.5px solid currentColor"},{key:"dashed",label:"虚线",preview:"1.5px dashed currentColor"},{key:"dotted",label:"点线",preview:"1.5px dotted currentColor"},{key:"double",label:"双线",preview:"3px double currentColor"}],Xx={left:"TextAlignStart",center:"TextAlignCenter",right:"TextAlignEnd",justify:"TextAlignJustify"};function an(e,t,n,r,o={}){return h("button",{type:"button",class:`ft-cell-btn${o.on?" on":""}`,dataset:{test:e,tip:t},disabled:!!o.disabled,onClick:r,html:`<svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true">${n}</svg>`})}const Qn='<rect class="g-faint" x="2.5" y="2.5" width="13" height="13" />',zh='<rect class="g-solid" x="2.5" y="2.5" width="13" height="13" fill="none" />';function Zx(e){const t=e.format;t.syncBorderDraft();const n=t.values,r=!t.fontEditable,o=r||t.context==="cells",i=t.context==="none",a=t.context==="cells",l=!t.painterActive&&(t.context==="none"||t.context==="cells"||!t.painterCapturable),c=t.painterActive?"退出格式刷(Esc)":t.context==="cells"?"格式刷(表格单元格暂不支持)":t.context==="none"?"格式刷(需选中元素)":t.painterCapturable?"格式刷:单击刷一次,双击连续刷":"格式刷(请仅选中一个源元素)",s=u=>r?`${u}(需选中文本元素)`:u,d=[h("div",{class:"ft-border-panel",dataset:{test:"border-panel"}},[h("div",{class:"ft-border-grid"},[an("preset-none","无边框",`${Qn}<line class="g-solid" x1="4" y1="14" x2="14" y2="4" />`,()=>t.applyBorderPreset("none")),an("preset-all","所有边框",`${zh}<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")),an("preset-outer","外侧边框",zh,()=>t.applyBorderPreset("outer")),an("preset-inner",a?"内部边框":"内部边框(仅表格单元格可用)",`${Qn}<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:!a}),an("edge-top","上边框",`${Qn}<line class="g-solid" x1="2" y1="3" x2="16" y2="3" />`,()=>t.applyEdge("top"),{on:t.edgeOn("top")}),an("edge-bottom","下边框",`${Qn}<line class="g-solid" x1="2" y1="15" x2="16" y2="15" />`,()=>t.applyEdge("bottom"),{on:t.edgeOn("bottom")}),an("edge-left","左边框",`${Qn}<line class="g-solid" x1="3" y1="2" x2="3" y2="16" />`,()=>t.applyEdge("left"),{on:t.edgeOn("left")}),an("edge-right","右边框",`${Qn}<line class="g-solid" x1="15" y1="2" x2="15" y2="16" />`,()=>t.applyEdge("right"),{on:t.edgeOn("right")})]),h("div",{class:"ft-style-row"},Kx.map(u=>h("button",{type:"button",class:`ft-style-btn${t.borderStyle===u.key?" on":""}`,dataset:{test:`style-${u.key}`,tip:t.borderStyle===u.key?`${u.label}(再点一次取消,线型=无)`:u.label},onClick:()=>{t.toggleBorderStyle(u.key),e.repaint()}},[h("span",{class:"ft-style-line",style:{borderTop:u.preview}})]))),h("div",{class:"ft-border-style-row"},[h("span",{class:"ft-edge-label",text:"粗细"}),h("div",{class:"ft-line-width"},[J({value:t.borderWidth,min:.25,max:5,step:.25,placeholder:t.borderMixed.width?"混合":void 0,onCommit:u=>{t.setBorderWidth(u),e.repaint()}})])]),h("div",{class:"ft-border-style-row"},[h("span",{class:"ft-edge-label",text:"颜色"}),ot(t.borderColor,u=>{t.setBorderColor(u),e.repaint()},"边框颜色")]),t.borderMixedAny?h("p",{class:"pd-hint",text:"当前单元格四边规格不一致:留空的项不谎报,点预设/单边时按缺省档(实线 0.75 / #333333)批写"}):""].filter(Boolean))],p=[h("div",{class:"ft-align-panel",dataset:{test:"align-panel"}},[h("div",{class:"ft-align-row"},[["left","左对齐","TextAlignStart"],["center","水平居中","TextAlignCenter"],["right","右对齐","TextAlignEnd"],["justify","两端对齐(撑满行宽,含末行)","TextAlignJustify"]].map(([u,f,g])=>h("button",{type:"button",class:`ft-cell-btn${n.textAlign===u?" on":""}`,dataset:{test:`align-${u}`,tip:f},disabled:r,onClick:()=>t.applyStyle({textAlign:u}),html:Re(g)}))),h("div",{class:"ft-align-row"},[["top","顶端对齐","ArrowUpToLine"],["middle","垂直居中","ChevronsUpDown"],["bottom","底端对齐","ArrowDownToLine"]].map(([u,f,g])=>h("button",{type:"button",class:`ft-cell-btn${n.verticalAlign===u?" on":""}`,dataset:{test:`valign-${u}`,tip:f},disabled:r,onClick:()=>t.applyStyle({verticalAlign:u}),html:Re(g)})))])];return h("div",{class:"format-toolbar"},[h("div",{class:"tb-ou ft-group",dataset:{unit:"painter"}},[h("button",{type:"button",class:`ft-btn${t.painterActive?" on":""}`,dataset:{test:"format-painter",tip:c},disabled:l,onClick:()=>{t.painterActive?t.cancelPainter():t.pickPainterSource(!1),e.repaint()},onDblclick:()=>{t.pickPainterSource(!0),e.repaint()},html:Re("Paintbrush")})]),h("div",{class:"tb-ou ft-group",dataset:{unit:"font"}},[h("div",{class:"ft-font"},[qi({id:"ft-font",state:e.state,fonts:e.host.fonts,value:typeof n.fontFamily=="string"?n.fontFamily:void 0,placeholder:n.fontFamily===_n?"混合":"默认",disabled:r,onChange:u=>t.applyStyle({fontFamily:u})})]),h("div",{class:"ft-size",dataset:{test:"font-size"}},[J({value:typeof n.fontSize=="number"?n.fontSize:void 0,min:5,max:72,disabled:r,placeholder:n.fontSize===_n?"混合":"默认",onCommit:u=>t.applyStyle({fontSize:u})})])]),h("div",{class:"tb-ou ft-group",dataset:{unit:"style"}},[...[["bold","Bold","加粗",()=>t.toggleBold()],["underline","Underline","下划线",()=>t.toggleUnderline()],["strike","Strikethrough","删除线",()=>t.toggleStrike()]].map(([u,f,g,m])=>h("button",{type:"button",class:`ft-btn${n[u]===!0?" on":""}`,dataset:{test:u,tip:s(g)},disabled:u==="bold"?r:o,onClick:m,html:Re(f)}))]),h("div",{class:"tb-ou ft-group",dataset:{unit:"color"}},[h("span",{class:`ft-color-btn${r?" dim":""}`,title:`字体颜色${r?"(需选中或混选文本元素)":""}`},[ot(typeof n.color=="string"?n.color:void 0,u=>t.applyStyle({color:u})),h("span",{class:"ft-glyph",text:"A"})]),h("span",{class:`ft-color-btn${i?" dim":""}`,title:"背景色"},[ot(typeof n.backgroundColor=="string"?n.backgroundColor:void 0,u=>t.applyStyle({backgroundColor:u})),h("span",{class:"ft-glyph",html:Re("PaintBucket",14)})])]),h("div",{class:"tb-ou ft-group",dataset:{unit:"align"}},[Ui(e,"align",{icon:Xx[String(n.textAlign)]??"TextAlignStart",text:"对齐",textClass:"ft-btn-text",tip:r?"对齐(需选中文本元素或单元格)":"对齐",disabled:r,testId:"align-dd"},p)]),h("div",{class:"tb-ou ft-group",dataset:{unit:"border"}},[Ui(e,"border",{icon:"Grid3x3",text:"边框",textClass:"ft-btn-text",tip:i?"边框(需选中元素)":"边框",disabled:i,testId:"border"},d)])])}const Jx="1.5.3";Ii.filter(e=>e.material).map(e=>({type:e.type,label:e.label,icon:e.icon}));function Wi(e,t){return Re(e??"Shapes",t)||Re("Shapes",t)}function Qx(e){const t=e.state;if(t.leftCollapsed)return h("div",{class:"left-panel collapsed"},[h("div",{class:"left-collapsed"},[Bh("ChevronsRight","展开素材台",()=>{t.leftCollapsed=!1,e.repaint()}),...[["elements","元素","Table2"],["fields","字段","ListTree"],["layers","图层","Layers"]].map(([r,o,i])=>h("button",{type:"button",class:`lc-btn${t.leftTab===r?" on":""}`,title:o,html:Wi(i,14),onClick:()=>{t.leftTab=r,t.leftCollapsed=!1,e.repaint()}}))])]);const n=(r,o,i="")=>h("div",{class:`pd-tab-pane${i?` ${i}`:""}`,role:"tabpanel",dataset:{pane:`left:${r}`},style:t.leftTab===r?"":{display:"none"}},o);return h("div",{class:"left-panel"},[h("div",{class:"left-head"},[h("span",{class:"left-title",text:"素材台"}),Bh("ChevronsLeft","收起素材台",()=>{t.leftCollapsed=!0,e.repaint()})]),h("div",{class:"pd-tabs left-tabs"},[h("div",{class:"pd-tab-bar",role:"tablist"},[...[["elements","元素"],["fields","字段"],["layers","图层"]].map(([r,o])=>h("button",{type:"button",class:`pd-tab${t.leftTab===r?" active":""}`,text:o,onClick:()=>{t.leftTab=r,e.repaint()}}))]),n("elements",t2(),"material-grid"),n("fields",[n2(e)]),n("layers",[r2(e)])])])}function Bh(e,t,n){return h("button",{type:"button",class:"collapse-btn",title:t,html:Wi(e,14),onClick:n})}function e2(e,t,n){return h("div",{class:`material-card${w0(t)?" material-card--wide":""}`,draggable:!0,dataset:{test:`material-${e}`},onDragstart:r=>{const o=r.dataTransfer;o?.setData("elementType",e),o&&(o.effectAllowed="all")}},[h("span",{class:"material-icon","data-icon":n,html:Wi(n,14)}),h("span",{class:"material-label",text:t})])}function t2(){const e=[];let t;for(const n of Ff()){const r=n.group;r&&r!==t&&e.push(h("div",{class:"material-group-title",text:r})),r&&(t=r),e.push(e2(n.type,n.label,n.icon))}return[h("div",{class:"panel-title",text:"拖拽元素到画布"}),...e]}function n2(e){const t=e.state,n=Tu(e.store.fields),r=(t.fieldSearch??"").trim().toLowerCase(),o=r?n.map(i=>({...i,fields:i.fields.filter(a=>`${a.fieldLabel}${a.fieldKey}`.toLowerCase().includes(r))})).filter(i=>i.fields.length):n;return h("div",{class:"field-tree-panel"},[h("div",{class:"panel-title",text:"业务字段"}),h("input",{class:"pd-input search-input",type:"search",placeholder:"搜索字段...","aria-label":"搜索字段",value:t.fieldSearch??"",onInput:i=>{t.fieldSearch=i.target.value},onChange:()=>e.repaint()}),h("div",{class:"tree-container"},o.flatMap(i=>{const a=t.collapsedGroups.has(i.key)&&!r,l=i.key?h("div",{class:`field-group-header${i.isList?" is-list":""}`,onClick:()=>{a?t.collapsedGroups.delete(i.key):t.collapsedGroups.add(i.key),e.repaint()}},[h("span",{class:"expand-icon",text:a?"▶":"▼"}),h("span",{class:"node-icon",text:i.isList?"📋":"📁"}),h("span",{class:"group-label",text:i.label,"data-tip":i.label})]):"",c=a?[]:i.fields.map(s=>h("div",{class:"field-row",draggable:!0,"data-tip":`${s.fieldLabel} (${s.fieldKey}) · 单击复制字段名 · 拖动中按住 Ctrl(Mac 为 ⌘)切换为插入字段名`,style:{paddingLeft:`${i.key?22:8}px`},onDragstart:d=>{const p=d.dataTransfer;p?.setData("fieldKey",s.fieldKey),p&&(p.effectAllowed="all")},onClick:()=>{ku(s.fieldLabel||s.fieldKey).then(d=>{d&&(t.copiedFieldKey=s.fieldKey,e.repaint(),setTimeout(()=>{t.copiedFieldKey===s.fieldKey&&(t.copiedFieldKey="",e.repaint())},1200))})}},[h("span",{class:"node-icon",text:"📄"}),h("span",{class:"node-meta"},[h("span",{class:"node-label",text:s.fieldLabel}),h("span",{class:"node-key",text:`(${s.fieldKey})`})]),t.copiedFieldKey===s.fieldKey?h("span",{class:"copy-hint",text:"已复制"}):""].filter(Boolean)));return[l,h("div",{},c.filter(Boolean))].filter(Boolean)})),o.length===0?h("p",{class:"pd-empty",text:"暂无字段"}):""].filter(Boolean))}function r2(e){const t=e.store,n=[...t.elements].sort((l,c)=>(c.options.zIndex??0)-(l.options.zIndex??0)),r=t.elements.filter(l=>t.selectedIds.has(l.id)),o=r.length>=2,i=r.some(l=>!!l.options.groupId),a=l=>l.zone==="header"?"页眉":l.zone==="footer"?"页脚":"";return h("div",{class:"layer-panel"},[h("div",{class:"panel-title",text:"图层"}),...n.map(l=>{const c=Hf(l.printElementType.type);return h("div",{class:`layer-item${t.selectedIds.has(l.id)?" active":""}`,onClick:s=>t.selectElement(l.id,s.ctrlKey||s.metaKey)},[h("span",{class:"layer-icon","data-icon":c??"Shapes",html:Wi(c,12)}),h("span",{class:"layer-name",text:l.options.title||l.printElementType.title||l.printElementType.type}),a(l)?h("span",{class:"layer-zone",text:a(l)}):"",h("span",{class:"layer-zindex",text:`z:${l.options.zIndex??0}`})].filter(Boolean))}),n.length?h("div",{class:"layer-actions"},[...[["top","置顶","ArrowUpToLine"],["up","上移","ArrowUp"],["down","下移","ArrowDown"],["bottom","置底","ArrowDownToLine"]].map(([l,c,s])=>h("button",{type:"button",class:"pd-button small",title:c,html:Re(s,14),onClick:()=>e.fire("move-layer",l)}))]):"",o||i?h("div",{class:"layer-actions"},[o?h("button",{type:"button",class:"pd-button small",title:"组合 (Ctrl+G)",html:Re("Group",14),onClick:()=>e.fire("group")}):"",i?h("button",{type:"button",class:"pd-button small",title:"取消组合 (Ctrl+Shift+G)",html:Re("Ungroup",14),onClick:()=>e.fire("ungroup")}):""].filter(Boolean)):""].filter(Boolean))}function o2(e){const t=e.store,n=e.state,r=t.pages.length>1,o=t.pages[t.activePageIndex]?.name||`页面 ${t.activePageIndex+1}`,i=t.tilingEnabled;return h("div",{class:"page-tabs"},[h("div",{class:"page-tabs-list"},t.pages.map((l,c)=>n.renamingPage===c?h("input",{class:"page-tab-rename",dataset:{test:"page-rename-input"},value:n.renameText??"",onInput:s=>{n.renameText=s.target.value},onBlur:()=>a(),onKeydown:s=>{const d=s;if(d.key==="Enter"){a();return}d.key==="Escape"&&(n.renamingPage=null,e.repaint())}}):h("button",{type:"button",class:`page-tab${c===t.activePageIndex?" active":""}`,dataset:{tip:l.name?`${l.name}(双击重命名)`:"双击重命名"},text:l.name||`页面 ${c+1}`,onClick:()=>t.switchPage(c),onDblclick:()=>{n.renamingPage=c,n.renameText=l.name??"",e.repaint()}}))),h("div",{class:"page-tabs-actions"},[h("button",{type:"button",dataset:{test:"add-page",tip:i?"拼版模板仅允许一个设计页面":"新增页面(在当前页后追加空白页)"},disabled:i,text:"+",onClick:()=>e.fire("add-page")}),h("button",{type:"button",dataset:{test:"duplicate-page",tip:i?"拼版模板仅允许一个设计页面":`复制当前页「${o}」`},disabled:i,text:"⧉",onClick:()=>e.fire("duplicate-page")}),h("button",{type:"button",dataset:{test:"delete-page",tip:r?`删除当前页「${o}」`:"仅多页面模板可删除页面"},disabled:!r,text:"✕",onClick:()=>e.fire("delete-page")}),h("button",{type:"button",dataset:{test:"move-left",tip:`前移「${o}」`},disabled:t.activePageIndex<=0,text:"←",onClick:()=>e.fire("move-page",-1)}),h("button",{type:"button",dataset:{test:"move-right",tip:`后移「${o}」`},disabled:t.activePageIndex>=t.pages.length-1,text:"→",onClick:()=>e.fire("move-page",1)})])]);function a(){const l=(n.renameText??"").trim();n.renamingPage!==null&&l&&t.renamePage(n.renamingPage,l),n.renamingPage=null,e.repaint()}}function i2(e){const t=e.store,n=t.templateData,r=Jt(n),o=n.orientation==="landscape"?"横向":"纵向",i=Ot[n.paperSize]?.label??n.paperSize,a=n.outputRotation,l=`${i} ${o} ${Math.round(r.width)}×${Math.round(r.height)}mm${a?`(旋转${a}°)`:""}`;return h("div",{class:"status-bar"},[h("span",{class:"status-item coord",dataset:{coord:""},style:{display:"none"}}),h("span",{class:"status-item",text:`缩放 ${t.scale}%`}),h("span",{class:"status-item",text:`元素 ${t.elements.length}${t.selectedIds.size?` (选中 ${t.selectedIds.size})`:""}`}),h("span",{class:"status-item status-version",text:`v${Jx}`}),h("span",{class:"status-item status-paper",text:l})])}const a2=Object.keys(Ot).filter(e=>e!=="CUSTOM"&&!Ot[e]?.continuous);function s2(e){const t=document.createElement("label");t.className="pd-button small upload-label";const n=document.createTextNode("上传背景图"),r=document.createElement("input");r.className="visually-hidden",r.type="file",r.accept="image/*",t.append(n,r);const o=i=>{t.className=`pd-button small upload-label${i?" disabled":""}`,r.disabled=i};return r.addEventListener("change",async()=>{const i=r.files?.[0];if(!i)return;if(!i.type.startsWith("image/")){alert("仅支持上传图片文件"),r.value="";return}const a=e.host.uploadDesignBackground;if(!a){alert("设计背景上传能力未配置"),r.value="";return}o(!0),n.textContent="上传中...";try{const l=await a(i);l?e.store.updateTemplateData({designBackground:{src:l,rotation:0}}):alert("设计背景上传失败")}catch(l){alert(l instanceof Error?l.message:"设计背景上传失败")}finally{n.textContent="上传背景图",o(!e.host.uploadDesignBackground),r.value=""}}),e.host.uploadDesignBackground||o(!0),t}function l2(e){const n=e.store.templateData.designBackground,r=n?.rotation??0;return h("div",{class:"design-background-config"},[$t("设计背景"),h("p",{class:"design-background-tip",text:"仅设计器显示,用于套打定位,不会出现在预览和打印中"}),n?.src?[h("div",{class:"design-background-path",title:n.src,text:n.src}),h("div",{class:"design-background-actions"},[h("button",{type:"button",class:"pd-button small rotate-btn",text:`旋转(${(r+90)%360}°)`,onClick:()=>e.store.updateTemplateData({designBackground:{...n,rotation:(r+90)%360}})}),h("button",{type:"button",class:"pd-button small remove-btn",text:"移除",onClick:()=>e.store.updateTemplateData({designBackground:void 0})})])]:s2(e)].flat())}function c2(e){const t=e.store,n=t.templateData,r=n.tiling,o={...Pt,...r??{},enabled:r?.enabled??!1,sheetMargin:{...Pt.sheetMargin,...r?.sheetMargin??{}}},i=_o(n.paperSize),a=g=>t.updateTemplateData({tiling:{...o,...g}}),l=g=>Cn({target:o,base:Pt,propKey:g,write:()=>a({[g]:Pt[g]})}),c=g=>Cn({target:o.sheetMargin,base:Pt.sheetMargin,propKey:g,write:()=>s(g,Pt.sheetMargin[g])}),s=(g,m)=>a({sheetMargin:{...o.sheetMargin,[g]:m??0}}),d={...n,tiling:o},p=as(d),u=Math.max(gu(d),1);let f="";if(!p.length)try{const g=hu(d),m=Ir(d),b=o.sheetPaperSize==="CUSTOM"?"自定义":o.sheetPaperSize??"A4",v=o.sheetPaperSize==="CUSTOM"?"":o.sheetOrientation==="landscape"?" 横向":" 纵向";f=`目标纸 ${b}${v} ${m.width}×${m.height}mm · ${g.columns} 列 × ${g.rows} 行 = 每张 ${g.perSheet} 格 · 每格 ${g.tile.width}×${g.tile.height}mm`}catch{f=""}return h("div",{class:"tiling-config",dataset:{test:"tiling-config"}},[$t("拼版打印"),h("p",{class:"pd-hint",text:"把标签按「列 × 行」铺到一张大纸上批量打印"}),h("div",{class:"pd-field"},[h("label",{class:"tiling-switch"},[h("input",{type:"checkbox",checked:o.enabled===!0,disabled:i,onChange:g=>{if(!g.target.checked){a({enabled:!1});return}a({...Pt,columns:Math.min(Pt.columns,Math.max(u,1))})}}),h("span",{text:"启用拼版"})]),i?h("p",{class:"pd-hint tiling-error",text:"连续纸不支持拼版"}):""].filter(Boolean)),o.enabled&&!i?[se("目标纸张",h("select",{class:"pd-select",style:{width:"100%"},onChange:g=>{const m=g.target.value;if(m!=="CUSTOM"){a({sheetPaperSize:m});return}const b=Ir(d);a({sheetPaperSize:"CUSTOM",sheetCustomWidth:o.sheetCustomWidth??b.width,sheetCustomHeight:o.sheetCustomHeight??b.height})}},[...a2.map(g=>h("option",{value:g,text:Ot[g]?.label??g,selected:(o.sheetPaperSize??"A4")===g})),h("option",{value:"CUSTOM",text:"自定义",selected:o.sheetPaperSize==="CUSTOM"})]),void 0,l("sheetPaperSize")),o.sheetPaperSize==="CUSTOM"?se("目标纸宽高 (mm)",h("div",{class:"custom-size-grid"},[J({value:Number(o.sheetCustomWidth??0),min:25,max:2e3,onCommit:g=>a({sheetCustomWidth:g})}),h("span",{class:"custom-size-x",text:"×"}),J({value:Number(o.sheetCustomHeight??0),min:25,max:2e3,onCommit:g=>a({sheetCustomHeight:g})})])):se("目标纸方向",on("tiling-ori",[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],o.sheetOrientation==="landscape"?"landscape":"portrait",g=>a({sheetOrientation:g})),void 0,l("sheetOrientation")),$t("拼版留白 (mm)"),h("div",{class:"margin-grid"},[se("上",J({value:o.sheetMargin.top??0,min:0,max:100,onCommit:g=>s("top",g)}),void 0,c("top")),se("下",J({value:o.sheetMargin.bottom??0,min:0,max:100,onCommit:g=>s("bottom",g)}),void 0,c("bottom")),se("左",J({value:o.sheetMargin.left??0,min:0,max:100,onCommit:g=>s("left",g)}),void 0,c("left")),se("右",J({value:o.sheetMargin.right??0,min:0,max:100,onCommit:g=>s("right",g)}),void 0,c("right"))]),$t("格间距与列数"),se("横向间距",J({value:o.gapX??0,min:0,max:50,onCommit:g=>a({gapX:g??0})}),void 0,l("gapX")),se("纵向间距",J({value:o.gapY??0,min:0,max:50,onCommit:g=>a({gapY:g??0})}),void 0,l("gapY")),se("列数",J({value:o.columns??1,min:1,max:u,onCommit:g=>a({columns:g||1})})),...p.map(g=>h("p",{class:"pd-hint tiling-error",text:g.message})),!p.length&&f?h("p",{class:"pd-hint tiling-summary",text:f}):""]:""].flat().filter(Boolean))}const d2=new Set(Mo.map(e=>e.group)),u2={"table-settings":"content"},Hh=new Map;function Sl(e){const t=e??"";let n=Hh.get(t);if(!n){const{groups:r,itemKeys:o}=m0(t);n={groups:r,keys:o,searching:!!t.trim()},Hh.set(t,n)}return n}function _l(e){const t=u2[e]??e;return d2.has(t)?t:""}function p2(e,t){const n=Sl(e.state.propSearch);if(!n.searching)return!0;const r=_l(t);return!r||n.groups.includes(r)}function f2(e,t){const n=Sl(e.state.propSearch);return!n.searching||n.keys.has(t)}function Uh(e,t){const n=e.props.style??{};return e.props.style={...n,display:t?"":"none"},e}function W(e,t,n){const r=n.props.dataset??{};return n.props.dataset={...r,propKey:t},Uh(n,f2(e,t))}function h2(e,t,n){const r=_l(t);if(!r)return n;const o=n.props.dataset??{};return n.props.dataset={...o,propGroup:r},Uh(n,p2(e,t))}function qh(e,t){const n=Sl(t);for(const r of Array.from(e.querySelectorAll("[data-prop-group]"))){const o=_l(r.dataset.propGroup??"");r.style.display=!n.searching||!o||n.groups.includes(o)?"":"none"}for(const r of Array.from(e.querySelectorAll("[data-prop-key]")))r.style.display=!n.searching||n.keys.has(r.dataset.propKey??"")?"":"none"}function g2(e){return h("div",{class:"property-search"},[h("input",{class:"pd-input",type:"search",placeholder:"搜索属性...","aria-label":"搜索属性",value:e.state.propSearch??"",onInput:t=>{const n=t.target,r=n.value;e.state.propSearch=r,qh(n.getRootNode(),r)}})])}const m2={Document:"≡",Brush:"◧",Setting:"⚙"};function b2(e,t){try{const n=window.localStorage.getItem(`property-group-${e}`);return n===null?t:n==="true"}catch{return t}}function y2(e,t){try{window.localStorage.setItem(`property-group-${e}`,String(t))}catch{}}function Qe(e,t,n,r,o,i=!0,a=[]){const l=b2(t,i);return h2(e,t,h("div",{class:`property-group${l?" is-expanded":""}`},[h("div",{class:"group-header",onClick:()=>{y2(t,!l),e.repaint()}},[h("span",{class:"group-icon",text:m2[r]||"•"}),h("span",{class:"group-title",text:n}),...a,h("span",{class:"expand-icon",text:l?"▾":"▸"})]),h("div",{class:"group-content",style:l?"":{display:"none"}},o.filter(Boolean))]))}function ji(e){return h("form",{class:"pd-form",onSubmit:t=>t.preventDefault()},e.filter(Boolean))}function Wh(e){return e.split(".").flatMap(t=>{const n=t.match(/^([^\[]+)((?:\[\d+\])*)$/);if(!n)return[t];const r=n[1],o=[...n[2].matchAll(/\[(\d+)\]/g)].map(i=>Number(i[1]));return[r,...o]})}function jh(e,t){return Wh(t).reduce((o,i)=>o==null?"":o[i],e)??""}function Ml(e,t,n,r){const o=Wh(n),i=o.pop(),a=o.reduce((l,c)=>((l[c]===void 0||l[c]===null)&&(l[c]={}),l[c]),t);a[i]=r||void 0,e.recordHistory(),e.emit()}function v2(e,t){const n=e.store;if(t.printElementType.type==="table"&&n.tableSelection?.elementId===t.id){const{r1:r,c1:o}=n.tableSelection,i=(t.options.tableRows??[])[r];if(i)return Cu(i.type,r,o,t.options.fields?.[0]?.dataSource)}return N1(t)}function w2(e,t){const n=document.createElement("label");n.className="pd-button small upload-label",Ze(h("svg",{class:"pd-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"currentColor",d:"M12 3l4 4h-3v7h-2V7H8zm-7 12h14v5H5Z"})]),n);const r=document.createTextNode("上传图片"),o=document.createElement("input");o.className="visually-hidden",o.type="file",o.accept="image/*",n.append(r,o);const i=c=>{n.className=`pd-button small upload-label${c?" disabled":""}`,o.disabled=c};o.addEventListener("change",async()=>{const c=o.files?.[0];if(!c)return;if(!c.type.startsWith("image/")){alert("仅支持上传图片文件"),o.value="";return}const s=e.host.uploadImage;if(!s){alert("图片上传能力未配置"),o.value="";return}i(!0),r.textContent="上传中...";try{const d=await s(c);d?Ml(e.store,t,"options.src",d):alert("图片上传失败")}catch(d){alert(d instanceof Error?d.message:"图片上传失败")}finally{r.textContent="上传图片",i(!e.host.uploadImage),o.value=""}}),e.host.uploadImage||i(!0);const a=document.createElement("div");a.className="image-content-upload";const l=document.createElement("p");return l.className="upload-tip",l.textContent="支持 jpg/png/gif/bmp/webp/svg 等图片,上传后填入相对路径",a.append(n,l),a}function x2(e,t){const n=r=>e.fire("open-expression",{elementId:t.id,targetPath:r.targetPath,value:jh(t,r.targetPath)});return Qe(e,"binding","内容","Document",[...v2(e,t).map(r=>se(r.label,h("input",{class:"pd-input",type:"text",value:jh(t,r.targetPath),placeholder:r.placeholder||"输入内容,支持 {字段} 表达式",onChange:o=>Ml(e.store,t,r.targetPath,o.target.value),onDblclick:()=>n(r)}))),t.printElementType.type==="image"?w2(e,t):""].filter(Boolean))}const Jr=new Map;function Gi(e){return`${Math.round(e*1e4)/1e4}%`}function Gh(e,t){const n=S1(t.value),r=n.kind==="custom",o=n.kind==="axes"?n.x:50,i=n.kind==="axes"?n.y:50,a=A1(t.src),l=Jr.get(a.src),c={widthMm:t.widthMm,heightMm:t.heightMm,naturalWidth:l?.width,naturalHeight:l?.height,fit:t.fit,scalePct:t.scale},s=_1(c),d=M1(c,o,i),p=document.createElement("select");p.className="pd-select",p.style.width="100%";for(const m of R1(s,o,i)){const b=document.createElement("option");b.value=m.value,b.textContent=m.label,p.appendChild(b)}if(r){const m=document.createElement("option");m.value="custom",m.textContent="自定义(保留原值)",p.appendChild(m)}p.value=r?"custom":`${o},${i}`,p.selectedIndex<0&&(p.selectedIndex=r?p.options.length-1:0),p.addEventListener("change",()=>{if(p.value==="custom")return;const[m,b]=p.value.split(",").map(Number);t.onCommit(wu(m,b))});const u=Ae(t.fieldKey),f=[h("div",{class:"pd-field",dataset:{field:t.fieldKey}},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t"},[t.label,El(u)]),t.resetAnchor??""].filter(Boolean)),p])];f.push(h("div",{class:"pd-field",dataset:{field:"ap-img-fit-scale"}},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t"},[O1,El(Ae("ap-img-fit-scale"))]),t.resetScale??""].filter(Boolean)),J({value:t.scale,min:gr,max:Ic,step:5,placeholder:"默认 100",onCommit:m=>t.onScaleCommit(m>gr?m:void 0)})]));for(const m of P1(s,o,i))f.push(h("div",{class:"pd-field",dataset:{field:t.fieldKey}},[h("span",{class:"pd-label",text:m.label}),J({value:m.value,min:0,max:100,step:1,onCommit:b=>t.onCommit(wu(m.name==="horizontal"?b:o,m.name==="vertical"?b:i))})]));const g=I1(s,r);return g&&f.push(h("p",{class:"pd-crop-note",text:g})),a.isSample&&f.push(h("p",{class:"pd-crop-note",text:C1})),f.push(h("div",{class:"pd-crop-preview"},[h("img",{class:"pd-crop-thumb",src:a.src,alt:a.isSample?"示例图":"原图",onLoad:m=>{const b=m.target;if(!(b.naturalWidth>0&&b.naturalHeight>0))return;const v=Jr.get(a.src);v&&v.width===b.naturalWidth&&v.height===b.naturalHeight||(Jr.set(a.src,{width:b.naturalWidth,height:b.naturalHeight}),e.repaint())},onError:()=>{Jr.has(a.src)&&(Jr.delete(a.src),e.repaint())}}),d?h("div",{class:"pd-crop-win",style:{left:Gi(d.leftPct),top:Gi(d.topPct),width:Gi(d.widthPct),height:Gi(d.heightPct)}}):""])),h("div",{class:t.containerClass??"pd-crop-anchor"},f)}const An=e=>Number(e??0),Tl=e=>e||void 0;function On(e,t,n,r,o,i){return h("div",{class:"pd-field"},[h("span",{class:"pd-label",...r?{title:r}:{}},[h("span",{class:"pd-label-t",text:e}),o??""].filter(Boolean)),h("input",{class:"pd-switch",type:"checkbox",checked:t,...i?{disabled:!0}:{},onChange:a=>n(a.target.checked)})])}function Vh(e,t,n,r,o=!1,i){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:e}),""].filter(Boolean)),h("select",{class:"pd-select",...o?{style:{width:"100%"}}:{},onChange:a=>r(a.target.value)},n.map(a=>h("option",{value:a.value,text:a.label,selected:a.value===t})))])}function Qr(e,t,n,r,o={}){return h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:e}),o.reset??""].filter(Boolean)),Fh(t,n,r,{className:"pd-select",...o.full?{width:"100%"}:{}})])}const er=e=>h("p",{class:"pd-hint",text:e}),E2="多级表头作为一个结构整体重复,勾选后表头区所有行都会在每页顶部重复",S2=[{value:"header",label:"标题行"},{value:"data",label:"数据行"},{value:"subtotal",label:"小计行(每页小计)"},{value:"summary",label:"汇总行"}],_2=[{value:"CODE128",label:"CODE128(通用)"},{value:"EAN13",label:"EAN13(商品码)"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],M2=[{value:"L",label:"L(最低,容量大)"},{value:"M",label:"M(推荐)"},{value:"Q",label:"Q"},{value:"H",label:"H(最高)"}],T2=[{value:"clip",label:"截断"},{value:"shrink",label:"自动缩小"},{value:"autoHeight",label:"自适应行高"}],k2={value:"__multi__",label:"多选",disabled:!0};function C2(e,t){const n=e.store,r=n.tableSelection,o=t.options.tableRows??[],i=r?o[r.r1]:void 0;if(!r||!i)return Qe(e,"table-row","行属性","Grid",[]);const a=l=>n.updateElement(t.id,l);return Qe(e,"table-row","行属性","Grid",[ji([Vh("行类型",i.type,S2,l=>{const c=na(o,r.r1,l);if(c){window.alert(c);return}a({tableRows:o})},!0),h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"行高 (mm)"}),J({value:i.height,min:3,max:100,step:.5,onCommit:l=>{i.height=l,a({tableRows:o})}})]),i.type==="header"?On("表头每页重复",i.repeatOnPage??!1,l=>{$g(o,l),a({tableRows:o})},E2):""])])}function A2(e,t){const n=e.store,r=t.options,o=d=>n.updateElement(t.id,d),i=r.tableColWidths??[],a=n.paperSize.width-n.templateData.margins.left-n.templateData.margins.right,l=n.fields.filter(d=>d.fieldType==="list").map(d=>({value:d.fieldKey,label:d.fieldLabel})),c=Ea("table"),s=d=>Cn({target:r,base:c,propKey:d,write:()=>o({[d]:c[d]})});return Qe(e,"table-settings","表格设置","Grid",[ji([Vh("列表数据源字段",r.dataSource??"",l,d=>o({dataSource:d||void 0}),!0),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认字体"}),s("tableDefaultFontFamily")]),qi({id:"table-default-font",state:e.state,fonts:e.host.fonts,value:r.tableDefaultFontFamily,placeholder:"默认",onChange:d=>o({tableDefaultFontFamily:d||void 0})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认字号 (pt)"}),s("tableDefaultFontSize")]),J({value:An(r.tableDefaultFontSize),min:0,max:72,placeholder:"默认",onCommit:d=>o({tableDefaultFontSize:Tl(d)})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认文字颜色"}),s("tableDefaultColor")]),ot(r.tableDefaultColor,d=>o({tableDefaultColor:d}),"默认文字颜色")]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"默认内边距 (mm)"}),s("tableDefaultPadding")]),J({value:An(r.tableDefaultPadding),min:0,max:10,step:.5,placeholder:"默认",onCommit:d=>o({tableDefaultPadding:Tl(d)})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"列宽 (mm)"}),...i.map((d,p)=>h("div",{class:"col-width-row"},[h("span",{style:{width:"60px"},text:`列${p+1}`}),J({value:d,min:5,max:200,onCommit:u=>{const f=i.reduce((g,m,b)=>b===p?g:g+m,0);if(f+u>a){const g=Math.max(5,Math.round((a-f)*10)/10);window.alert(`表格总宽不能超过打印范围宽度 ${a}mm,列${p+1} 已调整为 ${g}mm`),i[p]=g}else i[p]=u;o({tableColWidths:i})}})]))])])])}function O2(e,t){const n=e.store,r=t.options,o=t.printElementType.type==="table",i=l=>n.updateElement(t.id,l),a=[];if(o)a.push(W(e,"pg-enabled",On("启用分页",r.tablePagination?.enabled??!0,l=>i({tablePagination:{enabled:l}}))));else{const l=r.pagination?.pageable??!0,c=r.pagination?.keepWithNext??!1;a.push(W(e,"pg-pageable",On("参与分页",l,s=>i({pagination:{pageable:s,keepWithNext:c}})))),a.push(W(e,"pg-keep-with-next",On("与下元素同页",c,s=>i({pagination:{pageable:l,keepWithNext:s}}))))}return Qe(e,"pagination","分页配置","Document",[ji(a)],!1)}const kl=new WeakMap,Yh=[{value:"top",label:"上"},{value:"right",label:"右"},{value:"bottom",label:"下"},{value:"left",label:"左"}];function I2(e,t){const n=e.store,r=n.tableSelection,o=t.options.tableRows??[];if(!r)return Qe(e,"table-cell","单元格","Menu",[]);const i=ar(o,r.r1,r.c1),a=o[i.r]?.cells[i.c];if(!a)return Qe(e,"table-cell","单元格","Menu",[]);const l=()=>lo(o,r),c=ra(o,r),s=c.count,d=c.mode==="multi",p=`${t.id}:${r.r1}:${r.c1}:${r.r2}:${r.c2}`,u=kl.get(n),f=u?.key===p?u:{key:p,border:{},values:{},edges:{}};u?.key!==p&&kl.set(n,f);const g=_=>{kl.set(n,{key:p,border:_.border??f.border,values:_.values??f.values,edges:_.edges??f.edges})},m=(_,G)=>{g({border:{...f.border,[_]:G}}),e.repaint()},b=(_,G)=>{l().forEach(_),d&&G&&g({values:{...f.values,...G}}),n.updateElement(t.id,{tableRows:o})},v=(_,G)=>{b(K=>{K[_]=G},{[_]:G})},w=_=>d?f.values[_]:a[_],E=_=>d&&_ in f.values,k=d?{width:void 0,style:void 0,color:void 0}:lc(o,r),L=!d&&l().some(_=>!!_.borders&&!!(_.borders.top||_.borders.right||_.borders.bottom||_.borders.left)),R=!d&&!L,P={width:R?0:typeof k.width=="number"?k.width:Kt.width,style:R?"none":typeof k.style=="string"&&k.style!=="mixed"?k.style:Kt.style,color:typeof k.color=="string"&&k.color!=="mixed"?k.color:Kt.color,...f.border},O="__mixed__",C={style:!d&&k.style==="mixed",width:!d&&k.width==="mixed",color:!d&&k.color==="mixed"},I=C.style&&!("style"in f.border),S=C.width&&!("width"in f.border),$=C.color&&!("color"in f.border),N=I||S||$,z=I?O:P.style,T=S?void 0:P.width,ie=$?void 0:P.color,pe=_=>{const G={style:_};_!=="none"&&T===0?G.width=Kt.width:_==="none"&&!L&&(G.width=0),g({border:{...f.border,...G}}),e.repaint()},Ge=()=>({...P}),Q=d?Yh.reduce((_,G)=>(_[G.value]=f.edges[G.value]?"on":"off",_),{}):Xc(l().map(_=>_.borders)),Te=d?"cellType"in f.values?f.values.cellType??"text":zg(o,r):a.cellType??"text",he=Te==="barcode",de=Te==="qrcode",ye=Te==="image",ne=Te==="text",De=he&&!!w("printerDpi"),it=Cc(w("printerDpi"),w("barWidth")),te=d?f.values.textFit:aa(a),Ve=d?"cellType"in f.values?f.values.cellType??"text":"":a.cellType||"text",$e=_=>d?[k2,..._]:_,fe=_=>d?"多选":_,me=(_,G)=>d?f.values[_]:G,tr=d?w("barcodeType")??"__multi__":a.barcodeType||"CODE128",to=d?E("printerDpi")?w("printerDpi")?String(w("printerDpi")):"":"__multi__":a.printerDpi?String(a.printerDpi):"",no=d?w("qrCodeLevel")??"__multi__":a.qrCodeLevel||"M",ro=d?w("fit")??"__multi__":a.fit||"contain",nr=te??"__multi__",ge=tc(o,r);let Mt=!0;for(let _=r.r1;_<=r.r2;_++)if(o[_]?.type!=="data"){Mt=!1;break}const M=Mt?"":"仅数据行(明细行)支持按值合并";let H=!1;for(let _=r.r1;_<=r.r2&&!H;_++)for(let G=r.c1;G<=r.c2&&!H;G++){const K=o[_]?.cells[G];K&&!K.merged&&((K.rowspan??1)>1||(K.colspan??1)>1)&&(H=!0)}const B=(_,G,K,Z={},oe)=>h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:_}),oe??""].filter(Boolean)),J({value:G,...Z,onCommit:be=>v(K,Tl(be))})]),q="恢复默认值(跟随表格默认)",U=_=>Cn({target:a,base:{},propKey:_,tipOverride:q,force:d,write:()=>v(_,void 0)}),V=t.options.tableDefaultPadding??1,ee={width:la(t.options.tableColWidths??[],i.c,a,V),height:ur(o,i.r,a,V)};return Qe(e,"table-cell","单元格","Menu",[ji([d?er(`已选 ${s} 格 · 批量设置:不显示单格配置,改动会应用到全部选中格`):"",h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"单元格类型"}),on("cell-type",[{value:"text",label:"文本"},{value:"barcode",label:"条形码"},{value:"qrcode",label:"二维码"},{value:"image",label:"图片"}],Ve,_=>{const G=_==="text"?void 0:_,K={cellType:_};_!=="barcode"&&Object.assign(K,{barcodeType:void 0,showBarcodeText:void 0,printerDpi:void 0,barQuietZone:void 0,barHeight:void 0}),_!=="qrcode"&&Object.assign(K,{qrCodeLevel:void 0,qrQuietZone:void 0}),b(Z=>{Z.cellType=G,_!=="barcode"&&(Z.barcodeType=void 0,Z.showBarcodeText=void 0,Z.printerDpi=void 0,Z.barQuietZone=void 0,Z.barHeight=void 0),_!=="qrcode"&&(Z.qrCodeLevel=void 0,Z.qrQuietZone=void 0)},K)})]),he?Qr("码制",tr,$e(_2),_=>{_!=="__multi__"&&v("barcodeType",_||void 0)}):"",he?On("显示文本",d?f.values.showBarcodeText===!0:a.showBarcodeText!==!1,_=>v("showBarcodeText",_),void 0,U("showBarcodeText")):"",he?B("条宽(倍率)",me("barWidth",a.barWidth??2),"barWidth",{min:2,max:8,step:.5,placeholder:fe("")},U("barWidth")):"",he?er((De?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),单元格放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定")+(it?`。${it}`:"")):"",he?He("静区 (模块)",J({value:me("barQuietZone",a.barQuietZone),min:0,max:20,placeholder:fe("默认 10"),onCommit:_=>v("barQuietZone",_)}),Ae("cd-bar-quiet-zone"),U("barQuietZone")):"",he?He("条高 (mm)",J({value:me("barHeight",a.barHeight),min:1,max:100,placeholder:fe("默认 30 模块"),onCommit:_=>v("barHeight",_??void 0)}),Ae("cd-bar-height"),U("barHeight")):"",he?B("文本字号(相对条高,条高为 30)",me("barFontSize",a.barFontSize??10),"barFontSize",{min:5,max:24,placeholder:fe("默认 10")},U("barFontSize")):"",he?Qr("打印机分辨率",to,$e([{value:"",label:"不指定(按条宽渲染)"},{value:"203",label:"203 dpi(8 点/mm)"},{value:"300",label:"300 dpi(11.8 点/mm)"},{value:"600",label:"600 dpi(23.6 点/mm)"}]),_=>{if(_==="__multi__")return;const G=Number(_);v("printerDpi",G>0?G:void 0)},{reset:U("printerDpi")}):"",he?er("填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小"):"",de?Qr("纠错级别",no,$e(M2),_=>{_!=="__multi__"&&v("qrCodeLevel",_||void 0)},{reset:U("qrCodeLevel")}):"",de?He("静区 (模块)",J({value:me("qrQuietZone",a.qrQuietZone),min:0,max:8,placeholder:fe("默认 0"),onCommit:_=>v("qrQuietZone",_)}),Ae("cd-quiet-zone"),U("qrQuietZone")):"",he?er("单元格条码尺寸由「条宽」与「打印机分辨率」结算:可用宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限。要放大条码:先加条宽倍率,再收窄静区(左右白边会换成条宽),必要时关掉显示文本以让出文本区高度"):"",de||ye?Qr("缩放模式",ro,$e(cs),_=>{_!=="__multi__"&&v("fit",_)},{reset:U("fit")}):"",ye&&!d&&a.fit==="cover"?Gh(e,{fieldKey:"ap-img-object-position",label:"裁剪锚点",src:Su(a.formatter),fit:a.fit,containerClass:"pd-cell-anchor",widthMm:ee.width,heightMm:ee.height,scale:a.fitScale,value:a.objectPosition,onCommit:_=>v("objectPosition",_),onScaleCommit:_=>v("fitScale",_),resetAnchor:U("objectPosition"),resetScale:U("fitScale")}):"",he||de||ye?B("最大宽度 (mm)",me("maxWidth",An(a.maxWidth)),"maxWidth",{min:0,max:200,placeholder:fe("默认")},U("maxWidth")):"",he||de||ye?B("最大高度 (mm)",me("maxHeight",An(a.maxHeight)),"maxHeight",{min:0,max:200,placeholder:fe("默认")},U("maxHeight")):"",h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"内容"}),h("input",{class:"pd-input",type:"text",value:d?w("formatter")??"":a.formatter||"",placeholder:d?"多选(输入后覆盖全部选中格)":"输入内容,支持 {字段} 表达式",onChange:_=>v("formatter",_.target.value||void 0),onDblclick:()=>e.fire("table-cell-dblclick",{elementId:t.id,r:i.r,c:i.c,cellId:a.id})})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"水平对齐"}),U("align")]),on("cell-align",[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"},{value:"justify",label:"两端"}],d?f.values.align??"":a.align||"left",_=>v("align",_))]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"垂直对齐"}),U("valign")]),on("cell-valign",[{value:"top",label:"上"},{value:"middle",label:"中"},{value:"bottom",label:"下"}],d?f.values.valign??"":a.valign||"top",_=>v("valign",_))]),h("div",{class:"cell-style-grid"},[h("div",{class:"pd-field cell-font-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"字体"}),U("fontFamily")]),qi({id:"cell-font",state:e.state,fonts:e.host.fonts,value:d?w("fontFamily"):a.fontFamily,placeholder:fe("继承默认"),onChange:_=>v("fontFamily",_)})]),B("字号 (pt)",me("fontSize",An(a.fontSize)),"fontSize",{min:0,max:72,placeholder:fe("默认")},U("fontSize")),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"加粗"}),U("fontWeight")]),h("input",{class:"pd-switch",type:"checkbox",checked:d?f.values.fontWeight==="bold":a.fontWeight==="bold",onChange:_=>v("fontWeight",_.target.checked?"bold":void 0)})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"文字颜色"}),U("color")]),ot(d?w("color"):a.color,_=>v("color",_),"文字颜色")]),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"背景色"}),U("backgroundColor")]),ot(d?w("backgroundColor"):a.backgroundColor,_=>v("backgroundColor",_),"背景颜色")])]),$t("边框"),h("div",{class:"border-style-row"},[Fh(z,[...I?[{value:O,label:"混合",disabled:!0}]:[],...Ta],_=>{_!==O&&pe(_)},{width:"90px"}),h("div",{style:{width:"112px",flexShrink:"0"}},[J({value:T,min:.25,max:5,step:.25,placeholder:d?"多选":S?"混合":void 0,onCommit:_=>m("width",_)})]),ot(ie,_=>m("color",_),"边框颜色")]),h("div",{class:"pd-button-group border-presets"},[["all","全部"],["outer","外侧"],["inner","内部"],["none","无"]].map(([_,G])=>h("button",{type:"button",class:"pd-button small",text:G,onClick:()=>{ac(o,r,P.style==="none"?"none":_,Ge()),n.updateElement(t.id,{tableRows:o})}}))),h("div",{class:"pd-checkbox-group"},Yh.map(_=>h("label",{class:"pd-checkbox"},[h("input",{type:"checkbox",value:_.value,checked:Q[_.value]==="on",indeterminate:Q[_.value]==="mixed",onChange:G=>{const Z=G.target.checked&&P.style!=="none";d&&g({edges:{...f.edges,[_.value]:Z}}),b(oe=>{sc(oe,_.value,Z?Ge():null)})}}),h("span",{text:_.label})]))),er(d?Lg:N?Fg:Ng),B("内边距 (mm)",me("padding",An(a.padding)),"padding",{min:0,max:10,step:.5,placeholder:fe("默认")},U("padding")),On("自动换行",d?f.values.wordWrap===!0:a.wordWrap??!0,_=>v("wordWrap",_),void 0,U("wordWrap")),ne?Qr("文字溢出",nr,$e(T2),_=>{_!=="__multi__"&&v("textFit",_)},{full:!0,reset:U("textFit")}):"",ne&&te==="shrink"?B("最小字号 (pt)",me("shrinkMinFontSize",An(a.shrinkMinFontSize)),"shrinkMinFontSize",{min:0,max:72,step:.5,placeholder:fe("默认 6")},U("shrinkMinFontSize")):"",h("div",{class:"merge-card"},[h("div",{class:"merge-card-title",text:"单元格合并"}),h("div",{class:"merge-btns"},[h("button",{type:"button",class:"pd-button small",text:"合并单元格",disabled:!!ge,title:ge||"",onClick:()=>{nc(o,r),n.updateElement(t.id,{tableRows:o})}}),h("button",{type:"button",class:"pd-button small",text:"拆分单元格",disabled:!H,onClick:()=>{rc(o,r),n.updateElement(t.id,{tableRows:o})}})]),h("div",{class:"merge-card-divider"}),On("按值合并",d?f.values.mergeSameValue===!0:a.mergeSameValue===!0,_=>v("mergeSameValue",_),M||void 0,Mt?U("mergeSameValue"):void 0,!Mt),er("明细相邻行同值时自动纵向合并;跨页时在该页内成段,续页首行重放该值")])])])}const Cl=lb;function Al(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 P2(e){return e?e.mode==="binding"?e.binding??"":e.content??"":""}function R2(e){const t=e.store.templateData.watermark,n=P2(t),r=t?.mode==="binding"||n!==""&&Al(n),o=(()=>{const s=t?.tileWidth??le.tileWidth,d=t?.tileHeight??le.tileHeight;for(const[p,u]of Object.entries(Cl))if(u.width===s&&u.height===d)return p;return"custom"})(),i=s=>{const d={...t,testData:t?.testData??"",rotate:t?.rotate??le.rotate,color:t?.color||le.color,opacity:t?.opacity??le.opacity,tileWidth:t?.tileWidth??le.tileWidth,tileHeight:t?.tileHeight??le.tileHeight};e.store.updateTemplateData({watermark:{...d,...s}})},a=()=>e.fire("open-expression",{elementId:"",targetPath:"watermark.content",value:n}),l={rotate:t?.rotate??le.rotate,color:t?.color||le.color,opacity:t?.opacity??le.opacity,tileWidth:t?.tileWidth??le.tileWidth,tileHeight:t?.tileHeight??le.tileHeight},c=s=>Cn({target:l,base:le,propKey:s,write:()=>i({[s]:le[s]})});return h("div",{class:"watermark-config"},[$t("水印"),h("form",{class:"pd-form",onSubmit:s=>s.preventDefault()},[h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"水印表达式"}),h("input",{class:"pd-input",type:"text",value:n,placeholder:"直接输入文字,或用表达式:{order.no}、{printDate}",title:"双击或点「编辑表达式」打开表达式弹框",onChange:s=>{const d=s.target.value;i(Al(d)?{mode:"binding",binding:d,content:""}:{mode:"fixed",content:d,binding:""})},onDblclick:a}),h("button",{type:"button",class:"pd-button small",text:"编辑表达式",onClick:a})]),r?se("测试值",h("input",{class:"pd-input",type:"text",value:t?.testData??"",placeholder:"表达式取不到值时预览显示",onChange:s=>i({testData:s.target.value})})):"",h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"旋转角度"}),c("rotate")]),h("input",{type:"range",class:"pd-range",min:-90,max:90,step:5,value:String(t?.rotate??le.rotate),onChange:s=>i({rotate:Number(s.target.value)})}),h("span",{class:"pd-hint",text:`${t?.rotate??le.rotate}°`})]),se("颜色",ot(t?.color||le.color,s=>i({color:s}),"水印颜色"),void 0,c("color")),h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"透明度"}),c("opacity")]),h("input",{type:"range",class:"pd-range",min:.05,max:.5,step:.05,value:String(t?.opacity??le.opacity),onChange:s=>i({opacity:Number(s.target.value)})}),h("span",{class:"pd-hint",text:(t?.opacity??le.opacity).toFixed(2)})]),h("div",{class:"pd-field"},[h("span",{class:"pd-label",text:"密度"}),h("select",{class:"pd-select",style:{width:"100%"},onChange:s=>{const d=s.target.value,p=Cl[d];p&&i({tileWidth:p.width,tileHeight:p.height})}},[...Object.entries(Cl).map(([s,d])=>h("option",{value:s,text:`${d.label}(${d.width}×${d.height})`,selected:o===s})),h("option",{value:"custom",text:"自定义",selected:o==="custom"})])]),o==="custom"?h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"瓦片宽"}),c("tileWidth")]),h("input",{type:"number",class:"pd-input",min:le.minTileWidth,step:10,value:String(t?.tileWidth??le.tileWidth),onChange:s=>i({tileWidth:Number(s.target.value)})})]):"",o==="custom"?h("div",{class:"pd-field"},[h("span",{class:"pd-label"},[h("span",{class:"pd-label-t",text:"瓦片高"}),c("tileHeight")]),h("input",{type:"number",class:"pd-input",min:le.minTileHeight,step:10,value:String(t?.tileHeight??le.tileHeight),onChange:s=>i({tileHeight:Number(s.target.value)})})]):""].filter(Boolean))])}function Ie(e,t,n,r,o={},i){return se(t,J({value:n,...o,onCommit:r}),void 0,i)}function jt(e,t,n,r,o,i,a){const l=document.createElement("select");l.className="pd-select",l.addEventListener("change",()=>o(l.value));for(const c of r){const s=document.createElement("option");s.value=c.value,s.textContent=c.label,l.appendChild(s)}return l.value=n,r.some(c=>c.value===n)||(l.selectedIndex=-1),i?He(t,l,i,a):se(t,l,void 0,a)}function In(e,t,n,r,o){return se(t,h("input",{type:"checkbox",class:"pd-switch",checked:n,onChange:i=>r(i.target.checked)}),void 0,o)}const D2=[{value:"all",label:"全部"},{value:"outer",label:"外侧"},{value:"inner",label:"内部"},{value:"none",label:"无"}],$2=[{value:"top",label:"上"},{value:"right",label:"右"},{value:"bottom",label:"下"},{value:"left",label:"左"}];function N2(e,t){const n=e.store,r=t.options,o=t.printElementType.type,i=T=>n.updateElement(t.id,T),a=zf(o),l=a==="text",c=a==="code",s=a==="table",d=s&&n.tableSelection?.elementId===t.id,p=d&&ra(t.options.tableRows??[],n.tableSelection).mode==="multi",u=[];p||u.push(x2(e,t));const f=Ea(o),g=(T,ie)=>{const pe=b0(ie);return Cn({target:r,base:f,propKey:T,tipValue:pe?.value,tipUnit:pe?.unit,write:()=>i({[T]:f[T]})})};d||u.push(Qe(e,"position-size","位置与尺寸","Location",[h("form",{class:"pd-form",onSubmit:T=>T.preventDefault()},[h("div",{class:"position-grid"},[W(e,"ps-left",Ie(e,"X",r.left,T=>i({left:T}),{min:0})),W(e,"ps-top",Ie(e,"Y",r.top,T=>i({top:T}),{min:0})),W(e,"ps-width",Ie(e,"W",r.width,T=>i({width:T}),{min:4})),W(e,"ps-height",Ie(e,"H",r.height,T=>i({height:T}),{min:4}))]),h("h3",{class:"pd-divider",text:"外边距 (mm)"}),h("div",{class:"margin-grid"},[W(e,"ps-margin-top",Ie(e,"上",r.marginTop,T=>i({marginTop:T===0?void 0:T}),{},g("marginTop","ps-margin-top"))),W(e,"ps-margin-right",Ie(e,"右",r.marginRight,T=>i({marginRight:T===0?void 0:T}),{},g("marginRight","ps-margin-right"))),W(e,"ps-margin-bottom",Ie(e,"下",r.marginBottom,T=>i({marginBottom:T===0?void 0:T}),{},g("marginBottom","ps-margin-bottom"))),W(e,"ps-margin-left",Ie(e,"左",r.marginLeft,T=>i({marginLeft:T===0?void 0:T}),{},g("marginLeft","ps-margin-left")))])])]));const m=typeof r.rotate=="number"&&Number.isFinite(r.rotate)&&r.rotate!==0?mr(r.rotate):void 0,b=T=>i({rotate:T===void 0||T===0?void 0:mr(T)}),v=_m(o,r),w=$c(o)||Bc(n.elements).has(t.id),E=w?"":W(e,"ap-rotate",He("旋转 (°)",h("div",{class:"pd-rotate-row"},[h("button",{type:"button",class:"pd-rotate-btn",title:"逆时针 90°","aria-label":"逆时针旋转 90 度",text:"↺",onClick:()=>b((m??0)-90)}),h("div",{class:"pd-rotate-stepper"},[J({value:m,min:0,max:359,placeholder:"0",disabled:!v,onCommit:T=>b(T)})]),h("button",{type:"button",class:"pd-rotate-btn",title:"顺时针 90°","aria-label":"顺时针旋转 90 度",text:"↻",onClick:()=>b((m??0)+90)})]),Ae("ap-rotate"),g("rotate","ap-rotate"))),k=w||v?"":h("p",{class:"pd-hint pd-rotate-note",text:Sm});if(u.push(Qe(e,"appearance","外观","Brush",[h("form",{class:"pd-form",onSubmit:T=>T.preventDefault()},l?[W(e,"ap-font-family",se("字体",qi({id:"prop-font",state:e.state,fonts:e.host.fonts,value:typeof r.fontFamily=="string"?r.fontFamily:void 0,placeholder:"默认",onChange:T=>i({fontFamily:T})}),void 0,g("fontFamily","ap-font-family"))),W(e,"ap-font-size",Ie(e,"字体大小",r.fontSize,T=>i({fontSize:T}),{min:8,max:72},g("fontSize","ap-font-size"))),W(e,"ap-font-weight",jt(e,"字体粗细",String(r.fontWeight??""),[{value:"normal",label:"正常"},{value:"bold",label:"粗体"},{value:"bolder",label:"更粗"},{value:"lighter",label:"细体"}],T=>i({fontWeight:T}),void 0,g("fontWeight","ap-font-weight"))),W(e,"ap-align",se("对齐",on("ta",[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"},{value:"justify",label:"两端"}],r.textAlign||"left",T=>i({textAlign:T})),void 0,g("textAlign","ap-align"))),W(e,"ap-vertical-align",se("垂直对齐",on("va",[{value:"top",label:"顶"},{value:"middle",label:"中"},{value:"bottom",label:"底"}],r.verticalAlign||"top",T=>i({verticalAlign:T})),void 0,g("verticalAlign","ap-vertical-align"))),h("div",{class:"color-row"},[W(e,"ap-color",se("颜色",ot(r.color,T=>i({color:T}),"字体颜色"),void 0,g("color","ap-color"))),W(e,"ap-bg-color",se("背景色",ot(r.backgroundColor,T=>i({backgroundColor:T}),"背景颜色"),void 0,g("backgroundColor","ap-bg-color")))]),W(e,"ap-line-height",Ie(e,"行高",r.lineHeight,T=>i({lineHeight:T||void 0}),{min:0,max:100},g("lineHeight","ap-line-height"))),W(e,"ap-letter-spacing",Ie(e,"字间距",r.letterSpacing,T=>i({letterSpacing:T||void 0}),{min:0,max:20,step:.5},g("letterSpacing","ap-letter-spacing"))),W(e,"ap-text-fit",jt(e,"文字溢出",po(o,r),[{value:"clip",label:"截断"},{value:"shrink",label:"自动缩小"},{value:"autoHeight",label:"自适应行高"}],T=>i({textFit:T}),void 0,g("textFit","ap-text-fit"))),r.textFit==="shrink"?W(e,"ap-shrink-min",se("最小字号 (pt)",J({value:r.shrinkMinFontSize,min:1,max:72,step:.5,placeholder:"默认 6",onCommit:T=>i({shrinkMinFontSize:T||void 0})}),void 0,g("shrinkMinFontSize","ap-shrink-min"))):"",o==="longText"?W(e,"ap-long-text-indent",He("首行缩进 (字符)",J({value:r.longTextIndent,min:0,max:10,placeholder:"默认 0",onCommit:T=>i({longTextIndent:T||void 0})}),Ae("ap-long-text-indent"),g("longTextIndent","ap-long-text-indent"))):"",W(e,"ap-word-wrap",In(e,"自动换行",r.wordWrap!==!1,T=>i({wordWrap:T?void 0:!1}),g("wordWrap","ap-word-wrap"))),W(e,"ap-keep-line-breaks",In(e,"保留换行符",r.keepLineBreaks===!0,T=>i({keepLineBreaks:T?!0:void 0}),g("keepLineBreaks","ap-keep-line-breaks"))),E,k]:[o==="image"?W(e,"ap-img-fit",jt(e,"缩放模式",String(r.fit??"contain"),cs,T=>i({fit:T}),Ae("ap-img-fit"),g("fit","ap-img-fit"))):"",o==="image"&&r.fit==="cover"?W(e,"ap-img-object-position",Gh(e,{fieldKey:"ap-img-object-position",label:"裁剪锚点",src:Su(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:T=>i({objectPosition:T}),onScaleCommit:T=>i({fitScale:T}),resetAnchor:g("objectPosition","ap-img-object-position"),resetScale:g("fitScale","ap-img-fit-scale")})):"",E,k,o==="flowList"?h("p",{class:"pd-empty",text:"当前元素不支持外观设置"}):""].filter(Boolean))])),c){const T=o==="barcode",ie=String(r.barcodeType||"CODE128").toUpperCase(),pe=r.printerDpi?String(r.printerDpi):"",Ge=Cc(r.printerDpi,r.barWidth);u.push(Qe(e,"code","条码设置","Postcard",[h("form",{class:"pd-form",onSubmit:Q=>Q.preventDefault()},[T?[W(e,"cd-type",jt(e,"码制",ie,[{value:"CODE128",label:"CODE128(通用)"},{value:"EAN13",label:"EAN13(商品码)"},{value:"EAN8",label:"EAN8"},{value:"UPC",label:"UPC"},{value:"CODE39",label:"CODE39"},{value:"ITF14",label:"ITF14"}],Q=>i({barcodeType:Q==="CODE128"?void 0:Q}))),W(e,"cd-dpi",jt(e,"打印机分辨率",pe,[{value:"",label:"不指定(按条宽渲染)"},{value:"203",label:"203 dpi(8 点/mm)"},{value:"300",label:"300 dpi(11.8 点/mm)"},{value:"600",label:"600 dpi(23.6 点/mm)"}],Q=>i({printerDpi:Number(Q)>0?Number(Q):void 0}),void 0,g("printerDpi","cd-dpi"))),W(e,"cd-dpi",h("p",{class:"pd-hint",text:"填写后条宽吸附到整数打印点(消除出纸「条宽忽宽忽窄」):条码先按条宽渲染,可用宽度够就原样落纸,不够才整体等比缩小"})),W(e,"cd-bar-width",Ie(e,"条宽(倍率)",r.barWidth??2,Q=>i({barWidth:Q}),{min:2,max:8,step:.5},g("barWidth","cd-bar-width"))),W(e,"cd-bar-width",h("p",{class:"pd-hint",text:(pe?"已设置打印机分辨率:条宽会被吸附到最近的整数打印点(DPI 优先于毫米值),元素框放不下时整体等比缩小":"热敏/针式打印建议 3 及以上:决定条码的落纸尺寸,条越粗出纸后条宽越稳定")+(Ge?`。${Ge}`:"")})),W(e,"cd-bar-quiet-zone",He("静区 (模块)",J({value:r.barQuietZone,min:0,max:20,placeholder:"默认 10",onCommit:Q=>i({barQuietZone:Q})}),Ae("cd-bar-quiet-zone"),g("barQuietZone","cd-bar-quiet-zone"))),W(e,"cd-bar-height",He("条高 (mm)",J({value:r.barHeight,min:1,max:100,placeholder:"默认 30 模块",onCommit:Q=>i({barHeight:Q??void 0})}),Ae("cd-bar-height"),g("barHeight","cd-bar-height"))),W(e,"cd-show-text",In(e,"显示文本",r.hideTitle!==!0,Q=>i({hideTitle:Q?void 0:!0}),g("hideTitle","cd-show-text"))),W(e,"cd-font-size",se("文本字号(相对条高,条高为 30)",J({value:r.fontSize,min:5,max:24,placeholder:"默认 10",onCommit:Q=>i({fontSize:Q||void 0})}),void 0,g("fontSize","cd-font-size")))]:[W(e,"cd-ec-level",jt(e,"纠错级别",String(r.qrCodeLevel??"M"),[{value:"L",label:"L(最低,容量大)"},{value:"M",label:"M(推荐)"},{value:"Q",label:"Q"},{value:"H",label:"H(最高)"}],Q=>i({qrCodeLevel:Q}),void 0,g("qrCodeLevel","cd-ec-level"))),W(e,"cd-quiet-zone",He("静区 (模块)",J({value:r.qrQuietZone,min:0,max:8,placeholder:"默认 0",onCommit:Q=>i({qrQuietZone:Q})}),Ae("cd-quiet-zone"),g("qrQuietZone","cd-quiet-zone")))],$t("自定义设置"),T?h("p",{class:"pd-hint",text:"条码尺寸由「条宽」与「打印机分辨率」结算:宽度足够时按条宽原样落纸,不足时整体等比缩小;拉伸会把条宽变成非整数,故条形码不提供缩放模式,可用「最大宽高」限制上限。要放大条码:先加条宽倍率,再收窄静区(左右白边会换成条宽),必要时关掉显示文本以让出文本区高度"}):"",T?"":W(e,"cd-fit",jt(e,"缩放模式",String(r.fit||"contain"),cs,Q=>i({fit:Q||void 0}),void 0,g("fit","cd-fit"))),W(e,"cd-max-width",se("最大宽度 (mm)",J({value:r.maxWidth,min:1,max:200,placeholder:"默认",onCommit:Q=>i({maxWidth:Q||void 0})}),void 0,g("maxWidth","cd-max-width"))),W(e,"cd-max-height",se("最大高度 (mm)",J({value:r.maxHeight,min:1,max:200,placeholder:"默认",onCommit:Q=>i({maxHeight:Q||void 0})}),void 0,g("maxHeight","cd-max-height")))].flat().filter(Boolean))]))}if(d&&(u.push(C2(e,t)),u.push(I2(e,t))),s&&u.push(A2(e,t)),o==="flowList"){const T=pt(r.flowColumns),ie=Xt(r.flowRowHeight),pe=vt(r.flowGapX),Ge=fn(r.flowMaxSpan,T),Q=dm(r.width??0,pe,r.fontSize??12),Te=pn(r.flowLayoutMode),he=Te==="dynamic",de=Nn(r),ye=(ne,De)=>{i({[ne]:typeof De=="number"&&Number.isFinite(De)&&De>0?De:0})};u.push(Qe(e,"flowList","流式列表","Grid3x3",[h("form",{class:"pd-form",onSubmit:ne=>ne.preventDefault()},[W(e,"fl-layout-mode",jt(e,"布局模式",Te,[{value:"fixed",label:"固定高度"},{value:"dynamic",label:"动态分页"}],ne=>i({flowLayoutMode:ne==="dynamic"?"dynamic":"fixed"}),Ae("fl-layout-mode"))),...he?[W(e,"fl-padding-top",He("上内边距 (mm)",J({value:de.top,min:0,max:100,step:.5,onCommit:ne=>ye("flowPaddingTop",ne)}),Ae("fl-padding-top"))),W(e,"fl-padding-right",He("右内边距 (mm)",J({value:de.right,min:0,max:100,step:.5,onCommit:ne=>ye("flowPaddingRight",ne)}),Ae("fl-padding-right"))),W(e,"fl-padding-bottom",He("下内边距 (mm)",J({value:de.bottom,min:0,max:100,step:.5,onCommit:ne=>ye("flowPaddingBottom",ne)}),Ae("fl-padding-bottom"))),W(e,"fl-padding-left",He("左内边距 (mm)",J({value:de.left,min:0,max:100,step:.5,onCommit:ne=>ye("flowPaddingLeft",ne)}),Ae("fl-padding-left")))]:[],W(e,"fl-columns",He("每行列数",J({value:T,min:1,max:12,onCommit:ne=>i({flowColumns:pt(ne),flowMaxSpan:fn(r.flowMaxSpan,pt(ne))})}),Ae("fl-columns"))),W(e,"fl-row-height",He("行高 (mm)",J({value:ie,min:3,max:100,step:.5,onCommit:ne=>i({flowRowHeight:Xt(ne)})}),Ae("fl-row-height"))),W(e,"fl-gap-x",He("单元横向间距 (mm)",J({value:pe,min:0,max:50,step:.5,onCommit:ne=>i({flowGapX:vt(ne)})}),Ae("fl-gap-x"))),W(e,"fl-auto-span",In(e,"内容过长时跨列",r.flowAutoSpan===!0,ne=>{i(ne?{flowAutoSpan:ne,flowMaxSpan:Ge}:{flowAutoSpan:ne})})),r.flowAutoSpan===!0?W(e,"fl-max-span",He("最多跨几列",J({value:Ge,min:1,max:T,onCommit:ne=>i({flowMaxSpan:fn(ne,T)})}),Ae("fl-max-span"))):"",T>Q?h("p",{class:"pd-hint",text:`按当前字号与框宽,${T} 列偏挤(可放约 ${Q} 列)。数值保持不变,出纸按 ${T} 列排。`}):""].flat().filter(Boolean))]))}const L=()=>({borderWidth:r.borderWidth,borderStyle:r.borderStyle,borderColor:r.borderColor,borders:r.borders}),R=T=>{const ie=L();Zc(ie,T,ed(ie)),i(ie)},P=T=>{const ie=L();Ca(ie,T,!xr(ie,T)),i(ie)},O=Qc(r),C=O.style==="mixed",I=typeof O.width=="number"?O.width:void 0,S=C||O.style===void 0?"":O.style,$=typeof O.color=="string"?O.color:void 0,N=(T,ie)=>{const pe=L();Jm(pe,T,ie),i(pe)},z=C?[{value:"",label:"混合"},...Ta]:[...Ta];return u.push(Qe(e,"border-bg","边框与背景","Picture",[h("form",{class:"pd-form",onSubmit:T=>T.preventDefault()},[W(e,"bb-border-style",jt(e,"线型",S,z,T=>N("borderStyle",T))),h("div",{class:"border-row"},[W(e,"bb-border-width",Ie(e,"边框宽度",I,T=>N("borderWidth",T),{min:0,max:20,step:.25,placeholder:O.width==="mixed"?"混合":void 0},g("borderWidth","bb-border-width"))),W(e,"bb-border-color",se("边框颜色",ot($,T=>N("borderColor",T),"边框颜色"),void 0,g("borderColor","bb-border-color")))]),...mo(o)?[h("div",{class:"pd-button-group border-presets"},D2.map(T=>h("button",{type:"button",class:"pd-button small",text:T.label,disabled:T.value==="inner",onClick:()=>R(T.value)}))),h("div",{class:"pd-checkbox-group"},$2.map(T=>h("label",{class:"pd-checkbox"},[h("input",{type:"checkbox",checked:xr(r,T.value),onChange:()=>P(T.value)}),h("span",{text:T.label})]))),h("p",{class:"pd-hint",text:jm})]:[],W(e,"bb-bg-color",se("背景色",ot(r.backgroundColor,T=>i({backgroundColor:T}),"背景颜色"),void 0,g("backgroundColor","bb-bg-color")))])])),u.push(O2(e,t)),u.push(Qe(e,"advanced","高级设置","Setting",[h("form",{class:"pd-form",onSubmit:T=>T.preventDefault()},[h("div",{class:"advanced-row"},[W(e,"ad-locked",In(e,"锁定",!!r.locked,T=>i({locked:T}),g("locked","ad-locked"))),W(e,"ad-fixed",In(e,"每页重复",!!r.repeatOnEveryPage,T=>i({repeatOnEveryPage:T}),g("repeatOnEveryPage","ad-fixed"))),W(e,"ad-fixed-position",In(e,"每页固定",!!r.fixed,T=>i({fixed:T}),g("fixed","ad-fixed-position")))]),W(e,"ad-z-index",Ie(e,"层级",r.zIndex,T=>i({zIndex:T}),{min:0,max:999},g("zIndex","ad-z-index"))),W(e,"ad-delete",h("div",{class:"pd-field"},[h("button",{type:"button",class:"pd-button danger",text:"删除元素",onClick:()=>n.deleteSelected()})]))])],!1,[h("button",{type:"button",class:"group-help",title:"高级设置说明","aria-label":"高级设置说明",text:"?",onClick:T=>{T.stopPropagation(),e.fire("help","advanced-settings")}})])),h("div",{class:"property-content"},u)}function L2(e){const t=e.store,n=t.templateData,r=c=>t.updateTemplateData(c),o=c=>{const s=n.tiling,d=p=>p===90||p===270;if(s?.enabled&&d(c)!==d(n.outputRotation)){const p=gu({...n,outputRotation:c});r({outputRotation:c,tiling:{...s,columns:Math.max(p,1)}});return}r({outputRotation:c})},i=[];for(const[c,s]of Object.entries(Ot)){const d=s.group??"其他";let p=i.find(u=>u.group===d);p||(p={group:d,items:[]},i.push(p)),p.items.push({key:c,label:s.label??c})}const a=!Ot[n.paperSize],l=_o(n.paperSize);return h("form",{class:"pd-form",onSubmit:c=>c.preventDefault()},[$t("纸张设置"),se("纸张尺寸",h("select",{class:"pd-select",style:{width:"100%"},onChange:c=>r({paperSize:c.target.value})},[...i.map(c=>h("optgroup",{label:c.group},c.items.map(s=>h("option",{value:s.key,text:s.label,selected:n.paperSize===s.key})))),h("option",{value:"CUSTOM",text:"自定义宽高",selected:a})])),l||a?se(l?"纸宽 (mm)":"自定义宽高 (mm)",h("div",{class:"custom-size-grid"},[J({value:Number(n.customWidth??0),min:25,max:2e3,onCommit:c=>r({customWidth:c})}),...a?[h("span",{class:"custom-size-x",text:"×"}),J({value:Number(n.customHeight??0),min:25,max:2e3,onCommit:c=>r({customHeight:c})})]:[]])):"",l?"":se("纸张方向",on("ori",[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],n.orientation==="landscape"?"landscape":"portrait",c=>r({orientation:c})),"切换即交换纸张长宽(设计稿内容随之铺在该尺寸上)"),l?"":se("内容旋转角度",on("rot",[{value:"0",label:"0°"},{value:"90",label:"90°"},{value:"180",label:"180°"},{value:"270",label:"270°"}],String(n.outputRotation??0),c=>o(Number(c)),!0),n.tiling?.enabled?"拼版时每个标签的内容按该角度旋转;90°/270° 时每格占位宽高互换,列数自动铺满新档位上限,行数按互换后重算;0° 为不旋转(默认)":"整页内容旋转对应角度出纸;90°/270° 时纸张长宽互换以贴合内容,内容不变形不裁切;0° 为不旋转(默认)"),se("页面背景色",h("div",{class:"page-bg-row"},[ot(n.pageBackground,c=>r({pageBackground:c}),"页面背景色","page-bg-picker")]),void 0,Cn({target:n,base:{pageBackground:void 0},propKey:"pageBackground",write:()=>r({pageBackground:void 0})})),l2(e),t.pages.length>1?"":c2(e),$t("页边距 (mm)"),h("div",{class:"margin-grid"},[Ie(e,"上",n.margins.top,c=>r({margins:{...n.margins,top:c}}),{min:0,max:50}),Ie(e,"下",n.margins.bottom,c=>r({margins:{...n.margins,bottom:c}}),{min:0,max:100}),Ie(e,"左",n.margins.left,c=>r({margins:{...n.margins,left:c}}),{min:0,max:50}),Ie(e,"右",n.margins.right,c=>r({margins:{...n.margins,right:c}}),{min:0,max:50})]),$t("页眉/页脚高度 (mm)"),Ie(e,"页眉高度",n.header.height??10,c=>r({header:{...n.header,height:c}}),{min:0,max:100,step:.1}),Ie(e,"页脚高度",n.footer.height??10,c=>r({footer:{...n.footer,height:c}}),{min:0,max:100,step:.1}),R2(e)].filter(Boolean))}function F2(e,t,n){const r=(e.state.propSearch??"").trim(),o=!r||cd(r,[...n.searchKeywords,n.label]),i=document.createElement("div");if(i.className="property-content",o)try{fh(`property:${t.id}`,n.ui.renderProperty({element:t,data:e.host.designData?.length?e.host.designData:[gt],fields:e.host.fields??[],update:a=>e.store.updateElement(t.id,a),repaint:()=>e.repaint()}),i)}catch{}return h("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:custom"},style:e.state.propTab==="custom"?"":{display:"none"}},[i])}function z2(e){const t=e.store,n=e.state,r=t.selectedElement,o=r?Gs(r):void 0;if(n.propCollapsed)return h("div",{class:"property-panel collapsed"},[h("div",{class:"prop-collapsed"},[h("button",{type:"button",class:"pc-btn",title:"展开属性台",text:"«",onClick:()=>{n.propCollapsed=!1,e.repaint()}}),...o?[h("button",{type:"button",class:`pc-btn${n.propTab==="custom"?" on":""}`,title:o.label,html:Re(o.icon,14)||Re("Shapes",14),onClick:()=>{n.propTab="custom",n.propCollapsed=!1,e.repaint()}})]:[],...[["element","元素属性","▦"],["page","页面属性","▤"]].map(([a,l,c])=>h("button",{type:"button",class:`pc-btn${n.propTab===a?" on":""}`,title:l,text:c,onClick:()=>{n.propTab=a,n.propCollapsed=!1,e.repaint()}}))])]);const i=r?n.propTab==="custom"&&!o?"element":n.propTab:"page";return h("div",{class:"property-panel"},[h("div",{class:"prop-head"},[h("span",{class:"prop-title",text:"属性台"}),h("button",{type:"button",class:"collapse-btn",title:"收起属性台",text:"»",onClick:()=>{n.propCollapsed=!0,e.repaint()}})]),h("div",{class:"pd-tabs prop-tabs"},[h("div",{class:"pd-tab-bar",role:"tablist"},[...o?[h("button",{type:"button",class:`pd-tab${i==="custom"?" active":""}`,text:o.label,onClick:()=>{n.propTab="custom",e.repaint()}})]:[],h("button",{type:"button",class:`pd-tab${i==="element"?" active":""}`,text:"元素属性",onClick:()=>{n.propTab="element",e.repaint()}}),h("button",{type:"button",class:`pd-tab${i==="page"?" active":""}`,text:"页面属性",onClick:()=>{n.propTab="page",e.repaint()}})]),o&&r?F2(e,r,o):"",h("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:element"},style:i==="element"?"":{display:"none"}},r?[g2(e),N2(e,r)]:[h("p",{class:"pd-empty",text:"请在画布中选择一个元素"})]),h("div",{class:"pd-tab-pane",role:"tabpanel",dataset:{pane:"prop:page"},style:i==="page"?"":{display:"none"}},[L2(e)])].filter(Boolean))])}const Ol=[{key:"field",text:"📁 字段"},{key:"variable",text:"🔧 变量"},{key:"function",text:"⚡ 函数"}],Kh={field:"搜索字段...",variable:"搜索变量...",function:"搜索函数..."},B2=[{name:"SUM",label:"求和",template:"SUM()"},{name:"AVG",label:"平均值",template:"AVG()"},{name:"COUNT",label:"计数",template:"COUNT()"},{name:"MIN",label:"最小值",template:"MIN()"},{name:"MAX",label:"最大值",template:"MAX()"}],H2=[{name:"ADD",label:"相加",template:"ADD()"},{name:"SUB",label:"相减",template:"SUB()"},{name:"MUL",label:"相乘",template:"MUL()"},{name:"DIV",label:"相除",template:"DIV()"},{name:"ROUND",label:"四舍五入",template:"ROUND()"},{name:"ROUNDUP",label:"进一法",template:"ROUNDUP()"},{name:"ROUNDDOWN",label:"去尾法",template:"ROUNDDOWN()"},{name:"ROUNDBANK",label:"四舍六入五成双",template:"ROUNDBANK()"}],U2=[{name:"MONEY",label:"金额格式化",template:"MONEY()"},{name:"DATE",label:"日期格式化",template:"DATE()"},{name:"UPPER",label:"大写金额",template:"UPPER()"},{name:"IF",label:"条件判断",template:"IF()"}],q2=[{name:"pageIndex",label:"当前页码",template:"{pageIndex}"},{name:"totalPages",label:"总页数",template:"{totalPages}"},{name:"printDate",label:"打印日期",template:"{printDate}"},{name:"printTime",label:"打印时间",template:"{printTime}"}],W2=[{title:"聚合函数",items:B2},{title:"数值运算",items:H2},{title:"格式化函数",items:U2}],j2="(输入表达式后预览)",G2="(无法计算)",Il="(表达式错误)";function Xh(e,t){if(!e.trim())return j2;try{const n={...gt,...t??{},...Io()},r=Wn(e,n);return r==null?G2:String(r)}catch{return Il}}function Zh(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.name.toLowerCase().includes(n)):e}function V2(e,t){const n=e.substring(0,t),r=n.lastIndexOf("{"),o=r!==-1&&!n.slice(r+1).includes("}"),i=n.lastIndexOf("("),a=i!==-1&&!n.slice(i+1).includes(")");return{insideBlock:o,insideParens:a}}const Y2=e=>/[\u4e00-\u9fff]/.test(e),K2=e=>`字段「${e}」含中文,请用 {${e}} 引用(函数参数内写 ${e});中文可直接在 {} 中使用,无需 data['...'] 方括号`;function X2(e,t){const n=/^\{\s*([^{}]+?)\s*\}$/.exec(e.trim());if(!n)return null;const r=n[1]??"";return t.find(o=>o.fieldKey===r)??null}function Pl(e,t){return h("div",{class:"ee-field-info"},[h("span",{class:"ee-item-label",text:e}),h("span",{class:"ee-item-key",text:t})])}function Nt(e){return e.currentTarget.getRootNode()}function Vi(e,t,n){const r=[];return n.forEach((o,i)=>{r.push(o),i<n.length-1&&r.push(h("br"))}),h("div",{class:`ee-help-card ${e}`},[h("div",{class:"ee-help-card-title",text:t}),h("div",{class:"ee-help-card-content"},r)])}function Z2(){return h("div",{class:"ee-help-section"},[h("div",{class:"ee-help-title",text:"帮助信息"}),h("div",{class:"ee-help-grid"},[Vi("ee-help-field","输入方式",["双击左侧字段、变量、函数即可插入到表达式输入框中","双击途中按住 Ctrl(Mac 为 ⌘)切换为插入字段名称,当静态文本用","静态数据直接输入即可,如:供应商名称","动态解析字段、变量、函数必须用 {} 包裹","示例:{SUM(supplier.name)}","中文 key 直接写 {字段名},如 {姓名}、{supplier.名称}","注意:只能嵌套一层"]),Vi("ee-help-function","函数使用",["SUM(字段) - 求和","AVG(字段) - 平均值","COUNT(字段) - 计数","IF(条件, 真值, 假值) - 条件判断","四则运算:{qty * price}、{ADD(qty, 1)}","修约:ROUND 四舍五入 / ROUNDUP 进一 / ROUNDDOWN 去尾 / ROUNDBANK 四舍六入五成双"]),Vi("ee-help-variable","系统变量",["{pageIndex} - 当前页码","{totalPages} - 总页数","{printDate} - 打印日期"]),Vi("ee-help-conditional","示例",["静态文本:供应商名称","动态字段:{supplier.name}","函数调用:{SUM(amount)}",'条件判断:{IF(amount>1000, "大单", "小单")}',"运算并修约:{ROUND(qty * price, 2)}"])])])}function J2(e,t){const n={activeTab:"field",searchText:"",expression:t.value||"",binding:t.binding,copiedFieldKey:"",keyHint:""},r=(b,v)=>b.querySelector(v),o=b=>{const v=r(b,".ee-preview");if(!v)return;const w=Xh(n.expression,e.demoData);v.textContent=w,v.classList.toggle("ee-preview-error",w===Il)},i=b=>{const v=r(b,".ee-key-hint");v&&(v.textContent=n.keyHint,v.style.display=n.keyHint?"":"none")},a=()=>{if(n.activeTab==="variable")return Zh(q2,n.searchText).map(w=>h("div",{class:"ee-list-item",onDblclick:E=>{const{insideParens:k}=s(E);d(Nt(E),k?w.template.replace(/^\{|\}$/g,""):w.template,void 0,"")}},[Pl(w.label,w.template)]));if(n.activeTab==="function")return W2.map(w=>h("div",{class:"ee-func-group"},[h("div",{class:"ee-func-group-title",text:w.title}),...Zh(w.items,n.searchText).map(E=>h("div",{class:"ee-list-item",onDblclick:k=>{const{insideBlock:L}=s(k),R=L?E.template:`{${E.template}}`;d(Nt(k),R,R.indexOf("(")+1,"")}},[Pl(E.label,`${E.name}()`)]))]));const b=D1(Tu(e.fields??[]),n.searchText);if(!b.length)return[h("p",{class:"pd-empty",text:"暂无字段"})];const v=[];for(const w of b){w.key&&v.push(h("div",{class:`ee-field-group${w.isList?" is-list":""}`},[h("span",{class:"ee-field-group-icon",text:w.isList?"📋":"📁"}),h("span",{text:w.label})]));for(const E of w.fields)v.push(h("div",{class:"ee-list-item ee-field-item",style:{paddingLeft:w.key?"22px":"10px"},onDblclick:k=>{const{insideParens:L}=s(k),R=k;if(R.ctrlKey||R.metaKey){const P=E.fieldLabel||E.fieldKey;d(Nt(k),L?`"${P}"`:P,void 0,"");return}d(Nt(k),L?E.fieldKey:`{${E.fieldKey}}`,void 0,Y2(E.fieldKey)?K2(E.fieldKey):"")}},[Pl(E.fieldLabel,E.fieldKey),h("button",{type:"button",class:`ee-copy-btn${n.copiedFieldKey===E.fieldKey?" is-copied":""}`,"data-tip":n.copiedFieldKey===E.fieldKey?"已复制":`复制字段名「${E.fieldLabel}」`,"aria-label":`复制字段名 ${E.fieldLabel}`,html:Re(n.copiedFieldKey===E.fieldKey?"Check":"Copy",13),onClick:k=>{k.stopPropagation(),c(k,E)},onDblclick:k=>k.stopPropagation()})]))}return v},l=b=>{Array.from(b.querySelectorAll(".ee-nav-tab")).forEach((L,R)=>L.classList.toggle("active",Ol[R]?.key===n.activeTab));const w=r(b,".ee-content-search .pd-input");if(w){const L=Kh[n.activeTab];w.placeholder!==L&&(w.placeholder=L),w.value!==n.searchText&&(w.value=n.searchText)}const E=r(b,".ee-textarea");E&&E.value!==n.expression&&(E.value=n.expression);const k=r(b,".ee-content-list");if(k){kf(k);for(const L of a())Ze(L,k)}o(b),i(b)};function c(b,v){const w=Nt(b);ku(v.fieldLabel||v.fieldKey).then(E=>{E&&(n.copiedFieldKey=v.fieldKey,l(w),setTimeout(()=>{n.copiedFieldKey===v.fieldKey&&(n.copiedFieldKey="",l(w))},1200))})}const s=b=>{const w=r(Nt(b),".ee-textarea")?.selectionStart??n.expression.length;return V2(n.expression,w)},d=(b,v,w=v.length,E)=>{E!==void 0&&(n.keyHint=E);const k=r(b,".ee-textarea");if(!k){n.expression+=v,o(b),i(b);return}const L=k.selectionStart??n.expression.length,R=k.selectionEnd??L;n.expression=n.expression.substring(0,L)+v+n.expression.substring(R);const P=L+w;k.value=n.expression,k.focus(),k.selectionStart=k.selectionEnd=P,o(b),i(b)},p=()=>{const b=n.expression;if(n.binding===void 0){e.onApply({formatter:b}),e.onClose();return}const v=X2(b,e.fields??[]);e.onApply(v?{formatter:b,binding:v.fieldKey,title:v.fieldLabel}:{formatter:b}),e.onClose()},u=h("div",{class:"ee-nav"},[h("div",{class:"ee-nav-title",text:"类型"}),h("div",{class:"ee-nav-tabs"},Ol.map((b,v)=>h("div",{class:`ee-nav-tab${n.activeTab===b.key?" active":""}`,text:b.text,onClick:w=>{n.activeTab=Ol[v].key,l(Nt(w))}})))]),f=h("div",{class:"ee-content"},[h("div",{class:"ee-content-search"},[h("input",{class:"pd-input",placeholder:Kh[n.activeTab],onInput:b=>{n.searchText=b.target.value,l(Nt(b))}})]),h("div",{class:"ee-content-list"},a())]),g=Xh(n.expression,e.demoData),m=h("div",{class:"ee-editor"},[h("div",{class:"ee-editor-section"},[h("div",{class:"ee-editor-title",text:"表达式编辑"}),h("textarea",{class:"ee-textarea",rows:6,placeholder:"双击左侧字段/变量/函数插入,双击途中按住 Ctrl(Mac 为 ⌘)切换为插入字段名,或直接输入静态内容",text:n.expression,onInput:b=>{n.expression=b.target.value,n.keyHint="",o(Nt(b)),i(Nt(b))}}),h("div",{class:"pd-hint ee-key-hint",style:{display:"none",color:"var(--pd-accent, #165DFF)"},text:""})]),h("div",{class:"ee-editor-section"},[h("div",{class:"ee-editor-title",text:"预览结果"}),h("div",{class:`ee-preview${g===Il?" ee-preview-error":""}`,text:g})]),Z2()]);return h("div",{class:"pd-dialog-overlay",onKeydown:b=>{b.key==="Escape"&&e.onClose()}},[h("section",{class:"pd-dialog pd-dialog-large",role:"dialog","aria-modal":"true","aria-labelledby":"expression-editor-title"},[h("header",{class:"pd-dialog-header"},[h("strong",{id:"expression-editor-title",text:"编辑表达式"}),h("button",{type:"button",class:"pd-close","aria-label":"关闭",text:"×",onClick:()=>e.onClose()})]),h("div",{class:"expression-editor"},[u,f,m]),h("footer",{class:"pd-dialog-footer"},[h("button",{type:"button",class:"pd-button",text:"取消",onClick:()=>e.onClose()}),h("button",{type:"button",class:"pd-button primary",text:"确定",onClick:()=>p()})])])])}const Yi=[{id:"getting-started",title:"快速入门",content:`
|
|
273
273
|
<h2>界面布局</h2>
|
|
274
274
|
<p>打印模板设计器采用三栏布局:</p>
|
|
275
275
|
<ul>
|
|
@@ -733,6 +733,41 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
733
733
|
<p><strong>提示</strong>:水印配置保存在模板 JSON 的 <code>watermark</code> 字段中,仅对当前模板生效。</p>
|
|
734
734
|
</blockquote>
|
|
735
735
|
`},{id:"changelog",title:"更新记录",content:`
|
|
736
|
+
<h2>V1.5.3<small>(2026-11-18)</small></h2>
|
|
737
|
+
|
|
738
|
+
<h3>新增</h3>
|
|
739
|
+
<ul>
|
|
740
|
+
<li><strong>设计器配色可传参控制</strong>:新增 <code>theme</code>(跟随系统 / 浅色 / 深色)与 <code>theme-config</code> 两个参数,传参即优先于 CSS 主题令牌,不必自己覆盖样式变量。优先级为「参数覆盖 > 显式深色/浅色 > 跟随系统 > CSS 令牌」,宿主可只传一个深色开关,也可细调任意颜色。</li>
|
|
741
|
+
</ul>
|
|
742
|
+
|
|
743
|
+
<h3>注意</h3>
|
|
744
|
+
<ul>
|
|
745
|
+
<li><strong>画布保持原样</strong>:内置深色预设只改变设计器外壳,纸张、画布背景、标尺与手柄的颜色不变,预览所见即所得不受换肤影响。若想连画布外围背景一起换色,可显式覆盖 <code>--pd-canvas-bg</code>。</li>
|
|
746
|
+
</ul>
|
|
747
|
+
|
|
748
|
+
<h2>V1.5.2<small>(2026-11-17)</small></h2>
|
|
749
|
+
|
|
750
|
+
<h3>新增</h3>
|
|
751
|
+
<ul>
|
|
752
|
+
<li><strong>动态 base64 图片可在画布直接显示</strong>:图片元素与表格图片单元格里的 <code>{字段}</code> 表达式,现在优先取宿主给的设计态示例数据,不用等到预览或出纸才看到图;未注入示例数据时仍用内置演示图。</li>
|
|
753
|
+
<li><strong>工具栏「预览 / 保存」按钮可隐藏</strong>:宿主可按需隐藏这两个按钮并自行接管出图业务。隐藏只影响按钮显示,保存与预览功能本身照常可用。</li>
|
|
754
|
+
</ul>
|
|
755
|
+
|
|
756
|
+
<h2>V1.5.1<small>(2026-11-16)</small></h2>
|
|
757
|
+
|
|
758
|
+
<h3>发布</h3>
|
|
759
|
+
<ul>
|
|
760
|
+
<li><strong>桌面客户端安装包正式发行</strong>:mac(x64 / arm64)、Windows、Linux(deb / rpm / AppImage)六件安装包随版发布,README 提供直链与校验清单,可按系统直接下载静默打印客户端。</li>
|
|
761
|
+
</ul>
|
|
762
|
+
|
|
763
|
+
<h2>V1.5.0<small>(2026-11-16)</small></h2>
|
|
764
|
+
|
|
765
|
+
<h3>发布</h3>
|
|
766
|
+
<ul>
|
|
767
|
+
<li><strong>第一个稳定版本正式发布</strong>:设计器以零框架的 Web Components 实现为权威版本,npm 包名迁移为 <code>@worm-print-platform/*</code>;Vue 3 用法保留兼容门面,原有接入代码无需重写。</li>
|
|
768
|
+
<li><strong>插件化元素转正</strong>:图表等扩展元素可作为独立插件安装,内置元素与第三方插件在设计器里同权使用。</li>
|
|
769
|
+
</ul>
|
|
770
|
+
|
|
736
771
|
<h2>V1.4.8<small>(2026-11-11)</small></h2>
|
|
737
772
|
|
|
738
773
|
<h3>修复</h3>
|
|
@@ -1158,6 +1193,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1158
1193
|
<blockquote>
|
|
1159
1194
|
<p>完整更新记录请查阅仓库 <code>docs/中文/CHANGELOG.md</code> 与 <code>docs/en/CHANGELOG.en.md</code>。</p>
|
|
1160
1195
|
</blockquote>
|
|
1161
|
-
`}],Zh="worm-print-help-tab",j2="getting-started";function Jh(e){return ji.some(t=>t.id===e)?String(e):""}function G2(e){let t=null;try{t=window.localStorage.getItem(Zh)}catch{t=null}return Jh(e)||Jh(t)||j2}function V2(e){const t=G2(e.initialTab),n=(r,o)=>{const i=r.currentTarget,a=i.closest(".help-modal");if(!a)return;for(const c of Array.from(a.querySelectorAll(".help-tab")))c.classList.toggle("active",c===i);const l=a.querySelector(".help-content");l&&(l.innerHTML=ji.find(c=>c.id===o)?.content??"");try{window.localStorage.setItem(Zh,o)}catch{}};return h("div",{class:"help-modal-overlay",tabindex:"-1",onClick:r=>{r.target===r.currentTarget&&e.onClose()},onKeydown:r=>{r.key==="Escape"&&e.onClose()}},[h("div",{class:"help-modal"},[h("div",{class:"help-modal-header"},[h("div",{class:"help-modal-title-wrap"},[h("h2",{class:"help-modal-title",text:"帮助文档"}),h("span",{class:"help-modal-project",text:"worm-print-platform"})]),h("button",{type:"button",class:"help-modal-close",title:"关闭",text:"×",onClick:()=>e.onClose()})]),h("div",{class:"help-modal-body"},[h("div",{class:"help-modal-sidebar"},ji.map(r=>h("button",{type:"button",class:`help-tab${r.id===t?" active":""}`,text:r.title,onClick:o=>n(o,r.id)}))),h("div",{class:"help-modal-content"},[h("div",{class:"help-content",html:ji.find(r=>r.id===t)?.content??""})])])])])}function Y2(e,t){const n=Je(V2(t),e),r=o=>{o.key==="Escape"&&t.onClose()};return document.addEventListener("keydown",r),n.focus?.(),()=>{document.removeEventListener("keydown",r),n.remove()}}const K2=2,X2=74,Pl=[{id:"clipboard",order:1,label:"剪贴板"},{id:"painter",order:2,label:"格式刷"},{id:"zoom",order:3,label:"缩放"},{id:"arrange-view",order:4,label:"排列 / 视图"},{id:"border",order:5,label:"边框"},{id:"color",order:6,label:"颜色"},{id:"align",order:7,label:"对齐"},{id:"style",order:8,label:"文字样式"},{id:"font",order:9,label:"字体与字号"}];function Z2(e){const t=!!e.state.openMore,n=Pl.slice().sort((r,o)=>r.order-o.order).map(r=>h("div",{class:"tb-more-item",dataset:{unit:r.id},style:{display:"none"}},[h("div",{class:"tb-menu-label",text:r.label}),h("div",{class:"tb-more-slot",id:`tb-more-slot-${r.id}`,dataset:{unit:r.id}})]));return h("div",{class:"tb-group tb-more-group",style:{display:"none"}},[h("div",{class:"tb-dd"},[h("button",{type:"button",class:`tb-dd-trigger${t?" on":""}`,dataset:{test:"more-dd",tip:"更多"},onClick:()=>{e.state.openMore=!t,e.repaint()},html:`${De("Ellipsis",15)}<span class="tb-btn-text">更多</span>${De("ChevronDown",12,"tb-dd-arrow")}`}),h("div",{class:`tb-dd-panel tb-more-panel${t?"":" is-hidden"}`},[h("div",{class:"tb-menu tb-more-menu"},n)])])])}const Qh=new WeakMap;function eg(e){const t=e.querySelector(".designer-toolbar");if(!t)return{movedIds:[],overflowRemains:!1};const n=getComputedStyle(t),r=Number.parseFloat(n.gap)||K2,o=Number.parseFloat(n.paddingLeft)||0,i=Number.parseFloat(n.paddingRight)||0,a=new Map;for(const m of Array.from(t.querySelectorAll(".tb-ou[data-unit]"))){const b=m.parentElement;b&&!b.classList.contains("tb-more-slot")&&Qh.set(m,{parent:b,next:m.nextSibling}),a.set(m.dataset.unit,m)}for(const m of a.values()){const b=Qh.get(m);!b||m.parentElement===b.parent||(b.next?.parentElement===b.parent?b.parent.insertBefore(m,b.next):b.parent.appendChild(m))}let l=0;for(const m of Array.from(t.children)){if(m.classList.contains("tb-spacer")||m.classList.contains("tb-more-group"))continue;const b=Math.max(m.offsetWidth,m.scrollWidth);b<=0||(l+=b+r)}const c=new Map;for(const[m,b]of a){const v=b.offsetWidth;v>0&&c.set(m,v)}const s=Pl.map(m=>({id:m.id,order:m.order,width:c.get(m.id)??0})),d=s.reduce((m,b)=>m-b.width-r,l),p=t.clientWidth-o-i,{movedIds:u,overflowRemains:f}=Yc({available:p,pinned:d,moreTriggerWidth:X2,gap:r,units:s});for(const m of Pl){const b=t.querySelector(`.tb-more-item[data-unit="${m.id}"]`),v=t.querySelector(`#tb-more-slot-${m.id}`),w=a.get(m.id);if(!b||!v||!w)continue;const E=u.includes(m.id);E&&w.parentElement!==v&&v.appendChild(w),b.style.display=E?"":"none"}const g=t.querySelector(".tb-more-group");return g&&(g.style.display=u.length>0?"":"none"),t.classList.toggle("is-tight",f),{movedIds:u,overflowRemains:f}}function J2(e,t){const n=e.store,r=n.selectedIds.size>0,o=n.selectedIds.size>1,i=n.selectedElement,a=!r,l=e.isEdit?"编辑模板":"新建模板",c=[h("div",{class:"tb-menu",dataset:{test:"arrange-panel"}},[h("div",{class:"tb-menu-label",text:"对齐 / 分布"}),h("div",{class:"tb-menu-grid"},[Se(e,"AlignStartVertical","align",{arg:"left",tip:"左对齐",disabled:!o}),Se(e,"AlignEndVertical","align",{arg:"right",tip:"右对齐",disabled:!o}),Se(e,"AlignStartHorizontal","align",{arg:"top",tip:"顶对齐",disabled:!o}),Se(e,"AlignEndHorizontal","align",{arg:"bottom",tip:"底对齐",disabled:!o}),Se(e,"AlignCenterVertical","align",{arg:"vertical",tip:"水平居中",disabled:!o}),Se(e,"AlignCenterHorizontal","align",{arg:"horizontal",tip:"垂直居中",disabled:!o}),Se(e,"AlignHorizontalSpaceBetween","align",{arg:"distributeHor",tip:"水平分布",disabled:!o}),Se(e,"AlignVerticalSpaceBetween","align",{arg:"distributeVer",tip:"垂直分布",disabled:!o})]),h("div",{class:"tb-menu-label",text:"层级"}),h("div",{class:"tb-menu-grid"},[Se(e,"ArrowUpToLine","move-layer",{arg:"top",tip:"置顶",disabled:!r}),Se(e,"ArrowUp","move-layer",{arg:"up",tip:"上移一层",disabled:!r}),Se(e,"ArrowDown","move-layer",{arg:"down",tip:"下移一层",disabled:!r}),Se(e,"ArrowDownToLine","move-layer",{arg:"bottom",tip:"置底",disabled:!r})]),h("div",{class:"tb-menu-label",text:"组合"}),h("div",{class:"tb-menu-grid"},[Se(e,"Group","group",{tip:"组合 (Ctrl+G)",disabled:!o}),Se(e,"Ungroup","ungroup",{tip:"取消组合 (Ctrl+Shift+G)",disabled:!i?.options?.groupId})])])],s=[h("div",{class:"tb-menu tb-menu-rows",dataset:{test:"view-panel"}},[d("标尺",n.showRuler,"toggle-ruler","显示/隐藏标尺"),d("网格",n.showGrid,"toggle-grid","显示/隐藏网格背景"),d("虚框",n.showTableGhostBorder,"toggle-table-ghost-border","显示/隐藏无边框表格的虚拟虚线"),d("吸附",n.snapToGrid,"toggle-snap","开启/关闭元素吸附到网格")])];function d(p,u,f,g){return h("button",{type:"button",class:`tb-btn tb-menu-row${u?" on":""}`,dataset:{tip:g},onClick:()=>e.fire(f)},[h("span",{class:"dot"}),p])}return h("div",{class:"designer-toolbar"},[h("div",{class:"tb-group tb-brand"},[h("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>'}),h("div",{class:"tb-title"},[h("span",{class:"tb-title-name",text:l}),h("span",{class:"tb-title-sub",text:"打印模板设计器"})])]),h("div",{class:"tb-group"},[Se(e,"Undo2","undo",{tip:"撤销",disabled:!n.canUndo}),Se(e,"Redo2","redo",{tip:"重做",disabled:!n.canRedo})]),t,h("div",{class:"tb-ou tb-group",dataset:{unit:"arrange-view"}},[zi(e,"arrange",{icon:"Layers",text:"排列",tip:"排列",testId:"arrange-dd"},c),zi(e,"view",{icon:"Eye",text:"视图",tip:"视图",testId:"view-dd"},s)]),h("div",{class:"tb-ou tb-group",dataset:{unit:"zoom"}},[Se(e,"Maximize","fit-window",{tip:"适应窗口"}),Se(e,"ZoomOut","zoom",{arg:-10,tip:"缩小"}),h("span",{class:"tb-zoom",text:`${n.scale}%`}),Se(e,"ZoomIn","zoom",{arg:10,tip:"放大"})]),h("div",{class:"tb-ou tb-group",dataset:{unit:"clipboard"}},[Se(e,"Copy","copy",{tip:a?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)",disabled:a,test:"copy"}),Se(e,"ClipboardPaste","paste",{tip:a?"粘贴 (Ctrl+V),需选中元素":n.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空",disabled:a||!n.hasClipboard,test:"paste"}),Se(e,"Trash2","delete",{tip:a?"删除 (Delete),需选中元素":"删除 (Delete)",disabled:a,danger:!0,test:"delete"})]),Z2(e),h("div",{class:"tb-spacer"}),e.showHelp?h("div",{class:"tb-group"},[h("button",{type:"button",class:"help-button",title:"帮助文档",onClick:()=>e.fire("help")},[h("span",{class:"help-icon",text:"?"})])]):"",h("div",{class:"tb-group"},[h("button",{type:"button",class:"btn-secondary",dataset:{tip:"预览模板打印效果"},text:"预览",onClick:()=>e.fire("preview")}),h("button",{type:"button",class:"btn-primary",dataset:{tip:"保存模板"},text:"保存",onClick:()=>e.fire("save")})])].filter(Boolean))}function Dl(e,t,n){for(const r of t){const o=e.getPropertyValue(r).trim();if(o)return o}return n}function Q2(e,t){const n=t.orientation==="horizontal",r=t.geom,o=n?r.viewW:r.viewH;e.style.width=`${n?o:Ra}px`,e.style.height=`${n?Ra:o}px`;const i=e.getContext("2d");if(!i)return;const a=window.devicePixelRatio||1,l=Math.max(0,Math.round(o)),c=Ra;e.width=(n?l:c)*a,e.height=(n?c:l)*a,i.setTransform(a,0,0,a,0,0);const s=getComputedStyle(e),d=Dl(s,["--pd-ruler-bg"],"#F8F9FC"),p=Dl(s,["--pd-ruler"],"#9AA1AF"),u=Dl(s,["--pd-ruler-cursor","--pd-accent"],"#165DFF");i.fillStyle=d,i.fillRect(0,0,n?l:c,n?c:l);const f=t.scale>0?t.scale:r.paperScale>0?r.paperScale:1,g=dn(1)*f;if(g<=0)return;const m={ctx:i,horizontal:n,viewportPx:o,thickness:c,originPx:n?r.originX:r.originY,pxPerMM:g,paperLengthMM:t.paperLengthMM},b=-m.originPx/g,v=(l-m.originPx)/g,w=l0(f),E=u0(b,v,w);ng(m,E,p,!0),ng(m,E,p,!1),rg(m,0,u),rg(m,t.paperLengthMM,u);const C=t.cursorPx??null;if(C!==null&&C>=0&&C<=l){if(i.strokeStyle=u,i.lineWidth=1.5,i.beginPath(),n){const F=Math.round(C)+.5;i.moveTo(F,0),i.lineTo(F,c)}else{const F=Math.round(C)+.5;i.moveTo(0,F),i.lineTo(c,F)}i.stroke()}}function tg(e,t){return Math.round(e.originPx+t*e.pxPerMM)+.5}function ng(e,t,n,r){const{ctx:o,horizontal:i,paperLengthMM:a}=e;o.strokeStyle=n,o.fillStyle=n,o.globalAlpha=r?.32:1,o.lineWidth=1,o.font="9px ui-monospace, Menlo, monospace",o.textBaseline="top";for(const l of t){if((l.mm<0||l.mm>a)!==r)continue;const s=tg(e,l.mm),d=l.major?8:4;o.beginPath(),i?(o.moveTo(s,0),o.lineTo(s,d)):(o.moveTo(0,s),o.lineTo(d,s)),o.stroke(),l.major&&l.label&&(i?o.fillText(l.label,s+2,11):(o.save(),o.translate(11,s+2),o.rotate(-Math.PI/2),o.fillText(l.label,0,0),o.restore()))}o.globalAlpha=1}function rg(e,t,n){const{ctx:r,horizontal:o,thickness:i,viewportPx:a}=e,l=tg(e,t);l<=0||l>=a||(r.strokeStyle=n,r.globalAlpha=.55,r.lineWidth=1,r.beginPath(),o?(r.moveTo(l,0),r.lineTo(l,i)):(r.moveTo(0,l),r.lineTo(i,l)),r.stroke(),r.globalAlpha=1)}const eE=':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);height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.pd-form{display:flex;flex-direction:column;gap:10px;font-size:12px;color:var(--pd-text, #303133)}.pd-field{display:flex;flex-direction:column;gap:4px}.pd-label{font-size:11px;color:var(--pd-text-muted, #909399);display:inline-flex;align-items:center;position:relative;justify-content:space-between;gap:6px}.pd-label-t{display:inline-flex;align-items:center;gap:4px;min-width:0}.pd-reset-btn{flex:none;width:15px;height:15px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-faint, #b4b9c4);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:color .14s ease,border-color .14s ease,background .14s ease}.pd-reset-btn.is-dirty{color:var(--pd-text, #2a2e37)}.pd-reset-btn:hover{color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.pd-help{position:static;display:inline-flex;align-items:center;justify-content:center;flex:none;width:13px;height:13px;margin-left:4px;padding:0;border:1px solid var(--pd-border, #d9dde6);border-radius:50%;background:transparent;color:var(--pd-text-muted, #909399);font-size:9px;line-height:1;cursor:help}.pd-help:before{content:"?";font-weight:600}.pd-help:hover,.pd-help:focus-visible{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF)}.pd-help:after{content:attr(data-tip);position:absolute;top:calc(100% + 6px);left:0;z-index:120;width:196px;padding:5px 7px;border-radius:4px;background:#1e2330e0;color:#fff;font-size:12px;font-weight:400;line-height:1.45;text-align:left;white-space:normal;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease}.pd-help:hover:after,.pd-help:focus:after{opacity:1;visibility:visible}.pd-hover-tip{position:fixed;z-index:9999;transform:translate(-50%);padding:4px 8px;border-radius:4px;background:#2a2e37eb;color:#fff;font-size:12px;line-height:1.4;width:max-content;max-width:calc(100vw - 16px);box-sizing:border-box;overflow-wrap:anywhere;pointer-events:none}.pd-input,.pd-select,textarea.pd-input{width:100%;height:26px;min-height:26px;padding:3px 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);color:inherit;font:inherit;box-sizing:border-box;transition:border-color .14s ease,box-shadow .14s ease}.pd-input:hover,.pd-select:hover{border-color:var(--pd-text-faint, #b4b9c4)}textarea.pd-input{height:auto;min-height:48px;resize:vertical}.pd-input:focus,.pd-select:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.pd-select{appearance:auto}.pd-switch{appearance:none;width:32px;height:18px;margin:0;border:1px solid var(--pd-border, #dcdfe6);border-radius:999px;background:#dcdfe6;position:relative;cursor:pointer;transition:background .2s,border-color .2s}.pd-switch:checked{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF)}.pd-switch:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;transition:transform .2s}.pd-switch:checked:after{transform:translate(14px)}.pd-range{width:100%;accent-color:var(--pd-accent, #165DFF)}.pd-radio-group,.pd-checkbox-group{display:flex;flex-wrap:wrap;gap:6px}.pd-radio-group--2col{display:grid;grid-template-columns:1fr 1fr}.pd-radio-group--2col>.pd-radio{width:60%;justify-content:flex-start}.pd-radio,.pd-checkbox{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:0 7px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);cursor:pointer;transition:border-color .14s ease,background .14s ease,color .14s ease}.pd-radio:has(input:checked),.pd-checkbox:has(input:checked){color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:#165dff0f}.pd-button-group{display:inline-flex;gap:4px}.pd-button,.pd-tab{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:26px;padding:3px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font:inherit;cursor:pointer;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-button:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-button.primary{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);color:#fff}.pd-button.danger{background:#f56c6c;border-color:#f56c6c;color:#fff}.pd-button.small{min-height:22px;padding:1px 6px;font-size:11px}.pd-button:disabled{opacity:.55;cursor:not-allowed}.pd-tabs{display:flex;flex-direction:column;min-height:0}.pd-tab-bar{display:flex;gap:4px;padding:8px 12px 0;border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-tab{border:0;border-bottom:2px solid transparent;border-radius:5px 5px 0 0;background:transparent;transition:color .14s ease,background .14s ease}.pd-tab-bar .pd-tab:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pd-tab.active{color:var(--pd-accent, #165DFF);border-bottom-color:var(--pd-accent, #165DFF);background:transparent;font-weight:600}.pd-tab-pane{min-height:0;overflow:auto}.pd-divider{margin:6px 0;font-size:11px;color:var(--pd-text-muted, #909399)}.pd-empty{margin:16px 0;color:var(--pd-text-muted, #909399);text-align:center}.pd-dialog-overlay{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:16px;background:#00000073}.pd-dialog{display:flex;flex-direction:column;width:min(950px,90vw);max-height:90vh;overflow:hidden;background:var(--pd-surface, #fff);border-radius:12px;box-shadow:var(--pd-shadow-md, 0 12px 40px rgba(23, 32, 60, .18))}.pd-dialog-large{width:min(950px,90vw)}.pd-dialog-header,.pd-dialog-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px}.pd-dialog-header{border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-dialog-footer{justify-content:flex-end;border-top:1px solid var(--pd-border-soft, #ebeef5)}.pd-close{width:22px;height:22px;border:0;background:transparent;color:var(--pd-text-muted, #909399);font-size:16px;cursor:pointer}.pd-icon{display:inline-flex;width:14px;height:14px}.tb-more-panel{min-width:244px}.designer-container{scrollbar-width:thin;scrollbar-color:var(--pd-scrollbar, rgba(23, 32, 60, .18)) transparent}.designer-container ::-webkit-scrollbar{width:9px;height:9px}.designer-container ::-webkit-scrollbar-track{background:transparent}.designer-container ::-webkit-scrollbar-thumb{background:var(--pd-scrollbar-thumb, rgba(23, 32, 60, .16));border-radius:999px;border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-thumb:hover{background:var(--pd-scrollbar-thumb-hover, rgba(23, 32, 60, .3));border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-corner{background:transparent}.designer-container button:focus-visible,.designer-container [tabindex]:focus-visible,.designer-container .pd-tab:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}@media(prefers-reduced-motion:reduce){.designer-container *,.designer-container *:before,.designer-container *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}.help-button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;cursor:pointer;transition:background-color .15s}.help-button:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-icon{display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--pd-accent, #165DFF);color:#fff;font-size:12px;font-weight:600;line-height:1}.tb-dd{position:relative;display:inline-flex}.tb-dd-trigger{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:3px;font-size:12px;transition:background .14s ease,color .14s ease}.tb-dd-trigger:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-dd-trigger:disabled{opacity:.32;cursor:default}.tb-dd-trigger.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.tb-dd-arrow{opacity:.6;transition:transform .14s ease}.tb-dd-arrow.up{transform:rotate(180deg)}.tb-dd-trigger[data-tip]{position:relative}.tb-dd-trigger[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.tb-dd-trigger[data-tip]:hover:after{opacity:1}.tb-dd-panel{position:absolute;top:34px;left:0;background:var(--pd-surface, #fff);border:1px solid var(--pd-border, #d9dde6);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));z-index:200}.tb-dd-panel.is-hidden{display:none}.tb-more-group{flex-shrink:0}.tb-more-menu{display:flex;flex-direction:column;gap:8px;padding:8px;max-height:min(70vh,520px)}.tb-more-item{display:flex;flex-direction:column;gap:4px}.tb-menu-label{font-size:11px;color:var(--pd-text-muted, #8b909c);padding-left:2px}.tb-more-slot{display:flex;align-items:center}.designer-toolbar{display:flex;align-items:center;gap:2px;padding:0 12px;height:50px;background:var(--pd-surface, #ffffff);border-bottom:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 1px 2px #17203c0a,0 6px 16px -12px #17203c40;flex-shrink:0;position:relative;z-index:100}.tb-ou{flex-shrink:0}.designer-toolbar>*{flex-shrink:0}.designer-toolbar>.tb-brand{flex-shrink:1;min-width:0}.tb-title,.tb-title-name,.tb-title-sub,.tb-btn-text,.tb-zoom{white-space:nowrap}.designer-toolbar.is-tight .tb-title{min-width:0;overflow:hidden}.designer-toolbar.is-tight .tb-title-name,.designer-toolbar.is-tight .tb-title-sub{overflow:hidden;text-overflow:ellipsis}.tb-group{display:flex;align-items:center;gap:2px;padding:0 8px}.tb-group+.tb-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.tb-btn{height:30px;min-width:30px;padding:0 8px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:5px;transition:background .14s ease,color .14s ease,border-color .14s ease,box-shadow .14s ease}.tb-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-btn:active{background:var(--pd-border-soft, #e9ecf2)}.tb-btn:disabled{opacity:.32;cursor:default;background:transparent;color:var(--pd-text-faint, #b4b9c4)}.tb-btn.danger:hover:not(:disabled){color:var(--pd-accent-secondary, #f56c6c);background:var(--pd-danger-soft, rgba(245, 108, 108, .1))}.tb-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));font-weight:600}.tb-btn .dot{width:6px;height:6px;border-radius:50%;background:var(--pd-text-faint, #b4b9c4);display:inline-block;transition:background .14s ease,box-shadow .14s ease}.tb-btn.on .dot{background:var(--pd-accent, #165DFF);box-shadow:0 0 0 3px #165dff1f}.tb-icon{font-size:15px;line-height:1}[data-tip]{position:relative}[data-tip]:after{content:attr(data-tip);position:absolute;bottom:-32px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}[data-tip]:hover:after{opacity:1}.tb-mark{width:28px;height:28px;margin-right:2px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;color:#fff;background:linear-gradient(150deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));box-shadow:0 3px 8px #165dff47,inset 0 1px #ffffff38;flex-shrink:0}.tb-mark svg{width:16px;height:16px}.tb-title{display:flex;flex-direction:column;line-height:1.2;padding-left:6px}.tb-title-name{font-size:13px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.2px}.tb-title-sub{font-size:10px;color:var(--pd-text-muted, #8b909c);letter-spacing:.8px}.tb-zoom{font-size:12px;color:var(--pd-text, #2a2e37);font-variant-numeric:tabular-nums;min-width:46px;text-align:center}.tb-spacer{flex:1}.tb-group .tb-dd-trigger{height:30px;min-width:30px;padding:0 8px}.tb-btn-text{font-size:12px}.tb-menu{padding:8px;display:flex;flex-direction:column;gap:4px}.tb-menu-rows{width:148px}.tb-menu-label{padding:2px 4px;font-size:11px;color:var(--pd-text-muted, #8b909c)}.tb-menu-grid{display:grid;grid-template-columns:repeat(4,32px);gap:2px;margin-bottom:4px}.tb-menu-row{justify-content:flex-start;width:100%}.btn-primary,.btn-secondary{height:32px;padding:0 16px;border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;transition:filter .14s ease,background .14s ease,border-color .14s ease,box-shadow .14s ease}.btn-secondary{background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text-muted, #606266);border:1px solid var(--pd-border, #d9dde6)}.btn-secondary:hover{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .06))}.btn-primary{background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));color:#fff;border:none;box-shadow:0 3px 10px #165dff47,inset 0 1px #ffffff2e}.btn-primary:hover{filter:brightness(1.07);box-shadow:0 5px 14px #165dff57,inset 0 1px #ffffff2e}.btn-primary:active{filter:brightness(.97)}.font-select{position:relative}.font-select-input{display:block;width:100%}.font-select-list{position:absolute;top:calc(100% + 4px);left:0;width:100%;min-width:150px;z-index:200;margin:0;max-height:200px;overflow-y:auto;padding:2px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #ffffff);box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));list-style:none}.font-select-list.is-up{top:auto;bottom:calc(100% + 4px)}.font-select-option{padding:4px 6px;border-radius:4px;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.font-select-option.is-active{background:var(--pd-sidebar-hover, #f0f3f9)}.font-select-option.is-muted{color:var(--pd-text-muted, #8b909c)}.pd-stepper{display:flex;align-items:center;width:100%}.pd-step-btn{width:26px;height:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-step-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-step-btn:disabled{opacity:.45;cursor:not-allowed}.pd-step-minus{border-radius:6px 0 0 6px;border-right:none}.pd-step-plus{border-radius:0 6px 6px 0;border-left:none}.pd-step-input.pd-input{border-radius:0;min-width:0;flex:1;text-align:center;-moz-appearance:textfield}.pd-step-input.pd-input::-webkit-outer-spin-button,.pd-step-input.pd-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.preset-color-trigger{display:flex;align-items:center;width:100%;min-height:26px;padding:1px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #fff);cursor:pointer;transition:border-color .14s ease,box-shadow .14s ease}.preset-color-trigger:hover,.preset-color-trigger[aria-expanded=true]{border-color:var(--pd-accent, #165DFF)}.preset-color-trigger:focus-visible{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.preset-color-swatch{width:100%;height:22px;border-radius:4px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.preset-color-panel{position:fixed;z-index:3000;width:190px;padding:10px;border:1px solid var(--pd-border, #d9dde6);border-radius:8px;background:var(--pd-surface, #fff);box-shadow:0 8px 24px #17203c29}.picker-preview{display:flex;align-items:center;gap:8px;margin-bottom:8px}.picker-current{flex:0 0 26px;height:24px;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.picker-current.is-empty{position:relative;background-color:#fff}.picker-current.is-empty:after{content:"";position:absolute;inset:3px;background:linear-gradient(to top right,transparent calc(50% - .7px),#f53f3f calc(50% - .7px),#f53f3f calc(50% + .7px),transparent calc(50% + .7px));border-radius:3px}.picker-hex{flex:1;min-width:0;height:24px;padding:0 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:5px;color:var(--pd-text, #303133);font:inherit;font-size:11px;text-transform:uppercase}.picker-hex:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.picker-area{position:relative;height:100px;border:1px solid rgb(0 0 0 / 12%);border-radius:6px;overflow:hidden;cursor:crosshair;touch-action:none;background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,hsl(var(--picker-hue) 100% 50%))}.picker-handle{position:absolute;width:12px;height:12px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 3px #00000073;pointer-events:none}.picker-hue{width:100%;height:14px;margin:10px 0 0;appearance:none;border:1px solid rgb(0 0 0 / 12%);border-radius:999px;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.picker-hue::-webkit-slider-thumb{appearance:none;width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-hue::-moz-range-thumb{width:8px;height:8px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-heading{display:flex;align-items:center;justify-content:space-between;margin-top:10px;margin-bottom:6px;font-size:11px;color:var(--pd-text-muted, #909399)}.picker-clear{display:inline-flex;align-items:center;gap:3px;padding:2px 6px;border:none;border-radius:4px;background:transparent;font-size:11px;line-height:1;color:var(--pd-text-muted, #909399);cursor:pointer}.picker-clear:hover:not(:disabled){background:#0000000f;color:var(--pd-danger, #f53f3f)}.picker-clear:disabled{opacity:.45;cursor:not-allowed}.preset-color-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}.preset-color-item{width:22px;height:22px;padding:0;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;cursor:pointer}.preset-color-item.active{box-shadow:0 0 0 2px #fff,0 0 0 3px var(--pd-accent, #165DFF)}.format-toolbar{display:flex;align-items:center;gap:2px;flex-shrink:0;min-width:0}.ft-group{display:flex;align-items:center;gap:2px;padding:0 8px;flex-shrink:0}.ft-group+.ft-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.ft-btn{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:4px;transition:background .14s ease,color .14s ease}.ft-btn:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.ft-btn:disabled{opacity:.32;cursor:default}.ft-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.ft-btn-text{font-size:12px}.ft-btn[data-tip]{position:relative}.ft-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.ft-btn[data-tip]:hover:after{opacity:1}.ft-font{width:150px}.ft-size{width:96px}.ft-font .font-select-input,.ft-size .pd-input,.ft-size .pd-step-btn{font-size:12px}.ft-color-btn{position:relative;width:28px;height:28px;display:inline-flex;margin-left:2px}.ft-color-btn.dim{opacity:.35}.ft-color-btn .preset-color-trigger{width:100%;height:100%;min-height:0;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;align-items:flex-end;justify-content:center}.ft-color-btn .preset-color-trigger:hover,.ft-color-btn .preset-color-trigger[aria-expanded=true]{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-color-btn .preset-color-swatch{width:16px;height:4px;margin-bottom:3px;border-radius:1px;background-image:none;border-bottom:1px solid var(--pd-text-faint, #b4b9c4)}.ft-glyph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding-bottom:7px;font-size:13px;font-weight:700;color:var(--pd-text, #2a2e37);pointer-events:none}.ft-border-panel{width:196px;padding:10px;display:flex;flex-direction:column;gap:8px}.ft-align-panel{padding:6px;display:flex;flex-direction:column;gap:4px}.ft-align-row{display:grid;grid-template-columns:repeat(3,36px);gap:4px}.ft-border-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-cell-btn{height:30px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-cell-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-cell-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-cell-btn:disabled{opacity:.32;cursor:default}.ft-cell-btn .g-faint{fill:none;stroke:var(--pd-text-faint, #b4b9c4);stroke-width:1;stroke-dasharray:2 2}.ft-cell-btn .g-solid{stroke:currentColor;stroke-width:1.6}.ft-cell-btn[data-tip],.ft-style-btn[data-tip]{position:relative}.ft-cell-btn[data-tip]:after,.ft-style-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;font-weight:400;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:210}.ft-cell-btn[data-tip]:hover:after,.ft-style-btn[data-tip]:hover:after{opacity:1}.ft-style-row{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-style-btn{height:22px;display:inline-flex;align-items:center;justify-content:center;padding:0 4px;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-style-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.ft-style-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-style-line{width:100%;height:0}.ft-border-style-row{display:flex;align-items:center;gap:6px}.ft-line-width{width:96px}.ft-edge-label{font-size:12px;color:var(--pd-text-muted, #8b909c);white-space:nowrap;flex-shrink:0}.layer-panel{border-top:1px solid var(--pd-border);padding:8px 12px;height:100%;box-sizing:border-box;overflow-y:auto}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}.layer-item{display:flex;align-items:center;gap:6px;padding:4px 6px;margin-bottom:2px;border-radius:4px;cursor:pointer;font-size:12px;transition:background .1s}.layer-item:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.layer-item.active{background:#165dff1a;color:var(--pd-accent, #165DFF);box-shadow:inset 2px 0 0 var(--pd-accent, #165DFF)}.layer-icon{width:18px;text-align:center;font-size:12px;color:var(--pd-text-muted, #909399)}.layer-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pd-text, #303133)}.layer-zone{flex-shrink:0;padding:0 4px;font-size:10px;line-height:14px;color:var(--pd-ink-green, #67c23a);background:#67c23a1a;border-radius:3px}.layer-zindex{font-size:10px;color:var(--pd-text-muted, #909399);font-variant-numeric:tabular-nums}.layer-actions{display:flex;gap:4px;margin-top:8px}.field-tree-panel{padding:0}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;padding:4px 0 8px;margin-bottom:8px;border-bottom:1px solid var(--pd-border)}.search-input{margin-bottom:8px}.tree-container{overflow-y:auto;min-height:0}.field-group-header{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .1s}.field-group-header:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.field-group-header.is-list{color:var(--pd-accent, #165DFF);font-weight:500}.expand-icon{width:12px;font-size:8px;flex-shrink:0;color:var(--pd-text-muted, #909399)}.field-row{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:grab;-webkit-user-select:none;user-select:none;transition:background .1s}.field-row:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.node-icon{font-size:14px;flex-shrink:0;filter:saturate(.6);opacity:.9}.node-meta{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:center;column-gap:4px;row-gap:1px}.node-label{flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.node-key{flex:0 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--pd-text-muted, #909399)}.group-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.copy-hint{flex-shrink:0;margin-left:auto;font-size:11px;color:var(--pd-accent, #165DFF);white-space:nowrap}.left-panel{width:248px;min-width:248px;background:var(--pd-sidebar, #ffffff);border-right:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.left-panel.collapsed{width:36px;min-width:36px;border-right:1px solid var(--pd-border-soft, #e9ecf2)}.left-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.lc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.lc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.lc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.left-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.left-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.left-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.left-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.left-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.material-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-content:start}.material-grid>.panel-title,.material-grid>.material-group-title,.material-grid>.material-card--wide{grid-column:1 / -1}.material-grid>.panel-title,.material-grid>.material-group-title{margin-bottom:0}.material-grid>.material-card{margin-bottom:0;min-width:0}.panel-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:2px 2px 8px;margin-bottom:10px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-group-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:4px 2px 6px;margin:2px 0 8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-card{display:flex;align-items:center;gap:10px;padding:8px 10px;margin-bottom:7px;border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;background:var(--pd-field-bg, #f4f6fa);cursor:grab;-webkit-user-select:none;user-select:none;transition:border-color .14s ease,background .14s ease,transform .14s ease,box-shadow .14s ease}.material-card:hover{border-color:#165dff73;background:var(--pd-surface, #ffffff);transform:translateY(-1px);box-shadow:var(--pd-shadow-sm, 0 1px 2px rgba(23, 32, 60, .05))}.material-card:active{cursor:grabbing;transform:translateY(0)}.material-icon{width:30px;height:24px;border:1px dashed var(--pd-border, #d9dde6);border-radius:5px;display:flex;align-items:center;justify-content:center;color:var(--pd-accent, #165DFF);background:var(--pd-surface, #ffffff);flex-shrink:0;transition:border-color .14s ease,background .14s ease}.material-card:hover .material-icon{border-style:solid;border-color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.material-label{font-size:12.5px;color:var(--pd-text, #2a2e37)}.print-image{width:100%;height:100%;overflow:hidden}.print-image img{width:100%;height:100%;display:block}.table-ctx-menu{position:fixed;z-index:3000;min-width:140px;padding:4px 0;background:var(--pd-surface, #fff);border:1px solid var(--pd-menu-border, #dcdfe6);border-radius:4px;box-shadow:0 2px 12px #00000026;font-size:13px}.menu-item{padding:5px 14px;cursor:pointer;color:var(--pd-menu-text, #333)}.menu-item:hover{background:var(--pd-menu-hover, #f5f7fa)}.menu-item.disabled{color:var(--pd-menu-disabled, #c0c4cc);cursor:not-allowed}.menu-item.active{color:var(--pd-accent, #165DFF)}.menu-divider{height:1px;margin:4px 0;background:var(--pd-menu-divider, #ebeef5)}.menu-group-title{padding:4px 14px;font-size:12px;color:var(--pd-menu-muted, #909399)}.cell-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-barcode svg{max-width:100%;max-height:100%}.cell-barcode img{max-width:100%;max-height:100%}.cell-barcode-fallback{font-style:italic;opacity:.6}.cell-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-image img{max-width:100%;max-height:100%;display:block}.image-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:#bbb;font-size:12px;border:1px dashed #ddd;box-sizing:border-box}.print-table{position:relative;width:100%;height:100%}.print-table table{border-collapse:collapse;table-layout:fixed;width:100%}.print-table td{box-sizing:border-box;word-break:normal;overflow-wrap:break-word}.cell-selected{outline:2px solid #165DFF;outline-offset:-2px;background-color:#165dff14}.row-data-bg{background-image:repeating-linear-gradient(45deg,rgba(22,93,255,.04) 0 6px,transparent 6px 12px)}.data-placeholder{color:#909399;font-style:italic}.row-badges{position:absolute;left:-16px;top:0;width:14px}.row-badge{position:absolute;width:14px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#909399;background:#f5f7fa;border-radius:2px}.col-resize-layer{position:absolute;inset:0;pointer-events:none;z-index:3}.col-resize-handle{position:absolute;top:0;bottom:0;width:6px;transform:translate(-50%);cursor:col-resize;pointer-events:auto}.col-resize-handle:after{content:"";position:absolute;top:0;bottom:0;left:50%;border-left:1px solid transparent}.col-resize-handle:hover:after,.col-resize-handle.dragging:after{border-left-color:var(--pd-accent, #165DFF)}.print-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-barcode svg{max-width:100%;max-height:100%}.print-qrcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-qrcode img{max-width:100%;max-height:100%}.print-html,.page-number-element{width:100%;height:100%;overflow:hidden}.print-element{box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none}.extension-placeholder{display:flex;align-items:center;justify-content:center;width:100%;height:100%;box-sizing:border-box;padding:2px;font-size:11px;line-height:1.4;text-align:center;color:var(--pd-text-muted, #8b909c);background:repeating-linear-gradient(45deg,#f4f6fa,#f4f6fa 6px,#fff 6px 12px);overflow:hidden}.element-margin-guide{position:absolute;box-sizing:border-box;pointer-events:none}.print-element.design-mode{outline:1px dashed #C3C9D6}.print-element.design-mode.zone-header,.print-element.design-mode.zone-footer{outline:1px dashed var(--pd-ink-green, #67c23a)}.print-element.selected{outline:1.5px solid var(--pd-accent, #165DFF);background:#165dff0a}.print-element.previewed{outline:1.5px solid rgba(22,93,255,.5);background:#165dff1a}.print-element.design-mode:hover{outline:1px dashed var(--pd-accent, #165DFF)}.print-element.locked{cursor:not-allowed}.print-element.locked:not(.selected){outline:1.5px dashed #999}.print-element.hidden{opacity:.3;pointer-events:none}.print-element.drag-ghost{opacity:.4}.drag-preview{position:absolute;inset:0;border:2px dashed var(--pd-accent, #165DFF);pointer-events:none;z-index:1000;box-sizing:border-box}.selected-indicator{position:absolute;top:-18px;left:0;font-size:10px;white-space:nowrap;pointer-events:none;z-index:20}.position-label{background:var(--pd-accent, #165DFF);color:#fff;padding:1px 6px;border-radius:3px;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:10px;font-variant-numeric:tabular-nums;letter-spacing:0;box-shadow:0 2px 6px #00000026}.resize-handles{position:absolute;inset:0;pointer-events:none}.resize-handle{position:absolute;width:7px;height:7px;background:var(--pd-handle, #165DFF);border:1.5px solid #fff;border-radius:2px;box-sizing:border-box;transform:translate(-50%,-50%);box-shadow:0 1px 3px #0000002e;z-index:10;pointer-events:auto}.handle-nw{top:0;left:0;cursor:nw-resize}.handle-n{top:0;left:50%;cursor:n-resize}.handle-ne{top:0;left:100%;cursor:ne-resize}.handle-e{top:50%;left:100%;cursor:e-resize}.handle-se{top:100%;left:100%;cursor:se-resize}.handle-s{top:100%;left:50%;cursor:s-resize}.handle-sw{top:100%;left:0;cursor:sw-resize}.handle-w{top:50%;left:0;cursor:w-resize}.paper-wrapper{display:block}.hiprint-printPaper{transition:transform .15s ease-out}.zone-layer{box-sizing:border-box}.zone-layer.zone-header.design-mode,.zone-layer.zone-footer.design-mode{outline:1px dashed var(--pd-ink-green, #67c23a);background:#67c23a0a}.zone-layer.zone-content.design-mode{outline:1px dashed #C3C9D6}.zone-label{position:absolute;top:2px;right:4px;font-size:9px;color:#909399;pointer-events:none;-webkit-user-select:none;user-select:none}.zone-resize-handle{position:absolute;left:0;width:100%;height:6px;cursor:ns-resize;z-index:5}.zone-resize-handle.handle-bottom{bottom:-3px}.zone-resize-handle.handle-top{top:-3px}.zone-resize-handle:hover{background:#10b98140}.zone-height-tip{position:absolute;right:4px;top:-22px;padding:1px 6px;font-size:11px;color:#fff;background:#10b981;border-radius:3px;white-space:nowrap;pointer-events:none}.design-background{position:absolute;z-index:0;overflow:hidden;pointer-events:none}.design-background img{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.grid-bg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:0}.snap-indicator{position:absolute;width:6px;height:6px;background:var(--pd-accent, #165DFF);border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;z-index:10;animation:snap-pulse-3160f418 .3s ease-out}@keyframes snap-pulse-3160f418{0%{transform:translate(-50%,-50%) scale(2);opacity:.5}to{transform:translate(-50%,-50%) scale(1);opacity:0}}.watermark-layer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;overflow:hidden;pointer-events:none}.watermark-tile{position:absolute;pointer-events:none}.adsorb-guide{position:absolute;pointer-events:none;z-index:9999}.adsorb-guide.guide-vertical{border-left:1px dashed var(--pd-accent-secondary, #f56c6c)}.adsorb-guide.guide-horizontal{border-top:1px dashed var(--pd-accent-secondary, #f56c6c)}.manual-guide{position:absolute;pointer-events:auto;z-index:9998;cursor:move}.manual-guide.guide-vertical{border-left:1px solid #3B82F6;width:0}.manual-guide.guide-horizontal{border-top:1px solid #3B82F6;height:0}.manual-guide:before{content:"";position:absolute;pointer-events:auto}.manual-guide.guide-vertical:before{top:0;bottom:0;left:50%;width:var(--guide-hit, 8px);transform:translate(-50%)}.manual-guide.guide-horizontal:before{left:0;right:0;top:50%;height:var(--guide-hit, 8px);transform:translateY(-50%)}.manual-guide:hover{border-color:#ef4444!important}.pd-ruler{position:absolute;display:block;pointer-events:auto;cursor:crosshair;z-index:1;background:var(--pd-ruler-bg, #f8f9fc)}.pd-ruler.is-horizontal{box-shadow:0 1px 0 var(--pd-border-soft, #e9ecf2)}.pd-ruler.is-vertical{box-shadow:1px 0 0 var(--pd-border-soft, #e9ecf2)}.canvas-area{flex:1;overflow-x:scroll;overflow-y:auto;scrollbar-gutter:stable;display:flex;background-color:var(--pd-canvas-bg, #e6e9f0);background-image:radial-gradient(circle,rgba(23,32,60,.13) 1px,transparent 1.2px);background-size:20px 20px;background-position:center;padding:44px 28px 32px 44px;position:relative}.canvas-scroll{display:flex;flex-direction:column;align-items:center;gap:20px;position:relative;flex:none;margin:auto;width:fit-content}.marquee-selection{position:fixed;border:1.5px solid rgba(22,93,255,.7);background:#165dff14;border-radius:2px;pointer-events:none;z-index:10000}.drop-hint{position:fixed;z-index:10002;pointer-events:none;padding:2px 8px;border-radius:10px;background:var(--pd-accent, #165dff);color:#fff;font-size:12px;line-height:18px;white-space:nowrap;box-shadow:0 2px 8px #0000002e}.context-menu{position:fixed;background:var(--pd-surface, #ffffff);border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 10px 28px rgba(23, 32, 60, .12));padding:5px;z-index:10001;min-width:132px}.context-menu-item{padding:7px 12px;border-radius:5px;font-size:12.5px;cursor:pointer;color:var(--pd-text, #2a2e37);-webkit-user-select:none;user-select:none;transition:background .12s ease,color .12s ease}.context-menu-item:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.context-menu-item.disabled{color:var(--pd-text-faint, #b4b9c4);cursor:not-allowed}.context-menu-item.disabled:hover{background:transparent;color:var(--pd-text-faint, #b4b9c4)}.context-menu-sep{height:1px;background:var(--pd-border-soft, #e9ecf2);margin:5px 8px}.ruler-overlay{position:absolute;inset:0;pointer-events:none;z-index:60}.ruler-corner{position:absolute;top:0;left:0;width:22px;height:22px;background:var(--pd-ruler-bg, #f8f9fc);box-shadow:1px 1px 0 var(--pd-border-soft, #e9ecf2);z-index:2}.ruler-overlay .pd-ruler.is-horizontal{top:0;left:22px}.ruler-overlay .pd-ruler.is-vertical{top:22px;left:0}.ruler-guide-preview{position:fixed;pointer-events:none;z-index:9997}.ruler-guide-preview.guide-vertical{width:0;border-left:1px dashed var(--pd-accent, #165dff)}.ruler-guide-preview.guide-horizontal{height:0;border-top:1px dashed var(--pd-accent, #165dff)}.property-search{padding:0 0 10px;background:transparent}.property-group{border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;margin-bottom:10px;background:var(--pd-surface, #ffffff);overflow:hidden;transition:border-color .14s ease,box-shadow .14s ease}.property-group:last-child{margin-bottom:2px}.property-group.is-expanded{border-color:var(--pd-border-soft, #e9ecf2)}.group-header{display:flex;align-items:center;padding:9px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;background:var(--pd-field-bg, #f4f6fa);transition:background .14s ease}.group-header:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.property-group.is-expanded .group-header{border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.group-icon{margin-right:8px;color:var(--pd-accent, #165DFF)}.group-title{flex:1;font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.3px}.expand-icon{color:var(--pd-text-muted, #8b909c);font-size:10px}.group-content{padding:10px 12px 12px;background:var(--pd-surface, #ffffff)}.position-grid,.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.margin-grid{margin-top:8px}.pd-crop-note{margin:0 0 8px;font-size:12px;line-height:1.5;color:var(--pd-text-faint, #6b7280)}.pd-crop-preview{position:relative;overflow:hidden;margin-bottom:8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;line-height:0;width:fit-content;max-width:100%}.pd-crop-thumb{max-width:100%;max-height:96px;display:block}.pd-crop-win{position:absolute;border:1px solid #ff5a5a;box-shadow:0 0 0 999px #0000008c;pointer-events:none}.color-row{display:flex;gap:12px}.color-row>.pd-field{flex:1 1 0;min-width:0}.pd-rotate-row{display:flex;align-items:stretch;width:100%}.pd-rotate-btn{width:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;transition:background .14s ease,border-color .14s ease}.pd-rotate-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-rotate-btn:first-child{border-radius:6px 0 0 6px;border-right:none}.pd-rotate-btn:last-child{border-radius:0 6px 6px 0;border-left:none}.pd-rotate-stepper{flex:1;min-width:0}.pd-rotate-stepper .pd-step-minus,.pd-rotate-stepper .pd-step-plus{display:none}.pd-rotate-stepper .pd-step-input.pd-input{border-radius:0}.expression-editor{display:flex;height:450px;gap:0}.ee-nav{width:100px;background:var(--pd-sidebar);border-right:1px solid var(--pd-border);display:flex;flex-direction:column;flex-shrink:0}.ee-nav-title{padding:10px;border-bottom:1px solid var(--pd-border);font-weight:600;font-size:13px;color:var(--pd-text);text-align:center}.ee-nav-tabs{flex:1;display:flex;flex-direction:column;padding:6px;gap:4px}.ee-nav-tab{padding:8px 10px;border-radius:6px;cursor:pointer;font-size:12px;text-align:center;transition:all .2s}.ee-nav-tab.active{background:var(--pd-accent);color:#fff}.ee-nav-tab:not(.active){background:var(--pd-surface, white);border:1px solid var(--pd-border);color:var(--pd-text)}.ee-nav-tab:hover:not(.active){background:var(--pd-hover-tint, #ecf5ff);border-color:var(--pd-accent)}.ee-content{width:300px;display:flex;flex-direction:column;border-right:1px solid var(--pd-border);flex-shrink:0}.ee-content-search{padding:10px;border-bottom:1px solid var(--pd-border)}.ee-content-list{flex:1;padding:8px;overflow-y:auto;min-height:0}.ee-func-group{margin-bottom:12px}.ee-func-group-title{font-size:11px;font-weight:600;color:var(--pd-text-muted);padding:6px 10px;margin-bottom:2px;letter-spacing:.5px}.ee-field-group{display:flex;align-items:center;gap:4px;padding:6px 10px;font-size:12px;font-weight:600;color:var(--pd-text)}.ee-field-group.is-list{color:var(--pd-accent, #165DFF)}.ee-field-group-icon{font-size:13px;filter:saturate(.6)}.ee-list-item{padding:7px 10px;cursor:pointer;border-radius:4px;margin-bottom:2px;transition:background .15s}.ee-field-info{display:flex;flex-direction:column;gap:1px}.ee-field-info .ee-item-label{font-size:12px;color:var(--pd-text)}.ee-field-info .ee-item-key{font-size:10px;color:var(--pd-text-muted);font-family:monospace}.ee-field-item{display:flex;align-items:center;gap:6px}.ee-field-item .ee-field-info{flex:1;min-width:0}.ee-copy-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-muted);cursor:pointer;transition:color .15s,background .15s,border-color .15s}.ee-copy-btn:hover{background:var(--pd-surface, white);border-color:var(--pd-border);color:var(--pd-accent)}.ee-copy-btn.is-copied{color:var(--pd-success, #16a34a)}.ee-list-item:hover{background:var(--pd-hover-tint, #ecf5ff)}.ee-editor{flex:1;display:flex;flex-direction:column;background:var(--pd-sidebar);min-width:0}.ee-editor-section{padding:12px;border-bottom:1px solid var(--pd-border)}.ee-editor-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}.ee-textarea{width:100%;border:1px solid var(--pd-border);border-radius:6px;padding:10px;font-family:monospace;font-size:13px;resize:vertical;box-sizing:border-box;min-height:100px}.ee-textarea:focus{outline:none;border-color:var(--pd-accent)}.ee-preview{padding:10px;background:var(--pd-bg);border:1px solid var(--pd-border);border-radius:6px;min-height:30px;font-size:13px;color:var(--pd-text);line-height:1.6;white-space:pre-wrap}.ee-preview-error{color:var(--pd-danger, #e53e3e);background:var(--pd-danger-bg, #fef2f2);border-color:var(--pd-danger-border, #fecaca)}.ee-help-section{flex:1;padding:12px;overflow-y:auto;min-height:0}.ee-help-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:8px;text-transform:uppercase;letter-spacing:.5px}.ee-help-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.ee-help-card{border-radius:6px;padding:10px}.ee-help-card-title{font-size:12px;font-weight:600;margin-bottom:4px}.ee-help-card-content{font-size:11px;line-height:1.5;color:var(--pd-text)}.ee-help-field{background:var(--pd-help-field-bg, #f0f9ff);border:1px solid var(--pd-help-field-line, #bae6fd)}.ee-help-field .ee-help-card-title{color:var(--pd-help-field-ink, #0369a1)}.ee-help-function{background:var(--pd-help-function-bg, #f0fdf4);border:1px solid var(--pd-help-function-line, #bbf7d0)}.ee-help-function .ee-help-card-title{color:var(--pd-help-function-ink, #166534)}.ee-help-variable{background:var(--pd-help-variable-bg, #fefce8);border:1px solid var(--pd-help-variable-line, #fde68a)}.ee-help-variable .ee-help-card-title{color:var(--pd-help-variable-ink, #854d0e)}.ee-help-conditional{background:var(--pd-help-conditional-bg, #fdf2f8);border:1px solid var(--pd-help-conditional-line, #fbcfe8)}.ee-help-conditional .ee-help-card-title{color:var(--pd-help-conditional-ink, #9d174d)}.expression-editor{max-height:min(600px,80vh);overflow-y:auto;padding:16px}.col-width-row{display:flex;align-items:center;gap:8px;margin-bottom:4px;width:100%}.border-row{display:flex;gap:10px}.border-row .pd-field{flex:1;min-width:0}.advanced-row{display:flex;gap:16px}.group-help{flex:0 0 auto;width:18px;height:18px;margin-right:6px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:18px;cursor:pointer}.group-help:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.group-help:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}.image-content-upload{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin-top:4px}.upload-tip{margin:0;font-size:11px;color:var(--pd-text-muted, #909399)}.cell-style-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 8px}.cell-font-field{grid-column:1 / -1;padding-bottom:8px}.border-style-row{display:flex;gap:6px;margin-bottom:8px}.border-presets{margin-bottom:8px}.merge-btns{display:flex;gap:8px}.merge-card{margin-top:8px;padding:8px;border:1px solid var(--pd-border, #dcdfe6);border-radius:6px}.merge-card-title{font-size:12px;font-weight:600;color:var(--pd-text, #303133);margin-bottom:8px}.merge-card-divider{height:1px;background:var(--pd-menu-divider, #ebeef5);margin:8px 0}.merge-card-hint{margin-top:6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #8b909c)}.watermark-config{padding:0 4px}.pd-hint{margin-left:8px;font-size:12px;color:#909399;min-width:32px}.design-background-config{padding:0 4px}.design-background-tip{margin:2px 0 6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #909399)}.design-background-path{margin-bottom:6px;padding:4px 6px;font-size:11px;color:var(--pd-text-regular, #606266);background:var(--pd-fill-light, #f5f7fa);border-radius:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.design-background-actions{display:flex;gap:6px}.upload-label{cursor:pointer}.upload-label.disabled{opacity:.6;cursor:not-allowed}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.tiling-config{padding:0 4px}.tiling-switch{display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer}.tiling-error{color:#f56c6c}.tiling-summary{color:var(--pd-text-regular, #606266)}.property-panel{width:304px;min-width:304px;background:var(--pd-sidebar, #ffffff);border-left:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.property-panel.collapsed{width:36px;min-width:36px;border-left:1px solid var(--pd-border-soft, #e9ecf2)}.prop-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.pc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.pc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.prop-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.prop-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.prop-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.collapse-btn{border:none;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:14px;cursor:pointer;width:24px;height:24px;border-radius:5px;transition:all .14s ease}.collapse-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.prop-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.prop-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.property-content{padding:0}.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.custom-size-grid{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:4px;width:100%}.custom-size-x{color:var(--pd-text-muted, #8b909c);font-size:12px}.pd-hint{margin:2px 0 6px;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1.4}.page-bg-row{display:flex;align-items:center;gap:8px}.page-bg-picker{flex:1;min-width:0}.status-bar{position:relative;display:flex;align-items:center;gap:20px;height:30px;padding:0 16px;background:var(--pd-surface, #ffffff);border-top:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 -1px 2px #17203c08;font-size:11.5px;color:var(--pd-text-muted, #8b909c);-webkit-user-select:none;user-select:none;flex-shrink:0}.status-item{white-space:nowrap;font-variant-numeric:tabular-nums;display:inline-flex;align-items:center}.coord{font-variant-numeric:tabular-nums;color:var(--pd-text, #2a2e37)}.status-paper{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--pd-accent, #165DFF);font-weight:600}.status-dirty{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;color:var(--pd-text-muted, #8b909c)}.status-dirty.on{color:var(--pd-accent-secondary, #f56c6c)}.dirty-dot{width:7px;height:7px;border-radius:50%;background:var(--pd-ink-green, #67c23a)}.status-dirty.on .dirty-dot{background:var(--pd-accent-secondary, #f56c6c);box-shadow:0 0 0 3px #f56c6c24;animation:dirty-pulse-a91952ff 1.6s ease-in-out infinite}@keyframes dirty-pulse-a91952ff{0%,to{box-shadow:0 0 0 2px #f56c6c1f}50%{box-shadow:0 0 0 4px #f56c6c0d}}@media(prefers-reduced-motion:reduce){.status-dirty.on .dirty-dot{animation:none}}.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);height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.designer-body{flex:1;display:flex;overflow:hidden}.designer-container.format-painting .canvas-area,.designer-container.format-painting .canvas-area *{cursor:copy!important}.print-html-preview{width:100%;height:100%;position:relative;background:#e9ebee}.print-html-preview-iframe{width:100%;height:100%;border:0;background:#fff}.print-html-preview-loading,.print-html-preview-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#909399;font-size:14px}.print-html-preview-error{color:#f56c6c}.print-html-preview-warn{position:absolute;top:8px;left:12px;z-index:2;max-width:62%;padding:4px 8px;border:1px solid #e6a23c;border-radius:4px;background:#faecd1f0;color:#b88230;font-size:12px;line-height:1.5}.print-html-preview-zoom{position:absolute;top:8px;right:12px;z-index:2;display:flex;align-items:center;gap:4px;padding:3px 4px;border:1px solid var(--pd-border-soft, #ebeef5);border-radius:6px;background:#ffffffeb;box-shadow:0 1px 4px #00000014}.print-html-preview-zoom-btn{padding:2px 7px;border:0;border-radius:4px;background:transparent;color:var(--pd-text-muted, #909399);font-size:11px;line-height:18px;cursor:pointer;transition:color .14s ease,background .14s ease}.print-html-preview-zoom-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.print-html-preview-zoom-btn.active{background:var(--pd-accent, #165DFF);color:#fff;font-weight:600}.print-html-preview-zoom-note{padding-right:4px;color:var(--pd-text-muted, #909399);font-size:11px}.print-html-preview-zoom-hint{color:#b88230;font-size:11px}.tiling-config .margin-grid,.tiling-config .custom-size-grid{display:block;grid-template-columns:none;gap:normal}.tiling-config .custom-size-x{display:inline;min-width:0;color:inherit}.pd-hint{min-width:auto}.watermark-config .pd-hint{min-width:32px;margin-left:8px;color:#909399}.tiling-config .tiling-error{color:#f56c6c}.tiling-config .tiling-summary{color:var(--pd-text-regular, #606266)}.pd-help{position:static}.pd-help:after{top:calc(100% + 6px);bottom:auto;left:0;transform:none;padding:5px 7px;white-space:normal;z-index:120}.page-tabs [data-tip]:after,.field-tree-panel [data-tip]:after{content:none}',Gi=20,tE=".page-tabs, .field-tree-panel, .pd-dialog-overlay",nE=new Set(["z","y","a","c","x","v","d","g","1","l","r","e","t","b","0"]),og="print-studio:left",ig="print-studio:right";function ag(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function sg(e,t){try{localStorage.setItem(e,t?"1":"0")}catch{}}function $l(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return}if(Array.isArray(t))return t.filter(n=>!!n&&typeof n=="object"&&!Array.isArray(n));if(t&&typeof t=="object")return[t]}class jt extends HTMLElement{root;store;format;unsub=null;unsubPluginUI=null;unsubDefinitions=null;pluginStyleEls=new Map;instanceDisposers=[];measureRaf=null;state={leftTab:"elements",leftCollapsed:!1,propTab:"page",propCollapsed:!1,openDd:null,openMore:!1,collapsedGroups:new Set,renamingPage:null};geom={originX:0,originY:0,viewW:0,viewH:0,paperScale:1};static active=null;docKeydown=null;docDragend=null;ro=null;roArea=null;toolbarRo=null;scrollPos={x:0,y:0};paneScroll=new Map;marquee={visible:!1,x:0,y:0,w:0,h:0};menu={visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null};guidePreview=null;zoneResizing=null;tableMenu={visible:!1,x:0,y:0};exprTarget=null;exprMountedFor=null;helpVisible=!1;helpInitialTab;unmountHelp=null;drag=null;snapTimer=null;hoverTipEl=null;hoverTipTimer=null;resize=null;raf=0;lastSelKey="";chromeKey="";uploadImage;uploadDesignBackground;_designData;set designData(t){this._designData=$l(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=eE,this.root.appendChild(t),Je(h("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()}static contractVersion=Vs;static getHostContract(){return Xs()}getHostContract(){return Xs()}static get observedAttributes(){return[...Ys]}attributeChangedCallback(t,n,r){if(t==="design-data"){this._designData=r===null?void 0:$l(r),this.repaint();return}if(!r)return;if(t==="name"){this.repaint();return}let o;try{o=JSON.parse(r)}catch{return}t==="template"?this.applyTemplate(o):t==="fields"?(this.store.fields=o,this.repaint()):t==="fonts"&&Array.isArray(o)&&(this.fonts=o)}connectedCallback(){if(this.store){this.applyFontFace(),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners();return}const t={},n=this.getAttribute("template");if(n)try{t.initialTemplate=JSON.parse(n)}catch{}const r=this.getAttribute("fields");if(r)try{t.initialFields=JSON.parse(r)}catch{}const o=this.getAttribute("design-data");o&&this._designData===void 0&&(this._designData=$l(o)),this.store=new Af(t),this.format=new _v(this.store),this.store.onSelectionChanged=()=>this.format.painterSyncSelection(),this.readChrome(),this.unsub=this.store.subscribe(()=>this.repaint()),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners(),this.applyFontFace(),this.repaint(),this.measureRaf=requestAnimationFrame(()=>{this.measureRaf=null,this.measureRuler()})}readChrome(){this.state.leftCollapsed=ag(og),this.state.propCollapsed=ag(ig),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,sg(og,this.state.leftCollapsed),sg(ig,this.state.propCollapsed))}disconnectedCallback(){this.unsub?.(),this.unsub=null,this.unsubPluginUI?.(),this.unsubPluginUI=null,this.unsubDefinitions?.(),this.unsubDefinitions=null,hh(),this.detachDocKeys(),this.ro?.disconnect(),this.ro=null,this.roArea=null,this.toolbarRo?.disconnect(),this.toolbarRo=null,jt.active===this&&(jt.active=null),Th(),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=Er(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=gv(()=>this.repaint())),this.unsubDefinitions||(this.unsubDefinitions=Df(()=>this.repaint()))}syncPluginUIStyles(){const t=new Map;for(const{type:n,ui:r}of hv())r.styles&&t.set(n,r.styles);for(const[n,r]of[...this.pluginStyleEls])t.has(n)||(r.remove(),this.pluginStyleEls.delete(n));for(const[n,r]of t){let o=this.pluginStyleEls.get(n);o||(o=document.createElement("style"),o.setAttribute("data-plugin-ui",n),this.root.appendChild(o),this.pluginStyleEls.set(n,o)),o.textContent!==r&&(o.textContent=r)}}templateJsonWithFonts(){const t=JSON.parse(this.store.getTemplateJson()),n=this.fonts;if(!n?.length)return t;if(Array.isArray(t.pages)){const r=t;return{...r,pages:r.pages.map(o=>({...o,fonts:[...n]}))}}return{...t,fonts:[...n]}}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 n=this.getGeometryWarnings();n.length&&window.alert(`出纸提示(不影响保存):
|
|
1162
|
-
|
|
1163
|
-
`)}`);const r=this.templateJsonWithFonts();if(Array.isArray(r.pages))try{ls(r)}catch(i){window.alert(i instanceof Error?i.message:String(i));return}const o=JSON.stringify(r);this.store.dirty=!1,this.repaint(),this.dispatchEvent(new CustomEvent(xt.save,{detail:o,bubbles:!0,composed:!0}))}validateTemplate(){const t=this.store.templateData;return t.tiling?.enabled===!0?as(t):[]}getGeometryWarnings(){return a1(this.store.templateData)}applyTemplate(t){if(!t)return;const n=typeof t=="string"?JSON.parse(t):t;this.store?this.store.loadTemplate(n):this.setAttribute("template",JSON.stringify(n))}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 n=this.exprTarget;Je(W2({fields:this.store.fields,onClose:()=>this.closeExpression(),onApply:r=>this.applyExpression(n,r)},n),this.root),this.exprMountedFor=n}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=Y2(this.root,{initialTab:this.helpInitialTab,onClose:()=>this.closeHelp()});else if(!t&&this.unmountHelp){const n=this.unmountHelp;this.unmountHelp=null,n()}}applyExpression(t,n){const r=n.formatter??"",o=t.targetPath;if(o.startsWith("options.")){if(o.includes("[")){const a=this.store.elements.find(l=>l.id===t.elementId);a&&Ml(this.store,a,o,r);return}const i={[o.slice(8)]:r||void 0};n.title!==void 0&&(i.title=n.title),this.store.updateElement(t.elementId,i);return}if(o==="watermark.content"){const i={...this.store.templateData.watermark};Al(r)?Object.assign(i,{mode:"binding",binding:r,content:""}):Object.assign(i,{mode:"fixed",content:r,binding:""}),this.store.updateTemplateData({watermark:i})}}dblEditElement(t){const n=this.store.elements.find(o=>o.id===t);if(!n||(this.store.selectOne(t),this.state.propTab=Gs(n)?"custom":"element",n.options.locked))return;const r=zf(n.printElementType.type);r&&this.openExpression({elementId:n.id,targetPath:`options.${r}`,value:String(n.options[r]??"")})}dblEditCell(t){const n=this.store.elements.find(l=>l.id===t.elementId);if(!n||(this.store.selectOne(n.id),this.state.propTab="element",n.options.locked))return;const r=n.options.tableRows??[],o=or(r,t.r,t.c),a=r[o.r]?.cells[o.c];a&&this.openExpression({elementId:n.id,targetPath:`options.tableRows[${o.r}].cells[${o.c}].formatter`,value:a.formatter??""})}get ctx(){return{store:this.store,format:this.format,state:this.state,repaint:()=>this.repaint(),fire:(t,n)=>this.fire(t,n),showHelp:this.getAttribute("show-help")!=="false",isEdit:this.getAttribute("is-edit")==="true",host:{uploadImage:this.uploadImage,uploadDesignBackground:this.uploadDesignBackground,fonts:this.fonts,designData:this.designData,fields:this.store.fields}}}canvasUi(){return{geom:this.geom,marquee:this.marquee,contextMenu:this.menu,guidePreview:this.guidePreview,zoneResizing:this.zoneResizing,scrollX:this.scrollPos.x,scrollY:this.scrollPos.y}}repaint(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.paint()}))}paint(){if(!this.store)return;hh(),this.syncPluginUIStyles();const t=[...this.store.selectedIds].join(",");if(t!==this.lastSelKey){this.lastSelKey=t;const a=this.store.selectedElement;this.state.propTab=a?Gs(a)?"custom":"element":"page"}const n=this.root.querySelector(".designer-container");n.classList.toggle("format-painting",this.format.painterActive);for(const a of n.querySelectorAll("[data-pane]"))a.style.display!=="none"&&this.paneScroll.set(a.dataset.pane,a.scrollTop);Tf(n);const r=this.ctx;Je(J2(r,Gx(r)),n),Je(Jx(r),n),Je(h("div",{class:"designer-body"},[Vx(r),kx(r,this.canvasUi()),P2(r)]),n),Je(Qx(r),n),eg(n),!this.toolbarRo&&typeof ResizeObserver<"u"&&(this.toolbarRo=new ResizeObserver(()=>eg(n)),this.toolbarRo.observe(n));const o=Jw(this.store,(a,l)=>this.fire(a,l),this.tableMenu);o&&Je(o,n),Sw(this.root,this.store.elements,this.designData),Uh(this.root,this.state.propSearch),this.applyShrinkFit();const i=this.root.querySelector(".canvas-area");i&&(i.scrollLeft=this.scrollPos.x,i.scrollTop=this.scrollPos.y);for(const a of n.querySelectorAll("[data-pane]")){const l=this.paneScroll.get(a.dataset.pane);l!==void 0&&(a.scrollTop=l)}this.syncRulers(),this.persistChrome(),this.applyHostParts(n)}applyHostParts(t){const n={".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,o]of Object.entries(n)){const i=t.querySelector(r);i&&Ks.includes(o)&&i.setAttribute("part",o)}}applyShrinkFit(){for(const t of Array.from(this.root.querySelectorAll('[data-fit="shrink"]')))Sf(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 n=t.getAttribute("data-fit-base");n?t.style.fontSize=`${n}pt`:t.style.removeProperty("font-size")}}measureRuler(){const t=this.root.querySelector(".canvas-area"),n=this.root.querySelector(".hiprint-printPaper");if(!t||!n)return;const r=t.getBoundingClientRect(),o=n.getBoundingClientRect(),i=(this.store.scale||100)/100,a=o.width/dn(this.store.paperSize.width);this.geom={paperScale:Math.abs(a-i)<.002?i:a,originX:o.left-r.left-Gi,originY:o.top-r.top-Gi,viewW:t.clientWidth-Gi,viewH:t.clientHeight-Gi},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,n=Xt(t),r=this.geom.paperScale;for(const o of Array.from(this.root.querySelectorAll(".pd-ruler"))){const i=o.dataset.ruler==="vertical"?"vertical":"horizontal";Q2(o,{orientation:i,geom:this.geom,scale:r,paperLengthMM:i==="horizontal"?n.width:n.height})}}patchElementDom(){for(const r of this.store.elements){const o=this.root.querySelector(`[data-el-id="${CSS.escape(r.id)}"]`);o&&(o.style.left=`${r.options.left}mm`,o.style.top=`${r.options.top}mm`,o.style.width=`${r.options.width}mm`,o.style.height=`${r.options.height}mm`)}const t=this.root.querySelector(".position-label"),n=this.store.selectedElement;t&&n&&!this.drag&&(t.textContent=Rh(n.options))}fire(t,n){const r=this.store;switch(t){case"undo":r.undo();break;case"redo":r.redo();break;case"align":r.alignSelected(n);break;case"move-layer":r.moveLayer(n);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+n);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(n>0?1:-1);break;case"preview":this.dispatchEvent(new CustomEvent(xt.preview,{detail:this.getTemplateJson(),bubbles:!0,composed:!0}));break;case"save":this.save();break;case"help":this.dispatchEvent(new CustomEvent(xt.help,{bubbles:!0,composed:!0})),this.openHelp(n);break;case"guide-remove":r.removeGuide(n);break;case"resize-start":this.beginResize(n);break;case"element-mousedown":{const o=n;o.event.button===0&&this.isDoubleTap(`el:${o.id}`,o.event)&&this.fire("element-dblclick",{event:o.event,id:o.id}),this.beginDrag(o);break}case"table-cell-mousedown":{const o=n;this.isDoubleTap(`cell:${o.elementId}:${o.r}:${o.c}`,o.event)&&(this.taps.delete(`el:${o.elementId}`),this.fire("table-cell-dblclick",{elementId:o.elementId,r:o.r,c:o.c,cellId:o.cellId}));break}case"zone-resize":this.beginZoneResize(n);break;case"guide-mousedown":this.beginGuideDrag(n);break;case"ruler-mousedown":this.beginRulerGuide(n);break;case"canvas-mousedown":this.onCanvasMouseDown(n);break;case"canvas-mousemove":this.onCanvasMouseMove(n);break;case"canvas-mouseleave":this.clearCoord();break;case"canvas-contextmenu":this.onContextMenu(n);break;case"contextmenu":this.onElementContextMenu(n);break;case"element-dblclick":{const{id:o}=n;this.dblEditElement(o),this.dispatchEvent(new CustomEvent(xt.dblclickElement,{detail:o,bubbles:!0,composed:!0}));break}case"table-cell-dblclick":{const o=n;this.dblEditCell(o),this.dispatchEvent(new CustomEvent(xt.dblclickCell,{detail:{elementId:o.elementId,r:o.r,c:o.c,cellId:o.cellId},bubbles:!0,composed:!0}));break}case"open-expression":this.openExpression(n);break;case"drop":this.onDrop(n);break;case"wheel":this.onWheel(n);break;case"scroll":this.onScroll();break}}onDrop(t){t.preventDefault();const n=t.dataTransfer,r=n?.getData("elementType"),o=n?.getData("fieldKey"),i=this.pointToPaperMm(t);if(!i)return;const a={x:i.left,y:i.top};if(r)this.store.addElement(r,{},a);else if(o){const l=this.store.fields.find(c=>c.fieldKey===o);l&&this.store.addFieldElement(l,{},a,t.ctrlKey||t.metaKey||t.labelIntent===!0)}}pointToPaperMm(t){const n=this.root.querySelector(".hiprint-printPaper");if(!n)return null;const r=n.getBoundingClientRect(),o=(this.store.scale||100)/100,i=lo((t.clientX-r.left)/o),a=lo((t.clientY-r.top)/o);return i<0||a<0?null:{left:i,top:a}}onCanvasMouseDown(t){const n=t.target;(n===this.root.querySelector(".canvas-area")||["canvas-scroll","hiprint-printPaper","hiprint-printPaper-content","zone-layer","grid-bg","watermark-layer"].some(o=>n.classList.contains(o)))&&(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 n=this.pointToPaperMm(t),r=this.root.querySelector("[data-coord]");if(r){if(!n){r.style.display="none";return}r.style.display="",r.textContent=`x:${(n.left-this.store.templateData.margins.left).toFixed(1)} y:${(n.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,n){this.menu.x=t.clientX,this.menu.y=t.clientY,this.menu.targetId=n,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 o=r.getBoundingClientRect();this.menu.flipX=o.right>window.innerWidth?window.innerWidth-o.right-8:0,this.menu.flipY=o.bottom>window.innerHeight?window.innerHeight-o.bottom-8:0,this.paint()})}startMarquee(t){const n={x:t.clientX,y:t.clientY},r=i=>{this.marquee={visible:!0,x:Math.min(n.x,i.clientX),y:Math.min(n.y,i.clientY),w:Math.abs(i.clientX-n.x),h:Math.abs(i.clientY-n.y)},this.paint()},o=()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o);const i={...this.marquee};if(this.marquee={visible:!1,x:0,y:0,w:0,h:0},i.w>2&&i.h>2){const a=this.store.elements.filter(l=>{const c=this.root.querySelector(`[data-el-id="${CSS.escape(l.id)}"]`);if(!c)return!1;const s=c.getBoundingClientRect();return s.left<i.x+i.w&&s.right>i.x&&s.top<i.y+i.h&&s.bottom>i.y});this.store.select(new Set(a.map(l=>l.id)))}else this.repaint()};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)}taps=new Map;isDoubleTap(t,n){const r=this.taps.get(t);return this.taps.set(t,{t:n.timeStamp,x:n.clientX,y:n.clientY}),!r||n.timeStamp-r.t>=500||Math.abs(n.clientX-r.x)>6||Math.abs(n.clientY-r.y)>6?!1:(this.taps.delete(t),!0)}beginDrag(t){const n=t.event;if(n.button!==0)return;const r=this.store;n.stopPropagation();const o=r.elements.find(l=>l.id===t.id);if(!o||(r.selectElement(o.id,n.ctrlKey||n.metaKey),o.options.locked))return;const i=n.altKey?[o.id]:r.dragIds(o.id),a=new Map;for(const l of i){const c=r.elements.find(s=>s.id===l);c&&a.set(l,{left:c.options.left,top:c.options.top})}this.drag={ids:i,primary:o.id,altKey:n.altKey,movedPositions:new Map,startX:n.clientX,startY:n.clientY,origin:a,zone:o.zone||"content",moved:!1},r.draggingIds=new Set(i),r.dragStart(),this.syncDragGhost()}syncDragGhost(){const t=this.store.draggingIds;for(const n of Array.from(this.root.querySelectorAll(".print-element"))){const r=t.has(n.dataset.elId??"");n.classList.toggle("drag-ghost",r);const o=n.querySelector(":scope > .drag-preview");r&&!o?Je(h("div",{class:"drag-preview"}),n):!r&&o&&o.remove()}}finishAltClone(t){const n=this.store;n.adsorbGuides=[];const r=n.elements.find(a=>a.id===t.primary),o=t.movedPositions.get(t.primary);if(n.discardLive(),!r||!o)return;const i=JSON.parse(JSON.stringify(r));i.id=Ln(),i.options.left=o.left,i.options.top=o.top,i.options.groupId=void 0,n.cloneElement(i)}flashSnapIndicator(t,n){const r=this.root.querySelector(".hiprint-printPaper-content");r&&(r.querySelector(".snap-indicator")?.remove(),Je(h("div",{class:"snap-indicator",style:{left:`${t}mm`,top:`${n}mm`}}),r),this.snapTimer&&clearTimeout(this.snapTimer),this.snapTimer=setTimeout(()=>{r.querySelector(".snap-indicator")?.remove(),this.snapTimer=null},300))}beginResize(t){const n=t.event;n.stopPropagation();const r=this.store.elements.find(o=>o.id===t.id);!r||r.options.locked||(this.resize={id:t.id,point:t.point,startX:n.clientX,startY:n.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 n=t.event.clientY,r=this.store.templateData,o=t.zone==="header"?r.header.height:r.footer.height,i=(this.store.scale||100)/100,a=c=>{const s=lo((c.clientY-n)/i),d=Math.max(0,Math.round((o+(t.zone==="header"?s:-s))*10)/10);t.zone==="header"?this.store.updateTemplateData({header:{...r.header,height:d}}):this.store.updateTemplateData({footer:{...r.footer,height:d}}),this.paint()},l=()=>{window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",l),this.zoneResizing=null,this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",a),window.addEventListener("mouseup",l)}beginGuideDrag(t){const n=(this.store.templateData.guides??[]).find(d=>d.id===t.id);if(!n)return;const r=Xt(this.store.templateData),o=n.type==="vertical"?r.width:r.height,i=t.event.clientX,a=t.event.clientY,l=(this.store.scale||100)/100,c=d=>{const p=lo((n.type==="vertical"?d.clientX-i:d.clientY-a)/l);this.store.moveGuide(n.id,Math.min(o,Math.max(0,n.position+p))),this.paint()},s=()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s),this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",c),window.addEventListener("mouseup",s)}beginRulerGuide(t){const n=t.orientation==="horizontal"?"vertical":"horizontal",r=i=>{this.guidePreview={type:n,position:n==="vertical"?i.clientX:i.clientY},this.paint()},o=i=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o);const a=this.rulerPointToMM(i,n);this.guidePreview=null,a!==null?this.store.addGuide(n,a):this.repaint()};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)}rulerPointToMM(t,n){const r=this.root.querySelector(".hiprint-printPaper");if(!r)return null;const o=r.getBoundingClientRect(),i=dn(1)*(this.geom.paperScale||1),a=n==="vertical"?(t.clientX-o.left)/i:(t.clientY-o.top)/i,l=Xt(this.store.templateData),c=n==="vertical"?l.width:l.height;return a<0||a>c?null:a}applyZoom(t,n,r,o){const i=this.root.querySelector(".canvas-area");if(!i)return;const a=Math.round(this.store.scale),l=Math.max(o,Math.round(t));if(l===a)return;const c=getComputedStyle(i),s=parseFloat(c.paddingLeft)||0,d=parseFloat(c.paddingTop)||0,p=i.scrollLeft+n-s,u=i.scrollTop+r-d,f=l/a;this.store.setScale(l,o),i.scrollLeft=p*f-n+s,i.scrollTop=u*f-r+d,this.scrollPos={x:i.scrollLeft,y:i.scrollTop}}zoomByStep(t){const n=this.root.querySelector(".canvas-area");n&&this.applyZoom(Vc(this.store.scale,t),n.clientWidth/2,n.clientHeight/2,xo)}fitToWindow(){const t=this.root.querySelector(".canvas-area");if(!t)return;const n=getComputedStyle(t),r=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0),o=(parseFloat(n.paddingTop)||0)+(parseFloat(n.paddingBottom)||0),i=Xt(this.store.templateData),a=Om(t.clientWidth-r,t.clientHeight-o,dn(i.width),dn(i.height));this.applyZoom(a,t.clientWidth/2,t.clientHeight/2,Gc)}onWheel(t){if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=this.root.querySelector(".canvas-area");if(!n)return;const r=Math.round(this.store.scale),o=Vc(r,t.deltaY>0?-1:1);if(o===r)return;const i=n.getBoundingClientRect();this.applyZoom(o,t.clientX-i.left,t.clientY-i.top,xo)}onScroll(){const t=this.root.querySelector(".canvas-area");if(!t)return;this.scrollPos={x:t.scrollLeft,y:t.scrollTop};const n=this.root.querySelector(".ruler-overlay");n&&(n.style.transform=`translate(${this.scrollPos.x}px, ${this.scrollPos.y}px)`),this.syncRulers()}on(t,n,r,o){t.addEventListener(n,r,o),this.instanceDisposers.push(()=>t.removeEventListener(n,r,o))}attachInstanceListeners(){this.instanceDisposers.length||(this.bindPointer(),this.bindKeys(),this.bindPaneScroll())}bindPaneScroll(){this.on(this.root,"scroll",t=>{const n=t.target;if(!(n instanceof HTMLElement))return;const r=n.dataset.pane;r&&this.paneScroll.set(r,n.scrollTop)},!0)}bindPointer(){const t=a=>{const l=this.store;if(!l)return;const s=((l.scale||100)/100||1)*dn(1),d=(p,u)=>({dx:p/s,dy:u/s});if(this.drag){const{dx:p,dy:u}=d(a.clientX-this.drag.startX,a.clientY-this.drag.startY);(Math.abs(p)>.05||Math.abs(u)>.05)&&(this.drag.moved=!0);const f=l.elements.find(C=>C.id===this.drag.primary),g=f&&je(f.options).margin,m=f&&g&&{id:f.id,left:(this.drag.origin.get(f.id)?.left??0)+p,top:(this.drag.origin.get(f.id)?.top??0)+u,width:g.width,height:g.height};let b=null;if(m&&l.snapToGrid!==!1){const C=l.elements.filter(P=>!this.drag.ids.includes(P.id)&&(P.zone||"content")===this.drag.zone).map(P=>({id:P.id,...je(P.options).margin})),F=gl(l.templateData,l.paperSize)[this.drag.zone],N=$1(m,C,this.manualGuides());b={left:N.left,top:N.top},l.adsorbGuides=(N.lines??[]).filter(P=>P.position>=0&&P.position<=(P.type==="vertical"?F.width:F.height)),(b.left!==m.left||b.top!==m.top)&&this.flashSnapIndicator(b.left+m.width/2,b.top+m.height/2)}else l.adsorbGuides=[];const v=f?this.drag.origin.get(f.id):void 0,w=b&&v?b.left-v.left:p,E=b&&v?b.top-v.top:u;for(const C of this.drag.ids){const F=this.drag.origin.get(C);if(!F)continue;const N={left:F.left+w,top:F.top+E};this.drag.movedPositions.set(C,N),l.livePatch(C,N)}this.patchElementDom(),l.adsorbGuides.length&&this.paintGuidesOnly()}else if(this.resize){const{dx:p,dy:u}=d(a.clientX-this.resize.startX,a.clientY-this.resize.startY),f=z1(this.resize.point,this.resize.origin,p,u,3.5,3.5);l.livePatch(this.resize.id,f),this.patchElementDom()}},n=()=>{const a=!!this.drag,l=this.drag;if(l?.moved&&l.altKey){this.finishAltClone(l),this.store.dragStop(),this.drag=null,this.store.draggingIds=new Set,this.repaint();return}this.drag?.moved||this.resize?(this.store.adsorbGuides=[],this.store.commitLive(),this.store.dragStop(),this.drag=null,this.resize=null,this.store.draggingIds=new Set,this.repaint()):(this.drag=null,this.store.dragStop(),a&&(this.store.draggingIds=new Set,this.syncDragGhost()))},r=a=>{const l=a.composedPath(),c=l.some(d=>d.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 s=l.some(d=>d.classList?.contains("context-menu"));this.menu.visible&&!s&&(this.menu.visible=!1,this.repaint())},o=a=>{const c=a.target?.closest?.("[data-tip]");!c||!c.closest(tE)||(this.hoverTipTimer&&clearTimeout(this.hoverTipTimer),this.hoverTipTimer=setTimeout(()=>this.showHoverTip(c),300))},i=a=>{const l=a,c=l.target?.closest?.("[data-tip]");c&&l.relatedTarget?.closest?.("[data-tip]")!==c&&this.hideHoverTip()};this.on(window,"mousemove",t),this.on(window,"mouseup",n),this.on(this,"pointerdown",r),this.on(this.root,"mouseover",o),this.on(this.root,"mouseout",i)}showHoverTip(t){const n=t.dataset.tip;if(!n)return;this.hideHoverTip();const r=t.getBoundingClientRect(),o=r.left+r.width/2;this.hoverTipEl=Je(h("div",{class:"pd-hover-tip",style:{left:`${o}px`,top:`${r.bottom+6}px`},text:n}),this.root);const i=this.hoverTipEl.offsetWidth/2;if(!i)return;const a=i+8,l=Math.max(window.innerWidth-i-8,a);this.hoverTipEl.style.left=`${Math.min(Math.max(o,a),l)}px`}hideHoverTip(){this.hoverTipTimer&&(clearTimeout(this.hoverTipTimer),this.hoverTipTimer=null),this.hoverTipEl?.remove(),this.hoverTipEl=null}manualGuides(){const t=[],n=[];for(const r of this.store.templateData.guides??[])r.type==="vertical"?t.push(r.position):n.push(r.position);return{vertical:t,horizontal:n}}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 n=this.store.paperSize;gl(this.store.templateData,n);for(const r of this.store.adsorbGuides){const o=document.createElement("div");o.className=`adsorb-guide guide-${r.type}`,r.type==="vertical"?o.style.cssText=`left:${r.position}mm;top:0;height:${n.height}mm;border-left-color:${r.color||"var(--pd-accent-secondary, #f56c6c)"}`:o.style.cssText=`top:${r.position}mm;left:0;width:${n.width}mm;border-top-color:${r.color||"var(--pd-accent-secondary, #f56c6c)"}`,t.appendChild(o)}}bindKeys(){this.setAttribute("tabindex","0");const t=()=>{jt.active=this};this.on(this,"pointerdown",t),this.on(this,"focusin",t),jt.active||(jt.active=this)}attachDocKeys(){this.docKeydown||(this.docKeydown=t=>this.onGlobalKeydown(t),document.addEventListener("keydown",this.docKeydown),this.docDragend=()=>Dh(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 n=this.store;if(!n||jt.active!==this)return;const o=t.composedPath()[0]?.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT")return;if(this.format.handlePainterKeydown(t),t.key.startsWith("Arrow")){t.preventDefault();const a=t.shiftKey?10:t.ctrlKey?.5:1,l=t.key==="ArrowLeft"?-a:t.key==="ArrowRight"?a:0,c=t.key==="ArrowUp"?-a:t.key==="ArrowDown"?a:0;n.moveSelected(l,c);return}if(t.key==="Delete"||t.key==="Backspace"){t.preventDefault(),n.deleteSelected();return}if(!(t.ctrlKey||t.metaKey))return;const i=t.key.toLowerCase();nE.has(i)&&(t.preventDefault(),i==="z"?t.shiftKey?n.redo():n.undo():i==="y"?n.redo():i==="a"?n.selectAll():i==="c"?n.copy():i==="x"?n.cutSelected():i==="v"?n.paste():i==="d"?n.duplicateSelected():i==="g"?t.shiftKey?n.ungroupSelected():n.groupSelected():i==="1"?n.resetZoom():i==="l"?n.alignSelected("left"):i==="r"?n.alignSelected("right"):i==="e"?n.alignSelected("vertical"):i==="t"?n.alignSelected("top"):i==="b"?n.alignSelected("bottom"):i==="0"&&this.fire("fit-window"))}}function lg(e="print-designer"){return customElements.get(e)||customElements.define(e,jt),e}function rE(){return lg()}const oE=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_ELEMENT_CAPABILITIES:ar,BUILTIN_ELEMENT_DEFINITIONS:Ci,DesignerStore:Af,PRINT_DESIGNER_ATTRIBUTES:Ys,PRINT_DESIGNER_BOOLEAN_ATTRIBUTES:Uf,PRINT_DESIGNER_CONTRACT_VERSION:Vs,PRINT_DESIGNER_EVENT:xt,PRINT_DESIGNER_EVENTS:Gf,PRINT_DESIGNER_EVENT_OPTIONS:Iv,PRINT_DESIGNER_METHODS:Wf,PRINT_DESIGNER_PARTS:Ks,PRINT_DESIGNER_PROPERTY_NAMES:jf,PRINT_DESIGNER_TAG:Hf,PRINT_DESIGNER_THEME_TOKENS:qf,PrintDesignerElement:jt,TILING_SINGLE_PAGE_TIP:Us,createDefaultTemplate:Br,definePrintDesigner:lg,getElementCapabilities:dt,getElementCapabilityTypes:na,getElementDblEditableField:zf,getElementDefinition:Qt,getElementDefinitions:Nf,getElementLayerIcon:Bf,getElementPropertyGroup:Ff,getHostContract:Xs,getMaterialElementDefinitions:Lf,registerAll:rE,registerElementCapabilities:Hg,registerElementDefinition:kv,registerElementRenderer:Cv,registerElementRenderers:$f,resetElementCapabilities:Ug,resetElementDefinitions:Ov,serializePage:kf,subscribeElementDefinitions:Df,toRuntimePool:qs},Symbol.toStringTag,{value:"Module"})),iE=17521,aE=20,Zr={PRINTERS_LIST:"printers.list",PRINT_SUBMIT:"print.submit",PRINT_SUBMIT_HTML:"print.submitHtml",TEMPLATE_ATTACH:"template.attach",TEMPLATE_DETACH:"template.detach"};let Nl=0;function sE(){return Nl=(Nl+1)%Number.MAX_SAFE_INTEGER,`${Date.now().toString(36)}-${Nl.toString(36)}`}function cg(e,t){const n={id:sE(),type:e,payload:t};return JSON.stringify(n)}function dg(e){let t;try{t=JSON.parse(e)}catch{return{malformed:!0}}if(typeof t!="object"||t===null)return{malformed:!0};const n=t;if(typeof n.id!="string"||typeof n.ok!="boolean")return{malformed:!0};if(n.ok)return{id:n.id,ok:!0,payload:n.payload??{}};const r=n.error;return!r||typeof r.code!="string"||typeof r.message!="string"?{malformed:!0}:{id:n.id,ok:!1,error:{code:r.code,message:r.message}}}function lE(e){if(typeof e!="object"||e===null)return!1;const t=e;return!("ok"in t)&&typeof t.id=="string"&&typeof t.type=="string"&&typeof t.payload=="object"&&t.payload!==null}class Dt extends Error{constructor(t,n){super(n),this.name="WormPrintError",this.code=t}}function cE(e){return e instanceof Dt||e&&typeof e=="object"&&typeof e.code=="string"?e.code:"INTERNAL"}class ug extends Error{constructor(t){super(t),this.code="UNAUTHORIZED",this.name="AuthRejectedError"}}class dE{constructor(t={}){this.ws=null,this.status_="disconnected",this.hello=null,this.pendings=new Map,this.statusCbs=new Set,this.requestHandler=null,this.manualClose=!1,this.reconnectTimer=null,this.reconnectAttempts=0,this.opts=t,this.ctor=t.WebSocketCtor??WebSocket,this.defaultTimeout=t.timeoutMs??15e3}get status(){return this.status_}onStatus(t){return this.statusCbs.add(t),()=>this.statusCbs.delete(t)}setRequestHandler(t){this.requestHandler=t}setToken(t){this.opts={...this.opts,token:t}}async connect(t){if(this.status_==="connected"&&this.hello)return this.hello;this.setStatus("connecting");const n=this.opts.ports??Array.from({length:aE},(r,o)=>iE+o);for(const r of n){if(t?.aborted)throw new Dt("CLIENT_NOT_RUNNING","连接已取消");try{return this.hello=await this.tryPort(r,t),this.manualClose=!1,this.reconnectAttempts=0,this.setStatus("connected"),this.hello}catch(o){if(o instanceof ug)throw this.setStatus("disconnected"),new Dt("UNAUTHORIZED",o.message||"配对 token 无效或来源未授权")}}throw this.setStatus("disconnected"),new Dt("CLIENT_NOT_RUNNING","未发现运行中的打印客户端(已探测默认端口区间),请确认客户端已启动")}request(t,n,r){if(this.status_!=="connected"||!this.ws)return Promise.reject(new Dt("CLIENT_NOT_RUNNING","打印客户端未连接"));const o=cg(t,n),i=JSON.parse(o);return new Promise((a,l)=>{const c=setTimeout(()=>{this.pendings.delete(i.id),l(new Dt("CLIENT_TIMEOUT",`请求 ${t} 超时未响应`))},r??this.defaultTimeout);this.pendings.set(i.id,{resolve:a,reject:l,timer:c}),this.ws.send(o)})}close(){this.manualClose=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.ws?.close(),this.failAllPendings(new Dt("CLIENT_NOT_RUNNING","连接已关闭")),this.setStatus("disconnected")}buildUrl(t){const n=new URL(`ws://127.0.0.1:${t}`);return this.opts.token&&n.searchParams.set("token",this.opts.token),n.toString().replace(/\/$/,"")}tryPort(t,n){return new Promise((r,o)=>{const i=new this.ctor(this.buildUrl(t));this.ws=i;let a=!1;const l=()=>{a||(a=!0,o(new Error("aborted")))};n?.addEventListener("abort",l,{once:!0}),i.onopen=()=>{i.send(cg("hello",{}))},i.onmessage=c=>{const s=dg(String(c.data));if(!("malformed"in s))if(s.ok&&uE(s.payload)){if(a)return;a=!0,this.bindLifecycle(i),r(s.payload)}else if(!s.ok&&s.error.code==="UNAUTHORIZED"){if(a)return;a=!0,o(new ug(s.error.message))}else a||(a=!0,o(new Error("握手失败")))},i.onerror=()=>{a||(a=!0,o(new Error("连接错误")))},i.onclose=()=>{a||(a=!0,o(new Error("连接关闭")))}})}bindLifecycle(t){t.onmessage=n=>{this.handleIncoming(t,String(n.data))},t.onclose=()=>{this.failAllPendings(new Dt("CLIENT_NOT_RUNNING","与客户端的连接中断")),this.hello=null,this.ws=null,this.manualClose||this.scheduleReconnect()},t.onerror=()=>{}}handleIncoming(t,n){let r;try{r=JSON.parse(n)}catch{return}if(lE(r)){this.dispatchServerRequest(t,r);return}const o=dg(n);if("malformed"in o)return;const i=this.pendings.get(o.id);i&&(this.pendings.delete(o.id),clearTimeout(i.timer),o.ok?i.resolve(o.payload):i.reject(new Dt(o.error.code,o.error.message)))}dispatchServerRequest(t,n){const r=this.requestHandler;if(!r){this.safeSend(t,n.id,!1,void 0,"INVALID_REQUEST","桌面端请求未注册处理器");return}Promise.resolve().then(()=>r(n.type,n.payload)).then(o=>this.safeSend(t,n.id,!0,o??{})).catch(o=>{const i=cE(o),a=o instanceof Error?o.message:String(o);this.safeSend(t,n.id,!1,void 0,i,a)})}safeSend(t,n,r,o,i,a){t.readyState===1&&t.send(JSON.stringify(r?{id:n,ok:r,payload:o}:{id:n,ok:r,error:{code:i??"INTERNAL",message:a??"内部错误"}}))}scheduleReconnect(){this.setStatus("connecting");const t=Math.min(1e3*2**this.reconnectAttempts++,1e4);this.reconnectTimer=setTimeout(()=>{this.connect().catch(()=>this.scheduleReconnect())},t)}failAllPendings(t){for(const[,n]of this.pendings)clearTimeout(n.timer),n.reject(t);this.pendings.clear()}setStatus(t){if(this.status_!==t){this.status_=t;for(const n of this.statusCbs)n(t)}}}function uE(e){return typeof e=="object"&&e!==null&&e.app==="worm-print-client"}const pg="worm-print-client:token";class Ll{constructor(t={}){const r={token:t.token??Ll.loadStoredToken()??void 0,timeoutMs:t.timeoutMs,WebSocketCtor:t.WebSocketCtor};this.transport=new dE(r)}get status(){return this.transport.status}connect(t){return this.transport.connect(t)}onStatusChange(t){return this.transport.onStatus(t)}setRequestHandler(t){this.transport.setRequestHandler(t)}async listPrinters(){return(await this.transport.request(Zr.PRINTERS_LIST,{})).printers}request(t,n,r){return this.transport.request(t,n,r)}attachTemplate(t){return this.request(Zr.TEMPLATE_ATTACH,t)}detachTemplate(t){return this.request(Zr.TEMPLATE_DETACH,{sessionId:t})}print(t,n,r={},o){const{baseUrl:i,fontBaseUrl:a,timeoutMs:l,...c}=r,s={templateJson:t,printData:n,baseUrl:i,fontBaseUrl:a,print:c};return typeof o=="string"&&o.trim().length>0&&(s.templateName=o),this.transport.request(Zr.PRINT_SUBMIT,s,l)}printHtml(t,n={},r){const{timeoutMs:o,...i}=n,a={html:t.html,paperMm:t.paperMm,continuous:t.continuous,pageCount:t.pageCount,print:i};return typeof r=="string"&&r.trim().length>0&&(a.templateName=r),this.transport.request(Zr.PRINT_SUBMIT_HTML,a,o)}pair(t){localStorage.setItem(pg,t),this.transport.setToken(t)}static loadStoredToken(){try{return localStorage.getItem(pg)}catch{return null}}close(){this.transport.close()}}const pE={...oE,renderHtmlPages:pv,browserCodeRenderer:Ls,PrintClient:Ll,WormPrintError:Dt,getPaperDimensions:ft,isContinuousPaperSize:$n,getByPath:vr,resolvePrinterDpi:Zm,paperWidthPx:Jm,zoomPresets:e0,defaultZoomKey:rd,resolveZoomKey:r0,zoomValueOf:o0,viewZoomHint:t0,applyPreviewViewZoom:n0,resolveToolbarOverflow:Yc};globalThis.WormPrintCanvas??=pE}));
|
|
1196
|
+
`}],Jh="worm-print-help-tab",Q2="getting-started";function Qh(e){return Yi.some(t=>t.id===e)?String(e):""}function eE(e){let t=null;try{t=window.localStorage.getItem(Jh)}catch{t=null}return Qh(e)||Qh(t)||Q2}function tE(e){const t=eE(e.initialTab),n=(r,o)=>{const i=r.currentTarget,a=i.closest(".help-modal");if(!a)return;for(const c of Array.from(a.querySelectorAll(".help-tab")))c.classList.toggle("active",c===i);const l=a.querySelector(".help-content");l&&(l.innerHTML=Yi.find(c=>c.id===o)?.content??"");try{window.localStorage.setItem(Jh,o)}catch{}};return h("div",{class:"help-modal-overlay",tabindex:"-1",onClick:r=>{r.target===r.currentTarget&&e.onClose()},onKeydown:r=>{r.key==="Escape"&&e.onClose()}},[h("div",{class:"help-modal"},[h("div",{class:"help-modal-header"},[h("div",{class:"help-modal-title-wrap"},[h("h2",{class:"help-modal-title",text:"帮助文档"}),h("span",{class:"help-modal-project",text:"worm-print-platform"})]),h("button",{type:"button",class:"help-modal-close",title:"关闭",text:"×",onClick:()=>e.onClose()})]),h("div",{class:"help-modal-body"},[h("div",{class:"help-modal-sidebar"},Yi.map(r=>h("button",{type:"button",class:`help-tab${r.id===t?" active":""}`,text:r.title,onClick:o=>n(o,r.id)}))),h("div",{class:"help-modal-content"},[h("div",{class:"help-content",html:Yi.find(r=>r.id===t)?.content??""})])])])])}function nE(e,t){const n=Ze(tE(t),e),r=o=>{o.key==="Escape"&&t.onClose()};return document.addEventListener("keydown",r),n.focus?.(),()=>{document.removeEventListener("keydown",r),n.remove()}}const rE=2,oE=74,Rl=[{id:"clipboard",order:1,label:"剪贴板"},{id:"painter",order:2,label:"格式刷"},{id:"zoom",order:3,label:"缩放"},{id:"arrange-view",order:4,label:"排列 / 视图"},{id:"border",order:5,label:"边框"},{id:"color",order:6,label:"颜色"},{id:"align",order:7,label:"对齐"},{id:"style",order:8,label:"文字样式"},{id:"font",order:9,label:"字体与字号"}];function iE(e){const t=!!e.state.openMore,n=Rl.slice().sort((r,o)=>r.order-o.order).map(r=>h("div",{class:"tb-more-item",dataset:{unit:r.id},style:{display:"none"}},[h("div",{class:"tb-menu-label",text:r.label}),h("div",{class:"tb-more-slot",id:`tb-more-slot-${r.id}`,dataset:{unit:r.id}})]));return h("div",{class:"tb-group tb-more-group",style:{display:"none"}},[h("div",{class:"tb-dd"},[h("button",{type:"button",class:`tb-dd-trigger${t?" on":""}`,dataset:{test:"more-dd",tip:"更多"},onClick:()=>{e.state.openMore=!t,e.repaint()},html:`${Re("Ellipsis",15)}<span class="tb-btn-text">更多</span>${Re("ChevronDown",12,"tb-dd-arrow")}`}),h("div",{class:`tb-dd-panel tb-more-panel${t?"":" is-hidden"}`},[h("div",{class:"tb-menu tb-more-menu"},n)])])])}const eg=new WeakMap;function tg(e){const t=e.querySelector(".designer-toolbar");if(!t)return{movedIds:[],overflowRemains:!1};const n=getComputedStyle(t),r=Number.parseFloat(n.gap)||rE,o=Number.parseFloat(n.paddingLeft)||0,i=Number.parseFloat(n.paddingRight)||0,a=new Map;for(const m of Array.from(t.querySelectorAll(".tb-ou[data-unit]"))){const b=m.parentElement;b&&!b.classList.contains("tb-more-slot")&&eg.set(m,{parent:b,next:m.nextSibling}),a.set(m.dataset.unit,m)}for(const m of a.values()){const b=eg.get(m);!b||m.parentElement===b.parent||(b.next?.parentElement===b.parent?b.parent.insertBefore(m,b.next):b.parent.appendChild(m))}let l=0;for(const m of Array.from(t.children)){if(m.classList.contains("tb-spacer")||m.classList.contains("tb-more-group"))continue;const b=Math.max(m.offsetWidth,m.scrollWidth);b<=0||(l+=b+r)}const c=new Map;for(const[m,b]of a){const v=b.offsetWidth;v>0&&c.set(m,v)}const s=Rl.map(m=>({id:m.id,order:m.order,width:c.get(m.id)??0})),d=s.reduce((m,b)=>m-b.width-r,l),p=t.clientWidth-o-i,{movedIds:u,overflowRemains:f}=Kc({available:p,pinned:d,moreTriggerWidth:oE,gap:r,units:s});for(const m of Rl){const b=t.querySelector(`.tb-more-item[data-unit="${m.id}"]`),v=t.querySelector(`#tb-more-slot-${m.id}`),w=a.get(m.id);if(!b||!v||!w)continue;const E=u.includes(m.id);E&&w.parentElement!==v&&v.appendChild(w),b.style.display=E?"":"none"}const g=t.querySelector(".tb-more-group");return g&&(g.style.display=u.length>0?"":"none"),t.classList.toggle("is-tight",f),{movedIds:u,overflowRemains:f}}function aE(e,t){const n=e.store,r=n.selectedIds.size>0,o=n.selectedIds.size>1,i=n.selectedElement,a=!r,l=e.isEdit?"编辑模板":"新建模板",c=[h("div",{class:"tb-menu",dataset:{test:"arrange-panel"}},[h("div",{class:"tb-menu-label",text:"对齐 / 分布"}),h("div",{class:"tb-menu-grid"},[_e(e,"AlignStartVertical","align",{arg:"left",tip:"左对齐",disabled:!o}),_e(e,"AlignEndVertical","align",{arg:"right",tip:"右对齐",disabled:!o}),_e(e,"AlignStartHorizontal","align",{arg:"top",tip:"顶对齐",disabled:!o}),_e(e,"AlignEndHorizontal","align",{arg:"bottom",tip:"底对齐",disabled:!o}),_e(e,"AlignCenterVertical","align",{arg:"vertical",tip:"水平居中",disabled:!o}),_e(e,"AlignCenterHorizontal","align",{arg:"horizontal",tip:"垂直居中",disabled:!o}),_e(e,"AlignHorizontalSpaceBetween","align",{arg:"distributeHor",tip:"水平分布",disabled:!o}),_e(e,"AlignVerticalSpaceBetween","align",{arg:"distributeVer",tip:"垂直分布",disabled:!o})]),h("div",{class:"tb-menu-label",text:"层级"}),h("div",{class:"tb-menu-grid"},[_e(e,"ArrowUpToLine","move-layer",{arg:"top",tip:"置顶",disabled:!r}),_e(e,"ArrowUp","move-layer",{arg:"up",tip:"上移一层",disabled:!r}),_e(e,"ArrowDown","move-layer",{arg:"down",tip:"下移一层",disabled:!r}),_e(e,"ArrowDownToLine","move-layer",{arg:"bottom",tip:"置底",disabled:!r})]),h("div",{class:"tb-menu-label",text:"组合"}),h("div",{class:"tb-menu-grid"},[_e(e,"Group","group",{tip:"组合 (Ctrl+G)",disabled:!o}),_e(e,"Ungroup","ungroup",{tip:"取消组合 (Ctrl+Shift+G)",disabled:!i?.options?.groupId})])])],s=[h("div",{class:"tb-menu tb-menu-rows",dataset:{test:"view-panel"}},[d("标尺",n.showRuler,"toggle-ruler","显示/隐藏标尺"),d("网格",n.showGrid,"toggle-grid","显示/隐藏网格背景"),d("虚框",n.showTableGhostBorder,"toggle-table-ghost-border","显示/隐藏无边框表格的虚拟虚线"),d("吸附",n.snapToGrid,"toggle-snap","开启/关闭元素吸附到网格")])];function d(p,u,f,g){return h("button",{type:"button",class:`tb-btn tb-menu-row${u?" on":""}`,dataset:{tip:g},onClick:()=>e.fire(f)},[h("span",{class:"dot"}),p])}return h("div",{class:"designer-toolbar"},[h("div",{class:"tb-group tb-brand"},[h("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>'}),h("div",{class:"tb-title"},[h("span",{class:"tb-title-name",text:l}),h("span",{class:"tb-title-sub",text:"打印模板设计器"})])]),h("div",{class:"tb-group"},[_e(e,"Undo2","undo",{tip:"撤销",disabled:!n.canUndo}),_e(e,"Redo2","redo",{tip:"重做",disabled:!n.canRedo})]),t,h("div",{class:"tb-ou tb-group",dataset:{unit:"arrange-view"}},[Ui(e,"arrange",{icon:"Layers",text:"排列",tip:"排列",testId:"arrange-dd"},c),Ui(e,"view",{icon:"Eye",text:"视图",tip:"视图",testId:"view-dd"},s)]),h("div",{class:"tb-ou tb-group",dataset:{unit:"zoom"}},[_e(e,"Maximize","fit-window",{tip:"适应窗口"}),_e(e,"ZoomOut","zoom",{arg:-10,tip:"缩小"}),h("span",{class:"tb-zoom",text:`${n.scale}%`}),_e(e,"ZoomIn","zoom",{arg:10,tip:"放大"})]),h("div",{class:"tb-ou tb-group",dataset:{unit:"clipboard"}},[_e(e,"Copy","copy",{tip:a?"复制 (Ctrl+C),需选中元素":"复制 (Ctrl+C)",disabled:a,test:"copy"}),_e(e,"ClipboardPaste","paste",{tip:a?"粘贴 (Ctrl+V),需选中元素":n.hasClipboard?"粘贴 (Ctrl+V)":"粘贴 (Ctrl+V),剪贴板为空",disabled:a||!n.hasClipboard,test:"paste"}),_e(e,"Trash2","delete",{tip:a?"删除 (Delete),需选中元素":"删除 (Delete)",disabled:a,danger:!0,test:"delete"})]),iE(e),h("div",{class:"tb-spacer"}),e.showHelp?h("div",{class:"tb-group"},[h("button",{type:"button",class:"help-button",title:"帮助文档",onClick:()=>e.fire("help")},[h("span",{class:"help-icon",text:"?"})])]):"",(()=>{const p=[e.showPreview!==!1?h("button",{type:"button",class:"btn-secondary",dataset:{tip:"预览模板打印效果"},text:"预览",onClick:()=>e.fire("preview")}):"",e.showSave!==!1?h("button",{type:"button",class:"btn-primary",dataset:{tip:"保存模板"},text:"保存",onClick:()=>e.fire("save")}):""].filter(Boolean);return p.length?h("div",{class:"tb-group"},p):""})()].filter(Boolean))}function Dl(e,t,n){for(const r of t){const o=e.getPropertyValue(r).trim();if(o)return o}return n}function sE(e,t){const n=t.orientation==="horizontal",r=t.geom,o=n?r.viewW:r.viewH;e.style.width=`${n?o:Pa}px`,e.style.height=`${n?Pa:o}px`;const i=e.getContext("2d");if(!i)return;const a=window.devicePixelRatio||1,l=Math.max(0,Math.round(o)),c=Pa;e.width=(n?l:c)*a,e.height=(n?c:l)*a,i.setTransform(a,0,0,a,0,0);const s=getComputedStyle(e),d=Dl(s,["--pd-ruler-bg"],"#F8F9FC"),p=Dl(s,["--pd-ruler"],"#9AA1AF"),u=Dl(s,["--pd-ruler-cursor","--pd-accent"],"#165DFF");i.fillStyle=d,i.fillRect(0,0,n?l:c,n?c:l);const f=t.scale>0?t.scale:r.paperScale>0?r.paperScale:1,g=un(1)*f;if(g<=0)return;const m={ctx:i,horizontal:n,viewportPx:o,thickness:c,originPx:n?r.originX:r.originY,pxPerMM:g,paperLengthMM:t.paperLengthMM},b=-m.originPx/g,v=(l-m.originPx)/g,w=p0(f),E=g0(b,v,w);rg(m,E,p,!0),rg(m,E,p,!1),og(m,0,u),og(m,t.paperLengthMM,u);const k=t.cursorPx??null;if(k!==null&&k>=0&&k<=l){if(i.strokeStyle=u,i.lineWidth=1.5,i.beginPath(),n){const L=Math.round(k)+.5;i.moveTo(L,0),i.lineTo(L,c)}else{const L=Math.round(k)+.5;i.moveTo(0,L),i.lineTo(c,L)}i.stroke()}}function ng(e,t){return Math.round(e.originPx+t*e.pxPerMM)+.5}function rg(e,t,n,r){const{ctx:o,horizontal:i,paperLengthMM:a}=e;o.strokeStyle=n,o.fillStyle=n,o.globalAlpha=r?.32:1,o.lineWidth=1,o.font="9px ui-monospace, Menlo, monospace",o.textBaseline="top";for(const l of t){if((l.mm<0||l.mm>a)!==r)continue;const s=ng(e,l.mm),d=l.major?8:4;o.beginPath(),i?(o.moveTo(s,0),o.lineTo(s,d)):(o.moveTo(0,s),o.lineTo(d,s)),o.stroke(),l.major&&l.label&&(i?o.fillText(l.label,s+2,11):(o.save(),o.translate(11,s+2),o.rotate(-Math.PI/2),o.fillText(l.label,0,0),o.restore()))}o.globalAlpha=1}function og(e,t,n){const{ctx:r,horizontal:o,thickness:i,viewportPx:a}=e,l=ng(e,t);l<=0||l>=a||(r.strokeStyle=n,r.globalAlpha=.55,r.lineWidth=1,r.beginPath(),o?(r.moveTo(l,0),r.lineTo(l,i)):(r.moveTo(0,l),r.lineTo(i,l)),r.stroke(),r.globalAlpha=1)}const lE=':host{display:block;width:100%;height:100%}:host{--pd-bg: #f3f5f9;--pd-surface: #ffffff;--pd-field-bg: #f4f6fa;--pd-sidebar: #ffffff;--pd-sidebar-hover: #f0f3f9;--pd-canvas-bg: #e6e9f0;--pd-paper: #FFFFFF;--pd-accent: #165DFF;--pd-accent-2: #3D7BFF;--pd-accent-soft: rgba(22, 93, 255, .09);--pd-accent-secondary: #f56c6c;--pd-danger-soft: rgba(245, 108, 108, .1);--pd-ink-green: #67c23a;--pd-text: #2a2e37;--pd-text-muted: #8b909c;--pd-text-faint: #b4b9c4;--pd-border: #d9dde6;--pd-border-soft: #e9ecf2;--pd-input-bg: #ffffff;--pd-hover-tint: #ecf5ff;--pd-danger: #e53e3e;--pd-danger-bg: #fef2f2;--pd-danger-border: #fecaca;--pd-menu-text: #333;--pd-menu-hover: #f5f7fa;--pd-menu-border: #dcdfe6;--pd-menu-divider: #ebeef5;--pd-menu-muted: #909399;--pd-menu-disabled: #c0c4cc;--pd-scrollbar: rgba(23, 32, 60, .18);--pd-scrollbar-thumb: rgba(23, 32, 60, .16);--pd-scrollbar-thumb-hover: rgba(23, 32, 60, .3);--pd-help-field-bg: #f0f9ff;--pd-help-field-line: #bae6fd;--pd-help-field-ink: #0369a1;--pd-help-function-bg: #f0fdf4;--pd-help-function-line: #bbf7d0;--pd-help-function-ink: #166534;--pd-help-variable-bg: #fefce8;--pd-help-variable-line: #fde68a;--pd-help-variable-ink: #854d0e;--pd-help-conditional-bg: #fdf2f8;--pd-help-conditional-line: #fbcfe8;--pd-help-conditional-ink: #9d174d;--pd-handle: #165DFF;--pd-ruler: #9aa1af;--pd-ruler-bg: #f8f9fc;--pd-ruler-cursor: #165DFF;--pd-radius: 6px;--pd-shadow-sm: 0 1px 2px rgba(23, 32, 60, .05);--pd-shadow-md: 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07);--pd-shadow-paper: 0 0 0 1px rgba(23, 32, 60, .05), 0 1px 2px rgba(23, 32, 60, .06), 0 8px 20px rgba(23, 32, 60, .08), 0 26px 60px rgba(23, 32, 60, .15);--pd-success: #16a34a;--pd-text-regular: #606266;--pd-fill-light: #f5f7fa;height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.pd-form{display:flex;flex-direction:column;gap:10px;font-size:12px;color:var(--pd-text, #303133)}.pd-field{display:flex;flex-direction:column;gap:4px}.pd-label{font-size:11px;color:var(--pd-text-muted, #909399);display:inline-flex;align-items:center;position:relative;justify-content:space-between;gap:6px}.pd-label-t{display:inline-flex;align-items:center;gap:4px;min-width:0}.pd-reset-btn{flex:none;width:15px;height:15px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-faint, #b4b9c4);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:color .14s ease,border-color .14s ease,background .14s ease}.pd-reset-btn.is-dirty{color:var(--pd-text, #2a2e37)}.pd-reset-btn:hover{color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.pd-help{position:static;display:inline-flex;align-items:center;justify-content:center;flex:none;width:13px;height:13px;margin-left:4px;padding:0;border:1px solid var(--pd-border, #d9dde6);border-radius:50%;background:transparent;color:var(--pd-text-muted, #909399);font-size:9px;line-height:1;cursor:help}.pd-help:before{content:"?";font-weight:600}.pd-help:hover,.pd-help:focus-visible{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF)}.pd-help:after{content:attr(data-tip);position:absolute;top:calc(100% + 6px);left:0;z-index:120;width:196px;padding:5px 7px;border-radius:4px;background:#1e2330e0;color:#fff;font-size:12px;font-weight:400;line-height:1.45;text-align:left;white-space:normal;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease}.pd-help:hover:after,.pd-help:focus:after{opacity:1;visibility:visible}.pd-hover-tip{position:fixed;z-index:9999;transform:translate(-50%);padding:4px 8px;border-radius:4px;background:#2a2e37eb;color:#fff;font-size:12px;line-height:1.4;width:max-content;max-width:calc(100vw - 16px);box-sizing:border-box;overflow-wrap:anywhere;pointer-events:none}.pd-input,.pd-select,textarea.pd-input{width:100%;height:26px;min-height:26px;padding:3px 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);color:inherit;font:inherit;box-sizing:border-box;transition:border-color .14s ease,box-shadow .14s ease}.pd-input:hover,.pd-select:hover{border-color:var(--pd-text-faint, #b4b9c4)}textarea.pd-input{height:auto;min-height:48px;resize:vertical}.pd-input:focus,.pd-select:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.pd-select{appearance:auto}.pd-switch{appearance:none;width:32px;height:18px;margin:0;border:1px solid var(--pd-border, #dcdfe6);border-radius:999px;background:#dcdfe6;position:relative;cursor:pointer;transition:background .2s,border-color .2s}.pd-switch:checked{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF)}.pd-switch:after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;transition:transform .2s}.pd-switch:checked:after{transform:translate(14px)}.pd-range{width:100%;accent-color:var(--pd-accent, #165DFF)}.pd-radio-group,.pd-checkbox-group{display:flex;flex-wrap:wrap;gap:6px}.pd-radio-group--2col{display:grid;grid-template-columns:1fr 1fr}.pd-radio-group--2col>.pd-radio{width:60%;justify-content:flex-start}.pd-radio,.pd-checkbox{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:0 7px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-input-bg, #fff);cursor:pointer;transition:border-color .14s ease,background .14s ease,color .14s ease}.pd-radio:has(input:checked),.pd-checkbox:has(input:checked){color:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);background:#165dff0f}.pd-button-group{display:inline-flex;gap:4px}.pd-button,.pd-tab{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:26px;padding:3px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font:inherit;cursor:pointer;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-button:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-button.primary{background:var(--pd-accent, #165DFF);border-color:var(--pd-accent, #165DFF);color:#fff}.pd-button.danger{background:#f56c6c;border-color:#f56c6c;color:#fff}.pd-button.small{min-height:22px;padding:1px 6px;font-size:11px}.pd-button:disabled{opacity:.55;cursor:not-allowed}.pd-tabs{display:flex;flex-direction:column;min-height:0}.pd-tab-bar{display:flex;gap:4px;padding:8px 12px 0;border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-tab{border:0;border-bottom:2px solid transparent;border-radius:5px 5px 0 0;background:transparent;transition:color .14s ease,background .14s ease}.pd-tab-bar .pd-tab:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pd-tab.active{color:var(--pd-accent, #165DFF);border-bottom-color:var(--pd-accent, #165DFF);background:transparent;font-weight:600}.pd-tab-pane{min-height:0;overflow:auto}.pd-divider{margin:6px 0;font-size:11px;color:var(--pd-text-muted, #909399)}.pd-empty{margin:16px 0;color:var(--pd-text-muted, #909399);text-align:center}.pd-dialog-overlay{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:16px;background:#00000073}.pd-dialog{display:flex;flex-direction:column;width:min(950px,90vw);max-height:90vh;overflow:hidden;background:var(--pd-surface, #fff);border-radius:12px;box-shadow:var(--pd-shadow-md, 0 12px 40px rgba(23, 32, 60, .18))}.pd-dialog-large{width:min(950px,90vw)}.pd-dialog-header,.pd-dialog-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px}.pd-dialog-header{border-bottom:1px solid var(--pd-border-soft, #ebeef5)}.pd-dialog-footer{justify-content:flex-end;border-top:1px solid var(--pd-border-soft, #ebeef5)}.pd-close{width:22px;height:22px;border:0;background:transparent;color:var(--pd-text-muted, #909399);font-size:16px;cursor:pointer}.pd-icon{display:inline-flex;width:14px;height:14px}.tb-more-panel{min-width:244px}.designer-container{scrollbar-width:thin;scrollbar-color:var(--pd-scrollbar, rgba(23, 32, 60, .18)) transparent}.designer-container ::-webkit-scrollbar{width:9px;height:9px}.designer-container ::-webkit-scrollbar-track{background:transparent}.designer-container ::-webkit-scrollbar-thumb{background:var(--pd-scrollbar-thumb, rgba(23, 32, 60, .16));border-radius:999px;border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-thumb:hover{background:var(--pd-scrollbar-thumb-hover, rgba(23, 32, 60, .3));border:2px solid transparent;background-clip:content-box}.designer-container ::-webkit-scrollbar-corner{background:transparent}.designer-container button:focus-visible,.designer-container [tabindex]:focus-visible,.designer-container .pd-tab:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}@media(prefers-reduced-motion:reduce){.designer-container *,.designer-container *:before,.designer-container *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}.help-button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;cursor:pointer;transition:background-color .15s}.help-button:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-icon{display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--pd-accent, #165DFF);color:#fff;font-size:12px;font-weight:600;line-height:1}.tb-dd{position:relative;display:inline-flex}.tb-dd-trigger{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:3px;font-size:12px;transition:background .14s ease,color .14s ease}.tb-dd-trigger:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-dd-trigger:disabled{opacity:.32;cursor:default}.tb-dd-trigger.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.tb-dd-arrow{opacity:.6;transition:transform .14s ease}.tb-dd-arrow.up{transform:rotate(180deg)}.tb-dd-trigger[data-tip]{position:relative}.tb-dd-trigger[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.tb-dd-trigger[data-tip]:hover:after{opacity:1}.tb-dd-panel{position:absolute;top:34px;left:0;background:var(--pd-surface, #fff);border:1px solid var(--pd-border, #d9dde6);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));z-index:200}.tb-dd-panel.is-hidden{display:none}.tb-more-group{flex-shrink:0}.tb-more-menu{display:flex;flex-direction:column;gap:8px;padding:8px;max-height:min(70vh,520px)}.tb-more-item{display:flex;flex-direction:column;gap:4px}.tb-menu-label{font-size:11px;color:var(--pd-text-muted, #8b909c);padding-left:2px}.tb-more-slot{display:flex;align-items:center}.designer-toolbar{display:flex;align-items:center;gap:2px;padding:0 12px;height:50px;background:var(--pd-surface, #ffffff);border-bottom:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 1px 2px #17203c0a,0 6px 16px -12px #17203c40;flex-shrink:0;position:relative;z-index:100}.tb-ou{flex-shrink:0}.designer-toolbar>*{flex-shrink:0}.designer-toolbar>.tb-brand{flex-shrink:1;min-width:0}.tb-title,.tb-title-name,.tb-title-sub,.tb-btn-text,.tb-zoom{white-space:nowrap}.designer-toolbar.is-tight .tb-title{min-width:0;overflow:hidden}.designer-toolbar.is-tight .tb-title-name,.designer-toolbar.is-tight .tb-title-sub{overflow:hidden;text-overflow:ellipsis}.tb-group{display:flex;align-items:center;gap:2px;padding:0 8px}.tb-group+.tb-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.tb-btn{height:30px;min-width:30px;padding:0 8px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:5px;transition:background .14s ease,color .14s ease,border-color .14s ease,box-shadow .14s ease}.tb-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.tb-btn:active{background:var(--pd-border-soft, #e9ecf2)}.tb-btn:disabled{opacity:.32;cursor:default;background:transparent;color:var(--pd-text-faint, #b4b9c4)}.tb-btn.danger:hover:not(:disabled){color:var(--pd-accent-secondary, #f56c6c);background:var(--pd-danger-soft, rgba(245, 108, 108, .1))}.tb-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));font-weight:600}.tb-btn .dot{width:6px;height:6px;border-radius:50%;background:var(--pd-text-faint, #b4b9c4);display:inline-block;transition:background .14s ease,box-shadow .14s ease}.tb-btn.on .dot{background:var(--pd-accent, #165DFF);box-shadow:0 0 0 3px #165dff1f}.tb-icon{font-size:15px;line-height:1}[data-tip]{position:relative}[data-tip]:after{content:attr(data-tip);position:absolute;bottom:-32px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}[data-tip]:hover:after{opacity:1}.tb-mark{width:28px;height:28px;margin-right:2px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;color:#fff;background:linear-gradient(150deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));box-shadow:0 3px 8px #165dff47,inset 0 1px #ffffff38;flex-shrink:0}.tb-mark svg{width:16px;height:16px}.tb-title{display:flex;flex-direction:column;line-height:1.2;padding-left:6px}.tb-title-name{font-size:13px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.2px}.tb-title-sub{font-size:10px;color:var(--pd-text-muted, #8b909c);letter-spacing:.8px}.tb-zoom{font-size:12px;color:var(--pd-text, #2a2e37);font-variant-numeric:tabular-nums;min-width:46px;text-align:center}.tb-spacer{flex:1}.tb-group .tb-dd-trigger{height:30px;min-width:30px;padding:0 8px}.tb-btn-text{font-size:12px}.tb-menu{padding:8px;display:flex;flex-direction:column;gap:4px}.tb-menu-rows{width:148px}.tb-menu-label{padding:2px 4px;font-size:11px;color:var(--pd-text-muted, #8b909c)}.tb-menu-grid{display:grid;grid-template-columns:repeat(4,32px);gap:2px;margin-bottom:4px}.tb-menu-row{justify-content:flex-start;width:100%}.btn-primary,.btn-secondary{height:32px;padding:0 16px;border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;transition:filter .14s ease,background .14s ease,border-color .14s ease,box-shadow .14s ease}.btn-secondary{background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text-muted, #606266);border:1px solid var(--pd-border, #d9dde6)}.btn-secondary:hover{border-color:var(--pd-accent, #165DFF);color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .06))}.btn-primary{background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF));color:#fff;border:none;box-shadow:0 3px 10px #165dff47,inset 0 1px #ffffff2e}.btn-primary:hover{filter:brightness(1.07);box-shadow:0 5px 14px #165dff57,inset 0 1px #ffffff2e}.btn-primary:active{filter:brightness(.97)}.font-select{position:relative}.font-select-input{display:block;width:100%}.font-select-list{position:absolute;top:calc(100% + 4px);left:0;width:100%;min-width:150px;z-index:200;margin:0;max-height:200px;overflow-y:auto;padding:2px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #ffffff);box-shadow:var(--pd-shadow-md, 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07));list-style:none}.font-select-list.is-up{top:auto;bottom:calc(100% + 4px)}.font-select-option{padding:4px 6px;border-radius:4px;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.font-select-option.is-active{background:var(--pd-sidebar-hover, #f0f3f9)}.font-select-option.is-muted{color:var(--pd-text-muted, #8b909c)}.pd-stepper{display:flex;align-items:center;width:100%}.pd-step-btn{width:26px;height:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .14s ease,border-color .14s ease,color .14s ease}.pd-step-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-step-btn:disabled{opacity:.45;cursor:not-allowed}.pd-step-minus{border-radius:6px 0 0 6px;border-right:none}.pd-step-plus{border-radius:0 6px 6px 0;border-left:none}.pd-step-input.pd-input{border-radius:0;min-width:0;flex:1;text-align:center;-moz-appearance:textfield}.pd-step-input.pd-input::-webkit-outer-spin-button,.pd-step-input.pd-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.preset-color-trigger{display:flex;align-items:center;width:100%;min-height:26px;padding:1px;border:1px solid var(--pd-border, #d9dde6);border-radius:6px;background:var(--pd-surface, #fff);cursor:pointer;transition:border-color .14s ease,box-shadow .14s ease}.preset-color-trigger:hover,.preset-color-trigger[aria-expanded=true]{border-color:var(--pd-accent, #165DFF)}.preset-color-trigger:focus-visible{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.preset-color-swatch{width:100%;height:22px;border-radius:4px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.preset-color-panel{position:fixed;z-index:3000;width:190px;padding:10px;border:1px solid var(--pd-border, #d9dde6);border-radius:8px;background:var(--pd-surface, #fff);box-shadow:0 8px 24px #17203c29}.picker-preview{display:flex;align-items:center;gap:8px;margin-bottom:8px}.picker-current{flex:0 0 26px;height:24px;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;background-image:linear-gradient(45deg,#e9ecef 25%,transparent 25%,transparent 75%,#e9ecef 75%);background-size:8px 8px;background-position:0 0,4px 4px}.picker-current.is-empty{position:relative;background-color:#fff}.picker-current.is-empty:after{content:"";position:absolute;inset:3px;background:linear-gradient(to top right,transparent calc(50% - .7px),#f53f3f calc(50% - .7px),#f53f3f calc(50% + .7px),transparent calc(50% + .7px));border-radius:3px}.picker-hex{flex:1;min-width:0;height:24px;padding:0 6px;border:1px solid var(--pd-border, #d9dde6);border-radius:5px;color:var(--pd-text, #303133);font:inherit;font-size:11px;text-transform:uppercase}.picker-hex:focus{outline:none;border-color:var(--pd-accent, #165DFF);box-shadow:0 0 0 2px #165dff1f}.picker-area{position:relative;height:100px;border:1px solid rgb(0 0 0 / 12%);border-radius:6px;overflow:hidden;cursor:crosshair;touch-action:none;background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,hsl(var(--picker-hue) 100% 50%))}.picker-handle{position:absolute;width:12px;height:12px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 3px #00000073;pointer-events:none}.picker-hue{width:100%;height:14px;margin:10px 0 0;appearance:none;border:1px solid rgb(0 0 0 / 12%);border-radius:999px;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.picker-hue::-webkit-slider-thumb{appearance:none;width:12px;height:12px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-hue::-moz-range-thumb{width:8px;height:8px;border:2px solid #fff;border-radius:50%;background:transparent;box-shadow:0 0 3px #00000073}.picker-heading{display:flex;align-items:center;justify-content:space-between;margin-top:10px;margin-bottom:6px;font-size:11px;color:var(--pd-text-muted, #909399)}.picker-clear{display:inline-flex;align-items:center;gap:3px;padding:2px 6px;border:none;border-radius:4px;background:transparent;font-size:11px;line-height:1;color:var(--pd-text-muted, #909399);cursor:pointer}.picker-clear:hover:not(:disabled){background:#0000000f;color:var(--pd-danger, #f53f3f)}.picker-clear:disabled{opacity:.45;cursor:not-allowed}.preset-color-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}.preset-color-item{width:22px;height:22px;padding:0;border:1px solid rgb(0 0 0 / 12%);border-radius:5px;cursor:pointer}.preset-color-item.active{box-shadow:0 0 0 2px #fff,0 0 0 3px var(--pd-accent, #165DFF)}.format-toolbar{display:flex;align-items:center;gap:2px;flex-shrink:0;min-width:0}.ft-group{display:flex;align-items:center;gap:2px;padding:0 8px;flex-shrink:0}.ft-group+.ft-group{border-left:1px solid var(--pd-border-soft, #e9ecf2)}.ft-btn{height:28px;min-width:28px;padding:0 5px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:4px;transition:background .14s ease,color .14s ease}.ft-btn:hover:not(:disabled){color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.ft-btn:disabled{opacity:.32;cursor:default}.ft-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.ft-btn-text{font-size:12px}.ft-btn[data-tip]{position:relative}.ft-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:34px;left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:100}.ft-btn[data-tip]:hover:after{opacity:1}.ft-font{width:150px}.ft-size{width:96px}.ft-font .font-select-input,.ft-size .pd-input,.ft-size .pd-step-btn{font-size:12px}.ft-color-btn{position:relative;width:28px;height:28px;display:inline-flex;margin-left:2px}.ft-color-btn.dim{opacity:.35}.ft-color-btn .preset-color-trigger{width:100%;height:100%;min-height:0;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;align-items:flex-end;justify-content:center}.ft-color-btn .preset-color-trigger:hover,.ft-color-btn .preset-color-trigger[aria-expanded=true]{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-color-btn .preset-color-swatch{width:16px;height:4px;margin-bottom:3px;border-radius:1px;background-image:none;border-bottom:1px solid var(--pd-text-faint, #b4b9c4)}.ft-glyph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding-bottom:7px;font-size:13px;font-weight:700;color:var(--pd-text, #2a2e37);pointer-events:none}.ft-border-panel{width:196px;padding:10px;display:flex;flex-direction:column;gap:8px}.ft-align-panel{padding:6px;display:flex;flex-direction:column;gap:4px}.ft-align-row{display:grid;grid-template-columns:repeat(3,36px);gap:4px}.ft-border-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-cell-btn{height:30px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-cell-btn:hover:not(:disabled){background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-border-soft, #e9ecf2)}.ft-cell-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-cell-btn:disabled{opacity:.32;cursor:default}.ft-cell-btn .g-faint{fill:none;stroke:var(--pd-text-faint, #b4b9c4);stroke-width:1;stroke-dasharray:2 2}.ft-cell-btn .g-solid{stroke:currentColor;stroke-width:1.6}.ft-cell-btn[data-tip],.ft-style-btn[data-tip]{position:relative}.ft-cell-btn[data-tip]:after,.ft-style-btn[data-tip]:after{content:attr(data-tip);position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%);padding:4px 8px;font-size:12px;font-weight:400;color:#fff;background:#1e2330e0;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s ease;z-index:210}.ft-cell-btn[data-tip]:hover:after,.ft-style-btn[data-tip]:hover:after{opacity:1}.ft-style-row{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.ft-style-btn{height:22px;display:inline-flex;align-items:center;justify-content:center;padding:0 4px;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--pd-text, #2a2e37);cursor:pointer}.ft-style-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.ft-style-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));border-color:#165dff59}.ft-style-line{width:100%;height:0}.ft-border-style-row{display:flex;align-items:center;gap:6px}.ft-line-width{width:96px}.ft-edge-label{font-size:12px;color:var(--pd-text-muted, #8b909c);white-space:nowrap;flex-shrink:0}.layer-panel{border-top:1px solid var(--pd-border);padding:8px 12px;height:100%;box-sizing:border-box;overflow-y:auto}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}.layer-item{display:flex;align-items:center;gap:6px;padding:4px 6px;margin-bottom:2px;border-radius:4px;cursor:pointer;font-size:12px;transition:background .1s}.layer-item:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.layer-item.active{background:#165dff1a;color:var(--pd-accent, #165DFF);box-shadow:inset 2px 0 0 var(--pd-accent, #165DFF)}.layer-icon{width:18px;text-align:center;font-size:12px;color:var(--pd-text-muted, #909399)}.layer-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pd-text, #303133)}.layer-zone{flex-shrink:0;padding:0 4px;font-size:10px;line-height:14px;color:var(--pd-ink-green, #67c23a);background:#67c23a1a;border-radius:3px}.layer-zindex{font-size:10px;color:var(--pd-text-muted, #909399);font-variant-numeric:tabular-nums}.layer-actions{display:flex;gap:4px;margin-top:8px}.field-tree-panel{padding:0}.panel-title{font-size:11px;color:var(--pd-text-muted);text-transform:uppercase;letter-spacing:.5px;padding:4px 0 8px;margin-bottom:8px;border-bottom:1px solid var(--pd-border)}.search-input{margin-bottom:8px}.tree-container{overflow-y:auto;min-height:0}.field-group-header{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background .1s}.field-group-header:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.field-group-header.is-list{color:var(--pd-accent, #165DFF);font-weight:500}.expand-icon{width:12px;font-size:8px;flex-shrink:0;color:var(--pd-text-muted, #909399)}.field-row{display:flex;align-items:center;gap:4px;padding:5px 8px;border-radius:4px;font-size:13px;color:var(--pd-text, #303133);cursor:grab;-webkit-user-select:none;user-select:none;transition:background .1s}.field-row:hover{background:var(--pd-sidebar-hover, #f0f2f5)}.node-icon{font-size:14px;flex-shrink:0;filter:saturate(.6);opacity:.9}.node-meta{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:center;column-gap:4px;row-gap:1px}.node-label{flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.node-key{flex:0 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--pd-text-muted, #909399)}.group-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.copy-hint{flex-shrink:0;margin-left:auto;font-size:11px;color:var(--pd-accent, #165DFF);white-space:nowrap}.left-panel{width:248px;min-width:248px;background:var(--pd-sidebar, #ffffff);border-right:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.left-panel.collapsed{width:36px;min-width:36px;border-right:1px solid var(--pd-border-soft, #e9ecf2)}.left-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.lc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.lc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.lc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.left-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.left-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.left-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.left-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.left-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.material-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-content:start}.material-grid>.panel-title,.material-grid>.material-group-title,.material-grid>.material-card--wide{grid-column:1 / -1}.material-grid>.panel-title,.material-grid>.material-group-title{margin-bottom:0}.material-grid>.material-card{margin-bottom:0;min-width:0}.panel-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:2px 2px 8px;margin-bottom:10px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-group-title{font-size:11px;color:var(--pd-text-muted, #8b909c);letter-spacing:.6px;padding:4px 2px 6px;margin:2px 0 8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.material-card{position:relative;display:flex;align-items:center;gap:9px;padding:7px 8px;border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:7px;background:transparent;cursor:grab;-webkit-user-select:none;user-select:none;transition:background .16s ease,border-color .16s ease,transform .16s ease,box-shadow .16s ease}.material-card:before{content:"";position:absolute;left:0;top:50%;width:2px;height:0;border-radius:2px;background:var(--pd-accent, #165DFF);transform:translateY(-50%);transition:height .16s ease}.material-card:hover{background:var(--pd-hover-tint, #ecf5ff);border-color:#165dff73;transform:translate(2px)}.material-card:hover:before{height:56%}.material-card:active{cursor:grabbing;transform:translate(2px) scale(.985)}.material-icon{width:30px;height:30px;border:0;border-radius:7px;display:flex;align-items:center;justify-content:center;color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09));box-shadow:inset 0 0 0 1px #165dff1f;flex-shrink:0;transition:background .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease}.material-card:hover .material-icon{background:var(--pd-accent, #165DFF);color:#fff;box-shadow:0 2px 6px #165dff47}.material-card:active .material-icon{transform:scale(.92)}.material-label{min-width:0;flex:1;font-size:12.5px;font-weight:500;line-height:1.3;color:var(--pd-text, #2a2e37);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:color .16s ease}.material-card:hover .material-label{color:var(--pd-accent, #165DFF)}.print-image{width:100%;height:100%;overflow:hidden}.print-image img{width:100%;height:100%;display:block}.table-ctx-menu{position:fixed;z-index:3000;min-width:140px;padding:4px 0;background:var(--pd-surface, #fff);border:1px solid var(--pd-menu-border, #dcdfe6);border-radius:4px;box-shadow:0 2px 12px #00000026;font-size:13px}.menu-item{padding:5px 14px;cursor:pointer;color:var(--pd-menu-text, #333)}.menu-item:hover{background:var(--pd-menu-hover, #f5f7fa)}.menu-item.disabled{color:var(--pd-menu-disabled, #c0c4cc);cursor:not-allowed}.menu-item.active{color:var(--pd-accent, #165DFF)}.menu-divider{height:1px;margin:4px 0;background:var(--pd-menu-divider, #ebeef5)}.menu-group-title{padding:4px 14px;font-size:12px;color:var(--pd-menu-muted, #909399)}.cell-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-barcode svg{max-width:100%;max-height:100%}.cell-barcode img{max-width:100%;max-height:100%}.cell-barcode-fallback{font-style:italic;opacity:.6}.cell-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.cell-image img{max-width:100%;max-height:100%;display:block}.image-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:#bbb;font-size:12px;border:1px dashed #ddd;box-sizing:border-box}.print-table{position:relative;width:100%;height:100%}.print-table table{border-collapse:collapse;table-layout:fixed;width:100%}.print-table td{box-sizing:border-box;word-break:normal;overflow-wrap:break-word}.cell-selected{outline:2px solid #165DFF;outline-offset:-2px;background-color:#165dff14}.row-data-bg{background-image:repeating-linear-gradient(45deg,rgba(22,93,255,.04) 0 6px,transparent 6px 12px)}.data-placeholder{color:#909399;font-style:italic}.row-badges{position:absolute;left:-16px;top:0;width:14px}.row-badge{position:absolute;width:14px;display:flex;align-items:center;justify-content:center;font-size:10px;color:#909399;background:#f5f7fa;border-radius:2px}.col-resize-layer{position:absolute;inset:0;pointer-events:none;z-index:3}.col-resize-handle{position:absolute;top:0;bottom:0;width:6px;transform:translate(-50%);cursor:col-resize;pointer-events:auto}.col-resize-handle:after{content:"";position:absolute;top:0;bottom:0;left:50%;border-left:1px solid transparent}.col-resize-handle:hover:after,.col-resize-handle.dragging:after{border-left-color:var(--pd-accent, #165DFF)}.print-barcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-barcode svg{max-width:100%;max-height:100%}.print-qrcode{width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}.print-qrcode img{max-width:100%;max-height:100%}.print-html,.page-number-element{width:100%;height:100%;overflow:hidden}.print-element{box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none}.extension-placeholder{display:flex;align-items:center;justify-content:center;width:100%;height:100%;box-sizing:border-box;padding:2px;font-size:11px;line-height:1.4;text-align:center;color:var(--pd-text-muted, #8b909c);background:repeating-linear-gradient(45deg,#f4f6fa,#f4f6fa 6px,#fff 6px 12px);overflow:hidden}.element-margin-guide{position:absolute;box-sizing:border-box;pointer-events:none}.print-element.design-mode{outline:1px dashed #C3C9D6}.print-element.design-mode.zone-header,.print-element.design-mode.zone-footer{outline:1px dashed var(--pd-ink-green, #67c23a)}.print-element.selected{outline:1.5px solid var(--pd-accent, #165DFF);background:#165dff0a}.print-element.previewed{outline:1.5px solid rgba(22,93,255,.5);background:#165dff1a}.print-element.design-mode:hover{outline:1px dashed var(--pd-accent, #165DFF)}.print-element.locked{cursor:not-allowed}.print-element.locked:not(.selected){outline:1.5px dashed #999}.print-element.hidden{opacity:.3;pointer-events:none}.print-element.drag-ghost{opacity:.4}.drag-preview{position:absolute;inset:0;border:2px dashed var(--pd-accent, #165DFF);pointer-events:none;z-index:1000;box-sizing:border-box}.selected-indicator{position:absolute;top:-18px;left:0;font-size:10px;white-space:nowrap;pointer-events:none;z-index:20}.position-label{background:var(--pd-accent, #165DFF);color:#fff;padding:1px 6px;border-radius:3px;font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:10px;font-variant-numeric:tabular-nums;letter-spacing:0;box-shadow:0 2px 6px #00000026}.resize-handles{position:absolute;inset:0;pointer-events:none}.resize-handle{position:absolute;width:7px;height:7px;background:var(--pd-handle, #165DFF);border:1.5px solid #fff;border-radius:2px;box-sizing:border-box;transform:translate(-50%,-50%);box-shadow:0 1px 3px #0000002e;z-index:10;pointer-events:auto}.handle-nw{top:0;left:0;cursor:nw-resize}.handle-n{top:0;left:50%;cursor:n-resize}.handle-ne{top:0;left:100%;cursor:ne-resize}.handle-e{top:50%;left:100%;cursor:e-resize}.handle-se{top:100%;left:100%;cursor:se-resize}.handle-s{top:100%;left:50%;cursor:s-resize}.handle-sw{top:100%;left:0;cursor:sw-resize}.handle-w{top:50%;left:0;cursor:w-resize}.paper-wrapper{display:block}.hiprint-printPaper{transition:transform .15s ease-out}.zone-layer{box-sizing:border-box}.zone-layer.zone-header.design-mode,.zone-layer.zone-footer.design-mode{outline:1px dashed var(--pd-ink-green, #67c23a);background:#67c23a0a}.zone-layer.zone-content.design-mode{outline:1px dashed #C3C9D6}.zone-label{position:absolute;top:2px;right:4px;font-size:9px;color:#909399;pointer-events:none;-webkit-user-select:none;user-select:none}.zone-resize-handle{position:absolute;left:0;width:100%;height:6px;cursor:ns-resize;z-index:5}.zone-resize-handle.handle-bottom{bottom:-3px}.zone-resize-handle.handle-top{top:-3px}.zone-resize-handle:hover{background:#10b98140}.zone-height-tip{position:absolute;right:4px;top:-22px;padding:1px 6px;font-size:11px;color:#fff;background:#10b981;border-radius:3px;white-space:nowrap;pointer-events:none}.design-background{position:absolute;z-index:0;overflow:hidden;pointer-events:none}.design-background img{display:block;width:100%;height:100%;object-fit:fill;pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.grid-bg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:0}.snap-indicator{position:absolute;width:6px;height:6px;background:var(--pd-accent, #165DFF);border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;z-index:10;animation:snap-pulse-3160f418 .3s ease-out}@keyframes snap-pulse-3160f418{0%{transform:translate(-50%,-50%) scale(2);opacity:.5}to{transform:translate(-50%,-50%) scale(1);opacity:0}}.watermark-layer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;overflow:hidden;pointer-events:none}.watermark-tile{position:absolute;pointer-events:none}.adsorb-guide{position:absolute;pointer-events:none;z-index:9999}.adsorb-guide.guide-vertical{border-left:1px dashed var(--pd-accent-secondary, #f56c6c)}.adsorb-guide.guide-horizontal{border-top:1px dashed var(--pd-accent-secondary, #f56c6c)}.manual-guide{position:absolute;pointer-events:auto;z-index:9998;cursor:move}.manual-guide.guide-vertical{border-left:1px solid #3B82F6;width:0}.manual-guide.guide-horizontal{border-top:1px solid #3B82F6;height:0}.manual-guide:before{content:"";position:absolute;pointer-events:auto}.manual-guide.guide-vertical:before{top:0;bottom:0;left:50%;width:var(--guide-hit, 8px);transform:translate(-50%)}.manual-guide.guide-horizontal:before{left:0;right:0;top:50%;height:var(--guide-hit, 8px);transform:translateY(-50%)}.manual-guide:hover{border-color:#ef4444!important}.pd-ruler{position:absolute;display:block;pointer-events:auto;cursor:crosshair;z-index:1;background:var(--pd-ruler-bg, #f8f9fc)}.pd-ruler.is-horizontal{box-shadow:0 1px 0 var(--pd-border-soft, #e9ecf2)}.pd-ruler.is-vertical{box-shadow:1px 0 0 var(--pd-border-soft, #e9ecf2)}.canvas-area{flex:1;overflow-x:scroll;overflow-y:auto;scrollbar-gutter:stable;display:flex;background-color:var(--pd-canvas-bg, #e6e9f0);background-image:radial-gradient(circle,rgba(23,32,60,.13) 1px,transparent 1.2px);background-size:20px 20px;background-position:center;padding:44px 28px 32px 44px;position:relative}.canvas-scroll{display:flex;flex-direction:column;align-items:center;gap:20px;position:relative;flex:none;margin:auto;width:fit-content}.marquee-selection{position:fixed;border:1.5px solid rgba(22,93,255,.7);background:#165dff14;border-radius:2px;pointer-events:none;z-index:10000}.drop-hint{position:fixed;z-index:10002;pointer-events:none;padding:2px 8px;border-radius:10px;background:var(--pd-accent, #165dff);color:#fff;font-size:12px;line-height:18px;white-space:nowrap;box-shadow:0 2px 8px #0000002e}.context-menu{position:fixed;background:var(--pd-surface, #ffffff);border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;box-shadow:var(--pd-shadow-md, 0 10px 28px rgba(23, 32, 60, .12));padding:5px;z-index:10001;min-width:132px}.context-menu-item{padding:7px 12px;border-radius:5px;font-size:12.5px;cursor:pointer;color:var(--pd-text, #2a2e37);-webkit-user-select:none;user-select:none;transition:background .12s ease,color .12s ease}.context-menu-item:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.context-menu-item.disabled{color:var(--pd-text-faint, #b4b9c4);cursor:not-allowed}.context-menu-item.disabled:hover{background:transparent;color:var(--pd-text-faint, #b4b9c4)}.context-menu-sep{height:1px;background:var(--pd-border-soft, #e9ecf2);margin:5px 8px}.ruler-overlay{position:absolute;inset:0;pointer-events:none;z-index:60}.ruler-corner{position:absolute;top:0;left:0;width:22px;height:22px;background:var(--pd-ruler-bg, #f8f9fc);box-shadow:1px 1px 0 var(--pd-border-soft, #e9ecf2);z-index:2}.ruler-overlay .pd-ruler.is-horizontal{top:0;left:22px}.ruler-overlay .pd-ruler.is-vertical{top:22px;left:0}.ruler-guide-preview{position:fixed;pointer-events:none;z-index:9997}.ruler-guide-preview.guide-vertical{width:0;border-left:1px dashed var(--pd-accent, #165dff)}.ruler-guide-preview.guide-horizontal{height:0;border-top:1px dashed var(--pd-accent, #165dff)}.property-search{padding:0 0 10px;background:transparent}.property-group{border:1px solid var(--pd-border-soft, #e9ecf2);border-radius:8px;margin-bottom:10px;background:var(--pd-surface, #ffffff);overflow:hidden;transition:border-color .14s ease,box-shadow .14s ease}.property-group:last-child{margin-bottom:2px}.property-group.is-expanded{border-color:var(--pd-border-soft, #e9ecf2)}.group-header{display:flex;align-items:center;padding:9px 12px;cursor:pointer;-webkit-user-select:none;user-select:none;background:var(--pd-field-bg, #f4f6fa);transition:background .14s ease}.group-header:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.property-group.is-expanded .group-header{border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.group-icon{margin-right:8px;color:var(--pd-accent, #165DFF)}.group-title{flex:1;font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:.3px}.expand-icon{color:var(--pd-text-muted, #8b909c);font-size:10px}.group-content{padding:10px 12px 12px;background:var(--pd-surface, #ffffff)}.position-grid,.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.margin-grid{margin-top:8px}.pd-crop-note{margin:0 0 8px;font-size:12px;line-height:1.5;color:var(--pd-text-faint, #6b7280)}.pd-crop-preview{position:relative;overflow:hidden;margin-bottom:8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;line-height:0;width:fit-content;max-width:100%}.pd-crop-thumb{max-width:100%;max-height:96px;display:block}.pd-crop-win{position:absolute;border:1px solid #ff5a5a;box-shadow:0 0 0 999px #0000008c;pointer-events:none}.color-row{display:flex;gap:12px}.color-row>.pd-field{flex:1 1 0;min-width:0}.pd-rotate-row{display:flex;align-items:stretch;width:100%}.pd-rotate-btn{width:26px;flex-shrink:0;border:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);color:var(--pd-text, #2a2e37);font-size:14px;line-height:1;cursor:pointer;transition:background .14s ease,border-color .14s ease}.pd-rotate-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);border-color:var(--pd-text-faint, #b4b9c4)}.pd-rotate-btn:first-child{border-radius:6px 0 0 6px;border-right:none}.pd-rotate-btn:last-child{border-radius:0 6px 6px 0;border-left:none}.pd-rotate-stepper{flex:1;min-width:0}.pd-rotate-stepper .pd-step-minus,.pd-rotate-stepper .pd-step-plus{display:none}.pd-rotate-stepper .pd-step-input.pd-input{border-radius:0}.expression-editor{display:flex;height:450px;gap:0}.ee-nav{width:100px;background:var(--pd-sidebar);border-right:1px solid var(--pd-border);display:flex;flex-direction:column;flex-shrink:0}.ee-nav-title{padding:10px;border-bottom:1px solid var(--pd-border);font-weight:600;font-size:13px;color:var(--pd-text);text-align:center}.ee-nav-tabs{flex:1;display:flex;flex-direction:column;padding:6px;gap:4px}.ee-nav-tab{padding:8px 10px;border-radius:6px;cursor:pointer;font-size:12px;text-align:center;transition:all .2s}.ee-nav-tab.active{background:var(--pd-accent);color:#fff}.ee-nav-tab:not(.active){background:var(--pd-surface, white);border:1px solid var(--pd-border);color:var(--pd-text)}.ee-nav-tab:hover:not(.active){background:var(--pd-hover-tint, #ecf5ff);border-color:var(--pd-accent)}.ee-content{width:300px;display:flex;flex-direction:column;border-right:1px solid var(--pd-border);flex-shrink:0}.ee-content-search{padding:10px;border-bottom:1px solid var(--pd-border)}.ee-content-list{flex:1;padding:8px;overflow-y:auto;min-height:0}.ee-func-group{margin-bottom:12px}.ee-func-group-title{font-size:11px;font-weight:600;color:var(--pd-text-muted);padding:6px 10px;margin-bottom:2px;letter-spacing:.5px}.ee-field-group{display:flex;align-items:center;gap:4px;padding:6px 10px;font-size:12px;font-weight:600;color:var(--pd-text)}.ee-field-group.is-list{color:var(--pd-accent, #165DFF)}.ee-field-group-icon{font-size:13px;filter:saturate(.6)}.ee-list-item{padding:7px 10px;cursor:pointer;border-radius:4px;margin-bottom:2px;transition:background .15s}.ee-field-info{display:flex;flex-direction:column;gap:1px}.ee-field-info .ee-item-label{font-size:12px;color:var(--pd-text)}.ee-field-info .ee-item-key{font-size:10px;color:var(--pd-text-muted);font-family:monospace}.ee-field-item{display:flex;align-items:center;gap:6px}.ee-field-item .ee-field-info{flex:1;min-width:0}.ee-copy-btn{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:1px solid transparent;border-radius:4px;background:transparent;color:var(--pd-text-muted);cursor:pointer;transition:color .15s,background .15s,border-color .15s}.ee-copy-btn:hover{background:var(--pd-surface, white);border-color:var(--pd-border);color:var(--pd-accent)}.ee-copy-btn.is-copied{color:var(--pd-success, #16a34a)}.ee-list-item:hover{background:var(--pd-hover-tint, #ecf5ff)}.ee-editor{flex:1;display:flex;flex-direction:column;background:var(--pd-sidebar);min-width:0}.ee-editor-section{padding:12px;border-bottom:1px solid var(--pd-border)}.ee-editor-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}.ee-textarea{width:100%;border:1px solid var(--pd-border);border-radius:6px;padding:10px;font-family:monospace;font-size:13px;resize:vertical;box-sizing:border-box;min-height:100px}.ee-textarea:focus{outline:none;border-color:var(--pd-accent)}.ee-preview{padding:10px;background:var(--pd-bg);border:1px solid var(--pd-border);border-radius:6px;min-height:30px;font-size:13px;color:var(--pd-text);line-height:1.6;white-space:pre-wrap}.ee-preview-error{color:var(--pd-danger, #e53e3e);background:var(--pd-danger-bg, #fef2f2);border-color:var(--pd-danger-border, #fecaca)}.ee-help-section{flex:1;padding:12px;overflow-y:auto;min-height:0}.ee-help-title{font-size:11px;color:var(--pd-text-muted);margin-bottom:8px;text-transform:uppercase;letter-spacing:.5px}.ee-help-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.ee-help-card{border-radius:6px;padding:10px}.ee-help-card-title{font-size:12px;font-weight:600;margin-bottom:4px}.ee-help-card-content{font-size:11px;line-height:1.5;color:var(--pd-text)}.ee-help-field{background:var(--pd-help-field-bg, #f0f9ff);border:1px solid var(--pd-help-field-line, #bae6fd)}.ee-help-field .ee-help-card-title{color:var(--pd-help-field-ink, #0369a1)}.ee-help-function{background:var(--pd-help-function-bg, #f0fdf4);border:1px solid var(--pd-help-function-line, #bbf7d0)}.ee-help-function .ee-help-card-title{color:var(--pd-help-function-ink, #166534)}.ee-help-variable{background:var(--pd-help-variable-bg, #fefce8);border:1px solid var(--pd-help-variable-line, #fde68a)}.ee-help-variable .ee-help-card-title{color:var(--pd-help-variable-ink, #854d0e)}.ee-help-conditional{background:var(--pd-help-conditional-bg, #fdf2f8);border:1px solid var(--pd-help-conditional-line, #fbcfe8)}.ee-help-conditional .ee-help-card-title{color:var(--pd-help-conditional-ink, #9d174d)}.expression-editor{max-height:min(600px,80vh);overflow-y:auto;padding:16px}.col-width-row{display:flex;align-items:center;gap:8px;margin-bottom:4px;width:100%}.border-row{display:flex;gap:10px}.border-row .pd-field{flex:1;min-width:0}.advanced-row{display:flex;gap:16px}.group-help{flex:0 0 auto;width:18px;height:18px;margin-right:6px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:18px;cursor:pointer}.group-help:hover{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF)}.group-help:focus-visible{outline:2px solid var(--pd-accent, #165DFF);outline-offset:1px}.image-content-upload{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin-top:4px}.upload-tip{margin:0;font-size:11px;color:var(--pd-text-muted, #909399)}.cell-style-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 8px}.cell-font-field{grid-column:1 / -1;padding-bottom:8px}.border-style-row{display:flex;gap:6px;margin-bottom:8px}.border-presets{margin-bottom:8px}.merge-btns{display:flex;gap:8px}.merge-card{margin-top:8px;padding:8px;border:1px solid var(--pd-border, #dcdfe6);border-radius:6px}.merge-card-title{font-size:12px;font-weight:600;color:var(--pd-text, #303133);margin-bottom:8px}.merge-card-divider{height:1px;background:var(--pd-menu-divider, #ebeef5);margin:8px 0}.merge-card-hint{margin-top:6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #8b909c)}.watermark-config{padding:0 4px}.pd-hint{margin-left:8px;font-size:12px;color:#909399;min-width:32px}.design-background-config{padding:0 4px}.design-background-tip{margin:2px 0 6px;font-size:11px;line-height:1.4;color:var(--pd-text-muted, #909399)}.design-background-path{margin-bottom:6px;padding:4px 6px;font-size:11px;color:var(--pd-text-regular, #606266);background:var(--pd-fill-light, #f5f7fa);border-radius:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.design-background-actions{display:flex;gap:6px}.upload-label{cursor:pointer}.upload-label.disabled{opacity:.6;cursor:not-allowed}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.tiling-config{padding:0 4px}.tiling-switch{display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer}.tiling-error{color:#f56c6c}.tiling-summary{color:var(--pd-text-regular, #606266)}.property-panel{width:304px;min-width:304px;background:var(--pd-sidebar, #ffffff);border-left:1px solid var(--pd-border-soft, #e9ecf2);display:flex;flex-direction:column;overflow:hidden;transition:width .18s ease}.property-panel.collapsed{width:36px;min-width:36px;border-left:1px solid var(--pd-border-soft, #e9ecf2)}.prop-collapsed{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:12px;flex:1}.pc-btn{width:26px;height:26px;border-radius:6px;border:1px solid transparent;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .14s ease}.pc-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.pc-btn.on{color:var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.prop-head{display:flex;align-items:center;justify-content:space-between;height:42px;padding:0 12px;flex-shrink:0;border-bottom:1px solid var(--pd-border-soft, #e9ecf2)}.prop-title{font-size:12px;font-weight:600;color:var(--pd-text, #2a2e37);letter-spacing:1.2px;display:inline-flex;align-items:center;gap:7px}.prop-title:before{content:"";width:3px;height:12px;border-radius:2px;background:linear-gradient(180deg,var(--pd-accent-2, #3D7BFF),var(--pd-accent, #165DFF))}.collapse-btn{border:none;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:14px;cursor:pointer;width:24px;height:24px;border-radius:5px;transition:all .14s ease}.collapse-btn:hover{color:var(--pd-text, #2a2e37);background:var(--pd-sidebar-hover, #f0f3f9)}.prop-tabs{flex:1;display:flex;flex-direction:column;overflow:hidden}.prop-tabs .pd-tab-pane{flex:1;min-height:0;overflow-y:auto;padding:12px}.property-content{padding:0}.margin-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.custom-size-grid{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:4px;width:100%}.custom-size-x{color:var(--pd-text-muted, #8b909c);font-size:12px}.pd-hint{margin:2px 0 6px;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1.4}.page-bg-row{display:flex;align-items:center;gap:8px}.page-bg-picker{flex:1;min-width:0}.status-bar{position:relative;display:flex;align-items:center;gap:20px;height:30px;padding:0 16px;background:var(--pd-surface, #ffffff);border-top:1px solid var(--pd-border-soft, #e9ecf2);box-shadow:0 -1px 2px #17203c08;font-size:11.5px;color:var(--pd-text-muted, #8b909c);-webkit-user-select:none;user-select:none;flex-shrink:0}.status-item{white-space:nowrap;font-variant-numeric:tabular-nums;display:inline-flex;align-items:center}.coord{font-variant-numeric:tabular-nums;color:var(--pd-text, #2a2e37)}.status-paper{margin-left:auto;font-variant-numeric:tabular-nums;color:var(--pd-accent, #165DFF);font-weight:600}.status-version{font-variant-numeric:tabular-nums;color:var(--pd-text-muted, #8b909c)}.help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.help-modal{width:800px;max-width:90vw;height:600px;max-height:85vh;background:var(--pd-surface, #ffffff);border-radius:8px;box-shadow:0 4px 24px #00000026;display:flex;flex-direction:column;overflow:hidden}.help-modal-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--pd-border, #d9dde6)}.help-modal-title{margin:0;font-size:16px;font-weight:600;color:var(--pd-text, #2a2e37)}.help-modal-title-wrap{display:flex;align-items:center;gap:10px}.help-modal-project{padding:2px 8px;border-radius:4px;background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF);font-size:12px;font-weight:500}.help-modal-close{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:4px;background:transparent;color:var(--pd-text-muted, #8b909c);font-size:20px;cursor:pointer;transition:all .15s}.help-modal-close:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.help-modal-body{flex:1;display:flex;overflow:hidden}.help-modal-sidebar{width:160px;padding:12px;border-right:1px solid var(--pd-border, #d9dde6);background:var(--pd-field-bg, #f4f6fa);overflow-y:auto}.help-tab{display:block;width:100%;padding:10px 12px;margin-bottom:4px;border:none;border-radius:4px;background:transparent;color:var(--pd-text, #2a2e37);font-size:13px;text-align:left;cursor:pointer;transition:all .15s}.help-tab:hover{background:var(--pd-sidebar-hover, #f0f3f9)}.help-tab.active{background:var(--pd-accent-soft, rgba(22, 93, 255, .09));color:var(--pd-accent, #165DFF);font-weight:500}.help-modal-content{flex:1;padding:20px;overflow-y:auto}.help-content{font-size:14px;line-height:1.6;color:var(--pd-text, #2a2e37)}.help-content h2{margin:0 0 16px;padding-bottom:8px;border-bottom:1px solid var(--pd-border-soft, #e9ecf2);font-size:18px;font-weight:600}.help-content h3{margin:20px 0 12px;font-size:15px;font-weight:600}.help-content p{margin:0 0 12px}.help-content ul,.help-content ol{margin:0 0 12px;padding-left:24px}.help-content li{margin-bottom:4px}.help-content code{padding:2px 6px;border-radius:3px;background:var(--pd-field-bg, #f4f6fa);font-family:SF Mono,Monaco,monospace;font-size:13px}.help-content pre{margin:0 0 12px;padding:12px;border-radius:4px;background:var(--pd-field-bg, #f4f6fa);overflow-x:auto}.help-content pre code{padding:0;background:transparent}.help-content table{width:100%;margin:0 0 12px;border-collapse:collapse}.help-content th,.help-content td{padding:8px 12px;border:1px solid var(--pd-border, #d9dde6);text-align:left}.help-content th{background:var(--pd-field-bg, #f4f6fa);font-weight:600}.help-content blockquote{margin:0 0 12px;padding:12px 16px;border-left:3px solid var(--pd-accent, #165DFF);background:var(--pd-accent-soft, rgba(22, 93, 255, .09))}.help-modal-enter-active,.help-modal-leave-active{transition:opacity .2s ease}.help-modal-enter-active .help-modal,.help-modal-leave-active .help-modal{transition:transform .2s ease}.help-modal-enter-from,.help-modal-leave-to{opacity:0}.help-modal-enter-from .help-modal,.help-modal-leave-to .help-modal{transform:scale(.95)}.page-tabs{display:flex;align-items:center;gap:8px;padding:4px 12px;background:var(--pd-sidebar, #fff);border-bottom:1px solid var(--pd-border, #d9dde6);flex-shrink:0}.page-tabs-list{display:flex;gap:4px;overflow-x:auto;align-items:center}.page-tab{padding:4px 12px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;background:transparent;cursor:pointer;white-space:nowrap;color:var(--pd-text, #2a2e37);font-size:12px}.page-tab.active{background:var(--pd-accent, #165DFF);color:#fff}.page-tab-rename{padding:4px 8px;width:96px;border:1px solid var(--pd-accent, #165DFF);border-radius:4px;font-size:12px;color:var(--pd-text, #2a2e37);outline:none}.page-tabs-actions{display:flex;gap:4px;margin-left:auto}.page-tabs-actions button{padding:4px 8px;border:1px solid var(--pd-border, #d9dde6);border-radius:4px;background:transparent;cursor:pointer;color:var(--pd-text-muted, #8b909c);font-size:12px;line-height:1}.page-tabs-actions button:disabled{opacity:.4;cursor:not-allowed}.designer-container{--pd-bg: #f3f5f9;--pd-surface: #ffffff;--pd-field-bg: #f4f6fa;--pd-sidebar: #ffffff;--pd-sidebar-hover: #f0f3f9;--pd-canvas-bg: #e6e9f0;--pd-paper: #FFFFFF;--pd-accent: #165DFF;--pd-accent-2: #3D7BFF;--pd-accent-soft: rgba(22, 93, 255, .09);--pd-accent-secondary: #f56c6c;--pd-danger-soft: rgba(245, 108, 108, .1);--pd-ink-green: #67c23a;--pd-text: #2a2e37;--pd-text-muted: #8b909c;--pd-text-faint: #b4b9c4;--pd-border: #d9dde6;--pd-border-soft: #e9ecf2;--pd-input-bg: #ffffff;--pd-hover-tint: #ecf5ff;--pd-danger: #e53e3e;--pd-danger-bg: #fef2f2;--pd-danger-border: #fecaca;--pd-menu-text: #333;--pd-menu-hover: #f5f7fa;--pd-menu-border: #dcdfe6;--pd-menu-divider: #ebeef5;--pd-menu-muted: #909399;--pd-menu-disabled: #c0c4cc;--pd-scrollbar: rgba(23, 32, 60, .18);--pd-scrollbar-thumb: rgba(23, 32, 60, .16);--pd-scrollbar-thumb-hover: rgba(23, 32, 60, .3);--pd-help-field-bg: #f0f9ff;--pd-help-field-line: #bae6fd;--pd-help-field-ink: #0369a1;--pd-help-function-bg: #f0fdf4;--pd-help-function-line: #bbf7d0;--pd-help-function-ink: #166534;--pd-help-variable-bg: #fefce8;--pd-help-variable-line: #fde68a;--pd-help-variable-ink: #854d0e;--pd-help-conditional-bg: #fdf2f8;--pd-help-conditional-line: #fbcfe8;--pd-help-conditional-ink: #9d174d;--pd-handle: #165DFF;--pd-ruler: #9aa1af;--pd-ruler-bg: #f8f9fc;--pd-ruler-cursor: #165DFF;--pd-radius: 6px;--pd-shadow-sm: 0 1px 2px rgba(23, 32, 60, .05);--pd-shadow-md: 0 2px 8px rgba(23, 32, 60, .06), 0 10px 28px rgba(23, 32, 60, .07);--pd-shadow-paper: 0 0 0 1px rgba(23, 32, 60, .05), 0 1px 2px rgba(23, 32, 60, .06), 0 8px 20px rgba(23, 32, 60, .08), 0 26px 60px rgba(23, 32, 60, .15);--pd-success: #16a34a;--pd-text-regular: #606266;--pd-fill-light: #f5f7fa;height:100%;display:flex;flex-direction:column;background:var(--pd-bg)}.designer-body{flex:1;display:flex;overflow:hidden}.designer-container.format-painting .canvas-area,.designer-container.format-painting .canvas-area *{cursor:copy!important}.print-html-preview{width:100%;height:100%;position:relative;background:#e9ebee}.print-html-preview-iframe{width:100%;height:100%;border:0;background:#fff}.print-html-preview-loading,.print-html-preview-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#909399;font-size:14px}.print-html-preview-error{color:#f56c6c}.print-html-preview-warn{position:absolute;top:8px;left:12px;z-index:2;max-width:62%;padding:4px 8px;border:1px solid #e6a23c;border-radius:4px;background:#faecd1f0;color:#b88230;font-size:12px;line-height:1.5}.print-html-preview-zoom{position:absolute;top:8px;right:12px;z-index:2;display:flex;align-items:center;gap:4px;padding:3px 4px;border:1px solid var(--pd-border-soft, #ebeef5);border-radius:6px;background:#ffffffeb;box-shadow:0 1px 4px #00000014}.print-html-preview-zoom-btn{padding:2px 7px;border:0;border-radius:4px;background:transparent;color:var(--pd-text-muted, #909399);font-size:11px;line-height:18px;cursor:pointer;transition:color .14s ease,background .14s ease}.print-html-preview-zoom-btn:hover{background:var(--pd-sidebar-hover, #f0f3f9);color:var(--pd-text, #2a2e37)}.print-html-preview-zoom-btn.active{background:var(--pd-accent, #165DFF);color:#fff;font-weight:600}.print-html-preview-zoom-note{padding-right:4px;color:var(--pd-text-muted, #909399);font-size:11px}.print-html-preview-zoom-hint{color:#b88230;font-size:11px}.tiling-config .margin-grid,.tiling-config .custom-size-grid{display:block;grid-template-columns:none;gap:normal}.tiling-config .custom-size-x{display:inline;min-width:0;color:inherit}.pd-hint{min-width:auto}.watermark-config .pd-hint{min-width:32px;margin-left:8px;color:#909399}.tiling-config .tiling-error{color:#f56c6c}.tiling-config .tiling-summary{color:var(--pd-text-regular, #606266)}.pd-help{position:static}.pd-help:after{top:calc(100% + 6px);bottom:auto;left:0;transform:none;padding:5px 7px;white-space:normal;z-index:120}.page-tabs [data-tip]:after,.field-tree-panel [data-tip]:after{content:none}',Ki=20;function ig(e){try{const t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t))return t}catch{}}const cE=".page-tabs, .field-tree-panel, .pd-dialog-overlay",dE=new Set(["z","y","a","c","x","v","d","g","1","l","r","e","t","b","0"]),ag="print-studio:left",sg="print-studio:right";function lg(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function cg(e,t){try{localStorage.setItem(e,t?"1":"0")}catch{}}function $l(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return}if(Array.isArray(t))return t.filter(n=>!!n&&typeof n=="object"&&!Array.isArray(n));if(t&&typeof t=="object")return[t]}class Gt extends HTMLElement{root;store;format;unsub=null;unsubPluginUI=null;unsubDefinitions=null;pluginStyleEls=new Map;instanceDisposers=[];measureRaf=null;state={leftTab:"elements",leftCollapsed:!1,propTab:"page",propCollapsed:!1,openDd:null,openMore:!1,collapsedGroups:new Set,renamingPage:null};geom={originX:0,originY:0,viewW:0,viewH:0,paperScale:1};static active=null;docKeydown=null;docDragend=null;ro=null;roArea=null;toolbarRo=null;scrollPos={x:0,y:0};paneScroll=new Map;marquee={visible:!1,x:0,y:0,w:0,h:0};menu={visible:!1,x:0,y:0,flipX:0,flipY:0,targetId:null};guidePreview=null;zoneResizing=null;tableMenu={visible:!1,x:0,y:0};exprTarget=null;exprMountedFor=null;helpVisible=!1;helpInitialTab;unmountHelp=null;drag=null;snapTimer=null;hoverTipEl=null;hoverTipTimer=null;resize=null;raf=0;lastSelKey="";chromeKey="";_theme="auto";_themeConfig;systemDark=!1;themeMedia=null;onThemeMediaChange=()=>{this.systemDark=this.themeMedia?.matches??!1,this.applyTheme()};appliedThemeTokens=[];uploadImage;uploadDesignBackground;_designData;set designData(t){this._designData=$l(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=lE,this.root.appendChild(t),Ze(h("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 theme(t){const n=t==="dark"||t==="light"?t:"auto";this._theme=n,this.setAttribute("theme",n),this.applyTheme()}get theme(){return this._theme}set themeConfig(t){const n=typeof t=="string"?ig(t):t;this._themeConfig=n,n===void 0?this.removeAttribute("theme-config"):this.setAttribute("theme-config",JSON.stringify(n)),this.applyTheme()}get themeConfig(){return this._themeConfig}static contractVersion=Vs;static getHostContract(){return Xs()}getHostContract(){return Xs()}static get observedAttributes(){return[...Ys]}attributeChangedCallback(t,n,r){if(t==="design-data"){this._designData=r===null?void 0:$l(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?ig(r):void 0,this.applyTheme();return}if(!r)return;if(t==="name"){this.repaint();return}let o;try{o=JSON.parse(r)}catch{return}t==="template"?this.applyTemplate(o):t==="fields"?(this.store.fields=o,this.repaint()):t==="fonts"&&Array.isArray(o)&&(this.fonts=o)}connectedCallback(){if(this.attachThemeMedia(),this.applyTheme(),this.store){this.applyFontFace(),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners();return}const t={},n=this.getAttribute("template");if(n)try{t.initialTemplate=JSON.parse(n)}catch{}const r=this.getAttribute("fields");if(r)try{t.initialFields=JSON.parse(r)}catch{}const o=this.getAttribute("design-data");o&&this._designData===void 0&&(this._designData=$l(o)),this.store=new Of(t),this.format=new Cv(this.store),this.store.onSelectionChanged=()=>this.format.painterSyncSelection(),this.readChrome(),this.unsub=this.store.subscribe(()=>this.repaint()),this.attachDocKeys(),this.attachPluginUI(),this.attachInstanceListeners(),this.applyFontFace(),this.repaint(),this.measureRaf=requestAnimationFrame(()=>{this.measureRaf=null,this.measureRuler()})}attachThemeMedia(){typeof window>"u"||typeof window.matchMedia!="function"||(this.detachThemeMedia(),this.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),this.systemDark=this.themeMedia.matches,this.themeMedia.addEventListener("change",this.onThemeMediaChange))}detachThemeMedia(){this.themeMedia?.removeEventListener("change",this.onThemeMediaChange),this.themeMedia=null}applyTheme(){const t=this.root.querySelector(".designer-container");if(!t)return;for(const o of this.appliedThemeTokens)t.style.removeProperty(o);if(this.appliedThemeTokens=[],(this._theme==="dark"||this._theme==="light"?this._theme:this.systemDark?"dark":"light")==="dark")for(const[o,i]of Object.entries(Nv))i!==void 0&&(t.style.setProperty(o,i),this.appliedThemeTokens.push(o));const r=this._themeConfig?.overrides;if(r)for(const[o,i]of Object.entries(r))!o.startsWith("--pd-")||typeof i!="string"||(t.style.setProperty(o,i),this.appliedThemeTokens.includes(o)||this.appliedThemeTokens.push(o))}readChrome(){this.state.leftCollapsed=lg(ag),this.state.propCollapsed=lg(sg),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,cg(ag,this.state.leftCollapsed),cg(sg,this.state.propCollapsed))}disconnectedCallback(){this.detachThemeMedia(),this.unsub?.(),this.unsub=null,this.unsubPluginUI?.(),this.unsubPluginUI=null,this.unsubDefinitions?.(),this.unsubDefinitions=null,gh(),this.detachDocKeys(),this.ro?.disconnect(),this.ro=null,this.roArea=null,this.toolbarRo?.disconnect(),this.toolbarRo=null,Gt.active===this&&(Gt.active=null),kh(),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=Mr(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=vv(()=>this.repaint())),this.unsubDefinitions||(this.unsubDefinitions=$f(()=>this.repaint()))}syncPluginUIStyles(){const t=new Map;for(const{type:n,ui:r}of yv())r.styles&&t.set(n,r.styles);for(const[n,r]of[...this.pluginStyleEls])t.has(n)||(r.remove(),this.pluginStyleEls.delete(n));for(const[n,r]of t){let o=this.pluginStyleEls.get(n);o||(o=document.createElement("style"),o.setAttribute("data-plugin-ui",n),this.root.appendChild(o),this.pluginStyleEls.set(n,o)),o.textContent!==r&&(o.textContent=r)}}templateJsonWithFonts(){const t=JSON.parse(this.store.getTemplateJson()),n=this.fonts;if(!n?.length)return t;if(Array.isArray(t.pages)){const r=t;return{...r,pages:r.pages.map(o=>({...o,fonts:[...n]}))}}return{...t,fonts:[...n]}}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 n=this.templateJsonWithFonts();if(Array.isArray(n.pages))try{ls(n)}catch(i){window.alert(i instanceof Error?i.message:String(i));return}const r=this.getGeometryWarnings();if(r.length&&!window.confirm(`出纸提示:部分内容超出纸面,打印时会被裁切。
|
|
1197
|
+
是否接受裁切并继续保存?
|
|
1198
|
+
点击“确定”继续保存,点击“取消”返回修改。
|
|
1199
|
+
|
|
1200
|
+
${r.join(`
|
|
1201
|
+
`)}`))return;const o=JSON.stringify(n);this.store.dirty=!1,this.repaint(),this.dispatchEvent(new CustomEvent(St.save,{detail:o,bubbles:!0,composed:!0}))}validateTemplate(){const t=this.store.templateData;return t.tiling?.enabled===!0?as(t):[]}getGeometryWarnings(){return d1(this.store.templateData)}applyTemplate(t){if(!t)return;const n=typeof t=="string"?JSON.parse(t):t;this.store?this.store.loadTemplate(n):this.setAttribute("template",JSON.stringify(n))}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 n=this.exprTarget;Ze(J2({fields:this.store.fields,onClose:()=>this.closeExpression(),onApply:r=>this.applyExpression(n,r)},n),this.root),this.exprMountedFor=n}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=nE(this.root,{initialTab:this.helpInitialTab,onClose:()=>this.closeHelp()});else if(!t&&this.unmountHelp){const n=this.unmountHelp;this.unmountHelp=null,n()}}applyExpression(t,n){const r=n.formatter??"",o=t.targetPath;if(o.startsWith("options.")){if(o.includes("[")){const a=this.store.elements.find(l=>l.id===t.elementId);a&&Ml(this.store,a,o,r);return}const i={[o.slice(8)]:r||void 0};n.title!==void 0&&(i.title=n.title),this.store.updateElement(t.elementId,i);return}if(o==="watermark.content"){const i={...this.store.templateData.watermark};Al(r)?Object.assign(i,{mode:"binding",binding:r,content:""}):Object.assign(i,{mode:"fixed",content:r,binding:""}),this.store.updateTemplateData({watermark:i})}}dblEditElement(t){const n=this.store.elements.find(o=>o.id===t);if(!n||(this.store.selectOne(t),this.state.propTab=Gs(n)?"custom":"element",n.options.locked))return;const r=Bf(n.printElementType.type);r&&this.openExpression({elementId:n.id,targetPath:`options.${r}`,value:String(n.options[r]??"")})}dblEditCell(t){const n=this.store.elements.find(l=>l.id===t.elementId);if(!n||(this.store.selectOne(n.id),this.state.propTab="element",n.options.locked))return;const r=n.options.tableRows??[],o=ar(r,t.r,t.c),a=r[o.r]?.cells[o.c];a&&this.openExpression({elementId:n.id,targetPath:`options.tableRows[${o.r}].cells[${o.c}].formatter`,value:a.formatter??""})}get ctx(){return{store:this.store,format:this.format,state:this.state,repaint:()=>this.repaint(),fire:(t,n)=>this.fire(t,n),showHelp:this.getAttribute("show-help")!=="false",showPreview:this.getAttribute("show-preview")!=="false",showSave:this.getAttribute("show-save")!=="false",isEdit:this.getAttribute("is-edit")==="true",host:{uploadImage:this.uploadImage,uploadDesignBackground:this.uploadDesignBackground,fonts:this.fonts,designData:this.designData,fields:this.store.fields}}}canvasUi(){return{geom:this.geom,marquee:this.marquee,contextMenu:this.menu,guidePreview:this.guidePreview,zoneResizing:this.zoneResizing,scrollX:this.scrollPos.x,scrollY:this.scrollPos.y}}repaint(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=0,this.paint()}))}paint(){if(!this.store)return;gh(),this.syncPluginUIStyles();const t=[...this.store.selectedIds].join(",");if(t!==this.lastSelKey){this.lastSelKey=t;const a=this.store.selectedElement;this.state.propTab=a?Gs(a)?"custom":"element":"page"}const n=this.root.querySelector(".designer-container");n.classList.toggle("format-painting",this.format.painterActive);for(const a of n.querySelectorAll("[data-pane]"))a.style.display!=="none"&&this.paneScroll.set(a.dataset.pane,a.scrollTop);kf(n);const r=this.ctx;Ze(aE(r,Zx(r)),n),Ze(o2(r),n),Ze(h("div",{class:"designer-body"},[Qx(r),Px(r,this.canvasUi()),z2(r)]),n),Ze(i2(r),n),tg(n),!this.toolbarRo&&typeof ResizeObserver<"u"&&(this.toolbarRo=new ResizeObserver(()=>tg(n)),this.toolbarRo.observe(n));const o=rx(this.store,(a,l)=>this.fire(a,l),this.tableMenu);o&&Ze(o,n),Cw(this.root,this.store.elements,this.designData),qh(this.root,this.state.propSearch),this.applyShrinkFit();const i=this.root.querySelector(".canvas-area");i&&(i.scrollLeft=this.scrollPos.x,i.scrollTop=this.scrollPos.y);for(const a of n.querySelectorAll("[data-pane]")){const l=this.paneScroll.get(a.dataset.pane);l!==void 0&&(a.scrollTop=l)}this.syncRulers(),this.persistChrome(),this.applyHostParts(n)}applyHostParts(t){const n={".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,o]of Object.entries(n)){const i=t.querySelector(r);i&&Ks.includes(o)&&i.setAttribute("part",o)}}applyShrinkFit(){for(const t of Array.from(this.root.querySelectorAll('[data-fit="shrink"]')))_f(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 n=t.getAttribute("data-fit-base");n?t.style.fontSize=`${n}pt`:t.style.removeProperty("font-size")}}measureRuler(){const t=this.root.querySelector(".canvas-area"),n=this.root.querySelector(".hiprint-printPaper");if(!t||!n)return;const r=t.getBoundingClientRect(),o=n.getBoundingClientRect(),i=(this.store.scale||100)/100,a=o.width/un(this.store.paperSize.width);this.geom={paperScale:Math.abs(a-i)<.002?i:a,originX:o.left-r.left-Ki,originY:o.top-r.top-Ki,viewW:t.clientWidth-Ki,viewH:t.clientHeight-Ki},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,n=Jt(t),r=this.geom.paperScale;for(const o of Array.from(this.root.querySelectorAll(".pd-ruler"))){const i=o.dataset.ruler==="vertical"?"vertical":"horizontal";sE(o,{orientation:i,geom:this.geom,scale:r,paperLengthMM:i==="horizontal"?n.width:n.height})}}patchElementDom(){for(const r of this.store.elements){const o=this.root.querySelector(`[data-el-id="${CSS.escape(r.id)}"]`);o&&(o.style.left=`${r.options.left}mm`,o.style.top=`${r.options.top}mm`,o.style.width=`${r.options.width}mm`,o.style.height=`${r.options.height}mm`)}const t=this.root.querySelector(".position-label"),n=this.store.selectedElement;t&&n&&!this.drag&&(t.textContent=Rh(n.options))}fire(t,n){const r=this.store;switch(t){case"undo":r.undo();break;case"redo":r.redo();break;case"align":r.alignSelected(n);break;case"move-layer":r.moveLayer(n);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+n);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(n>0?1:-1);break;case"preview":this.dispatchEvent(new CustomEvent(St.preview,{detail:this.getTemplateJson(),bubbles:!0,composed:!0}));break;case"save":this.save();break;case"help":this.dispatchEvent(new CustomEvent(St.help,{bubbles:!0,composed:!0})),this.openHelp(n);break;case"guide-remove":r.removeGuide(n);break;case"resize-start":this.beginResize(n);break;case"element-mousedown":{const o=n;o.event.button===0&&this.isDoubleTap(`el:${o.id}`,o.event)&&this.fire("element-dblclick",{event:o.event,id:o.id}),this.beginDrag(o);break}case"table-cell-mousedown":{const o=n;this.isDoubleTap(`cell:${o.elementId}:${o.r}:${o.c}`,o.event)&&(this.taps.delete(`el:${o.elementId}`),this.fire("table-cell-dblclick",{elementId:o.elementId,r:o.r,c:o.c,cellId:o.cellId}));break}case"zone-resize":this.beginZoneResize(n);break;case"guide-mousedown":this.beginGuideDrag(n);break;case"ruler-mousedown":this.beginRulerGuide(n);break;case"canvas-mousedown":this.onCanvasMouseDown(n);break;case"canvas-mousemove":this.onCanvasMouseMove(n);break;case"canvas-mouseleave":this.clearCoord();break;case"canvas-contextmenu":this.onContextMenu(n);break;case"contextmenu":this.onElementContextMenu(n);break;case"element-dblclick":{const{id:o}=n;this.dblEditElement(o),this.dispatchEvent(new CustomEvent(St.dblclickElement,{detail:o,bubbles:!0,composed:!0}));break}case"table-cell-dblclick":{const o=n;this.dblEditCell(o),this.dispatchEvent(new CustomEvent(St.dblclickCell,{detail:{elementId:o.elementId,r:o.r,c:o.c,cellId:o.cellId},bubbles:!0,composed:!0}));break}case"open-expression":this.openExpression(n);break;case"drop":this.onDrop(n);break;case"wheel":this.onWheel(n);break;case"scroll":this.onScroll();break}}onDrop(t){t.preventDefault();const n=t.dataTransfer,r=n?.getData("elementType"),o=n?.getData("fieldKey"),i=this.pointToPaperMm(t);if(!i)return;const a={x:i.left,y:i.top};if(r)this.store.addElement(r,{},a);else if(o){const l=this.store.fields.find(c=>c.fieldKey===o);l&&this.store.addFieldElement(l,{},a,t.ctrlKey||t.metaKey||t.labelIntent===!0)}}pointToPaperMm(t){const n=this.root.querySelector(".hiprint-printPaper");if(!n)return null;const r=n.getBoundingClientRect(),o=(this.store.scale||100)/100,i=uo((t.clientX-r.left)/o),a=uo((t.clientY-r.top)/o);return i<0||a<0?null:{left:i,top:a}}onCanvasMouseDown(t){const n=t.target;(n===this.root.querySelector(".canvas-area")||["canvas-scroll","hiprint-printPaper","hiprint-printPaper-content","zone-layer","grid-bg","watermark-layer"].some(o=>n.classList.contains(o)))&&(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 n=this.pointToPaperMm(t),r=this.root.querySelector("[data-coord]");if(r){if(!n){r.style.display="none";return}r.style.display="",r.textContent=`x:${(n.left-this.store.templateData.margins.left).toFixed(1)} y:${(n.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,n){this.menu.x=t.clientX,this.menu.y=t.clientY,this.menu.targetId=n,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 o=r.getBoundingClientRect();this.menu.flipX=o.right>window.innerWidth?window.innerWidth-o.right-8:0,this.menu.flipY=o.bottom>window.innerHeight?window.innerHeight-o.bottom-8:0,this.paint()})}startMarquee(t){const n={x:t.clientX,y:t.clientY},r=i=>{this.marquee={visible:!0,x:Math.min(n.x,i.clientX),y:Math.min(n.y,i.clientY),w:Math.abs(i.clientX-n.x),h:Math.abs(i.clientY-n.y)},this.paint()},o=()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o);const i={...this.marquee};if(this.marquee={visible:!1,x:0,y:0,w:0,h:0},i.w>2&&i.h>2){const a=this.store.elements.filter(l=>{const c=this.root.querySelector(`[data-el-id="${CSS.escape(l.id)}"]`);if(!c)return!1;const s=c.getBoundingClientRect();return s.left<i.x+i.w&&s.right>i.x&&s.top<i.y+i.h&&s.bottom>i.y});this.store.select(new Set(a.map(l=>l.id)))}else this.repaint()};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)}taps=new Map;isDoubleTap(t,n){const r=this.taps.get(t);return this.taps.set(t,{t:n.timeStamp,x:n.clientX,y:n.clientY}),!r||n.timeStamp-r.t>=500||Math.abs(n.clientX-r.x)>6||Math.abs(n.clientY-r.y)>6?!1:(this.taps.delete(t),!0)}beginDrag(t){const n=t.event;if(n.button!==0)return;const r=this.store;n.stopPropagation();const o=r.elements.find(l=>l.id===t.id);if(!o||(r.selectElement(o.id,n.ctrlKey||n.metaKey),o.options.locked))return;const i=n.altKey?[o.id]:r.dragIds(o.id),a=new Map;for(const l of i){const c=r.elements.find(s=>s.id===l);c&&a.set(l,{left:c.options.left,top:c.options.top})}this.drag={ids:i,primary:o.id,altKey:n.altKey,movedPositions:new Map,startX:n.clientX,startY:n.clientY,origin:a,zone:o.zone||"content",moved:!1},r.draggingIds=new Set(i),r.dragStart(),this.syncDragGhost()}syncDragGhost(){const t=this.store.draggingIds;for(const n of Array.from(this.root.querySelectorAll(".print-element"))){const r=t.has(n.dataset.elId??"");n.classList.toggle("drag-ghost",r);const o=n.querySelector(":scope > .drag-preview");r&&!o?Ze(h("div",{class:"drag-preview"}),n):!r&&o&&o.remove()}}finishAltClone(t){const n=this.store;n.adsorbGuides=[];const r=n.elements.find(a=>a.id===t.primary),o=t.movedPositions.get(t.primary);if(n.discardLive(),!r||!o)return;const i=JSON.parse(JSON.stringify(r));i.id=zn(),i.options.left=o.left,i.options.top=o.top,i.options.groupId=void 0,n.cloneElement(i)}flashSnapIndicator(t,n){const r=this.root.querySelector(".hiprint-printPaper-content");r&&(r.querySelector(".snap-indicator")?.remove(),Ze(h("div",{class:"snap-indicator",style:{left:`${t}mm`,top:`${n}mm`}}),r),this.snapTimer&&clearTimeout(this.snapTimer),this.snapTimer=setTimeout(()=>{r.querySelector(".snap-indicator")?.remove(),this.snapTimer=null},300))}beginResize(t){const n=t.event;n.stopPropagation();const r=this.store.elements.find(o=>o.id===t.id);!r||r.options.locked||(this.resize={id:t.id,point:t.point,startX:n.clientX,startY:n.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 n=t.event.clientY,r=this.store.templateData,o=t.zone==="header"?r.header.height:r.footer.height,i=(this.store.scale||100)/100,a=c=>{const s=uo((c.clientY-n)/i),d=Math.max(0,Math.round((o+(t.zone==="header"?s:-s))*10)/10);t.zone==="header"?this.store.updateTemplateData({header:{...r.header,height:d}}):this.store.updateTemplateData({footer:{...r.footer,height:d}}),this.paint()},l=()=>{window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",l),this.zoneResizing=null,this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",a),window.addEventListener("mouseup",l)}beginGuideDrag(t){const n=(this.store.templateData.guides??[]).find(d=>d.id===t.id);if(!n)return;const r=Jt(this.store.templateData),o=n.type==="vertical"?r.width:r.height,i=t.event.clientX,a=t.event.clientY,l=(this.store.scale||100)/100,c=d=>{const p=uo((n.type==="vertical"?d.clientX-i:d.clientY-a)/l);this.store.moveGuide(n.id,Math.min(o,Math.max(0,n.position+p))),this.paint()},s=()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s),this.store.recordHistory(),this.repaint()};window.addEventListener("mousemove",c),window.addEventListener("mouseup",s)}beginRulerGuide(t){const n=t.orientation==="horizontal"?"vertical":"horizontal",r=i=>{this.guidePreview={type:n,position:n==="vertical"?i.clientX:i.clientY},this.paint()},o=i=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o);const a=this.rulerPointToMM(i,n);this.guidePreview=null,a!==null?this.store.addGuide(n,a):this.repaint()};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)}rulerPointToMM(t,n){const r=this.root.querySelector(".hiprint-printPaper");if(!r)return null;const o=r.getBoundingClientRect(),i=un(1)*(this.geom.paperScale||1),a=n==="vertical"?(t.clientX-o.left)/i:(t.clientY-o.top)/i,l=Jt(this.store.templateData),c=n==="vertical"?l.width:l.height;return a<0||a>c?null:a}applyZoom(t,n,r,o){const i=this.root.querySelector(".canvas-area");if(!i)return;const a=Math.round(this.store.scale),l=Math.max(o,Math.round(t));if(l===a)return;const c=getComputedStyle(i),s=parseFloat(c.paddingLeft)||0,d=parseFloat(c.paddingTop)||0,p=i.scrollLeft+n-s,u=i.scrollTop+r-d,f=l/a;this.store.setScale(l,o),i.scrollLeft=p*f-n+s,i.scrollTop=u*f-r+d,this.scrollPos={x:i.scrollLeft,y:i.scrollTop}}zoomByStep(t){const n=this.root.querySelector(".canvas-area");n&&this.applyZoom(Yc(this.store.scale,t),n.clientWidth/2,n.clientHeight/2,So)}fitToWindow(){const t=this.root.querySelector(".canvas-area");if(!t)return;const n=getComputedStyle(t),r=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0),o=(parseFloat(n.paddingTop)||0)+(parseFloat(n.paddingBottom)||0),i=Jt(this.store.templateData),a=Dm(t.clientWidth-r,t.clientHeight-o,un(i.width),un(i.height));this.applyZoom(a,t.clientWidth/2,t.clientHeight/2,Vc)}onWheel(t){if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=this.root.querySelector(".canvas-area");if(!n)return;const r=Math.round(this.store.scale),o=Yc(r,t.deltaY>0?-1:1);if(o===r)return;const i=n.getBoundingClientRect();this.applyZoom(o,t.clientX-i.left,t.clientY-i.top,So)}onScroll(){const t=this.root.querySelector(".canvas-area");if(!t)return;this.scrollPos={x:t.scrollLeft,y:t.scrollTop};const n=this.root.querySelector(".ruler-overlay");n&&(n.style.transform=`translate(${this.scrollPos.x}px, ${this.scrollPos.y}px)`),this.syncRulers()}on(t,n,r,o){t.addEventListener(n,r,o),this.instanceDisposers.push(()=>t.removeEventListener(n,r,o))}attachInstanceListeners(){this.instanceDisposers.length||(this.bindPointer(),this.bindKeys(),this.bindPaneScroll())}bindPaneScroll(){this.on(this.root,"scroll",t=>{const n=t.target;if(!(n instanceof HTMLElement))return;const r=n.dataset.pane;r&&this.paneScroll.set(r,n.scrollTop)},!0)}bindPointer(){const t=a=>{const l=this.store;if(!l)return;const s=((l.scale||100)/100||1)*un(1),d=(p,u)=>({dx:p/s,dy:u/s});if(this.drag){const{dx:p,dy:u}=d(a.clientX-this.drag.startX,a.clientY-this.drag.startY);(Math.abs(p)>.05||Math.abs(u)>.05)&&(this.drag.moved=!0);const f=l.elements.find(k=>k.id===this.drag.primary),g=f&&We(f.options).margin,m=f&&g&&{id:f.id,left:(this.drag.origin.get(f.id)?.left??0)+p,top:(this.drag.origin.get(f.id)?.top??0)+u,width:g.width,height:g.height};let b=null;if(m&&l.snapToGrid!==!1){const k=l.elements.filter(P=>!this.drag.ids.includes(P.id)&&(P.zone||"content")===this.drag.zone).map(P=>({id:P.id,...We(P.options).margin})),L=gl(l.templateData,l.paperSize)[this.drag.zone],R=z1(m,k,this.manualGuides());b={left:R.left,top:R.top},l.adsorbGuides=(R.lines??[]).filter(P=>P.position>=0&&P.position<=(P.type==="vertical"?L.width:L.height)),(b.left!==m.left||b.top!==m.top)&&this.flashSnapIndicator(b.left+m.width/2,b.top+m.height/2)}else l.adsorbGuides=[];const v=f?this.drag.origin.get(f.id):void 0,w=b&&v?b.left-v.left:p,E=b&&v?b.top-v.top:u;for(const k of this.drag.ids){const L=this.drag.origin.get(k);if(!L)continue;const R={left:L.left+w,top:L.top+E};this.drag.movedPositions.set(k,R),l.livePatch(k,R)}this.patchElementDom(),l.adsorbGuides.length&&this.paintGuidesOnly()}else if(this.resize){const{dx:p,dy:u}=d(a.clientX-this.resize.startX,a.clientY-this.resize.startY),f=q1(this.resize.point,this.resize.origin,p,u,3.5,3.5);l.livePatch(this.resize.id,f),this.patchElementDom()}},n=()=>{const a=!!this.drag,l=this.drag;if(l?.moved&&l.altKey){this.finishAltClone(l),this.store.dragStop(),this.drag=null,this.store.draggingIds=new Set,this.repaint();return}this.drag?.moved||this.resize?(this.store.adsorbGuides=[],this.store.commitLive(),this.store.dragStop(),this.drag=null,this.resize=null,this.store.draggingIds=new Set,this.repaint()):(this.drag=null,this.store.dragStop(),a&&(this.store.draggingIds=new Set,this.syncDragGhost()))},r=a=>{const l=a.composedPath(),c=l.some(d=>d.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 s=l.some(d=>d.classList?.contains("context-menu"));this.menu.visible&&!s&&(this.menu.visible=!1,this.repaint())},o=a=>{const c=a.target?.closest?.("[data-tip]");!c||!c.closest(cE)||(this.hoverTipTimer&&clearTimeout(this.hoverTipTimer),this.hoverTipTimer=setTimeout(()=>this.showHoverTip(c),300))},i=a=>{const l=a,c=l.target?.closest?.("[data-tip]");c&&l.relatedTarget?.closest?.("[data-tip]")!==c&&this.hideHoverTip()};this.on(window,"mousemove",t),this.on(window,"mouseup",n),this.on(this,"pointerdown",r),this.on(this.root,"mouseover",o),this.on(this.root,"mouseout",i)}showHoverTip(t){const n=t.dataset.tip;if(!n)return;this.hideHoverTip();const r=t.getBoundingClientRect(),o=r.left+r.width/2;this.hoverTipEl=Ze(h("div",{class:"pd-hover-tip",style:{left:`${o}px`,top:`${r.bottom+6}px`},text:n}),this.root);const i=this.hoverTipEl.offsetWidth/2;if(!i)return;const a=i+8,l=Math.max(window.innerWidth-i-8,a);this.hoverTipEl.style.left=`${Math.min(Math.max(o,a),l)}px`}hideHoverTip(){this.hoverTipTimer&&(clearTimeout(this.hoverTipTimer),this.hoverTipTimer=null),this.hoverTipEl?.remove(),this.hoverTipEl=null}manualGuides(){const t=[],n=[];for(const r of this.store.templateData.guides??[])r.type==="vertical"?t.push(r.position):n.push(r.position);return{vertical:t,horizontal:n}}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 n=this.store.paperSize;gl(this.store.templateData,n);for(const r of this.store.adsorbGuides){const o=document.createElement("div");o.className=`adsorb-guide guide-${r.type}`,r.type==="vertical"?o.style.cssText=`left:${r.position}mm;top:0;height:${n.height}mm;border-left-color:${r.color||"var(--pd-accent-secondary, #f56c6c)"}`:o.style.cssText=`top:${r.position}mm;left:0;width:${n.width}mm;border-top-color:${r.color||"var(--pd-accent-secondary, #f56c6c)"}`,t.appendChild(o)}}bindKeys(){this.setAttribute("tabindex","0");const t=()=>{Gt.active=this};this.on(this,"pointerdown",t),this.on(this,"focusin",t),Gt.active||(Gt.active=this)}attachDocKeys(){this.docKeydown||(this.docKeydown=t=>this.onGlobalKeydown(t),document.addEventListener("keydown",this.docKeydown),this.docDragend=()=>$h(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 n=this.store;if(!n||Gt.active!==this)return;const o=t.composedPath()[0]?.tagName;if(o==="INPUT"||o==="TEXTAREA"||o==="SELECT")return;if(this.format.handlePainterKeydown(t),t.key.startsWith("Arrow")){t.preventDefault();const a=t.shiftKey?10:t.ctrlKey?.5:1,l=t.key==="ArrowLeft"?-a:t.key==="ArrowRight"?a:0,c=t.key==="ArrowUp"?-a:t.key==="ArrowDown"?a:0;n.moveSelected(l,c);return}if(t.key==="Delete"||t.key==="Backspace"){t.preventDefault(),n.deleteSelected();return}if(!(t.ctrlKey||t.metaKey))return;const i=t.key.toLowerCase();dE.has(i)&&(t.preventDefault(),i==="z"?t.shiftKey?n.redo():n.undo():i==="y"?n.redo():i==="a"?n.selectAll():i==="c"?n.copy():i==="x"?n.cutSelected():i==="v"?n.paste():i==="d"?n.duplicateSelected():i==="g"?t.shiftKey?n.ungroupSelected():n.groupSelected():i==="1"?n.resetZoom():i==="l"?n.alignSelected("left"):i==="r"?n.alignSelected("right"):i==="e"?n.alignSelected("vertical"):i==="t"?n.alignSelected("top"):i==="b"?n.alignSelected("bottom"):i==="0"&&this.fire("fit-window"))}}function dg(e="print-designer"){return customElements.get(e)||customElements.define(e,Gt),e}function uE(){return dg()}const pE=Object.freeze(Object.defineProperty({__proto__:null,BUILTIN_ELEMENT_CAPABILITIES:lr,BUILTIN_ELEMENT_DEFINITIONS:Ii,DesignerStore:Of,PRINT_DESIGNER_ATTRIBUTES:Ys,PRINT_DESIGNER_BOOLEAN_ATTRIBUTES:qf,PRINT_DESIGNER_CONTRACT_VERSION:Vs,PRINT_DESIGNER_EVENT:St,PRINT_DESIGNER_EVENTS:Vf,PRINT_DESIGNER_EVENT_OPTIONS:$v,PRINT_DESIGNER_METHODS:jf,PRINT_DESIGNER_PARTS:Ks,PRINT_DESIGNER_PROPERTY_NAMES:Gf,PRINT_DESIGNER_TAG:Uf,PRINT_DESIGNER_THEME_TOKENS:Wf,PrintDesignerElement:Gt,TILING_SINGLE_PAGE_TIP:Us,createDefaultTemplate:qr,definePrintDesigner:dg,getElementCapabilities:ut,getElementCapabilityTypes:oa,getElementDblEditableField:Bf,getElementDefinition:tn,getElementDefinitions:Lf,getElementLayerIcon:Hf,getElementPropertyGroup:zf,getHostContract:Xs,getMaterialElementDefinitions:Ff,registerAll:uE,registerElementCapabilities:jg,registerElementDefinition:Iv,registerElementRenderer:Pv,registerElementRenderers:Nf,resetElementCapabilities:Gg,resetElementDefinitions:Dv,serializePage:Cf,subscribeElementDefinitions:$f,toRuntimePool:qs},Symbol.toStringTag,{value:"Module"})),fE=17521,hE=20,eo={PRINTERS_LIST:"printers.list",PRINT_SUBMIT:"print.submit",PRINT_SUBMIT_HTML:"print.submitHtml",TEMPLATE_ATTACH:"template.attach",TEMPLATE_DETACH:"template.detach"};let Nl=0;function gE(){return Nl=(Nl+1)%Number.MAX_SAFE_INTEGER,`${Date.now().toString(36)}-${Nl.toString(36)}`}function ug(e,t){const n={id:gE(),type:e,payload:t};return JSON.stringify(n)}function pg(e){let t;try{t=JSON.parse(e)}catch{return{malformed:!0}}if(typeof t!="object"||t===null)return{malformed:!0};const n=t;if(typeof n.id!="string"||typeof n.ok!="boolean")return{malformed:!0};if(n.ok)return{id:n.id,ok:!0,payload:n.payload??{}};const r=n.error;return!r||typeof r.code!="string"||typeof r.message!="string"?{malformed:!0}:{id:n.id,ok:!1,error:{code:r.code,message:r.message}}}function mE(e){if(typeof e!="object"||e===null)return!1;const t=e;return!("ok"in t)&&typeof t.id=="string"&&typeof t.type=="string"&&typeof t.payload=="object"&&t.payload!==null}class Lt extends Error{constructor(t,n){super(n),this.name="WormPrintError",this.code=t}}function bE(e){return e instanceof Lt||e&&typeof e=="object"&&typeof e.code=="string"?e.code:"INTERNAL"}class fg extends Error{constructor(t){super(t),this.code="UNAUTHORIZED",this.name="AuthRejectedError"}}class yE{constructor(t={}){this.ws=null,this.status_="disconnected",this.hello=null,this.pendings=new Map,this.statusCbs=new Set,this.requestHandler=null,this.manualClose=!1,this.reconnectTimer=null,this.reconnectAttempts=0,this.opts=t,this.ctor=t.WebSocketCtor??WebSocket,this.defaultTimeout=t.timeoutMs??15e3}get status(){return this.status_}onStatus(t){return this.statusCbs.add(t),()=>this.statusCbs.delete(t)}setRequestHandler(t){this.requestHandler=t}setToken(t){this.opts={...this.opts,token:t}}async connect(t){if(this.status_==="connected"&&this.hello)return this.hello;this.setStatus("connecting");const n=this.opts.ports??Array.from({length:hE},(r,o)=>fE+o);for(const r of n){if(t?.aborted)throw new Lt("CLIENT_NOT_RUNNING","连接已取消");try{return this.hello=await this.tryPort(r,t),this.manualClose=!1,this.reconnectAttempts=0,this.setStatus("connected"),this.hello}catch(o){if(o instanceof fg)throw this.setStatus("disconnected"),new Lt("UNAUTHORIZED",o.message||"配对 token 无效或来源未授权")}}throw this.setStatus("disconnected"),new Lt("CLIENT_NOT_RUNNING","未发现运行中的打印客户端(已探测默认端口区间),请确认客户端已启动")}request(t,n,r){if(this.status_!=="connected"||!this.ws)return Promise.reject(new Lt("CLIENT_NOT_RUNNING","打印客户端未连接"));const o=ug(t,n),i=JSON.parse(o);return new Promise((a,l)=>{const c=setTimeout(()=>{this.pendings.delete(i.id),l(new Lt("CLIENT_TIMEOUT",`请求 ${t} 超时未响应`))},r??this.defaultTimeout);this.pendings.set(i.id,{resolve:a,reject:l,timer:c}),this.ws.send(o)})}close(){this.manualClose=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.ws?.close(),this.failAllPendings(new Lt("CLIENT_NOT_RUNNING","连接已关闭")),this.setStatus("disconnected")}buildUrl(t){const n=new URL(`ws://127.0.0.1:${t}`);return this.opts.token&&n.searchParams.set("token",this.opts.token),n.toString().replace(/\/$/,"")}tryPort(t,n){return new Promise((r,o)=>{const i=new this.ctor(this.buildUrl(t));this.ws=i;let a=!1;const l=()=>{a||(a=!0,o(new Error("aborted")))};n?.addEventListener("abort",l,{once:!0}),i.onopen=()=>{i.send(ug("hello",{}))},i.onmessage=c=>{const s=pg(String(c.data));if(!("malformed"in s))if(s.ok&&vE(s.payload)){if(a)return;a=!0,this.bindLifecycle(i),r(s.payload)}else if(!s.ok&&s.error.code==="UNAUTHORIZED"){if(a)return;a=!0,o(new fg(s.error.message))}else a||(a=!0,o(new Error("握手失败")))},i.onerror=()=>{a||(a=!0,o(new Error("连接错误")))},i.onclose=()=>{a||(a=!0,o(new Error("连接关闭")))}})}bindLifecycle(t){t.onmessage=n=>{this.handleIncoming(t,String(n.data))},t.onclose=()=>{this.failAllPendings(new Lt("CLIENT_NOT_RUNNING","与客户端的连接中断")),this.hello=null,this.ws=null,this.manualClose||this.scheduleReconnect()},t.onerror=()=>{}}handleIncoming(t,n){let r;try{r=JSON.parse(n)}catch{return}if(mE(r)){this.dispatchServerRequest(t,r);return}const o=pg(n);if("malformed"in o)return;const i=this.pendings.get(o.id);i&&(this.pendings.delete(o.id),clearTimeout(i.timer),o.ok?i.resolve(o.payload):i.reject(new Lt(o.error.code,o.error.message)))}dispatchServerRequest(t,n){const r=this.requestHandler;if(!r){this.safeSend(t,n.id,!1,void 0,"INVALID_REQUEST","桌面端请求未注册处理器");return}Promise.resolve().then(()=>r(n.type,n.payload)).then(o=>this.safeSend(t,n.id,!0,o??{})).catch(o=>{const i=bE(o),a=o instanceof Error?o.message:String(o);this.safeSend(t,n.id,!1,void 0,i,a)})}safeSend(t,n,r,o,i,a){t.readyState===1&&t.send(JSON.stringify(r?{id:n,ok:r,payload:o}:{id:n,ok:r,error:{code:i??"INTERNAL",message:a??"内部错误"}}))}scheduleReconnect(){this.setStatus("connecting");const t=Math.min(1e3*2**this.reconnectAttempts++,1e4);this.reconnectTimer=setTimeout(()=>{this.connect().catch(()=>this.scheduleReconnect())},t)}failAllPendings(t){for(const[,n]of this.pendings)clearTimeout(n.timer),n.reject(t);this.pendings.clear()}setStatus(t){if(this.status_!==t){this.status_=t;for(const n of this.statusCbs)n(t)}}}function vE(e){return typeof e=="object"&&e!==null&&e.app==="worm-print-client"}const hg="worm-print-client:token";class Ll{constructor(t={}){const r={token:t.token??Ll.loadStoredToken()??void 0,timeoutMs:t.timeoutMs,WebSocketCtor:t.WebSocketCtor};this.transport=new yE(r)}get status(){return this.transport.status}connect(t){return this.transport.connect(t)}onStatusChange(t){return this.transport.onStatus(t)}setRequestHandler(t){this.transport.setRequestHandler(t)}async listPrinters(){return(await this.transport.request(eo.PRINTERS_LIST,{})).printers}request(t,n,r){return this.transport.request(t,n,r)}attachTemplate(t){return this.request(eo.TEMPLATE_ATTACH,t)}detachTemplate(t){return this.request(eo.TEMPLATE_DETACH,{sessionId:t})}print(t,n,r={},o){const{baseUrl:i,fontBaseUrl:a,timeoutMs:l,...c}=r,s={templateJson:t,printData:n,baseUrl:i,fontBaseUrl:a,print:c};return typeof o=="string"&&o.trim().length>0&&(s.templateName=o),this.transport.request(eo.PRINT_SUBMIT,s,l)}printHtml(t,n={},r){const{timeoutMs:o,...i}=n,a={html:t.html,paperMm:t.paperMm,pagePaperMm:t.pagePaperMm,continuous:t.continuous,pageCount:t.pageCount,print:i};return typeof r=="string"&&r.trim().length>0&&(a.templateName=r),this.transport.request(eo.PRINT_SUBMIT_HTML,a,o)}pair(t){localStorage.setItem(hg,t),this.transport.setToken(t)}static loadStoredToken(){try{return localStorage.getItem(hg)}catch{return null}}close(){this.transport.close()}}const wE={...pE,renderHtmlPages:mv,browserCodeRenderer:Ls,PrintClient:Ll,WormPrintError:Lt,getPaperDimensions:ht,isContinuousPaperSize:Fn,getByPath:Er,resolvePrinterDpi:t0,paperWidthPx:n0,zoomPresets:o0,defaultZoomKey:od,resolveZoomKey:s0,zoomValueOf:l0,viewZoomHint:i0,applyPreviewViewZoom:a0,resolveToolbarOverflow:Kc};globalThis.WormPrintCanvas??=wE}));
|