@eigenpal/docx-editor-core 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.mts +5 -4
- package/dist/agent/index.d.ts +5 -4
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/anchoredObjectPosition-CS-8BfhO.d.ts +48 -0
- package/dist/anchoredObjectPosition-KJEyF-wr.d.mts +48 -0
- package/dist/{chunk-U4WUDHDK.js → chunk-2SGJZYQF.js} +1 -1
- package/dist/chunk-3ANZ3252.mjs +2 -0
- package/dist/chunk-3G44SFHX.mjs +4 -0
- package/dist/{chunk-4QEETB7U.js → chunk-3QPKTG2Y.js} +2 -2
- package/dist/chunk-3R7QHNI5.js +2 -0
- package/dist/chunk-4GFTMGSV.mjs +1 -0
- package/dist/chunk-4MYKVWNF.js +1 -0
- package/dist/chunk-4RTVLMRZ.js +2 -0
- package/dist/chunk-55XWETY4.mjs +1 -0
- package/dist/chunk-6QO4O52Y.mjs +1 -0
- package/dist/{chunk-THLJYXFB.js → chunk-6V3SFHEM.js} +1 -1
- package/dist/{chunk-6ZXL3EIP.mjs → chunk-7CZEZ3UL.mjs} +1 -1
- package/dist/{chunk-Z5MJYQSD.mjs → chunk-7UZJ5YDF.mjs} +1 -1
- package/dist/{chunk-BXWOLARZ.js → chunk-APNMO5JT.js} +1 -1
- package/dist/{chunk-KZXZWGFX.mjs → chunk-B46V5G46.mjs} +1 -1
- package/dist/chunk-BH3ACQ3M.js +59 -0
- package/dist/chunk-BUCOTKYY.js +1 -0
- package/dist/{chunk-5BLQHXWK.mjs → chunk-CDXCFHOY.mjs} +1 -1
- package/dist/chunk-CHN26LLL.mjs +59 -0
- package/dist/chunk-CZSAC65M.js +2 -0
- package/dist/chunk-D3PRIF3Y.mjs +1 -0
- package/dist/chunk-DE2V4X3B.mjs +1 -0
- package/dist/{chunk-7BVHKWEW.mjs → chunk-DFUWJHKF.mjs} +1 -1
- package/dist/{chunk-UGV4KRQB.js → chunk-DG2CMDSM.js} +1 -1
- package/dist/chunk-DKKTY56Q.js +1 -0
- package/dist/chunk-FIGLFSNR.js +1 -0
- package/dist/{chunk-AMB6Y77B.js → chunk-FQS436KN.js} +1 -1
- package/dist/chunk-FYRJTDC4.mjs +2 -0
- package/dist/chunk-GYWTUUXX.mjs +2 -0
- package/dist/chunk-HPJBZL37.mjs +1 -0
- package/dist/chunk-INDYZOOS.js +1 -0
- package/dist/chunk-IUVQJ6PX.mjs +1 -0
- package/dist/chunk-J3YFJDZD.js +1 -0
- package/dist/chunk-JHTURDPX.mjs +1 -0
- package/dist/{chunk-D62KS7QG.mjs → chunk-LAJPGQEE.mjs} +1 -1
- package/dist/chunk-LERLET2D.js +4 -0
- package/dist/chunk-LX35TFGF.mjs +1 -0
- package/dist/{chunk-BOOHU5EW.mjs → chunk-MOCGHQ4A.mjs} +1 -1
- package/dist/chunk-NAFMAKLK.js +2 -0
- package/dist/chunk-NRWQ65NX.js +1 -0
- package/dist/chunk-OTHV7YV2.js +2 -0
- package/dist/chunk-QLAIOTQB.js +1 -0
- package/dist/{chunk-U4XMGWF7.js → chunk-RAWVGULQ.js} +1 -1
- package/dist/chunk-RQVHKDXK.js +2 -0
- package/dist/chunk-RSU4HTC6.js +1 -0
- package/dist/{chunk-E4JMCA5X.js → chunk-SCK6ZM5V.js} +2 -2
- package/dist/chunk-SWBLJF6R.mjs +2 -0
- package/dist/chunk-UE2ZKRYB.mjs +2 -0
- package/dist/chunk-VOCHZNOF.mjs +1 -0
- package/dist/{chunk-OEXVWIHW.mjs → chunk-W77JXDEV.mjs} +1 -1
- package/dist/chunk-W7CQRQZ6.mjs +1 -0
- package/dist/chunk-WWBNJ7KF.js +1 -0
- package/dist/chunk-WWNOXNEX.mjs +2 -0
- package/dist/chunk-YGWUKRFD.mjs +1 -0
- package/dist/chunk-YM7SMTYY.js +1 -0
- package/dist/{chunk-QKLY4F2J.mjs → chunk-YNUPP7UG.mjs} +1 -1
- package/dist/chunk-YPKIQMPR.js +1 -0
- package/dist/{chunk-HQPWFUP5.js → chunk-Z3LGMBJC.js} +1 -1
- package/dist/{colorResolver-BZ_yScf4.d.ts → colorResolver-8A-qj-LP.d.ts} +1 -1
- package/dist/{colorResolver-C6DtsoFI.d.mts → colorResolver-BCvxTlLF.d.mts} +1 -1
- package/dist/{content-CE-ZdMwG.d.mts → content-3xF4WDE8.d.mts} +51 -7
- package/dist/{content-CYXJ2tfQ.d.ts → content-C8fc_tL6.d.ts} +51 -7
- package/dist/{contentControlValues-gyVPsi6m.d.ts → contentControlValues-DGDKD589.d.ts} +1 -1
- package/dist/{contentControlValues-DAwTWfgR.d.mts → contentControlValues-DjWvoJQ-.d.mts} +1 -1
- package/dist/core-plugins.d.mts +6 -5
- package/dist/core-plugins.d.ts +6 -5
- package/dist/core-plugins.js +1 -1
- package/dist/core-plugins.mjs +1 -1
- package/dist/core.d.mts +12 -11
- package/dist/core.d.ts +12 -11
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{documentStyles-DToJv9co.d.ts → documentStyles-C7k_8Sye.d.ts} +1 -1
- package/dist/{documentStyles-D87dxl18.d.mts → documentStyles-qR0VR2s0.d.mts} +1 -1
- package/dist/docx/index.d.mts +3 -2
- package/dist/docx/index.d.ts +3 -2
- package/dist/docx/index.js +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/parser.d.mts +3 -2
- package/dist/docx/parser.d.ts +3 -2
- package/dist/docx/parser.js +1 -1
- package/dist/docx/parser.mjs +1 -1
- package/dist/docx/rezip.d.mts +3 -2
- package/dist/docx/rezip.d.ts +3 -2
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/rezip.mjs +1 -1
- package/dist/docx/serializer/index.d.mts +42 -4
- package/dist/docx/serializer/index.d.ts +42 -4
- package/dist/docx/serializer/index.js +1 -1
- package/dist/docx/serializer/index.mjs +1 -1
- package/dist/editor/index.d.mts +128 -0
- package/dist/editor/index.d.ts +128 -0
- package/dist/editor/index.js +1 -0
- package/dist/editor/index.mjs +1 -0
- package/dist/{fontLoader-Z7pqeNvZ.d.mts → fontLoader-CUS1BPv7.d.mts} +1 -1
- package/dist/{fontLoader-Cm02v7PO.d.ts → fontLoader-Dl9SEKex.d.ts} +1 -1
- package/dist/{footnotes-lCH_P3N3.d.mts → footnotes-BZ24OTAT.d.mts} +25 -2
- package/dist/{footnotes-skVvEHvZ.d.ts → footnotes-DMsicPGd.d.ts} +25 -2
- package/dist/{headerFooterLayout-Bd58Tum3.d.ts → headerFooterLayout-AtAOhM8E.d.ts} +22 -6
- package/dist/{headerFooterLayout-CuIJiIzi.d.mts → headerFooterLayout-CU6hvszp.d.mts} +22 -6
- package/dist/headless.d.mts +47 -11
- package/dist/headless.d.ts +47 -11
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/layout-bridge/clickToPositionDom.d.mts +26 -1
- package/dist/layout-bridge/clickToPositionDom.d.ts +26 -1
- package/dist/layout-bridge/clickToPositionDom.js +1 -1
- package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +134 -8
- package/dist/layout-bridge/index.d.ts +134 -8
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +7 -75
- package/dist/layout-bridge/measuring/index.d.ts +7 -75
- package/dist/layout-bridge/measuring/index.js +1 -1
- package/dist/layout-bridge/measuring/index.mjs +1 -1
- package/dist/layout-bridge/tableInsertHover.js +1 -1
- package/dist/layout-bridge/tableInsertHover.mjs +1 -1
- package/dist/layout-bridge/toFlowBlocks.d.mts +3 -2
- package/dist/layout-bridge/toFlowBlocks.d.ts +3 -2
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.d.mts +16 -3
- package/dist/layout-engine/index.d.ts +16 -3
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-engine/types.d.mts +22 -1
- package/dist/layout-engine/types.d.ts +22 -1
- package/dist/layout-painter/index.d.mts +7 -5
- package/dist/layout-painter/index.d.ts +7 -5
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +15 -6
- package/dist/layout-painter/renderPage.d.ts +15 -6
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/managers/AutoSaveManager.d.mts +3 -2
- package/dist/managers/AutoSaveManager.d.ts +3 -2
- package/dist/managers/TableSelectionManager.d.mts +3 -2
- package/dist/managers/TableSelectionManager.d.ts +3 -2
- package/dist/managers/types.d.mts +3 -2
- package/dist/managers/types.d.ts +3 -2
- package/dist/mcp-cli.mjs +23 -23
- package/dist/mcp.d.mts +4 -3
- package/dist/mcp.d.ts +4 -3
- package/dist/mcp.js +3 -3
- package/dist/mcp.mjs +2 -2
- package/dist/measureBlocksPipeline-BMqbRFQB.d.mts +96 -0
- package/dist/measureBlocksPipeline-iYNzAH-o.d.ts +96 -0
- package/dist/{nodes-BNkRKBBX.d.ts → nodes-75Q9GBxV.d.ts} +1 -1
- package/dist/{nodes-Bz-UHhLE.d.mts → nodes-cEI7hVY2.d.mts} +1 -1
- package/dist/prosemirror/applyFormatting.d.mts +67 -0
- package/dist/prosemirror/applyFormatting.d.ts +67 -0
- package/dist/prosemirror/applyFormatting.js +1 -0
- package/dist/prosemirror/applyFormatting.mjs +1 -0
- package/dist/prosemirror/commands/formatting.js +1 -1
- package/dist/prosemirror/commands/formatting.mjs +1 -1
- package/dist/prosemirror/commands/index.d.mts +20 -1
- package/dist/prosemirror/commands/index.d.ts +20 -1
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/index.mjs +1 -1
- package/dist/prosemirror/commands/paragraph.js +1 -1
- package/dist/prosemirror/commands/paragraph.mjs +1 -1
- package/dist/prosemirror/commentIdAllocator.d.mts +50 -0
- package/dist/prosemirror/commentIdAllocator.d.ts +50 -0
- package/dist/prosemirror/commentIdAllocator.js +1 -0
- package/dist/prosemirror/commentIdAllocator.mjs +1 -0
- package/dist/prosemirror/commentOps.d.mts +46 -0
- package/dist/prosemirror/commentOps.d.ts +46 -0
- package/dist/prosemirror/commentOps.js +1 -0
- package/dist/prosemirror/commentOps.mjs +1 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +3 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +3 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
- package/dist/prosemirror/conversion/index.d.mts +3 -2
- package/dist/prosemirror/conversion/index.d.ts +3 -2
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/editor.css +12 -2
- package/dist/prosemirror/extensions/index.js +1 -1
- package/dist/prosemirror/extensions/index.mjs +1 -1
- package/dist/prosemirror/imageCommit.d.mts +35 -0
- package/dist/prosemirror/imageCommit.d.ts +35 -0
- package/dist/prosemirror/imageCommit.js +1 -0
- package/dist/prosemirror/imageCommit.mjs +1 -0
- package/dist/prosemirror/index.d.mts +6 -5
- package/dist/prosemirror/index.d.ts +6 -5
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/index.mjs +1 -1
- package/dist/prosemirror/paraText.d.mts +52 -0
- package/dist/prosemirror/paraText.d.ts +52 -0
- package/dist/prosemirror/paraText.js +1 -0
- package/dist/prosemirror/paraText.mjs +1 -0
- package/dist/prosemirror/plugins/index.d.mts +4 -3
- package/dist/prosemirror/plugins/index.d.ts +4 -3
- package/dist/prosemirror/queries.d.mts +65 -0
- package/dist/prosemirror/queries.d.ts +65 -0
- package/dist/prosemirror/queries.js +2 -0
- package/dist/prosemirror/queries.mjs +2 -0
- package/dist/prosemirror/schema/index.d.mts +3 -2
- package/dist/prosemirror/schema/index.d.ts +3 -2
- package/dist/prosemirror/schema/index.js +1 -1
- package/dist/prosemirror/schema/index.mjs +1 -1
- package/dist/prosemirror/styles/index.d.mts +1 -1
- package/dist/prosemirror/styles/index.d.ts +1 -1
- package/dist/prosemirror/tableResize.d.mts +58 -0
- package/dist/prosemirror/tableResize.d.ts +58 -0
- package/dist/prosemirror/tableResize.js +1 -0
- package/dist/prosemirror/tableResize.mjs +1 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +2 -1
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +2 -1
- package/dist/{registry-Cpyybgij.d.mts → registry-NLnxX7pq.d.mts} +1 -1
- package/dist/{registry-E5pahPKL.d.ts → registry-egK81C_z.d.ts} +1 -1
- package/dist/sectionPropertiesSerializer-D86QlzlT.d.mts +59 -0
- package/dist/sectionPropertiesSerializer-uXyGONxu.d.ts +59 -0
- package/dist/{styles-EI2lxeEN.d.mts → styles-BOJ93SAm.d.mts} +1 -1
- package/dist/{styles-BBv7doYK.d.ts → styles-BWqX2AS-.d.ts} +1 -1
- package/dist/types/content.d.mts +2 -1
- package/dist/types/content.d.ts +2 -1
- package/dist/types/content.js +1 -1
- package/dist/types/content.mjs +1 -0
- package/dist/types/document.d.mts +17 -6
- package/dist/types/document.d.ts +17 -6
- package/dist/types/document.js +1 -1
- package/dist/types/document.mjs +1 -0
- package/dist/{types-DXG7vqe9.d.ts → types-DDQWU7-j.d.ts} +1 -1
- package/dist/{types-dYdjUZMo.d.mts → types-DTF0N7UE.d.mts} +1 -1
- package/dist/utils/autoScroll.d.mts +24 -0
- package/dist/utils/autoScroll.d.ts +24 -0
- package/dist/utils/autoScroll.js +1 -0
- package/dist/utils/autoScroll.mjs +1 -0
- package/dist/utils/comments.d.mts +2 -1
- package/dist/utils/comments.d.ts +2 -1
- package/dist/utils/index.d.mts +5 -4
- package/dist/utils/index.d.ts +5 -4
- package/dist/{variableDetector-HPZbJ_gw.d.ts → variableDetector-1mxzPfs2.d.ts} +1 -1
- package/dist/{variableDetector-C7BLz9sJ.d.mts → variableDetector-CaY-sDau.d.mts} +1 -1
- package/dist/watermark-DAcnAs_J.d.mts +77 -0
- package/dist/watermark-DAcnAs_J.d.ts +77 -0
- package/package.json +73 -1
- package/dist/chunk-2EQGBVPV.js +0 -2
- package/dist/chunk-44FHVKSI.js +0 -1
- package/dist/chunk-44JKHPGF.mjs +0 -2
- package/dist/chunk-5M7TI6TV.js +0 -1
- package/dist/chunk-6Y6LON6Y.mjs +0 -1
- package/dist/chunk-7RDCZLTU.js +0 -1
- package/dist/chunk-7ZN4WI5N.mjs +0 -4
- package/dist/chunk-CCPBNE2F.mjs +0 -2
- package/dist/chunk-DV6GWBUJ.js +0 -2
- package/dist/chunk-EQAORQC3.mjs +0 -1
- package/dist/chunk-FYKRDDKG.js +0 -1
- package/dist/chunk-GUQFNJHE.mjs +0 -1
- package/dist/chunk-ICE6NC3S.mjs +0 -1
- package/dist/chunk-IFUED5ZS.mjs +0 -1
- package/dist/chunk-KGTEBLB6.js +0 -1
- package/dist/chunk-KRN6YSR2.mjs +0 -1
- package/dist/chunk-L72YAV5N.js +0 -3
- package/dist/chunk-LTHT4A4S.js +0 -1
- package/dist/chunk-MERJFGEP.mjs +0 -59
- package/dist/chunk-MP4QSEO2.mjs +0 -1
- package/dist/chunk-PVAVS3IU.js +0 -1
- package/dist/chunk-QYF7BRG3.js +0 -2
- package/dist/chunk-RKDVY7I3.mjs +0 -1
- package/dist/chunk-ROG4MNOR.js +0 -4
- package/dist/chunk-SORYYVJ7.js +0 -1
- package/dist/chunk-SZIOF5SG.js +0 -59
- package/dist/chunk-VMRUBLPI.js +0 -1
- package/dist/chunk-WKUHYMDO.mjs +0 -1
- package/dist/chunk-WLDI6N3B.mjs +0 -3
- package/dist/chunk-WLHNIXWC.mjs +0 -2
- package/dist/chunk-YMZ3F2FZ.mjs +0 -1
- package/dist/chunk-ZBFNOJGY.js +0 -1
- package/dist/documentSerializer-Bghq9rFI.d.mts +0 -36
- package/dist/documentSerializer-C4lFC60P.d.ts +0 -36
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c as c$2}from'./chunk-B46V5G46.mjs';import {c,f,a as a$2,g,b,e as e$1}from'./chunk-55XWETY4.mjs';import {v,w,x,U as U$1,I,J as J$1,K,t,z as z$1,b as b$1}from'./chunk-JHTURDPX.mjs';import {a as a$1,c as c$3}from'./chunk-7E5VBRDL.mjs';import {x as x$1}from'./chunk-3G44SFHX.mjs';import {c as c$1}from'./chunk-IUVQJ6PX.mjs';import {c as c$4}from'./chunk-MOKKS75W.mjs';import {a}from'./chunk-AMENZY5F.mjs';import {e,i}from'./chunk-VW22RZ6C.mjs';function et(e,t,n,o,r){let a=new Map,i=[];for(let m of e.fragments){let s=o(m);if(s.length===0||!("height"in m))continue;let y=m.y-e.margins.top,g=y+m.height;s.forEach((u,E)=>{let b=`${E}:${u.id}`,f=a.get(b);f?(f.top=Math.min(f.top,y),f.bottom=Math.max(f.bottom,g)):(a.set(b,{group:u,depth:E,top:y,bottom:g}),i.push(b));});}let d=2,l=[];for(let m of i){let{group:s,depth:y,top:g,bottom:u}=a.get(m),E=y*(d+1),b=r.createElement("div");b.className="layout-block-sdt-box",b.dataset.sdtGroupId=s.id,b.dataset.sdtType=s.sdtType,b.dataset.sdtDepth=String(y+1),s.tag!=null&&(b.dataset.sdtTag=s.tag),s.alias!=null&&(b.dataset.sdtAlias=s.alias),s.lock!=null&&(b.dataset.sdtLock=s.lock),b.style.position="absolute",b.style.left=`${E}px`,b.style.top=`${g-d}px`,b.style.width=`${n-E*2}px`,b.style.height=`${u-g+d*2}px`;let f=s.alias||s.tag||s.sdtType;if(f){let F=r.createElement("span");F.className="layout-block-sdt-label",F.textContent=f,b.appendChild(F);}let w=wt(s.sdtType);if(w&&s.tag!=null&&!s.bound&&s.lock!=="contentLocked"&&s.lock!=="sdtContentLocked"){let F=r.createElement("button");F.type="button",F.className="layout-sdt-widget",F.dataset.sdtWidget=w,F.dataset.sdtTag=s.tag,F.dataset.sdtGroupId=s.id,F.setAttribute("aria-label",`${w} control ${s.alias||s.tag}`),w==="dropdown"?F.setAttribute("aria-haspopup","listbox"):w==="date"&&F.setAttribute("aria-haspopup","dialog"),F.textContent=w==="dropdown"?"\u25BE":w==="date"?"\u{1F4C5}":s.checked?"\u2612":"\u2610",b.appendChild(F);}if(s.repeatingItem&&!s.bound){let F=r.createElement("div");F.className="layout-sdt-repeat-controls";for(let c of ["add","remove"]){let x=r.createElement("button");x.type="button",x.className="layout-sdt-repeat-btn",x.dataset.sdtRepeat=c,x.dataset.sdtGroupId=s.id,x.setAttribute("aria-label",c==="add"?"Add item":"Remove item"),x.textContent=c==="add"?"\uFF0B":"\u2715",F.appendChild(x);}b.appendChild(F);}t.appendChild(b),l.push(b);}Tt(t,l);}function wt(e){return e==="checkbox"?"checkbox":e==="dropDownList"||e==="comboBox"?"dropdown":e==="date"?"date":null}function Tt(e,t){if(t.length===0||typeof e.addEventListener!="function")return;let n=(d,l)=>{for(let m of t){let s=m.getBoundingClientRect(),y=d>=s.left&&d<=s.right&&l>=s.top&&l<=s.bottom;y!==m.classList.contains("is-active")&&m.classList.toggle("is-active",y);}},o=typeof requestAnimationFrame=="function"?requestAnimationFrame:d=>d(),r=false,a=0,i=0;e.addEventListener("mousemove",d=>{a=d.clientX,i=d.clientY,!r&&(r=true,o(()=>{r=false,n(a,i);}));}),e.addEventListener("mouseleave",()=>{for(let d of t)d.classList.remove("is-active");});}function xn(e,t,n){let o=new Set,r=e.content.size,a=i=>{let d=e.resolve(Math.max(0,Math.min(i,r)));for(let l=1;l<=d.depth;l++)d.node(l).type.name==="blockSdt"&&o.add(`sdt@${d.before(l)}`);};return a(t),n!==t&&a(n),o}function Sn(e,t){let n=e.querySelectorAll(".layout-block-sdt-box");for(let o of n){let r=o.dataset.sdtGroupId,a=r!=null&&t.has(r);a!==o.classList.contains("is-focused")&&o.classList.toggle("is-focused",a);}}var U={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image",line:"layout-line",run:"layout-run"};function It(e){return e.kind==="paragraph"}function Ft(e){return e.kind==="table"}function Ct(e){return e.kind==="image"}function pe(e){e.style.position="absolute",e.style.overflow="hidden";}function Rt(e,t,n){let o=n.createElement("div");return o.className=`${U.fragment} ${U.paragraph}`,pe(o),o.dataset.blockId=String(e.blockId),o.dataset.fromLine=String(e.fromLine),o.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(o.dataset.continuesFromPrev="true"),e.continuesOnNext&&(o.dataset.continuesOnNext="true"),o}function Et(e,t,n){let o=n.createElement("div");return o.className=`${U.fragment} ${U.table}`,pe(o),o.dataset.blockId=String(e.blockId),o.dataset.fromRow=String(e.fromRow),o.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),o}function Lt(e,t,n){let o=n.createElement("div");return o.className=`${U.fragment} ${U.image}`,pe(o),o.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(o.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(o.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(o.dataset.anchored="true"),e.zIndex!==void 0&&(o.style.zIndex=String(e.zIndex)),o}function Ie(e,t,n={}){let o=n.document??document;if(It(e))return Rt(e,t,o);if(Ft(e))return Et(e,t,o);if(Ct(e))return Lt(e,t,o);let r=o.createElement("div");r.className=U.fragment,pe(r);let a=e;return a.blockId!==void 0&&(r.dataset.blockId=String(a.blockId)),a.kind&&(r.dataset.kind=a.kind),r}var B={fragment:"layout-paragraph",line:"layout-line",run:"layout-run",text:"layout-run-text",tab:"layout-run-tab",image:"layout-run-image",lineBreak:"layout-run-linebreak"};function z(e){return e.kind==="text"}function D(e){return e.kind==="tab"}function G(e){return e.kind==="image"}function Y(e){return e.kind==="lineBreak"}function X(e){return e.kind==="field"}var tt={image:"layout-image",imageAnchored:"layout-image-anchored"};function ne(e){return !!(e.cropTop||e.cropRight||e.cropBottom||e.cropLeft||e.opacity!=null&&e.opacity<1)}function oe(e,t){let n=t.cropTop??0,o=t.cropRight??0,r=t.cropBottom??0,a=t.cropLeft??0;(n||o||r||a)&&(e.style.clipPath=`inset(${n*100}% ${o*100}% ${r*100}% ${a*100}%)`),t.opacity!=null&&t.opacity<1&&(e.style.opacity=String(Math.max(0,t.opacity)));}function Z(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");i.className=tt.image,e.isAnchored&&i.classList.add(tt.imageAnchored),i.style.position="absolute",i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.overflow="hidden",e.zIndex!==void 0&&(i.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(i.style.zIndex="-1"),i.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(i.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(i.dataset.pmEnd=String(e.pmEnd));let d=a.createElement("img");if(d.src=t.src,d.alt=t.alt??"",d.style.width="100%",d.style.height="100%",d.style.objectFit="contain",d.style.display="block",t.transform&&(d.style.transform=t.transform),d.draggable=false,t.hlinkHref){let l=a.createElement("a");l.href=t.hlinkHref,l.target="_blank",l.rel="noopener noreferrer",l.style.display="block",l.style.width="100%",l.style.height="100%",l.appendChild(d),i.appendChild(l);}else i.appendChild(d);return i}function vt(e,t,n){if(t.fontFamily&&(e.style.fontFamily=a(t.fontFamily).cssFallback),t.fontSize){let r=t.fontSize*96/72;e.style.fontSize=`${r}px`;}if(t.bold&&(e.style.fontWeight="bold"),t.italic&&(e.style.fontStyle="italic"),t.color&&(e.style.color=t.color),t.letterSpacing&&(e.style.letterSpacing=`${t.letterSpacing}px`),t.allCaps&&(e.style.textTransform="uppercase"),t.smallCaps&&(e.style.fontVariant="small-caps"),t.positionPx&&(e.style.verticalAlign=`${t.positionPx}px`),t.horizontalScale&&t.horizontalScale!==100&&(e.style.display="inline-block",e.style.transform=`scaleX(${t.horizontalScale/100})`,e.style.transformOrigin="left center"),t.kerningMinPt&&t.kerningMinPt>0&&(t.fontSize??11)>=t.kerningMinPt&&(e.style.fontKerning="normal"),t.emboss&&(e.style.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),t.imprint&&(e.style.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),t.textShadow&&!t.emboss&&!t.imprint&&(e.style.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),t.textOutline&&(e.style.webkitTextStroke="1px currentColor",e.style.webkitTextFillColor="transparent"),t.emphasisMark){let r=t.emphasisMark==="comma"?"filled sesame":t.emphasisMark==="circle"?"filled circle":"filled dot",a=t.emphasisMark==="underDot"?"under right":"over right";e.style.textEmphasis=`${r}`,e.style.textEmphasisPosition=a,e.style.webkitTextEmphasis=r,e.style.webkitTextEmphasisPosition=a;}t.highlight&&(e.style.backgroundColor=t.highlight);let o=[];if(t.underline&&(o.push("underline"),typeof t.underline=="object"&&(t.underline.style&&(e.style.textDecorationStyle=t.underline.style),t.underline.color&&(e.style.textDecorationColor=t.underline.color))),t.strike&&o.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(a=>!n||!n.has(a));r!=null&&(e.style.backgroundColor="rgba(255, 212, 0, 0.15)",e.style.borderBottom="1px solid rgba(255, 212, 0, 0.4)",e.dataset.commentId=String(r));}t.isInsertion&&(e.style.backgroundColor="rgba(52, 168, 83, 0.08)",e.style.borderBottom="2px dashed #2e7d32",e.style.paddingBottom="1px",e.classList.add("docx-insertion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),t.isDeletion&&(e.style.backgroundColor="rgba(211, 47, 47, 0.08)",e.style.color="#c62828",o.includes("line-through")||o.push("line-through"),e.style.textDecorationColor="#c62828",e.classList.add("docx-deletion"),t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId))),o.length>0&&(e.style.textDecorationLine=o.join(" ")),t.superscript&&(e.style.verticalAlign="super",e.style.fontSize="0.75em"),t.subscript&&(e.style.verticalAlign="sub",e.style.fontSize="0.75em"),t.hidden&&(e.classList.add("docx-hidden"),e.style.opacity="0.4",e.style.textDecoration="underline dotted"),t.rtl&&e.setAttribute("dir","rtl"),t.textEffect&&(e.classList.add("docx-text-effect",`docx-text-effect-${t.textEffect}`),e.dataset.effect=t.textEffect);}function j(e,t,n){t!==void 0&&(e.dataset.pmStart=String(t)),n!==void 0&&(e.dataset.pmEnd=String(n));}function re(e,t,n){let o=t.createElement("span");if(o.className=`${B.run} ${B.text}`,vt(o,e,n),j(o,e.pmStart,e.pmEnd),e.hyperlink){let r=t.createElement("a");r.href=e.hyperlink.href,e.hyperlink.href.startsWith("#")||(r.target="_blank",r.rel="noopener noreferrer"),e.hyperlink.tooltip&&(r.title=e.hyperlink.tooltip),r.textContent=e.text,r.style.color="inherit",r.style.textDecoration="inherit",e.hyperlink.noDefaultStyle||(e.color||(r.style.color="#0563c1",o.style.color="#0563c1"),e.underline||(r.style.textDecoration="underline")),o.appendChild(r);}else o.textContent=e.text;return o}var Pt=1e3;function fe(e,t,n,o){let r=t.createElement("span");r.className=`${B.run} ${B.tab}`,r.style.display="inline-block",r.style.width=`${n}px`,j(r,e.pmStart,e.pmEnd);let a=o&&o!=="none"?Bt(o):null;if(a){r.style.position="relative",r.textContent="\u200B";let i=t.createElement("span");i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.overflow="hidden",i.style.whiteSpace="nowrap",i.textContent=a.repeat(Pt),r.appendChild(i);}else r.textContent="\xA0";return r}function Bt(e){switch(e){case "dot":return ".";case "hyphen":return "-";case "underscore":return "_";case "middleDot":return "\xB7";case "heavy":return "_";default:return null}}function rt(e){if(!e)return 0;let t=e.match(/rotate\(([-\d.]+)deg\)/);return t?(parseFloat(t[1])%360+360)%360:0}function it(e,t,n){if(n===0||n===180)return {w:e,h:t};if(n===90||n===270)return {w:t,h:e};let o=n*Math.PI/180,r=Math.abs(Math.sin(o)),a=Math.abs(Math.cos(o));return {w:e*a+t*r,h:e*r+t*a}}function nt(e,t){t.distTop&&(e.style.marginTop=`${t.distTop}px`),t.distBottom&&(e.style.marginBottom=`${t.distBottom}px`);}function Mt(e,t){let n=t.createElement("img");n.className=`${B.run} ${B.image}`,n.src=e.src,n.width=e.width,n.height=e.height,n.style.width=`${e.width}px`,n.style.height=`${e.height}px`,e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform,n.style.transformOrigin="center center"),ne(e)&&oe(n,e);let o=rt(e.transform);if(o!==0){let r=it(e.width,e.height,o),a=t.createElement("span");return a.style.display="inline-block",a.style.position="relative",a.style.width=`${r.w}px`,a.style.height=`${r.h}px`,a.style.verticalAlign="middle",n.style.position="absolute",n.style.left=`${(r.w-e.width)/2}px`,n.style.top=`${(r.h-e.height)/2}px`,nt(a,e),j(a,e.pmStart,e.pmEnd),a.appendChild(n),a}return n.style.display="inline-block",n.style.verticalAlign="middle",nt(n,e),j(n,e.pmStart,e.pmEnd),n}function ot(e,t){let n=t.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${e.distTop??6}px`,n.style.marginBottom=`${e.distBottom??6}px`;let o=t.createElement("img");o.src=e.src,o.width=e.width,o.height=e.height,o.style.marginLeft="auto",o.style.marginRight="auto",e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform,o.style.transformOrigin="center center"),ne(e)&&oe(o,e);let r=rt(e.transform);if(r!==0){let a=it(e.width,e.height,r);n.style.height=`${a.h}px`,n.style.position="relative",o.style.position="absolute",o.style.left="50%",o.style.top="50%",o.style.marginLeft=`${-e.width/2}px`,o.style.marginRight="0",o.style.marginTop=`${-e.height/2}px`;}return j(n,e.pmStart,e.pmEnd),n.appendChild(o),n}function ge(e,t){let n;return c(e)||e.displayMode==="block"||e.wrapType==="topAndBottom"?n=ot(e,t):n=Mt(e,t),$t(n,e),n}function $t(e,t){if(t.isInsertion)e.style.outline="2px solid #2e7d32",e.style.outlineOffset="1px",e.classList.add("docx-insertion");else if(t.isDeletion)e.style.outline="2px solid #c62828",e.style.outlineOffset="1px",e.style.opacity="0.6",e.classList.add("docx-deletion");else return;t.changeAuthor&&(e.dataset.changeAuthor=t.changeAuthor),t.changeDate&&(e.dataset.changeDate=t.changeDate),t.changeRevisionId!=null&&(e.dataset.revisionId=String(t.changeRevisionId));}function Fe(e,t){let n=t.createElement("br");return n.className=`${B.run} ${B.lineBreak}`,j(n,e.pmStart,e.pmEnd),n}function me(e,t,n){let o=e.fallback??"";switch(e.fieldType){case "PAGE":o=String(n.pageNumber);break;case "NUMPAGES":o=String(n.totalPages);break;case "DATE":o=new Date().toLocaleDateString();break;case "TIME":o=new Date().toLocaleTimeString();break}let r={...e,text:o};return re(r,t,n?.resolvedCommentIds)}function Ce(e,t,n){if(z(e))return re(e,t,n?.resolvedCommentIds);if(D(e))return fe(e,t,48,void 0);if(G(e))return ge(e,t);if(Y(e))return Fe(e,t);if(X(e)&&n)return me(e,t,n);let o=t.createElement("span");return o.className=B.run,o}function lt(e,t){let n=[],o=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let a=o[r];if(a)if(z(a)){let i=r===t.fromRun?t.fromChar:0,d=r===t.toRun?t.toChar:a.text.length;if(i>0||d<a.text.length){let l=a.text.slice(i,d);n.push({...a,text:l,pmStart:a.pmStart!==void 0?a.pmStart+i:void 0,pmEnd:a.pmStart!==void 0?a.pmStart+d:void 0});}else n.push(a);}else n.push(a);}return n}function at(e){return e==="center"?"center":e==="right"?"flex-end":"flex-start"}function st(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function Ht(e){return {val:e.val,pos:e.pos,leader:e.leader}}function At(e,t,n){let o="";for(let r=t+1;r<e.length;r++){let a=e[r];if(z(a))o+=a.text;else if(X(a))a.fieldType==="PAGE"&&n?o+=String(n.pageNumber):a.fieldType==="NUMPAGES"&&n?o+=String(n.totalPages):o+=a.fallback??"";else if(D(a)||Y(a))break}return o}var Ot=.5;function zt(e,t,n,o){let r=0;for(let a=t+1;a<e.length;a++){let i=e[a];if(D(i)||Y(i))break;if(z(i))r+=n(i.text||"",i.fontSize,i.fontFamily,i.bold,i.italic);else if(X(i)){let d;i.fieldType==="PAGE"&&o?d=String(o.pageNumber):i.fieldType==="NUMPAGES"&&o?d=String(o.totalPages):d=i.fallback??"",r+=n(d,i.fontSize,i.fontFamily,i.bold,i.italic);}else G(i)&&!c(i)&&(r+=i.width||0);}return r}function Dt(e){let n=e.createElement("canvas").getContext("2d");return (o,r=11,a$1="Calibri",i=false,d=false)=>{if(!n)return o.length*7;let l=a(a$1).cssFallback,m=r*96/72,s=[];return d&&s.push("italic"),i&&s.push("bold"),s.push(`${m}px`,l),n.font=s.join(" "),n.measureText(o).width}}function ue(e,t,n,o,r){let a=o.createElement("div");a.className=B.line,a.style.height=`${t.lineHeight}px`,a.style.lineHeight=`${t.lineHeight}px`;let i=lt(e,t);if(i.length===1&&G(i[0])){let w=i[0].position?.horizontal?.align??n;a.style.display="flex",a.style.alignItems="center",a.style.justifyContent=at(w),a.dataset.flexLine="true";}else i.some(G)&&(a.style.display="flex",a.style.alignItems="baseline",a.style.justifyContent=at(n),a.style.lineHeight="normal",a.dataset.flexLine="true");if(i.length===0){let b=o.createElement("span");return b.className=`${B.run} layout-empty-run`,b.innerHTML=" ",a.appendChild(b),a}let d=n==="justify",l=false;d&&r&&(l=!r.isLastLine||r.paragraphEndsWithLineBreak,l&&(a.style.textAlign="justify",a.style.textAlignLast="justify",a.style.width=`${r.availableWidth}px`)),a.style.whiteSpace="pre";let m=i.some(b=>z(b)&&b.highlight);a.style.overflow=m?"hidden":"visible";let s=i.some(D),y,g=Dt(o);if(s){let b=r?.tabStops?.map(Ht),f=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;y={explicitStops:b,leftIndent:f};}let u=0,E=r?.leftIndentPx??0;if(r?.isFirstLine){let b=r?.firstLineIndentPx??0;u=E+b;}else u=E;for(let b=0;b<i.length;b++){let f=i[b];if(D(f)&&y){let w=zt(i,b,g,r?.context),F=At(i,b,r?.context),c$1=F.indexOf("."),x=c$1>=0?g(F.slice(0,c$1)):0,T=v(u,y,{followingWidth:w,decimalPrefixWidth:x}),S=r?.lineRightEdgePx,k=w,p=false;for(let I=b+1;I<i.length&&!Y(i[I]);I++)if(D(i[I])){p=true;break}if(S!==void 0&&T.alignment==="end"&&!p&&u+T.width+k>=S-Ot){a.style.display="flex",a.style.alignItems="baseline",a.style.whiteSpace="nowrap",a.style.textIndent="0",a.dataset.flexLine="true",r?.isFirstLine&&r.firstLineIndentPx&&r.firstLineIndentPx<0&&a.firstElementChild instanceof HTMLElement&&(a.firstElementChild.style.marginLeft=`${r.firstLineIndentPx}px`);let I=fe(f,o,0,T.leader);I.style.flex="1 1 0",I.style.minWidth="0",I.style.width="auto",a.appendChild(I);for(let v=b+1;v<i.length;v++){let L=i[v];if(D(L)||Y(L))break;if(z(L))a.appendChild(re(L,o,r?.context?.resolvedCommentIds));else if(X(L)&&r?.context)a.appendChild(me(L,o,r.context));else if(G(L)){if(c(L))continue;let P=st(L);r?.renderedInlineImageKeys?.has(P)||(r?.renderedInlineImageKeys?.add(P),a.appendChild(ge(L,o)));}else a.appendChild(Ce(L,o,r?.context));}break}let R=T.width;S!==void 0&&u+R+k>S&&(R=Math.max(1,S-u-k));let C=fe(f,o,R,T.leader);a.appendChild(C),u+=R;}else if(z(f)){let w=re(f,o,r?.context?.resolvedCommentIds);if(f.highlight){let T=(f.fontSize?f.fontSize*96/72:14.67)*1.2,S=Math.max(0,t.lineHeight-T);if(S>0){let k=S/2;w.style.paddingTop=`${k}px`,w.style.paddingBottom=`${k}px`;}}a.appendChild(w);let F=f.fontSize||11,c=f.fontFamily||"Calibri";u+=g(f.text,F,c,f.bold,f.italic);}else if(G(f)){if(c(f))continue;let w=st(f);if(r?.renderedInlineImageKeys?.has(w))continue;r?.renderedInlineImageKeys?.add(w);let F=ge(f,o);a.appendChild(F),f.displayMode!=="block"&&f.wrapType!=="topAndBottom"&&(u+=f.width);}else if(Y(f)){let w=Fe(f,o);a.appendChild(w);}else if(X(f)&&r?.context){let w=me(f,o,r.context);a.appendChild(w);let F=f.fallback??"";f.fieldType==="PAGE"?F=String(r.context.pageNumber):f.fieldType==="NUMPAGES"&&(F=String(r.context.totalPages));let c=f.fontSize||11,x=f.fontFamily||"Calibri";u+=g(F,c,x,f.bold,f.italic);}else {let w=Ce(f,o,r?.context);a.appendChild(w);}}return a}function ie(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function dt(e,t){return !e&&!t||!e||!t?false:ie(e.top,t.top)&&ie(e.bottom,t.bottom)&&ie(e.left,t.left)&&ie(e.right,t.right)&&ie(e.between,t.between)}function O(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");i.className=B.fragment,i.style.position=o.positioning==="absolute"?"absolute":"relative",i.dataset.blockId=String(e.blockId),i.dataset.fromLine=String(e.fromLine),i.dataset.toLine=String(e.toLine),j(i,e.pmStart,e.pmEnd),e.continuesFromPrev&&(i.dataset.continuesFromPrev="true"),e.continuesOnNext&&(i.dataset.continuesOnNext="true");let d=t.attrs?.pPrIns,l=t.attrs?.pPrDel;if(d||l){let S=d??l;i.classList.add("layout-revision-pmark"),i.classList.add(d?"layout-revision-ins":"layout-revision-del"),i.dataset.revisionId=String(S.revisionId),i.dataset.revisionAuthor=S.author,S.date&&(i.dataset.revisionDate=S.date);}let m=n.lines.slice(e.fromLine,e.toLine),s=t.attrs?.alignment;t.attrs?.styleId&&(i.dataset.styleId=t.attrs.styleId);let y=t.attrs?.bidi;y&&(i.dir="rtl"),s?s==="center"?i.style.textAlign="center":s==="right"?i.style.textAlign="right":s==="left"?i.style.textAlign="left":i.style.textAlign=y?"right":"left":y&&(i.style.textAlign="right");let g=t.attrs?.indent,u=0,E=0;g&&(y?(g.left&&g.left>0&&(E=g.left),g.right&&g.right>0&&(u=g.right)):(g.left&&g.left>0&&(u=g.left),g.right&&g.right>0&&(E=g.right)));let b=t.attrs?.borders;if(b){let S=L=>{switch(L){case "single":return "solid";case "double":return "double";case "dotted":return "dotted";case "dashed":return "dashed";case "thick":return "solid";case "wave":return "wavy";case "dashSmallGap":return "dashed";case "nil":case "none":return "none";default:return "solid"}};i.style.boxSizing="border-box";let k=L=>`${L.width}px ${S(L.style)} ${L.color}`,p=dt(r.prevBorders,b),h=dt(b,r.nextBorders),R=p?b.between:b.top,C=h?void 0:b.bottom,I=a.createElement("div");if(I.className="layout-paragraph-border",I.style.position="absolute",I.style.pointerEvents="none",I.style.boxSizing="border-box",I.style.left=`${u-(b.left?.space??0)}px`,I.style.right=`${E-(b.right?.space??0)}px`,I.style.top=`${-(R?.space??0)}px`,I.style.bottom=`${-(C?.space??0)}px`,R&&(I.style.borderTop=k(R)),C&&(I.style.borderBottom=k(C)),b.left&&(I.style.borderLeft=k(b.left)),b.right&&(I.style.borderRight=k(b.right)),(R||C||b.left||b.right)&&i.appendChild(I),b.bar){let L=a.createElement("div");L.style.position="absolute",L.style.left="-8px",L.style.top="0",L.style.bottom="0",L.style.borderLeft=k(b.bar),i.style.position="relative",i.appendChild(L);}}t.attrs?.shading&&(i.style.backgroundColor=t.attrs.shading);let f=e.width-u-E,F=t.runs[t.runs.length-1]?.kind==="lineBreak",c=n.lines.length,x$1=0;g?.hanging&&g.hanging>0?x$1=-g.hanging:g?.firstLine&&g.firstLine>0&&(x$1=g.firstLine);let T=r.renderedInlineImageKeys??new Set;for(let S=0;S<m.length;S++){let k=m[S],p=e.fromLine+S,h=p===c-1,R=p===0&&!e.continuesFromPrev,C=k.leftOffset??0,I=k.rightOffset??0,v=f;if(R){let M=g?.hanging&&g.hanging>0,$=g?.firstLine&&g.firstLine>0;M&&g?.hanging?v=f+g.hanging:$&&g?.firstLine&&(v=f-g.firstLine);}if(Nt(k,t)){let M=a.createElement("div");M.className=`${B.line} layout-line-split`,M.style.position="relative",M.style.height=`${k.lineHeight}px`,M.style.lineHeight=`${k.lineHeight}px`;for(let $ of k.segments){let we={fromRun:$.fromRun,fromChar:$.fromChar,toRun:$.toRun,toChar:$.toChar,width:$.width,ascent:k.ascent,descent:k.descent,lineHeight:k.lineHeight},_=ue(t,we,s,a,{availableWidth:$.availableWidth,isLastLine:h,isFirstLine:R,paragraphEndsWithLineBreak:F,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:R?x$1:0,context:o,renderedInlineImageKeys:T});_.className+=" layout-line-segment",_.style.position="absolute",_.style.left=`${$.leftOffset}px`,_.style.top="0",_.style.width=`${$.availableWidth}px`,M.appendChild(_);}i.appendChild(M);continue}let L=ue(t,k,s,a,{availableWidth:v-C-I,isLastLine:h,isFirstLine:R,paragraphEndsWithLineBreak:F,tabStops:t.attrs?.tabs,leftIndentPx:u,firstLineIndentPx:R?x$1:0,context:o,renderedInlineImageKeys:T,lineRightEdgePx:e.width-E-I});if(C>0||I>0){C>0&&(L.style.marginLeft=`${C}px`),I>0&&(L.style.marginRight=`${I}px`);let M=v-C-I;M>0&&(L.style.width=`${M}px`);}k.floatSkipBefore&&k.floatSkipBefore>0&&(L.style.marginTop=`${k.floatSkipBefore}px`);let P=g?.hanging&&g.hanging>0,Oe=g?.firstLine&&g.firstLine>0,xt=L.dataset.flexLine==="true";if(R?u>0&&P?(L.style.paddingLeft=`${u}px`,xt||(L.style.textIndent=`-${g.hanging}px`)):u>0&&Oe?(L.style.paddingLeft=`${u}px`,L.style.textIndent=`${g.firstLine}px`):u>0?L.style.paddingLeft=`${u}px`:Oe&&(L.style.textIndent=`${g.firstLine}px`):u>0?L.style.paddingLeft=`${u}px`:P&&(L.style.paddingLeft=`${g.hanging}px`),E>0&&(L.style.paddingRight=`${E}px`),R&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let M=g?.hanging??0,$=g?.firstLine??0,we=M>0?Math.max(0,u-M):u+$;L.style.paddingLeft=`${we}px`,L.style.textIndent="0";let{fontFamily:_,fontSize:St}=w(t),kt=Wt(t.attrs.listMarker,x(t),a,_,St,t.attrs.listMarkerRevision);L.insertBefore(kt,L.firstChild);}i.appendChild(L);}if((d||l)&&!e.continuesOnNext){let S=i.lastElementChild;if(S){let k=a.createElement("span");k.className="layout-revision-pmark-glyph",d?k.classList.add("layout-revision-ins"):k.classList.add("layout-revision-del"),k.textContent="\xB6",k.setAttribute("aria-hidden","true"),S.appendChild(k);}}return i}function Nt(e,t){return (e.segments?.length??0)>1&&!t.attrs?.listMarker}function Wt(e,t,n,o,r,a$1){let i=n.createElement("span");return i.className="layout-list-marker",i.style.fontFamily=a(o).cssFallback,i.style.fontSize=`${r*96/72}px`,i.style.textAlign="left",i.style.boxSizing="border-box",i.style.display="inline-block",i.style.minWidth=`${t}px`,i.textContent=e,a$1==="ins"?i.style.color="#2e7d32":a$1==="del"&&(i.style.color="#c62828",i.style.textDecoration="line-through"),i}function q(e,t,n){let o=t.createElement("div");o.className=n.layerClass,o.style.position="absolute",o.style.top="0",o.style.left="0",n.sizing==="inset0"?(o.style.right="0",o.style.bottom="0"):(o.style.width="100%",o.style.height="100%",o.style.overflow="hidden"),o.style.pointerEvents="none",n.layerMode==="front"&&(o.style.zIndex="10");for(let r of e){let a=t.createElement("div");a.className=n.itemClass,a.style.position="absolute",a.style.pointerEvents="auto",a.style.top=`${r.y}px`,a.style.left=`${r.x}px`,r.pmStart!==void 0&&(a.dataset.pmStart=String(r.pmStart)),r.pmEnd!==void 0&&(a.dataset.pmEnd=String(r.pmEnd));let i=t.createElement("img");i.src=r.src,i.style.width=`${r.width}px`,i.style.height=`${r.height}px`,i.style.display="block",i.style.maxWidth="none",i.style.maxHeight="none",r.alt&&(i.alt=r.alt),r.transform&&(i.style.transform=r.transform,i.style.transformOrigin="center center"),ne(r)&&oe(i,r),a.appendChild(i),o.appendChild(a);}return o}function ct(e$2,t,n){let o=[],r=0;for(let a=0;a<e$2.blocks.length;a++){let i=e$2.blocks[a];if(i?.kind!=="paragraph"){let m=t.blocks[a];m&&m.kind==="table"&&(r+=m.totalHeight??0);continue}let d=i;for(let m of d.runs){if(m.kind!=="image")continue;let s=m;if(!c(s))continue;let y=s.position,g=s.distTop??0,u=s.distBottom??0,E=s.distLeft??12,b=s.distRight??12,f="left",w=0;if(y?.horizontal){let c=y.horizontal;c.align==="right"?(f="right",w=n-s.width):c.align==="left"?w=0:c.align==="center"?w=(n-s.width)/2:c.posOffset!==void 0&&(w=e(c.posOffset),f=w>n/2?"right":"left");}else s.cssFloat==="right"&&(f="right",w=n-s.width);let F=r;if(y?.vertical){let c=y.vertical;c.posOffset!==void 0?F=r+e(c.posOffset):c.align==="top"&&(F=0);}w=Math.max(0,Math.min(w,n-s.width)),o.push({src:s.src,width:s.width,height:s.height,alt:s.alt,transform:s.transform,x:w,y:F,side:f,distTop:g,distBottom:u,distLeft:E,distRight:b,wrapText:e$1(s.cssFloat),wrapType:s.wrapType,pmStart:s.pmStart,pmEnd:s.pmEnd});}let l=t.blocks[a];l&&l.kind==="paragraph"&&(r+=l.totalHeight);}return o}function Re(e){return !!e&&e.style!=="none"&&e.style!=="nil"&&e.width!==0}function J(e,t,n){let o=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!Re(n))e.style[o]="none";else {let r=n.width??1,a=n.color??"#000000",i=n.style??"solid";e.style[o]=`${r}px ${i} ${a}`;}}function Ee(e){let t=[],n=0;for(let o of e)t.push(Math.round(n)),n+=o?.height??0;return t.push(Math.round(n)),t}function pt(e,t){let n=e.createElement("div");n.className="layout-table-cut-border",n.style.position="absolute",n.style.left=`${t.x}px`,n.style.width=`${t.width}px`;let o=t.border.width??1;return n.style.top=`${t.edge==="bottom"?t.topY-o:t.topY}px`,J(n,"top",t.border),n}function Le(e,t,n,o){e.classList.add(`ep-revision-${t}`,`ep-revision-${n}`),e.dataset.revisionId=String(o.revisionId),e.dataset.revisionAuthor=o.author,o.date&&(e.dataset.revisionDate=o.date);}var N={table:"layout-table",row:"layout-table-row",cell:"layout-table-cell",cellContent:"layout-table-cell-content",resizeHandle:"layout-table-resize-handle",rowResizeHandle:"layout-table-row-resize-handle",tableEdgeHandleBottom:"layout-table-edge-handle-bottom",tableEdgeHandleRight:"layout-table-edge-handle-right"};function _t(e,t,n,o){let r=o.createElement("div");r.className=N.cellContent,r.style.position="relative";let a=e.padding?.left??7,i=e.padding?.right??7,d=Math.max(0,t.width-a-i);r.style.width=`${d}px`;let l=ct(e,t,d),m;if(l.length>0){m=l.filter(a$2).map(E=>{let b=E.x+E.width+E.distRight,f=E.y-E.distTop,w=E.y+E.height+E.distBottom,F=0,c=0,x=E.wrapText??"bothSides";return x==="right"?F=b:x==="left"?c=d-(E.x-E.distLeft):E.side==="left"?F=b:c=d-(E.x-E.distLeft),{leftMargin:F,rightMargin:c,topY:f,bottomY:w}});let u=l.filter(b);u.length>0&&r.appendChild(q(u,o,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"behind"}));}let s=0,y=0;for(let u=0;u<e.blocks.length;u++){let E=e.blocks[u],b=t.blocks[u];if(E?.kind==="paragraph"&&b?.kind==="paragraph"){let f=E,w=b,F=f.attrs?.spacing,c=Math.max(y,F?.before??0);s+=c,m&&m.length>0&&(w=z$1(f,d,{floatingZones:m,paragraphYOffset:s}));let x={blockId:f.id,width:d,height:w.totalHeight,fromLine:0,toLine:w.lines.length,pmStart:f.pmStart,pmEnd:f.pmEnd},T={...n,insideTableCell:true},S=O(x,f,w,T,{document:o});S.style.position="relative",c>0&&(S.style.marginTop=`${c}px`),r.appendChild(S),s+=w.totalHeight,y=F?.after??0;}else if(E?.kind==="table"&&b?.kind==="table"){let f=E,w=b,F=y,c=Gt(f,w,n,o);c.style.position="relative",F>0&&(c.style.marginTop=`${F}px`),r.appendChild(c),s+=F+(b.totalHeight??0),y=0;}}y>0&&(r.style.paddingBottom=`${y}px`);let g=l.filter(u=>!b(u));return g.length>0&&r.appendChild(q(g,o,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"front"})),r}function Gt(e,t,n,o){let r=o.createElement("div");r.className=`${N.table} layout-nested-table`,r.style.position="relative",r.style.width=`${t.totalWidth}px`,r.style.display="block",e.justification==="center"?(r.style.marginLeft="auto",r.style.marginRight="auto"):e.justification==="right"?r.style.marginLeft="auto":e.indent&&(r.style.marginLeft=`${e.indent}px`),r.dataset.blockId=String(e.id),e.pmStart!==void 0&&(r.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(r.dataset.pmEnd=String(e.pmEnd));let a=e.rows[0],i=a?.trackedIns,d=a?.trackedDel,l=(g,u)=>!!g&&!!u&&(g.author??"")===(u.author??"")&&(g.date??null)===(u.date??null),m=e.rows.length>0&&e.rows.every(g=>i?l(g.trackedIns,i):d?l(g.trackedDel,d):false);if(m){let g=i??d,u=i?"ins":"del";r.classList.add("ep-revision-table",`ep-revision-${u}`),r.dataset.revisionId=String(g.revisionId),r.dataset.revisionAuthor=g.author,g.date&&(r.dataset.revisionDate=g.date);}let s=Ee(t.rows),y=new Map;for(let g=0;g<e.rows.length;g++){let u=e.rows[g],E=t.rows[g];if(!u||!E)continue;let b=ve(u,E,g,s[g]??0,t.columnWidths,e.rows.length,n,o,y,s,void 0,m);r.appendChild(b);}return r.style.height=`${s[e.rows.length]??0}px`,r}function ft(e,t,n,o,r,a,i,d){let l=i.createElement("div");l.className=N.cell,e.trackedMarker&&e.trackedMarker.info.revisionId!==d&&Le(l,"cell",e.trackedMarker.kind,e.trackedMarker.info),l.style.position="absolute",l.style.left=`${n}px`,l.style.top="0",l.style.width=`${t.width}px`,l.style.height=`${o}px`,l.style.overflow="hidden",l.style.boxSizing="border-box";let m=e.padding?.top??1,s=e.padding?.right??7,y=e.padding?.bottom??1,g=e.padding?.left??7;l.style.padding=`${m}px ${s}px ${y}px ${g}px`,e.borders&&(r.isFirstRow&&J(l,"top",e.borders.top),J(l,"right",e.borders.right),J(l,"bottom",e.borders.bottom),r.isFirstCol&&J(l,"left",e.borders.left)),e.background&&(l.style.backgroundColor=e.background),e.noWrap&&(l.style.whiteSpace="nowrap");let u=(t.height??0)>=o-.5;if(e.verticalAlign&&!u)switch(l.style.display="flex",l.style.flexDirection="column",e.verticalAlign){case "top":l.style.justifyContent="flex-start";break;case "center":l.style.justifyContent="center";break;case "bottom":l.style.justifyContent="flex-end";break}let E=_t(e,t,a,i);if(l.appendChild(E),e.blocks.length>0){let b=e.blocks[0],f=e.blocks[e.blocks.length-1];b&&"pmStart"in b&&b.pmStart!==void 0&&(l.dataset.pmStart=String(b.pmStart)),f&&"pmEnd"in f&&f.pmEnd!==void 0&&(l.dataset.pmEnd=String(f.pmEnd));}return l}function Yt(e,t){return b$1(e).map(n=>{let o=0;for(let r=0;r<n.columnIndex;r++)o+=t[r]??0;return {rowIndex:n.rowIndex,cellIndex:n.cellIndex,columnIndex:n.columnIndex,x:o,colSpan:n.colSpan,rowSpan:n.rowSpan,cell:e.rows[n.rowIndex].cells[n.cellIndex]}})}function ve(e,t,n,o,r,a,i,d,l,m,s,y){let g=d.createElement("div");g.className=N.row,y||(e.trackedDel?Le(g,"row","del",e.trackedDel):e.trackedIns&&Le(g,"row","ins",e.trackedIns));let u=m&&m.length>n+1?(m[n+1]??0)-(m[n]??0):t.height;g.style.position="absolute",g.style.left="0",g.style.top=`${o}px`,g.style.width="100%",g.style.height=`${u}px`,g.dataset.rowIndex=String(n);let E=new Set;if(l){for(let[,w]of l)if(w.startRow<n&&w.startRow+w.rowSpan>n)for(let F=0;F<w.colSpan;F++)E.add(w.columnIndex+F);}let b=0,f=0;for(;E.has(f);)b+=r[f]??0,f++;for(let w=0;w<e.cells.length;w++){let F=e.cells[w],c=t.cells[w];if(!F||!c)continue;let x=F.colSpan??1,T=F.rowSpan??1,S=u;if(T>1&&m){S=0;for(let I=n;I<n+T&&I<m.length-1;I++)S+=(m[I+1]??0)-(m[I]??0);S===0&&(S=t.height*T);}let k=n===0||s===true,h=f===0;f+x>=r.length;let C=ft(F,c,b,S,{isFirstRow:k,isFirstCol:h},i,d,e.trackedIns?.revisionId??e.trackedDel?.revisionId);if(C.dataset.cellIndex=String(w),C.dataset.columnIndex=String(f),T>1&&(C.dataset.rowSpan=String(T)),g.appendChild(C),T>1&&l){let I=`${n}-${f}`;l.set(I,{cell:F,cellMeasure:c,columnIndex:f,startRow:n,rowSpan:T,colSpan:x,x:b,totalHeight:S});}for(let I=0;I<x&&f+I<r.length;I++)b+=r[f+I]??0;for(f+=x;E.has(f);)b+=r[f]??0,f++;}return g}function Q(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");i.className=N.table,i.style.position=o.positioning==="flow"?"relative":"absolute",i.style.width=`${e.width}px`,i.style.overflow="hidden",i.dataset.blockId=String(e.blockId),i.dataset.fromRow=String(e.fromRow),i.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(i.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(i.dataset.pmEnd=String(e.pmEnd));let d=t.rows[0],l=d?.trackedIns,m=d?.trackedDel,s=(p,h)=>!!p&&!!h&&(p.author??"")===(h.author??"")&&(p.date??null)===(h.date??null),y=t.rows.length>0&&t.rows.every(p=>l?s(p.trackedIns,l):m?s(p.trackedDel,m):false);if(y){let p=l??m,h=l?"ins":"del";i.classList.add("ep-revision-table",`ep-revision-${h}`),i.dataset.revisionId=String(p.revisionId),i.dataset.revisionAuthor=p.author,p.date&&(i.dataset.revisionDate=p.date),i.style.overflowX="visible",i.style.overflowY="hidden";}let g=0;for(let p=0;p<n.columnWidths.length-1;p++){g+=n.columnWidths[p]??0;let h=a.createElement("div");h.className=N.resizeHandle,h.style.position="absolute",h.style.left=`${g-3}px`,h.style.top="0",h.style.width="6px",h.style.height="100%",h.style.cursor="col-resize",h.style.zIndex="10",h.dataset.columnIndex=String(p),h.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),i.appendChild(h);}let u=Ee(n.rows),E=Yt(t,n.columnWidths),b=e.headerRowCount??0,f=0;if(b>0&&e.continuesFromPrev){let p=new Map;for(let h=0;h<b;h++){let R=t.rows[h],C=n.rows[h];if(!R||!C)continue;let I=ve(R,C,h,f,n.columnWidths,t.rows.length,o,a,p,u,h===0,y);I.dataset.repeatedHeader="true",i.appendChild(I),f+=C.height;}}let w=(u[e.fromRow]??0)+(e.topClip??0),F=p=>f+(p-w),c=e.bottomClip!==void 0?Math.round(e.height):F(u[e.toRow]??0);i.style.height=`${c}px`;let x=new Map,T=b>0&&e.continuesFromPrev;for(let p of E){if(p.rowSpan<=1||p.rowIndex>=e.fromRow||p.rowIndex+p.rowSpan<=e.fromRow||T&&p.rowIndex<b)continue;let h=n.rows[p.rowIndex]?.cells?.[p.cellIndex];if(!h)continue;let R=0;for(let P=p.rowIndex;P<p.rowIndex+p.rowSpan&&P<u.length-1;P++)R+=(u[P+1]??0)-(u[P]??0);x.set(`${p.rowIndex}-${p.columnIndex}`,{cell:p.cell,cellMeasure:h,columnIndex:p.columnIndex,startRow:p.rowIndex,rowSpan:p.rowSpan,colSpan:p.colSpan,x:p.x,totalHeight:R});p.rowIndex+p.rowSpan>=t.rows.length;let I=p.columnIndex===0;p.columnIndex+p.colSpan>=n.columnWidths.length;let L=ft(p.cell,h,p.x,R,{isFirstRow:false,isFirstCol:I},o,a);L.style.top=`${F(u[p.rowIndex]??0)}px`,L.dataset.columnIndex=String(p.columnIndex),L.dataset.vmergeContinuation="true",delete L.dataset.pmStart,delete L.dataset.pmEnd,i.appendChild(L);}for(let p=e.fromRow;p<e.toRow;p++){let h=t.rows[p],R=n.rows[p];if(!h||!R)continue;let C=b>0&&e.continuesFromPrev?false:e.continuesFromPrev&&p===e.fromRow&&!e.topClip,I=ve(h,R,p,F(u[p]??0),n.columnWidths,t.rows.length,o,a,x,u,C,y);i.appendChild(I);}let S=(p,h,R,C)=>{for(let I of E){if(I.rowIndex>p||I.rowIndex+I.rowSpan-1<p||C&&!(h==="bottom"?I.rowIndex+I.rowSpan-1>p:I.rowIndex<p))continue;let v=I.cell.borders?.[h];if(!Re(v))continue;let L=0;for(let P=0;P<I.colSpan;P++)L+=n.columnWidths[I.columnIndex+P]??0;i.appendChild(pt(a,{x:I.x,topY:R,width:L,edge:h,border:v}));}};e.topClip?S(e.fromRow,"top",f,false):e.continuesFromPrev&&S(e.fromRow,"top",f,true),e.bottomClip!==void 0?S(e.toRow-1,"bottom",c,false):e.continuesOnNext&&S(e.toRow-1,"bottom",c,true);for(let p=e.fromRow;p<e.toRow-1;p++){let h=F(u[p+1]??0);if(h<=f||h>=e.height)continue;let R=a.createElement("div");R.className=N.rowResizeHandle,R.style.position="absolute",R.style.left="0",R.style.top=`${h-3}px`,R.style.width="100%",R.style.height="6px",R.style.cursor="row-resize",R.style.zIndex="10",R.dataset.rowIndex=String(p),R.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(R.dataset.tablePmStart=String(e.pmStart)),i.appendChild(R);}let k=e.toRow===t.rows.length&&e.bottomClip===void 0;if(k){let p=a.createElement("div");p.className=N.tableEdgeHandleBottom,p.style.position="absolute",p.style.left="0",p.style.top=`${F(u[e.toRow]??0)-3}px`,p.style.width="100%",p.style.height="6px",p.style.cursor="row-resize",p.style.zIndex="10",p.dataset.rowIndex=String(t.rows.length-1),p.dataset.tableBlockId=String(e.blockId),p.dataset.isEdge="bottom",e.pmStart!==void 0&&(p.dataset.tablePmStart=String(e.pmStart)),i.appendChild(p);}if(k){let p=n.columnWidths.reduce((R,C)=>R+C,0),h=a.createElement("div");h.className=N.tableEdgeHandleRight,h.style.position="absolute",h.style.left=`${p-3}px`,h.style.top="0",h.style.width="6px",h.style.height="100%",h.style.cursor="col-resize",h.style.zIndex="10",h.dataset.columnIndex=String(n.columnWidths.length-1),h.dataset.tableBlockId=String(e.blockId),h.dataset.isEdge="right",e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),i.appendChild(h);}return i}var jt={textBox:"layout-textbox"};function ee(e,t,n,o,r={}){let a=r.document??document,i=a.createElement("div");if(i.className=jt.textBox,i.style.position="absolute",i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.overflow="hidden",i.style.boxSizing="border-box",Kt(i,e),t.fillColor&&(i.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let s=t.outlineStyle||"solid",y=t.outlineColor||"#000000";i.style.border=`${t.outlineWidth}px ${s} ${y}`;}let d=t.margins??a$1;i.style.padding=`${d.top}px ${d.right}px ${d.bottom}px ${d.left}px`,i.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(i.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(i.dataset.pmEnd=String(e.pmEnd));let l=e.width-d.left-d.right,m=0;for(let s=0;s<t.content.length;s++){let y=t.content[s],g=n.innerMeasures[s];if(!g)continue;let u={blockId:y.id,width:l,height:g.totalHeight,pmStart:y.pmStart,pmEnd:y.pmEnd,fromLine:0,toLine:g.lines.length},E=O(u,y,g,{...o,positioning:"flow"},{document:a});i.appendChild(E),m+=g.totalHeight;}return i}function Kt(e,t){!t.isFloating&&t.zIndex===void 0||(e.style.zIndex=String(t.zIndex??10));}var Vt="layout-watermark-layer";function Ut(e,t){let n=Math.max(e.trim().length,1),o=t/(n*.62);return Math.max(24,Math.min(o,180))}function Xt(e,t,n){let o=n.createElement("div");o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.whiteSpace="nowrap",o.style.fontWeight="bold",o.style.color=e.color,o.style.fontFamily=a(e.font).cssFallback,o.style.userSelect="none";let r=t.size.w-t.margins.left-t.margins.right,a$1=e.layout==="diagonal"?r*1.3:r,i=e.fontSize!==void 0?e.fontSize*96/72:Ut(e.text,a$1);o.style.fontSize=`${i}px`,o.style.lineHeight="1",o.style.opacity=e.semitransparent?"0.5":"0.85";let d=e.layout==="diagonal"?-45:0;return o.style.transform=`translate(-50%, -50%) rotate(${d}deg)`,o.style.transformOrigin="center center",o.textContent=e.text,o}function qt(e,t,n){if(!e.dataUrl)return null;let o=n.createElement("img");o.src=e.dataUrl,o.alt="",o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.transform="translate(-50%, -50%)";let r=t.size.w-t.margins.left-t.margins.right,a=e.widthEmu!==void 0?e.widthEmu/(914400/96):r*.75;return o.style.width=`${a*(e.scale||1)}px`,o.style.height="auto",e.washout&&(o.style.opacity="0.5",o.style.filter="brightness(1.4) contrast(0.4)"),o}function gt(e,t,n=document){let o=e.kind==="text"?Xt(e,t,n):qt(e,t,n);if(!o)return null;let r=n.createElement("div");return r.className=Vt,r.setAttribute("aria-hidden","true"),r.style.position="absolute",r.style.inset="0",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="0",r.appendChild(o),r}function mt(e){return e?.align??e?.alignment}function Zt(e$1,t){let n=e$1.position.vertical;if(!n)return e$1.paragraphY;let o=mt(n),r=n.posOffset!==void 0?e(n.posOffset):void 0;if(n.relativeTo==="page"){if(r!==void 0)return r-t.flowTop;if(o==="top")return -t.flowTop;if(o==="bottom")return t.pageHeight-e$1.height-t.flowTop;if(o==="center")return (t.pageHeight-e$1.height)/2-t.flowTop}if(n.relativeTo==="margin"){let a=t.margins.top,i=t.pageHeight-t.margins.top-t.margins.bottom;if(r!==void 0)return a+r-t.flowTop;if(o==="top")return a-t.flowTop;if(o==="bottom")return a+i-e$1.height-t.flowTop;if(o==="center")return a+(i-e$1.height)/2-t.flowTop}return r!==void 0?e$1.paragraphY+r:e$1.paragraphY}function Pe(e$1,t,n){if(!t)return "0";let o=mt(t);if(t.relativeTo==="page"){if(t.posOffset!==void 0)return `${e(t.posOffset)-n.flowLeft}px`;if(o==="right")return `${n.pageWidth-e$1-n.flowLeft}px`;if(o==="center")return `${(n.pageWidth-e$1)/2-n.flowLeft}px`;if(o==="left")return `${-n.flowLeft}px`}return t.posOffset!==void 0?`${e(t.posOffset)}px`:o==="right"?`${n.contentWidth-e$1}px`:o==="center"?`${(n.contentWidth-e$1)/2}px`:"0"}function Jt(e,t,n){e.style.left=Pe(t.width,t.position.horizontal,n);}function ut(e,t){let n=e.tblpY??0;e.vertAnchor==="page"?n-=t.flowTop:e.vertAnchor==="margin"&&(n+=t.margins.top-t.flowTop);let o=e.tblpX??0;return e.horzAnchor==="page"?o-=t.flowLeft:e.horzAnchor==="margin"&&(o+=t.margins.left-t.flowLeft),{left:o,top:n}}function Be(e,t,n,o){let r=n.document??document,a=r.createElement("div");a.style.position="relative";let i=t.contentWidth??600,d=[],l=0;for(let m=0;m<e.blocks.length;m++){let s=e.blocks[m],y=e.measures[m];if(!(!s||!y))if(s.kind==="paragraph"){if(y.kind!=="paragraph")continue;let g=s,u=y,E=g.attrs?.spacing?.before??0,b=l,f=[];for(let x of g.runs)if(x.kind==="image"&&"position"in x&&x.position){let T=x;d.push({src:T.src,width:T.width,height:T.height,alt:T.alt,paragraphY:b,position:T.position});}else f.push(x);let w={...g,runs:f},F={blockId:g.id,width:i,height:u.totalHeight,fromLine:0,toLine:u.lines.length,pmStart:g.pmStart,pmEnd:g.pmEnd},c=O(F,w,u,{...t,positioning:"absolute"},{document:r});c.style.top=`${l+E}px`,c.style.left="0",c.style.width=`${i}px`,a.appendChild(c),l+=u.totalHeight;}else if(s.kind==="table"){if(y.kind!=="table")continue;let g={blockId:s.id,width:y.totalWidth,height:y.totalHeight,fromRow:0,toRow:y.rows.length,pmStart:s.pmStart,pmEnd:s.pmEnd},u=Q(g,s,y,{...t,positioning:"absolute"},{document:r});if(s.floating){let{left:E,top:b}=ut(s.floating,o);u.style.top=`${b}px`,u.style.left=`${E}px`,a.appendChild(u);}else u.style.top=`${l}px`,u.style.left="0",a.appendChild(u),l+=y.totalHeight;}else if(s.kind==="image"){if(y.kind!=="image")continue;let g={blockId:s.id,width:y.width,height:y.height,pmStart:s.pmStart,pmEnd:s.pmEnd},u=Z(g,s,y,{...t},{document:r});u.style.top=`${l}px`,u.style.left="0",a.appendChild(u),l+=y.height;}else if(s.kind==="textBox"){if(y.kind!=="textBox")continue;let g={blockId:s.id,width:y.width,height:y.height,pmStart:s.pmStart,pmEnd:s.pmEnd},u=ee(g,s,y,{...t,positioning:"absolute"},{document:r});u.style.top=`${l}px`,u.style.left=Pe(y.width,s.position?.horizontal,o),a.appendChild(u),l+=y.height;}else s.kind==="sectionBreak"||s.kind==="pageBreak"||s.kind==="columnBreak"||c$3(s,"renderHeaderFooterContent");}for(let m of d){let s=r.createElement("img");s.src=m.src,s.width=m.width,s.height=m.height,m.alt&&(s.alt=m.alt),s.style.position="absolute",s.style.display="block",s.style.width=`${m.width}px`,s.style.height=`${m.height}px`,s.style.maxWidth="none",s.style.maxHeight="none",Jt(s,m,o),s.style.top=`${Zt(m,o)}px`,a.appendChild(s);}return a}var ye=12,Me=6;function Qt(e,t){if(e.size!==t.size)return false;for(let[n,o]of e)if(t.get(n)!==o)return false;return true}function en(e,t){for(let[n,o]of t)if((e.get(n)??0)<o)return false;return true}function tn(e,t){let n=new Map(e);for(let[o,r]of t)n.set(o,Math.max(n.get(o)??0,r));return n}var $e=8;function So(e){let t=[],n=o=>{for(let r of o)if(r.kind==="paragraph")for(let a of r.runs)a.kind==="text"&&a.footnoteRefId!=null&&t.push({footnoteId:a.footnoteRefId,pmPos:a.pmStart??0});else if(r.kind==="table")for(let a of r.rows)for(let i of a.cells)n(i.blocks);else r.kind==="textBox"&&n(r.content);};return n(e),t}function he(e,t){let n=new Map;if(t.length===0)return n;for(let o of t)for(let r of e){let a=false;for(let i of r.fragments){let d=i.pmStart??-1,l=i.pmEnd??-1;if(d>=0&&l>=0&&o.pmPos>=d&&o.pmPos<l){let m=n.get(r.number)??[];m.includes(o.footnoteId)||m.push(o.footnoteId),n.set(r.number,m),a=true;break}}if(a)break}return n}function nn(e,t){if(e.length===0)return [{kind:"paragraph",id:`fn-empty-${t}`,runs:[{kind:"text",text:`${t} `,fontSize:$e,superscript:true}]}];let n=e.map(r=>{if(r.kind!=="paragraph")return r;let a=r;return {...a,runs:a.runs.map(i=>(i.kind==="text"||i.kind==="tab")&&i.fontSize==null?{...i,fontSize:$e}:i)}}),o=n[0];if(o.kind==="paragraph"){let r={kind:"text",text:`${t} `,fontSize:$e,superscript:true};n[0]={...o,runs:[r,...o.runs]};}return n}function on(e,t,n,o){let r=c$1(e.content,{styles:o.styles??void 0,theme:o.theme??null,defaultTabStopTwips:o.defaultTabStopTwips??null}),a=c$2(r,{theme:o.theme??void 0}),i=nn(a,t),d=o.measureBlocks(i,n),l=d.reduce((m,s)=>s.kind==="paragraph"||s.kind==="table"?m+s.totalHeight:s.kind==="image"||s.kind==="textBox"?m+s.height:m,0);return {id:e.id,displayNumber:t,blocks:i,measures:d,height:l}}function ko(e,t,n,o){let r=new Map,a=new Map;for(let l of e)(l.noteType==="normal"||l.noteType==null)&&a.set(l.id,l);let i=1,d=new Set;for(let l of t){if(d.has(l.footnoteId))continue;d.add(l.footnoteId);let m=a.get(l.footnoteId);m&&(r.set(l.footnoteId,on(m,i,n,o)),i++);}return r}function He(e,t){let n=new Map;for(let[o,r]of e){let a=0;for(let i of r){let d=t.get(i);d&&(a+=d.height);}a>0&&(a+=ye,n.set(o,a));}return n}function wo(e){let{blocks:t,measures:n,layoutOpts:o,footnoteRefs:r,footnoteContentMap:a,initialLayout:i}=e,d=he(i.pages,r),l=He(d,a);if(l.size===0)return {layout:i,pageFootnoteMap:d,converged:true};let m=i,s=false;for(let y=0;y<Me;y++){m=U$1(t,n,{...o,footnoteReservedHeights:l});let g=he(m.pages,r),u=He(g,a);if(d=g,Qt(l,u)){l=u,s=true;break}l=u;}if(!s){let y=l,g=false;for(let u=0;u<Me;u++){m=U$1(t,n,{...o,footnoteReservedHeights:y}),d=he(m.pages,r);let E=He(d,a);if(en(y,E)){g=true;break}y=tn(y,E);}g||(m=U$1(t,n,{...o,footnoteReservedHeights:y}),d=he(m.pages,r)),console.warn(`[docx-editor] footnote layout did not stabilize within ${Me} passes; settling with conservative page reservations. If footnotes appear misplaced, please file a bug with the document.`);}for(let[y,g]of d){let u=m.pages.find(E=>E.number===y);u&&(u.footnoteIds=g);}return {layout:m,pageFootnoteMap:d,converged:s}}function To(e,t,n){let o=new Map;if(!n?.package?.footnotes)return o;let r=new Map;for(let a of n.package.footnotes)a.noteType&&a.noteType!=="normal"||r.set(a.id,a);for(let[a,i]of e){let d=[];for(let l of i){let m=r.get(l);if(!m)continue;let s=t.get(l),y=s?.displayNumber??0;d.push({displayNumber:String(y),text:x$1(m),content:s});}d.length>0&&o.set(a,d);}return o}function rn(e,t,n,o){let r=o.createElement("div");r.className="layout-footnote-content",r.style.position="relative",r.style.width=`${t}px`,r.style.height=`${e.height}px`;let a=0;for(let i=0;i<e.blocks.length;i++){let d=e.blocks[i],l=e.measures[i];if(!(!d||!l)){if(d.kind==="paragraph"&&l.kind==="paragraph"){let m=d.attrs?.spacing?.before??0,s={blockId:d.id,width:t,height:l.totalHeight,pmStart:d.pmStart,pmEnd:d.pmEnd,fromLine:0,toLine:l.lines.length},y=O(s,d,l,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:o});y.style.top=`${a+m}px`,y.style.left="0",y.style.width=`${t}px`,y.style.height=`${l.totalHeight}px`,r.appendChild(y),a+=l.totalHeight;}else if(d.kind==="table"&&l.kind==="table"){let m={blockId:d.id,width:l.totalWidth,height:l.totalHeight,pmStart:d.pmStart,pmEnd:d.pmEnd,fromRow:0,toRow:l.rows.length},s=Q(m,d,l,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:o});s.style.top=`${a}px`,s.style.left="0",r.appendChild(s),a+=l.totalHeight;}else if(d.kind==="image"&&l.kind==="image"){let m={blockId:d.id,width:l.width,height:l.height,pmStart:d.pmStart,pmEnd:d.pmEnd},s=Z(m,d,l,{...n},{document:o});s.style.top=`${a}px`,s.style.left="0",r.appendChild(s),a+=l.height;}else if(d.kind==="textBox"&&l.kind==="textBox"){let m={blockId:d.id,width:l.width,height:l.height,pmStart:d.pmStart,pmEnd:d.pmEnd},s=ee(m,d,l,{...n,section:"body",contentWidth:t,positioning:"absolute"},{document:o});s.style.top=`${a}px`,s.style.left="0",r.appendChild(s),a+=l.height;}}}return r}function an(e,t){let n=t.createElement("div");n.style.fontSize="10px",n.style.lineHeight="1.3",n.style.marginBottom="4px",n.style.color="#000";let o=t.createElement("sup");o.textContent=e.displayNumber,o.style.fontSize="7px",o.style.marginRight="2px",n.appendChild(o);let r=t.createTextNode(" "+e.text);return n.appendChild(r),n}function ht(e){let t=ye;for(let n of e)n.content&&(t+=n.content.height);return t}function yt(e,t,n,o){let r=o.createElement("div");r.className="layout-footnote-area",r.style.width=`${t}px`;let a=o.createElement("div"),i=.5,d=(ye-i)/2;a.style.width="33%",a.style.height=`${i}px`,a.style.backgroundColor="#000",a.style.marginBottom=`${d}px`,a.style.marginTop=`${d}px`,r.appendChild(a);for(let l of e)r.appendChild(l.content?rn(l.content,t,n,o):an(l,o));return r}function Ae(e,t,n){let o={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:n.resolvedCommentIds},r={...n};if(n.titlePg&&e.number===1&&(r.headerContent=n.firstPageHeaderContent,r.footerContent=n.firstPageFooterContent),n.footnotesByPage){let a=n.footnotesByPage.get(e.number);a&&a.length>0&&(r.footnoteArea=a);}return {context:o,pageOptions:r}}function bt(e){let t=[];t.push(`s:${e.size.w},${e.size.h}`),t.push(`m:${e.margins.top},${e.margins.right},${e.margins.bottom},${e.margins.left}`),t.push(`n:${e.number}`),e.footnoteReservedHeight&&t.push(`fn:${e.footnoteReservedHeight}`);for(let n of e.fragments){let o=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;n.pmStart!==void 0&&(o+=`,ps:${n.pmStart}`),n.pmEnd!==void 0&&(o+=`,pe:${n.pmEnd}`),n.kind==="paragraph"?o+=`,fl:${n.fromLine},tl:${n.toLine}`:n.kind==="table"&&(o+=`,fr:${n.fromRow},tr:${n.toRow}`),t.push(o);}return t.join("|")}function sn(e){let t=[];return e.headerContent&&t.push(`hdr:${e.headerContent.blocks.length},${e.headerContent.height},${e.headerContent.visualTop??0},${e.headerContent.visualBottom??e.headerContent.height}`),e.footerContent&&t.push(`ftr:${e.footerContent.blocks.length},${e.footerContent.height},${e.footerContent.visualTop??0},${e.footerContent.visualBottom??e.footerContent.height}`),e.firstPageHeaderContent&&t.push(`fp-hdr:${e.firstPageHeaderContent.blocks.length},${e.firstPageHeaderContent.height}`),e.firstPageFooterContent&&t.push(`fp-ftr:${e.firstPageFooterContent.blocks.length},${e.firstPageFooterContent.height}`),e.titlePg&&t.push("titlePg"),e.theme&&t.push(`thm:${e.theme.name??"default"}`),e.pageBorders&&t.push(`pb:${JSON.stringify(e.pageBorders)}`),e.headerDistance!==void 0&&t.push(`hd:${e.headerDistance}`),e.footerDistance!==void 0&&t.push(`fd:${e.footerDistance}`),t.join("|")}function ln(e,t){e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.gap=`${t}px`,e.style.padding=`${t}px`,e.style.backgroundColor="var(--doc-bg, #f8f9fa)";}var be=2,dn=8;function cn(e,t,n={}){let o=e.length,r=n.pageGap??24,a=t,i=a.__pageRenderState,d=sn(n),l=o>=dn;if(i&&i.optionsHash===d&&l){let f=i.pageStates,w=i.pageDataMap,F=a.__pageObserver,c=[];for(let S of e)c.push(bt(S));let x=i.totalPages!==o,T=Math.min(f.length,e.length);for(let S=0;S<T;S++){let k=f[S],p=c[S];if(k.fingerprint===p&&!x){let C=w.get(k.element);C&&(C.page=e[S]);continue}let h=k.element,R=w.get(h);R&&(R.page=e[S],R.rendered&&pn(h,w,o,n)),k.fingerprint=p,se(h,e[S].size.w,e[S].size.h,n),h.dataset.pageNumber=String(e[S].number);}if(e.length>f.length){let S=n.document??document;for(let k=f.length;k<e.length;k++){let p=e[k],h=S.createElement("div");h.className=n.pageClassName??W.page,h.dataset.pageNumber=String(p.number),h.dataset.pageIndex=String(k),se(h,p.size.w,p.size.h,n),t.appendChild(h),f.push({element:h,fingerprint:c[k]}),w.set(h,{page:p,index:k,rendered:false}),F&&F.observe(h);}}if(e.length<f.length){for(let S=f.length-1;S>=e.length;S--){let k=f[S].element;F&&F.unobserve(k),w.delete(k),t.removeChild(k);}f.length=e.length;}for(let S=0;S<f.length;S++){let k=w.get(f[S].element);k&&(k.index=S);}return i.totalPages=o,i.currentOptions=n,"incremental"}let s=a.__pageObserver;s&&(s.disconnect(),a.__pageObserver=void 0),t.innerHTML="",a.__pageRenderState=void 0,ln(t,r);let y=[],g=[];for(let f=0;f<e.length;f++){let w=e[f];if(g.push(bt(w)),l){let c=(n.document??document).createElement("div");c.className=n.pageClassName??W.page,c.dataset.pageNumber=String(w.number),c.dataset.pageIndex=String(f),se(c,w.size.w,w.size.h,n),t.appendChild(c),y.push(c);}else {let{context:F,pageOptions:c}=Ae(w,o,n),x=xe(w,F,c);t.appendChild(x),y.push(x);}}if(!l)return "full";let u=new Map;for(let f=0;f<e.length;f++)u.set(y[f],{page:e[f],index:f,rendered:false});let E=new IntersectionObserver(f=>{let w=a.__pageRenderState;if(!w)return;let{currentOptions:F,totalPages:c,pageDataMap:x}=w;for(let p of f){let h=p.target,R=x.get(h);if(R&&p.isIntersecting){ae(h,x,c,F);for(let C=-be;C<=be;C++){let I=R.index+C;I>=0&&I<w.pageStates.length&&I!==R.index&&ae(w.pageStates[I].element,x,c,F);}}}let T=window.innerHeight,S=T*3,k=new Set;for(let[p,h]of x){if(!h.rendered)continue;let R=p.getBoundingClientRect();R.bottom>-S&&R.top<T+S&&k.add(h.index);}for(let[p,h]of x){if(!h.rendered)continue;let R=false;for(let C of k)if(Math.abs(h.index-C)<=be+1){R=true;break}!R&&k.size>0&&fn(p,x);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let f of y)E.observe(f);a.__pageObserver=E,a.__pageRenderState={pageStates:y.map((f,w)=>({element:f,fingerprint:g[w]})),totalPages:o,optionsHash:d,pageDataMap:u,currentOptions:n};let b=Math.min(e.length,be+3);for(let f=0;f<b;f++)ae(y[f],u,o,n);return "full"}function ae(e,t,n,o){let r=t.get(e);if(!r||r.rendered)return;let{context:a,pageOptions:i}=Ae(r.page,n,o),d=xe(r.page,a,i);for(;d.firstChild;)e.appendChild(d.firstChild);r.rendered=true;}function pn(e,t,n,o){let r=t.get(e);if(!r)return;let{context:a,pageOptions:i}=Ae(r.page,n,o),l=xe(r.page,a,i).querySelector(`.${W.content}`),m=e.querySelector(`.${W.content}`);l&&m?e.replaceChild(l,m):(e.innerHTML="",r.rendered=false,ae(e,t,n,o));}function fn(e,t){let n=t.get(e);!n||!n.rendered||(e.innerHTML="",n.rendered=false);}function gn(e){let n=e.__pageRenderState;if(!n)return 0;let{pageStates:o,totalPages:r,currentOptions:a,pageDataMap:i}=n,d=0;for(let{element:l}of o){let m=i.get(l);!m||m.rendered||(ae(l,i,r,a),d++);}return d}var W={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function se(e,t,n,o){e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${n}px`,e.style.backgroundColor=o.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily=a("Calibri").cssFallback,e.style.fontSize=`${1056/72}px`,e.style.color="#000000",o.showBorders&&(e.style.border="1px solid #ccc"),o.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");}function mn(e,t){switch(t??"allPages"){case "firstPage":return e===1;case "notFirstPage":return e!==1;default:return true}}function Se(e){return e?.space!==void 0?i(e.space):0}function ke(e,t,n,o){if(!t||t.style==="none"||t.style==="nil")return;let r=c$4(t,n,o);for(let[l,m]of Object.entries(r))e.style[l]=String(m);let a=`border${n}Style`,i=`border${n}Width`;if(e.style[a]==="double"){let l=parseFloat(e.style[i]);(!Number.isFinite(l)||l<3)&&(e.style[i]="3px");}}function un(e,t,n){let o=t.pageBorders;if(!o||!mn(e.number,o.display)||![o.top,o.bottom,o.left,o.right].some(y=>y&&y.style!=="none"&&y.style!=="nil"))return null;let a=o.offsetFrom??"text",i=Se(o.top),d=Se(o.right),l=Se(o.bottom),m=Se(o.left),s=n.createElement("div");return s.className="layout-page-border",s.style.position="absolute",s.style.pointerEvents="none",s.style.boxSizing="border-box",s.style.zIndex=o.zOrder==="back"?"0":"20",a==="page"?(s.style.top=`${i}px`,s.style.right=`${d}px`,s.style.bottom=`${l}px`,s.style.left=`${m}px`):(s.style.top=`${Math.max(0,e.margins.top-i)}px`,s.style.right=`${Math.max(0,e.margins.right-d)}px`,s.style.bottom=`${Math.max(0,e.margins.bottom-l)}px`,s.style.left=`${Math.max(0,e.margins.left-m)}px`),ke(s,o.top,"Top",t.theme),ke(s,o.bottom,"Bottom",t.theme),ke(s,o.left,"Left",t.theme),ke(s,o.right,"Right",t.theme),s}function hn(e,t){let n=t.margins;e.style.position="absolute",e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,e.style.right=`${n.right}px`,e.style.bottom=`${n.bottom}px`,e.style.overflow="visible";}function yn(e,t,n){e.style.position="absolute",e.style.left=`${t.x-n.left}px`;let o=t.y-n.top;e.style.top=`${t.kind==="table"?Math.round(o):o}px`,e.style.width=`${t.width}px`,"height"in t&&t.kind!=="table"&&(e.style.height=`${t.height}px`);}function bn(e,t,n,o){let r=[];for(let a of e.runs){if(a.kind!=="image")continue;let i=a;if(!c(i))continue;let d=i.distTop??0,l=i.distBottom??0,m=i.distLeft??12,s=i.distRight??12,{x:y,y:g$1,side:u}=g(i,t,n,o);r.push({src:i.src,width:i.width,height:i.height,alt:i.alt,transform:i.transform,side:u,x:y,y:g$1,distTop:d,distBottom:l,distLeft:m,distRight:s,pmStart:i.pmStart,pmEnd:i.pmEnd,wrapText:e$1(i.cssFloat),wrapType:i.wrapType,cropTop:i.cropTop,cropRight:i.cropRight,cropBottom:i.cropBottom,cropLeft:i.cropLeft,opacity:i.opacity});}return r}function xe(e,t$1,n={}){let o=n.document??document,r=o.createElement("div");if(r.className=n.pageClassName??W.page,r.dataset.pageNumber=String(e.number),se(r,e.size.w,e.size.h,n),n.watermark){let c=gt(n.watermark,e,o);c&&r.appendChild(c);}let a=un(e,n,o);a&&n.pageBorders?.zOrder==="back"&&r.appendChild(a);let i=o.createElement("div");i.className=W.content,hn(i,e);let d=f(e),l=d.contentWidth,m=[],s=[];for(let c of e.fragments)if(c.kind==="paragraph"&&n.blockLookup){let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind==="paragraph"){let T=x.block,S=c.y-e.margins.top,k=bn(T,S,l,d);m.push(...k);}}for(let c of m)a$2(c)&&s.push({side:c.side,x:c.x,y:c.y,width:c.width,height:c.height,distTop:c.distTop,distBottom:c.distBottom,distLeft:c.distLeft,distRight:c.distRight,wrapText:c.wrapText,wrapType:c.wrapType});if(n.blockLookup)for(let c of e.fragments){if(c.kind!=="table")continue;let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind!=="table")continue;let S=x.block.floating;if(!S)continue;let k=c.x-e.margins.left,p=c.y-e.margins.top,h=S.topFromText??0,R=S.bottomFromText??0,C=S.leftFromText??12,I=S.rightFromText??12,v=k<l/2?"left":"right";s.push({side:v,x:k,y:p,width:c.width,height:c.height,distTop:h,distBottom:R,distLeft:C,distRight:I});}if(n.blockLookup)for(let c of e.fragments){if(c.kind!=="textBox")continue;let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind!=="textBox")continue;let T=x.block;if(!I(T))continue;let S=c.y-e.margins.top,k=g({width:c.width,height:c.height,position:T.position,cssFloat:T.cssFloat},S,l,d);c.x=e.margins.left+k.x,c.y=e.margins.top+k.y,!(!J$1(T)&&!K(T))&&s.push({side:k.side,x:k.x,y:k.y,width:c.width,height:c.height,distTop:T.distTop??0,distBottom:T.distBottom??0,distLeft:T.distLeft??12,distRight:T.distRight??12,wrapText:T.wrapText,wrapType:T.wrapType});}let y=s.length>0?t(s,l):[],g$1=m.filter(b),u=m.filter(c=>!b(c));if(g$1.length>0){let c=q(g$1,o,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"behind"});i.appendChild(c);}let E=c=>{if(c.kind!=="paragraph"||!n.blockLookup||!c.blockId)return;let x=n.blockLookup.get(String(c.blockId));if(x?.block.kind==="paragraph")return x.block.attrs?.borders},b$1,f$1=new Map,w=c=>!n.blockLookup||!c.blockId?[]:n.blockLookup.get(String(c.blockId))?.block.sdtGroups??[],F=(c,x)=>{if(x.length===0)return;let T=x[x.length-1];c.classList.add("layout-block-sdt"),c.dataset.sdtGroupId=T.id,c.dataset.sdtType=T.sdtType,c.dataset.sdtDepth=String(x.length),T.tag!=null&&(c.dataset.sdtTag=T.tag),T.alias!=null&&(c.dataset.sdtAlias=T.alias),T.lock!=null&&(c.dataset.sdtLock=T.lock);};for(let c=0;c<e.fragments.length;c++){let x=e.fragments[c],T,S={...t$1,section:"body",contentWidth:l},k=x.y-e.margins.top;if(n.blockLookup&&x.blockId){let p=n.blockLookup.get(String(x.blockId));if(x.kind==="paragraph"&&p?.block.kind==="paragraph"&&p?.measure.kind==="paragraph"){let h=p.block,R=c+1<e.fragments.length?E(e.fragments[c+1]):void 0,C=String(x.blockId),I=f$1.get(C);I||(I=new Set,f$1.set(C,I));let v=p.measure;y.length>0&&(v=z$1(h,l,{floatingZones:y,paragraphYOffset:k})),T=O(x,h,v,S,{document:o,prevBorders:b$1,nextBorders:R,renderedInlineImageKeys:I}),b$1=h.attrs?.borders;}else x.kind==="table"&&p?.block.kind==="table"&&p?.measure.kind==="table"?(T=Q(x,p.block,p.measure,S,{document:o}),b$1=void 0):x.kind==="image"&&p?.block.kind==="image"&&p?.measure.kind==="image"?(T=Z(x,p.block,p.measure,S,{document:o}),b$1=void 0):x.kind==="textBox"&&p?.block.kind==="textBox"&&p?.measure.kind==="textBox"?(T=ee(x,p.block,p.measure,S,{document:o}),b$1=void 0):(T=Ie(x,S,{document:o}),b$1=void 0);}else T=Ie(x,S,{document:o}),b$1=void 0;yn(T,x,{left:e.margins.left,top:e.margins.top}),F(T,w(x)),i.appendChild(T);}if(et(e,i,l,w,o),u.length>0){let c=q(u,o,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"front"});i.appendChild(c);}if(e.columns&&e.columns.separator&&e.columns.count>1){let c=e.columns.count,x=e.columns.gap,T=(l-(c-1)*x)/c,S=e.size.h-e.margins.top-e.margins.bottom;for(let k=0;k<c-1;k++){let p=(k+1)*T+k*x+x/2,h=o.createElement("div");h.style.position="absolute",h.style.left=`${p}px`,h.style.top="0",h.style.height=`${S}px`,h.style.width="0.5px",h.style.backgroundColor="#000",h.style.pointerEvents="none",i.appendChild(h);}}if(n.footnoteArea&&n.footnoteArea.length>0){let c=yt(n.footnoteArea,l,t$1,o);c.style.position="absolute";let x=Math.max(e.footnoteReservedHeight??0,ht(n.footnoteArea)),T=e.size.h-e.margins.bottom-e.margins.top;c.style.top=`${Math.max(-e.margins.top,T-x)}px`,c.style.left="0",c.style.right="0",i.appendChild(c);}r.appendChild(i);{let x=n.headerDistance??e.margins.header??48,T=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.top-x,48),k=n.headerContent?.visualTop??0,p=n.headerContent?.visualBottom??n.headerContent?.height??0,h=Math.max(p-k,24),R=p>S,C=o.createElement("div");C.className=W.header,C.style.position="absolute",C.style.top=`${x+k}px`,C.style.left=`${e.margins.left}px`,C.style.right=`${e.margins.right}px`,C.style.width=`${T}px`,C.style.height=`${h}px`,C.style.minHeight=`${h}px`;let I=!R;if(n.headerContent&&n.headerContent.blocks.length>0){let v={flowTop:x,flowLeft:e.margins.left,contentWidth:T,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},L=Be(n.headerContent,{...t$1,section:"header",contentWidth:T},n,v);L.style.top=`${-k}px`,L.querySelector("img")&&(I=false),C.appendChild(L);}I&&(C.style.maxHeight=`${S}px`,C.style.overflow="hidden"),r.appendChild(C);}{let x=n.footerDistance??e.margins.footer??48,T=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.bottom-x,48),k=n.footerContent?.visualTop??0,p=n.footerContent?.visualBottom??n.footerContent?.height??0,h=Math.max(p-k,24),R=h>S,C=o.createElement("div");C.className=W.footer,C.style.position="absolute",C.style.top=`${e.size.h-x-h}px`,C.style.left=`${e.margins.left}px`,C.style.right=`${e.margins.right}px`,C.style.width=`${T}px`,C.style.height=`${h}px`,C.style.minHeight=`${h}px`;let I=!R;if(n.footerContent&&n.footerContent.blocks.length>0){let v={flowTop:e.size.h-x-(n.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:T,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},L=Be(n.footerContent,{...t$1,section:"footer",contentWidth:T},n,v);L.style.top=`${-k}px`,L.querySelector("img")&&(I=false),C.appendChild(L);}I&&(C.style.maxHeight=`${S}px`,C.style.overflow="hidden"),r.appendChild(C);}return a&&n.pageBorders?.zOrder!=="back"&&r.appendChild(a),r}export{ut as A,cn as B,gn as C,W as D,se as E,xe as F,ye as a,Me as b,Qt as c,So as d,he as e,nn as f,on as g,ko as h,He as i,wo as j,To as k,xn as l,Sn as m,U as n,Ie as o,tt as p,Z as q,lt as r,ue as s,O as t,q as u,N as v,Q as w,jt as x,ee as y,Pe as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkFQS436KN_js=require('./chunk-FQS436KN.js'),chunkRSU4HTC6_js=require('./chunk-RSU4HTC6.js'),chunkBUCOTKYY_js=require('./chunk-BUCOTKYY.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function Z(e,n){if(e.pages.length===0)return null;let a=e.pageGap??0,r=0,t=null,o=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,f=r,u=f+l;if(n.y>=f&&n.y<u)return {pageIndex:s,page:i,pageY:n.y-f};let c=f+l/2,m=Math.abs(n.y-c);m<o&&(o=m,t=s),r=u+a;}if(t!==null){let s=e.pages[t],i=D(e,t);return {pageIndex:t,page:s,pageY:Math.max(0,Math.min(n.y-i,s.size?.h??e.pageSize.h))}}return null}function D(e,n){let a=e.pageGap??0,r=0;for(let t=0;t<n&&t<e.pages.length;t++){let s=e.pages[t].size?.h??e.pageSize.h;r+=s+a;}return r}function Xe(e,n){return Z(e,{y:n})?.pageIndex??null}function ee(e,n){return e.findIndex(a=>a.id===n)}function Ne(e,n){let a=0;for(let r=e.fromLine;r<e.toLine&&r<n.lines.length;r++)a+=n.lines[r].lineHeight;return a}function me(e,n,a,r){let t=[...e.page.fragments].sort((o,s)=>{let i=o.y-s.y;return Math.abs(i)>.5?i:o.x-s.x});for(let o of t){let s=ee(n,o.blockId);if(s===-1)continue;let i=n[s],l=a[s];if(!i||!l)continue;let f;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;f=Ne(o,l);}else if(o.kind==="table")f=o.height;else if(o.kind==="image")f=o.height;else continue;let u=r.x>=o.x&&r.x<=o.x+o.width,c=r.y>=o.y&&r.y<=o.y+f;if(u&&c)return {fragment:o,block:i,measure:l,pageIndex:e.pageIndex,localX:r.x-o.x,localY:r.y-o.y}}return null}function Ye(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="image")continue;let o=ee(n,t.blockId);if(o===-1)continue;let s=n[o],i=a[o];if(!s||!i)continue;let l=r.x>=t.x&&r.x<=t.x+t.width,f=r.y>=t.y&&r.y<=t.y+t.height;if(l&&f)return {fragment:t,block:s,measure:i,pageIndex:e.pageIndex,localX:r.x-t.x,localY:r.y-t.y}}return null}function ge(e,n,a,r){for(let t of e.page.fragments){if(t.kind!=="table")continue;let o=t,s=r.x>=o.x&&r.x<=o.x+o.width,i=r.y>=o.y&&r.y<=o.y+o.height;if(!s||!i)continue;let l=ee(n,o.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="table"||!u||u.kind!=="table")continue;let c=f,m=u,g=r.x-o.x,x=r.y-o.y,d=o.headerRowCount??0,h=d>0&&o.continuesFromPrev?chunkRSU4HTC6_js.V(m,d):0,p=0,b=-1;if(m.rows.length===0||c.rows.length===0)continue;if(h>0&&x<h){let M=0;for(let w=0;w<d&&w<m.rows.length;w++){let A=m.rows[w];if(x>=M&&x<M+A.height){b=w;break}M+=A.height;}b===-1&&(b=0);}else {let M=x-h;for(let w=o.fromRow;w<o.toRow&&w<m.rows.length;w++){let A=m.rows[w];if(M>=p&&M<p+A.height){b=w;break}p+=A.height;}}if(b===-1&&(b=Math.min(o.toRow-1,m.rows.length-1),b<o.fromRow))continue;let T=m.rows[b],H=c.rows[b];if(!T||!H)continue;let F=0,k=-1;if(T.cells.length===0||H.cells.length===0)continue;for(let M=0;M<T.cells.length;M++){let w=T.cells[M];if(g>=F&&g<F+w.width){k=M;break}F+=w.width;}if(k===-1&&(k=T.cells.length-1,k<0))continue;let P=T.cells[k],S=H.cells[k];if(!P||!S)continue;let y=0;if(h>0&&b<d)for(let M=0;M<b;M++)y+=m.rows[M]?.height??0;else {y=h;for(let M=o.fromRow;M<b;M++)y+=m.rows[M]?.height??0;}let R=0;for(let M=0;M<k;M++)R+=T.cells[M]?.width??0;let X,I;if(S.blocks&&S.blocks.length>0){let M=S.blocks[0],w=P.blocks[0];M.kind==="paragraph"&&w?.kind==="paragraph"&&(X=M,I=w);}let L=g-R,C=x-y;return {fragment:o,block:c,measure:m,pageIndex:e.pageIndex,rowIndex:b,colIndex:k,cellBlock:X,cellMeasure:I,cellLocalX:Math.max(0,L),cellLocalY:Math.max(0,C)}}return null}function ze(e,n,a,r){let t={pageHit:null,fragmentHit:null,tableCellHit:null};if(t.pageHit=Z(e,r),!t.pageHit)return t;let o=D(e,t.pageHit.pageIndex),s={x:r.x,y:r.y-o};return t.fragmentHit=me(t.pageHit,n,a,s),t.fragmentHit?.fragment.kind==="table"&&(t.tableCellHit=ge(t.pageHit,n,a,s)),t}function We(e){if(e.pages.length===0)return 0;let n=e.pageGap??0,a=0;for(let r=0;r<e.pages.length;r++){let t=e.pages[r];a+=t.size?.h??e.pageSize.h,r<e.pages.length-1&&(a+=n);}return a}function Ge(e,n){return D(e,n)}function Ve(e,n){if(n<0||n>=e.pages.length)return null;let a=D(e,n),t=e.pages[n].size?.h??e.pageSize.h;return {top:a,bottom:a+t}}function te(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function pe(e,n){let a=[];for(let r=n.fromRun;r<=n.toRun&&r<e.runs.length;r++){let t=e.runs[r];if(t){if(t.kind==="tab"||t.kind==="image"||t.kind==="lineBreak"){a.push(t);continue}if(t.kind==="text"){let o=t.text??"",s=r===n.fromRun,i=r===n.toRun;if(s||i){let l=s?n.fromChar:0,f=i?n.toChar:o.length,u=o.slice(l,f);u.length>0&&a.push({...t,text:u});}else a.push(t);}}}return a}function be(e,n){let a,r,t=e.pmStart??0,o=0;for(let s=0;s<e.runs.length&&s<=n.toRun;s++){let i=e.runs[s];i&&(s<n.fromRun?i.kind==="text"?o+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(o+=1):s===n.fromRun&&(o+=n.fromChar,a=t+o,i.kind==="text"&&(o=n.fromChar)));}if(a!==void 0){let s=0;for(let i=n.fromRun;i<=n.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let f=l.text??"",u=i===n.fromRun?n.fromChar:0,c=i===n.toRun?n.toChar:f.length;s+=c-u;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}r=a+s;}return {pmStart:a,pmEnd:r}}function Ue(e,n,a,r){let t=0;for(let o=a;o<r&&o<e.lines.length;o++){let i=e.lines[o].lineHeight;if(n>=t&&n<t+i)return o;t+=i;}return r>a?Math.min(r-1,e.lines.length-1):null}function $e(e,n,a,r){let{pmStart:t,pmEnd:o}=be(e,n);if(t===void 0||o===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(r-n.width)/2):s==="right"&&(i=Math.max(0,r-n.width));let l=Math.max(0,a-i);if(l<=0)return {charOffset:0,pmPosition:t};let f=pe(e,n);if(f.length===0)return {charOffset:0,pmPosition:t};let u=0,c=0;for(let g of f){if(g.kind==="tab"){let x=g.width??48,d=u+x;if(l<=d){let h=u+x/2;return l<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="image"){let x=g.width,d=u+x;if(l<=d){let h=u+x/2;return l<h?{charOffset:c,pmPosition:t+c}:{charOffset:c+1,pmPosition:t+c+1}}u=d,c+=1;continue}if(g.kind==="lineBreak"){if(l>=u)return {charOffset:c,pmPosition:t+c};c+=1;continue}if(g.kind==="text"){let x=g.text??"";if(x.length===0)continue;let d=te(g),h=chunkRSU4HTC6_js.k(x,d),p=u+h.width;if(l<=p){let b=l-u,T=chunkRSU4HTC6_js.l(b,h.charWidths),H=c+T;return {charOffset:H,pmPosition:t+H}}u=p,c+=x.length;}}return {charOffset:o-t,pmPosition:o}}function ne(e){let{fragment:n,block:a,measure:r,localX:t,localY:o}=e;if(n.kind!=="paragraph"||a.kind!=="paragraph"||r.kind!=="paragraph")return null;let s=n,i=a,l=r,f=Ue(l,o,s.fromLine,s.toLine);if(f===null)return null;let u=l.lines[f];if(!u)return null;let c=0;for(let T=s.fromLine;T<f;T++)c+=l.lines[T]?.lineHeight??0;let m=i.attrs?.indent,g=m?.left??0,x=m?.right??0,d=Math.max(0,n.width-g-x),h=t-g,{charOffset:p,pmPosition:b}=$e(i,u,h,d);return {pmPosition:b,charOffset:p,lineIndex:f}}function xe(e){let{cellBlock:n,cellMeasure:a,cellLocalX:r,cellLocalY:t}=e;if(!n||!a)return null;let o={fragment:{kind:"paragraph",blockId:n.id,x:0,y:0,width:a.lines.reduce((i,l)=>Math.max(i,l.width),100),fromLine:0,toLine:a.lines.length,height:a.totalHeight},block:n,measure:a,pageIndex:e.pageIndex,localX:r,localY:t};return ne(o)?.pmPosition??null}function qe(e,n){if(n)return xe(n);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?ne(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function ke(e,n,a,r){let t=e.pmStart??0,o=e.pmEnd??t;if(a<t||a>o)return null;let s=a-t;for(let i=0;i<n.lines.length;i++){let l=n.lines[i],{pmStart:f,pmEnd:u}=be(e,l);if(f===void 0||u===void 0)continue;let c=f-t,m=u-t;if(s>=c&&s<=m){let g=s-c,x=pe(e,l),d=0,h=0;for(let p of x)if(p.kind==="tab"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+(p.width??48),lineIndex:i};d+=p.width??48,h+=1;}else if(p.kind==="image"){if(g<=h+1)return g<=h?{x:d,lineIndex:i}:{x:d+p.width,lineIndex:i};d+=p.width,h+=1;}else if(p.kind==="lineBreak"){if(g<=h)return {x:d,lineIndex:i};h+=1;}else if(p.kind==="text"){let b=p.text??"";if(g<=h+b.length){let F=g-h,k=te(p),P=chunkRSU4HTC6_js.k(b.slice(0,F),k);return {x:d+P.width,lineIndex:i}}let T=te(p),H=chunkRSU4HTC6_js.k(b,T);d+=H.width,h+=b.length;}return {x:d,lineIndex:i}}}return null}function je(e,n,a,r,t,o,s){let i=ke(e,n,a);if(!i)return null;let l=e.attrs?.alignment??"left",f=e.attrs?.indent,u=f?.left??0,c=f?.right??0,m=Math.max(0,o-u-c),g=n.lines[i.lineIndex];if(!g)return null;let x=0;l==="center"?x=Math.max(0,(m-g.width)/2):l==="right"&&(x=Math.max(0,m-g.width));let d=0;for(let h=s;h<i.lineIndex;h++)d+=n.lines[h]?.lineHeight??0;return {x:r+u+x+i.x,y:t+d,height:g.lineHeight}}function Je(e,n,a={}){let r=a.scope??"body",t=r==="body"?"layout-page-content":`layout-page-${r}`,o=`.${t} .layout-table-cell`,s=e.querySelectorAll(`.${t} .layout-table-cell-selected`);for(let c of Array.from(s))c.classList.remove("layout-table-cell-selected");let i=n.selection;if(!("$anchorCell"in i&&typeof i.forEachCell=="function")||!i.forEachCell)return;let f=[];i.forEachCell((c,m)=>{f.push([m,m+c.nodeSize]);});let u=e.querySelectorAll(o);for(let c of Array.from(u)){let m=c,g=m.dataset.pmStart;if(g===void 0)continue;let x=Number(g);for(let[d,h]of f)if(x>=d&&x<h){m.classList.add("layout-table-cell-selected");break}}}function Te(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function oe(e,n){return e.findIndex(a=>a.id===n)}function V(e,n){let r=(e.pmStart??0)+1,t=0,o;for(let l=0;l<e.runs.length&&l<=n.toRun;l++){let f=e.runs[l];if(f){if(l<n.fromRun)f.kind==="text"?t+=(f.text??"").length:t+=1;else if(l===n.fromRun){t+=n.fromChar,o=r+t;break}}}o===void 0&&(o=r);let s=0;for(let l=n.fromRun;l<=n.toRun&&l<e.runs.length;l++){let f=e.runs[l];if(f)if(f.kind==="text"){let u=f.text??"",c=l===n.fromRun?n.fromChar:0,m=l===n.toRun?n.toChar:u.length;s+=m-c;}else s+=1;}let i=o+s;return {pmStart:o,pmEnd:i}}function Me(e,n,a,r){let t=[];for(let o=0;o<n.lines.length;o++){let s=n.lines[o],i=V(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<r&&t.push({line:s,index:o});}return t}function W(e,n,a){let r=V(e,n);return r.pmStart===void 0?0:Math.max(0,a-r.pmStart)}function G(e,n,a,r){let t=0,o=0;for(let s=n.fromRun;s<=n.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="image"){let l=i.width;if(o+1>=a)return a<=o?t:t+l;t+=l,o+=1;continue}if(i.kind==="lineBreak"){if(a<=o)return t;o+=1;continue}if(i.kind==="text"){let l=i.text??"",f=s===n.fromRun,u=s===n.toRun,c=f?n.fromChar:0,m=u?n.toChar:l.length,g=l.slice(c,m);if(o+g.length>=a){let h=a-o,p=Te(i),b=chunkRSU4HTC6_js.k(g.slice(0,h),p);return t+b.width}let x=Te(i),d=chunkRSU4HTC6_js.k(g,x);t+=d.width,o+=g.length;}}}return t}function j(e,n){let a=0;for(let r=0;r<n&&r<e.lines.length;r++)a+=e.lines[r].lineHeight;return a}function Ke(e,n,a,r,t){if(r===t)return [];let o=Math.min(r,t),s=Math.max(r,t),i=[];for(let l=0;l<e.pages.length;l++){let f=e.pages[l],u=D(e,l);for(let c of f.fragments){if(c.kind==="paragraph"){let m=oe(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=g,h=x,p=c,b=Me(d,h,o,s);for(let{line:T,index:H}of b){if(H<p.fromLine||H>=p.toLine)continue;let F=V(d,T);if(F.pmStart===void 0||F.pmEnd===void 0)continue;let k=Math.max(F.pmStart,o),P=Math.min(F.pmEnd,s);if(k>=P)continue;let S=W(d,T,k),y=W(d,T,P),B=d.attrs?.indent,R=B?.left??0,X=B?.right??0,I=Math.max(0,c.width-R-X),L=G(d,T,S),C=G(d,T,y),M=d.attrs?.alignment??"left",w=0;M==="center"?w=Math.max(0,(I-T.width)/2):M==="right"&&(w=Math.max(0,I-T.width));let A=j(h,H)-j(h,p.fromLine),v=c.x+R+w+Math.min(L,C),Y=Math.max(1,Math.abs(C-L)),z=c.y+A;i.push({x:v,y:z+u,width:Y,height:T.lineHeight,pageIndex:l});}}if(c.kind==="table"){let m=oe(n,c.blockId);if(m===-1)continue;let g=n[m],x=a[m];if(!g||g.kind!=="table"||!x||x.kind!=="table")continue;let d=g,h=x,p=c,b=[],T=0;for(let y=0;y<h.rows.length;y++)b.push(Math.round(T)),T+=h.rows[y]?.height??0;b.push(Math.round(T));let H=p.headerRowCount??0,F=H>0&&p.continuesFromPrev?chunkRSU4HTC6_js.V(h,H):0,k=(b[p.fromRow]??0)+(p.topClip??0),P=p.bottomClip!==void 0?Math.round(p.height):F+((b[p.toRow]??0)-k),S=y=>F+(y-k);for(let y=p.fromRow;y<p.toRow&&y<d.rows.length;y++){let B=d.rows[y],R=h.rows[y];if(!B||!R)continue;let X=b[y]??0,I=0;for(let L=0;L<B.cells.length;L++){let C=B.cells[L],M=R.cells[L];if(!C||!M)continue;let w=C.padding?.top??0,A=chunkRSU4HTC6_js.L(C.blocks,M.blocks,w);for(let v=0;v<C.blocks.length;v++){let Y=C.blocks[v],z=M.blocks[v];if(!Y||Y.kind!=="paragraph"||!z||z.kind!=="paragraph")continue;let N=Y,Le=z,Ae=A.lineTops[v]??[],De=Me(N,Le,o,s);for(let{line:_,index:ve}of De){let $=V(N,_);if($.pmStart===void 0||$.pmEnd===void 0)continue;let ie=Math.max($.pmStart,o),ae=Math.min($.pmEnd,s);if(ie>=ae)continue;let K=S(X+(Ae[ve]??0));if(K+_.lineHeight<=F||K>=P)continue;let _e=W(N,_,ie),Oe=W(N,_,ae),se=G(N,_,_e,M.width),le=G(N,_,Oe,M.width);i.push({x:p.x+I+Math.min(se,le),y:p.y+K+u,width:Math.max(1,Math.abs(le-se)),height:_.lineHeight,pageIndex:l});}}I+=M.width;}}}if(c.kind==="image"){let m=c.pmStart??0;(c.pmEnd??m+1)>o&&m<s&&i.push({x:c.x,y:c.y+u,width:c.width,height:c.height,pageIndex:l});}}}return i}function Qe(e,n,a,r){for(let t=0;t<e.pages.length;t++){let o=e.pages[t],s=D(e,t);for(let i of o.fragments){if(i.kind==="paragraph"){let l=oe(n,i.blockId);if(l===-1)continue;let f=n[l],u=a[l];if(!f||f.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let c=f,m=u,g=i,x=c.pmStart??0,d=c.pmEnd??x;if(r<x||r>d)continue;for(let h=g.fromLine;h<g.toLine;h++){let p=m.lines[h];if(!p)continue;let b=V(c,p);if(!(b.pmStart===void 0||b.pmEnd===void 0)&&r>=b.pmStart&&r<=b.pmEnd){let T=W(c,p,r),H=c.attrs?.indent,F=H?.left??0,k=H?.right??0,P=Math.max(0,i.width-F-k),S=G(c,p,T),y=c.attrs?.alignment??"left",B=0;y==="center"?B=Math.max(0,(P-p.width)/2):y==="right"&&(B=Math.max(0,P-p.width));let R=j(m,h)-j(m,g.fromLine);return {x:i.x+F+B+S,y:i.y+R+s,height:p.lineHeight,pageIndex:t}}}}if(i.kind==="image"){let l=i.pmStart??0,f=i.pmEnd??l+1;if(r>=l&&r<=f){let u=r===l?0:i.width;return {x:i.x+u,y:i.y+s,height:i.height,pageIndex:t}}}}}return null}function Ze(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function et(e){let n=new Map;for(let a of e){let r=n.get(a.pageIndex)??[];r.push(a),n.set(a.pageIndex,r);}return n}function tt(e){if(e.kind!=="paragraph")return false;let n=e.attrs;return n?!!(n.borders?.top||n.borders?.bottom||n.spacingExplicit?.before||n.spacingExplicit?.after):false}function Fe(e){return ye(e)}function ye(e){let n=new Set;for(let a=1;a<e.length;a++){let r=e[a-1],t=e[a];r.kind==="table"&&t.kind==="paragraph"&&(t.runs.length>0||tt(t)||n.add(a));}return e.map((a,r)=>{if(a.kind==="table")return nt(a);if(a.kind!=="paragraph")return a;let t=n.has(r),o=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!o?.before,f=i&&!o?.after,u=l||f;if(!u&&!t)return a;let c=a.attrs;return u&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:o?.before?c.spacing.before:void 0,after:o?.after?c.spacing.after:void 0}}),t&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function nt(e){let n=false,a=e.rows.map(r=>{let t=false,o=r.cells.map(s=>{let i=ye(s.blocks);return i.some((f,u)=>f!==s.blocks[u])?(t=true,{...s,blocks:i}):s});return t?(n=true,{...r,cells:o}):r});return n?{...e,rows:a}:e}function ot(e){return e?.align??e?.alignment}function He(e,n,a,r){let t=r.section==="header"?r.margins.header??48:r.pageSize.h-(r.margins.footer??48)-a,o=e.position?.vertical;if(!o)return n;let s=ot(o),i=o.posOffset!==void 0?chunk4Q2IP5FW_js.e(o.posOffset):void 0;if(o.relativeTo==="page"){if(i!==void 0)return i-t;if(s==="top")return -t;if(s==="bottom")return r.pageSize.h-e.height-t;if(s==="center")return (r.pageSize.h-e.height)/2-t}if(o.relativeTo==="margin"){let l=r.margins.top,f=r.pageSize.h-r.margins.top-r.margins.bottom;if(i!==void 0)return l+i-t;if(s==="top")return l-t;if(s==="bottom")return l+f-e.height-t;if(s==="center")return l+(f-e.height)/2-t}return i!==void 0?n+i:n}function we(e){switch(e.kind){case "paragraph":case "table":return true;case "image":return !e.anchor?.isAnchored;case "textBox":return e.displayMode===void 0||e.displayMode==="inline";default:return false}}function rt(e){return e?e.kind==="paragraph"||e.kind==="table"?e.totalHeight:e.kind==="image"||e.kind==="textBox"?e.height:0:0}function Pe(e,n,a,r){let t=0,o=a,s=0;for(let i=0;i<e.length;i++){let l=e[i],f=n[i];if(!(!l||!f)){if(l.kind==="paragraph"&&f.kind==="paragraph"){let u=s,c=u+f.totalHeight;t=Math.min(t,u),o=Math.max(o,c);for(let m of l.runs){if(m.kind!=="image"||!m.position)continue;let g=He(m,u,a,r);t=Math.min(t,g),o=Math.max(o,g+m.height);}s=c;}else if(l.kind==="table"&&f.kind==="table"){let u=s+f.totalHeight;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="image"&&f.kind==="image"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),s=u;}else if(l.kind==="textBox"&&f.kind==="textBox"){let u=s+f.height;t=Math.min(t,s),o=Math.max(o,u),s=u;}}}return {visualTop:t,visualBottom:o}}function it(e,n,a,r){if(!e||!e.content||e.content.length===0)return;let t=chunkBUCOTKYY_js.b(e.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null});return Se(t,n,a,r)}function Se(e,n,a,r){let t=chunkFQS436KN_js.c(e,{theme:r.theme??void 0});if(t.length===0)return;let o=Fe(t),s=r.measureBlocks(o,n),i=0,l=0;for(let c=0;c<o.length;c++){let m=rt(s[c]);i+=m,we(o[c])&&(l+=m);}let{visualTop:f,visualBottom:u}=Pe(t,s,i,a);return {blocks:o,measures:s,height:i,flowHeight:l,visualTop:f,visualBottom:u}}var J={header:null,footer:null};function at(){J.header=null,J.footer=null;}function Be(e,n){let a=n.querySelectorAll(`.layout-page-${e}`);if(a.length===0)return null;let r=n.defaultView,t=r?r.innerHeight/2:0,o=a[0],s=1/0;for(let c of Array.from(a)){let m=c.getBoundingClientRect(),g=Math.abs((m.top+m.bottom)/2-t);g<s&&(s=g,o=c);}let i=J[e];if(i&&i.host===o&&i.host.isConnected)return i;let l=Array.from(o.querySelectorAll("span[data-pm-start][data-pm-end]")),f=Array.from(o.querySelectorAll("[data-pm-start][data-pm-end]")),u={host:o,spans:l,ranged:f};return J[e]=u,u}function st(e,n,a=globalThis.document){let r=e.state.selection;if(!r.empty)return null;let t=r.head,o=Be(n,a);if(!o)return null;let{host:s,spans:i}=o;for(let d of i){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!(!Number.isFinite(h)||!Number.isFinite(p))&&t>=h&&t<=p){let b=s.ownerDocument.createRange(),T=s.ownerDocument.createTreeWalker(d,NodeFilter.SHOW_TEXT),H=t-h,F=T.nextNode();for(;F;){let S=F.data.length;if(H<=S){try{b.setStart(F,H),b.setEnd(F,H);let y=b.getClientRects()[0]??b.getBoundingClientRect();if(y&&y.height>0)return {top:y.top,left:y.left,height:y.height}}catch{}break}H-=S,F=T.nextNode();}let k=d.getBoundingClientRect(),P=(t-h)/Math.max(1,p-h);return {top:k.top,left:k.left+k.width*P,height:k.height}}}let l=s.querySelector(`[data-pm-start="${t}"]`);if(l){let d=l.getBoundingClientRect();return {top:d.top,left:d.left+1,height:d.height||16}}let f=o.ranged,u=null,c=1/0;for(let d of f){let h=Number(d.dataset.pmStart),p=Number(d.dataset.pmEnd);if(!Number.isFinite(h)||!Number.isFinite(p)||t<h||t>p)continue;let b=p-h;b<c&&(c=b,u=d);}if(u){let d=u.getBoundingClientRect(),h=Number(u.dataset.pmEnd),p=t>=h;return {top:d.top,left:p?d.right:d.left+1,height:d.height||16}}let m=null,g=-1/0;for(let d of f){let h=Number(d.dataset.pmStart);Number.isFinite(h)&&(h>t||h>g&&(g=h,m=d));}if(m){let d=m.getBoundingClientRect();return {top:d.top,left:d.right,height:d.height||16}}let x=s.getBoundingClientRect();return {top:x.top+2,left:x.left+2,height:16}}function lt(e,n,a=globalThis.document){let r=e.state.selection;if(r.empty)return [];let t=r.from,o=r.to,s=[],i=Be(n,a);if(!i)return s;let{host:l,spans:f}=i;for(let u of f){let c=Number(u.dataset.pmStart),m=Number(u.dataset.pmEnd);if(!Number.isFinite(c)||!Number.isFinite(m)||m<=t||c>=o)continue;if(u.classList.contains("layout-run-tab")){let p=u.getBoundingClientRect();s.push({top:p.top,left:p.left,width:p.width,height:p.height});continue}let g=null;if(u.firstChild?.nodeType===Node.TEXT_NODE?g=u.firstChild:u.firstChild?.nodeType===Node.ELEMENT_NODE&&u.firstChild.tagName==="A"&&u.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(g=u.firstChild.firstChild),!g)continue;let x=Math.max(0,t-c),d=Math.min(g.length,o-c);if(x>=d)continue;let h=l.ownerDocument.createRange();h.setStart(g,x),h.setEnd(g,d);for(let p of Array.from(h.getClientRects()))s.push({top:p.top,left:p.left,width:p.width,height:p.height});}return s}function Re(e){return e?e.flowHeight??e.height:0}function ct(e){let{pageSize:n,margins:a,finalMargins:r,bodyBlocks:t,headers:o,footers:s,warn:i}=e,l=a.header??48,f=a.footer??48,u=a.top-l,c=a.bottom-f,m=Math.max(0,...(o??[]).map(Re)),g=Math.max(0,...(s??[]).map(Re)),x=m>u,d=g>c;if(!x&&!d)return {margins:a,finalMargins:r};let h=Math.max(0,n.h-24),p=false,b=F=>{let k={...F};return x&&(k.top=Math.max(F.top,l+m)),d&&(k.bottom=Math.max(F.bottom,f+g)),k.top+k.bottom>h&&(p=true,k.bottom=Math.max(0,Math.min(k.bottom,h-k.top)),k.top+k.bottom>h&&(k.top=Math.max(0,h-k.bottom))),k},T=b(a),H=b(r);if(t)for(let F of t){if(F.kind!=="sectionBreak")continue;let k=F;k.margins&&(k.margins=b(k.margins));}return p&&i&&i(`[layout] header/footer content exceeds page height; clamping margins to preserve a content area. pageHeight=${Math.round(n.h)} headerBand=${Math.round(m)} footerBand=${Math.round(g)} top=${Math.round(T.top)} bottom=${Math.round(T.bottom)}`),{margins:T,finalMargins:H}}var Ie=816,Ce=1056,U=96,re=48;function E(e){return Math.round(e/1440*96)}function ut(e){return {w:e?.pageWidth?E(e.pageWidth):Ie,h:e?.pageHeight?E(e.pageHeight):Ce}}function ft(e){return {top:e?.marginTop?E(e.marginTop):U,right:e?.marginRight?E(e.marginRight):U,bottom:e?.marginBottom?E(e.marginBottom):U,left:e?.marginLeft?E(e.marginLeft):U,header:e?.headerDistance?E(e.headerDistance):re,footer:e?.footerDistance?E(e.footerDistance):re}}function dt(e,n){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let r=e.package.headers,t=e.package.footers,o=null,s=null,i=null,l=null;if(r&&n?.headerReferences){let f=n.headerReferences.find(c=>c.type==="default");f?.rId&&(o=r.get(f.rId)??null);let u=n.headerReferences.find(c=>c.type==="first");u?.rId&&(i=r.get(u.rId)??null);}if(t&&n?.footerReferences){let f=n.footerReferences.find(c=>c.type==="default");f?.rId&&(s=t.get(f.rId)??null);let u=n.footerReferences.find(c=>c.type==="first");u?.rId&&(l=t.get(u.rId)??null);}return n?.titlePg||(!o&&i&&(o=i),!s&&l&&(s=l)),{header:o,footer:s,firstHeader:i,firstFooter:l}}function ht(e){let n=e?.columnCount??1;if(n<=1)return;let a=E(e?.columnSpace??720);return {count:n,gap:a,equalWidth:e?.equalWidth??true,separator:e?.separator}}function Ee(e){let n=e.pageSize.w-e.margins.left-e.margins.right,a=e.columns;return !a||a.count<=1?n:Math.floor((n-(a.count-1)*a.gap)/a.count)}function mt(e,n,a){let{configs:r,breakIndices:t}=chunkRSU4HTC6_js.T(e,n,a),o=0,s=[];for(let i=0;i<e.length;i++)s.push(Ee(r[o]??n)),o<t.length&&i===t[o]&&o++;return s}exports.A=at;exports.B=st;exports.C=lt;exports.D=ct;exports.E=Ie;exports.F=Ce;exports.G=U;exports.H=re;exports.I=E;exports.J=ut;exports.K=ft;exports.L=dt;exports.M=ht;exports.N=Ee;exports.O=mt;exports.a=Z;exports.b=D;exports.c=Xe;exports.d=me;exports.e=Ye;exports.f=ge;exports.g=ze;exports.h=We;exports.i=Ge;exports.j=Ve;exports.k=ne;exports.l=xe;exports.m=qe;exports.n=ke;exports.o=je;exports.p=Je;exports.q=Ke;exports.r=Qe;exports.s=Ze;exports.t=et;exports.u=Fe;exports.v=He;exports.w=we;exports.x=Pe;exports.y=it;exports.z=Se;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-FYRJTDC4.mjs';import {a as a$1}from'./chunk-ARHPXIBJ.mjs';import {b,a as a$2}from'./chunk-CUY2THAO.mjs';import {i,t}from'./chunk-CHN26LLL.mjs';import {f}from'./chunk-UE2ZKRYB.mjs';import {a}from'./chunk-QYUPLKLP.mjs';var P=class o{constructor(t){a(this,"_document");a(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let e=await f(t);return new o(e)}static fromDocument(t){return new o(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],e=this._document.package.document;for(let n of e.content)n.type==="paragraph"&&this._extractParagraphSegments(n,t);return t}getVariables(){return a$1(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let a=r;e.push({id:n,name:a.name||n,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return e}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(n=>n.length>0).length}getCharacterCount(t=true){let e=this.getText();return t?e.length:e.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let e=this._document.package.document,n=e.content.filter(i=>i.type==="paragraph"),r=n.map((i,s)=>{let c=this._getParagraphText(i),p=i.formatting?.styleId;return {index:s,preview:c.slice(0,t),style:p,isHeading:p?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(p),isListItem:!!i.listRendering,isEmpty:c.trim().length===0}}),a=(e.sections||[]).map((i,s)=>({index:s,paragraphCount:i.content?.length||0,pageSize:i.properties?.pageWidth&&i.properties?.pageHeight?{width:i.properties.pageWidth,height:i.properties.pageHeight}:void 0,isLandscape:i.properties?.orientation==="landscape",hasHeader:!!i.properties?.headerReferences?.length,hasFooter:!!i.properties?.footerReferences?.length}));return {paragraphCount:n.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:r,sections:a,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,n={}){let r={type:"insertText",position:t,text:e,formatting:n.formatting};return this._executeCommand(r)}replaceRange(t,e,n={}){let r={type:"replaceText",range:t,text:e,formatting:n.formatting};return this._executeCommand(r)}deleteRange(t){let e={type:"deleteText",range:t};return this._executeCommand(e)}applyFormatting(t,e){let n={type:"formatText",range:t,formatting:e};return this._executeCommand(n)}applyStyle(t,e){let n={type:"applyStyle",paragraphIndex:t,styleId:e};return this._executeCommand(n)}applyParagraphFormatting(t,e){let n={type:"formatParagraph",paragraphIndex:t,formatting:e};return this._executeCommand(n)}insertTable(t,e,n,r={}){let a={type:"insertTable",position:t,rows:e,columns:n,data:r.data,hasHeader:r.hasHeader};return this._executeCommand(a)}insertImage(t,e,n={}){let r={type:"insertImage",position:t,src:e,width:n.width,height:n.height,alt:n.alt};return this._executeCommand(r)}insertHyperlink(t,e,n={}){let r={type:"insertHyperlink",range:t,url:e,displayText:n.displayText,tooltip:n.tooltip};return this._executeCommand(r)}removeHyperlink(t){let e={type:"removeHyperlink",range:t};return this._executeCommand(e)}insertParagraphBreak(t){let e={type:"insertParagraphBreak",position:t};return this._executeCommand(e)}mergeParagraphs(t,e){let n={type:"mergeParagraphs",paragraphIndex:t,count:e};return this._executeCommand(n)}setVariable(t,e){return this._pendingVariables[t]=e,this}setVariables(t){for(let[e,n]of Object.entries(t))this._pendingVariables[e]=n;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let e={...this._pendingVariables,...t};if(Object.keys(e).length===0)return this;let n=this._document.originalBuffer;if(!n)throw new Error("Cannot apply variables: no original buffer for processing");let{processTemplate:r}=await import('./processTemplate-GPFDLQMX.mjs'),a=r(n,e),i=await f(a),s=new o(i);return s._pendingVariables={},s}async toBuffer(t$1){if(this._document.originalBuffer){if(t$1?.selective){let n=await c(this._document,this._document.originalBuffer,t$1.selective);if(n)return this._document.originalBuffer=n,n}let e=await i(this._document);return this._document.originalBuffer=e,e}return t(this._document)}async toBlob(t="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let e=await this.toBuffer();return new Blob([e],{type:t})}executeCommands(t){return new o(b(this._document,t))}_executeCommand(t){let e=new o(a$2(this._document,t));return e._pendingVariables={...this._pendingVariables},e}_getBodyText(t){let e=[];for(let n of t.content)n.type==="paragraph"?e.push(this._getParagraphText(n)):n.type==="table"&&e.push(this._getTableText(n));return e.join(`
|
|
2
2
|
`)}_getParagraphText(t){let e=[];for(let n of t.content)n.type==="run"?e.push(this._getRunText(n)):n.type==="hyperlink"&&e.push(this._getHyperlinkText(n));return e.join("")}_getRunText(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("")}_getHyperlinkText(t){let e=[];for(let n of t.children)n.type==="run"&&e.push(this._getRunText(n));return e.join("")}_getTableText(t){let e=[];for(let n of t.rows)for(let r of n.cells)for(let a of r.content)a.type==="paragraph"&&e.push(this._getParagraphText(a));return e.join(" ")}_extractParagraphSegments(t,e){for(let n of t.content)if(n.type==="run"){let r=this._getRunText(n);r&&e.push({text:r,formatting:n.formatting});}else if(n.type==="hyperlink"){let r=n.href||"";for(let a of n.children)if(a.type==="run"){let i=this._getRunText(a);i&&e.push({text:i,formatting:a.formatting,isHyperlink:true,hyperlinkUrl:r});}}}_parseHeadingLevel(t){if(!t)return;let e=t.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}_hasImages(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="run"){for(let r of n.content)if(r.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="hyperlink")return true}return false}};async function Ct(o){return P.fromBuffer(o)}function kt(o){return P.fromDocument(o)}function M(o,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:n=50}=t,r=o.package.document,a=r.content.filter(y=>y.type==="paragraph"),i=z(a,e,n),s=a$1(o),c=W(o),p=$(r),u=U(r),d=G(r),f=r.content.some(y=>y.type==="table"),x=K(r),l=N(r);return {paragraphCount:a.length,wordCount:u,characterCount:d,variables:s,variableCount:s.length,availableStyles:c,outline:i,sections:p,hasTables:f,hasImages:x,hasHyperlinks:l}}function At(o,t,e={}){let{contextChars:n=200,includeSuggestions:r=true}=e,i=o.package.document.content.filter(m=>m.type==="paragraph"),s=i[t.start.paragraphIndex];if(!s)throw new Error(`Paragraph not found at index ${t.start.paragraphIndex}`);let c=g(s),p="";if(t.start.paragraphIndex===t.end.paragraphIndex)p=c.slice(t.start.offset,t.end.offset);else {let m=[];for(let b=t.start.paragraphIndex;b<=t.end.paragraphIndex;b++){let H=i[b];if(!H)continue;let _=g(H);b===t.start.paragraphIndex?m.push(_.slice(t.start.offset)):b===t.end.paragraphIndex?m.push(_.slice(0,t.end.offset)):m.push(_);}p=m.join(`
|
|
3
3
|
`);}let u=Y(i,t.start.paragraphIndex,t.start.offset,n),d=Z(i,t.end.paragraphIndex,t.end.offset,n),f=tt(s,t.start.offset),x=s.formatting||{},l={index:t.start.paragraphIndex,fullText:c,style:s.formatting?.styleId,wordCount:v(c)},y=false,A=et(s,t.start.offset),S=r?nt(p):[];return {selectedText:p,range:t,formatting:f,paragraphFormatting:x,textBefore:u,textAfter:d,paragraph:l,inTable:y,inHyperlink:A,suggestedActions:S}}function L(o){let t=M(o,{outlineMaxChars:50,maxOutlineParagraphs:10}),e=[`Document with ${t.paragraphCount} paragraphs, ${t.wordCount} words.`];t.hasTables&&e.push("Contains tables."),t.hasImages&&e.push("Contains images."),t.hasHyperlinks&&e.push("Contains hyperlinks."),t.variableCount>0&&e.push(`Has ${t.variableCount} template variables: ${t.variables.join(", ")}`);let n=t.outline.filter(r=>r.isHeading);if(n.length>0){e.push(`
|
|
4
4
|
Headings:`);for(let r of n.slice(0,5)){let a=r.headingLevel||1;e.push(`${" ".repeat(a-1)}- ${r.preview}`);}n.length>5&&e.push(` ... and ${n.length-5} more headings`);}return e.join(" ")}function z(o,t,e){let n=[];for(let r=0;r<Math.min(o.length,e);r++){let a=o[r],i=g(a),s=a.formatting?.styleId;n.push({index:r,preview:i.slice(0,t),style:s,isHeading:Q(s),headingLevel:X(s),isListItem:!!a.listRendering,isEmpty:i.trim().length===0});}return n}function W(o){let t=o.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let a=r;e.push({id:n,name:a.name||n,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return e}function $(o){return o.sections?o.sections.map((t,e)=>({index:e,paragraphCount:t.content?.length||0,pageSize:t.properties?.pageWidth&&t.properties?.pageHeight?{width:t.properties.pageWidth,height:t.properties.pageHeight}:void 0,isLandscape:t.properties?.orientation==="landscape",hasHeader:!!t.properties?.headerReferences?.length,hasFooter:!!t.properties?.footerReferences?.length})):[]}function U(o){let t=0;for(let e of o.content)if(e.type==="paragraph"){let n=g(e);t+=v(n);}else e.type==="table"&&(t+=q(e));return t}function v(o){return o.split(/\s+/).filter(e=>e.length>0).length}function G(o){let t=0;for(let e of o.content)if(e.type==="paragraph"){let n=g(e);t+=n.length;}else e.type==="table"&&(t+=J(e));return t}function q(o){let t=0;for(let e of o.rows)for(let n of e.cells)for(let r of n.content)if(r.type==="paragraph"){let a=g(r);t+=v(a);}return t}function J(o){let t=0;for(let e of o.rows)for(let n of e.cells)for(let r of n.content)if(r.type==="paragraph"){let a=g(r);t+=a.length;}return t}function g(o){let t=[];for(let e of o.content)e.type==="run"?t.push(T(e)):e.type==="hyperlink"&&t.push(F(e));return t.join("")}function T(o){return o.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function F(o){let t=[];for(let e of o.children)e.type==="run"&&t.push(T(e));return t.join("")}function K(o){for(let t of o.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let n of e.content)if(n.type==="drawing")return true}}return false}function N(o){for(let t of o.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="hyperlink")return true}return false}function Q(o){return o?o.toLowerCase().includes("heading"):false}function X(o){if(!o)return;let t=o.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}function Y(o,t,e,n){let r=[],a=0,i=o[t];if(i){let p=g(i).slice(0,e);r.unshift(p),a+=p.length;}for(let c=t-1;c>=0&&a<n;c--){let p=o[c];if(!p)continue;let u=g(p);r.unshift(u),a+=u.length;}let s=r.join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkQLAIOTQB_js=require('./chunk-QLAIOTQB.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var i={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},y=[`.${i.pageFloatingImage}`,`.${i.cellFloatingImage}`,`.${i.blockImage}`,`.${i.runImage}`].join(", ");function L(n){if(!(n instanceof Element))return null;let e=n.closest(y);if(!e)return null;let o=e.dataset.pmStart;if(o===void 0)return null;let t=Number(o);return Number.isNaN(t)?null:{pos:t,imageEl:e}}function b(n){if(!(n instanceof HTMLElement))return null;if(n.tagName==="IMG"&&n.classList.contains(i.runImage))return n;let e=n.closest(y);return e&&e.dataset.pmStart?e:null}function x(n,e=1){if(!n.classList.contains(i.runImage))return;let o=n.closest(`.${i.pageContent}`),t=n.closest(`.${i.paragraph}`);if(!o||!t)return;let r=n.getBoundingClientRect(),a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),p=e>0?e:1;return {horizontalEmu:Math.round(chunk4Q2IP5FW_js.f((r.left-a.left)/p)),verticalEmu:Math.round(chunk4Q2IP5FW_js.f((r.top-l.top)/p))}}function T(n,e){return n==="inline"?"inline":n==="behind"?"behind":n==="inFront"?"inFront":n==="square"||n==="tight"||n==="through"?e==="right"?"squareRight":"squareLeft":null}var k=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function I(n,e){return true}function E(n){switch(n){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function X(n,e){let o=new Map;for(let t=0;t<n.length;t++){let r=n[t],a=e[t];r&&a&&o.set(String(r.id),{block:r,measure:a});}return o}var c=class{constructor(e={}){chunkDC7S76ZX_js.a(this,"container",null);chunkDC7S76ZX_js.a(this,"blockLookup",new Map);chunkDC7S76ZX_js.a(this,"pageStates",[]);chunkDC7S76ZX_js.a(this,"totalPages",0);chunkDC7S76ZX_js.a(this,"options");chunkDC7S76ZX_js.a(this,"doc");chunkDC7S76ZX_js.a(this,"resolvedCommentIds",new Set);this.options=e,this.doc=e.document??document;}setBlockLookup(e){this.blockLookup=e;}mount(e){this.container=e,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let e=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${e}px`,this.container.style.padding=`${e}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(e){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:o}=e;this.totalPages=o.length,this.container.innerHTML="",this.pageStates=[];for(let t=0;t<o.length;t++){let r=o[t],a={pageNumber:r.number,totalPages:this.totalPages,section:"body",resolvedCommentIds:this.resolvedCommentIds},l=this.renderPageWithLookup(r,a);this.container.appendChild(l),this.pageStates.push({element:l,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(e,o){let t=this.doc.createElement("div");t.className="layout-page",t.dataset.pageNumber=String(e.number),t.style.position="relative",t.style.width=`${e.size.w}px`,t.style.height=`${e.size.h}px`,t.style.backgroundColor=this.options.pageBackground??"#ffffff",t.style.overflow="hidden",this.options.showShadow&&(t.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${e.margins.top}px`,r.style.left=`${e.margins.left}px`,r.style.right=`${e.margins.right}px`,r.style.bottom=`${e.margins.bottom}px`,r.style.overflow="visible";for(let a of e.fragments){let l=this.renderFragmentWithLookup(a,o);this.applyFragmentPosition(l,a),r.appendChild(l);}return t.appendChild(r),t}renderFragmentWithLookup(e,o){let t=this.blockLookup.get(String(e.blockId));if(e.kind==="paragraph"&&t){let r=t.block,a=t.measure;return chunkQLAIOTQB_js.t(e,r,a,o,{document:this.doc})}if(e.kind==="table"&&t){let r=t.block,a=t.measure;return chunkQLAIOTQB_js.w(e,r,a,o,{document:this.doc})}if(e.kind==="image"&&t){let r=t.block,a=t.measure;return chunkQLAIOTQB_js.q(e,r,a,o,{document:this.doc})}if(e.kind==="textBox"&&t){let r=t.block,a=t.measure;return chunkQLAIOTQB_js.y(e,r,a,o,{document:this.doc})}return chunkQLAIOTQB_js.o(e,o,{document:this.doc})}applyFragmentPosition(e,o){e.style.position="absolute",e.style.left=`${o.x}px`,e.style.top=`${o.y}px`,e.style.width=`${o.width}px`,"height"in o&&(e.style.height=`${o.height}px`);}getPageCount(){return this.totalPages}getPageElement(e){return this.pageStates[e]?.element??null}scrollToPage(e){let o=this.pageStates.find(t=>t.pageNumber===e);o?.element&&o.element.scrollIntoView({behavior:"smooth",block:"start"});}};function Z(n){return new c(n)}exports.a=i;exports.b=L;exports.c=b;exports.d=x;exports.e=T;exports.f=k;exports.g=I;exports.h=E;exports.i=X;exports.j=c;exports.k=Z;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk3R7QHNI5_js=require('./chunk-3R7QHNI5.js');var u={image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",footnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",endnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",webSettings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",oleObject:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",diagramData:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",customProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",customXml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",commentsExtended:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",commentsIds:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",commentsExtensible:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"};function x(e){let t=new Map;if(!e||e.trim().length===0)return t;let i=chunk3R7QHNI5_js.c(e);if(!i)return console.warn("Failed to parse relationships XML"),t;let f=chunk3R7QHNI5_js.i(i);for(let o of f){let l=o.name||"";if(!l.endsWith("Relationship")&&!l.includes(":Relationship"))continue;let n=chunk3R7QHNI5_js.j(o,null,"Id"),r=chunk3R7QHNI5_js.j(o,null,"Type"),a=chunk3R7QHNI5_js.j(o,null,"Target"),c=chunk3R7QHNI5_js.j(o,null,"TargetMode");if(!n||!r||!a){console.warn("Relationship missing required attributes:",{id:n,type:r,target:a});continue}let p={id:n,type:r,target:a};c==="External"?p.targetMode="External":c==="Internal"&&(p.targetMode="Internal"),t.set(n,p);}return t}function d(e){return e.type===u.hyperlink&&e.targetMode==="External"}function R(e,t){return e.get(t)?.target}
|
|
2
2
|
exports.a=u;exports.b=x;exports.c=d;exports.d=R;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Document } from './types/document.js';
|
|
2
2
|
import { T as ThemeColorSlot, C as ColorValue } from './colors-C3vA7HUU.js';
|
|
3
|
-
import { T as Theme, f as ThemeColorScheme } from './styles-
|
|
3
|
+
import { T as Theme, f as ThemeColorScheme } from './styles-BWqX2AS-.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Template Processing Utility
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Document } from './types/document.mjs';
|
|
2
2
|
import { T as ThemeColorSlot, C as ColorValue } from './colors-C3vA7HUU.mjs';
|
|
3
|
-
import { T as Theme, f as ThemeColorScheme } from './styles-
|
|
3
|
+
import { T as Theme, f as ThemeColorScheme } from './styles-BOJ93SAm.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Template Processing Utility
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { P as ParagraphFormatting, T as TextFormatting, a as TableFormatting, b as TableRowFormatting, c as TableCellFormatting } from './formatting-BH4hcZiq.mjs';
|
|
2
2
|
import { WrapType } from './docx/wrapTypes.mjs';
|
|
3
3
|
import { B as BorderSpec, C as ColorValue, T as ThemeColorSlot } from './colors-C3vA7HUU.mjs';
|
|
4
|
+
import { W as Watermark } from './watermark-DAcnAs_J.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Lists & Numbering Types
|
|
@@ -546,6 +547,12 @@ interface HeaderFooter {
|
|
|
546
547
|
hdrFtrType: HeaderFooterType;
|
|
547
548
|
/** Content (paragraphs, tables, etc.) */
|
|
548
549
|
content: BlockContent[];
|
|
550
|
+
/**
|
|
551
|
+
* Watermark stored on this header (MS Word "Design → Watermark"). Lives
|
|
552
|
+
* here, not in `content`, so it stays out of the editable text flow while
|
|
553
|
+
* still round-tripping. Only headers carry watermarks; footers never do.
|
|
554
|
+
*/
|
|
555
|
+
watermark?: Watermark;
|
|
549
556
|
}
|
|
550
557
|
/**
|
|
551
558
|
* Footnote position
|
|
@@ -588,12 +595,23 @@ interface Footnote {
|
|
|
588
595
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
589
596
|
/**
|
|
590
597
|
* Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
|
|
591
|
-
* the body
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* (toProseDoc → toFlowBlocks)
|
|
598
|
+
* the body, so the note parser reuses the body's `parseBlockContent`: the
|
|
599
|
+
* full block model — paragraphs, tables, and block-level `w:sdt` content
|
|
600
|
+
* controls (as `BlockSdt`) — flows through the body pipeline
|
|
601
|
+
* (toProseDoc → toFlowBlocks) and stays editable on round-trip.
|
|
595
602
|
*/
|
|
596
603
|
content: BlockContent[];
|
|
604
|
+
/**
|
|
605
|
+
* Verbatim original XML of the entire `<w:footnote>` element, captured at
|
|
606
|
+
* parse time ONLY when the note body carries a block-level construct the
|
|
607
|
+
* model still can't represent — note-level bookmarks
|
|
608
|
+
* (`w:bookmarkStart`/`w:bookmarkEnd`) or `w:customXml`. Block-level `w:sdt`
|
|
609
|
+
* is NOT a trigger: it round-trips through the model as `BlockSdt`. When
|
|
610
|
+
* present the serializer re-emits these bytes instead of rebuilding from
|
|
611
|
+
* `content`, restoring pre-#646 fidelity for the unmodeled constructs.
|
|
612
|
+
* See `parseNoteBlockContent` / `serializeNote` for the gate (#646 F3).
|
|
613
|
+
*/
|
|
614
|
+
verbatimXml?: string;
|
|
597
615
|
}
|
|
598
616
|
/**
|
|
599
617
|
* Endnote (w:endnote)
|
|
@@ -606,9 +624,12 @@ interface Endnote {
|
|
|
606
624
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
607
625
|
/**
|
|
608
626
|
* Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
|
|
609
|
-
* the body — paragraphs and
|
|
627
|
+
* the body — paragraphs, tables, and block-level content controls. See note
|
|
628
|
+
* on `Footnote.content`.
|
|
610
629
|
*/
|
|
611
630
|
content: BlockContent[];
|
|
631
|
+
/** Verbatim original XML — see `Footnote.verbatimXml` (#646 F3). */
|
|
632
|
+
verbatimXml?: string;
|
|
612
633
|
}
|
|
613
634
|
|
|
614
635
|
/**
|
|
@@ -1336,6 +1357,29 @@ interface NoteReferenceContent {
|
|
|
1336
1357
|
/** Note ID */
|
|
1337
1358
|
id: number;
|
|
1338
1359
|
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Footnote/endnote auto-number mark (`w:footnoteRef` / `w:endnoteRef`).
|
|
1362
|
+
*
|
|
1363
|
+
* Distinct from {@link NoteReferenceContent}: that is the *reference* placed in
|
|
1364
|
+
* the document body (`w:footnoteReference`), whereas this is the numbering
|
|
1365
|
+
* placeholder that lives *inside* the note body — the run carrying it is what
|
|
1366
|
+
* Word renders as the note's leading superscript number. Preserving it keeps
|
|
1367
|
+
* the note's own number visible on round-trip.
|
|
1368
|
+
*/
|
|
1369
|
+
interface NoteRefMarkContent {
|
|
1370
|
+
type: 'footnoteRefMark' | 'endnoteRefMark';
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Footnote/endnote separator mark (`w:separator` / `w:continuationSeparator`).
|
|
1374
|
+
*
|
|
1375
|
+
* These appear inside the special separator notes (`w:type="separator"` and
|
|
1376
|
+
* `w:type="continuationSeparator"`) and draw the horizontal rule Word places
|
|
1377
|
+
* between the body and its notes. They carry no content; Word rejects a notes
|
|
1378
|
+
* part whose separator notes have lost these markers, so they must round-trip.
|
|
1379
|
+
*/
|
|
1380
|
+
interface SeparatorContent {
|
|
1381
|
+
type: 'separator' | 'continuationSeparator';
|
|
1382
|
+
}
|
|
1339
1383
|
/**
|
|
1340
1384
|
* Field character (begin/separate/end)
|
|
1341
1385
|
*/
|
|
@@ -1387,7 +1431,7 @@ interface ShapeContent {
|
|
|
1387
1431
|
/**
|
|
1388
1432
|
* All possible run content types
|
|
1389
1433
|
*/
|
|
1390
|
-
type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
|
|
1434
|
+
type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
|
|
1391
1435
|
/**
|
|
1392
1436
|
* A run (`w:r`) — a contiguous span of inline content sharing one set of
|
|
1393
1437
|
* character properties (bold, italic, font, color, etc.). Runs are the
|
|
@@ -1415,4 +1459,4 @@ interface Run {
|
|
|
1415
1459
|
content: RunContent[];
|
|
1416
1460
|
}
|
|
1417
1461
|
|
|
1418
|
-
export type { HeaderFooterType as $, AbstractNumbering as A, BlockContent as B,
|
|
1462
|
+
export type { HeaderFooterType as $, AbstractNumbering as A, BlockContent as B, CellMarker as C, DocumentBody as D, Endnote as E, Footnote as F, BookmarkStart as G, Hyperlink as H, Image as I, Column as J, ComplexField as K, ListLevel as L, MoveFrom as M, NumberFormat as N, DrawingContent as O, Paragraph as P, EndnotePosition as Q, RevisionInfo as R, SectionProperties as S, Table as T, EndnoteProperties as U, Field as V, FieldCharContent as W, FieldType as X, FooterReference as Y, FootnotePosition as Z, FootnoteProperties as _, ParagraphPropertyChange as a, HeaderReference as a0, ImageCrop as a1, ImagePadding as a2, ImagePosition as a3, ImageSize as a4, ImageTransform as a5, ImageWrap as a6, InlineSdt as a7, InstrTextContent as a8, LevelSuffix as a9, SymbolContent as aA, TabContent as aB, TableStructuralChangeInfo as aC, TextBox as aD, VerticalAlign as aE, LineNumberRestart as aa, ListRendering as ab, MathEquation as ac, MoveFromRangeEnd as ad, MoveFromRangeStart as ae, MoveToRangeEnd as af, MoveToRangeStart as ag, NoBreakHyphenContent as ah, NoteNumberRestart as ai, NoteRefMarkContent as aj, NoteReferenceContent as ak, NumberingInstance as al, PageOrientation as am, PropertyChangeInfo as an, RunPropertyChange as ao, Section as ap, SectionStart as aq, SeparatorContent as ar, Shape as as, ShapeContent as at, ShapeFill as au, ShapeOutline as av, ShapeTextBody as aw, ShapeType as ax, SimpleField as ay, SoftHyphenContent as az, TablePropertyChange as b, TableCellPropertyChange as c, TableRowPropertyChange as d, Comment as e, CommentRangeEnd as f, CommentRangeStart as g, Deletion as h, Insertion as i, MoveTo as j, NumberingDefinitions as k, ParagraphContent as l, Run as m, RunContent as n, TableCell as o, TableRow as p, TextContent as q, TrackedChangeInfo as r, TrackedRunChange as s, SdtType as t, SdtProperties as u, SdtDataBinding as v, BlockSdt as w, BreakContent as x, HeaderFooter as y, BookmarkEnd as z };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { P as ParagraphFormatting, T as TextFormatting, a as TableFormatting, b as TableRowFormatting, c as TableCellFormatting } from './formatting-_OXU8gLB.js';
|
|
2
2
|
import { WrapType } from './docx/wrapTypes.js';
|
|
3
3
|
import { B as BorderSpec, C as ColorValue, T as ThemeColorSlot } from './colors-C3vA7HUU.js';
|
|
4
|
+
import { W as Watermark } from './watermark-DAcnAs_J.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Lists & Numbering Types
|
|
@@ -546,6 +547,12 @@ interface HeaderFooter {
|
|
|
546
547
|
hdrFtrType: HeaderFooterType;
|
|
547
548
|
/** Content (paragraphs, tables, etc.) */
|
|
548
549
|
content: BlockContent[];
|
|
550
|
+
/**
|
|
551
|
+
* Watermark stored on this header (MS Word "Design → Watermark"). Lives
|
|
552
|
+
* here, not in `content`, so it stays out of the editable text flow while
|
|
553
|
+
* still round-tripping. Only headers carry watermarks; footers never do.
|
|
554
|
+
*/
|
|
555
|
+
watermark?: Watermark;
|
|
549
556
|
}
|
|
550
557
|
/**
|
|
551
558
|
* Footnote position
|
|
@@ -588,12 +595,23 @@ interface Footnote {
|
|
|
588
595
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
589
596
|
/**
|
|
590
597
|
* Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
|
|
591
|
-
* the body
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
* (toProseDoc → toFlowBlocks)
|
|
598
|
+
* the body, so the note parser reuses the body's `parseBlockContent`: the
|
|
599
|
+
* full block model — paragraphs, tables, and block-level `w:sdt` content
|
|
600
|
+
* controls (as `BlockSdt`) — flows through the body pipeline
|
|
601
|
+
* (toProseDoc → toFlowBlocks) and stays editable on round-trip.
|
|
595
602
|
*/
|
|
596
603
|
content: BlockContent[];
|
|
604
|
+
/**
|
|
605
|
+
* Verbatim original XML of the entire `<w:footnote>` element, captured at
|
|
606
|
+
* parse time ONLY when the note body carries a block-level construct the
|
|
607
|
+
* model still can't represent — note-level bookmarks
|
|
608
|
+
* (`w:bookmarkStart`/`w:bookmarkEnd`) or `w:customXml`. Block-level `w:sdt`
|
|
609
|
+
* is NOT a trigger: it round-trips through the model as `BlockSdt`. When
|
|
610
|
+
* present the serializer re-emits these bytes instead of rebuilding from
|
|
611
|
+
* `content`, restoring pre-#646 fidelity for the unmodeled constructs.
|
|
612
|
+
* See `parseNoteBlockContent` / `serializeNote` for the gate (#646 F3).
|
|
613
|
+
*/
|
|
614
|
+
verbatimXml?: string;
|
|
597
615
|
}
|
|
598
616
|
/**
|
|
599
617
|
* Endnote (w:endnote)
|
|
@@ -606,9 +624,12 @@ interface Endnote {
|
|
|
606
624
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
607
625
|
/**
|
|
608
626
|
* Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
|
|
609
|
-
* the body — paragraphs and
|
|
627
|
+
* the body — paragraphs, tables, and block-level content controls. See note
|
|
628
|
+
* on `Footnote.content`.
|
|
610
629
|
*/
|
|
611
630
|
content: BlockContent[];
|
|
631
|
+
/** Verbatim original XML — see `Footnote.verbatimXml` (#646 F3). */
|
|
632
|
+
verbatimXml?: string;
|
|
612
633
|
}
|
|
613
634
|
|
|
614
635
|
/**
|
|
@@ -1336,6 +1357,29 @@ interface NoteReferenceContent {
|
|
|
1336
1357
|
/** Note ID */
|
|
1337
1358
|
id: number;
|
|
1338
1359
|
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Footnote/endnote auto-number mark (`w:footnoteRef` / `w:endnoteRef`).
|
|
1362
|
+
*
|
|
1363
|
+
* Distinct from {@link NoteReferenceContent}: that is the *reference* placed in
|
|
1364
|
+
* the document body (`w:footnoteReference`), whereas this is the numbering
|
|
1365
|
+
* placeholder that lives *inside* the note body — the run carrying it is what
|
|
1366
|
+
* Word renders as the note's leading superscript number. Preserving it keeps
|
|
1367
|
+
* the note's own number visible on round-trip.
|
|
1368
|
+
*/
|
|
1369
|
+
interface NoteRefMarkContent {
|
|
1370
|
+
type: 'footnoteRefMark' | 'endnoteRefMark';
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Footnote/endnote separator mark (`w:separator` / `w:continuationSeparator`).
|
|
1374
|
+
*
|
|
1375
|
+
* These appear inside the special separator notes (`w:type="separator"` and
|
|
1376
|
+
* `w:type="continuationSeparator"`) and draw the horizontal rule Word places
|
|
1377
|
+
* between the body and its notes. They carry no content; Word rejects a notes
|
|
1378
|
+
* part whose separator notes have lost these markers, so they must round-trip.
|
|
1379
|
+
*/
|
|
1380
|
+
interface SeparatorContent {
|
|
1381
|
+
type: 'separator' | 'continuationSeparator';
|
|
1382
|
+
}
|
|
1339
1383
|
/**
|
|
1340
1384
|
* Field character (begin/separate/end)
|
|
1341
1385
|
*/
|
|
@@ -1387,7 +1431,7 @@ interface ShapeContent {
|
|
|
1387
1431
|
/**
|
|
1388
1432
|
* All possible run content types
|
|
1389
1433
|
*/
|
|
1390
|
-
type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
|
|
1434
|
+
type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
|
|
1391
1435
|
/**
|
|
1392
1436
|
* A run (`w:r`) — a contiguous span of inline content sharing one set of
|
|
1393
1437
|
* character properties (bold, italic, font, color, etc.). Runs are the
|
|
@@ -1415,4 +1459,4 @@ interface Run {
|
|
|
1415
1459
|
content: RunContent[];
|
|
1416
1460
|
}
|
|
1417
1461
|
|
|
1418
|
-
export type { HeaderFooterType as $, AbstractNumbering as A, BlockContent as B,
|
|
1462
|
+
export type { HeaderFooterType as $, AbstractNumbering as A, BlockContent as B, CellMarker as C, DocumentBody as D, Endnote as E, Footnote as F, BookmarkStart as G, Hyperlink as H, Image as I, Column as J, ComplexField as K, ListLevel as L, MoveFrom as M, NumberFormat as N, DrawingContent as O, Paragraph as P, EndnotePosition as Q, RevisionInfo as R, SectionProperties as S, Table as T, EndnoteProperties as U, Field as V, FieldCharContent as W, FieldType as X, FooterReference as Y, FootnotePosition as Z, FootnoteProperties as _, ParagraphPropertyChange as a, HeaderReference as a0, ImageCrop as a1, ImagePadding as a2, ImagePosition as a3, ImageSize as a4, ImageTransform as a5, ImageWrap as a6, InlineSdt as a7, InstrTextContent as a8, LevelSuffix as a9, SymbolContent as aA, TabContent as aB, TableStructuralChangeInfo as aC, TextBox as aD, VerticalAlign as aE, LineNumberRestart as aa, ListRendering as ab, MathEquation as ac, MoveFromRangeEnd as ad, MoveFromRangeStart as ae, MoveToRangeEnd as af, MoveToRangeStart as ag, NoBreakHyphenContent as ah, NoteNumberRestart as ai, NoteRefMarkContent as aj, NoteReferenceContent as ak, NumberingInstance as al, PageOrientation as am, PropertyChangeInfo as an, RunPropertyChange as ao, Section as ap, SectionStart as aq, SeparatorContent as ar, Shape as as, ShapeContent as at, ShapeFill as au, ShapeOutline as av, ShapeTextBody as aw, ShapeType as ax, SimpleField as ay, SoftHyphenContent as az, TablePropertyChange as b, TableCellPropertyChange as c, TableRowPropertyChange as d, Comment as e, CommentRangeEnd as f, CommentRangeStart as g, Deletion as h, Insertion as i, MoveTo as j, NumberingDefinitions as k, ParagraphContent as l, Run as m, RunContent as n, TableCell as o, TableRow as p, TextContent as q, TrackedChangeInfo as r, TrackedRunChange as s, SdtType as t, SdtProperties as u, SdtDataBinding as v, BlockSdt as w, BreakContent as x, HeaderFooter as y, BookmarkEnd as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from './types/document.js';
|
|
2
|
-
import { t as SdtType, u as SdtProperties, v as SdtDataBinding,
|
|
2
|
+
import { t as SdtType, u as SdtProperties, v as SdtDataBinding, D as DocumentBody, w as BlockSdt, B as BlockContent } from './content-C8fc_tL6.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Content-control (SDT) addressing for the document model.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from './types/document.mjs';
|
|
2
|
-
import { t as SdtType, u as SdtProperties, v as SdtDataBinding,
|
|
2
|
+
import { t as SdtType, u as SdtProperties, v as SdtDataBinding, D as DocumentBody, w as BlockSdt, B as BlockContent } from './content-3xF4WDE8.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Content-control (SDT) addressing for the document model.
|