@eigenpal/docx-editor-core 0.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +36 -1
  2. package/dist/agent/index.js +1 -1
  3. package/dist/agent/index.mjs +1 -1
  4. package/dist/chunk-3GNIP6IX.mjs +4 -0
  5. package/dist/chunk-7UTXBQKF.mjs +1 -0
  6. package/dist/{chunk-CKXAHSJQ.js → chunk-AFMMYLPX.js} +2 -2
  7. package/dist/{chunk-J7ULKGU2.mjs → chunk-AGNZEOVL.mjs} +1 -1
  8. package/dist/chunk-BD4CYYFB.js +1 -0
  9. package/dist/{chunk-6ILFFGGS.js → chunk-C6GSFUV2.js} +1 -1
  10. package/dist/chunk-DN36K5JU.mjs +1 -0
  11. package/dist/{chunk-CWAP26GB.js → chunk-DV6IEOP5.js} +3 -3
  12. package/dist/{chunk-23CP3TOP.js → chunk-GH5N36F7.js} +1 -1
  13. package/dist/chunk-GNPLUGUG.mjs +1 -0
  14. package/dist/chunk-HVZMO3BU.js +1 -0
  15. package/dist/chunk-ITVXBQGR.mjs +1 -0
  16. package/dist/{chunk-S7IKPRC3.js → chunk-KSYEBTYE.js} +1 -1
  17. package/dist/{chunk-ZRZ2VRQQ.mjs → chunk-LDAOONXZ.mjs} +1 -1
  18. package/dist/{chunk-36VIYQHD.mjs → chunk-N3GIC2UI.mjs} +1 -1
  19. package/dist/{chunk-FC6QL3E6.js → chunk-NFYCMDM5.js} +1 -1
  20. package/dist/chunk-P3AXSRLG.mjs +1 -0
  21. package/dist/chunk-PK4PDRTA.js +1 -0
  22. package/dist/{chunk-VKTCTMIO.mjs → chunk-R7RR6M4A.mjs} +1 -1
  23. package/dist/{chunk-BGC7QKP5.mjs → chunk-RSMS6OTE.mjs} +1 -1
  24. package/dist/chunk-TZJUO3NW.js +1 -0
  25. package/dist/chunk-YE357WVA.js +1 -0
  26. package/dist/core-plugins.js +1 -1
  27. package/dist/core-plugins.mjs +1 -1
  28. package/dist/core.d.mts +1 -1
  29. package/dist/core.d.ts +1 -1
  30. package/dist/core.js +1 -1
  31. package/dist/core.mjs +1 -1
  32. package/dist/docx/index.js +1 -1
  33. package/dist/docx/index.mjs +1 -1
  34. package/dist/docx/parser.js +1 -1
  35. package/dist/docx/parser.mjs +1 -1
  36. package/dist/headless.js +1 -1
  37. package/dist/headless.mjs +1 -1
  38. package/dist/layout-bridge/index.d.mts +1 -1
  39. package/dist/layout-bridge/index.d.ts +1 -1
  40. package/dist/layout-bridge/index.js +1 -1
  41. package/dist/layout-bridge/index.mjs +1 -1
  42. package/dist/layout-bridge/measuring/index.d.mts +17 -1
  43. package/dist/layout-bridge/measuring/index.d.ts +17 -1
  44. package/dist/layout-bridge/measuring/index.js +1 -1
  45. package/dist/layout-bridge/measuring/index.mjs +1 -1
  46. package/dist/layout-bridge/tableInsertHover.js +1 -1
  47. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  48. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  49. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  50. package/dist/layout-engine/types.d.mts +8 -4
  51. package/dist/layout-engine/types.d.ts +8 -4
  52. package/dist/layout-painter/index.js +1 -1
  53. package/dist/layout-painter/index.mjs +1 -1
  54. package/dist/layout-painter/renderPage.d.mts +7 -0
  55. package/dist/layout-painter/renderPage.d.ts +7 -0
  56. package/dist/layout-painter/renderPage.js +1 -1
  57. package/dist/layout-painter/renderPage.mjs +1 -1
  58. package/dist/mcp-cli.mjs +15 -15
  59. package/dist/mcp.js +2 -2
  60. package/dist/mcp.mjs +1 -1
  61. package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
  62. package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
  63. package/dist/prosemirror/conversion/index.js +1 -1
  64. package/dist/prosemirror/conversion/index.mjs +1 -1
  65. package/dist/prosemirror/index.js +1 -1
  66. package/dist/prosemirror/index.mjs +1 -1
  67. package/package.json +1 -1
  68. package/dist/chunk-4AJYHCPB.js +0 -2
  69. package/dist/chunk-7GHQ4YCJ.mjs +0 -1
  70. package/dist/chunk-BWHUD2XC.mjs +0 -4
  71. package/dist/chunk-DY2MJCSV.js +0 -1
  72. package/dist/chunk-G6Y4UZMJ.mjs +0 -1
  73. package/dist/chunk-LMF2ELOB.js +0 -1
  74. package/dist/chunk-N27FJQTG.js +0 -1
  75. package/dist/chunk-UIROUI5I.mjs +0 -1
  76. package/dist/chunk-UOFQYE2L.mjs +0 -1
  77. package/dist/chunk-V7BKPX67.mjs +0 -2
  78. package/dist/chunk-Y7JZPBBW.js +0 -1
