@eigenpal/docx-js-editor 0.0.13 → 0.0.15
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 +0 -3
- package/dist/FindReplaceDialog-46BE7Q2G.cjs +1 -0
- package/dist/{FindReplaceDialog-RWYDRWHF.js → FindReplaceDialog-UMXCBBST.js} +1 -1
- package/dist/{FootnotePropertiesDialog-BC6JIPDA.cjs → FootnotePropertiesDialog-OBQXOBJE.cjs} +1 -1
- package/dist/{FootnotePropertiesDialog-CWQF5EBK.js → FootnotePropertiesDialog-TYQGPWPX.js} +1 -1
- package/dist/{HyperlinkDialog-EG2BSLPD.cjs → HyperlinkDialog-22NH7ZLP.cjs} +1 -1
- package/dist/{HyperlinkDialog-YAVK64F4.js → HyperlinkDialog-UOERZIBM.js} +1 -1
- package/dist/{ImagePositionDialog-S6SMH7XH.js → ImagePositionDialog-52FDANUK.js} +1 -1
- package/dist/{ImagePositionDialog-IGYS5KMK.cjs → ImagePositionDialog-ZK5WFBRC.cjs} +1 -1
- package/dist/{ImagePropertiesDialog-VGV4E4SN.cjs → ImagePropertiesDialog-LU44RDIY.cjs} +1 -1
- package/dist/{ImagePropertiesDialog-UO5QUIBS.js → ImagePropertiesDialog-YPSLPSF6.js} +1 -1
- package/dist/{TablePropertiesDialog-WRM47JI6.cjs → TablePropertiesDialog-KMOYHPGF.cjs} +1 -1
- package/dist/{TablePropertiesDialog-VBOU4DID.js → TablePropertiesDialog-OUUJAA7D.js} +1 -1
- package/dist/chunk-24N3L4IL.cjs +258 -0
- package/dist/{chunk-PNMZPPPI.cjs → chunk-46OFHSPJ.cjs} +1 -1
- package/dist/{chunk-FLECKDK4.cjs → chunk-65OFYOHF.cjs} +2 -2
- package/dist/chunk-6YFGCUHU.js +4 -0
- package/dist/{chunk-KVAT5SVD.js → chunk-CTYOM6BE.js} +1 -1
- package/dist/chunk-DYQUXFE5.cjs +1 -0
- package/dist/{chunk-A7VY2V4X.cjs → chunk-FYAWM7MP.cjs} +1 -1
- package/dist/chunk-GLFFXY2X.js +258 -0
- package/dist/chunk-JKN7TNPA.js +12 -0
- package/dist/{chunk-6MBDPZVD.js → chunk-MLSHZVL7.js} +2 -2
- package/dist/chunk-NO7WUK5E.cjs +12 -0
- package/dist/chunk-O7QVCJN6.cjs +4 -0
- package/dist/{chunk-W4DUKACP.cjs → chunk-OEOUMSWH.cjs} +3 -3
- package/dist/chunk-OWMXCVKB.js +1 -0
- package/dist/{chunk-XVFMG77A.cjs → chunk-PXC7ARQB.cjs} +1 -1
- package/dist/{chunk-QHWHCIUW.js → chunk-R5SKERM2.js} +1 -1
- package/dist/chunk-RM3ITJ2H.cjs +10 -0
- package/dist/{chunk-M7F2CUUD.js → chunk-ULNHBTYA.js} +1 -1
- package/dist/chunk-UXXV4GT6.js +10 -0
- package/dist/chunk-VOWKSURW.cjs +1 -0
- package/dist/{chunk-CZ7W7MCM.cjs → chunk-VTAS7VZ6.cjs} +1 -1
- package/dist/{chunk-MMJD2DLL.js → chunk-WFWLPKQA.js} +1 -1
- package/dist/chunk-WFYRA2TH.js +1 -0
- package/dist/{chunk-MDPDH7KS.js → chunk-YMXKVLTU.js} +1 -1
- package/dist/core-plugins.cjs +1 -1
- package/dist/core-plugins.d.cts +7 -4
- package/dist/core-plugins.d.ts +7 -4
- package/dist/core-plugins.js +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/executor-ITYZTNSH.cjs +1 -0
- package/dist/executor-TC7CLATE.js +1 -0
- package/dist/headless.cjs +2 -2
- package/dist/headless.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/mcp-cli.js +21 -21
- package/dist/mcp.cjs +8 -8
- package/dist/mcp.js +1 -1
- package/dist/{processTemplate-QOEAXCKA.cjs → processTemplate-525HZL4S.cjs} +1 -1
- package/dist/{processTemplate-BHBTDAIC.js → processTemplate-RJN6452W.js} +1 -1
- package/dist/{react-Be1YOl4z.d.ts → react-BZxD04XV.d.ts} +2 -8
- package/dist/{react-DPuSVbgY.d.cts → react-D8eAYckC.d.cts} +2 -8
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/selectionRects-PQEUEW35.cjs +1 -0
- package/dist/selectionRects-QAG5RSHD.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.cts +1 -53
- package/dist/ui.d.ts +1 -53
- package/dist/ui.js +1 -1
- package/package.json +1 -2
- package/dist/FindReplaceDialog-BAACAU67.cjs +0 -1
- package/dist/chunk-3IYNTJO5.js +0 -1
- package/dist/chunk-6YLNNCRZ.cjs +0 -10
- package/dist/chunk-BVQ2QRHA.cjs +0 -4
- package/dist/chunk-COP5BIBZ.js +0 -10
- package/dist/chunk-E6XDMUAM.js +0 -4
- package/dist/chunk-EPCZ24TY.cjs +0 -12
- package/dist/chunk-MTX3EEBJ.js +0 -258
- package/dist/chunk-OTG4NABM.js +0 -12
- package/dist/chunk-RTESADL3.cjs +0 -1
- package/dist/chunk-S6FZ7HL6.js +0 -1
- package/dist/chunk-VN7XH644.cjs +0 -258
- package/dist/chunk-Y37VT37I.cjs +0 -1
- package/dist/executor-44OB3DFD.js +0 -1
- package/dist/executor-U3BZPPGN.cjs +0 -1
- package/dist/selectionRects-I5JVL73G.cjs +0 -1
- package/dist/selectionRects-LO3FJT47.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-2ASOEN3V.js';import {d
|
|
1
|
+
import {a}from'./chunk-2ASOEN3V.js';import {d as d$1,e}from'./chunk-YMXKVLTU.js';import {b,a as a$1}from'./chunk-WFWLPKQA.js';import {p}from'./chunk-JKN7TNPA.js';import {d}from'./chunk-OWMXCVKB.js';var m=class i{constructor(t){d(this,"_document");d(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let e=await p(t);return new i(e)}static fromDocument(t){return new i(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],e=this._document.package.document;for(let n of e.content)n.type==="paragraph"&&this._extractParagraphSegments(n,t);return t}getVariables(){return a(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let o=r;e.push({id:n,name:o.name||n,type:o.type==="numbering"?"paragraph":o.type||"paragraph",builtIn:o.default});}return e}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(n=>n.length>0).length}getCharacterCount(t=true){let e=this.getText();return t?e.length:e.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let e=this._document.package.document,n=e.content.filter(a=>a.type==="paragraph"),r=n.map((a,s)=>{let u=this._getParagraphText(a),c=a.formatting?.styleId;return {index:s,preview:u.slice(0,t),style:c,isHeading:c?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(c),isListItem:!!a.listRendering,isEmpty:u.trim().length===0}}),o=(e.sections||[]).map((a,s)=>({index:s,paragraphCount:a.content?.length||0,pageSize:a.properties?.pageWidth&&a.properties?.pageHeight?{width:a.properties.pageWidth,height:a.properties.pageHeight}:void 0,isLandscape:a.properties?.orientation==="landscape",hasHeader:!!a.properties?.headerReferences?.length,hasFooter:!!a.properties?.footerReferences?.length}));return {paragraphCount:n.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:r,sections:o,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,n={}){let r={type:"insertText",position:t,text:e,formatting:n.formatting};return this._executeCommand(r)}replaceRange(t,e,n={}){let r={type:"replaceText",range:t,text:e,formatting:n.formatting};return this._executeCommand(r)}deleteRange(t){let e={type:"deleteText",range:t};return this._executeCommand(e)}applyFormatting(t,e){let n={type:"formatText",range:t,formatting:e};return this._executeCommand(n)}applyStyle(t,e){let n={type:"applyStyle",paragraphIndex:t,styleId:e};return this._executeCommand(n)}applyParagraphFormatting(t,e){let n={type:"formatParagraph",paragraphIndex:t,formatting:e};return this._executeCommand(n)}insertTable(t,e,n,r={}){let o={type:"insertTable",position:t,rows:e,columns:n,data:r.data,hasHeader:r.hasHeader};return this._executeCommand(o)}insertImage(t,e,n={}){let r={type:"insertImage",position:t,src:e,width:n.width,height:n.height,alt:n.alt};return this._executeCommand(r)}insertHyperlink(t,e,n={}){let r={type:"insertHyperlink",range:t,url:e,displayText:n.displayText,tooltip:n.tooltip};return this._executeCommand(r)}removeHyperlink(t){let e={type:"removeHyperlink",range:t};return this._executeCommand(e)}insertParagraphBreak(t){let e={type:"insertParagraphBreak",position:t};return this._executeCommand(e)}mergeParagraphs(t,e){let n={type:"mergeParagraphs",paragraphIndex:t,count:e};return this._executeCommand(n)}setVariable(t,e){return this._pendingVariables[t]=e,this}setVariables(t){for(let[e,n]of Object.entries(t))this._pendingVariables[e]=n;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let e={...this._pendingVariables,...t};if(Object.keys(e).length===0)return this;let n=this._document.originalBuffer;if(!n)throw new Error("Cannot apply variables: no original buffer for processing");let{processTemplate:r}=await import('./processTemplate-RJN6452W.js'),o=r(n,e),a=await p(o),s=new i(a);return s._pendingVariables={},s}async toBuffer(){return this._document.originalBuffer?d$1(this._document):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=b(this._document,t);return new i(e)}_executeCommand(t){let e=a$1(this._document,t),n=new i(e);return n._pendingVariables={...this._pendingVariables},n}_getBodyText(t){let e=[];for(let n of t.content)n.type==="paragraph"?e.push(this._getParagraphText(n)):n.type==="table"&&e.push(this._getTableText(n));return e.join(`
|
|
2
2
|
`)}_getParagraphText(t){let e=[];for(let n of t.content)n.type==="run"?e.push(this._getRunText(n)):n.type==="hyperlink"&&e.push(this._getHyperlinkText(n));return e.join("")}_getRunText(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("")}_getHyperlinkText(t){let e=[];for(let n of t.children)n.type==="run"&&e.push(this._getRunText(n));return e.join("")}_getTableText(t){let e=[];for(let n of t.rows)for(let r of n.cells)for(let o of r.content)o.type==="paragraph"&&e.push(this._getParagraphText(o));return e.join(" ")}_extractParagraphSegments(t,e){for(let n of t.content)if(n.type==="run"){let r=this._getRunText(n);r&&e.push({text:r,formatting:n.formatting});}else if(n.type==="hyperlink"){let r=n.href||"";for(let o of n.children)if(o.type==="run"){let a=this._getRunText(o);a&&e.push({text:a,formatting:o.formatting,isHyperlink:true,hyperlinkUrl:r});}}}_parseHeadingLevel(t){if(!t)return;let e=t.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}_hasImages(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="run"){for(let r of n.content)if(r.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="hyperlink")return true}return false}};async function A(i){return m.fromBuffer(i)}function T(i){return m.fromDocument(i)}export{m as a,A as b,T as c};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {b as b$1,f}from'./chunk-ESI4BSBF.js';import {b}from'./chunk-2ASOEN3V.js';import {p}from'./chunk-JKN7TNPA.js';function M(o){return typeof o=="object"&&o!==null&&("_def"in o||"parse"in o||"safeParse"in o)}function v(o,i){let s=i,{position:n,variableName:t}=s,e=JSON.parse(JSON.stringify(o)),a=e.package.document.content.filter(m=>m.type==="paragraph");if(n.paragraphIndex>=a.length)throw new Error(`Paragraph index ${n.paragraphIndex} out of bounds`);let l=a[n.paragraphIndex],p=`{${t}}`;return C(l,n.offset,p),e.templateVariables||(e.templateVariables=[]),e.templateVariables.includes(t)||e.templateVariables.push(t),e}function w(o,i){let s=i,{range:n,variableName:t}=s,e=JSON.parse(JSON.stringify(o)),a=e.package.document.content.filter(m=>m.type==="paragraph");if(n.start.paragraphIndex!==n.end.paragraphIndex)throw new Error("Template variable replacement cannot span multiple paragraphs");if(n.start.paragraphIndex>=a.length)throw new Error(`Paragraph index ${n.start.paragraphIndex} out of bounds`);let l=a[n.start.paragraphIndex];I(l,n.start.offset,n.end.offset);let p=`{${t}}`;return C(l,n.start.offset,p),e.templateVariables||(e.templateVariables=[]),e.templateVariables.includes(t)||e.templateVariables.push(t),e}function C(o,i,s){let n=0,t=false;for(let e=0;e<o.content.length;e++){let r=o.content[e];if(r.type==="run"){let a=g(r),l=n,p=n+a.length;if(!t&&i>=l&&i<=p){let m=i-l,f=a.slice(0,m),x=a.slice(m),d=[];for(let c=0;c<e;c++)d.push(o.content[c]);f&&d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:f}]}),d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:s}]}),x&&d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:x}]});for(let c=e+1;c<o.content.length;c++)d.push(o.content[c]);o.content=d,t=true;break}n=p;}else if(r.type==="hyperlink")for(let a of r.children)a.type==="run"&&(n+=g(a).length);}t||o.content.push({type:"run",content:[{type:"text",text:s}]});}function I(o,i,s){let n=[],t=0;for(let e of o.content)if(e.type==="run"){let r=g(e),a=t,l=t+r.length;if(l<=i||a>=s)n.push(e);else {let p="";a<i&&(p+=r.slice(0,i-a)),l>s&&(p+=r.slice(s-a)),p.length>0&&n.push({type:"run",formatting:e.formatting,content:[{type:"text",text:p}]});}t=l;}else n.push(e);o.content=n;}function g(o){return o.content.filter(i=>i.type==="text").map(i=>i.text).join("")}var u={type:"string",description:"Document ID from a previous docx_load call"},D={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)"},offset:{type:"number",description:"Character offset within the paragraph"}},required:["paragraphIndex","offset"]},V={name:"docx_get_variables",description:`List all template variables ({name} format) found in the document.
|
|
2
|
+
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
|
+
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(o,i)=>{let{documentId:s}=o,n=i.session.documents.get(s);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};try{let t=b(n.document);return {content:[{type:"text",text:JSON.stringify({variables:t.variables,count:t.variables.length,totalOccurrences:t.totalOccurrences,byLocation:t.byLocation},null,2)}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to detect variables: ${t.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low",examples:[{description:"Get all variables from a loaded document",input:{documentId:"doc_123"},output:'{"variables": ["customer_name", "invoice_date"], "count": 2}'}]}},R={name:"docx_insert_variable",description:`Insert a template variable placeholder ({name}) at a specific position in the document.
|
|
4
|
+
The variable can later be substituted with actual values using docx_apply_template.
|
|
5
|
+
Variable names should follow the pattern: letters, numbers, underscores, starting with a letter.`,inputSchema:{type:"object",properties:{documentId:u,position:D,variableName:{type:"string",description:'Variable name without braces (e.g., "customer_name"). Will be inserted as {customer_name}',pattern:"^[a-zA-Z_][a-zA-Z0-9_]*$"}},required:["documentId","position","variableName"]},handler:async(o,i)=>{let{documentId:s,position:n,variableName:t}=o,e=i.session.documents.get(s);if(!e)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};if(!/^[a-zA-Z_][a-zA-Z0-9_\-.]*$/.test(t))return {isError:true,content:[{type:"text",text:`Invalid variable name: ${t}. Must start with letter/underscore and contain only alphanumeric, underscore, hyphen, or dot.`}]};try{let{executeCommand:r}=await import('./executor-TC7CLATE.js'),a=r(e.document,{type:"insertText",position:n,text:`{${t}}`});return e.document=a,e.lastModified=Date.now(),a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t)||a.templateVariables.push(t),{content:[{type:"text",text:JSON.stringify({success:!0,variable:t,insertedAs:`{${t}}`,position:n})}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to insert variable: ${r.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"low",examples:[{description:"Insert customer name variable at start of first paragraph",input:{documentId:"doc_123",position:{paragraphIndex:0,offset:0},variableName:"customer_name"}}]}},S={name:"docx_apply_template",description:`Substitute template variables with actual values in the document.
|
|
6
|
+
Replaces all {variable} placeholders with the corresponding values provided.
|
|
7
|
+
Preserves all formatting (fonts, styles, colors, tables).
|
|
8
|
+
Use docx_get_variables first to discover what variables exist in the document.`,inputSchema:{type:"object",properties:{documentId:u,variables:{type:"object",description:'Map of variable names to values (e.g., {"customer_name": "John Doe", "date": "2024-01-15"})',additionalProperties:{type:"string"}},keepUnmatchedVariables:{type:"boolean",description:"If true, keep {variable} placeholders for variables not in the map. If false, replace with empty string. Default: true",default:true}},required:["documentId","variables"]},handler:async(o,i)=>{let{documentId:s,variables:n,keepUnmatchedVariables:t=true}=o,e=i.session.documents.get(s);if(!e)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};if(!e.buffer)return {isError:true,content:[{type:"text",text:"Cannot apply template: document was not loaded from a DOCX buffer"}]};try{let r=b$1(e.buffer,n,{nullGetter:t?"keep":"empty"}),a=await p(r.buffer);return e.document=a,e.buffer=r.buffer,e.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedVariables:r.replacedVariables,unreplacedVariables:r.unreplacedVariables,warnings:r.warnings})}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to apply template: ${r.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"medium",examples:[{description:"Fill in customer and date values",input:{documentId:"doc_123",variables:{customer_name:"Jane Smith",invoice_date:"2024-02-15",amount:"$1,234.56"}}}]}},k={name:"docx_validate_template",description:`Validate that a document is a valid docxtemplater template.
|
|
9
|
+
Checks for syntax errors like unclosed braces, invalid tag names, etc.
|
|
10
|
+
Returns validation result with any errors found and list of valid tags.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(o,i)=>{let{documentId:s}=o,n=i.session.documents.get(s);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};if(!n.buffer)return {isError:true,content:[{type:"text",text:"Cannot validate template: document was not loaded from a DOCX buffer"}]};try{let t=f(n.buffer);return {content:[{type:"text",text:JSON.stringify({valid:t.valid,tags:t.tags,errors:t.errors.map(e=>({message:e.message,variable:e.variable,type:e.type}))},null,2)}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to validate template: ${t.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low"}},P=[V,R,S,k];var E={id:"docxtemplater",name:"Docxtemplater",version:"1.0.0",description:"Template variable support using standard docxtemplater syntax ({variable})",commandHandlers:{insertTemplateVariable:v,replaceWithTemplateVariable:w},mcpTools:P};export{M as a,E as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var h=a=>{throw TypeError(a)};var l=(a,b,c)=>b in a?f(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var p=(a,b)=>()=>(a&&(b=a(a=0)),b);var q=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:true});},m=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of j(b))!k.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=i(b,e))||d.enumerable});return a};var r=a=>m(f({},"__esModule",{value:true}),a);var s=(a,b,c)=>l(a,typeof b!="symbol"?b+"":b,c),g=(a,b,c)=>b.has(a)||h("Cannot "+c);var n=(a,b,c)=>(g(a,b,"read from private field"),c?c.call(a):b.get(a)),t=(a,b,c)=>b.has(a)?h("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),o=(a,b,c,d)=>(g(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c),u=(a,b,c)=>(g(a,b,"access private method"),c);var v=(a,b,c,d)=>({set _(e){o(a,b,e,c);},get _(){return n(a,b,d)}});exports.a=p;exports.b=q;exports.c=r;exports.d=s;exports.e=n;exports.f=t;exports.g=o;exports.h=u;exports.i=v;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');function _(){return {matchCase:false,matchWholeWord:false,useRegex:false}}function H(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X(e,n){if(!e)return null;try{let t;n.useRegex?t=e:t=H(e),n.matchWholeWord&&(t=`\\b${t}\\b`);let c=n.matchCase?"g":"gi";return new RegExp(t,c)}catch{return null}}function D(e,n,t){if(!e||!n)return [];let c=[],i=n;t.matchCase||(i=n.toLowerCase());let f=v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d;t.matchWholeWord?d=`\\b${f(i)}\\b`:d=f(i);let s=t.matchCase?"g":"gi",p=new RegExp(d,s),h;for(;(h=p.exec(e))!==null;)c.push({start:h.index,end:h.index+h[0].length}),h[0].length===0&&p.lastIndex++;return c}function me(e,n,t,c){let i=X(n,c);return i?e.replace(i,t):e}function be(e,n,t,c,i=0){let f=D(e,n,c),d=f.find(p=>p.start>=i)||f[0];return d?{content:e.substring(0,d.start)+t+e.substring(d.end),replaced:true,matchStart:d.start,matchEnd:d.start+t.length}:{content:e,replaced:false,matchStart:-1,matchEnd:-1}}function Se(e){return e?e.totalCount===0?"No results":e.totalCount===1?"1 match":`${e.currentIndex+1} of ${e.totalCount} matches`:""}function ye(e){return !e||e.trim()===""}function Ce(){return {currentMatchColor:"#FFFF00",otherMatchColor:"#FFFFAA"}}function k(e){if(!e||!e.content)return "";let n="";for(let t of e.content)t.type==="text"?n+=t.text||"":t.type==="tab"?n+=" ":t.type==="break"&&t.breakType==="textWrapping"&&(n+=`
|
|
2
|
-
`);return n}function Fe(e){if(!e||!e.content)return "";let n="";for(let t of e.content)if(t.type==="run")n+=k(t);else if(t.type==="hyperlink")for(let c of t.children||[])c.type==="run"&&(n+=k(c));return n}function Re(e,n,t){if(!e||!n)return [];let c=[],i=e.package?.document||e.package?.document;if(!i||!i.content)return c;let f=0;for(let d of i.content)if(d.type==="paragraph"){let s=q(d,n,t,f);c.push(...s),f++;}else if(d.type==="table")for(let s of d.rows||[])for(let p of s.cells||[])for(let h of p.content||[])h.type;return c}function q(e,n,t,c){let i=[],f=Fe(e);if(!f)return i;let d=D(f,n,t);for(let s of d){let p=Te(e,s.start);i.push({paragraphIndex:c,contentIndex:p.contentIndex,startOffset:p.offsetInContent,endOffset:p.offsetInContent+(s.end-s.start),text:f.substring(s.start,s.end)});}return i}function Te(e,n){if(!e||!e.content)return {contentIndex:0,runIndex:0,offsetInContent:n};let t=0,c=0;for(let i of e.content){let f="";if(i.type==="run")f=k(i);else if(i.type==="hyperlink")for(let s of i.children||[])s.type==="run"&&(f+=k(s));let d=f.length;if(t+d>n)return {contentIndex:c,runIndex:c,offsetInContent:n-t};t+=d,c++;}return {contentIndex:Math.max(0,e.content.length-1),runIndex:Math.max(0,e.content.length-1),offsetInContent:0}}function Ie(e,n){if(!e||!n)return;let t=e.querySelector(`[data-paragraph-index="${n.paragraphIndex}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"});}function Ee(e){let[n,t]=react.useState({isOpen:false,searchText:"",replaceText:"",options:_(),matches:[],currentIndex:0,replaceMode:e?.initialReplaceMode??false}),c=react.useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:false,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),i=react.useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:true,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),f=react.useCallback(()=>{t(o=>({...o,isOpen:false}));},[]),d=react.useCallback(()=>{t(o=>({...o,isOpen:!o.isOpen}));},[]),s=react.useCallback(o=>{t(r=>({...r,searchText:o}));},[]),p=react.useCallback(o=>{t(r=>({...r,replaceText:o}));},[]),h=react.useCallback(o=>{t(r=>({...r,options:{...r.options,...o}}));},[]),v=react.useCallback((o,r=0)=>{let E=Math.max(0,Math.min(r,o.length-1));t(L=>({...L,matches:o,currentIndex:o.length>0?E:0})),e?.onMatchesChange?.(o),o.length>0?e?.onCurrentMatchChange?.(o[E],E):e?.onCurrentMatchChange?.(null,-1);},[e]),M=react.useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=(r.currentIndex+1)%r.matches.length,{...r,currentIndex:o})),o},[]),N=react.useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=r.currentIndex===0?r.matches.length-1:r.currentIndex-1,{...r,currentIndex:o})),o},[]),w=react.useCallback(o=>{t(r=>r.matches.length===0||o<0||o>=r.matches.length?r:{...r,currentIndex:o});},[]),x=react.useCallback(()=>n.matches.length===0?null:n.matches[n.currentIndex]||null,[n.matches,n.currentIndex]),O=react.useCallback(()=>n.matches.length>0,[n.matches.length]);return {state:n,openFind:c,openReplace:i,close:f,toggle:d,setSearchText:s,setReplaceText:p,setOptions:h,setMatches:v,goToNextMatch:M,goToPreviousMatch:N,goToMatch:w,getCurrentMatch:x,hasMatches:O}}var Me={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},Oe={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},Le={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},ke={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},Ne={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},we={padding:"16px"},Q={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},Z={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},Y={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},ee={...Y,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},Pe={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},B={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},te={...B,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},U={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},ne={...U,color:"var(--doc-border-input)",cursor:"not-allowed"},_e={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},W={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},oe={width:"14px",height:"14px",cursor:"pointer"},re={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},De={...re,color:"var(--doc-error)"},Ae=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})}),We=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})});function Ye({isOpen:e,onClose:n,onFind:t,onFindNext:c,onFindPrevious:i,onReplace:f,onReplaceAll:d,onHighlightMatches:s,onClearHighlights:p,initialSearchText:h="",replaceMode:v=false,currentResult:M,className:N,style:w}){let[x,O]=react.useState(""),[o,r]=react.useState(""),[E,L]=react.useState(v),[C,ae]=react.useState(false),[F,ce]=react.useState(false),[l,R]=react.useState(null),[ie,K]=react.useState(false),[se,z]=react.useState(false),P=react.useRef(null),$=react.useRef(null);react.useEffect(()=>{M!==void 0&&R(M);},[M]),react.useEffect(()=>{if(e){if(O(h),r(""),L(v),R(null),setTimeout(()=>{P.current?.focus(),P.current?.select();},100),h){let a=t(h,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s&&s(a.matches);}}else p&&p();},[e,h,v]);let S=react.useCallback(()=>{if(!x.trim()){R(null),p&&p();return}let a=t(x,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s?s(a.matches):p&&p();},[x,C,F,t,s,p]);react.useEffect(()=>{e&&x.trim()&&S();},[C,F]);let le=react.useCallback(a=>{O(a.target.value);},[]),de=react.useCallback(a=>{a.key==="Enter"?(a.preventDefault(),a.shiftKey?V():l?G():S()):a.key==="Escape"&&n();},[l,S,n]),pe=react.useCallback(a=>{a.key==="Enter"?(a.preventDefault(),j()):a.key==="Escape"&&n();},[n]),G=react.useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(c()&&l){let y=(l.currentIndex+1)%l.totalCount;R({...l,currentIndex:y});}},[x,l,S,c]),V=react.useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(i()&&l){let y=l.currentIndex===0?l.totalCount-1:l.currentIndex-1;R({...l,currentIndex:y});}},[x,l,S,i]),j=react.useCallback(()=>{if(!l||l.totalCount===0)return;if(f(o)){let y=t(x,{matchCase:C,matchWholeWord:F});R(y),y?.matches&&s&&s(y.matches);}},[l,o,x,C,F,f,t,s]),ue=react.useCallback(()=>{if(!x.trim())return;d(x,o,{matchCase:C,matchWholeWord:F})>0&&(R({matches:[],totalCount:0,currentIndex:-1}),p&&p());},[x,o,C,F,d,p]),fe=react.useCallback(()=>{L(a=>{let y=!a;return y&&setTimeout(()=>$.current?.focus(),100),y});},[]),xe=react.useCallback(a=>{a.target,a.currentTarget;},[]),he=react.useCallback(a=>{a.key==="Escape"&&n();},[n]);if(!e)return null;let T=l&&l.totalCount>0,ge=l&&l.totalCount===0&&x.trim();return jsxRuntime.jsx("div",{className:`docx-find-replace-dialog-overlay ${N||""}`,style:{...Me,...w},onClick:xe,onKeyDown:he,children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog",style:Oe,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-header",style:Le,children:[jsxRuntime.jsx("h2",{id:"find-replace-dialog-title",style:ke,children:E?"Find and Replace":"Find"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:Ne,onClick:n,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-body",style:we,children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsxRuntime.jsx("label",{htmlFor:"find-text",style:Z,children:"Find:"}),jsxRuntime.jsx("input",{ref:P,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:ie?ee:Y,value:x,onChange:le,onKeyDown:de,onFocus:()=>K(true),onBlur:()=>{K(false),x.trim()&&!l&&S();},placeholder:"Enter text to find...","aria-label":"Find text"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:V,disabled:!T,"aria-label":"Find previous",title:"Find Previous (Shift+Enter)",children:jsxRuntime.jsx(Ae,{})}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:G,disabled:!T,"aria-label":"Find next",title:"Find Next (Enter)",children:jsxRuntime.jsx(We,{})})]})]}),T&&jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-status",style:re,children:[l.currentIndex+1," of ",l.totalCount," matches"]}),ge&&jsxRuntime.jsx("div",{className:"docx-find-replace-dialog-status",style:De,children:"No results found"}),E&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsxRuntime.jsx("label",{htmlFor:"replace-text",style:Z,children:"Replace:"}),jsxRuntime.jsx("input",{ref:$,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:se?ee:Y,value:o,onChange:a=>r(a.target.value),onKeyDown:pe,onFocus:()=>z(true),onBlur:()=>z(false),placeholder:"Enter replacement text...","aria-label":"Replace text"}),jsxRuntime.jsxs("div",{style:Pe,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:j,disabled:!T,title:"Replace current match",children:"Replace"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:ue,disabled:!T,title:"Replace all matches",children:"Replace All"})]})]})}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-options",style:_e,children:[jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsxRuntime.jsx("input",{type:"checkbox",style:oe,checked:C,onChange:a=>ae(a.target.checked)}),"Match case"]}),jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsxRuntime.jsx("input",{type:"checkbox",style:oe,checked:F,onChange:a=>ce(a.target.checked)}),"Whole words"]}),!E&&jsxRuntime.jsx("button",{type:"button",style:{...W,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:fe,children:"+ Replace"})]})]})]})})}var je=Ye;exports.a=_;exports.b=H;exports.c=X;exports.d=D;exports.e=me;exports.f=be;exports.g=Se;exports.h=ye;exports.i=Ce;exports.j=Re;exports.k=q;exports.l=Ie;exports.m=Ee;exports.n=Ye;exports.o=je;
|
|
2
|
+
`);return n}function Fe(e){if(!e||!e.content)return "";let n="";for(let t of e.content)if(t.type==="run")n+=k(t);else if(t.type==="hyperlink")for(let c of t.children||[])c.type==="run"&&(n+=k(c));return n}function Re(e,n,t){if(!e||!n)return [];let c=[],i=e.package?.document||e.package?.document;if(!i||!i.content)return c;let f=0;for(let d of i.content)if(d.type==="paragraph"){let s=q(d,n,t,f);c.push(...s),f++;}else if(d.type==="table")for(let s of d.rows||[])for(let p of s.cells||[])for(let h of p.content||[])h.type;return c}function q(e,n,t,c){let i=[],f=Fe(e);if(!f)return i;let d=D(f,n,t);for(let s of d){let p=Te(e,s.start);i.push({paragraphIndex:c,contentIndex:p.contentIndex,startOffset:p.offsetInContent,endOffset:p.offsetInContent+(s.end-s.start),text:f.substring(s.start,s.end)});}return i}function Te(e,n){if(!e||!e.content)return {contentIndex:0,runIndex:0,offsetInContent:n};let t=0,c=0;for(let i of e.content){let f="";if(i.type==="run")f=k(i);else if(i.type==="hyperlink")for(let s of i.children||[])s.type==="run"&&(f+=k(s));let d=f.length;if(t+d>n)return {contentIndex:c,runIndex:c,offsetInContent:n-t};t+=d,c++;}return {contentIndex:Math.max(0,e.content.length-1),runIndex:Math.max(0,e.content.length-1),offsetInContent:0}}function Ie(e,n){if(!e||!n)return;let t=e.querySelector(`[data-paragraph-index="${n.paragraphIndex}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"});}function Ee(e){let[n,t]=react.useState({isOpen:false,searchText:"",replaceText:"",options:_(),matches:[],currentIndex:0,replaceMode:e?.initialReplaceMode??false}),c=react.useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:false,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),i=react.useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:true,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),f=react.useCallback(()=>{t(o=>({...o,isOpen:false}));},[]),d=react.useCallback(()=>{t(o=>({...o,isOpen:!o.isOpen}));},[]),s=react.useCallback(o=>{t(r=>({...r,searchText:o}));},[]),p=react.useCallback(o=>{t(r=>({...r,replaceText:o}));},[]),h=react.useCallback(o=>{t(r=>({...r,options:{...r.options,...o}}));},[]),v=react.useCallback((o,r=0)=>{let E=Math.max(0,Math.min(r,o.length-1));t(L=>({...L,matches:o,currentIndex:o.length>0?E:0})),e?.onMatchesChange?.(o),o.length>0?e?.onCurrentMatchChange?.(o[E],E):e?.onCurrentMatchChange?.(null,-1);},[e]),M=react.useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=(r.currentIndex+1)%r.matches.length,{...r,currentIndex:o})),o},[]),N=react.useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=r.currentIndex===0?r.matches.length-1:r.currentIndex-1,{...r,currentIndex:o})),o},[]),w=react.useCallback(o=>{t(r=>r.matches.length===0||o<0||o>=r.matches.length?r:{...r,currentIndex:o});},[]),x=react.useCallback(()=>n.matches.length===0?null:n.matches[n.currentIndex]||null,[n.matches,n.currentIndex]),O=react.useCallback(()=>n.matches.length>0,[n.matches.length]);return {state:n,openFind:c,openReplace:i,close:f,toggle:d,setSearchText:s,setReplaceText:p,setOptions:h,setMatches:v,goToNextMatch:M,goToPreviousMatch:N,goToMatch:w,getCurrentMatch:x,hasMatches:O}}var Me={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},Oe={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},Le={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},ke={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},Ne={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},we={padding:"16px"},Q={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},Z={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},Y={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},ee={...Y,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},Pe={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},B={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},te={...B,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},U={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},ne={...U,color:"var(--doc-border-input)",cursor:"not-allowed"},_e={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},W={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},oe={width:"14px",height:"14px",cursor:"pointer"},re={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},De={...re,color:"var(--doc-error)"},Ae=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})}),We=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})});function Ye({isOpen:e,onClose:n,onFind:t,onFindNext:c,onFindPrevious:i,onReplace:f,onReplaceAll:d,onHighlightMatches:s,onClearHighlights:p,initialSearchText:h="",replaceMode:v=false,currentResult:M,className:N,style:w}){let[x,O]=react.useState(""),[o,r]=react.useState(""),[E,L]=react.useState(v),[C,ae]=react.useState(false),[F,ce]=react.useState(false),[l,R]=react.useState(null),[ie,K]=react.useState(false),[se,z]=react.useState(false),P=react.useRef(null),$=react.useRef(null);react.useEffect(()=>{M!==void 0&&R(M);},[M]),react.useEffect(()=>{if(e){if(O(h),r(""),L(v),R(null),setTimeout(()=>{P.current?.focus(),P.current?.select();},100),h){let a=t(h,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s&&s(a.matches);}}else p&&p();},[e,h,v]);let S=react.useCallback(()=>{if(!x.trim()){R(null),p&&p();return}let a=t(x,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s?s(a.matches):p&&p();},[x,C,F,t,s,p]);react.useEffect(()=>{e&&x.trim()&&S();},[C,F]);let le=react.useCallback(a=>{O(a.target.value);},[]),de=react.useCallback(a=>{a.key==="Enter"?(a.preventDefault(),a.shiftKey?V():l?G():S()):a.key==="Escape"&&n();},[l,S,n]),pe=react.useCallback(a=>{a.key==="Enter"?(a.preventDefault(),j()):a.key==="Escape"&&n();},[n]),G=react.useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(c()&&l){let y=(l.currentIndex+1)%l.totalCount;R({...l,currentIndex:y});}},[x,l,S,c]),V=react.useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(i()&&l){let y=l.currentIndex===0?l.totalCount-1:l.currentIndex-1;R({...l,currentIndex:y});}},[x,l,S,i]),j=react.useCallback(()=>{if(!l||l.totalCount===0)return;if(f(o)){let y=t(x,{matchCase:C,matchWholeWord:F});R(y),y?.matches&&s&&s(y.matches);}},[l,o,x,C,F,f,t,s]),ue=react.useCallback(()=>{if(!x.trim())return;d(x,o,{matchCase:C,matchWholeWord:F})>0&&(R({matches:[],totalCount:0,currentIndex:-1}),p&&p());},[x,o,C,F,d,p]),fe=react.useCallback(()=>{L(a=>{let y=!a;return y&&setTimeout(()=>$.current?.focus(),100),y});},[]),xe=react.useCallback(a=>{a.target,a.currentTarget;},[]),he=react.useCallback(a=>{a.key==="Escape"&&n();},[n]);if(!e)return null;let T=l&&l.totalCount>0,ge=l&&l.totalCount===0&&x.trim();return jsxRuntime.jsx("div",{className:`docx-find-replace-dialog-overlay ${N||""}`,style:{...Me,...w},onClick:xe,onKeyDown:he,children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog","data-testid":"find-replace-dialog",style:Oe,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-header",style:Le,children:[jsxRuntime.jsx("h2",{id:"find-replace-dialog-title",style:ke,children:E?"Find and Replace":"Find"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:Ne,onClick:n,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-body",style:we,children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsxRuntime.jsx("label",{htmlFor:"find-text",style:Z,children:"Find:"}),jsxRuntime.jsx("input",{ref:P,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:ie?ee:Y,value:x,onChange:le,onKeyDown:de,onFocus:()=>K(true),onBlur:()=>{K(false),x.trim()&&!l&&S();},placeholder:"Enter text to find...","aria-label":"Find text"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:V,disabled:!T,"aria-label":"Find previous",title:"Find Previous (Shift+Enter)",children:jsxRuntime.jsx(Ae,{})}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:G,disabled:!T,"aria-label":"Find next",title:"Find Next (Enter)",children:jsxRuntime.jsx(We,{})})]})]}),T&&jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-status",style:re,children:[l.currentIndex+1," of ",l.totalCount," matches"]}),ge&&jsxRuntime.jsx("div",{className:"docx-find-replace-dialog-status",style:De,children:"No results found"}),E&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsxRuntime.jsx("label",{htmlFor:"replace-text",style:Z,children:"Replace:"}),jsxRuntime.jsx("input",{ref:$,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:se?ee:Y,value:o,onChange:a=>r(a.target.value),onKeyDown:pe,onFocus:()=>z(true),onBlur:()=>z(false),placeholder:"Enter replacement text...","aria-label":"Replace text"}),jsxRuntime.jsxs("div",{style:Pe,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:j,disabled:!T,title:"Replace current match",children:"Replace"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:ue,disabled:!T,title:"Replace all matches",children:"Replace All"})]})]})}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-options",style:_e,children:[jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsxRuntime.jsx("input",{type:"checkbox",style:oe,checked:C,onChange:a=>ae(a.target.checked)}),"Match case"]}),jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsxRuntime.jsx("input",{type:"checkbox",style:oe,checked:F,onChange:a=>ce(a.target.checked)}),"Whole words"]}),!E&&jsxRuntime.jsx("button",{type:"button",style:{...W,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:fe,children:"+ Replace"})]})]})]})})}var je=Ye;exports.a=_;exports.b=H;exports.c=X;exports.d=D;exports.e=me;exports.f=be;exports.g=Se;exports.h=ye;exports.i=Ce;exports.j=Re;exports.k=q;exports.l=Ie;exports.m=Ee;exports.n=Ye;exports.o=je;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-
|
|
1
|
+
import {b as b$1}from'./chunk-R5SKERM2.js';function v(s,t){let a=b$1.getCommandHandler(t.type);if(a)return a(s,t);switch(t.type){case "insertText":return R(s,t);case "replaceText":return E(s,t);case "deleteText":return B(s,t);case "formatText":return S(s,t);case "formatParagraph":return V(s,t);case "applyStyle":return $(s,t);case "insertTable":return H(s,t);case "insertImage":return A(s,t);case "insertHyperlink":return F(s,t);case "removeHyperlink":return j(s,t);case "insertParagraphBreak":return T(s,t);case "mergeParagraphs":return N(s,t);case "splitParagraph":return M(s,t);case "setVariable":return O(s,t);case "applyVariables":return _(s,t);default:let r=t;throw new Error(`Unknown command type: ${r.type}`)}}function z(s,t){return t.reduce((a,r)=>v(a,r),s)}function h(s){return JSON.parse(JSON.stringify(s))}function g(s,t){let a=0;for(let r=0;r<s.content.length;r++)if(s.content[r].type==="paragraph"){if(a===t)return r;a++;}return -1}function I(s){let t="";for(let a of s.content)if(a.type==="run")for(let r of a.content)r.type==="text"&&(t+=r.text);else if(a.type==="hyperlink"){for(let r of a.children)if(r.type==="run")for(let e of r.content)e.type==="text"&&(t+=e.text);}return t}function b(s,t){return {type:"run",formatting:t,content:[{type:"text",text:s}]}}function C(s,t,a,r){let e=[],o=0,p=false;for(let n of s.content)if(n.type==="run"){let c=n.content.filter(l=>l.type==="text").map(l=>l.text).join(""),i=o,u=o+c.length;if(!p&&t>=i&&t<=u){let l=t-i;l>0&&e.push({...n,content:[{type:"text",text:c.slice(0,l)}]}),e.push(b(a,r||n.formatting)),l<c.length&&e.push({...n,content:[{type:"text",text:c.slice(l)}]}),p=true;}else e.push(n);o=u;}else e.push(n);return p||e.push(b(a,r)),e}function y(s,t,a){let r=[],e=0;for(let o of s.content)if(o.type==="run"){let p=o.content.filter(i=>i.type==="text").map(i=>i.text).join(""),n=e,c=e+p.length;if(c<=t||n>=a)r.push(o);else {let i="";n<t&&(i+=p.slice(0,t-n)),c>a&&(i+=p.slice(a-n)),i.length>0&&r.push({...o,content:[{type:"text",text:i}]});}e=c;}else r.push(o);return r}function D(s,t,a,r){let e=[],o=0;for(let p of s.content)if(p.type==="run"){let n=p.content.filter(u=>u.type==="text").map(u=>u.text).join(""),c=o,i=o+n.length;if(i<=t||c>=a)e.push(p);else if(c>=t&&i<=a)e.push({...p,formatting:{...p.formatting,...r}});else {let u=Math.max(t,c),l=Math.min(a,i);c<u&&e.push({...p,content:[{type:"text",text:n.slice(0,u-c)}]}),e.push({...p,formatting:{...p.formatting,...r},content:[{type:"text",text:n.slice(u-c,l-c)}]}),i>l&&e.push({...p,content:[{type:"text",text:n.slice(l-c)}]});}o=i;}else e.push(p);return e}function R(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e];return o.content=C(o,t.position.offset,t.text,t.formatting),a}function E(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset),n.content=C(n,e.offset,t.text,t.formatting);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length),n.content=C(n,e.offset,t.text,t.formatting);let i=[];for(let u=e.paragraphIndex+1;u<=o.paragraphIndex;u++)i.push(g(r,u));for(let u=i.length-1;u>=0;u--)i[u]!==-1&&r.content.splice(i[u],1);}return a}function B(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length);let i=g(r,o.paragraphIndex),u=r.content[i];u.content=y(u,0,o.offset),n.content.push(...u.content);let l=[];for(let f=e.paragraphIndex+1;f<=o.paragraphIndex;f++)l.push(g(r,f));for(let f=l.length-1;f>=0;f--)l[f]!==-1&&r.content.splice(l[f],1);}return a}function S(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=D(n,e.offset,o.offset,t.formatting);}else for(let p=e.paragraphIndex;p<=o.paragraphIndex;p++){let n=g(r,p);if(n===-1)continue;let c=r.content[n],i=I(c),u=0,l=i.length;p===e.paragraphIndex&&(u=e.offset),p===o.paragraphIndex&&(l=o.offset),c.content=D(c,u,l,t.formatting);}return a}function V(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];if(o.formatting={...o.formatting,...t.formatting},"numPr"in t.formatting){let p=t.formatting.numPr;if(p&&p.numId!==void 0&&p.numId!==0){let n=p.ilvl??0,c=p.numId===1,i=c?"\u2022":"1.";if(a.package.numbering){let u=a.package.numbering.nums.find(l=>l.numId===p.numId);if(u){let l=a.package.numbering.abstractNums.find(f=>f.abstractNumId===u.abstractNumId);if(l){let f=l.levels.find(x=>x.ilvl===n);f&&(i=f.lvlText||i);}}}o.listRendering={level:n,numId:p.numId,marker:i,isBullet:c};}else delete o.listRendering;}return a}function $(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];return o.formatting={...o.formatting,styleId:t.styleId},a}function H(s,t){let a=h(s),r=a.package.document,e=[];for(let n=0;n<t.rows;n++){let c=[];for(let i=0;i<t.columns;i++){let u=t.data?.[n]?.[i]||"";c.push({type:"tableCell",content:[{type:"paragraph",content:u?[b(u)]:[]}]});}e.push({type:"tableRow",formatting:n===0&&t.hasHeader?{header:true}:void 0,cells:c});}let o={type:"table",rows:e},p=g(r,t.position.paragraphIndex);return p===-1?r.content.push(o):r.content.splice(p+1,0,o),a}function A(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],n={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:t.src,alt:t.alt,size:{width:(t.width||100)*914400,height:(t.height||100)*914400},wrap:{type:"inline"}}}]},c=C(o,t.position.offset,"",void 0),i=false,u=0;for(let l=0;l<c.length;l++){let f=c[l];if(f.type==="run"){let x=f.content.filter(d=>d.type==="text").map(d=>d.text).join("");if(u+=x.length,!i&&u>=t.position.offset){c.splice(l+1,0,n),i=true;break}}}return i||c.push(n),o.content=c,a}function F(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex!==o.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p],c=I(n),i=t.displayText||c.slice(e.offset,o.offset);n.content=y(n,e.offset,o.offset);let u={type:"hyperlink",href:t.url,tooltip:t.tooltip,children:[b(i)]},l=false,f=0,x=[];for(let d of n.content)if(d.type==="run"){let P=d.content.filter(m=>m.type==="text").map(m=>m.text).join(""),w=f+P.length;if(!l&&f<=e.offset&&e.offset<=w){let m=e.offset-f;m>0&&x.push({...d,content:[{type:"text",text:P.slice(0,m)}]}),x.push(u),m<P.length&&x.push({...d,content:[{type:"text",text:P.slice(m)}]}),l=true;}else x.push(d);f=w;}else x.push(d);return l||x.push(u),n.content=x,a}function j(s,t){let a=h(s),r=a.package.document,{start:e}=t.range,o=g(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let p=r.content[o],n=[];for(let c of p.content)if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&n.push(i);else n.push(c);return p.content=n,a}function T(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],p=I(o),n=y({...o,content:[...o.content]},t.position.offset,p.length),c=y({...o,content:[...o.content]},0,t.position.offset);o.content=n;let i={type:"paragraph",formatting:o.formatting,content:c};return r.content.splice(e+1,0,i),a}function N(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e],p=[];for(let n=1;n<=t.count;n++){let c=g(r,t.paragraphIndex+n);if(c!==-1){let i=r.content[c];o.content.push(...i.content),p.push(c);}}for(let n=p.length-1;n>=0;n--)r.content.splice(p[n],1);return a}function M(s,t){return T(s,{position:t.position})}function O(s,t){let a=h(s);return a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t.name)||a.templateVariables.push(t.name),a}function _(s,t){let a=h(s),r=a.package.document;function e(n){for(let c of n.content)if(c.type==="text")for(let[i,u]of Object.entries(t.values)){let l=new RegExp(`\\{${i}\\}`,"g");c.text=c.text.replace(l,u);}}function o(n){for(let c of n.content)if(c.type==="run")e(c);else if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&e(i);}function p(n){if(n.type==="paragraph")o(n);else if(n.type==="table")for(let c of n.rows)for(let i of c.cells)for(let u of i.content)p(u);}for(let n of r.content)p(n);return a}export{v as a,z as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ue={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1499},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1499},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},ge={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function fe(n){let e=n.toLowerCase();return e.includes("mono")||e.includes("courier")||e.includes("consolas")||e.includes("console")||e.includes("code")||e.includes("terminal")?"monospace":e.includes("times")||e.includes("georgia")||e.includes("garamond")||e.includes("palatino")||e.includes("baskerville")||e.includes("bodoni")||e.includes("cambria")||e.includes("mincho")||e.includes("ming")||e.includes("song")||e.includes("serif")?"serif":e.includes("script")||e.includes("cursive")||e.includes("comic")||e.includes("brush")||e.includes("hand")?"cursive":"sans-serif"}function Q(n){let e=n.trim().toLowerCase(),a=ue[e];if(a)return {googleFont:a.googleFont,cssFallback:a.fallbackStack.map(K).join(", "),originalFont:n,hasGoogleEquivalent:true,singleLineRatio:a.singleLineRatio};let t=fe(n),r=ge[t];return {googleFont:null,cssFallback:`${K(n)}, ${r}`,originalFont:n,hasGoogleEquivalent:false,singleLineRatio:1.15}}function K(n){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(n.toLowerCase())?n:/[\s,'"()]/.test(n)?`"${n.replace(/"/g,'\\"')}"`:n}function Fe(n,e){if(!e)return null;let t=n.toLowerCase().startsWith("major")?e.majorFont:e.minorFont;if(!t)return null;let r=n.toLowerCase();return r.includes("eastasia")||r.includes("ea")?t.ea??t.latin??null:r.includes("cs")||r.includes("bidi")?t.cs??t.latin??null:t.latin??null}var Z=96,ee=11,ne="Calibri",he=1.15,de=.8,pe=.2,A=null;function X(){if(!A){let n=typeof document<"u"?document.createElement("canvas"):null;if(!n)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(A=n.getContext("2d"),!A)throw new Error("Failed to get 2D context from canvas")}return A}function we(){A=null;}var V=new Map;function te(n){let e=V.get(n);if(e===void 0){let a=Q(n);e={cssFallback:a.cssFallback,singleLineRatio:a.singleLineRatio},V.set(n,e);}return e}function be(n){return te(n).cssFallback}function U(n){let e=[];n.italic&&e.push("italic"),n.bold&&e.push("bold");let a=n.fontSize??ee,t=oe(a);e.push(`${t}px`);let r=n.fontFamily??ne;return e.push(be(r)),e.join(" ")}function xe(n){let e=n.fontSize??ee,a=n.fontFamily??ne,t=oe(e),r=t*de,o=t*pe,c=t*he;try{let s=X();s.font=U(n);let g=s.measureText("Hg");typeof g.actualBoundingBoxAscent=="number"&&typeof g.actualBoundingBoxDescent=="number"&&(r=g.actualBoundingBoxAscent,o=g.actualBoundingBoxDescent);}catch{}c=Math.max(c,r+o);let i=te(a).singleLineRatio;return {fontSize:e,ascent:r,descent:o,lineHeight:c,fontFamily:a,singleLineRatio:i}}function Me(n,e){if(!n)return 0;let a=X();a.font=U(e);let r=a.measureText(n).width;return e.letterSpacing&&n.length>1&&(r+=e.letterSpacing*(n.length-1)),r}function W(n,e){let a=xe(e);if(!n)return {width:0,charWidths:[],metrics:a};let t=X();t.font=U(e);let r=e.letterSpacing??0,o=[],c=0;for(let i=0;i<n.length;i++){let s=n[i],h=t.measureText(s).width;r&&i<n.length-1&&(h+=r),o.push(h),c+=h;}return {width:c,charWidths:o,metrics:a}}function Te(n,e){if(e.length===0||n<=0)return 0;let a=0;for(let t=0;t<e.length;t++){let r=e[t],o=a+r/2;if(n<=o)return t;a+=r;}return e.length}function oe(n){return n*Z/72}function q(n,e){let a=n.pageGap??0,t=0;for(let r=0;r<e&&r<n.pages.length;r++){let c=n.pages[r].size?.h??n.pageSize.h;t+=c+a;}return t}function ae(n,e){return n.findIndex(a=>a.id===e)}function ke(n,e){let a=0;for(let t=n.fromLine;t<n.toLine&&t<e.lines.length;t++)a+=e.lines[t].lineHeight;return a}function Ie(n,e,a,t){let r=[...n.page.fragments].sort((o,c)=>{let i=o.y-c.y;return Math.abs(i)>.5?i:o.x-c.x});for(let o of r){let c=ae(e,o.blockId);if(c===-1)continue;let i=e[c],s=a[c];if(!i||!s)continue;let g;if(o.kind==="paragraph"){if(i.kind!=="paragraph"||s.kind!=="paragraph")continue;g=ke(o,s);}else if(o.kind==="table")g=o.height;else if(o.kind==="image")g=o.height;else continue;let h=t.x>=o.x&&t.x<=o.x+o.width,l=t.y>=o.y&&t.y<=o.y+g;if(h&&l)return {fragment:o,block:i,measure:s,pageIndex:n.pageIndex,localX:t.x-o.x,localY:t.y-o.y}}return null}function Ce(n,e,a,t){for(let r of n.page.fragments){if(r.kind!=="table")continue;let o=r,c=t.x>=o.x&&t.x<=o.x+o.width,i=t.y>=o.y&&t.y<=o.y+o.height;if(!c||!i)continue;let s=ae(e,o.blockId);if(s===-1)continue;let g=e[s],h=a[s];if(!g||g.kind!=="table"||!h||h.kind!=="table")continue;let l=g,f=h,d=t.x-o.x,F=t.y-o.y,x=0,p=-1;if(f.rows.length===0||l.rows.length===0)continue;for(let u=o.fromRow;u<o.toRow&&u<f.rows.length;u++){let L=f.rows[u];if(F>=x&&F<x+L.height){p=u;break}x+=L.height;}if(p===-1&&(p=Math.min(o.toRow-1,f.rows.length-1),p<o.fromRow))continue;let m=f.rows[p],S=l.rows[p];if(!m||!S)continue;let b=0,k=-1;if(m.cells.length===0||S.cells.length===0)continue;for(let u=0;u<m.cells.length;u++){let L=m.cells[u];if(d>=b&&d<b+L.width){k=u;break}b+=L.width;}if(k===-1&&(k=m.cells.length-1,k<0))continue;let y=m.cells[k],R=S.cells[k];if(!y||!R)continue;let w=0;for(let u=o.fromRow;u<p;u++)w+=f.rows[u]?.height??0;let I=0;for(let u=0;u<k;u++)I+=m.cells[u]?.width??0;let T,M;if(R.blocks&&R.blocks.length>0){let u=R.blocks[0],L=y.blocks[0];u.kind==="paragraph"&&L?.kind==="paragraph"&&(T=u,M=L);}let C=d-I,B=F-w;return {fragment:o,block:l,measure:f,pageIndex:n.pageIndex,rowIndex:p,colIndex:k,cellBlock:T,cellMeasure:M,cellLocalX:Math.max(0,C),cellLocalY:Math.max(0,B)}}return null}function re(n){return {fontFamily:n.fontFamily??"Arial",fontSize:n.fontSize??12,bold:n.bold,italic:n.italic,letterSpacing:n.letterSpacing}}function j(n,e){return n.findIndex(a=>a.id===e)}function G(n,e){let t=(n.pmStart??0)+1,r=0,o;for(let s=0;s<n.runs.length&&s<=e.toRun;s++){let g=n.runs[s];if(g){if(s<e.fromRun)g.kind==="text"?r+=(g.text??"").length:r+=1;else if(s===e.fromRun){r+=e.fromChar,o=t+r;break}}}o===void 0&&(o=t);let c=0;for(let s=e.fromRun;s<=e.toRun&&s<n.runs.length;s++){let g=n.runs[s];if(g)if(g.kind==="text"){let h=g.text??"",l=s===e.fromRun?e.fromChar:0,f=s===e.toRun?e.toChar:h.length;c+=f-l;}else c+=1;}let i=o+c;return {pmStart:o,pmEnd:i}}function ie(n,e,a,t){let r=[];for(let o=0;o<e.lines.length;o++){let c=e.lines[o],i=G(n,c);i.pmStart===void 0||i.pmEnd===void 0||i.pmEnd>a&&i.pmStart<t&&r.push({line:c,index:o});}return r}function v(n,e,a){let t=G(n,e);return t.pmStart===void 0?0:Math.max(0,a-t.pmStart)}function _(n,e,a,t){let r=0,o=0;for(let c=e.fromRun;c<=e.toRun&&c<n.runs.length;c++){let i=n.runs[c];if(i){if(i.kind==="tab"){let s=i.width??48;if(o+1>=a)return a<=o?r:r+s;r+=s,o+=1;continue}if(i.kind==="image"){let s=i.width;if(o+1>=a)return a<=o?r:r+s;r+=s,o+=1;continue}if(i.kind==="lineBreak"){if(a<=o)return r;o+=1;continue}if(i.kind==="text"){let s=i.text??"",g=c===e.fromRun,h=c===e.toRun,l=g?e.fromChar:0,f=h?e.toChar:s.length,d=s.slice(l,f);if(o+d.length>=a){let p=a-o,m=re(i),S=W(d.slice(0,p),m);return r+S.width}let F=re(i),x=W(d,F);r+=x.width,o+=d.length;}}}return r}function N(n,e){let a=0;for(let t=0;t<e&&t<n.lines.length;t++)a+=n.lines[t].lineHeight;return a}function He(n,e,a,t,r){if(t===r)return [];let o=Math.min(t,r),c=Math.max(t,r),i=[];for(let s=0;s<n.pages.length;s++){let g=n.pages[s],h=q(n,s);for(let l of g.fragments){if(l.kind==="paragraph"){let f=j(e,l.blockId);if(f===-1)continue;let d=e[f],F=a[f];if(!d||d.kind!=="paragraph"||!F||F.kind!=="paragraph")continue;let x=d,p=F,m=l,S=ie(x,p,o,c);for(let{line:b,index:k}of S){if(k<m.fromLine||k>=m.toLine)continue;let y=G(x,b);if(y.pmStart===void 0||y.pmEnd===void 0)continue;let R=Math.max(y.pmStart,o),w=Math.min(y.pmEnd,c);if(R>=w)continue;let I=v(x,b,R),T=v(x,b,w),M=x.attrs?.indent,C=M?.left??0,B=M?.right??0,u=Math.max(0,l.width-C-B),L=_(x,b,I),z=_(x,b,T),H=x.attrs?.alignment??"left",P=0;H==="center"?P=Math.max(0,(u-b.width)/2):H==="right"&&(P=Math.max(0,u-b.width));let D=N(p,k)-N(p,m.fromLine),E=l.x+C+P+Math.min(L,z),O=Math.max(1,Math.abs(z-L)),Y=l.y+D;i.push({x:E,y:Y+h,width:O,height:b.lineHeight,pageIndex:s});}}if(l.kind==="table"){let f=j(e,l.blockId);if(f===-1)continue;let d=e[f],F=a[f];if(!d||d.kind!=="table"||!F||F.kind!=="table")continue;let x=d,p=F,m=l,S=0;for(let b=m.fromRow;b<m.toRow&&b<x.rows.length;b++){let k=x.rows[b],y=p.rows[b];if(!k||!y)continue;let R=0;for(let w=0;w<k.cells.length;w++){let I=k.cells[w],T=y.cells[w];if(!(!I||!T)){for(let M=0;M<I.blocks.length;M++){let C=I.blocks[M],B=T.blocks[M];if(!C||C.kind!=="paragraph"||!B||B.kind!=="paragraph")continue;let u=C,L=B,z=ie(u,L,o,c),H=0;for(let{line:P,index:D}of z){let E=G(u,P);if(E.pmStart===void 0||E.pmEnd===void 0)continue;let O=Math.max(E.pmStart,o),Y=Math.min(E.pmEnd,c);if(O>=Y)continue;let se=v(u,P,O),ce=v(u,P,Y),J=_(u,P,se,T.width),$=_(u,P,ce,T.width),le=N(L,D);i.push({x:m.x+R+Math.min(J,$),y:m.y+S+H+le+h,width:Math.max(1,Math.abs($-J)),height:P.lineHeight,pageIndex:s});}H+=L.totalHeight;}R+=T.width;}}S+=y.height;}}if(l.kind==="image"){let f=l.pmStart??0;(l.pmEnd??f+1)>o&&f<c&&i.push({x:l.x,y:l.y+h,width:l.width,height:l.height,pageIndex:s});}}}return i}function Ae(n,e,a,t){for(let r=0;r<n.pages.length;r++){let o=n.pages[r],c=q(n,r);for(let i of o.fragments){if(i.kind==="paragraph"){let s=j(e,i.blockId);if(s===-1)continue;let g=e[s],h=a[s];if(!g||g.kind!=="paragraph"||!h||h.kind!=="paragraph")continue;let l=g,f=h,d=i,F=l.pmStart??0,x=l.pmEnd??F;if(t<F||t>x)continue;for(let p=d.fromLine;p<d.toLine;p++){let m=f.lines[p];if(!m)continue;let S=G(l,m);if(!(S.pmStart===void 0||S.pmEnd===void 0)&&t>=S.pmStart&&t<=S.pmEnd){let b=v(l,m,t),k=l.attrs?.indent,y=k?.left??0,R=k?.right??0,w=Math.max(0,i.width-y-R),I=_(l,m,b),T=l.attrs?.alignment??"left",M=0;T==="center"?M=Math.max(0,(w-m.width)/2):T==="right"&&(M=Math.max(0,w-m.width));let C=N(f,p)-N(f,d.fromLine);return {x:i.x+y+M+I,y:i.y+C+c,height:m.lineHeight,pageIndex:r}}}}if(i.kind==="image"){let s=i.pmStart??0,g=i.pmEnd??s+1;if(t>=s&&t<=g){let h=t===s?0:i.width;return {x:i.x+h,y:i.y+c,height:i.height,pageIndex:r}}}}}return null}function ve(n){return n.length<=1?false:new Set(n.map(a=>a.pageIndex)).size>1}function _e(n){let e=new Map;for(let a of n){let t=e.get(a.pageIndex)??[];t.push(a),e.set(a.pageIndex,t);}return e}export{Q as a,Fe as b,we as c,xe as d,Me as e,W as f,Te as g,oe as h,Ie as i,Ce as j,He as k,Ae as l,ve as m,_e as n};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-OTG4NABM.js';import k from'jszip';function h(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function J(e){if(!e)return "";let t=[];return e.auto?t.push('w:val="auto"'):e.rgb&&t.push(`w:val="${e.rgb}"`),e.themeColor&&t.push(`w:themeColor="${e.themeColor}"`),e.themeTint&&t.push(`w:themeTint="${e.themeTint}"`),e.themeShade&&t.push(`w:themeShade="${e.themeShade}"`),t.length===0?"":`<w:color ${t.join(" ")}/>`}function K(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function v(e){if(!e)return "";let t=[];if(e.styleId&&t.push(`<w:rStyle w:val="${h(e.styleId)}"/>`),e.fontFamily){let i=[];e.fontFamily.ascii&&i.push(`w:ascii="${h(e.fontFamily.ascii)}"`),e.fontFamily.hAnsi&&i.push(`w:hAnsi="${h(e.fontFamily.hAnsi)}"`),e.fontFamily.eastAsia&&i.push(`w:eastAsia="${h(e.fontFamily.eastAsia)}"`),e.fontFamily.cs&&i.push(`w:cs="${h(e.fontFamily.cs)}"`),e.fontFamily.asciiTheme&&i.push(`w:asciiTheme="${e.fontFamily.asciiTheme}"`),e.fontFamily.hAnsiTheme&&i.push(`w:hAnsiTheme="${e.fontFamily.hAnsiTheme}"`),e.fontFamily.eastAsiaTheme&&i.push(`w:eastAsiaTheme="${e.fontFamily.eastAsiaTheme}"`),e.fontFamily.csTheme&&i.push(`w:csTheme="${e.fontFamily.csTheme}"`),i.length>0&&t.push(`<w:rFonts ${i.join(" ")}/>`);}e.bold===true?t.push("<w:b/>"):e.bold===false&&t.push('<w:b w:val="0"/>'),e.boldCs===true?t.push("<w:bCs/>"):e.boldCs===false&&t.push('<w:bCs w:val="0"/>'),e.italic===true?t.push("<w:i/>"):e.italic===false&&t.push('<w:i w:val="0"/>'),e.italicCs===true?t.push("<w:iCs/>"):e.italicCs===false&&t.push('<w:iCs w:val="0"/>'),e.allCaps&&t.push("<w:caps/>"),e.smallCaps&&t.push("<w:smallCaps/>"),e.strike&&t.push("<w:strike/>"),e.doubleStrike&&t.push("<w:dstrike/>"),e.outline&&t.push("<w:outline/>"),e.shadow&&t.push("<w:shadow/>"),e.emboss&&t.push("<w:emboss/>"),e.imprint&&t.push("<w:imprint/>"),e.hidden&&t.push("<w:vanish/>");let n=J(e.color);if(n&&t.push(n),e.spacing!==void 0&&t.push(`<w:spacing w:val="${e.spacing}"/>`),e.scale!==void 0&&t.push(`<w:w w:val="${e.scale}"/>`),e.kerning!==void 0&&t.push(`<w:kern w:val="${e.kerning}"/>`),e.position!==void 0&&t.push(`<w:position w:val="${e.position}"/>`),e.fontSize!==void 0&&t.push(`<w:sz w:val="${e.fontSize}"/>`),e.fontSizeCs!==void 0&&t.push(`<w:szCs w:val="${e.fontSizeCs}"/>`),e.highlight&&e.highlight!=="none"&&new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]).has(e.highlight)&&t.push(`<w:highlight w:val="${e.highlight}"/>`),e.underline){let i=[`w:val="${e.underline.style}"`];e.underline.color&&(e.underline.color.rgb&&i.push(`w:color="${e.underline.color.rgb}"`),e.underline.color.themeColor&&i.push(`w:themeColor="${e.underline.color.themeColor}"`)),t.push(`<w:u ${i.join(" ")}/>`);}e.effect&&e.effect!=="none"&&t.push(`<w:effect w:val="${e.effect}"/>`),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(`<w:em w:val="${e.emphasisMark}"/>`);let r=K(e.shading);return r&&t.push(r),e.vertAlign&&e.vertAlign!=="baseline"&&t.push(`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&t.push("<w:rtl/>"),e.cs&&t.push("<w:cs/>"),t.length===0?"":`<w:rPr>${t.join("")}</w:rPr>`}function Q(e){return `<w:t${e.preserveSpace||e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${h(e.text)}</w:t>`}function ee(e){return "<w:tab/>"}function te(e){let t=[];return e.breakType==="page"?t.push('w:type="page"'):e.breakType==="column"?t.push('w:type="column"'):e.breakType==="textWrapping"&&(t.push('w:type="textWrapping"'),e.clear&&e.clear!=="none"&&t.push(`w:clear="${e.clear}"`)),t.length===0?"<w:br/>":`<w:br ${t.join(" ")}/>`}function ne(e){return `<w:sym w:font="${h(e.font)}" w:char="${h(e.char)}"/>`}function re(e){return e.type==="footnoteRef"?`<w:footnoteReference w:id="${e.id}"/>`:`<w:endnoteReference w:id="${e.id}"/>`}function ie(e){let t=[`w:fldCharType="${e.charType}"`];return e.fldLock&&t.push('w:fldLock="true"'),e.dirty&&t.push('w:dirty="true"'),`<w:fldChar ${t.join(" ")}/>`}function se(e){return `<w:instrText${e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${h(e.text)}</w:instrText>`}function oe(e){return "<w:softHyphen/>"}function ae(e){return "<w:noBreakHyphen/>"}function D(e){if(!e)return "";if(e.rgb)return `<a:srgbClr val="${e.rgb.replace("#","")}"/>`;if(e.themeColor){let t=`<a:schemeClr val="${e.themeColor}"`;return e.themeTint?t+=`><a:tint val="${e.themeTint}"/></a:schemeClr>`:e.themeShade?t+=`><a:shade val="${e.themeShade}"/></a:schemeClr>`:t+="/>",t}return ""}function ce(e){if(!e||e.type==="none")return "<a:noFill/>";if(e.type==="solid"&&e.color)return `<a:solidFill>${D(e.color)}</a:solidFill>`;if(e.type==="gradient"&&e.gradient){let t=e.gradient,n=t.stops.map(i=>`<a:gs pos="${i.position}">${D(i.color)}</a:gs>`).join(""),r=t.type==="linear"?`<a:lin ang="${(t.angle||0)*6e4}" scaled="1"/>`:"";return `<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return ""}function E(e){if(!e)return "";let t=[];e.width!=null&&t.push(`w="${e.width}"`),e.cap&&t.push(`cap="${e.cap}"`);let n=[];return e.color&&n.push(`<a:solidFill>${D(e.color)}</a:solidFill>`),e.style&&e.style!=="solid"&&n.push(`<a:prstDash val="${e.style}"/>`),e.headEnd&&n.push(`<a:headEnd type="${e.headEnd.type}"${e.headEnd.width?` w="${e.headEnd.width}"`:""}${e.headEnd.length?` len="${e.headEnd.length}"`:""}/>`),e.tailEnd&&n.push(`<a:tailEnd type="${e.tailEnd.type}"${e.tailEnd.width?` w="${e.tailEnd.width}"`:""}${e.tailEnd.length?` len="${e.tailEnd.length}"`:""}/>`),n.length===0&&t.length===0?"":`<a:ln${t.length?" "+t.join(" "):""}>${n.join("")}</a:ln>`}function I(e){let t=[],n=e.horizontal;t.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?t.push(`<wp:align>${n.alignment}</wp:align>`):t.push(`<wp:posOffset>${n.posOffset||0}</wp:posOffset>`),t.push("</wp:positionH>");let r=e.vertical;return t.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?t.push(`<wp:align>${r.alignment}</wp:align>`):t.push(`<wp:posOffset>${r.posOffset||0}</wp:posOffset>`),t.push("</wp:positionV>"),t.join("")}function X(e){let t=e.wrapText?` wrapText="${e.wrapText}"`:' wrapText="bothSides"';switch(e.type){case "square":return `<wp:wrapSquare${t}/>`;case "tight":return `<wp:wrapTight${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case "through":return `<wp:wrapThrough${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case "topAndBottom":return "<wp:wrapTopAndBottom/>";case "behind":case "inFront":return "<wp:wrapNone/>";default:return "<wp:wrapNone/>"}}function le(e){let t=e.size.width,n=e.size.height,r=e.rId||"rId1",i=e.id||"0",s=e.filename||`image${i}`,o="";return e.transform?.rotation&&(o+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(o+=' flipH="1"'),e.transform?.flipV&&(o+=' flipV="1"'),['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${i}" name="${h(s)}"${e.alt?` descr="${h(e.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",`<a:blip r:embed="${r}"/>`,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${o}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${t}" cy="${n}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',e.outline?E(e.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function pe(e){let t=e.image,n=t.wrap.type!=="inline",r=t.size.width,i=t.size.height,s=t.padding?.top??t.wrap.distT??0,o=t.padding?.bottom??t.wrap.distB??0,a=t.padding?.left??t.wrap.distL??0,l=t.padding?.right??t.wrap.distR??0,p=t.id||"1",c=t.title||t.filename||`Picture ${p}`,u=le(t);if(!n)return ["<w:drawing>",`<wp:inline distT="${s}" distB="${o}" distL="${a}" distR="${l}">`,`<wp:extent cx="${r}" cy="${i}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${p}" name="${h(c)}"${t.alt?` descr="${h(t.alt)}"`:""}${t.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',u,"</wp:inline>","</w:drawing>"].join("");let f=t.wrap.type==="behind"?"1":"0",g=t.position?I(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',b=X(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${s}" distB="${o}" distL="${a}" distR="${l}" simplePos="0" relativeHeight="251658240" behindDoc="${f}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',g,`<wp:extent cx="${r}" cy="${i}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',b,`<wp:docPr id="${p}" name="${h(c)}"${t.alt?` descr="${h(t.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',u,"</wp:anchor>","</w:drawing>"].join("")}function ue(e){return e.map(t=>$(t)).join("")}function fe(e){let t=e.shape,n=t.size.width,r=t.size.height,i=t.shapeType==="textBox",s=t.wrap&&t.wrap.type!=="inline",o=t.wrap?.distT??0,a=t.wrap?.distB??0,l=t.wrap?.distL??0,p=t.wrap?.distR??0,c=t.id||"1",u=t.name||(i?`TextBox ${c}`:`Shape ${c}`),f="";t.transform?.rotation&&(f+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(f+=' flipH="1"'),t.transform?.flipV&&(f+=' flipV="1"');let g=["<wps:spPr>",`<a:xfrm${f}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${n}" cy="${r}"/>`,"</a:xfrm>",`<a:prstGeom prst="${t.shapeType==="textBox"?"rect":t.shapeType}"><a:avLst/></a:prstGeom>`,ce(t.fill),E(t.outline),"</wps:spPr>"].join(""),b="";if(t.textBody){let d=t.textBody,y=['rot="0"','vert="horz"'];d.anchor&&y.push(`anchor="${d.anchor==="middle"?"ctr":d.anchor}"`),d.anchorCenter&&y.push('anchorCtr="1"'),d.margins&&(d.margins.left!=null&&y.push(`lIns="${d.margins.left}"`),d.margins.top!=null&&y.push(`tIns="${d.margins.top}"`),d.margins.right!=null&&y.push(`rIns="${d.margins.right}"`),d.margins.bottom!=null&&y.push(`bIns="${d.margins.bottom}"`)),i?b=["<wps:txbx><w:txbxContent>",ue(d.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${y.join(" ")}/>`].join(""):b=[`<wps:bodyPr ${y.join(" ")}/>`].join("");}let j=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${i?' txBox="1"':""}/>`,g,b,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!s)return ["<w:drawing>",`<wp:inline distT="${o}" distB="${a}" distL="${l}" distR="${p}">`,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${c}" name="${h(u)}"/>`,"<wp:cNvGraphicFramePr/>",j,"</wp:inline>","</w:drawing>"].join("");let q=t.wrap?.type==="behind"?"1":"0",Z=t.position?I(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',Y=X(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${o}" distB="${a}" distL="${l}" distR="${p}" simplePos="0" relativeHeight="251658240" behindDoc="${q}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',Z,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',Y,`<wp:docPr id="${c}" name="${h(u)}"/>`,"<wp:cNvGraphicFramePr/>",j,"</wp:anchor>","</w:drawing>"].join("")}function he(e){switch(e.type){case "text":return Q(e);case "tab":return ee();case "break":return te(e);case "symbol":return ne(e);case "footnoteRef":case "endnoteRef":return re(e);case "fieldChar":return ie(e);case "instrText":return se(e);case "softHyphen":return oe();case "noBreakHyphen":return ae();case "drawing":return pe(e);case "shape":return fe(e);default:return ""}}function x(e){let t=[],n=v(e.formatting);n&&t.push(n);for(let r of e.content){let i=he(r);i&&t.push(i);}return `<w:r>${t.join("")}</w:r>`}function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function P(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function me(e){if(!e)return "";let t=[];if(e.top){let n=P(e.top,"top");n&&t.push(n);}if(e.left){let n=P(e.left,"left");n&&t.push(n);}if(e.bottom){let n=P(e.bottom,"bottom");n&&t.push(n);}if(e.right){let n=P(e.right,"right");n&&t.push(n);}if(e.between){let n=P(e.between,"between");n&&t.push(n);}if(e.bar){let n=P(e.bar,"bar");n&&t.push(n);}return t.length===0?"":`<w:pBdr>${t.join("")}</w:pBdr>`}function de(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function we(e){return !e||e.length===0?"":`<w:tabs>${e.map(n=>{let r=[`w:val="${n.alignment}"`,`w:pos="${n.position}"`];return n.leader&&n.leader!=="none"&&r.push(`w:leader="${n.leader}"`),`<w:tab ${r.join(" ")}/>`}).join("")}</w:tabs>`}function ge(e){let t=[];return e.spaceBefore!==void 0&&t.push(`w:before="${e.spaceBefore}"`),e.spaceAfter!==void 0&&t.push(`w:after="${e.spaceAfter}"`),e.lineSpacing!==void 0&&t.push(`w:line="${e.lineSpacing}"`),e.lineSpacingRule&&t.push(`w:lineRule="${e.lineSpacingRule}"`),e.beforeAutospacing&&t.push('w:beforeAutospacing="1"'),e.afterAutospacing&&t.push('w:afterAutospacing="1"'),t.length===0?"":`<w:spacing ${t.join(" ")}/>`}function ye(e){let t=[];return e.indentLeft!==void 0&&t.push(`w:left="${e.indentLeft}"`),e.indentRight!==void 0&&t.push(`w:right="${e.indentRight}"`),e.indentFirstLine!==void 0&&(e.hangingIndent?t.push(`w:hanging="${Math.abs(e.indentFirstLine)}"`):e.indentFirstLine!==0&&t.push(`w:firstLine="${e.indentFirstLine}"`)),t.length===0?"":`<w:ind ${t.join(" ")}/>`}function xe(e){if(!e)return "";let t=[];return e.ilvl!==void 0&&t.push(`<w:ilvl w:val="${e.ilvl}"/>`),e.numId!==void 0&&t.push(`<w:numId w:val="${e.numId}"/>`),t.length===0?"":`<w:numPr>${t.join("")}</w:numPr>`}function $e(e){if(!e)return "";let t=[];return e.width!==void 0&&t.push(`w:w="${e.width}"`),e.height!==void 0&&t.push(`w:h="${e.height}"`),e.hAnchor&&t.push(`w:hAnchor="${e.hAnchor}"`),e.vAnchor&&t.push(`w:vAnchor="${e.vAnchor}"`),e.x!==void 0&&t.push(`w:x="${e.x}"`),e.y!==void 0&&t.push(`w:y="${e.y}"`),e.xAlign&&t.push(`w:xAlign="${e.xAlign}"`),e.yAlign&&t.push(`w:yAlign="${e.yAlign}"`),e.wrap&&t.push(`w:wrap="${e.wrap}"`),t.length===0?"":`<w:framePr ${t.join(" ")}/>`}function Te(e){if(!e)return "";let t=[];e.styleId&&t.push(`<w:pStyle w:val="${m(e.styleId)}"/>`),e.keepNext&&t.push("<w:keepNext/>"),e.keepLines&&t.push("<w:keepLines/>"),e.contextualSpacing&&t.push("<w:contextualSpacing/>"),e.pageBreakBefore&&t.push("<w:pageBreakBefore/>");let n=$e(e.frame);n&&t.push(n),e.widowControl===false?t.push('<w:widowControl w:val="0"/>'):e.widowControl===true&&t.push("<w:widowControl/>");let r=xe(e.numPr);r&&t.push(r);let i=me(e.borders);i&&t.push(i);let s=de(e.shading);s&&t.push(s);let o=we(e.tabs);o&&t.push(o),e.suppressLineNumbers&&t.push("<w:suppressLineNumbers/>"),e.suppressAutoHyphens&&t.push("<w:suppressAutoHyphens/>");let a=ge(e);a&&t.push(a);let l=ye(e);if(l&&t.push(l),e.bidi&&t.push("<w:bidi/>"),e.alignment&&t.push(`<w:jc w:val="${e.alignment}"/>`),e.outlineLevel!==void 0&&t.push(`<w:outlineLvl w:val="${e.outlineLevel}"/>`),e.runProperties){let p=v(e.runProperties);p&&t.push(p);}return t.length===0?"":`<w:pPr>${t.join("")}</w:pPr>`}function R(e){let t=[];e.rId&&t.push(`r:id="${e.rId}"`),e.anchor&&t.push(`w:anchor="${m(e.anchor)}"`),e.tooltip&&t.push(`w:tooltip="${m(e.tooltip)}"`),e.target&&t.push(`w:tgtFrame="${m(e.target)}"`),e.history===false&&t.push('w:history="0"'),e.docLocation&&t.push(`w:docLocation="${m(e.docLocation)}"`);let n=e.children.map(i=>i.type==="run"?x(i):i.type==="bookmarkStart"?O(i):i.type==="bookmarkEnd"?M(i):"").join("");return `<w:hyperlink${t.length>0?" "+t.join(" "):""}>${n}</w:hyperlink>`}function O(e){let t=[`w:id="${e.id}"`,`w:name="${m(e.name)}"`];return e.colFirst!==void 0&&t.push(`w:colFirst="${e.colFirst}"`),e.colLast!==void 0&&t.push(`w:colLast="${e.colLast}"`),`<w:bookmarkStart ${t.join(" ")}/>`}function M(e){return `<w:bookmarkEnd w:id="${e.id}"/>`}function be(e){let t=[],n=e.content.find(a=>a.type==="run"),r=n?.formatting?v(n.formatting):"",i=['w:fldCharType="begin"'];e.fldLock&&i.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${i.join(" ")}/></w:r>`);let o=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${o}>${m(e.instruction)}</w:instrText></w:r>`),t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let a of e.content)a.type==="run"&&t.push(x(a));return t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Pe(e){let t=[],n=e.fieldResult?.[0]?.formatting,r=n?v(n):"",i=['w:fldCharType="begin"'];if(e.fldLock&&i.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${i.join(" ")}/></w:r>`),e.fieldCode.length>0)t.push(...e.fieldCode.map(s=>x(s)));else {let o=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${o}>${m(e.instruction)}</w:instrText></w:r>`);}return t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),t.push(...e.fieldResult.map(s=>x(s))),t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Ce(e){let t=e.properties,n=[];switch(t.alias&&n.push(`<w:alias w:val="${m(t.alias)}"/>`),t.tag&&n.push(`<w:tag w:val="${m(t.tag)}"/>`),t.lock&&t.lock!=="unlocked"&&n.push(`<w:lock w:val="${t.lock}"/>`),t.showingPlaceholder&&n.push("<w:showingPlcHdr/>"),t.sdtType){case "plainText":n.push("<w:text/>");break;case "date":t.dateFormat?n.push(`<w:date w:fullDate="${m(t.dateFormat)}"/>`):n.push("<w:date/>");break;case "dropdown":{let i=(t.listItems??[]).map(s=>`<w:listItem w:displayText="${m(s.displayText)}" w:value="${m(s.value)}"/>`).join("");n.push(`<w:dropDownList>${i}</w:dropDownList>`);break}case "comboBox":{let i=(t.listItems??[]).map(s=>`<w:listItem w:displayText="${m(s.displayText)}" w:value="${m(s.value)}"/>`).join("");n.push(`<w:comboBox>${i}</w:comboBox>`);break}case "checkbox":n.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/></w14:checkbox>`);break;case "picture":n.push("<w:picture/>");break}let r=e.content.map(i=>i.type==="run"?x(i):i.type==="hyperlink"?R(i):"").join("");return `<w:sdt><w:sdtPr>${n.join("")}</w:sdtPr><w:sdtContent>${r}</w:sdtContent></w:sdt>`}function L(e,t){let n=t.info,r=[`w:id="${n.id}"`,`w:author="${m(n.author)}"`];n.date&&r.push(`w:date="${m(n.date)}"`);let i=t.content.map(s=>s.type==="run"?x(s):s.type==="hyperlink"?R(s):"").join("");return `<w:${e} ${r.join(" ")}>${i}</w:${e}>`}function ve(e){switch(e.type){case "run":return x(e);case "hyperlink":return R(e);case "bookmarkStart":return O(e);case "bookmarkEnd":return M(e);case "simpleField":return be(e);case "complexField":return Pe(e);case "inlineSdt":return Ce(e);case "commentRangeStart":return `<w:commentRangeStart w:id="${e.id}"/>`;case "commentRangeEnd":return `<w:commentRangeEnd w:id="${e.id}"/>`;case "insertion":return L("ins",e);case "deletion":return L("del",e);case "mathEquation":return e.ommlXml||"";default:return ""}}function $(e){let t=[],n=[];e.paraId&&n.push(`w14:paraId="${e.paraId}"`),e.textId&&n.push(`w14:textId="${e.textId}"`);let r=n.length>0?" "+n.join(" "):"",i=Te(e.formatting);i&&t.push(i);for(let s of e.content){let o=ve(s);o&&t.push(o);}return `<w:p${r}>${t.join("")}</w:p>`}function Fe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function T(e,t){if(!e)return "";let n=[`w:w="${e.value}"`,`w:type="${e.type}"`];return `<w:${t} ${n.join(" ")}/>`}function C(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function H(e,t){if(!e)return "";let n=[];if(e.top){let r=C(e.top,"top");r&&n.push(r);}if(e.left){let r=C(e.left,"left");r&&n.push(r);}if(e.bottom){let r=C(e.bottom,"bottom");r&&n.push(r);}if(e.right){let r=C(e.right,"right");r&&n.push(r);}if(e.insideH){let r=C(e.insideH,"insideH");r&&n.push(r);}if(e.insideV){let r=C(e.insideV,"insideV");r&&n.push(r);}return n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function N(e,t){if(!e)return "";let n=[];return e.top&&n.push(T(e.top,"top")),e.left&&n.push(T(e.left,"left")),e.bottom&&n.push(T(e.bottom,"bottom")),e.right&&n.push(T(e.right,"right")),n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function W(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function Se(e){if(!e)return "";let t=[];return e.firstRow&&t.push('w:firstRow="1"'),e.lastRow&&t.push('w:lastRow="1"'),e.firstColumn&&t.push('w:firstColumn="1"'),e.lastColumn&&t.push('w:lastColumn="1"'),e.noHBand&&t.push('w:noHBand="1"'),e.noVBand&&t.push('w:noVBand="1"'),t.length===0?"":`<w:tblLook ${t.join(" ")}/>`}function Ae(e){if(!e)return "";let t=[];return e.horzAnchor&&t.push(`w:horzAnchor="${e.horzAnchor}"`),e.vertAnchor&&t.push(`w:vertAnchor="${e.vertAnchor}"`),e.tblpX!==void 0&&t.push(`w:tblpX="${e.tblpX}"`),e.tblpXSpec&&t.push(`w:tblpXSpec="${e.tblpXSpec}"`),e.tblpY!==void 0&&t.push(`w:tblpY="${e.tblpY}"`),e.tblpYSpec&&t.push(`w:tblpYSpec="${e.tblpYSpec}"`),e.topFromText!==void 0&&t.push(`w:topFromText="${e.topFromText}"`),e.bottomFromText!==void 0&&t.push(`w:bottomFromText="${e.bottomFromText}"`),e.leftFromText!==void 0&&t.push(`w:leftFromText="${e.leftFromText}"`),e.rightFromText!==void 0&&t.push(`w:rightFromText="${e.rightFromText}"`),t.length===0?"":`<w:tblpPr ${t.join(" ")}/>`}function Be(e){if(!e)return "";let t=[];e.styleId&&t.push(`<w:tblStyle w:val="${Fe(e.styleId)}"/>`);let n=Ae(e.floating);n&&t.push(n),e.bidi&&t.push("<w:bidiVisual/>");let r=T(e.width,"tblW");r&&t.push(r),e.justification&&t.push(`<w:jc w:val="${e.justification}"/>`);let i=T(e.cellSpacing,"tblCellSpacing");i&&t.push(i);let s=T(e.indent,"tblInd");s&&t.push(s);let o=H(e.borders,"tblBorders");o&&t.push(o);let a=N(e.cellMargins,"tblCellMar");a&&t.push(a),e.layout&&t.push(`<w:tblLayout w:type="${e.layout}"/>`);let l=W(e.shading);l&&t.push(l);let p=Se(e.look);return p&&t.push(p),e.overlap&&t.push(`<w:tblOverlap w:val="${e.overlap}"/>`),t.length===0?"":`<w:tblPr>${t.join("")}</w:tblPr>`}function De(e){if(!e)return "";let t=[];if(e.cantSplit&&t.push("<w:cantSplit/>"),e.header&&t.push("<w:tblHeader/>"),e.height){let n=[`w:val="${e.height.value}"`];e.heightRule&&n.push(`w:hRule="${e.heightRule}"`),t.push(`<w:trHeight ${n.join(" ")}/>`);}return e.justification&&t.push(`<w:jc w:val="${e.justification}"/>`),e.hidden&&t.push("<w:hidden/>"),t.length===0?"":`<w:trPr>${t.join("")}</w:trPr>`}function Re(e){if(!e)return "";let n=[e.firstRow?"1":"0",e.lastRow?"1":"0",e.firstColumn?"1":"0",e.lastColumn?"1":"0",e.oddVBand?"1":"0",e.evenVBand?"1":"0",e.oddHBand?"1":"0",e.evenHBand?"1":"0",e.nwCell?"1":"0",e.neCell?"1":"0",e.swCell?"1":"0",e.seCell?"1":"0"].join("");return n==="000000000000"?"":`<w:cnfStyle w:val="${n}"/>`}function ze(e){if(!e)return "";let t=[],n=Re(e.conditionalFormat);n&&t.push(n);let r=T(e.width,"tcW");r&&t.push(r),e.gridSpan&&e.gridSpan>1&&t.push(`<w:gridSpan w:val="${e.gridSpan}"/>`),e.vMerge&&(e.vMerge==="restart"?t.push('<w:vMerge w:val="restart"/>'):t.push("<w:vMerge/>"));let i=H(e.borders,"tcBorders");i&&t.push(i);let s=W(e.shading);s&&t.push(s),e.noWrap&&t.push("<w:noWrap/>");let o=N(e.margins,"tcMar");return o&&t.push(o),e.textDirection&&t.push(`<w:textDirection w:val="${e.textDirection}"/>`),e.fitText&&t.push("<w:tcFitText/>"),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.hideMark&&t.push("<w:hideMark/>"),t.length===0?"":`<w:tcPr>${t.join("")}</w:tcPr>`}function ke(e){return !e||e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${n}"/>`).join("")}</w:tblGrid>`}function je(e){let t=[];for(let n of e)n.type==="paragraph"?t.push($(n)):n.type==="table"&&t.push(F(n));return t.length===0&&t.push("<w:p/>"),t.join("")}function Ee(e){let t=[],n=ze(e.formatting);return n&&t.push(n),t.push(je(e.content)),`<w:tc>${t.join("")}</w:tc>`}function Ie(e){let t=[],n=De(e.formatting);n&&t.push(n);for(let r of e.cells)t.push(Ee(r));return `<w:tr>${t.join("")}</w:tr>`}function F(e){let t=[],n=Be(e.formatting);n&&t.push(n);let r=ke(e.columnWidths);r&&t.push(r);for(let i of e.rows)t.push(Ie(i));return `<w:tbl>${t.join("")}</w:tbl>`}var w={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Xe(){let e={wpc:w.wpc,mc:w.mc,o:w.o,r:w.r,m:w.m,v:w.v,wp14:w.wp14,wp:w.wp,w10:w.w10,w:w.w,w14:w.w14,w15:w.w15,wpg:w.wpg,wps:w.wps};return Object.entries(e).map(([t,n])=>`xmlns:${t}="${n}"`).join(" ")}function S(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Le(e){return `<w:headerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Oe(e){return `<w:footerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Me(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:footnotePr>${t.join("")}</w:footnotePr>`}function He(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:endnotePr>${t.join("")}</w:endnotePr>`}function Ne(e){let t=[];return e.pageWidth!==void 0&&t.push(`w:w="${e.pageWidth}"`),e.pageHeight!==void 0&&t.push(`w:h="${e.pageHeight}"`),e.orientation==="landscape"&&t.push('w:orient="landscape"'),t.length===0?"":`<w:pgSz ${t.join(" ")}/>`}function We(e){let t=[];return e.marginTop!==void 0&&t.push(`w:top="${e.marginTop}"`),e.marginRight!==void 0&&t.push(`w:right="${e.marginRight}"`),e.marginBottom!==void 0&&t.push(`w:bottom="${e.marginBottom}"`),e.marginLeft!==void 0&&t.push(`w:left="${e.marginLeft}"`),e.headerDistance!==void 0&&t.push(`w:header="${e.headerDistance}"`),e.footerDistance!==void 0&&t.push(`w:footer="${e.footerDistance}"`),e.gutter!==void 0&&t.push(`w:gutter="${e.gutter}"`),t.length===0?"":`<w:pgMar ${t.join(" ")}/>`}function Ge(e){if(!e.columnCount&&!e.columns?.length)return "";let t=[];e.columnCount!==void 0&&e.columnCount>1&&t.push(`w:num="${e.columnCount}"`),e.columnSpace!==void 0&&t.push(`w:space="${e.columnSpace}"`),e.equalWidth!==void 0&&t.push(`w:equalWidth="${e.equalWidth?"1":"0"}"`),e.separator&&t.push('w:sep="1"');let n="";return e.columns&&e.columns.length>0&&(n=e.columns.map(i=>{let s=[];return i.width!==void 0&&s.push(`w:w="${i.width}"`),i.space!==void 0&&s.push(`w:space="${i.space}"`),`<w:col ${s.join(" ")}/>`}).join("")),t.length===0&&!n?"":`<w:cols${t.length>0?" "+t.join(" "):""}>${n}</w:cols>`}function Ve(e){if(!e.lineNumbers)return "";let t=e.lineNumbers,n=[];return t.countBy!==void 0&&n.push(`w:countBy="${t.countBy}"`),t.start!==void 0&&n.push(`w:start="${t.start}"`),t.distance!==void 0&&n.push(`w:distance="${t.distance}"`),t.restart&&n.push(`w:restart="${t.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function _e(e){if(!e.pageBorders)return "";let t=e.pageBorders,n=[],r=[];if(t.display&&n.push(`w:display="${t.display}"`),t.offsetFrom&&n.push(`w:offsetFrom="${t.offsetFrom}"`),t.zOrder&&n.push(`w:zOrder="${t.zOrder}"`),t.top){let s=S(t.top,"top");s&&r.push(s);}if(t.left){let s=S(t.left,"left");s&&r.push(s);}if(t.bottom){let s=S(t.bottom,"bottom");s&&r.push(s);}if(t.right){let s=S(t.right,"right");s&&r.push(s);}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function Ue(e){if(!e.docGrid)return "";let t=e.docGrid,n=[];return t.type&&n.push(`w:type="${t.type}"`),t.linePitch!==void 0&&n.push(`w:linePitch="${t.linePitch}"`),t.charSpace!==void 0&&n.push(`w:charSpace="${t.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function qe(e){if(!e)return "";let t=[];if(e.headerReferences)for(let c of e.headerReferences)t.push(Le(c));if(e.footerReferences)for(let c of e.footerReferences)t.push(Oe(c));let n=Me(e.footnotePr);n&&t.push(n);let r=He(e.endnotePr);r&&t.push(r),e.sectionStart&&t.push(`<w:type w:val="${e.sectionStart}"/>`);let i=Ne(e);i&&t.push(i);let s=We(e);if(s&&t.push(s),e.paperSrcFirst!==void 0||e.paperSrcOther!==void 0){let c=[];e.paperSrcFirst!==void 0&&c.push(`w:first="${e.paperSrcFirst}"`),e.paperSrcOther!==void 0&&c.push(`w:other="${e.paperSrcOther}"`),t.push(`<w:paperSrc ${c.join(" ")}/>`);}let o=_e(e);o&&t.push(o);let a=Ve(e);a&&t.push(a);let l=Ge(e);l&&t.push(l);let p=Ue(e);return p&&t.push(p),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.bidi&&t.push("<w:bidi/>"),e.titlePg&&t.push("<w:titlePg/>"),e.evenAndOddHeaders&&t.push("<w:evenAndOddHeaders/>"),t.length===0?"":`<w:sectPr>${t.join("")}</w:sectPr>`}function G(e){if(e.type==="paragraph")return $(e);if(e.type==="table")return F(e);if(e.type==="blockSdt"){let t=e.content.map(i=>G(i)).join(""),n=e.properties,r=[];return n.alias&&r.push(`<w:alias w:val="${n.alias}"/>`),n.tag&&r.push(`<w:tag w:val="${n.tag}"/>`),`<w:sdt><w:sdtPr>${r.join("")}</w:sdtPr><w:sdtContent>${t}</w:sdtContent></w:sdt>`}return ""}function Ze(e){return e.map(t=>G(t)).join("")}function Ye(e){let t=[];return t.push(Ze(e.content)),e.finalSectionProperties&&t.push(qe(e.finalSectionProperties)),t.join("")}function V(e){let t=[];t.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=Xe();return t.push(`<w:document ${n} mc:Ignorable="w14 w15 wp14">`),t.push("<w:body>"),t.push(Ye(e.package.document)),t.push("</w:body>"),t.push("</w:document>"),t.join("")}var Je={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Ke(){return Object.entries(Je).map(([e,t])=>`xmlns:${e}="${t}"`).join(" ")}function Qe(e){return e.type==="paragraph"?$(e):e.type==="table"?F(e):""}function z(e){let t=e.type==="header"?"w:hdr":"w:ftr",n=Ke(),r=e.content.map(i=>Qe(i)).join("");return r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1
|
+
import {c}from'./chunk-JKN7TNPA.js';import k from'jszip';function h(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function J(e){if(!e)return "";let t=[];return e.auto?t.push('w:val="auto"'):e.rgb&&t.push(`w:val="${e.rgb}"`),e.themeColor&&t.push(`w:themeColor="${e.themeColor}"`),e.themeTint&&t.push(`w:themeTint="${e.themeTint}"`),e.themeShade&&t.push(`w:themeShade="${e.themeShade}"`),t.length===0?"":`<w:color ${t.join(" ")}/>`}function K(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function v(e){if(!e)return "";let t=[];if(e.styleId&&t.push(`<w:rStyle w:val="${h(e.styleId)}"/>`),e.fontFamily){let i=[];e.fontFamily.ascii&&i.push(`w:ascii="${h(e.fontFamily.ascii)}"`),e.fontFamily.hAnsi&&i.push(`w:hAnsi="${h(e.fontFamily.hAnsi)}"`),e.fontFamily.eastAsia&&i.push(`w:eastAsia="${h(e.fontFamily.eastAsia)}"`),e.fontFamily.cs&&i.push(`w:cs="${h(e.fontFamily.cs)}"`),e.fontFamily.asciiTheme&&i.push(`w:asciiTheme="${e.fontFamily.asciiTheme}"`),e.fontFamily.hAnsiTheme&&i.push(`w:hAnsiTheme="${e.fontFamily.hAnsiTheme}"`),e.fontFamily.eastAsiaTheme&&i.push(`w:eastAsiaTheme="${e.fontFamily.eastAsiaTheme}"`),e.fontFamily.csTheme&&i.push(`w:csTheme="${e.fontFamily.csTheme}"`),i.length>0&&t.push(`<w:rFonts ${i.join(" ")}/>`);}e.bold===true?t.push("<w:b/>"):e.bold===false&&t.push('<w:b w:val="0"/>'),e.boldCs===true?t.push("<w:bCs/>"):e.boldCs===false&&t.push('<w:bCs w:val="0"/>'),e.italic===true?t.push("<w:i/>"):e.italic===false&&t.push('<w:i w:val="0"/>'),e.italicCs===true?t.push("<w:iCs/>"):e.italicCs===false&&t.push('<w:iCs w:val="0"/>'),e.allCaps&&t.push("<w:caps/>"),e.smallCaps&&t.push("<w:smallCaps/>"),e.strike&&t.push("<w:strike/>"),e.doubleStrike&&t.push("<w:dstrike/>"),e.outline&&t.push("<w:outline/>"),e.shadow&&t.push("<w:shadow/>"),e.emboss&&t.push("<w:emboss/>"),e.imprint&&t.push("<w:imprint/>"),e.hidden&&t.push("<w:vanish/>");let n=J(e.color);if(n&&t.push(n),e.spacing!==void 0&&t.push(`<w:spacing w:val="${e.spacing}"/>`),e.scale!==void 0&&t.push(`<w:w w:val="${e.scale}"/>`),e.kerning!==void 0&&t.push(`<w:kern w:val="${e.kerning}"/>`),e.position!==void 0&&t.push(`<w:position w:val="${e.position}"/>`),e.fontSize!==void 0&&t.push(`<w:sz w:val="${e.fontSize}"/>`),e.fontSizeCs!==void 0&&t.push(`<w:szCs w:val="${e.fontSizeCs}"/>`),e.highlight&&e.highlight!=="none"&&new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]).has(e.highlight)&&t.push(`<w:highlight w:val="${e.highlight}"/>`),e.underline){let i=[`w:val="${e.underline.style}"`];e.underline.color&&(e.underline.color.rgb&&i.push(`w:color="${e.underline.color.rgb}"`),e.underline.color.themeColor&&i.push(`w:themeColor="${e.underline.color.themeColor}"`)),t.push(`<w:u ${i.join(" ")}/>`);}e.effect&&e.effect!=="none"&&t.push(`<w:effect w:val="${e.effect}"/>`),e.emphasisMark&&e.emphasisMark!=="none"&&t.push(`<w:em w:val="${e.emphasisMark}"/>`);let r=K(e.shading);return r&&t.push(r),e.vertAlign&&e.vertAlign!=="baseline"&&t.push(`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&t.push("<w:rtl/>"),e.cs&&t.push("<w:cs/>"),t.length===0?"":`<w:rPr>${t.join("")}</w:rPr>`}function Q(e){return `<w:t${e.preserveSpace||e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${h(e.text)}</w:t>`}function ee(e){return "<w:tab/>"}function te(e){let t=[];return e.breakType==="page"?t.push('w:type="page"'):e.breakType==="column"?t.push('w:type="column"'):e.breakType==="textWrapping"&&(t.push('w:type="textWrapping"'),e.clear&&e.clear!=="none"&&t.push(`w:clear="${e.clear}"`)),t.length===0?"<w:br/>":`<w:br ${t.join(" ")}/>`}function ne(e){return `<w:sym w:font="${h(e.font)}" w:char="${h(e.char)}"/>`}function re(e){return e.type==="footnoteRef"?`<w:footnoteReference w:id="${e.id}"/>`:`<w:endnoteReference w:id="${e.id}"/>`}function ie(e){let t=[`w:fldCharType="${e.charType}"`];return e.fldLock&&t.push('w:fldLock="true"'),e.dirty&&t.push('w:dirty="true"'),`<w:fldChar ${t.join(" ")}/>`}function se(e){return `<w:instrText${e.text.startsWith(" ")||e.text.endsWith(" ")||e.text.includes(" ")?' xml:space="preserve"':""}>${h(e.text)}</w:instrText>`}function oe(e){return "<w:softHyphen/>"}function ae(e){return "<w:noBreakHyphen/>"}function D(e){if(!e)return "";if(e.rgb)return `<a:srgbClr val="${e.rgb.replace("#","")}"/>`;if(e.themeColor){let t=`<a:schemeClr val="${e.themeColor}"`;return e.themeTint?t+=`><a:tint val="${e.themeTint}"/></a:schemeClr>`:e.themeShade?t+=`><a:shade val="${e.themeShade}"/></a:schemeClr>`:t+="/>",t}return ""}function ce(e){if(!e||e.type==="none")return "<a:noFill/>";if(e.type==="solid"&&e.color)return `<a:solidFill>${D(e.color)}</a:solidFill>`;if(e.type==="gradient"&&e.gradient){let t=e.gradient,n=t.stops.map(i=>`<a:gs pos="${i.position}">${D(i.color)}</a:gs>`).join(""),r=t.type==="linear"?`<a:lin ang="${(t.angle||0)*6e4}" scaled="1"/>`:"";return `<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return ""}function E(e){if(!e)return "";let t=[];e.width!=null&&t.push(`w="${e.width}"`),e.cap&&t.push(`cap="${e.cap}"`);let n=[];return e.color&&n.push(`<a:solidFill>${D(e.color)}</a:solidFill>`),e.style&&e.style!=="solid"&&n.push(`<a:prstDash val="${e.style}"/>`),e.headEnd&&n.push(`<a:headEnd type="${e.headEnd.type}"${e.headEnd.width?` w="${e.headEnd.width}"`:""}${e.headEnd.length?` len="${e.headEnd.length}"`:""}/>`),e.tailEnd&&n.push(`<a:tailEnd type="${e.tailEnd.type}"${e.tailEnd.width?` w="${e.tailEnd.width}"`:""}${e.tailEnd.length?` len="${e.tailEnd.length}"`:""}/>`),n.length===0&&t.length===0?"":`<a:ln${t.length?" "+t.join(" "):""}>${n.join("")}</a:ln>`}function I(e){let t=[],n=e.horizontal;t.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?t.push(`<wp:align>${n.alignment}</wp:align>`):t.push(`<wp:posOffset>${n.posOffset||0}</wp:posOffset>`),t.push("</wp:positionH>");let r=e.vertical;return t.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?t.push(`<wp:align>${r.alignment}</wp:align>`):t.push(`<wp:posOffset>${r.posOffset||0}</wp:posOffset>`),t.push("</wp:positionV>"),t.join("")}function X(e){let t=e.wrapText?` wrapText="${e.wrapText}"`:' wrapText="bothSides"';switch(e.type){case "square":return `<wp:wrapSquare${t}/>`;case "tight":return `<wp:wrapTight${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case "through":return `<wp:wrapThrough${t}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case "topAndBottom":return "<wp:wrapTopAndBottom/>";case "behind":case "inFront":return "<wp:wrapNone/>";default:return "<wp:wrapNone/>"}}function le(e){let t=e.size.width,n=e.size.height,r=e.rId||"rId1",i=e.id||"0",s=e.filename||`image${i}`,o="";return e.transform?.rotation&&(o+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(o+=' flipH="1"'),e.transform?.flipV&&(o+=' flipV="1"'),['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${i}" name="${h(s)}"${e.alt?` descr="${h(e.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",`<a:blip r:embed="${r}"/>`,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${o}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${t}" cy="${n}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',e.outline?E(e.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function pe(e){let t=e.image,n=t.wrap.type!=="inline",r=t.size.width,i=t.size.height,s=t.padding?.top??t.wrap.distT??0,o=t.padding?.bottom??t.wrap.distB??0,a=t.padding?.left??t.wrap.distL??0,l=t.padding?.right??t.wrap.distR??0,p=t.id||"1",c=t.title||t.filename||`Picture ${p}`,u=le(t);if(!n)return ["<w:drawing>",`<wp:inline distT="${s}" distB="${o}" distL="${a}" distR="${l}">`,`<wp:extent cx="${r}" cy="${i}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${p}" name="${h(c)}"${t.alt?` descr="${h(t.alt)}"`:""}${t.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',u,"</wp:inline>","</w:drawing>"].join("");let f=t.wrap.type==="behind"?"1":"0",g=t.position?I(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',b=X(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${s}" distB="${o}" distL="${a}" distR="${l}" simplePos="0" relativeHeight="251658240" behindDoc="${f}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',g,`<wp:extent cx="${r}" cy="${i}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',b,`<wp:docPr id="${p}" name="${h(c)}"${t.alt?` descr="${h(t.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',u,"</wp:anchor>","</w:drawing>"].join("")}function ue(e){return e.map(t=>$(t)).join("")}function fe(e){let t=e.shape,n=t.size.width,r=t.size.height,i=t.shapeType==="textBox",s=t.wrap&&t.wrap.type!=="inline",o=t.wrap?.distT??0,a=t.wrap?.distB??0,l=t.wrap?.distL??0,p=t.wrap?.distR??0,c=t.id||"1",u=t.name||(i?`TextBox ${c}`:`Shape ${c}`),f="";t.transform?.rotation&&(f+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(f+=' flipH="1"'),t.transform?.flipV&&(f+=' flipV="1"');let g=["<wps:spPr>",`<a:xfrm${f}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${n}" cy="${r}"/>`,"</a:xfrm>",`<a:prstGeom prst="${t.shapeType==="textBox"?"rect":t.shapeType}"><a:avLst/></a:prstGeom>`,ce(t.fill),E(t.outline),"</wps:spPr>"].join(""),b="";if(t.textBody){let d=t.textBody,y=['rot="0"','vert="horz"'];d.anchor&&y.push(`anchor="${d.anchor==="middle"?"ctr":d.anchor}"`),d.anchorCenter&&y.push('anchorCtr="1"'),d.margins&&(d.margins.left!=null&&y.push(`lIns="${d.margins.left}"`),d.margins.top!=null&&y.push(`tIns="${d.margins.top}"`),d.margins.right!=null&&y.push(`rIns="${d.margins.right}"`),d.margins.bottom!=null&&y.push(`bIns="${d.margins.bottom}"`)),i?b=["<wps:txbx><w:txbxContent>",ue(d.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${y.join(" ")}/>`].join(""):b=[`<wps:bodyPr ${y.join(" ")}/>`].join("");}let j=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${i?' txBox="1"':""}/>`,g,b,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!s)return ["<w:drawing>",`<wp:inline distT="${o}" distB="${a}" distL="${l}" distR="${p}">`,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${c}" name="${h(u)}"/>`,"<wp:cNvGraphicFramePr/>",j,"</wp:inline>","</w:drawing>"].join("");let q=t.wrap?.type==="behind"?"1":"0",Z=t.position?I(t.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',Y=X(t.wrap);return ["<w:drawing>",`<wp:anchor distT="${o}" distB="${a}" distL="${l}" distR="${p}" simplePos="0" relativeHeight="251658240" behindDoc="${q}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',Z,`<wp:extent cx="${n}" cy="${r}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',Y,`<wp:docPr id="${c}" name="${h(u)}"/>`,"<wp:cNvGraphicFramePr/>",j,"</wp:anchor>","</w:drawing>"].join("")}function he(e){switch(e.type){case "text":return Q(e);case "tab":return ee();case "break":return te(e);case "symbol":return ne(e);case "footnoteRef":case "endnoteRef":return re(e);case "fieldChar":return ie(e);case "instrText":return se(e);case "softHyphen":return oe();case "noBreakHyphen":return ae();case "drawing":return pe(e);case "shape":return fe(e);default:return ""}}function x(e){let t=[],n=v(e.formatting);n&&t.push(n);for(let r of e.content){let i=he(r);i&&t.push(i);}return `<w:r>${t.join("")}</w:r>`}function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function P(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function me(e){if(!e)return "";let t=[];if(e.top){let n=P(e.top,"top");n&&t.push(n);}if(e.left){let n=P(e.left,"left");n&&t.push(n);}if(e.bottom){let n=P(e.bottom,"bottom");n&&t.push(n);}if(e.right){let n=P(e.right,"right");n&&t.push(n);}if(e.between){let n=P(e.between,"between");n&&t.push(n);}if(e.bar){let n=P(e.bar,"bar");n&&t.push(n);}return t.length===0?"":`<w:pBdr>${t.join("")}</w:pBdr>`}function de(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function we(e){return !e||e.length===0?"":`<w:tabs>${e.map(n=>{let r=[`w:val="${n.alignment}"`,`w:pos="${n.position}"`];return n.leader&&n.leader!=="none"&&r.push(`w:leader="${n.leader}"`),`<w:tab ${r.join(" ")}/>`}).join("")}</w:tabs>`}function ge(e){let t=[];return e.spaceBefore!==void 0&&t.push(`w:before="${e.spaceBefore}"`),e.spaceAfter!==void 0&&t.push(`w:after="${e.spaceAfter}"`),e.lineSpacing!==void 0&&t.push(`w:line="${e.lineSpacing}"`),e.lineSpacingRule&&t.push(`w:lineRule="${e.lineSpacingRule}"`),e.beforeAutospacing&&t.push('w:beforeAutospacing="1"'),e.afterAutospacing&&t.push('w:afterAutospacing="1"'),t.length===0?"":`<w:spacing ${t.join(" ")}/>`}function ye(e){let t=[];return e.indentLeft!==void 0&&t.push(`w:left="${e.indentLeft}"`),e.indentRight!==void 0&&t.push(`w:right="${e.indentRight}"`),e.indentFirstLine!==void 0&&(e.hangingIndent?t.push(`w:hanging="${Math.abs(e.indentFirstLine)}"`):e.indentFirstLine!==0&&t.push(`w:firstLine="${e.indentFirstLine}"`)),t.length===0?"":`<w:ind ${t.join(" ")}/>`}function xe(e){if(!e)return "";let t=[];return e.ilvl!==void 0&&t.push(`<w:ilvl w:val="${e.ilvl}"/>`),e.numId!==void 0&&t.push(`<w:numId w:val="${e.numId}"/>`),t.length===0?"":`<w:numPr>${t.join("")}</w:numPr>`}function $e(e){if(!e)return "";let t=[];return e.width!==void 0&&t.push(`w:w="${e.width}"`),e.height!==void 0&&t.push(`w:h="${e.height}"`),e.hAnchor&&t.push(`w:hAnchor="${e.hAnchor}"`),e.vAnchor&&t.push(`w:vAnchor="${e.vAnchor}"`),e.x!==void 0&&t.push(`w:x="${e.x}"`),e.y!==void 0&&t.push(`w:y="${e.y}"`),e.xAlign&&t.push(`w:xAlign="${e.xAlign}"`),e.yAlign&&t.push(`w:yAlign="${e.yAlign}"`),e.wrap&&t.push(`w:wrap="${e.wrap}"`),t.length===0?"":`<w:framePr ${t.join(" ")}/>`}function Te(e){if(!e)return "";let t=[];e.styleId&&t.push(`<w:pStyle w:val="${m(e.styleId)}"/>`),e.keepNext&&t.push("<w:keepNext/>"),e.keepLines&&t.push("<w:keepLines/>"),e.contextualSpacing&&t.push("<w:contextualSpacing/>"),e.pageBreakBefore&&t.push("<w:pageBreakBefore/>");let n=$e(e.frame);n&&t.push(n),e.widowControl===false?t.push('<w:widowControl w:val="0"/>'):e.widowControl===true&&t.push("<w:widowControl/>");let r=xe(e.numPr);r&&t.push(r);let i=me(e.borders);i&&t.push(i);let s=de(e.shading);s&&t.push(s);let o=we(e.tabs);o&&t.push(o),e.suppressLineNumbers&&t.push("<w:suppressLineNumbers/>"),e.suppressAutoHyphens&&t.push("<w:suppressAutoHyphens/>");let a=ge(e);a&&t.push(a);let l=ye(e);if(l&&t.push(l),e.bidi&&t.push("<w:bidi/>"),e.alignment&&t.push(`<w:jc w:val="${e.alignment}"/>`),e.outlineLevel!==void 0&&t.push(`<w:outlineLvl w:val="${e.outlineLevel}"/>`),e.runProperties){let p=v(e.runProperties);p&&t.push(p);}return t.length===0?"":`<w:pPr>${t.join("")}</w:pPr>`}function R(e){let t=[];e.rId&&t.push(`r:id="${e.rId}"`),e.anchor&&t.push(`w:anchor="${m(e.anchor)}"`),e.tooltip&&t.push(`w:tooltip="${m(e.tooltip)}"`),e.target&&t.push(`w:tgtFrame="${m(e.target)}"`),e.history===false&&t.push('w:history="0"'),e.docLocation&&t.push(`w:docLocation="${m(e.docLocation)}"`);let n=e.children.map(i=>i.type==="run"?x(i):i.type==="bookmarkStart"?O(i):i.type==="bookmarkEnd"?M(i):"").join("");return `<w:hyperlink${t.length>0?" "+t.join(" "):""}>${n}</w:hyperlink>`}function O(e){let t=[`w:id="${e.id}"`,`w:name="${m(e.name)}"`];return e.colFirst!==void 0&&t.push(`w:colFirst="${e.colFirst}"`),e.colLast!==void 0&&t.push(`w:colLast="${e.colLast}"`),`<w:bookmarkStart ${t.join(" ")}/>`}function M(e){return `<w:bookmarkEnd w:id="${e.id}"/>`}function be(e){let t=[],n=e.content.find(a=>a.type==="run"),r=n?.formatting?v(n.formatting):"",i=['w:fldCharType="begin"'];e.fldLock&&i.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${i.join(" ")}/></w:r>`);let o=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${o}>${m(e.instruction)}</w:instrText></w:r>`),t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let a of e.content)a.type==="run"&&t.push(x(a));return t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Pe(e){let t=[],n=e.fieldResult?.[0]?.formatting,r=n?v(n):"",i=['w:fldCharType="begin"'];if(e.fldLock&&i.push('w:fldLock="true"'),t.push(`<w:r>${r}<w:fldChar ${i.join(" ")}/></w:r>`),e.fieldCode.length>0)t.push(...e.fieldCode.map(s=>x(s)));else {let o=e.instruction.startsWith(" ")||e.instruction.endsWith(" ")||e.instruction.includes(" ")?' xml:space="preserve"':"";t.push(`<w:r>${r}<w:instrText${o}>${m(e.instruction)}</w:instrText></w:r>`);}return t.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),t.push(...e.fieldResult.map(s=>x(s))),t.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),t.join("")}function Ce(e){let t=e.properties,n=[];switch(t.alias&&n.push(`<w:alias w:val="${m(t.alias)}"/>`),t.tag&&n.push(`<w:tag w:val="${m(t.tag)}"/>`),t.lock&&t.lock!=="unlocked"&&n.push(`<w:lock w:val="${t.lock}"/>`),t.showingPlaceholder&&n.push("<w:showingPlcHdr/>"),t.sdtType){case "plainText":n.push("<w:text/>");break;case "date":t.dateFormat?n.push(`<w:date w:fullDate="${m(t.dateFormat)}"/>`):n.push("<w:date/>");break;case "dropdown":{let i=(t.listItems??[]).map(s=>`<w:listItem w:displayText="${m(s.displayText)}" w:value="${m(s.value)}"/>`).join("");n.push(`<w:dropDownList>${i}</w:dropDownList>`);break}case "comboBox":{let i=(t.listItems??[]).map(s=>`<w:listItem w:displayText="${m(s.displayText)}" w:value="${m(s.value)}"/>`).join("");n.push(`<w:comboBox>${i}</w:comboBox>`);break}case "checkbox":n.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/></w14:checkbox>`);break;case "picture":n.push("<w:picture/>");break}let r=e.content.map(i=>i.type==="run"?x(i):i.type==="hyperlink"?R(i):"").join("");return `<w:sdt><w:sdtPr>${n.join("")}</w:sdtPr><w:sdtContent>${r}</w:sdtContent></w:sdt>`}function L(e,t){let n=t.info,r=[`w:id="${n.id}"`,`w:author="${m(n.author)}"`];n.date&&r.push(`w:date="${m(n.date)}"`);let i=t.content.map(s=>s.type==="run"?x(s):s.type==="hyperlink"?R(s):"").join("");return `<w:${e} ${r.join(" ")}>${i}</w:${e}>`}function ve(e){switch(e.type){case "run":return x(e);case "hyperlink":return R(e);case "bookmarkStart":return O(e);case "bookmarkEnd":return M(e);case "simpleField":return be(e);case "complexField":return Pe(e);case "inlineSdt":return Ce(e);case "commentRangeStart":return `<w:commentRangeStart w:id="${e.id}"/>`;case "commentRangeEnd":return `<w:commentRangeEnd w:id="${e.id}"/>`;case "insertion":return L("ins",e);case "deletion":return L("del",e);case "mathEquation":return e.ommlXml||"";default:return ""}}function $(e){let t=[],n=[];e.paraId&&n.push(`w14:paraId="${e.paraId}"`),e.textId&&n.push(`w14:textId="${e.textId}"`);let r=n.length>0?" "+n.join(" "):"",i=Te(e.formatting);i&&t.push(i);for(let s of e.content){let o=ve(s);o&&t.push(o);}return `<w:p${r}>${t.join("")}</w:p>`}function Fe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function T(e,t){if(!e)return "";let n=[`w:w="${e.value}"`,`w:type="${e.type}"`];return `<w:${t} ${n.join(" ")}/>`}function C(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function H(e,t){if(!e)return "";let n=[];if(e.top){let r=C(e.top,"top");r&&n.push(r);}if(e.left){let r=C(e.left,"left");r&&n.push(r);}if(e.bottom){let r=C(e.bottom,"bottom");r&&n.push(r);}if(e.right){let r=C(e.right,"right");r&&n.push(r);}if(e.insideH){let r=C(e.insideH,"insideH");r&&n.push(r);}if(e.insideV){let r=C(e.insideV,"insideV");r&&n.push(r);}return n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function N(e,t){if(!e)return "";let n=[];return e.top&&n.push(T(e.top,"top")),e.left&&n.push(T(e.left,"left")),e.bottom&&n.push(T(e.bottom,"bottom")),e.right&&n.push(T(e.right,"right")),n.length===0?"":`<w:${t}>${n.join("")}</w:${t}>`}function W(e){if(!e)return "";let t=[];return e.pattern?t.push(`w:val="${e.pattern}"`):t.push('w:val="clear"'),e.color?.rgb?t.push(`w:color="${e.color.rgb}"`):e.color?.auto&&t.push('w:color="auto"'),e.fill?.rgb?t.push(`w:fill="${e.fill.rgb}"`):e.fill?.auto&&t.push('w:fill="auto"'),e.fill?.themeColor&&t.push(`w:themeFill="${e.fill.themeColor}"`),e.fill?.themeTint&&t.push(`w:themeFillTint="${e.fill.themeTint}"`),e.fill?.themeShade&&t.push(`w:themeFillShade="${e.fill.themeShade}"`),t.length===0?"":`<w:shd ${t.join(" ")}/>`}function Se(e){if(!e)return "";let t=[];return e.firstRow&&t.push('w:firstRow="1"'),e.lastRow&&t.push('w:lastRow="1"'),e.firstColumn&&t.push('w:firstColumn="1"'),e.lastColumn&&t.push('w:lastColumn="1"'),e.noHBand&&t.push('w:noHBand="1"'),e.noVBand&&t.push('w:noVBand="1"'),t.length===0?"":`<w:tblLook ${t.join(" ")}/>`}function Ae(e){if(!e)return "";let t=[];return e.horzAnchor&&t.push(`w:horzAnchor="${e.horzAnchor}"`),e.vertAnchor&&t.push(`w:vertAnchor="${e.vertAnchor}"`),e.tblpX!==void 0&&t.push(`w:tblpX="${e.tblpX}"`),e.tblpXSpec&&t.push(`w:tblpXSpec="${e.tblpXSpec}"`),e.tblpY!==void 0&&t.push(`w:tblpY="${e.tblpY}"`),e.tblpYSpec&&t.push(`w:tblpYSpec="${e.tblpYSpec}"`),e.topFromText!==void 0&&t.push(`w:topFromText="${e.topFromText}"`),e.bottomFromText!==void 0&&t.push(`w:bottomFromText="${e.bottomFromText}"`),e.leftFromText!==void 0&&t.push(`w:leftFromText="${e.leftFromText}"`),e.rightFromText!==void 0&&t.push(`w:rightFromText="${e.rightFromText}"`),t.length===0?"":`<w:tblpPr ${t.join(" ")}/>`}function Be(e){if(!e)return "";let t=[];e.styleId&&t.push(`<w:tblStyle w:val="${Fe(e.styleId)}"/>`);let n=Ae(e.floating);n&&t.push(n),e.bidi&&t.push("<w:bidiVisual/>");let r=T(e.width,"tblW");r&&t.push(r),e.justification&&t.push(`<w:jc w:val="${e.justification}"/>`);let i=T(e.cellSpacing,"tblCellSpacing");i&&t.push(i);let s=T(e.indent,"tblInd");s&&t.push(s);let o=H(e.borders,"tblBorders");o&&t.push(o);let a=N(e.cellMargins,"tblCellMar");a&&t.push(a),e.layout&&t.push(`<w:tblLayout w:type="${e.layout}"/>`);let l=W(e.shading);l&&t.push(l);let p=Se(e.look);return p&&t.push(p),e.overlap&&t.push(`<w:tblOverlap w:val="${e.overlap}"/>`),t.length===0?"":`<w:tblPr>${t.join("")}</w:tblPr>`}function De(e){if(!e)return "";let t=[];if(e.cantSplit&&t.push("<w:cantSplit/>"),e.header&&t.push("<w:tblHeader/>"),e.height){let n=[`w:val="${e.height.value}"`];e.heightRule&&n.push(`w:hRule="${e.heightRule}"`),t.push(`<w:trHeight ${n.join(" ")}/>`);}return e.justification&&t.push(`<w:jc w:val="${e.justification}"/>`),e.hidden&&t.push("<w:hidden/>"),t.length===0?"":`<w:trPr>${t.join("")}</w:trPr>`}function Re(e){if(!e)return "";let n=[e.firstRow?"1":"0",e.lastRow?"1":"0",e.firstColumn?"1":"0",e.lastColumn?"1":"0",e.oddVBand?"1":"0",e.evenVBand?"1":"0",e.oddHBand?"1":"0",e.evenHBand?"1":"0",e.nwCell?"1":"0",e.neCell?"1":"0",e.swCell?"1":"0",e.seCell?"1":"0"].join("");return n==="000000000000"?"":`<w:cnfStyle w:val="${n}"/>`}function ze(e){if(!e)return "";let t=[],n=Re(e.conditionalFormat);n&&t.push(n);let r=T(e.width,"tcW");r&&t.push(r),e.gridSpan&&e.gridSpan>1&&t.push(`<w:gridSpan w:val="${e.gridSpan}"/>`),e.vMerge&&(e.vMerge==="restart"?t.push('<w:vMerge w:val="restart"/>'):t.push("<w:vMerge/>"));let i=H(e.borders,"tcBorders");i&&t.push(i);let s=W(e.shading);s&&t.push(s),e.noWrap&&t.push("<w:noWrap/>");let o=N(e.margins,"tcMar");return o&&t.push(o),e.textDirection&&t.push(`<w:textDirection w:val="${e.textDirection}"/>`),e.fitText&&t.push("<w:tcFitText/>"),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.hideMark&&t.push("<w:hideMark/>"),t.length===0?"":`<w:tcPr>${t.join("")}</w:tcPr>`}function ke(e){return !e||e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${n}"/>`).join("")}</w:tblGrid>`}function je(e){let t=[];for(let n of e)n.type==="paragraph"?t.push($(n)):n.type==="table"&&t.push(F(n));return t.length===0&&t.push("<w:p/>"),t.join("")}function Ee(e){let t=[],n=ze(e.formatting);return n&&t.push(n),t.push(je(e.content)),`<w:tc>${t.join("")}</w:tc>`}function Ie(e){let t=[],n=De(e.formatting);n&&t.push(n);for(let r of e.cells)t.push(Ee(r));return `<w:tr>${t.join("")}</w:tr>`}function F(e){let t=[],n=Be(e.formatting);n&&t.push(n);let r=ke(e.columnWidths);r&&t.push(r);for(let i of e.rows)t.push(Ie(i));return `<w:tbl>${t.join("")}</w:tbl>`}var w={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Xe(){let e={wpc:w.wpc,mc:w.mc,o:w.o,r:w.r,m:w.m,v:w.v,wp14:w.wp14,wp:w.wp,w10:w.w10,w:w.w,w14:w.w14,w15:w.w15,wpg:w.wpg,wps:w.wps};return Object.entries(e).map(([t,n])=>`xmlns:${t}="${n}"`).join(" ")}function S(e,t){if(!e||e.style==="none"||e.style==="nil")return "";let n=[`w:val="${e.style}"`];return e.size!==void 0&&n.push(`w:sz="${e.size}"`),e.space!==void 0&&n.push(`w:space="${e.space}"`),e.color&&(e.color.auto?n.push('w:color="auto"'):e.color.rgb&&n.push(`w:color="${e.color.rgb}"`),e.color.themeColor&&n.push(`w:themeColor="${e.color.themeColor}"`),e.color.themeTint&&n.push(`w:themeTint="${e.color.themeTint}"`),e.color.themeShade&&n.push(`w:themeShade="${e.color.themeShade}"`)),e.shadow&&n.push('w:shadow="true"'),e.frame&&n.push('w:frame="true"'),`<w:${t} ${n.join(" ")}/>`}function Le(e){return `<w:headerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Oe(e){return `<w:footerReference ${[`w:type="${e.type}"`,`r:id="${e.rId}"`].join(" ")}/>`}function Me(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:footnotePr>${t.join("")}</w:footnotePr>`}function He(e){if(!e)return "";let t=[];return e.position&&t.push(`<w:pos w:val="${e.position}"/>`),e.numFmt&&t.push(`<w:numFmt w:val="${e.numFmt}"/>`),e.numStart!==void 0&&t.push(`<w:numStart w:val="${e.numStart}"/>`),e.numRestart&&t.push(`<w:numRestart w:val="${e.numRestart}"/>`),t.length===0?"":`<w:endnotePr>${t.join("")}</w:endnotePr>`}function Ne(e){let t=[];return e.pageWidth!==void 0&&t.push(`w:w="${e.pageWidth}"`),e.pageHeight!==void 0&&t.push(`w:h="${e.pageHeight}"`),e.orientation==="landscape"&&t.push('w:orient="landscape"'),t.length===0?"":`<w:pgSz ${t.join(" ")}/>`}function We(e){let t=[];return e.marginTop!==void 0&&t.push(`w:top="${e.marginTop}"`),e.marginRight!==void 0&&t.push(`w:right="${e.marginRight}"`),e.marginBottom!==void 0&&t.push(`w:bottom="${e.marginBottom}"`),e.marginLeft!==void 0&&t.push(`w:left="${e.marginLeft}"`),e.headerDistance!==void 0&&t.push(`w:header="${e.headerDistance}"`),e.footerDistance!==void 0&&t.push(`w:footer="${e.footerDistance}"`),e.gutter!==void 0&&t.push(`w:gutter="${e.gutter}"`),t.length===0?"":`<w:pgMar ${t.join(" ")}/>`}function Ge(e){if(!e.columnCount&&!e.columns?.length)return "";let t=[];e.columnCount!==void 0&&e.columnCount>1&&t.push(`w:num="${e.columnCount}"`),e.columnSpace!==void 0&&t.push(`w:space="${e.columnSpace}"`),e.equalWidth!==void 0&&t.push(`w:equalWidth="${e.equalWidth?"1":"0"}"`),e.separator&&t.push('w:sep="1"');let n="";return e.columns&&e.columns.length>0&&(n=e.columns.map(i=>{let s=[];return i.width!==void 0&&s.push(`w:w="${i.width}"`),i.space!==void 0&&s.push(`w:space="${i.space}"`),`<w:col ${s.join(" ")}/>`}).join("")),t.length===0&&!n?"":`<w:cols${t.length>0?" "+t.join(" "):""}>${n}</w:cols>`}function Ve(e){if(!e.lineNumbers)return "";let t=e.lineNumbers,n=[];return t.countBy!==void 0&&n.push(`w:countBy="${t.countBy}"`),t.start!==void 0&&n.push(`w:start="${t.start}"`),t.distance!==void 0&&n.push(`w:distance="${t.distance}"`),t.restart&&n.push(`w:restart="${t.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function _e(e){if(!e.pageBorders)return "";let t=e.pageBorders,n=[],r=[];if(t.display&&n.push(`w:display="${t.display}"`),t.offsetFrom&&n.push(`w:offsetFrom="${t.offsetFrom}"`),t.zOrder&&n.push(`w:zOrder="${t.zOrder}"`),t.top){let s=S(t.top,"top");s&&r.push(s);}if(t.left){let s=S(t.left,"left");s&&r.push(s);}if(t.bottom){let s=S(t.bottom,"bottom");s&&r.push(s);}if(t.right){let s=S(t.right,"right");s&&r.push(s);}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function Ue(e){if(!e.docGrid)return "";let t=e.docGrid,n=[];return t.type&&n.push(`w:type="${t.type}"`),t.linePitch!==void 0&&n.push(`w:linePitch="${t.linePitch}"`),t.charSpace!==void 0&&n.push(`w:charSpace="${t.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function qe(e){if(!e)return "";let t=[];if(e.headerReferences)for(let c of e.headerReferences)t.push(Le(c));if(e.footerReferences)for(let c of e.footerReferences)t.push(Oe(c));let n=Me(e.footnotePr);n&&t.push(n);let r=He(e.endnotePr);r&&t.push(r),e.sectionStart&&t.push(`<w:type w:val="${e.sectionStart}"/>`);let i=Ne(e);i&&t.push(i);let s=We(e);if(s&&t.push(s),e.paperSrcFirst!==void 0||e.paperSrcOther!==void 0){let c=[];e.paperSrcFirst!==void 0&&c.push(`w:first="${e.paperSrcFirst}"`),e.paperSrcOther!==void 0&&c.push(`w:other="${e.paperSrcOther}"`),t.push(`<w:paperSrc ${c.join(" ")}/>`);}let o=_e(e);o&&t.push(o);let a=Ve(e);a&&t.push(a);let l=Ge(e);l&&t.push(l);let p=Ue(e);return p&&t.push(p),e.verticalAlign&&t.push(`<w:vAlign w:val="${e.verticalAlign}"/>`),e.bidi&&t.push("<w:bidi/>"),e.titlePg&&t.push("<w:titlePg/>"),e.evenAndOddHeaders&&t.push("<w:evenAndOddHeaders/>"),t.length===0?"":`<w:sectPr>${t.join("")}</w:sectPr>`}function G(e){if(e.type==="paragraph")return $(e);if(e.type==="table")return F(e);if(e.type==="blockSdt"){let t=e.content.map(i=>G(i)).join(""),n=e.properties,r=[];return n.alias&&r.push(`<w:alias w:val="${n.alias}"/>`),n.tag&&r.push(`<w:tag w:val="${n.tag}"/>`),`<w:sdt><w:sdtPr>${r.join("")}</w:sdtPr><w:sdtContent>${t}</w:sdtContent></w:sdt>`}return ""}function Ze(e){return e.map(t=>G(t)).join("")}function Ye(e){let t=[];return t.push(Ze(e.content)),e.finalSectionProperties&&t.push(qe(e.finalSectionProperties)),t.join("")}function V(e){let t=[];t.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=Xe();return t.push(`<w:document ${n} mc:Ignorable="w14 w15 wp14">`),t.push("<w:body>"),t.push(Ye(e.package.document)),t.push("</w:body>"),t.push("</w:document>"),t.join("")}var Je={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function Ke(){return Object.entries(Je).map(([e,t])=>`xmlns:${e}="${t}"`).join(" ")}function Qe(e){return e.type==="paragraph"?$(e):e.type==="table"?F(e):""}function z(e){let t=e.type==="header"?"w:hdr":"w:ftr",n=Ke(),r=e.content.map(i=>Qe(i)).join("");return r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
2
|
<${t} ${n}>${r}</${t}>`}function U(e){let t=[];for(let n of e)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run")for(let i of r.content)i.type==="drawing"&&i.image.src?.startsWith("data:")&&t.push(i.image);}else if(n.type==="table")for(let r of n.rows)for(let i of r.cells)t.push(...U(i.content));return t}var et={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tiff","image/webp":"webp","image/svg+xml":"svg"};function tt(e){let t=e.match(/^data:([^;]+);base64,(.+)$/);if(!t)throw new Error("Invalid data URL");let n=atob(t[2]),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return {data:r.buffer,extension:et[t[1]]||"png"}}async function nt(e,t,n){if(e.length===0)return;let r="word/_rels/document.xml.rels",i=t.file(r);if(!i)return;let s=await i.async("text"),o=0;for(let c of s.matchAll(/Id="rId(\d+)"/g)){let u=parseInt(c[1],10);u>o&&(o=u);}let a=0;t.forEach(c=>{let u=c.match(/^word\/media\/image(\d+)\./);if(u){let f=parseInt(u[1],10);f>a&&(a=f);}});let l=[],p=new Set;for(let c of e){let{data:u,extension:f}=tt(c.src);a++,o++;let g=`image${a}.${f}`,b=`word/media/${g}`,A=`rId${o}`;t.file(b,u,{compression:"DEFLATE",compressionOptions:{level:n}}),l.push(`<Relationship Id="${A}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/${g}"/>`),p.add(f),c.rId=A;}if(l.length>0&&(s=s.replace("</Relationships>",l.join("")+"</Relationships>"),t.file(r,s,{compression:"DEFLATE",compressionOptions:{level:n}})),p.size>0){let c=t.file("[Content_Types].xml");if(c){let u=await c.async("text");for(let f of p)if(!u.includes(`Extension="${f}"`)){let g=ot(f);u=u.replace("</Types>",`<Default Extension="${f}" ContentType="${g}"/></Types>`);}t.file("[Content_Types].xml",u,{compression:"DEFLATE",compressionOptions:{level:n}});}}}async function rt(e,t={}){if(!e.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");let{compressionLevel:n=6,updateModifiedDate:r=true,modifiedBy:i}=t,s=await k.loadAsync(e.originalBuffer),o=new k;for(let[c,u]of Object.entries(s.files)){if(u.dir){o.folder(c.replace(/\/$/,""));continue}let f=await u.async("arraybuffer");o.file(c,f,{compression:"DEFLATE",compressionOptions:{level:n}});}let a=U(e.package.document.content);await nt(a,o,n);let l=V(e);if(o.file("word/document.xml",l,{compression:"DEFLATE",compressionOptions:{level:n}}),it(e,o,n),r){let c="docProps/core.xml",u=s.file(c);if(u){let f=await u.async("text"),g=st(f,{updateModifiedDate:r,modifiedBy:i});o.file(c,g,{compression:"DEFLATE",compressionOptions:{level:n}});}}return await o.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:n}})}function it(e,t,n){let r=e.package.relationships;if(!r)return;let i={level:n};if(e.package.headers)for(let[s,o]of e.package.headers.entries()){let a=r.get(s);if(a&&a.type===c.header&&a.target){let l=a.target.startsWith("/")?a.target.slice(1):`word/${a.target}`,p=z(o);t.file(l,p,{compression:"DEFLATE",compressionOptions:i});}}if(e.package.footers)for(let[s,o]of e.package.footers.entries()){let a=r.get(s);if(a&&a.type===c.footer&&a.target){let l=a.target.startsWith("/")?a.target.slice(1):`word/${a.target}`,p=z(o);t.file(l,p,{compression:"DEFLATE",compressionOptions:i});}}}function st(e,t){let n=e;if(t.updateModifiedDate){let r=new Date().toISOString();n.includes("<dcterms:modified")?n=n.replace(/<dcterms:modified[^>]*>[^<]*<\/dcterms:modified>/,`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified>`):n=n.replace("</cp:coreProperties>",`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified></cp:coreProperties>`);}return t.modifiedBy&&(n.includes("<cp:lastModifiedBy")?n=n.replace(/<cp:lastModifiedBy>[^<]*<\/cp:lastModifiedBy>/,`<cp:lastModifiedBy>${_(t.modifiedBy)}</cp:lastModifiedBy>`):n=n.replace("</cp:coreProperties>",`<cp:lastModifiedBy>${_(t.modifiedBy)}</cp:lastModifiedBy></cp:coreProperties>`)),n}function _(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ot(e,t){return {png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp",wmf:"image/x-wmf",emf:"image/x-emf"}[e]||"application/octet-stream"}async function at(){let e=new k;e.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
3
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
4
4
|
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
package/dist/core-plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkRM3ITJ2H_cjs=require('./chunk-RM3ITJ2H.cjs');require('./chunk-ITWEFKGQ.cjs'),require('./chunk-NT2REEAA.cjs'),require('./chunk-NO7WUK5E.cjs');var chunkPXC7ARQB_cjs=require('./chunk-PXC7ARQB.cjs');require('./chunk-VOWKSURW.cjs');Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkRM3ITJ2H_cjs.b}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkRM3ITJ2H_cjs.a}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.d}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.c}});
|
package/dist/core-plugins.d.cts
CHANGED
|
@@ -7,9 +7,9 @@ import './agentApi-CbVUCZRu.cjs';
|
|
|
7
7
|
* Docxtemplater Plugin
|
|
8
8
|
*
|
|
9
9
|
* Core plugin for template variable functionality using docxtemplater.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* **Command handlers** — `insertTemplateVariable` and `replaceWithTemplateVariable`
|
|
12
|
+
* allow DocumentAgent to programmatically insert `{variable}` placeholders.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
@@ -21,7 +21,10 @@ import './agentApi-CbVUCZRu.cjs';
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Docxtemplater plugin for template variable functionality
|
|
24
|
+
* Docxtemplater plugin for template variable functionality.
|
|
25
|
+
*
|
|
26
|
+
* Dependency validation is handled lazily by `processTemplate` at call time,
|
|
27
|
+
* so no eager `initialize()` is needed.
|
|
25
28
|
*/
|
|
26
29
|
declare const docxtemplaterPlugin: CorePlugin;
|
|
27
30
|
|
package/dist/core-plugins.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import './agentApi-CbVUCZRu.js';
|
|
|
7
7
|
* Docxtemplater Plugin
|
|
8
8
|
*
|
|
9
9
|
* Core plugin for template variable functionality using docxtemplater.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* **Command handlers** — `insertTemplateVariable` and `replaceWithTemplateVariable`
|
|
12
|
+
* allow DocumentAgent to programmatically insert `{variable}` placeholders.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
@@ -21,7 +21,10 @@ import './agentApi-CbVUCZRu.js';
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Docxtemplater plugin for template variable functionality
|
|
24
|
+
* Docxtemplater plugin for template variable functionality.
|
|
25
|
+
*
|
|
26
|
+
* Dependency validation is handled lazily by `processTemplate` at call time,
|
|
27
|
+
* so no eager `initialize()` is needed.
|
|
25
28
|
*/
|
|
26
29
|
declare const docxtemplaterPlugin: CorePlugin;
|
|
27
30
|
|
package/dist/core-plugins.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as docxtemplaterPlugin,a as isZodSchema}from'./chunk-
|
|
1
|
+
export{b as docxtemplaterPlugin,a as isZodSchema}from'./chunk-UXXV4GT6.js';import'./chunk-ESI4BSBF.js';import'./chunk-2ASOEN3V.js';import'./chunk-JKN7TNPA.js';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-R5SKERM2.js';import'./chunk-OWMXCVKB.js';
|