@eigenpal/docx-js-editor 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-3IYNTJO5.js +1 -0
- package/dist/chunk-7KNRIGGW.cjs +1 -0
- package/dist/chunk-AQ35GWDV.js +1 -0
- package/dist/chunk-CDT2SOKB.cjs +9 -0
- package/dist/chunk-CM5WP7HZ.cjs +10 -0
- package/dist/chunk-EU5LN2WS.js +11 -0
- package/dist/chunk-FOU7PS3K.cjs +1 -0
- package/dist/chunk-G4AXMTQY.cjs +11 -0
- package/dist/chunk-HRPNPUU4.js +1 -0
- package/dist/chunk-NI5OFVY2.js +57 -0
- package/dist/chunk-QHWHCIUW.js +1 -0
- package/dist/chunk-RGYAPHXT.cjs +57 -0
- package/dist/chunk-RTESADL3.cjs +1 -0
- package/dist/chunk-T3I3VSJ3.js +9 -0
- package/dist/chunk-XVFMG77A.cjs +1 -0
- package/dist/chunk-YJJ7HRPG.js +10 -0
- package/dist/core-plugins.cjs +1 -7131
- package/dist/core-plugins.js +1 -7102
- package/dist/executor-7DZMHPUF.js +1 -0
- package/dist/executor-FSMRGT73.cjs +1 -0
- package/dist/headless.cjs +4 -10984
- package/dist/headless.d.cts +4 -3
- package/dist/headless.d.ts +4 -3
- package/dist/headless.js +4 -10852
- package/dist/index.cjs +209 -44710
- package/dist/index.css +1 -369
- package/dist/index.d.cts +213 -47
- package/dist/index.d.ts +213 -47
- package/dist/index.js +209 -44385
- package/dist/mcp-cli.js +35 -9557
- package/dist/mcp.cjs +14 -8713
- package/dist/mcp.js +14 -8665
- package/dist/selectionRects-3PJ6FGHQ.js +1 -0
- package/dist/selectionRects-6QL5E7CE.cjs +1 -0
- package/package.json +3 -6
- package/dist/core-plugins.cjs.map +0 -1
- package/dist/core-plugins.js.map +0 -1
- package/dist/headless.cjs.map +0 -1
- package/dist/headless.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-cli.js.map +0 -1
- package/dist/mcp.cjs.map +0 -1
- package/dist/mcp.js.map +0 -1
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ const result = await processTemplate(docxBuffer, {
|
|
|
168
168
|
- Full WYSIWYG editing with Microsoft Word fidelity
|
|
169
169
|
- Open, edit, and save DOCX files in the browser
|
|
170
170
|
- Standalone components (Toolbar, FontPicker, ColorPicker, etc.)
|
|
171
|
-
- Template variable support (`{
|
|
171
|
+
- Template variable support (`{variable}` - standard docxtemplater syntax)
|
|
172
172
|
- Extendable plugin architecture
|
|
173
173
|
- Zero server dependencies
|
|
174
174
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var h=a=>{throw TypeError(a)};var l=(a,b,c)=>b in a?f(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var p=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var q=(a,b)=>()=>(a&&(b=a(a=0)),b);var r=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:true});},m=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of j(b))!k.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=i(b,e))||d.enumerable});return a};var s=a=>m(f({},"__esModule",{value:true}),a);var t=(a,b,c)=>l(a,typeof b!="symbol"?b+"":b,c),g=(a,b,c)=>b.has(a)||h("Cannot "+c);var n=(a,b,c)=>(g(a,b,"read from private field"),c?c.call(a):b.get(a)),u=(a,b,c)=>b.has(a)?h("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),o=(a,b,c,d)=>(g(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c),v=(a,b,c)=>(g(a,b,"access private method"),c);var w=(a,b,c,d)=>({set _(e){o(a,b,e,c);},get _(){return n(a,b,d)}});export{p as a,q as b,r as c,s as d,t as e,n as f,u as g,o as h,v as i,w as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var K="Calibri";var O=null;function W(){if(!O){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(O=e.getContext("2d"),!O)throw new Error("Failed to get 2D context from canvas")}return O}var re='"Segoe UI", Arial, sans-serif';function U(e){let t=[];e.italic&&t.push("italic"),e.bold&&t.push("bold");let i=e.fontSize??11,n=J(i);t.push(`${n}px`);let o=e.fontFamily??K,r=o.includes(" ")?`"${o}"`:o;return t.push(`${r}, ${re}`),t.join(" ")}function oe(e){let t=e.fontSize??11,i=e.fontFamily??K,n=J(t),o=n*.8,r=n*.2;try{let a=W();a.font=U(e);let c=a.measureText("Hg");typeof c.actualBoundingBoxAscent=="number"&&typeof c.actualBoundingBoxDescent=="number"&&(o=c.actualBoundingBoxAscent,r=c.actualBoundingBoxDescent);}catch{}let s=n*1.15;return {fontSize:t,ascent:o,descent:r,lineHeight:s,fontFamily:i}}function ce(e,t){if(!e)return 0;let i=W();i.font=U(t);let n=i.measureText(e),o=n.width,r=(n.actualBoundingBoxLeft||0)+(n.actualBoundingBoxRight||0),s=Math.max(o,r);return t.letterSpacing&&e.length>1&&(s+=t.letterSpacing*(e.length-1)),s}function G(e,t){let i=oe(t);if(!e)return {width:0,charWidths:[],metrics:i};let n=W();n.font=U(t);let o=t.letterSpacing??0,r=[],s=0;for(let a=0;a<e.length;a++){let c=e[a],g=n.measureText(c).width;o&&a<e.length-1&&(g+=o),r.push(g),s+=g;}return {width:s,charWidths:r,metrics:i}}function se(e,t){if(t.length===0||e<=0)return 0;let i=0;for(let n=0;n<t.length;n++){let o=t[n],r=i+o/2;if(e<=r)return n;i+=o;}return t.length}function J(e){return e*96/72}function $(e,t){let i=e.pageGap??0,n=0;for(let o=0;o<t&&o<e.pages.length;o++){let s=e.pages[o].size?.h??e.pageSize.h;n+=s+i;}return n}function ae(e,t){return e.findIndex(i=>i.id===t)}function ie(e,t){let i=0;for(let n=e.fromLine;n<e.toLine&&n<t.lines.length;n++)i+=t.lines[n].lineHeight;return i}function ue(e,t,i,n){let o=[...e.page.fragments].sort((r,s)=>{let a=r.y-s.y;return Math.abs(a)>.5?a:r.x-s.x});for(let r of o){let s=ae(t,r.blockId);if(s===-1)continue;let a=t[s],c=i[s];if(!a||!c)continue;let u;if(r.kind==="paragraph"){if(a.kind!=="paragraph"||c.kind!=="paragraph")continue;u=ie(r,c);}else if(r.kind==="table")u=r.height;else if(r.kind==="image")u=r.height;else continue;let g=n.x>=r.x&&n.x<=r.x+r.width,l=n.y>=r.y&&n.y<=r.y+u;if(g&&l)return {fragment:r,block:a,measure:c,pageIndex:e.pageIndex,localX:n.x-r.x,localY:n.y-r.y}}return null}function Q(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Z(e,t){return e.findIndex(i=>i.id===t)}function Y(e,t){let n=(e.pmStart??0)+1,o=0,r;for(let c=0;c<e.runs.length&&c<=t.toRun;c++){let u=e.runs[c];if(u){if(c<t.fromRun)u.kind==="text"?o+=(u.text??"").length:o+=1;else if(c===t.fromRun){o+=t.fromChar,r=n+o;break}}}r===void 0&&(r=n);let s=0;for(let c=t.fromRun;c<=t.toRun&&c<e.runs.length;c++){let u=e.runs[c];if(u)if(u.kind==="text"){let g=u.text??"",l=c===t.fromRun?t.fromChar:0,f=c===t.toRun?t.toChar:g.length;s+=f-l;}else s+=1;}let a=r+s;return {pmStart:r,pmEnd:a}}function V(e,t,i,n){let o=[];for(let r=0;r<t.lines.length;r++){let s=t.lines[r],a=Y(e,s);a.pmStart===void 0||a.pmEnd===void 0||a.pmEnd>i&&a.pmStart<n&&o.push({line:s,index:r});}return o}function _(e,t,i){let n=Y(e,t);return n.pmStart===void 0?0:Math.max(0,i-n.pmStart)}function X(e,t,i,n){let o=0,r=0;for(let s=t.fromRun;s<=t.toRun&&s<e.runs.length;s++){let a=e.runs[s];if(a){if(a.kind==="tab"){let c=a.width??48;if(r+1>=i)return i<=r?o:o+c;o+=c,r+=1;continue}if(a.kind==="image"){let c=a.width;if(r+1>=i)return i<=r?o:o+c;o+=c,r+=1;continue}if(a.kind==="lineBreak"){if(i<=r)return o;r+=1;continue}if(a.kind==="text"){let c=a.text??"",u=s===t.fromRun,g=s===t.toRun,l=u?t.fromChar:0,f=g?t.toChar:c.length,m=c.slice(l,f);if(r+m.length>=i){let b=i-r,h=Q(a),k=G(m.slice(0,b),h);return o+k.width}let x=Q(a),d=G(m,x);o+=d.width,r+=m.length;}}}return o}function A(e,t){let i=0;for(let n=0;n<t&&n<e.lines.length;n++)i+=e.lines[n].lineHeight;return i}function me(e,t,i,n,o){if(n===o)return [];let r=Math.min(n,o),s=Math.max(n,o),a=[];for(let c=0;c<e.pages.length;c++){let u=e.pages[c],g=$(e,c);for(let l of u.fragments){if(l.kind==="paragraph"){let f=Z(t,l.blockId);if(f===-1)continue;let m=t[f],x=i[f];if(!m||m.kind!=="paragraph"||!x||x.kind!=="paragraph")continue;let d=m,b=x,h=l,k=V(d,b,r,s);for(let{line:p,index:F}of k){if(F<h.fromLine||F>=h.toLine)continue;let M=Y(d,p);if(M.pmStart===void 0||M.pmEnd===void 0)continue;let B=Math.max(M.pmStart,r),T=Math.min(M.pmEnd,s);if(B>=T)continue;let R=_(d,p,B),P=_(d,p,T),w=d.attrs?.indent,y=w?.left??0,E=w?.right??0,I=Math.max(0,l.width-y-E),L=X(d,p,R),z=X(d,p,P),C=d.attrs?.alignment??"left",S=0;C==="center"?S=Math.max(0,(I-p.width)/2):C==="right"&&(S=Math.max(0,I-p.width));let v=A(b,F)-A(b,h.fromLine),H=l.x+y+S+Math.min(L,z),D=Math.max(1,Math.abs(z-L)),N=l.y+v;a.push({x:H,y:N+g,width:D,height:p.lineHeight,pageIndex:c});}}if(l.kind==="table"){let f=Z(t,l.blockId);if(f===-1)continue;let m=t[f],x=i[f];if(!m||m.kind!=="table"||!x||x.kind!=="table")continue;let d=m,b=x,h=l,k=0;for(let p=h.fromRow;p<h.toRow&&p<d.rows.length;p++){let F=d.rows[p],M=b.rows[p];if(!F||!M)continue;let B=0;for(let T=0;T<F.cells.length;T++){let R=F.cells[T],P=M.cells[T];if(!(!R||!P)){for(let w=0;w<R.blocks.length;w++){let y=R.blocks[w],E=P.blocks[w];if(!y||y.kind!=="paragraph"||!E||E.kind!=="paragraph")continue;let I=y,L=E,z=V(I,L,r,s),C=0;for(let{line:S,index:v}of z){let H=Y(I,S);if(H.pmStart===void 0||H.pmEnd===void 0)continue;let D=Math.max(H.pmStart,r),N=Math.min(H.pmEnd,s);if(D>=N)continue;let ee=_(I,S,D),te=_(I,S,N),j=X(I,S,ee,P.width),q=X(I,S,te,P.width),ne=A(L,v);a.push({x:h.x+B+Math.min(j,q),y:h.y+k+C+ne+g,width:Math.max(1,Math.abs(q-j)),height:S.lineHeight,pageIndex:c});}C+=L.totalHeight;}B+=P.width;}}k+=M.height;}}if(l.kind==="image"){let f=l.pmStart??0;(l.pmEnd??f+1)>r&&f<s&&a.push({x:l.x,y:l.y+g,width:l.width,height:l.height,pageIndex:c});}}}return a}function pe(e,t,i,n){for(let o=0;o<e.pages.length;o++){let r=e.pages[o],s=$(e,o);for(let a of r.fragments){if(a.kind==="paragraph"){let c=Z(t,a.blockId);if(c===-1)continue;let u=t[c],g=i[c];if(!u||u.kind!=="paragraph"||!g||g.kind!=="paragraph")continue;let l=u,f=g,m=a,x=l.pmStart??0,d=l.pmEnd??x;if(n<x||n>d)continue;for(let b=m.fromLine;b<m.toLine;b++){let h=f.lines[b];if(!h)continue;let k=Y(l,h);if(!(k.pmStart===void 0||k.pmEnd===void 0)&&n>=k.pmStart&&n<=k.pmEnd){let p=_(l,h,n),F=l.attrs?.indent,M=F?.left??0,B=F?.right??0,T=Math.max(0,a.width-M-B),R=X(l,h,p),P=l.attrs?.alignment??"left",w=0;P==="center"?w=Math.max(0,(T-h.width)/2):P==="right"&&(w=Math.max(0,T-h.width));let y=A(f,b)-A(f,m.fromLine);return {x:a.x+M+w+R,y:a.y+y+s,height:h.lineHeight,pageIndex:o}}}}if(a.kind==="image"){let c=a.pmStart??0,u=a.pmEnd??c+1;if(n>=c&&n<=u){let g=n===c?0:a.width;return {x:a.x+g,y:a.y+s,height:a.height,pageIndex:o}}}}}return null}function de(e){return e.length<=1?false:new Set(e.map(i=>i.pageIndex)).size>1}function xe(e){let t=new Map;for(let i of e){let n=t.get(i.pageIndex)??[];n.push(i),t.set(i.pageIndex,n);}return t}exports.a=oe;exports.b=ce;exports.c=G;exports.d=se;exports.e=J;exports.f=ue;exports.g=me;exports.h=pe;exports.i=de;exports.j=xe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-QHWHCIUW.js';function T(s,t){let a=b$1.getCommandHandler(t.type);if(a)return a(s,t);switch(t.type){case "insertText":return R(s,t);case "replaceText":return E(s,t);case "deleteText":return B(s,t);case "formatText":return S(s,t);case "formatParagraph":return V(s,t);case "applyStyle":return $(s,t);case "insertTable":return H(s,t);case "insertImage":return A(s,t);case "insertHyperlink":return F(s,t);case "removeHyperlink":return j(s,t);case "insertParagraphBreak":return v(s,t);case "mergeParagraphs":return N(s,t);case "splitParagraph":return M(s,t);case "setVariable":return O(s,t);case "applyVariables":return _(s,t);default:let r=t;throw new Error(`Unknown command type: ${r.type}`)}}function z(s,t){return t.reduce((a,r)=>T(a,r),s)}function h(s){return JSON.parse(JSON.stringify(s))}function g(s,t){let a=0;for(let r=0;r<s.content.length;r++)if(s.content[r].type==="paragraph"){if(a===t)return r;a++;}return -1}function I(s){let t="";for(let a of s.content)if(a.type==="run")for(let r of a.content)r.type==="text"&&(t+=r.text);else if(a.type==="hyperlink"){for(let r of a.children)if(r.type==="run")for(let e of r.content)e.type==="text"&&(t+=e.text);}return t}function b(s,t){return {type:"run",formatting:t,content:[{type:"text",text:s}]}}function C(s,t,a,r){let e=[],o=0,p=false;for(let n of s.content)if(n.type==="run"){let c=n.content.filter(l=>l.type==="text").map(l=>l.text).join(""),i=o,u=o+c.length;if(!p&&t>=i&&t<=u){let l=t-i;l>0&&e.push({...n,content:[{type:"text",text:c.slice(0,l)}]}),e.push(b(a,r||n.formatting)),l<c.length&&e.push({...n,content:[{type:"text",text:c.slice(l)}]}),p=true;}else e.push(n);o=u;}else e.push(n);return p||e.push(b(a,r)),e}function y(s,t,a){let r=[],e=0;for(let o of s.content)if(o.type==="run"){let p=o.content.filter(i=>i.type==="text").map(i=>i.text).join(""),n=e,c=e+p.length;if(c<=t||n>=a)r.push(o);else {let i="";n<t&&(i+=p.slice(0,t-n)),c>a&&(i+=p.slice(a-n)),i.length>0&&r.push({...o,content:[{type:"text",text:i}]});}e=c;}else r.push(o);return r}function D(s,t,a,r){let e=[],o=0;for(let p of s.content)if(p.type==="run"){let n=p.content.filter(u=>u.type==="text").map(u=>u.text).join(""),c=o,i=o+n.length;if(i<=t||c>=a)e.push(p);else if(c>=t&&i<=a)e.push({...p,formatting:{...p.formatting,...r}});else {let u=Math.max(t,c),l=Math.min(a,i);c<u&&e.push({...p,content:[{type:"text",text:n.slice(0,u-c)}]}),e.push({...p,formatting:{...p.formatting,...r},content:[{type:"text",text:n.slice(u-c,l-c)}]}),i>l&&e.push({...p,content:[{type:"text",text:n.slice(l-c)}]});}o=i;}else e.push(p);return e}function R(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e];return o.content=C(o,t.position.offset,t.text,t.formatting),a}function E(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset),n.content=C(n,e.offset,t.text,t.formatting);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length),n.content=C(n,e.offset,t.text,t.formatting);let i=[];for(let u=e.paragraphIndex+1;u<=o.paragraphIndex;u++)i.push(g(r,u));for(let u=i.length-1;u>=0;u--)i[u]!==-1&&r.content.splice(i[u],1);}return a}function B(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length);let i=g(r,o.paragraphIndex),u=r.content[i];u.content=y(u,0,o.offset),n.content.push(...u.content);let l=[];for(let f=e.paragraphIndex+1;f<=o.paragraphIndex;f++)l.push(g(r,f));for(let f=l.length-1;f>=0;f--)l[f]!==-1&&r.content.splice(l[f],1);}return a}function S(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=D(n,e.offset,o.offset,t.formatting);}else for(let p=e.paragraphIndex;p<=o.paragraphIndex;p++){let n=g(r,p);if(n===-1)continue;let c=r.content[n],i=I(c),u=0,l=i.length;p===e.paragraphIndex&&(u=e.offset),p===o.paragraphIndex&&(l=o.offset),c.content=D(c,u,l,t.formatting);}return a}function V(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];if(o.formatting={...o.formatting,...t.formatting},"numPr"in t.formatting){let p=t.formatting.numPr;if(p&&p.numId!==void 0&&p.numId!==0){let n=p.ilvl??0,c=p.numId===1,i=c?"\u2022":"1.";if(a.package.numbering){let u=a.package.numbering.nums.find(l=>l.numId===p.numId);if(u){let l=a.package.numbering.abstractNums.find(f=>f.abstractNumId===u.abstractNumId);if(l){let f=l.levels.find(x=>x.ilvl===n);f&&(i=f.lvlText||i);}}}o.listRendering={level:n,numId:p.numId,marker:i,isBullet:c};}else delete o.listRendering;}return a}function $(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];return o.formatting={...o.formatting,styleId:t.styleId},a}function H(s,t){let a=h(s),r=a.package.document,e=[];for(let n=0;n<t.rows;n++){let c=[];for(let i=0;i<t.columns;i++){let u=t.data?.[n]?.[i]||"";c.push({type:"tableCell",content:[{type:"paragraph",content:u?[b(u)]:[]}]});}e.push({type:"tableRow",formatting:n===0&&t.hasHeader?{header:true}:void 0,cells:c});}let o={type:"table",rows:e},p=g(r,t.position.paragraphIndex);return p===-1?r.content.push(o):r.content.splice(p+1,0,o),a}function A(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],n={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:t.src,alt:t.alt,size:{width:(t.width||100)*914400,height:(t.height||100)*914400},wrap:{type:"inline"}}}]},c=C(o,t.position.offset,"",void 0),i=false,u=0;for(let l=0;l<c.length;l++){let f=c[l];if(f.type==="run"){let x=f.content.filter(d=>d.type==="text").map(d=>d.text).join("");if(u+=x.length,!i&&u>=t.position.offset){c.splice(l+1,0,n),i=true;break}}}return i||c.push(n),o.content=c,a}function F(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex!==o.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p],c=I(n),i=t.displayText||c.slice(e.offset,o.offset);n.content=y(n,e.offset,o.offset);let u={type:"hyperlink",href:t.url,tooltip:t.tooltip,children:[b(i)]},l=false,f=0,x=[];for(let d of n.content)if(d.type==="run"){let P=d.content.filter(m=>m.type==="text").map(m=>m.text).join(""),w=f+P.length;if(!l&&f<=e.offset&&e.offset<=w){let m=e.offset-f;m>0&&x.push({...d,content:[{type:"text",text:P.slice(0,m)}]}),x.push(u),m<P.length&&x.push({...d,content:[{type:"text",text:P.slice(m)}]}),l=true;}else x.push(d);f=w;}else x.push(d);return l||x.push(u),n.content=x,a}function j(s,t){let a=h(s),r=a.package.document,{start:e}=t.range,o=g(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let p=r.content[o],n=[];for(let c of p.content)if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&n.push(i);else n.push(c);return p.content=n,a}function v(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],p=I(o),n=y({...o,content:[...o.content]},t.position.offset,p.length),c=y({...o,content:[...o.content]},0,t.position.offset);o.content=n;let i={type:"paragraph",formatting:o.formatting,content:c};return r.content.splice(e+1,0,i),a}function N(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e],p=[];for(let n=1;n<=t.count;n++){let c=g(r,t.paragraphIndex+n);if(c!==-1){let i=r.content[c];o.content.push(...i.content),p.push(c);}}for(let n=p.length-1;n>=0;n--)r.content.splice(p[n],1);return a}function M(s,t){return v(s,{position:t.position})}function O(s,t){let a=h(s);return a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t.name)||a.templateVariables.push(t.name),a}function _(s,t){let a=h(s),r=a.package.document;function e(n){for(let c of n.content)if(c.type==="text")for(let[i,u]of Object.entries(t.values)){let l=new RegExp(`\\{${i}\\}`,"g");c.text=c.text.replace(l,u);}}function o(n){for(let c of n.content)if(c.type==="run")e(c);else if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&e(i);}function p(n){if(n.type==="paragraph")o(n);else if(n.type==="table")for(let c of n.rows)for(let i of c.cells)for(let u of i.content)p(u);}for(let n of r.content)p(n);return a}var U=T;export{T as a,z as b,U as c};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';var chunkCM5WP7HZ_cjs=require('./chunk-CM5WP7HZ.cjs'),chunkRGYAPHXT_cjs=require('./chunk-RGYAPHXT.cjs'),chunkG4AXMTQY_cjs=require('./chunk-G4AXMTQY.cjs'),chunkFOU7PS3K_cjs=require('./chunk-FOU7PS3K.cjs'),chunkRTESADL3_cjs=require('./chunk-RTESADL3.cjs');var W={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},Y={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},w={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function U(n){if(!n)return 1;let e=parseInt(n,16);return isNaN(e)?1:e/255}function C(n){let e=n.padStart(6,"0").slice(0,6),t=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return {r:isNaN(t)?0:t,g:isNaN(r)?0:r,b:isNaN(o)?0:o}}function D(n,e,t){let r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return `${r(n)}${r(e)}${r(t)}`.toUpperCase()}function $(n,e,t){n/=255,e/=255,t/=255;let r=Math.max(n,e,t),o=Math.min(n,e,t),a=(r+o)/2;if(r===o)return {h:0,s:0,l:a};let i=r-o,s=a>.5?i/(2-r-o):i/(r+o),u;switch(r){case n:u=((e-t)/i+(e<t?6:0))/6;break;case e:u=((t-n)/i+2)/6;break;case t:u=((n-e)/i+4)/6;break;default:u=0;}return {h:u*360,s,l:a}}function G(n,e,t){if(n=n/360,e===0){let i=Math.round(t*255);return {r:i,g:i,b:i}}let r=(i,s,u)=>(u<0&&(u+=1),u>1&&(u-=1),u<1/6?i+(s-i)*6*u:u<1/2?s:u<2/3?i+(s-i)*(2/3-u)*6:i),o=t<.5?t*(1+e):t+e-t*e,a=2*t-o;return {r:Math.round(r(a,o,n+1/3)*255),g:Math.round(r(a,o,n)*255),b:Math.round(r(a,o,n-1/3)*255)}}function q(n,e){if(e<=0||e>=1)return e>=1?"FFFFFF":n;let t=C(n),r=$(t.r,t.g,t.b);r.l=r.l+(1-r.l)*e;let o=G(r.h,r.s,r.l);return D(o.r,o.g,o.b)}function X(n,e){if(e<=0||e>=1)return e<=0?"000000":n;let t=C(n),r=$(t.r,t.g,t.b);r.l=r.l*e;let o=G(r.h,r.s,r.l);return D(o.r,o.g,o.b)}function J(n,e){let t=w[e]??e,r=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],o=a=>r.includes(a);return n?.colorScheme?o(t)?n.colorScheme[t]??W[t]??"000000":"000000":o(t)?W[t]??"000000":"000000"}function K(n){if(!n)return null;let e=n.toLowerCase();return w[n]??w[e]??null}function g(n,e,t="000000"){if(!n)return `#${t}`;if(n.auto)return `#${t}`;let r;if(n.themeColor){let o=K(n.themeColor);if(o?r=J(e,o):r=n.rgb??t,n.themeTint){let a=U(n.themeTint);r=q(r,a);}else if(n.themeShade){let a=U(n.themeShade);r=X(r,a);}}else n.rgb?r=n.rgb:r=t;return `#${r.toUpperCase().replace(/^#/,"")}`}function De(n){if(!n||n==="none")return "";let e=Y[n];return e?`#${e}`:""}function Be(n,e){return n?n.auto?"transparent":g(n,e):""}function ve(n,e){if(!n)return false;if(n.auto)return true;let r=g(n,e).replace(/^#/,"").toLowerCase(),o=C(r);return (o.r+o.g+o.b)/3<20}function Oe(n,e){if(!n)return false;let r=g(n,e).replace(/^#/,"").toLowerCase(),o=C(r);return (o.r+o.g+o.b)/3>235}function Ne(n,e){if(!n)return "#000000";let r=g(n,e).replace(/^#/,""),o=C(r);return (.299*o.r+.587*o.g+.114*o.b)/255>.5?"#000000":"#FFFFFF"}function Le(n){if(!n)return;let e=n.trim();if(e.toLowerCase()==="auto")return {auto:true};let t=K(e);if(t)return {themeColor:t};let r=e.replace(/^#/,"").toUpperCase();return /^[0-9A-F]{6}$/i.test(r)?{rgb:r}:/^[0-9A-F]{3}$/i.test(r)?{rgb:r.split("").map(a=>a+a).join("")}:{rgb:r.padStart(6,"0").slice(0,6)}}function Me(n,e,t){let r={themeColor:n};return e!==void 0&&e>0&&e<1&&(r.themeTint=Math.round(e*255).toString(16).toUpperCase().padStart(2,"0")),t!==void 0&&t>0&&t<1&&(r.themeShade=Math.round(t*255).toString(16).toUpperCase().padStart(2,"0")),r}function Ve(n){return {rgb:n.replace(/^#/,"").toUpperCase()}}function ze(n,e,t){let o=g(n,e).replace(/^#/,""),a=1-t/100;return `#${X(o,a)}`}function je(n,e,t){let o=g(n,e).replace(/^#/,""),a=t/100;return `#${q(o,a)}`}function We(n,e,t,r){let o=g(n,r).replace(/^#/,""),a=g(e,r).replace(/^#/,""),i=C(o),s=C(a),u={r:Math.round(i.r*(1-t)+s.r*t),g:Math.round(i.g*(1-t)+s.g*t),b:Math.round(i.b*(1-t)+s.b*t)};return `#${D(u.r,u.g,u.b)}`}function Ue(n,e,t){if(!n&&!e)return true;if(!n||!e)return false;let r=g(n,t).toUpperCase(),o=g(e,t).toUpperCase();return r===o}function Ge(n){return n/1440*96}function qe(n){return n/96*1440}function Xe(n){return n/914400*96}function Ke(n){return n/96*914400}function Ze(n){return n/914400*1440}function Ye(n){return n/1440*914400}function Je(n){return n/72*96}function Qe(n){return n/144*96}function et(n){return n/2}function tt(n){return n/576*96}function Q(n,e=2){let t=Math.pow(10,e);return Math.round(n*t)/t}function nt(n){return `${Q(n)}px`}var S=class n{constructor(e){chunkRTESADL3_cjs.e(this,"_document");chunkRTESADL3_cjs.e(this,"_pendingVariables");e instanceof ArrayBuffer||ArrayBuffer.isView(e)?this._document={package:{document:{content:[]}},originalBuffer:e instanceof ArrayBuffer?e:e.buffer}:this._document=e,this._pendingVariables={};}static async fromBuffer(e){let t=await chunkG4AXMTQY_cjs.l(e);return new n(t)}static fromDocument(e){return new n(e)}getDocument(){return this._document}getText(){let e=this._document.package.document;return this._getBodyText(e)}getFormattedText(){let e=[],t=this._document.package.document;for(let r of t.content)r.type==="paragraph"&&this._extractParagraphSegments(r,e);return e}getVariables(){return chunkCM5WP7HZ_cjs.a(this._document)}getStyles(){let e=this._document.package.styles;if(!e?.styles)return [];let t=[];for(let[r,o]of Object.entries(e.styles))if(typeof o=="object"&&o!==null){let a=o;t.push({id:r,name:a.name||r,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return t}getPageCount(){let e=this.getWordCount();return Math.max(1,Math.ceil(e/500))}getWordCount(){return this.getText().split(/\s+/).filter(r=>r.length>0).length}getCharacterCount(e=true){let t=this.getText();return e?t.length:t.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(e=>e.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(e=>e.type==="table").length}getAgentContext(e=100){let t=this._document.package.document,r=t.content.filter(i=>i.type==="paragraph"),o=r.map((i,s)=>{let u=this._getParagraphText(i),c=i.formatting?.styleId;return {index:s,preview:u.slice(0,e),style:c,isHeading:c?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(c),isListItem:!!i.listRendering,isEmpty:u.trim().length===0}}),a=(t.sections||[]).map((i,s)=>({index:s,paragraphCount:i.content?.length||0,pageSize:i.properties?.pageWidth&&i.properties?.pageHeight?{width:i.properties.pageWidth,height:i.properties.pageHeight}:void 0,isLandscape:i.properties?.orientation==="landscape",hasHeader:!!i.properties?.headerReferences?.length,hasFooter:!!i.properties?.footerReferences?.length}));return {paragraphCount:r.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:o,sections:a,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(e,t,r={}){let o={type:"insertText",position:e,text:t,formatting:r.formatting};return this._executeCommand(o)}replaceRange(e,t,r={}){let o={type:"replaceText",range:e,text:t,formatting:r.formatting};return this._executeCommand(o)}deleteRange(e){let t={type:"deleteText",range:e};return this._executeCommand(t)}applyFormatting(e,t){let r={type:"formatText",range:e,formatting:t};return this._executeCommand(r)}applyStyle(e,t){let r={type:"applyStyle",paragraphIndex:e,styleId:t};return this._executeCommand(r)}applyParagraphFormatting(e,t){let r={type:"formatParagraph",paragraphIndex:e,formatting:t};return this._executeCommand(r)}insertTable(e,t,r,o={}){let a={type:"insertTable",position:e,rows:t,columns:r,data:o.data,hasHeader:o.hasHeader};return this._executeCommand(a)}insertImage(e,t,r={}){let o={type:"insertImage",position:e,src:t,width:r.width,height:r.height,alt:r.alt};return this._executeCommand(o)}insertHyperlink(e,t,r={}){let o={type:"insertHyperlink",range:e,url:t,displayText:r.displayText,tooltip:r.tooltip};return this._executeCommand(o)}removeHyperlink(e){let t={type:"removeHyperlink",range:e};return this._executeCommand(t)}insertParagraphBreak(e){let t={type:"insertParagraphBreak",position:e};return this._executeCommand(t)}mergeParagraphs(e,t){let r={type:"mergeParagraphs",paragraphIndex:e,count:t};return this._executeCommand(r)}setVariable(e,t){return this._pendingVariables[e]=t,this}setVariables(e){for(let[t,r]of Object.entries(e))this._pendingVariables[t]=r;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(e){let t={...this._pendingVariables,...e};if(Object.keys(t).length===0)return this;let r=this._document.originalBuffer;if(!r)throw new Error("Cannot apply variables: no original buffer for processing");let o=chunkCM5WP7HZ_cjs.n(r,t),a=await chunkG4AXMTQY_cjs.l(o),i=new n(a);return i._pendingVariables={},i}async toBuffer(){return this._document.originalBuffer?chunkRGYAPHXT_cjs.d(this._document):chunkRGYAPHXT_cjs.e(this._document)}async toBlob(e="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let t=await this.toBuffer();return new Blob([t],{type:e})}executeCommands(e){let t=chunkFOU7PS3K_cjs.b(this._document,e);return new n(t)}_executeCommand(e){let t=chunkFOU7PS3K_cjs.a(this._document,e),r=new n(t);return r._pendingVariables={...this._pendingVariables},r}_getBodyText(e){let t=[];for(let r of e.content)r.type==="paragraph"?t.push(this._getParagraphText(r)):r.type==="table"&&t.push(this._getTableText(r));return t.join(`
|
|
2
|
+
`)}_getParagraphText(e){let t=[];for(let r of e.content)r.type==="run"?t.push(this._getRunText(r)):r.type==="hyperlink"&&t.push(this._getHyperlinkText(r));return t.join("")}_getRunText(e){return e.content.filter(t=>t.type==="text").map(t=>t.text).join("")}_getHyperlinkText(e){let t=[];for(let r of e.children)r.type==="run"&&t.push(this._getRunText(r));return t.join("")}_getTableText(e){let t=[];for(let r of e.rows)for(let o of r.cells)for(let a of o.content)a.type==="paragraph"&&t.push(this._getParagraphText(a));return t.join(" ")}_extractParagraphSegments(e,t){for(let r of e.content)if(r.type==="run"){let o=this._getRunText(r);o&&t.push({text:o,formatting:r.formatting});}else if(r.type==="hyperlink"){let o=r.href||"";for(let a of r.children)if(a.type==="run"){let i=this._getRunText(a);i&&t.push({text:i,formatting:a.formatting,isHyperlink:true,hyperlinkUrl:o});}}}_parseHeadingLevel(e){if(!e)return;let t=e.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}_hasImages(){let e=this._document.package.document;for(let t of e.content)if(t.type==="paragraph"){for(let r of t.content)if(r.type==="run"){for(let o of r.content)if(o.type==="drawing")return true}}return false}_hasHyperlinks(){let e=this._document.package.document;for(let t of e.content)if(t.type==="paragraph"){for(let r of t.content)if(r.type==="hyperlink")return true}return false}};async function ct(n){return S.fromBuffer(n)}function pt(n){return S.fromDocument(n)}function ee(n,e={}){let{outlineMaxChars:t=100,maxOutlineParagraphs:r=50}=e,o=n.package.document,a=o.content.filter(y=>y.type==="paragraph"),i=te(a,t,r),s=chunkCM5WP7HZ_cjs.a(n),u=ne(n),c=re(o),p=oe(o),x=ae(o),d=o.content.some(y=>y.type==="table"),b=ue(o),l=ce(o);return {paragraphCount:a.length,wordCount:p,characterCount:x,variables:s,variableCount:s.length,availableStyles:u,outline:i,sections:c,hasTables:d,hasImages:b,hasHyperlinks:l}}function dt(n,e,t={}){let{contextChars:r=200,includeSuggestions:o=true}=t,i=n.package.document.content.filter(f=>f.type==="paragraph"),s=i[e.start.paragraphIndex];if(!s)throw new Error(`Paragraph not found at index ${e.start.paragraphIndex}`);let u=m(s),c="";if(e.start.paragraphIndex===e.end.paragraphIndex)c=u.slice(e.start.offset,e.end.offset);else {let f=[];for(let P=e.start.paragraphIndex;P<=e.end.paragraphIndex;P++){let N=i[P];if(!N)continue;let R=m(N);P===e.start.paragraphIndex?f.push(R.slice(e.start.offset)):P===e.end.paragraphIndex?f.push(R.slice(0,e.end.offset)):f.push(R);}c=f.join(`
|
|
3
|
+
`);}let p=me(i,e.start.paragraphIndex,e.start.offset,r),x=ge(i,e.end.paragraphIndex,e.end.offset,r),d=de(s,e.start.offset),b=s.formatting||{},l={index:e.start.paragraphIndex,fullText:u,style:s.formatting?.styleId,wordCount:B(u)},y=false,_=fe(s,e.start.offset),F=o?he(c):[];return {selectedText:c,range:e,formatting:d,paragraphFormatting:b,textBefore:p,textAfter:x,paragraph:l,inTable:y,inHyperlink:_,suggestedActions:F}}function Z(n){let e=ee(n,{outlineMaxChars:50,maxOutlineParagraphs:10}),t=[`Document with ${e.paragraphCount} paragraphs, ${e.wordCount} words.`];e.hasTables&&t.push("Contains tables."),e.hasImages&&t.push("Contains images."),e.hasHyperlinks&&t.push("Contains hyperlinks."),e.variableCount>0&&t.push(`Has ${e.variableCount} template variables: ${e.variables.join(", ")}`);let r=e.outline.filter(o=>o.isHeading);if(r.length>0){t.push(`
|
|
4
|
+
Headings:`);for(let o of r.slice(0,5)){let a=o.headingLevel||1;t.push(`${" ".repeat(a-1)}- ${o.preview}`);}r.length>5&&t.push(` ... and ${r.length-5} more headings`);}return t.join(" ")}function te(n,e,t){let r=[];for(let o=0;o<Math.min(n.length,t);o++){let a=n[o],i=m(a),s=a.formatting?.styleId;r.push({index:o,preview:i.slice(0,e),style:s,isHeading:pe(s),headingLevel:le(s),isListItem:!!a.listRendering,isEmpty:i.trim().length===0});}return r}function ne(n){let e=n.package.styles;if(!e?.styles)return [];let t=[];for(let[r,o]of Object.entries(e.styles))if(typeof o=="object"&&o!==null){let a=o;t.push({id:r,name:a.name||r,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return t}function re(n){return n.sections?n.sections.map((e,t)=>({index:t,paragraphCount:e.content?.length||0,pageSize:e.properties?.pageWidth&&e.properties?.pageHeight?{width:e.properties.pageWidth,height:e.properties.pageHeight}:void 0,isLandscape:e.properties?.orientation==="landscape",hasHeader:!!e.properties?.headerReferences?.length,hasFooter:!!e.properties?.footerReferences?.length})):[]}function oe(n){let e=0;for(let t of n.content)if(t.type==="paragraph"){let r=m(t);e+=B(r);}else t.type==="table"&&(e+=ie(t));return e}function B(n){return n.split(/\s+/).filter(t=>t.length>0).length}function ae(n){let e=0;for(let t of n.content)if(t.type==="paragraph"){let r=m(t);e+=r.length;}else t.type==="table"&&(e+=se(t));return e}function ie(n){let e=0;for(let t of n.rows)for(let r of t.cells)for(let o of r.content)if(o.type==="paragraph"){let a=m(o);e+=B(a);}return e}function se(n){let e=0;for(let t of n.rows)for(let r of t.cells)for(let o of r.content)if(o.type==="paragraph"){let a=m(o);e+=a.length;}return e}function m(n){let e=[];for(let t of n.content)t.type==="run"?e.push(A(t)):t.type==="hyperlink"&&e.push(v(t));return e.join("")}function A(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function v(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(A(t));return e.join("")}function ue(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let r of t.content)if(r.type==="drawing")return true}}return false}function ce(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function pe(n){return n?n.toLowerCase().includes("heading"):false}function le(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function me(n,e,t,r){let o=[],a=0,i=n[e];if(i){let c=m(i).slice(0,t);o.unshift(c),a+=c.length;}for(let u=e-1;u>=0&&a<r;u--){let c=n[u];if(!c)continue;let p=m(c);o.unshift(p),a+=p.length;}let s=o.join(`
|
|
5
|
+
`);return s.length>r?"..."+s.slice(-r):s}function ge(n,e,t,r){let o=[],a=0,i=n[e];if(i){let c=m(i).slice(t);o.push(c),a+=c.length;}for(let u=e+1;u<n.length&&a<r;u++){let c=n[u];if(!c)continue;let p=m(c);o.push(p),a+=p.length;}let s=o.join(`
|
|
6
|
+
`);return s.length>r?s.slice(0,r)+"...":s}function de(n,e){let t=0;for(let r of n.content)if(r.type==="run"){let o=A(r),a=t,i=t+o.length;if(e>=a&&e<i)return r.formatting||{};t=i;}else if(r.type==="hyperlink"){let o=v(r),a=t,i=t+o.length;if(e>=a&&e<i){for(let s of r.children)if(s.type==="run")return s.formatting||{}}t=i;}return {}}function fe(n,e){let t=0;for(let r of n.content)if(r.type==="run"){let o=A(r);t+=o.length;}else if(r.type==="hyperlink"){let o=v(r),a=t,i=t+o.length;if(e>=a&&e<i)return true;t=i;}return false}function he(n,e,t){let r=[];return n.length>0&&(r.push({id:"rewrite",label:"Rewrite",description:"Rewrite this text",priority:10},{id:"summarize",label:"Summarize",description:"Summarize this text",priority:9}),n.length>200&&r.push({id:"summarize",label:"Summarize",description:"Create a shorter version",priority:8}),n.length<50&&n.split(/\s+/).length<10&&r.push({id:"expand",label:"Expand",description:"Add more details",priority:8}),r.push({id:"fixGrammar",label:"Fix Grammar",description:"Fix grammar and spelling",priority:7}),r.push({id:"translate",label:"Translate",description:"Translate to another language",priority:6}),r.push({id:"makeFormal",label:"Make Formal",description:"Use formal tone",priority:5},{id:"makeCasual",label:"Make Casual",description:"Use casual tone",priority:4})),r.sort((o,a)=>(a.priority||0)-(o.priority||0)),r}function xe(n,e,t={}){let{contextCharsBefore:r=200,contextCharsAfter:o=200,includeSuggestions:a=true}=t,i=n.package.document,s=i.content.filter(f=>f.type==="paragraph");if(e.start.paragraphIndex>=s.length)throw new Error(`Invalid start paragraph index: ${e.start.paragraphIndex}`);let u=s[e.start.paragraphIndex],c=be(s,e),p=ye(s,e.start,r),x=Ce(s,e.end,o),d=Pe(u,e.start.offset),b=u.formatting||{},l={index:e.start.paragraphIndex,fullText:h(u),style:u.formatting?.styleId,wordCount:O(h(u))},y=Ie(i,e.start),_=Se(u,e.start.offset),F=a?Ae(c):[];return {selectedText:c,range:e,formatting:d,paragraphFormatting:b,textBefore:p,textAfter:x,paragraph:l,inTable:y,inHyperlink:_,suggestedActions:F}}function xt(n,e,t={}){let r=xe(n,e,t),{includeDocumentSummary:o=true}=t,i=n.package.document.content.filter(l=>l.type==="paragraph"),s=O(r.selectedText),u=r.selectedText.length,c=e.start.paragraphIndex!==e.end.paragraphIndex,p=[];for(let l=e.start.paragraphIndex;l<=e.end.paragraphIndex;l++)p.push(l);let x=ke(i,e),d=o?Z(n):void 0,b=_e(r.selectedText);return {...r,documentSummary:d,wordCount:s,characterCount:u,isMultiParagraph:c,paragraphIndices:p,detectedLanguage:b,contentType:x}}function bt(n,e){let r=n.package.document.content.filter(s=>s.type==="paragraph"),o=[];for(let s=e.start.paragraphIndex;s<=e.end.paragraphIndex;s++){let u=r[s];if(!u)continue;let c=s===e.start.paragraphIndex?e.start.offset:0,p=s===e.end.paragraphIndex?e.end.offset:1/0;Te(u,c,p,o);}let a=o.length<=1||o.every(s=>Fe(s,o[0]));return {predominant:o.length>0?o[0]:{},isConsistent:a,allFormatting:o}}function be(n,e){if(e.start.paragraphIndex===e.end.paragraphIndex){let r=n[e.start.paragraphIndex];return r?h(r).slice(e.start.offset,e.end.offset):""}let t=[];for(let r=e.start.paragraphIndex;r<=e.end.paragraphIndex;r++){let o=n[r];if(!o)continue;let a=h(o);r===e.start.paragraphIndex?t.push(a.slice(e.start.offset)):r===e.end.paragraphIndex?t.push(a.slice(0,e.end.offset)):t.push(a);}return t.join(`
|
|
7
|
+
`)}function ye(n,e,t){let r=[],o=0,a=n[e.paragraphIndex];if(a){let u=h(a).slice(0,e.offset);r.unshift(u),o+=u.length;}for(let s=e.paragraphIndex-1;s>=0&&o<t;s--){let u=n[s];if(!u)continue;let c=h(u);r.unshift(c),o+=c.length;}let i=r.join(`
|
|
8
|
+
`);return i.length>t?"..."+i.slice(-t):i}function Ce(n,e,t){let r=[],o=0,a=n[e.paragraphIndex];if(a){let u=h(a).slice(e.offset);r.push(u),o+=u.length;}for(let s=e.paragraphIndex+1;s<n.length&&o<t;s++){let u=n[s];if(!u)continue;let c=h(u);r.push(c),o+=c.length;}let i=r.join(`
|
|
9
|
+
`);return i.length>t?i.slice(0,t)+"...":i}function Pe(n,e){let t=0;for(let r of n.content)if(r.type==="run"){let o=T(r),a=t+o.length;if(e>=t&&e<a)return r.formatting||{};t=a;}else if(r.type==="hyperlink"){let o=k(r),a=t+o.length;if(e>=t&&e<a){for(let i of r.children)if(i.type==="run")return i.formatting||{}}t=a;}return {}}function Te(n,e,t,r){let o=0;for(let a of n.content)if(a.type==="run"){let i=T(a),s=o,u=o+i.length;u>e&&s<t&&a.formatting&&r.push({...a.formatting}),o=u;}else if(a.type==="hyperlink"){let i=k(a),s=o,u=o+i.length;if(u>e&&s<t)for(let c of a.children)c.type==="run"&&c.formatting&&r.push({...c.formatting});o=u;}}function Ie(n,e){return false}function Se(n,e){let t=0;for(let r of n.content)if(r.type==="run"){let o=T(r);t+=o.length;}else if(r.type==="hyperlink"){let o=k(r),a=t,i=t+o.length;if(e>=a&&e<i)return true;t=i;}return false}function Ae(n,e,t){let r=[];if(!n||n.trim().length===0)return r;r.push({id:"askAI",label:"Ask AI",description:"Ask AI about this text",priority:11},{id:"rewrite",label:"Rewrite",description:"Rewrite this text differently",priority:10});let o=O(n);return o>50&&r.push({id:"summarize",label:"Summarize",description:"Create a shorter version",priority:9}),o<20&&r.push({id:"expand",label:"Expand",description:"Add more details",priority:9}),r.push({id:"fixGrammar",label:"Fix Grammar",description:"Fix grammar and spelling",priority:7},{id:"translate",label:"Translate",description:"Translate to another language",priority:6},{id:"explain",label:"Explain",description:"Explain what this means",priority:5}),r.push({id:"makeFormal",label:"Make Formal",description:"Use formal tone",priority:4},{id:"makeCasual",label:"Make Casual",description:"Use casual tone",priority:3}),r.sort((a,i)=>(i.priority||0)-(a.priority||0)),r}function ke(n,e){let t=new Set;for(let r=e.start.paragraphIndex;r<=e.end.paragraphIndex;r++){let o=n[r];o&&(o.listRendering?t.add("list"):o.formatting?.styleId?.toLowerCase().includes("heading")?t.add("heading"):t.add("prose"));}return t.size>1?"mixed":t.has("list")?"list":t.has("heading")?"heading":"prose"}function _e(n){return /[а-яА-ЯёЁ]/.test(n)?"ru":/[一-龯]/.test(n)?"zh":/[ひらがなカタカナ]/.test(n)||/[\u3040-\u309F\u30A0-\u30FF]/.test(n)?"ja":/[가-힣]/.test(n)?"ko":/[àâäéèêëïîôùûüç]/i.test(n)?"fr":/[äöüß]/i.test(n)?"de":/[áéíóúñ]/i.test(n)?"es":"en"}function h(n){let e=[];for(let t of n.content)t.type==="run"?e.push(T(t)):t.type==="hyperlink"&&e.push(k(t));return e.join("")}function T(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function k(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(T(t));return e.join("")}function O(n){return n.split(/\s+/).filter(e=>e.length>0).length}function Fe(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?false:t.every(o=>{let a=n[o],i=e[o];return a===i})}function Re(){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 He(){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 Ee(n={}){let e=He();n.pageWidth!==void 0&&(e.pageWidth=n.pageWidth),n.pageHeight!==void 0&&(e.pageHeight=n.pageHeight),n.orientation!==void 0&&(e.orientation=n.orientation),n.marginTop!==void 0&&(e.marginTop=n.marginTop),n.marginBottom!==void 0&&(e.marginBottom=n.marginBottom),n.marginLeft!==void 0&&(e.marginLeft=n.marginLeft),n.marginRight!==void 0&&(e.marginRight=n.marginRight);let t={type:"text",text:n.initialText||""};return {package:{document:{content:[{type:"paragraph",content:[{type:"run",content:n.initialText?[t]:[],formatting:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}}}],formatting:{lineSpacing:276}}],finalSectionProperties:e},styles:{docDefaults:{rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},styles:Re()}},templateVariables:[],warnings:[]}}function Ct(n,e={}){return Ee({...e,initialText:n})}function Tt(n){return {start:n,end:n,collapsed:true}}function It(n,e){return {start:n,end:e,collapsed:n.paragraphIndex===e.paragraphIndex&&n.offset===e.offset}}function St(n,e){return !(n.paragraphIndex<e.start.paragraphIndex||n.paragraphIndex===e.start.paragraphIndex&&n.offset<e.start.offset||n.paragraphIndex>e.end.paragraphIndex||n.paragraphIndex===e.end.paragraphIndex&&n.offset>e.end.offset)}function At(n,e){return n.paragraphIndex<e.paragraphIndex?-1:n.paragraphIndex>e.paragraphIndex?1:n.offset<e.offset?-1:n.offset>e.offset?1:0}function kt(n){return {askAI:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom Prompt"}[n]}function _t(n){return {askAI:"Ask AI a question about this text",rewrite:"Rewrite this text in a different way",expand:"Expand this text with more details",summarize:"Summarize this text to be shorter",translate:"Translate this text to another language",explain:"Explain what this text means",fixGrammar:"Fix grammar and spelling errors",makeFormal:"Make the tone more formal",makeCasual:"Make the tone more casual",custom:"Enter a custom prompt"}[n]}var Ft=["askAI","rewrite","expand","summarize","translate","explain"];function Rt(n){return {...n,id:we()}}function we(){return `cmd_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}exports.A=pt;exports.B=ee;exports.C=dt;exports.D=Z;exports.E=xe;exports.F=xt;exports.G=bt;exports.H=Ee;exports.I=Ct;exports.J=Tt;exports.K=It;exports.L=St;exports.M=At;exports.N=kt;exports.O=_t;exports.P=Ft;exports.Q=Rt;exports.a=g;exports.b=De;exports.c=Be;exports.d=ve;exports.e=Oe;exports.f=Ne;exports.g=Le;exports.h=Me;exports.i=Ve;exports.j=ze;exports.k=je;exports.l=We;exports.m=Ue;exports.n=Ge;exports.o=qe;exports.p=Xe;exports.q=Ke;exports.r=Ze;exports.s=Ye;exports.t=Je;exports.u=Qe;exports.v=et;exports.w=tt;exports.x=nt;exports.y=S;exports.z=ct;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';var chunkG4AXMTQY_cjs=require('./chunk-G4AXMTQY.cjs'),chunkRTESADL3_cjs=require('./chunk-RTESADL3.cjs'),g=require('pizzip'),b=require('docxtemplater');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var g__default=/*#__PURE__*/_interopDefault(g);var b__default=/*#__PURE__*/_interopDefault(b);function J(e){return typeof e=="object"&&e!==null&&("_def"in e||"parse"in e||"safeParse"in e)}function v(e,t){let r=t,{position:o,variableName:n}=r,a=JSON.parse(JSON.stringify(e)),s=a.package.document.content.filter(u=>u.type==="paragraph");if(o.paragraphIndex>=s.length)throw new Error(`Paragraph index ${o.paragraphIndex} out of bounds`);let c=s[o.paragraphIndex],l=`{{${n}}}`;return k(c,o.offset,l),a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(n)||a.templateVariables.push(n),a}function w(e,t){let r=t,{range:o,variableName:n}=r,a=JSON.parse(JSON.stringify(e)),s=a.package.document.content.filter(u=>u.type==="paragraph");if(o.start.paragraphIndex!==o.end.paragraphIndex)throw new Error("Template variable replacement cannot span multiple paragraphs");if(o.start.paragraphIndex>=s.length)throw new Error(`Paragraph index ${o.start.paragraphIndex} out of bounds`);let c=s[o.start.paragraphIndex];Z(c,o.start.offset,o.end.offset);let l=`{{${n}}}`;return k(c,o.start.offset,l),a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(n)||a.templateVariables.push(n),a}function k(e,t,r){let o=0,n=false;for(let a=0;a<e.content.length;a++){let i=e.content[a];if(i.type==="run"){let s=T(i),c=o,l=o+s.length;if(!n&&t>=c&&t<=l){let u=t-c,y=s.slice(0,u),m=s.slice(u),p=[];for(let d=0;d<a;d++)p.push(e.content[d]);y&&p.push({type:"run",formatting:i.formatting,content:[{type:"text",text:y}]}),p.push({type:"run",formatting:i.formatting,content:[{type:"text",text:r}]}),m&&p.push({type:"run",formatting:i.formatting,content:[{type:"text",text:m}]});for(let d=a+1;d<e.content.length;d++)p.push(e.content[d]);e.content=p,n=true;break}o=l;}else if(i.type==="hyperlink")for(let s of i.children)s.type==="run"&&(o+=T(s).length);}n||e.content.push({type:"run",content:[{type:"text",text:r}]});}function Z(e,t,r){let o=[],n=0;for(let a of e.content)if(a.type==="run"){let i=T(a),s=n,c=n+i.length;if(c<=t||s>=r)o.push(a);else {let l="";s<t&&(l+=i.slice(0,t-s)),c>r&&(l+=i.slice(r-s)),l.length>0&&o.push({type:"run",formatting:a.formatting,content:[{type:"text",text:l}]});}n=c;}else o.push(a);e.content=o;}function T(e){return e.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function U(e){return V(e).variables}function V(e){let t=[],r={body:[],headers:[],footers:[],footnotes:[],endnotes:[],textBoxes:[]};if(e.package?.document){let n=j(e.package.document);n.forEach(a=>{t.push({name:a,location:"body"});}),r.body=Array.from(new Set(n)).sort();}if(e.package?.document?.sections&&e.package.document.sections.forEach((n,a)=>{n.properties.headerReferences&&n.properties.headerReferences.forEach(i=>{});}),e.package?.footnotes){let n=A(e.package.footnotes);n.forEach(a=>{t.push({name:a,location:"footnote"});}),r.footnotes=Array.from(new Set(n)).sort();}if(e.package?.endnotes){let n=A(e.package.endnotes);n.forEach(a=>{t.push({name:a,location:"endnote"});}),r.endnotes=Array.from(new Set(n)).sort();}e.templateVariables&&e.templateVariables.forEach(n=>{t.some(a=>a.name===n)||t.push({name:n,location:"body"});});let o=new Set;return t.forEach(n=>o.add(n.name)),{variables:Array.from(o).sort(),totalOccurrences:t.length,byLocation:r,occurrences:t}}function j(e){let t=[];if(e.content&&t.push(...I(e.content)),e.sections)for(let r of e.sections)r.content&&t.push(...I(r.content));return t}function I(e){let t=[];for(let r of e)r.type==="paragraph"?t.push(...R(r)):r.type==="table"&&t.push(...M(r));return t}function R(e){let t=[];if(!e.content)return t;for(let r of e.content)r.type==="run"?t.push(...f(r)):r.type==="hyperlink"?t.push(...q(r)):r.type==="simpleField"?t.push(...W(r)):r.type==="complexField"&&t.push(...G(r));return t}function f(e){let t=[];if(!e.content)return t;for(let r of e.content)r.type==="text"&&r.text&&t.push(...B(r.text));return t}function q(e){let t=[];if(!e.children)return t;for(let r of e.children)r.type==="run"&&t.push(...f(r));return t}function W(e){let t=[];if(e.instruction&&t.push(...B(e.instruction)),e.content)for(let r of e.content)r.type==="run"&&t.push(...f(r));return t}function G(e){let t=[];if(e.fieldCode)for(let r of e.fieldCode)r.type==="run"&&t.push(...f(r));if(e.fieldResult)for(let r of e.fieldResult)r.type==="run"&&t.push(...f(r));return t}function M(e){let t=[];if(!e.rows)return t;for(let r of e.rows)if(r.cells)for(let o of r.cells)t.push(...X(o));return t}function X(e){let t=[];if(!e.content)return t;for(let r of e.content)r.type==="paragraph"?t.push(...R(r)):r.type==="table"&&t.push(...M(r));return t}function A(e){let t=[];for(let r of e)if(r.content)for(let o of r.content)t.push(...R(o));return t}var S=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g,_=/\{(.+?)\}/g;function B(e){if(!e)return [];let t=[],r=new RegExp(S),o;for(;(o=r.exec(e))!==null;)t.push(o[1]);return t}function oe(e){return S.test(e)}function ae(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 ie(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 se(e){return `{${e}}`}function ce(e){let t=e.match(/^\{(.+?)\}$/);return t?t[1]:null}function le(e,t){return e&&e.replace(_,(r,o)=>{let n=o.trim();return n in t?t[n]:r})}function pe(e,t=""){return e&&e.replace(_,t)}function ue(e){return U(e).length>0}function O(e,t,r={}){return E(e,t,r).buffer}function E(e,t,r={}){let{nullGetter:o="keep",linebreaks:n=true,delimiters:a}=r,i=[],s=[],c=[];try{let l=new g__default.default(e),u=new b__default.default(l,{paragraphLoop:!0,linebreaks:n,nullGetter:m=>{let p=m.value||"";if(o==="error")throw new Error(`Undefined variable: ${p}`);return o==="empty"?(c.push(p),""):(c.push(p),`{${p}}`)},delimiters:a?{start:a.start||"{",end:a.end||"}"}:void 0});return Object.keys(t).forEach(m=>{t[m]!==void 0&&t[m]!==null&&s.push(m);}),u.setData(t),u.render(),{buffer:u.getZip().generate({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:6}}),replacedVariables:s,unreplacedVariables:c,warnings:i}}catch(l){throw x(l)}}function ge(e,t,r={}){let o=O(e,t,r);return new Blob([o],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})}function be(e){try{let t=new g__default.default(e),o=new b__default.default(t,{paragraphLoop:!0,linebreaks:!0}).getFullText();return $(o)}catch(t){throw x(t)}}function L(e){let t=[],r=[];try{let o=new g__default.default(e),a=new b__default.default(o,{paragraphLoop:!0,linebreaks:!0}).getFullText();r=$(a);let i=K(a);for(let s of i)t.push({message:`Unclosed tag: ${s}`,variable:s,type:"parse"});return {valid:t.length===0,errors:t,tags:r}}catch(o){return t.push(x(o)),{valid:false,errors:t,tags:r}}}function xe(e,t){return e.filter(r=>!(r in t)||t[r]===void 0||t[r]===null)}function he(e,t){try{let r=new g__default.default(e),o=new b__default.default(r,{paragraphLoop:!0,linebreaks:!0,nullGetter:n=>`[${n.value||""}]`});return o.setData(t),o.render(),o.getFullText()}catch(r){throw x(r)}}function $(e){let t=[],r=/\{([^{}]+)\}/g,o;for(;(o=r.exec(e))!==null;){let n=o[1].trim();n&&!t.includes(n)&&t.push(n);}return t.sort()}function K(e){let t=[],r=0,o="";for(let n of e)n==="{"?(r++,o=""):n==="}"?(r--,r<0&&(r=0)):r>0&&(o+=n);return r>0&&o.trim()&&t.push(o.trim()),t}function Q(e){return "properties"in e&&typeof e.properties=="object"}function x(e){if(e instanceof Error){if(Q(e)&&e.properties?.errors){let t=e.properties.errors[0];return {message:t?.message||"Template processing error",variable:t?.properties?.tag,type:"render",originalError:e}}if(e.message.includes("undefined")){let t=e.message.match(/undefined (?:variable|tag):\s*(\S+)/i);return {message:e.message,variable:t?t[1]:void 0,type:"undefined",originalError:e}}return e.message.includes("parse")||e.message.includes("unclosed")||e.message.includes("syntax")?{message:e.message,type:"parse",originalError:e}:{message:e.message,type:"unknown",originalError:e}}return {message:String(e),type:"unknown"}}function ye(e,t,r={}){let{linebreaks:o=true,delimiters:n}=r;try{let a=new g__default.default(e),i=new b__default.default(a,{paragraphLoop:!0,linebreaks:o,delimiters:n?{start:n.start||"{",end:n.end||"}"}:void 0});return i.setData(t),i.render(),i.getZip().generate({type:"arraybuffer",compression:"DEFLATE"})}catch(a){throw x(a)}}function Te(e={}){return (t,r)=>O(t,r,e)}var h={type:"string",description:"Document ID from a previous docx_load call"},Y={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"]},N={name:"docx_get_variables",description:`List all template variables ({{name}} format) found in the document.
|
|
2
|
+
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
|
+
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId:h},required:["documentId"]},handler:async(e,t)=>{let{documentId:r}=e,o=t.session.documents.get(r);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${r}`}]};try{let n=V(o.document);return {content:[{type:"text",text:JSON.stringify({variables:n.variables,count:n.variables.length,totalOccurrences:n.totalOccurrences,byLocation:n.byLocation},null,2)}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to detect variables: ${n.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}'}]}},F={name:"docx_insert_variable",description:`Insert a template variable placeholder ({{name}}) at a specific position in the document.
|
|
4
|
+
The variable can later be substituted with actual values using docx_apply_template.
|
|
5
|
+
Variable names should follow the pattern: letters, numbers, underscores, starting with a letter.`,inputSchema:{type:"object",properties:{documentId:h,position:Y,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:r,position:o,variableName:n}=e,a=t.session.documents.get(r);if(!a)return {isError:true,content:[{type:"text",text:`Document not found: ${r}`}]};if(!/^[a-zA-Z_][a-zA-Z0-9_\-.]*$/.test(n))return {isError:true,content:[{type:"text",text:`Invalid variable name: ${n}. Must start with letter/underscore and contain only alphanumeric, underscore, hyphen, or dot.`}]};try{let{executeCommand:i}=await import('./executor-FSMRGT73.cjs'),s=i(a.document,{type:"insertText",position:o,text:`{{${n}}}`});return a.document=s,a.lastModified=Date.now(),s.templateVariables||(s.templateVariables=[]),s.templateVariables.includes(n)||s.templateVariables.push(n),{content:[{type:"text",text:JSON.stringify({success:!0,variable:n,insertedAs:`{{${n}}}`,position:o})}]}}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"}}]}},z={name:"docx_apply_template",description:`Substitute template variables with actual values in the document.
|
|
6
|
+
Replaces all {variable} placeholders with the corresponding values provided.
|
|
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:h,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:r,variables:o,keepUnmatchedVariables:n=true}=e,a=t.session.documents.get(r);if(!a)return {isError:true,content:[{type:"text",text:`Document not found: ${r}`}]};if(!a.buffer)return {isError:true,content:[{type:"text",text:"Cannot apply template: document was not loaded from a DOCX buffer"}]};try{let i=E(a.buffer,o,{nullGetter:n?"keep":"empty"}),s=await chunkG4AXMTQY_cjs.l(i.buffer);return a.document=s,a.buffer=i.buffer,a.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"}}}]}},H={name:"docx_validate_template",description:`Validate that a document is a valid docxtemplater template.
|
|
9
|
+
Checks for syntax errors like unclosed braces, invalid tag names, etc.
|
|
10
|
+
Returns validation result with any errors found and list of valid tags.`,inputSchema:{type:"object",properties:{documentId:h},required:["documentId"]},handler:async(e,t)=>{let{documentId:r}=e,o=t.session.documents.get(r);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${r}`}]};if(!o.buffer)return {isError:true,content:[{type:"text",text:"Cannot validate template: document was not loaded from a DOCX buffer"}]};try{let n=L(o.buffer);return {content:[{type:"text",text:JSON.stringify({valid:n.valid,tags:n.tags,errors:n.errors.map(a=>({message:a.message,variable:a.variable,type:a.type}))},null,2)}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to validate template: ${n.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low"}},D=[N,F,z,H];var ee={id:"docxtemplater",name:"Docxtemplater",version:"1.0.0",description:"Template variable support using standard docxtemplater syntax ({variable})",commandHandlers:{insertTemplateVariable:v,replaceWithTemplateVariable:w},mcpTools:D,initialize:()=>{try{chunkRTESADL3_cjs.a("docxtemplater"),chunkRTESADL3_cjs.a("pizzip");}catch{console.warn("[docxtemplater-plugin] Warning: docxtemplater or pizzip not installed. Template features may not work. Install with: npm install docxtemplater pizzip");}}};exports.a=U;exports.b=V;exports.c=j;exports.d=R;exports.e=B;exports.f=oe;exports.g=ae;exports.h=ie;exports.i=se;exports.j=ce;exports.k=le;exports.l=pe;exports.m=ue;exports.n=O;exports.o=E;exports.p=ge;exports.q=be;exports.r=L;exports.s=xe;exports.t=he;exports.u=ye;exports.v=Te;exports.w=J;exports.x=ee;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Ut from'jszip';import {xml2js}from'xml-js';var V=new Set,ne=new Map,we=new Set,be=false;function Ee(e,t=[400,700],n=["normal","italic"]){let o=encodeURIComponent(e),r=[];for(let a of n){let f=a==="italic"?1:0;for(let u of t)r.push(`${f},${u}`);}r.sort();let i=r.join(";");return `https://fonts.googleapis.com/css2?family=${o}:ital,wght@${i}&display=swap`}async function Pe(e,t){let n=e.trim();if(V.has(n))return true;let o=ne.get(n);if(o)return o;let r=(async()=>{be=true;try{let i=Ee(n,t?.weights,t?.styles),a=document.createElement("link");return a.rel="stylesheet",a.href=i,await new Promise(u=>{a.onload=()=>u(!0),a.onerror=()=>u(!1),document.head.appendChild(a),setTimeout(()=>u(!1),5e3);})?(await Be(n,3e3),V.add(n),Ae([n]),!0):!1}catch(i){return console.warn(`Failed to load font "${n}":`,i),false}finally{ne.delete(n),ne.size===0&&(be=false);}})();return ne.set(n,r),r}async function Dt(e,t){let n=e.filter(o=>!V.has(o.trim()));n.length!==0&&await Promise.all(n.map(o=>Pe(o,t)));}function Eo(e){return V.has(e.trim())}function Po(){return be}function Ao(){return Array.from(V)}function Bo(e){return we.add(e),()=>{we.delete(e);}}function Ae(e){for(let t of we)try{t(e);}catch(n){console.warn("Font load callback error:",n);}}async function Be(e,t){if("fonts"in document)try{let n=`400 16px "${e}"`;return await Promise.race([document.fonts.load(n),new Promise(o=>setTimeout(o,t))]),document.fonts.check(n)}catch{}return await new Promise(n=>setTimeout(n,100)),true}function No(e,t="sans-serif"){if(typeof document>"u")return false;let n=(r,i)=>{let f=document.createElement("canvas").getContext("2d");if(!f)return false;f.textBaseline="top";let u="abcdefghijklmnopqrstuvwxyz0123456789";f.font=`72px ${i}`;let c=f.measureText(u).width;return f.font=`72px "${r}", ${i}`,f.measureText(u).width!==c};return n(e,t)?true:n(e,t==="sans-serif"?"serif":"sans-serif")}async function Xo(e,t,n){let o=e.trim();if(V.has(o))return true;try{let r=new Blob([t],{type:"font/ttf"}),i=URL.createObjectURL(r),a=document.createElement("style");return a.textContent=`
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: "${o}";
|
|
4
|
+
src: url(${i}) format('truetype');
|
|
5
|
+
font-weight: ${n?.weight??"normal"};
|
|
6
|
+
font-style: ${n?.style??"normal"};
|
|
7
|
+
font-display: swap;
|
|
8
|
+
}
|
|
9
|
+
`,document.head.appendChild(a),await Be(o,3e3),V.add(o),Ae([o]),!0}catch(r){return console.warn(`Failed to load font "${o}" from buffer:`,r),false}}var Ht={Calibri:"Carlito",Cambria:"Caladea",Arial:"Arimo","Times New Roman":"Tinos","Courier New":"Cousine",Garamond:"EB Garamond","Book Antiqua":"EB Garamond",Georgia:"Tinos",Verdana:"Open Sans",Tahoma:"Open Sans","Trebuchet MS":"Source Sans Pro","Century Gothic":"Poppins","Franklin Gothic":"Libre Franklin",Palatino:"EB Garamond","Palatino Linotype":"EB Garamond","Lucida Sans":"Open Sans","Segoe UI":"Open Sans",Impact:"Anton","Comic Sans MS":"Comic Neue",Consolas:"Inconsolata","Lucida Console":"Inconsolata",Monaco:"Fira Code"};function Ot(e){let t=e.trim();return Ht[t]||t}async function jt(e){let t=e.trim(),n=Ot(t);return n!==t?(await Wt(t,n),V.add(t),V.add(n),true):Pe(n)}async function Wt(e,t){let n=`font-alias-${e.toLowerCase().replace(/\s+/g,"-")}`;if(!document.getElementById(n))try{let o=Ee(t,[400,700],["normal","italic"]),r=await fetch(o);if(!r.ok){console.warn(`Failed to fetch Google Fonts CSS for "${t}": ${r.status}`);return}let i=await r.text(),a=new RegExp(`font-family:\\s*['"]${Vt(t)}['"]`,"gi"),f=i.replace(a,`font-family: '${e}'`),u=document.createElement("style");u.id=n,u.textContent=f,document.head.appendChild(u),console.log(`Loaded font: "${e}" (via ${t})`);}catch(o){console.warn(`Failed to create font alias for "${e}":`,o);}}function Vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function ye(e){let t=[...new Set(e.map(n=>n.trim()))];await Promise.all(t.map(n=>jt(n)));}async function Lo(){await Dt(["Carlito","Caladea","Arimo","Tinos","Cousine","EB Garamond"]);}function zt(e){let t=new Set,n=e;if(!n?.package)return t;let o=n.package?.document?.content;if(Array.isArray(o)){for(let i of o)if(i?.type==="paragraph"&&Array.isArray(i.content)){for(let a of i.content)if(a?.type==="run"&&a.formatting?.fontFamily){let{ascii:f,hAnsi:u}=a.formatting.fontFamily;f&&t.add(f),u&&u!==f&&t.add(u);}}}let r=n.package?.styles?.styles;if(Array.isArray(r)){for(let i of r)if(i?.runProperties?.fontFamily){let{ascii:a,hAnsi:f}=i.runProperties.fontFamily;a&&t.add(a),f&&f!==a&&t.add(f);}}return t}async function Io(e){let t=zt(e);t.size!==0&&(console.log("Loading document fonts:",Array.from(t)),await ye(Array.from(t)));}async function Ne(e){let t=await Ut.loadAsync(e),n={documentXml:null,stylesXml:null,themeXml:null,numberingXml:null,fontTableXml:null,settingsXml:null,webSettingsXml:null,headers:new Map,footers:new Map,footnotesXml:null,endnotesXml:null,commentsXml:null,documentRels:null,packageRels:null,contentTypesXml:null,corePropsXml:null,appPropsXml:null,customPropsXml:null,media:new Map,fonts:new Map,allXml:new Map,originalZip:t,originalBuffer:e};for(let[o,r]of Object.entries(t.files)){if(r.dir)continue;let i=o.toLowerCase();if(i.endsWith(".xml")||i.endsWith(".rels")){let a=await r.async("text");if(n.allXml.set(o,a),i==="word/document.xml")n.documentXml=a;else if(i==="word/styles.xml")n.stylesXml=a;else if(i==="word/theme/theme1.xml")n.themeXml=a;else if(i==="word/numbering.xml")n.numberingXml=a;else if(i==="word/fonttable.xml")n.fontTableXml=a;else if(i==="word/settings.xml")n.settingsXml=a;else if(i==="word/websettings.xml")n.webSettingsXml=a;else if(i==="word/footnotes.xml")n.footnotesXml=a;else if(i==="word/endnotes.xml")n.endnotesXml=a;else if(i==="word/comments.xml")n.commentsXml=a;else if(i==="word/_rels/document.xml.rels")n.documentRels=a;else if(i==="_rels/.rels")n.packageRels=a;else if(i==="[content_types].xml")n.contentTypesXml=a;else if(i==="docprops/core.xml")n.corePropsXml=a;else if(i==="docprops/app.xml")n.appPropsXml=a;else if(i==="docprops/custom.xml")n.customPropsXml=a;else if(i.match(/^word\/header\d+\.xml$/)){let f=o.split("/").pop()||o;n.headers.set(f,a);}else if(i.match(/^word\/footer\d+\.xml$/)){let f=o.split("/").pop()||o;n.footers.set(f,a);}}else if(i.startsWith("word/media/")){let a=await r.async("arraybuffer");n.media.set(o,a);}else if(i.startsWith("word/fonts/")){let a=await r.async("arraybuffer");n.fonts.set(o,a);}}return n}function Xe(e){switch(e.toLowerCase().split(".").pop()){case "png":return "image/png";case "jpg":case "jpeg":return "image/jpeg";case "gif":return "image/gif";case "bmp":return "image/bmp";case "tif":case "tiff":return "image/tiff";case "wmf":return "image/x-wmf";case "emf":return "image/x-emf";case "svg":return "image/svg+xml";case "webp":return "image/webp";default:return "application/octet-stream"}}function z(e){return xml2js(e,{compact:false,ignoreComment:true,ignoreInstruction:true,ignoreDoctype:true,alwaysArray:false,trim:false,attributesKey:"attributes",textKey:"text"})}function U(e){try{let t=z(e);return t.elements&&t.elements.length>0?t.elements.find(n=>n.type==="element")??null:t}catch(t){return console.warn("Failed to parse XML:",t),null}}function oe(e){let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function l(e,t,n){if(!e||!e.elements)return null;let o=`${t}:${n}`;for(let r of e.elements)if(r.type==="element"&&(r.name===o||oe(r.name||"")===n))return r;return null}function B(e,t,n){if(!e||!e.elements)return [];let o=`${t}:${n}`,r=[];for(let i of e.elements)i.type==="element"&&(i.name===o||oe(i.name||"")===n)&&r.push(i);return r}function I(e){return !e||!e.elements?[]:e.elements.filter(t=>t.type==="element")}function s(e,t,n){if(!e||!e.attributes)return null;let o=e.attributes;if(t){let r=`${t}:${n}`;if(r in o)return o[r]}return n in o?o[n]:null}function re(e){if(!e)return "";if("text"in e&&typeof e.text=="string")return e.text;if(!e.elements)return "";let t="";for(let n of e.elements)n.type==="text"&&"text"in n?t+=n.text??"":n.type==="element"&&(t+=re(n));return t}function Le(e){return e?{val:s(e,"w","val")??void 0,themeColor:s(e,"w","themeColor")??void 0,themeTint:s(e,"w","themeTint")??void 0,themeShade:s(e,"w","themeShade")??void 0}:null}function g(e,t,n,o=1){let r=s(e,t,n);if(r===null)return;let i=parseInt(r,10);if(!isNaN(i))return i*o}function x(e,t="w"){if(!e)return false;let n=s(e,t,"val");return n===null?true:!(n==="0"||n==="false"||n==="off")}var ie={hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"};function ae(e){let t=new Map;if(!e||e.trim().length===0)return t;let n=U(e);if(!n)return console.warn("Failed to parse relationships XML"),t;let o=I(n);for(let r of o){let i=r.name||"";if(!i.endsWith("Relationship")&&!i.includes(":Relationship"))continue;let a=s(r,null,"Id"),f=s(r,null,"Type"),u=s(r,null,"Target"),c=s(r,null,"TargetMode");if(!a||!f||!u){console.warn("Relationship missing required attributes:",{id:a,type:f,target:u});continue}let d={id:a,type:f,target:u};c==="External"?d.targetMode="External":c==="Internal"&&(d.targetMode="Internal"),t.set(a,d);}return t}function Ie(e){return e.type===ie.hyperlink&&e.targetMode==="External"}var Oe={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},se={majorFont:{latin:"Calibri Light",ea:"",cs:"",fonts:{}},minorFont:{latin:"Calibri",ea:"",cs:"",fonts:{}}},xe={name:"Office Theme",colorScheme:Oe,fontScheme:se},_t=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function Gt(e){if(!e)return null;switch(oe(e.name||"")){case "srgbClr":return s(e,"a","val")??s(e,null,"val")??null;case "sysClr":{let n=s(e,"a","lastClr")??s(e,null,"lastClr");if(n)return n;switch(s(e,"a","val")??s(e,null,"val")){case "windowText":case "menuText":case "captionText":case "btnText":return "000000";case "window":case "menu":case "btnFace":case "btnHighlight":return "FFFFFF";case "highlight":return "0078D7";case "highlightText":return "FFFFFF";case "grayText":return "808080";default:return null}}case "schemeClr":{s(e,"a","val")??s(e,null,"val");return null}default:return null}}function qt(e){let t={...Oe};if(!e)return t;for(let n of _t){let o=l(e,"a",n);if(o){let r=I(o);if(r.length>0){let i=Gt(r[0]);i&&(t[n]=i);}}}return t}function De(e){let t={latin:"",ea:"",cs:"",fonts:{}};if(!e)return t;let n=l(e,"a","latin");n&&(t.latin=s(n,"a","typeface")??s(n,null,"typeface")??"");let o=l(e,"a","ea");o&&(t.ea=s(o,"a","typeface")??s(o,null,"typeface")??"");let r=l(e,"a","cs");r&&(t.cs=s(r,"a","typeface")??s(r,null,"typeface")??"");let i=B(e,"a","font");for(let a of i){let f=s(a,"a","script")??s(a,null,"script"),u=s(a,"a","typeface")??s(a,null,"typeface");f&&u&&(t.fonts=t.fonts||{},t.fonts[f]=u);}return t}function Zt(e){let t={...se};if(!e)return t;let n=l(e,"a","majorFont");n&&(t.majorFont=De(n));let o=l(e,"a","minorFont");return o&&(t.minorFont=De(o)),t}function je(e){if(!e)return {...xe};try{let t=U(e);if(!t)return {...xe};let n=s(t,"a","name")??s(t,null,"name")??"Office Theme",o=l(t,"a","themeElements"),r=l(o,"a","clrScheme"),i=qt(r),a=l(o,"a","fontScheme"),f=Zt(a);return {name:n,colorScheme:i,fontScheme:f}}catch(t){return console.warn("Failed to parse theme:",t),{...xe}}}function Yt(e,t="latin"){if(!e?.fontScheme?.majorFont)return se.majorFont?.latin??"Calibri Light";let n=e.fontScheme.majorFont;return t==="latin"?n.latin||"Calibri Light":t==="ea"?n.ea||"":t==="cs"?n.cs||"":n.fonts?.[t]?n.fonts[t]:n.latin||"Calibri Light"}function He(e,t="latin"){if(!e?.fontScheme?.minorFont)return se.minorFont?.latin??"Calibri";let n=e.fontScheme.minorFont;return t==="latin"?n.latin||"Calibri":t==="ea"?n.ea||"":t==="cs"?n.cs||"":n.fonts?.[t]?n.fonts[t]:n.latin||"Calibri"}function W(e,t){if(!t)return "Calibri";let n=t.toLowerCase().includes("major"),o=t.toLowerCase().includes("minor"),r="latin",i=t.toLowerCase();return i.includes("eastasia")?r="ea":(i.includes("bidi")||i.includes("cs"))&&(r="cs"),n?Yt(e,r):o?He(e,r):He(e,"latin")}function le(e,t){if(!e)return;let n={},o=l(e,"w","b");o&&(n.bold=x(o));let r=l(e,"w","bCs");r&&(n.boldCs=x(r));let i=l(e,"w","i");i&&(n.italic=x(i));let a=l(e,"w","iCs");a&&(n.italicCs=x(a));let f=l(e,"w","u");if(f){let M=s(f,"w","val");if(M){n.underline={style:M};let k=s(f,"w","color"),D=s(f,"w","themeColor");(k||D)&&(n.underline.color=Te(k,D,s(f,"w","themeTint"),s(f,"w","themeShade")));}}let u=l(e,"w","strike");u&&(n.strike=x(u));let c=l(e,"w","dstrike");c&&(n.doubleStrike=x(c));let d=l(e,"w","vertAlign");if(d){let M=s(d,"w","val");(M==="superscript"||M==="subscript"||M==="baseline")&&(n.vertAlign=M);}let m=l(e,"w","smallCaps");m&&(n.smallCaps=x(m));let y=l(e,"w","caps");y&&(n.allCaps=x(y));let b=l(e,"w","vanish");b&&(n.hidden=x(b));let p=l(e,"w","color");p&&(n.color=Te(s(p,"w","val"),s(p,"w","themeColor"),s(p,"w","themeTint"),s(p,"w","themeShade")));let T=l(e,"w","highlight");if(T){let M=s(T,"w","val");M&&(n.highlight=M);}let N=l(e,"w","shd");N&&(n.shading=fe(N));let A=l(e,"w","sz");if(A){let M=g(A,"w","val");M!==void 0&&(n.fontSize=M);}let R=l(e,"w","szCs");if(R){let M=g(R,"w","val");M!==void 0&&(n.fontSizeCs=M);}let v=l(e,"w","rFonts");if(v){n.fontFamily={ascii:s(v,"w","ascii")??void 0,hAnsi:s(v,"w","hAnsi")??void 0,eastAsia:s(v,"w","eastAsia")??void 0,cs:s(v,"w","cs")??void 0};let M=s(v,"w","asciiTheme");M&&(n.fontFamily.asciiTheme=M,t&&!n.fontFamily.ascii&&(n.fontFamily.ascii=W(t,M)));let k=s(v,"w","hAnsiTheme");k&&(n.fontFamily.hAnsiTheme=k,t&&!n.fontFamily.hAnsi&&(n.fontFamily.hAnsi=W(t,k)));let D=s(v,"w","eastAsiaTheme");D&&(n.fontFamily.eastAsiaTheme=D,t&&!n.fontFamily.eastAsia&&(n.fontFamily.eastAsia=W(t,D)));let j=s(v,"w","cstheme");j&&(n.fontFamily.csTheme=j,t&&!n.fontFamily.cs&&(n.fontFamily.cs=W(t,j)));}let h=l(e,"w","spacing");if(h){let M=g(h,"w","val");M!==void 0&&(n.spacing=M);}let F=l(e,"w","position");if(F){let M=g(F,"w","val");M!==void 0&&(n.position=M);}let w=l(e,"w","w");if(w){let M=g(w,"w","val");M!==void 0&&(n.scale=M);}let C=l(e,"w","kern");if(C){let M=g(C,"w","val");M!==void 0&&(n.kerning=M);}let S=l(e,"w","effect");if(S){let M=s(S,"w","val");M&&(n.effect=M);}let E=l(e,"w","em");if(E){let M=s(E,"w","val");M&&(n.emphasisMark=M);}let P=l(e,"w","emboss");P&&(n.emboss=x(P));let L=l(e,"w","imprint");L&&(n.imprint=x(L));let O=l(e,"w","outline");O&&(n.outline=x(O));let Y=l(e,"w","shadow");Y&&(n.shadow=x(Y));let K=l(e,"w","rtl");K&&(n.rtl=x(K));let J=l(e,"w","cs");J&&(n.cs=x(J));let Q=l(e,"w","rStyle");if(Q){let M=s(Q,"w","val");M&&(n.styleId=M);}return Object.keys(n).length>0?n:void 0}function Te(e,t,n,o){let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),r}function fe(e){if(!e)return;let t={},n=s(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let o=s(e,"w","fill");o&&o!=="auto"&&(t.fill={rgb:o});let r=s(e,"w","themeFill");r&&(t.fill=t.fill||{},t.fill.themeColor=r);let i=s(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=s(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let f=s(e,"w","val");return f&&(t.pattern=f),Object.keys(t).length>0?t:void 0}function H(e){if(!e)return;let t=s(e,"w","val");if(!t)return;let n={style:t},o=s(e,"w","color"),r=s(e,"w","themeColor");(o||r)&&(n.color=Te(o,r,s(e,"w","themeTint"),s(e,"w","themeShade")));let i=g(e,"w","sz");i!==void 0&&(n.size=i);let a=g(e,"w","space");a!==void 0&&(n.space=a);let f=s(e,"w","shadow");f&&(n.shadow=f==="1"||f==="true");let u=s(e,"w","frame");return u&&(n.frame=u==="1"||u==="true"),n}function Kt(e){if(!e)return;let t=B(e,"w","tab");if(t.length===0)return;let n=[];for(let o of t){let r=g(o,"w","pos"),i=s(o,"w","val");if(r!==void 0&&i){let a={position:r,alignment:i},f=s(o,"w","leader");f&&(a.leader=f),n.push(a);}}return n.length>0?n:void 0}function Fe(e,t){if(!e)return;let n={},o=l(e,"w","jc");if(o){let h=s(o,"w","val");h&&(n.alignment=h);}let r=l(e,"w","bidi");r&&(n.bidi=x(r));let i=l(e,"w","spacing");if(i){let h=g(i,"w","before");h!==void 0&&(n.spaceBefore=h);let F=g(i,"w","after");F!==void 0&&(n.spaceAfter=F);let w=g(i,"w","line");w!==void 0&&(n.lineSpacing=w);let C=s(i,"w","lineRule");C&&(n.lineSpacingRule=C);let S=s(i,"w","beforeAutospacing");S&&(n.beforeAutospacing=S==="1"||S==="true");let E=s(i,"w","afterAutospacing");E&&(n.afterAutospacing=E==="1"||E==="true");}let a=l(e,"w","ind");if(a){let h=g(a,"w","left");h!==void 0&&(n.indentLeft=h);let F=g(a,"w","right");F!==void 0&&(n.indentRight=F);let w=g(a,"w","firstLine");w!==void 0&&(n.indentFirstLine=w);let C=g(a,"w","hanging");C!==void 0&&(n.indentFirstLine=-C,n.hangingIndent=true);}let f=l(e,"w","pBdr");if(f){let h={},F=H(l(f,"w","top"));F&&(h.top=F);let w=H(l(f,"w","bottom"));w&&(h.bottom=w);let C=H(l(f,"w","left"));C&&(h.left=C);let S=H(l(f,"w","right"));S&&(h.right=S);let E=H(l(f,"w","between"));E&&(h.between=E);let P=H(l(f,"w","bar"));P&&(h.bar=P),Object.keys(h).length>0&&(n.borders=h);}let u=l(e,"w","shd");u&&(n.shading=fe(u));let c=l(e,"w","tabs");c&&(n.tabs=Kt(c));let d=l(e,"w","keepNext");d&&(n.keepNext=x(d));let m=l(e,"w","keepLines");m&&(n.keepLines=x(m));let y=l(e,"w","widowControl");y&&(n.widowControl=x(y));let b=l(e,"w","pageBreakBefore");b&&(n.pageBreakBefore=x(b));let p=l(e,"w","numPr");if(p){let h=l(p,"w","numId"),F=l(p,"w","ilvl");if(h||F){if(n.numPr={},h){let w=g(h,"w","val");w!==void 0&&(n.numPr.numId=w);}if(F){let w=g(F,"w","val");w!==void 0&&(n.numPr.ilvl=w);}}}let T=l(e,"w","outlineLvl");if(T){let h=g(T,"w","val");h!==void 0&&(n.outlineLevel=h);}let N=l(e,"w","pStyle");if(N){let h=s(N,"w","val");h&&(n.styleId=h);}let A=l(e,"w","suppressLineNumbers");A&&(n.suppressLineNumbers=x(A));let R=l(e,"w","suppressAutoHyphens");R&&(n.suppressAutoHyphens=x(R));let v=l(e,"w","rPr");return v&&(n.runProperties=le(v,t)),Object.keys(n).length>0?n:void 0}function $(e){if(!e)return;let t=g(e,"w","w"),n=s(e,"w","type");if(t!==void 0&&n)return {value:t,type:n}}function Ue(e){if(!e)return;let t={},n=H(l(e,"w","top"));n&&(t.top=n);let o=H(l(e,"w","bottom"));o&&(t.bottom=o);let r=H(l(e,"w","left"));r&&(t.left=r);let i=H(l(e,"w","right"));i&&(t.right=i);let a=H(l(e,"w","insideH"));a&&(t.insideH=a);let f=H(l(e,"w","insideV"));return f&&(t.insideV=f),Object.keys(t).length>0?t:void 0}function $e(e){if(!e)return;let t={},n=$(l(e,"w","top"));n&&(t.top=n);let o=$(l(e,"w","bottom"));o&&(t.bottom=o);let r=$(l(e,"w","left"));r&&(t.left=r);let i=$(l(e,"w","right"));return i&&(t.right=i),Object.keys(t).length>0?t:void 0}function Jt(e){if(!e)return;let t={},n=s(e,"w","val");if(n){let c=parseInt(n,16);isNaN(c)||(t.firstRow=(c&32)!==0,t.lastRow=(c&64)!==0,t.firstColumn=(c&128)!==0,t.lastColumn=(c&256)!==0,t.noHBand=(c&512)!==0,t.noVBand=(c&1024)!==0);}let o=s(e,"w","firstColumn");o&&(t.firstColumn=o==="1");let r=s(e,"w","firstRow");r&&(t.firstRow=r==="1");let i=s(e,"w","lastColumn");i&&(t.lastColumn=i==="1");let a=s(e,"w","lastRow");a&&(t.lastRow=a==="1");let f=s(e,"w","noHBand");f&&(t.noHBand=f==="1");let u=s(e,"w","noVBand");return u&&(t.noVBand=u==="1"),Object.keys(t).length>0?t:void 0}function We(e,t){if(!e)return;let n={},o=l(e,"w","tblW");o&&(n.width=$(o));let r=l(e,"w","jc");if(r){let p=s(r,"w","val");(p==="left"||p==="center"||p==="right")&&(n.justification=p);}let i=l(e,"w","tblCellSpacing");i&&(n.cellSpacing=$(i));let a=l(e,"w","tblInd");a&&(n.indent=$(a));let f=l(e,"w","tblBorders");f&&(n.borders=Ue(f));let u=l(e,"w","tblCellMar");u&&(n.cellMargins=$e(u));let c=l(e,"w","tblLayout");if(c){let p=s(c,"w","type");(p==="fixed"||p==="autofit")&&(n.layout=p);}let d=l(e,"w","tblStyle");if(d){let p=s(d,"w","val");p&&(n.styleId=p);}let m=l(e,"w","tblLook");m&&(n.look=Jt(m));let y=l(e,"w","shd");y&&(n.shading=fe(y));let b=l(e,"w","bidiVisual");return b&&(n.bidi=x(b)),Object.keys(n).length>0?n:void 0}function Ve(e){if(!e)return;let t={},n=l(e,"w","trHeight");if(n){t.height=$(n);let f=s(n,"w","hRule");f&&(t.heightRule=f);}let o=l(e,"w","tblHeader");o&&(t.header=x(o));let r=l(e,"w","cantSplit");r&&(t.cantSplit=x(r));let i=l(e,"w","jc");if(i){let f=s(i,"w","val");(f==="left"||f==="center"||f==="right")&&(t.justification=f);}let a=l(e,"w","hidden");return a&&(t.hidden=x(a)),Object.keys(t).length>0?t:void 0}function ze(e,t){if(!e)return;let n={},o=l(e,"w","tcW");o&&(n.width=$(o));let r=l(e,"w","tcBorders");r&&(n.borders=Ue(r));let i=l(e,"w","tcMar");i&&(n.margins=$e(i));let a=l(e,"w","shd");a&&(n.shading=fe(a));let f=l(e,"w","vAlign");if(f){let p=s(f,"w","val");(p==="top"||p==="center"||p==="bottom")&&(n.verticalAlign=p);}let u=l(e,"w","textDirection");if(u){let p=s(u,"w","val");p&&(n.textDirection=p);}let c=l(e,"w","gridSpan");if(c){let p=g(c,"w","val");p!==void 0&&(n.gridSpan=p);}let d=l(e,"w","vMerge");if(d){let p=s(d,"w","val");n.vMerge=p==="restart"?"restart":"continue";}let m=l(e,"w","tcFitText");m&&(n.fitText=x(m));let y=l(e,"w","noWrap");y&&(n.noWrap=x(y));let b=l(e,"w","hideMark");return b&&(n.hideMark=x(b)),Object.keys(n).length>0?n:void 0}function Qt(e,t){let n={styleId:s(e,"w","styleId")??"",type:s(e,"w","type")??"paragraph"},o=s(e,"w","default");o&&(n.default=o==="1"||o==="true");let r=l(e,"w","name");r&&(n.name=s(r,"w","val")??void 0);let i=l(e,"w","basedOn");i&&(n.basedOn=s(i,"w","val")??void 0);let a=l(e,"w","next");a&&(n.next=s(a,"w","val")??void 0);let f=l(e,"w","link");f&&(n.link=s(f,"w","val")??void 0);let u=l(e,"w","uiPriority");if(u){let h=g(u,"w","val");h!==void 0&&(n.uiPriority=h);}let c=l(e,"w","hidden");c&&(n.hidden=x(c));let d=l(e,"w","semiHidden");d&&(n.semiHidden=x(d));let m=l(e,"w","unhideWhenUsed");m&&(n.unhideWhenUsed=x(m));let y=l(e,"w","qFormat");y&&(n.qFormat=x(y));let b=l(e,"w","personal");b&&(n.personal=x(b));let p=l(e,"w","pPr");p&&(n.pPr=Fe(p,t));let T=l(e,"w","rPr");T&&(n.rPr=le(T,t));let N=l(e,"w","tblPr");N&&(n.tblPr=We(N));let A=l(e,"w","trPr");A&&(n.trPr=Ve(A));let R=l(e,"w","tcPr");R&&(n.tcPr=ze(R));let v=B(e,"w","tblStylePr");if(v.length>0){n.tblStylePr=[];for(let h of v){let F=s(h,"w","type");if(F){let w={type:F},C=l(h,"w","pPr");C&&(w.pPr=Fe(C,t));let S=l(h,"w","rPr");S&&(w.rPr=le(S,t));let E=l(h,"w","tblPr");E&&(w.tblPr=We(E));let P=l(h,"w","trPr");P&&(w.trPr=Ve(P));let L=l(h,"w","tcPr");L&&(w.tcPr=ze(L)),n.tblStylePr.push(w);}}}return n}function en(e,t){if(!e)return;let n={},o=l(e,"w","rPrDefault");if(o){let i=l(o,"w","rPr");i&&(n.rPr=le(i,t));}let r=l(e,"w","pPrDefault");if(r){let i=l(r,"w","pPr");i&&(n.pPr=Fe(i,t));}return n.rPr||n.pPr?n:void 0}function _e(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let o of Object.keys(t)){let r=t[o];r!==void 0&&(n[o]=typeof r=="object"&&r!==null?{...n[o]||{},...r}:r);}return n}function tn(e,t){if(!t)return e;if(!e)return t?{...t}:void 0;let n={...e};for(let o of Object.keys(t)){let r=t[o];if(r!==void 0)if(o==="runProperties")n.runProperties=_e(n.runProperties,t.runProperties);else if(o==="borders"||o==="numPr"||o==="frame"){let i=n[o],a=r;n[o]={...i||{},...a||{}};}else o==="tabs"&&Array.isArray(r)?n.tabs=[...r]:n[o]=r;}return n}function Ge(e,t,n,o=new Set){if(o.has(e.styleId)||(o.add(e.styleId),!e.basedOn))return e;let r=t.get(e.basedOn);if(!r)return e;let i=Ge(r,t,n,o),a={...e,pPr:tn(i.pPr,e.pPr),rPr:_e(i.rPr,e.rPr)};return e.type==="table"&&((i.tblPr||e.tblPr)&&(a.tblPr={...i.tblPr||{},...e.tblPr||{}}),(i.trPr||e.trPr)&&(a.trPr={...i.trPr||{},...e.trPr||{}}),(i.tcPr||e.tcPr)&&(a.tcPr={...i.tcPr||{},...e.tcPr||{}})),a}function Ce(e,t){let n=new Map;try{let o=U(e);if(!o)return n;let r=B(o,"w","style");for(let i of r){let a=Qt(i,t);a.styleId&&n.set(a.styleId,a);}for(let[i,a]of n){let f=Ge(a,n,t);n.set(i,f);}}catch(o){console.warn("Failed to parse styles:",o);}return n}function qe(e,t){let n={styles:[]};try{let o=U(e);if(!o)return n;let r=l(o,"w","docDefaults");n.docDefaults=en(r,t);let i=l(o,"w","latentStyles");i&&(n.latentStyles={defLockedState:s(i,"w","defLockedState")==="1",defUIPriority:g(i,"w","defUIPriority"),defSemiHidden:s(i,"w","defSemiHidden")==="1",defUnhideWhenUsed:s(i,"w","defUnhideWhenUsed")==="1",defQFormat:s(i,"w","defQFormat")==="1",count:g(i,"w","count")});let a=Ce(e,t);n.styles=Array.from(a.values());}catch(o){console.warn("Failed to parse style definitions:",o);}return n}function Ze(e){let t={abstractNums:[],nums:[]};if(!e)return Se(t);let n=U(e);if(!n)return Se(t);let o=B(n,"w","abstractNum");for(let i of o){let a=nn(i);a&&t.abstractNums.push(a);}let r=B(n,"w","num");for(let i of r){let a=on(i);a&&t.nums.push(a);}return Se(t)}function nn(e){let t=s(e,"w","abstractNumId");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n))return null;let o={abstractNumId:n,levels:[]},r=l(e,"w","multiLevelType");if(r){let c=s(r,"w","val");(c==="hybridMultilevel"||c==="multilevel"||c==="singleLevel")&&(o.multiLevelType=c);}let i=l(e,"w","name");i&&(o.name=s(i,"w","val")??void 0);let a=l(e,"w","numStyleLink");a&&(o.numStyleLink=s(a,"w","val")??void 0);let f=l(e,"w","styleLink");f&&(o.styleLink=s(f,"w","val")??void 0);let u=B(e,"w","lvl");for(let c of u){let d=Ye(c);d&&o.levels.push(d);}return o.levels.sort((c,d)=>c.ilvl-d.ilvl),o}function on(e){let t=s(e,"w","numId");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n))return null;let o=l(e,"w","abstractNumId");if(!o)return null;let r=s(o,"w","val");if(r===null)return null;let i=parseInt(r,10);if(isNaN(i))return null;let a={numId:n,abstractNumId:i},f=B(e,"w","lvlOverride");if(f.length>0){a.levelOverrides=[];for(let u of f){let c=s(u,"w","ilvl");if(c===null)continue;let d=parseInt(c,10);if(isNaN(d))continue;let m={ilvl:d},y=l(u,"w","startOverride");if(y){let p=s(y,"w","val");if(p!==null){let T=parseInt(p,10);isNaN(T)||(m.startOverride=T);}}let b=l(u,"w","lvl");b&&(m.lvl=Ye(b)??void 0),a.levelOverrides.push(m);}}return a}function Ye(e){let t=s(e,"w","ilvl");if(t===null)return null;let n=parseInt(t,10);if(isNaN(n)||n<0||n>8)return null;let o={ilvl:n,numFmt:"decimal",lvlText:""},r=l(e,"w","start");if(r){let p=s(r,"w","val");if(p!==null){let T=parseInt(p,10);isNaN(T)||(o.start=T);}}let i=l(e,"w","numFmt");if(i){let p=s(i,"w","val");p&&(o.numFmt=rn(p));}let a=l(e,"w","lvlText");a&&(o.lvlText=s(a,"w","val")??"");let f=l(e,"w","lvlJc");if(f){let p=s(f,"w","val");(p==="left"||p==="center"||p==="right")&&(o.lvlJc=p);}let u=l(e,"w","suff");if(u){let p=s(u,"w","val");(p==="tab"||p==="space"||p==="nothing")&&(o.suffix=p);}let c=l(e,"w","isLgl");c&&(o.isLgl=x(c));let d=l(e,"w","lvlRestart");if(d){let p=s(d,"w","val");if(p!==null){let T=parseInt(p,10);isNaN(T)||(o.lvlRestart=T);}}let m=l(e,"w","legacy");m&&(o.legacy={legacy:x(m),legacySpace:g(m,"w","legacySpace"),legacyIndent:g(m,"w","legacyIndent")});let y=l(e,"w","pPr");y&&(o.pPr=an(y));let b=l(e,"w","rPr");return b&&(o.rPr=fn(b)),o}function rn(e){return {decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",hex:"hex",chicago:"chicago",bullet:"bullet",none:"none",decimalZero:"decimalZero",ganada:"ganada",chosung:"chosung",ideographDigital:"ideographDigital",japaneseCounting:"japaneseCounting",aiueo:"aiueo",iroha:"iroha",decimalFullWidth:"decimalFullWidth",decimalHalfWidth:"decimalHalfWidth",japaneseLegal:"japaneseLegal",japaneseDigitalTenThousand:"japaneseDigitalTenThousand",decimalEnclosedCircle:"decimalEnclosedCircle",decimalFullWidth2:"decimalFullWidth2",aiueoFullWidth:"aiueoFullWidth",irohaFullWidth:"irohaFullWidth",decimalEnclosedFullstop:"decimalEnclosedFullstop",decimalEnclosedParen:"decimalEnclosedParen",decimalEnclosedCircleChinese:"decimalEnclosedCircleChinese",ideographEnclosedCircle:"ideographEnclosedCircle",ideographTraditional:"ideographTraditional",ideographZodiac:"ideographZodiac",ideographZodiacTraditional:"ideographZodiacTraditional",taiwaneseCounting:"taiwaneseCounting",ideographLegalTraditional:"ideographLegalTraditional",taiwaneseCountingThousand:"taiwaneseCountingThousand",taiwaneseDigital:"taiwaneseDigital",chineseCounting:"chineseCounting",chineseLegalSimplified:"chineseLegalSimplified",chineseCountingThousand:"chineseCountingThousand",koreanDigital:"koreanDigital",koreanCounting:"koreanCounting",koreanLegal:"koreanLegal",koreanDigital2:"koreanDigital2",vietnameseCounting:"vietnameseCounting",russianLower:"russianLower",russianUpper:"russianUpper",numberInDash:"numberInDash",hebrew1:"hebrew1",hebrew2:"hebrew2",arabicAlpha:"arabicAlpha",arabicAbjad:"arabicAbjad",hindiVowels:"hindiVowels",hindiConsonants:"hindiConsonants",hindiNumbers:"hindiNumbers",hindiCounting:"hindiCounting",thaiLetters:"thaiLetters",thaiNumbers:"thaiNumbers",thaiCounting:"thaiCounting"}[e]??"decimal"}function an(e){let t={},n=l(e,"w","ind");if(n){let r=g(n,"w","left"),i=g(n,"w","right"),a=g(n,"w","firstLine"),f=g(n,"w","hanging");r!==void 0&&(t.indentLeft=r),i!==void 0&&(t.indentRight=i),f!==void 0?(t.indentFirstLine=-f,t.hangingIndent=true):a!==void 0&&(t.indentFirstLine=a);}let o=l(e,"w","tabs");if(o){t.tabs=[];let r=B(o,"w","tab");for(let i of r){let a=g(i,"w","pos"),f=s(i,"w","val"),u=s(i,"w","leader");a!==void 0&&f&&t.tabs.push({position:a,alignment:sn(f),leader:ln(u)});}}return t}function sn(e){switch(e){case "left":return "left";case "center":return "center";case "right":return "right";case "decimal":return "decimal";case "bar":return "bar";case "clear":return "clear";case "num":return "num";default:return "left"}}function ln(e){if(e)switch(e){case "none":return "none";case "dot":return "dot";case "hyphen":return "hyphen";case "underscore":return "underscore";case "heavy":return "heavy";case "middleDot":return "middleDot";default:return}}function fn(e){let t={},n=l(e,"w","rFonts");n&&(t.fontFamily={ascii:s(n,"w","ascii")??void 0,hAnsi:s(n,"w","hAnsi")??void 0,eastAsia:s(n,"w","eastAsia")??void 0,cs:s(n,"w","cs")??void 0});let o=l(e,"w","sz");if(o){let f=g(o,"w","val");f!==void 0&&(t.fontSize=f);}let r=l(e,"w","color");if(r){let f=s(r,"w","val"),u=s(r,"w","themeColor");f==="auto"?t.color={auto:true}:u?t.color={themeColor:u,themeTint:s(r,"w","themeTint")??void 0,themeShade:s(r,"w","themeShade")??void 0}:f&&(t.color={rgb:f});}let i=l(e,"w","b");i&&(t.bold=x(i));let a=l(e,"w","i");return a&&(t.italic=x(a)),t}function Se(e){let t=new Map;for(let o of e.abstractNums)t.set(o.abstractNumId,o);let n=new Map;for(let o of e.nums)n.set(o.numId,o);return {definitions:e,getLevel(o,r){let i=n.get(o);if(!i)return null;if(i.levelOverrides){let f=i.levelOverrides.find(u=>u.ilvl===r);if(f){if(f.lvl)return f.lvl;let u=t.get(i.abstractNumId);if(u){let c=u.levels.find(d=>d.ilvl===r);if(c&&f.startOverride!==void 0)return {...c,start:f.startOverride}}}}let a=t.get(i.abstractNumId);return a?a.levels.find(f=>f.ilvl===r)??null:null},getAbstract(o){return t.get(o)??null},hasNumbering(o){return n.has(o)}}}var un=914400,cn=96;function Jo(e){return e==null||isNaN(e)?0:Math.round(e*cn/un)}function dn(e){if(!e)return;let t=parseInt(e,10);if(!isNaN(t))return t/6e4}function X(e,t){let n=I(e);for(let o of n)if(o.name===t)return o;return null}function pn(e,t){let n=I(e);for(let o of n)if(t.includes(o.name||""))return o;return null}function Ke(e){if(!e)return {width:0,height:0};let t=g(e,null,"cx")??0,n=g(e,null,"cy")??0;return {width:t,height:n}}function Je(e){if(!e)return;let t=g(e,null,"l")??0,n=g(e,null,"t")??0,o=g(e,null,"r")??0,r=g(e,null,"b")??0;if(!(t===0&&n===0&&o===0&&r===0))return {left:t,top:n,right:o,bottom:r}}function Qe(e){if(!e)return {};let t=s(e,null,"id")??void 0,n=s(e,null,"name")??void 0,o=s(e,null,"descr")??void 0,r=s(e,null,"title")??void 0,i=s(e,null,"decorative")==="1";return {id:t,name:n,alt:o,title:r,decorative:i||void 0}}function mn(e){if(!e)return;let t=s(e,null,"relativeFrom")??"column",n=X(e,"wp:align");if(n){let r=n.elements?.[0]?.text??null;return {relativeTo:t,alignment:r}}let o=X(e,"wp:posOffset");if(o){let r=String(o.elements?.[0]?.text??"0"),i=parseInt(r,10);return {relativeTo:t,posOffset:isNaN(i)?0:i}}return {relativeTo:t}}function gn(e){if(!e)return;let t=s(e,null,"relativeFrom")??"paragraph",n=X(e,"wp:align");if(n){let r=n.elements?.[0]?.text??null;return {relativeTo:t,alignment:r}}let o=X(e,"wp:posOffset");if(o){let r=String(o.elements?.[0]?.text??"0"),i=parseInt(r,10);return {relativeTo:t,posOffset:isNaN(i)?0:i}}return {relativeTo:t}}var hn=["wp:wrapNone","wp:wrapSquare","wp:wrapTight","wp:wrapThrough","wp:wrapTopAndBottom"];function wn(e,t){if(!e)return {type:t?"behind":"inFront"};let o=(e.name||"").replace("wp:",""),r=g(e,null,"distT")??void 0,i=g(e,null,"distB")??void 0,a=g(e,null,"distL")??void 0,f=g(e,null,"distR")??void 0,u=s(e,null,"wrapText")??void 0,c;switch(o){case "wrapNone":c=t?"behind":"inFront";break;case "wrapSquare":c="square";break;case "wrapTight":c="tight";break;case "wrapThrough":c="through";break;case "wrapTopAndBottom":c="topAndBottom";break;default:c="square";}let d={type:c};return u&&(d.wrapText=u),r!==void 0&&(d.distT=r),i!==void 0&&(d.distB=i),a!==void 0&&(d.distL=a),f!==void 0&&(d.distR=f),d}function et(e){if(!e)return;let t=s(e,null,"rot"),n=s(e,null,"flipH")==="1",o=s(e,null,"flipV")==="1",r=dn(t);if(r===void 0&&!n&&!o)return;let i={};return r!==void 0&&(i.rotation=r),n&&(i.flipH=true),o&&(i.flipV=true),i}function tt(e){let t=X(e,"a:graphic");if(!t)return null;let n=X(t,"a:graphicData");if(!n)return null;let o=X(n,"pic:pic");if(!o)return null;let r=X(o,"pic:blipFill");return r?X(r,"a:blip"):null}function nt(e){if(!e)return "";let t=s(e,"r","embed");if(t)return t;let n=s(e,null,"embed");if(n)return n;let o=s(e,"r","link");return o||""}function ot(e){let t=X(e,"a:graphic");if(!t)return null;let n=X(t,"a:graphicData");if(!n)return null;let o=X(n,"pic:pic");if(!o)return null;let r=X(o,"pic:spPr");return r?X(r,"a:xfrm"):null}function bn(e){if(!e)return e;let t=e.replace(/^\/+/,"");return t.startsWith("media/")?t=`word/${t}`:t.startsWith("word/")||(t=`word/${t}`),t}function yn(e){let t=e.split(".").pop()?.toLowerCase()??"";return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"}[t]??"application/octet-stream"}function rt(e,t,n){if(!e||!t)return {};let o=t.get(e);if(!o)return {};let r=o.target;if(!r)return {};let i=bn(r),a=r.split("/").pop(),f=(u,c)=>{let d=c.toLowerCase();for(let[m,y]of u.entries())if(m.toLowerCase()===d)return y};if(n){let u=f(n,i);if(u)return {src:u.dataUrl||u.base64,mimeType:u.mimeType,filename:a};let c=r.replace(/^\/+/,""),d=f(n,c);if(d)return {src:d.dataUrl||d.base64,mimeType:d.mimeType,filename:a};let m=`word/${c}`,y=f(n,m);if(y)return {src:y.dataUrl||y.base64,mimeType:y.mimeType,filename:a}}return {mimeType:yn(r),filename:a}}function xn(e,t,n){let o=X(e,"wp:extent"),r=Ke(o),i=X(e,"wp:effectExtent"),a=Je(i),f=X(e,"wp:docPr"),u=Qe(f),c=tt(e),d=nt(c),m=rt(d,t,n),y=ot(e),b=et(y),p={type:"image",rId:d,size:r,wrap:{type:"inline"}};return u.id&&(p.id=u.id),u.alt&&(p.alt=u.alt),u.title&&(p.title=u.title),u.decorative&&(p.decorative=true),m.src&&(p.src=m.src),m.mimeType&&(p.mimeType=m.mimeType),m.filename&&(p.filename=m.filename),a&&(p.padding=a),b&&(p.transform=b),p}function Tn(e,t,n){let o=X(e,"wp:extent"),r=Ke(o),i=X(e,"wp:effectExtent"),a=Je(i),f=X(e,"wp:docPr"),u=Qe(f),c=s(e,null,"behindDoc")==="1",d=pn(e,hn),m=wn(d,c),y=X(e,"wp:positionH"),b=X(e,"wp:positionV"),p=mn(y),T=gn(b),N;(p||T)&&(N={horizontal:p??{relativeTo:"column"},vertical:T??{relativeTo:"paragraph"}});let A=tt(e),R=nt(A),v=rt(R,t,n),h=ot(e),F=et(h),w={type:"image",rId:R,size:r,wrap:m};return u.id&&(w.id=u.id),u.alt&&(w.alt=u.alt),u.title&&(w.title=u.title),u.decorative&&(w.decorative=true),v.src&&(w.src=v.src),v.mimeType&&(w.mimeType=v.mimeType),v.filename&&(w.filename=v.filename),N&&(w.position=N),a&&(w.padding=a),F&&(w.transform=F),w}function Fn(e,t,n){let o=I(e);for(let r of o){let i=r.name||"";if(i==="wp:inline")return xn(r,t,n);if(i==="wp:anchor")return Tn(r,t,n)}return null}function it(e,t,n){return Fn(e,t,n)}function at(e,t,n,o){let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),r}function Cn(e){if(!e)return;let t={},n=s(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let o=s(e,"w","fill");o&&o!=="auto"&&(t.fill={rgb:o});let r=s(e,"w","themeFill");r&&(t.fill=t.fill||{},t.fill.themeColor=r);let i=s(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=s(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let f=s(e,"w","val");return f&&(t.pattern=f),Object.keys(t).length>0?t:void 0}function ke(e,t,n){if(!e)return;let o={},r=l(e,"w","b");r&&(o.bold=x(r));let i=l(e,"w","bCs");i&&(o.boldCs=x(i));let a=l(e,"w","i");a&&(o.italic=x(a));let f=l(e,"w","iCs");f&&(o.italicCs=x(f));let u=l(e,"w","u");if(u){let k=s(u,"w","val");if(k){o.underline={style:k};let D=s(u,"w","color"),j=s(u,"w","themeColor");(D||j)&&(o.underline.color=at(D,j,s(u,"w","themeTint"),s(u,"w","themeShade")));}}let c=l(e,"w","strike");c&&(o.strike=x(c));let d=l(e,"w","dstrike");d&&(o.doubleStrike=x(d));let m=l(e,"w","vertAlign");if(m){let k=s(m,"w","val");(k==="superscript"||k==="subscript"||k==="baseline")&&(o.vertAlign=k);}let y=l(e,"w","smallCaps");y&&(o.smallCaps=x(y));let b=l(e,"w","caps");b&&(o.allCaps=x(b));let p=l(e,"w","vanish");p&&(o.hidden=x(p));let T=l(e,"w","color");T&&(o.color=at(s(T,"w","val"),s(T,"w","themeColor"),s(T,"w","themeTint"),s(T,"w","themeShade")));let N=l(e,"w","highlight");if(N){let k=s(N,"w","val");k&&(o.highlight=k);}let A=l(e,"w","shd");A&&(o.shading=Cn(A));let R=l(e,"w","sz");if(R){let k=g(R,"w","val");k!==void 0&&(o.fontSize=k);}let v=l(e,"w","szCs");if(v){let k=g(v,"w","val");k!==void 0&&(o.fontSizeCs=k);}let h=l(e,"w","rFonts");if(h){o.fontFamily={ascii:s(h,"w","ascii")??void 0,hAnsi:s(h,"w","hAnsi")??void 0,eastAsia:s(h,"w","eastAsia")??void 0,cs:s(h,"w","cs")??void 0};let k=s(h,"w","asciiTheme");k&&(o.fontFamily.asciiTheme=k,t&&!o.fontFamily.ascii&&(o.fontFamily.ascii=W(t,k)));let D=s(h,"w","hAnsiTheme");D&&(o.fontFamily.hAnsiTheme=D,t&&!o.fontFamily.hAnsi&&(o.fontFamily.hAnsi=W(t,D)));let j=s(h,"w","eastAsiaTheme");j&&(o.fontFamily.eastAsiaTheme=j,t&&!o.fontFamily.eastAsia&&(o.fontFamily.eastAsia=W(t,j)));let he=s(h,"w","cstheme");he&&(o.fontFamily.csTheme=he,t&&!o.fontFamily.cs&&(o.fontFamily.cs=W(t,he)));}let F=l(e,"w","spacing");if(F){let k=g(F,"w","val");k!==void 0&&(o.spacing=k);}let w=l(e,"w","position");if(w){let k=g(w,"w","val");k!==void 0&&(o.position=k);}let C=l(e,"w","w");if(C){let k=g(C,"w","val");k!==void 0&&(o.scale=k);}let S=l(e,"w","kern");if(S){let k=g(S,"w","val");k!==void 0&&(o.kerning=k);}let E=l(e,"w","effect");if(E){let k=s(E,"w","val");k&&(o.effect=k);}let P=l(e,"w","em");if(P){let k=s(P,"w","val");k&&(o.emphasisMark=k);}let L=l(e,"w","emboss");L&&(o.emboss=x(L));let O=l(e,"w","imprint");O&&(o.imprint=x(O));let Y=l(e,"w","outline");Y&&(o.outline=x(Y));let K=l(e,"w","shadow");K&&(o.shadow=x(K));let J=l(e,"w","rtl");J&&(o.rtl=x(J));let Q=l(e,"w","cs");Q&&(o.cs=x(Q));let M=l(e,"w","rStyle");if(M){let k=s(M,"w","val");k&&(o.styleId=k);}return Object.keys(o).length>0?o:void 0}function Sn(e){let t=re(e),n=s(e,"xml","space")==="preserve";return {type:"text",text:t,preserveSpace:n||void 0}}function kn(){return {type:"tab"}}function Mn(e){let t=s(e,"w","type"),n=s(e,"w","clear"),o={type:"break"};return (t==="page"||t==="column"||t==="textWrapping")&&(o.breakType=t),(n==="none"||n==="left"||n==="right"||n==="all")&&(o.clear=n),o}function vn(e){let t=s(e,"w","font")??"",n=s(e,"w","char")??"";return {type:"symbol",font:t,char:n}}function Rn(e){return {type:"footnoteRef",id:g(e,"w","id")??0}}function En(e){return {type:"endnoteRef",id:g(e,"w","id")??0}}function Pn(e){let t=s(e,"w","fldCharType"),n=s(e,"w","fldLock")==="true"||s(e,"w","fldLock")==="1",o=s(e,"w","dirty")==="true"||s(e,"w","dirty")==="1",r="begin";return t==="separate"?r="separate":t==="end"&&(r="end"),{type:"fieldChar",charType:r,fldLock:n||void 0,dirty:o||void 0}}function An(e){return {type:"instrText",text:re(e)}}function Bn(e,t,n){let o=it(e,t??void 0,n??void 0);return o?{type:"drawing",image:o}:null}function Nn(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function Xn(e,t,n){let o=[],r=I(e);for(let i of r)switch(Nn(i.name)){case "t":o.push(Sn(i));break;case "tab":o.push(kn());break;case "br":o.push(Mn(i));break;case "sym":o.push(vn(i));break;case "footnoteReference":o.push(Rn(i));break;case "endnoteReference":o.push(En(i));break;case "fldChar":o.push(Pn(i));break;case "instrText":o.push(An(i));break;case "softHyphen":o.push({type:"softHyphen"});break;case "noBreakHyphen":o.push({type:"noBreakHyphen"});break;case "drawing":let f=Bn(i,t,n);f&&o.push(f);break;case "pict":case "object":break;case "rPr":break;case "lastRenderedPageBreak":break;case "cr":o.push({type:"break",breakType:"textWrapping"});break;}return o}function ee(e,t,n,o=null,r=null){let i={type:"run",content:[]},a=l(e,"w","rPr");return a&&(i.formatting=ke(a,n)),i.content=Xn(e,o,r),i}function Ln(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function In(e){let t=g(e,"w","id")??0,n=s(e,"w","name")??"",o={type:"bookmarkStart",id:t,name:n},r=g(e,"w","colFirst");r!==void 0&&(o.colFirst=r);let i=g(e,"w","colLast");return i!==void 0&&(o.colLast=i),o}function Dn(e){return {type:"bookmarkEnd",id:g(e,"w","id")??0}}function st(e,t,n=null,o=null,r=null){let i={type:"hyperlink",children:[]},a=s(e,"r","id");if(a&&(i.rId=a,t)){let b=t.get(a);b&&(Ie(b),i.href=b.target);}let f=s(e,"w","anchor");f&&(i.anchor=f,i.href||(i.href=`#${f}`));let u=s(e,"w","tooltip");u&&(i.tooltip=u);let c=s(e,"w","tgtFrame");c&&(i.target=c);let d=s(e,"w","history");(d==="1"||d==="true")&&(i.history=true);let m=s(e,"w","docLocation");m&&(i.docLocation=m);let y=I(e);for(let b of y)switch(Ln(b.name)){case "r":i.children.push(ee(b,n,o,t,r));break;case "bookmarkStart":i.children.push(In(b));break;case "bookmarkEnd":i.children.push(Dn(b));break}return i}function lt(e){let t=g(e,"w","id")??0,n=s(e,"w","name")??"",o={type:"bookmarkStart",id:t,name:n},r=g(e,"w","colFirst");r!==void 0&&(o.colFirst=r);let i=g(e,"w","colLast");return i!==void 0&&(o.colLast=i),o}function ft(e){return {type:"bookmarkEnd",id:g(e,"w","id")??0}}function Hn(e){if(!e)return;let t=g(e,"w","w")??0,n=s(e,"w","type")??"dxa",o="dxa";return (n==="auto"||n==="dxa"||n==="nil"||n==="pct")&&(o=n),{value:t,type:o}}function _(e){return Hn(e)}function q(e){if(!e)return;let o={style:s(e,"w","val")??"none"},r=g(e,"w","sz");r!==void 0&&(o.size=r);let i=g(e,"w","space");i!==void 0&&(o.space=i);let a=Le(e);a&&(o.color={rgb:a.val,themeColor:a.themeColor,themeTint:a.themeTint,themeShade:a.themeShade});let f=s(e,"w","shadow");(f==="1"||f==="true")&&(o.shadow=true);let u=s(e,"w","frame");return (u==="1"||u==="true")&&(o.frame=true),o}function ut(e){if(!e)return;let t={},n=q(l(e,"w","top"));n&&(t.top=n);let o=q(l(e,"w","bottom"));o&&(t.bottom=o);let r=q(l(e,"w","left")??l(e,"w","start"));r&&(t.left=r);let i=q(l(e,"w","right")??l(e,"w","end"));i&&(t.right=i);let a=q(l(e,"w","insideH"));a&&(t.insideH=a);let f=q(l(e,"w","insideV"));if(f&&(t.insideV=f),Object.keys(t).length!==0)return t}function ct(e){if(!e)return;let t={},n=_(l(e,"w","top"));n&&(t.top=n);let o=_(l(e,"w","bottom"));o&&(t.bottom=o);let r=_(l(e,"w","left")??l(e,"w","start"));r&&(t.left=r);let i=_(l(e,"w","right")??l(e,"w","end"));if(i&&(t.right=i),Object.keys(t).length!==0)return t}function dt(e){if(!e)return;let t={},n=s(e,"w","fill");n&&n!=="auto"&&(t.fill={rgb:n});let o=s(e,"w","themeFill");if(o){t.fill={themeColor:o};let a=s(e,"w","themeFillTint");a&&t.fill&&(t.fill.themeTint=a);let f=s(e,"w","themeFillShade");f&&t.fill&&(t.fill.themeShade=f);}let r=s(e,"w","color");r&&r!=="auto"&&(t.color={rgb:r});let i=s(e,"w","val");if(i&&(t.pattern=i),Object.keys(t).length!==0)return t}function On(e){if(!e)return;let t={},n=s(e,"w","firstRow");(n==="1"||n==="true")&&(t.firstRow=true);let o=s(e,"w","lastRow");(o==="1"||o==="true")&&(t.lastRow=true);let r=s(e,"w","firstColumn");(r==="1"||r==="true")&&(t.firstColumn=true);let i=s(e,"w","lastColumn");(i==="1"||i==="true")&&(t.lastColumn=true);let a=s(e,"w","noHBand");(a==="1"||a==="true")&&(t.noHBand=true);let f=s(e,"w","noVBand");(f==="1"||f==="true")&&(t.noVBand=true);let u=s(e,"w","val");if(u){let c=parseInt(u,16);isNaN(c)||(c&32&&(t.firstRow=true),c&64&&(t.lastRow=true),c&128&&(t.firstColumn=true),c&256&&(t.lastColumn=true),c&512&&(t.noHBand=true),c&1024&&(t.noVBand=true));}if(Object.keys(t).length!==0)return t}function jn(e){if(!e)return;let t={},n=s(e,"w","horzAnchor");(n==="margin"||n==="page"||n==="text")&&(t.horzAnchor=n);let o=s(e,"w","vertAnchor");(o==="margin"||o==="page"||o==="text")&&(t.vertAnchor=o);let r=g(e,"w","tblpX");r!==void 0&&(t.tblpX=r);let i=s(e,"w","tblpXSpec");i&&(t.tblpXSpec=i);let a=g(e,"w","tblpY");a!==void 0&&(t.tblpY=a);let f=s(e,"w","tblpYSpec");f&&(t.tblpYSpec=f);let u=g(e,"w","topFromText");u!==void 0&&(t.topFromText=u);let c=g(e,"w","bottomFromText");c!==void 0&&(t.bottomFromText=c);let d=g(e,"w","leftFromText");d!==void 0&&(t.leftFromText=d);let m=g(e,"w","rightFromText");if(m!==void 0&&(t.rightFromText=m),Object.keys(t).length!==0)return t}function Wn(e){if(!e)return;let t={},n=_(l(e,"w","tblW"));n&&(t.width=n);let o=l(e,"w","jc");if(o){let T=s(o,"w","val");(T==="left"||T==="center"||T==="right"||T==="start")&&(t.justification=T==="start"?"left":T);}let r=_(l(e,"w","tblCellSpacing"));r&&(t.cellSpacing=r);let i=_(l(e,"w","tblInd"));i&&(t.indent=i);let a=ut(l(e,"w","tblBorders"));a&&(t.borders=a);let f=ct(l(e,"w","tblCellMar"));f&&(t.cellMargins=f);let u=l(e,"w","tblLayout");if(u){let T=s(u,"w","type");(T==="fixed"||T==="autofit")&&(t.layout=T);}let c=l(e,"w","tblStyle");if(c){let T=s(c,"w","val");T&&(t.styleId=T);}let d=On(l(e,"w","tblLook"));d&&(t.look=d);let m=dt(l(e,"w","shd"));m&&(t.shading=m);let y=l(e,"w","tblOverlap");if(y){let T=s(y,"w","val");(T==="never"||T==="overlap")&&(t.overlap=T);}let b=jn(l(e,"w","tblpPr"));if(b&&(t.floating=b),x(l(e,"w","bidiVisual"))&&(t.bidi=true),Object.keys(t).length!==0)return t}function Vn(e){if(!e)return;let t={},n=l(e,"w","trHeight");if(n){let f=_(n);f&&(t.height=f);let u=s(n,"w","hRule");(u==="auto"||u==="atLeast"||u==="exact")&&(t.heightRule=u);}x(l(e,"w","tblHeader"))&&(t.header=true),x(l(e,"w","cantSplit"))&&(t.cantSplit=true);let i=l(e,"w","jc");if(i){let f=s(i,"w","val");(f==="left"||f==="center"||f==="right")&&(t.justification=f);}if(x(l(e,"w","hidden"))&&(t.hidden=true),Object.keys(t).length!==0)return t}function zn(e){if(!e)return;let t={},n=s(e,"w","firstRow");(n==="1"||n==="true")&&(t.firstRow=true);let o=s(e,"w","lastRow");(o==="1"||o==="true")&&(t.lastRow=true);let r=s(e,"w","firstColumn");(r==="1"||r==="true")&&(t.firstColumn=true);let i=s(e,"w","lastColumn");(i==="1"||i==="true")&&(t.lastColumn=true);let a=s(e,"w","oddHBand");(a==="1"||a==="true")&&(t.oddHBand=true);let f=s(e,"w","evenHBand");(f==="1"||f==="true")&&(t.evenHBand=true);let u=s(e,"w","oddVBand");(u==="1"||u==="true")&&(t.oddVBand=true);let c=s(e,"w","evenVBand");(c==="1"||c==="true")&&(t.evenVBand=true);let d=s(e,"w","firstRowFirstColumn");(d==="1"||d==="true")&&(t.nwCell=true);let m=s(e,"w","firstRowLastColumn");(m==="1"||m==="true")&&(t.neCell=true);let y=s(e,"w","lastRowFirstColumn");(y==="1"||y==="true")&&(t.swCell=true);let b=s(e,"w","lastRowLastColumn");(b==="1"||b==="true")&&(t.seCell=true);let p=s(e,"w","val");if(p&&p.length===12&&(p[0]==="1"&&(t.firstRow=true),p[1]==="1"&&(t.lastRow=true),p[2]==="1"&&(t.firstColumn=true),p[3]==="1"&&(t.lastColumn=true),p[4]==="1"&&(t.oddVBand=true),p[5]==="1"&&(t.evenVBand=true),p[6]==="1"&&(t.oddHBand=true),p[7]==="1"&&(t.evenHBand=true),p[8]==="1"&&(t.nwCell=true),p[9]==="1"&&(t.neCell=true),p[10]==="1"&&(t.swCell=true),p[11]==="1"&&(t.seCell=true)),Object.keys(t).length!==0)return t}function Un(e){if(!e)return;let t={},n=_(l(e,"w","tcW"));n&&(t.width=n);let o=ut(l(e,"w","tcBorders"));o&&(t.borders=o);let r=ct(l(e,"w","tcMar"));r&&(t.margins=r);let i=dt(l(e,"w","shd"));i&&(t.shading=i);let a=l(e,"w","vAlign");if(a){let p=s(a,"w","val");(p==="top"||p==="center"||p==="bottom")&&(t.verticalAlign=p);}let f=l(e,"w","textDirection");if(f){let p=s(f,"w","val");p&&(t.textDirection=p);}let u=l(e,"w","gridSpan");if(u){let p=g(u,"w","val");p!==void 0&&p>1&&(t.gridSpan=p);}let c=l(e,"w","vMerge");c&&(s(c,"w","val")==="restart"?t.vMerge="restart":t.vMerge="continue"),x(l(e,"w","tcFitText"))&&(t.fitText=true),x(l(e,"w","noWrap"))&&(t.noWrap=true),x(l(e,"w","hideMark"))&&(t.hideMark=true);let b=zn(l(e,"w","cnfStyle"));if(b&&(t.conditionalFormat=b),Object.keys(t).length!==0)return t}function $n(e,t,n,o,r,i){let a=[],f=e.elements||[];for(let u of f){if(!u.name)continue;let c=u.name.split(":").pop();if(c==="p"){let d=G(u,t,n,o,r,i);a.push(d);}else if(c==="tbl"){let d=te(u,t,n,o,r,i);a.push(d);}}return a.length===0&&a.push({type:"paragraph",content:[]}),a}function _n(e,t,n,o,r,i){let a={type:"tableCell",content:[]},f=Un(l(e,"w","tcPr"));return f&&(a.formatting=f),a.content=$n(e,t,n,o,r,i),a}function Gn(e,t,n,o,r,i){let a={type:"tableRow",cells:[]},f=Vn(l(e,"w","trPr"));f&&(a.formatting=f);let u=B(e,"w","tc");for(let c of u){let d=_n(c,t,n,o,r,i);a.cells.push(d);}return a}function qn(e){if(!e)return;let t=[],n=B(e,"w","gridCol");for(let o of n){let r=g(o,"w","w")??0;t.push(r);}return t.length>0?t:void 0}function te(e,t,n,o,r,i){let a={type:"table",rows:[]},f=Wn(l(e,"w","tblPr"));f&&(a.formatting=f);let u=qn(l(e,"w","tblGrid"));u&&(a.columnWidths=u);let c=B(e,"w","tr");for(let d of c){let m=Gn(d,t,n,o,r,i);a.rows.push(m);}return a}function pt(e){switch(e){case "first":return "first";case "even":return "even";default:return "default"}}function mt(e){let t=s(e,"w","type"),n=s(e,"r","id")??"";return {type:pt(t),rId:n}}function gt(e){let t=s(e,"w","type"),n=s(e,"r","id")??"";return {type:pt(t),rId:n}}function Me(e,t,n,o,r,i){let a=[],f=e.elements??[];for(let u of f){if(u.type!=="element")continue;let c=u.name??"";if(c==="w:p"||c.endsWith(":p")){let d=G(u,t,n,o,r,i);a.push(d);}else if(c==="w:tbl"||c.endsWith(":tbl")){let d=te(u,t,n,o,r,i);a.push(d);}else if(c==="w:sdt"||c.endsWith(":sdt")){let d=(u.elements??[]).find(m=>m.type==="element"&&(m.name==="w:sdtContent"||m.name?.endsWith(":sdtContent")));if(d){let m=Me(d,t,n,o,r,i);a.push(...m);}}}return a}function ht(e,t="default",n=null,o=null,r=null,i=null,a=null){let f={type:"header",hdrFtrType:t,content:[]};if(!e)return f;let u=z(e);if(!u)return f;let c=u.elements?.find(d=>d.type==="element"&&(d.name==="w:hdr"||d.name?.endsWith(":hdr")));return c&&(f.content=Me(c,n,o,r,i,a)),f}function wt(e,t="default",n=null,o=null,r=null,i=null,a=null){let f={type:"footer",hdrFtrType:t,content:[]};if(!e)return f;let u=z(e);if(!u)return f;let c=u.elements?.find(d=>d.type==="element"&&(d.name==="w:ftr"||d.name?.endsWith(":ftr")));return c&&(f.content=Me(c,n,o,r,i,a)),f}function bt(e){switch(e){case "separator":return "separator";case "continuationSeparator":return "continuationSeparator";case "continuationNotice":return "continuationNotice";default:return "normal"}}function Zn(e,t,n,o,r,i){let a=g(e,"w","id")??0,f=s(e,"w","type"),u=bt(f),d=B(e,"w","p").map(m=>G(m,t,n,o,r));return {type:"footnote",id:a,noteType:u,content:d}}function yt(e,t=null,n=null,o=null,r=null,i=null){let a=new Map,f=[];if(!e)return ue(a,f);let u=z(e);if(!u)return ue(a,f);let c=u.elements?.find(m=>m.type==="element"&&(m.name==="w:footnotes"||m.name?.endsWith(":footnotes")));if(!c)return ue(a,f);let d=B(c,"w","footnote");for(let m of d){let y=Zn(m,t,n,o,r);a.set(y.id,y),f.push(y);}return ue(a,f)}function ue(e,t){return {byId:e,footnotes:t,getFootnote(n){return e.get(n)},hasFootnote(n){return e.has(n)},getNormalFootnotes(){return t.filter(n=>n.noteType==="normal")},getSeparator(){return t.find(n=>n.noteType==="separator")},getContinuationSeparator(){return t.find(n=>n.noteType==="continuationSeparator")}}}function Yn(e,t,n,o,r,i){let a=g(e,"w","id")??0,f=s(e,"w","type"),u=bt(f),d=B(e,"w","p").map(m=>G(m,t,n,o,r));return {type:"endnote",id:a,noteType:u,content:d}}function xt(e,t=null,n=null,o=null,r=null,i=null){let a=new Map,f=[];if(!e)return ce(a,f);let u=z(e);if(!u)return ce(a,f);let c=u.elements?.find(m=>m.type==="element"&&(m.name==="w:endnotes"||m.name?.endsWith(":endnotes")));if(!c)return ce(a,f);let d=B(c,"w","endnote");for(let m of d){let y=Yn(m,t,n,o,r);a.set(y.id,y),f.push(y);}return ce(a,f)}function ce(e,t){return {byId:e,endnotes:t,getEndnote(n){return e.get(n)},hasEndnote(n){return e.has(n)},getNormalEndnotes(){return t.filter(n=>n.noteType==="normal")},getSeparator(){return t.find(n=>n.noteType==="separator")},getContinuationSeparator(){return t.find(n=>n.noteType==="continuationSeparator")}}}function Tt(e){return e?{decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",bullet:"bullet",chicago:"chicago",none:"none"}[e]:void 0}function Kn(e){switch(e){case "pageBottom":return "pageBottom";case "beneathText":return "beneathText";case "sectEnd":return "sectEnd";case "docEnd":return "docEnd";default:return}}function Jn(e){switch(e){case "sectEnd":return "sectEnd";case "docEnd":return "docEnd";default:return}}function Ft(e){switch(e){case "continuous":return "continuous";case "eachSect":return "eachSect";case "eachPage":return "eachPage";default:return}}function Ct(e){let t={};if(!e)return t;let n=l(e,"w","pos");if(n){let a=s(n,"w","val");t.position=Kn(a);}let o=l(e,"w","numFmt");if(o){let a=s(o,"w","val");t.numFmt=Tt(a);}let r=l(e,"w","numStart");r&&(t.numStart=g(r,"w","val")??void 0);let i=l(e,"w","numRestart");if(i){let a=s(i,"w","val");t.numRestart=Ft(a);}return t}function St(e){let t={};if(!e)return t;let n=l(e,"w","pos");if(n){let a=s(n,"w","val");t.position=Jn(a);}let o=l(e,"w","numFmt");if(o){let a=s(o,"w","val");t.numFmt=Tt(a);}let r=l(e,"w","numStart");r&&(t.numStart=g(r,"w","val")??void 0);let i=l(e,"w","numRestart");if(i){let a=s(i,"w","val");t.numRestart=Ft(a);}return t}function Qn(e,t,n,o){if(!e&&!t)return;let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),Object.keys(r).length>0?r:void 0}function de(e){if(!e)return;let o={style:s(e,"w","val")??"none"},r=g(e,"w","sz");r!==void 0&&(o.size=r);let i=g(e,"w","space");i!==void 0&&(o.space=i);let a=s(e,"w","color"),f=s(e,"w","themeColor"),u=s(e,"w","themeTint"),c=s(e,"w","themeShade"),d=Qn(a,f,u,c);d&&(o.color=d);let m=s(e,"w","shadow");(m==="1"||m==="true")&&(o.shadow=true);let y=s(e,"w","frame");return (y==="1"||y==="true")&&(o.frame=true),o}function eo(e){switch(e){case "landscape":return "landscape";case "portrait":return "portrait";default:return}}function to(e){switch(e){case "continuous":return "continuous";case "nextPage":return "nextPage";case "oddPage":return "oddPage";case "evenPage":return "evenPage";case "nextColumn":return "nextColumn";default:return}}function no(e){switch(e){case "top":return "top";case "center":return "center";case "both":return "both";case "bottom":return "bottom";default:return}}function oo(e){switch(e){case "continuous":return "continuous";case "newPage":return "newPage";case "newSection":return "newSection";default:return}}function pe(e,t){let n={};if(!e)return n;let o=l(e,"w","pgSz");if(o){let h=g(o,"w","w");h!==void 0&&(n.pageWidth=h);let F=g(o,"w","h");F!==void 0&&(n.pageHeight=F);let w=s(o,"w","orient"),C=eo(w);C&&(n.orientation=C);}let r=l(e,"w","pgMar");if(r){let h=g(r,"w","top");h!==void 0&&(n.marginTop=h);let F=g(r,"w","bottom");F!==void 0&&(n.marginBottom=F);let w=g(r,"w","left");w!==void 0&&(n.marginLeft=w);let C=g(r,"w","right");C!==void 0&&(n.marginRight=C);let S=g(r,"w","header");S!==void 0&&(n.headerDistance=S);let E=g(r,"w","footer");E!==void 0&&(n.footerDistance=E);let P=g(r,"w","gutter");P!==void 0&&(n.gutter=P);}let i=l(e,"w","cols");if(i){let h=g(i,"w","num");h!==void 0&&(n.columnCount=h);let F=g(i,"w","space");F!==void 0&&(n.columnSpace=F);let w=s(i,"w","equalWidth");w==="1"||w==="true"?n.equalWidth=true:(w==="0"||w==="false")&&(n.equalWidth=false);let C=s(i,"w","sep");(C==="1"||C==="true")&&(n.separator=true);let S=B(i,"w","col");if(S.length>0){n.columns=[];for(let E of S){let P={},L=g(E,"w","w");L!==void 0&&(P.width=L);let O=g(E,"w","space");O!==void 0&&(P.space=O),n.columns.push(P);}}}let a=l(e,"w","type");if(a){let h=s(a,"w","val"),F=to(h);F&&(n.sectionStart=F);}let f=l(e,"w","vAlign");if(f){let h=s(f,"w","val"),F=no(h);F&&(n.verticalAlign=F);}let u=l(e,"w","bidi");u&&(n.bidi=x(u));let c=B(e,"w","headerReference");c.length>0&&(n.headerReferences=c.map(h=>mt(h)));let d=B(e,"w","footerReference");d.length>0&&(n.footerReferences=d.map(h=>gt(h)));let m=l(e,"w","titlePg");m&&(n.titlePg=x(m));let y=l(e,"w","evenAndOddHeaders");y&&(n.evenAndOddHeaders=x(y));let b=l(e,"w","lnNumType");if(b){n.lineNumbers={};let h=g(b,"w","start");h!==void 0&&(n.lineNumbers.start=h);let F=g(b,"w","countBy");F!==void 0&&(n.lineNumbers.countBy=F);let w=g(b,"w","distance");w!==void 0&&(n.lineNumbers.distance=w);let C=s(b,"w","restart"),S=oo(C);S&&(n.lineNumbers.restart=S);}let p=l(e,"w","pgBorders");if(p){n.pageBorders={};let h=de(l(p,"w","top"));h&&(n.pageBorders.top=h);let F=de(l(p,"w","bottom"));F&&(n.pageBorders.bottom=F);let w=de(l(p,"w","left"));w&&(n.pageBorders.left=w);let C=de(l(p,"w","right"));C&&(n.pageBorders.right=C);let S=s(p,"w","display");(S==="allPages"||S==="firstPage"||S==="notFirstPage")&&(n.pageBorders.display=S);let E=s(p,"w","offsetFrom");(E==="page"||E==="text")&&(n.pageBorders.offsetFrom=E);let P=s(p,"w","zOrder");(P==="front"||P==="back")&&(n.pageBorders.zOrder=P);}let T=l(e,"w","background");if(T){n.background={};let h=s(T,"w","color");h&&h!=="auto"&&(n.background.color={rgb:h});let F=s(T,"w","themeColor");F&&(n.background.themeColor=F);let w=s(T,"w","themeTint");w&&(n.background.themeTint=w);let C=s(T,"w","themeShade");C&&(n.background.themeShade=C);}let N=l(e,"w","footnotePr");if(N){let h=Ct(N);Object.keys(h).length>0&&(n.footnotePr=h);}let A=l(e,"w","endnotePr");if(A){let h=St(A);Object.keys(h).length>0&&(n.endnotePr=h);}let R=l(e,"w","docGrid");if(R){n.docGrid={};let h=s(R,"w","type");(h==="default"||h==="lines"||h==="linesAndChars"||h==="snapToChars")&&(n.docGrid.type=h);let F=g(R,"w","linePitch");F!==void 0&&(n.docGrid.linePitch=F);let w=g(R,"w","charSpace");w!==void 0&&(n.docGrid.charSpace=w);}let v=l(e,"w","paperSrc");if(v){let h=g(v,"w","first");h!==void 0&&(n.paperSrcFirst=h);let F=g(v,"w","other");F!==void 0&&(n.paperSrcOther=F);}return n}function kt(){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 ro(e,t){return !e&&!t?true:!(!e||!t||e.bold!==t.bold||e.boldCs!==t.boldCs||e.italic!==t.italic||e.italicCs!==t.italicCs||e.strike!==t.strike||e.doubleStrike!==t.doubleStrike||e.smallCaps!==t.smallCaps||e.allCaps!==t.allCaps||e.hidden!==t.hidden||e.emboss!==t.emboss||e.imprint!==t.imprint||e.outline!==t.outline||e.shadow!==t.shadow||e.rtl!==t.rtl||e.cs!==t.cs||e.fontSize!==t.fontSize||e.fontSizeCs!==t.fontSizeCs||e.spacing!==t.spacing||e.position!==t.position||e.scale!==t.scale||e.kerning!==t.kerning||e.vertAlign!==t.vertAlign||e.highlight!==t.highlight||e.effect!==t.effect||e.emphasisMark!==t.emphasisMark||e.styleId!==t.styleId||!io(e.underline,t.underline)||!me(e.color,t.color)||!ao(e.shading,t.shading)||!so(e.fontFamily,t.fontFamily))}function io(e,t){return !e&&!t?true:!e||!t||e.style!==t.style?false:me(e.color,t.color)}function me(e,t){return !e&&!t?true:!e||!t?false:e.rgb===t.rgb&&e.auto===t.auto&&e.themeColor===t.themeColor&&e.themeTint===t.themeTint&&e.themeShade===t.themeShade}function ao(e,t){return !e&&!t?true:!(!e||!t||e.pattern!==t.pattern||!me(e.color,t.color)||!me(e.fill,t.fill))}function so(e,t){return !e&&!t?true:!e||!t?false:e.ascii===t.ascii&&e.hAnsi===t.hAnsi&&e.eastAsia===t.eastAsia&&e.cs===t.cs&&e.asciiTheme===t.asciiTheme&&e.hAnsiTheme===t.hAnsiTheme&&e.eastAsiaTheme===t.eastAsiaTheme&&e.csTheme===t.csTheme}function lo(e){return e.type==="text"||e.type==="softHyphen"||e.type==="noBreakHyphen"}function Mt(e){return e.content.length===0?true:e.content.every(lo)}function fo(e,t){let n=[];for(let o of e)n.push(o);if(n.length>0&&t.length>0&&n[n.length-1].type==="text"&&t[0].type==="text"){let o=n[n.length-1],r=t[0];n[n.length-1]={type:"text",text:o.text+r.text,preserveSpace:o.preserveSpace||r.preserveSpace||void 0};for(let i=1;i<t.length;i++)n.push(t[i]);}else for(let o of t)n.push(o);return n}function uo(e){if(e.length<=1)return e;let t=[],n=null;for(let o of e)if(o.content.length!==0){if(n===null){n={...o,content:[...o.content]};continue}Mt(n)&&Mt(o)&&ro(n.formatting,o.formatting)?n={type:"run",formatting:n.formatting,content:fo(n.content,o.content)}:(t.push(n),n={...o,content:[...o.content]});}return n!==null&&t.push(n),t}function ve(e){if(e.length<=1)return e;let t=[],n=[];function o(){if(n.length>0){let r=uo(n);t.push(...r),n.length=0;}}for(let r of e)if(r.type==="run")n.push(r);else if(o(),r.type==="hyperlink"){let i={...r,children:ve(r.children)};t.push(i);}else t.push(r);return o(),t}function co(e,t,n,o){let r={};return e&&e!=="auto"?r.rgb=e:e==="auto"&&(r.auto=true),t&&(r.themeColor=t),n&&(r.themeTint=n),o&&(r.themeShade=o),r}function po(e){if(!e)return;let t={},n=s(e,"w","color");n&&n!=="auto"&&(t.color={rgb:n});let o=s(e,"w","fill");o&&o!=="auto"&&(t.fill={rgb:o});let r=s(e,"w","themeFill");r&&(t.fill=t.fill||{},t.fill.themeColor=r);let i=s(e,"w","themeFillTint");i&&t.fill&&(t.fill.themeTint=i);let a=s(e,"w","themeFillShade");a&&t.fill&&(t.fill.themeShade=a);let f=s(e,"w","val");return f&&(t.pattern=f),Object.keys(t).length>0?t:void 0}function Z(e){if(!e)return;let t=s(e,"w","val");if(!t)return;let n={style:t},o=s(e,"w","color"),r=s(e,"w","themeColor");(o||r)&&(n.color=co(o,r,s(e,"w","themeTint"),s(e,"w","themeShade")));let i=g(e,"w","sz");i!==void 0&&(n.size=i);let a=g(e,"w","space");a!==void 0&&(n.space=a);let f=s(e,"w","shadow");f&&(n.shadow=f==="1"||f==="true");let u=s(e,"w","frame");return u&&(n.frame=u==="1"||u==="true"),n}function mo(e){if(!e)return;let t=B(e,"w","tab");if(t.length===0)return;let n=[];for(let o of t){let r=g(o,"w","pos"),i=s(o,"w","val");if(r!==void 0&&i){let a={position:r,alignment:i},f=s(o,"w","leader");f&&(a.leader=f),n.push(a);}}return n.length>0?n:void 0}function go(e){if(!e)return;let t={},n=g(e,"w","w");n!==void 0&&(t.width=n);let o=g(e,"w","h");o!==void 0&&(t.height=o);let r=s(e,"w","hAnchor");(r==="text"||r==="margin"||r==="page")&&(t.hAnchor=r);let i=s(e,"w","vAnchor");(i==="text"||i==="margin"||i==="page")&&(t.vAnchor=i);let a=g(e,"w","x");a!==void 0&&(t.x=a);let f=g(e,"w","y");f!==void 0&&(t.y=f);let u=s(e,"w","xAlign");u&&(t.xAlign=u);let c=s(e,"w","yAlign");c&&(t.yAlign=c);let d=s(e,"w","wrap");return d&&(t.wrap=d),Object.keys(t).length>0?t:void 0}function ho(e,t,n){if(!e)return;let o={},r=l(e,"w","jc");if(r){let w=s(r,"w","val");w&&(o.alignment=w);}let i=l(e,"w","bidi");i&&(o.bidi=x(i));let a=l(e,"w","spacing");if(a){let w=g(a,"w","before");w!==void 0&&(o.spaceBefore=w);let C=g(a,"w","after");C!==void 0&&(o.spaceAfter=C);let S=g(a,"w","line");S!==void 0&&(o.lineSpacing=S);let E=s(a,"w","lineRule");E&&(o.lineSpacingRule=E);let P=s(a,"w","beforeAutospacing");P&&(o.beforeAutospacing=P==="1"||P==="true");let L=s(a,"w","afterAutospacing");L&&(o.afterAutospacing=L==="1"||L==="true");}let f=l(e,"w","ind");if(f){let w=g(f,"w","left");w!==void 0&&(o.indentLeft=w);let C=g(f,"w","right");C!==void 0&&(o.indentRight=C);let S=g(f,"w","firstLine");S!==void 0&&(o.indentFirstLine=S);let E=g(f,"w","hanging");E!==void 0&&(o.indentFirstLine=-E,o.hangingIndent=true);let P=g(f,"w","start");P!==void 0&&o.indentLeft===void 0&&(o.indentLeft=P);let L=g(f,"w","end");L!==void 0&&o.indentRight===void 0&&(o.indentRight=L);}let u=l(e,"w","pBdr");if(u){let w={},C=Z(l(u,"w","top"));C&&(w.top=C);let S=Z(l(u,"w","bottom"));S&&(w.bottom=S);let E=Z(l(u,"w","left"));E&&(w.left=E);let P=Z(l(u,"w","right"));P&&(w.right=P);let L=Z(l(u,"w","between"));L&&(w.between=L);let O=Z(l(u,"w","bar"));O&&(w.bar=O),Object.keys(w).length>0&&(o.borders=w);}let c=l(e,"w","shd");c&&(o.shading=po(c));let d=l(e,"w","tabs");d&&(o.tabs=mo(d));let m=l(e,"w","keepNext");m&&(o.keepNext=x(m));let y=l(e,"w","keepLines");y&&(o.keepLines=x(y));let b=l(e,"w","widowControl");b&&(o.widowControl=x(b));let p=l(e,"w","pageBreakBefore");p&&(o.pageBreakBefore=x(p));let T=l(e,"w","numPr");if(T){let w=l(T,"w","numId"),C=l(T,"w","ilvl");if(w||C){if(o.numPr={},w){let S=g(w,"w","val");S!==void 0&&(o.numPr.numId=S);}if(C){let S=g(C,"w","val");S!==void 0&&(o.numPr.ilvl=S);}}}let N=l(e,"w","outlineLvl");if(N){let w=g(N,"w","val");w!==void 0&&(o.outlineLevel=w);}let A=l(e,"w","pStyle");if(A){let w=s(A,"w","val");w&&(o.styleId=w);}let R=l(e,"w","framePr");R&&(o.frame=go(R));let v=l(e,"w","suppressLineNumbers");v&&(o.suppressLineNumbers=x(v));let h=l(e,"w","suppressAutoHyphens");h&&(o.suppressAutoHyphens=x(h));let F=l(e,"w","rPr");return F&&(o.runProperties=ke(F,t)),Object.keys(o).length>0?o:void 0}function vt(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function wo(e,t,n,o,r){return st(e,t,n,o,r)}function bo(e){return lt(e)}function yo(e){return ft(e)}function Rt(e){let t=e.trim().match(/^\\?([A-Z]+)/i);if(!t)return "UNKNOWN";let n=t[1].toUpperCase();return ["PAGE","NUMPAGES","NUMWORDS","NUMCHARS","DATE","TIME","CREATEDATE","SAVEDATE","PRINTDATE","AUTHOR","TITLE","SUBJECT","KEYWORDS","COMMENTS","FILENAME","FILESIZE","TEMPLATE","DOCPROPERTY","DOCVARIABLE","REF","PAGEREF","NOTEREF","HYPERLINK","TOC","TOA","INDEX","SEQ","STYLEREF","AUTONUM","AUTONUMLGL","AUTONUMOUT","IF","MERGEFIELD","NEXT","NEXTIF","ASK","SET","QUOTE","INCLUDETEXT","INCLUDEPICTURE","SYMBOL","ADVANCE","EDITTIME","REVNUM","SECTION","SECTIONPAGES","USERADDRESS","USERNAME","USERINITIALS"].includes(n)?n:"UNKNOWN"}function xo(e,t,n,o,r){let i=s(e,"w","instr")??"",a=Rt(i),f={type:"simpleField",instruction:i,fieldType:a,content:[]},u=s(e,"w","fldLock");(u==="1"||u==="true")&&(f.fldLock=true);let c=s(e,"w","dirty");(c==="1"||c==="true")&&(f.dirty=true);let d=I(e);for(let m of d)vt(m.name)==="r"&&f.content.push(ee(m,t,n,o,r));return f}function Et(e,t,n,o,r,i){let a=[],f=I(e),u=false,c="",d=[],m=[],y=false,b=false,p=false;for(let T of f)switch(vt(T.name)){case "r":{let A=ee(T,t,n,r,i),R=false,v=false,h=false,F="";for(let w of A.content)w.type==="fieldChar"?w.charType==="begin"?(R=true,w.fldLock&&(b=true),w.dirty&&(p=true)):w.charType==="separate"?v=true:w.charType==="end"&&(h=true):w.type==="instrText"&&(F+=w.text);if(R&&(u=true,y=false,c="",d=[],m=[],b=false,p=false),u){if(F&&(c+=F),v&&(y=true),y&&!h?v||m.push(A):!y&&!R&&d.push(A),h){let w={type:"complexField",instruction:c.trim(),fieldType:Rt(c),fieldCode:d,fieldResult:m};b&&(w.fldLock=true),p&&(w.dirty=true),a.push(w),u=false;}}else a.push(A);break}case "hyperlink":a.push(wo(T,r,t,n,i));break;case "bookmarkStart":a.push(bo(T));break;case "bookmarkEnd":a.push(yo(T));break;case "fldSimple":a.push(xo(T,t,n,r,i));break;case "pPr":break;case "proofErr":case "permStart":case "permEnd":case "customXml":break;case "sdt":{let A=(T.elements??[]).find(R=>R.type==="element"&&(R.name==="w:sdtContent"||R.name?.endsWith(":sdtContent")));if(A){let R=Et(A,t,n,null,r,i);a.push(...R);}break}}return a}function G(e,t,n,o,r=null,i=null){let a={type:"paragraph",content:[]},f=s(e,"w14","paraId")??s(e,"w","paraId");f&&(a.paraId=f);let u=s(e,"w14","textId")??s(e,"w","textId");u&&(a.textId=u);let c=l(e,"w","pPr");if(c){a.formatting=ho(c,n);let m=l(c,"w","sectPr");m&&(a.sectionProperties=pe(m));}let d=Et(e,t,n,o,r,i);if(a.content=ve(d),a.formatting?.numPr&&o){let{numId:m,ilvl:y=0}=a.formatting.numPr;if(m!==void 0&&m!==0){let b=o.getLevel(m,y);b&&(a.listRendering={level:y,numId:m,marker:b.lvlText,isBullet:b.numFmt==="bullet",numFmt:b.numFmt},b.pPr&&(a.formatting||(a.formatting={}),b.pPr.indentLeft!==void 0&&(a.formatting.indentLeft=b.pPr.indentLeft),b.pPr.indentFirstLine!==void 0&&(a.formatting.indentFirstLine=b.pPr.indentFirstLine),b.pPr.hangingIndent!==void 0&&(a.formatting.hangingIndent=b.pPr.hangingIndent)));}}return a}function Re(e){let t="";for(let n of e.content)if(n.type==="run")for(let o of n.content)o.type==="text"?t+=o.text:o.type==="tab"?t+=" ":o.type==="break"&&(o.breakType==="page"?t+="\f":t+=`
|
|
10
|
+
`);else if(n.type==="hyperlink"){for(let o of n.children)if(o.type==="run")for(let r of o.content)r.type==="text"&&(t+=r.text);}else if(n.type==="simpleField"){for(let o of n.content)if(o.type==="run")for(let r of o.content)r.type==="text"&&(t+=r.text);}else if(n.type==="complexField")for(let o of n.fieldResult)for(let r of o.content)r.type==="text"&&(t+=r.text);return t}function To(e){if(!e||e.trim()==="")return "\u2022";let t=e.charCodeAt(0),n={183:"\u2022",111:"\u25CB",167:"\u25A0",252:"\u2713",110:"\u25A0",113:"\u25CB",117:"\u25C6",118:"\u2756",168:"\u2713",251:"\u2713",254:"\u2713",61623:"\u2022",61550:"\u25A0",61551:"\u25CB",61607:"\u25A0",61692:"\u2713",8226:"\u2022",9679:"\u25CF",9675:"\u25CB",9632:"\u25A0",9633:"\u25A1",9670:"\u25C6",9671:"\u25C7",8211:"\u2013",8212:"\u2014",62:">",45:"-"};return n[t]?n[t]:t>=57344&&t<=63743||t<32||t>=127&&t<160?"\u2022":e}function Fo(e,t,n){let o=e.listRendering;if(!o||!t)return;let{numId:r,level:i}=o;if(r===void 0||r===0)return;n.has(r)||n.set(r,new Array(9).fill(0));let a=n.get(r);a[i]=(a[i]||0)+1;for(let c=i+1;c<a.length;c++)a[c]=0;let f=o.marker;if(o.isBullet){let c=f||"";o.marker=To(c);return}let u=f;for(let c=0;c<=i;c++){let d=`%${c+1}`;if(u.includes(d)){let m=a[c],y=t.getLevel(r,c),b=Co(m,y?.numFmt||"decimal");u=u.replace(d,b);}}o.marker=u;}function Co(e,t){switch(t){case "decimal":case "decimalZero":return String(e);case "lowerLetter":return String.fromCharCode(96+(e-1)%26+1);case "upperLetter":return String.fromCharCode(64+(e-1)%26+1);case "lowerRoman":return Pt(e).toLowerCase();case "upperRoman":return Pt(e);case "bullet":return "\u2022";default:return String(e)}}function Pt(e){let t=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],n="";for(let[o,r]of t)for(;e>=o;)n+=r,e-=o;return n}var At=/\{\{([^{}]+)\}\}/g;function Bt(e){let t=[],n;for(At.lastIndex=0;(n=At.exec(e))!==null;){let o=n[1].trim();o&&!t.includes(o)&&t.push(o);}return t}function Nt(e){let t=[];for(let n of e)if(n.type==="paragraph"){let o=Re(n),r=Bt(o);for(let i of r)t.includes(i)||t.push(i);}else if(n.type==="table"){let o=Xt(n);for(let r of o)t.includes(r)||t.push(r);}return t}function Xt(e){let t=[];for(let n of e.rows)for(let o of n.cells)for(let r of o.content)if(r.type==="paragraph"){let i=Re(r),a=Bt(i);for(let f of a)t.includes(f)||t.push(f);}else if(r.type==="table"){let i=Xt(r);for(let a of i)t.includes(a)||t.push(a);}return t}function Lt(e,t,n,o,r,i){let a=[],f=I(e),u=new Map;for(let c of f){let d=c.name??"";if(d==="w:p"||d.endsWith(":p")){let m=G(c,t,n,o,r,i);Fo(m,o,u),a.push(m);}else if(d==="w:tbl"||d.endsWith(":tbl")){let m=te(c,t,n,o,r,i);a.push(m);}else if(d==="w:sdt"||d.endsWith(":sdt")){let m=(c.elements??[]).find(y=>y.type==="element"&&(y.name==="w:sdtContent"||y.name?.endsWith(":sdtContent")));if(m){let y=Lt(m,t,n,o,r,i);a.push(...y);}}}return a}function So(e,t){let n=[],o=[];for(let r of e)o.push(r),r.type==="paragraph"&&r.sectionProperties&&(n.push({properties:r.sectionProperties,content:o}),o=[]);return (o.length>0||n.length===0)&&n.push({properties:t??kt(),content:o}),n}function It(e,t=null,n=null,o=null,r=null,i=null){let a={content:[]};if(!e)return a;let f=z(e);if(!f)return a;let u=(f.elements??[]).find(m=>m.type==="element"&&(m.name==="w:document"||m.name?.endsWith(":document")));if(!u)return a;let c=l(u,"w","body");if(!c)return a;a.content=Lt(c,t,n,o,r,i);let d=l(c,"w","sectPr");return d&&(a.finalSectionProperties=pe(d)),a.sections=So(a.content,a.finalSectionProperties),a}async function _r(e,t={}){let{onProgress:n=()=>{},preloadFonts:o=true,parseHeadersFooters:r=true,parseNotes:i=true,detectVariables:a=true}=t,f=[];try{n("Extracting DOCX...",0);let u=await Ne(e);n("Extracted DOCX",10),n("Parsing relationships...",10);let c=u.documentRels?ae(u.documentRels):new Map;n("Parsed relationships",15),n("Parsing theme...",15);let d=je(u.themeXml);n("Parsed theme",20),n("Parsing styles...",20);let m=null,y;u.stylesXml&&(m=Ce(u.stylesXml,d),y=qe(u.stylesXml,d)),n("Parsed styles",30),n("Parsing numbering...",30);let b=Ze(u.numberingXml);n("Parsed numbering",35),n("Processing media files...",35);let p=ko(u,c);n("Processed media",40),n("Parsing document body...",40);let T={content:[]};u.documentXml?T=It(u.documentXml,m,d,b,c,p):f.push("No document.xml found in DOCX"),n("Parsed document body",55);let N,A;if(r){n("Parsing headers/footers...",55);let{headers:C,footers:S}=Mo(u,m,d,b,c,p);N=C,A=S,n("Parsed headers/footers",65);}else n("Skipping headers/footers",65);let R,v;if(i){n("Parsing footnotes/endnotes...",65);let{footnotes:C,endnotes:S}=vo(u,m,d,b,c,p);R=C,v=S,n("Parsed footnotes/endnotes",75);}else n("Skipping footnotes/endnotes",75);let h;a?(n("Detecting template variables...",75),h=Nt(T.content),n("Detected variables",80)):n("Skipping variable detection",80),o?(n("Loading fonts...",80),await Ro(d,y,T),n("Loaded fonts",95)):n("Skipping font loading",95),n("Assembling document...",95);let w={package:{document:T,styles:y,theme:d,numbering:b.definitions,headers:N,footers:A,footnotes:R,endnotes:v,relationships:c,media:p},originalBuffer:e,templateVariables:h,warnings:f.length>0?f:void 0};return n("Complete",100),w}catch(u){let c=u instanceof Error?u.message:String(u);throw new Error(`Failed to parse DOCX: ${c}`)}}function ko(e,t){let n=new Map;for(let[o,r]of e.media.entries()){let i=o.split("/").pop()||o,a=Xe(o),f=new Uint8Array(r),u="";for(let b=0;b<f.length;b++)u+=String.fromCharCode(f[b]);let c=btoa(u),d=`data:${a};base64,${c}`,m={path:o,filename:i,mimeType:a,data:r,dataUrl:d};n.set(o,m);let y=o.replace(/^word\//,"");y!==o&&n.set(y,m);}return n}function ge(e,t){let n=t.toLowerCase();for(let[o,r]of e.entries())if(o.toLowerCase()===n)return r}function Mo(e,t,n,o,r,i){let a=new Map,f=new Map;for(let[u,c]of r.entries())if(c.type===ie.header&&c.target){let d=c.target.split("/").pop()||c.target,m=ge(e.headers,d);if(m){let y=`word/_rels/${d}.rels`,b=ge(e.allXml,y),p=b?ae(b):r,T=ht(m,"default",t,n,o,p,i);a.set(u,T);}}else if(c.type===ie.footer&&c.target){let d=c.target.split("/").pop()||c.target,m=ge(e.footers,d);if(m){let y=`word/_rels/${d}.rels`,b=ge(e.allXml,y),p=b?ae(b):r,T=wt(m,"default",t,n,o,p,i);f.set(u,T);}}return {headers:a,footers:f}}function vo(e,t,n,o,r,i){let a=yt(e.footnotesXml,t,n,o,r,i),f=xt(e.endnotesXml,t,n,o,r,i);return {footnotes:a.getNormalFootnotes(),endnotes:f.getNormalEndnotes()}}async function Ro(e,t,n){let o=new Set;if(e?.fontScheme){let{majorFont:r,minorFont:i}=e.fontScheme;r?.latin&&o.add(r.latin),i?.latin&&o.add(i.latin);}if(t?.docDefaults?.rPr?.fontFamily?.ascii&&o.add(t.docDefaults.rPr.fontFamily.ascii),t?.styles)for(let r of t.styles)r.rPr?.fontFamily?.ascii&&o.add(r.rPr.fontFamily.ascii),r.rPr?.fontFamily?.hAnsi&&o.add(r.rPr.fontFamily.hAnsi);if(n.content){for(let r of n.content)if(r.type==="paragraph")for(let i of r.content)i.type==="run"&&i.formatting?.fontFamily&&(i.formatting.fontFamily.ascii&&o.add(i.formatting.fontFamily.ascii),i.formatting.fontFamily.hAnsi&&o.add(i.formatting.fontFamily.hAnsi));}if(o.size>0)try{await ye(Array.from(o));}catch(r){console.warn("Failed to load some fonts:",r);}}
|
|
11
|
+
export{Pe as a,Dt as b,Eo as c,Po as d,Ao as e,Bo as f,No as g,Xo as h,Lo as i,Io as j,Jo as k,_r as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkXVFMG77A_cjs=require('./chunk-XVFMG77A.cjs');function T(s,t){let a=chunkXVFMG77A_cjs.b.getCommandHandler(t.type);if(a)return a(s,t);switch(t.type){case "insertText":return R(s,t);case "replaceText":return E(s,t);case "deleteText":return B(s,t);case "formatText":return S(s,t);case "formatParagraph":return V(s,t);case "applyStyle":return $(s,t);case "insertTable":return H(s,t);case "insertImage":return A(s,t);case "insertHyperlink":return F(s,t);case "removeHyperlink":return j(s,t);case "insertParagraphBreak":return v(s,t);case "mergeParagraphs":return N(s,t);case "splitParagraph":return M(s,t);case "setVariable":return O(s,t);case "applyVariables":return _(s,t);default:let r=t;throw new Error(`Unknown command type: ${r.type}`)}}function z(s,t){return t.reduce((a,r)=>T(a,r),s)}function h(s){return JSON.parse(JSON.stringify(s))}function g(s,t){let a=0;for(let r=0;r<s.content.length;r++)if(s.content[r].type==="paragraph"){if(a===t)return r;a++;}return -1}function I(s){let t="";for(let a of s.content)if(a.type==="run")for(let r of a.content)r.type==="text"&&(t+=r.text);else if(a.type==="hyperlink"){for(let r of a.children)if(r.type==="run")for(let e of r.content)e.type==="text"&&(t+=e.text);}return t}function b(s,t){return {type:"run",formatting:t,content:[{type:"text",text:s}]}}function C(s,t,a,r){let e=[],o=0,p=false;for(let n of s.content)if(n.type==="run"){let c=n.content.filter(l=>l.type==="text").map(l=>l.text).join(""),i=o,u=o+c.length;if(!p&&t>=i&&t<=u){let l=t-i;l>0&&e.push({...n,content:[{type:"text",text:c.slice(0,l)}]}),e.push(b(a,r||n.formatting)),l<c.length&&e.push({...n,content:[{type:"text",text:c.slice(l)}]}),p=true;}else e.push(n);o=u;}else e.push(n);return p||e.push(b(a,r)),e}function y(s,t,a){let r=[],e=0;for(let o of s.content)if(o.type==="run"){let p=o.content.filter(i=>i.type==="text").map(i=>i.text).join(""),n=e,c=e+p.length;if(c<=t||n>=a)r.push(o);else {let i="";n<t&&(i+=p.slice(0,t-n)),c>a&&(i+=p.slice(a-n)),i.length>0&&r.push({...o,content:[{type:"text",text:i}]});}e=c;}else r.push(o);return r}function D(s,t,a,r){let e=[],o=0;for(let p of s.content)if(p.type==="run"){let n=p.content.filter(u=>u.type==="text").map(u=>u.text).join(""),c=o,i=o+n.length;if(i<=t||c>=a)e.push(p);else if(c>=t&&i<=a)e.push({...p,formatting:{...p.formatting,...r}});else {let u=Math.max(t,c),l=Math.min(a,i);c<u&&e.push({...p,content:[{type:"text",text:n.slice(0,u-c)}]}),e.push({...p,formatting:{...p.formatting,...r},content:[{type:"text",text:n.slice(u-c,l-c)}]}),i>l&&e.push({...p,content:[{type:"text",text:n.slice(l-c)}]});}o=i;}else e.push(p);return e}function R(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e];return o.content=C(o,t.position.offset,t.text,t.formatting),a}function E(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset),n.content=C(n,e.offset,t.text,t.formatting);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length),n.content=C(n,e.offset,t.text,t.formatting);let i=[];for(let u=e.paragraphIndex+1;u<=o.paragraphIndex;u++)i.push(g(r,u));for(let u=i.length-1;u>=0;u--)i[u]!==-1&&r.content.splice(i[u],1);}return a}function B(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length);let i=g(r,o.paragraphIndex),u=r.content[i];u.content=y(u,0,o.offset),n.content.push(...u.content);let l=[];for(let f=e.paragraphIndex+1;f<=o.paragraphIndex;f++)l.push(g(r,f));for(let f=l.length-1;f>=0;f--)l[f]!==-1&&r.content.splice(l[f],1);}return a}function S(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=D(n,e.offset,o.offset,t.formatting);}else for(let p=e.paragraphIndex;p<=o.paragraphIndex;p++){let n=g(r,p);if(n===-1)continue;let c=r.content[n],i=I(c),u=0,l=i.length;p===e.paragraphIndex&&(u=e.offset),p===o.paragraphIndex&&(l=o.offset),c.content=D(c,u,l,t.formatting);}return a}function V(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];if(o.formatting={...o.formatting,...t.formatting},"numPr"in t.formatting){let p=t.formatting.numPr;if(p&&p.numId!==void 0&&p.numId!==0){let n=p.ilvl??0,c=p.numId===1,i=c?"\u2022":"1.";if(a.package.numbering){let u=a.package.numbering.nums.find(l=>l.numId===p.numId);if(u){let l=a.package.numbering.abstractNums.find(f=>f.abstractNumId===u.abstractNumId);if(l){let f=l.levels.find(x=>x.ilvl===n);f&&(i=f.lvlText||i);}}}o.listRendering={level:n,numId:p.numId,marker:i,isBullet:c};}else delete o.listRendering;}return a}function $(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];return o.formatting={...o.formatting,styleId:t.styleId},a}function H(s,t){let a=h(s),r=a.package.document,e=[];for(let n=0;n<t.rows;n++){let c=[];for(let i=0;i<t.columns;i++){let u=t.data?.[n]?.[i]||"";c.push({type:"tableCell",content:[{type:"paragraph",content:u?[b(u)]:[]}]});}e.push({type:"tableRow",formatting:n===0&&t.hasHeader?{header:true}:void 0,cells:c});}let o={type:"table",rows:e},p=g(r,t.position.paragraphIndex);return p===-1?r.content.push(o):r.content.splice(p+1,0,o),a}function A(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],n={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:t.src,alt:t.alt,size:{width:(t.width||100)*914400,height:(t.height||100)*914400},wrap:{type:"inline"}}}]},c=C(o,t.position.offset,"",void 0),i=false,u=0;for(let l=0;l<c.length;l++){let f=c[l];if(f.type==="run"){let x=f.content.filter(d=>d.type==="text").map(d=>d.text).join("");if(u+=x.length,!i&&u>=t.position.offset){c.splice(l+1,0,n),i=true;break}}}return i||c.push(n),o.content=c,a}function F(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex!==o.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p],c=I(n),i=t.displayText||c.slice(e.offset,o.offset);n.content=y(n,e.offset,o.offset);let u={type:"hyperlink",href:t.url,tooltip:t.tooltip,children:[b(i)]},l=false,f=0,x=[];for(let d of n.content)if(d.type==="run"){let P=d.content.filter(m=>m.type==="text").map(m=>m.text).join(""),w=f+P.length;if(!l&&f<=e.offset&&e.offset<=w){let m=e.offset-f;m>0&&x.push({...d,content:[{type:"text",text:P.slice(0,m)}]}),x.push(u),m<P.length&&x.push({...d,content:[{type:"text",text:P.slice(m)}]}),l=true;}else x.push(d);f=w;}else x.push(d);return l||x.push(u),n.content=x,a}function j(s,t){let a=h(s),r=a.package.document,{start:e}=t.range,o=g(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let p=r.content[o],n=[];for(let c of p.content)if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&n.push(i);else n.push(c);return p.content=n,a}function v(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],p=I(o),n=y({...o,content:[...o.content]},t.position.offset,p.length),c=y({...o,content:[...o.content]},0,t.position.offset);o.content=n;let i={type:"paragraph",formatting:o.formatting,content:c};return r.content.splice(e+1,0,i),a}function N(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e],p=[];for(let n=1;n<=t.count;n++){let c=g(r,t.paragraphIndex+n);if(c!==-1){let i=r.content[c];o.content.push(...i.content),p.push(c);}}for(let n=p.length-1;n>=0;n--)r.content.splice(p[n],1);return a}function M(s,t){return v(s,{position:t.position})}function O(s,t){let a=h(s);return a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t.name)||a.templateVariables.push(t.name),a}function _(s,t){let a=h(s),r=a.package.document;function e(n){for(let c of n.content)if(c.type==="text")for(let[i,u]of Object.entries(t.values)){let l=new RegExp(`\\{${i}\\}`,"g");c.text=c.text.replace(l,u);}}function o(n){for(let c of n.content)if(c.type==="run")e(c);else if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&e(i);}function p(n){if(n.type==="paragraph")o(n);else if(n.type==="table")for(let c of n.rows)for(let i of c.cells)for(let u of i.content)p(u);}for(let n of r.content)p(n);return a}var U=T;exports.a=T;exports.b=z;exports.c=U;
|