@@ -0,0 +1 @@
1
+ import {d}from'./chunk-DN36K5JU.mjs';import {q as q$1,g,h}from'./chunk-5N5DBQJV.mjs';import {a as a$2}from'./chunk-7E5VBRDL.mjs';import {p,s}from'./chunk-7UTXBQKF.mjs';import {v}from'./chunk-3GNIP6IX.mjs';import {c as c$1}from'./chunk-GNPLUGUG.mjs';import {b,a,c}from'./chunk-QPFJJPIC.mjs';import {c as c$2}from'./chunk-MOKKS75W.mjs';import {a as a$1}from'./chunk-AMENZY5F.mjs';import {i,e}from'./chunk-VW22RZ6C.mjs';var V={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image",line:"layout-line",run:"layout-run"};function dt(e){return e.kind==="paragraph"}function pt(e){return e.kind==="table"}function ct(e){return e.kind==="image"}function oe(e){e.style.position="absolute",e.style.overflow="hidden";}function ft(e,t,o){let n=o.createElement("div");return n.className=`${V.fragment} ${V.paragraph}`,oe(n),n.dataset.blockId=String(e.blockId),n.dataset.fromLine=String(e.fromLine),n.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(n.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(n.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(n.dataset.continuesFromPrev="true"),e.continuesOnNext&&(n.dataset.continuesOnNext="true"),n}function gt(e,t,o){let n=o.createElement("div");return n.className=`${V.fragment} ${V.table}`,oe(n),n.dataset.blockId=String(e.blockId),n.dataset.fromRow=String(e.fromRow),n.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(n.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(n.dataset.pmEnd=String(e.pmEnd)),n}function mt(e,t,o){let n=o.createElement("div");return n.className=`${V.fragment} ${V.image}`,oe(n),n.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(n.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(n.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(n.dataset.anchored="true"),e.zIndex!==void 0&&(n.style.zIndex=String(e.zIndex)),n}function we(e,t,o={}){let n=o.document??document;if(dt(e))return ft(e,t,n);if(pt(e))return gt(e,t,n);if(ct(e))return mt(e,t,n);let r=n.createElement("div");r.className=V.fragment,oe(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}var E={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 A(e){return e.kind==="text"}function z(e){return e.kind==="tab"}function j(e){return e.kind==="image"}function W(e){return e.kind==="lineBreak"}function K(e){return e.kind==="field"}function Z(e){return !b(e.wrapType)&&e.wrapType!=="topAndBottom"}function Y(e){return e.wrapType==="behind"}function M(e){return a(e.wrapType)?true:e.displayMode==="float"}function ht(e){return b(e.wrapType)||e.wrapType==="topAndBottom"?false:c(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}function re(e){return e==="left"?"right":e==="right"?"left":"bothSides"}var Ke={image:"layout-image",imageAnchored:"layout-image-anchored"};function q(e){return !!(e.cropTop||e.cropRight||e.cropBottom||e.cropLeft||e.opacity!=null&&e.opacity<1)}function J(e,t){let o=t.cropTop??0,n=t.cropRight??0,r=t.cropBottom??0,i=t.cropLeft??0;(o||n||r||i)&&(e.style.clipPath=`inset(${o*100}% ${n*100}% ${r*100}% ${i*100}%)`),t.opacity!=null&&t.opacity<1&&(e.style.opacity=String(Math.max(0,t.opacity)));}function ie(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");a.className=Ke.image,e.isAnchored&&a.classList.add(Ke.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",e.zIndex!==void 0&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let l=i.createElement("img");if(l.src=t.src,l.alt=t.alt??"",l.style.width="100%",l.style.height="100%",l.style.objectFit="contain",l.style.display="block",t.transform&&(l.style.transform=t.transform),l.draggable=false,t.hlinkHref){let d=i.createElement("a");d.href=t.hlinkHref,d.target="_blank",d.rel="noopener noreferrer",d.style.display="block",d.style.width="100%",d.style.height="100%",d.appendChild(l),a.appendChild(d);}else a.appendChild(l);return a}function ut(e,t,o){if(t.fontFamily&&(e.style.fontFamily=a$1(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",i=t.emphasisMark==="underDot"?"under right":"over right";e.style.textEmphasis=`${r}`,e.style.textEmphasisPosition=i,e.style.webkitTextEmphasis=r,e.style.webkitTextEmphasisPosition=i;}t.highlight&&(e.style.backgroundColor=t.highlight);let n=[];if(t.underline&&(n.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&&n.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(i=>!o||!o.has(i));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",n.includes("line-through")||n.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))),n.length>0&&(e.style.textDecorationLine=n.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 G(e,t,o){t!==void 0&&(e.dataset.pmStart=String(t)),o!==void 0&&(e.dataset.pmEnd=String(o));}function Q(e,t,o){let n=t.createElement("span");if(n.className=`${E.run} ${E.text}`,ut(n,e,o),G(n,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",n.style.color="#0563c1"),e.underline||(r.style.textDecoration="underline")),n.appendChild(r);}else n.textContent=e.text;return n}var yt=1e3;function ae(e,t,o,n){let r=t.createElement("span");r.className=`${E.run} ${E.tab}`,r.style.display="inline-block",r.style.width=`${o}px`,G(r,e.pmStart,e.pmEnd);let i=n&&n!=="none"?bt(n):null;if(i){r.style.position="relative",r.textContent="\u200B";let a=t.createElement("span");a.style.position="absolute",a.style.left="0",a.style.right="0",a.style.top="0",a.style.bottom="0",a.style.overflow="hidden",a.style.whiteSpace="nowrap",a.textContent=i.repeat(yt),r.appendChild(a);}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 Ue(e){if(!e)return 0;let t=e.match(/rotate\(([-\d.]+)deg\)/);return t?(parseFloat(t[1])%360+360)%360:0}function Xe(e,t,o){if(o===0||o===180)return {w:e,h:t};if(o===90||o===270)return {w:t,h:e};let n=o*Math.PI/180,r=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n));return {w:e*i+t*r,h:e*r+t*i}}function xt(e,t){let o=t.createElement("img");o.className=`${E.run} ${E.image}`,o.src=e.src,o.width=e.width,o.height=e.height,o.style.width=`${e.width}px`,o.style.height=`${e.height}px`,e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform,o.style.transformOrigin="center center"),q(e)&&J(o,e);let n=Ue(e.transform);if(n!==0){let r=Xe(e.width,e.height,n),i=t.createElement("span");return i.style.display="inline-block",i.style.position="relative",i.style.width=`${r.w}px`,i.style.height=`${r.h}px`,i.style.verticalAlign="middle",o.style.position="absolute",o.style.left=`${(r.w-e.width)/2}px`,o.style.top=`${(r.h-e.height)/2}px`,G(i,e.pmStart,e.pmEnd),i.appendChild(o),i}return o.style.display="inline-block",o.style.verticalAlign="middle",G(o,e.pmStart,e.pmEnd),o}function Ye(e,t){let o=t.createElement("div");o.className="layout-block-image",o.style.display="block",o.style.textAlign="center",o.style.marginTop=`${e.distTop??6}px`,o.style.marginBottom=`${e.distBottom??6}px`;let n=t.createElement("img");n.src=e.src,n.width=e.width,n.height=e.height,n.style.marginLeft="auto",n.style.marginRight="auto",e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform,n.style.transformOrigin="center center"),q(e)&&J(n,e);let r=Ue(e.transform);if(r!==0){let i=Xe(e.width,e.height,r);o.style.height=`${i.h}px`,o.style.position="relative",n.style.position="absolute",n.style.left="50%",n.style.top="50%",n.style.marginLeft=`${-e.width/2}px`,n.style.marginRight="0",n.style.marginTop=`${-e.height/2}px`;}return G(o,e.pmStart,e.pmEnd),o.appendChild(n),o}function se(e,t){return M(e)||e.displayMode==="block"||e.wrapType==="topAndBottom"?Ye(e,t):xt(e,t)}function Fe(e,t){let o=t.createElement("br");return o.className=`${E.run} ${E.lineBreak}`,G(o,e.pmStart,e.pmEnd),o}function le(e,t,o){let n=e.fallback??"";switch(e.fieldType){case "PAGE":n=String(o.pageNumber);break;case "NUMPAGES":n=String(o.totalPages);break;case "DATE":n=new Date().toLocaleDateString();break;case "TIME":n=new Date().toLocaleTimeString();break}let r={text:n,bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,color:e.color,highlight:e.highlight,fontFamily:e.fontFamily,fontSize:e.fontSize,pmStart:e.pmStart,pmEnd:e.pmEnd};return Q(r,t,o?.resolvedCommentIds)}function ke(e,t,o){if(A(e))return Q(e,t,o?.resolvedCommentIds);if(z(e))return ae(e,t,48,void 0);if(j(e))return se(e,t);if(W(e))return Fe(e,t);if(K(e)&&o)return le(e,t,o);let n=t.createElement("span");return n.className=E.run,n}function Ie(e){return e/1440*96}function Tt(e){return e/96*1440}function St(e){let{explicitStops:t=[],defaultTabInterval:o=720,leftIndent:n=0}=e,r=t.filter(c=>c.val!=="clear").filter(c=>c.pos>=n),i=t.filter(c=>c.val==="clear").map(c=>c.pos),a=r.reduce((c,T)=>Math.max(c,T.pos),0),l=[...r];n>0&&!r.some(c=>c.pos<=n)&&(i.some(T=>Math.abs(T-n)<20)||l.push({val:"start",pos:n,leader:"none"}));let f=a>0?Math.max(a,n):n,s=n+14400;for(;f<s;){f+=o;let c=r.some(m=>Math.abs(m.pos-f)<20),T=i.some(m=>Math.abs(m-f)<20),b=n>0&&Math.abs(f-n)<20;!c&&!T&&!b&&l.push({val:"start",pos:f,leader:"none"});}return l.sort((c,T)=>c.pos-T.pos)}function Ze(e,t,o="",n,r="."){let{defaultTabInterval:i=720}=t,a=Tt(e),d=St(t).find(c=>c.pos>a);if(!d){let c=Ie(i),T=c-e%c;return T<=0&&(T=c),{width:T,alignment:"default"}}let s=Ie(d.pos)-e;if(d.val==="center"||d.val==="end"){let c=n?n(o):0;d.val==="center"?s-=c/2:s-=c;}else if(d.val==="decimal"){let c=o.indexOf(r);if(c>=0&&n){let T=o.slice(0,c),b=n(T);s-=b;}}else if(d.val==="bar")return {width:0,leader:d.leader,alignment:"bar"};if(s<1){let c=Ie(i),T=c-e%c;return T<=0&&(T=c),{width:T,alignment:"default"}}return {width:s,leader:d.leader,alignment:d.val}}function Je(e,t){let o=[],n=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=n[r];if(i)if(A(i)){let a=r===t.fromRun?t.fromChar:0,l=r===t.toRun?t.toChar:i.text.length;if(a>0||l<i.text.length){let d=i.text.slice(a,l);o.push({...i,text:d,pmStart:i.pmStart!==void 0?i.pmStart+a:void 0,pmEnd:i.pmStart!==void 0?i.pmStart+l:void 0});}else o.push(i);}else o.push(i);}return o}function qe(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function wt(e){return {val:e.val,pos:e.pos,leader:e.leader}}function Ft(e,t,o){let n="";for(let r=t+1;r<e.length;r++){let i=e[r];if(A(i))n+=i.text;else if(K(i))i.fieldType==="PAGE"&&o?n+=String(o.pageNumber):i.fieldType==="NUMPAGES"&&o?n+=String(o.totalPages):n+=i.fallback??"";else if(z(i)||W(i))break}return n}var kt=.5;function It(e,t,o,n){let r=0;for(let i=t+1;i<e.length;i++){let a=e[i];if(z(a)||W(a))break;if(A(a))r+=o(a.text||"",a.fontSize,a.fontFamily,a.bold,a.italic);else if(K(a)){let l;a.fieldType==="PAGE"&&n?l=String(n.pageNumber):a.fieldType==="NUMPAGES"&&n?l=String(n.totalPages):l=a.fallback??"",r+=o(l,a.fontSize,a.fontFamily,a.bold,a.italic);}else j(a)&&!M(a)&&(r+=a.width||0);}return r}function Ct(e){let o=e.createElement("canvas").getContext("2d");return (n,r=11,i="Calibri",a=false,l=false)=>{if(!o)return n.length*7;let d=a$1(i).cssFallback,f=r*96/72,s=[];return l&&s.push("italic"),a&&s.push("bold"),s.push(`${f}px`,d),o.font=s.join(" "),o.measureText(n).width}}function de(e,t,o,n,r){let i=n.createElement("div");i.className=E.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=Je(e,t);if(a.length===1&&j(a[0])){let p=a[0].position?.horizontal?.align??o;i.style.display="flex",i.style.alignItems="center",i.style.justifyContent=p==="center"?"center":p==="right"?"flex-end":"flex-start",i.dataset.flexLine="true";}if(a.length===0){let h=n.createElement("span");return h.className=`${E.run} layout-empty-run`,h.innerHTML="&nbsp;",i.appendChild(h),i}let l=o==="justify",d=false;l&&r&&(d=!r.isLastLine||r.paragraphEndsWithLineBreak,d&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${r.availableWidth}px`)),i.style.whiteSpace="pre";let f=a.some(h=>A(h)&&h.highlight);i.style.overflow=f?"hidden":"visible";let s=a.some(z),c,T=Ct(n);if(s){let h=r?.tabStops?.map(wt),g=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;c={explicitStops:h,leftIndent:g};}let b=0,m=r?.leftIndentPx??0;if(r?.isFirstLine){let h=r?.firstLineIndentPx??0;b=m+h;}else b=m;for(let h=0;h<a.length;h++){let g=a[h];if(z(g)&&c){let p=Ft(a,h,r?.context),y=Ze(b,c,p,T),u=r?.lineRightEdgePx,S=u!==void 0?It(a,h,T,r?.context):0,w=false;for(let x=h+1;x<a.length&&!W(a[x]);x++)if(z(a[x])){w=true;break}if(u!==void 0&&y.alignment==="end"&&!w&&b+y.width+S>=u-kt){i.style.display="flex",i.style.alignItems="baseline",i.style.whiteSpace="nowrap",i.style.textIndent="0",i.dataset.flexLine="true",r?.isFirstLine&&r.firstLineIndentPx&&r.firstLineIndentPx<0&&i.firstElementChild instanceof HTMLElement&&(i.firstElementChild.style.marginLeft=`${r.firstLineIndentPx}px`);let x=ae(g,n,0,y.leader);x.style.flex="1 1 0",x.style.minWidth="0",x.style.width="auto",i.appendChild(x);for(let k=h+1;k<a.length;k++){let P=a[k];if(z(P)||W(P))break;if(A(P))i.appendChild(Q(P,n,r?.context?.resolvedCommentIds));else if(K(P)&&r?.context)i.appendChild(le(P,n,r.context));else if(j(P)){if(M(P))continue;let C=qe(P);r?.renderedInlineImageKeys?.has(C)||(r?.renderedInlineImageKeys?.add(C),i.appendChild(se(P,n)));}else i.appendChild(ke(P,n,r?.context));}break}let I=y.width;u!==void 0&&b+I+S>u&&(I=Math.max(1,u-b-S));let R=ae(g,n,I,y.leader);i.appendChild(R),b+=I;}else if(A(g)){let p=Q(g,n,r?.context?.resolvedCommentIds);if(g.highlight){let w=(g.fontSize?g.fontSize*96/72:14.67)*1.2,F=Math.max(0,t.lineHeight-w);if(F>0){let I=F/2;p.style.paddingTop=`${I}px`,p.style.paddingBottom=`${I}px`;}}i.appendChild(p);let y=g.fontSize||11,u=g.fontFamily||"Calibri";b+=T(g.text,y,u,g.bold,g.italic);}else if(j(g)){if(M(g))continue;let p=qe(g);if(r?.renderedInlineImageKeys?.has(p))continue;r?.renderedInlineImageKeys?.add(p);let y=se(g,n);i.appendChild(y),g.displayMode!=="block"&&g.wrapType!=="topAndBottom"&&(b+=g.width);}else if(W(g)){let p=Fe(g,n);i.appendChild(p);}else if(K(g)&&r?.context){let p=le(g,n,r.context);i.appendChild(p);let y=g.fallback??"";g.fieldType==="PAGE"?y=String(r.context.pageNumber):g.fieldType==="NUMPAGES"&&(y=String(r.context.totalPages));let u=g.fontSize||11,S=g.fontFamily||"Calibri";b+=T(y,u,S,g.bold,g.italic);}else {let p=ke(g,n,r?.context);i.appendChild(p);}}return i}function ee(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function Qe(e,t){return !e&&!t||!e||!t?false:ee(e.top,t.top)&&ee(e.bottom,t.bottom)&&ee(e.left,t.left)&&ee(e.right,t.right)&&ee(e.between,t.between)}function $(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");a.className=E.fragment,a.style.position=n.positioning==="absolute"?"absolute":"relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),G(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");let l=o.lines.slice(e.fromLine,e.toLine),d=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId);let f=t.attrs?.bidi;f&&(a.dir="rtl"),d?d==="center"?a.style.textAlign="center":d==="right"?a.style.textAlign="right":d==="left"?a.style.textAlign="left":a.style.textAlign=f?"right":"left":f&&(a.style.textAlign="right");let s=t.attrs?.indent,c=0,T=0;s&&(f?(s.left&&s.left>0&&(T=s.left),s.right&&s.right>0&&(c=s.right)):(s.left&&s.left>0&&(c=s.left),s.right&&s.right>0&&(T=s.right)));let b=t.attrs?.borders;if(b){let S=C=>{switch(C){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"}};a.style.boxSizing="border-box";let w=C=>`${C.width}px ${S(C.style)} ${C.color}`,F=Qe(r.prevBorders,b),I=Qe(b,r.nextBorders),R=F?b.between:b.top,x=I?void 0:b.bottom,k=i.createElement("div");if(k.className="layout-paragraph-border",k.style.position="absolute",k.style.pointerEvents="none",k.style.boxSizing="border-box",k.style.left=`${c-(b.left?.space??0)}px`,k.style.right=`${T-(b.right?.space??0)}px`,k.style.top=`${-(R?.space??0)}px`,k.style.bottom=`${-(x?.space??0)}px`,R&&(k.style.borderTop=w(R)),x&&(k.style.borderBottom=w(x)),b.left&&(k.style.borderLeft=w(b.left)),b.right&&(k.style.borderRight=w(b.right)),(R||x||b.left||b.right)&&a.appendChild(k),b.bar){let C=i.createElement("div");C.style.position="absolute",C.style.left="-8px",C.style.top="0",C.style.bottom="0",C.style.borderLeft=w(b.bar),a.style.position="relative",a.appendChild(C);}}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let m=e.width-c-T,g=t.runs[t.runs.length-1]?.kind==="lineBreak",p=o.lines.length,y=0;s?.hanging&&s.hanging>0?y=-s.hanging:s?.firstLine&&s.firstLine>0&&(y=s.firstLine);let u=r.renderedInlineImageKeys??new Set;for(let S=0;S<l.length;S++){let w=l[S],F=e.fromLine+S,I=F===p-1,R=F===0&&!e.continuesFromPrev,x=w.leftOffset??0,k=w.rightOffset??0,P=m;if(R){let B=s?.hanging&&s.hanging>0,L=s?.firstLine&&s.firstLine>0;B&&s?.hanging?P=m+s.hanging:L&&s?.firstLine&&(P=m-s.firstLine);}if(Rt(w,t)){let B=i.createElement("div");B.className=`${E.line} layout-line-split`,B.style.position="relative",B.style.height=`${w.lineHeight}px`,B.style.lineHeight=`${w.lineHeight}px`;for(let L of w.segments){let be={fromRun:L.fromRun,fromChar:L.fromChar,toRun:L.toRun,toChar:L.toChar,width:L.width,ascent:w.ascent,descent:w.descent,lineHeight:w.lineHeight},D=de(t,be,d,i,{availableWidth:L.availableWidth,isLastLine:I,isFirstLine:R,paragraphEndsWithLineBreak:g,tabStops:t.attrs?.tabs,leftIndentPx:c,firstLineIndentPx:R?y:0,context:n,renderedInlineImageKeys:u});D.className+=" layout-line-segment",D.style.position="absolute",D.style.left=`${L.leftOffset}px`,D.style.top="0",D.style.width=`${L.availableWidth}px`,B.appendChild(D);}a.appendChild(B);continue}let C=de(t,w,d,i,{availableWidth:P-x-k,isLastLine:I,isFirstLine:R,paragraphEndsWithLineBreak:g,tabStops:t.attrs?.tabs,leftIndentPx:c,firstLineIndentPx:R?y:0,context:n,renderedInlineImageKeys:u,lineRightEdgePx:e.width-T-k});if(x>0||k>0){x>0&&(C.style.marginLeft=`${x}px`),k>0&&(C.style.marginRight=`${k}px`);let B=P-x-k;B>0&&(C.style.width=`${B}px`);}let Me=s?.hanging&&s.hanging>0,ve=s?.firstLine&&s.firstLine>0,lt=C.dataset.flexLine==="true";if(R?c>0&&Me?(C.style.paddingLeft=`${c}px`,lt||(C.style.textIndent=`-${s.hanging}px`)):c>0&&ve?(C.style.paddingLeft=`${c}px`,C.style.textIndent=`${s.firstLine}px`):c>0?C.style.paddingLeft=`${c}px`:ve&&(C.style.textIndent=`${s.firstLine}px`):c>0?C.style.paddingLeft=`${c}px`:Me&&(C.style.paddingLeft=`${s.hanging}px`),T>0&&(C.style.paddingRight=`${T}px`),R&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let B=Math.max(0,c-(s?.hanging??0));C.style.paddingLeft=`${B}px`,C.style.textIndent="0";let L;if(!t.attrs.listMarkerFontFamily||!t.attrs.listMarkerFontSize)for(let H=w.fromRun;H<=w.toRun;H++){let xe=t.runs[H];if(xe&&xe.kind==="text"){L=xe;break}}let be=t.attrs.listMarkerFontFamily??L?.fontFamily??t.attrs.defaultFontFamily,D=t.attrs.listMarkerFontSize??L?.fontSize??t.attrs.defaultFontSize,$e=Pt(t.attrs.listMarker,s,i,be,D);if((s?.hanging??0)>0)C.insertBefore($e,C.firstChild);else {let H=i.createElement("div");H.className="layout-line layout-list-marker-line",H.style.height=`${w.lineHeight}px`,H.style.lineHeight=`${w.lineHeight}px`,H.appendChild($e),a.appendChild(H);}}a.appendChild(C);}return a}function Rt(e,t){return (e.segments?.length??0)>1&&!t.attrs?.listMarker}function Pt(e,t,o,n,r){let i=o.createElement("span");if(i.className="layout-list-marker",n&&(i.style.fontFamily=a$1(n).cssFallback),r){let l=r*96/72;i.style.fontSize=`${l}px`;}i.textContent=e,i.style.textAlign="left",i.style.boxSizing="border-box";let a=t?.hanging??0;return i.style.display="inline-block",a>0&&(i.style.minWidth=`${a}px`),i}function U(e,t,o){let n=t.createElement("div");n.className=o.layerClass,n.style.position="absolute",n.style.top="0",n.style.left="0",o.sizing==="inset0"?(n.style.right="0",n.style.bottom="0"):(n.style.width="100%",n.style.height="100%",n.style.overflow="hidden"),n.style.pointerEvents="none",o.layerMode==="front"&&(n.style.zIndex="10");for(let r of e){let i=t.createElement("div");i.className=o.itemClass,i.style.position="absolute",i.style.pointerEvents="auto",i.style.top=`${r.y}px`,i.style.left=`${r.x}px`,r.pmStart!==void 0&&(i.dataset.pmStart=String(r.pmStart)),r.pmEnd!==void 0&&(i.dataset.pmEnd=String(r.pmEnd));let a=t.createElement("img");a.src=r.src,a.style.width=`${r.width}px`,a.style.height=`${r.height}px`,a.style.display="block",r.alt&&(a.alt=r.alt),r.transform&&(a.style.transform=r.transform,a.style.transformOrigin="center center"),q(r)&&J(a,r),i.appendChild(a),n.appendChild(i);}return n}var O={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 Et(e$1,t,o){let n=[],r=0;for(let i=0;i<e$1.blocks.length;i++){let a=e$1.blocks[i];if(a?.kind!=="paragraph"){let f=t.blocks[i];f&&f.kind==="table"&&(r+=f.totalHeight??0);continue}let l=a;for(let f of l.runs){if(f.kind!=="image")continue;let s=f;if(!M(s))continue;let c=s.position,T=s.distTop??0,b=s.distBottom??0,m=s.distLeft??12,h=s.distRight??12,g="left",p=0;if(c?.horizontal){let u=c.horizontal;u.align==="right"?(g="right",p=o-s.width):u.align==="left"?p=0:u.align==="center"?p=(o-s.width)/2:u.posOffset!==void 0&&(p=e(u.posOffset),g=p>o/2?"right":"left");}else s.cssFloat==="right"&&(g="right",p=o-s.width);let y=r;if(c?.vertical){let u=c.vertical;u.posOffset!==void 0?y=r+e(u.posOffset):u.align==="top"&&(y=0);}p=Math.max(0,Math.min(p,o-s.width)),n.push({src:s.src,width:s.width,height:s.height,alt:s.alt,transform:s.transform,x:p,y,side:g,distTop:T,distBottom:b,distLeft:m,distRight:h,wrapText:re(s.cssFloat),wrapType:s.wrapType,pmStart:s.pmStart,pmEnd:s.pmEnd});}let d=t.blocks[i];d&&d.kind==="paragraph"&&(r+=d.totalHeight);}return n}function Lt(e,t,o,n){let r=n.createElement("div");r.className=O.cellContent,r.style.position="relative";let i=e.padding?.left??7,a=e.padding?.right??7,l=Math.max(0,t.width-i-a);r.style.width=`${l}px`;let d=Et(e,t,l),f;if(d.length>0){f=d.filter(Z).map(m=>{let h=m.x+m.width+m.distRight,g=m.y-m.distTop,p=m.y+m.height+m.distBottom,y=0,u=0,S=m.wrapText??"bothSides";return S==="right"?y=h:S==="left"?u=l-(m.x-m.distLeft):m.side==="left"?y=h:u=l-(m.x-m.distLeft),{leftMargin:y,rightMargin:u,topY:g,bottomY:p}});let b=d.filter(Y);b.length>0&&r.appendChild(U(b,n,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"behind"}));}let s$1=0,c=0;for(let b=0;b<e.blocks.length;b++){let m=e.blocks[b],h=t.blocks[b];if(m?.kind==="paragraph"&&h?.kind==="paragraph"){let g=m,p=h,y=g.attrs?.spacing,u=Math.max(c,y?.before??0);s$1+=u,f&&f.length>0&&(p=s(g,l,{floatingZones:f,paragraphYOffset:s$1}));let S={blockId:g.id,width:l,height:p.totalHeight,fromLine:0,toLine:p.lines.length,pmStart:g.pmStart,pmEnd:g.pmEnd},w={...o,insideTableCell:true},F=$(S,g,p,w,{document:n});F.style.position="relative",u>0&&(F.style.marginTop=`${u}px`),r.appendChild(F),s$1+=p.totalHeight,c=y?.after??0;}else if(m?.kind==="table"&&h?.kind==="table"){let g=m,p=h,y=c,u=Bt(g,p,o,n);u.style.position="relative",y>0&&(u.style.marginTop=`${y}px`),r.appendChild(u),s$1+=y+(h.totalHeight??0),c=0;}}c>0&&(r.style.paddingBottom=`${c}px`);let T=d.filter(b=>!Y(b));return T.length>0&&r.appendChild(U(T,n,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"front"})),r}function Bt(e,t,o,n){let r=n.createElement("div");r.className=`${O.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 i=[],a=0;for(let f=0;f<t.rows.length;f++)i.push(a),a+=t.rows[f]?.height??0;i.push(a);let l=new Map,d=0;for(let f=0;f<e.rows.length;f++){let s=e.rows[f],c=t.rows[f];if(!s||!c)continue;let T=Ce(s,c,f,d,t.columnWidths,e.rows.length,o,n,l,i);r.appendChild(T),d+=c.height;}return r.style.height=`${d}px`,r}function pe(e,t,o){let n=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!o||o.style==="none"||o.style==="nil"||o.width===0)e.style[n]="none";else {let r=o.width??1,i=o.color??"#000000",a=o.style??"solid";e.style[n]=`${r}px ${a} ${i}`;}}function Mt(e,t,o,n,r,i,a){let l=a.createElement("div");l.className=O.cell,l.style.position="absolute",l.style.left=`${o}px`,l.style.top="0",l.style.width=`${t.width}px`,l.style.height=`${n}px`,l.style.overflow="hidden",l.style.boxSizing="border-box";let d=e.padding?.top??1,f=e.padding?.right??7,s=e.padding?.bottom??1,c=e.padding?.left??7;if(l.style.padding=`${d}px ${f}px ${s}px ${c}px`,e.borders&&(r.isFirstRow&&pe(l,"top",e.borders.top),pe(l,"right",e.borders.right),pe(l,"bottom",e.borders.bottom),r.isFirstCol&&pe(l,"left",e.borders.left)),e.background&&(l.style.backgroundColor=e.background),e.noWrap&&(l.style.whiteSpace="nowrap"),e.verticalAlign)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 T=Lt(e,t,i,a);if(l.appendChild(T),e.blocks.length>0){let b=e.blocks[0],m=e.blocks[e.blocks.length-1];b&&"pmStart"in b&&b.pmStart!==void 0&&(l.dataset.pmStart=String(b.pmStart)),m&&"pmEnd"in m&&m.pmEnd!==void 0&&(l.dataset.pmEnd=String(m.pmEnd));}return l}function Ce(e,t,o,n,r,i,a,l,d,f,s){let c=l.createElement("div");c.className=O.row,c.style.position="absolute",c.style.left="0",c.style.top=`${n}px`,c.style.width="100%",c.style.height=`${t.height}px`,c.dataset.rowIndex=String(o);let T=new Set;if(d){for(let[,h]of d)if(h.startRow<o&&h.startRow+h.rowSpan>o)for(let g=0;g<h.colSpan;g++)T.add(h.columnIndex+g);}let b=0,m=0;for(;T.has(m);)b+=r[m]??0,m++;for(let h=0;h<e.cells.length;h++){let g=e.cells[h],p=t.cells[h];if(!g||!p)continue;let y=g.colSpan??1,u=g.rowSpan??1,S=t.height;if(u>1&&f){S=0;for(let k=o;k<o+u&&k<f.length-1;k++)S+=(f[k+1]??0)-(f[k]??0);S===0&&(S=t.height*u);}let w=o===0||s===true,I=m===0;m+y>=r.length;let x=Mt(g,p,b,S,{isFirstRow:w,isFirstCol:I},a,l);if(x.dataset.cellIndex=String(h),x.dataset.columnIndex=String(m),u>1&&(x.dataset.rowSpan=String(u)),c.appendChild(x),u>1&&d){let k=`${o}-${m}`;d.set(k,{cell:g,cellMeasure:p,columnIndex:m,startRow:o,rowSpan:u,colSpan:y,x:b,totalHeight:S});}for(let k=0;k<y&&m+k<r.length;k++)b+=r[m+k]??0;for(m+=y;T.has(m);)b+=r[m]??0,m++;}return c}function X(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");a.className=O.table,a.style.position=n.positioning==="flow"?"relative":"absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.dataset.blockId=String(e.blockId),a.dataset.fromRow=String(e.fromRow),a.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let l=0;for(let m=0;m<o.columnWidths.length-1;m++){l+=o.columnWidths[m]??0;let h=i.createElement("div");h.className=O.resizeHandle,h.style.position="absolute",h.style.left=`${l-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(m),h.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),a.appendChild(h);}let d=[],f=0;for(let m=0;m<o.rows.length;m++)d.push(f),f+=o.rows[m]?.height??0;d.push(f);let s=new Map,c=e.headerRowCount??0,T=0;if(c>0&&e.continuesFromPrev)for(let m=0;m<c;m++){let h=t.rows[m],g=o.rows[m];if(!h||!g)continue;let p=Ce(h,g,m,T,o.columnWidths,t.rows.length,n,i,s,d,m===0);p.dataset.repeatedHeader="true",a.appendChild(p),T+=g.height;}for(let m=e.fromRow;m<e.toRow;m++){let h=t.rows[m],g=o.rows[m];if(!h||!g)continue;let p=c>0&&e.continuesFromPrev?false:e.continuesFromPrev&&m===e.fromRow,y=Ce(h,g,m,T,o.columnWidths,t.rows.length,n,i,s,d,p);a.appendChild(y),T+=g.height;}let b=0;for(let m=e.fromRow;m<e.toRow;m++)if(b+=o.rows[m]?.height??0,m<e.toRow-1){let h=i.createElement("div");h.className=O.rowResizeHandle,h.style.position="absolute",h.style.left="0",h.style.top=`${b-3}px`,h.style.width="100%",h.style.height="6px",h.style.cursor="row-resize",h.style.zIndex="10",h.dataset.rowIndex=String(m),h.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),a.appendChild(h);}if(e.toRow===t.rows.length){let m=i.createElement("div");m.className=O.tableEdgeHandleBottom,m.style.position="absolute",m.style.left="0",m.style.top=`${b-3}px`,m.style.width="100%",m.style.height="6px",m.style.cursor="row-resize",m.style.zIndex="10",m.dataset.rowIndex=String(t.rows.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="bottom",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let m=o.columnWidths.reduce((g,p)=>g+p,0),h=i.createElement("div");h.className=O.tableEdgeHandleRight,h.style.position="absolute",h.style.left=`${m-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(o.columnWidths.length-1),h.dataset.tableBlockId=String(e.blockId),h.dataset.isEdge="right",e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),a.appendChild(h);}return a}var vt={textBox:"layout-textbox"};function ce(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");if(a.className=vt.textBox,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",$t(a,e),t.fillColor&&(a.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let s=t.outlineStyle||"solid",c=t.outlineColor||"#000000";a.style.border=`${t.outlineWidth}px ${s} ${c}`;}let l=t.margins??a$2;a.style.padding=`${l.top}px ${l.right}px ${l.bottom}px ${l.left}px`,a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let d=e.width-l.left-l.right,f=0;for(let s=0;s<t.content.length;s++){let c=t.content[s],T=o.innerMeasures[s];if(!T)continue;let b={blockId:c.id,width:d,height:T.totalHeight,pmStart:c.pmStart,pmEnd:c.pmEnd,fromLine:0,toLine:T.lines.length},m=$(b,c,T,{...n,positioning:"flow"},{document:i});a.appendChild(m),f+=T.totalHeight;}return a}function $t(e,t){!t.isFloating&&t.zIndex===void 0||(e.style.zIndex=String(t.zIndex??10));}function et(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function Re(e,t,o,n){let{x:r,side:i}=Ht(e,o,n),a=zt(e,t,n);return {x:r,y:a,side:i}}function Ht(e$1,t,o){let n=e$1.position?.horizontal;if(!n)return e$1.cssFloat==="right"?{x:t-e$1.width,side:"right"}:{x:0,side:"left"};let r=At(n.relativeTo,t,o);if(n.align==="right")return {x:r.size?r.base+r.size-e$1.width:0,side:"right"};if(n.align==="left")return {x:r.base,side:"left"};if(n.align==="center")return {x:r.size?r.base+(r.size-e$1.width)/2:0,side:"left"};if(n.posOffset!==void 0){let i=r.base+e(n.posOffset);return {x:i,side:i>t/2?"right":"left"}}return {x:r.base,side:"left"}}function At(e,t,o){let n=o?.pageWidth??0,r=o?.marginLeft??0;switch(e){case "page":return {base:-r,size:n};case "leftMargin":return {base:-r,size:r};case "rightMargin":return {base:t,size:r};case "character":return {base:0,size:0};default:return {base:0,size:t}}}function zt(e$1,t,o){let n=e$1.position?.vertical;if(!n)return t;let r=Ot(n.relativeTo,t,o);return n.align==="top"?r.base:n.align==="center"?r.size?r.base+(r.size-e$1.height)/2:t:n.align==="bottom"?r.size?r.base+r.size-e$1.height:t:n.posOffset!==void 0?r.base+e(n.posOffset):n.relativeTo==="paragraph"||n.relativeTo==="line"?t:r.base}function Ot(e,t,o){let n=o?.pageHeight??0,r=o?.marginTop??0,i=o?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:t,size:0};case "page":return {base:-r,size:n};case "topMargin":return {base:-r,size:r};case "bottomMargin":return {base:i,size:r};default:return {base:0,size:i}}}function tt(e){return e?.align??e?.alignment}function Nt(e$1,t){let o=e$1.position.vertical;if(!o)return e$1.paragraphY;let n=tt(o),r=o.posOffset!==void 0?e(o.posOffset):void 0;if(o.relativeTo==="page"){if(r!==void 0)return r-t.flowTop;if(n==="top")return -t.flowTop;if(n==="bottom")return t.pageHeight-e$1.height-t.flowTop;if(n==="center")return (t.pageHeight-e$1.height)/2-t.flowTop}if(o.relativeTo==="margin"){let i=t.margins.top,a=t.pageHeight-t.margins.top-t.margins.bottom;if(r!==void 0)return i+r-t.flowTop;if(n==="top")return i-t.flowTop;if(n==="bottom")return i+a-e$1.height-t.flowTop;if(n==="center")return i+(a-e$1.height)/2-t.flowTop}return r!==void 0?e$1.paragraphY+r:e$1.paragraphY}function Dt(e$1,t,o){let n=t.position.horizontal;if(!n){e$1.style.left="0";return}let r=tt(n);if(n.relativeTo==="page"){if(n.posOffset!==void 0){e$1.style.left=`${e(n.posOffset)-o.flowLeft}px`;return}if(r==="right"){e$1.style.left=`${o.pageWidth-t.width-o.flowLeft}px`;return}if(r==="center"){e$1.style.left=`${(o.pageWidth-t.width)/2-o.flowLeft}px`;return}if(r==="left"){e$1.style.left=`${-o.flowLeft}px`;return}}if(n.posOffset!==void 0){e$1.style.left=`${e(n.posOffset)}px`;return}if(r==="right"){e$1.style.left=`${o.contentWidth-t.width}px`;return}if(r==="center"){e$1.style.left=`${(o.contentWidth-t.width)/2}px`;return}e$1.style.left="0";}function nt(e,t){let o=e.tblpY??0;e.vertAnchor==="page"?o-=t.flowTop:e.vertAnchor==="margin"&&(o+=t.margins.top-t.flowTop);let n=e.tblpX??0;return e.horzAnchor==="page"?n-=t.flowLeft:e.horzAnchor==="margin"&&(n+=t.margins.left-t.flowLeft),{left:n,top:o}}function Pe(e,t,o,n){let r=o.document??document,i=r.createElement("div");i.style.position="relative";let a=t.contentWidth??600,l=[],d=0;for(let f=0;f<e.blocks.length;f++){let s=e.blocks[f],c=e.measures[f];if(!(!s||!c)){if(s.kind==="paragraph"&&c.kind==="paragraph"){let T=s,b=c,m=T.attrs?.spacing?.before??0,h=d,g=[];for(let S of T.runs)if(S.kind==="image"&&"position"in S&&S.position){let w=S;l.push({src:w.src,width:w.width,height:w.height,alt:w.alt,paragraphY:h,position:w.position});}else g.push(S);let p={...T,runs:g},y={blockId:T.id,width:a,height:b.totalHeight,fromLine:0,toLine:b.lines.length},u=$(y,p,b,{...t,positioning:"absolute"},{document:r});u.style.top=`${d+m}px`,u.style.left="0",u.style.width=`${a}px`,i.appendChild(u),d+=b.totalHeight;}else if(s.kind==="table"&&c.kind==="table"){let T={blockId:s.id,width:c.totalWidth,height:c.totalHeight,fromRow:0,toRow:c.rows.length,pmStart:s.pmStart,pmEnd:s.pmEnd},b=X(T,s,c,{...t,positioning:"absolute"},{document:r});if(s.floating){let{left:m,top:h}=nt(s.floating,n);b.style.top=`${h}px`,b.style.left=`${m}px`,i.appendChild(b);}else b.style.top=`${d}px`,b.style.left="0",i.appendChild(b),d+=c.totalHeight;}}}for(let f of l){let s=r.createElement("img");s.src=f.src,s.width=f.width,s.height=f.height,f.alt&&(s.alt=f.alt),s.style.position="absolute",s.style.display="block",s.style.width=`${f.width}px`,s.style.height=`${f.height}px`,s.style.maxWidth="none",s.style.maxHeight="none",Dt(s,f,n),s.style.top=`${Nt(f,n)}px`,i.appendChild(s);}return i}var fe=12,ot=6;function _t(e,t){if(e.size!==t.size)return false;for(let[o,n]of e)if(t.get(o)!==n)return false;return true}var Ee=8;function Xn(e){let t=[];for(let o of e)if(o.kind==="paragraph")for(let n of o.runs)n.kind==="text"&&n.footnoteRefId!=null&&t.push({footnoteId:n.footnoteRefId,pmPos:n.pmStart??0});return t}function Le(e,t){let o=new Map;if(t.length===0)return o;for(let n of t)for(let r of e){let i=false;for(let a of r.fragments){let l=a.pmStart??-1,d=a.pmEnd??-1;if(l>=0&&d>=0&&n.pmPos>=l&&n.pmPos<d){let f=o.get(r.number)??[];f.includes(n.footnoteId)||f.push(n.footnoteId),o.set(r.number,f),i=true;break}}if(i)break}return o}function Wt(e,t){if(e.length===0)return [{kind:"paragraph",id:`fn-empty-${t}`,runs:[{kind:"text",text:`${t} `,fontSize:Ee,superscript:true}]}];let o=e.map(r=>{if(r.kind!=="paragraph")return r;let i=r;return {...i,runs:i.runs.map(a=>(a.kind==="text"||a.kind==="tab")&&a.fontSize==null?{...a,fontSize:Ee}:a)}}),n=o[0];if(n.kind==="paragraph"){let r={kind:"text",text:`${t} `,fontSize:Ee,superscript:true};o[0]={...n,runs:[r,...n.runs]};}return o}function Gt(e,t,o,n){let r=c$1(e.content,{styles:n.styles??void 0,theme:n.theme??null}),i=d(r,{theme:n.theme??void 0}),a=Wt(i,t),l=n.measureBlocks(a,o),d$1=l.reduce((f,s)=>s.kind==="paragraph"||s.kind==="table"?f+s.totalHeight:s.kind==="image"||s.kind==="textBox"?f+s.height:f,0);return {id:e.id,displayNumber:t,blocks:a,measures:l,height:d$1}}function Zn(e,t,o,n){let r=new Map,i=new Map;for(let d of e)(d.noteType==="normal"||d.noteType==null)&&i.set(d.id,d);let a=1,l=new Set;for(let d of t){if(l.has(d.footnoteId))continue;l.add(d.footnoteId);let f=i.get(d.footnoteId);f&&(r.set(d.footnoteId,Gt(f,a,o,n)),a++);}return r}function rt(e,t){let o=new Map;for(let[n,r]of e){let i=0;for(let a of r){let l=t.get(a);l&&(i+=l.height);}i>0&&(i+=fe,o.set(n,i));}return o}function qn(e){let{blocks:t,measures:o,layoutOpts:n,footnoteRefs:r,footnoteContentMap:i,initialLayout:a}=e,l=Le(a.pages,r),d=rt(l,i);if(d.size===0)return {layout:a,pageFootnoteMap:l,converged:true};let f=a,s=false;for(let c=0;c<ot;c++){f=q$1(t,o,{...n,footnoteReservedHeights:d});let T=Le(f.pages,r),b=rt(T,i);if(l=T,_t(d,b)){d=b,s=true;break}d=b;}s||(f=q$1(t,o,{...n,footnoteReservedHeights:d}),l=Le(f.pages,r),console.warn(`[docx-editor] footnote layout did not stabilize within ${ot} passes; settling with best-effort reservation. If footnotes appear misplaced, please file a bug with the document.`));for(let[c,T]of l){let b=f.pages.find(m=>m.number===c);b&&(b.footnoteIds=T);}return {layout:f,pageFootnoteMap:l,converged:s}}function Jn(e,t,o){let n=new Map;if(!o?.package?.footnotes)return n;let r=new Map;for(let i of o.package.footnotes)i.noteType&&i.noteType!=="normal"||r.set(i.id,i);for(let[i,a]of e){let l=[];for(let d of a){let f=r.get(d);if(!f)continue;let s=t.get(d),c=s?.displayNumber??0;l.push({displayNumber:String(c),text:v(f),content:s});}l.length>0&&n.set(i,l);}return n}function Vt(e,t,o,n){let r=n.createElement("div");r.className="layout-footnote-content",r.style.position="relative",r.style.width=`${t}px`,r.style.height=`${e.height}px`;let i=0;for(let a=0;a<e.blocks.length;a++){let l=e.blocks[a],d=e.measures[a];if(!(!l||!d)){if(l.kind==="paragraph"&&d.kind==="paragraph"){let f=l.attrs?.spacing?.before??0,s={blockId:l.id,width:t,height:d.totalHeight,pmStart:l.pmStart,pmEnd:l.pmEnd,fromLine:0,toLine:d.lines.length},c=$(s,l,d,{...o,section:"body",contentWidth:t,positioning:"absolute"},{document:n});c.style.top=`${i+f}px`,c.style.left="0",c.style.width=`${t}px`,c.style.height=`${d.totalHeight}px`,r.appendChild(c),i+=d.totalHeight;}else if(l.kind==="table"&&d.kind==="table"){let f={blockId:l.id,width:d.totalWidth,height:d.totalHeight,pmStart:l.pmStart,pmEnd:l.pmEnd,fromRow:0,toRow:d.rows.length},s=X(f,l,d,{...o,section:"body",contentWidth:t,positioning:"absolute"},{document:n});s.style.top=`${i}px`,s.style.left="0",r.appendChild(s),i+=d.totalHeight;}else if(l.kind==="image"&&d.kind==="image"){let f={blockId:l.id,width:d.width,height:d.height,pmStart:l.pmStart,pmEnd:l.pmEnd},s=ie(f,l,d,{...o},{document:n});s.style.top=`${i}px`,s.style.left="0",r.appendChild(s),i+=d.height;}else if(l.kind==="textBox"&&d.kind==="textBox"){let f={blockId:l.id,width:d.width,height:d.height,pmStart:l.pmStart,pmEnd:l.pmEnd},s=ce(f,l,d,{...o,section:"body",contentWidth:t,positioning:"absolute"},{document:n});s.style.top=`${i}px`,s.style.left="0",r.appendChild(s),i+=d.height;}}}return r}function jt(e,t){let o=t.createElement("div");o.style.fontSize="10px",o.style.lineHeight="1.3",o.style.marginBottom="4px",o.style.color="#000";let n=t.createElement("sup");n.textContent=e.displayNumber,n.style.fontSize="7px",n.style.marginRight="2px",o.appendChild(n);let r=t.createTextNode(" "+e.text);return o.appendChild(r),o}function it(e){let t=fe;for(let o of e)o.content&&(t+=o.content.height);return t}function at(e,t,o,n){let r=n.createElement("div");r.className="layout-footnote-area",r.style.width=`${t}px`;let i=n.createElement("div"),a=.5,l=(fe-a)/2;i.style.width="33%",i.style.height=`${a}px`,i.style.backgroundColor="#000",i.style.marginBottom=`${l}px`,i.style.marginTop=`${l}px`,r.appendChild(i);for(let d of e)r.appendChild(d.content?Vt(d.content,t,o,n):jt(d,n));return r}function Be(e,t,o){let n={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:o.resolvedCommentIds},r={...o};if(o.titlePg&&e.number===1&&(r.headerContent=o.firstPageHeaderContent,r.footerContent=o.firstPageFooterContent),o.footnotesByPage){let i=o.footnotesByPage.get(e.number);i&&i.length>0&&(r.footnoteArea=i);}return {context:n,pageOptions:r}}function st(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 o of e.fragments){let n=`${o.kind}:${o.blockId},${o.x},${o.y},${o.width},${o.height}`;o.pmStart!==void 0&&(n+=`,ps:${o.pmStart}`),o.pmEnd!==void 0&&(n+=`,pe:${o.pmEnd}`),o.kind==="paragraph"?n+=`,fl:${o.fromLine},tl:${o.toLine}`:o.kind==="table"&&(n+=`,fr:${o.fromRow},tr:${o.toRow}`),t.push(n);}return t.join("|")}function Kt(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 Yt(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 ge=2,Ut=8;function Xt(e,t,o={}){let n=e.length,r=o.pageGap??24,i=t,a=i.__pageRenderState,l=Kt(o),d=n>=Ut;if(a&&a.optionsHash===l&&d){let g=a.pageStates,p=a.pageDataMap,y=i.__pageObserver,u=[];for(let F of e)u.push(st(F));let S=a.totalPages!==n,w=Math.min(g.length,e.length);for(let F=0;F<w;F++){let I=g[F],R=u[F];if(I.fingerprint===R&&!S){let P=p.get(I.element);P&&(P.page=e[F]);continue}let x=I.element,k=p.get(x);k&&(k.page=e[F],k.rendered&&Zt(x,p,n,o)),I.fingerprint=R,te(x,e[F].size.w,e[F].size.h,o),x.dataset.pageNumber=String(e[F].number);}if(e.length>g.length){let F=o.document??document;for(let I=g.length;I<e.length;I++){let R=e[I],x=F.createElement("div");x.className=o.pageClassName??N.page,x.dataset.pageNumber=String(R.number),x.dataset.pageIndex=String(I),te(x,R.size.w,R.size.h,o),t.appendChild(x),g.push({element:x,fingerprint:u[I]}),p.set(x,{page:R,index:I,rendered:false}),y&&y.observe(x);}}if(e.length<g.length){for(let F=g.length-1;F>=e.length;F--){let I=g[F].element;y&&y.unobserve(I),p.delete(I),t.removeChild(I);}g.length=e.length;}for(let F=0;F<g.length;F++){let I=p.get(g[F].element);I&&(I.index=F);}return a.totalPages=n,a.currentOptions=o,"incremental"}let s=i.__pageObserver;s&&(s.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,Yt(t,r);let c=[],T=[];for(let g=0;g<e.length;g++){let p=e[g];if(T.push(st(p)),d){let u=(o.document??document).createElement("div");u.className=o.pageClassName??N.page,u.dataset.pageNumber=String(p.number),u.dataset.pageIndex=String(g),te(u,p.size.w,p.size.h,o),t.appendChild(u),c.push(u);}else {let{context:y,pageOptions:u}=Be(p,n,o),S=he(p,y,u);t.appendChild(S),c.push(S);}}if(!d)return "full";let b=new Map;for(let g=0;g<e.length;g++)b.set(c[g],{page:e[g],index:g,rendered:false});let m=new IntersectionObserver(g=>{let p=i.__pageRenderState;if(!p)return;let{currentOptions:y,totalPages:u,pageDataMap:S}=p;for(let R of g){let x=R.target,k=S.get(x);if(k&&R.isIntersecting){me(x,S,u,y);for(let P=-ge;P<=ge;P++){let C=k.index+P;C>=0&&C<p.pageStates.length&&C!==k.index&&me(p.pageStates[C].element,S,u,y);}}}let w=window.innerHeight,F=w*3,I=new Set;for(let[R,x]of S){if(!x.rendered)continue;let k=R.getBoundingClientRect();k.bottom>-F&&k.top<w+F&&I.add(x.index);}for(let[R,x]of S){if(!x.rendered)continue;let k=false;for(let P of I)if(Math.abs(x.index-P)<=ge+1){k=true;break}!k&&I.size>0&&qt(R,S);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let g of c)m.observe(g);i.__pageObserver=m,i.__pageRenderState={pageStates:c.map((g,p)=>({element:g,fingerprint:T[p]})),totalPages:n,optionsHash:l,pageDataMap:b,currentOptions:o};let h=Math.min(e.length,ge+3);for(let g=0;g<h;g++)me(c[g],b,n,o);return "full"}function me(e,t,o,n){let r=t.get(e);if(!r||r.rendered)return;let{context:i,pageOptions:a}=Be(r.page,o,n),l=he(r.page,i,a);for(;l.firstChild;)e.appendChild(l.firstChild);r.rendered=true;}function Zt(e,t,o,n){let r=t.get(e);if(!r)return;let{context:i,pageOptions:a}=Be(r.page,o,n),d=he(r.page,i,a).querySelector(`.${N.content}`),f=e.querySelector(`.${N.content}`);d&&f?e.replaceChild(d,f):(e.innerHTML="",r.rendered=false,me(e,t,o,n));}function qt(e,t){let o=t.get(e);!o||!o.rendered||(e.innerHTML="",o.rendered=false);}var N={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function te(e,t,o,n){e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${o}px`,e.style.backgroundColor=n.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily=a$1("Calibri").cssFallback,e.style.fontSize=`${1056/72}px`,e.style.color="#000000",n.showBorders&&(e.style.border="1px solid #ccc"),n.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");}function Jt(e,t){switch(t??"allPages"){case "firstPage":return e===1;case "notFirstPage":return e!==1;default:return true}}function ue(e){return e?.space!==void 0?i(e.space):0}function ye(e,t,o,n){if(!t||t.style==="none"||t.style==="nil")return;let r=c$2(t,o,n);for(let[d,f]of Object.entries(r))e.style[d]=String(f);let i=`border${o}Style`,a=`border${o}Width`;if(e.style[i]==="double"){let d=parseFloat(e.style[a]);(!Number.isFinite(d)||d<3)&&(e.style[a]="3px");}}function Qt(e,t,o){let n=t.pageBorders;if(!n||!Jt(e.number,n.display)||![n.top,n.bottom,n.left,n.right].some(c=>c&&c.style!=="none"&&c.style!=="nil"))return null;let i=n.offsetFrom??"text",a=ue(n.top),l=ue(n.right),d=ue(n.bottom),f=ue(n.left),s=o.createElement("div");return s.className="layout-page-border",s.style.position="absolute",s.style.pointerEvents="none",s.style.boxSizing="border-box",s.style.zIndex=n.zOrder==="back"?"0":"20",i==="page"?(s.style.top=`${a}px`,s.style.right=`${l}px`,s.style.bottom=`${d}px`,s.style.left=`${f}px`):(s.style.top=`${Math.max(0,e.margins.top-a)}px`,s.style.right=`${Math.max(0,e.margins.right-l)}px`,s.style.bottom=`${Math.max(0,e.margins.bottom-d)}px`,s.style.left=`${Math.max(0,e.margins.left-f)}px`),ye(s,n.top,"Top",t.theme),ye(s,n.bottom,"Bottom",t.theme),ye(s,n.left,"Left",t.theme),ye(s,n.right,"Right",t.theme),s}function en(e,t){let o=t.margins;e.style.position="absolute",e.style.top=`${o.top}px`,e.style.left=`${o.left}px`,e.style.right=`${o.right}px`,e.style.bottom=`${o.bottom}px`,e.style.overflow="visible";}function tn(e,t,o){e.style.position="absolute",e.style.left=`${t.x-o.left}px`,e.style.top=`${t.y-o.top}px`,e.style.width=`${t.width}px`,"height"in t&&(e.style.height=`${t.height}px`);}function nn(e,t,o,n){let r=[];for(let i of e.runs){if(i.kind!=="image")continue;let a=i;if(!M(a))continue;let l=a.distTop??0,d=a.distBottom??0,f=a.distLeft??12,s=a.distRight??12,{x:c,y:T,side:b}=Re(a,t,o,n);r.push({src:a.src,width:a.width,height:a.height,alt:a.alt,transform:a.transform,side:b,x:c,y:T,distTop:l,distBottom:d,distLeft:f,distRight:s,pmStart:a.pmStart,pmEnd:a.pmEnd,wrapText:re(a.cssFloat),wrapType:a.wrapType,cropTop:a.cropTop,cropRight:a.cropRight,cropBottom:a.cropBottom,cropLeft:a.cropLeft,opacity:a.opacity});}return r}function he(e,t,o={}){let n=o.document??document,r=n.createElement("div");r.className=o.pageClassName??N.page,r.dataset.pageNumber=String(e.number),te(r,e.size.w,e.size.h,o);let i=Qt(e,o,n);i&&o.pageBorders?.zOrder==="back"&&r.appendChild(i);let a=n.createElement("div");a.className=N.content,en(a,e);let l=et(e),d=l.contentWidth,f=[],s$1=[];for(let p of e.fragments)if(p.kind==="paragraph"&&o.blockLookup){let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind==="paragraph"){let u=y.block,S=p.y-e.margins.top,w=nn(u,S,d,l);f.push(...w);}}for(let p of f)Z(p)&&s$1.push({side:p.side,x:p.x,y:p.y,width:p.width,height:p.height,distTop:p.distTop,distBottom:p.distBottom,distLeft:p.distLeft,distRight:p.distRight,wrapText:p.wrapText,wrapType:p.wrapType});if(o.blockLookup)for(let p of e.fragments){if(p.kind!=="table")continue;let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind!=="table")continue;let S=y.block.floating;if(!S)continue;let w=p.x-e.margins.left,F=p.y-e.margins.top,I=S.topFromText??0,R=S.bottomFromText??0,x=S.leftFromText??12,k=S.rightFromText??12,P=w<d/2?"left":"right";s$1.push({side:P,x:w,y:F,width:p.width,height:p.height,distTop:I,distBottom:R,distLeft:x,distRight:k});}if(o.blockLookup)for(let p of e.fragments){if(p.kind!=="textBox")continue;let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind!=="textBox")continue;let u=y.block;if(!g(u))continue;let S=p.y-e.margins.top,w=Re({width:p.width,height:p.height,position:u.position,cssFloat:u.cssFloat},S,d,l);p.x=e.margins.left+w.x,p.y=e.margins.top+w.y,h(u)&&s$1.push({side:w.side,x:w.x,y:w.y,width:p.width,height:p.height,distTop:u.distTop??0,distBottom:u.distBottom??0,distLeft:u.distLeft??12,distRight:u.distRight??12,wrapText:u.wrapText,wrapType:u.wrapType});}let c=s$1.length>0?p(s$1,d):[],T=f.filter(Y),b=f.filter(p=>!Y(p));if(T.length>0){let p=U(T,n,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"behind"});a.appendChild(p);}let m=p=>{if(p.kind!=="paragraph"||!o.blockLookup||!p.blockId)return;let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind==="paragraph")return y.block.attrs?.borders},h$1,g$1=new Map;for(let p=0;p<e.fragments.length;p++){let y=e.fragments[p],u,S={...t,section:"body",contentWidth:d},w=y.y-e.margins.top;if(o.blockLookup&&y.blockId){let F=o.blockLookup.get(String(y.blockId));if(y.kind==="paragraph"&&F?.block.kind==="paragraph"&&F?.measure.kind==="paragraph"){let I=F.block,R=p+1<e.fragments.length?m(e.fragments[p+1]):void 0,x=String(y.blockId),k=g$1.get(x);k||(k=new Set,g$1.set(x,k));let P=F.measure;c.length>0&&(P=s(I,d,{floatingZones:c,paragraphYOffset:w})),u=$(y,I,P,S,{document:n,prevBorders:h$1,nextBorders:R,renderedInlineImageKeys:k}),h$1=I.attrs?.borders;}else y.kind==="table"&&F?.block.kind==="table"&&F?.measure.kind==="table"?(u=X(y,F.block,F.measure,S,{document:n}),h$1=void 0):y.kind==="image"&&F?.block.kind==="image"&&F?.measure.kind==="image"?(u=ie(y,F.block,F.measure,S,{document:n}),h$1=void 0):y.kind==="textBox"&&F?.block.kind==="textBox"&&F?.measure.kind==="textBox"?(u=ce(y,F.block,F.measure,S,{document:n}),h$1=void 0):(u=we(y,S,{document:n}),h$1=void 0);}else u=we(y,S,{document:n}),h$1=void 0;tn(u,y,{left:e.margins.left,top:e.margins.top}),a.appendChild(u);}if(b.length>0){let p=U(b,n,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"front"});a.appendChild(p);}if(e.columns&&e.columns.separator&&e.columns.count>1){let p=e.columns.count,y=e.columns.gap,u=(d-(p-1)*y)/p,S=e.size.h-e.margins.top-e.margins.bottom;for(let w=0;w<p-1;w++){let F=(w+1)*u+w*y+y/2,I=n.createElement("div");I.style.position="absolute",I.style.left=`${F}px`,I.style.top="0",I.style.height=`${S}px`,I.style.width="0.5px",I.style.backgroundColor="#000",I.style.pointerEvents="none",a.appendChild(I);}}if(o.footnoteArea&&o.footnoteArea.length>0){let p=at(o.footnoteArea,d,t,n);p.style.position="absolute";let y=Math.max(e.footnoteReservedHeight??0,it(o.footnoteArea)),u=e.size.h-e.margins.bottom-e.margins.top;p.style.top=`${Math.max(-e.margins.top,u-y)}px`,p.style.left="0",p.style.right="0",a.appendChild(p);}r.appendChild(a);{let y=o.headerDistance??e.margins.header??48,u=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.top-y,48),w=o.headerContent?.visualTop??0,F=o.headerContent?.visualBottom??o.headerContent?.height??0,I=Math.max(F-w,24),R=F>S,x=n.createElement("div");x.className=N.header,x.style.position="absolute",x.style.top=`${y+w}px`,x.style.left=`${e.margins.left}px`,x.style.right=`${e.margins.right}px`,x.style.width=`${u}px`,x.style.height=`${I}px`,x.style.minHeight=`${I}px`;let k=!R;if(o.headerContent&&o.headerContent.blocks.length>0){let P={flowTop:y,flowLeft:e.margins.left,contentWidth:u,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},C=Pe(o.headerContent,{...t,section:"header",contentWidth:u},o,P);C.style.top=`${-w}px`,C.querySelector("img")&&(k=false),x.appendChild(C);}k&&(x.style.maxHeight=`${S}px`,x.style.overflow="hidden"),r.appendChild(x);}{let y=o.footerDistance??e.margins.footer??48,u=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.bottom-y,48),w=o.footerContent?.visualTop??0,F=o.footerContent?.visualBottom??o.footerContent?.height??0,I=Math.max(F-w,24),R=I>S,x=n.createElement("div");x.className=N.footer,x.style.position="absolute",x.style.top=`${e.size.h-y-I}px`,x.style.left=`${e.margins.left}px`,x.style.right=`${e.margins.right}px`,x.style.width=`${u}px`,x.style.height=`${I}px`,x.style.minHeight=`${I}px`;let k=!R;if(o.footerContent&&o.footerContent.blocks.length>0){let P={flowTop:e.size.h-y-(o.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:u,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},C=Pe(o.footerContent,{...t,section:"footer",contentWidth:u},o,P);C.style.top=`${-w}px`,C.querySelector("img")&&(k=false),x.appendChild(C);}k&&(x.style.maxHeight=`${S}px`,x.style.overflow="hidden"),r.appendChild(x);}return i&&o.pageBorders?.zOrder!=="back"&&r.appendChild(i),r}export{ce as A,nt as B,Xt as C,N as D,te as E,he as F,fe as a,ot as b,_t as c,Xn as d,Le as e,Wt as f,Gt as g,Zn as h,rt as i,qn as j,Jn as k,V as l,we as m,Z as n,Y as o,M as p,ht as q,Ke as r,ie as s,Je as t,de as u,$ as v,U as w,O as x,X as y,vt as z};
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkWLQEPVDR_js=require('./chunk-WLQEPVDR.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkWNTT4MGC_js=require('./chunk-WNTT4MGC.js'),chunk6ILFFGGS_js=require('./chunk-6ILFFGGS.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var P=class o{constructor(t){chunkDC7S76ZX_js.a(this,"_document");chunkDC7S76ZX_js.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 chunk6ILFFGGS_js.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 chunkU4UCHBZ7_js.a(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-HH2E3HBO.js'),a=r(n,e),i=await chunk6ILFFGGS_js.f(a),s=new o(i);return s._pendingVariables={},s}async toBuffer(t){if(this._document.originalBuffer){if(t?.selective){let n=await chunkWLQEPVDR_js.c(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await chunkWNTT4MGC_js.h(this._document);return this._document.originalBuffer=e,e}return chunkWNTT4MGC_js.s(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(chunkTE2AF7FM_js.b(this._document,t))}_executeCommand(t){let e=new o(chunkTE2AF7FM_js.a(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(`
1
+ 'use strict';var chunkWLQEPVDR_js=require('./chunk-WLQEPVDR.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkWNTT4MGC_js=require('./chunk-WNTT4MGC.js'),chunkC6GSFUV2_js=require('./chunk-C6GSFUV2.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var P=class o{constructor(t){chunkDC7S76ZX_js.a(this,"_document");chunkDC7S76ZX_js.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 chunkC6GSFUV2_js.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 chunkU4UCHBZ7_js.a(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-HH2E3HBO.js'),a=r(n,e),i=await chunkC6GSFUV2_js.f(a),s=new o(i);return s._pendingVariables={},s}async toBuffer(t){if(this._document.originalBuffer){if(t?.selective){let n=await chunkWLQEPVDR_js.c(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await chunkWNTT4MGC_js.h(this._document);return this._document.originalBuffer=e,e}return chunkWNTT4MGC_js.s(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(chunkTE2AF7FM_js.b(this._document,t))}_executeCommand(t){let e=new o(chunkTE2AF7FM_js.a(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=chunkU4UCHBZ7_js.a(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(`
@@ -1 +1 @@
1
- import {x,D}from'./chunk-V7BKPX67.mjs';var O=30,F=200,y=24,R=10,B=10,C=24;function N(_){let{mouseX:n,mouseY:l,pagesContainer:d,target:L,hfEditMode:m,edgeProximity:r=O}=_,T=`.${x.table}`,H=`.${x.row}`,p=`.${x.cell}`,h=`.${D.header}`,M=`.${D.footer}`,E=t=>{let o=!!t.closest(h),e=!!t.closest(M);return !o&&!e?!m:o?m==="header":m==="footer"},c=L.closest(T);if(c&&!E(c)&&(c=null),!c){let t=d.querySelectorAll(T);for(let o of Array.from(t)){if(!E(o))continue;let e=o.getBoundingClientRect(),s=n>=e.left-r&&n<e.left,A=l>=e.top-r&&l<e.top,P=n>=e.left-r&&n<=e.right,I=l>=e.top-r&&l<=e.bottom;if(s&&I||A&&P){c=o;break}}}if(!c)return null;let i=c.getBoundingClientRect(),b=n<i.left+r&&n>=i.left-r,g=l<i.top+r&&l>=i.top-r;if(!b&&!g)return null;let u=c.querySelectorAll(`:scope > ${H}`);if(u.length===0)return null;let S=t=>t&&Number(t.dataset.pmStart)||0;if(b)for(let t=0;t<u.length;t++){let o=u[t].getBoundingClientRect();if(l>=o.top&&l<=o.bottom){let e=u[t].querySelector(p),s=S(e);if(!s)break;return {type:"row",clientX:i.left-y,clientY:o.top+o.height/2-R,cellPmPos:s}}}if(g){let t=u[0].querySelectorAll(`:scope > ${p}`);for(let o=0;o<t.length;o++){let e=t[o].getBoundingClientRect();if(n>=e.left&&n<=e.right){let s=S(t[o]);if(!s)break;return {type:"column",clientX:e.left+e.width/2-B,clientY:i.top-C,cellPmPos:s}}}}return null}export{O as a,F as b,N as c};
1
+ import {x,D}from'./chunk-ITVXBQGR.mjs';var O=30,F=200,y=24,R=10,B=10,C=24;function N(_){let{mouseX:n,mouseY:l,pagesContainer:d,target:L,hfEditMode:m,edgeProximity:r=O}=_,T=`.${x.table}`,H=`.${x.row}`,p=`.${x.cell}`,h=`.${D.header}`,M=`.${D.footer}`,E=t=>{let o=!!t.closest(h),e=!!t.closest(M);return !o&&!e?!m:o?m==="header":m==="footer"},c=L.closest(T);if(c&&!E(c)&&(c=null),!c){let t=d.querySelectorAll(T);for(let o of Array.from(t)){if(!E(o))continue;let e=o.getBoundingClientRect(),s=n>=e.left-r&&n<e.left,A=l>=e.top-r&&l<e.top,P=n>=e.left-r&&n<=e.right,I=l>=e.top-r&&l<=e.bottom;if(s&&I||A&&P){c=o;break}}}if(!c)return null;let i=c.getBoundingClientRect(),b=n<i.left+r&&n>=i.left-r,g=l<i.top+r&&l>=i.top-r;if(!b&&!g)return null;let u=c.querySelectorAll(`:scope > ${H}`);if(u.length===0)return null;let S=t=>t&&Number(t.dataset.pmStart)||0;if(b)for(let t=0;t<u.length;t++){let o=u[t].getBoundingClientRect();if(l>=o.top&&l<=o.bottom){let e=u[t].querySelector(p),s=S(e);if(!s)break;return {type:"row",clientX:i.left-y,clientY:o.top+o.height/2-R,cellPmPos:s}}}if(g){let t=u[0].querySelectorAll(`:scope > ${p}`);for(let o=0;o<t.length;o++){let e=t[o].getBoundingClientRect();if(n>=e.left&&n<=e.right){let s=S(t[o]);if(!s)break;return {type:"column",clientX:e.left+e.width/2-B,clientY:i.top-C,cellPmPos:s}}}}return null}export{O as a,F as b,N as c};
@@ -1,4 +1,4 @@
1
- import {c}from'./chunk-O5X22KZ6.mjs';import {a as a$1}from'./chunk-ARHPXIBJ.mjs';import {b,a as a$2}from'./chunk-CUY2THAO.mjs';import {h as h$1,s}from'./chunk-4EHBV73E.mjs';import {f}from'./chunk-VKTCTMIO.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){if(this._document.originalBuffer){if(t?.selective){let n=await c(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await h$1(this._document);return this._document.originalBuffer=e,e}return s(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(`
1
+ import {c}from'./chunk-O5X22KZ6.mjs';import {a as a$1}from'./chunk-ARHPXIBJ.mjs';import {b,a as a$2}from'./chunk-CUY2THAO.mjs';import {h as h$1,s}from'./chunk-4EHBV73E.mjs';import {f}from'./chunk-R7RR6M4A.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){if(this._document.originalBuffer){if(t?.selective){let n=await c(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await h$1(this._document);return this._document.originalBuffer=e,e}return s(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(`
@@ -1 +1 @@
1
- 'use strict';var chunkN27FJQTG_js=require('./chunk-N27FJQTG.js'),chunk44RUAQA2_js=require('./chunk-44RUAQA2.js'),chunkDY2MJCSV_js=require('./chunk-DY2MJCSV.js'),chunkY7JZPBBW_js=require('./chunk-Y7JZPBBW.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function N(e,t,a){if(!(!e||e<=0)){if(t==="pct")return a*e/5e3;if(!t||t==="dxa"||t==="auto")return chunk4Q2IP5FW_js.c(e)}}function q(e){return Math.max(1,...e.rows.map(t=>t.cells.reduce((a,o)=>a+Math.max(1,o.colSpan??1),0)))}function J(e,t,a){if(t<=0)return [];let o=a>0?a/t:0;if(e.length===0)return Array(t).fill(o);let n=e.slice(0,t),r=t-n.length;if(r>0){let u=n.filter(g=>g>0),c=u.length>0?u.reduce((g,h)=>g+h,0)/u.length:o;n=n.concat(Array(r).fill(c));}let s=n.reduce((u,c)=>u+(c>0?c:0),0),i=n.filter(u=>u<=0).length;if(s<=0)return Array(t).fill(o);if(i===0)return n;let l=Math.max(0,a-s),f=l>0?l/i:s/Math.max(1,t-i);return n.map(u=>u>0?u:f)}function K(e,t){if(e.pages.length===0)return null;let a=e.pageGap??0,o=0,n=null,r=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,f=o,u=f+l;if(t.y>=f&&t.y<u)return {pageIndex:s,page:i,pageY:t.y-f};let c=f+l/2,g=Math.abs(t.y-c);g<r&&(r=g,n=s),o=u+a;}if(n!==null){let s=e.pages[n],i=D(e,n);return {pageIndex:n,page:s,pageY:Math.max(0,Math.min(t.y-i,s.size?.h??e.pageSize.h))}}return null}function D(e,t){let a=e.pageGap??0,o=0;for(let n=0;n<t&&n<e.pages.length;n++){let s=e.pages[n].size?.h??e.pageSize.h;o+=s+a;}return o}function Ie(e,t){return K(e,{y:t})?.pageIndex??null}function Q(e,t){return e.findIndex(a=>a.id===t)}function Be(e,t){let a=0;for(let o=e.fromLine;o<e.toLine&&o<t.lines.length;o++)a+=t.lines[o].lineHeight;return a}function ce(e,t,a,o){let n=[...e.page.fragments].sort((r,s)=>{let i=r.y-s.y;return Math.abs(i)>.5?i:r.x-s.x});for(let r of n){let s=Q(t,r.blockId);if(s===-1)continue;let i=t[s],l=a[s];if(!i||!l)continue;let f;if(r.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;f=Be(r,l);}else if(r.kind==="table")f=r.height;else if(r.kind==="image")f=r.height;else continue;let u=o.x>=r.x&&o.x<=r.x+r.width,c=o.y>=r.y&&o.y<=r.y+f;if(u&&c)return {fragment:r,block:i,measure:l,pageIndex:e.pageIndex,localX:o.x-r.x,localY:o.y-r.y}}return null}function Re(e,t,a,o){for(let n of e.page.fragments){if(n.kind!=="image")continue;let r=Q(t,n.blockId);if(r===-1)continue;let s=t[r],i=a[r];if(!s||!i)continue;let l=o.x>=n.x&&o.x<=n.x+n.width,f=o.y>=n.y&&o.y<=n.y+n.height;if(l&&f)return {fragment:n,block:s,measure:i,pageIndex:e.pageIndex,localX:o.x-n.x,localY:o.y-n.y}}return null}function ue(e,t,a,o){for(let n of e.page.fragments){if(n.kind!=="table")continue;let r=n,s=o.x>=r.x&&o.x<=r.x+r.width,i=o.y>=r.y&&o.y<=r.y+r.height;if(!s||!i)continue;let l=Q(t,r.blockId);if(l===-1)continue;let f=t[l],u=a[l];if(!f||f.kind!=="table"||!u||u.kind!=="table")continue;let c=f,g=u,h=o.x-r.x,x=o.y-r.y,d=r.headerRowCount??0,p=d>0&&r.continuesFromPrev?chunk44RUAQA2_js.r(g,d):0,m=0,b=-1;if(g.rows.length===0||c.rows.length===0)continue;if(p>0&&x<p){let T=0;for(let w=0;w<d&&w<g.rows.length;w++){let E=g.rows[w];if(x>=T&&x<T+E.height){b=w;break}T+=E.height;}b===-1&&(b=0);}else {let T=x-p;for(let w=r.fromRow;w<r.toRow&&w<g.rows.length;w++){let E=g.rows[w];if(T>=m&&T<m+E.height){b=w;break}m+=E.height;}}if(b===-1&&(b=Math.min(r.toRow-1,g.rows.length-1),b<r.fromRow))continue;let k=g.rows[b],F=c.rows[b];if(!k||!F)continue;let P=0,M=-1;if(k.cells.length===0||F.cells.length===0)continue;for(let T=0;T<k.cells.length;T++){let w=k.cells[T];if(h>=P&&h<P+w.width){M=T;break}P+=w.width;}if(M===-1&&(M=k.cells.length-1,M<0))continue;let H=k.cells[M],R=F.cells[M];if(!H||!R)continue;let y=0;if(p>0&&b<d)for(let T=0;T<b;T++)y+=g.rows[T]?.height??0;else {y=p;for(let T=r.fromRow;T<b;T++)y+=g.rows[T]?.height??0;}let I=0;for(let T=0;T<M;T++)I+=k.cells[T]?.width??0;let C,S;if(R.blocks&&R.blocks.length>0){let T=R.blocks[0],w=H.blocks[0];T.kind==="paragraph"&&w?.kind==="paragraph"&&(C=T,S=w);}let _=h-I,L=x-y;return {fragment:r,block:c,measure:g,pageIndex:e.pageIndex,rowIndex:b,colIndex:M,cellBlock:C,cellMeasure:S,cellLocalX:Math.max(0,_),cellLocalY:Math.max(0,L)}}return null}function Se(e,t,a,o){let n={pageHit:null,fragmentHit:null,tableCellHit:null};if(n.pageHit=K(e,o),!n.pageHit)return n;let r=D(e,n.pageHit.pageIndex),s={x:o.x,y:o.y-r};return n.fragmentHit=ce(n.pageHit,t,a,s),n.fragmentHit?.fragment.kind==="table"&&(n.tableCellHit=ue(n.pageHit,t,a,s)),n}function Le(e){if(e.pages.length===0)return 0;let t=e.pageGap??0,a=0;for(let o=0;o<e.pages.length;o++){let n=e.pages[o];a+=n.size?.h??e.pageSize.h,o<e.pages.length-1&&(a+=t);}return a}function Ee(e,t){return D(e,t)}function Ce(e,t){if(t<0||t>=e.pages.length)return null;let a=D(e,t),n=e.pages[t].size?.h??e.pageSize.h;return {top:a,bottom:a+n}}function Z(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function fe(e,t){let a=[];for(let o=t.fromRun;o<=t.toRun&&o<e.runs.length;o++){let n=e.runs[o];if(n){if(n.kind==="tab"||n.kind==="image"||n.kind==="lineBreak"){a.push(n);continue}if(n.kind==="text"){let r=n.text??"",s=o===t.fromRun,i=o===t.toRun;if(s||i){let l=s?t.fromChar:0,f=i?t.toChar:r.length,u=r.slice(l,f);u.length>0&&a.push({...n,text:u});}else a.push(n);}}}return a}function ge(e,t){let a,o,n=e.pmStart??0,r=0;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let i=e.runs[s];i&&(s<t.fromRun?i.kind==="text"?r+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(r+=1):s===t.fromRun&&(r+=t.fromChar,a=n+r,i.kind==="text"&&(r=t.fromChar)));}if(a!==void 0){let s=0;for(let i=t.fromRun;i<=t.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let f=l.text??"",u=i===t.fromRun?t.fromChar:0,c=i===t.toRun?t.toChar:f.length;s+=c-u;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}o=a+s;}return {pmStart:a,pmEnd:o}}function _e(e,t,a,o){let n=0;for(let r=a;r<o&&r<e.lines.length;r++){let i=e.lines[r].lineHeight;if(t>=n&&t<n+i)return r;n+=i;}return o>a?Math.min(o-1,e.lines.length-1):null}function Ae(e,t,a,o){let{pmStart:n,pmEnd:r}=ge(e,t);if(n===void 0||r===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(o-t.width)/2):s==="right"&&(i=Math.max(0,o-t.width));let l=Math.max(0,a-i);if(l<=0)return {charOffset:0,pmPosition:n};let f=fe(e,t);if(f.length===0)return {charOffset:0,pmPosition:n};let u=0,c=0;for(let h of f){if(h.kind==="tab"){let x=h.width??48,d=u+x;if(l<=d){let p=u+x/2;return l<p?{charOffset:c,pmPosition:n+c}:{charOffset:c+1,pmPosition:n+c+1}}u=d,c+=1;continue}if(h.kind==="image"){let x=h.width,d=u+x;if(l<=d){let p=u+x/2;return l<p?{charOffset:c,pmPosition:n+c}:{charOffset:c+1,pmPosition:n+c+1}}u=d,c+=1;continue}if(h.kind==="lineBreak"){if(l>=u)return {charOffset:c,pmPosition:n+c};c+=1;continue}if(h.kind==="text"){let x=h.text??"";if(x.length===0)continue;let d=Z(h),p=chunkDY2MJCSV_js.g(x,d),m=u+p.width;if(l<=m){let b=l-u,k=chunkDY2MJCSV_js.h(b,p.charWidths),F=c+k;return {charOffset:F,pmPosition:n+F}}u=m,c+=x.length;}}return {charOffset:r-n,pmPosition:r}}function $(e){let{fragment:t,block:a,measure:o,localX:n,localY:r}=e;if(t.kind!=="paragraph"||a.kind!=="paragraph"||o.kind!=="paragraph")return null;let s=t,i=a,l=o,f=_e(l,r,s.fromLine,s.toLine);if(f===null)return null;let u=l.lines[f];if(!u)return null;let c=0;for(let k=s.fromLine;k<f;k++)c+=l.lines[k]?.lineHeight??0;let g=i.attrs?.indent,h=g?.left??0,x=g?.right??0,d=Math.max(0,t.width-h-x),p=n-h,{charOffset:m,pmPosition:b}=Ae(i,u,p,d);return {pmPosition:b,charOffset:m,lineIndex:f}}function he(e){let{cellBlock:t,cellMeasure:a,cellLocalX:o,cellLocalY:n}=e;if(!t||!a)return null;let r={fragment:{kind:"paragraph",blockId:t.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:t,measure:a,pageIndex:e.pageIndex,localX:o,localY:n};return $(r)?.pmPosition??null}function De(e,t){if(t)return he(t);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?$(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function de(e,t,a,o){let n=e.pmStart??0,r=e.pmEnd??n;if(a<n||a>r)return null;let s=a-n;for(let i=0;i<t.lines.length;i++){let l=t.lines[i],{pmStart:f,pmEnd:u}=ge(e,l);if(f===void 0||u===void 0)continue;let c=f-n,g=u-n;if(s>=c&&s<=g){let h=s-c,x=fe(e,l),d=0,p=0;for(let m of x)if(m.kind==="tab"){if(h<=p+1)return h<=p?{x:d,lineIndex:i}:{x:d+(m.width??48),lineIndex:i};d+=m.width??48,p+=1;}else if(m.kind==="image"){if(h<=p+1)return h<=p?{x:d,lineIndex:i}:{x:d+m.width,lineIndex:i};d+=m.width,p+=1;}else if(m.kind==="lineBreak"){if(h<=p)return {x:d,lineIndex:i};p+=1;}else if(m.kind==="text"){let b=m.text??"";if(h<=p+b.length){let P=h-p,M=Z(m),H=chunkDY2MJCSV_js.g(b.slice(0,P),M);return {x:d+H.width,lineIndex:i}}let k=Z(m),F=chunkDY2MJCSV_js.g(b,k);d+=F.width,p+=b.length;}return {x:d,lineIndex:i}}}return null}function Oe(e,t,a,o,n,r,s){let i=de(e,t,a);if(!i)return null;let l=e.attrs?.alignment??"left",f=e.attrs?.indent,u=f?.left??0,c=f?.right??0,g=Math.max(0,r-u-c),h=t.lines[i.lineIndex];if(!h)return null;let x=0;l==="center"?x=Math.max(0,(g-h.width)/2):l==="right"&&(x=Math.max(0,g-h.width));let d=0;for(let p=s;p<i.lineIndex;p++)d+=t.lines[p]?.lineHeight??0;return {x:o+u+x+i.x,y:n+d,height:h.lineHeight}}function me(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function ee(e,t){return e.findIndex(a=>a.id===t)}function G(e,t){let o=(e.pmStart??0)+1,n=0,r;for(let l=0;l<e.runs.length&&l<=t.toRun;l++){let f=e.runs[l];if(f){if(l<t.fromRun)f.kind==="text"?n+=(f.text??"").length:n+=1;else if(l===t.fromRun){n+=t.fromChar,r=o+n;break}}}r===void 0&&(r=o);let s=0;for(let l=t.fromRun;l<=t.toRun&&l<e.runs.length;l++){let f=e.runs[l];if(f)if(f.kind==="text"){let u=f.text??"",c=l===t.fromRun?t.fromChar:0,g=l===t.toRun?t.toChar:u.length;s+=g-c;}else s+=1;}let i=r+s;return {pmStart:r,pmEnd:i}}function pe(e,t,a,o){let n=[];for(let r=0;r<t.lines.length;r++){let s=t.lines[r],i=G(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<o&&n.push({line:s,index:r});}return n}function v(e,t,a){let o=G(e,t);return o.pmStart===void 0?0:Math.max(0,a-o.pmStart)}function z(e,t,a,o){let n=0,r=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(r+1>=a)return a<=r?n:n+l;n+=l,r+=1;continue}if(i.kind==="image"){let l=i.width;if(r+1>=a)return a<=r?n:n+l;n+=l,r+=1;continue}if(i.kind==="lineBreak"){if(a<=r)return n;r+=1;continue}if(i.kind==="text"){let l=i.text??"",f=s===t.fromRun,u=s===t.toRun,c=f?t.fromChar:0,g=u?t.toChar:l.length,h=l.slice(c,g);if(r+h.length>=a){let p=a-r,m=me(i),b=chunkDY2MJCSV_js.g(h.slice(0,p),m);return n+b.width}let x=me(i),d=chunkDY2MJCSV_js.g(h,x);n+=d.width,r+=h.length;}}}return n}function W(e,t){let a=0;for(let o=0;o<t&&o<e.lines.length;o++)a+=e.lines[o].lineHeight;return a}function Xe(e,t,a,o,n){if(o===n)return [];let r=Math.min(o,n),s=Math.max(o,n),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 g=ee(t,c.blockId);if(g===-1)continue;let h=t[g],x=a[g];if(!h||h.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=h,p=x,m=c,b=pe(d,p,r,s);for(let{line:k,index:F}of b){if(F<m.fromLine||F>=m.toLine)continue;let P=G(d,k);if(P.pmStart===void 0||P.pmEnd===void 0)continue;let M=Math.max(P.pmStart,r),H=Math.min(P.pmEnd,s);if(M>=H)continue;let R=v(d,k,M),y=v(d,k,H),B=d.attrs?.indent,I=B?.left??0,C=B?.right??0,S=Math.max(0,c.width-I-C),_=z(d,k,R),L=z(d,k,y),T=d.attrs?.alignment??"left",w=0;T==="center"?w=Math.max(0,(S-k.width)/2):T==="right"&&(w=Math.max(0,S-k.width));let E=W(p,F)-W(p,m.fromLine),A=c.x+I+w+Math.min(_,L),V=Math.max(1,Math.abs(L-_)),Y=c.y+E;i.push({x:A,y:Y+u,width:V,height:k.lineHeight,pageIndex:l});}}if(c.kind==="table"){let g=ee(t,c.blockId);if(g===-1)continue;let h=t[g],x=a[g];if(!h||h.kind!=="table"||!x||x.kind!=="table")continue;let d=h,p=x,m=c,b=m.headerRowCount??0,F=b>0&&m.continuesFromPrev?chunk44RUAQA2_js.r(p,b):0;for(let P=m.fromRow;P<m.toRow&&P<d.rows.length;P++){let M=d.rows[P],H=p.rows[P];if(!M||!H)continue;let R=0;for(let y=0;y<M.cells.length;y++){let B=M.cells[y],I=H.cells[y];if(!(!B||!I)){for(let C=0;C<B.blocks.length;C++){let S=B.blocks[C],_=I.blocks[C];if(!S||S.kind!=="paragraph"||!_||_.kind!=="paragraph")continue;let L=S,T=_,w=pe(L,T,r,s),E=0;for(let{line:A,index:V}of w){let Y=G(L,A);if(Y.pmStart===void 0||Y.pmEnd===void 0)continue;let te=Math.max(Y.pmStart,r),ne=Math.min(Y.pmEnd,s);if(te>=ne)continue;let Me=v(L,A,te),ye=v(L,A,ne),re=z(L,A,Me,I.width),oe=z(L,A,ye,I.width),He=W(T,V);i.push({x:m.x+R+Math.min(re,oe),y:m.y+F+E+He+u,width:Math.max(1,Math.abs(oe-re)),height:A.lineHeight,pageIndex:l});}E+=T.totalHeight;}R+=I.width;}}F+=H.height;}}if(c.kind==="image"){let g=c.pmStart??0;(c.pmEnd??g+1)>r&&g<s&&i.push({x:c.x,y:c.y+u,width:c.width,height:c.height,pageIndex:l});}}}return i}function Ye(e,t,a,o){for(let n=0;n<e.pages.length;n++){let r=e.pages[n],s=D(e,n);for(let i of r.fragments){if(i.kind==="paragraph"){let l=ee(t,i.blockId);if(l===-1)continue;let f=t[l],u=a[l];if(!f||f.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let c=f,g=u,h=i,x=c.pmStart??0,d=c.pmEnd??x;if(o<x||o>d)continue;for(let p=h.fromLine;p<h.toLine;p++){let m=g.lines[p];if(!m)continue;let b=G(c,m);if(!(b.pmStart===void 0||b.pmEnd===void 0)&&o>=b.pmStart&&o<=b.pmEnd){let k=v(c,m,o),F=c.attrs?.indent,P=F?.left??0,M=F?.right??0,H=Math.max(0,i.width-P-M),R=z(c,m,k),y=c.attrs?.alignment??"left",B=0;y==="center"?B=Math.max(0,(H-m.width)/2):y==="right"&&(B=Math.max(0,H-m.width));let I=W(g,p)-W(g,h.fromLine);return {x:i.x+P+B+R,y:i.y+I+s,height:m.lineHeight,pageIndex:n}}}}if(i.kind==="image"){let l=i.pmStart??0,f=i.pmEnd??l+1;if(o>=l&&o<=f){let u=o===l?0:i.width;return {x:i.x+u,y:i.y+s,height:i.height,pageIndex:n}}}}}return null}function ve(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function ze(e){let t=new Map;for(let a of e){let o=t.get(a.pageIndex)??[];o.push(a),t.set(a.pageIndex,o);}return t}function We(e){if(e.kind!=="paragraph")return false;let t=e.attrs;return t?!!(t.borders?.top||t.borders?.bottom||t.spacingExplicit?.before||t.spacingExplicit?.after):false}function xe(e){return be(e)}function be(e){let t=new Set;for(let a=1;a<e.length;a++){let o=e[a-1],n=e[a];o.kind==="table"&&n.kind==="paragraph"&&(n.runs.length>0||We(n)||t.add(a));}return e.map((a,o)=>{if(a.kind==="table")return Ge(a);if(a.kind!=="paragraph")return a;let n=t.has(o),r=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!r?.before,f=i&&!r?.after,u=l||f;if(!u&&!n)return a;let c=a.attrs;return u&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:r?.before?c.spacing.before:void 0,after:r?.after?c.spacing.after:void 0}}),n&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function Ge(e){let t=false,a=e.rows.map(o=>{let n=false,r=o.cells.map(s=>{let i=be(s.blocks);return i.some((f,u)=>f!==s.blocks[u])?(n=true,{...s,blocks:i}):s});return n?(t=true,{...o,cells:r}):o});return t?{...e,rows:a}:e}function Ue(e){return e?.align??e?.alignment}function ke(e,t,a,o){let n=o.section==="header"?o.margins.header??48:o.pageSize.h-(o.margins.footer??48)-a,r=e.position?.vertical;if(!r)return t;let s=Ue(r),i=r.posOffset!==void 0?chunk4Q2IP5FW_js.e(r.posOffset):void 0;if(r.relativeTo==="page"){if(i!==void 0)return i-n;if(s==="top")return -n;if(s==="bottom")return o.pageSize.h-e.height-n;if(s==="center")return (o.pageSize.h-e.height)/2-n}if(r.relativeTo==="margin"){let l=o.margins.top,f=o.pageSize.h-o.margins.top-o.margins.bottom;if(i!==void 0)return l+i-n;if(s==="top")return l-n;if(s==="bottom")return l+f-e.height-n;if(s==="center")return l+(f-e.height)/2-n}return i!==void 0?t+i:t}function Te(e,t,a,o){let n=0,r=a,s=0;for(let i=0;i<e.length;i++){let l=e[i],f=t[i];if(!(!l||!f)){if(l.kind==="paragraph"&&f.kind==="paragraph"){let u=s,c=u+f.totalHeight;n=Math.min(n,u),r=Math.max(r,c);for(let g of l.runs){if(g.kind!=="image"||!g.position)continue;let h=ke(g,u,a,o);n=Math.min(n,h),r=Math.max(r,h+g.height);}s=c;}else if(l.kind==="table"&&f.kind==="table"){let u=s+f.totalHeight;n=Math.min(n,s),r=Math.max(r,u),s=u;}else if(l.kind==="image"&&f.kind==="image"){let u=s+f.height;n=Math.min(n,s),r=Math.max(r,u),s=u;}else if(l.kind==="textBox"&&f.kind==="textBox"){let u=s+f.height;n=Math.min(n,s),r=Math.max(r,u),s=u;}}}return {visualTop:n,visualBottom:r}}function Ne(e,t,a,o){if(!e||!e.content||e.content.length===0)return;let n=chunkY7JZPBBW_js.b(e.content,{styles:o.styles??void 0,theme:o.theme??null}),r=chunkN27FJQTG_js.d(n,{theme:o.theme??void 0});if(r.length===0)return;let s=xe(r),i=o.measureBlocks(s,t),l=i.reduce((c,g)=>g.kind==="paragraph"||g.kind==="table"?c+g.totalHeight:g.kind==="image"||g.kind==="textBox"?c+g.height:c,0),{visualTop:f,visualBottom:u}=Te(r,i,l,a);return {blocks:s,measures:i,height:l,visualTop:f,visualBottom:u}}var Pe=7,Fe=0;function we(e,t){if(e.kind!=="paragraph"||t.kind!=="paragraph")return "totalHeight"in t?t.totalHeight:"height"in t?t.height:0;let a=e.runs.filter(i=>i.kind!=="text"||i.text.length>0);if(!(t.lines.length===1&&a.length>0&&a.every(i=>i.kind==="image")))return t.totalHeight;let n=a.reduce((i,l)=>l.kind==="image"?Math.max(i,l.height):i,0),r=e.attrs?.spacing?.before??0,s=e.attrs?.spacing?.after??0;return r+n+s}function Ve(e){let t=e?.borders?.top?.width??0,a=e?.borders?.bottom?.width??0;return t+a}function je(e,t,a){let o=e.columnWidths??[],n=N(e.width,e.widthType,t),r=q(e),s=n??t;if(e.rows.length>0&&(o=J(o,r,s)),o.length>0&&n){let c=o.reduce((g,h)=>g+h,0);if(c>0&&Math.abs(c-n)>1){let g=n/c;o=o.map(h=>h*g);}}let i=new Map;for(let c=0;c<e.rows.length;c++){let g=e.rows[c];if(!g)continue;let h=0,x=i.get(c)??new Set;for(;x.has(h);)h++;for(let d of g.cells){let p=d.colSpan??1,m=d.rowSpan??1;if(m>1)for(let b=c+1;b<c+m;b++){i.has(b)||i.set(b,new Set);let k=i.get(b);for(let F=0;F<p;F++)k.add(h+F);}for(h+=p;x.has(h);)h++;}}let l=e.rows.map((c,g)=>{let h=0,x=i.get(g)??new Set;for(;x.has(h);)h++;return {cells:c.cells.map(d=>{let p=d.colSpan??1,m=0;for(let P=0;P<p&&h+P<o.length;P++)m+=o[h+P]??0;for(m===0&&(m=(d.width&&d.width>0?d.width:N(d.widthValue,d.widthType,s))??100),h+=p;x.has(h);)h++;let b=d.padding?.left??Pe,k=d.padding?.right??Pe,F=Math.max(1,m-b-k);return {blocks:d.blocks.map(P=>a(P,F)),width:m,height:0,colSpan:d.colSpan,rowSpan:d.rowSpan}}),height:0}});for(let c=0;c<l.length;c++){let g=l[c],h=e.rows[c]?.cells,x=0,d=0;for(let k=0;k<g.cells.length;k++){let F=g.cells[k],P=h?.[k],M=0;for(let y=0;y<F.blocks.length;y++){let B=P?.blocks[y],I=F.blocks[y];!B||!I||(M+=we(B,I));}F.height=M;let H=P?.padding?.top??Fe,R=P?.padding?.bottom??Fe;F.height+=H+R,x=Math.max(x,F.height),d=Math.max(d,Ve(P));}let p=e.rows[c],m=p?.height,b=p?.heightRule;m&&b==="exact"?g.height=m:m?g.height=Math.max(x+d,m):g.height=x+d;}let f=l.reduce((c,g)=>c+g.height,0),u=o.reduce((c,g)=>c+g,0)||n||t;return {kind:"table",rows:l,columnWidths:o,totalWidth:u,totalHeight:f}}var qe=816,Je=1056,Ke=96,Qe=48;function O(e){return Math.round(e/1440*96)}function Ze(e){return {w:e?.pageWidth?O(e.pageWidth):816,h:e?.pageHeight?O(e.pageHeight):1056}}function $e(e){return {top:e?.marginTop?O(e.marginTop):96,right:e?.marginRight?O(e.marginRight):96,bottom:e?.marginBottom?O(e.marginBottom):96,left:e?.marginLeft?O(e.marginLeft):96,header:e?.headerDistance?O(e.headerDistance):48,footer:e?.footerDistance?O(e.footerDistance):48}}function et(e,t){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let o=e.package.headers,n=e.package.footers,r=null,s=null,i=null,l=null;if(o&&t?.headerReferences){let f=t.headerReferences.find(c=>c.type==="default");f?.rId&&(r=o.get(f.rId)??null);let u=t.headerReferences.find(c=>c.type==="first");u?.rId&&(i=o.get(u.rId)??null);}if(n&&t?.footerReferences){let f=t.footerReferences.find(c=>c.type==="default");f?.rId&&(s=n.get(f.rId)??null);let u=t.footerReferences.find(c=>c.type==="first");u?.rId&&(l=n.get(u.rId)??null);}return t?.titlePg||(!r&&i&&(r=i),!s&&l&&(s=l)),{header:r,footer:s,firstHeader:i,firstFooter:l}}exports.A=we;exports.B=je;exports.C=qe;exports.D=Je;exports.E=Ke;exports.F=Qe;exports.G=Ze;exports.H=$e;exports.I=et;exports.a=N;exports.b=q;exports.c=J;exports.d=K;exports.e=D;exports.f=Ie;exports.g=ce;exports.h=Re;exports.i=ue;exports.j=Se;exports.k=Le;exports.l=Ee;exports.m=Ce;exports.n=$;exports.o=he;exports.p=De;exports.q=de;exports.r=Oe;exports.s=Xe;exports.t=Ye;exports.u=ve;exports.v=ze;exports.w=xe;exports.x=ke;exports.y=Te;exports.z=Ne;
1
+ 'use strict';var chunkBD4CYYFB_js=require('./chunk-BD4CYYFB.js'),chunk44RUAQA2_js=require('./chunk-44RUAQA2.js'),chunkTZJUO3NW_js=require('./chunk-TZJUO3NW.js'),chunkHVZMO3BU_js=require('./chunk-HVZMO3BU.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');function N(e,t,a){if(!(!e||e<=0)){if(t==="pct")return a*e/5e3;if(!t||t==="dxa"||t==="auto")return chunk4Q2IP5FW_js.c(e)}}function q(e){return Math.max(1,...e.rows.map(t=>t.cells.reduce((a,o)=>a+Math.max(1,o.colSpan??1),0)))}function J(e,t,a){if(t<=0)return [];let o=a>0?a/t:0;if(e.length===0)return Array(t).fill(o);let n=e.slice(0,t),r=t-n.length;if(r>0){let u=n.filter(g=>g>0),c=u.length>0?u.reduce((g,h)=>g+h,0)/u.length:o;n=n.concat(Array(r).fill(c));}let s=n.reduce((u,c)=>u+(c>0?c:0),0),i=n.filter(u=>u<=0).length;if(s<=0)return Array(t).fill(o);if(i===0)return n;let l=Math.max(0,a-s),f=l>0?l/i:s/Math.max(1,t-i);return n.map(u=>u>0?u:f)}function K(e,t){if(e.pages.length===0)return null;let a=e.pageGap??0,o=0,n=null,r=1/0;for(let s=0;s<e.pages.length;s++){let i=e.pages[s],l=i.size?.h??e.pageSize.h,f=o,u=f+l;if(t.y>=f&&t.y<u)return {pageIndex:s,page:i,pageY:t.y-f};let c=f+l/2,g=Math.abs(t.y-c);g<r&&(r=g,n=s),o=u+a;}if(n!==null){let s=e.pages[n],i=D(e,n);return {pageIndex:n,page:s,pageY:Math.max(0,Math.min(t.y-i,s.size?.h??e.pageSize.h))}}return null}function D(e,t){let a=e.pageGap??0,o=0;for(let n=0;n<t&&n<e.pages.length;n++){let s=e.pages[n].size?.h??e.pageSize.h;o+=s+a;}return o}function Ie(e,t){return K(e,{y:t})?.pageIndex??null}function Q(e,t){return e.findIndex(a=>a.id===t)}function Be(e,t){let a=0;for(let o=e.fromLine;o<e.toLine&&o<t.lines.length;o++)a+=t.lines[o].lineHeight;return a}function ce(e,t,a,o){let n=[...e.page.fragments].sort((r,s)=>{let i=r.y-s.y;return Math.abs(i)>.5?i:r.x-s.x});for(let r of n){let s=Q(t,r.blockId);if(s===-1)continue;let i=t[s],l=a[s];if(!i||!l)continue;let f;if(r.kind==="paragraph"){if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;f=Be(r,l);}else if(r.kind==="table")f=r.height;else if(r.kind==="image")f=r.height;else continue;let u=o.x>=r.x&&o.x<=r.x+r.width,c=o.y>=r.y&&o.y<=r.y+f;if(u&&c)return {fragment:r,block:i,measure:l,pageIndex:e.pageIndex,localX:o.x-r.x,localY:o.y-r.y}}return null}function Re(e,t,a,o){for(let n of e.page.fragments){if(n.kind!=="image")continue;let r=Q(t,n.blockId);if(r===-1)continue;let s=t[r],i=a[r];if(!s||!i)continue;let l=o.x>=n.x&&o.x<=n.x+n.width,f=o.y>=n.y&&o.y<=n.y+n.height;if(l&&f)return {fragment:n,block:s,measure:i,pageIndex:e.pageIndex,localX:o.x-n.x,localY:o.y-n.y}}return null}function ue(e,t,a,o){for(let n of e.page.fragments){if(n.kind!=="table")continue;let r=n,s=o.x>=r.x&&o.x<=r.x+r.width,i=o.y>=r.y&&o.y<=r.y+r.height;if(!s||!i)continue;let l=Q(t,r.blockId);if(l===-1)continue;let f=t[l],u=a[l];if(!f||f.kind!=="table"||!u||u.kind!=="table")continue;let c=f,g=u,h=o.x-r.x,x=o.y-r.y,d=r.headerRowCount??0,p=d>0&&r.continuesFromPrev?chunk44RUAQA2_js.r(g,d):0,m=0,b=-1;if(g.rows.length===0||c.rows.length===0)continue;if(p>0&&x<p){let T=0;for(let w=0;w<d&&w<g.rows.length;w++){let E=g.rows[w];if(x>=T&&x<T+E.height){b=w;break}T+=E.height;}b===-1&&(b=0);}else {let T=x-p;for(let w=r.fromRow;w<r.toRow&&w<g.rows.length;w++){let E=g.rows[w];if(T>=m&&T<m+E.height){b=w;break}m+=E.height;}}if(b===-1&&(b=Math.min(r.toRow-1,g.rows.length-1),b<r.fromRow))continue;let k=g.rows[b],F=c.rows[b];if(!k||!F)continue;let P=0,M=-1;if(k.cells.length===0||F.cells.length===0)continue;for(let T=0;T<k.cells.length;T++){let w=k.cells[T];if(h>=P&&h<P+w.width){M=T;break}P+=w.width;}if(M===-1&&(M=k.cells.length-1,M<0))continue;let H=k.cells[M],R=F.cells[M];if(!H||!R)continue;let y=0;if(p>0&&b<d)for(let T=0;T<b;T++)y+=g.rows[T]?.height??0;else {y=p;for(let T=r.fromRow;T<b;T++)y+=g.rows[T]?.height??0;}let I=0;for(let T=0;T<M;T++)I+=k.cells[T]?.width??0;let C,S;if(R.blocks&&R.blocks.length>0){let T=R.blocks[0],w=H.blocks[0];T.kind==="paragraph"&&w?.kind==="paragraph"&&(C=T,S=w);}let _=h-I,L=x-y;return {fragment:r,block:c,measure:g,pageIndex:e.pageIndex,rowIndex:b,colIndex:M,cellBlock:C,cellMeasure:S,cellLocalX:Math.max(0,_),cellLocalY:Math.max(0,L)}}return null}function Se(e,t,a,o){let n={pageHit:null,fragmentHit:null,tableCellHit:null};if(n.pageHit=K(e,o),!n.pageHit)return n;let r=D(e,n.pageHit.pageIndex),s={x:o.x,y:o.y-r};return n.fragmentHit=ce(n.pageHit,t,a,s),n.fragmentHit?.fragment.kind==="table"&&(n.tableCellHit=ue(n.pageHit,t,a,s)),n}function Le(e){if(e.pages.length===0)return 0;let t=e.pageGap??0,a=0;for(let o=0;o<e.pages.length;o++){let n=e.pages[o];a+=n.size?.h??e.pageSize.h,o<e.pages.length-1&&(a+=t);}return a}function Ee(e,t){return D(e,t)}function Ce(e,t){if(t<0||t>=e.pages.length)return null;let a=D(e,t),n=e.pages[t].size?.h??e.pageSize.h;return {top:a,bottom:a+n}}function Z(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function fe(e,t){let a=[];for(let o=t.fromRun;o<=t.toRun&&o<e.runs.length;o++){let n=e.runs[o];if(n){if(n.kind==="tab"||n.kind==="image"||n.kind==="lineBreak"){a.push(n);continue}if(n.kind==="text"){let r=n.text??"",s=o===t.fromRun,i=o===t.toRun;if(s||i){let l=s?t.fromChar:0,f=i?t.toChar:r.length,u=r.slice(l,f);u.length>0&&a.push({...n,text:u});}else a.push(n);}}}return a}function ge(e,t){let a,o,n=e.pmStart??0,r=0;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let i=e.runs[s];i&&(s<t.fromRun?i.kind==="text"?r+=(i.text??"").length:(i.kind==="tab"||i.kind==="lineBreak"||i.kind==="image")&&(r+=1):s===t.fromRun&&(r+=t.fromChar,a=n+r,i.kind==="text"&&(r=t.fromChar)));}if(a!==void 0){let s=0;for(let i=t.fromRun;i<=t.toRun&&i<e.runs.length;i++){let l=e.runs[i];if(l)if(l.kind==="text"){let f=l.text??"",u=i===t.fromRun?t.fromChar:0,c=i===t.toRun?t.toChar:f.length;s+=c-u;}else (l.kind==="tab"||l.kind==="lineBreak"||l.kind==="image")&&(s+=1);}o=a+s;}return {pmStart:a,pmEnd:o}}function _e(e,t,a,o){let n=0;for(let r=a;r<o&&r<e.lines.length;r++){let i=e.lines[r].lineHeight;if(t>=n&&t<n+i)return r;n+=i;}return o>a?Math.min(o-1,e.lines.length-1):null}function Ae(e,t,a,o){let{pmStart:n,pmEnd:r}=ge(e,t);if(n===void 0||r===void 0)return {charOffset:0,pmPosition:e.pmStart??0};let s=e.attrs?.alignment??"left",i=0;s==="center"?i=Math.max(0,(o-t.width)/2):s==="right"&&(i=Math.max(0,o-t.width));let l=Math.max(0,a-i);if(l<=0)return {charOffset:0,pmPosition:n};let f=fe(e,t);if(f.length===0)return {charOffset:0,pmPosition:n};let u=0,c=0;for(let h of f){if(h.kind==="tab"){let x=h.width??48,d=u+x;if(l<=d){let p=u+x/2;return l<p?{charOffset:c,pmPosition:n+c}:{charOffset:c+1,pmPosition:n+c+1}}u=d,c+=1;continue}if(h.kind==="image"){let x=h.width,d=u+x;if(l<=d){let p=u+x/2;return l<p?{charOffset:c,pmPosition:n+c}:{charOffset:c+1,pmPosition:n+c+1}}u=d,c+=1;continue}if(h.kind==="lineBreak"){if(l>=u)return {charOffset:c,pmPosition:n+c};c+=1;continue}if(h.kind==="text"){let x=h.text??"";if(x.length===0)continue;let d=Z(h),p=chunkTZJUO3NW_js.g(x,d),m=u+p.width;if(l<=m){let b=l-u,k=chunkTZJUO3NW_js.h(b,p.charWidths),F=c+k;return {charOffset:F,pmPosition:n+F}}u=m,c+=x.length;}}return {charOffset:r-n,pmPosition:r}}function $(e){let{fragment:t,block:a,measure:o,localX:n,localY:r}=e;if(t.kind!=="paragraph"||a.kind!=="paragraph"||o.kind!=="paragraph")return null;let s=t,i=a,l=o,f=_e(l,r,s.fromLine,s.toLine);if(f===null)return null;let u=l.lines[f];if(!u)return null;let c=0;for(let k=s.fromLine;k<f;k++)c+=l.lines[k]?.lineHeight??0;let g=i.attrs?.indent,h=g?.left??0,x=g?.right??0,d=Math.max(0,t.width-h-x),p=n-h,{charOffset:m,pmPosition:b}=Ae(i,u,p,d);return {pmPosition:b,charOffset:m,lineIndex:f}}function he(e){let{cellBlock:t,cellMeasure:a,cellLocalX:o,cellLocalY:n}=e;if(!t||!a)return null;let r={fragment:{kind:"paragraph",blockId:t.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:t,measure:a,pageIndex:e.pageIndex,localX:o,localY:n};return $(r)?.pmPosition??null}function De(e,t){if(t)return he(t);if(!e)return null;let{fragment:a}=e;return a.kind==="paragraph"?$(e)?.pmPosition??null:a.kind==="image"?a.pmStart??null:null}function de(e,t,a,o){let n=e.pmStart??0,r=e.pmEnd??n;if(a<n||a>r)return null;let s=a-n;for(let i=0;i<t.lines.length;i++){let l=t.lines[i],{pmStart:f,pmEnd:u}=ge(e,l);if(f===void 0||u===void 0)continue;let c=f-n,g=u-n;if(s>=c&&s<=g){let h=s-c,x=fe(e,l),d=0,p=0;for(let m of x)if(m.kind==="tab"){if(h<=p+1)return h<=p?{x:d,lineIndex:i}:{x:d+(m.width??48),lineIndex:i};d+=m.width??48,p+=1;}else if(m.kind==="image"){if(h<=p+1)return h<=p?{x:d,lineIndex:i}:{x:d+m.width,lineIndex:i};d+=m.width,p+=1;}else if(m.kind==="lineBreak"){if(h<=p)return {x:d,lineIndex:i};p+=1;}else if(m.kind==="text"){let b=m.text??"";if(h<=p+b.length){let P=h-p,M=Z(m),H=chunkTZJUO3NW_js.g(b.slice(0,P),M);return {x:d+H.width,lineIndex:i}}let k=Z(m),F=chunkTZJUO3NW_js.g(b,k);d+=F.width,p+=b.length;}return {x:d,lineIndex:i}}}return null}function Oe(e,t,a,o,n,r,s){let i=de(e,t,a);if(!i)return null;let l=e.attrs?.alignment??"left",f=e.attrs?.indent,u=f?.left??0,c=f?.right??0,g=Math.max(0,r-u-c),h=t.lines[i.lineIndex];if(!h)return null;let x=0;l==="center"?x=Math.max(0,(g-h.width)/2):l==="right"&&(x=Math.max(0,g-h.width));let d=0;for(let p=s;p<i.lineIndex;p++)d+=t.lines[p]?.lineHeight??0;return {x:o+u+x+i.x,y:n+d,height:h.lineHeight}}function me(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function ee(e,t){return e.findIndex(a=>a.id===t)}function G(e,t){let o=(e.pmStart??0)+1,n=0,r;for(let l=0;l<e.runs.length&&l<=t.toRun;l++){let f=e.runs[l];if(f){if(l<t.fromRun)f.kind==="text"?n+=(f.text??"").length:n+=1;else if(l===t.fromRun){n+=t.fromChar,r=o+n;break}}}r===void 0&&(r=o);let s=0;for(let l=t.fromRun;l<=t.toRun&&l<e.runs.length;l++){let f=e.runs[l];if(f)if(f.kind==="text"){let u=f.text??"",c=l===t.fromRun?t.fromChar:0,g=l===t.toRun?t.toChar:u.length;s+=g-c;}else s+=1;}let i=r+s;return {pmStart:r,pmEnd:i}}function pe(e,t,a,o){let n=[];for(let r=0;r<t.lines.length;r++){let s=t.lines[r],i=G(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<o&&n.push({line:s,index:r});}return n}function v(e,t,a){let o=G(e,t);return o.pmStart===void 0?0:Math.max(0,a-o.pmStart)}function z(e,t,a,o){let n=0,r=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let l=i.width??48;if(r+1>=a)return a<=r?n:n+l;n+=l,r+=1;continue}if(i.kind==="image"){let l=i.width;if(r+1>=a)return a<=r?n:n+l;n+=l,r+=1;continue}if(i.kind==="lineBreak"){if(a<=r)return n;r+=1;continue}if(i.kind==="text"){let l=i.text??"",f=s===t.fromRun,u=s===t.toRun,c=f?t.fromChar:0,g=u?t.toChar:l.length,h=l.slice(c,g);if(r+h.length>=a){let p=a-r,m=me(i),b=chunkTZJUO3NW_js.g(h.slice(0,p),m);return n+b.width}let x=me(i),d=chunkTZJUO3NW_js.g(h,x);n+=d.width,r+=h.length;}}}return n}function W(e,t){let a=0;for(let o=0;o<t&&o<e.lines.length;o++)a+=e.lines[o].lineHeight;return a}function Xe(e,t,a,o,n){if(o===n)return [];let r=Math.min(o,n),s=Math.max(o,n),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 g=ee(t,c.blockId);if(g===-1)continue;let h=t[g],x=a[g];if(!h||h.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=h,p=x,m=c,b=pe(d,p,r,s);for(let{line:k,index:F}of b){if(F<m.fromLine||F>=m.toLine)continue;let P=G(d,k);if(P.pmStart===void 0||P.pmEnd===void 0)continue;let M=Math.max(P.pmStart,r),H=Math.min(P.pmEnd,s);if(M>=H)continue;let R=v(d,k,M),y=v(d,k,H),B=d.attrs?.indent,I=B?.left??0,C=B?.right??0,S=Math.max(0,c.width-I-C),_=z(d,k,R),L=z(d,k,y),T=d.attrs?.alignment??"left",w=0;T==="center"?w=Math.max(0,(S-k.width)/2):T==="right"&&(w=Math.max(0,S-k.width));let E=W(p,F)-W(p,m.fromLine),A=c.x+I+w+Math.min(_,L),V=Math.max(1,Math.abs(L-_)),Y=c.y+E;i.push({x:A,y:Y+u,width:V,height:k.lineHeight,pageIndex:l});}}if(c.kind==="table"){let g=ee(t,c.blockId);if(g===-1)continue;let h=t[g],x=a[g];if(!h||h.kind!=="table"||!x||x.kind!=="table")continue;let d=h,p=x,m=c,b=m.headerRowCount??0,F=b>0&&m.continuesFromPrev?chunk44RUAQA2_js.r(p,b):0;for(let P=m.fromRow;P<m.toRow&&P<d.rows.length;P++){let M=d.rows[P],H=p.rows[P];if(!M||!H)continue;let R=0;for(let y=0;y<M.cells.length;y++){let B=M.cells[y],I=H.cells[y];if(!(!B||!I)){for(let C=0;C<B.blocks.length;C++){let S=B.blocks[C],_=I.blocks[C];if(!S||S.kind!=="paragraph"||!_||_.kind!=="paragraph")continue;let L=S,T=_,w=pe(L,T,r,s),E=0;for(let{line:A,index:V}of w){let Y=G(L,A);if(Y.pmStart===void 0||Y.pmEnd===void 0)continue;let te=Math.max(Y.pmStart,r),ne=Math.min(Y.pmEnd,s);if(te>=ne)continue;let Me=v(L,A,te),ye=v(L,A,ne),re=z(L,A,Me,I.width),oe=z(L,A,ye,I.width),He=W(T,V);i.push({x:m.x+R+Math.min(re,oe),y:m.y+F+E+He+u,width:Math.max(1,Math.abs(oe-re)),height:A.lineHeight,pageIndex:l});}E+=T.totalHeight;}R+=I.width;}}F+=H.height;}}if(c.kind==="image"){let g=c.pmStart??0;(c.pmEnd??g+1)>r&&g<s&&i.push({x:c.x,y:c.y+u,width:c.width,height:c.height,pageIndex:l});}}}return i}function Ye(e,t,a,o){for(let n=0;n<e.pages.length;n++){let r=e.pages[n],s=D(e,n);for(let i of r.fragments){if(i.kind==="paragraph"){let l=ee(t,i.blockId);if(l===-1)continue;let f=t[l],u=a[l];if(!f||f.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let c=f,g=u,h=i,x=c.pmStart??0,d=c.pmEnd??x;if(o<x||o>d)continue;for(let p=h.fromLine;p<h.toLine;p++){let m=g.lines[p];if(!m)continue;let b=G(c,m);if(!(b.pmStart===void 0||b.pmEnd===void 0)&&o>=b.pmStart&&o<=b.pmEnd){let k=v(c,m,o),F=c.attrs?.indent,P=F?.left??0,M=F?.right??0,H=Math.max(0,i.width-P-M),R=z(c,m,k),y=c.attrs?.alignment??"left",B=0;y==="center"?B=Math.max(0,(H-m.width)/2):y==="right"&&(B=Math.max(0,H-m.width));let I=W(g,p)-W(g,h.fromLine);return {x:i.x+P+B+R,y:i.y+I+s,height:m.lineHeight,pageIndex:n}}}}if(i.kind==="image"){let l=i.pmStart??0,f=i.pmEnd??l+1;if(o>=l&&o<=f){let u=o===l?0:i.width;return {x:i.x+u,y:i.y+s,height:i.height,pageIndex:n}}}}}return null}function ve(e){return e.length<=1?false:new Set(e.map(a=>a.pageIndex)).size>1}function ze(e){let t=new Map;for(let a of e){let o=t.get(a.pageIndex)??[];o.push(a),t.set(a.pageIndex,o);}return t}function We(e){if(e.kind!=="paragraph")return false;let t=e.attrs;return t?!!(t.borders?.top||t.borders?.bottom||t.spacingExplicit?.before||t.spacingExplicit?.after):false}function xe(e){return be(e)}function be(e){let t=new Set;for(let a=1;a<e.length;a++){let o=e[a-1],n=e[a];o.kind==="table"&&n.kind==="paragraph"&&(n.runs.length>0||We(n)||t.add(a));}return e.map((a,o)=>{if(a.kind==="table")return Ge(a);if(a.kind!=="paragraph")return a;let n=t.has(o),r=a.attrs?.spacingExplicit,s=a.attrs?.spacing?.before!=null,i=a.attrs?.spacing?.after!=null,l=s&&!r?.before,f=i&&!r?.after,u=l||f;if(!u&&!n)return a;let c=a.attrs;return u&&c?.spacing&&(c={...c,spacing:{...c.spacing,before:r?.before?c.spacing.before:void 0,after:r?.after?c.spacing.after:void 0}}),n&&(c={...c??{},suppressEmptyParagraphHeight:true}),{...a,attrs:c}})}function Ge(e){let t=false,a=e.rows.map(o=>{let n=false,r=o.cells.map(s=>{let i=be(s.blocks);return i.some((f,u)=>f!==s.blocks[u])?(n=true,{...s,blocks:i}):s});return n?(t=true,{...o,cells:r}):o});return t?{...e,rows:a}:e}function Ue(e){return e?.align??e?.alignment}function ke(e,t,a,o){let n=o.section==="header"?o.margins.header??48:o.pageSize.h-(o.margins.footer??48)-a,r=e.position?.vertical;if(!r)return t;let s=Ue(r),i=r.posOffset!==void 0?chunk4Q2IP5FW_js.e(r.posOffset):void 0;if(r.relativeTo==="page"){if(i!==void 0)return i-n;if(s==="top")return -n;if(s==="bottom")return o.pageSize.h-e.height-n;if(s==="center")return (o.pageSize.h-e.height)/2-n}if(r.relativeTo==="margin"){let l=o.margins.top,f=o.pageSize.h-o.margins.top-o.margins.bottom;if(i!==void 0)return l+i-n;if(s==="top")return l-n;if(s==="bottom")return l+f-e.height-n;if(s==="center")return l+(f-e.height)/2-n}return i!==void 0?t+i:t}function Te(e,t,a,o){let n=0,r=a,s=0;for(let i=0;i<e.length;i++){let l=e[i],f=t[i];if(!(!l||!f)){if(l.kind==="paragraph"&&f.kind==="paragraph"){let u=s,c=u+f.totalHeight;n=Math.min(n,u),r=Math.max(r,c);for(let g of l.runs){if(g.kind!=="image"||!g.position)continue;let h=ke(g,u,a,o);n=Math.min(n,h),r=Math.max(r,h+g.height);}s=c;}else if(l.kind==="table"&&f.kind==="table"){let u=s+f.totalHeight;n=Math.min(n,s),r=Math.max(r,u),s=u;}else if(l.kind==="image"&&f.kind==="image"){let u=s+f.height;n=Math.min(n,s),r=Math.max(r,u),s=u;}else if(l.kind==="textBox"&&f.kind==="textBox"){let u=s+f.height;n=Math.min(n,s),r=Math.max(r,u),s=u;}}}return {visualTop:n,visualBottom:r}}function Ne(e,t,a,o){if(!e||!e.content||e.content.length===0)return;let n=chunkHVZMO3BU_js.b(e.content,{styles:o.styles??void 0,theme:o.theme??null}),r=chunkBD4CYYFB_js.d(n,{theme:o.theme??void 0});if(r.length===0)return;let s=xe(r),i=o.measureBlocks(s,t),l=i.reduce((c,g)=>g.kind==="paragraph"||g.kind==="table"?c+g.totalHeight:g.kind==="image"||g.kind==="textBox"?c+g.height:c,0),{visualTop:f,visualBottom:u}=Te(r,i,l,a);return {blocks:s,measures:i,height:l,visualTop:f,visualBottom:u}}var Pe=7,Fe=0;function we(e,t){if(e.kind!=="paragraph"||t.kind!=="paragraph")return "totalHeight"in t?t.totalHeight:"height"in t?t.height:0;let a=e.runs.filter(i=>i.kind!=="text"||i.text.length>0);if(!(t.lines.length===1&&a.length>0&&a.every(i=>i.kind==="image")))return t.totalHeight;let n=a.reduce((i,l)=>l.kind==="image"?Math.max(i,l.height):i,0),r=e.attrs?.spacing?.before??0,s=e.attrs?.spacing?.after??0;return r+n+s}function Ve(e){let t=e?.borders?.top?.width??0,a=e?.borders?.bottom?.width??0;return t+a}function je(e,t,a){let o=e.columnWidths??[],n=N(e.width,e.widthType,t),r=q(e),s=n??t;if(e.rows.length>0&&(o=J(o,r,s)),o.length>0&&n){let c=o.reduce((g,h)=>g+h,0);if(c>0&&Math.abs(c-n)>1){let g=n/c;o=o.map(h=>h*g);}}let i=new Map;for(let c=0;c<e.rows.length;c++){let g=e.rows[c];if(!g)continue;let h=0,x=i.get(c)??new Set;for(;x.has(h);)h++;for(let d of g.cells){let p=d.colSpan??1,m=d.rowSpan??1;if(m>1)for(let b=c+1;b<c+m;b++){i.has(b)||i.set(b,new Set);let k=i.get(b);for(let F=0;F<p;F++)k.add(h+F);}for(h+=p;x.has(h);)h++;}}let l=e.rows.map((c,g)=>{let h=0,x=i.get(g)??new Set;for(;x.has(h);)h++;return {cells:c.cells.map(d=>{let p=d.colSpan??1,m=0;for(let P=0;P<p&&h+P<o.length;P++)m+=o[h+P]??0;for(m===0&&(m=(d.width&&d.width>0?d.width:N(d.widthValue,d.widthType,s))??100),h+=p;x.has(h);)h++;let b=d.padding?.left??Pe,k=d.padding?.right??Pe,F=Math.max(1,m-b-k);return {blocks:d.blocks.map(P=>a(P,F)),width:m,height:0,colSpan:d.colSpan,rowSpan:d.rowSpan}}),height:0}});for(let c=0;c<l.length;c++){let g=l[c],h=e.rows[c]?.cells,x=0,d=0;for(let k=0;k<g.cells.length;k++){let F=g.cells[k],P=h?.[k],M=0;for(let y=0;y<F.blocks.length;y++){let B=P?.blocks[y],I=F.blocks[y];!B||!I||(M+=we(B,I));}F.height=M;let H=P?.padding?.top??Fe,R=P?.padding?.bottom??Fe;F.height+=H+R,x=Math.max(x,F.height),d=Math.max(d,Ve(P));}let p=e.rows[c],m=p?.height,b=p?.heightRule;m&&b==="exact"?g.height=m:m?g.height=Math.max(x+d,m):g.height=x+d;}let f=l.reduce((c,g)=>c+g.height,0),u=o.reduce((c,g)=>c+g,0)||n||t;return {kind:"table",rows:l,columnWidths:o,totalWidth:u,totalHeight:f}}var qe=816,Je=1056,Ke=96,Qe=48;function O(e){return Math.round(e/1440*96)}function Ze(e){return {w:e?.pageWidth?O(e.pageWidth):816,h:e?.pageHeight?O(e.pageHeight):1056}}function $e(e){return {top:e?.marginTop?O(e.marginTop):96,right:e?.marginRight?O(e.marginRight):96,bottom:e?.marginBottom?O(e.marginBottom):96,left:e?.marginLeft?O(e.marginLeft):96,header:e?.headerDistance?O(e.headerDistance):48,footer:e?.footerDistance?O(e.footerDistance):48}}function et(e,t){let a={header:null,footer:null,firstHeader:null,firstFooter:null};if(!e?.package)return a;let o=e.package.headers,n=e.package.footers,r=null,s=null,i=null,l=null;if(o&&t?.headerReferences){let f=t.headerReferences.find(c=>c.type==="default");f?.rId&&(r=o.get(f.rId)??null);let u=t.headerReferences.find(c=>c.type==="first");u?.rId&&(i=o.get(u.rId)??null);}if(n&&t?.footerReferences){let f=t.footerReferences.find(c=>c.type==="default");f?.rId&&(s=n.get(f.rId)??null);let u=t.footerReferences.find(c=>c.type==="first");u?.rId&&(l=n.get(u.rId)??null);}return t?.titlePg||(!r&&i&&(r=i),!s&&l&&(s=l)),{header:r,footer:s,firstHeader:i,firstFooter:l}}exports.A=we;exports.B=je;exports.C=qe;exports.D=Je;exports.E=Ke;exports.F=Qe;exports.G=Ze;exports.H=$e;exports.I=et;exports.a=N;exports.b=q;exports.c=J;exports.d=K;exports.e=D;exports.f=Ie;exports.g=ce;exports.h=Re;exports.i=ue;exports.j=Se;exports.k=Le;exports.l=Ee;exports.m=Ce;exports.n=$;exports.o=he;exports.p=De;exports.q=de;exports.r=Oe;exports.s=Xe;exports.t=Ye;exports.u=ve;exports.v=ze;exports.w=xe;exports.x=ke;exports.y=Te;exports.z=Ne;
@@ -0,0 +1 @@
1
+ import {c,d,e}from'./chunk-LBKMYD3M.mjs';import {f}from'./chunk-VW22RZ6C.mjs';function k(t){let e=new Map,n=new Map;return t.descendants(i=>{let o=i.marks.find(r=>r.type.name==="insertion"),a=i.marks.find(r=>r.type.name==="deletion");if(o){let r=Number(o.attrs.revisionId);Number.isFinite(r)&&e.set(r,(e.get(r)??0)+1);}if(a){let r=Number(a.attrs.revisionId);Number.isFinite(r)&&n.set(r,(n.get(r)??0)+1);}}),{insertionById:e,deletionById:n}}function N(t){return t.attrs.href||""}function E(t){let e=t.filter(n=>n.type.name!=="hyperlink");return e.length===0?"":e.map(n=>`${n.type.name}:${JSON.stringify(n.attrs)}`).sort().join("|")}function T(t){let e={};for(let n of t)switch(n.type.name){case "bold":e.bold=true,e.boldCs=true;break;case "italic":e.italic=true,e.italicCs=true;break;case "underline":{let i=n.attrs;e.underline={style:i.style||"single",color:i.color};break}case "strike":n.attrs.double?e.doubleStrike=true:e.strike=true;break;case "textColor":{let i=n.attrs;e.color={rgb:i.rgb,themeColor:i.themeColor,themeTint:i.themeTint,themeShade:i.themeShade};break}case "highlight":e.highlight=n.attrs.color;break;case "fontSize":e.fontSize=n.attrs.size,e.fontSizeCs=n.attrs.size;break;case "fontFamily":{let i=n.attrs;e.fontFamily={ascii:i.ascii,hAnsi:i.hAnsi,eastAsia:i.eastAsia||void 0,cs:i.cs||i.ascii||void 0,asciiTheme:i.asciiTheme,hAnsiTheme:i.hAnsiTheme||void 0,eastAsiaTheme:i.eastAsiaTheme||void 0,csTheme:i.csTheme||void 0};break}case "superscript":e.vertAlign="superscript";break;case "subscript":e.vertAlign="subscript";break;case "allCaps":e.allCaps=true;break;case "smallCaps":e.smallCaps=true;break;case "characterSpacing":{n.attrs.spacing!=null&&(e.spacing=n.attrs.spacing),n.attrs.position!=null&&(e.position=n.attrs.position),n.attrs.scale!=null&&(e.scale=n.attrs.scale),n.attrs.kerning!=null&&(e.kerning=n.attrs.kerning);break}case "emboss":e.emboss=true;break;case "imprint":e.imprint=true;break;case "textShadow":e.shadow=true;break;case "emphasisMark":e.emphasisMark=n.attrs.type||"dot";break;case "textOutline":e.outline=true;break;case "hidden":e.hidden=true;break;case "rtl":e.rtl=true;break;case "textEffect":e.effect=n.attrs.effect||"blinkBackground";break}return e}function L(t){let e=t.attrs.href;return e?.startsWith("#")?{type:"hyperlink",anchor:e.substring(1),tooltip:t.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:e,tooltip:t.attrs.tooltip||void 0,rId:t.attrs.rId||void 0,children:[]}}function x(t,e){let n=e.marks.filter(i=>i.type.name!=="hyperlink");e.isText&&e.text?t.children.push(C(e.text,n)):e.type.name==="tab"?t.children.push(w()):e.type.name==="hardBreak"&&t.children.push(P());}function C(t,e){let n=T(e),i={type:"text",text:t};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[i]}}function H(t,e){let n=t.content[t.content.length-1];n&&n.type==="text"?n.text+=e:t.content.push({type:"text",text:e});}function P(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function w(){return {type:"run",content:[{type:"tab"}]}}function O(t,e){let n=t.attrs,i=e&&e.length>0?T(e):void 0,o=n.displayText||"";if(!o)switch(n.fieldType){case "PAGE":o="1";break;case "NUMPAGES":o="1";break;default:o=" ";break}let a={type:"run",content:[{type:"text",text:o}],...i&&Object.keys(i).length>0?{formatting:i}:{}};return n.fieldKind==="complex"?{type:"complexField",instruction:n.instruction,fieldType:n.fieldType,fieldCode:[],fieldResult:[a],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}:{type:"simpleField",instruction:n.instruction,fieldType:n.fieldType,content:[a],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}}function W(t){let e=t.attrs;return {type:"mathEquation",display:e.display||"inline",ommlXml:e.ommlXml,plainText:e.plainText||void 0}}function D(t){let e=t.attrs,i={type:e.wrapType||"inline"};e.distTop!==void 0&&(i.distT=f(e.distTop)),e.distBottom!==void 0&&(i.distB=f(e.distBottom)),e.distLeft!==void 0&&(i.distL=f(e.distLeft)),e.distRight!==void 0&&(i.distR=f(e.distRight)),e.wrapText&&(i.wrapText=e.wrapText);let o={type:"image",rId:e.rId||"",src:e.src,alt:e.alt||void 0,title:e.title||void 0,size:{width:f(e.width||0),height:f(e.height||0)},wrap:i};if(e.transform){let r=e.transform,l={},s=r.match(/rotate\(([-\d.]+)deg\)/);s&&(l.rotation=parseFloat(s[1])),r.includes("scaleX(-1)")&&(l.flipH=true),r.includes("scaleY(-1)")&&(l.flipV=true),(l.rotation||l.flipH||l.flipV)&&(o.transform=l);}if(e.position?.horizontal&&e.position?.vertical){let r=e.position;o.position={horizontal:{relativeTo:r.horizontal.relativeTo||"column",alignment:r.horizontal.align,posOffset:r.horizontal.posOffset},vertical:{relativeTo:r.vertical.relativeTo||"paragraph",alignment:r.vertical.align,posOffset:r.vertical.posOffset}};}if(e.borderWidth&&e.borderWidth>0){let r={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};o.outline={width:f(e.borderWidth),color:e.borderColor?{rgb:e.borderColor.replace("#","")}:void 0,style:e.borderStyle&&r[e.borderStyle]||"solid"};}if(e.hlinkHref&&(o.hlinkHref=e.hlinkHref),e.cropTop!==void 0||e.cropRight!==void 0||e.cropBottom!==void 0||e.cropLeft!==void 0){let r={};e.cropTop!==void 0&&e.cropTop!==null&&(r.top=e.cropTop),e.cropRight!==void 0&&e.cropRight!==null&&(r.right=e.cropRight),e.cropBottom!==void 0&&e.cropBottom!==null&&(r.bottom=e.cropBottom),e.cropLeft!==void 0&&e.cropLeft!==null&&(r.left=e.cropLeft),Object.keys(r).length>0&&(o.crop=r);}if(e.opacity!==void 0&&e.opacity!==null&&e.opacity<1&&(o.opacity=e.opacity),e.layoutInCell!==void 0&&e.layoutInCell!==null&&(o.layoutInCell=e.layoutInCell),e.allowOverlap!==void 0&&e.allowOverlap!==null&&(o.allowOverlap=e.allowOverlap),e.effectExtentTop||e.effectExtentBottom||e.effectExtentLeft||e.effectExtentRight){let r={};e.effectExtentTop&&(r.top=f(e.effectExtentTop)),e.effectExtentBottom&&(r.bottom=f(e.effectExtentBottom)),e.effectExtentLeft&&(r.left=f(e.effectExtentLeft)),e.effectExtentRight&&(r.right=f(e.effectExtentRight)),Object.keys(r).length>0&&(o.padding=r);}return {type:"run",content:[{type:"drawing",image:o}]}}function j(t){let e=t.attrs,n={type:"shape",shapeType:e.shapeType||"rect",id:e.shapeId||void 0,size:{width:e.width?f(e.width):0,height:e.height?f(e.height):0}};if(e.fillType==="gradient"&&e.gradientStops)try{let o=JSON.parse(e.gradientStops);n.fill={type:"gradient",gradient:{type:e.gradientType||"linear",angle:e.gradientAngle||void 0,stops:o.map(a=>({position:a.position,color:{rgb:a.color.replace("#","")}}))}};}catch{n.fill={type:"solid",color:{rgb:(e.fillColor||"000000").replace("#","")}};}else e.fillColor?n.fill={type:e.fillType||"solid",color:{rgb:e.fillColor.replace("#","")}}:e.fillType==="none"&&(n.fill={type:"none"});if(e.outlineWidth&&e.outlineWidth>0){let o={solid:"solid",dotted:"dot",dashed:"dash"};n.outline={width:f(e.outlineWidth),color:e.outlineColor?{rgb:e.outlineColor.replace("#","")}:void 0,style:e.outlineStyle&&o[e.outlineStyle]||"solid"};}return {type:"run",content:[{type:"shape",shape:n}]}}function b(t,e){let n=t.attrs,i=J(z(t,e),t),o=n.bookmarks;if(o&&o.length>0){let r=o.map(s=>({type:"bookmarkStart",id:s.id,name:s.name})),l=o.map(s=>({type:"bookmarkEnd",id:s.id}));i=[...r,...i,...l];}let a={type:"paragraph",paraId:n.paraId||void 0,textId:n.textId||void 0,formatting:q(n),content:i};return n.renderedPageBreakBefore&&(a.renderedPageBreakBefore=true),n._sectionProperties?a.sectionProperties=n._sectionProperties:n.sectionBreakType&&(a.sectionProperties={sectionStart:n.sectionBreakType}),a}function J(t,e){let n=new Set;if(e.forEach(r=>{for(let l of r.marks)l.type.name==="comment"&&n.add(l.attrs.commentId);}),n.size===0)return t;let i=[],o=new Set,a=0;e.forEach(r=>{let l=new Set;for(let s of r.marks)s.type.name==="comment"&&l.add(s.attrs.commentId);for(let s of [...o])l.has(s)||(i.push({type:"commentRangeEnd",id:s}),o.delete(s));for(let s of l)o.has(s)||(i.push({type:"commentRangeStart",id:s}),o.add(s));a<t.length&&i.push(t[a]),a++;});for(let r of o)i.push({type:"commentRangeEnd",id:r});return i}function q(t){if(t._originalFormatting){let n=t._originalFormatting,i={...n};return t.alignment!==(n.alignment||void 0)&&(i.alignment=t.alignment||void 0),t.numPr!==n.numPr&&JSON.stringify(t.numPr)!==JSON.stringify(n.numPr)&&(i.numPr=t.numPr||void 0),t.styleId!==(n.styleId||void 0)&&(i.styleId=t.styleId||void 0),t.pageBreakBefore!==(n.pageBreakBefore||void 0)&&(i.pageBreakBefore=t.pageBreakBefore||void 0),t.bidi!==(n.bidi||void 0)&&(i.bidi=t.bidi||void 0),i}if(t.alignment||t.spaceBefore||t.spaceAfter||t.lineSpacing||t.indentLeft||t.indentRight||t.indentFirstLine||t.numPr||t.styleId||t.borders||t.shading||t.tabs||t.outlineLevel!=null||t.contextualSpacing||t.bidi)return {alignment:t.alignment||void 0,spaceBefore:t.spaceBefore||void 0,spaceAfter:t.spaceAfter||void 0,lineSpacing:t.lineSpacing||void 0,lineSpacingRule:t.lineSpacingRule||void 0,indentLeft:t.indentLeft||void 0,indentRight:t.indentRight||void 0,indentFirstLine:t.indentFirstLine||void 0,hangingIndent:t.hangingIndent||void 0,numPr:t.numPr||void 0,styleId:t.styleId||void 0,borders:t.borders||void 0,shading:t.shading||void 0,tabs:t.tabs||void 0,outlineLevel:t.outlineLevel??void 0,contextualSpacing:t.contextualSpacing||void 0,bidi:t.bidi||void 0}}function z(t,e){let n=[],i=e??k(t),o=null,a=null,r=null;return t.forEach(l=>{let s=l.marks.find(p=>p.type.name==="footnoteRef");if(s){o&&(n.push(o),o=null,a=null),r&&(n.push(r),r=null);let u={type:s.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(s.attrs.id,10)||0};n.push({type:"run",content:[u]});return}let d=l.marks.find(p=>p.type.name==="insertion"),m=l.marks.find(p=>p.type.name==="deletion");if(d||m){o&&(n.push(o),o=null,a=null),r&&(n.push(r),r=null);let p=d||m,u=l.marks.filter(I=>I.type.name!=="insertion"&&I.type.name!=="deletion"),h=T(u),y={type:"run",content:l.isText&&l.text?[{type:"text",text:l.text}]:[],...Object.keys(h).length>0?{formatting:h}:{}},g={id:p.attrs.revisionId,author:p.attrs.author||"Unknown",date:p.attrs.date||void 0},R=g.id,K=(i.insertionById.get(R)??0)>0,V=(i.deletionById.get(R)??0)>0,F=K&&V;d?F?n.push({type:"moveTo",info:g,content:[y]}):n.push({type:"insertion",info:g,content:[y]}):F?n.push({type:"moveFrom",info:g,content:[y]}):n.push({type:"deletion",info:g,content:[y]});return}let f=l.marks.find(p=>p.type.name==="hyperlink");if(f){let p=N(f),u=r?.href||(r?.anchor?`#${r.anchor}`:"");r&&u===p?x(r,l):(o&&(n.push(o),o=null,a=null),r&&n.push(r),r=L(f),x(r,l));return}if(r&&(n.push(r),r=null),l.isText){let p=E(l.marks);o&&a===p?H(o,l.text||""):(o&&n.push(o),o=C(l.text||"",l.marks),a=p);}else l.type.name==="hardBreak"?(o&&(n.push(o),o=null,a=null),n.push(P())):l.type.name==="image"?(o&&(n.push(o),o=null,a=null),n.push(D(l))):l.type.name==="shape"?(o&&(n.push(o),o=null,a=null),n.push(j(l))):l.type.name==="tab"?(o&&(n.push(o),o=null,a=null),n.push(w())):l.type.name==="field"?(o&&(n.push(o),o=null,a=null),n.push(O(l,l.marks))):l.type.name==="sdt"?(o&&(n.push(o),o=null,a=null),n.push(U(l))):l.type.name==="math"&&(o&&(n.push(o),o=null,a=null),n.push(W(l)));}),o&&n.push(o),r&&n.push(r),n}function U(t){let e=t.attrs,n={sdtType:e.sdtType??"richText",alias:e.alias??void 0,tag:e.tag??void 0,lock:e.lock??void 0,placeholder:e.placeholder??void 0,showingPlaceholder:e.showingPlaceholder??void 0,dateFormat:e.dateFormat??void 0,listItems:e.listItems?JSON.parse(e.listItems):void 0,checked:e.checked!=null?e.checked:void 0},o=z(t).filter(a=>a.type==="run"||a.type==="hyperlink"||a.type==="simpleField"||a.type==="complexField"||a.type==="inlineSdt"||a.type==="mathEquation");return {type:"inlineSdt",properties:n,content:o}}function X(t){for(let e of t)for(let n of e.cells){let i=n.formatting?.borders;if(i){let o=i.top||i.left||i.right||i.bottom||i.insideH||i.insideV;return o?{top:i.top??o,bottom:i.bottom??o,left:i.left??o,right:i.right??o,insideH:i.insideH??i.bottom??o,insideV:i.insideV??i.right??o}:void 0}}}function G(t,e){let n=[],i=[],o=0;for(let a=0;a<t.childCount;a++){let r=t.child(a),l=0;r.forEach(s=>{if(s.type.name!=="tableCell"&&s.type.name!=="tableHeader")return;for(;n[a]?.[l];)l++;let d=s.attrs.rowspan||1,m=s.attrs.colspan||1;i.push({row:a,col:l,rowspan:d,colspan:m,cell:Z(s,e)});for(let f=a;f<a+d;f++){let p=n[f]??[];n[f]=p;for(let u=l;u<l+m;u++)p[u]=true;}l+=m,o=Math.max(o,l);});}return {anchors:i,totalCols:o}}function M(t,e){let n=t.attrs,{anchors:i,totalCols:o}=G(t,e),a=new Map,r=new Map;for(let d of i){a.set(`${d.row}-${d.col}`,d);for(let m=d.row;m<d.row+d.rowspan;m++)for(let f=d.col;f<d.col+d.colspan;f++)r.set(`${m}-${f}`,d);}let l=[];for(let d=0;d<t.childCount;d++){let m=t.child(d),f=[];for(let p=0;p<o;){let u=a.get(`${d}-${p}`);if(u){let g={...u.cell.formatting??{}};u.colspan>1?g.gridSpan=u.colspan:delete g.gridSpan,u.rowspan>1?g.vMerge="restart":delete g.vMerge,f.push({...u.cell,formatting:Object.keys(g).length?g:void 0}),p+=u.colspan;continue}let h=r.get(`${d}-${p}`);if(!h){p++;continue}let y={...h.cell.formatting??{}};h.colspan>1?y.gridSpan=h.colspan:delete y.gridSpan,y.vMerge="continue",f.push({...h.cell,content:[],formatting:y}),p+=h.colspan;}l.push({type:"tableRow",formatting:Q(m.attrs),cells:f});}let s=Y(n)||void 0;if(!s?.borders){let d=X(l);if(d)if(s)s.borders=d;else return {type:"table",columnWidths:n.columnWidths||void 0,formatting:{borders:d},rows:l}}return {type:"table",columnWidths:n.columnWidths||void 0,formatting:s,rows:l}}function Y(t){if(t._originalFormatting){let o=t._originalFormatting,a={...o};t.styleId!==(o.styleId||void 0)&&(a.styleId=t.styleId||void 0),t.justification!==(o.justification||void 0)&&(a.justification=t.justification||void 0),t.floating!==(o.floating||void 0)&&(a.floating=t.floating||void 0),t.look!==(o.look||void 0)&&(a.look=t.look||void 0);let r=o.width?.value,l=o.width?.type;return (t.width!==r||t.widthType!==l)&&(t.width!=null||t.widthType?a.width={value:t.width??0,type:t.widthType||"dxa"}:a.width=void 0),t.cellMargins&&(a.cellMargins={top:t.cellMargins.top!=null?{value:t.cellMargins.top,type:"dxa"}:void 0,bottom:t.cellMargins.bottom!=null?{value:t.cellMargins.bottom,type:"dxa"}:void 0,left:t.cellMargins.left!=null?{value:t.cellMargins.left,type:"dxa"}:void 0,right:t.cellMargins.right!=null?{value:t.cellMargins.right,type:"dxa"}:void 0}),a}if(!(t.styleId||t.width!=null||t.widthType||t.justification||t.floating||t.cellMargins||t.look))return;let n=t.cellMargins?{top:t.cellMargins.top!=null?{value:t.cellMargins.top,type:"dxa"}:void 0,bottom:t.cellMargins.bottom!=null?{value:t.cellMargins.bottom,type:"dxa"}:void 0,left:t.cellMargins.left!=null?{value:t.cellMargins.left,type:"dxa"}:void 0,right:t.cellMargins.right!=null?{value:t.cellMargins.right,type:"dxa"}:void 0}:void 0,i;return (t.width!=null||t.widthType)&&(i={value:t.width??0,type:t.widthType||"dxa"}),{styleId:t.styleId||void 0,width:i,justification:t.justification||void 0,floating:t.floating||void 0,cellMargins:n,look:t.look||void 0}}function Q(t){if(t._originalFormatting){let n=t._originalFormatting,i={...n};return t.height!==(n.height?.value||void 0)&&(i.height=t.height?{value:t.height,type:"dxa"}:void 0),t.heightRule!==(n.heightRule||void 0)&&(i.heightRule=t.heightRule||void 0),t.isHeader!==(n.header||void 0)&&(i.header=t.isHeader||void 0),i}if(t.height||t.isHeader)return {height:t.height?{value:t.height,type:"dxa"}:void 0,heightRule:t.heightRule||void 0,header:t.isHeader||void 0}}function Z(t,e){let n=t.attrs,i=[];return t.forEach(o=>{o.type.name==="paragraph"?i.push(b(o,e)):o.type.name==="table"&&i.push(M(o,e));}),{type:"tableCell",formatting:ee(n),content:i}}function ee(t){if(t._originalFormatting){let i=t._originalFormatting,o={...i};if(t.colspan>1&&(o.gridSpan=t.colspan),t.width!=null&&(o.width={value:t.width,type:t.widthType||"dxa"}),t.verticalAlign!==(i.verticalAlign||void 0)&&(o.verticalAlign=t.verticalAlign||void 0),t.backgroundColor?t._originalResolvedFill===t.backgroundColor&&i.shading?o.shading=i.shading:o.shading={fill:{rgb:t.backgroundColor}}:i.shading&&(o.shading=void 0),t.borders&&(o.borders=t.borders),t.margins){let a=t.margins,r={};a.top!=null&&(r.top={value:a.top,type:"dxa"}),a.bottom!=null&&(r.bottom={value:a.bottom,type:"dxa"}),a.left!=null&&(r.left={value:a.left,type:"dxa"}),a.right!=null&&(r.right={value:a.right,type:"dxa"}),o.margins=r;}return t.textDirection!==(i.textDirection||void 0)&&(o.textDirection=t.textDirection||void 0),o}if(!(t.colspan>1||t.rowspan>1||t.width!=null||t.verticalAlign||t.backgroundColor||t.borders||t.margins||t.textDirection))return;let n;if(t.margins){let i=t.margins;n={},i.top!=null&&(n.top={value:i.top,type:"dxa"}),i.bottom!=null&&(n.bottom={value:i.bottom,type:"dxa"}),i.left!=null&&(n.left={value:i.left,type:"dxa"}),i.right!=null&&(n.right={value:i.right,type:"dxa"});}return {gridSpan:t.colspan>1?t.colspan:void 0,width:t.width!=null?{value:t.width,type:t.widthType||"dxa"}:void 0,verticalAlign:t.verticalAlign||void 0,textDirection:t.textDirection||void 0,shading:t.backgroundColor?{fill:{rgb:t.backgroundColor}}:void 0,borders:t.borders,margins:n}}function v(t){let e$1=t.attrs,n=[];t.forEach(l=>{l.type.name==="paragraph"&&n.push(b(l));});let i={type:"shape",shapeType:"rect",id:e$1.textBoxId||void 0,size:{width:e$1.width?f(e$1.width):0,height:e$1.height?f(e$1.height):0},textBody:{content:n.length>0?n:[{type:"paragraph",content:[]}],margins:{top:e$1.marginTop!=null?f(e$1.marginTop):void 0,bottom:e$1.marginBottom!=null?f(e$1.marginBottom):void 0,left:e$1.marginLeft!=null?f(e$1.marginLeft):void 0,right:e$1.marginRight!=null?f(e$1.marginRight):void 0}}},o=d(e$1);o&&(i.position=o);let a=e(e$1);if(a&&(i.wrap=a),e$1.fillColor&&(i.fill={type:"solid",color:{rgb:e$1.fillColor.replace("#","")}}),e$1.outlineWidth&&e$1.outlineWidth>0){let l={solid:"solid",dotted:"dot",dashed:"dash"};i.outline={width:f(e$1.outlineWidth),color:e$1.outlineColor?{rgb:e$1.outlineColor.replace("#","")}:void 0,style:e$1.outlineStyle&&l[e$1.outlineStyle]||"solid"};}return {type:"run",content:[{type:"shape",shape:i}]}}function _(t){return {type:"paragraph",content:[v(t)]}}function te(t,e){let i={content:$(t),finalSectionProperties:e?.package.document.finalSectionProperties,sections:e?.package.document.sections,comments:e?.package.document.comments};return e?{...e,package:{...e.package,document:i}}:{package:{document:i}}}function $(t){let e=[],n=k(t),i=[],o=()=>{for(let a of i)e.push({type:"paragraph",content:[a]});i=[];};return t.forEach(a=>{if(a.type.name==="paragraph"){let r=b(a,n);i.length>0&&(r.content=[...i,...r.content],i=[]),e.push(r);}else if(a.type.name==="table")o(),e.push(M(a,n));else if(a.type.name==="textBox"){let r=a.attrs;c(r)?i.push(v(a)):(o(),e.push(_(a)));}else a.type.name==="pageBreak"&&(o(),e.push(ne()));}),o(),e}function ne(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function xe(t,e){return te(e,t)}function Ce(t){return $(t)}export{te as a,xe as b,Ce as c};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkBD4CYYFB_js=require('./chunk-BD4CYYFB.js'),chunk44RUAQA2_js=require('./chunk-44RUAQA2.js'),chunkDROCYKAR_js=require('./chunk-DROCYKAR.js'),chunkTZJUO3NW_js=require('./chunk-TZJUO3NW.js'),chunkDV6IEOP5_js=require('./chunk-DV6IEOP5.js'),chunkHVZMO3BU_js=require('./chunk-HVZMO3BU.js'),chunkJFZIXFRC_js=require('./chunk-JFZIXFRC.js'),chunkBHBOAP6Z_js=require('./chunk-BHBOAP6Z.js'),chunkN3Y5BUKV_js=require('./chunk-N3Y5BUKV.js'),chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');var V={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image",line:"layout-line",run:"layout-run"};function dt(e){return e.kind==="paragraph"}function pt(e){return e.kind==="table"}function ct(e){return e.kind==="image"}function oe(e){e.style.position="absolute",e.style.overflow="hidden";}function ft(e,t,o){let n=o.createElement("div");return n.className=`${V.fragment} ${V.paragraph}`,oe(n),n.dataset.blockId=String(e.blockId),n.dataset.fromLine=String(e.fromLine),n.dataset.toLine=String(e.toLine),e.pmStart!==void 0&&(n.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(n.dataset.pmEnd=String(e.pmEnd)),e.continuesFromPrev&&(n.dataset.continuesFromPrev="true"),e.continuesOnNext&&(n.dataset.continuesOnNext="true"),n}function gt(e,t,o){let n=o.createElement("div");return n.className=`${V.fragment} ${V.table}`,oe(n),n.dataset.blockId=String(e.blockId),n.dataset.fromRow=String(e.fromRow),n.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(n.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(n.dataset.pmEnd=String(e.pmEnd)),n}function mt(e,t,o){let n=o.createElement("div");return n.className=`${V.fragment} ${V.image}`,oe(n),n.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(n.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(n.dataset.pmEnd=String(e.pmEnd)),e.isAnchored&&(n.dataset.anchored="true"),e.zIndex!==void 0&&(n.style.zIndex=String(e.zIndex)),n}function we(e,t,o={}){let n=o.document??document;if(dt(e))return ft(e,t,n);if(pt(e))return gt(e,t,n);if(ct(e))return mt(e,t,n);let r=n.createElement("div");r.className=V.fragment,oe(r);let i=e;return i.blockId!==void 0&&(r.dataset.blockId=String(i.blockId)),i.kind&&(r.dataset.kind=i.kind),r}var E={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 A(e){return e.kind==="text"}function z(e){return e.kind==="tab"}function j(e){return e.kind==="image"}function W(e){return e.kind==="lineBreak"}function K(e){return e.kind==="field"}function Z(e){return !chunkJFZIXFRC_js.b(e.wrapType)&&e.wrapType!=="topAndBottom"}function Y(e){return e.wrapType==="behind"}function M(e){return chunkJFZIXFRC_js.a(e.wrapType)?true:e.displayMode==="float"}function ht(e){return chunkJFZIXFRC_js.b(e.wrapType)||e.wrapType==="topAndBottom"?false:chunkJFZIXFRC_js.c(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}function re(e){return e==="left"?"right":e==="right"?"left":"bothSides"}var Ke={image:"layout-image",imageAnchored:"layout-image-anchored"};function q(e){return !!(e.cropTop||e.cropRight||e.cropBottom||e.cropLeft||e.opacity!=null&&e.opacity<1)}function J(e,t){let o=t.cropTop??0,n=t.cropRight??0,r=t.cropBottom??0,i=t.cropLeft??0;(o||n||r||i)&&(e.style.clipPath=`inset(${o*100}% ${n*100}% ${r*100}% ${i*100}%)`),t.opacity!=null&&t.opacity<1&&(e.style.opacity=String(Math.max(0,t.opacity)));}function ie(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");a.className=Ke.image,e.isAnchored&&a.classList.add(Ke.imageAnchored),a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",e.zIndex!==void 0&&(a.style.zIndex=String(e.zIndex)),t.anchor?.behindDoc&&(a.style.zIndex="-1"),a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let l=i.createElement("img");if(l.src=t.src,l.alt=t.alt??"",l.style.width="100%",l.style.height="100%",l.style.objectFit="contain",l.style.display="block",t.transform&&(l.style.transform=t.transform),l.draggable=false,t.hlinkHref){let d=i.createElement("a");d.href=t.hlinkHref,d.target="_blank",d.rel="noopener noreferrer",d.style.display="block",d.style.width="100%",d.style.height="100%",d.appendChild(l),a.appendChild(d);}else a.appendChild(l);return a}function ut(e,t,o){if(t.fontFamily&&(e.style.fontFamily=chunkN3Y5BUKV_js.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",i=t.emphasisMark==="underDot"?"under right":"over right";e.style.textEmphasis=`${r}`,e.style.textEmphasisPosition=i,e.style.webkitTextEmphasis=r,e.style.webkitTextEmphasisPosition=i;}t.highlight&&(e.style.backgroundColor=t.highlight);let n=[];if(t.underline&&(n.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&&n.push("line-through"),t.commentIds&&t.commentIds.length>0){let r=t.commentIds.find(i=>!o||!o.has(i));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",n.includes("line-through")||n.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))),n.length>0&&(e.style.textDecorationLine=n.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 G(e,t,o){t!==void 0&&(e.dataset.pmStart=String(t)),o!==void 0&&(e.dataset.pmEnd=String(o));}function Q(e,t,o){let n=t.createElement("span");if(n.className=`${E.run} ${E.text}`,ut(n,e,o),G(n,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",n.style.color="#0563c1"),e.underline||(r.style.textDecoration="underline")),n.appendChild(r);}else n.textContent=e.text;return n}var yt=1e3;function ae(e,t,o,n){let r=t.createElement("span");r.className=`${E.run} ${E.tab}`,r.style.display="inline-block",r.style.width=`${o}px`,G(r,e.pmStart,e.pmEnd);let i=n&&n!=="none"?bt(n):null;if(i){r.style.position="relative",r.textContent="\u200B";let a=t.createElement("span");a.style.position="absolute",a.style.left="0",a.style.right="0",a.style.top="0",a.style.bottom="0",a.style.overflow="hidden",a.style.whiteSpace="nowrap",a.textContent=i.repeat(yt),r.appendChild(a);}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 Ue(e){if(!e)return 0;let t=e.match(/rotate\(([-\d.]+)deg\)/);return t?(parseFloat(t[1])%360+360)%360:0}function Xe(e,t,o){if(o===0||o===180)return {w:e,h:t};if(o===90||o===270)return {w:t,h:e};let n=o*Math.PI/180,r=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n));return {w:e*i+t*r,h:e*r+t*i}}function xt(e,t){let o=t.createElement("img");o.className=`${E.run} ${E.image}`,o.src=e.src,o.width=e.width,o.height=e.height,o.style.width=`${e.width}px`,o.style.height=`${e.height}px`,e.alt&&(o.alt=e.alt),e.transform&&(o.style.transform=e.transform,o.style.transformOrigin="center center"),q(e)&&J(o,e);let n=Ue(e.transform);if(n!==0){let r=Xe(e.width,e.height,n),i=t.createElement("span");return i.style.display="inline-block",i.style.position="relative",i.style.width=`${r.w}px`,i.style.height=`${r.h}px`,i.style.verticalAlign="middle",o.style.position="absolute",o.style.left=`${(r.w-e.width)/2}px`,o.style.top=`${(r.h-e.height)/2}px`,G(i,e.pmStart,e.pmEnd),i.appendChild(o),i}return o.style.display="inline-block",o.style.verticalAlign="middle",G(o,e.pmStart,e.pmEnd),o}function Ye(e,t){let o=t.createElement("div");o.className="layout-block-image",o.style.display="block",o.style.textAlign="center",o.style.marginTop=`${e.distTop??6}px`,o.style.marginBottom=`${e.distBottom??6}px`;let n=t.createElement("img");n.src=e.src,n.width=e.width,n.height=e.height,n.style.marginLeft="auto",n.style.marginRight="auto",e.alt&&(n.alt=e.alt),e.transform&&(n.style.transform=e.transform,n.style.transformOrigin="center center"),q(e)&&J(n,e);let r=Ue(e.transform);if(r!==0){let i=Xe(e.width,e.height,r);o.style.height=`${i.h}px`,o.style.position="relative",n.style.position="absolute",n.style.left="50%",n.style.top="50%",n.style.marginLeft=`${-e.width/2}px`,n.style.marginRight="0",n.style.marginTop=`${-e.height/2}px`;}return G(o,e.pmStart,e.pmEnd),o.appendChild(n),o}function se(e,t){return M(e)||e.displayMode==="block"||e.wrapType==="topAndBottom"?Ye(e,t):xt(e,t)}function Fe(e,t){let o=t.createElement("br");return o.className=`${E.run} ${E.lineBreak}`,G(o,e.pmStart,e.pmEnd),o}function le(e,t,o){let n=e.fallback??"";switch(e.fieldType){case "PAGE":n=String(o.pageNumber);break;case "NUMPAGES":n=String(o.totalPages);break;case "DATE":n=new Date().toLocaleDateString();break;case "TIME":n=new Date().toLocaleTimeString();break}let r={text:n,bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,color:e.color,highlight:e.highlight,fontFamily:e.fontFamily,fontSize:e.fontSize,pmStart:e.pmStart,pmEnd:e.pmEnd};return Q(r,t,o?.resolvedCommentIds)}function ke(e,t,o){if(A(e))return Q(e,t,o?.resolvedCommentIds);if(z(e))return ae(e,t,48,void 0);if(j(e))return se(e,t);if(W(e))return Fe(e,t);if(K(e)&&o)return le(e,t,o);let n=t.createElement("span");return n.className=E.run,n}function Ie(e){return e/1440*96}function Tt(e){return e/96*1440}function St(e){let{explicitStops:t=[],defaultTabInterval:o=720,leftIndent:n=0}=e,r=t.filter(c=>c.val!=="clear").filter(c=>c.pos>=n),i=t.filter(c=>c.val==="clear").map(c=>c.pos),a=r.reduce((c,T)=>Math.max(c,T.pos),0),l=[...r];n>0&&!r.some(c=>c.pos<=n)&&(i.some(T=>Math.abs(T-n)<20)||l.push({val:"start",pos:n,leader:"none"}));let f=a>0?Math.max(a,n):n,s=n+14400;for(;f<s;){f+=o;let c=r.some(m=>Math.abs(m.pos-f)<20),T=i.some(m=>Math.abs(m-f)<20),b=n>0&&Math.abs(f-n)<20;!c&&!T&&!b&&l.push({val:"start",pos:f,leader:"none"});}return l.sort((c,T)=>c.pos-T.pos)}function Ze(e,t,o="",n,r="."){let{defaultTabInterval:i=720}=t,a=Tt(e),d=St(t).find(c=>c.pos>a);if(!d){let c=Ie(i),T=c-e%c;return T<=0&&(T=c),{width:T,alignment:"default"}}let s=Ie(d.pos)-e;if(d.val==="center"||d.val==="end"){let c=n?n(o):0;d.val==="center"?s-=c/2:s-=c;}else if(d.val==="decimal"){let c=o.indexOf(r);if(c>=0&&n){let T=o.slice(0,c),b=n(T);s-=b;}}else if(d.val==="bar")return {width:0,leader:d.leader,alignment:"bar"};if(s<1){let c=Ie(i),T=c-e%c;return T<=0&&(T=c),{width:T,alignment:"default"}}return {width:s,leader:d.leader,alignment:d.val}}function Je(e,t){let o=[],n=e.runs;for(let r=t.fromRun;r<=t.toRun;r++){let i=n[r];if(i)if(A(i)){let a=r===t.fromRun?t.fromChar:0,l=r===t.toRun?t.toChar:i.text.length;if(a>0||l<i.text.length){let d=i.text.slice(a,l);o.push({...i,text:d,pmStart:i.pmStart!==void 0?i.pmStart+a:void 0,pmEnd:i.pmStart!==void 0?i.pmStart+l:void 0});}else o.push(i);}else o.push(i);}return o}function qe(e){return [e.pmStart??"no-start",e.pmEnd??"no-end",e.src,e.width,e.height,e.displayMode??"inline",e.wrapType??"none"].join("|")}function wt(e){return {val:e.val,pos:e.pos,leader:e.leader}}function Ft(e,t,o){let n="";for(let r=t+1;r<e.length;r++){let i=e[r];if(A(i))n+=i.text;else if(K(i))i.fieldType==="PAGE"&&o?n+=String(o.pageNumber):i.fieldType==="NUMPAGES"&&o?n+=String(o.totalPages):n+=i.fallback??"";else if(z(i)||W(i))break}return n}var kt=.5;function It(e,t,o,n){let r=0;for(let i=t+1;i<e.length;i++){let a=e[i];if(z(a)||W(a))break;if(A(a))r+=o(a.text||"",a.fontSize,a.fontFamily,a.bold,a.italic);else if(K(a)){let l;a.fieldType==="PAGE"&&n?l=String(n.pageNumber):a.fieldType==="NUMPAGES"&&n?l=String(n.totalPages):l=a.fallback??"",r+=o(l,a.fontSize,a.fontFamily,a.bold,a.italic);}else j(a)&&!M(a)&&(r+=a.width||0);}return r}function Ct(e){let o=e.createElement("canvas").getContext("2d");return (n,r=11,i="Calibri",a=false,l=false)=>{if(!o)return n.length*7;let d=chunkN3Y5BUKV_js.a(i).cssFallback,f=r*96/72,s=[];return l&&s.push("italic"),a&&s.push("bold"),s.push(`${f}px`,d),o.font=s.join(" "),o.measureText(n).width}}function de(e,t,o,n,r){let i=n.createElement("div");i.className=E.line,i.style.height=`${t.lineHeight}px`,i.style.lineHeight=`${t.lineHeight}px`;let a=Je(e,t);if(a.length===1&&j(a[0])){let p=a[0].position?.horizontal?.align??o;i.style.display="flex",i.style.alignItems="center",i.style.justifyContent=p==="center"?"center":p==="right"?"flex-end":"flex-start",i.dataset.flexLine="true";}if(a.length===0){let h=n.createElement("span");return h.className=`${E.run} layout-empty-run`,h.innerHTML="&nbsp;",i.appendChild(h),i}let l=o==="justify",d=false;l&&r&&(d=!r.isLastLine||r.paragraphEndsWithLineBreak,d&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${r.availableWidth}px`)),i.style.whiteSpace="pre";let f=a.some(h=>A(h)&&h.highlight);i.style.overflow=f?"hidden":"visible";let s=a.some(z),c,T=Ct(n);if(s){let h=r?.tabStops?.map(wt),g=r?.leftIndentPx?Math.round(r.leftIndentPx*15):0;c={explicitStops:h,leftIndent:g};}let b=0,m=r?.leftIndentPx??0;if(r?.isFirstLine){let h=r?.firstLineIndentPx??0;b=m+h;}else b=m;for(let h=0;h<a.length;h++){let g=a[h];if(z(g)&&c){let p=Ft(a,h,r?.context),y=Ze(b,c,p,T),u=r?.lineRightEdgePx,S=u!==void 0?It(a,h,T,r?.context):0,w=false;for(let x=h+1;x<a.length&&!W(a[x]);x++)if(z(a[x])){w=true;break}if(u!==void 0&&y.alignment==="end"&&!w&&b+y.width+S>=u-kt){i.style.display="flex",i.style.alignItems="baseline",i.style.whiteSpace="nowrap",i.style.textIndent="0",i.dataset.flexLine="true",r?.isFirstLine&&r.firstLineIndentPx&&r.firstLineIndentPx<0&&i.firstElementChild instanceof HTMLElement&&(i.firstElementChild.style.marginLeft=`${r.firstLineIndentPx}px`);let x=ae(g,n,0,y.leader);x.style.flex="1 1 0",x.style.minWidth="0",x.style.width="auto",i.appendChild(x);for(let k=h+1;k<a.length;k++){let P=a[k];if(z(P)||W(P))break;if(A(P))i.appendChild(Q(P,n,r?.context?.resolvedCommentIds));else if(K(P)&&r?.context)i.appendChild(le(P,n,r.context));else if(j(P)){if(M(P))continue;let C=qe(P);r?.renderedInlineImageKeys?.has(C)||(r?.renderedInlineImageKeys?.add(C),i.appendChild(se(P,n)));}else i.appendChild(ke(P,n,r?.context));}break}let I=y.width;u!==void 0&&b+I+S>u&&(I=Math.max(1,u-b-S));let R=ae(g,n,I,y.leader);i.appendChild(R),b+=I;}else if(A(g)){let p=Q(g,n,r?.context?.resolvedCommentIds);if(g.highlight){let w=(g.fontSize?g.fontSize*96/72:14.67)*1.2,F=Math.max(0,t.lineHeight-w);if(F>0){let I=F/2;p.style.paddingTop=`${I}px`,p.style.paddingBottom=`${I}px`;}}i.appendChild(p);let y=g.fontSize||11,u=g.fontFamily||"Calibri";b+=T(g.text,y,u,g.bold,g.italic);}else if(j(g)){if(M(g))continue;let p=qe(g);if(r?.renderedInlineImageKeys?.has(p))continue;r?.renderedInlineImageKeys?.add(p);let y=se(g,n);i.appendChild(y),g.displayMode!=="block"&&g.wrapType!=="topAndBottom"&&(b+=g.width);}else if(W(g)){let p=Fe(g,n);i.appendChild(p);}else if(K(g)&&r?.context){let p=le(g,n,r.context);i.appendChild(p);let y=g.fallback??"";g.fieldType==="PAGE"?y=String(r.context.pageNumber):g.fieldType==="NUMPAGES"&&(y=String(r.context.totalPages));let u=g.fontSize||11,S=g.fontFamily||"Calibri";b+=T(y,u,S,g.bold,g.italic);}else {let p=ke(g,n,r?.context);i.appendChild(p);}}return i}function ee(e,t){return !e&&!t?true:!e||!t?false:e.style===t.style&&e.width===t.width&&e.color===t.color}function Qe(e,t){return !e&&!t||!e||!t?false:ee(e.top,t.top)&&ee(e.bottom,t.bottom)&&ee(e.left,t.left)&&ee(e.right,t.right)&&ee(e.between,t.between)}function $(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");a.className=E.fragment,a.style.position=n.positioning==="absolute"?"absolute":"relative",a.dataset.blockId=String(e.blockId),a.dataset.fromLine=String(e.fromLine),a.dataset.toLine=String(e.toLine),G(a,e.pmStart,e.pmEnd),e.continuesFromPrev&&(a.dataset.continuesFromPrev="true"),e.continuesOnNext&&(a.dataset.continuesOnNext="true");let l=o.lines.slice(e.fromLine,e.toLine),d=t.attrs?.alignment;t.attrs?.styleId&&(a.dataset.styleId=t.attrs.styleId);let f=t.attrs?.bidi;f&&(a.dir="rtl"),d?d==="center"?a.style.textAlign="center":d==="right"?a.style.textAlign="right":d==="left"?a.style.textAlign="left":a.style.textAlign=f?"right":"left":f&&(a.style.textAlign="right");let s=t.attrs?.indent,c=0,T=0;s&&(f?(s.left&&s.left>0&&(T=s.left),s.right&&s.right>0&&(c=s.right)):(s.left&&s.left>0&&(c=s.left),s.right&&s.right>0&&(T=s.right)));let b=t.attrs?.borders;if(b){let S=C=>{switch(C){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"}};a.style.boxSizing="border-box";let w=C=>`${C.width}px ${S(C.style)} ${C.color}`,F=Qe(r.prevBorders,b),I=Qe(b,r.nextBorders),R=F?b.between:b.top,x=I?void 0:b.bottom,k=i.createElement("div");if(k.className="layout-paragraph-border",k.style.position="absolute",k.style.pointerEvents="none",k.style.boxSizing="border-box",k.style.left=`${c-(b.left?.space??0)}px`,k.style.right=`${T-(b.right?.space??0)}px`,k.style.top=`${-(R?.space??0)}px`,k.style.bottom=`${-(x?.space??0)}px`,R&&(k.style.borderTop=w(R)),x&&(k.style.borderBottom=w(x)),b.left&&(k.style.borderLeft=w(b.left)),b.right&&(k.style.borderRight=w(b.right)),(R||x||b.left||b.right)&&a.appendChild(k),b.bar){let C=i.createElement("div");C.style.position="absolute",C.style.left="-8px",C.style.top="0",C.style.bottom="0",C.style.borderLeft=w(b.bar),a.style.position="relative",a.appendChild(C);}}t.attrs?.shading&&(a.style.backgroundColor=t.attrs.shading);let m=e.width-c-T,g=t.runs[t.runs.length-1]?.kind==="lineBreak",p=o.lines.length,y=0;s?.hanging&&s.hanging>0?y=-s.hanging:s?.firstLine&&s.firstLine>0&&(y=s.firstLine);let u=r.renderedInlineImageKeys??new Set;for(let S=0;S<l.length;S++){let w=l[S],F=e.fromLine+S,I=F===p-1,R=F===0&&!e.continuesFromPrev,x=w.leftOffset??0,k=w.rightOffset??0,P=m;if(R){let B=s?.hanging&&s.hanging>0,L=s?.firstLine&&s.firstLine>0;B&&s?.hanging?P=m+s.hanging:L&&s?.firstLine&&(P=m-s.firstLine);}if(Rt(w,t)){let B=i.createElement("div");B.className=`${E.line} layout-line-split`,B.style.position="relative",B.style.height=`${w.lineHeight}px`,B.style.lineHeight=`${w.lineHeight}px`;for(let L of w.segments){let be={fromRun:L.fromRun,fromChar:L.fromChar,toRun:L.toRun,toChar:L.toChar,width:L.width,ascent:w.ascent,descent:w.descent,lineHeight:w.lineHeight},D=de(t,be,d,i,{availableWidth:L.availableWidth,isLastLine:I,isFirstLine:R,paragraphEndsWithLineBreak:g,tabStops:t.attrs?.tabs,leftIndentPx:c,firstLineIndentPx:R?y:0,context:n,renderedInlineImageKeys:u});D.className+=" layout-line-segment",D.style.position="absolute",D.style.left=`${L.leftOffset}px`,D.style.top="0",D.style.width=`${L.availableWidth}px`,B.appendChild(D);}a.appendChild(B);continue}let C=de(t,w,d,i,{availableWidth:P-x-k,isLastLine:I,isFirstLine:R,paragraphEndsWithLineBreak:g,tabStops:t.attrs?.tabs,leftIndentPx:c,firstLineIndentPx:R?y:0,context:n,renderedInlineImageKeys:u,lineRightEdgePx:e.width-T-k});if(x>0||k>0){x>0&&(C.style.marginLeft=`${x}px`),k>0&&(C.style.marginRight=`${k}px`);let B=P-x-k;B>0&&(C.style.width=`${B}px`);}let Me=s?.hanging&&s.hanging>0,ve=s?.firstLine&&s.firstLine>0,lt=C.dataset.flexLine==="true";if(R?c>0&&Me?(C.style.paddingLeft=`${c}px`,lt||(C.style.textIndent=`-${s.hanging}px`)):c>0&&ve?(C.style.paddingLeft=`${c}px`,C.style.textIndent=`${s.firstLine}px`):c>0?C.style.paddingLeft=`${c}px`:ve&&(C.style.textIndent=`${s.firstLine}px`):c>0?C.style.paddingLeft=`${c}px`:Me&&(C.style.paddingLeft=`${s.hanging}px`),T>0&&(C.style.paddingRight=`${T}px`),R&&t.attrs?.listMarker&&!t.attrs?.listMarkerHidden){let B=Math.max(0,c-(s?.hanging??0));C.style.paddingLeft=`${B}px`,C.style.textIndent="0";let L;if(!t.attrs.listMarkerFontFamily||!t.attrs.listMarkerFontSize)for(let H=w.fromRun;H<=w.toRun;H++){let xe=t.runs[H];if(xe&&xe.kind==="text"){L=xe;break}}let be=t.attrs.listMarkerFontFamily??L?.fontFamily??t.attrs.defaultFontFamily,D=t.attrs.listMarkerFontSize??L?.fontSize??t.attrs.defaultFontSize,$e=Pt(t.attrs.listMarker,s,i,be,D);if((s?.hanging??0)>0)C.insertBefore($e,C.firstChild);else {let H=i.createElement("div");H.className="layout-line layout-list-marker-line",H.style.height=`${w.lineHeight}px`,H.style.lineHeight=`${w.lineHeight}px`,H.appendChild($e),a.appendChild(H);}}a.appendChild(C);}return a}function Rt(e,t){return (e.segments?.length??0)>1&&!t.attrs?.listMarker}function Pt(e,t,o,n,r){let i=o.createElement("span");if(i.className="layout-list-marker",n&&(i.style.fontFamily=chunkN3Y5BUKV_js.a(n).cssFallback),r){let l=r*96/72;i.style.fontSize=`${l}px`;}i.textContent=e,i.style.textAlign="left",i.style.boxSizing="border-box";let a=t?.hanging??0;return i.style.display="inline-block",a>0&&(i.style.minWidth=`${a}px`),i}function U(e,t,o){let n=t.createElement("div");n.className=o.layerClass,n.style.position="absolute",n.style.top="0",n.style.left="0",o.sizing==="inset0"?(n.style.right="0",n.style.bottom="0"):(n.style.width="100%",n.style.height="100%",n.style.overflow="hidden"),n.style.pointerEvents="none",o.layerMode==="front"&&(n.style.zIndex="10");for(let r of e){let i=t.createElement("div");i.className=o.itemClass,i.style.position="absolute",i.style.pointerEvents="auto",i.style.top=`${r.y}px`,i.style.left=`${r.x}px`,r.pmStart!==void 0&&(i.dataset.pmStart=String(r.pmStart)),r.pmEnd!==void 0&&(i.dataset.pmEnd=String(r.pmEnd));let a=t.createElement("img");a.src=r.src,a.style.width=`${r.width}px`,a.style.height=`${r.height}px`,a.style.display="block",r.alt&&(a.alt=r.alt),r.transform&&(a.style.transform=r.transform,a.style.transformOrigin="center center"),q(r)&&J(a,r),i.appendChild(a),n.appendChild(i);}return n}var O={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 Et(e,t,o){let n=[],r=0;for(let i=0;i<e.blocks.length;i++){let a=e.blocks[i];if(a?.kind!=="paragraph"){let f=t.blocks[i];f&&f.kind==="table"&&(r+=f.totalHeight??0);continue}let l=a;for(let f of l.runs){if(f.kind!=="image")continue;let s=f;if(!M(s))continue;let c=s.position,T=s.distTop??0,b=s.distBottom??0,m=s.distLeft??12,h=s.distRight??12,g="left",p=0;if(c?.horizontal){let u=c.horizontal;u.align==="right"?(g="right",p=o-s.width):u.align==="left"?p=0:u.align==="center"?p=(o-s.width)/2:u.posOffset!==void 0&&(p=chunk4Q2IP5FW_js.e(u.posOffset),g=p>o/2?"right":"left");}else s.cssFloat==="right"&&(g="right",p=o-s.width);let y=r;if(c?.vertical){let u=c.vertical;u.posOffset!==void 0?y=r+chunk4Q2IP5FW_js.e(u.posOffset):u.align==="top"&&(y=0);}p=Math.max(0,Math.min(p,o-s.width)),n.push({src:s.src,width:s.width,height:s.height,alt:s.alt,transform:s.transform,x:p,y,side:g,distTop:T,distBottom:b,distLeft:m,distRight:h,wrapText:re(s.cssFloat),wrapType:s.wrapType,pmStart:s.pmStart,pmEnd:s.pmEnd});}let d=t.blocks[i];d&&d.kind==="paragraph"&&(r+=d.totalHeight);}return n}function Lt(e,t,o,n){let r=n.createElement("div");r.className=O.cellContent,r.style.position="relative";let i=e.padding?.left??7,a=e.padding?.right??7,l=Math.max(0,t.width-i-a);r.style.width=`${l}px`;let d=Et(e,t,l),f;if(d.length>0){f=d.filter(Z).map(m=>{let h=m.x+m.width+m.distRight,g=m.y-m.distTop,p=m.y+m.height+m.distBottom,y=0,u=0,S=m.wrapText??"bothSides";return S==="right"?y=h:S==="left"?u=l-(m.x-m.distLeft):m.side==="left"?y=h:u=l-(m.x-m.distLeft),{leftMargin:y,rightMargin:u,topY:g,bottomY:p}});let b=d.filter(Y);b.length>0&&r.appendChild(U(b,n,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"behind"}));}let s=0,c=0;for(let b=0;b<e.blocks.length;b++){let m=e.blocks[b],h=t.blocks[b];if(m?.kind==="paragraph"&&h?.kind==="paragraph"){let g=m,p=h,y=g.attrs?.spacing,u=Math.max(c,y?.before??0);s+=u,f&&f.length>0&&(p=chunkTZJUO3NW_js.s(g,l,{floatingZones:f,paragraphYOffset:s}));let S={blockId:g.id,width:l,height:p.totalHeight,fromLine:0,toLine:p.lines.length,pmStart:g.pmStart,pmEnd:g.pmEnd},w={...o,insideTableCell:true},F=$(S,g,p,w,{document:n});F.style.position="relative",u>0&&(F.style.marginTop=`${u}px`),r.appendChild(F),s+=p.totalHeight,c=y?.after??0;}else if(m?.kind==="table"&&h?.kind==="table"){let g=m,p=h,y=c,u=Bt(g,p,o,n);u.style.position="relative",y>0&&(u.style.marginTop=`${y}px`),r.appendChild(u),s+=y+(h.totalHeight??0),c=0;}}c>0&&(r.style.paddingBottom=`${c}px`);let T=d.filter(b=>!Y(b));return T.length>0&&r.appendChild(U(T,n,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"front"})),r}function Bt(e,t,o,n){let r=n.createElement("div");r.className=`${O.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 i=[],a=0;for(let f=0;f<t.rows.length;f++)i.push(a),a+=t.rows[f]?.height??0;i.push(a);let l=new Map,d=0;for(let f=0;f<e.rows.length;f++){let s=e.rows[f],c=t.rows[f];if(!s||!c)continue;let T=Ce(s,c,f,d,t.columnWidths,e.rows.length,o,n,l,i);r.appendChild(T),d+=c.height;}return r.style.height=`${d}px`,r}function pe(e,t,o){let n=`border${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!o||o.style==="none"||o.style==="nil"||o.width===0)e.style[n]="none";else {let r=o.width??1,i=o.color??"#000000",a=o.style??"solid";e.style[n]=`${r}px ${a} ${i}`;}}function Mt(e,t,o,n,r,i,a){let l=a.createElement("div");l.className=O.cell,l.style.position="absolute",l.style.left=`${o}px`,l.style.top="0",l.style.width=`${t.width}px`,l.style.height=`${n}px`,l.style.overflow="hidden",l.style.boxSizing="border-box";let d=e.padding?.top??1,f=e.padding?.right??7,s=e.padding?.bottom??1,c=e.padding?.left??7;if(l.style.padding=`${d}px ${f}px ${s}px ${c}px`,e.borders&&(r.isFirstRow&&pe(l,"top",e.borders.top),pe(l,"right",e.borders.right),pe(l,"bottom",e.borders.bottom),r.isFirstCol&&pe(l,"left",e.borders.left)),e.background&&(l.style.backgroundColor=e.background),e.noWrap&&(l.style.whiteSpace="nowrap"),e.verticalAlign)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 T=Lt(e,t,i,a);if(l.appendChild(T),e.blocks.length>0){let b=e.blocks[0],m=e.blocks[e.blocks.length-1];b&&"pmStart"in b&&b.pmStart!==void 0&&(l.dataset.pmStart=String(b.pmStart)),m&&"pmEnd"in m&&m.pmEnd!==void 0&&(l.dataset.pmEnd=String(m.pmEnd));}return l}function Ce(e,t,o,n,r,i,a,l,d,f,s){let c=l.createElement("div");c.className=O.row,c.style.position="absolute",c.style.left="0",c.style.top=`${n}px`,c.style.width="100%",c.style.height=`${t.height}px`,c.dataset.rowIndex=String(o);let T=new Set;if(d){for(let[,h]of d)if(h.startRow<o&&h.startRow+h.rowSpan>o)for(let g=0;g<h.colSpan;g++)T.add(h.columnIndex+g);}let b=0,m=0;for(;T.has(m);)b+=r[m]??0,m++;for(let h=0;h<e.cells.length;h++){let g=e.cells[h],p=t.cells[h];if(!g||!p)continue;let y=g.colSpan??1,u=g.rowSpan??1,S=t.height;if(u>1&&f){S=0;for(let k=o;k<o+u&&k<f.length-1;k++)S+=(f[k+1]??0)-(f[k]??0);S===0&&(S=t.height*u);}let w=o===0||s===true,I=m===0;m+y>=r.length;let x=Mt(g,p,b,S,{isFirstRow:w,isFirstCol:I},a,l);if(x.dataset.cellIndex=String(h),x.dataset.columnIndex=String(m),u>1&&(x.dataset.rowSpan=String(u)),c.appendChild(x),u>1&&d){let k=`${o}-${m}`;d.set(k,{cell:g,cellMeasure:p,columnIndex:m,startRow:o,rowSpan:u,colSpan:y,x:b,totalHeight:S});}for(let k=0;k<y&&m+k<r.length;k++)b+=r[m+k]??0;for(m+=y;T.has(m);)b+=r[m]??0,m++;}return c}function X(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");a.className=O.table,a.style.position=n.positioning==="flow"?"relative":"absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.dataset.blockId=String(e.blockId),a.dataset.fromRow=String(e.fromRow),a.dataset.toRow=String(e.toRow),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let l=0;for(let m=0;m<o.columnWidths.length-1;m++){l+=o.columnWidths[m]??0;let h=i.createElement("div");h.className=O.resizeHandle,h.style.position="absolute",h.style.left=`${l-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(m),h.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),a.appendChild(h);}let d=[],f=0;for(let m=0;m<o.rows.length;m++)d.push(f),f+=o.rows[m]?.height??0;d.push(f);let s=new Map,c=e.headerRowCount??0,T=0;if(c>0&&e.continuesFromPrev)for(let m=0;m<c;m++){let h=t.rows[m],g=o.rows[m];if(!h||!g)continue;let p=Ce(h,g,m,T,o.columnWidths,t.rows.length,n,i,s,d,m===0);p.dataset.repeatedHeader="true",a.appendChild(p),T+=g.height;}for(let m=e.fromRow;m<e.toRow;m++){let h=t.rows[m],g=o.rows[m];if(!h||!g)continue;let p=c>0&&e.continuesFromPrev?false:e.continuesFromPrev&&m===e.fromRow,y=Ce(h,g,m,T,o.columnWidths,t.rows.length,n,i,s,d,p);a.appendChild(y),T+=g.height;}let b=0;for(let m=e.fromRow;m<e.toRow;m++)if(b+=o.rows[m]?.height??0,m<e.toRow-1){let h=i.createElement("div");h.className=O.rowResizeHandle,h.style.position="absolute",h.style.left="0",h.style.top=`${b-3}px`,h.style.width="100%",h.style.height="6px",h.style.cursor="row-resize",h.style.zIndex="10",h.dataset.rowIndex=String(m),h.dataset.tableBlockId=String(e.blockId),e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),a.appendChild(h);}if(e.toRow===t.rows.length){let m=i.createElement("div");m.className=O.tableEdgeHandleBottom,m.style.position="absolute",m.style.left="0",m.style.top=`${b-3}px`,m.style.width="100%",m.style.height="6px",m.style.cursor="row-resize",m.style.zIndex="10",m.dataset.rowIndex=String(t.rows.length-1),m.dataset.tableBlockId=String(e.blockId),m.dataset.isEdge="bottom",e.pmStart!==void 0&&(m.dataset.tablePmStart=String(e.pmStart)),a.appendChild(m);}if(e.toRow===t.rows.length){let m=o.columnWidths.reduce((g,p)=>g+p,0),h=i.createElement("div");h.className=O.tableEdgeHandleRight,h.style.position="absolute",h.style.left=`${m-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(o.columnWidths.length-1),h.dataset.tableBlockId=String(e.blockId),h.dataset.isEdge="right",e.pmStart!==void 0&&(h.dataset.tablePmStart=String(e.pmStart)),a.appendChild(h);}return a}var vt={textBox:"layout-textbox"};function ce(e,t,o,n,r={}){let i=r.document??document,a=i.createElement("div");if(a.className=vt.textBox,a.style.position="absolute",a.style.width=`${e.width}px`,a.style.height=`${e.height}px`,a.style.overflow="hidden",a.style.boxSizing="border-box",$t(a,e),t.fillColor&&(a.style.backgroundColor=t.fillColor),t.outlineWidth&&t.outlineWidth>0){let s=t.outlineStyle||"solid",c=t.outlineColor||"#000000";a.style.border=`${t.outlineWidth}px ${s} ${c}`;}let l=t.margins??chunkDROCYKAR_js.a;a.style.padding=`${l.top}px ${l.right}px ${l.bottom}px ${l.left}px`,a.dataset.blockId=String(e.blockId),e.pmStart!==void 0&&(a.dataset.pmStart=String(e.pmStart)),e.pmEnd!==void 0&&(a.dataset.pmEnd=String(e.pmEnd));let d=e.width-l.left-l.right,f=0;for(let s=0;s<t.content.length;s++){let c=t.content[s],T=o.innerMeasures[s];if(!T)continue;let b={blockId:c.id,width:d,height:T.totalHeight,pmStart:c.pmStart,pmEnd:c.pmEnd,fromLine:0,toLine:T.lines.length},m=$(b,c,T,{...n,positioning:"flow"},{document:i});a.appendChild(m),f+=T.totalHeight;}return a}function $t(e,t){!t.isFloating&&t.zIndex===void 0||(e.style.zIndex=String(t.zIndex??10));}function et(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function Re(e,t,o,n){let{x:r,side:i}=Ht(e,o,n),a=zt(e,t,n);return {x:r,y:a,side:i}}function Ht(e,t,o){let n=e.position?.horizontal;if(!n)return e.cssFloat==="right"?{x:t-e.width,side:"right"}:{x:0,side:"left"};let r=At(n.relativeTo,t,o);if(n.align==="right")return {x:r.size?r.base+r.size-e.width:0,side:"right"};if(n.align==="left")return {x:r.base,side:"left"};if(n.align==="center")return {x:r.size?r.base+(r.size-e.width)/2:0,side:"left"};if(n.posOffset!==void 0){let i=r.base+chunk4Q2IP5FW_js.e(n.posOffset);return {x:i,side:i>t/2?"right":"left"}}return {x:r.base,side:"left"}}function At(e,t,o){let n=o?.pageWidth??0,r=o?.marginLeft??0;switch(e){case "page":return {base:-r,size:n};case "leftMargin":return {base:-r,size:r};case "rightMargin":return {base:t,size:r};case "character":return {base:0,size:0};default:return {base:0,size:t}}}function zt(e,t,o){let n=e.position?.vertical;if(!n)return t;let r=Ot(n.relativeTo,t,o);return n.align==="top"?r.base:n.align==="center"?r.size?r.base+(r.size-e.height)/2:t:n.align==="bottom"?r.size?r.base+r.size-e.height:t:n.posOffset!==void 0?r.base+chunk4Q2IP5FW_js.e(n.posOffset):n.relativeTo==="paragraph"||n.relativeTo==="line"?t:r.base}function Ot(e,t,o){let n=o?.pageHeight??0,r=o?.marginTop??0,i=o?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:t,size:0};case "page":return {base:-r,size:n};case "topMargin":return {base:-r,size:r};case "bottomMargin":return {base:i,size:r};default:return {base:0,size:i}}}function tt(e){return e?.align??e?.alignment}function Nt(e,t){let o=e.position.vertical;if(!o)return e.paragraphY;let n=tt(o),r=o.posOffset!==void 0?chunk4Q2IP5FW_js.e(o.posOffset):void 0;if(o.relativeTo==="page"){if(r!==void 0)return r-t.flowTop;if(n==="top")return -t.flowTop;if(n==="bottom")return t.pageHeight-e.height-t.flowTop;if(n==="center")return (t.pageHeight-e.height)/2-t.flowTop}if(o.relativeTo==="margin"){let i=t.margins.top,a=t.pageHeight-t.margins.top-t.margins.bottom;if(r!==void 0)return i+r-t.flowTop;if(n==="top")return i-t.flowTop;if(n==="bottom")return i+a-e.height-t.flowTop;if(n==="center")return i+(a-e.height)/2-t.flowTop}return r!==void 0?e.paragraphY+r:e.paragraphY}function Dt(e,t,o){let n=t.position.horizontal;if(!n){e.style.left="0";return}let r=tt(n);if(n.relativeTo==="page"){if(n.posOffset!==void 0){e.style.left=`${chunk4Q2IP5FW_js.e(n.posOffset)-o.flowLeft}px`;return}if(r==="right"){e.style.left=`${o.pageWidth-t.width-o.flowLeft}px`;return}if(r==="center"){e.style.left=`${(o.pageWidth-t.width)/2-o.flowLeft}px`;return}if(r==="left"){e.style.left=`${-o.flowLeft}px`;return}}if(n.posOffset!==void 0){e.style.left=`${chunk4Q2IP5FW_js.e(n.posOffset)}px`;return}if(r==="right"){e.style.left=`${o.contentWidth-t.width}px`;return}if(r==="center"){e.style.left=`${(o.contentWidth-t.width)/2}px`;return}e.style.left="0";}function nt(e,t){let o=e.tblpY??0;e.vertAnchor==="page"?o-=t.flowTop:e.vertAnchor==="margin"&&(o+=t.margins.top-t.flowTop);let n=e.tblpX??0;return e.horzAnchor==="page"?n-=t.flowLeft:e.horzAnchor==="margin"&&(n+=t.margins.left-t.flowLeft),{left:n,top:o}}function Pe(e,t,o,n){let r=o.document??document,i=r.createElement("div");i.style.position="relative";let a=t.contentWidth??600,l=[],d=0;for(let f=0;f<e.blocks.length;f++){let s=e.blocks[f],c=e.measures[f];if(!(!s||!c)){if(s.kind==="paragraph"&&c.kind==="paragraph"){let T=s,b=c,m=T.attrs?.spacing?.before??0,h=d,g=[];for(let S of T.runs)if(S.kind==="image"&&"position"in S&&S.position){let w=S;l.push({src:w.src,width:w.width,height:w.height,alt:w.alt,paragraphY:h,position:w.position});}else g.push(S);let p={...T,runs:g},y={blockId:T.id,width:a,height:b.totalHeight,fromLine:0,toLine:b.lines.length},u=$(y,p,b,{...t,positioning:"absolute"},{document:r});u.style.top=`${d+m}px`,u.style.left="0",u.style.width=`${a}px`,i.appendChild(u),d+=b.totalHeight;}else if(s.kind==="table"&&c.kind==="table"){let T={blockId:s.id,width:c.totalWidth,height:c.totalHeight,fromRow:0,toRow:c.rows.length,pmStart:s.pmStart,pmEnd:s.pmEnd},b=X(T,s,c,{...t,positioning:"absolute"},{document:r});if(s.floating){let{left:m,top:h}=nt(s.floating,n);b.style.top=`${h}px`,b.style.left=`${m}px`,i.appendChild(b);}else b.style.top=`${d}px`,b.style.left="0",i.appendChild(b),d+=c.totalHeight;}}}for(let f of l){let s=r.createElement("img");s.src=f.src,s.width=f.width,s.height=f.height,f.alt&&(s.alt=f.alt),s.style.position="absolute",s.style.display="block",s.style.width=`${f.width}px`,s.style.height=`${f.height}px`,s.style.maxWidth="none",s.style.maxHeight="none",Dt(s,f,n),s.style.top=`${Nt(f,n)}px`,i.appendChild(s);}return i}var fe=12,ot=6;function _t(e,t){if(e.size!==t.size)return false;for(let[o,n]of e)if(t.get(o)!==n)return false;return true}var Ee=8;function Xn(e){let t=[];for(let o of e)if(o.kind==="paragraph")for(let n of o.runs)n.kind==="text"&&n.footnoteRefId!=null&&t.push({footnoteId:n.footnoteRefId,pmPos:n.pmStart??0});return t}function Le(e,t){let o=new Map;if(t.length===0)return o;for(let n of t)for(let r of e){let i=false;for(let a of r.fragments){let l=a.pmStart??-1,d=a.pmEnd??-1;if(l>=0&&d>=0&&n.pmPos>=l&&n.pmPos<d){let f=o.get(r.number)??[];f.includes(n.footnoteId)||f.push(n.footnoteId),o.set(r.number,f),i=true;break}}if(i)break}return o}function Wt(e,t){if(e.length===0)return [{kind:"paragraph",id:`fn-empty-${t}`,runs:[{kind:"text",text:`${t} `,fontSize:Ee,superscript:true}]}];let o=e.map(r=>{if(r.kind!=="paragraph")return r;let i=r;return {...i,runs:i.runs.map(a=>(a.kind==="text"||a.kind==="tab")&&a.fontSize==null?{...a,fontSize:Ee}:a)}}),n=o[0];if(n.kind==="paragraph"){let r={kind:"text",text:`${t} `,fontSize:Ee,superscript:true};o[0]={...n,runs:[r,...n.runs]};}return o}function Gt(e,t,o,n){let r=chunkHVZMO3BU_js.c(e.content,{styles:n.styles??void 0,theme:n.theme??null}),i=chunkBD4CYYFB_js.d(r,{theme:n.theme??void 0}),a=Wt(i,t),l=n.measureBlocks(a,o),d=l.reduce((f,s)=>s.kind==="paragraph"||s.kind==="table"?f+s.totalHeight:s.kind==="image"||s.kind==="textBox"?f+s.height:f,0);return {id:e.id,displayNumber:t,blocks:a,measures:l,height:d}}function Zn(e,t,o,n){let r=new Map,i=new Map;for(let d of e)(d.noteType==="normal"||d.noteType==null)&&i.set(d.id,d);let a=1,l=new Set;for(let d of t){if(l.has(d.footnoteId))continue;l.add(d.footnoteId);let f=i.get(d.footnoteId);f&&(r.set(d.footnoteId,Gt(f,a,o,n)),a++);}return r}function rt(e,t){let o=new Map;for(let[n,r]of e){let i=0;for(let a of r){let l=t.get(a);l&&(i+=l.height);}i>0&&(i+=fe,o.set(n,i));}return o}function qn(e){let{blocks:t,measures:o,layoutOpts:n,footnoteRefs:r,footnoteContentMap:i,initialLayout:a}=e,l=Le(a.pages,r),d=rt(l,i);if(d.size===0)return {layout:a,pageFootnoteMap:l,converged:true};let f=a,s=false;for(let c=0;c<ot;c++){f=chunk44RUAQA2_js.q(t,o,{...n,footnoteReservedHeights:d});let T=Le(f.pages,r),b=rt(T,i);if(l=T,_t(d,b)){d=b,s=true;break}d=b;}s||(f=chunk44RUAQA2_js.q(t,o,{...n,footnoteReservedHeights:d}),l=Le(f.pages,r),console.warn(`[docx-editor] footnote layout did not stabilize within ${ot} passes; settling with best-effort reservation. If footnotes appear misplaced, please file a bug with the document.`));for(let[c,T]of l){let b=f.pages.find(m=>m.number===c);b&&(b.footnoteIds=T);}return {layout:f,pageFootnoteMap:l,converged:s}}function Jn(e,t,o){let n=new Map;if(!o?.package?.footnotes)return n;let r=new Map;for(let i of o.package.footnotes)i.noteType&&i.noteType!=="normal"||r.set(i.id,i);for(let[i,a]of e){let l=[];for(let d of a){let f=r.get(d);if(!f)continue;let s=t.get(d),c=s?.displayNumber??0;l.push({displayNumber:String(c),text:chunkDV6IEOP5_js.v(f),content:s});}l.length>0&&n.set(i,l);}return n}function Vt(e,t,o,n){let r=n.createElement("div");r.className="layout-footnote-content",r.style.position="relative",r.style.width=`${t}px`,r.style.height=`${e.height}px`;let i=0;for(let a=0;a<e.blocks.length;a++){let l=e.blocks[a],d=e.measures[a];if(!(!l||!d)){if(l.kind==="paragraph"&&d.kind==="paragraph"){let f=l.attrs?.spacing?.before??0,s={blockId:l.id,width:t,height:d.totalHeight,pmStart:l.pmStart,pmEnd:l.pmEnd,fromLine:0,toLine:d.lines.length},c=$(s,l,d,{...o,section:"body",contentWidth:t,positioning:"absolute"},{document:n});c.style.top=`${i+f}px`,c.style.left="0",c.style.width=`${t}px`,c.style.height=`${d.totalHeight}px`,r.appendChild(c),i+=d.totalHeight;}else if(l.kind==="table"&&d.kind==="table"){let f={blockId:l.id,width:d.totalWidth,height:d.totalHeight,pmStart:l.pmStart,pmEnd:l.pmEnd,fromRow:0,toRow:d.rows.length},s=X(f,l,d,{...o,section:"body",contentWidth:t,positioning:"absolute"},{document:n});s.style.top=`${i}px`,s.style.left="0",r.appendChild(s),i+=d.totalHeight;}else if(l.kind==="image"&&d.kind==="image"){let f={blockId:l.id,width:d.width,height:d.height,pmStart:l.pmStart,pmEnd:l.pmEnd},s=ie(f,l,d,{...o},{document:n});s.style.top=`${i}px`,s.style.left="0",r.appendChild(s),i+=d.height;}else if(l.kind==="textBox"&&d.kind==="textBox"){let f={blockId:l.id,width:d.width,height:d.height,pmStart:l.pmStart,pmEnd:l.pmEnd},s=ce(f,l,d,{...o,section:"body",contentWidth:t,positioning:"absolute"},{document:n});s.style.top=`${i}px`,s.style.left="0",r.appendChild(s),i+=d.height;}}}return r}function jt(e,t){let o=t.createElement("div");o.style.fontSize="10px",o.style.lineHeight="1.3",o.style.marginBottom="4px",o.style.color="#000";let n=t.createElement("sup");n.textContent=e.displayNumber,n.style.fontSize="7px",n.style.marginRight="2px",o.appendChild(n);let r=t.createTextNode(" "+e.text);return o.appendChild(r),o}function it(e){let t=fe;for(let o of e)o.content&&(t+=o.content.height);return t}function at(e,t,o,n){let r=n.createElement("div");r.className="layout-footnote-area",r.style.width=`${t}px`;let i=n.createElement("div"),a=.5,l=(fe-a)/2;i.style.width="33%",i.style.height=`${a}px`,i.style.backgroundColor="#000",i.style.marginBottom=`${l}px`,i.style.marginTop=`${l}px`,r.appendChild(i);for(let d of e)r.appendChild(d.content?Vt(d.content,t,o,n):jt(d,n));return r}function Be(e,t,o){let n={pageNumber:e.number,totalPages:t,section:"body",resolvedCommentIds:o.resolvedCommentIds},r={...o};if(o.titlePg&&e.number===1&&(r.headerContent=o.firstPageHeaderContent,r.footerContent=o.firstPageFooterContent),o.footnotesByPage){let i=o.footnotesByPage.get(e.number);i&&i.length>0&&(r.footnoteArea=i);}return {context:n,pageOptions:r}}function st(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 o of e.fragments){let n=`${o.kind}:${o.blockId},${o.x},${o.y},${o.width},${o.height}`;o.pmStart!==void 0&&(n+=`,ps:${o.pmStart}`),o.pmEnd!==void 0&&(n+=`,pe:${o.pmEnd}`),o.kind==="paragraph"?n+=`,fl:${o.fromLine},tl:${o.toLine}`:o.kind==="table"&&(n+=`,fr:${o.fromRow},tr:${o.toRow}`),t.push(n);}return t.join("|")}function Kt(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 Yt(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 ge=2,Ut=8;function Xt(e,t,o={}){let n=e.length,r=o.pageGap??24,i=t,a=i.__pageRenderState,l=Kt(o),d=n>=Ut;if(a&&a.optionsHash===l&&d){let g=a.pageStates,p=a.pageDataMap,y=i.__pageObserver,u=[];for(let F of e)u.push(st(F));let S=a.totalPages!==n,w=Math.min(g.length,e.length);for(let F=0;F<w;F++){let I=g[F],R=u[F];if(I.fingerprint===R&&!S){let P=p.get(I.element);P&&(P.page=e[F]);continue}let x=I.element,k=p.get(x);k&&(k.page=e[F],k.rendered&&Zt(x,p,n,o)),I.fingerprint=R,te(x,e[F].size.w,e[F].size.h,o),x.dataset.pageNumber=String(e[F].number);}if(e.length>g.length){let F=o.document??document;for(let I=g.length;I<e.length;I++){let R=e[I],x=F.createElement("div");x.className=o.pageClassName??N.page,x.dataset.pageNumber=String(R.number),x.dataset.pageIndex=String(I),te(x,R.size.w,R.size.h,o),t.appendChild(x),g.push({element:x,fingerprint:u[I]}),p.set(x,{page:R,index:I,rendered:false}),y&&y.observe(x);}}if(e.length<g.length){for(let F=g.length-1;F>=e.length;F--){let I=g[F].element;y&&y.unobserve(I),p.delete(I),t.removeChild(I);}g.length=e.length;}for(let F=0;F<g.length;F++){let I=p.get(g[F].element);I&&(I.index=F);}return a.totalPages=n,a.currentOptions=o,"incremental"}let s=i.__pageObserver;s&&(s.disconnect(),i.__pageObserver=void 0),t.innerHTML="",i.__pageRenderState=void 0,Yt(t,r);let c=[],T=[];for(let g=0;g<e.length;g++){let p=e[g];if(T.push(st(p)),d){let u=(o.document??document).createElement("div");u.className=o.pageClassName??N.page,u.dataset.pageNumber=String(p.number),u.dataset.pageIndex=String(g),te(u,p.size.w,p.size.h,o),t.appendChild(u),c.push(u);}else {let{context:y,pageOptions:u}=Be(p,n,o),S=he(p,y,u);t.appendChild(S),c.push(S);}}if(!d)return "full";let b=new Map;for(let g=0;g<e.length;g++)b.set(c[g],{page:e[g],index:g,rendered:false});let m=new IntersectionObserver(g=>{let p=i.__pageRenderState;if(!p)return;let{currentOptions:y,totalPages:u,pageDataMap:S}=p;for(let R of g){let x=R.target,k=S.get(x);if(k&&R.isIntersecting){me(x,S,u,y);for(let P=-ge;P<=ge;P++){let C=k.index+P;C>=0&&C<p.pageStates.length&&C!==k.index&&me(p.pageStates[C].element,S,u,y);}}}let w=window.innerHeight,F=w*3,I=new Set;for(let[R,x]of S){if(!x.rendered)continue;let k=R.getBoundingClientRect();k.bottom>-F&&k.top<w+F&&I.add(x.index);}for(let[R,x]of S){if(!x.rendered)continue;let k=false;for(let P of I)if(Math.abs(x.index-P)<=ge+1){k=true;break}!k&&I.size>0&&qt(R,S);}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let g of c)m.observe(g);i.__pageObserver=m,i.__pageRenderState={pageStates:c.map((g,p)=>({element:g,fingerprint:T[p]})),totalPages:n,optionsHash:l,pageDataMap:b,currentOptions:o};let h=Math.min(e.length,ge+3);for(let g=0;g<h;g++)me(c[g],b,n,o);return "full"}function me(e,t,o,n){let r=t.get(e);if(!r||r.rendered)return;let{context:i,pageOptions:a}=Be(r.page,o,n),l=he(r.page,i,a);for(;l.firstChild;)e.appendChild(l.firstChild);r.rendered=true;}function Zt(e,t,o,n){let r=t.get(e);if(!r)return;let{context:i,pageOptions:a}=Be(r.page,o,n),d=he(r.page,i,a).querySelector(`.${N.content}`),f=e.querySelector(`.${N.content}`);d&&f?e.replaceChild(d,f):(e.innerHTML="",r.rendered=false,me(e,t,o,n));}function qt(e,t){let o=t.get(e);!o||!o.rendered||(e.innerHTML="",o.rendered=false);}var N={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function te(e,t,o,n){e.style.position="relative",e.style.width=`${t}px`,e.style.height=`${o}px`,e.style.backgroundColor=n.backgroundColor??"#ffffff",e.style.overflow="hidden",e.style.fontFamily=chunkN3Y5BUKV_js.a("Calibri").cssFallback,e.style.fontSize=`${1056/72}px`,e.style.color="#000000",n.showBorders&&(e.style.border="1px solid #ccc"),n.showShadow&&(e.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");}function Jt(e,t){switch(t??"allPages"){case "firstPage":return e===1;case "notFirstPage":return e!==1;default:return true}}function ue(e){return e?.space!==void 0?chunk4Q2IP5FW_js.i(e.space):0}function ye(e,t,o,n){if(!t||t.style==="none"||t.style==="nil")return;let r=chunkBHBOAP6Z_js.c(t,o,n);for(let[d,f]of Object.entries(r))e.style[d]=String(f);let i=`border${o}Style`,a=`border${o}Width`;if(e.style[i]==="double"){let d=parseFloat(e.style[a]);(!Number.isFinite(d)||d<3)&&(e.style[a]="3px");}}function Qt(e,t,o){let n=t.pageBorders;if(!n||!Jt(e.number,n.display)||![n.top,n.bottom,n.left,n.right].some(c=>c&&c.style!=="none"&&c.style!=="nil"))return null;let i=n.offsetFrom??"text",a=ue(n.top),l=ue(n.right),d=ue(n.bottom),f=ue(n.left),s=o.createElement("div");return s.className="layout-page-border",s.style.position="absolute",s.style.pointerEvents="none",s.style.boxSizing="border-box",s.style.zIndex=n.zOrder==="back"?"0":"20",i==="page"?(s.style.top=`${a}px`,s.style.right=`${l}px`,s.style.bottom=`${d}px`,s.style.left=`${f}px`):(s.style.top=`${Math.max(0,e.margins.top-a)}px`,s.style.right=`${Math.max(0,e.margins.right-l)}px`,s.style.bottom=`${Math.max(0,e.margins.bottom-d)}px`,s.style.left=`${Math.max(0,e.margins.left-f)}px`),ye(s,n.top,"Top",t.theme),ye(s,n.bottom,"Bottom",t.theme),ye(s,n.left,"Left",t.theme),ye(s,n.right,"Right",t.theme),s}function en(e,t){let o=t.margins;e.style.position="absolute",e.style.top=`${o.top}px`,e.style.left=`${o.left}px`,e.style.right=`${o.right}px`,e.style.bottom=`${o.bottom}px`,e.style.overflow="visible";}function tn(e,t,o){e.style.position="absolute",e.style.left=`${t.x-o.left}px`,e.style.top=`${t.y-o.top}px`,e.style.width=`${t.width}px`,"height"in t&&(e.style.height=`${t.height}px`);}function nn(e,t,o,n){let r=[];for(let i of e.runs){if(i.kind!=="image")continue;let a=i;if(!M(a))continue;let l=a.distTop??0,d=a.distBottom??0,f=a.distLeft??12,s=a.distRight??12,{x:c,y:T,side:b}=Re(a,t,o,n);r.push({src:a.src,width:a.width,height:a.height,alt:a.alt,transform:a.transform,side:b,x:c,y:T,distTop:l,distBottom:d,distLeft:f,distRight:s,pmStart:a.pmStart,pmEnd:a.pmEnd,wrapText:re(a.cssFloat),wrapType:a.wrapType,cropTop:a.cropTop,cropRight:a.cropRight,cropBottom:a.cropBottom,cropLeft:a.cropLeft,opacity:a.opacity});}return r}function he(e,t,o={}){let n=o.document??document,r=n.createElement("div");r.className=o.pageClassName??N.page,r.dataset.pageNumber=String(e.number),te(r,e.size.w,e.size.h,o);let i=Qt(e,o,n);i&&o.pageBorders?.zOrder==="back"&&r.appendChild(i);let a=n.createElement("div");a.className=N.content,en(a,e);let l=et(e),d=l.contentWidth,f=[],s=[];for(let p of e.fragments)if(p.kind==="paragraph"&&o.blockLookup){let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind==="paragraph"){let u=y.block,S=p.y-e.margins.top,w=nn(u,S,d,l);f.push(...w);}}for(let p of f)Z(p)&&s.push({side:p.side,x:p.x,y:p.y,width:p.width,height:p.height,distTop:p.distTop,distBottom:p.distBottom,distLeft:p.distLeft,distRight:p.distRight,wrapText:p.wrapText,wrapType:p.wrapType});if(o.blockLookup)for(let p of e.fragments){if(p.kind!=="table")continue;let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind!=="table")continue;let S=y.block.floating;if(!S)continue;let w=p.x-e.margins.left,F=p.y-e.margins.top,I=S.topFromText??0,R=S.bottomFromText??0,x=S.leftFromText??12,k=S.rightFromText??12,P=w<d/2?"left":"right";s.push({side:P,x:w,y:F,width:p.width,height:p.height,distTop:I,distBottom:R,distLeft:x,distRight:k});}if(o.blockLookup)for(let p of e.fragments){if(p.kind!=="textBox")continue;let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind!=="textBox")continue;let u=y.block;if(!chunk44RUAQA2_js.g(u))continue;let S=p.y-e.margins.top,w=Re({width:p.width,height:p.height,position:u.position,cssFloat:u.cssFloat},S,d,l);p.x=e.margins.left+w.x,p.y=e.margins.top+w.y,chunk44RUAQA2_js.h(u)&&s.push({side:w.side,x:w.x,y:w.y,width:p.width,height:p.height,distTop:u.distTop??0,distBottom:u.distBottom??0,distLeft:u.distLeft??12,distRight:u.distRight??12,wrapText:u.wrapText,wrapType:u.wrapType});}let c=s.length>0?chunkTZJUO3NW_js.p(s,d):[],T=f.filter(Y),b=f.filter(p=>!Y(p));if(T.length>0){let p=U(T,n,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"behind"});a.appendChild(p);}let m=p=>{if(p.kind!=="paragraph"||!o.blockLookup||!p.blockId)return;let y=o.blockLookup.get(String(p.blockId));if(y?.block.kind==="paragraph")return y.block.attrs?.borders},h,g=new Map;for(let p=0;p<e.fragments.length;p++){let y=e.fragments[p],u,S={...t,section:"body",contentWidth:d},w=y.y-e.margins.top;if(o.blockLookup&&y.blockId){let F=o.blockLookup.get(String(y.blockId));if(y.kind==="paragraph"&&F?.block.kind==="paragraph"&&F?.measure.kind==="paragraph"){let I=F.block,R=p+1<e.fragments.length?m(e.fragments[p+1]):void 0,x=String(y.blockId),k=g.get(x);k||(k=new Set,g.set(x,k));let P=F.measure;c.length>0&&(P=chunkTZJUO3NW_js.s(I,d,{floatingZones:c,paragraphYOffset:w})),u=$(y,I,P,S,{document:n,prevBorders:h,nextBorders:R,renderedInlineImageKeys:k}),h=I.attrs?.borders;}else y.kind==="table"&&F?.block.kind==="table"&&F?.measure.kind==="table"?(u=X(y,F.block,F.measure,S,{document:n}),h=void 0):y.kind==="image"&&F?.block.kind==="image"&&F?.measure.kind==="image"?(u=ie(y,F.block,F.measure,S,{document:n}),h=void 0):y.kind==="textBox"&&F?.block.kind==="textBox"&&F?.measure.kind==="textBox"?(u=ce(y,F.block,F.measure,S,{document:n}),h=void 0):(u=we(y,S,{document:n}),h=void 0);}else u=we(y,S,{document:n}),h=void 0;tn(u,y,{left:e.margins.left,top:e.margins.top}),a.appendChild(u);}if(b.length>0){let p=U(b,n,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"front"});a.appendChild(p);}if(e.columns&&e.columns.separator&&e.columns.count>1){let p=e.columns.count,y=e.columns.gap,u=(d-(p-1)*y)/p,S=e.size.h-e.margins.top-e.margins.bottom;for(let w=0;w<p-1;w++){let F=(w+1)*u+w*y+y/2,I=n.createElement("div");I.style.position="absolute",I.style.left=`${F}px`,I.style.top="0",I.style.height=`${S}px`,I.style.width="0.5px",I.style.backgroundColor="#000",I.style.pointerEvents="none",a.appendChild(I);}}if(o.footnoteArea&&o.footnoteArea.length>0){let p=at(o.footnoteArea,d,t,n);p.style.position="absolute";let y=Math.max(e.footnoteReservedHeight??0,it(o.footnoteArea)),u=e.size.h-e.margins.bottom-e.margins.top;p.style.top=`${Math.max(-e.margins.top,u-y)}px`,p.style.left="0",p.style.right="0",a.appendChild(p);}r.appendChild(a);{let y=o.headerDistance??e.margins.header??48,u=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.top-y,48),w=o.headerContent?.visualTop??0,F=o.headerContent?.visualBottom??o.headerContent?.height??0,I=Math.max(F-w,24),R=F>S,x=n.createElement("div");x.className=N.header,x.style.position="absolute",x.style.top=`${y+w}px`,x.style.left=`${e.margins.left}px`,x.style.right=`${e.margins.right}px`,x.style.width=`${u}px`,x.style.height=`${I}px`,x.style.minHeight=`${I}px`;let k=!R;if(o.headerContent&&o.headerContent.blocks.length>0){let P={flowTop:y,flowLeft:e.margins.left,contentWidth:u,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},C=Pe(o.headerContent,{...t,section:"header",contentWidth:u},o,P);C.style.top=`${-w}px`,C.querySelector("img")&&(k=false),x.appendChild(C);}k&&(x.style.maxHeight=`${S}px`,x.style.overflow="hidden"),r.appendChild(x);}{let y=o.footerDistance??e.margins.footer??48,u=e.size.w-e.margins.left-e.margins.right,S=Math.max(e.margins.bottom-y,48),w=o.footerContent?.visualTop??0,F=o.footerContent?.visualBottom??o.footerContent?.height??0,I=Math.max(F-w,24),R=I>S,x=n.createElement("div");x.className=N.footer,x.style.position="absolute",x.style.top=`${e.size.h-y-I}px`,x.style.left=`${e.margins.left}px`,x.style.right=`${e.margins.right}px`,x.style.width=`${u}px`,x.style.height=`${I}px`,x.style.minHeight=`${I}px`;let k=!R;if(o.footerContent&&o.footerContent.blocks.length>0){let P={flowTop:e.size.h-y-(o.footerContent?.height??0),flowLeft:e.margins.left,contentWidth:u,pageWidth:e.size.w,pageHeight:e.size.h,margins:e.margins},C=Pe(o.footerContent,{...t,section:"footer",contentWidth:u},o,P);C.style.top=`${-w}px`,C.querySelector("img")&&(k=false),x.appendChild(C);}k&&(x.style.maxHeight=`${S}px`,x.style.overflow="hidden"),r.appendChild(x);}return i&&o.pageBorders?.zOrder!=="back"&&r.appendChild(i),r}exports.A=ce;exports.B=nt;exports.C=Xt;exports.D=N;exports.E=te;exports.F=he;exports.a=fe;exports.b=ot;exports.c=_t;exports.d=Xn;exports.e=Le;exports.f=Wt;exports.g=Gt;exports.h=Zn;exports.i=rt;exports.j=qn;exports.k=Jn;exports.l=V;exports.m=we;exports.n=Z;exports.o=Y;exports.p=M;exports.q=ht;exports.r=Ke;exports.s=ie;exports.t=Je;exports.u=de;exports.v=$;exports.w=U;exports.x=O;exports.y=X;exports.z=vt;