@eigenpal/docx-js-editor 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/{ClipboardManager-Bbo5MM_U.d.cts → ClipboardManager-BYO62Qs5.d.cts} +1 -1
- package/dist/{ClipboardManager-CR843H7H.d.ts → ClipboardManager-YQYq5X_Z.d.ts} +1 -1
- package/dist/{DocumentAgent-lHtXgMFN.d.ts → DocumentAgent-BW1-gnqM.d.ts} +1 -1
- package/dist/{DocumentAgent-cHf96hwL.d.cts → DocumentAgent-ZcA8CUmC.d.cts} +1 -1
- package/dist/{agentApi-DmDuQm0e.d.cts → agentApi-B0688ssC.d.cts} +6 -0
- package/dist/{agentApi-DmDuQm0e.d.ts → agentApi-B0688ssC.d.ts} +6 -0
- package/dist/{chunk-R56SLH64.js → chunk-4XF5YD4I.js} +4 -4
- package/dist/chunk-76GITSCY.cjs +258 -0
- package/dist/chunk-7YCCCWUZ.cjs +3 -0
- package/dist/{chunk-6TUCNECX.js → chunk-ABNIHWGF.js} +1 -1
- package/dist/{chunk-PIVLDW7B.cjs → chunk-CL62W2HQ.cjs} +7 -7
- package/dist/chunk-E7U5ZBOK.js +3 -0
- package/dist/{chunk-3C2VHZX6.cjs → chunk-EUH3GF72.cjs} +4 -4
- package/dist/chunk-H7AKDCWH.js +258 -0
- package/dist/{chunk-5ILXHRJS.cjs → chunk-J5YOIHCW.cjs} +2 -2
- package/dist/chunk-JO2CKU4O.js +1 -0
- package/dist/chunk-MHUCHYNM.cjs +59 -0
- package/dist/{chunk-KL2RYY6G.cjs → chunk-NKW2UER2.cjs} +2 -2
- package/dist/chunk-OJ7NJK46.cjs +1 -0
- package/dist/chunk-PP54GVGD.js +59 -0
- package/dist/{chunk-JIKVCUR6.js → chunk-T2SRPPZY.js} +1 -1
- package/dist/{chunk-3X3LTNK4.js → chunk-YP3CXYSU.js} +7 -7
- package/dist/{clipboard-DriRE6eS.d.ts → clipboard-D0EG6AxE.d.ts} +2 -155
- package/dist/{clipboard-Bj2X5pLO.d.cts → clipboard-Da1iPK0O.d.cts} +2 -155
- package/dist/{colorResolver-yl7Xh_Qg.d.cts → colorResolver-DR1p8Eg-.d.cts} +2 -2
- package/dist/{colorResolver-BTTqW66Q.d.ts → colorResolver-Dk7bMHIa.d.ts} +2 -2
- package/dist/core-plugins-reexport.cjs +1 -1
- package/dist/core-plugins-reexport.d.cts +4 -4
- package/dist/core-plugins-reexport.d.ts +4 -4
- package/dist/core-plugins-reexport.js +1 -1
- package/dist/core-reexport.cjs +1 -1
- package/dist/core-reexport.d.cts +10 -10
- package/dist/core-reexport.d.ts +10 -10
- package/dist/core-reexport.js +1 -1
- package/dist/{fontLoader-Daq8y8C2.d.cts → fontLoader-54sS8rtN.d.cts} +1 -1
- package/dist/{fontLoader-DQJOS1sb.d.ts → fontLoader-C7RvUiHx.d.ts} +1 -1
- package/dist/headless-reexport.cjs +2 -2
- package/dist/headless-reexport.d.cts +7 -7
- package/dist/headless-reexport.d.ts +7 -7
- package/dist/headless-reexport.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +98 -15
- package/dist/index.d.ts +98 -15
- package/dist/index.js +6 -6
- package/dist/mcp-reexport.cjs +3 -3
- package/dist/mcp-reexport.d.cts +2 -2
- package/dist/mcp-reexport.d.ts +2 -2
- package/dist/mcp-reexport.js +1 -1
- package/dist/{react-BYRZYSPG.d.cts → react-C_O0Z9ci.d.ts} +20 -12
- package/dist/{react-Bj9uDtjg.d.ts → react-XjilVrXZ.d.cts} +20 -12
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +1 -1
- package/dist/{registry-C2DPl-QW.d.ts → registry-BHOeZbR9.d.ts} +1 -1
- package/dist/{registry-CXGC344v.d.cts → registry-CqFFeBgF.d.cts} +1 -1
- package/dist/selectionRects-BMXJJCPJ.cjs +1 -0
- package/dist/selectionRects-TWK7CAC3.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/{types-BpokDLqL.d.ts → types-BwCYaZKB.d.ts} +1 -1
- package/dist/{types-COQvtZji.d.cts → types-DAxXgYu5.d.cts} +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.cts +6 -5
- package/dist/ui.d.ts +6 -5
- package/dist/ui.js +1 -1
- package/dist/{variableDetector-BYzE_RXw.d.ts → variableDetector-B2FHghLx.d.ts} +1 -1
- package/dist/{variableDetector-C8ST_dnq.d.cts → variableDetector-DIeB1Nxd.d.cts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-2JOQ7WKO.js +0 -258
- package/dist/chunk-4CUGBNL2.cjs +0 -1
- package/dist/chunk-5GFXHUMP.js +0 -1
- package/dist/chunk-C6ELWJWO.js +0 -3
- package/dist/chunk-I5YZ4MRV.cjs +0 -3
- package/dist/chunk-PGEORVCG.js +0 -59
- package/dist/chunk-PUVSVHHB.cjs +0 -59
- package/dist/chunk-RHLMVYVZ.cjs +0 -258
- package/dist/selectionRects-7QU337P5.cjs +0 -1
- package/dist/selectionRects-V5RC2BYX.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';var chunkB7TICMXD_cjs=require('./chunk-B7TICMXD.cjs'),
|
|
1
|
+
'use strict';var chunkB7TICMXD_cjs=require('./chunk-B7TICMXD.cjs'),chunkCL62W2HQ_cjs=require('./chunk-CL62W2HQ.cjs');function H(e){return g(e).variables}function g(e){let t=[],n={body:[],headers:[],footers:[],footnotes:[],endnotes:[],textBoxes:[]};if(e.package?.document){let r=$(e.package.document);r.forEach(o=>{t.push({name:o,location:"body"});}),n.body=Array.from(new Set(r)).sort();}if(e.package?.document?.sections&&e.package.document.sections.forEach((r,o)=>{r.properties.headerReferences&&r.properties.headerReferences.forEach(i=>{});}),e.package?.footnotes){let r=D(e.package.footnotes);r.forEach(o=>{t.push({name:o,location:"footnote"});}),n.footnotes=Array.from(new Set(r)).sort();}if(e.package?.endnotes){let r=D(e.package.endnotes);r.forEach(o=>{t.push({name:o,location:"endnote"});}),n.endnotes=Array.from(new Set(r)).sort();}e.templateVariables&&e.templateVariables.forEach(r=>{t.some(o=>o.name===r)||t.push({name:r,location:"body"});});let a=new Set;return t.forEach(r=>a.add(r.name)),{variables:Array.from(a).sort(),totalOccurrences:t.length,byLocation:n,occurrences:t}}function $(e){let t=[];if(e.content&&t.push(...R(e.content)),e.sections)for(let n of e.sections)n.content&&t.push(...R(n.content));return t}function R(e){let t=[];for(let n of e)n.type==="paragraph"?t.push(...b(n)):n.type==="table"&&t.push(...P(n));return t}function b(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="run"?t.push(...d(n)):n.type==="hyperlink"?t.push(...J(n)):n.type==="simpleField"?t.push(...L(n)):n.type==="complexField"&&t.push(...F(n));return t}function d(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="text"&&n.text&&t.push(...E(n.text));return t}function J(e){let t=[];if(!e.children)return t;for(let n of e.children)n.type==="run"&&t.push(...d(n));return t}function L(e){let t=[];if(e.instruction&&t.push(...E(e.instruction)),e.content)for(let n of e.content)n.type==="run"&&t.push(...d(n));return t}function F(e){let t=[];if(e.fieldCode)for(let n of e.fieldCode)n.type==="run"&&t.push(...d(n));if(e.fieldResult)for(let n of e.fieldResult)n.type==="run"&&t.push(...d(n));return t}function P(e){let t=[];if(!e.rows)return t;for(let n of e.rows)if(n.cells)for(let a of n.cells)t.push(...B(a));return t}function B(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="paragraph"?t.push(...b(n)):n.type==="table"&&t.push(...P(n));return t}function D(e){let t=[];for(let n of e)if(n.content)for(let a of n.content)t.push(...b(a));return t}var k=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g,M=/\{(.+?)\}/g;function E(e){if(!e)return [];let t=[],n=new RegExp(k),a;for(;(a=n.exec(e))!==null;)t.push(a[1]);return t}function q(e){return k.test(e)}function U(e){return !(!e||typeof e!="string"||e.length===0||e.length>100||!/^[a-zA-Z_]/.test(e)||!/^[a-zA-Z_][a-zA-Z0-9_\-\.]*$/.test(e))}function X(e){if(!e)return "";let t=e.replace(/\s+/g,"_");return t=t.replace(/[^a-zA-Z0-9_\-\.]/g,""),t&&!/^[a-zA-Z_]/.test(t)&&(t="_"+t),t.substring(0,100)}function G(e){return `{${e}}`}function K(e){let t=e.match(/^\{(.+?)\}$/);return t?t[1]:null}function Q(e,t){return e&&e.replace(M,(n,a)=>{let r=a.trim();return r in t?t[r]:n})}function Y(e,t=""){return e&&e.replace(M,t)}function ee(e){return H(e).length>0}function Z(e){return typeof e=="object"&&e!==null&&("_def"in e||"parse"in e||"safeParse"in e)}function h(e,t){let n=t,{position:a,variableName:r}=n,o=JSON.parse(JSON.stringify(e)),s=o.package.document.content.filter(u=>u.type==="paragraph");if(a.paragraphIndex>=s.length)throw new Error(`Paragraph index ${a.paragraphIndex} out of bounds`);let c=s[a.paragraphIndex],l=`{${r}}`;return S(c,a.offset,l),o.templateVariables||(o.templateVariables=[]),o.templateVariables.includes(r)||o.templateVariables.push(r),o}function y(e,t){let n=t,{range:a,variableName:r}=n,o=JSON.parse(JSON.stringify(e)),s=o.package.document.content.filter(u=>u.type==="paragraph");if(a.start.paragraphIndex!==a.end.paragraphIndex)throw new Error("Template variable replacement cannot span multiple paragraphs");if(a.start.paragraphIndex>=s.length)throw new Error(`Paragraph index ${a.start.paragraphIndex} out of bounds`);let c=s[a.start.paragraphIndex];z(c,a.start.offset,a.end.offset);let l=`{${r}}`;return S(c,a.start.offset,l),o.templateVariables||(o.templateVariables=[]),o.templateVariables.includes(r)||o.templateVariables.push(r),o}function S(e,t,n){let a=0,r=false;for(let o=0;o<e.content.length;o++){let i=e.content[o];if(i.type==="run"){let s=x(i),c=a,l=a+s.length;if(!r&&t>=c&&t<=l){let u=t-c,v=s.slice(0,u),V=s.slice(u),m=[];for(let p=0;p<o;p++)m.push(e.content[p]);v&&m.push({type:"run",formatting:i.formatting,content:[{type:"text",text:v}]}),m.push({type:"run",formatting:i.formatting,content:[{type:"text",text:n}]}),V&&m.push({type:"run",formatting:i.formatting,content:[{type:"text",text:V}]});for(let p=o+1;p<e.content.length;p++)m.push(e.content[p]);e.content=m,r=true;break}a=l;}else if(i.type==="hyperlink")for(let s of i.children)s.type==="run"&&(a+=x(s).length);}r||e.content.push({type:"run",content:[{type:"text",text:n}]});}function z(e,t,n){let a=[],r=0;for(let o of e.content)if(o.type==="run"){let i=x(o),s=r,c=r+i.length;if(c<=t||s>=n)a.push(o);else {let l="";s<t&&(l+=i.slice(0,t-s)),c>n&&(l+=i.slice(n-s)),l.length>0&&a.push({type:"run",formatting:o.formatting,content:[{type:"text",text:l}]});}r=c;}else a.push(o);e.content=a;}function x(e){return e.content.filter(t=>t.type==="text").map(t=>t.text).join("")}var f={type:"string",description:"Document ID from a previous docx_load call"},j={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)"},offset:{type:"number",description:"Character offset within the paragraph"}},required:["paragraphIndex","offset"]},_={name:"docx_get_variables",description:`List all template variables ({name} format) found in the document.
|
|
2
2
|
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
3
|
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId:f},required:["documentId"]},handler:async(e,t)=>{let{documentId:n}=e,a=t.session.documents.get(n);if(!a)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};try{let r=g(a.document);return {content:[{type:"text",text:JSON.stringify({variables:r.variables,count:r.variables.length,totalOccurrences:r.totalOccurrences,byLocation:r.byLocation},null,2)}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to detect variables: ${r.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low",examples:[{description:"Get all variables from a loaded document",input:{documentId:"doc_123"},output:'{"variables": ["customer_name", "invoice_date"], "count": 2}'}]}},A={name:"docx_insert_variable",description:`Insert a template variable placeholder ({name}) at a specific position in the document.
|
|
4
4
|
The variable can later be substituted with actual values using docx_apply_template.
|
|
5
5
|
Variable names should follow the pattern: letters, numbers, underscores, starting with a letter.`,inputSchema:{type:"object",properties:{documentId:f,position:j,variableName:{type:"string",description:'Variable name without braces (e.g., "customer_name"). Will be inserted as {customer_name}',pattern:"^[a-zA-Z_][a-zA-Z0-9_]*$"}},required:["documentId","position","variableName"]},handler:async(e,t)=>{let{documentId:n,position:a,variableName:r}=e,o=t.session.documents.get(n);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};if(!/^[a-zA-Z_][a-zA-Z0-9_\-.]*$/.test(r))return {isError:true,content:[{type:"text",text:`Invalid variable name: ${r}. Must start with letter/underscore and contain only alphanumeric, underscore, hyphen, or dot.`}]};try{let{executeCommand:i}=await import('./executor-JGWZ7S6Z.cjs'),s=i(o.document,{type:"insertText",position:a,text:`{${r}}`});return o.document=s,o.lastModified=Date.now(),s.templateVariables||(s.templateVariables=[]),s.templateVariables.includes(r)||s.templateVariables.push(r),{content:[{type:"text",text:JSON.stringify({success:!0,variable:r,insertedAs:`{${r}}`,position:a})}]}}catch(i){return {isError:true,content:[{type:"text",text:`Failed to insert variable: ${i.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"low",examples:[{description:"Insert customer name variable at start of first paragraph",input:{documentId:"doc_123",position:{paragraphIndex:0,offset:0},variableName:"customer_name"}}]}},O={name:"docx_apply_template",description:`Substitute template variables with actual values in the document.
|
|
6
6
|
Replaces all {variable} placeholders with the corresponding values provided.
|
|
7
7
|
Preserves all formatting (fonts, styles, colors, tables).
|
|
8
|
-
Use docx_get_variables first to discover what variables exist in the document.`,inputSchema:{type:"object",properties:{documentId:f,variables:{type:"object",description:'Map of variable names to values (e.g., {"customer_name": "John Doe", "date": "2024-01-15"})',additionalProperties:{type:"string"}},keepUnmatchedVariables:{type:"boolean",description:"If true, keep {variable} placeholders for variables not in the map. If false, replace with empty string. Default: true",default:true}},required:["documentId","variables"]},handler:async(e,t)=>{let{documentId:n,variables:a,keepUnmatchedVariables:r=true}=e,o=t.session.documents.get(n);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};if(!o.buffer)return {isError:true,content:[{type:"text",text:"Cannot apply template: document was not loaded from a DOCX buffer"}]};try{let i=chunkB7TICMXD_cjs.b(o.buffer,a,{nullGetter:r?"keep":"empty"}),s=await
|
|
8
|
+
Use docx_get_variables first to discover what variables exist in the document.`,inputSchema:{type:"object",properties:{documentId:f,variables:{type:"object",description:'Map of variable names to values (e.g., {"customer_name": "John Doe", "date": "2024-01-15"})',additionalProperties:{type:"string"}},keepUnmatchedVariables:{type:"boolean",description:"If true, keep {variable} placeholders for variables not in the map. If false, replace with empty string. Default: true",default:true}},required:["documentId","variables"]},handler:async(e,t)=>{let{documentId:n,variables:a,keepUnmatchedVariables:r=true}=e,o=t.session.documents.get(n);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};if(!o.buffer)return {isError:true,content:[{type:"text",text:"Cannot apply template: document was not loaded from a DOCX buffer"}]};try{let i=chunkB7TICMXD_cjs.b(o.buffer,a,{nullGetter:r?"keep":"empty"}),s=await chunkCL62W2HQ_cjs.n(i.buffer);return o.document=s,o.buffer=i.buffer,o.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedVariables:i.replacedVariables,unreplacedVariables:i.unreplacedVariables,warnings:i.warnings})}]}}catch(i){return {isError:true,content:[{type:"text",text:`Failed to apply template: ${i.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"medium",examples:[{description:"Fill in customer and date values",input:{documentId:"doc_123",variables:{customer_name:"Jane Smith",invoice_date:"2024-02-15",amount:"$1,234.56"}}}]}},N={name:"docx_validate_template",description:`Validate that a document is a valid docxtemplater template.
|
|
9
9
|
Checks for syntax errors like unclosed braces, invalid tag names, etc.
|
|
10
10
|
Returns validation result with any errors found and list of valid tags.`,inputSchema:{type:"object",properties:{documentId:f},required:["documentId"]},handler:async(e,t)=>{let{documentId:n}=e,a=t.session.documents.get(n);if(!a)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};if(!a.buffer)return {isError:true,content:[{type:"text",text:"Cannot validate template: document was not loaded from a DOCX buffer"}]};try{let r=chunkB7TICMXD_cjs.f(a.buffer);return {content:[{type:"text",text:JSON.stringify({valid:r.valid,tags:r.tags,errors:r.errors.map(o=>({message:o.message,variable:o.variable,type:o.type}))},null,2)}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to validate template: ${r.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low"}},T=[_,A,O,N];var W={id:"docxtemplater",name:"Docxtemplater",version:"1.0.0",description:"Template variable support using standard docxtemplater syntax ({variable})",commandHandlers:{insertTemplateVariable:h,replaceWithTemplateVariable:y},mcpTools:T};exports.a=H;exports.b=g;exports.c=$;exports.d=b;exports.e=E;exports.f=q;exports.g=U;exports.h=X;exports.i=G;exports.j=K;exports.k=Q;exports.l=Y;exports.m=ee;exports.n=Z;exports.o=W;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function ae(e,t,r,n){let a=e-t-r,o=(n.count-1)*n.gap;return (a-o)/n.count}function U(e){let{pageSize:t,margins:r}=e,n=e.columns??{count:1,gap:0},a=[],o=[],c=r.top,i=t.h-r.bottom;if(i-c<=0)throw new Error("Paginator: page size and margins yield no content area");let u=ae(t.w,r.left,r.right,n),g=c;function l(p){return r.left+p*(u+n.gap)}function m(){let p=a.length+1,S=e.footnoteReservedHeights?.get(p)??0,T=i-S,w={number:p,fragments:[],margins:{...r},size:{...t},footnoteReservedHeight:S>0?S:void 0,columns:n.count>1?{...n}:void 0},C={page:w,cursorY:c,columnIndex:0,topMargin:c,contentBottom:T,trailingSpacing:0};return a.push(w),o.push(C),g=c,e.onNewPage&&e.onNewPage(C),C}function f(){return o.length===0?m():o[o.length-1]}function x(p){return p.contentBottom-p.cursorY}function h(p,S){let T=S||f();return x(T)>=p}function b(p){return p.columnIndex<n.count-1?(p.columnIndex+=1,p.cursorY=g,p.trailingSpacing=0,p):m()}function d(p){let S=f(),T=Number.isFinite(p)&&p>0?p:0,w=S.contentBottom-S.topMargin;if(T>w)return S.cursorY!==S.topMargin&&(S=b(S)),S;for(;!h(T,S);)S=b(S);return S}function k(p,S,T=0,w=0){let C=Math.max(T,f().trailingSpacing),R=C+S,I=d(R),H=I.cursorY===I.topMargin?0:C,L=l(I.columnIndex),B=I.cursorY+H;return p.x=L,p.y=B,I.page.fragments.push(p),I.cursorY=B+S,I.trailingSpacing=w,{state:I,x:L,y:B}}function y(){return m()}function F(){let p=f();return b(p)}function M(p){n=p,u=ae(t.w,r.left,r.right,n);let S=f();S.page.columns=n.count>1?{...n}:void 0,g=S.cursorY,S.columnIndex=0;}return {pages:a,states:o,get columnWidth(){return u},get columns(){return {...n}},getCurrentState:f,getAvailableHeight:()=>x(f()),fits:p=>h(p),ensureFits:d,addFragment:k,forcePageBreak:y,forceColumnBreak:F,getColumnX:l,updateColumns:M}}function j(e){let t=new Map,r=new Set;for(let n=0;n<e.length;n++){if(r.has(n))continue;let a=e[n];if(a.kind!=="paragraph"||!a.attrs?.keepNext)continue;let c=[n],i=n;for(let g=n+1;g<e.length;g++){let l=e[g];if(l.kind==="sectionBreak"||l.kind==="pageBreak"||l.kind==="columnBreak"||l.kind!=="paragraph")break;if(l.attrs?.keepNext)c.push(g),i=g,r.add(g);else break}let s=i+1,u=-1;if(s<e.length){let g=e[s];g.kind!=="sectionBreak"&&g.kind!=="pageBreak"&&g.kind!=="columnBreak"&&(u=s);}t.set(n,{startIndex:n,endIndex:i,memberIndices:c,anchorIndex:u});}return t}function q(e,t,r){let n=0;for(let a of e.memberIndices){let o=t[a],c=r[a];if(o.kind!=="paragraph"||c.kind!=="paragraph")continue;let i=o,s=c,u=i.attrs?.spacing?.before??0;n+=u,n+=s.totalHeight;let g=i.attrs?.spacing?.after??0;n+=g;}if(e.anchorIndex!==-1){let a=r[e.anchorIndex];if(a?.kind==="paragraph"){let o=a;o.lines.length>0&&(n+=o.lines[0].lineHeight);}}return n}function K(e){let t=new Set;for(let r of e.values())for(let n=1;n<r.memberIndices.length;n++)t.add(r.memberIndices[n]);return t}function $(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var We={top:4,bottom:4,left:7,right:7},Ue=200;var Be={w:816,h:1056},O={top:96,right:96,bottom:96,left:96};function ie(e){return e.attrs?.spacing?.before??0}function se(e){return e.attrs?.spacing?.after??0}function Fe(e){for(let t=0;t<e.length-1;t++){let r=e[t],n=e[t+1];if(r.kind!=="paragraph"||n.kind!=="paragraph")continue;let a=r.attrs,o=n.attrs;a?.contextualSpacing&&o?.contextualSpacing&&a.styleId&&a.styleId===o.styleId&&(a.spacing&&(a.spacing={...a.spacing,after:0}),o.spacing&&(o.spacing={...o.spacing,before:0}));}}function rt(e,t,r={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let n=r.pageSize??Be,a={top:r.margins?.top??O.top,right:r.margins?.right??O.right,bottom:r.margins?.bottom??O.bottom,left:r.margins?.left??O.left,header:r.margins?.header??r.margins?.top??O.top,footer:r.margins?.footer??r.margins?.bottom??O.bottom};r.headerContentHeights,r.footerContentHeights,r.titlePage,r.evenAndOddHeaders;let o={...a},c=n.w-o.left-o.right;if(c<=0)throw new Error("layoutDocument: page size and margins yield no content area");let i={count:1,gap:0},s=[],u=[];for(let h=0;h<e.length;h++)if(e[h].kind==="sectionBreak"){let b=e[h];s.push(b.columns??i),u.push(b.type);}s.push(r.columns??i),u.push(r.bodyBreakType);let g=s.length>0?s[0]:r.columns,l=U({pageSize:n,margins:o,columns:g,footnoteReservedHeights:r.footnoteReservedHeights});Fe(e);let m=j(e),f=K(m),x=0;for(let h=0;h<e.length;h++){let b=e[h],d=t[h];$(b)&&l.forcePageBreak();let k=m.get(h);if(k&&!f.has(h)){let y=q(k,e,t),F=l.getCurrentState(),M=l.getAvailableHeight(),p=F.contentBottom-F.topMargin;y<=p&&y>M&&F.page.fragments.length>0&&l.forcePageBreak();}switch(b.kind){case "paragraph":Me(b,d,l,c);break;case "table":b.floating?Te(b,d,l,c):we(b,d,l);break;case "image":Ce(b,d,l);break;case "textBox":Re(b,d,l);break;case "pageBreak":l.forcePageBreak();break;case "columnBreak":l.forceColumnBreak();break;case "sectionBreak":{let y=u[x+1]??u[x];Le(b,l,s[x+1]??i,y),x++;break}}}return l.pages.length===0&&l.getCurrentState(),{pageSize:n,pages:l.pages,columns:r.columns,pageGap:r.pageGap}}function Me(e,t,r,n){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let a=t.lines;if(a.length===0){let s=ie(e),u=se(e),g=r.getCurrentState(),l={kind:"paragraph",blockId:e.id,x:r.getColumnX(g.columnIndex),y:g.cursorY+s,width:n,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};r.addFragment(l,0,s,u);return}let o=ie(e),c=se(e),i=0;for(;i<a.length;){let s=r.getCurrentState(),u=r.getAvailableHeight(),g=0,l=0;for(let k=i;k<a.length;k++){let y=a[k].lineHeight,F=g+y;if((i===0&&k===i?F+o:F)<=u||l===0)g=F,l++;else break}let m=i===0,f=i+l>=a.length,x=m?o:0,h=f?c:0,b={kind:"paragraph",blockId:e.id,x:r.getColumnX(s.columnIndex),y:0,width:n,height:g,fromLine:i,toLine:i+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!m,continuesOnNext:!f},d=r.addFragment(b,g,x,h);b.y=d.y,i+=l,i<a.length&&r.ensureFits(a[i].lineHeight);}}function Pe(e){let t=0;for(let r of e.rows)if(r.isHeader)t++;else break;return t}function z(e,t){let r=0;for(let n=0;n<t&&n<e.rows.length;n++)r+=e.rows[n].height;return r}function we(e,t,r){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let n=t.rows;if(n.length===0)return;let a=Pe(e),o=z(t,a),c=0;for(;c<n.length;){let i=r.getCurrentState(),s=r.getAvailableHeight(),u=c===0,g=u?i.trailingSpacing:0,l=s-g,m=!u&&a>0?o:0,f=0,x=0;for(let F=c;F<n.length;F++){let M=n[F].height;if(f+M+m<=l||x===0)f+=M,x++;else break}let h=f+m,b=c+x>=n.length,d=r.getColumnX(i.columnIndex);e.justification==="center"?d=d+(r.columnWidth-t.totalWidth)/2:e.justification==="right"?d=d+r.columnWidth-t.totalWidth:e.indent&&(d+=e.indent);let k={kind:"table",blockId:e.id,x:d,y:0,width:t.totalWidth,height:h,fromRow:c,toRow:c+x,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!b,headerRowCount:!u&&a>0?a:void 0},y=r.addFragment(k,h,0,0);if(k.y=y.y,k.x=d,c+=x,c<n.length){let F=n[c].height+(a>0?o:0);r.ensureFits(F);}}}function Te(e,t,r,n){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let a=r.getCurrentState(),o=e.floating,c=a.page,i=c.margins,s=t.totalWidth,u=t.totalHeight,g=c.size.h-i.top-i.bottom,l=i.left,m=i.top;o?.horzAnchor==="page"&&(l=0),o?.vertAnchor==="page"&&(m=0);let f=r.getColumnX(a.columnIndex);if(o?.tblpX!==void 0)f=l+o.tblpX;else if(o?.tblpXSpec){let y=o.tblpXSpec;y==="left"||y==="inside"?f=l:y==="right"||y==="outside"?f=l+n-s:y==="center"&&(f=l+(n-s)/2);}else e.justification==="center"?f=l+(n-s)/2:e.justification==="right"&&(f=l+n-s);let x=a.cursorY,h=false;if(o?.tblpY!==void 0)x=m+o.tblpY,h=true;else if(o?.tblpYSpec){h=true;let y=o.tblpYSpec;y==="top"?x=m:y==="bottom"?x=m+g-u:y==="center"&&(x=m+(g-u)/2);}h||(x=r.ensureFits(u).cursorY);let b=i.left,d=i.left+n-s;Number.isFinite(d)&&(f=Math.max(b,Math.min(f,d)));let k={kind:"table",blockId:e.id,x:f,y:x,width:s,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};a.page.fragments.push(k);}function Ce(e,t,r){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Ie(e,t,r);return}let n=r.ensureFits(t.height),a={kind:"image",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Ie(e,t,r){let n=r.getCurrentState(),a=e.anchor,o=a.offsetH??r.getColumnX(n.columnIndex),c=a.offsetV??n.cursorY,i={kind:"image",blockId:e.id,x:o,y:c,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:a.behindDoc?-1:1};n.page.fragments.push(i);}function Re(e,t,r){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");let n=r.ensureFits(t.height),a={kind:"textBox",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Le(e,t,r,n){switch(n??"nextPage"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}t.updateColumns(r);}var ve={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1499},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1499},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},He={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function Ee(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function ce(e){let t=e.trim().toLowerCase(),r=ve[t];if(r)return {googleFont:r.googleFont,cssFallback:r.fallbackStack.map(le).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:r.singleLineRatio};let n=Ee(e),a=He[n];return {googleFont:null,cssFallback:`${le(e)}, ${a}`,originalFont:e,hasGoogleEquivalent:false,singleLineRatio:1.15}}function le(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function ct(e,t){if(!t)return null;let n=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!n)return null;let a=e.toLowerCase();return a.includes("eastasia")||a.includes("ea")?n.ea??n.latin??null:a.includes("cs")||a.includes("bidi")?n.cs??n.latin??null:n.latin??null}var ge=96,me=11,pe="Calibri",Ne=1,Oe=.8,ze=.2,_=null;function J(){if(!_){let e=typeof document<"u"?document.createElement("canvas"):null;if(!e)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(_=e.getContext("2d"),!_)throw new Error("Failed to get 2D context from canvas")}return _}function pt(){_=null;}var ue=new Map;function fe(e){let t=ue.get(e);if(t===void 0){let r=ce(e);t={cssFallback:r.cssFallback,singleLineRatio:r.singleLineRatio},ue.set(e,t);}return t}function _e(e){return fe(e).cssFallback}function V(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let r=e.fontSize??me,n=de(r);t.push(`${n}px`);let a=e.fontFamily??pe;return t.push(_e(a)),t.join(" ")}function Ye(e){let t=e.fontSize??me,r=e.fontFamily??pe,n=de(t),a=n*Oe,o=n*ze,c=n*Ne;try{let s=J();s.font=V(e);let u=s.measureText("Hg");typeof u.actualBoundingBoxAscent=="number"&&typeof u.actualBoundingBoxDescent=="number"&&(a=u.actualBoundingBoxAscent,o=u.actualBoundingBoxDescent);}catch{}c=Math.max(c,a+o);let i=fe(r).singleLineRatio;return {fontSize:t,ascent:a,descent:o,lineHeight:c,fontFamily:r,singleLineRatio:i}}function ft(e,t){if(!e)return 0;let r=J();r.font=V(t);let a=r.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function Q(e,t){let r=Ye(t);if(!e)return {width:0,charWidths:[],metrics:r};let n=J();n.font=V(t);let a=t.letterSpacing??0,o=[],c=0;for(let i=0;i<e.length;i++){let s=e[i],g=n.measureText(s).width;a&&i<e.length-1&&(g+=a),o.push(g),c+=g;}return {width:c,charWidths:o,metrics:r}}function dt(e,t){if(t.length===0||e<=0)return 0;let r=0;for(let n=0;n<t.length;n++){let a=t[n],o=r+a/2;if(e<=o)return n;r+=a;}return t.length}function de(e){return e*ge/72}function Z(e,t){let r=e.pageGap??0,n=0;for(let a=0;a<t&&a<e.pages.length;a++){let c=e.pages[a].size?.h??e.pageSize.h;n+=c+r;}return n}function he(e,t){return e.findIndex(r=>r.id===t)}function Xe(e,t){let r=0;for(let n=e.fromLine;n<e.toLine&&n<t.lines.length;n++)r+=t.lines[n].lineHeight;return r}function xt(e,t,r,n){let a=[...e.page.fragments].sort((o,c)=>{let i=o.y-c.y;return Math.abs(i)>.5?i:o.x-c.x});for(let o of a){let c=he(t,o.blockId);if(c===-1)continue;let i=t[c],s=r[c];if(!i||!s)continue;let u;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||s.kind!=="paragraph")continue;u=Xe(o,s);}else if(o.kind==="table")u=o.height;else if(o.kind==="image")u=o.height;else continue;let g=n.x>=o.x&&n.x<=o.x+o.width,l=n.y>=o.y&&n.y<=o.y+u;if(g&&l)return {fragment:o,block:i,measure:s,pageIndex:e.pageIndex,localX:n.x-o.x,localY:n.y-o.y}}return null}function kt(e,t,r,n){for(let a of e.page.fragments){if(a.kind!=="table")continue;let o=a,c=n.x>=o.x&&n.x<=o.x+o.width,i=n.y>=o.y&&n.y<=o.y+o.height;if(!c||!i)continue;let s=he(t,o.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="table"||!g||g.kind!=="table")continue;let l=u,m=g,f=n.x-o.x,x=n.y-o.y,h=o.headerRowCount??0,b=h>0&&o.continuesFromPrev?z(m,h):0,d=0,k=-1;if(m.rows.length===0||l.rows.length===0)continue;if(b>0&&x<b){let B=0;for(let P=0;P<h&&P<m.rows.length;P++){let E=m.rows[P];if(x>=B&&x<B+E.height){k=P;break}B+=E.height;}k===-1&&(k=0);}else {let B=x-b;for(let P=o.fromRow;P<o.toRow&&P<m.rows.length;P++){let E=m.rows[P];if(B>=d&&B<d+E.height){k=P;break}d+=E.height;}}if(k===-1&&(k=Math.min(o.toRow-1,m.rows.length-1),k<o.fromRow))continue;let y=m.rows[k],F=l.rows[k];if(!y||!F)continue;let M=0,p=-1;if(y.cells.length===0||F.cells.length===0)continue;for(let B=0;B<y.cells.length;B++){let P=y.cells[B];if(f>=M&&f<M+P.width){p=B;break}M+=P.width;}if(p===-1&&(p=y.cells.length-1,p<0))continue;let S=y.cells[p],T=F.cells[p];if(!S||!T)continue;let w=0;if(b>0&&k<h)for(let B=0;B<k;B++)w+=m.rows[B]?.height??0;else {w=b;for(let B=o.fromRow;B<k;B++)w+=m.rows[B]?.height??0;}let R=0;for(let B=0;B<p;B++)R+=y.cells[B]?.width??0;let I,v;if(T.blocks&&T.blocks.length>0){let B=T.blocks[0],P=S.blocks[0];B.kind==="paragraph"&&P?.kind==="paragraph"&&(I=B,v=P);}let H=f-R,L=x-w;return {fragment:o,block:l,measure:m,pageIndex:e.pageIndex,rowIndex:k,colIndex:p,cellBlock:I,cellMeasure:v,cellLocalX:Math.max(0,H),cellLocalY:Math.max(0,L)}}return null}function be(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(r=>r.id===t)}function D(e,t){let n=(e.pmStart??0)+1,a=0,o;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let u=e.runs[s];if(u){if(s<t.fromRun)u.kind==="text"?a+=(u.text??"").length:a+=1;else if(s===t.fromRun){a+=t.fromChar,o=n+a;break}}}o===void 0&&(o=n);let c=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let u=e.runs[s];if(u)if(u.kind==="text"){let g=u.text??"",l=s===t.fromRun?t.fromChar:0,m=s===t.toRun?t.toChar:g.length;c+=m-l;}else c+=1;}let i=o+c;return {pmStart:o,pmEnd:i}}function xe(e,t,r,n){let a=[];for(let o=0;o<t.lines.length;o++){let c=t.lines[o],i=D(e,c);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>r&&i.pmStart<n&&a.push({line:c,index:o});}return a}function Y(e,t,r){let n=D(e,t);return n.pmStart===void 0?0:Math.max(0,r-n.pmStart)}function X(e,t,r,n){let a=0,o=0;for(let c=t.fromRun;c<=t.toRun&&c<e.runs.length;c++){let i=e.runs[c];if(i){if(i.kind==="tab"){let s=i.width??48;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="image"){let s=i.width;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="lineBreak"){if(r<=o)return a;o+=1;continue}if(i.kind==="text"){let s=i.text??"",u=c===t.fromRun,g=c===t.toRun,l=u?t.fromChar:0,m=g?t.toChar:s.length,f=s.slice(l,m);if(o+f.length>=r){let b=r-o,d=be(i),k=Q(f.slice(0,b),d);return a+k.width}let x=be(i),h=Q(f,x);a+=h.width,o+=f.length;}}}return a}function G(e,t){let r=0;for(let n=0;n<t&&n<e.lines.length;n++)r+=e.lines[n].lineHeight;return r}function Mt(e,t,r,n,a){if(n===a)return [];let o=Math.min(n,a),c=Math.max(n,a),i=[];for(let s=0;s<e.pages.length;s++){let u=e.pages[s],g=Z(e,s);for(let l of u.fragments){if(l.kind==="paragraph"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let h=f,b=x,d=l,k=xe(h,b,o,c);for(let{line:y,index:F}of k){if(F<d.fromLine||F>=d.toLine)continue;let M=D(h,y);if(M.pmStart===void 0||M.pmEnd===void 0)continue;let p=Math.max(M.pmStart,o),S=Math.min(M.pmEnd,c);if(p>=S)continue;let T=Y(h,y,p),w=Y(h,y,S),C=h.attrs?.indent,R=C?.left??0,I=C?.right??0,v=Math.max(0,l.width-R-I),H=X(h,y,T),L=X(h,y,w),B=h.attrs?.alignment??"left",P=0;B==="center"?P=Math.max(0,(v-y.width)/2):B==="right"&&(P=Math.max(0,v-y.width));let E=G(b,F)-G(b,d.fromLine),A=l.x+R+P+Math.min(H,L),W=Math.max(1,Math.abs(L-H)),N=l.y+E;i.push({x:A,y:N+g,width:W,height:y.lineHeight,pageIndex:s});}}if(l.kind==="table"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="table"||!x||x.kind!=="table")continue;let h=f,b=x,d=l,k=d.headerRowCount??0,F=k>0&&d.continuesFromPrev?z(b,k):0;for(let M=d.fromRow;M<d.toRow&&M<h.rows.length;M++){let p=h.rows[M],S=b.rows[M];if(!p||!S)continue;let T=0;for(let w=0;w<p.cells.length;w++){let C=p.cells[w],R=S.cells[w];if(!(!C||!R)){for(let I=0;I<C.blocks.length;I++){let v=C.blocks[I],H=R.blocks[I];if(!v||v.kind!=="paragraph"||!H||H.kind!=="paragraph")continue;let L=v,B=H,P=xe(L,B,o,c),E=0;for(let{line:A,index:W}of P){let N=D(L,A);if(N.pmStart===void 0||N.pmEnd===void 0)continue;let te=Math.max(N.pmStart,o),ne=Math.min(N.pmEnd,c);if(te>=ne)continue;let ke=Y(L,A,te),ye=Y(L,A,ne),re=X(L,A,ke,R.width),oe=X(L,A,ye,R.width),Se=G(B,W);i.push({x:d.x+T+Math.min(re,oe),y:d.y+F+E+Se+g,width:Math.max(1,Math.abs(oe-re)),height:A.lineHeight,pageIndex:s});}E+=B.totalHeight;}T+=R.width;}}F+=S.height;}}if(l.kind==="image"){let m=l.pmStart??0;(l.pmEnd??m+1)>o&&m<c&&i.push({x:l.x,y:l.y+g,width:l.width,height:l.height,pageIndex:s});}}}return i}function Pt(e,t,r,n){for(let a=0;a<e.pages.length;a++){let o=e.pages[a],c=Z(e,a);for(let i of o.fragments){if(i.kind==="paragraph"){let s=ee(t,i.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="paragraph"||!g||g.kind!=="paragraph")continue;let l=u,m=g,f=i,x=l.pmStart??0,h=l.pmEnd??x;if(n<x||n>h)continue;for(let b=f.fromLine;b<f.toLine;b++){let d=m.lines[b];if(!d)continue;let k=D(l,d);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let y=Y(l,d,n),F=l.attrs?.indent,M=F?.left??0,p=F?.right??0,S=Math.max(0,i.width-M-p),T=X(l,d,y),w=l.attrs?.alignment??"left",C=0;w==="center"?C=Math.max(0,(S-d.width)/2):w==="right"&&(C=Math.max(0,S-d.width));let R=G(m,b)-G(m,f.fromLine);return {x:i.x+M+C+T,y:i.y+R+c,height:d.lineHeight,pageIndex:a}}}}if(i.kind==="image"){let s=i.pmStart??0,u=i.pmEnd??s+1;if(n>=s&&n<=u){let g=n===s?0:i.width;return {x:i.x+g,y:i.y+c,height:i.height,pageIndex:a}}}}}return null}function wt(e){return e.length<=1?false:new Set(e.map(r=>r.pageIndex)).size>1}function Tt(e){let t=new Map;for(let r of e){let n=t.get(r.pageIndex)??[];n.push(r),t.set(r.pageIndex,n);}return t}export{ce as a,ct as b,We as c,Ue as d,rt as e,pt as f,Ye as g,ft as h,Q as i,dt as j,de as k,xt as l,kt as m,Mt as n,Pt as o,wt as p,Tt as q};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';var chunkCL62W2HQ_cjs=require('./chunk-CL62W2HQ.cjs'),chunkXQNCLN4T_cjs=require('./chunk-XQNCLN4T.cjs'),chunkPCJ5ACUV_cjs=require('./chunk-PCJ5ACUV.cjs');function s(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var j=1e5;function X(){j=1e5;}function L(e){return e!=null&&e!==""&&e!==0?String(e):String(j++)}var fe=new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]);function ue(e){if(!e)return "";let t=[];return e.auto?t.push('w:val="auto"'):e.rgb&&t.push(`w:val="${e.rgb}"`),e.themeColor&&t.push(`w:themeColor="${e.themeColor}"`),e.themeTint&&t.push(`w:themeTint="${e.themeTint}"`),e.themeShade&&t.push(`w:themeShade="${e.themeShade}"`),t.length===0?"":`<w:color ${t.join(" ")}/>`}function me(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function b(e){if(!e)return "";let t=[];if(e.styleId&&t.push(`<w:rStyle w:val="${s(e.styleId)}"/>`),e.fontFamily){let i=[];e.fontFamily.ascii&&i.push(`w:ascii="${s(e.fontFamily.ascii)}"`),e.fontFamily.hAnsi&&i.push(`w:hAnsi="${s(e.fontFamily.hAnsi)}"`),e.fontFamily.eastAsia&&i.push(`w:eastAsia="${s(e.fontFamily.eastAsia)}"`),e.fontFamily.cs&&i.push(`w:cs="${s(e.fontFamily.cs)}"`),e.fontFamily.asciiTheme&&i.push(`w:asciiTheme="${e.fontFamily.asciiTheme}"`),e.fontFamily.hAnsiTheme&&i.push(`w:hAnsiTheme="${e.fontFamily.hAnsiTheme}"`),e.fontFamily.eastAsiaTheme&&i.push(`w:eastAsiaTheme="${e.fontFamily.eastAsiaTheme}"`),e.fontFamily.csTheme&&i.push(`w:csTheme="${e.fontFamily.csTheme}"`),i.length>0&&t.push(`<w:rFonts ${i.join(" ")}/>`);}e.bold===true?t.push("<w:b/>"):e.bold===false&&t.push('<w:b w:val="0"/>'),e.boldCs===true?t.push("<w:bCs/>"):e.boldCs===false&&t.push('<w:bCs w:val="0"/>'),e.italic===true?t.push("<w:i/>"):e.italic===false&&t.push('<w:i w:val="0"/>'),e.italicCs===true?t.push("<w:iCs/>"):e.italicCs===false&&t.push('<w:iCs w:val="0"/>'),e.allCaps&&t.push("<w:caps/>"),e.smallCaps&&t.push("<w:smallCaps/>"),e.strike&&t.push("<w:strike/>"),e.doubleStrike&&t.push("<w:dstrike/>"),e.outline&&t.push("<w:outline/>"),e.shadow&&t.push("<w:shadow/>"),e.emboss&&t.push("<w:emboss/>"),e.imprint&&t.push("<w:imprint/>"),e.hidden&&t.push("<w:vanish/>");let n=ue(e.color);if(n&&t.push(n),e.spacing!==void 0&&t.push(`<w:spacing w:val="${e.spacing}"/>`),e.scale!==void 0&&t.push(`<w:w w:val="${e.scale}"/>`),e.kerning!==void 0&&t.push(`<w:kern w:val="${e.kerning}"/>`),e.position!==void 0&&t.push(`<w:position w:val="${e.position}"/>`),e.fontSize!==void 0&&t.push(`<w:sz w:val="${e.fontSize}"/>`),e.fontSizeCs!==void 0&&t.push(`<w:szCs w:val="${e.fontSizeCs}"/>`),e.highlight&&e.highlight!=="none"){if(fe.has(e.highlight))t.push(`<w:highlight w:val="${e.highlight}"/>`);else if(!e.shading){let i=e.highlight.replace(/^#/,"");/^[0-9a-fA-F]{6}$/.test(i)&&t.push(`<w:shd w:val="clear" w:color="auto" w:fill="${i}"/>`);}}if(e.underline){let i=[`w:val="${e.underline.style}"`];e.underline.color&&(e.underline.color.rgb&&i.push(`w:color="${e.underline.color.rgb}"`),e.underline.color.themeColor&&i.push(`w:themeColor="${e.underline.color.themeColor}"`),e.underline.color.themeTint&&i.push(`w:themeTint="${e.underline.color.themeTint}"`),e.underline.color.themeShade&&i.push(`w:themeShade="${e.underline.color.themeShade}"`)),t.push(`<w:u ${i.join(" ")}/>`);}e.effect&&e.effect!=="none"&&t.push(`<w:effect w:val="${e.effect}"/>`),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(`<w:em w:val="${e.emphasisMark}"/>`);let r=me(e.shading);return r&&t.push(r),e.vertAlign&&e.vertAlign!=="baseline"&&t.push(`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&t.push("<w:rtl/>"),e.cs&&t.push("<w:cs/>"),t.length===0?"":`<w:rPr>${t.join("")}</w:rPr>`}function he(e){return !e.startsWith("<w:rPr>")||!e.endsWith("</w:rPr>")?"":e.slice(7,-8)}function de(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",i=typeof e.info.date=="string"?e.info.date.trim():void 0,o=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,c=[`w:id="${t}"`,`w:author="${s(r)}"`];i&&c.push(`w:date="${s(i)}"`),o&&c.push(`w:rsid="${s(o)}"`);let a=b(e.previousFormatting)||"<w:rPr/>";return `<w:rPrChange ${c.join(" ")}>${a}</w:rPrChange>`}function we(e,t){let n=b(e),r=n?he(n):"",i=(t??[]).map(de).join(""),o=`${r}${i}`;return o?`<w:rPr>${o}</w:rPr>`:""}function ge(e){return `<w:t${e.preserveSpace||e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${s(e.text)}</w:t>`}function ye(e){return "<w:tab/>"}function xe(e){let t=[];return e.breakType==="page"?t.push('w:type="page"'):e.breakType==="column"?t.push('w:type="column"'):e.breakType==="textWrapping"&&(t.push('w:type="textWrapping"'),e.clear&&e.clear!=="none"&&t.push(`w:clear="${e.clear}"`)),t.length===0?"<w:br/>":`<w:br ${t.join(" ")}/>`}function $e(e){return `<w:sym w:font="${s(e.font)}" w:char="${s(e.char)}"/>`}function Te(e){return e.type==="footnoteRef"?`<w:footnoteReference w:id="${e.id}"/>`:`<w:endnoteReference w:id="${e.id}"/>`}function Pe(e){let t=[`w:fldCharType="${e.charType}"`];return e.fldLock&&t.push('w:fldLock="true"'),e.dirty&&t.push('w:dirty="true"'),`<w:fldChar ${t.join(" ")}/>`}function be(e){return `<w:instrText${e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${s(e.text)}</w:instrText>`}function ve(e){return "<w:softHyphen/>"}function Ce(e){return "<w:noBreakHyphen/>"}function D(e){if(!e)return "";if(e.rgb)return `<a:srgbClr val="${e.rgb.replace("#","")}"/>`;if(e.themeColor){let t=`<a:schemeClr val="${e.themeColor}"`;return e.themeTint?t+=`><a:tint val="${e.themeTint}"/></a:schemeClr>`:e.themeShade?t+=`><a:shade val="${e.themeShade}"/></a:schemeClr>`:t+="/>",t}return ""}function Fe(e){if(!e||e.type==="none")return "<a:noFill/>";if(e.type==="solid"&&e.color)return `<a:solidFill>${D(e.color)}</a:solidFill>`;if(e.type==="gradient"&&e.gradient){let t=e.gradient,n=t.stops.map(i=>`<a:gs pos="${i.position}">${D(i.color)}</a:gs>`).join(""),r=t.type==="linear"?`<a:lin ang="${(t.angle||0)*6e4}" scaled="1"/>`:"";return `<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return ""}function O(e){if(!e)return "";let t=[];e.width!=null&&t.push(`w="${e.width}"`),e.cap&&t.push(`cap="${e.cap}"`);let n=[];return e.color&&n.push(`<a:solidFill>${D(e.color)}</a:solidFill>`),e.style&&e.style!=="solid"&&n.push(`<a:prstDash val="${e.style}"/>`),e.headEnd&&n.push(`<a:headEnd type="${e.headEnd.type}"${e.headEnd.width?` w="${e.headEnd.width}"`:""}${e.headEnd.length?` len="${e.headEnd.length}"`:""}/>`),e.tailEnd&&n.push(`<a:tailEnd type="${e.tailEnd.type}"${e.tailEnd.width?` w="${e.tailEnd.width}"`:""}${e.tailEnd.length?` len="${e.tailEnd.length}"`:""}/>`),n.length===0&&t.length===0?"":`<a:ln${t.length?" "+t.join(" "):""}>${n.join("")}</a:ln>`}function M(e){let t=[],n=e.horizontal;t.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?t.push(`<wp:align>${n.alignment}</wp:align>`):t.push(`<wp:posOffset>${n.posOffset||0}</wp:posOffset>`),t.push("</wp:positionH>");let r=e.vertical;return t.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?t.push(`<wp:align>${r.alignment}</wp:align>`):t.push(`<wp:posOffset>${r.posOffset||0}</wp:posOffset>`),t.push("</wp:positionV>"),t.join("")}function H(e){let t=e.wrapText?` wrapText="${e.wrapText}"`:' wrapText="bothSides"';switch(e.type){case "square":return `<wp:wrapSquare${t}/>`;case "tight":return `<wp:wrapTight${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case "through":return `<wp:wrapThrough${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case "topAndBottom":return "<wp:wrapTopAndBottom/>";case "behind":case "inFront":return "<wp:wrapNone/>";default:return "<wp:wrapNone/>"}}function Se(e,t){let n=e.size.width,r=e.size.height,i=e.rId||"rId1",o=t,c=e.filename||`image${o}`,a="";return e.transform?.rotation&&(a+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(a+=' flipH="1"'),e.transform?.flipV&&(a+=' flipV="1"'),['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${o}" name="${s(c)}"${e.alt?` descr="${s(e.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",`<a:blip r:embed="${i}"/>`,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${a}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${n}" cy="${r}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',e.outline?O(e.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function Re(e){let t=e.image,n=t.wrap.type!=="inline",r=t.size.width,i=t.size.height,o=t.padding?.top??t.wrap.distT??0,c=t.padding?.bottom??t.wrap.distB??0,a=t.padding?.left??t.wrap.distL??0,l=t.padding?.right??t.wrap.distR??0,p=L(t.id),f=t.title||t.filename||`Picture ${p}`,m=Se(t,p);if(!n)return ["<w:drawing>",`<wp:inline distT="${o}" distB="${c}" distL="${a}" distR="${l}">`,`<wp:extent cx="${r}" cy="${i}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${p}" name="${s(f)}"${t.alt?` descr="${s(t.alt)}"`:""}${t.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',m,"</wp:inline>","</w:drawing>"].join("");let u=t.wrap.type==="behind"?"1":"0",h=t.position?M(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',g=H(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${o}" distB="${c}" distL="${a}" distR="${l}" simplePos="0" relativeHeight="251658240" behindDoc="${u}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',h,`<wp:extent cx="${r}" cy="${i}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',g,`<wp:docPr id="${p}" name="${s(f)}"${t.alt?` descr="${s(t.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',m,"</wp:anchor>","</w:drawing>"].join("")}function Ae(e){return e.map(t=>$(t)).join("")}function ze(e){let t=e.shape,n=t.size.width,r=t.size.height,i=t.shapeType==="textBox",o=t.wrap&&t.wrap.type!=="inline",c=t.wrap?.distT??0,a=t.wrap?.distB??0,l=t.wrap?.distL??0,p=t.wrap?.distR??0,f=L(t.id),m=t.name||(i?`TextBox ${f}`:`Shape ${f}`),u="";t.transform?.rotation&&(u+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(u+=' flipH="1"'),t.transform?.flipV&&(u+=' flipV="1"');let h=["<wps:spPr>",`<a:xfrm${u}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${n}" cy="${r}"/>`,"</a:xfrm>",`<a:prstGeom prst="${t.shapeType==="textBox"?"rect":t.shapeType}"><a:avLst/></a:prstGeom>`,Fe(t.fill),O(t.outline),"</wps:spPr>"].join(""),g="";if(t.textBody){let d=t.textBody,x=['rot="0"','vert="horz"'];d.anchor&&x.push(`anchor="${d.anchor==="middle"?"ctr":d.anchor}"`),d.anchorCenter&&x.push('anchorCtr="1"'),d.margins&&(d.margins.left!=null&&x.push(`lIns="${d.margins.left}"`),d.margins.top!=null&&x.push(`tIns="${d.margins.top}"`),d.margins.right!=null&&x.push(`rIns="${d.margins.right}"`),d.margins.bottom!=null&&x.push(`bIns="${d.margins.bottom}"`)),i?g=["<wps:txbx><w:txbxContent>",Ae(d.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${x.join(" ")}/>`].join(""):g=[`<wps:bodyPr ${x.join(" ")}/>`].join("");}let E=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${i?' txBox="1"':""}/>`,h,g,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!o)return ["<w:drawing>",`<wp:inline distT="${c}" distB="${a}" distL="${l}" distR="${p}">`,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${f}" name="${s(m)}"/>`,"<wp:cNvGraphicFramePr/>",E,"</wp:inline>","</w:drawing>"].join("");let se=t.wrap?.type==="behind"?"1":"0",ae=t.position?M(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',ce=H(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${c}" distB="${a}" distL="${l}" distR="${p}" simplePos="0" relativeHeight="251658240" behindDoc="${se}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',ae,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',ce,`<wp:docPr id="${f}" name="${s(m)}"/>`,"<wp:cNvGraphicFramePr/>",E,"</wp:anchor>","</w:drawing>"].join("")}function Ie(e){switch(e.type){case "text":return ge(e);case "tab":return ye();case "break":return xe(e);case "symbol":return $e(e);case "footnoteRef":case "endnoteRef":return Te(e);case "fieldChar":return Pe(e);case "instrText":return be(e);case "softHyphen":return ve();case "noBreakHyphen":return Ce();case "drawing":return Re(e);case "shape":return ze(e);default:return ""}}function y(e){let t=[],n=we(e.formatting,e.propertyChanges);n&&t.push(n);for(let r of e.content){let i=Ie(r);i&&t.push(i);}return `<w:r>${t.join("")}</w:r>`}function v(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function De(e){if(!e)return "";let t=[];if(e.top){let n=v(e.top,"top");n&&t.push(n);}if(e.left){let n=v(e.left,"left");n&&t.push(n);}if(e.bottom){let n=v(e.bottom,"bottom");n&&t.push(n);}if(e.right){let n=v(e.right,"right");n&&t.push(n);}if(e.between){let n=v(e.between,"between");n&&t.push(n);}if(e.bar){let n=v(e.bar,"bar");n&&t.push(n);}return t.length===0?"":`<w:pBdr>${t.join("")}</w:pBdr>`}function ke(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function Be(e){return !e||e.length===0?"":`<w:tabs>${e.map(n=>{let r=[`w:val="${n.alignment}"`,`w:pos="${n.position}"`];return n.leader&&n.leader!=="none"&&r.push(`w:leader="${n.leader}"`),`<w:tab ${r.join(" ")}/>`}).join("")}</w:tabs>`}function Ee(e){let t=[];return e.spaceBefore!==void 0&&t.push(`w:before="${e.spaceBefore}"`),e.spaceAfter!==void 0&&t.push(`w:after="${e.spaceAfter}"`),e.lineSpacing!==void 0&&t.push(`w:line="${e.lineSpacing}"`),e.lineSpacingRule&&t.push(`w:lineRule="${e.lineSpacingRule}"`),e.beforeAutospacing&&t.push('w:beforeAutospacing="1"'),e.afterAutospacing&&t.push('w:afterAutospacing="1"'),t.length===0?"":`<w:spacing ${t.join(" ")}/>`}function je(e){let t=[];return e.indentLeft!==void 0&&t.push(`w:left="${e.indentLeft}"`),e.indentRight!==void 0&&t.push(`w:right="${e.indentRight}"`),e.indentFirstLine!==void 0&&(e.hangingIndent?t.push(`w:hanging="${Math.abs(e.indentFirstLine)}"`):e.indentFirstLine!==0&&t.push(`w:firstLine="${e.indentFirstLine}"`)),t.length===0?"":`<w:ind ${t.join(" ")}/>`}function Xe(e){if(!e)return "";let t=[];return e.ilvl!==void 0&&t.push(`<w:ilvl w:val="${e.ilvl}"/>`),e.numId!==void 0&&t.push(`<w:numId w:val="${e.numId}"/>`),t.length===0?"":`<w:numPr>${t.join("")}</w:numPr>`}function Le(e){if(!e)return "";let t=[];return e.width!==void 0&&t.push(`w:w="${e.width}"`),e.height!==void 0&&t.push(`w:h="${e.height}"`),e.hAnchor&&t.push(`w:hAnchor="${e.hAnchor}"`),e.vAnchor&&t.push(`w:vAnchor="${e.vAnchor}"`),e.x!==void 0&&t.push(`w:x="${e.x}"`),e.y!==void 0&&t.push(`w:y="${e.y}"`),e.xAlign&&t.push(`w:xAlign="${e.xAlign}"`),e.yAlign&&t.push(`w:yAlign="${e.yAlign}"`),e.wrap&&t.push(`w:wrap="${e.wrap}"`),t.length===0?"":`<w:framePr ${t.join(" ")}/>`}function W(e,t){let n=[];if(e){e.styleId&&n.push(`<w:pStyle w:val="${s(e.styleId)}"/>`),e.keepNext&&n.push("<w:keepNext/>"),e.keepLines&&n.push("<w:keepLines/>"),e.contextualSpacing&&n.push("<w:contextualSpacing/>"),e.pageBreakBefore&&n.push("<w:pageBreakBefore/>");let r=Le(e.frame);r&&n.push(r),e.widowControl===false?n.push('<w:widowControl w:val="0"/>'):e.widowControl===true&&n.push("<w:widowControl/>");let i=Xe(e.numPr);i&&n.push(i);let o=De(e.borders);o&&n.push(o);let c=ke(e.shading);c&&n.push(c);let a=Be(e.tabs);a&&n.push(a),e.suppressLineNumbers&&n.push("<w:suppressLineNumbers/>"),e.suppressAutoHyphens&&n.push("<w:suppressAutoHyphens/>");let l=Ee(e);l&&n.push(l);let p=je(e);if(p&&n.push(p),e.bidi&&n.push("<w:bidi/>"),e.alignment&&n.push(`<w:jc w:val="${e.alignment}"/>`),e.outlineLevel!==void 0&&n.push(`<w:outlineLvl w:val="${e.outlineLevel}"/>`),e.runProperties){let f=b(e.runProperties);f&&n.push(f);}}return t&&t.length>0&&n.push(...t.map(r=>Me(r))),n.length===0?"":`<w:pPr>${n.join("")}</w:pPr>`}function Oe(e){return !e.startsWith("<w:pPr>")||!e.endsWith("</w:pPr>")?"":e.slice(7,-8)}function Me(e){let t=Number.isInteger(e.info.id)&&e.info.id>=0?e.info.id:0,n=typeof e.info.author=="string"?e.info.author.trim():"",r=n.length>0?n:"Unknown",i=typeof e.info.date=="string"?e.info.date.trim():void 0,o=typeof e.info.rsid=="string"?e.info.rsid.trim():void 0,c=[`w:id="${t}"`,`w:author="${s(r)}"`];i&&c.push(`w:date="${s(i)}"`),o&&c.push(`w:rsid="${s(o)}"`);let a=W(e.previousFormatting)||"<w:pPr/>",l=Oe(a),p=l.length>0?`<w:pPr>${l}</w:pPr>`:"<w:pPr/>";return `<w:pPrChange ${c.join(" ")}>${p}</w:pPrChange>`}function k(e){let t=[];e.rId&&t.push(`r:id="${e.rId}"`),e.anchor&&t.push(`w:anchor="${s(e.anchor)}"`),e.tooltip&&t.push(`w:tooltip="${s(e.tooltip)}"`),e.target&&t.push(`w:tgtFrame="${s(e.target)}"`),e.history===false&&t.push('w:history="0"'),e.docLocation&&t.push(`w:docLocation="${s(e.docLocation)}"`);let n=e.children.map(i=>i.type==="run"?y(i):i.type==="bookmarkStart"?G(i):i.type==="bookmarkEnd"?_(i):"").join("");return `<w:hyperlink${t.length>0?" "+t.join(" "):""}>${n}</w:hyperlink>`}function G(e){let t=[`w:id="${e.id}"`,`w:name="${s(e.name)}"`];return e.colFirst!==void 0&&t.push(`w:colFirst="${e.colFirst}"`),e.colLast!==void 0&&t.push(`w:colLast="${e.colLast}"`),`<w:bookmarkStart ${t.join(" ")}/>`}function _(e){return `<w:bookmarkEnd w:id="${e.id}"/>`}function He(e){let t=[],n=e.content.find(a=>a.type==="run"),r=n?.formatting?b(n.formatting):"",i=['w:fldCharType="begin"'];e.fldLock&&i.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${i.join(" ")}/></w:r>`);let c=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${c}>${s(e.instruction)}</w:instrText></w:r>`),t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let a of e.content)a.type==="run"&&t.push(y(a));return t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Ne(e){let t=[],n=e.fieldResult?.[0]?.formatting,r=n?b(n):"",i=['w:fldCharType="begin"'];if(e.fldLock&&i.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${i.join(" ")}/></w:r>`),e.fieldCode.length>0)t.push(...e.fieldCode.map(o=>y(o)));else {let c=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${c}>${s(e.instruction)}</w:instrText></w:r>`);}return t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),t.push(...e.fieldResult.map(o=>y(o))),t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function We(e){let t=e.properties,n=[];switch(t.alias&&n.push(`<w:alias w:val="${s(t.alias)}"/>`),t.tag&&n.push(`<w:tag w:val="${s(t.tag)}"/>`),t.lock&&t.lock!=="unlocked"&&n.push(`<w:lock w:val="${t.lock}"/>`),t.showingPlaceholder&&n.push("<w:showingPlcHdr/>"),t.sdtType){case "plainText":n.push("<w:text/>");break;case "date":t.dateFormat?n.push(`<w:date w:fullDate="${s(t.dateFormat)}"/>`):n.push("<w:date/>");break;case "dropdown":{let i=(t.listItems??[]).map(o=>`<w:listItem w:displayText="${s(o.displayText)}" w:value="${s(o.value)}"/>`).join("");n.push(`<w:dropDownList>${i}</w:dropDownList>`);break}case "comboBox":{let i=(t.listItems??[]).map(o=>`<w:listItem w:displayText="${s(o.displayText)}" w:value="${s(o.value)}"/>`).join("");n.push(`<w:comboBox>${i}</w:comboBox>`);break}case "checkbox":n.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/></w14:checkbox>`);break;case "picture":n.push("<w:picture/>");break}let r=e.content.map(i=>i.type==="run"?y(i):i.type==="hyperlink"?k(i):"").join("");return `<w:sdt><w:sdtPr>${n.join("")}</w:sdtPr><w:sdtContent>${r}</w:sdtContent></w:sdt>`}function N(e,t){let n=[`w:id="${t.id}"`,`w:name="${s(t.name)}"`];return `<w:${e} ${n.join(" ")}/>`}function z(e,t){let n=t.info,r=Number.isInteger(n.id)&&n.id>=0?n.id:0,i=typeof n.author=="string"?n.author.trim():"",o=i.length>0?i:"Unknown",c=typeof n.date=="string"?n.date.trim():void 0,a=[`w:id="${r}"`,`w:author="${s(o)}"`];c&&a.push(`w:date="${s(c)}"`);let l=t.content.map(p=>p.type==="run"?e==="del"||e==="moveFrom"?y(p).replace(/<w:t\b/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>").replace(/<w:instrText\b/g,"<w:delInstrText").replace(/<\/w:instrText>/g,"</w:delInstrText>"):y(p):p.type==="hyperlink"?k(p):"").join("");return `<w:${e} ${a.join(" ")}>${l}</w:${e}>`}function Ge(e){switch(e.type){case "run":return y(e);case "hyperlink":return k(e);case "bookmarkStart":return G(e);case "bookmarkEnd":return _(e);case "simpleField":return He(e);case "complexField":return Ne(e);case "inlineSdt":return We(e);case "commentRangeStart":return `<w:commentRangeStart w:id="${e.id}"/>`;case "commentRangeEnd":return `<w:commentRangeEnd w:id="${e.id}"/><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="${e.id}"/></w:r>`;case "insertion":return z("ins",e);case "deletion":return z("del",e);case "moveFrom":return z("moveFrom",e);case "moveTo":return z("moveTo",e);case "moveFromRangeStart":return N("moveFromRangeStart",e);case "moveFromRangeEnd":return `<w:moveFromRangeEnd w:id="${e.id}"/>`;case "moveToRangeStart":return N("moveToRangeStart",e);case "moveToRangeEnd":return `<w:moveToRangeEnd w:id="${e.id}"/>`;case "mathEquation":return e.ommlXml||"";default:return ""}}function $(e){let t=[],n=[];e.paraId&&n.push(`w14:paraId="${e.paraId}"`),e.textId&&n.push(`w14:textId="${e.textId}"`);let r=n.length>0?" "+n.join(" "):"",i=W(e.formatting,e.propertyChanges);i&&t.push(i);for(let o of e.content){let c=Ge(o);c&&t.push(c);}return `<w:p${r}>${t.join("")}</w:p>`}function _e(e){let t=Number.isInteger(e.id)&&e.id>=0?e.id:0,n=typeof e.author=="string"?e.author.trim():"",r=n.length>0?n:"Unknown",i=typeof e.date=="string"?e.date.trim():void 0;return {id:t,author:r,date:i}}function P(e,t){let n=_e(e),r=[`w:id="${n.id}"`,`w:author="${s(n.author)}"`];return n.date&&r.push(`w:date="${s(n.date)}"`),t&&t.trim().length>0&&r.push(`w:rsid="${s(t.trim())}"`),r.join(" ")}function T(e,t){if(!e)return "";let n=[`w:w="${e.value}"`,`w:type="${e.type}"`];return `<w:${t} ${n.join(" ")}/>`}function C(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function V(e,t){if(!e)return "";let n=[];if(e.top){let r=C(e.top,"top");r&&n.push(r);}if(e.left){let r=C(e.left,"left");r&&n.push(r);}if(e.bottom){let r=C(e.bottom,"bottom");r&&n.push(r);}if(e.right){let r=C(e.right,"right");r&&n.push(r);}if(e.insideH){let r=C(e.insideH,"insideH");r&&n.push(r);}if(e.insideV){let r=C(e.insideV,"insideV");r&&n.push(r);}return n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function U(e,t){if(!e)return "";let n=[];return e.top&&n.push(T(e.top,"top")),e.left&&n.push(T(e.left,"left")),e.bottom&&n.push(T(e.bottom,"bottom")),e.right&&n.push(T(e.right,"right")),n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function Z(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function Ve(e){if(!e)return "";let t=[];return e.firstRow&&t.push('w:firstRow="1"'),e.lastRow&&t.push('w:lastRow="1"'),e.firstColumn&&t.push('w:firstColumn="1"'),e.lastColumn&&t.push('w:lastColumn="1"'),e.noHBand&&t.push('w:noHBand="1"'),e.noVBand&&t.push('w:noVBand="1"'),t.length===0?"":`<w:tblLook ${t.join(" ")}/>`}function Ue(e){if(!e)return "";let t=[];return e.horzAnchor&&t.push(`w:horzAnchor="${e.horzAnchor}"`),e.vertAnchor&&t.push(`w:vertAnchor="${e.vertAnchor}"`),e.tblpX!==void 0&&t.push(`w:tblpX="${e.tblpX}"`),e.tblpXSpec&&t.push(`w:tblpXSpec="${e.tblpXSpec}"`),e.tblpY!==void 0&&t.push(`w:tblpY="${e.tblpY}"`),e.tblpYSpec&&t.push(`w:tblpYSpec="${e.tblpYSpec}"`),e.topFromText!==void 0&&t.push(`w:topFromText="${e.topFromText}"`),e.bottomFromText!==void 0&&t.push(`w:bottomFromText="${e.bottomFromText}"`),e.leftFromText!==void 0&&t.push(`w:leftFromText="${e.leftFromText}"`),e.rightFromText!==void 0&&t.push(`w:rightFromText="${e.rightFromText}"`),t.length===0?"":`<w:tblpPr ${t.join(" ")}/>`}function q(e,t){let n=[];if(e){e.styleId&&n.push(`<w:tblStyle w:val="${s(e.styleId)}"/>`);let r=Ue(e.floating);r&&n.push(r),e.bidi&&n.push("<w:bidiVisual/>");let i=T(e.width,"tblW");i&&n.push(i),e.justification&&n.push(`<w:jc w:val="${e.justification}"/>`);let o=T(e.cellSpacing,"tblCellSpacing");o&&n.push(o);let c=T(e.indent,"tblInd");c&&n.push(c);let a=V(e.borders,"tblBorders");a&&n.push(a);let l=U(e.cellMargins,"tblCellMar");l&&n.push(l),e.layout&&n.push(`<w:tblLayout w:type="${e.layout}"/>`);let p=Z(e.shading);p&&n.push(p);let f=Ve(e.look);f&&n.push(f),e.overlap&&n.push(`<w:tblOverlap w:val="${e.overlap}"/>`);}return t&&t.length>0&&n.push(...t.map(r=>qe(r))),n.length===0?"":`<w:tblPr>${n.join("")}</w:tblPr>`}function Ze(e){return !e.startsWith("<w:tblPr>")||!e.endsWith("</w:tblPr>")?"":e.slice(9,-10)}function qe(e){let t=P(e.info,e.info.rsid),n=q(e.previousFormatting)||"<w:tblPr/>",r=Ze(n),i=r.length>0?`<w:tblPr>${r}</w:tblPr>`:"<w:tblPr/>";return `<w:tblPrChange ${t}>${i}</w:tblPrChange>`}function Y(e,t,n){let r=[];if(e){if(e.cantSplit&&r.push("<w:cantSplit/>"),e.header&&r.push("<w:tblHeader/>"),e.height){let i=[`w:val="${e.height.value}"`];e.heightRule&&i.push(`w:hRule="${e.heightRule}"`),r.push(`<w:trHeight ${i.join(" ")}/>`);}e.justification&&r.push(`<w:jc w:val="${e.justification}"/>`),e.hidden&&r.push("<w:hidden/>");}return n&&(n.type==="tableRowInsertion"?r.push(`<w:ins ${P(n.info)}/>`):n.type==="tableRowDeletion"&&r.push(`<w:del ${P(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(i=>Je(i))),r.length===0?"":`<w:trPr>${r.join("")}</w:trPr>`}function Ye(e){return !e.startsWith("<w:trPr>")||!e.endsWith("</w:trPr>")?"":e.slice(8,-9)}function Je(e){let t=P(e.info,e.info.rsid),n=Y(e.previousFormatting)||"<w:trPr/>",r=Ye(n),i=r.length>0?`<w:trPr>${r}</w:trPr>`:"<w:trPr/>";return `<w:trPrChange ${t}>${i}</w:trPrChange>`}function Ke(e){if(!e)return "";let n=[e.firstRow?"1":"0",e.lastRow?"1":"0",e.firstColumn?"1":"0",e.lastColumn?"1":"0",e.oddVBand?"1":"0",e.evenVBand?"1":"0",e.oddHBand?"1":"0",e.evenHBand?"1":"0",e.nwCell?"1":"0",e.neCell?"1":"0",e.swCell?"1":"0",e.seCell?"1":"0"].join("");return n==="000000000000"?"":`<w:cnfStyle w:val="${n}"/>`}function J(e,t,n){let r=[];if(e){let i=Ke(e.conditionalFormat);i&&r.push(i);let o=T(e.width,"tcW");o&&r.push(o),e.gridSpan&&e.gridSpan>1&&r.push(`<w:gridSpan w:val="${e.gridSpan}"/>`),e.vMerge&&(e.vMerge==="restart"?r.push('<w:vMerge w:val="restart"/>'):r.push("<w:vMerge/>"));let c=V(e.borders,"tcBorders");c&&r.push(c);let a=Z(e.shading);a&&r.push(a),e.noWrap&&r.push("<w:noWrap/>");let l=U(e.margins,"tcMar");l&&r.push(l),e.textDirection&&r.push(`<w:textDirection w:val="${e.textDirection}"/>`),e.fitText&&r.push("<w:tcFitText/>"),e.verticalAlign&&r.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.hideMark&&r.push("<w:hideMark/>");}return n&&(n.type==="tableCellInsertion"?r.push(`<w:cellIns ${P(n.info)}/>`):n.type==="tableCellDeletion"?r.push(`<w:cellDel ${P(n.info)}/>`):n.type==="tableCellMerge"&&r.push(`<w:cellMerge ${P(n.info)}/>`)),t&&t.length>0&&r.push(...t.map(i=>et(i))),r.length===0?"":`<w:tcPr>${r.join("")}</w:tcPr>`}function Qe(e){return !e.startsWith("<w:tcPr>")||!e.endsWith("</w:tcPr>")?"":e.slice(8,-9)}function et(e){let t=P(e.info,e.info.rsid),n=J(e.previousFormatting)||"<w:tcPr/>",r=Qe(n),i=r.length>0?`<w:tcPr>${r}</w:tcPr>`:"<w:tcPr/>";return `<w:tcPrChange ${t}>${i}</w:tcPrChange>`}function tt(e){return !e||e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${n}"/>`).join("")}</w:tblGrid>`}function nt(e){let t=[];for(let n of e)n.type==="paragraph"?t.push($(n)):n.type==="table"&&t.push(R(n));return t.length===0&&t.push("<w:p/>"),t.join("")}function rt(e){let t=[],n=J(e.formatting,e.propertyChanges,e.structuralChange);return n&&t.push(n),t.push(nt(e.content)),`<w:tc>${t.join("")}</w:tc>`}function it(e){let t=[],n=Y(e.formatting,e.propertyChanges,e.structuralChange);n&&t.push(n);for(let r of e.cells)t.push(rt(r));return `<w:tr>${t.join("")}</w:tr>`}function R(e){let t=[],n=q(e.formatting,e.propertyChanges);n&&t.push(n);let r=tt(e.columnWidths);r&&t.push(r);for(let i of e.rows)t.push(it(i));return `<w:tbl>${t.join("")}</w:tbl>`}var w={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function ot(){let e={wpc:w.wpc,mc:w.mc,o:w.o,r:w.r,m:w.m,v:w.v,wp14:w.wp14,wp:w.wp,w10:w.w10,w:w.w,w14:w.w14,w15:w.w15,wpg:w.wpg,wps:w.wps};return Object.entries(e).map(([t,n])=>`xmlns:${t}="${n}"`).join(" ")}function I(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function st(e){return `<w:headerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function at(e){return `<w:footerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function ct(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:footnotePr>${t.join("")}</w:footnotePr>`}function lt(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:endnotePr>${t.join("")}</w:endnotePr>`}function pt(e){let t=[];return e.pageWidth!==void 0&&t.push(`w:w="${e.pageWidth}"`),e.pageHeight!==void 0&&t.push(`w:h="${e.pageHeight}"`),e.orientation==="landscape"&&t.push('w:orient="landscape"'),t.length===0?"":`<w:pgSz ${t.join(" ")}/>`}function ft(e){let t=[];return e.marginTop!==void 0&&t.push(`w:top="${e.marginTop}"`),e.marginRight!==void 0&&t.push(`w:right="${e.marginRight}"`),e.marginBottom!==void 0&&t.push(`w:bottom="${e.marginBottom}"`),e.marginLeft!==void 0&&t.push(`w:left="${e.marginLeft}"`),e.headerDistance!==void 0&&t.push(`w:header="${e.headerDistance}"`),e.footerDistance!==void 0&&t.push(`w:footer="${e.footerDistance}"`),e.gutter!==void 0&&t.push(`w:gutter="${e.gutter}"`),t.length===0?"":`<w:pgMar ${t.join(" ")}/>`}function ut(e){if(!e.columnCount&&!e.columns?.length)return "";let t=[];e.columnCount!==void 0&&e.columnCount>1&&t.push(`w:num="${e.columnCount}"`),e.columnSpace!==void 0&&t.push(`w:space="${e.columnSpace}"`),e.equalWidth!==void 0&&t.push(`w:equalWidth="${e.equalWidth?"1":"0"}"`),e.separator&&t.push('w:sep="1"');let n="";return e.columns&&e.columns.length>0&&(n=e.columns.map(i=>{let o=[];return i.width!==void 0&&o.push(`w:w="${i.width}"`),i.space!==void 0&&o.push(`w:space="${i.space}"`),`<w:col ${o.join(" ")}/>`}).join("")),t.length===0&&!n?"":`<w:cols${t.length>0?" "+t.join(" "):""}>${n}</w:cols>`}function mt(e){if(!e.lineNumbers)return "";let t=e.lineNumbers,n=[];return t.countBy!==void 0&&n.push(`w:countBy="${t.countBy}"`),t.start!==void 0&&n.push(`w:start="${t.start}"`),t.distance!==void 0&&n.push(`w:distance="${t.distance}"`),t.restart&&n.push(`w:restart="${t.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function ht(e){if(!e.pageBorders)return "";let t=e.pageBorders,n=[],r=[];if(t.display&&n.push(`w:display="${t.display}"`),t.offsetFrom&&n.push(`w:offsetFrom="${t.offsetFrom}"`),t.zOrder&&n.push(`w:zOrder="${t.zOrder}"`),t.top){let o=I(t.top,"top");o&&r.push(o);}if(t.left){let o=I(t.left,"left");o&&r.push(o);}if(t.bottom){let o=I(t.bottom,"bottom");o&&r.push(o);}if(t.right){let o=I(t.right,"right");o&&r.push(o);}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function dt(e){if(!e.docGrid)return "";let t=e.docGrid,n=[];return t.type&&n.push(`w:type="${t.type}"`),t.linePitch!==void 0&&n.push(`w:linePitch="${t.linePitch}"`),t.charSpace!==void 0&&n.push(`w:charSpace="${t.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function wt(e){if(!e)return "";let t=[];if(e.headerReferences)for(let f of e.headerReferences)t.push(st(f));if(e.footerReferences)for(let f of e.footerReferences)t.push(at(f));let n=ct(e.footnotePr);n&&t.push(n);let r=lt(e.endnotePr);r&&t.push(r),e.sectionStart&&t.push(`<w:type w:val="${e.sectionStart}"/>`);let i=pt(e);i&&t.push(i);let o=ft(e);if(o&&t.push(o),e.paperSrcFirst!==void 0||e.paperSrcOther!==void 0){let f=[];e.paperSrcFirst!==void 0&&f.push(`w:first="${e.paperSrcFirst}"`),e.paperSrcOther!==void 0&&f.push(`w:other="${e.paperSrcOther}"`),t.push(`<w:paperSrc ${f.join(" ")}/>`);}let c=ht(e);c&&t.push(c);let a=mt(e);a&&t.push(a);let l=ut(e);l&&t.push(l);let p=dt(e);return p&&t.push(p),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.bidi&&t.push("<w:bidi/>"),e.titlePg&&t.push("<w:titlePg/>"),e.evenAndOddHeaders&&t.push("<w:evenAndOddHeaders/>"),t.length===0?"":`<w:sectPr>${t.join("")}</w:sectPr>`}function K(e){if(e.type==="paragraph")return $(e);if(e.type==="table")return R(e);if(e.type==="blockSdt"){let t=e.content.map(i=>K(i)).join(""),n=e.properties,r=[];return n.alias&&r.push(`<w:alias w:val="${n.alias}"/>`),n.tag&&r.push(`<w:tag w:val="${n.tag}"/>`),`<w:sdt><w:sdtPr>${r.join("")}</w:sdtPr><w:sdtContent>${t}</w:sdtContent></w:sdt>`}return ""}function gt(e){return e.map(t=>K(t)).join("")}function yt(e){let t=[];return t.push(gt(e.content)),e.finalSectionProperties&&t.push(wt(e.finalSectionProperties)),t.join("")}function Q(e){X();let t=[];t.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=ot();return t.push(`<w:document ${n} mc:Ignorable="w14 w15 wp14">`),t.push("<w:body>"),t.push(yt(e.package.document)),t.push("</w:body>"),t.push("</w:document>"),t.join("")}var A=chunkPCJ5ACUV_cjs.c(chunkXQNCLN4T_cjs.a(),1);var xt={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function $t(){return Object.entries(xt).map(([e,t])=>`xmlns:${e}="${t}"`).join(" ")}function Tt(e){return e.type==="paragraph"?$(e):e.type==="table"?R(e):""}function ee(e){let t=e.type==="header"?"w:hdr":"w:ftr",n=$t(),r=e.content.map(i=>Tt(i)).join("");return r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<${t} ${n}>${r}</${t}>`}function ne(e){let t="<w:r>",n=[];e.formatting?.bold&&n.push("<w:b/>"),e.formatting?.italic&&n.push("<w:i/>"),n.length>0&&(t+=`<w:rPr>${n.join("")}</w:rPr>`);for(let r of e.content)if(r.type==="text"){let i=r.text!==r.text.trim()||r.text.includes(" ");t+=i?`<w:t xml:space="preserve">${s(r.text)}</w:t>`:`<w:t>${s(r.text)}</w:t>`;}else r.type==="break"&&(t+="<w:br/>");return t+="</w:r>",t}function Pt(e){let t="<w:p>";for(let n of e.content)n.type==="run"&&(t+=ne(n));return t+="</w:p>",t}function bt(e){let t="<w:p>";t+='<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r>';for(let n of e.content)n.type==="run"&&(t+=ne(n));return t+="</w:p>",t}function te(e){let t=[`w:id="${e.id}"`];e.author&&t.push(`w:author="${s(e.author)}"`),e.initials&&t.push(`w:initials="${s(e.initials)}"`),e.date&&t.push(`w:date="${s(e.date)}"`);let n=`<w:comment ${t.join(" ")}>`;if(e.content&&e.content.length>0){n+=bt(e.content[0]);for(let r=1;r<e.content.length;r++)n+=Pt(e.content[r]);}else n+='<w:p><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r></w:p>';return n+="</w:comment>",n}function re(e){if(!e||e.length===0)return "";let t=[],n=[];for(let i of e)(i.parentId==null?t:n).push(i);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
|
+
<w:comments xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14">`;for(let i of t)r+=te(i);for(let i of n)r+=te(i);return r+="</w:comments>",r}function B(e){let t=0;for(let n of e.matchAll(/Id="rId(\d+)"/g)){let r=parseInt(n[1],10);r>t&&(t=r);}return t}async function vt(e,t,n){let r=e.package.document.comments;if(!r||r.length===0)return;let i=re(r);t.file("word/comments.xml",i,{compression:"DEFLATE",compressionOptions:{level:n}}),await Promise.all([It(t,n),Dt(t,n)]);}function ie(e){let t=[];for(let n of e)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run")for(let i of r.content)i.type==="drawing"&&i.image.src?.startsWith("data:")&&t.push(i.image);}else if(n.type==="table")for(let r of n.rows)for(let i of r.cells)t.push(...ie(i.content));return t}var Ct={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tiff","image/webp":"webp","image/svg+xml":"svg"};function Ft(e){let t=e.match(/^data:([^;]+);base64,(.+)$/);if(!t)throw new Error("Invalid data URL");let n=atob(t[2]),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return {data:r.buffer,extension:Ct[t[1]]||"png"}}async function St(e,t,n){if(e.length===0)return;let r="word/_rels/document.xml.rels",i=t.file(r);if(!i)return;let o=await i.async("text"),c=B(o),a=0;t.forEach(f=>{let m=f.match(/^word\/media\/image(\d+)\./);if(m){let u=parseInt(m[1],10);u>a&&(a=u);}});let l=[],p=new Set;for(let f of e){let{data:m,extension:u}=Ft(f.src);a++,c++;let h=`image${a}.${u}`,g=`word/media/${h}`,F=`rId${c}`;t.file(g,m,{compression:"DEFLATE",compressionOptions:{level:n}}),l.push(`<Relationship Id="${F}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/${h}"/>`),p.add(u),f.rId=F;}if(l.length>0&&(o=o.replace("</Relationships>",l.join("")+"</Relationships>"),t.file(r,o,{compression:"DEFLATE",compressionOptions:{level:n}})),p.size>0){let f=t.file("[Content_Types].xml");if(f){let m=await f.async("text");for(let u of p)if(!m.includes(`Extension="${u}"`)){let h=Xt(u);m=m.replace("</Types>",`<Default Extension="${u}" ContentType="${h}"/></Types>`);}t.file("[Content_Types].xml",m,{compression:"DEFLATE",compressionOptions:{level:n}});}}}function oe(e){let t=[];for(let n of e)if(n.type==="paragraph")for(let r of n.content)r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor&&t.push(r);else if(n.type==="table")for(let r of n.rows)for(let i of r.cells)t.push(...oe(i.content));return t}async function Rt(e,t,n){if(e.length===0)return;let r="word/_rels/document.xml.rels",i=t.file(r);if(!i)return;let o=await i.async("text"),c=B(o),a=[];for(let l of e){c++;let p=`rId${c}`;a.push(`<Relationship Id="${p}" Type="${chunkCL62W2HQ_cjs.a.hyperlink}" Target="${s(l.href)}" TargetMode="External"/>`),l.rId=p;}a.length>0&&(o=o.replace("</Relationships>",a.join("")+"</Relationships>"),t.file(r,o,{compression:"DEFLATE",compressionOptions:{level:n}}));}async function At(e,t={}){if(!e.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");let{compressionLevel:n=6,updateModifiedDate:r=true,modifiedBy:i}=t,o=e,c=await A.default.loadAsync(e.originalBuffer),a=new A.default;for(let[u,h]of Object.entries(c.files)){if(h.dir){a.folder(u.replace(/\/$/,""));continue}let g=await h.async("arraybuffer");a.file(u,g,{compression:"DEFLATE",compressionOptions:{level:n}});}let l=ie(o.package.document.content);await St(l,a,n);let p=oe(o.package.document.content);await Rt(p,a,n);let f=Q(o);if(a.file("word/document.xml",f,{compression:"DEFLATE",compressionOptions:{level:n}}),Et(o,a,n),await vt(o,a,n),r){let u="docProps/core.xml",h=c.file(u);if(h){let g=await h.async("text"),F=jt(g,{updateModifiedDate:r,modifiedBy:i});a.file(u,F,{compression:"DEFLATE",compressionOptions:{level:n}});}}return await a.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:n}})}var zt="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml";async function It(e,t){let n=e.file("[Content_Types].xml");if(!n)return;let r=await n.async("text");r.includes("/word/comments.xml")||(r=r.replace("</Types>",`<Override PartName="/word/comments.xml" ContentType="${zt}"/></Types>`),e.file("[Content_Types].xml",r,{compression:"DEFLATE",compressionOptions:{level:t}}));}async function Dt(e,t){let n="word/_rels/document.xml.rels",r=e.file(n);if(!r)return;let i=await r.async("text");if(i.includes("comments.xml"))return;let o=`rId${B(i)+1}`;i=i.replace("</Relationships>",`<Relationship Id="${o}" Type="${chunkCL62W2HQ_cjs.a.comments}" Target="comments.xml"/></Relationships>`),e.file(n,i,{compression:"DEFLATE",compressionOptions:{level:t}});}async function pn(e,t,n={}){let r=await A.default.loadAsync(e);return kt(r,t,n)}async function kt(e,t,n={}){let{compressionLevel:r=6}=n;for(let[i,o]of t)e.file(i,o,{compression:"DEFLATE",compressionOptions:{level:r}});return e.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:r}})}function Bt(e){let t=new Map,n=e.package.relationships;if(!n)return t;let r=[{map:e.package.headers,type:chunkCL62W2HQ_cjs.a.header},{map:e.package.footers,type:chunkCL62W2HQ_cjs.a.footer}];for(let{map:i,type:o}of r)if(i)for(let[c,a]of i.entries()){let l=n.get(c);if(l&&l.type===o&&l.target){let p=l.target.startsWith("/")?l.target.slice(1):`word/${l.target}`;t.set(p,ee(a));}}return t}function Et(e,t,n){let r={level:n};for(let[i,o]of Bt(e))t.file(i,o,{compression:"DEFLATE",compressionOptions:r});}function jt(e,t){let n=e;if(t.updateModifiedDate){let r=new Date().toISOString();n.includes("<dcterms:modified")?n=n.replace(/<dcterms:modified[^>]*>[^<]*<\/dcterms:modified>/,`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified>`):n=n.replace("</cp:coreProperties>",`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified></cp:coreProperties>`);}return t.modifiedBy&&(n.includes("<cp:lastModifiedBy")?n=n.replace(/<cp:lastModifiedBy>[^<]*<\/cp:lastModifiedBy>/,`<cp:lastModifiedBy>${s(t.modifiedBy)}</cp:lastModifiedBy>`):n=n.replace("</cp:coreProperties>",`<cp:lastModifiedBy>${s(t.modifiedBy)}</cp:lastModifiedBy></cp:coreProperties>`)),n}function Xt(e,t){return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp",wmf:"image/x-wmf",emf:"image/x-emf"}[e]||"application/octet-stream"}async function Lt(){let e=new A.default;e.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
4
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
5
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
6
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
7
|
+
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
|
|
8
|
+
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
|
9
|
+
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
|
|
10
|
+
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
|
|
11
|
+
</Types>`),e.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
12
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
13
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
14
|
+
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
|
|
15
|
+
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
|
|
16
|
+
</Relationships>`),e.file("word/_rels/document.xml.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
17
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
18
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
19
|
+
</Relationships>`),e.file("word/document.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
20
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
21
|
+
<w:body>
|
|
22
|
+
<w:p>
|
|
23
|
+
<w:r>
|
|
24
|
+
<w:t></w:t>
|
|
25
|
+
</w:r>
|
|
26
|
+
</w:p>
|
|
27
|
+
<w:sectPr>
|
|
28
|
+
<w:pgSz w:w="12240" w:h="15840"/>
|
|
29
|
+
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
|
|
30
|
+
</w:sectPr>
|
|
31
|
+
</w:body>
|
|
32
|
+
</w:document>`),e.file("word/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
33
|
+
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
34
|
+
<w:docDefaults>
|
|
35
|
+
<w:rPrDefault>
|
|
36
|
+
<w:rPr>
|
|
37
|
+
<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
|
|
38
|
+
<w:sz w:val="22"/>
|
|
39
|
+
</w:rPr>
|
|
40
|
+
</w:rPrDefault>
|
|
41
|
+
<w:pPrDefault>
|
|
42
|
+
<w:pPr>
|
|
43
|
+
<w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
|
|
44
|
+
</w:pPr>
|
|
45
|
+
</w:pPrDefault>
|
|
46
|
+
</w:docDefaults>
|
|
47
|
+
<w:style w:type="paragraph" w:default="1" w:styleId="Normal">
|
|
48
|
+
<w:name w:val="Normal"/>
|
|
49
|
+
</w:style>
|
|
50
|
+
</w:styles>`);let t=new Date().toISOString();return e.file("docProps/core.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
51
|
+
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
52
|
+
<dc:creator>EigenPal DOCX Editor</dc:creator>
|
|
53
|
+
<dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>
|
|
54
|
+
<dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>
|
|
55
|
+
</cp:coreProperties>`),e.file("docProps/app.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
56
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
|
|
57
|
+
<Application>EigenPal DOCX Editor</Application>
|
|
58
|
+
<AppVersion>1.0.0</AppVersion>
|
|
59
|
+
</Properties>`),e.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:6}})}async function fn(e){let t=await Lt(),n={...e,originalBuffer:t};return At(n)}exports.a=wt;exports.b=yt;exports.c=Q;exports.d=re;exports.e=B;exports.f=At;exports.g=zt;exports.h=pn;exports.i=kt;exports.j=Bt;exports.k=jt;exports.l=fn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';var chunk5ILXHRJS_cjs=require('./chunk-5ILXHRJS.cjs'),chunkPUVSVHHB_cjs=require('./chunk-PUVSVHHB.cjs'),chunkP7ZF45KZ_cjs=require('./chunk-P7ZF45KZ.cjs'),chunkPIVLDW7B_cjs=require('./chunk-PIVLDW7B.cjs'),chunkPCJ5ACUV_cjs=require('./chunk-PCJ5ACUV.cjs');function G(r,t){let e=et(t),n=new RegExp(`<w:p[\\s][^>]*w14:paraId="${e}"`,"g"),a=[],o;for(;(o=n.exec(r))!==null;)a.push(o.index);if(a.length===0||a.length>1)return null;let s=a[0],i=s,c=0;for(;i<r.length;){let l=r.indexOf("<",i);if(l===-1)break;if(r.startsWith("<w:p",l)){let u=r[l+4];if(u===">"||u===" "||u==="/"){let g=r.indexOf(">",l);if(g===-1)break;if(r[g-1]==="/"){if(c===0)return {start:s,end:g+1};i=g+1;}else c++,i=g+1;}else i=l+1;}else if(r.startsWith("</w:p>",l)){if(c--,c===0)return {start:s,end:l+6};i=l+6;}else i=l+1;}return null}function Q(r,t){let e=G(r,t);return e?r.substring(e.start,e.end):null}function q(r){let t=0,e=/<w:p[\s>]/g,n;for(;(n=e.exec(r))!==null;){let a=n.index,o=r[a+4];(o===">"||o===" ")&&t++;}return t}function X(r){let t=new Map,e=/w14:paraId="([^"]+)"/g,n;for(;(n=e.exec(r))!==null;){let a=n[1];t.set(a,(t.get(a)||0)+1);}return t}function tt(r,t,e){if(e.size===0)return {safe:true};let n=X(r),a=X(t);for(let i of e){let c=n.get(i)||0;if(c===0)return {safe:false,reason:`paraId-not-found-in-original: ${i}`};if(c>1)return {safe:false,reason:`duplicate-paraId-in-original: ${i}`}}for(let i of e){let c=a.get(i)||0;if(c===0)return {safe:false,reason:`paraId-not-found-in-serialized: ${i}`};if(c>1)return {safe:false,reason:`duplicate-paraId-in-serialized: ${i}`}}let o=q(r),s=q(t);return o!==s?{safe:false,reason:`paragraph-count-mismatch: original=${o}, serialized=${s}`}:{safe:true}}function Z(r,t,e){if(e.size===0)return r;if(!tt(r,t,e).safe)return null;let a=[];for(let s of e){let i=G(r,s);if(!i)return null;let c=Q(t,s);if(!c)return null;a.push({start:i.start,end:i.end,newXml:c});}a.sort((s,i)=>i.start-s.start);let o=r;for(let{start:s,end:i,newXml:c}of a)o=o.substring(0,s)+c+o.substring(i);return o}function et(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(r){for(let t of r)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let n of e.content)if(n.type==="drawing"&&n.image?.src?.startsWith("data:")&&!n.image?.rId)return true}else if(e.type==="hyperlink"&&e.href&&!e.rId&&!e.anchor)return true}else if(t.type==="table"){for(let e of t.rows)for(let n of e.cells)if(J(n.content))return true}return false}async function Y(r,t,e){let{changedParaIds:n,structuralChange:a,hasUntrackedChanges:o}=e;if(a||o||!t)return null;let s=r.package.document.content;if(J(s))return null;let i=r.package.document.comments,c=i&&i.length>0,l=chunkPUVSVHHB_cjs.j(r);try{let g=await(await import('./lib-HOLGQI5K.cjs')).default.loadAsync(t),f=new Map;if(n.size>0){let p=g.file("word/document.xml");if(!p)return null;let m=await p.async("text"),b=chunkPUVSVHHB_cjs.c(r),d=Z(m,b,n);if(!d)return null;f.set("word/document.xml",d);}if(c){f.set("word/comments.xml",chunkPUVSVHHB_cjs.d(i));let p=g.file("[Content_Types].xml");if(p){let d=await p.async("text");d.includes("/word/comments.xml")||f.set("[Content_Types].xml",d.replace("</Types>",`<Override PartName="/word/comments.xml" ContentType="${chunkPUVSVHHB_cjs.g}"/></Types>`));}let m="word/_rels/document.xml.rels",b=g.file(m);if(b){let d=await b.async("text");if(!d.includes("comments.xml")){let x=chunkPUVSVHHB_cjs.e(d);f.set(m,d.replace("</Relationships>",`<Relationship Id="rId${x+1}" Type="${chunkPIVLDW7B_cjs.a.comments}" Target="comments.xml"/></Relationships>`));}}}for(let[p,m]of l)f.set(p,m);let y=g.file("docProps/core.xml");if(y){let p=await y.async("text");f.set("docProps/core.xml",chunkPUVSVHHB_cjs.k(p,{updateModifiedDate:!0}));}return await chunkPUVSVHHB_cjs.i(g,f)}catch{return null}}function nt(){return [{styleId:"Normal",type:"paragraph",name:"Normal",default:true,qFormat:true,uiPriority:0,rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},{styleId:"Title",type:"paragraph",name:"Title",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:10,rPr:{fontSize:52,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:240}},{styleId:"Subtitle",type:"paragraph",name:"Subtitle",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:11,rPr:{fontSize:30,color:{rgb:"666666"},fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:240}},{styleId:"Heading1",type:"paragraph",name:"Heading 1",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:40,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:400,spaceAfter:120,lineSpacing:240}},{styleId:"Heading2",type:"paragraph",name:"Heading 2",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:32,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:360,spaceAfter:80,lineSpacing:240}},{styleId:"Heading3",type:"paragraph",name:"Heading 3",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:28,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:320,spaceAfter:80,lineSpacing:240}},{styleId:"Heading4",type:"paragraph",name:"Heading 4",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:24,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:280,spaceAfter:80,lineSpacing:240}}]}function rt(){return {pageWidth:12240,pageHeight:15840,orientation:"portrait",marginTop:1440,marginBottom:1440,marginLeft:1440,marginRight:1440,headerDistance:720,footerDistance:720,gutter:0,columnCount:1,columnSpace:720,equalWidth:true,sectionStart:"nextPage",verticalAlign:"top"}}function at(r={}){let t=rt();r.pageWidth!==void 0&&(t.pageWidth=r.pageWidth),r.pageHeight!==void 0&&(t.pageHeight=r.pageHeight),r.orientation!==void 0&&(t.orientation=r.orientation),r.marginTop!==void 0&&(t.marginTop=r.marginTop),r.marginBottom!==void 0&&(t.marginBottom=r.marginBottom),r.marginLeft!==void 0&&(t.marginLeft=r.marginLeft),r.marginRight!==void 0&&(t.marginRight=r.marginRight);let e={type:"text",text:r.initialText||""};return {package:{document:{content:[{type:"paragraph",content:[{type:"run",content:r.initialText?[e]:[],formatting:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}}}],formatting:{lineSpacing:276}}],finalSectionProperties:t},styles:{docDefaults:{rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},styles:nt()}},templateVariables:[],warnings:[]}}function Wt(r,t={}){return at({...t,initialText:r})}var T=class r{constructor(t){chunkPCJ5ACUV_cjs.d(this,"_document");chunkPCJ5ACUV_cjs.d(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 chunkPIVLDW7B_cjs.n(t);return new r(e)}static fromDocument(t){return new r(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 chunk5ILXHRJS_cjs.a(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[n,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:n,name:o.name||n,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.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(s=>s.type==="paragraph"),a=n.map((s,i)=>{let c=this._getParagraphText(s),l=s.formatting?.styleId;return {index:i,preview:c.slice(0,t),style:l,isHeading:l?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(l),isListItem:!!s.listRendering,isEmpty:c.trim().length===0}}),o=(e.sections||[]).map((s,i)=>({index:i,paragraphCount:s.content?.length||0,pageSize:s.properties?.pageWidth&&s.properties?.pageHeight?{width:s.properties.pageWidth,height:s.properties.pageHeight}:void 0,isLandscape:s.properties?.orientation==="landscape",hasHeader:!!s.properties?.headerReferences?.length,hasFooter:!!s.properties?.footerReferences?.length}));return {paragraphCount:n.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:a,sections:o,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,n={}){let a={type:"insertText",position:t,text:e,formatting:n.formatting};return this._executeCommand(a)}replaceRange(t,e,n={}){let a={type:"replaceText",range:t,text:e,formatting:n.formatting};return this._executeCommand(a)}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,a={}){let o={type:"insertTable",position:t,rows:e,columns:n,data:a.data,hasHeader:a.hasHeader};return this._executeCommand(o)}insertImage(t,e,n={}){let a={type:"insertImage",position:t,src:e,width:n.width,height:n.height,alt:n.alt};return this._executeCommand(a)}insertHyperlink(t,e,n={}){let a={type:"insertHyperlink",range:t,url:e,displayText:n.displayText,tooltip:n.tooltip};return this._executeCommand(a)}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:a}=await import('./processTemplate-BXZKWRQD.cjs'),o=a(n,e),s=await chunkPIVLDW7B_cjs.n(o),i=new r(s);return i._pendingVariables={},i}async toBuffer(t){if(this._document.originalBuffer){if(t?.selective){let n=await Y(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await chunkPUVSVHHB_cjs.f(this._document);return this._document.originalBuffer=e,e}return chunkPUVSVHHB_cjs.l(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 r(chunkP7ZF45KZ_cjs.b(this._document,t))}_executeCommand(t){let e=new r(chunkP7ZF45KZ_cjs.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
|
-
`)}_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 a of n.cells)for(let o of a.content)o.type==="paragraph"&&e.push(this._getParagraphText(o));return e.join(" ")}_extractParagraphSegments(t,e){for(let n of t.content)if(n.type==="run"){let a=this._getRunText(n);a&&e.push({text:a,formatting:n.formatting});}else if(n.type==="hyperlink"){let a=n.href||"";for(let o of n.children)if(o.type==="run"){let s=this._getRunText(o);s&&e.push({text:s,formatting:o.formatting,isHyperlink:true,hyperlinkUrl:a});}}}_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 a of n.content)if(a.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 Gt(r){return T.fromBuffer(r)}function Zt(r){return T.fromDocument(r)}function ot(r,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:n=50}=t,a=r.package.document,o=a.content.filter(m=>m.type==="paragraph"),s=it(o,e,n),i=
|
|
1
|
+
'use strict';var chunkJ5YOIHCW_cjs=require('./chunk-J5YOIHCW.cjs'),chunkMHUCHYNM_cjs=require('./chunk-MHUCHYNM.cjs'),chunkP7ZF45KZ_cjs=require('./chunk-P7ZF45KZ.cjs'),chunkCL62W2HQ_cjs=require('./chunk-CL62W2HQ.cjs'),chunkPCJ5ACUV_cjs=require('./chunk-PCJ5ACUV.cjs');function G(r,t){let e=et(t),n=new RegExp(`<w:p[\\s][^>]*w14:paraId="${e}"`,"g"),a=[],o;for(;(o=n.exec(r))!==null;)a.push(o.index);if(a.length===0||a.length>1)return null;let s=a[0],i=s,c=0;for(;i<r.length;){let l=r.indexOf("<",i);if(l===-1)break;if(r.startsWith("<w:p",l)){let u=r[l+4];if(u===">"||u===" "||u==="/"){let g=r.indexOf(">",l);if(g===-1)break;if(r[g-1]==="/"){if(c===0)return {start:s,end:g+1};i=g+1;}else c++,i=g+1;}else i=l+1;}else if(r.startsWith("</w:p>",l)){if(c--,c===0)return {start:s,end:l+6};i=l+6;}else i=l+1;}return null}function Q(r,t){let e=G(r,t);return e?r.substring(e.start,e.end):null}function q(r){let t=0,e=/<w:p[\s>]/g,n;for(;(n=e.exec(r))!==null;){let a=n.index,o=r[a+4];(o===">"||o===" ")&&t++;}return t}function X(r){let t=new Map,e=/w14:paraId="([^"]+)"/g,n;for(;(n=e.exec(r))!==null;){let a=n[1];t.set(a,(t.get(a)||0)+1);}return t}function tt(r,t,e){if(e.size===0)return {safe:true};let n=X(r),a=X(t);for(let i of e){let c=n.get(i)||0;if(c===0)return {safe:false,reason:`paraId-not-found-in-original: ${i}`};if(c>1)return {safe:false,reason:`duplicate-paraId-in-original: ${i}`}}for(let i of e){let c=a.get(i)||0;if(c===0)return {safe:false,reason:`paraId-not-found-in-serialized: ${i}`};if(c>1)return {safe:false,reason:`duplicate-paraId-in-serialized: ${i}`}}let o=q(r),s=q(t);return o!==s?{safe:false,reason:`paragraph-count-mismatch: original=${o}, serialized=${s}`}:{safe:true}}function Z(r,t,e){if(e.size===0)return r;if(!tt(r,t,e).safe)return null;let a=[];for(let s of e){let i=G(r,s);if(!i)return null;let c=Q(t,s);if(!c)return null;a.push({start:i.start,end:i.end,newXml:c});}a.sort((s,i)=>i.start-s.start);let o=r;for(let{start:s,end:i,newXml:c}of a)o=o.substring(0,s)+c+o.substring(i);return o}function et(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(r){for(let t of r)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let n of e.content)if(n.type==="drawing"&&n.image?.src?.startsWith("data:")&&!n.image?.rId)return true}else if(e.type==="hyperlink"&&e.href&&!e.rId&&!e.anchor)return true}else if(t.type==="table"){for(let e of t.rows)for(let n of e.cells)if(J(n.content))return true}return false}async function Y(r,t,e){let{changedParaIds:n,structuralChange:a,hasUntrackedChanges:o}=e;if(a||o||!t)return null;let s=r.package.document.content;if(J(s))return null;let i=r.package.document.comments,c=i&&i.length>0,l=chunkMHUCHYNM_cjs.j(r);try{let g=await(await import('./lib-HOLGQI5K.cjs')).default.loadAsync(t),f=new Map;if(n.size>0){let p=g.file("word/document.xml");if(!p)return null;let m=await p.async("text"),b=chunkMHUCHYNM_cjs.c(r),d=Z(m,b,n);if(!d)return null;f.set("word/document.xml",d);}if(c){f.set("word/comments.xml",chunkMHUCHYNM_cjs.d(i));let p=g.file("[Content_Types].xml");if(p){let d=await p.async("text");d.includes("/word/comments.xml")||f.set("[Content_Types].xml",d.replace("</Types>",`<Override PartName="/word/comments.xml" ContentType="${chunkMHUCHYNM_cjs.g}"/></Types>`));}let m="word/_rels/document.xml.rels",b=g.file(m);if(b){let d=await b.async("text");if(!d.includes("comments.xml")){let x=chunkMHUCHYNM_cjs.e(d);f.set(m,d.replace("</Relationships>",`<Relationship Id="rId${x+1}" Type="${chunkCL62W2HQ_cjs.a.comments}" Target="comments.xml"/></Relationships>`));}}}for(let[p,m]of l)f.set(p,m);let y=g.file("docProps/core.xml");if(y){let p=await y.async("text");f.set("docProps/core.xml",chunkMHUCHYNM_cjs.k(p,{updateModifiedDate:!0}));}return await chunkMHUCHYNM_cjs.i(g,f)}catch{return null}}function nt(){return [{styleId:"Normal",type:"paragraph",name:"Normal",default:true,qFormat:true,uiPriority:0,rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},{styleId:"Title",type:"paragraph",name:"Title",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:10,rPr:{fontSize:52,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:240}},{styleId:"Subtitle",type:"paragraph",name:"Subtitle",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:11,rPr:{fontSize:30,color:{rgb:"666666"},fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:240}},{styleId:"Heading1",type:"paragraph",name:"Heading 1",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:40,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:400,spaceAfter:120,lineSpacing:240}},{styleId:"Heading2",type:"paragraph",name:"Heading 2",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:32,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:360,spaceAfter:80,lineSpacing:240}},{styleId:"Heading3",type:"paragraph",name:"Heading 3",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:28,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:320,spaceAfter:80,lineSpacing:240}},{styleId:"Heading4",type:"paragraph",name:"Heading 4",basedOn:"Normal",next:"Normal",qFormat:true,uiPriority:9,rPr:{fontSize:24,bold:true,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{spaceBefore:280,spaceAfter:80,lineSpacing:240}}]}function rt(){return {pageWidth:12240,pageHeight:15840,orientation:"portrait",marginTop:1440,marginBottom:1440,marginLeft:1440,marginRight:1440,headerDistance:720,footerDistance:720,gutter:0,columnCount:1,columnSpace:720,equalWidth:true,sectionStart:"nextPage",verticalAlign:"top"}}function at(r={}){let t=rt();r.pageWidth!==void 0&&(t.pageWidth=r.pageWidth),r.pageHeight!==void 0&&(t.pageHeight=r.pageHeight),r.orientation!==void 0&&(t.orientation=r.orientation),r.marginTop!==void 0&&(t.marginTop=r.marginTop),r.marginBottom!==void 0&&(t.marginBottom=r.marginBottom),r.marginLeft!==void 0&&(t.marginLeft=r.marginLeft),r.marginRight!==void 0&&(t.marginRight=r.marginRight);let e={type:"text",text:r.initialText||""};return {package:{document:{content:[{type:"paragraph",content:[{type:"run",content:r.initialText?[e]:[],formatting:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}}}],formatting:{lineSpacing:276}}],finalSectionProperties:t},styles:{docDefaults:{rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},styles:nt()}},templateVariables:[],warnings:[]}}function Wt(r,t={}){return at({...t,initialText:r})}var T=class r{constructor(t){chunkPCJ5ACUV_cjs.d(this,"_document");chunkPCJ5ACUV_cjs.d(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 chunkCL62W2HQ_cjs.n(t);return new r(e)}static fromDocument(t){return new r(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 chunkJ5YOIHCW_cjs.a(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[n,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:n,name:o.name||n,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.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(s=>s.type==="paragraph"),a=n.map((s,i)=>{let c=this._getParagraphText(s),l=s.formatting?.styleId;return {index:i,preview:c.slice(0,t),style:l,isHeading:l?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(l),isListItem:!!s.listRendering,isEmpty:c.trim().length===0}}),o=(e.sections||[]).map((s,i)=>({index:i,paragraphCount:s.content?.length||0,pageSize:s.properties?.pageWidth&&s.properties?.pageHeight?{width:s.properties.pageWidth,height:s.properties.pageHeight}:void 0,isLandscape:s.properties?.orientation==="landscape",hasHeader:!!s.properties?.headerReferences?.length,hasFooter:!!s.properties?.footerReferences?.length}));return {paragraphCount:n.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:a,sections:o,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,n={}){let a={type:"insertText",position:t,text:e,formatting:n.formatting};return this._executeCommand(a)}replaceRange(t,e,n={}){let a={type:"replaceText",range:t,text:e,formatting:n.formatting};return this._executeCommand(a)}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,a={}){let o={type:"insertTable",position:t,rows:e,columns:n,data:a.data,hasHeader:a.hasHeader};return this._executeCommand(o)}insertImage(t,e,n={}){let a={type:"insertImage",position:t,src:e,width:n.width,height:n.height,alt:n.alt};return this._executeCommand(a)}insertHyperlink(t,e,n={}){let a={type:"insertHyperlink",range:t,url:e,displayText:n.displayText,tooltip:n.tooltip};return this._executeCommand(a)}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:a}=await import('./processTemplate-BXZKWRQD.cjs'),o=a(n,e),s=await chunkCL62W2HQ_cjs.n(o),i=new r(s);return i._pendingVariables={},i}async toBuffer(t){if(this._document.originalBuffer){if(t?.selective){let n=await Y(this._document,this._document.originalBuffer,t.selective);if(n)return this._document.originalBuffer=n,n}let e=await chunkMHUCHYNM_cjs.f(this._document);return this._document.originalBuffer=e,e}return chunkMHUCHYNM_cjs.l(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 r(chunkP7ZF45KZ_cjs.b(this._document,t))}_executeCommand(t){let e=new r(chunkP7ZF45KZ_cjs.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
|
+
`)}_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 a of n.cells)for(let o of a.content)o.type==="paragraph"&&e.push(this._getParagraphText(o));return e.join(" ")}_extractParagraphSegments(t,e){for(let n of t.content)if(n.type==="run"){let a=this._getRunText(n);a&&e.push({text:a,formatting:n.formatting});}else if(n.type==="hyperlink"){let a=n.href||"";for(let o of n.children)if(o.type==="run"){let s=this._getRunText(o);s&&e.push({text:s,formatting:o.formatting,isHyperlink:true,hyperlinkUrl:a});}}}_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 a of n.content)if(a.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 Gt(r){return T.fromBuffer(r)}function Zt(r){return T.fromDocument(r)}function ot(r,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:n=50}=t,a=r.package.document,o=a.content.filter(m=>m.type==="paragraph"),s=it(o,e,n),i=chunkJ5YOIHCW_cjs.a(r),c=st(r),l=ct(a),u=lt(a),g=pt(a),f=a.content.some(m=>m.type==="table"),y=ft(a),p=mt(a);return {paragraphCount:o.length,wordCount:u,characterCount:g,variables:i,variableCount:i.length,availableStyles:c,outline:s,sections:l,hasTables:f,hasImages:y,hasHyperlinks:p}}function Qt(r,t,e={}){let{contextChars:n=200,includeSuggestions:a=true}=e,s=r.package.document.content.filter(x=>x.type==="paragraph"),i=s[t.start.paragraphIndex];if(!i)throw new Error(`Paragraph not found at index ${t.start.paragraphIndex}`);let c=h(i),l="";if(t.start.paragraphIndex===t.end.paragraphIndex)l=c.slice(t.start.offset,t.end.offset);else {let x=[];for(let C=t.start.paragraphIndex;C<=t.end.paragraphIndex;C++){let H=s[C];if(!H)continue;let w=h(H);C===t.start.paragraphIndex?x.push(w.slice(t.start.offset)):C===t.end.paragraphIndex?x.push(w.slice(0,t.end.offset)):x.push(w);}l=x.join(`
|
|
3
3
|
`);}let u=yt(s,t.start.paragraphIndex,t.start.offset,n),g=xt(s,t.end.paragraphIndex,t.end.offset,n),f=bt(i,t.start.offset),y=i.formatting||{},p={index:t.start.paragraphIndex,fullText:c,style:i.formatting?.styleId,wordCount:F(c)},m=false,b=Pt(i,t.start.offset),d=a?Ct(l):[];return {selectedText:l,range:t,formatting:f,paragraphFormatting:y,textBefore:u,textAfter:g,paragraph:p,inTable:m,inHyperlink:b,suggestedActions:d}}function K(r){let t=ot(r,{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(a=>a.isHeading);if(n.length>0){e.push(`
|
|
4
4
|
Headings:`);for(let a of n.slice(0,5)){let o=a.headingLevel||1;e.push(`${" ".repeat(o-1)}- ${a.preview}`);}n.length>5&&e.push(` ... and ${n.length-5} more headings`);}return e.join(" ")}function it(r,t,e){let n=[];for(let a=0;a<Math.min(r.length,e);a++){let o=r[a],s=h(o),i=o.formatting?.styleId;n.push({index:a,preview:s.slice(0,t),style:i,isHeading:dt(i),headingLevel:ht(i),isListItem:!!o.listRendering,isEmpty:s.trim().length===0});}return n}function st(r){let t=r.package.styles;if(!t?.styles)return [];let e=[];for(let[n,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:n,name:o.name||n,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.default});}return e}function ct(r){return r.sections?r.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 lt(r){let t=0;for(let e of r.content)if(e.type==="paragraph"){let n=h(e);t+=F(n);}else e.type==="table"&&(t+=ut(e));return t}function F(r){return r.split(/\s+/).filter(e=>e.length>0).length}function pt(r){let t=0;for(let e of r.content)if(e.type==="paragraph"){let n=h(e);t+=n.length;}else e.type==="table"&&(t+=gt(e));return t}function ut(r){let t=0;for(let e of r.rows)for(let n of e.cells)for(let a of n.content)if(a.type==="paragraph"){let o=h(a);t+=F(o);}return t}function gt(r){let t=0;for(let e of r.rows)for(let n of e.cells)for(let a of n.content)if(a.type==="paragraph"){let o=h(a);t+=o.length;}return t}function h(r){let t=[];for(let e of r.content)e.type==="run"?t.push(k(e)):e.type==="hyperlink"&&t.push(v(e));return t.join("")}function k(r){return r.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function v(r){let t=[];for(let e of r.children)e.type==="run"&&t.push(k(e));return t.join("")}function ft(r){for(let t of r.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 mt(r){for(let t of r.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="hyperlink")return true}return false}function dt(r){return r?r.toLowerCase().includes("heading"):false}function ht(r){if(!r)return;let t=r.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}function yt(r,t,e,n){let a=[],o=0,s=r[t];if(s){let l=h(s).slice(0,e);a.unshift(l),o+=l.length;}for(let c=t-1;c>=0&&o<n;c--){let l=r[c];if(!l)continue;let u=h(l);a.unshift(u),o+=u.length;}let i=a.join(`
|
|
5
5
|
`);return i.length>n?"..."+i.slice(-n):i}function xt(r,t,e,n){let a=[],o=0,s=r[t];if(s){let l=h(s).slice(e);a.push(l),o+=l.length;}for(let c=t+1;c<r.length&&o<n;c++){let l=r[c];if(!l)continue;let u=h(l);a.push(u),o+=u.length;}let i=a.join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function ae(e,t,r,n){let a=e-t-r,o=(n.count-1)*n.gap;return (a-o)/n.count}function U(e){let{pageSize:t,margins:r}=e,n=e.columns??{count:1,gap:0},a=[],o=[],c=r.top,i=t.h-r.bottom;if(i-c<=0)throw new Error("Paginator: page size and margins yield no content area");let u=ae(t.w,r.left,r.right,n),g=c;function l(p){return r.left+p*(u+n.gap)}function m(){let p=a.length+1,S=e.footnoteReservedHeights?.get(p)??0,T=i-S,w={number:p,fragments:[],margins:{...r},size:{...t},footnoteReservedHeight:S>0?S:void 0,columns:n.count>1?{...n}:void 0},C={page:w,cursorY:c,columnIndex:0,topMargin:c,contentBottom:T,trailingSpacing:0};return a.push(w),o.push(C),g=c,e.onNewPage&&e.onNewPage(C),C}function f(){return o.length===0?m():o[o.length-1]}function x(p){return p.contentBottom-p.cursorY}function h(p,S){let T=S||f();return x(T)>=p}function b(p){return p.columnIndex<n.count-1?(p.columnIndex+=1,p.cursorY=g,p.trailingSpacing=0,p):m()}function d(p){let S=f(),T=Number.isFinite(p)&&p>0?p:0,w=S.contentBottom-S.topMargin;if(T>w)return S.cursorY!==S.topMargin&&(S=b(S)),S;for(;!h(T,S);)S=b(S);return S}function k(p,S,T=0,w=0){let C=Math.max(T,f().trailingSpacing),R=C+S,I=d(R),H=I.cursorY===I.topMargin?0:C,L=l(I.columnIndex),B=I.cursorY+H;return p.x=L,p.y=B,I.page.fragments.push(p),I.cursorY=B+S,I.trailingSpacing=w,{state:I,x:L,y:B}}function y(){return m()}function F(){let p=f();return b(p)}function M(p){n=p,u=ae(t.w,r.left,r.right,n);let S=f();S.page.columns=n.count>1?{...n}:void 0,g=S.cursorY,S.columnIndex=0;}return {pages:a,states:o,get columnWidth(){return u},get columns(){return {...n}},getCurrentState:f,getAvailableHeight:()=>x(f()),fits:p=>h(p),ensureFits:d,addFragment:k,forcePageBreak:y,forceColumnBreak:F,getColumnX:l,updateColumns:M}}function j(e){let t=new Map,r=new Set;for(let n=0;n<e.length;n++){if(r.has(n))continue;let a=e[n];if(a.kind!=="paragraph"||!a.attrs?.keepNext)continue;let c=[n],i=n;for(let g=n+1;g<e.length;g++){let l=e[g];if(l.kind==="sectionBreak"||l.kind==="pageBreak"||l.kind==="columnBreak"||l.kind!=="paragraph")break;if(l.attrs?.keepNext)c.push(g),i=g,r.add(g);else break}let s=i+1,u=-1;if(s<e.length){let g=e[s];g.kind!=="sectionBreak"&&g.kind!=="pageBreak"&&g.kind!=="columnBreak"&&(u=s);}t.set(n,{startIndex:n,endIndex:i,memberIndices:c,anchorIndex:u});}return t}function q(e,t,r){let n=0;for(let a of e.memberIndices){let o=t[a],c=r[a];if(o.kind!=="paragraph"||c.kind!=="paragraph")continue;let i=o,s=c,u=i.attrs?.spacing?.before??0;n+=u,n+=s.totalHeight;let g=i.attrs?.spacing?.after??0;n+=g;}if(e.anchorIndex!==-1){let a=r[e.anchorIndex];if(a?.kind==="paragraph"){let o=a;o.lines.length>0&&(n+=o.lines[0].lineHeight);}}return n}function K(e){let t=new Set;for(let r of e.values())for(let n=1;n<r.memberIndices.length;n++)t.add(r.memberIndices[n]);return t}function $(e){return e.kind!=="paragraph"?false:e.attrs?.pageBreakBefore===true}var We={top:4,bottom:4,left:7,right:7},Ue=200;var Be={w:816,h:1056},O={top:96,right:96,bottom:96,left:96};function ie(e){return e.attrs?.spacing?.before??0}function se(e){return e.attrs?.spacing?.after??0}function Fe(e){for(let t=0;t<e.length-1;t++){let r=e[t],n=e[t+1];if(r.kind!=="paragraph"||n.kind!=="paragraph")continue;let a=r.attrs,o=n.attrs;a?.contextualSpacing&&o?.contextualSpacing&&a.styleId&&a.styleId===o.styleId&&(a.spacing&&(a.spacing={...a.spacing,after:0}),o.spacing&&(o.spacing={...o.spacing,before:0}));}}function rt(e,t,r={}){if(e.length!==t.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${e.length}, measures=${t.length})`);let n=r.pageSize??Be,a={top:r.margins?.top??O.top,right:r.margins?.right??O.right,bottom:r.margins?.bottom??O.bottom,left:r.margins?.left??O.left,header:r.margins?.header??r.margins?.top??O.top,footer:r.margins?.footer??r.margins?.bottom??O.bottom};r.headerContentHeights,r.footerContentHeights,r.titlePage,r.evenAndOddHeaders;let o={...a},c=n.w-o.left-o.right;if(c<=0)throw new Error("layoutDocument: page size and margins yield no content area");let i={count:1,gap:0},s=[],u=[];for(let h=0;h<e.length;h++)if(e[h].kind==="sectionBreak"){let b=e[h];s.push(b.columns??i),u.push(b.type);}s.push(r.columns??i),u.push(r.bodyBreakType);let g=s.length>0?s[0]:r.columns,l=U({pageSize:n,margins:o,columns:g,footnoteReservedHeights:r.footnoteReservedHeights});Fe(e);let m=j(e),f=K(m),x=0;for(let h=0;h<e.length;h++){let b=e[h],d=t[h];$(b)&&l.forcePageBreak();let k=m.get(h);if(k&&!f.has(h)){let y=q(k,e,t),F=l.getCurrentState(),M=l.getAvailableHeight(),p=F.contentBottom-F.topMargin;y<=p&&y>M&&F.page.fragments.length>0&&l.forcePageBreak();}switch(b.kind){case "paragraph":Me(b,d,l,c);break;case "table":b.floating?Te(b,d,l,c):we(b,d,l);break;case "image":Ce(b,d,l);break;case "textBox":Re(b,d,l);break;case "pageBreak":l.forcePageBreak();break;case "columnBreak":l.forceColumnBreak();break;case "sectionBreak":{let y=u[x+1]??u[x];Le(b,l,s[x+1]??i,y),x++;break}}}return l.pages.length===0&&l.getCurrentState(),{pageSize:n,pages:l.pages,columns:r.columns,pageGap:r.pageGap}}function Me(e,t,r,n){if(t.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let a=t.lines;if(a.length===0){let s=ie(e),u=se(e),g=r.getCurrentState(),l={kind:"paragraph",blockId:e.id,x:r.getColumnX(g.columnIndex),y:g.cursorY+s,width:n,height:0,fromLine:0,toLine:0,pmStart:e.pmStart,pmEnd:e.pmEnd};r.addFragment(l,0,s,u);return}let o=ie(e),c=se(e),i=0;for(;i<a.length;){let s=r.getCurrentState(),u=r.getAvailableHeight(),g=0,l=0;for(let k=i;k<a.length;k++){let y=a[k].lineHeight,F=g+y;if((i===0&&k===i?F+o:F)<=u||l===0)g=F,l++;else break}let m=i===0,f=i+l>=a.length,x=m?o:0,h=f?c:0,b={kind:"paragraph",blockId:e.id,x:r.getColumnX(s.columnIndex),y:0,width:n,height:g,fromLine:i,toLine:i+l,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!m,continuesOnNext:!f},d=r.addFragment(b,g,x,h);b.y=d.y,i+=l,i<a.length&&r.ensureFits(a[i].lineHeight);}}function Pe(e){let t=0;for(let r of e.rows)if(r.isHeader)t++;else break;return t}function z(e,t){let r=0;for(let n=0;n<t&&n<e.rows.length;n++)r+=e.rows[n].height;return r}function we(e,t,r){if(t.kind!=="table")throw new Error("layoutTable: expected table measure");let n=t.rows;if(n.length===0)return;let a=Pe(e),o=z(t,a),c=0;for(;c<n.length;){let i=r.getCurrentState(),s=r.getAvailableHeight(),u=c===0,g=u?i.trailingSpacing:0,l=s-g,m=!u&&a>0?o:0,f=0,x=0;for(let F=c;F<n.length;F++){let M=n[F].height;if(f+M+m<=l||x===0)f+=M,x++;else break}let h=f+m,b=c+x>=n.length,d=r.getColumnX(i.columnIndex);e.justification==="center"?d=d+(r.columnWidth-t.totalWidth)/2:e.justification==="right"?d=d+r.columnWidth-t.totalWidth:e.indent&&(d+=e.indent);let k={kind:"table",blockId:e.id,x:d,y:0,width:t.totalWidth,height:h,fromRow:c,toRow:c+x,pmStart:e.pmStart,pmEnd:e.pmEnd,continuesFromPrev:!u,continuesOnNext:!b,headerRowCount:!u&&a>0?a:void 0},y=r.addFragment(k,h,0,0);if(k.y=y.y,k.x=d,c+=x,c<n.length){let F=n[c].height+(a>0?o:0);r.ensureFits(F);}}}function Te(e,t,r,n){if(t.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let a=r.getCurrentState(),o=e.floating,c=a.page,i=c.margins,s=t.totalWidth,u=t.totalHeight,g=c.size.h-i.top-i.bottom,l=i.left,m=i.top;o?.horzAnchor==="page"&&(l=0),o?.vertAnchor==="page"&&(m=0);let f=r.getColumnX(a.columnIndex);if(o?.tblpX!==void 0)f=l+o.tblpX;else if(o?.tblpXSpec){let y=o.tblpXSpec;y==="left"||y==="inside"?f=l:y==="right"||y==="outside"?f=l+n-s:y==="center"&&(f=l+(n-s)/2);}else e.justification==="center"?f=l+(n-s)/2:e.justification==="right"&&(f=l+n-s);let x=a.cursorY,h=false;if(o?.tblpY!==void 0)x=m+o.tblpY,h=true;else if(o?.tblpYSpec){h=true;let y=o.tblpYSpec;y==="top"?x=m:y==="bottom"?x=m+g-u:y==="center"&&(x=m+(g-u)/2);}h||(x=r.ensureFits(u).cursorY);let b=i.left,d=i.left+n-s;Number.isFinite(d)&&(f=Math.max(b,Math.min(f,d)));let k={kind:"table",blockId:e.id,x:f,y:x,width:s,height:u,fromRow:0,toRow:e.rows.length,pmStart:e.pmStart,pmEnd:e.pmEnd,isFloating:true};a.page.fragments.push(k);}function Ce(e,t,r){if(t.kind!=="image")throw new Error("layoutImage: expected image measure");if(e.anchor?.isAnchored){Ie(e,t,r);return}let n=r.ensureFits(t.height),a={kind:"image",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Ie(e,t,r){let n=r.getCurrentState(),a=e.anchor,o=a.offsetH??r.getColumnX(n.columnIndex),c=a.offsetV??n.cursorY,i={kind:"image",blockId:e.id,x:o,y:c,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd,isAnchored:true,zIndex:a.behindDoc?-1:1};n.page.fragments.push(i);}function Re(e,t,r){if(t.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");let n=r.ensureFits(t.height),a={kind:"textBox",blockId:e.id,x:r.getColumnX(n.columnIndex),y:0,width:t.width,height:t.height,pmStart:e.pmStart,pmEnd:e.pmEnd},o=r.addFragment(a,t.height,0,0);a.y=o.y;}function Le(e,t,r,n){switch(n??"nextPage"){case "nextPage":t.forcePageBreak();break;case "evenPage":{t.forcePageBreak().page.number%2!==0&&t.forcePageBreak();break}case "oddPage":{t.forcePageBreak().page.number%2===0&&t.forcePageBreak();break}}t.updateColumns(r);}var ve={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1499},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1499},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},He={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function Ee(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function ce(e){let t=e.trim().toLowerCase(),r=ve[t];if(r)return {googleFont:r.googleFont,cssFallback:r.fallbackStack.map(le).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:r.singleLineRatio};let n=Ee(e),a=He[n];return {googleFont:null,cssFallback:`${le(e)}, ${a}`,originalFont:e,hasGoogleEquivalent:false,singleLineRatio:1.15}}function le(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function ct(e,t){if(!t)return null;let n=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!n)return null;let a=e.toLowerCase();return a.includes("eastasia")||a.includes("ea")?n.ea??n.latin??null:a.includes("cs")||a.includes("bidi")?n.cs??n.latin??null:n.latin??null}var ge=96,me=11,pe="Calibri",Ne=1,Oe=.8,ze=.2,_=null;function J(){if(!_){let e=typeof document<"u"?document.createElement("canvas"):null;if(!e)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(_=e.getContext("2d"),!_)throw new Error("Failed to get 2D context from canvas")}return _}function pt(){_=null;}var ue=new Map;function fe(e){let t=ue.get(e);if(t===void 0){let r=ce(e);t={cssFallback:r.cssFallback,singleLineRatio:r.singleLineRatio},ue.set(e,t);}return t}function _e(e){return fe(e).cssFallback}function V(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let r=e.fontSize??me,n=de(r);t.push(`${n}px`);let a=e.fontFamily??pe;return t.push(_e(a)),t.join(" ")}function Ye(e){let t=e.fontSize??me,r=e.fontFamily??pe,n=de(t),a=n*Oe,o=n*ze,c=n*Ne;try{let s=J();s.font=V(e);let u=s.measureText("Hg");typeof u.actualBoundingBoxAscent=="number"&&typeof u.actualBoundingBoxDescent=="number"&&(a=u.actualBoundingBoxAscent,o=u.actualBoundingBoxDescent);}catch{}c=Math.max(c,a+o);let i=fe(r).singleLineRatio;return {fontSize:t,ascent:a,descent:o,lineHeight:c,fontFamily:r,singleLineRatio:i}}function ft(e,t){if(!e)return 0;let r=J();r.font=V(t);let a=r.measureText(e).width;return t.letterSpacing&&e.length>1&&(a+=t.letterSpacing*(e.length-1)),a}function Q(e,t){let r=Ye(t);if(!e)return {width:0,charWidths:[],metrics:r};let n=J();n.font=V(t);let a=t.letterSpacing??0,o=[],c=0;for(let i=0;i<e.length;i++){let s=e[i],g=n.measureText(s).width;a&&i<e.length-1&&(g+=a),o.push(g),c+=g;}return {width:c,charWidths:o,metrics:r}}function dt(e,t){if(t.length===0||e<=0)return 0;let r=0;for(let n=0;n<t.length;n++){let a=t[n],o=r+a/2;if(e<=o)return n;r+=a;}return t.length}function de(e){return e*ge/72}function Z(e,t){let r=e.pageGap??0,n=0;for(let a=0;a<t&&a<e.pages.length;a++){let c=e.pages[a].size?.h??e.pageSize.h;n+=c+r;}return n}function he(e,t){return e.findIndex(r=>r.id===t)}function Xe(e,t){let r=0;for(let n=e.fromLine;n<e.toLine&&n<t.lines.length;n++)r+=t.lines[n].lineHeight;return r}function xt(e,t,r,n){let a=[...e.page.fragments].sort((o,c)=>{let i=o.y-c.y;return Math.abs(i)>.5?i:o.x-c.x});for(let o of a){let c=he(t,o.blockId);if(c===-1)continue;let i=t[c],s=r[c];if(!i||!s)continue;let u;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||s.kind!=="paragraph")continue;u=Xe(o,s);}else if(o.kind==="table")u=o.height;else if(o.kind==="image")u=o.height;else continue;let g=n.x>=o.x&&n.x<=o.x+o.width,l=n.y>=o.y&&n.y<=o.y+u;if(g&&l)return {fragment:o,block:i,measure:s,pageIndex:e.pageIndex,localX:n.x-o.x,localY:n.y-o.y}}return null}function kt(e,t,r,n){for(let a of e.page.fragments){if(a.kind!=="table")continue;let o=a,c=n.x>=o.x&&n.x<=o.x+o.width,i=n.y>=o.y&&n.y<=o.y+o.height;if(!c||!i)continue;let s=he(t,o.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="table"||!g||g.kind!=="table")continue;let l=u,m=g,f=n.x-o.x,x=n.y-o.y,h=o.headerRowCount??0,b=h>0&&o.continuesFromPrev?z(m,h):0,d=0,k=-1;if(m.rows.length===0||l.rows.length===0)continue;if(b>0&&x<b){let B=0;for(let P=0;P<h&&P<m.rows.length;P++){let E=m.rows[P];if(x>=B&&x<B+E.height){k=P;break}B+=E.height;}k===-1&&(k=0);}else {let B=x-b;for(let P=o.fromRow;P<o.toRow&&P<m.rows.length;P++){let E=m.rows[P];if(B>=d&&B<d+E.height){k=P;break}d+=E.height;}}if(k===-1&&(k=Math.min(o.toRow-1,m.rows.length-1),k<o.fromRow))continue;let y=m.rows[k],F=l.rows[k];if(!y||!F)continue;let M=0,p=-1;if(y.cells.length===0||F.cells.length===0)continue;for(let B=0;B<y.cells.length;B++){let P=y.cells[B];if(f>=M&&f<M+P.width){p=B;break}M+=P.width;}if(p===-1&&(p=y.cells.length-1,p<0))continue;let S=y.cells[p],T=F.cells[p];if(!S||!T)continue;let w=0;if(b>0&&k<h)for(let B=0;B<k;B++)w+=m.rows[B]?.height??0;else {w=b;for(let B=o.fromRow;B<k;B++)w+=m.rows[B]?.height??0;}let R=0;for(let B=0;B<p;B++)R+=y.cells[B]?.width??0;let I,v;if(T.blocks&&T.blocks.length>0){let B=T.blocks[0],P=S.blocks[0];B.kind==="paragraph"&&P?.kind==="paragraph"&&(I=B,v=P);}let H=f-R,L=x-w;return {fragment:o,block:l,measure:m,pageIndex:e.pageIndex,rowIndex:k,colIndex:p,cellBlock:I,cellMeasure:v,cellLocalX:Math.max(0,H),cellLocalY:Math.max(0,L)}}return null}function be(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(r=>r.id===t)}function D(e,t){let n=(e.pmStart??0)+1,a=0,o;for(let s=0;s<e.runs.length&&s<=t.toRun;s++){let u=e.runs[s];if(u){if(s<t.fromRun)u.kind==="text"?a+=(u.text??"").length:a+=1;else if(s===t.fromRun){a+=t.fromChar,o=n+a;break}}}o===void 0&&(o=n);let c=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let u=e.runs[s];if(u)if(u.kind==="text"){let g=u.text??"",l=s===t.fromRun?t.fromChar:0,m=s===t.toRun?t.toChar:g.length;c+=m-l;}else c+=1;}let i=o+c;return {pmStart:o,pmEnd:i}}function xe(e,t,r,n){let a=[];for(let o=0;o<t.lines.length;o++){let c=t.lines[o],i=D(e,c);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>r&&i.pmStart<n&&a.push({line:c,index:o});}return a}function Y(e,t,r){let n=D(e,t);return n.pmStart===void 0?0:Math.max(0,r-n.pmStart)}function X(e,t,r,n){let a=0,o=0;for(let c=t.fromRun;c<=t.toRun&&c<e.runs.length;c++){let i=e.runs[c];if(i){if(i.kind==="tab"){let s=i.width??48;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="image"){let s=i.width;if(o+1>=r)return r<=o?a:a+s;a+=s,o+=1;continue}if(i.kind==="lineBreak"){if(r<=o)return a;o+=1;continue}if(i.kind==="text"){let s=i.text??"",u=c===t.fromRun,g=c===t.toRun,l=u?t.fromChar:0,m=g?t.toChar:s.length,f=s.slice(l,m);if(o+f.length>=r){let b=r-o,d=be(i),k=Q(f.slice(0,b),d);return a+k.width}let x=be(i),h=Q(f,x);a+=h.width,o+=f.length;}}}return a}function G(e,t){let r=0;for(let n=0;n<t&&n<e.lines.length;n++)r+=e.lines[n].lineHeight;return r}function Mt(e,t,r,n,a){if(n===a)return [];let o=Math.min(n,a),c=Math.max(n,a),i=[];for(let s=0;s<e.pages.length;s++){let u=e.pages[s],g=Z(e,s);for(let l of u.fragments){if(l.kind==="paragraph"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let h=f,b=x,d=l,k=xe(h,b,o,c);for(let{line:y,index:F}of k){if(F<d.fromLine||F>=d.toLine)continue;let M=D(h,y);if(M.pmStart===void 0||M.pmEnd===void 0)continue;let p=Math.max(M.pmStart,o),S=Math.min(M.pmEnd,c);if(p>=S)continue;let T=Y(h,y,p),w=Y(h,y,S),C=h.attrs?.indent,R=C?.left??0,I=C?.right??0,v=Math.max(0,l.width-R-I),H=X(h,y,T),L=X(h,y,w),B=h.attrs?.alignment??"left",P=0;B==="center"?P=Math.max(0,(v-y.width)/2):B==="right"&&(P=Math.max(0,v-y.width));let E=G(b,F)-G(b,d.fromLine),A=l.x+R+P+Math.min(H,L),W=Math.max(1,Math.abs(L-H)),N=l.y+E;i.push({x:A,y:N+g,width:W,height:y.lineHeight,pageIndex:s});}}if(l.kind==="table"){let m=ee(t,l.blockId);if(m===-1)continue;let f=t[m],x=r[m];if(!f||f.kind!=="table"||!x||x.kind!=="table")continue;let h=f,b=x,d=l,k=d.headerRowCount??0,F=k>0&&d.continuesFromPrev?z(b,k):0;for(let M=d.fromRow;M<d.toRow&&M<h.rows.length;M++){let p=h.rows[M],S=b.rows[M];if(!p||!S)continue;let T=0;for(let w=0;w<p.cells.length;w++){let C=p.cells[w],R=S.cells[w];if(!(!C||!R)){for(let I=0;I<C.blocks.length;I++){let v=C.blocks[I],H=R.blocks[I];if(!v||v.kind!=="paragraph"||!H||H.kind!=="paragraph")continue;let L=v,B=H,P=xe(L,B,o,c),E=0;for(let{line:A,index:W}of P){let N=D(L,A);if(N.pmStart===void 0||N.pmEnd===void 0)continue;let te=Math.max(N.pmStart,o),ne=Math.min(N.pmEnd,c);if(te>=ne)continue;let ke=Y(L,A,te),ye=Y(L,A,ne),re=X(L,A,ke,R.width),oe=X(L,A,ye,R.width),Se=G(B,W);i.push({x:d.x+T+Math.min(re,oe),y:d.y+F+E+Se+g,width:Math.max(1,Math.abs(oe-re)),height:A.lineHeight,pageIndex:s});}E+=B.totalHeight;}T+=R.width;}}F+=S.height;}}if(l.kind==="image"){let m=l.pmStart??0;(l.pmEnd??m+1)>o&&m<c&&i.push({x:l.x,y:l.y+g,width:l.width,height:l.height,pageIndex:s});}}}return i}function Pt(e,t,r,n){for(let a=0;a<e.pages.length;a++){let o=e.pages[a],c=Z(e,a);for(let i of o.fragments){if(i.kind==="paragraph"){let s=ee(t,i.blockId);if(s===-1)continue;let u=t[s],g=r[s];if(!u||u.kind!=="paragraph"||!g||g.kind!=="paragraph")continue;let l=u,m=g,f=i,x=l.pmStart??0,h=l.pmEnd??x;if(n<x||n>h)continue;for(let b=f.fromLine;b<f.toLine;b++){let d=m.lines[b];if(!d)continue;let k=D(l,d);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let y=Y(l,d,n),F=l.attrs?.indent,M=F?.left??0,p=F?.right??0,S=Math.max(0,i.width-M-p),T=X(l,d,y),w=l.attrs?.alignment??"left",C=0;w==="center"?C=Math.max(0,(S-d.width)/2):w==="right"&&(C=Math.max(0,S-d.width));let R=G(m,b)-G(m,f.fromLine);return {x:i.x+M+C+T,y:i.y+R+c,height:d.lineHeight,pageIndex:a}}}}if(i.kind==="image"){let s=i.pmStart??0,u=i.pmEnd??s+1;if(n>=s&&n<=u){let g=n===s?0:i.width;return {x:i.x+g,y:i.y+c,height:i.height,pageIndex:a}}}}}return null}function wt(e){return e.length<=1?false:new Set(e.map(r=>r.pageIndex)).size>1}function Tt(e){let t=new Map;for(let r of e){let n=t.get(r.pageIndex)??[];n.push(r),t.set(r.pageIndex,n);}return t}exports.a=ce;exports.b=ct;exports.c=We;exports.d=Ue;exports.e=rt;exports.f=pt;exports.g=Ye;exports.h=ft;exports.i=Q;exports.j=dt;exports.k=de;exports.l=xt;exports.m=kt;exports.n=Mt;exports.o=Pt;exports.p=wt;exports.q=Tt;
|