@eigenpal/docx-js-editor 0.0.4 → 0.0.5
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 +69 -132
- package/dist/chunk-2CFVFSUH.js +57 -0
- package/dist/{chunk-BQWGTYDH.js → chunk-AOL255XD.js} +1 -1
- package/dist/chunk-BBGDBZJY.cjs +1 -0
- package/dist/{chunk-EUHVOGCB.cjs → chunk-D2GERZ7M.cjs} +2 -2
- package/dist/chunk-DQHQWQHL.cjs +11 -0
- package/dist/chunk-FXILBPZI.cjs +9 -0
- package/dist/chunk-H2UMX5CK.js +9 -0
- package/dist/chunk-HGOIKOKZ.js +1 -0
- package/dist/chunk-I2C6ENCR.js +11 -0
- package/dist/chunk-TL3YTVN2.cjs +57 -0
- package/dist/{colorResolver-Yakhydrt.d.ts → colorResolver-DrNkos_H.d.ts} +1 -32
- package/dist/{colorResolver-C-tITrbI.d.cts → colorResolver-WsUxFs5p.d.cts} +1 -32
- package/dist/core-plugins.cjs +1 -1
- package/dist/core-plugins.d.cts +3 -3
- package/dist/core-plugins.d.ts +3 -3
- package/dist/core-plugins.js +1 -1
- package/dist/headless.cjs +2 -2
- package/dist/headless.d.cts +4 -4
- package/dist/headless.d.ts +4 -4
- package/dist/headless.js +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.css +1 -1
- package/dist/index.d.cts +173 -362
- package/dist/index.d.ts +173 -362
- package/dist/index.js +43 -43
- package/dist/mcp-cli.js +20 -20
- package/dist/mcp.cjs +3 -3
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{registry-DeeU0bQB.d.cts → registry-BWDZlJx6.d.cts} +1 -1
- package/dist/{registry-D3zhko7n.d.ts → registry-DifIQR1O.d.ts} +1 -1
- package/dist/selectionRects-M7QY6HKR.cjs +1 -0
- package/dist/selectionRects-O6YQMMCP.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/{types-BJXChtaM.d.cts → types-XVRXTi4o.d.cts} +509 -336
- package/dist/{types-BJXChtaM.d.ts → types-XVRXTi4o.d.ts} +509 -336
- package/package.json +2 -2
- package/dist/chunk-6HBUJFBB.js +0 -1
- package/dist/chunk-CCXUC6LX.js +0 -9
- package/dist/chunk-DWFWDKAH.cjs +0 -9
- package/dist/chunk-FFPSMP4Q.cjs +0 -11
- package/dist/chunk-NI5OFVY2.js +0 -57
- package/dist/chunk-QB7IFLG2.cjs +0 -1
- package/dist/chunk-RGYAPHXT.cjs +0 -57
- package/dist/chunk-ZMWEAP5S.js +0 -11
- package/dist/selectionRects-2VAWY4ZQ.cjs +0 -1
- package/dist/selectionRects-ONIZYUUI.js +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';var qt=require('jszip'),xmlJs=require('xml-js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var qt__default=/*#__PURE__*/_interopDefault(qt);var G=new Set,ne=new Map,be=new Set,ye=false;function Pe(e,t=[400,700],n=["normal","italic"]){let o=encodeURIComponent(e),r=[];for(let a of n){let c=a==="italic"?1:0;for(let u of t)r.push(`${c},${u}`);}r.sort();let i=r.join(";");return `https://fonts.googleapis.com/css2?family=${o}:ital,wght@${i}&display=swap`}async function Ae(e,t){let n=e.trim();if(G.has(n))return true;let o=ne.get(n);if(o)return o;let r=(async()=>{ye=true;try{let i=Pe(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 Ne(n,3e3),G.add(n),Be([n]),!0):!1}catch(i){return console.warn(`Failed to load font "${n}":`,i),false}finally{ne.delete(n),ne.size===0&&(ye=false);}})();return ne.set(n,r),r}async function Wt(e,t){let n=e.filter(o=>!G.has(o.trim()));n.length!==0&&await Promise.all(n.map(o=>Ae(o,t)));}function Io(e){return G.has(e.trim())}function Lo(){return ye}function Do(){return Array.from(G)}function Ho(e){return be.add(e),()=>{be.delete(e);}}function Be(e){for(let t of be)try{t(e);}catch(n){console.warn("Font load callback error:",n);}}async function Ne(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 Oo(e,t="sans-serif"){if(typeof document>"u")return false;let n=(r,i)=>{let c=document.createElement("canvas").getContext("2d");if(!c)return false;c.textBaseline="top";let u="abcdefghijklmnopqrstuvwxyz0123456789";c.font=`72px ${i}`;let f=c.measureText(u).width;return c.font=`72px "${r}", ${i}`,c.measureText(u).width!==f};return n(e,t)?true:n(e,t==="sans-serif"?"serif":"sans-serif")}async function jo(e,t,n){let o=e.trim();if(G.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 Ne(o,3e3),G.add(o),Be([o]),!0}catch(r){return console.warn(`Failed to load font "${o}" from buffer:`,r),false}}var Vt={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 zt(e){let t=e.trim();return Vt[t]||t}async function $t(e){let t=e.trim(),n=zt(t);return n!==t?(await Ut(t,n),G.add(t),G.add(n),true):Ae(n)}async function Ut(e,t){let n=`font-alias-${e.toLowerCase().replace(/\s+/g,"-")}`;if(!document.getElementById(n))try{let o=Pe(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*['"]${_t(t)}['"]`,"gi"),c=i.replace(a,`font-family: '${e}'`),u=document.createElement("style");u.id=n,u.textContent=c,document.head.appendChild(u);}catch(o){console.warn(`Failed to create font alias for "${e}":`,o);}}function _t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function xe(e){let t=[...new Set(e.map(n=>n.trim()))];await Promise.all(t.map(n=>$t(n)));}async function Wo(){await Wt(["Carlito","Caladea","Arimo","Tinos","Cousine","EB Garamond"]);}function Gt(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:c,hAnsi:u}=a.formatting.fontFamily;c&&t.add(c),u&&u!==c&&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:c}=i.runProperties.fontFamily;a&&t.add(a),c&&c!==a&&t.add(c);}}return t}async function Vo(e){let t=Gt(e);t.size!==0&&await xe(Array.from(t));}async function Xe(e){let t=await qt__default.default.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 c=o.split("/").pop()||o;n.headers.set(c,a);}else if(i.match(/^word\/footer\d+\.xml$/)){let c=o.split("/").pop()||o;n.footers.set(c,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 Ie(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 V(e){return xmlJs.xml2js(e,{compact:false,ignoreComment:true,ignoreInstruction:true,ignoreDoctype:true,alwaysArray:false,trim:false,attributesKey:"attributes",textKey:"text"})}function Le(e){return xmlJs.js2xml({elements:[e]},{compact:false,spaces:0})}function q(e){try{let t=V(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 N(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 D(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 De(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 T(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=q(e);if(!n)return console.warn("Failed to parse relationships XML"),t;let o=D(n);for(let r of o){let i=r.name||"";if(!i.endsWith("Relationship")&&!i.includes(":Relationship"))continue;let a=s(r,null,"Id"),c=s(r,null,"Type"),u=s(r,null,"Target"),f=s(r,null,"TargetMode");if(!a||!c||!u){console.warn("Relationship missing required attributes:",{id:a,type:c,target:u});continue}let d={id:a,type:c,target:u};f==="External"?d.targetMode="External":f==="Internal"&&(d.targetMode="Internal"),t.set(a,d);}return t}function He(e){return e.type===ie.hyperlink&&e.targetMode==="External"}var We={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:{}}},Te={name:"Office Theme",colorScheme:We,fontScheme:se},Kt=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function Jt(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={...We};if(!e)return t;for(let n of Kt){let o=l(e,"a",n);if(o){let r=D(o);if(r.length>0){let i=Jt(r[0]);i&&(t[n]=i);}}}return t}function Oe(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=N(e,"a","font");for(let a of i){let c=s(a,"a","script")??s(a,null,"script"),u=s(a,"a","typeface")??s(a,null,"typeface");c&&u&&(t.fonts=t.fonts||{},t.fonts[c]=u);}return t}function en(e){let t={...se};if(!e)return t;let n=l(e,"a","majorFont");n&&(t.majorFont=Oe(n));let o=l(e,"a","minorFont");return o&&(t.minorFont=Oe(o)),t}function Ve(e){if(!e)return {...Te};try{let t=q(e);if(!t)return {...Te};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"),c=en(a);return {name:n,colorScheme:i,fontScheme:c}}catch(t){return console.warn("Failed to parse theme:",t),{...Te}}}function tn(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 je(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 U(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?tn(e,r):o?je(e,r):je(e,"latin")}function le(e,t){if(!e)return;let n={},o=l(e,"w","b");o&&(n.bold=T(o));let r=l(e,"w","bCs");r&&(n.boldCs=T(r));let i=l(e,"w","i");i&&(n.italic=T(i));let a=l(e,"w","iCs");a&&(n.italicCs=T(a));let c=l(e,"w","u");if(c){let M=s(c,"w","val");if(M){n.underline={style:M};let S=s(c,"w","color"),j=s(c,"w","themeColor");(S||j)&&(n.underline.color=Fe(S,j,s(c,"w","themeTint"),s(c,"w","themeShade")));}}let u=l(e,"w","strike");u&&(n.strike=T(u));let f=l(e,"w","dstrike");f&&(n.doubleStrike=T(f));let d=l(e,"w","vertAlign");if(d){let M=s(d,"w","val");(M==="superscript"||M==="subscript"||M==="baseline")&&(n.vertAlign=M);}let p=l(e,"w","smallCaps");p&&(n.smallCaps=T(p));let x=l(e,"w","caps");x&&(n.allCaps=T(x));let b=l(e,"w","vanish");b&&(n.hidden=T(b));let m=l(e,"w","color");m&&(n.color=Fe(s(m,"w","val"),s(m,"w","themeColor"),s(m,"w","themeTint"),s(m,"w","themeShade")));let y=l(e,"w","highlight");if(y){let M=s(y,"w","val");M&&(n.highlight=M);}let B=l(e,"w","shd");B&&(n.shading=ce(B));let R=l(e,"w","sz");if(R){let M=g(R,"w","val");M!==void 0&&(n.fontSize=M);}let E=l(e,"w","szCs");if(E){let M=g(E,"w","val");M!==void 0&&(n.fontSizeCs=M);}let C=l(e,"w","rFonts");if(C){n.fontFamily={ascii:s(C,"w","ascii")??void 0,hAnsi:s(C,"w","hAnsi")??void 0,eastAsia:s(C,"w","eastAsia")??void 0,cs:s(C,"w","cs")??void 0};let M=s(C,"w","asciiTheme");M&&(n.fontFamily.asciiTheme=M,t&&!n.fontFamily.ascii&&(n.fontFamily.ascii=U(t,M)));let S=s(C,"w","hAnsiTheme");S&&(n.fontFamily.hAnsiTheme=S,t&&!n.fontFamily.hAnsi&&(n.fontFamily.hAnsi=U(t,S)));let j=s(C,"w","eastAsiaTheme");j&&(n.fontFamily.eastAsiaTheme=j,t&&!n.fontFamily.eastAsia&&(n.fontFamily.eastAsia=U(t,j)));let $=s(C,"w","cstheme");$&&(n.fontFamily.csTheme=$,t&&!n.fontFamily.cs&&(n.fontFamily.cs=U(t,$)));}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 k=l(e,"w","kern");if(k){let M=g(k,"w","val");M!==void 0&&(n.kerning=M);}let v=l(e,"w","effect");if(v){let M=s(v,"w","val");M&&(n.effect=M);}let P=l(e,"w","em");if(P){let M=s(P,"w","val");M&&(n.emphasisMark=M);}let A=l(e,"w","emboss");A&&(n.emboss=T(A));let X=l(e,"w","imprint");X&&(n.imprint=T(X));let O=l(e,"w","outline");O&&(n.outline=T(O));let K=l(e,"w","shadow");K&&(n.shadow=T(K));let L=l(e,"w","rtl");L&&(n.rtl=T(L));let H=l(e,"w","cs");H&&(n.cs=T(H));let _=l(e,"w","rStyle");if(_){let M=s(_,"w","val");M&&(n.styleId=M);}return Object.keys(n).length>0?n:void 0}function Fe(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 ce(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 c=s(e,"w","val");return c&&(t.pattern=c),Object.keys(t).length>0?t:void 0}function W(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=Fe(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 c=s(e,"w","shadow");c&&(n.shadow=c==="1"||c==="true");let u=s(e,"w","frame");return u&&(n.frame=u==="1"||u==="true"),n}function nn(e){if(!e)return;let t=N(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},c=s(o,"w","leader");c&&(a.leader=c),n.push(a);}}return n.length>0?n:void 0}function Ce(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=T(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 k=s(i,"w","lineRule");k&&(n.lineSpacingRule=k);let v=s(i,"w","beforeAutospacing");v&&(n.beforeAutospacing=v==="1"||v==="true");let P=s(i,"w","afterAutospacing");P&&(n.afterAutospacing=P==="1"||P==="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 k=g(a,"w","hanging");k!==void 0&&(n.indentFirstLine=-k,n.hangingIndent=true);}let c=l(e,"w","pBdr");if(c){let h={},F=W(l(c,"w","top"));F&&(h.top=F);let w=W(l(c,"w","bottom"));w&&(h.bottom=w);let k=W(l(c,"w","left"));k&&(h.left=k);let v=W(l(c,"w","right"));v&&(h.right=v);let P=W(l(c,"w","between"));P&&(h.between=P);let A=W(l(c,"w","bar"));A&&(h.bar=A),Object.keys(h).length>0&&(n.borders=h);}let u=l(e,"w","shd");u&&(n.shading=ce(u));let f=l(e,"w","tabs");f&&(n.tabs=nn(f));let d=l(e,"w","keepNext");d&&(n.keepNext=T(d));let p=l(e,"w","keepLines");p&&(n.keepLines=T(p));let x=l(e,"w","widowControl");x&&(n.widowControl=T(x));let b=l(e,"w","pageBreakBefore");b&&(n.pageBreakBefore=T(b));let m=l(e,"w","numPr");if(m){let h=l(m,"w","numId"),F=l(m,"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 y=l(e,"w","outlineLvl");if(y){let h=g(y,"w","val");h!==void 0&&(n.outlineLevel=h);}let B=l(e,"w","pStyle");if(B){let h=s(B,"w","val");h&&(n.styleId=h);}let R=l(e,"w","suppressLineNumbers");R&&(n.suppressLineNumbers=T(R));let E=l(e,"w","suppressAutoHyphens");E&&(n.suppressAutoHyphens=T(E));let C=l(e,"w","rPr");return C&&(n.runProperties=le(C,t)),Object.keys(n).length>0?n:void 0}function Z(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 _e(e){if(!e)return;let t={},n=W(l(e,"w","top"));n&&(t.top=n);let o=W(l(e,"w","bottom"));o&&(t.bottom=o);let r=W(l(e,"w","left"));r&&(t.left=r);let i=W(l(e,"w","right"));i&&(t.right=i);let a=W(l(e,"w","insideH"));a&&(t.insideH=a);let c=W(l(e,"w","insideV"));return c&&(t.insideV=c),Object.keys(t).length>0?t:void 0}function Ge(e){if(!e)return;let t={},n=Z(l(e,"w","top"));n&&(t.top=n);let o=Z(l(e,"w","bottom"));o&&(t.bottom=o);let r=Z(l(e,"w","left"));r&&(t.left=r);let i=Z(l(e,"w","right"));return i&&(t.right=i),Object.keys(t).length>0?t:void 0}function on(e){if(!e)return;let t={},n=s(e,"w","val");if(n){let f=parseInt(n,16);isNaN(f)||(t.firstRow=(f&32)!==0,t.lastRow=(f&64)!==0,t.firstColumn=(f&128)!==0,t.lastColumn=(f&256)!==0,t.noHBand=(f&512)!==0,t.noVBand=(f&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 c=s(e,"w","noHBand");c&&(t.noHBand=c==="1");let u=s(e,"w","noVBand");return u&&(t.noVBand=u==="1"),Object.keys(t).length>0?t:void 0}function ze(e,t){if(!e)return;let n={},o=l(e,"w","tblW");o&&(n.width=Z(o));let r=l(e,"w","jc");if(r){let m=s(r,"w","val");(m==="left"||m==="center"||m==="right")&&(n.justification=m);}let i=l(e,"w","tblCellSpacing");i&&(n.cellSpacing=Z(i));let a=l(e,"w","tblInd");a&&(n.indent=Z(a));let c=l(e,"w","tblBorders");c&&(n.borders=_e(c));let u=l(e,"w","tblCellMar");u&&(n.cellMargins=Ge(u));let f=l(e,"w","tblLayout");if(f){let m=s(f,"w","type");(m==="fixed"||m==="autofit")&&(n.layout=m);}let d=l(e,"w","tblStyle");if(d){let m=s(d,"w","val");m&&(n.styleId=m);}let p=l(e,"w","tblLook");p&&(n.look=on(p));let x=l(e,"w","shd");x&&(n.shading=ce(x));let b=l(e,"w","bidiVisual");return b&&(n.bidi=T(b)),Object.keys(n).length>0?n:void 0}function $e(e){if(!e)return;let t={},n=l(e,"w","trHeight");if(n){t.height=Z(n);let c=s(n,"w","hRule");c&&(t.heightRule=c);}let o=l(e,"w","tblHeader");o&&(t.header=T(o));let r=l(e,"w","cantSplit");r&&(t.cantSplit=T(r));let i=l(e,"w","jc");if(i){let c=s(i,"w","val");(c==="left"||c==="center"||c==="right")&&(t.justification=c);}let a=l(e,"w","hidden");return a&&(t.hidden=T(a)),Object.keys(t).length>0?t:void 0}function Ue(e,t){if(!e)return;let n={},o=l(e,"w","tcW");o&&(n.width=Z(o));let r=l(e,"w","tcBorders");r&&(n.borders=_e(r));let i=l(e,"w","tcMar");i&&(n.margins=Ge(i));let a=l(e,"w","shd");a&&(n.shading=ce(a));let c=l(e,"w","vAlign");if(c){let m=s(c,"w","val");(m==="top"||m==="center"||m==="bottom")&&(n.verticalAlign=m);}let u=l(e,"w","textDirection");if(u){let m=s(u,"w","val");m&&(n.textDirection=m);}let f=l(e,"w","gridSpan");if(f){let m=g(f,"w","val");m!==void 0&&(n.gridSpan=m);}let d=l(e,"w","vMerge");if(d){let m=s(d,"w","val");n.vMerge=m==="restart"?"restart":"continue";}let p=l(e,"w","tcFitText");p&&(n.fitText=T(p));let x=l(e,"w","noWrap");x&&(n.noWrap=T(x));let b=l(e,"w","hideMark");return b&&(n.hideMark=T(b)),Object.keys(n).length>0?n:void 0}function rn(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 c=l(e,"w","link");c&&(n.link=s(c,"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 f=l(e,"w","hidden");f&&(n.hidden=T(f));let d=l(e,"w","semiHidden");d&&(n.semiHidden=T(d));let p=l(e,"w","unhideWhenUsed");p&&(n.unhideWhenUsed=T(p));let x=l(e,"w","qFormat");x&&(n.qFormat=T(x));let b=l(e,"w","personal");b&&(n.personal=T(b));let m=l(e,"w","pPr");m&&(n.pPr=Ce(m,t));let y=l(e,"w","rPr");y&&(n.rPr=le(y,t));let B=l(e,"w","tblPr");B&&(n.tblPr=ze(B));let R=l(e,"w","trPr");R&&(n.trPr=$e(R));let E=l(e,"w","tcPr");E&&(n.tcPr=Ue(E));let C=N(e,"w","tblStylePr");if(C.length>0){n.tblStylePr=[];for(let h of C){let F=s(h,"w","type");if(F){let w={type:F},k=l(h,"w","pPr");k&&(w.pPr=Ce(k,t));let v=l(h,"w","rPr");v&&(w.rPr=le(v,t));let P=l(h,"w","tblPr");P&&(w.tblPr=ze(P));let A=l(h,"w","trPr");A&&(w.trPr=$e(A));let X=l(h,"w","tcPr");X&&(w.tcPr=Ue(X)),n.tblStylePr.push(w);}}}return n}function an(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=Ce(i,t));}return n.rPr||n.pPr?n:void 0}function qe(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 sn(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=qe(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 Ze(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=Ze(r,t,n,o),a={...e,pPr:sn(i.pPr,e.pPr),rPr:qe(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 Se(e,t){let n=new Map;try{let o=q(e);if(!o)return n;let r=N(o,"w","style");for(let i of r){let a=rn(i,t);a.styleId&&n.set(a.styleId,a);}for(let[i,a]of n){let c=Ze(a,n,t);n.set(i,c);}}catch(o){console.warn("Failed to parse styles:",o);}return n}function Ye(e,t){let n={styles:[]};try{let o=q(e);if(!o)return n;let r=l(o,"w","docDefaults");n.docDefaults=an(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=Se(e,t);n.styles=Array.from(a.values());}catch(o){console.warn("Failed to parse style definitions:",o);}return n}function Ke(e){let t={abstractNums:[],nums:[]};if(!e)return ke(t);let n=q(e);if(!n)return ke(t);let o=N(n,"w","abstractNum");for(let i of o){let a=ln(i);a&&t.abstractNums.push(a);}let r=N(n,"w","num");for(let i of r){let a=cn(i);a&&t.nums.push(a);}return ke(t)}function ln(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 f=s(r,"w","val");(f==="hybridMultilevel"||f==="multilevel"||f==="singleLevel")&&(o.multiLevelType=f);}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 c=l(e,"w","styleLink");c&&(o.styleLink=s(c,"w","val")??void 0);let u=N(e,"w","lvl");for(let f of u){let d=Je(f);d&&o.levels.push(d);}return o.levels.sort((f,d)=>f.ilvl-d.ilvl),o}function cn(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},c=N(e,"w","lvlOverride");if(c.length>0){a.levelOverrides=[];for(let u of c){let f=s(u,"w","ilvl");if(f===null)continue;let d=parseInt(f,10);if(isNaN(d))continue;let p={ilvl:d},x=l(u,"w","startOverride");if(x){let m=s(x,"w","val");if(m!==null){let y=parseInt(m,10);isNaN(y)||(p.startOverride=y);}}let b=l(u,"w","lvl");b&&(p.lvl=Je(b)??void 0),a.levelOverrides.push(p);}}return a}function Je(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 m=s(r,"w","val");if(m!==null){let y=parseInt(m,10);isNaN(y)||(o.start=y);}}let i=l(e,"w","numFmt");if(i){let m=s(i,"w","val");m&&(o.numFmt=un(m));}let a=l(e,"w","lvlText");a&&(o.lvlText=s(a,"w","val")??"");let c=l(e,"w","lvlJc");if(c){let m=s(c,"w","val");(m==="left"||m==="center"||m==="right")&&(o.lvlJc=m);}let u=l(e,"w","suff");if(u){let m=s(u,"w","val");(m==="tab"||m==="space"||m==="nothing")&&(o.suffix=m);}let f=l(e,"w","isLgl");f&&(o.isLgl=T(f));let d=l(e,"w","lvlRestart");if(d){let m=s(d,"w","val");if(m!==null){let y=parseInt(m,10);isNaN(y)||(o.lvlRestart=y);}}let p=l(e,"w","legacy");p&&(o.legacy={legacy:T(p),legacySpace:g(p,"w","legacySpace"),legacyIndent:g(p,"w","legacyIndent")});let x=l(e,"w","pPr");x&&(o.pPr=fn(x));let b=l(e,"w","rPr");return b&&(o.rPr=mn(b)),o}function un(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 fn(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"),c=g(n,"w","hanging");r!==void 0&&(t.indentLeft=r),i!==void 0&&(t.indentRight=i),c!==void 0?(t.indentFirstLine=-c,t.hangingIndent=true):a!==void 0&&(t.indentFirstLine=a);}let o=l(e,"w","tabs");if(o){t.tabs=[];let r=N(o,"w","tab");for(let i of r){let a=g(i,"w","pos"),c=s(i,"w","val"),u=s(i,"w","leader");a!==void 0&&c&&t.tabs.push({position:a,alignment:dn(c),leader:pn(u)});}}return t}function dn(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 pn(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 mn(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 c=g(o,"w","val");c!==void 0&&(t.fontSize=c);}let r=l(e,"w","color");if(r){let c=s(r,"w","val"),u=s(r,"w","themeColor");c==="auto"?t.color={auto:true}:u?t.color={themeColor:u,themeTint:s(r,"w","themeTint")??void 0,themeShade:s(r,"w","themeShade")??void 0}:c&&(t.color={rgb:c});}let i=l(e,"w","b");i&&(t.bold=T(i));let a=l(e,"w","i");return a&&(t.italic=T(a)),t}function ke(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 c=i.levelOverrides.find(u=>u.ilvl===r);if(c){if(c.lvl)return c.lvl;let u=t.get(i.abstractNumId);if(u){let f=u.levels.find(d=>d.ilvl===r);if(f&&c.startOverride!==void 0)return {...f,start:c.startOverride}}}}let a=t.get(i.abstractNumId);return a?a.levels.find(c=>c.ilvl===r)??null:null},getAbstract(o){return t.get(o)??null},hasNumbering(o){return n.has(o)}}}var gn=914400,hn=96;function rr(e){return e==null||isNaN(e)?0:Math.round(e*hn/gn)}function wn(e){if(!e)return;let t=parseInt(e,10);if(!isNaN(t))return t/6e4}function I(e,t){let n=D(e);for(let o of n)if(o.name===t)return o;return null}function bn(e,t){let n=D(e);for(let o of n)if(t.includes(o.name||""))return o;return null}function Qe(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 et(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 tt(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 yn(e){if(!e)return;let t=s(e,null,"relativeFrom")??"column",n=I(e,"wp:align");if(n){let r=n.elements?.[0]?.text??null;return {relativeTo:t,alignment:r}}let o=I(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 xn(e){if(!e)return;let t=s(e,null,"relativeFrom")??"paragraph",n=I(e,"wp:align");if(n){let r=n.elements?.[0]?.text??null;return {relativeTo:t,alignment:r}}let o=I(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 Tn=["wp:wrapNone","wp:wrapSquare","wp:wrapTight","wp:wrapThrough","wp:wrapTopAndBottom"];function Fn(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,c=g(e,null,"distR")??void 0,u=s(e,null,"wrapText")??void 0,f;switch(o){case "wrapNone":f=t?"behind":"inFront";break;case "wrapSquare":f="square";break;case "wrapTight":f="tight";break;case "wrapThrough":f="through";break;case "wrapTopAndBottom":f="topAndBottom";break;default:f="square";}let d={type:f};return u&&(d.wrapText=u),r!==void 0&&(d.distT=r),i!==void 0&&(d.distB=i),a!==void 0&&(d.distL=a),c!==void 0&&(d.distR=c),d}function nt(e){if(!e)return;let t=s(e,null,"rot"),n=s(e,null,"flipH")==="1",o=s(e,null,"flipV")==="1",r=wn(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 ot(e){let t=I(e,"a:graphic");if(!t)return null;let n=I(t,"a:graphicData");if(!n)return null;let o=I(n,"pic:pic");if(!o)return null;let r=I(o,"pic:blipFill");return r?I(r,"a:blip"):null}function rt(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 it(e){let t=I(e,"a:graphic");if(!t)return null;let n=I(t,"a:graphicData");if(!n)return null;let o=I(n,"pic:pic");if(!o)return null;let r=I(o,"pic:spPr");return r?I(r,"a:xfrm"):null}function Cn(e){if(!e)return e;let t=e.replace(/^\/+/,"");return t.startsWith("media/")?t=`word/${t}`:t.startsWith("word/")||(t=`word/${t}`),t}function Sn(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 at(e,t,n){if(!e||!t)return {};let o=t.get(e);if(!o)return {};let r=o.target;if(!r)return {};let i=Cn(r),a=r.split("/").pop(),c=(u,f)=>{let d=f.toLowerCase();for(let[p,x]of u.entries())if(p.toLowerCase()===d)return x};if(n){let u=c(n,i);if(u)return {src:u.dataUrl||u.base64,mimeType:u.mimeType,filename:a};let f=r.replace(/^\/+/,""),d=c(n,f);if(d)return {src:d.dataUrl||d.base64,mimeType:d.mimeType,filename:a};let p=`word/${f}`,x=c(n,p);if(x)return {src:x.dataUrl||x.base64,mimeType:x.mimeType,filename:a}}return {mimeType:Sn(r),filename:a}}function kn(e,t,n){let o=I(e,"wp:extent"),r=Qe(o),i=I(e,"wp:effectExtent"),a=et(i),c=I(e,"wp:docPr"),u=tt(c),f=ot(e),d=rt(f),p=at(d,t,n),x=it(e),b=nt(x),m={type:"image",rId:d,size:r,wrap:{type:"inline"}};return u.id&&(m.id=u.id),u.alt&&(m.alt=u.alt),u.title&&(m.title=u.title),u.decorative&&(m.decorative=true),p.src&&(m.src=p.src),p.mimeType&&(m.mimeType=p.mimeType),p.filename&&(m.filename=p.filename),a&&(m.padding=a),b&&(m.transform=b),m}function Mn(e,t,n){let o=I(e,"wp:extent"),r=Qe(o),i=I(e,"wp:effectExtent"),a=et(i),c=I(e,"wp:docPr"),u=tt(c),f=s(e,null,"behindDoc")==="1",d=bn(e,Tn),p=Fn(d,f),x=I(e,"wp:positionH"),b=I(e,"wp:positionV"),m=yn(x),y=xn(b),B;(m||y)&&(B={horizontal:m??{relativeTo:"column"},vertical:y??{relativeTo:"paragraph"}});let R=ot(e),E=rt(R),C=at(E,t,n),h=it(e),F=nt(h),w={type:"image",rId:E,size:r,wrap:p};return u.id&&(w.id=u.id),u.alt&&(w.alt=u.alt),u.title&&(w.title=u.title),u.decorative&&(w.decorative=true),C.src&&(w.src=C.src),C.mimeType&&(w.mimeType=C.mimeType),C.filename&&(w.filename=C.filename),B&&(w.position=B),a&&(w.padding=a),F&&(w.transform=F),w}function vn(e,t,n){let o=D(e);for(let r of o){let i=r.name||"";if(i==="wp:inline")return kn(r,t,n);if(i==="wp:anchor")return Mn(r,t,n)}return null}function st(e,t,n){return vn(e,t,n)}function lt(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 En(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 c=s(e,"w","val");return c&&(t.pattern=c),Object.keys(t).length>0?t:void 0}function Me(e,t,n){if(!e)return;let o={},r=l(e,"w","b");r&&(o.bold=T(r));let i=l(e,"w","bCs");i&&(o.boldCs=T(i));let a=l(e,"w","i");a&&(o.italic=T(a));let c=l(e,"w","iCs");c&&(o.italicCs=T(c));let u=l(e,"w","u");if(u){let S=s(u,"w","val");if(S){o.underline={style:S};let j=s(u,"w","color"),$=s(u,"w","themeColor");(j||$)&&(o.underline.color=lt(j,$,s(u,"w","themeTint"),s(u,"w","themeShade")));}}let f=l(e,"w","strike");f&&(o.strike=T(f));let d=l(e,"w","dstrike");d&&(o.doubleStrike=T(d));let p=l(e,"w","vertAlign");if(p){let S=s(p,"w","val");(S==="superscript"||S==="subscript"||S==="baseline")&&(o.vertAlign=S);}let x=l(e,"w","smallCaps");x&&(o.smallCaps=T(x));let b=l(e,"w","caps");b&&(o.allCaps=T(b));let m=l(e,"w","vanish");m&&(o.hidden=T(m));let y=l(e,"w","color");y&&(o.color=lt(s(y,"w","val"),s(y,"w","themeColor"),s(y,"w","themeTint"),s(y,"w","themeShade")));let B=l(e,"w","highlight");if(B){let S=s(B,"w","val");S&&(o.highlight=S);}let R=l(e,"w","shd");R&&(o.shading=En(R));let E=l(e,"w","sz");if(E){let S=g(E,"w","val");S!==void 0&&(o.fontSize=S);}let C=l(e,"w","szCs");if(C){let S=g(C,"w","val");S!==void 0&&(o.fontSizeCs=S);}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 S=s(h,"w","asciiTheme");S&&(o.fontFamily.asciiTheme=S,t&&!o.fontFamily.ascii&&(o.fontFamily.ascii=U(t,S)));let j=s(h,"w","hAnsiTheme");j&&(o.fontFamily.hAnsiTheme=j,t&&!o.fontFamily.hAnsi&&(o.fontFamily.hAnsi=U(t,j)));let $=s(h,"w","eastAsiaTheme");$&&(o.fontFamily.eastAsiaTheme=$,t&&!o.fontFamily.eastAsia&&(o.fontFamily.eastAsia=U(t,$)));let we=s(h,"w","cstheme");we&&(o.fontFamily.csTheme=we,t&&!o.fontFamily.cs&&(o.fontFamily.cs=U(t,we)));}let F=l(e,"w","spacing");if(F){let S=g(F,"w","val");S!==void 0&&(o.spacing=S);}let w=l(e,"w","position");if(w){let S=g(w,"w","val");S!==void 0&&(o.position=S);}let k=l(e,"w","w");if(k){let S=g(k,"w","val");S!==void 0&&(o.scale=S);}let v=l(e,"w","kern");if(v){let S=g(v,"w","val");S!==void 0&&(o.kerning=S);}let P=l(e,"w","effect");if(P){let S=s(P,"w","val");S&&(o.effect=S);}let A=l(e,"w","em");if(A){let S=s(A,"w","val");S&&(o.emphasisMark=S);}let X=l(e,"w","emboss");X&&(o.emboss=T(X));let O=l(e,"w","imprint");O&&(o.imprint=T(O));let K=l(e,"w","outline");K&&(o.outline=T(K));let L=l(e,"w","shadow");L&&(o.shadow=T(L));let H=l(e,"w","rtl");H&&(o.rtl=T(H));let _=l(e,"w","cs");_&&(o.cs=T(_));let M=l(e,"w","rStyle");if(M){let S=s(M,"w","val");S&&(o.styleId=S);}return Object.keys(o).length>0?o:void 0}function Rn(e){let t=re(e),n=s(e,"xml","space")==="preserve";return {type:"text",text:t,preserveSpace:n||void 0}}function Pn(){return {type:"tab"}}function An(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 Bn(e){let t=s(e,"w","font")??"",n=s(e,"w","char")??"";return {type:"symbol",font:t,char:n}}function Nn(e){return {type:"footnoteRef",id:g(e,"w","id")??0}}function Xn(e){return {type:"endnoteRef",id:g(e,"w","id")??0}}function In(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 Ln(e){return {type:"instrText",text:re(e)}}function Dn(e,t,n){let o=st(e,t??void 0,n??void 0);return o?{type:"drawing",image:o}:null}function Hn(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function On(e,t,n){let o=[],r=D(e);for(let i of r)switch(Hn(i.name)){case "t":o.push(Rn(i));break;case "tab":o.push(Pn());break;case "br":o.push(An(i));break;case "sym":o.push(Bn(i));break;case "footnoteReference":o.push(Nn(i));break;case "endnoteReference":o.push(Xn(i));break;case "fldChar":o.push(In(i));break;case "instrText":o.push(Ln(i));break;case "softHyphen":o.push({type:"softHyphen"});break;case "noBreakHyphen":o.push({type:"noBreakHyphen"});break;case "drawing":let c=Dn(i,t,n);c&&o.push(c);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=Me(a,n)),i.content=On(e,o,r),i}function jn(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function Wn(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 Vn(e){return {type:"bookmarkEnd",id:g(e,"w","id")??0}}function ct(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&&(He(b),i.href=b.target);}let c=s(e,"w","anchor");c&&(i.anchor=c,i.href||(i.href=`#${c}`));let u=s(e,"w","tooltip");u&&(i.tooltip=u);let f=s(e,"w","tgtFrame");f&&(i.target=f);let d=s(e,"w","history");(d==="1"||d==="true")&&(i.history=true);let p=s(e,"w","docLocation");p&&(i.docLocation=p);let x=D(e);for(let b of x)switch(jn(b.name)){case "r":i.children.push(ee(b,n,o,t,r));break;case "bookmarkStart":i.children.push(Wn(b));break;case "bookmarkEnd":i.children.push(Vn(b));break}return i}function ut(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 zn(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 Y(e){return zn(e)}function J(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=De(e);a&&(o.color={rgb:a.val,themeColor:a.themeColor,themeTint:a.themeTint,themeShade:a.themeShade});let c=s(e,"w","shadow");(c==="1"||c==="true")&&(o.shadow=true);let u=s(e,"w","frame");return (u==="1"||u==="true")&&(o.frame=true),o}function dt(e){if(!e)return;let t={},n=J(l(e,"w","top"));n&&(t.top=n);let o=J(l(e,"w","bottom"));o&&(t.bottom=o);let r=J(l(e,"w","left")??l(e,"w","start"));r&&(t.left=r);let i=J(l(e,"w","right")??l(e,"w","end"));i&&(t.right=i);let a=J(l(e,"w","insideH"));a&&(t.insideH=a);let c=J(l(e,"w","insideV"));if(c&&(t.insideV=c),Object.keys(t).length!==0)return t}function pt(e){if(!e)return;let t={},n=Y(l(e,"w","top"));n&&(t.top=n);let o=Y(l(e,"w","bottom"));o&&(t.bottom=o);let r=Y(l(e,"w","left")??l(e,"w","start"));r&&(t.left=r);let i=Y(l(e,"w","right")??l(e,"w","end"));if(i&&(t.right=i),Object.keys(t).length!==0)return t}function mt(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 c=s(e,"w","themeFillShade");c&&t.fill&&(t.fill.themeShade=c);}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 $n(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 c=s(e,"w","noVBand");(c==="1"||c==="true")&&(t.noVBand=true);let u=s(e,"w","val");if(u){let f=parseInt(u,16);isNaN(f)||(f&32&&(t.firstRow=true),f&64&&(t.lastRow=true),f&128&&(t.firstColumn=true),f&256&&(t.lastColumn=true),f&512&&(t.noHBand=true),f&1024&&(t.noVBand=true));}if(Object.keys(t).length!==0)return t}function Un(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 c=s(e,"w","tblpYSpec");c&&(t.tblpYSpec=c);let u=g(e,"w","topFromText");u!==void 0&&(t.topFromText=u);let f=g(e,"w","bottomFromText");f!==void 0&&(t.bottomFromText=f);let d=g(e,"w","leftFromText");d!==void 0&&(t.leftFromText=d);let p=g(e,"w","rightFromText");if(p!==void 0&&(t.rightFromText=p),Object.keys(t).length!==0)return t}function _n(e){if(!e)return;let t={},n=Y(l(e,"w","tblW"));n&&(t.width=n);let o=l(e,"w","jc");if(o){let y=s(o,"w","val");(y==="left"||y==="center"||y==="right"||y==="start")&&(t.justification=y==="start"?"left":y);}let r=Y(l(e,"w","tblCellSpacing"));r&&(t.cellSpacing=r);let i=Y(l(e,"w","tblInd"));i&&(t.indent=i);let a=dt(l(e,"w","tblBorders"));a&&(t.borders=a);let c=pt(l(e,"w","tblCellMar"));c&&(t.cellMargins=c);let u=l(e,"w","tblLayout");if(u){let y=s(u,"w","type");(y==="fixed"||y==="autofit")&&(t.layout=y);}let f=l(e,"w","tblStyle");if(f){let y=s(f,"w","val");y&&(t.styleId=y);}let d=$n(l(e,"w","tblLook"));d&&(t.look=d);let p=mt(l(e,"w","shd"));p&&(t.shading=p);let x=l(e,"w","tblOverlap");if(x){let y=s(x,"w","val");(y==="never"||y==="overlap")&&(t.overlap=y);}let b=Un(l(e,"w","tblpPr"));if(b&&(t.floating=b),T(l(e,"w","bidiVisual"))&&(t.bidi=true),Object.keys(t).length!==0)return t}function Gn(e){if(!e)return;let t={},n=l(e,"w","trHeight");if(n){let c=Y(n);c&&(t.height=c);let u=s(n,"w","hRule");(u==="auto"||u==="atLeast"||u==="exact")&&(t.heightRule=u);}T(l(e,"w","tblHeader"))&&(t.header=true),T(l(e,"w","cantSplit"))&&(t.cantSplit=true);let i=l(e,"w","jc");if(i){let c=s(i,"w","val");(c==="left"||c==="center"||c==="right")&&(t.justification=c);}if(T(l(e,"w","hidden"))&&(t.hidden=true),Object.keys(t).length!==0)return t}function qn(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 c=s(e,"w","evenHBand");(c==="1"||c==="true")&&(t.evenHBand=true);let u=s(e,"w","oddVBand");(u==="1"||u==="true")&&(t.oddVBand=true);let f=s(e,"w","evenVBand");(f==="1"||f==="true")&&(t.evenVBand=true);let d=s(e,"w","firstRowFirstColumn");(d==="1"||d==="true")&&(t.nwCell=true);let p=s(e,"w","firstRowLastColumn");(p==="1"||p==="true")&&(t.neCell=true);let x=s(e,"w","lastRowFirstColumn");(x==="1"||x==="true")&&(t.swCell=true);let b=s(e,"w","lastRowLastColumn");(b==="1"||b==="true")&&(t.seCell=true);let m=s(e,"w","val");if(m&&m.length===12&&(m[0]==="1"&&(t.firstRow=true),m[1]==="1"&&(t.lastRow=true),m[2]==="1"&&(t.firstColumn=true),m[3]==="1"&&(t.lastColumn=true),m[4]==="1"&&(t.oddVBand=true),m[5]==="1"&&(t.evenVBand=true),m[6]==="1"&&(t.oddHBand=true),m[7]==="1"&&(t.evenHBand=true),m[8]==="1"&&(t.nwCell=true),m[9]==="1"&&(t.neCell=true),m[10]==="1"&&(t.swCell=true),m[11]==="1"&&(t.seCell=true)),Object.keys(t).length!==0)return t}function Zn(e){if(!e)return;let t={},n=Y(l(e,"w","tcW"));n&&(t.width=n);let o=dt(l(e,"w","tcBorders"));o&&(t.borders=o);let r=pt(l(e,"w","tcMar"));r&&(t.margins=r);let i=mt(l(e,"w","shd"));i&&(t.shading=i);let a=l(e,"w","vAlign");if(a){let m=s(a,"w","val");(m==="top"||m==="center"||m==="bottom")&&(t.verticalAlign=m);}let c=l(e,"w","textDirection");if(c){let m=s(c,"w","val");m&&(t.textDirection=m);}let u=l(e,"w","gridSpan");if(u){let m=g(u,"w","val");m!==void 0&&m>1&&(t.gridSpan=m);}let f=l(e,"w","vMerge");f&&(s(f,"w","val")==="restart"?t.vMerge="restart":t.vMerge="continue"),T(l(e,"w","tcFitText"))&&(t.fitText=true),T(l(e,"w","noWrap"))&&(t.noWrap=true),T(l(e,"w","hideMark"))&&(t.hideMark=true);let b=qn(l(e,"w","cnfStyle"));if(b&&(t.conditionalFormat=b),Object.keys(t).length!==0)return t}function Yn(e,t,n,o,r,i){let a=[],c=e.elements||[];for(let u of c){if(!u.name)continue;let f=u.name.split(":").pop();if(f==="p"){let d=z(u,t,n,o,r,i);a.push(d);}else if(f==="tbl"){let d=te(u,t,n,o,r,i);a.push(d);}}return a.length===0&&a.push({type:"paragraph",content:[]}),a}function Kn(e,t,n,o,r,i){let a={type:"tableCell",content:[]},c=Zn(l(e,"w","tcPr"));return c&&(a.formatting=c),a.content=Yn(e,t,n,o,r,i),a}function Jn(e,t,n,o,r,i){let a={type:"tableRow",cells:[]},c=Gn(l(e,"w","trPr"));c&&(a.formatting=c);let u=N(e,"w","tc");for(let f of u){let d=Kn(f,t,n,o,r,i);a.cells.push(d);}return a}function Qn(e){if(!e)return;let t=[],n=N(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:[]},c=_n(l(e,"w","tblPr"));c&&(a.formatting=c);let u=Qn(l(e,"w","tblGrid"));u&&(a.columnWidths=u);let f=N(e,"w","tr");for(let d of f){let p=Jn(d,t,n,o,r,i);a.rows.push(p);}return a}function gt(e){switch(e){case "first":return "first";case "even":return "even";default:return "default"}}function ht(e){let t=s(e,"w","type"),n=s(e,"r","id")??"";return {type:gt(t),rId:n}}function wt(e){let t=s(e,"w","type"),n=s(e,"r","id")??"";return {type:gt(t),rId:n}}function ve(e,t,n,o,r,i){let a=[],c=e.elements??[];for(let u of c){if(u.type!=="element")continue;let f=u.name??"";if(f==="w:p"||f.endsWith(":p")){let d=z(u,t,n,o,r,i);a.push(d);}else if(f==="w:tbl"||f.endsWith(":tbl")){let d=te(u,t,n,o,r,i);a.push(d);}else if(f==="w:sdt"||f.endsWith(":sdt")){let d=(u.elements??[]).find(p=>p.type==="element"&&(p.name==="w:sdtContent"||p.name?.endsWith(":sdtContent")));if(d){let p=ve(d,t,n,o,r,i);a.push(...p);}}}return a}function bt(e,t="default",n=null,o=null,r=null,i=null,a=null){let c={type:"header",hdrFtrType:t,content:[]};if(!e)return c;let u=V(e);if(!u)return c;let f=u.elements?.find(d=>d.type==="element"&&(d.name==="w:hdr"||d.name?.endsWith(":hdr")));return f&&(c.content=ve(f,n,o,r,i,a)),c}function yt(e,t="default",n=null,o=null,r=null,i=null,a=null){let c={type:"footer",hdrFtrType:t,content:[]};if(!e)return c;let u=V(e);if(!u)return c;let f=u.elements?.find(d=>d.type==="element"&&(d.name==="w:ftr"||d.name?.endsWith(":ftr")));return f&&(c.content=ve(f,n,o,r,i,a)),c}function xt(e){switch(e){case "separator":return "separator";case "continuationSeparator":return "continuationSeparator";case "continuationNotice":return "continuationNotice";default:return "normal"}}function eo(e,t,n,o,r,i){let a=g(e,"w","id")??0,c=s(e,"w","type"),u=xt(c),d=N(e,"w","p").map(p=>z(p,t,n,o,r));return {type:"footnote",id:a,noteType:u,content:d}}function Tt(e,t=null,n=null,o=null,r=null,i=null){let a=new Map,c=[];if(!e)return ue(a,c);let u=V(e);if(!u)return ue(a,c);let f=u.elements?.find(p=>p.type==="element"&&(p.name==="w:footnotes"||p.name?.endsWith(":footnotes")));if(!f)return ue(a,c);let d=N(f,"w","footnote");for(let p of d){let x=eo(p,t,n,o,r);a.set(x.id,x),c.push(x);}return ue(a,c)}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 to(e,t,n,o,r,i){let a=g(e,"w","id")??0,c=s(e,"w","type"),u=xt(c),d=N(e,"w","p").map(p=>z(p,t,n,o,r));return {type:"endnote",id:a,noteType:u,content:d}}function Ft(e,t=null,n=null,o=null,r=null,i=null){let a=new Map,c=[];if(!e)return fe(a,c);let u=V(e);if(!u)return fe(a,c);let f=u.elements?.find(p=>p.type==="element"&&(p.name==="w:endnotes"||p.name?.endsWith(":endnotes")));if(!f)return fe(a,c);let d=N(f,"w","endnote");for(let p of d){let x=to(p,t,n,o,r);a.set(x.id,x),c.push(x);}return fe(a,c)}function fe(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 Ct(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 no(e){switch(e){case "pageBottom":return "pageBottom";case "beneathText":return "beneathText";case "sectEnd":return "sectEnd";case "docEnd":return "docEnd";default:return}}function oo(e){switch(e){case "sectEnd":return "sectEnd";case "docEnd":return "docEnd";default:return}}function St(e){switch(e){case "continuous":return "continuous";case "eachSect":return "eachSect";case "eachPage":return "eachPage";default:return}}function kt(e){let t={};if(!e)return t;let n=l(e,"w","pos");if(n){let a=s(n,"w","val");t.position=no(a);}let o=l(e,"w","numFmt");if(o){let a=s(o,"w","val");t.numFmt=Ct(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=St(a);}return t}function Mt(e){let t={};if(!e)return t;let n=l(e,"w","pos");if(n){let a=s(n,"w","val");t.position=oo(a);}let o=l(e,"w","numFmt");if(o){let a=s(o,"w","val");t.numFmt=Ct(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=St(a);}return t}function ro(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"),c=s(e,"w","themeColor"),u=s(e,"w","themeTint"),f=s(e,"w","themeShade"),d=ro(a,c,u,f);d&&(o.color=d);let p=s(e,"w","shadow");(p==="1"||p==="true")&&(o.shadow=true);let x=s(e,"w","frame");return (x==="1"||x==="true")&&(o.frame=true),o}function io(e){switch(e){case "landscape":return "landscape";case "portrait":return "portrait";default:return}}function ao(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 so(e){switch(e){case "top":return "top";case "center":return "center";case "both":return "both";case "bottom":return "bottom";default:return}}function lo(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"),k=io(w);k&&(n.orientation=k);}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 k=g(r,"w","right");k!==void 0&&(n.marginRight=k);let v=g(r,"w","header");v!==void 0&&(n.headerDistance=v);let P=g(r,"w","footer");P!==void 0&&(n.footerDistance=P);let A=g(r,"w","gutter");A!==void 0&&(n.gutter=A);}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 k=s(i,"w","sep");(k==="1"||k==="true")&&(n.separator=true);let v=N(i,"w","col");if(v.length>0){n.columns=[];for(let P of v){let A={},X=g(P,"w","w");X!==void 0&&(A.width=X);let O=g(P,"w","space");O!==void 0&&(A.space=O),n.columns.push(A);}}}let a=l(e,"w","type");if(a){let h=s(a,"w","val"),F=ao(h);F&&(n.sectionStart=F);}let c=l(e,"w","vAlign");if(c){let h=s(c,"w","val"),F=so(h);F&&(n.verticalAlign=F);}let u=l(e,"w","bidi");u&&(n.bidi=T(u));let f=N(e,"w","headerReference");f.length>0&&(n.headerReferences=f.map(h=>ht(h)));let d=N(e,"w","footerReference");d.length>0&&(n.footerReferences=d.map(h=>wt(h)));let p=l(e,"w","titlePg");p&&(n.titlePg=T(p));let x=l(e,"w","evenAndOddHeaders");x&&(n.evenAndOddHeaders=T(x));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 k=s(b,"w","restart"),v=lo(k);v&&(n.lineNumbers.restart=v);}let m=l(e,"w","pgBorders");if(m){n.pageBorders={};let h=de(l(m,"w","top"));h&&(n.pageBorders.top=h);let F=de(l(m,"w","bottom"));F&&(n.pageBorders.bottom=F);let w=de(l(m,"w","left"));w&&(n.pageBorders.left=w);let k=de(l(m,"w","right"));k&&(n.pageBorders.right=k);let v=s(m,"w","display");(v==="allPages"||v==="firstPage"||v==="notFirstPage")&&(n.pageBorders.display=v);let P=s(m,"w","offsetFrom");(P==="page"||P==="text")&&(n.pageBorders.offsetFrom=P);let A=s(m,"w","zOrder");(A==="front"||A==="back")&&(n.pageBorders.zOrder=A);}let y=l(e,"w","background");if(y){n.background={};let h=s(y,"w","color");h&&h!=="auto"&&(n.background.color={rgb:h});let F=s(y,"w","themeColor");F&&(n.background.themeColor=F);let w=s(y,"w","themeTint");w&&(n.background.themeTint=w);let k=s(y,"w","themeShade");k&&(n.background.themeShade=k);}let B=l(e,"w","footnotePr");if(B){let h=kt(B);Object.keys(h).length>0&&(n.footnotePr=h);}let R=l(e,"w","endnotePr");if(R){let h=Mt(R);Object.keys(h).length>0&&(n.endnotePr=h);}let E=l(e,"w","docGrid");if(E){n.docGrid={};let h=s(E,"w","type");(h==="default"||h==="lines"||h==="linesAndChars"||h==="snapToChars")&&(n.docGrid.type=h);let F=g(E,"w","linePitch");F!==void 0&&(n.docGrid.linePitch=F);let w=g(E,"w","charSpace");w!==void 0&&(n.docGrid.charSpace=w);}let C=l(e,"w","paperSrc");if(C){let h=g(C,"w","first");h!==void 0&&(n.paperSrcFirst=h);let F=g(C,"w","other");F!==void 0&&(n.paperSrcOther=F);}return n}function vt(){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 co(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||!uo(e.underline,t.underline)||!me(e.color,t.color)||!fo(e.shading,t.shading)||!po(e.fontFamily,t.fontFamily))}function uo(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 fo(e,t){return !e&&!t?true:!(!e||!t||e.pattern!==t.pattern||!me(e.color,t.color)||!me(e.fill,t.fill))}function po(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 mo(e){return e.type==="text"||e.type==="softHyphen"||e.type==="noBreakHyphen"}function Et(e){return e.content.length===0?true:e.content.every(mo)}function go(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 ho(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}Et(n)&&Et(o)&&co(n.formatting,o.formatting)?n={type:"run",formatting:n.formatting,content:go(n.content,o.content)}:(t.push(n),n={...o,content:[...o.content]});}return n!==null&&t.push(n),t}function Ee(e){if(e.length<=1)return e;let t=[],n=[];function o(){if(n.length>0){let r=ho(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:Ee(r.children)};t.push(i);}else t.push(r);return o(),t}function wo(e){let t={sdtType:"richText"};if(!e||!e.elements)return t;for(let n of e.elements){if(n.type!=="element")continue;switch(n.name?.replace(/^w:/,"")??""){case "alias":t.alias=s(n,"w","val")??void 0;break;case "tag":t.tag=s(n,"w","val")??void 0;break;case "lock":t.lock=s(n,"w","val")??"unlocked";break;case "placeholder":{let r=l(n,"w","docPart");if(r){let i=l(r,"w","val");t.placeholder=i?s(i,"w","val")??void 0:void 0;}break}case "showingPlcHdr":t.showingPlaceholder=true;break;case "text":t.sdtType="plainText";break;case "date":t.sdtType="date",t.dateFormat=s(n,"w","fullDate")??void 0;break;case "dropDownList":t.sdtType="dropdown",t.listItems=Rt(n);break;case "comboBox":t.sdtType="comboBox",t.listItems=Rt(n);break;case "checkbox":{t.sdtType="checkbox";let r=l(n,"w14","checked")??l(n,"w","checked");t.checked=r?s(r,"w14","val")==="1"||s(r,"w","val")==="1":false;break}case "picture":t.sdtType="picture";break;case "docPartObj":t.sdtType="buildingBlockGallery";break;case "group":t.sdtType="group";break}}return t}function Rt(e){let t=[];for(let n of e.elements??[])n.type==="element"&&(n.name==="w:listItem"||n.name?.endsWith(":listItem"))&&t.push({displayText:s(n,"w","displayText")??"",value:s(n,"w","value")??""});return t}function Pt(e){let t="";if(e.type==="text"&&typeof e.text=="string")return e.text;if(e.elements)for(let n of e.elements)if((n.name?.replace(/^.*:/,"")??"")==="t"&&n.elements)for(let r of n.elements)r.type==="text"&&typeof r.text=="string"&&(t+=r.text);else t+=Pt(n);return t}function bo(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 yo(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 c=s(e,"w","val");return c&&(t.pattern=c),Object.keys(t).length>0?t:void 0}function Q(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=bo(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 c=s(e,"w","shadow");c&&(n.shadow=c==="1"||c==="true");let u=s(e,"w","frame");return u&&(n.frame=u==="1"||u==="true"),n}function xo(e){if(!e)return;let t=N(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},c=s(o,"w","leader");c&&(a.leader=c),n.push(a);}}return n.length>0?n:void 0}function To(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 c=g(e,"w","y");c!==void 0&&(t.y=c);let u=s(e,"w","xAlign");u&&(t.xAlign=u);let f=s(e,"w","yAlign");f&&(t.yAlign=f);let d=s(e,"w","wrap");return d&&(t.wrap=d),Object.keys(t).length>0?t:void 0}function Fo(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=T(i));let a=l(e,"w","spacing");if(a){let w=g(a,"w","before");w!==void 0&&(o.spaceBefore=w);let k=g(a,"w","after");k!==void 0&&(o.spaceAfter=k);let v=g(a,"w","line");v!==void 0&&(o.lineSpacing=v);let P=s(a,"w","lineRule");P&&(o.lineSpacingRule=P);let A=s(a,"w","beforeAutospacing");A&&(o.beforeAutospacing=A==="1"||A==="true");let X=s(a,"w","afterAutospacing");X&&(o.afterAutospacing=X==="1"||X==="true");}let c=l(e,"w","ind");if(c){let w=g(c,"w","left");w!==void 0&&(o.indentLeft=w);let k=g(c,"w","right");k!==void 0&&(o.indentRight=k);let v=g(c,"w","firstLine");v!==void 0&&(o.indentFirstLine=v);let P=g(c,"w","hanging");P!==void 0&&(o.indentFirstLine=-P,o.hangingIndent=true);let A=g(c,"w","start");A!==void 0&&o.indentLeft===void 0&&(o.indentLeft=A);let X=g(c,"w","end");X!==void 0&&o.indentRight===void 0&&(o.indentRight=X);}let u=l(e,"w","pBdr");if(u){let w={},k=Q(l(u,"w","top"));k&&(w.top=k);let v=Q(l(u,"w","bottom"));v&&(w.bottom=v);let P=Q(l(u,"w","left"));P&&(w.left=P);let A=Q(l(u,"w","right"));A&&(w.right=A);let X=Q(l(u,"w","between"));X&&(w.between=X);let O=Q(l(u,"w","bar"));O&&(w.bar=O),Object.keys(w).length>0&&(o.borders=w);}let f=l(e,"w","shd");f&&(o.shading=yo(f));let d=l(e,"w","tabs");d&&(o.tabs=xo(d));let p=l(e,"w","keepNext");p&&(o.keepNext=T(p));let x=l(e,"w","keepLines");x&&(o.keepLines=T(x));let b=l(e,"w","widowControl");b&&(o.widowControl=T(b));let m=l(e,"w","pageBreakBefore");m&&(o.pageBreakBefore=T(m));let y=l(e,"w","numPr");if(y){let w=l(y,"w","numId"),k=l(y,"w","ilvl");if(w||k){if(o.numPr={},w){let v=g(w,"w","val");v!==void 0&&(o.numPr.numId=v);}if(k){let v=g(k,"w","val");v!==void 0&&(o.numPr.ilvl=v);}}}let B=l(e,"w","outlineLvl");if(B){let w=g(B,"w","val");w!==void 0&&(o.outlineLevel=w);}let R=l(e,"w","pStyle");if(R){let w=s(R,"w","val");w&&(o.styleId=w);}let E=l(e,"w","framePr");E&&(o.frame=To(E));let C=l(e,"w","suppressLineNumbers");C&&(o.suppressLineNumbers=T(C));let h=l(e,"w","suppressAutoHyphens");h&&(o.suppressAutoHyphens=T(h));let F=l(e,"w","rPr");return F&&(o.runProperties=Me(F,t)),Object.keys(o).length>0?o:void 0}function At(e){if(!e)return "";let t=e.indexOf(":");return t>=0?e.substring(t+1):e}function Co(e,t,n,o,r){return ct(e,t,n,o,r)}function So(e){return ut(e)}function ko(e){return ft(e)}function Bt(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 Mo(e,t,n,o,r){let i=s(e,"w","instr")??"",a=Bt(i),c={type:"simpleField",instruction:i,fieldType:a,content:[]},u=s(e,"w","fldLock");(u==="1"||u==="true")&&(c.fldLock=true);let f=s(e,"w","dirty");(f==="1"||f==="true")&&(c.dirty=true);let d=D(e);for(let p of d)At(p.name)==="r"&&c.content.push(ee(p,t,n,o,r));return c}function ge(e,t,n,o,r,i){let a=[],c=D(e),u=false,f="",d=[],p=[],x=false,b=false,m=false;for(let y of c){let B=At(y.name);switch(B){case "r":{let R=ee(y,t,n,r,i),E=false,C=false,h=false,F="";for(let w of R.content)w.type==="fieldChar"?w.charType==="begin"?(E=true,w.fldLock&&(b=true),w.dirty&&(m=true)):w.charType==="separate"?C=true:w.charType==="end"&&(h=true):w.type==="instrText"&&(F+=w.text);if(E&&(u=true,x=false,f="",d=[],p=[],b=false,m=false),u){if(F&&(f+=F),C&&(x=true),x&&!h?C||p.push(R):!x&&!E&&d.push(R),h){let w={type:"complexField",instruction:f.trim(),fieldType:Bt(f),fieldCode:d,fieldResult:p};b&&(w.fldLock=true),m&&(w.dirty=true),a.push(w),u=false;}}else a.push(R);break}case "hyperlink":a.push(Co(y,r,t,n,i));break;case "bookmarkStart":a.push(So(y));break;case "bookmarkEnd":a.push(ko(y));break;case "fldSimple":a.push(Mo(y,t,n,r,i));break;case "pPr":break;case "proofErr":case "permStart":case "permEnd":case "customXml":break;case "sdt":{let R=(y.elements??[]).find(C=>C.type==="element"&&(C.name==="w:sdtPr"||C.name?.endsWith(":sdtPr"))),E=(y.elements??[]).find(C=>C.type==="element"&&(C.name==="w:sdtContent"||C.name?.endsWith(":sdtContent")));if(E){let C=ge(E,t,n,null,r,i),F={type:"inlineSdt",properties:wo(R??null),content:C.filter(w=>w.type==="run"||w.type==="hyperlink")};a.push(F);}break}case "ins":{let R={id:parseInt(s(y,"w","id")??"0",10),author:s(y,"w","author")??"Unknown",date:s(y,"w","date")??void 0},E=ge(y,t,n,null,r,i),C={type:"insertion",info:R,content:E.filter(h=>h.type==="run"||h.type==="hyperlink")};a.push(C);break}case "del":{let R={id:parseInt(s(y,"w","id")??"0",10),author:s(y,"w","author")??"Unknown",date:s(y,"w","date")??void 0},E=ge(y,t,n,null,r,i),C={type:"deletion",info:R,content:E.filter(h=>h.type==="run"||h.type==="hyperlink")};a.push(C);break}case "smartTag":case "moveTo":case "moveFrom":break;case "commentRangeStart":{let R=parseInt(s(y,"w","id")??"0",10);a.push({type:"commentRangeStart",id:R});break}case "commentRangeEnd":{let R=parseInt(s(y,"w","id")??"0",10);a.push({type:"commentRangeEnd",id:R});break}case "oMath":case "oMathPara":{let R=B==="oMathPara",E=Le(y),C=Pt(y),h={type:"mathEquation",display:R?"block":"inline",ommlXml:E,plainText:C||void 0};a.push(h);break}}}return a}function z(e,t,n,o,r=null,i=null){let a={type:"paragraph",content:[]},c=s(e,"w14","paraId")??s(e,"w","paraId");c&&(a.paraId=c);let u=s(e,"w14","textId")??s(e,"w","textId");u&&(a.textId=u);let f=l(e,"w","pPr");if(f){a.formatting=Fo(f,n);let p=l(f,"w","sectPr");p&&(a.sectionProperties=pe(p));}let d=ge(e,t,n,o,r,i);if(a.content=Ee(d),a.formatting?.numPr&&o){let{numId:p,ilvl:x=0}=a.formatting.numPr;if(p!==void 0&&p!==0){let b=o.getLevel(p,x);b&&(a.listRendering={level:x,numId:p,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 vo(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 Eo(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 f=i+1;f<a.length;f++)a[f]=0;let c=o.marker;if(o.isBullet){let f=c||"";o.marker=vo(f);return}let u=c;for(let f=0;f<=i;f++){let d=`%${f+1}`;if(u.includes(d)){let p=a[f],x=t.getLevel(r,f),b=Ro(p,x?.numFmt||"decimal");u=u.replace(d,b);}}o.marker=u;}function Ro(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 Nt(e).toLowerCase();case "upperRoman":return Nt(e);case "bullet":return "\u2022";default:return String(e)}}function Nt(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 Xt=/\{\{([^{}]+)\}\}/g;function It(e){let t=[],n;for(Xt.lastIndex=0;(n=Xt.exec(e))!==null;){let o=n[1].trim();o&&!t.includes(o)&&t.push(o);}return t}function Lt(e){let t=[];for(let n of e)if(n.type==="paragraph"){let o=Re(n),r=It(o);for(let i of r)t.includes(i)||t.push(i);}else if(n.type==="table"){let o=Dt(n);for(let r of o)t.includes(r)||t.push(r);}return t}function Dt(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=It(i);for(let c of a)t.includes(c)||t.push(c);}else if(r.type==="table"){let i=Dt(r);for(let a of i)t.includes(a)||t.push(a);}return t}function Ht(e,t,n,o,r,i){let a=[],c=D(e),u=new Map;for(let f of c){let d=f.name??"";if(d==="w:p"||d.endsWith(":p")){let p=z(f,t,n,o,r,i);Eo(p,o,u),a.push(p);}else if(d==="w:tbl"||d.endsWith(":tbl")){let p=te(f,t,n,o,r,i);a.push(p);}else if(d==="w:sdt"||d.endsWith(":sdt")){let p=(f.elements??[]).find(x=>x.type==="element"&&(x.name==="w:sdtContent"||x.name?.endsWith(":sdtContent")));if(p){let x=Ht(p,t,n,o,r,i);a.push(...x);}}}return a}function Po(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??vt(),content:o}),n}function Ot(e,t=null,n=null,o=null,r=null,i=null){let a={content:[]};if(!e)return a;let c=V(e);if(!c)return a;let u=(c.elements??[]).find(p=>p.type==="element"&&(p.name==="w:document"||p.name?.endsWith(":document")));if(!u)return a;let f=l(u,"w","body");if(!f)return a;a.content=Ht(f,t,n,o,r,i);let d=l(f,"w","sectPr");return d&&(a.finalSectionProperties=pe(d)),a.sections=Po(a.content,a.finalSectionProperties),a}function jt(e,t,n,o,r){if(!e)return [];let i=V(e);if(!i)return [];let a=l(i,"w","comments")??i,c=D(a),u=[];for(let f of c){if((f.name?.replace(/^.*:/,"")??"")!=="comment")continue;let p=parseInt(s(f,"w","id")??"0",10),x=s(f,"w","author")??"Unknown",b=s(f,"w","initials")??void 0,m=s(f,"w","date")??void 0,y=[];for(let B of D(f))if((B.name?.replace(/^.*:/,"")??"")==="p"){let E=z(B,t,n,null,o,r);y.push(E);}u.push({id:p,author:x,initials:b,date:m,content:y});}return u}async function ni(e,t={}){let{onProgress:n=()=>{},preloadFonts:o=true,parseHeadersFooters:r=true,parseNotes:i=true,detectVariables:a=true}=t,c=[];try{let p=function(L,H){let _=performance.now(),M=H(),S=performance.now()-_;return d.push({stage:L,ms:S}),S>1e3&&console.warn(`[parseDocx] ${L} took ${Math.round(S)}ms`),M};var u=p;let f=performance.now(),d=[];async function x(L,H){let _=performance.now(),M=await H(),S=performance.now()-_;return d.push({stage:L,ms:S}),S>1e3&&console.warn(`[parseDocx] ${L} took ${Math.round(S)}ms`),M}n("Extracting DOCX...",0);let b=await x("unzip",()=>Xe(e));n("Extracted DOCX",10),n("Parsing relationships...",10);let m=p("relationships",()=>b.documentRels?ae(b.documentRels):new Map);n("Parsed relationships",15),n("Parsing theme...",15);let y=p("theme",()=>Ve(b.themeXml));n("Parsed theme",20),n("Parsing styles...",20);let B=null,R;p("styles",()=>{b.stylesXml&&(B=Se(b.stylesXml,y),R=Ye(b.stylesXml,y));}),n("Parsed styles",30),n("Parsing numbering...",30);let E=p("numbering",()=>Ke(b.numberingXml));n("Parsed numbering",35),n("Processing media files...",35);let C=p("media",()=>Ao(b,m));n("Processed media",40),n("Parsing document body...",40);let h={content:[]};p("documentBody",()=>{b.documentXml?h=Ot(b.documentXml,B,y,E,m,C):c.push("No document.xml found in DOCX");}),n("Parsed document body",55);let F,w;if(r){n("Parsing headers/footers...",55);let L=p("headersFooters",()=>Bo(b,B,y,E,m,C));F=L.headers,w=L.footers,n("Parsed headers/footers",65);}else n("Skipping headers/footers",65);let k,v;if(i){n("Parsing footnotes/endnotes...",65);let L=p("footnotesEndnotes",()=>No(b,B,y,E,m,C));k=L.footnotes,v=L.endnotes,n("Parsed footnotes/endnotes",75);}else n("Skipping footnotes/endnotes",75);n("Parsing comments...",75);let P=p("comments",()=>jt(b.commentsXml,B,y,m,C));P.length>0&&(h.comments=P);let A;a?(n("Detecting template variables...",75),A=p("variables",()=>Lt(h.content)),n("Detected variables",80)):n("Skipping variable detection",80),o?(n("Loading fonts...",80),await x("fonts",()=>Xo(y,R,h)),n("Loaded fonts",95)):n("Skipping font loading",95),n("Assembling document...",95);let O={package:{document:h,styles:R,theme:y,numbering:E.definitions,headers:F,footers:w,footnotes:k,endnotes:v,relationships:m,media:C},originalBuffer:e,templateVariables:A,warnings:c.length>0?c:void 0},K=performance.now()-f;if(K>2e3){let L=d.filter(H=>H.ms>100).map(H=>`${H.stage}: ${Math.round(H.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(K)}ms`+(L?` (${L})`:""));}return n("Complete",100),O}catch(f){let d=f instanceof Error?f.message:String(f);throw console.error("[parseDocx] Failed to parse DOCX:",d,f),new Error(`Failed to parse DOCX: ${d}`)}}function Ao(e,t){let n=new Map;for(let[o,r]of e.media.entries()){let i=o.split("/").pop()||o,a=Ie(o),c=new Uint8Array(r),u="";for(let b=0;b<c.length;b++)u+=String.fromCharCode(c[b]);let f=btoa(u),d=`data:${a};base64,${f}`,p={path:o,filename:i,mimeType:a,data:r,dataUrl:d};n.set(o,p);let x=o.replace(/^word\//,"");x!==o&&n.set(x,p);}return n}function he(e,t){let n=t.toLowerCase();for(let[o,r]of e.entries())if(o.toLowerCase()===n)return r}function Bo(e,t,n,o,r,i){let a=new Map,c=new Map;for(let[u,f]of r.entries())if(f.type===ie.header&&f.target){let d=f.target.split("/").pop()||f.target,p=he(e.headers,d);if(p){let x=`word/_rels/${d}.rels`,b=he(e.allXml,x),m=b?ae(b):r,y=bt(p,"default",t,n,o,m,i);a.set(u,y);}}else if(f.type===ie.footer&&f.target){let d=f.target.split("/").pop()||f.target,p=he(e.footers,d);if(p){let x=`word/_rels/${d}.rels`,b=he(e.allXml,x),m=b?ae(b):r,y=yt(p,"default",t,n,o,m,i);c.set(u,y);}}return {headers:a,footers:c}}function No(e,t,n,o,r,i){let a=Tt(e.footnotesXml,t,n,o,r,i),c=Ft(e.endnotesXml,t,n,o,r,i);return {footnotes:a.getNormalFootnotes(),endnotes:c.getNormalEndnotes()}}async function Xo(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 xe(Array.from(o));}catch(r){console.warn("Failed to load some fonts:",r);}}
|
|
11
|
+
exports.a=rr;exports.b=Ae;exports.c=Wt;exports.d=Io;exports.e=Lo;exports.f=Do;exports.g=Ho;exports.h=Oo;exports.i=jo;exports.j=Wo;exports.k=Vo;exports.l=ni;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';var chunkD2GERZ7M_cjs=require('./chunk-D2GERZ7M.cjs'),chunkTL3YTVN2_cjs=require('./chunk-TL3YTVN2.cjs'),chunkDQHQWQHL_cjs=require('./chunk-DQHQWQHL.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"},J={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 $(n){if(!n)return 1;let t=parseInt(n,16);return isNaN(t)?1:t/255}function C(n){let t=n.padStart(6,"0").slice(0,6),e=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16);return {r:isNaN(e)?0:e,g:isNaN(r)?0:r,b:isNaN(a)?0:a}}function B(n,t,e){let r=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0");return `${r(n)}${r(t)}${r(e)}`.toUpperCase()}function U(n,t,e){n/=255,t/=255,e/=255;let r=Math.max(n,t,e),a=Math.min(n,t,e),o=(r+a)/2;if(r===a)return {h:0,s:0,l:o};let i=r-a,s=o>.5?i/(2-r-a):i/(r+a),c;switch(r){case n:c=((t-e)/i+(t<e?6:0))/6;break;case t:c=((e-n)/i+2)/6;break;case e:c=((n-t)/i+4)/6;break;default:c=0;}return {h:c*360,s,l:o}}function G(n,t,e){if(n=n/360,t===0){let i=Math.round(e*255);return {r:i,g:i,b:i}}let r=(i,s,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<1/6?i+(s-i)*6*c:c<1/2?s:c<2/3?i+(s-i)*(2/3-c)*6:i),a=e<.5?e*(1+t):e+t-e*t,o=2*e-a;return {r:Math.round(r(o,a,n+1/3)*255),g:Math.round(r(o,a,n)*255),b:Math.round(r(o,a,n-1/3)*255)}}function q(n,t){if(t<=0||t>=1)return t>=1?"FFFFFF":n;let e=C(n),r=U(e.r,e.g,e.b);r.l=r.l+(1-r.l)*t;let a=G(r.h,r.s,r.l);return B(a.r,a.g,a.b)}function X(n,t){if(t<=0||t>=1)return t<=0?"000000":n;let e=C(n),r=U(e.r,e.g,e.b);r.l=r.l*t;let a=G(r.h,r.s,r.l);return B(a.r,a.g,a.b)}function Q(n,t){let e=w[t]??t,r=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],a=o=>r.includes(o);return n?.colorScheme?a(e)?n.colorScheme[e]??W[e]??"000000":"000000":a(e)?W[e]??"000000":"000000"}function K(n){if(!n)return null;let t=n.toLowerCase();return w[n]??w[t]??null}function g(n,t,e="000000"){if(!n)return `#${e}`;if(n.auto)return `#${e}`;let r;if(n.themeColor){let a=K(n.themeColor);if(a?r=Q(t,a):r=n.rgb??e,n.themeTint){let o=$(n.themeTint);r=q(r,o);}else if(n.themeShade){let o=$(n.themeShade);r=X(r,o);}}else n.rgb?r=n.rgb:r=e;return `#${r.toUpperCase().replace(/^#/,"")}`}function Bt(n){if(!n||n==="none")return "";let t=J[n];return t?`#${t}`:""}function Et(n,t){return n?n.auto?"transparent":g(n,t):""}function vt(n,t){if(!n)return false;if(n.auto)return true;let r=g(n,t).replace(/^#/,"").toLowerCase(),a=C(r);return (a.r+a.g+a.b)/3<20}function Ot(n,t){if(!n)return false;let r=g(n,t).replace(/^#/,"").toLowerCase(),a=C(r);return (a.r+a.g+a.b)/3>235}function Nt(n,t){if(!n)return "#000000";let r=g(n,t).replace(/^#/,""),a=C(r);return (.299*a.r+.587*a.g+.114*a.b)/255>.5?"#000000":"#FFFFFF"}function Vt(n){if(!n)return;let t=n.trim();if(t.toLowerCase()==="auto")return {auto:true};let e=K(t);if(e)return {themeColor:e};let r=t.replace(/^#/,"").toUpperCase();return /^[0-9A-F]{6}$/i.test(r)?{rgb:r}:/^[0-9A-F]{3}$/i.test(r)?{rgb:r.split("").map(o=>o+o).join("")}:{rgb:r.padStart(6,"0").slice(0,6)}}function Lt(n,t,e){let r={themeColor:n};return t!==void 0&&t>0&&t<1&&(r.themeTint=Math.round(t*255).toString(16).toUpperCase().padStart(2,"0")),e!==void 0&&e>0&&e<1&&(r.themeShade=Math.round(e*255).toString(16).toUpperCase().padStart(2,"0")),r}function Mt(n){return {rgb:n.replace(/^#/,"").toUpperCase()}}function jt(n,t,e){let a=g(n,t).replace(/^#/,""),o=1-e/100;return `#${X(a,o)}`}function zt(n,t,e){let a=g(n,t).replace(/^#/,""),o=e/100;return `#${q(a,o)}`}function Wt(n,t,e,r){let a=g(n,r).replace(/^#/,""),o=g(t,r).replace(/^#/,""),i=C(a),s=C(o),c={r:Math.round(i.r*(1-e)+s.r*e),g:Math.round(i.g*(1-e)+s.g*e),b:Math.round(i.b*(1-e)+s.b*e)};return `#${B(c.r,c.g,c.b)}`}function $t(n,t,e){if(!n&&!t)return true;if(!n||!t)return false;let r=g(n,e).toUpperCase(),a=g(t,e).toUpperCase();return r===a}function Gt(n){return n/1440*96}function qt(n){return n/96*1440}function Xt(n){return n/914400*96}function Kt(n){return n/96*914400}function Yt(n){return n/914400*1440}function Jt(n){return n/1440*914400}function Qt(n){return n/72*96}function Zt(n){return n/144*96}function te(n){return n/2}function ee(n){return n/576*96}function Z(n,t=2){let e=Math.pow(10,t);return Math.round(n*e)/e}function ne(n){return `${Z(n)}px`}var A=class n{constructor(t){chunkRTESADL3_cjs.e(this,"_document");chunkRTESADL3_cjs.e(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let e=await chunkDQHQWQHL_cjs.l(t);return new n(e)}static fromDocument(t){return new n(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],e=this._document.package.document;for(let r of e.content)r.type==="paragraph"&&this._extractParagraphSegments(r,t);return t}getVariables(){return chunkD2GERZ7M_cjs.a(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[r,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:r,name:o.name||r,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.default});}return e}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(r=>r.length>0).length}getCharacterCount(t=true){let e=this.getText();return t?e.length:e.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let e=this._document.package.document,r=e.content.filter(i=>i.type==="paragraph"),a=r.map((i,s)=>{let c=this._getParagraphText(i),u=i.formatting?.styleId;return {index:s,preview:c.slice(0,t),style:u,isHeading:u?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(u),isListItem:!!i.listRendering,isEmpty:c.trim().length===0}}),o=(e.sections||[]).map((i,s)=>({index:s,paragraphCount:i.content?.length||0,pageSize:i.properties?.pageWidth&&i.properties?.pageHeight?{width:i.properties.pageWidth,height:i.properties.pageHeight}:void 0,isLandscape:i.properties?.orientation==="landscape",hasHeader:!!i.properties?.headerReferences?.length,hasFooter:!!i.properties?.footerReferences?.length}));return {paragraphCount:r.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:a,sections:o,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,r={}){let a={type:"insertText",position:t,text:e,formatting:r.formatting};return this._executeCommand(a)}replaceRange(t,e,r={}){let a={type:"replaceText",range:t,text:e,formatting:r.formatting};return this._executeCommand(a)}deleteRange(t){let e={type:"deleteText",range:t};return this._executeCommand(e)}applyFormatting(t,e){let r={type:"formatText",range:t,formatting:e};return this._executeCommand(r)}applyStyle(t,e){let r={type:"applyStyle",paragraphIndex:t,styleId:e};return this._executeCommand(r)}applyParagraphFormatting(t,e){let r={type:"formatParagraph",paragraphIndex:t,formatting:e};return this._executeCommand(r)}insertTable(t,e,r,a={}){let o={type:"insertTable",position:t,rows:e,columns:r,data:a.data,hasHeader:a.hasHeader};return this._executeCommand(o)}insertImage(t,e,r={}){let a={type:"insertImage",position:t,src:e,width:r.width,height:r.height,alt:r.alt};return this._executeCommand(a)}insertHyperlink(t,e,r={}){let a={type:"insertHyperlink",range:t,url:e,displayText:r.displayText,tooltip:r.tooltip};return this._executeCommand(a)}removeHyperlink(t){let e={type:"removeHyperlink",range:t};return this._executeCommand(e)}insertParagraphBreak(t){let e={type:"insertParagraphBreak",position:t};return this._executeCommand(e)}mergeParagraphs(t,e){let r={type:"mergeParagraphs",paragraphIndex:t,count:e};return this._executeCommand(r)}setVariable(t,e){return this._pendingVariables[t]=e,this}setVariables(t){for(let[e,r]of Object.entries(t))this._pendingVariables[e]=r;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let e={...this._pendingVariables,...t};if(Object.keys(e).length===0)return this;let r=this._document.originalBuffer;if(!r)throw new Error("Cannot apply variables: no original buffer for processing");let a=chunkD2GERZ7M_cjs.n(r,e),o=await chunkDQHQWQHL_cjs.l(a),i=new n(o);return i._pendingVariables={},i}async toBuffer(){return this._document.originalBuffer?chunkTL3YTVN2_cjs.d(this._document):chunkTL3YTVN2_cjs.e(this._document)}async toBlob(t="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let e=await this.toBuffer();return new Blob([e],{type:t})}executeCommands(t){let e=chunkFOU7PS3K_cjs.b(this._document,t);return new n(e)}_executeCommand(t){let e=chunkFOU7PS3K_cjs.a(this._document,t),r=new n(e);return r._pendingVariables={...this._pendingVariables},r}_getBodyText(t){let e=[];for(let r of t.content)r.type==="paragraph"?e.push(this._getParagraphText(r)):r.type==="table"&&e.push(this._getTableText(r));return e.join(`
|
|
2
|
+
`)}_getParagraphText(t){let e=[];for(let r of t.content)r.type==="run"?e.push(this._getRunText(r)):r.type==="hyperlink"&&e.push(this._getHyperlinkText(r));return e.join("")}_getRunText(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("")}_getHyperlinkText(t){let e=[];for(let r of t.children)r.type==="run"&&e.push(this._getRunText(r));return e.join("")}_getTableText(t){let e=[];for(let r of t.rows)for(let a of r.cells)for(let o of a.content)o.type==="paragraph"&&e.push(this._getParagraphText(o));return e.join(" ")}_extractParagraphSegments(t,e){for(let r of t.content)if(r.type==="run"){let a=this._getRunText(r);a&&e.push({text:a,formatting:r.formatting});}else if(r.type==="hyperlink"){let a=r.href||"";for(let o of r.children)if(o.type==="run"){let i=this._getRunText(o);i&&e.push({text:i,formatting:o.formatting,isHyperlink:true,hyperlinkUrl:a});}}}_parseHeadingLevel(t){if(!t)return;let e=t.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}_hasImages(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let r of e.content)if(r.type==="run"){for(let a of r.content)if(a.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let r of e.content)if(r.type==="hyperlink")return true}return false}};async function ue(n){return A.fromBuffer(n)}function le(n){return A.fromDocument(n)}function tt(n,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:r=50}=t,a=n.package.document,o=a.content.filter(y=>y.type==="paragraph"),i=et(o,e,r),s=chunkD2GERZ7M_cjs.a(n),c=nt(n),u=rt(a),l=at(a),x=ot(a),d=a.content.some(y=>y.type==="table"),b=ct(a),p=ut(a);return {paragraphCount:o.length,wordCount:l,characterCount:x,variables:s,variableCount:s.length,availableStyles:c,outline:i,sections:u,hasTables:d,hasImages:b,hasHyperlinks:p}}function de(n,t,e={}){let{contextChars:r=200,includeSuggestions:a=true}=e,i=n.package.document.content.filter(f=>f.type==="paragraph"),s=i[t.start.paragraphIndex];if(!s)throw new Error(`Paragraph not found at index ${t.start.paragraphIndex}`);let c=m(s),u="";if(t.start.paragraphIndex===t.end.paragraphIndex)u=c.slice(t.start.offset,t.end.offset);else {let f=[];for(let P=t.start.paragraphIndex;P<=t.end.paragraphIndex;P++){let N=i[P];if(!N)continue;let R=m(N);P===t.start.paragraphIndex?f.push(R.slice(t.start.offset)):P===t.end.paragraphIndex?f.push(R.slice(0,t.end.offset)):f.push(R);}u=f.join(`
|
|
3
|
+
`);}let l=mt(i,t.start.paragraphIndex,t.start.offset,r),x=gt(i,t.end.paragraphIndex,t.end.offset,r),d=dt(s,t.start.offset),b=s.formatting||{},p={index:t.start.paragraphIndex,fullText:c,style:s.formatting?.styleId,wordCount:E(c)},y=false,F=ft(s,t.start.offset),_=a?ht(u):[];return {selectedText:u,range:t,formatting:d,paragraphFormatting:b,textBefore:l,textAfter:x,paragraph:p,inTable:y,inHyperlink:F,suggestedActions:_}}function Y(n){let t=tt(n,{outlineMaxChars:50,maxOutlineParagraphs:10}),e=[`Document with ${t.paragraphCount} paragraphs, ${t.wordCount} words.`];t.hasTables&&e.push("Contains tables."),t.hasImages&&e.push("Contains images."),t.hasHyperlinks&&e.push("Contains hyperlinks."),t.variableCount>0&&e.push(`Has ${t.variableCount} template variables: ${t.variables.join(", ")}`);let r=t.outline.filter(a=>a.isHeading);if(r.length>0){e.push(`
|
|
4
|
+
Headings:`);for(let a of r.slice(0,5)){let o=a.headingLevel||1;e.push(`${" ".repeat(o-1)}- ${a.preview}`);}r.length>5&&e.push(` ... and ${r.length-5} more headings`);}return e.join(" ")}function et(n,t,e){let r=[];for(let a=0;a<Math.min(n.length,e);a++){let o=n[a],i=m(o),s=o.formatting?.styleId;r.push({index:a,preview:i.slice(0,t),style:s,isHeading:lt(s),headingLevel:pt(s),isListItem:!!o.listRendering,isEmpty:i.trim().length===0});}return r}function nt(n){let t=n.package.styles;if(!t?.styles)return [];let e=[];for(let[r,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:r,name:o.name||r,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.default});}return e}function rt(n){return n.sections?n.sections.map((t,e)=>({index:e,paragraphCount:t.content?.length||0,pageSize:t.properties?.pageWidth&&t.properties?.pageHeight?{width:t.properties.pageWidth,height:t.properties.pageHeight}:void 0,isLandscape:t.properties?.orientation==="landscape",hasHeader:!!t.properties?.headerReferences?.length,hasFooter:!!t.properties?.footerReferences?.length})):[]}function at(n){let t=0;for(let e of n.content)if(e.type==="paragraph"){let r=m(e);t+=E(r);}else e.type==="table"&&(t+=it(e));return t}function E(n){return n.split(/\s+/).filter(e=>e.length>0).length}function ot(n){let t=0;for(let e of n.content)if(e.type==="paragraph"){let r=m(e);t+=r.length;}else e.type==="table"&&(t+=st(e));return t}function it(n){let t=0;for(let e of n.rows)for(let r of e.cells)for(let a of r.content)if(a.type==="paragraph"){let o=m(a);t+=E(o);}return t}function st(n){let t=0;for(let e of n.rows)for(let r of e.cells)for(let a of r.content)if(a.type==="paragraph"){let o=m(a);t+=o.length;}return t}function m(n){let t=[];for(let e of n.content)e.type==="run"?t.push(S(e)):e.type==="hyperlink"&&t.push(v(e));return t.join("")}function S(n){return n.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function v(n){let t=[];for(let e of n.children)e.type==="run"&&t.push(S(e));return t.join("")}function ct(n){for(let t of n.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let r of e.content)if(r.type==="drawing")return true}}return false}function ut(n){for(let t of n.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="hyperlink")return true}return false}function lt(n){return n?n.toLowerCase().includes("heading"):false}function pt(n){if(!n)return;let t=n.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}function mt(n,t,e,r){let a=[],o=0,i=n[t];if(i){let u=m(i).slice(0,e);a.unshift(u),o+=u.length;}for(let c=t-1;c>=0&&o<r;c--){let u=n[c];if(!u)continue;let l=m(u);a.unshift(l),o+=l.length;}let s=a.join(`
|
|
5
|
+
`);return s.length>r?"..."+s.slice(-r):s}function gt(n,t,e,r){let a=[],o=0,i=n[t];if(i){let u=m(i).slice(e);a.push(u),o+=u.length;}for(let c=t+1;c<n.length&&o<r;c++){let u=n[c];if(!u)continue;let l=m(u);a.push(l),o+=l.length;}let s=a.join(`
|
|
6
|
+
`);return s.length>r?s.slice(0,r)+"...":s}function dt(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=S(r),o=e,i=e+a.length;if(t>=o&&t<i)return r.formatting||{};e=i;}else if(r.type==="hyperlink"){let a=v(r),o=e,i=e+a.length;if(t>=o&&t<i){for(let s of r.children)if(s.type==="run")return s.formatting||{}}e=i;}return {}}function ft(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=S(r);e+=a.length;}else if(r.type==="hyperlink"){let a=v(r),o=e,i=e+a.length;if(t>=o&&t<i)return true;e=i;}return false}function ht(n,t,e){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((a,o)=>(o.priority||0)-(a.priority||0)),r}function xt(n,t,e={}){let{contextCharsBefore:r=200,contextCharsAfter:a=200,includeSuggestions:o=true}=e,i=n.package.document,s=i.content.filter(f=>f.type==="paragraph");if(t.start.paragraphIndex>=s.length)throw new Error(`Invalid start paragraph index: ${t.start.paragraphIndex}`);let c=s[t.start.paragraphIndex],u=bt(s,t),l=yt(s,t.start,r),x=Ct(s,t.end,a),d=Pt(c,t.start.offset),b=c.formatting||{},p={index:t.start.paragraphIndex,fullText:h(c),style:c.formatting?.styleId,wordCount:O(h(c))},y=Tt(i,t.start),F=At(c,t.start.offset),_=o?St(u):[];return {selectedText:u,range:t,formatting:d,paragraphFormatting:b,textBefore:l,textAfter:x,paragraph:p,inTable:y,inHyperlink:F,suggestedActions:_}}function xe(n,t,e={}){let r=xt(n,t,e),{includeDocumentSummary:a=true}=e,i=n.package.document.content.filter(p=>p.type==="paragraph"),s=O(r.selectedText),c=r.selectedText.length,u=t.start.paragraphIndex!==t.end.paragraphIndex,l=[];for(let p=t.start.paragraphIndex;p<=t.end.paragraphIndex;p++)l.push(p);let x=kt(i,t),d=a?Y(n):void 0,b=Ft(r.selectedText);return {...r,documentSummary:d,wordCount:s,characterCount:c,isMultiParagraph:u,paragraphIndices:l,detectedLanguage:b,contentType:x}}function be(n,t){let r=n.package.document.content.filter(s=>s.type==="paragraph"),a=[];for(let s=t.start.paragraphIndex;s<=t.end.paragraphIndex;s++){let c=r[s];if(!c)continue;let u=s===t.start.paragraphIndex?t.start.offset:0,l=s===t.end.paragraphIndex?t.end.offset:1/0;It(c,u,l,a);}let o=a.length<=1||a.every(s=>_t(s,a[0]));return {predominant:a.length>0?a[0]:{},isConsistent:o,allFormatting:a}}function bt(n,t){if(t.start.paragraphIndex===t.end.paragraphIndex){let r=n[t.start.paragraphIndex];return r?h(r).slice(t.start.offset,t.end.offset):""}let e=[];for(let r=t.start.paragraphIndex;r<=t.end.paragraphIndex;r++){let a=n[r];if(!a)continue;let o=h(a);r===t.start.paragraphIndex?e.push(o.slice(t.start.offset)):r===t.end.paragraphIndex?e.push(o.slice(0,t.end.offset)):e.push(o);}return e.join(`
|
|
7
|
+
`)}function yt(n,t,e){let r=[],a=0,o=n[t.paragraphIndex];if(o){let c=h(o).slice(0,t.offset);r.unshift(c),a+=c.length;}for(let s=t.paragraphIndex-1;s>=0&&a<e;s--){let c=n[s];if(!c)continue;let u=h(c);r.unshift(u),a+=u.length;}let i=r.join(`
|
|
8
|
+
`);return i.length>e?"..."+i.slice(-e):i}function Ct(n,t,e){let r=[],a=0,o=n[t.paragraphIndex];if(o){let c=h(o).slice(t.offset);r.push(c),a+=c.length;}for(let s=t.paragraphIndex+1;s<n.length&&a<e;s++){let c=n[s];if(!c)continue;let u=h(c);r.push(u),a+=u.length;}let i=r.join(`
|
|
9
|
+
`);return i.length>e?i.slice(0,e)+"...":i}function Pt(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=I(r),o=e+a.length;if(t>=e&&t<o)return r.formatting||{};e=o;}else if(r.type==="hyperlink"){let a=k(r),o=e+a.length;if(t>=e&&t<o){for(let i of r.children)if(i.type==="run")return i.formatting||{}}e=o;}return {}}function It(n,t,e,r){let a=0;for(let o of n.content)if(o.type==="run"){let i=I(o),s=a,c=a+i.length;c>t&&s<e&&o.formatting&&r.push({...o.formatting}),a=c;}else if(o.type==="hyperlink"){let i=k(o),s=a,c=a+i.length;if(c>t&&s<e)for(let u of o.children)u.type==="run"&&u.formatting&&r.push({...u.formatting});a=c;}}function Tt(n,t){return false}function At(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=I(r);e+=a.length;}else if(r.type==="hyperlink"){let a=k(r),o=e,i=e+a.length;if(t>=o&&t<i)return true;e=i;}return false}function St(n,t,e){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 a=O(n);return a>50&&r.push({id:"summarize",label:"Summarize",description:"Create a shorter version",priority:9}),a<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((o,i)=>(i.priority||0)-(o.priority||0)),r}function kt(n,t){let e=new Set;for(let r=t.start.paragraphIndex;r<=t.end.paragraphIndex;r++){let a=n[r];a&&(a.listRendering?e.add("list"):a.formatting?.styleId?.toLowerCase().includes("heading")?e.add("heading"):e.add("prose"));}return e.size>1?"mixed":e.has("list")?"list":e.has("heading")?"heading":"prose"}function Ft(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 t=[];for(let e of n.content)e.type==="run"?t.push(I(e)):e.type==="hyperlink"&&t.push(k(e));return t.join("")}function I(n){return n.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function k(n){let t=[];for(let e of n.children)e.type==="run"&&t.push(I(e));return t.join("")}function O(n){return n.split(/\s+/).filter(t=>t.length>0).length}function _t(n,t){let e=Object.keys(n),r=Object.keys(t);return e.length!==r.length?false:e.every(a=>{let o=n[a],i=t[a];return o===i})}function Rt(){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 Ht(){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 Dt(n={}){let t=Ht();n.pageWidth!==void 0&&(t.pageWidth=n.pageWidth),n.pageHeight!==void 0&&(t.pageHeight=n.pageHeight),n.orientation!==void 0&&(t.orientation=n.orientation),n.marginTop!==void 0&&(t.marginTop=n.marginTop),n.marginBottom!==void 0&&(t.marginBottom=n.marginBottom),n.marginLeft!==void 0&&(t.marginLeft=n.marginLeft),n.marginRight!==void 0&&(t.marginRight=n.marginRight);let e={type:"text",text:n.initialText||""};return {package:{document:{content:[{type:"paragraph",content:[{type:"run",content:n.initialText?[e]:[],formatting:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}}}],formatting:{lineSpacing:276}}],finalSectionProperties:t},styles:{docDefaults:{rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},styles:Rt()}},templateVariables:[],warnings:[]}}function Ce(n,t={}){return Dt({...t,initialText:n})}function Ie(n){return {start:n,end:n,collapsed:true}}function Te(n,t){return {start:n,end:t,collapsed:n.paragraphIndex===t.paragraphIndex&&n.offset===t.offset}}function Ae(n,t){return !(n.paragraphIndex<t.start.paragraphIndex||n.paragraphIndex===t.start.paragraphIndex&&n.offset<t.start.offset||n.paragraphIndex>t.end.paragraphIndex||n.paragraphIndex===t.end.paragraphIndex&&n.offset>t.end.offset)}function Se(n,t){return n.paragraphIndex<t.paragraphIndex?-1:n.paragraphIndex>t.paragraphIndex?1:n.offset<t.offset?-1:n.offset>t.offset?1:0}function ke(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 Fe(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 _e=["askAI","rewrite","expand","summarize","translate","explain"];function Re(n){return {...n,id:wt()}}function wt(){return `cmd_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}exports.A=le;exports.B=tt;exports.C=de;exports.D=Y;exports.E=xt;exports.F=xe;exports.G=be;exports.H=Dt;exports.I=Ce;exports.J=Ie;exports.K=Te;exports.L=Ae;exports.M=Se;exports.N=ke;exports.O=Fe;exports.P=_e;exports.Q=Re;exports.a=g;exports.b=Bt;exports.c=Et;exports.d=vt;exports.e=Ot;exports.f=Nt;exports.g=Vt;exports.h=Lt;exports.i=Mt;exports.j=jt;exports.k=zt;exports.l=Wt;exports.m=$t;exports.n=Gt;exports.o=qt;exports.p=Xt;exports.q=Kt;exports.r=Yt;exports.s=Jt;exports.t=Qt;exports.u=Zt;exports.v=te;exports.w=ee;exports.x=ne;exports.y=A;exports.z=ue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {a,n}from'./chunk-AOL255XD.js';import {d,e as e$1}from'./chunk-2CFVFSUH.js';import {l}from'./chunk-I2C6ENCR.js';import {b,a as a$1}from'./chunk-AQ35GWDV.js';import {e}from'./chunk-3IYNTJO5.js';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"},J={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 $(n){if(!n)return 1;let t=parseInt(n,16);return isNaN(t)?1:t/255}function C(n){let t=n.padStart(6,"0").slice(0,6),e=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16);return {r:isNaN(e)?0:e,g:isNaN(r)?0:r,b:isNaN(a)?0:a}}function B(n,t,e){let r=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0");return `${r(n)}${r(t)}${r(e)}`.toUpperCase()}function U(n,t,e){n/=255,t/=255,e/=255;let r=Math.max(n,t,e),a=Math.min(n,t,e),o=(r+a)/2;if(r===a)return {h:0,s:0,l:o};let i=r-a,s=o>.5?i/(2-r-a):i/(r+a),c;switch(r){case n:c=((t-e)/i+(t<e?6:0))/6;break;case t:c=((e-n)/i+2)/6;break;case e:c=((n-t)/i+4)/6;break;default:c=0;}return {h:c*360,s,l:o}}function G(n,t,e){if(n=n/360,t===0){let i=Math.round(e*255);return {r:i,g:i,b:i}}let r=(i,s,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<1/6?i+(s-i)*6*c:c<1/2?s:c<2/3?i+(s-i)*(2/3-c)*6:i),a=e<.5?e*(1+t):e+t-e*t,o=2*e-a;return {r:Math.round(r(o,a,n+1/3)*255),g:Math.round(r(o,a,n)*255),b:Math.round(r(o,a,n-1/3)*255)}}function q(n,t){if(t<=0||t>=1)return t>=1?"FFFFFF":n;let e=C(n),r=U(e.r,e.g,e.b);r.l=r.l+(1-r.l)*t;let a=G(r.h,r.s,r.l);return B(a.r,a.g,a.b)}function X(n,t){if(t<=0||t>=1)return t<=0?"000000":n;let e=C(n),r=U(e.r,e.g,e.b);r.l=r.l*t;let a=G(r.h,r.s,r.l);return B(a.r,a.g,a.b)}function Q(n,t){let e=w[t]??t,r=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],a=o=>r.includes(o);return n?.colorScheme?a(e)?n.colorScheme[e]??W[e]??"000000":"000000":a(e)?W[e]??"000000":"000000"}function K(n){if(!n)return null;let t=n.toLowerCase();return w[n]??w[t]??null}function g(n,t,e="000000"){if(!n)return `#${e}`;if(n.auto)return `#${e}`;let r;if(n.themeColor){let a=K(n.themeColor);if(a?r=Q(t,a):r=n.rgb??e,n.themeTint){let o=$(n.themeTint);r=q(r,o);}else if(n.themeShade){let o=$(n.themeShade);r=X(r,o);}}else n.rgb?r=n.rgb:r=e;return `#${r.toUpperCase().replace(/^#/,"")}`}function Bt(n){if(!n||n==="none")return "";let t=J[n];return t?`#${t}`:""}function Et(n,t){return n?n.auto?"transparent":g(n,t):""}function vt(n,t){if(!n)return false;if(n.auto)return true;let r=g(n,t).replace(/^#/,"").toLowerCase(),a=C(r);return (a.r+a.g+a.b)/3<20}function Ot(n,t){if(!n)return false;let r=g(n,t).replace(/^#/,"").toLowerCase(),a=C(r);return (a.r+a.g+a.b)/3>235}function Nt(n,t){if(!n)return "#000000";let r=g(n,t).replace(/^#/,""),a=C(r);return (.299*a.r+.587*a.g+.114*a.b)/255>.5?"#000000":"#FFFFFF"}function Vt(n){if(!n)return;let t=n.trim();if(t.toLowerCase()==="auto")return {auto:true};let e=K(t);if(e)return {themeColor:e};let r=t.replace(/^#/,"").toUpperCase();return /^[0-9A-F]{6}$/i.test(r)?{rgb:r}:/^[0-9A-F]{3}$/i.test(r)?{rgb:r.split("").map(o=>o+o).join("")}:{rgb:r.padStart(6,"0").slice(0,6)}}function Lt(n,t,e){let r={themeColor:n};return t!==void 0&&t>0&&t<1&&(r.themeTint=Math.round(t*255).toString(16).toUpperCase().padStart(2,"0")),e!==void 0&&e>0&&e<1&&(r.themeShade=Math.round(e*255).toString(16).toUpperCase().padStart(2,"0")),r}function Mt(n){return {rgb:n.replace(/^#/,"").toUpperCase()}}function jt(n,t,e){let a=g(n,t).replace(/^#/,""),o=1-e/100;return `#${X(a,o)}`}function zt(n,t,e){let a=g(n,t).replace(/^#/,""),o=e/100;return `#${q(a,o)}`}function Wt(n,t,e,r){let a=g(n,r).replace(/^#/,""),o=g(t,r).replace(/^#/,""),i=C(a),s=C(o),c={r:Math.round(i.r*(1-e)+s.r*e),g:Math.round(i.g*(1-e)+s.g*e),b:Math.round(i.b*(1-e)+s.b*e)};return `#${B(c.r,c.g,c.b)}`}function $t(n,t,e){if(!n&&!t)return true;if(!n||!t)return false;let r=g(n,e).toUpperCase(),a=g(t,e).toUpperCase();return r===a}function Gt(n){return n/1440*96}function qt(n){return n/96*1440}function Xt(n){return n/914400*96}function Kt(n){return n/96*914400}function Yt(n){return n/914400*1440}function Jt(n){return n/1440*914400}function Qt(n){return n/72*96}function Zt(n){return n/144*96}function te(n){return n/2}function ee(n){return n/576*96}function Z(n,t=2){let e=Math.pow(10,t);return Math.round(n*e)/e}function ne(n){return `${Z(n)}px`}var A=class n$1{constructor(t){e(this,"_document");e(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let e=await l(t);return new n$1(e)}static fromDocument(t){return new n$1(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],e=this._document.package.document;for(let r of e.content)r.type==="paragraph"&&this._extractParagraphSegments(r,t);return t}getVariables(){return a(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[r,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:r,name:o.name||r,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.default});}return e}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(r=>r.length>0).length}getCharacterCount(t=true){let e=this.getText();return t?e.length:e.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let e=this._document.package.document,r=e.content.filter(i=>i.type==="paragraph"),a=r.map((i,s)=>{let c=this._getParagraphText(i),u=i.formatting?.styleId;return {index:s,preview:c.slice(0,t),style:u,isHeading:u?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(u),isListItem:!!i.listRendering,isEmpty:c.trim().length===0}}),o=(e.sections||[]).map((i,s)=>({index:s,paragraphCount:i.content?.length||0,pageSize:i.properties?.pageWidth&&i.properties?.pageHeight?{width:i.properties.pageWidth,height:i.properties.pageHeight}:void 0,isLandscape:i.properties?.orientation==="landscape",hasHeader:!!i.properties?.headerReferences?.length,hasFooter:!!i.properties?.footerReferences?.length}));return {paragraphCount:r.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:a,sections:o,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,r={}){let a={type:"insertText",position:t,text:e,formatting:r.formatting};return this._executeCommand(a)}replaceRange(t,e,r={}){let a={type:"replaceText",range:t,text:e,formatting:r.formatting};return this._executeCommand(a)}deleteRange(t){let e={type:"deleteText",range:t};return this._executeCommand(e)}applyFormatting(t,e){let r={type:"formatText",range:t,formatting:e};return this._executeCommand(r)}applyStyle(t,e){let r={type:"applyStyle",paragraphIndex:t,styleId:e};return this._executeCommand(r)}applyParagraphFormatting(t,e){let r={type:"formatParagraph",paragraphIndex:t,formatting:e};return this._executeCommand(r)}insertTable(t,e,r,a={}){let o={type:"insertTable",position:t,rows:e,columns:r,data:a.data,hasHeader:a.hasHeader};return this._executeCommand(o)}insertImage(t,e,r={}){let a={type:"insertImage",position:t,src:e,width:r.width,height:r.height,alt:r.alt};return this._executeCommand(a)}insertHyperlink(t,e,r={}){let a={type:"insertHyperlink",range:t,url:e,displayText:r.displayText,tooltip:r.tooltip};return this._executeCommand(a)}removeHyperlink(t){let e={type:"removeHyperlink",range:t};return this._executeCommand(e)}insertParagraphBreak(t){let e={type:"insertParagraphBreak",position:t};return this._executeCommand(e)}mergeParagraphs(t,e){let r={type:"mergeParagraphs",paragraphIndex:t,count:e};return this._executeCommand(r)}setVariable(t,e){return this._pendingVariables[t]=e,this}setVariables(t){for(let[e,r]of Object.entries(t))this._pendingVariables[e]=r;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let e={...this._pendingVariables,...t};if(Object.keys(e).length===0)return this;let r=this._document.originalBuffer;if(!r)throw new Error("Cannot apply variables: no original buffer for processing");let a=n(r,e),o=await l(a),i=new n$1(o);return i._pendingVariables={},i}async toBuffer(){return this._document.originalBuffer?d(this._document):e$1(this._document)}async toBlob(t="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let e=await this.toBuffer();return new Blob([e],{type:t})}executeCommands(t){let e=b(this._document,t);return new n$1(e)}_executeCommand(t){let e=a$1(this._document,t),r=new n$1(e);return r._pendingVariables={...this._pendingVariables},r}_getBodyText(t){let e=[];for(let r of t.content)r.type==="paragraph"?e.push(this._getParagraphText(r)):r.type==="table"&&e.push(this._getTableText(r));return e.join(`
|
|
2
|
+
`)}_getParagraphText(t){let e=[];for(let r of t.content)r.type==="run"?e.push(this._getRunText(r)):r.type==="hyperlink"&&e.push(this._getHyperlinkText(r));return e.join("")}_getRunText(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("")}_getHyperlinkText(t){let e=[];for(let r of t.children)r.type==="run"&&e.push(this._getRunText(r));return e.join("")}_getTableText(t){let e=[];for(let r of t.rows)for(let a of r.cells)for(let o of a.content)o.type==="paragraph"&&e.push(this._getParagraphText(o));return e.join(" ")}_extractParagraphSegments(t,e){for(let r of t.content)if(r.type==="run"){let a=this._getRunText(r);a&&e.push({text:a,formatting:r.formatting});}else if(r.type==="hyperlink"){let a=r.href||"";for(let o of r.children)if(o.type==="run"){let i=this._getRunText(o);i&&e.push({text:i,formatting:o.formatting,isHyperlink:true,hyperlinkUrl:a});}}}_parseHeadingLevel(t){if(!t)return;let e=t.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}_hasImages(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let r of e.content)if(r.type==="run"){for(let a of r.content)if(a.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let r of e.content)if(r.type==="hyperlink")return true}return false}};async function ue(n){return A.fromBuffer(n)}function le(n){return A.fromDocument(n)}function tt(n,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:r=50}=t,a$1=n.package.document,o=a$1.content.filter(y=>y.type==="paragraph"),i=et(o,e,r),s=a(n),c=nt(n),u=rt(a$1),l=at(a$1),x=ot(a$1),d=a$1.content.some(y=>y.type==="table"),b=ct(a$1),p=ut(a$1);return {paragraphCount:o.length,wordCount:l,characterCount:x,variables:s,variableCount:s.length,availableStyles:c,outline:i,sections:u,hasTables:d,hasImages:b,hasHyperlinks:p}}function de(n,t,e={}){let{contextChars:r=200,includeSuggestions:a=true}=e,i=n.package.document.content.filter(f=>f.type==="paragraph"),s=i[t.start.paragraphIndex];if(!s)throw new Error(`Paragraph not found at index ${t.start.paragraphIndex}`);let c=m(s),u="";if(t.start.paragraphIndex===t.end.paragraphIndex)u=c.slice(t.start.offset,t.end.offset);else {let f=[];for(let P=t.start.paragraphIndex;P<=t.end.paragraphIndex;P++){let N=i[P];if(!N)continue;let R=m(N);P===t.start.paragraphIndex?f.push(R.slice(t.start.offset)):P===t.end.paragraphIndex?f.push(R.slice(0,t.end.offset)):f.push(R);}u=f.join(`
|
|
3
|
+
`);}let l=mt(i,t.start.paragraphIndex,t.start.offset,r),x=gt(i,t.end.paragraphIndex,t.end.offset,r),d=dt(s,t.start.offset),b=s.formatting||{},p={index:t.start.paragraphIndex,fullText:c,style:s.formatting?.styleId,wordCount:E(c)},y=false,F=ft(s,t.start.offset),_=a?ht(u):[];return {selectedText:u,range:t,formatting:d,paragraphFormatting:b,textBefore:l,textAfter:x,paragraph:p,inTable:y,inHyperlink:F,suggestedActions:_}}function Y(n){let t=tt(n,{outlineMaxChars:50,maxOutlineParagraphs:10}),e=[`Document with ${t.paragraphCount} paragraphs, ${t.wordCount} words.`];t.hasTables&&e.push("Contains tables."),t.hasImages&&e.push("Contains images."),t.hasHyperlinks&&e.push("Contains hyperlinks."),t.variableCount>0&&e.push(`Has ${t.variableCount} template variables: ${t.variables.join(", ")}`);let r=t.outline.filter(a=>a.isHeading);if(r.length>0){e.push(`
|
|
4
|
+
Headings:`);for(let a of r.slice(0,5)){let o=a.headingLevel||1;e.push(`${" ".repeat(o-1)}- ${a.preview}`);}r.length>5&&e.push(` ... and ${r.length-5} more headings`);}return e.join(" ")}function et(n,t,e){let r=[];for(let a=0;a<Math.min(n.length,e);a++){let o=n[a],i=m(o),s=o.formatting?.styleId;r.push({index:a,preview:i.slice(0,t),style:s,isHeading:lt(s),headingLevel:pt(s),isListItem:!!o.listRendering,isEmpty:i.trim().length===0});}return r}function nt(n){let t=n.package.styles;if(!t?.styles)return [];let e=[];for(let[r,a]of Object.entries(t.styles))if(typeof a=="object"&&a!==null){let o=a;e.push({id:r,name:o.name||r,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.default});}return e}function rt(n){return n.sections?n.sections.map((t,e)=>({index:e,paragraphCount:t.content?.length||0,pageSize:t.properties?.pageWidth&&t.properties?.pageHeight?{width:t.properties.pageWidth,height:t.properties.pageHeight}:void 0,isLandscape:t.properties?.orientation==="landscape",hasHeader:!!t.properties?.headerReferences?.length,hasFooter:!!t.properties?.footerReferences?.length})):[]}function at(n){let t=0;for(let e of n.content)if(e.type==="paragraph"){let r=m(e);t+=E(r);}else e.type==="table"&&(t+=it(e));return t}function E(n){return n.split(/\s+/).filter(e=>e.length>0).length}function ot(n){let t=0;for(let e of n.content)if(e.type==="paragraph"){let r=m(e);t+=r.length;}else e.type==="table"&&(t+=st(e));return t}function it(n){let t=0;for(let e of n.rows)for(let r of e.cells)for(let a of r.content)if(a.type==="paragraph"){let o=m(a);t+=E(o);}return t}function st(n){let t=0;for(let e of n.rows)for(let r of e.cells)for(let a of r.content)if(a.type==="paragraph"){let o=m(a);t+=o.length;}return t}function m(n){let t=[];for(let e of n.content)e.type==="run"?t.push(S(e)):e.type==="hyperlink"&&t.push(v(e));return t.join("")}function S(n){return n.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function v(n){let t=[];for(let e of n.children)e.type==="run"&&t.push(S(e));return t.join("")}function ct(n){for(let t of n.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let r of e.content)if(r.type==="drawing")return true}}return false}function ut(n){for(let t of n.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="hyperlink")return true}return false}function lt(n){return n?n.toLowerCase().includes("heading"):false}function pt(n){if(!n)return;let t=n.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}function mt(n,t,e,r){let a=[],o=0,i=n[t];if(i){let u=m(i).slice(0,e);a.unshift(u),o+=u.length;}for(let c=t-1;c>=0&&o<r;c--){let u=n[c];if(!u)continue;let l=m(u);a.unshift(l),o+=l.length;}let s=a.join(`
|
|
5
|
+
`);return s.length>r?"..."+s.slice(-r):s}function gt(n,t,e,r){let a=[],o=0,i=n[t];if(i){let u=m(i).slice(e);a.push(u),o+=u.length;}for(let c=t+1;c<n.length&&o<r;c++){let u=n[c];if(!u)continue;let l=m(u);a.push(l),o+=l.length;}let s=a.join(`
|
|
6
|
+
`);return s.length>r?s.slice(0,r)+"...":s}function dt(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=S(r),o=e,i=e+a.length;if(t>=o&&t<i)return r.formatting||{};e=i;}else if(r.type==="hyperlink"){let a=v(r),o=e,i=e+a.length;if(t>=o&&t<i){for(let s of r.children)if(s.type==="run")return s.formatting||{}}e=i;}return {}}function ft(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=S(r);e+=a.length;}else if(r.type==="hyperlink"){let a=v(r),o=e,i=e+a.length;if(t>=o&&t<i)return true;e=i;}return false}function ht(n,t,e){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((a,o)=>(o.priority||0)-(a.priority||0)),r}function xt(n,t,e={}){let{contextCharsBefore:r=200,contextCharsAfter:a=200,includeSuggestions:o=true}=e,i=n.package.document,s=i.content.filter(f=>f.type==="paragraph");if(t.start.paragraphIndex>=s.length)throw new Error(`Invalid start paragraph index: ${t.start.paragraphIndex}`);let c=s[t.start.paragraphIndex],u=bt(s,t),l=yt(s,t.start,r),x=Ct(s,t.end,a),d=Pt(c,t.start.offset),b=c.formatting||{},p={index:t.start.paragraphIndex,fullText:h(c),style:c.formatting?.styleId,wordCount:O(h(c))},y=Tt(i,t.start),F=At(c,t.start.offset),_=o?St(u):[];return {selectedText:u,range:t,formatting:d,paragraphFormatting:b,textBefore:l,textAfter:x,paragraph:p,inTable:y,inHyperlink:F,suggestedActions:_}}function xe(n,t,e={}){let r=xt(n,t,e),{includeDocumentSummary:a=true}=e,i=n.package.document.content.filter(p=>p.type==="paragraph"),s=O(r.selectedText),c=r.selectedText.length,u=t.start.paragraphIndex!==t.end.paragraphIndex,l=[];for(let p=t.start.paragraphIndex;p<=t.end.paragraphIndex;p++)l.push(p);let x=kt(i,t),d=a?Y(n):void 0,b=Ft(r.selectedText);return {...r,documentSummary:d,wordCount:s,characterCount:c,isMultiParagraph:u,paragraphIndices:l,detectedLanguage:b,contentType:x}}function be(n,t){let r=n.package.document.content.filter(s=>s.type==="paragraph"),a=[];for(let s=t.start.paragraphIndex;s<=t.end.paragraphIndex;s++){let c=r[s];if(!c)continue;let u=s===t.start.paragraphIndex?t.start.offset:0,l=s===t.end.paragraphIndex?t.end.offset:1/0;It(c,u,l,a);}let o=a.length<=1||a.every(s=>_t(s,a[0]));return {predominant:a.length>0?a[0]:{},isConsistent:o,allFormatting:a}}function bt(n,t){if(t.start.paragraphIndex===t.end.paragraphIndex){let r=n[t.start.paragraphIndex];return r?h(r).slice(t.start.offset,t.end.offset):""}let e=[];for(let r=t.start.paragraphIndex;r<=t.end.paragraphIndex;r++){let a=n[r];if(!a)continue;let o=h(a);r===t.start.paragraphIndex?e.push(o.slice(t.start.offset)):r===t.end.paragraphIndex?e.push(o.slice(0,t.end.offset)):e.push(o);}return e.join(`
|
|
7
|
+
`)}function yt(n,t,e){let r=[],a=0,o=n[t.paragraphIndex];if(o){let c=h(o).slice(0,t.offset);r.unshift(c),a+=c.length;}for(let s=t.paragraphIndex-1;s>=0&&a<e;s--){let c=n[s];if(!c)continue;let u=h(c);r.unshift(u),a+=u.length;}let i=r.join(`
|
|
8
|
+
`);return i.length>e?"..."+i.slice(-e):i}function Ct(n,t,e){let r=[],a=0,o=n[t.paragraphIndex];if(o){let c=h(o).slice(t.offset);r.push(c),a+=c.length;}for(let s=t.paragraphIndex+1;s<n.length&&a<e;s++){let c=n[s];if(!c)continue;let u=h(c);r.push(u),a+=u.length;}let i=r.join(`
|
|
9
|
+
`);return i.length>e?i.slice(0,e)+"...":i}function Pt(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=I(r),o=e+a.length;if(t>=e&&t<o)return r.formatting||{};e=o;}else if(r.type==="hyperlink"){let a=k(r),o=e+a.length;if(t>=e&&t<o){for(let i of r.children)if(i.type==="run")return i.formatting||{}}e=o;}return {}}function It(n,t,e,r){let a=0;for(let o of n.content)if(o.type==="run"){let i=I(o),s=a,c=a+i.length;c>t&&s<e&&o.formatting&&r.push({...o.formatting}),a=c;}else if(o.type==="hyperlink"){let i=k(o),s=a,c=a+i.length;if(c>t&&s<e)for(let u of o.children)u.type==="run"&&u.formatting&&r.push({...u.formatting});a=c;}}function Tt(n,t){return false}function At(n,t){let e=0;for(let r of n.content)if(r.type==="run"){let a=I(r);e+=a.length;}else if(r.type==="hyperlink"){let a=k(r),o=e,i=e+a.length;if(t>=o&&t<i)return true;e=i;}return false}function St(n,t,e){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 a=O(n);return a>50&&r.push({id:"summarize",label:"Summarize",description:"Create a shorter version",priority:9}),a<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((o,i)=>(i.priority||0)-(o.priority||0)),r}function kt(n,t){let e=new Set;for(let r=t.start.paragraphIndex;r<=t.end.paragraphIndex;r++){let a=n[r];a&&(a.listRendering?e.add("list"):a.formatting?.styleId?.toLowerCase().includes("heading")?e.add("heading"):e.add("prose"));}return e.size>1?"mixed":e.has("list")?"list":e.has("heading")?"heading":"prose"}function Ft(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 t=[];for(let e of n.content)e.type==="run"?t.push(I(e)):e.type==="hyperlink"&&t.push(k(e));return t.join("")}function I(n){return n.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function k(n){let t=[];for(let e of n.children)e.type==="run"&&t.push(I(e));return t.join("")}function O(n){return n.split(/\s+/).filter(t=>t.length>0).length}function _t(n,t){let e=Object.keys(n),r=Object.keys(t);return e.length!==r.length?false:e.every(a=>{let o=n[a],i=t[a];return o===i})}function Rt(){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 Ht(){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 Dt(n={}){let t=Ht();n.pageWidth!==void 0&&(t.pageWidth=n.pageWidth),n.pageHeight!==void 0&&(t.pageHeight=n.pageHeight),n.orientation!==void 0&&(t.orientation=n.orientation),n.marginTop!==void 0&&(t.marginTop=n.marginTop),n.marginBottom!==void 0&&(t.marginBottom=n.marginBottom),n.marginLeft!==void 0&&(t.marginLeft=n.marginLeft),n.marginRight!==void 0&&(t.marginRight=n.marginRight);let e={type:"text",text:n.initialText||""};return {package:{document:{content:[{type:"paragraph",content:[{type:"run",content:n.initialText?[e]:[],formatting:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}}}],formatting:{lineSpacing:276}}],finalSectionProperties:t},styles:{docDefaults:{rPr:{fontSize:22,fontFamily:{ascii:"Arial",hAnsi:"Arial"}},pPr:{lineSpacing:276}},styles:Rt()}},templateVariables:[],warnings:[]}}function Ce(n,t={}){return Dt({...t,initialText:n})}function Ie(n){return {start:n,end:n,collapsed:true}}function Te(n,t){return {start:n,end:t,collapsed:n.paragraphIndex===t.paragraphIndex&&n.offset===t.offset}}function Ae(n,t){return !(n.paragraphIndex<t.start.paragraphIndex||n.paragraphIndex===t.start.paragraphIndex&&n.offset<t.start.offset||n.paragraphIndex>t.end.paragraphIndex||n.paragraphIndex===t.end.paragraphIndex&&n.offset>t.end.offset)}function Se(n,t){return n.paragraphIndex<t.paragraphIndex?-1:n.paragraphIndex>t.paragraphIndex?1:n.offset<t.offset?-1:n.offset>t.offset?1:0}function ke(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 Fe(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 _e=["askAI","rewrite","expand","summarize","translate","explain"];function Re(n){return {...n,id:wt()}}function wt(){return `cmd_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}export{le as A,tt as B,de as C,Y as D,xt as E,xe as F,be as G,Dt as H,Ce as I,Ie as J,Te as K,Ae as L,Se as M,ke as N,Fe as O,_e as P,Re as Q,g as a,Bt as b,Et as c,vt as d,Ot as e,Nt as f,Vt as g,Lt as h,Mt as i,jt as j,zt as k,Wt as l,$t as m,Gt as n,qt as o,Xt as p,Kt as q,Yt as r,Jt as s,Qt as t,Zt as u,te as v,ee as w,ne as x,A as y,ue as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var K="Calibri";var _=null;function W(){if(!_){let e=typeof document<"u"?document.createElement("canvas"):null;if(!e)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(_=e.getContext("2d"),!_)throw new Error("Failed to get 2D context from canvas")}return _}function ce(){_=null;}var oe='"Segoe UI", Arial, sans-serif';function U(e){let n=[];e.italic&&n.push("italic"),e.bold&&n.push("bold");let c=e.fontSize??11,r=J(c);n.push(`${r}px`);let a=e.fontFamily??K,t=a.includes(" ")?`"${a}"`:a;return n.push(`${t}, ${oe}`),n.join(" ")}function ae(e){let n=e.fontSize??11,c=e.fontFamily??K,r=J(n),a=r*.8,t=r*.2,s=r*1.15;try{let i=W();i.font=U(e);let o=i.measureText("Hg");typeof o.actualBoundingBoxAscent=="number"&&typeof o.actualBoundingBoxDescent=="number"&&(a=o.actualBoundingBoxAscent,t=o.actualBoundingBoxDescent),typeof o.fontBoundingBoxAscent=="number"&&typeof o.fontBoundingBoxDescent=="number"&&(s=o.fontBoundingBoxAscent+o.fontBoundingBoxDescent);}catch{}return s=Math.max(s,a+t),{fontSize:n,ascent:a,descent:t,lineHeight:s,fontFamily:c}}function se(e,n){if(!e)return 0;let c=W();c.font=U(n);let r=c.measureText(e),a=r.width,t=(r.actualBoundingBoxLeft||0)+(r.actualBoundingBoxRight||0),s=Math.max(a,t);return n.letterSpacing&&e.length>1&&(s+=n.letterSpacing*(e.length-1)),s}function G(e,n){let c=ae(n);if(!e)return {width:0,charWidths:[],metrics:c};let r=W();r.font=U(n);let a=n.letterSpacing??0,t=[],s=0;for(let i=0;i<e.length;i++){let o=e[i],m=r.measureText(o).width;a&&i<e.length-1&&(m+=a),t.push(m),s+=m;}return {width:s,charWidths:t,metrics:c}}function le(e,n){if(n.length===0||e<=0)return 0;let c=0;for(let r=0;r<n.length;r++){let a=n[r],t=c+a/2;if(e<=t)return r;c+=a;}return n.length}function J(e){return e*96/72}function $(e,n){let c=e.pageGap??0,r=0;for(let a=0;a<n&&a<e.pages.length;a++){let s=e.pages[a].size?.h??e.pageSize.h;r+=s+c;}return r}function Q(e,n){return e.findIndex(c=>c.id===n)}function ie(e,n){let c=0;for(let r=e.fromLine;r<e.toLine&&r<n.lines.length;r++)c+=n.lines[r].lineHeight;return c}function ge(e,n,c,r){let a=[...e.page.fragments].sort((t,s)=>{let i=t.y-s.y;return Math.abs(i)>.5?i:t.x-s.x});for(let t of a){let s=Q(n,t.blockId);if(s===-1)continue;let i=n[s],o=c[s];if(!i||!o)continue;let g;if(t.kind==="paragraph"){if(i.kind!=="paragraph"||o.kind!=="paragraph")continue;g=ie(t,o);}else if(t.kind==="table")g=t.height;else if(t.kind==="image")g=t.height;else continue;let m=r.x>=t.x&&r.x<=t.x+t.width,l=r.y>=t.y&&r.y<=t.y+g;if(m&&l)return {fragment:t,block:i,measure:o,pageIndex:e.pageIndex,localX:r.x-t.x,localY:r.y-t.y}}return null}function fe(e,n,c,r){for(let a of e.page.fragments){if(a.kind!=="table")continue;let t=a,s=r.x>=t.x&&r.x<=t.x+t.width,i=r.y>=t.y&&r.y<=t.y+t.height;if(!s||!i)continue;let o=Q(n,t.blockId);if(o===-1)continue;let g=n[o],m=c[o];if(!g||g.kind!=="table"||!m||m.kind!=="table")continue;let l=g,f=m,p=r.x-t.x,M=r.y-t.y,b=0,d=-1;if(f.rows.length===0||l.rows.length===0)continue;for(let u=t.fromRow;u<t.toRow&&u<f.rows.length;u++){let w=f.rows[u];if(M>=b&&M<b+w.height){d=u;break}b+=w.height;}if(d===-1&&(d=Math.min(t.toRow-1,f.rows.length-1),d<t.fromRow))continue;let h=f.rows[d],T=l.rows[d];if(!h||!T)continue;let x=0,k=-1;if(h.cells.length===0||T.cells.length===0)continue;for(let u=0;u<h.cells.length;u++){let w=h.cells[u];if(p>=x&&p<x+w.width){k=u;break}x+=w.width;}if(k===-1&&(k=h.cells.length-1,k<0))continue;let I=h.cells[k],B=T.cells[k];if(!I||!B)continue;let F=0;for(let u=t.fromRow;u<d;u++)F+=f.rows[u]?.height??0;let y=0;for(let u=0;u<k;u++)y+=h.cells[u]?.width??0;let S,P;if(B.blocks&&B.blocks.length>0){let u=B.blocks[0],w=I.blocks[0];u.kind==="paragraph"&&w?.kind==="paragraph"&&(S=u,P=w);}let R=p-y,H=M-F;return {fragment:t,block:l,measure:f,pageIndex:e.pageIndex,rowIndex:d,colIndex:k,cellBlock:S,cellMeasure:P,cellLocalX:Math.max(0,R),cellLocalY:Math.max(0,H)}}return null}function V(e){return {fontFamily:e.fontFamily??"Arial",fontSize:e.fontSize??12,bold:e.bold,italic:e.italic,letterSpacing:e.letterSpacing}}function Z(e,n){return e.findIndex(c=>c.id===n)}function z(e,n){let r=(e.pmStart??0)+1,a=0,t;for(let o=0;o<e.runs.length&&o<=n.toRun;o++){let g=e.runs[o];if(g){if(o<n.fromRun)g.kind==="text"?a+=(g.text??"").length:a+=1;else if(o===n.fromRun){a+=n.fromChar,t=r+a;break}}}t===void 0&&(t=r);let s=0;for(let o=n.fromRun;o<=n.toRun&&o<e.runs.length;o++){let g=e.runs[o];if(g)if(g.kind==="text"){let m=g.text??"",l=o===n.fromRun?n.fromChar:0,f=o===n.toRun?n.toChar:m.length;s+=f-l;}else s+=1;}let i=t+s;return {pmStart:t,pmEnd:i}}function ee(e,n,c,r){let a=[];for(let t=0;t<n.lines.length;t++){let s=n.lines[t],i=z(e,s);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>c&&i.pmStart<r&&a.push({line:s,index:t});}return a}function X(e,n,c){let r=z(e,n);return r.pmStart===void 0?0:Math.max(0,c-r.pmStart)}function A(e,n,c,r){let a=0,t=0;for(let s=n.fromRun;s<=n.toRun&&s<e.runs.length;s++){let i=e.runs[s];if(i){if(i.kind==="tab"){let o=i.width??48;if(t+1>=c)return c<=t?a:a+o;a+=o,t+=1;continue}if(i.kind==="image"){let o=i.width;if(t+1>=c)return c<=t?a:a+o;a+=o,t+=1;continue}if(i.kind==="lineBreak"){if(c<=t)return a;t+=1;continue}if(i.kind==="text"){let o=i.text??"",g=s===n.fromRun,m=s===n.toRun,l=g?n.fromChar:0,f=m?n.toChar:o.length,p=o.slice(l,f);if(t+p.length>=c){let d=c-t,h=V(i),T=G(p.slice(0,d),h);return a+T.width}let M=V(i),b=G(p,M);a+=b.width,t+=p.length;}}}return a}function Y(e,n){let c=0;for(let r=0;r<n&&r<e.lines.length;r++)c+=e.lines[r].lineHeight;return c}function de(e,n,c,r,a){if(r===a)return [];let t=Math.min(r,a),s=Math.max(r,a),i=[];for(let o=0;o<e.pages.length;o++){let g=e.pages[o],m=$(e,o);for(let l of g.fragments){if(l.kind==="paragraph"){let f=Z(n,l.blockId);if(f===-1)continue;let p=n[f],M=c[f];if(!p||p.kind!=="paragraph"||!M||M.kind!=="paragraph")continue;let b=p,d=M,h=l,T=ee(b,d,t,s);for(let{line:x,index:k}of T){if(k<h.fromLine||k>=h.toLine)continue;let I=z(b,x);if(I.pmStart===void 0||I.pmEnd===void 0)continue;let B=Math.max(I.pmStart,t),F=Math.min(I.pmEnd,s);if(B>=F)continue;let y=X(b,x,B),S=X(b,x,F),P=b.attrs?.indent,R=P?.left??0,H=P?.right??0,u=Math.max(0,l.width-R-H),w=A(b,x,y),D=A(b,x,S),C=b.attrs?.alignment??"left",L=0;C==="center"?L=Math.max(0,(u-x.width)/2):C==="right"&&(L=Math.max(0,u-x.width));let v=Y(d,k)-Y(d,h.fromLine),E=l.x+R+L+Math.min(w,D),N=Math.max(1,Math.abs(D-w)),O=l.y+v;i.push({x:E,y:O+m,width:N,height:x.lineHeight,pageIndex:o});}}if(l.kind==="table"){let f=Z(n,l.blockId);if(f===-1)continue;let p=n[f],M=c[f];if(!p||p.kind!=="table"||!M||M.kind!=="table")continue;let b=p,d=M,h=l,T=0;for(let x=h.fromRow;x<h.toRow&&x<b.rows.length;x++){let k=b.rows[x],I=d.rows[x];if(!k||!I)continue;let B=0;for(let F=0;F<k.cells.length;F++){let y=k.cells[F],S=I.cells[F];if(!(!y||!S)){for(let P=0;P<y.blocks.length;P++){let R=y.blocks[P],H=S.blocks[P];if(!R||R.kind!=="paragraph"||!H||H.kind!=="paragraph")continue;let u=R,w=H,D=ee(u,w,t,s),C=0;for(let{line:L,index:v}of D){let E=z(u,L);if(E.pmStart===void 0||E.pmEnd===void 0)continue;let N=Math.max(E.pmStart,t),O=Math.min(E.pmEnd,s);if(N>=O)continue;let te=X(u,L,N),ne=X(u,L,O),j=A(u,L,te,S.width),q=A(u,L,ne,S.width),re=Y(w,v);i.push({x:h.x+B+Math.min(j,q),y:h.y+T+C+re+m,width:Math.max(1,Math.abs(q-j)),height:L.lineHeight,pageIndex:o});}C+=w.totalHeight;}B+=S.width;}}T+=I.height;}}if(l.kind==="image"){let f=l.pmStart??0;(l.pmEnd??f+1)>t&&f<s&&i.push({x:l.x,y:l.y+m,width:l.width,height:l.height,pageIndex:o});}}}return i}function xe(e,n,c,r){for(let a=0;a<e.pages.length;a++){let t=e.pages[a],s=$(e,a);for(let i of t.fragments){if(i.kind==="paragraph"){let o=Z(n,i.blockId);if(o===-1)continue;let g=n[o],m=c[o];if(!g||g.kind!=="paragraph"||!m||m.kind!=="paragraph")continue;let l=g,f=m,p=i,M=l.pmStart??0,b=l.pmEnd??M;if(r<M||r>b)continue;for(let d=p.fromLine;d<p.toLine;d++){let h=f.lines[d];if(!h)continue;let T=z(l,h);if(!(T.pmStart===void 0||T.pmEnd===void 0)&&r>=T.pmStart&&r<=T.pmEnd){let x=X(l,h,r),k=l.attrs?.indent,I=k?.left??0,B=k?.right??0,F=Math.max(0,i.width-I-B),y=A(l,h,x),S=l.attrs?.alignment??"left",P=0;S==="center"?P=Math.max(0,(F-h.width)/2):S==="right"&&(P=Math.max(0,F-h.width));let R=Y(f,d)-Y(f,p.fromLine);return {x:i.x+I+P+y,y:i.y+R+s,height:h.lineHeight,pageIndex:a}}}}if(i.kind==="image"){let o=i.pmStart??0,g=i.pmEnd??o+1;if(r>=o&&r<=g){let m=r===o?0:i.width;return {x:i.x+m,y:i.y+s,height:i.height,pageIndex:a}}}}}return null}function be(e){return e.length<=1?false:new Set(e.map(c=>c.pageIndex)).size>1}function ke(e){let n=new Map;for(let c of e){let r=n.get(c.pageIndex)??[];r.push(c),n.set(c.pageIndex,r);}return n}export{ce as a,ae as b,se as c,G as d,le as e,J as f,ge as g,fe as h,de as i,xe as j,be as k,ke as l};
|