@eigenpal/docx-editor-core 1.5.0 → 1.6.0
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/dist/agent/index.d.mts +4 -4
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/chunk-2KPOGFFR.js +1 -0
- package/dist/{chunk-NPFFCPZ6.js → chunk-2KUOYHXX.js} +1 -1
- package/dist/{chunk-WXSGCEBZ.js → chunk-2ZTKTE7P.js} +1 -1
- package/dist/{chunk-C45EFOVP.js → chunk-34DJT72K.js} +1 -1
- package/dist/chunk-3HLRRK6N.mjs +2 -0
- package/dist/{chunk-COV4LHQ7.js → chunk-4272FQ2E.js} +1 -1
- package/dist/chunk-4DCTKHS5.js +1 -0
- package/dist/chunk-4QJEMD23.mjs +4 -0
- package/dist/chunk-4QSFBX26.mjs +1 -0
- package/dist/chunk-4SZAFWLV.mjs +1 -0
- package/dist/{chunk-WYFK4QOF.mjs → chunk-5JULVEYK.mjs} +1 -1
- package/dist/chunk-6AGU57TL.mjs +1 -0
- package/dist/{chunk-T4O4PFJD.mjs → chunk-6ENZQGYR.mjs} +1 -1
- package/dist/chunk-6KYOT4E7.js +4 -0
- package/dist/chunk-77X765ZO.js +1 -0
- package/dist/chunk-7UMOUKSF.js +1 -0
- package/dist/chunk-AXVWVIIN.js +1 -0
- package/dist/chunk-B6FA4MJ5.mjs +1 -0
- package/dist/chunk-BBJMUBTD.mjs +1 -0
- package/dist/chunk-BJSG6TEG.js +1 -0
- package/dist/chunk-BKP5QMTS.js +1 -0
- package/dist/{chunk-3HENAL6V.mjs → chunk-C57BOE7B.mjs} +1 -1
- package/dist/{chunk-3SJQRYO7.js → chunk-CDGV7CLS.js} +1 -1
- package/dist/{chunk-TV6JLFY5.js → chunk-CWPIXUU2.js} +1 -1
- package/dist/chunk-DX5XU6JN.js +1 -0
- package/dist/chunk-E7UN3PVC.mjs +1 -0
- package/dist/chunk-EJ2JAYRI.js +1 -0
- package/dist/{chunk-TDYWEVAE.js → chunk-F44XU6G5.js} +1 -1
- package/dist/{chunk-TE2AF7FM.js → chunk-FETIBXTH.js} +1 -1
- package/dist/chunk-GLPOVLZD.mjs +1 -0
- package/dist/{chunk-M7KTKPGO.mjs → chunk-HEJJXAXN.mjs} +1 -1
- package/dist/{chunk-5WINQXA3.js → chunk-ILPNMG7Q.js} +1 -1
- package/dist/chunk-IM56AITE.mjs +1 -0
- package/dist/chunk-KK673XRZ.mjs +1 -0
- package/dist/chunk-KNY7SXPJ.mjs +1 -0
- package/dist/{chunk-M3UL6EUU.mjs → chunk-KSW6W2EK.mjs} +2 -2
- package/dist/chunk-LVUL7O27.js +1 -0
- package/dist/{chunk-O2643IUW.js → chunk-LW5OFHSW.js} +2 -2
- package/dist/chunk-M65C4SQJ.mjs +2 -0
- package/dist/chunk-MWOHCSZE.js +1 -0
- package/dist/chunk-NO6PIL32.mjs +1 -0
- package/dist/chunk-NTYJIOUE.js +2 -0
- package/dist/{chunk-WWVIVYX6.mjs → chunk-NY36MZ55.mjs} +1 -1
- package/dist/chunk-PJEB3ZWG.mjs +3 -0
- package/dist/chunk-Q2VALXEU.js +3 -0
- package/dist/{chunk-6KM4VW4L.js → chunk-RGHRXIIZ.js} +3 -3
- package/dist/chunk-RRJKF2XI.mjs +1 -0
- package/dist/{chunk-GB7RICH6.js → chunk-T3UP6LF5.js} +1 -1
- package/dist/chunk-UC7JW66O.mjs +1 -0
- package/dist/{chunk-P7HWOJC5.js → chunk-V3NE7Q22.js} +1 -1
- package/dist/chunk-WCB25ESG.mjs +1 -0
- package/dist/{chunk-SKBHY5MK.mjs → chunk-WEQA5PPW.mjs} +1 -1
- package/dist/{chunk-CBKJOPOW.mjs → chunk-WQJWT4RB.mjs} +1 -1
- package/dist/chunk-WWG6PUWU.js +1 -0
- package/dist/{chunk-PYDX4MOT.mjs → chunk-XTPT4TNP.mjs} +1 -1
- package/dist/{chunk-QUM4DFRE.mjs → chunk-YMXWLXVF.mjs} +1 -1
- package/dist/{content-eG_Rtl0l.d.ts → content-BebvPfXc.d.ts} +1 -1
- package/dist/{content-BlWiORm-.d.mts → content-CbBCrsr0.d.mts} +1 -1
- package/dist/{contentControlValues-CO7pUqOf.d.ts → contentControlValues-Com1GnZS.d.ts} +1 -1
- package/dist/{contentControlValues-DfYN9BZ8.d.mts → contentControlValues-DVJyudKU.d.mts} +1 -1
- package/dist/core-plugins.d.mts +2 -2
- package/dist/core-plugins.d.ts +2 -2
- package/dist/core-plugins.js +1 -1
- package/dist/core-plugins.mjs +1 -1
- package/dist/core.d.mts +7 -7
- package/dist/core.d.ts +7 -7
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/docx/index.d.mts +2 -2
- package/dist/docx/index.d.ts +2 -2
- package/dist/docx/index.js +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/parser.d.mts +2 -2
- package/dist/docx/parser.d.ts +2 -2
- package/dist/docx/parser.js +1 -1
- package/dist/docx/parser.mjs +1 -1
- package/dist/docx/rezip.d.mts +2 -2
- package/dist/docx/rezip.d.ts +2 -2
- package/dist/docx/serializer/index.d.mts +3 -3
- package/dist/docx/serializer/index.d.ts +3 -3
- package/dist/editor/index.d.mts +2 -2
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/index.mjs +1 -1
- package/dist/executor-FHL5D4CB.js +1 -0
- package/dist/executor-FL6XGVP3.mjs +1 -0
- package/dist/{fontLoader-3MFD_Hj2.d.mts → fontLoader-B4uFKpAy.d.mts} +1 -1
- package/dist/{fontLoader-C6VvBUVB.d.ts → fontLoader-D9SBYuZZ.d.ts} +1 -1
- package/dist/{headerFooterLayout-bdHWlU6g.d.ts → headerFooterLayout-CtVsfqxQ.d.ts} +1 -1
- package/dist/{headerFooterLayout-DJb-dV7X.d.mts → headerFooterLayout-D2LZLkDC.d.mts} +1 -1
- package/dist/headless.d.mts +5 -5
- package/dist/headless.d.ts +5 -5
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/layout-bridge/clickToPositionDom.js +1 -1
- package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +67 -5
- package/dist/layout-bridge/index.d.ts +67 -5
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +2 -2
- package/dist/layout-bridge/measuring/index.d.ts +2 -2
- package/dist/layout-bridge/measuring/index.js +1 -1
- package/dist/layout-bridge/measuring/index.mjs +1 -1
- package/dist/layout-bridge/tableInsertHover.js +1 -1
- package/dist/layout-bridge/tableInsertHover.mjs +1 -1
- package/dist/layout-bridge/toFlowBlocks.d.mts +2 -2
- package/dist/layout-bridge/toFlowBlocks.d.ts +2 -2
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.d.mts +2 -2
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-engine/types.d.mts +2 -2
- package/dist/layout-engine/types.d.ts +2 -2
- package/dist/layout-painter/index.d.mts +3 -3
- package/dist/layout-painter/index.d.ts +3 -3
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +3 -3
- package/dist/layout-painter/renderPage.d.ts +3 -3
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/managers/AutoSaveManager.d.mts +2 -2
- package/dist/managers/AutoSaveManager.d.ts +2 -2
- package/dist/managers/TableSelectionManager.d.mts +2 -2
- package/dist/managers/TableSelectionManager.d.ts +2 -2
- package/dist/managers/types.d.mts +2 -2
- package/dist/managers/types.d.ts +2 -2
- package/dist/mcp-cli.mjs +23 -23
- package/dist/mcp.d.mts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +7 -7
- package/dist/mcp.mjs +1 -1
- package/dist/{nodes-BJef4KFW.d.ts → nodes-Bd6tTkp0.d.ts} +1 -1
- package/dist/{nodes-RfTS-NSv.d.mts → nodes-BvO8GGD4.d.mts} +1 -1
- package/dist/prosemirror/applyFormatting.d.mts +34 -4
- package/dist/prosemirror/applyFormatting.d.ts +34 -4
- package/dist/prosemirror/applyFormatting.js +1 -1
- package/dist/prosemirror/applyFormatting.mjs +1 -1
- package/dist/prosemirror/commands/formatting.js +1 -1
- package/dist/prosemirror/commands/formatting.mjs +1 -1
- package/dist/prosemirror/commands/index.d.mts +2 -1
- package/dist/prosemirror/commands/index.d.ts +2 -1
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/index.mjs +1 -1
- package/dist/prosemirror/commands/paragraph.js +1 -1
- package/dist/prosemirror/commands/paragraph.mjs +1 -1
- package/dist/prosemirror/commands/sectionBreak.d.mts +25 -0
- package/dist/prosemirror/commands/sectionBreak.d.ts +25 -0
- package/dist/prosemirror/commands/sectionBreak.js +1 -0
- package/dist/prosemirror/commands/sectionBreak.mjs +1 -0
- package/dist/prosemirror/commentIdAllocator.d.mts +2 -2
- package/dist/prosemirror/commentIdAllocator.d.ts +2 -2
- package/dist/prosemirror/commentOps.d.mts +2 -2
- package/dist/prosemirror/commentOps.d.ts +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
- package/dist/prosemirror/conversion/index.d.mts +2 -2
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/extensions/index.js +1 -1
- package/dist/prosemirror/extensions/index.mjs +1 -1
- package/dist/prosemirror/index.d.mts +4 -4
- package/dist/prosemirror/index.d.ts +4 -4
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/index.mjs +1 -1
- package/dist/prosemirror/plugins/index.d.mts +2 -2
- package/dist/prosemirror/plugins/index.d.ts +2 -2
- package/dist/prosemirror/plugins/index.js +1 -1
- package/dist/prosemirror/plugins/index.mjs +1 -1
- package/dist/prosemirror/queries.d.mts +2 -2
- package/dist/prosemirror/queries.d.ts +2 -2
- package/dist/prosemirror/schema/index.d.mts +3 -3
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/index.js +1 -1
- package/dist/prosemirror/schema/index.mjs +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +2 -2
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +2 -2
- package/dist/{sectionPropertiesSerializer-S8J1V9mb.d.ts → sectionPropertiesSerializer-CzgskSoA.d.ts} +1 -1
- package/dist/{sectionPropertiesSerializer-C8XCmzE4.d.mts → sectionPropertiesSerializer-D3yI82iZ.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/content.js +1 -1
- package/dist/types/content.mjs +1 -1
- package/dist/types/document.d.mts +3 -3
- package/dist/types/document.d.ts +3 -3
- package/dist/types/document.js +1 -1
- package/dist/types/document.mjs +1 -1
- package/dist/utils/cardStyles.js +1 -1
- package/dist/utils/cardStyles.mjs +1 -1
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/comments.d.ts +2 -2
- package/dist/utils/index.d.mts +37 -4
- package/dist/utils/index.d.ts +37 -4
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/utils/stylePreview.d.mts +83 -0
- package/dist/utils/stylePreview.d.ts +83 -0
- package/dist/utils/stylePreview.js +1 -0
- package/dist/utils/stylePreview.mjs +1 -0
- package/dist/utils/units.d.mts +7 -1
- package/dist/utils/units.d.ts +7 -1
- package/dist/utils/units.js +1 -1
- package/dist/utils/units.mjs +1 -1
- package/dist/{variableDetector-CN9_pUR_.d.mts → variableDetector-D2-xDa2O.d.mts} +1 -1
- package/dist/{variableDetector-o4Rb2Csy.d.ts → variableDetector-d-PpDlNV.d.ts} +1 -1
- package/dist/{watermark-DAcnAs_J.d.mts → watermark-D90356ZM.d.mts} +7 -1
- package/dist/{watermark-DAcnAs_J.d.ts → watermark-D90356ZM.d.ts} +7 -1
- package/package.json +17 -1
- package/dist/chunk-4Q2IP5FW.js +0 -1
- package/dist/chunk-4RQAAKQI.mjs +0 -1
- package/dist/chunk-5HA66FH4.mjs +0 -1
- package/dist/chunk-7OW3VCZE.mjs +0 -1
- package/dist/chunk-AA6D2C6R.js +0 -4
- package/dist/chunk-AMJNIGO2.mjs +0 -2
- package/dist/chunk-BHBOAP6Z.js +0 -3
- package/dist/chunk-BTSL4AYY.js +0 -1
- package/dist/chunk-CUY2THAO.mjs +0 -1
- package/dist/chunk-DKKTY56Q.js +0 -1
- package/dist/chunk-DZ3FN3JI.js +0 -2
- package/dist/chunk-ENIWJBS7.mjs +0 -2
- package/dist/chunk-EZNVVB63.mjs +0 -1
- package/dist/chunk-GKAXYZCE.mjs +0 -1
- package/dist/chunk-IGYHDSM7.mjs +0 -1
- package/dist/chunk-L6ZRNW7Y.mjs +0 -1
- package/dist/chunk-LJ2TB6CY.js +0 -1
- package/dist/chunk-MOKKS75W.mjs +0 -3
- package/dist/chunk-ND33YQGU.js +0 -1
- package/dist/chunk-QXSDGNJ4.js +0 -1
- package/dist/chunk-RT52EYG3.mjs +0 -4
- package/dist/chunk-SHYNWAW6.mjs +0 -1
- package/dist/chunk-SNTAAXXA.mjs +0 -1
- package/dist/chunk-TAQTZAVZ.js +0 -1
- package/dist/chunk-UKMKGIME.js +0 -1
- package/dist/chunk-UXPY65AC.js +0 -1
- package/dist/chunk-VOCHZNOF.mjs +0 -1
- package/dist/chunk-VW22RZ6C.mjs +0 -1
- package/dist/chunk-WQRWRWSK.js +0 -1
- package/dist/chunk-YHXVNJK5.mjs +0 -1
- package/dist/chunk-ZETEPB7I.js +0 -1
- package/dist/executor-DZAMMQ35.js +0 -1
- package/dist/executor-ZCJRLT3Z.mjs +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';var chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkESI4BSBF_js=require('./chunk-ESI4BSBF.js'),
|
|
1
|
+
'use strict';var chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkESI4BSBF_js=require('./chunk-ESI4BSBF.js'),chunkV3NE7Q22_js=require('./chunk-V3NE7Q22.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
2
|
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
3
|
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId: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=chunkU4UCHBZ7_js.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
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-
|
|
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-FHL5D4CB.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
6
|
Replaces all {variable} placeholders with the corresponding values provided.
|
|
7
7
|
Preserves all formatting (fonts, styles, colors, tables).
|
|
8
|
-
Use docx_get_variables first to discover what variables exist in the document.`,inputSchema:{type:"object",properties:{documentId: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=chunkESI4BSBF_js.b(e.buffer,n,{nullGetter:t?"keep":"empty"}),a=await
|
|
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=chunkESI4BSBF_js.b(e.buffer,n,{nullGetter:t?"keep":"empty"}),a=await chunkV3NE7Q22_js.a(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
9
|
Checks for syntax errors like unclosed braces, invalid tag names, etc.
|
|
10
10
|
Returns validation result with any errors found and list of valid tags.`,inputSchema:{type:"object",properties:{documentId: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=chunkESI4BSBF_js.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};exports.a=M;exports.b=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=".layout-page-content";function M(e){return Array.from(e.querySelectorAll(`${y} span[data-pm-start][data-pm-end]`))}function S(e){return Array.from(e.querySelectorAll(`${y} .layout-empty-run`))}function P(e){return Array.from(e.querySelectorAll(`${y} [data-pm-start]`))}function _(e,t){return Number.isFinite(t)?e.querySelector(`${y} [data-pm-start="${t}"]`):null}function F(e,t,a,o=1){let i=document.elementsFromPoint(t,a),c=i.find(r=>r.classList.contains("layout-page"));if(!c)return null;let p=i.find(r=>r.tagName==="SPAN"&&r.dataset.pmStart!==void 0&&r.dataset.pmEnd!==void 0);if(p)return L(p,t);let n=i.find(r=>r.classList.contains("layout-empty-run"));if(n){let r=n.closest(".layout-paragraph");if(r&&r.dataset.pmStart)return Number(r.dataset.pmStart)}let m=i.find(r=>r.classList.contains("layout-paragraph")&&r.dataset.pmStart!==void 0);if(m&&m.dataset.pmStart){let r=H(m,t,a);return r!==null?r:Number(m.dataset.pmStart)}let s=i.find(r=>r.classList.contains("layout-table-cell"));return s?H(s,t,a):B(e,c,t,a)}function L(e,t,a){let o=Number(e.dataset.pmStart),i=Number(e.dataset.pmEnd);if(e.classList.contains("layout-run-tab")){let l=e.getBoundingClientRect(),d=(l.left+l.right)/2;return t<d?o:i}let c=e.firstChild;if(!c||c.nodeType!==Node.TEXT_NODE)return o;let p=c,n=p.length;if(n===0)return o;let m=e.ownerDocument;if(!m)return o;let s=0,r=n;for(;s<r;){let l=Math.floor((s+r)/2),d=m.createRange();d.setStart(p,l),d.setEnd(p,l);let f=d.getBoundingClientRect().left;t<f?r=l:s=l+1;}if(s>0&&s<=n){let l=m.createRange();l.setStart(p,s-1),l.setEnd(p,s-1);let d=l.getBoundingClientRect();l.setStart(p,Math.min(s,n)),l.setEnd(p,Math.min(s,n));let u=l.getBoundingClientRect(),f=Math.abs(t-d.left),g=Math.abs(t-u.left);if(f<g)return o+(s-1)}return o+Math.min(s,i-o)}function H(e,t,a){let o=e.querySelector(".layout-empty-run");if(o){let l=o.closest(".layout-paragraph");if(l&&l.dataset.pmStart)return Number(l.dataset.pmStart)}let i=e.querySelectorAll(".layout-line"),c=null,p=1/0;for(let l of Array.from(i)){let d=l,u=d.getBoundingClientRect(),f=(u.top+u.bottom)/2,g=Math.abs(a-f);g<p&&(p=g,c=d);}if(!c){let l=e.querySelector(".layout-paragraph[data-pm-start]");return l?.dataset.pmStart?Number(l.dataset.pmStart):e.dataset.pmStart?Number(e.dataset.pmStart):null}let n=c.querySelectorAll("span[data-pm-start][data-pm-end]");if(n.length===0){let l=c.closest(".layout-paragraph");return l?.dataset.pmStart?Number(l.dataset.pmStart):null}let m=null,s=1/0;for(let l of Array.from(n)){let d=l,u=d.getBoundingClientRect();if(t>=u.left&&t<=u.right)return L(d,t);let f=t<u.left?u.left-t:t-u.right;f<s&&(s=f,m=d);}if(!m)return null;let r=m.getBoundingClientRect();return t<r.left?Number(m.dataset.pmStart):Number(m.dataset.pmEnd)}function B(e,t,a,o,i){if(t.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let u=t.querySelectorAll(".layout-paragraph");if(u.length>0){let f=u[0];return Number(f.dataset.pmStart)||0}return null}let p=t.querySelectorAll(".layout-line"),n=null,m=1/0;for(let u of Array.from(p)){let f=u,g=f.getBoundingClientRect(),b=(g.top+g.bottom)/2,h=Math.abs(o-b);h<m&&(m=h,n=f);}if(!n)return null;let s=n.querySelectorAll("span[data-pm-start][data-pm-end]");if(s.length===0){let u=n.closest(".layout-paragraph");return u?.dataset.pmStart?Number(u.dataset.pmStart):null}let r=null,l=1/0;for(let u of Array.from(s)){let f=u,g=f.getBoundingClientRect();if(a>=g.left&&a<=g.right)return L(f,a);let b=a<g.left?g.left-a:a-g.right;b<l&&(l=b,r=f);}if(!r)return null;let d=r.getBoundingClientRect();return a<d.left?Number(r.dataset.pmStart):Number(r.dataset.pmEnd)}var A=.5;function D(e,t){let a=e.closest(".layout-table:not(.layout-nested-table)");if(!a)return {left:t.left,top:t.top,right:t.right,bottom:t.bottom};let o=a.getBoundingClientRect(),i=Math.max(t.top,o.top),c=Math.min(t.bottom,o.bottom);return c-i<=A?null:{left:t.left,top:i,right:t.right,bottom:c}}var I=4;function N(e,t){let o=(e.closest(".layout-line")??e).getBoundingClientRect(),i=e.getBoundingClientRect().left,c=D(e,{left:i,top:o.top,right:i+I,bottom:o.bottom});if(!c)return null;let p=e.closest(".layout-page");return {x:c.left-t.left,y:c.top-t.top,width:c.right-c.left,height:c.bottom-c.top,pageIndex:p?Number(p.dataset.pageNumber||1)-1:0}}function O(e){let t=e.closest(".layout-paragraph");if(!t)return null;let a=Number(t.dataset.pmStart),o=Number(t.dataset.pmEnd);return !Number.isFinite(a)||!Number.isFinite(o)?null:{pmStart:a,pmEnd:o}}function $(e,t,a,o){let i=[],c=M(e);for(let p of Array.from(c)){let n=p,m=Number(n.dataset.pmStart),s=Number(n.dataset.pmEnd);if(s<=t||m>=a)continue;let r=n.closest(".layout-page"),l=r?Number(r.dataset.pageNumber||1)-1:0,d=T=>{let E=D(n,T);E&&i.push({x:E.left-o.left,y:E.top-o.top,width:E.right-E.left,height:E.bottom-E.top,pageIndex:l});};if(m===s){let T=N(n,o);T&&i.push(T);continue}if(n.classList.contains("layout-run-tab")){d(n.getBoundingClientRect());continue}let u=null;if(n.firstChild?.nodeType===Node.TEXT_NODE?u=n.firstChild:n.firstChild?.nodeType===Node.ELEMENT_NODE&&n.firstChild.tagName==="A"&&n.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(u=n.firstChild.firstChild),!u)continue;let f=n.ownerDocument;if(!f)continue;let g=Math.max(0,t-m),b=Math.min(u.length,a-m);if(g>=b)continue;let h=f.createRange();h.setStart(u,g),h.setEnd(u,b);for(let T of Array.from(h.getClientRects()))d(T);}for(let p of S(e)){let n=O(p);if(!n||n.pmEnd<=t||n.pmStart>=a)continue;let m=N(p,o);m&&i.push(m);}return i}function C(e,t){let a=e.closest(".layout-table:not(.layout-nested-table)");if(!a)return false;let o=a.getBoundingClientRect(),i=(t.top+t.bottom)/2;return i<o.top-.5||i>o.bottom+.5}function R(e,t,a,o){let i=e.closest(".layout-page"),c=i?Number(i.dataset.pageNumber||1)-1:0,p=e.closest(".layout-line"),n=p?p.offsetHeight:16,m=e.firstChild;if(e.classList.contains("layout-run-tab")||!m||m.nodeType!==Node.TEXT_NODE){let g=e.getBoundingClientRect();return {x:g.left-o.left,y:g.top-o.top,height:n,pageIndex:c}}let r=m,l=Math.min(t-a,r.length),u=e.ownerDocument.createRange();u.setStart(r,l),u.setEnd(r,l);let f=u.getBoundingClientRect();return {x:f.left-o.left,y:f.top-o.top,height:f.height||n,pageIndex:c}}function W(e,t,a){let o=M(e),i=null,c=0;for(let m of Array.from(o)){let s=m,r=Number(s.dataset.pmStart),l=Number(s.dataset.pmEnd);if(!(s.classList.contains("layout-run-tab")?t>=r&&t<l:t>=r&&t<=l))continue;let f=s.getBoundingClientRect();if(C(s,f)){i||(i=s,c=r);continue}return R(s,t,r,a)}if(i)return R(i,t,c,a);let p=e.querySelectorAll(".layout-paragraph"),n=null;for(let m of Array.from(p)){let s=m,r=Number(s.dataset.pmStart),l=Number(s.dataset.pmEnd);if(t>=r&&t<=l){let u=s.querySelector(".layout-empty-run")||s,f=u.getBoundingClientRect();if(C(s,f)){n||(n={el:s,targetEl:u});continue}return x(s,u,a)}}return n?x(n.el,n.targetEl,a):null}function x(e,t,a){let o=t.getBoundingClientRect(),i=e.closest(".layout-page"),c=i?Number(i.dataset.pageNumber||1)-1:0,n=(t.closest(".layout-line")||t).offsetHeight||16;return {x:o.left-a.left,y:o.top-a.top,height:n,pageIndex:c}}export{M as a,S as b,P as c,_ as d,F as e,D as f,$ as g,W as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk77X765ZO_js=require('./chunk-77X765ZO.js'),chunkBJSG6TEG_js=require('./chunk-BJSG6TEG.js'),chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');var i={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},y=[`.${i.pageFloatingImage}`,`.${i.cellFloatingImage}`,`.${i.blockImage}`,`.${i.runImage}`].join(", ");function L(n){if(!(n instanceof Element))return null;let e=n.closest(y);if(!e)return null;let o=e.dataset.pmStart;if(o===void 0)return null;let t=Number(o);return Number.isNaN(t)?null:{pos:t,imageEl:e}}function b(n){if(!(n instanceof HTMLElement))return null;if(n.tagName==="IMG"&&n.classList.contains(i.runImage))return n;let e=n.closest(y);return e&&e.dataset.pmStart?e:null}function x(n,e=1){if(!n.classList.contains(i.runImage))return;let o=n.closest(`.${i.pageContent}`),t=n.closest(`.${i.paragraph}`);if(!o||!t)return;let r=n.getBoundingClientRect(),a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),p=e>0?e:1;return {horizontalEmu:Math.round(chunkBJSG6TEG_js.g((r.left-a.left)/p)),verticalEmu:Math.round(chunkBJSG6TEG_js.g((r.top-l.top)/p))}}function T(n,e){return n==="inline"?"inline":n==="behind"?"behind":n==="inFront"?"inFront":n==="square"||n==="tight"||n==="through"?e==="right"?"squareRight":"squareLeft":null}var k=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function I(n,e){return true}function E(n){switch(n){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function X(n,e){let o=new Map;for(let t=0;t<n.length;t++){let r=n[t],a=e[t];r&&a&&o.set(String(r.id),{block:r,measure:a});}return o}var c=class{constructor(e={}){chunkDC7S76ZX_js.a(this,"container",null);chunkDC7S76ZX_js.a(this,"blockLookup",new Map);chunkDC7S76ZX_js.a(this,"pageStates",[]);chunkDC7S76ZX_js.a(this,"totalPages",0);chunkDC7S76ZX_js.a(this,"options");chunkDC7S76ZX_js.a(this,"doc");chunkDC7S76ZX_js.a(this,"resolvedCommentIds",new Set);this.options=e,this.doc=e.document??document;}setBlockLookup(e){this.blockLookup=e;}mount(e){this.container=e,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let e=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${e}px`,this.container.style.padding=`${e}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(e){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:o}=e;this.totalPages=o.length,this.container.innerHTML="",this.pageStates=[];for(let t=0;t<o.length;t++){let r=o[t],a={pageNumber:r.number,totalPages:this.totalPages,section:"body",resolvedCommentIds:this.resolvedCommentIds},l=this.renderPageWithLookup(r,a);this.container.appendChild(l),this.pageStates.push({element:l,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(e,o){let t=this.doc.createElement("div");t.className="layout-page",t.dataset.pageNumber=String(e.number),t.style.position="relative",t.style.width=`${e.size.w}px`,t.style.height=`${e.size.h}px`,t.style.backgroundColor=this.options.pageBackground??"var(--doc-page-bg, #ffffff)",t.style.color="var(--doc-page-text, #000000)",t.style.overflow="hidden",this.options.showShadow&&(t.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${e.margins.top}px`,r.style.left=`${e.margins.left}px`,r.style.right=`${e.margins.right}px`,r.style.bottom=`${e.margins.bottom}px`,r.style.overflow="visible";for(let a of e.fragments){let l=this.renderFragmentWithLookup(a,o);this.applyFragmentPosition(l,a),r.appendChild(l);}return t.appendChild(r),t}renderFragmentWithLookup(e,o){let t=this.blockLookup.get(String(e.blockId));if(e.kind==="paragraph"&&t){let r=t.block,a=t.measure;return chunk77X765ZO_js.t(e,r,a,o,{document:this.doc})}if(e.kind==="table"&&t){let r=t.block,a=t.measure;return chunk77X765ZO_js.w(e,r,a,o,{document:this.doc})}if(e.kind==="image"&&t){let r=t.block,a=t.measure;return chunk77X765ZO_js.q(e,r,a,o,{document:this.doc})}if(e.kind==="textBox"&&t){let r=t.block,a=t.measure;return chunk77X765ZO_js.y(e,r,a,o,{document:this.doc})}return chunk77X765ZO_js.o(e,o,{document:this.doc})}applyFragmentPosition(e,o){e.style.position="absolute",e.style.left=`${o.x}px`,e.style.top=`${o.y}px`,e.style.width=`${o.width}px`,"height"in o&&(e.style.height=`${o.height}px`);}getPageCount(){return this.totalPages}getPageElement(e){return this.pageStates[e]?.element??null}scrollToPage(e){let o=this.pageStates.find(t=>t.pageNumber===e);o?.element&&o.element.scrollIntoView({behavior:"smooth",block:"start"});}};function Z(n){return new c(n)}exports.a=i;exports.b=L;exports.c=b;exports.d=x;exports.e=T;exports.f=k;exports.g=I;exports.h=E;exports.i=X;exports.j=c;exports.k=Z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=["CONFIDENTIAL","DRAFT","DO NOT COPY","SAMPLE","URGENT","ASAP"];function r(t,n){if(!(t>0)||!(n>0))return;let e=t/n;return e>=1?{widthEmu:3954780,heightEmu:Math.round(3954780/e)}:{widthEmu:Math.round(3954780*e),heightEmu:3954780}}export{o as a,r as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkAA6D2C6R_js=require('./chunk-AA6D2C6R.js'),chunkFIGLFSNR_js=require('./chunk-FIGLFSNR.js'),chunkQVRMX2AC_js=require('./chunk-QVRMX2AC.js'),chunkZ3LGMBJC_js=require('./chunk-Z3LGMBJC.js'),chunkGSKMHXHG_js=require('./chunk-GSKMHXHG.js'),chunkH57LNDBH_js=require('./chunk-H57LNDBH.js'),chunk3R7QHNI5_js=require('./chunk-3R7QHNI5.js'),He=require('jszip');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var He__default=/*#__PURE__*/_interopDefault(He);async function G(t){let n=await He__default.default.loadAsync(t),e={documentXml:null,stylesXml:null,themeXml:null,numberingXml:null,fontTableXml:null,settingsXml:null,webSettingsXml:null,headers:new Map,footers:new Map,footnotesXml:null,endnotesXml:null,commentsXml:null,commentsExtensibleXml:null,commentsExtendedXml:null,documentRels:null,packageRels:null,contentTypesXml:null,corePropsXml:null,appPropsXml:null,customPropsXml:null,media:new Map,fonts:new Map,allXml:new Map,originalZip:n,originalBuffer:t};for(let[o,i]of Object.entries(n.files)){if(i.dir)continue;let r=o.toLowerCase();if(r.endsWith(".xml")||r.endsWith(".rels")){let a=await i.async("text");if(e.allXml.set(o,a),r==="word/document.xml")e.documentXml=a;else if(r==="word/styles.xml")e.stylesXml=a;else if(r==="word/theme/theme1.xml")e.themeXml=a;else if(r==="word/numbering.xml")e.numberingXml=a;else if(r==="word/fonttable.xml")e.fontTableXml=a;else if(r==="word/settings.xml")e.settingsXml=a;else if(r==="word/websettings.xml")e.webSettingsXml=a;else if(r==="word/footnotes.xml")e.footnotesXml=a;else if(r==="word/endnotes.xml")e.endnotesXml=a;else if(r==="word/comments.xml")e.commentsXml=a;else if(r==="word/commentsextensible.xml")e.commentsExtensibleXml=a;else if(r==="word/commentsextended.xml")e.commentsExtendedXml=a;else if(r==="word/_rels/document.xml.rels")e.documentRels=a;else if(r==="_rels/.rels")e.packageRels=a;else if(r==="[content_types].xml")e.contentTypesXml=a;else if(r==="docprops/core.xml")e.corePropsXml=a;else if(r==="docprops/app.xml")e.appPropsXml=a;else if(r==="docprops/custom.xml")e.customPropsXml=a;else if(r.match(/^word\/header\d+\.xml$/)){let c=o.split("/").pop()||o;e.headers.set(c,a);}else if(r.match(/^word\/footer\d+\.xml$/)){let c=o.split("/").pop()||o;e.footers.set(c,a);}}else if(r.startsWith("word/media/")){let a=await i.async("arraybuffer");e.media.set(o,a);}else if(r.startsWith("word/fonts/")){let a=await i.async("arraybuffer");e.fonts.set(o,a);}}return e}function Me(t){switch(t.toLowerCase().split(".").pop()){case "png":return "image/png";case "jpg":case "jpeg":return "image/jpeg";case "gif":return "image/gif";case "bmp":return "image/bmp";case "tif":case "tiff":return "image/tiff";case "wmf":return "image/x-wmf";case "emf":return "image/x-emf";case "svg":return "image/svg+xml";case "webp":return "image/webp";default:return "application/octet-stream"}}function Y(t,n,e,o){let i={};return t&&t!=="auto"?i.rgb=t:t==="auto"&&(i.auto=true),n&&(i.themeColor=n),e&&(i.themeTint=e),o&&(i.themeShade=o),i}function W(t){if(!t)return;let n={},e=chunk3R7QHNI5_js.j(t,"w","color");e&&e!=="auto"&&(n.color={rgb:e});let o=chunk3R7QHNI5_js.j(t,"w","fill");o&&o!=="auto"&&(n.fill={rgb:o});let i=chunk3R7QHNI5_js.j(t,"w","themeFill");i&&(n.fill=n.fill||{},n.fill.themeColor=i);let r=chunk3R7QHNI5_js.j(t,"w","themeFillTint");r&&n.fill&&(n.fill.themeTint=r);let a=chunk3R7QHNI5_js.j(t,"w","themeFillShade");a&&n.fill&&(n.fill.themeShade=a);let c=chunk3R7QHNI5_js.j(t,"w","val");return c&&(n.pattern=c),Object.keys(n).length>0?n:void 0}function $(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","b");o&&(e.bold=chunk3R7QHNI5_js.m(o));let i=chunk3R7QHNI5_js.e(t,"w","bCs");i&&(e.boldCs=chunk3R7QHNI5_js.m(i));let r=chunk3R7QHNI5_js.e(t,"w","i");r&&(e.italic=chunk3R7QHNI5_js.m(r));let a=chunk3R7QHNI5_js.e(t,"w","iCs");a&&(e.italicCs=chunk3R7QHNI5_js.m(a));let c=chunk3R7QHNI5_js.e(t,"w","u");if(c){let m=chunk3R7QHNI5_js.j(c,"w","val");if(m){e.underline={style:m};let P=chunk3R7QHNI5_js.j(c,"w","color"),I=chunk3R7QHNI5_js.j(c,"w","themeColor");(P||I)&&(e.underline.color=Y(P,I,chunk3R7QHNI5_js.j(c,"w","themeTint"),chunk3R7QHNI5_js.j(c,"w","themeShade")));}}let g=chunk3R7QHNI5_js.e(t,"w","strike");g&&(e.strike=chunk3R7QHNI5_js.m(g));let d=chunk3R7QHNI5_js.e(t,"w","dstrike");d&&(e.doubleStrike=chunk3R7QHNI5_js.m(d));let h=chunk3R7QHNI5_js.e(t,"w","vertAlign");if(h){let m=chunk3R7QHNI5_js.j(h,"w","val");(m==="superscript"||m==="subscript"||m==="baseline")&&(e.vertAlign=m);}let b=chunk3R7QHNI5_js.e(t,"w","smallCaps");b&&(e.smallCaps=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","caps");u&&(e.allCaps=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","vanish");S&&(e.hidden=chunk3R7QHNI5_js.m(S));let f=chunk3R7QHNI5_js.e(t,"w","color");f&&(e.color=Y(chunk3R7QHNI5_js.j(f,"w","val"),chunk3R7QHNI5_js.j(f,"w","themeColor"),chunk3R7QHNI5_js.j(f,"w","themeTint"),chunk3R7QHNI5_js.j(f,"w","themeShade")));let y=chunk3R7QHNI5_js.e(t,"w","highlight");if(y){let m=chunk3R7QHNI5_js.j(y,"w","val");m&&(e.highlight=m);}let C=chunk3R7QHNI5_js.e(t,"w","shd");C&&(e.shading=W(C));let D=chunk3R7QHNI5_js.e(t,"w","sz");if(D){let m=chunk3R7QHNI5_js.l(D,"w","val");m!==void 0&&(e.fontSize=m);}let B=chunk3R7QHNI5_js.e(t,"w","szCs");if(B){let m=chunk3R7QHNI5_js.l(B,"w","val");m!==void 0&&(e.fontSizeCs=m);}let v=chunk3R7QHNI5_js.e(t,"w","rFonts");if(v){e.fontFamily={ascii:chunk3R7QHNI5_js.j(v,"w","ascii")??void 0,hAnsi:chunk3R7QHNI5_js.j(v,"w","hAnsi")??void 0,eastAsia:chunk3R7QHNI5_js.j(v,"w","eastAsia")??void 0,cs:chunk3R7QHNI5_js.j(v,"w","cs")??void 0};let m=chunk3R7QHNI5_js.j(v,"w","asciiTheme");m&&(e.fontFamily.asciiTheme=m,n&&!e.fontFamily.ascii&&(e.fontFamily.ascii=chunkAA6D2C6R_js.b(n,m)));let P=chunk3R7QHNI5_js.j(v,"w","hAnsiTheme");P&&(e.fontFamily.hAnsiTheme=P,n&&!e.fontFamily.hAnsi&&(e.fontFamily.hAnsi=chunkAA6D2C6R_js.b(n,P)));let I=chunk3R7QHNI5_js.j(v,"w","eastAsiaTheme");I&&(e.fontFamily.eastAsiaTheme=I,n&&!e.fontFamily.eastAsia&&(e.fontFamily.eastAsia=chunkAA6D2C6R_js.b(n,I)));let U=chunk3R7QHNI5_js.j(v,"w","cstheme");U&&(e.fontFamily.csTheme=U,n&&!e.fontFamily.cs&&(e.fontFamily.cs=chunkAA6D2C6R_js.b(n,U)));}let X=chunk3R7QHNI5_js.e(t,"w","spacing");if(X){let m=chunk3R7QHNI5_js.l(X,"w","val");m!==void 0&&(e.spacing=m);}let p=chunk3R7QHNI5_js.e(t,"w","position");if(p){let m=chunk3R7QHNI5_js.l(p,"w","val");m!==void 0&&(e.position=m);}let x=chunk3R7QHNI5_js.e(t,"w","w");if(x){let m=chunk3R7QHNI5_js.l(x,"w","val");m!==void 0&&(e.scale=m);}let F=chunk3R7QHNI5_js.e(t,"w","kern");if(F){let m=chunk3R7QHNI5_js.l(F,"w","val");m!==void 0&&(e.kerning=m);}let A=chunk3R7QHNI5_js.e(t,"w","effect");if(A){let m=chunk3R7QHNI5_js.j(A,"w","val");m&&(e.effect=m);}let k=chunk3R7QHNI5_js.e(t,"w","em");if(k){let m=chunk3R7QHNI5_js.j(k,"w","val");m&&(e.emphasisMark=m);}let M=chunk3R7QHNI5_js.e(t,"w","emboss");M&&(e.emboss=chunk3R7QHNI5_js.m(M));let R=chunk3R7QHNI5_js.e(t,"w","imprint");R&&(e.imprint=chunk3R7QHNI5_js.m(R));let V=chunk3R7QHNI5_js.e(t,"w","outline");V&&(e.outline=chunk3R7QHNI5_js.m(V));let L=chunk3R7QHNI5_js.e(t,"w","shadow");L&&(e.shadow=chunk3R7QHNI5_js.m(L));let N=chunk3R7QHNI5_js.e(t,"w","rtl");N&&(e.rtl=chunk3R7QHNI5_js.m(N));let H=chunk3R7QHNI5_js.e(t,"w","cs");H&&(e.cs=chunk3R7QHNI5_js.m(H));let _=chunk3R7QHNI5_js.e(t,"w","rStyle");if(_){let m=chunk3R7QHNI5_js.j(_,"w","val");m&&(e.styleId=m);}return Object.keys(e).length>0?e:void 0}function E(t){if(!t)return;let n=chunk3R7QHNI5_js.j(t,"w","val");if(!n)return;let e={style:n},o=chunk3R7QHNI5_js.j(t,"w","color"),i=chunk3R7QHNI5_js.j(t,"w","themeColor");(o||i)&&(e.color=Y(o,i,chunk3R7QHNI5_js.j(t,"w","themeTint"),chunk3R7QHNI5_js.j(t,"w","themeShade")));let r=chunk3R7QHNI5_js.l(t,"w","sz");r!==void 0&&(e.size=r);let a=chunk3R7QHNI5_js.l(t,"w","space");a!==void 0&&(e.space=a);let c=chunk3R7QHNI5_js.j(t,"w","shadow");c&&(e.shadow=c==="1"||c==="true");let g=chunk3R7QHNI5_js.j(t,"w","frame");return g&&(e.frame=g==="1"||g==="true"),e}function je(t){if(!t)return;let n=chunk3R7QHNI5_js.f(t,"w","tab");if(n.length===0)return;let e=[];for(let o of n){let i=chunk3R7QHNI5_js.l(o,"w","pos"),r=chunk3R7QHNI5_js.j(o,"w","val");if(i!==void 0&&r){let a={position:i,alignment:r},c=chunk3R7QHNI5_js.j(o,"w","leader");c&&(a.leader=c),e.push(a);}}return e.length>0?e:void 0}function K(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","jc");if(o){let p=chunk3R7QHNI5_js.j(o,"w","val");p&&(e.alignment=p);}let i=chunk3R7QHNI5_js.e(t,"w","bidi");i&&(e.bidi=chunk3R7QHNI5_js.m(i));let r=chunk3R7QHNI5_js.e(t,"w","spacing");if(r){let p=chunk3R7QHNI5_js.l(r,"w","before");p!==void 0&&(e.spaceBefore=p);let x=chunk3R7QHNI5_js.l(r,"w","after");x!==void 0&&(e.spaceAfter=x);let F=chunk3R7QHNI5_js.l(r,"w","line");F!==void 0&&(e.lineSpacing=F);let A=chunk3R7QHNI5_js.j(r,"w","lineRule");A&&(e.lineSpacingRule=A);let k=chunk3R7QHNI5_js.j(r,"w","beforeAutospacing");k&&(e.beforeAutospacing=k==="1"||k==="true");let M=chunk3R7QHNI5_js.j(r,"w","afterAutospacing");M&&(e.afterAutospacing=M==="1"||M==="true");}let a=chunk3R7QHNI5_js.e(t,"w","ind");if(a){let p=chunk3R7QHNI5_js.l(a,"w","left");p!==void 0&&(e.indentLeft=p);let x=chunk3R7QHNI5_js.l(a,"w","right");x!==void 0&&(e.indentRight=x);let F=chunk3R7QHNI5_js.l(a,"w","firstLine");F!==void 0&&(e.indentFirstLine=F);let A=chunk3R7QHNI5_js.l(a,"w","hanging");A!==void 0&&(e.indentFirstLine=-A,e.hangingIndent=true);}let c=chunk3R7QHNI5_js.e(t,"w","pBdr");if(c){let p={},x=E(chunk3R7QHNI5_js.e(c,"w","top"));x&&(p.top=x);let F=E(chunk3R7QHNI5_js.e(c,"w","bottom"));F&&(p.bottom=F);let A=E(chunk3R7QHNI5_js.e(c,"w","left"));A&&(p.left=A);let k=E(chunk3R7QHNI5_js.e(c,"w","right"));k&&(p.right=k);let M=E(chunk3R7QHNI5_js.e(c,"w","between"));M&&(p.between=M);let R=E(chunk3R7QHNI5_js.e(c,"w","bar"));R&&(p.bar=R),Object.keys(p).length>0&&(e.borders=p);}let g=chunk3R7QHNI5_js.e(t,"w","shd");g&&(e.shading=W(g));let d=chunk3R7QHNI5_js.e(t,"w","tabs");d&&(e.tabs=je(d));let h=chunk3R7QHNI5_js.e(t,"w","keepNext");h&&(e.keepNext=chunk3R7QHNI5_js.m(h));let b=chunk3R7QHNI5_js.e(t,"w","keepLines");b&&(e.keepLines=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","widowControl");u&&(e.widowControl=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","pageBreakBefore");S&&(e.pageBreakBefore=chunk3R7QHNI5_js.m(S));let f=chunk3R7QHNI5_js.e(t,"w","contextualSpacing");f&&(e.contextualSpacing=chunk3R7QHNI5_js.m(f));let y=chunk3R7QHNI5_js.e(t,"w","numPr");if(y){let p=chunk3R7QHNI5_js.e(y,"w","numId"),x=chunk3R7QHNI5_js.e(y,"w","ilvl");if(p||x){if(e.numPr={},p){let F=chunk3R7QHNI5_js.l(p,"w","val");F!==void 0&&(e.numPr.numId=F);}if(x){let F=chunk3R7QHNI5_js.l(x,"w","val");F!==void 0&&(e.numPr.ilvl=F);}}}let C=chunk3R7QHNI5_js.e(t,"w","outlineLvl");if(C){let p=chunk3R7QHNI5_js.l(C,"w","val");p!==void 0&&(e.outlineLevel=p);}let D=chunk3R7QHNI5_js.e(t,"w","pStyle");if(D){let p=chunk3R7QHNI5_js.j(D,"w","val");p&&(e.styleId=p);}let B=chunk3R7QHNI5_js.e(t,"w","suppressLineNumbers");B&&(e.suppressLineNumbers=chunk3R7QHNI5_js.m(B));let v=chunk3R7QHNI5_js.e(t,"w","suppressAutoHyphens");v&&(e.suppressAutoHyphens=chunk3R7QHNI5_js.m(v));let X=chunk3R7QHNI5_js.e(t,"w","rPr");return X&&(e.runProperties=$(X,n)),Object.keys(e).length>0?e:void 0}function j(t){if(!t)return;let n=chunk3R7QHNI5_js.l(t,"w","w"),e=chunk3R7QHNI5_js.j(t,"w","type");if(n!==void 0&&e)return {value:n,type:e}}function De(t){if(!t)return;let n={},e=E(chunk3R7QHNI5_js.e(t,"w","top"));e&&(n.top=e);let o=E(chunk3R7QHNI5_js.e(t,"w","bottom"));o&&(n.bottom=o);let i=E(chunk3R7QHNI5_js.e(t,"w","left"));i&&(n.left=i);let r=E(chunk3R7QHNI5_js.e(t,"w","right"));r&&(n.right=r);let a=E(chunk3R7QHNI5_js.e(t,"w","insideH"));a&&(n.insideH=a);let c=E(chunk3R7QHNI5_js.e(t,"w","insideV"));return c&&(n.insideV=c),Object.keys(n).length>0?n:void 0}function Ae(t){if(!t)return;let n={},e=j(chunk3R7QHNI5_js.e(t,"w","top"));e&&(n.top=e);let o=j(chunk3R7QHNI5_js.e(t,"w","bottom"));o&&(n.bottom=o);let i=j(chunk3R7QHNI5_js.e(t,"w","left"));i&&(n.left=i);let r=j(chunk3R7QHNI5_js.e(t,"w","right"));return r&&(n.right=r),Object.keys(n).length>0?n:void 0}function Le(t){if(!t)return;let n={},e=chunk3R7QHNI5_js.j(t,"w","val");if(e){let d=parseInt(e,16);isNaN(d)||(n.firstRow=(d&32)!==0,n.lastRow=(d&64)!==0,n.firstColumn=(d&128)!==0,n.lastColumn=(d&256)!==0,n.noHBand=(d&512)!==0,n.noVBand=(d&1024)!==0);}let o=chunk3R7QHNI5_js.j(t,"w","firstColumn");o&&(n.firstColumn=o==="1");let i=chunk3R7QHNI5_js.j(t,"w","firstRow");i&&(n.firstRow=i==="1");let r=chunk3R7QHNI5_js.j(t,"w","lastColumn");r&&(n.lastColumn=r==="1");let a=chunk3R7QHNI5_js.j(t,"w","lastRow");a&&(n.lastRow=a==="1");let c=chunk3R7QHNI5_js.j(t,"w","noHBand");c&&(n.noHBand=c==="1");let g=chunk3R7QHNI5_js.j(t,"w","noVBand");return g&&(n.noVBand=g==="1"),Object.keys(n).length>0?n:void 0}function le(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","tblW");o&&(e.width=j(o));let i=chunk3R7QHNI5_js.e(t,"w","jc");if(i){let f=chunk3R7QHNI5_js.j(i,"w","val");(f==="left"||f==="center"||f==="right")&&(e.justification=f);}let r=chunk3R7QHNI5_js.e(t,"w","tblCellSpacing");r&&(e.cellSpacing=j(r));let a=chunk3R7QHNI5_js.e(t,"w","tblInd");a&&(e.indent=j(a));let c=chunk3R7QHNI5_js.e(t,"w","tblBorders");c&&(e.borders=De(c));let g=chunk3R7QHNI5_js.e(t,"w","tblCellMar");g&&(e.cellMargins=Ae(g));let d=chunk3R7QHNI5_js.e(t,"w","tblLayout");if(d){let f=chunk3R7QHNI5_js.j(d,"w","type");(f==="fixed"||f==="autofit")&&(e.layout=f);}let h=chunk3R7QHNI5_js.e(t,"w","tblStyle");if(h){let f=chunk3R7QHNI5_js.j(h,"w","val");f&&(e.styleId=f);}let b=chunk3R7QHNI5_js.e(t,"w","tblLook");b&&(e.look=Le(b));let u=chunk3R7QHNI5_js.e(t,"w","shd");u&&(e.shading=W(u));let S=chunk3R7QHNI5_js.e(t,"w","bidiVisual");return S&&(e.bidi=chunk3R7QHNI5_js.m(S)),Object.keys(e).length>0?e:void 0}function ce(t){if(!t)return;let n={},e=chunk3R7QHNI5_js.e(t,"w","trHeight");if(e){n.height=j(e);let c=chunk3R7QHNI5_js.j(e,"w","hRule");c&&(n.heightRule=c);}let o=chunk3R7QHNI5_js.e(t,"w","tblHeader");o&&(n.header=chunk3R7QHNI5_js.m(o));let i=chunk3R7QHNI5_js.e(t,"w","cantSplit");i&&(n.cantSplit=chunk3R7QHNI5_js.m(i));let r=chunk3R7QHNI5_js.e(t,"w","jc");if(r){let c=chunk3R7QHNI5_js.j(r,"w","val");(c==="left"||c==="center"||c==="right")&&(n.justification=c);}let a=chunk3R7QHNI5_js.e(t,"w","hidden");return a&&(n.hidden=chunk3R7QHNI5_js.m(a)),Object.keys(n).length>0?n:void 0}function fe(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","tcW");o&&(e.width=j(o));let i=chunk3R7QHNI5_js.e(t,"w","tcBorders");i&&(e.borders=De(i));let r=chunk3R7QHNI5_js.e(t,"w","tcMar");r&&(e.margins=Ae(r));let a=chunk3R7QHNI5_js.e(t,"w","shd");a&&(e.shading=W(a));let c=chunk3R7QHNI5_js.e(t,"w","vAlign");if(c){let f=chunk3R7QHNI5_js.j(c,"w","val");(f==="top"||f==="center"||f==="bottom")&&(e.verticalAlign=f);}let g=chunk3R7QHNI5_js.e(t,"w","textDirection");if(g){let f=chunk3R7QHNI5_js.j(g,"w","val");f&&(e.textDirection=f);}let d=chunk3R7QHNI5_js.e(t,"w","gridSpan");if(d){let f=chunk3R7QHNI5_js.l(d,"w","val");f!==void 0&&(e.gridSpan=f);}let h=chunk3R7QHNI5_js.e(t,"w","vMerge");if(h){let f=chunk3R7QHNI5_js.j(h,"w","val");e.vMerge=f==="restart"?"restart":"continue";}let b=chunk3R7QHNI5_js.e(t,"w","tcFitText");b&&(e.fitText=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","noWrap");u&&(e.noWrap=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","hideMark");return S&&(e.hideMark=chunk3R7QHNI5_js.m(S)),Object.keys(e).length>0?e:void 0}function Ue(t,n){let e={styleId:chunk3R7QHNI5_js.j(t,"w","styleId")??"",type:chunk3R7QHNI5_js.j(t,"w","type")??"paragraph"},o=chunk3R7QHNI5_js.j(t,"w","default");o&&(e.default=o==="1"||o==="true");let i=chunk3R7QHNI5_js.e(t,"w","name");i&&(e.name=chunk3R7QHNI5_js.j(i,"w","val")??void 0);let r=chunk3R7QHNI5_js.e(t,"w","basedOn");r&&(e.basedOn=chunk3R7QHNI5_js.j(r,"w","val")??void 0);let a=chunk3R7QHNI5_js.e(t,"w","next");a&&(e.next=chunk3R7QHNI5_js.j(a,"w","val")??void 0);let c=chunk3R7QHNI5_js.e(t,"w","link");c&&(e.link=chunk3R7QHNI5_js.j(c,"w","val")??void 0);let g=chunk3R7QHNI5_js.e(t,"w","uiPriority");if(g){let X=chunk3R7QHNI5_js.l(g,"w","val");X!==void 0&&(e.uiPriority=X);}let d=chunk3R7QHNI5_js.e(t,"w","hidden");d&&(e.hidden=chunk3R7QHNI5_js.m(d));let h=chunk3R7QHNI5_js.e(t,"w","semiHidden");h&&(e.semiHidden=chunk3R7QHNI5_js.m(h));let b=chunk3R7QHNI5_js.e(t,"w","unhideWhenUsed");b&&(e.unhideWhenUsed=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","qFormat");u&&(e.qFormat=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","personal");S&&(e.personal=chunk3R7QHNI5_js.m(S));let f=chunk3R7QHNI5_js.e(t,"w","pPr");f&&(e.pPr=K(f,n));let y=chunk3R7QHNI5_js.e(t,"w","rPr");y&&(e.rPr=$(y,n));let C=chunk3R7QHNI5_js.e(t,"w","tblPr");C&&(e.tblPr=le(C));let D=chunk3R7QHNI5_js.e(t,"w","trPr");D&&(e.trPr=ce(D));let B=chunk3R7QHNI5_js.e(t,"w","tcPr");B&&(e.tcPr=fe(B));let v=chunk3R7QHNI5_js.f(t,"w","tblStylePr");if(v.length>0){e.tblStylePr=[];for(let X of v){let p=chunk3R7QHNI5_js.j(X,"w","type");if(p){let x={type:p},F=chunk3R7QHNI5_js.e(X,"w","pPr");F&&(x.pPr=K(F,n));let A=chunk3R7QHNI5_js.e(X,"w","rPr");A&&(x.rPr=$(A,n));let k=chunk3R7QHNI5_js.e(X,"w","tblPr");k&&(x.tblPr=le(k));let M=chunk3R7QHNI5_js.e(X,"w","trPr");M&&(x.trPr=ce(M));let R=chunk3R7QHNI5_js.e(X,"w","tcPr");R&&(x.tcPr=fe(R)),e.tblStylePr.push(x);}}}return e}function Oe(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","rPrDefault");if(o){let r=chunk3R7QHNI5_js.e(o,"w","rPr");r&&(e.rPr=$(r,n));}let i=chunk3R7QHNI5_js.e(t,"w","pPrDefault");if(i){let r=chunk3R7QHNI5_js.e(i,"w","pPr");r&&(e.pPr=K(r,n));}return e.rPr||e.pPr?e:void 0}function ze(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let e={...t};for(let o of Object.keys(n)){let i=n[o];if(i!==void 0)if(o==="runProperties")e.runProperties=chunkGSKMHXHG_js.b(e.runProperties,n.runProperties);else if(o==="borders"||o==="numPr"||o==="frame"){let r=e[o],a=i;e[o]={...r||{},...a||{}};}else o==="tabs"&&Array.isArray(i)?e.tabs=[...i]:e[o]=i;}return e}function Be(t,n,e,o=new Set){if(o.has(t.styleId)||(o.add(t.styleId),!t.basedOn))return t;let i=n.get(t.basedOn);if(!i)return t;let r=Be(i,n,e,o),a={...t,pPr:ze(r.pPr,t.pPr),rPr:chunkGSKMHXHG_js.b(r.rPr,t.rPr)};return t.type==="table"&&((r.tblPr||t.tblPr)&&(a.tblPr={...r.tblPr||{},...t.tblPr||{}}),(r.trPr||t.trPr)&&(a.trPr={...r.trPr||{},...t.trPr||{}}),(r.tcPr||t.tcPr)&&(a.tcPr={...r.tcPr||{},...t.tcPr||{}})),a}function ue(t,n){let e=new Map;try{let o=chunk3R7QHNI5_js.c(t);if(!o)return e;let i=chunk3R7QHNI5_js.f(o,"w","style");for(let r of i){let a=Ue(r,n);a.styleId&&e.set(a.styleId,a);}for(let[r,a]of e){let c=Be(a,e,n);e.set(r,c);}}catch(o){console.warn("Failed to parse styles:",o);}return e}function ke(t,n){let e={styles:[]};try{let o=chunk3R7QHNI5_js.c(t);if(!o)return e;let i=chunk3R7QHNI5_js.e(o,"w","docDefaults");e.docDefaults=Oe(i,n);let r=chunk3R7QHNI5_js.e(o,"w","latentStyles");r&&(e.latentStyles={defLockedState:chunk3R7QHNI5_js.j(r,"w","defLockedState")==="1",defUIPriority:chunk3R7QHNI5_js.l(r,"w","defUIPriority"),defSemiHidden:chunk3R7QHNI5_js.j(r,"w","defSemiHidden")==="1",defUnhideWhenUsed:chunk3R7QHNI5_js.j(r,"w","defUnhideWhenUsed")==="1",defQFormat:chunk3R7QHNI5_js.j(r,"w","defQFormat")==="1",count:chunk3R7QHNI5_js.l(r,"w","count")});let a=ue(t,n);e.styles=Array.from(a.values());}catch(o){console.warn("Failed to parse style definitions:",o);}return e}var Ie=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g;function Re(t){let n=[],e;for(Ie.lastIndex=0;(e=Ie.exec(t))!==null;){let o=e[1].trim();o&&!n.includes(o)&&n.push(o);}return n}function ee(t){let n=[];for(let e of t)if(e.type==="paragraph"){let o=chunkAA6D2C6R_js.N(e),i=Re(o);for(let r of i)n.includes(r)||n.push(r);}else if(e.type==="table"){let o=Ee(e);for(let i of o)n.includes(i)||n.push(i);}return n}function Ee(t){let n=[];for(let e of t.rows)for(let o of e.cells)for(let i of o.content)if(i.type==="paragraph"){let r=chunkAA6D2C6R_js.N(i),a=Re(r);for(let c of a)n.includes(c)||n.push(c);}else if(i.type==="table"){let r=Ee(i);for(let a of r)n.includes(a)||n.push(a);}return n}function We(t,n){let e=[],o=[];for(let i of t)o.push(i),i.type==="paragraph"&&i.sectionProperties&&(e.push({properties:i.sectionProperties,content:o}),o=[]);return (o.length>0||e.length===0)&&e.push({properties:n??chunkAA6D2C6R_js.C(),content:o}),e}function te(t,n=null,e=null,o=null,i=null,r=null){let a={content:[]};if(!t)return a;let c=chunk3R7QHNI5_js.a(t);if(!c)return a;let g=(c.elements??[]).find(u=>u.type==="element"&&(u.name==="w:document"||u.name?.endsWith(":document")));if(!g)return a;let d=chunk3R7QHNI5_js.e(g,"w","body");if(!d)return a;a.content=chunkAA6D2C6R_js.q(d,n,e,o,i,r);let h=chunk3R7QHNI5_js.e(d,"w","sectPr");h&&(a.finalSectionProperties=chunkAA6D2C6R_js.B(h,i));let b=We(a.content,a.finalSectionProperties);return a.sections=chunkAA6D2C6R_js.D(b),a.finalSectionProperties&&a.sections.length>0&&(a.finalSectionProperties=a.sections[a.sections.length-1].properties),a}function $e(t){let n=new Map,e=chunk3R7QHNI5_js.a(t);if(!e)return n;let o=chunk3R7QHNI5_js.e(e,"w16cex","commentsExtensible")??e;for(let i of chunk3R7QHNI5_js.i(o)){if((i.name?.replace(/^.*:/,"")??"")!=="comment")continue;let a=chunk3R7QHNI5_js.j(i,"w16cex","paraId")??chunk3R7QHNI5_js.j(i,"w15","paraId")??i.attributes?.["w16cex:paraId"]??i.attributes?.["w15:paraId"],c=chunk3R7QHNI5_js.j(i,"w16cex","dateUtc")??chunk3R7QHNI5_js.j(i,"w15","dateUtc")??i.attributes?.["w16cex:dateUtc"]??i.attributes?.["w15:dateUtc"];a&&c&&n.set(String(a).toUpperCase(),String(c));}return n}function _e(t){let n=new Map,e=new Map,o=chunk3R7QHNI5_js.a(t);if(!o)return {parentByParaId:n,doneByParaId:e};let i=chunk3R7QHNI5_js.e(o,"w15","commentsEx")??o;for(let r of chunk3R7QHNI5_js.i(i)){if((r.name?.replace(/^.*:/,"")??"")!=="commentEx")continue;let c=chunk3R7QHNI5_js.j(r,"w15","paraId")??r.attributes?.["w15:paraId"],g=chunk3R7QHNI5_js.j(r,"w15","paraIdParent")??r.attributes?.["w15:paraIdParent"],d=chunk3R7QHNI5_js.j(r,"w15","done")??r.attributes?.["w15:done"];if(c){let h=String(c).toUpperCase();g&&n.set(h,String(g).toUpperCase()),d==="1"&&e.set(h,true);}}return {parentByParaId:n,doneByParaId:e}}function Ne(t,n,e,o,i,r,a){if(!t)return [];let c=chunk3R7QHNI5_js.a(t);if(!c)return [];let g=r?$e(r):new Map,d=a?_e(a):null,h=chunk3R7QHNI5_js.e(c,"w","comments")??c,b=chunk3R7QHNI5_js.i(h),u=[],S=[];for(let f of b){if((f.name?.replace(/^.*:/,"")??"")!=="comment")continue;let C=parseInt(chunk3R7QHNI5_js.j(f,"w","id")??"0",10),D=chunk3R7QHNI5_js.j(f,"w","author")??"Unknown",B=chunk3R7QHNI5_js.j(f,"w","initials"),v=B!=null?String(B):void 0,X=chunk3R7QHNI5_js.j(f,"w","date"),p=X!=null?String(X):void 0,x=chunk3R7QHNI5_js.j(f,"w14","paraId")??f.attributes?.["w14:paraId"]??chunk3R7QHNI5_js.j(f,"w","paraId"),A=(x?g.get(String(x).toUpperCase()):void 0)??p,k=chunk3R7QHNI5_js.j(f,"w","done")??f.attributes?.["w:done"],M=k==="1"||k==="true"?true:void 0,R=chunk3R7QHNI5_js.j(f,"w16cid","parentId")??chunk3R7QHNI5_js.j(f,"w","parentId")??f.attributes?.["w16cid:parentId"]??f.attributes?.["w:parentId"],V=R!=null?parseInt(String(R),10):void 0,L=[],N="";for(let H of chunk3R7QHNI5_js.i(f))if((H.name?.replace(/^.*:/,"")??"")==="p"){let m=chunkAA6D2C6R_js.O(H,n,e,null,o,i);L.push(m);let P=chunk3R7QHNI5_js.j(H,"w14","paraId")??H.attributes?.["w14:paraId"];P&&(N=String(P).toUpperCase());}M==null&&d&&N&&d.doneByParaId.get(N)&&(M=true),S.push(N),u.push({id:C,author:D,initials:v,date:A,content:L,...M!=null?{done:M}:{},...V!=null&&!isNaN(V)?{parentId:V}:{}});}if(d&&d.parentByParaId.size>0){let f=new Map;for(let y=0;y<u.length;y++){let C=S[y];C&&f.set(C,u[y].id);}for(let y=0;y<u.length;y++){if(u[y].parentId!=null)continue;let C=S[y];if(!C)continue;let D=d.parentByParaId.get(C);if(!D)continue;let B=f.get(D);B!=null&&(u[y]={...u[y],parentId:B});}}return u}async function Ve(t,n={}){let e=t instanceof ArrayBuffer?t:await chunkQVRMX2AC_js.u(t),{onProgress:o=()=>{},preloadFonts:i=true,parseHeadersFooters:r=true,parseNotes:a=true,detectVariables:c=true}=n,g=[];try{let u=function(P,I){let U=performance.now(),oe=I(),O=performance.now()-U;return b.push({stage:P,ms:O}),O>1e3&&console.warn(`[parseDocx] ${P} took ${Math.round(O)}ms`),oe};var d=u;let h=performance.now(),b=[];async function S(P,I){let U=performance.now(),oe=await I(),O=performance.now()-U;return b.push({stage:P,ms:O}),O>1e3&&console.warn(`[parseDocx] ${P} took ${Math.round(O)}ms`),oe}o("Extracting DOCX...",0);let f=await S("unzip",()=>G(e));o("Extracted DOCX",10),o("Parsing relationships...",10);let y=u("relationships",()=>f.documentRels?chunkZ3LGMBJC_js.b(f.documentRels):new Map);o("Parsed relationships",15),o("Parsing theme...",15);let C=u("theme",()=>chunkAA6D2C6R_js.a(f.themeXml));o("Parsed theme",20),o("Parsing styles...",20);let D=null,B;u("styles",()=>{f.stylesXml&&(D=ue(f.stylesXml,C),B=ke(f.stylesXml,C));}),o("Parsed styles",30),o("Parsing numbering...",30);let v=u("numbering",()=>chunkH57LNDBH_js.a(f.numberingXml)),X=u("settings",()=>chunkFIGLFSNR_js.b(f.settingsXml));o("Parsed numbering",35),o("Processing media files...",35);let p=u("media",()=>Ze(f,y));o("Processed media",40),o("Parsing document body...",40);let x={content:[]};u("documentBody",()=>{f.documentXml?x=te(f.documentXml,D,C,v,y,p):g.push("No document.xml found in DOCX");}),o("Parsed document body",55);let F,A;if(r){o("Parsing headers/footers...",55);let P=u("headersFooters",()=>qe(f,D,C,v,y,p));F=P.headers,A=P.footers,o("Parsed headers/footers",65);}else o("Skipping headers/footers",65);let k,M,R,V;if(a){o("Parsing footnotes/endnotes...",65);let P=u("footnotesEndnotes",()=>Je(f,D,C,v,y,p));k=P.footnotes,M=P.endnotes,R=P.footnoteSeparators,V=P.endnoteSeparators,o("Parsed footnotes/endnotes",75);}else o("Skipping footnotes/endnotes",75);o("Parsing comments...",75);let L=u("comments",()=>Ne(f.commentsXml,D,C,y,p,f.commentsExtensibleXml,f.commentsExtendedXml));L.length>0&&(x.comments=L);let N;c?(o("Detecting template variables...",75),N=u("variables",()=>ee(x.content)),o("Detected variables",80)):o("Skipping variable detection",80),i?(o("Loading fonts...",80),await S("fonts",()=>Qe(C,B,x)),o("Loaded fonts",95)):o("Skipping font loading",95),o("Assembling document...",95);let _={package:{document:x,styles:B,theme:C,numbering:v.definitions,settings:X,headers:F,footers:A,footnotes:k,endnotes:M,footnoteSeparators:R,endnoteSeparators:V,relationships:y,media:p},originalBuffer:e,templateVariables:N,warnings:g.length>0?g:void 0},m=performance.now()-h;if(m>2e3){let P=b.filter(I=>I.ms>100).map(I=>`${I.stage}: ${Math.round(I.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(m)}ms`+(P?` (${P})`:""));}return o("Complete",100),_}catch(h){let b=h instanceof Error?h.message:String(h);throw console.error("[parseDocx] Failed to parse DOCX:",b,h),new Error(`Failed to parse DOCX: ${b}`)}}function Ze(t,n){let e=new Map;for(let[o,i]of t.media.entries()){let r=o.split("/").pop()||o,a=Me(o),c=new Uint8Array(i),g="";for(let S=0;S<c.length;S++)g+=String.fromCharCode(c[S]);let d=btoa(g),h=`data:${a};base64,${d}`,b={path:o,filename:r,mimeType:a,data:i,dataUrl:h};e.set(o,b);let u=o.replace(/^word\//,"");u!==o&&e.set(u,b);}return e}function ne(t,n){let e=n.toLowerCase();for(let[o,i]of t.entries())if(o.toLowerCase()===e)return i}function qe(t,n,e,o,i,r){let a=new Map,c=new Map;for(let[g,d]of i.entries())if(d.type===chunkZ3LGMBJC_js.a.header&&d.target){let h=d.target.split("/").pop()||d.target,b=ne(t.headers,h);if(b){let u=`word/_rels/${h}.rels`,S=ne(t.allXml,u),f=S?chunkZ3LGMBJC_js.b(S):i,y=chunkAA6D2C6R_js.r(b,"default",n,e,o,f,r);a.set(g,y);}}else if(d.type===chunkZ3LGMBJC_js.a.footer&&d.target){let h=d.target.split("/").pop()||d.target,b=ne(t.footers,h);if(b){let u=`word/_rels/${h}.rels`,S=ne(t.allXml,u),f=S?chunkZ3LGMBJC_js.b(S):i,y=chunkAA6D2C6R_js.s(b,"default",n,e,o,f,r);c.set(g,y);}}return {headers:a,footers:c}}function Je(t,n,e,o,i,r){let a=chunkAA6D2C6R_js.t(t.footnotesXml,n,e,o,i,r),c=chunkAA6D2C6R_js.u(t.endnotesXml,n,e,o,i,r);return {footnotes:a.getNormalFootnotes(),endnotes:c.getNormalEndnotes(),footnoteSeparators:a.footnotes.filter(chunkAA6D2C6R_js.z),endnoteSeparators:c.endnotes.filter(chunkAA6D2C6R_js.A)}}async function Qe(t,n,e){let o=new Set;if(t?.fontScheme){let{majorFont:i,minorFont:r}=t.fontScheme;i?.latin&&o.add(i.latin),r?.latin&&o.add(r.latin);}if(n?.docDefaults?.rPr?.fontFamily?.ascii&&o.add(n.docDefaults.rPr.fontFamily.ascii),n?.styles)for(let i of n.styles)i.rPr?.fontFamily?.ascii&&o.add(i.rPr.fontFamily.ascii),i.rPr?.fontFamily?.hAnsi&&o.add(i.rPr.fontFamily.hAnsi);if(e.content){for(let i of e.content)if(i.type==="paragraph")for(let r of i.content)r.type==="run"&&r.formatting?.fontFamily&&(r.formatting.fontFamily.ascii&&o.add(r.formatting.fontFamily.ascii),r.formatting.fontFamily.hAnsi&&o.add(r.formatting.fontFamily.hAnsi));}if(o.size>0)try{await chunkQVRMX2AC_js.q(Array.from(o));}catch(i){console.warn("Failed to load some fonts:",i);}}async function Et(t){return Ve(t,{preloadFonts:false,parseHeadersFooters:false,parseNotes:false,detectVariables:true})}async function Nt(t,n){return Ve(t,{onProgress:n,preloadFonts:true,parseHeadersFooters:true,parseNotes:true,detectVariables:true})}async function Vt(t){let n=await G(t);if(!n.documentXml)return [];let e=te(n.documentXml);return ee(e.content)}async function Ht(t){let n=await G(t),e=n.documentXml?ee(te(n.documentXml).content):[];return {hasDocument:n.documentXml!==null,hasStyles:n.stylesXml!==null,hasTheme:n.themeXml!==null,hasNumbering:n.numberingXml!==null,headerCount:n.headers.size,footerCount:n.footers.size,mediaCount:n.media.size,variableCount:e.length}}
|
|
1
|
+
'use strict';var chunk6KYOT4E7_js=require('./chunk-6KYOT4E7.js'),chunkFIGLFSNR_js=require('./chunk-FIGLFSNR.js'),chunkQVRMX2AC_js=require('./chunk-QVRMX2AC.js'),chunkZ3LGMBJC_js=require('./chunk-Z3LGMBJC.js'),chunkGSKMHXHG_js=require('./chunk-GSKMHXHG.js'),chunkH57LNDBH_js=require('./chunk-H57LNDBH.js'),chunk3R7QHNI5_js=require('./chunk-3R7QHNI5.js'),He=require('jszip');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var He__default=/*#__PURE__*/_interopDefault(He);async function G(t){let n=await He__default.default.loadAsync(t),e={documentXml:null,stylesXml:null,themeXml:null,numberingXml:null,fontTableXml:null,settingsXml:null,webSettingsXml:null,headers:new Map,footers:new Map,footnotesXml:null,endnotesXml:null,commentsXml:null,commentsExtensibleXml:null,commentsExtendedXml:null,documentRels:null,packageRels:null,contentTypesXml:null,corePropsXml:null,appPropsXml:null,customPropsXml:null,media:new Map,fonts:new Map,allXml:new Map,originalZip:n,originalBuffer:t};for(let[o,i]of Object.entries(n.files)){if(i.dir)continue;let r=o.toLowerCase();if(r.endsWith(".xml")||r.endsWith(".rels")){let a=await i.async("text");if(e.allXml.set(o,a),r==="word/document.xml")e.documentXml=a;else if(r==="word/styles.xml")e.stylesXml=a;else if(r==="word/theme/theme1.xml")e.themeXml=a;else if(r==="word/numbering.xml")e.numberingXml=a;else if(r==="word/fonttable.xml")e.fontTableXml=a;else if(r==="word/settings.xml")e.settingsXml=a;else if(r==="word/websettings.xml")e.webSettingsXml=a;else if(r==="word/footnotes.xml")e.footnotesXml=a;else if(r==="word/endnotes.xml")e.endnotesXml=a;else if(r==="word/comments.xml")e.commentsXml=a;else if(r==="word/commentsextensible.xml")e.commentsExtensibleXml=a;else if(r==="word/commentsextended.xml")e.commentsExtendedXml=a;else if(r==="word/_rels/document.xml.rels")e.documentRels=a;else if(r==="_rels/.rels")e.packageRels=a;else if(r==="[content_types].xml")e.contentTypesXml=a;else if(r==="docprops/core.xml")e.corePropsXml=a;else if(r==="docprops/app.xml")e.appPropsXml=a;else if(r==="docprops/custom.xml")e.customPropsXml=a;else if(r.match(/^word\/header\d+\.xml$/)){let c=o.split("/").pop()||o;e.headers.set(c,a);}else if(r.match(/^word\/footer\d+\.xml$/)){let c=o.split("/").pop()||o;e.footers.set(c,a);}}else if(r.startsWith("word/media/")){let a=await i.async("arraybuffer");e.media.set(o,a);}else if(r.startsWith("word/fonts/")){let a=await i.async("arraybuffer");e.fonts.set(o,a);}}return e}function Me(t){switch(t.toLowerCase().split(".").pop()){case "png":return "image/png";case "jpg":case "jpeg":return "image/jpeg";case "gif":return "image/gif";case "bmp":return "image/bmp";case "tif":case "tiff":return "image/tiff";case "wmf":return "image/x-wmf";case "emf":return "image/x-emf";case "svg":return "image/svg+xml";case "webp":return "image/webp";default:return "application/octet-stream"}}function Y(t,n,e,o){let i={};return t&&t!=="auto"?i.rgb=t:t==="auto"&&(i.auto=true),n&&(i.themeColor=n),e&&(i.themeTint=e),o&&(i.themeShade=o),i}function W(t){if(!t)return;let n={},e=chunk3R7QHNI5_js.j(t,"w","color");e&&e!=="auto"&&(n.color={rgb:e});let o=chunk3R7QHNI5_js.j(t,"w","fill");o&&o!=="auto"&&(n.fill={rgb:o});let i=chunk3R7QHNI5_js.j(t,"w","themeFill");i&&(n.fill=n.fill||{},n.fill.themeColor=i);let r=chunk3R7QHNI5_js.j(t,"w","themeFillTint");r&&n.fill&&(n.fill.themeTint=r);let a=chunk3R7QHNI5_js.j(t,"w","themeFillShade");a&&n.fill&&(n.fill.themeShade=a);let c=chunk3R7QHNI5_js.j(t,"w","val");return c&&(n.pattern=c),Object.keys(n).length>0?n:void 0}function $(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","b");o&&(e.bold=chunk3R7QHNI5_js.m(o));let i=chunk3R7QHNI5_js.e(t,"w","bCs");i&&(e.boldCs=chunk3R7QHNI5_js.m(i));let r=chunk3R7QHNI5_js.e(t,"w","i");r&&(e.italic=chunk3R7QHNI5_js.m(r));let a=chunk3R7QHNI5_js.e(t,"w","iCs");a&&(e.italicCs=chunk3R7QHNI5_js.m(a));let c=chunk3R7QHNI5_js.e(t,"w","u");if(c){let m=chunk3R7QHNI5_js.j(c,"w","val");if(m){e.underline={style:m};let P=chunk3R7QHNI5_js.j(c,"w","color"),I=chunk3R7QHNI5_js.j(c,"w","themeColor");(P||I)&&(e.underline.color=Y(P,I,chunk3R7QHNI5_js.j(c,"w","themeTint"),chunk3R7QHNI5_js.j(c,"w","themeShade")));}}let g=chunk3R7QHNI5_js.e(t,"w","strike");g&&(e.strike=chunk3R7QHNI5_js.m(g));let d=chunk3R7QHNI5_js.e(t,"w","dstrike");d&&(e.doubleStrike=chunk3R7QHNI5_js.m(d));let h=chunk3R7QHNI5_js.e(t,"w","vertAlign");if(h){let m=chunk3R7QHNI5_js.j(h,"w","val");(m==="superscript"||m==="subscript"||m==="baseline")&&(e.vertAlign=m);}let b=chunk3R7QHNI5_js.e(t,"w","smallCaps");b&&(e.smallCaps=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","caps");u&&(e.allCaps=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","vanish");S&&(e.hidden=chunk3R7QHNI5_js.m(S));let f=chunk3R7QHNI5_js.e(t,"w","color");f&&(e.color=Y(chunk3R7QHNI5_js.j(f,"w","val"),chunk3R7QHNI5_js.j(f,"w","themeColor"),chunk3R7QHNI5_js.j(f,"w","themeTint"),chunk3R7QHNI5_js.j(f,"w","themeShade")));let y=chunk3R7QHNI5_js.e(t,"w","highlight");if(y){let m=chunk3R7QHNI5_js.j(y,"w","val");m&&(e.highlight=m);}let C=chunk3R7QHNI5_js.e(t,"w","shd");C&&(e.shading=W(C));let D=chunk3R7QHNI5_js.e(t,"w","sz");if(D){let m=chunk3R7QHNI5_js.l(D,"w","val");m!==void 0&&(e.fontSize=m);}let B=chunk3R7QHNI5_js.e(t,"w","szCs");if(B){let m=chunk3R7QHNI5_js.l(B,"w","val");m!==void 0&&(e.fontSizeCs=m);}let v=chunk3R7QHNI5_js.e(t,"w","rFonts");if(v){e.fontFamily={ascii:chunk3R7QHNI5_js.j(v,"w","ascii")??void 0,hAnsi:chunk3R7QHNI5_js.j(v,"w","hAnsi")??void 0,eastAsia:chunk3R7QHNI5_js.j(v,"w","eastAsia")??void 0,cs:chunk3R7QHNI5_js.j(v,"w","cs")??void 0};let m=chunk3R7QHNI5_js.j(v,"w","asciiTheme");m&&(e.fontFamily.asciiTheme=m,n&&!e.fontFamily.ascii&&(e.fontFamily.ascii=chunk6KYOT4E7_js.b(n,m)));let P=chunk3R7QHNI5_js.j(v,"w","hAnsiTheme");P&&(e.fontFamily.hAnsiTheme=P,n&&!e.fontFamily.hAnsi&&(e.fontFamily.hAnsi=chunk6KYOT4E7_js.b(n,P)));let I=chunk3R7QHNI5_js.j(v,"w","eastAsiaTheme");I&&(e.fontFamily.eastAsiaTheme=I,n&&!e.fontFamily.eastAsia&&(e.fontFamily.eastAsia=chunk6KYOT4E7_js.b(n,I)));let U=chunk3R7QHNI5_js.j(v,"w","cstheme");U&&(e.fontFamily.csTheme=U,n&&!e.fontFamily.cs&&(e.fontFamily.cs=chunk6KYOT4E7_js.b(n,U)));}let X=chunk3R7QHNI5_js.e(t,"w","spacing");if(X){let m=chunk3R7QHNI5_js.l(X,"w","val");m!==void 0&&(e.spacing=m);}let p=chunk3R7QHNI5_js.e(t,"w","position");if(p){let m=chunk3R7QHNI5_js.l(p,"w","val");m!==void 0&&(e.position=m);}let x=chunk3R7QHNI5_js.e(t,"w","w");if(x){let m=chunk3R7QHNI5_js.l(x,"w","val");m!==void 0&&(e.scale=m);}let F=chunk3R7QHNI5_js.e(t,"w","kern");if(F){let m=chunk3R7QHNI5_js.l(F,"w","val");m!==void 0&&(e.kerning=m);}let A=chunk3R7QHNI5_js.e(t,"w","effect");if(A){let m=chunk3R7QHNI5_js.j(A,"w","val");m&&(e.effect=m);}let k=chunk3R7QHNI5_js.e(t,"w","em");if(k){let m=chunk3R7QHNI5_js.j(k,"w","val");m&&(e.emphasisMark=m);}let M=chunk3R7QHNI5_js.e(t,"w","emboss");M&&(e.emboss=chunk3R7QHNI5_js.m(M));let R=chunk3R7QHNI5_js.e(t,"w","imprint");R&&(e.imprint=chunk3R7QHNI5_js.m(R));let V=chunk3R7QHNI5_js.e(t,"w","outline");V&&(e.outline=chunk3R7QHNI5_js.m(V));let L=chunk3R7QHNI5_js.e(t,"w","shadow");L&&(e.shadow=chunk3R7QHNI5_js.m(L));let N=chunk3R7QHNI5_js.e(t,"w","rtl");N&&(e.rtl=chunk3R7QHNI5_js.m(N));let H=chunk3R7QHNI5_js.e(t,"w","cs");H&&(e.cs=chunk3R7QHNI5_js.m(H));let _=chunk3R7QHNI5_js.e(t,"w","rStyle");if(_){let m=chunk3R7QHNI5_js.j(_,"w","val");m&&(e.styleId=m);}return Object.keys(e).length>0?e:void 0}function E(t){if(!t)return;let n=chunk3R7QHNI5_js.j(t,"w","val");if(!n)return;let e={style:n},o=chunk3R7QHNI5_js.j(t,"w","color"),i=chunk3R7QHNI5_js.j(t,"w","themeColor");(o||i)&&(e.color=Y(o,i,chunk3R7QHNI5_js.j(t,"w","themeTint"),chunk3R7QHNI5_js.j(t,"w","themeShade")));let r=chunk3R7QHNI5_js.l(t,"w","sz");r!==void 0&&(e.size=r);let a=chunk3R7QHNI5_js.l(t,"w","space");a!==void 0&&(e.space=a);let c=chunk3R7QHNI5_js.j(t,"w","shadow");c&&(e.shadow=c==="1"||c==="true");let g=chunk3R7QHNI5_js.j(t,"w","frame");return g&&(e.frame=g==="1"||g==="true"),e}function je(t){if(!t)return;let n=chunk3R7QHNI5_js.f(t,"w","tab");if(n.length===0)return;let e=[];for(let o of n){let i=chunk3R7QHNI5_js.l(o,"w","pos"),r=chunk3R7QHNI5_js.j(o,"w","val");if(i!==void 0&&r){let a={position:i,alignment:r},c=chunk3R7QHNI5_js.j(o,"w","leader");c&&(a.leader=c),e.push(a);}}return e.length>0?e:void 0}function K(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","jc");if(o){let p=chunk3R7QHNI5_js.j(o,"w","val");p&&(e.alignment=p);}let i=chunk3R7QHNI5_js.e(t,"w","bidi");i&&(e.bidi=chunk3R7QHNI5_js.m(i));let r=chunk3R7QHNI5_js.e(t,"w","spacing");if(r){let p=chunk3R7QHNI5_js.l(r,"w","before");p!==void 0&&(e.spaceBefore=p);let x=chunk3R7QHNI5_js.l(r,"w","after");x!==void 0&&(e.spaceAfter=x);let F=chunk3R7QHNI5_js.l(r,"w","line");F!==void 0&&(e.lineSpacing=F);let A=chunk3R7QHNI5_js.j(r,"w","lineRule");A&&(e.lineSpacingRule=A);let k=chunk3R7QHNI5_js.j(r,"w","beforeAutospacing");k&&(e.beforeAutospacing=k==="1"||k==="true");let M=chunk3R7QHNI5_js.j(r,"w","afterAutospacing");M&&(e.afterAutospacing=M==="1"||M==="true");}let a=chunk3R7QHNI5_js.e(t,"w","ind");if(a){let p=chunk3R7QHNI5_js.l(a,"w","left");p!==void 0&&(e.indentLeft=p);let x=chunk3R7QHNI5_js.l(a,"w","right");x!==void 0&&(e.indentRight=x);let F=chunk3R7QHNI5_js.l(a,"w","firstLine");F!==void 0&&(e.indentFirstLine=F);let A=chunk3R7QHNI5_js.l(a,"w","hanging");A!==void 0&&(e.indentFirstLine=-A,e.hangingIndent=true);}let c=chunk3R7QHNI5_js.e(t,"w","pBdr");if(c){let p={},x=E(chunk3R7QHNI5_js.e(c,"w","top"));x&&(p.top=x);let F=E(chunk3R7QHNI5_js.e(c,"w","bottom"));F&&(p.bottom=F);let A=E(chunk3R7QHNI5_js.e(c,"w","left"));A&&(p.left=A);let k=E(chunk3R7QHNI5_js.e(c,"w","right"));k&&(p.right=k);let M=E(chunk3R7QHNI5_js.e(c,"w","between"));M&&(p.between=M);let R=E(chunk3R7QHNI5_js.e(c,"w","bar"));R&&(p.bar=R),Object.keys(p).length>0&&(e.borders=p);}let g=chunk3R7QHNI5_js.e(t,"w","shd");g&&(e.shading=W(g));let d=chunk3R7QHNI5_js.e(t,"w","tabs");d&&(e.tabs=je(d));let h=chunk3R7QHNI5_js.e(t,"w","keepNext");h&&(e.keepNext=chunk3R7QHNI5_js.m(h));let b=chunk3R7QHNI5_js.e(t,"w","keepLines");b&&(e.keepLines=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","widowControl");u&&(e.widowControl=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","pageBreakBefore");S&&(e.pageBreakBefore=chunk3R7QHNI5_js.m(S));let f=chunk3R7QHNI5_js.e(t,"w","contextualSpacing");f&&(e.contextualSpacing=chunk3R7QHNI5_js.m(f));let y=chunk3R7QHNI5_js.e(t,"w","numPr");if(y){let p=chunk3R7QHNI5_js.e(y,"w","numId"),x=chunk3R7QHNI5_js.e(y,"w","ilvl");if(p||x){if(e.numPr={},p){let F=chunk3R7QHNI5_js.l(p,"w","val");F!==void 0&&(e.numPr.numId=F);}if(x){let F=chunk3R7QHNI5_js.l(x,"w","val");F!==void 0&&(e.numPr.ilvl=F);}}}let C=chunk3R7QHNI5_js.e(t,"w","outlineLvl");if(C){let p=chunk3R7QHNI5_js.l(C,"w","val");p!==void 0&&(e.outlineLevel=p);}let D=chunk3R7QHNI5_js.e(t,"w","pStyle");if(D){let p=chunk3R7QHNI5_js.j(D,"w","val");p&&(e.styleId=p);}let B=chunk3R7QHNI5_js.e(t,"w","suppressLineNumbers");B&&(e.suppressLineNumbers=chunk3R7QHNI5_js.m(B));let v=chunk3R7QHNI5_js.e(t,"w","suppressAutoHyphens");v&&(e.suppressAutoHyphens=chunk3R7QHNI5_js.m(v));let X=chunk3R7QHNI5_js.e(t,"w","rPr");return X&&(e.runProperties=$(X,n)),Object.keys(e).length>0?e:void 0}function j(t){if(!t)return;let n=chunk3R7QHNI5_js.l(t,"w","w"),e=chunk3R7QHNI5_js.j(t,"w","type");if(n!==void 0&&e)return {value:n,type:e}}function De(t){if(!t)return;let n={},e=E(chunk3R7QHNI5_js.e(t,"w","top"));e&&(n.top=e);let o=E(chunk3R7QHNI5_js.e(t,"w","bottom"));o&&(n.bottom=o);let i=E(chunk3R7QHNI5_js.e(t,"w","left"));i&&(n.left=i);let r=E(chunk3R7QHNI5_js.e(t,"w","right"));r&&(n.right=r);let a=E(chunk3R7QHNI5_js.e(t,"w","insideH"));a&&(n.insideH=a);let c=E(chunk3R7QHNI5_js.e(t,"w","insideV"));return c&&(n.insideV=c),Object.keys(n).length>0?n:void 0}function Ae(t){if(!t)return;let n={},e=j(chunk3R7QHNI5_js.e(t,"w","top"));e&&(n.top=e);let o=j(chunk3R7QHNI5_js.e(t,"w","bottom"));o&&(n.bottom=o);let i=j(chunk3R7QHNI5_js.e(t,"w","left"));i&&(n.left=i);let r=j(chunk3R7QHNI5_js.e(t,"w","right"));return r&&(n.right=r),Object.keys(n).length>0?n:void 0}function Le(t){if(!t)return;let n={},e=chunk3R7QHNI5_js.j(t,"w","val");if(e){let d=parseInt(e,16);isNaN(d)||(n.firstRow=(d&32)!==0,n.lastRow=(d&64)!==0,n.firstColumn=(d&128)!==0,n.lastColumn=(d&256)!==0,n.noHBand=(d&512)!==0,n.noVBand=(d&1024)!==0);}let o=chunk3R7QHNI5_js.j(t,"w","firstColumn");o&&(n.firstColumn=o==="1");let i=chunk3R7QHNI5_js.j(t,"w","firstRow");i&&(n.firstRow=i==="1");let r=chunk3R7QHNI5_js.j(t,"w","lastColumn");r&&(n.lastColumn=r==="1");let a=chunk3R7QHNI5_js.j(t,"w","lastRow");a&&(n.lastRow=a==="1");let c=chunk3R7QHNI5_js.j(t,"w","noHBand");c&&(n.noHBand=c==="1");let g=chunk3R7QHNI5_js.j(t,"w","noVBand");return g&&(n.noVBand=g==="1"),Object.keys(n).length>0?n:void 0}function le(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","tblW");o&&(e.width=j(o));let i=chunk3R7QHNI5_js.e(t,"w","jc");if(i){let f=chunk3R7QHNI5_js.j(i,"w","val");(f==="left"||f==="center"||f==="right")&&(e.justification=f);}let r=chunk3R7QHNI5_js.e(t,"w","tblCellSpacing");r&&(e.cellSpacing=j(r));let a=chunk3R7QHNI5_js.e(t,"w","tblInd");a&&(e.indent=j(a));let c=chunk3R7QHNI5_js.e(t,"w","tblBorders");c&&(e.borders=De(c));let g=chunk3R7QHNI5_js.e(t,"w","tblCellMar");g&&(e.cellMargins=Ae(g));let d=chunk3R7QHNI5_js.e(t,"w","tblLayout");if(d){let f=chunk3R7QHNI5_js.j(d,"w","type");(f==="fixed"||f==="autofit")&&(e.layout=f);}let h=chunk3R7QHNI5_js.e(t,"w","tblStyle");if(h){let f=chunk3R7QHNI5_js.j(h,"w","val");f&&(e.styleId=f);}let b=chunk3R7QHNI5_js.e(t,"w","tblLook");b&&(e.look=Le(b));let u=chunk3R7QHNI5_js.e(t,"w","shd");u&&(e.shading=W(u));let S=chunk3R7QHNI5_js.e(t,"w","bidiVisual");return S&&(e.bidi=chunk3R7QHNI5_js.m(S)),Object.keys(e).length>0?e:void 0}function ce(t){if(!t)return;let n={},e=chunk3R7QHNI5_js.e(t,"w","trHeight");if(e){n.height=j(e);let c=chunk3R7QHNI5_js.j(e,"w","hRule");c&&(n.heightRule=c);}let o=chunk3R7QHNI5_js.e(t,"w","tblHeader");o&&(n.header=chunk3R7QHNI5_js.m(o));let i=chunk3R7QHNI5_js.e(t,"w","cantSplit");i&&(n.cantSplit=chunk3R7QHNI5_js.m(i));let r=chunk3R7QHNI5_js.e(t,"w","jc");if(r){let c=chunk3R7QHNI5_js.j(r,"w","val");(c==="left"||c==="center"||c==="right")&&(n.justification=c);}let a=chunk3R7QHNI5_js.e(t,"w","hidden");return a&&(n.hidden=chunk3R7QHNI5_js.m(a)),Object.keys(n).length>0?n:void 0}function fe(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","tcW");o&&(e.width=j(o));let i=chunk3R7QHNI5_js.e(t,"w","tcBorders");i&&(e.borders=De(i));let r=chunk3R7QHNI5_js.e(t,"w","tcMar");r&&(e.margins=Ae(r));let a=chunk3R7QHNI5_js.e(t,"w","shd");a&&(e.shading=W(a));let c=chunk3R7QHNI5_js.e(t,"w","vAlign");if(c){let f=chunk3R7QHNI5_js.j(c,"w","val");(f==="top"||f==="center"||f==="bottom")&&(e.verticalAlign=f);}let g=chunk3R7QHNI5_js.e(t,"w","textDirection");if(g){let f=chunk3R7QHNI5_js.j(g,"w","val");f&&(e.textDirection=f);}let d=chunk3R7QHNI5_js.e(t,"w","gridSpan");if(d){let f=chunk3R7QHNI5_js.l(d,"w","val");f!==void 0&&(e.gridSpan=f);}let h=chunk3R7QHNI5_js.e(t,"w","vMerge");if(h){let f=chunk3R7QHNI5_js.j(h,"w","val");e.vMerge=f==="restart"?"restart":"continue";}let b=chunk3R7QHNI5_js.e(t,"w","tcFitText");b&&(e.fitText=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","noWrap");u&&(e.noWrap=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","hideMark");return S&&(e.hideMark=chunk3R7QHNI5_js.m(S)),Object.keys(e).length>0?e:void 0}function Ue(t,n){let e={styleId:chunk3R7QHNI5_js.j(t,"w","styleId")??"",type:chunk3R7QHNI5_js.j(t,"w","type")??"paragraph"},o=chunk3R7QHNI5_js.j(t,"w","default");o&&(e.default=o==="1"||o==="true");let i=chunk3R7QHNI5_js.e(t,"w","name");i&&(e.name=chunk3R7QHNI5_js.j(i,"w","val")??void 0);let r=chunk3R7QHNI5_js.e(t,"w","basedOn");r&&(e.basedOn=chunk3R7QHNI5_js.j(r,"w","val")??void 0);let a=chunk3R7QHNI5_js.e(t,"w","next");a&&(e.next=chunk3R7QHNI5_js.j(a,"w","val")??void 0);let c=chunk3R7QHNI5_js.e(t,"w","link");c&&(e.link=chunk3R7QHNI5_js.j(c,"w","val")??void 0);let g=chunk3R7QHNI5_js.e(t,"w","uiPriority");if(g){let X=chunk3R7QHNI5_js.l(g,"w","val");X!==void 0&&(e.uiPriority=X);}let d=chunk3R7QHNI5_js.e(t,"w","hidden");d&&(e.hidden=chunk3R7QHNI5_js.m(d));let h=chunk3R7QHNI5_js.e(t,"w","semiHidden");h&&(e.semiHidden=chunk3R7QHNI5_js.m(h));let b=chunk3R7QHNI5_js.e(t,"w","unhideWhenUsed");b&&(e.unhideWhenUsed=chunk3R7QHNI5_js.m(b));let u=chunk3R7QHNI5_js.e(t,"w","qFormat");u&&(e.qFormat=chunk3R7QHNI5_js.m(u));let S=chunk3R7QHNI5_js.e(t,"w","personal");S&&(e.personal=chunk3R7QHNI5_js.m(S));let f=chunk3R7QHNI5_js.e(t,"w","pPr");f&&(e.pPr=K(f,n));let y=chunk3R7QHNI5_js.e(t,"w","rPr");y&&(e.rPr=$(y,n));let C=chunk3R7QHNI5_js.e(t,"w","tblPr");C&&(e.tblPr=le(C));let D=chunk3R7QHNI5_js.e(t,"w","trPr");D&&(e.trPr=ce(D));let B=chunk3R7QHNI5_js.e(t,"w","tcPr");B&&(e.tcPr=fe(B));let v=chunk3R7QHNI5_js.f(t,"w","tblStylePr");if(v.length>0){e.tblStylePr=[];for(let X of v){let p=chunk3R7QHNI5_js.j(X,"w","type");if(p){let x={type:p},F=chunk3R7QHNI5_js.e(X,"w","pPr");F&&(x.pPr=K(F,n));let A=chunk3R7QHNI5_js.e(X,"w","rPr");A&&(x.rPr=$(A,n));let k=chunk3R7QHNI5_js.e(X,"w","tblPr");k&&(x.tblPr=le(k));let M=chunk3R7QHNI5_js.e(X,"w","trPr");M&&(x.trPr=ce(M));let R=chunk3R7QHNI5_js.e(X,"w","tcPr");R&&(x.tcPr=fe(R)),e.tblStylePr.push(x);}}}return e}function Oe(t,n){if(!t)return;let e={},o=chunk3R7QHNI5_js.e(t,"w","rPrDefault");if(o){let r=chunk3R7QHNI5_js.e(o,"w","rPr");r&&(e.rPr=$(r,n));}let i=chunk3R7QHNI5_js.e(t,"w","pPrDefault");if(i){let r=chunk3R7QHNI5_js.e(i,"w","pPr");r&&(e.pPr=K(r,n));}return e.rPr||e.pPr?e:void 0}function ze(t,n){if(!n)return t;if(!t)return n?{...n}:void 0;let e={...t};for(let o of Object.keys(n)){let i=n[o];if(i!==void 0)if(o==="runProperties")e.runProperties=chunkGSKMHXHG_js.b(e.runProperties,n.runProperties);else if(o==="borders"||o==="numPr"||o==="frame"){let r=e[o],a=i;e[o]={...r||{},...a||{}};}else o==="tabs"&&Array.isArray(i)?e.tabs=[...i]:e[o]=i;}return e}function Be(t,n,e,o=new Set){if(o.has(t.styleId)||(o.add(t.styleId),!t.basedOn))return t;let i=n.get(t.basedOn);if(!i)return t;let r=Be(i,n,e,o),a={...t,pPr:ze(r.pPr,t.pPr),rPr:chunkGSKMHXHG_js.b(r.rPr,t.rPr)};return t.type==="table"&&((r.tblPr||t.tblPr)&&(a.tblPr={...r.tblPr||{},...t.tblPr||{}}),(r.trPr||t.trPr)&&(a.trPr={...r.trPr||{},...t.trPr||{}}),(r.tcPr||t.tcPr)&&(a.tcPr={...r.tcPr||{},...t.tcPr||{}})),a}function ue(t,n){let e=new Map;try{let o=chunk3R7QHNI5_js.c(t);if(!o)return e;let i=chunk3R7QHNI5_js.f(o,"w","style");for(let r of i){let a=Ue(r,n);a.styleId&&e.set(a.styleId,a);}for(let[r,a]of e){let c=Be(a,e,n);e.set(r,c);}}catch(o){console.warn("Failed to parse styles:",o);}return e}function ke(t,n){let e={styles:[]};try{let o=chunk3R7QHNI5_js.c(t);if(!o)return e;let i=chunk3R7QHNI5_js.e(o,"w","docDefaults");e.docDefaults=Oe(i,n);let r=chunk3R7QHNI5_js.e(o,"w","latentStyles");r&&(e.latentStyles={defLockedState:chunk3R7QHNI5_js.j(r,"w","defLockedState")==="1",defUIPriority:chunk3R7QHNI5_js.l(r,"w","defUIPriority"),defSemiHidden:chunk3R7QHNI5_js.j(r,"w","defSemiHidden")==="1",defUnhideWhenUsed:chunk3R7QHNI5_js.j(r,"w","defUnhideWhenUsed")==="1",defQFormat:chunk3R7QHNI5_js.j(r,"w","defQFormat")==="1",count:chunk3R7QHNI5_js.l(r,"w","count")});let a=ue(t,n);e.styles=Array.from(a.values());}catch(o){console.warn("Failed to parse style definitions:",o);}return e}var Ie=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g;function Re(t){let n=[],e;for(Ie.lastIndex=0;(e=Ie.exec(t))!==null;){let o=e[1].trim();o&&!n.includes(o)&&n.push(o);}return n}function ee(t){let n=[];for(let e of t)if(e.type==="paragraph"){let o=chunk6KYOT4E7_js.N(e),i=Re(o);for(let r of i)n.includes(r)||n.push(r);}else if(e.type==="table"){let o=Ee(e);for(let i of o)n.includes(i)||n.push(i);}return n}function Ee(t){let n=[];for(let e of t.rows)for(let o of e.cells)for(let i of o.content)if(i.type==="paragraph"){let r=chunk6KYOT4E7_js.N(i),a=Re(r);for(let c of a)n.includes(c)||n.push(c);}else if(i.type==="table"){let r=Ee(i);for(let a of r)n.includes(a)||n.push(a);}return n}function We(t,n){let e=[],o=[];for(let i of t)o.push(i),i.type==="paragraph"&&i.sectionProperties&&(e.push({properties:i.sectionProperties,content:o}),o=[]);return (o.length>0||e.length===0)&&e.push({properties:n??chunk6KYOT4E7_js.C(),content:o}),e}function te(t,n=null,e=null,o=null,i=null,r=null){let a={content:[]};if(!t)return a;let c=chunk3R7QHNI5_js.a(t);if(!c)return a;let g=(c.elements??[]).find(u=>u.type==="element"&&(u.name==="w:document"||u.name?.endsWith(":document")));if(!g)return a;let d=chunk3R7QHNI5_js.e(g,"w","body");if(!d)return a;a.content=chunk6KYOT4E7_js.q(d,n,e,o,i,r);let h=chunk3R7QHNI5_js.e(d,"w","sectPr");h&&(a.finalSectionProperties=chunk6KYOT4E7_js.B(h,i));let b=We(a.content,a.finalSectionProperties);return a.sections=chunk6KYOT4E7_js.D(b),a.finalSectionProperties&&a.sections.length>0&&(a.finalSectionProperties=a.sections[a.sections.length-1].properties),a}function $e(t){let n=new Map,e=chunk3R7QHNI5_js.a(t);if(!e)return n;let o=chunk3R7QHNI5_js.e(e,"w16cex","commentsExtensible")??e;for(let i of chunk3R7QHNI5_js.i(o)){if((i.name?.replace(/^.*:/,"")??"")!=="comment")continue;let a=chunk3R7QHNI5_js.j(i,"w16cex","paraId")??chunk3R7QHNI5_js.j(i,"w15","paraId")??i.attributes?.["w16cex:paraId"]??i.attributes?.["w15:paraId"],c=chunk3R7QHNI5_js.j(i,"w16cex","dateUtc")??chunk3R7QHNI5_js.j(i,"w15","dateUtc")??i.attributes?.["w16cex:dateUtc"]??i.attributes?.["w15:dateUtc"];a&&c&&n.set(String(a).toUpperCase(),String(c));}return n}function _e(t){let n=new Map,e=new Map,o=chunk3R7QHNI5_js.a(t);if(!o)return {parentByParaId:n,doneByParaId:e};let i=chunk3R7QHNI5_js.e(o,"w15","commentsEx")??o;for(let r of chunk3R7QHNI5_js.i(i)){if((r.name?.replace(/^.*:/,"")??"")!=="commentEx")continue;let c=chunk3R7QHNI5_js.j(r,"w15","paraId")??r.attributes?.["w15:paraId"],g=chunk3R7QHNI5_js.j(r,"w15","paraIdParent")??r.attributes?.["w15:paraIdParent"],d=chunk3R7QHNI5_js.j(r,"w15","done")??r.attributes?.["w15:done"];if(c){let h=String(c).toUpperCase();g&&n.set(h,String(g).toUpperCase()),d==="1"&&e.set(h,true);}}return {parentByParaId:n,doneByParaId:e}}function Ne(t,n,e,o,i,r,a){if(!t)return [];let c=chunk3R7QHNI5_js.a(t);if(!c)return [];let g=r?$e(r):new Map,d=a?_e(a):null,h=chunk3R7QHNI5_js.e(c,"w","comments")??c,b=chunk3R7QHNI5_js.i(h),u=[],S=[];for(let f of b){if((f.name?.replace(/^.*:/,"")??"")!=="comment")continue;let C=parseInt(chunk3R7QHNI5_js.j(f,"w","id")??"0",10),D=chunk3R7QHNI5_js.j(f,"w","author")??"Unknown",B=chunk3R7QHNI5_js.j(f,"w","initials"),v=B!=null?String(B):void 0,X=chunk3R7QHNI5_js.j(f,"w","date"),p=X!=null?String(X):void 0,x=chunk3R7QHNI5_js.j(f,"w14","paraId")??f.attributes?.["w14:paraId"]??chunk3R7QHNI5_js.j(f,"w","paraId"),A=(x?g.get(String(x).toUpperCase()):void 0)??p,k=chunk3R7QHNI5_js.j(f,"w","done")??f.attributes?.["w:done"],M=k==="1"||k==="true"?true:void 0,R=chunk3R7QHNI5_js.j(f,"w16cid","parentId")??chunk3R7QHNI5_js.j(f,"w","parentId")??f.attributes?.["w16cid:parentId"]??f.attributes?.["w:parentId"],V=R!=null?parseInt(String(R),10):void 0,L=[],N="";for(let H of chunk3R7QHNI5_js.i(f))if((H.name?.replace(/^.*:/,"")??"")==="p"){let m=chunk6KYOT4E7_js.O(H,n,e,null,o,i);L.push(m);let P=chunk3R7QHNI5_js.j(H,"w14","paraId")??H.attributes?.["w14:paraId"];P&&(N=String(P).toUpperCase());}M==null&&d&&N&&d.doneByParaId.get(N)&&(M=true),S.push(N),u.push({id:C,author:D,initials:v,date:A,content:L,...M!=null?{done:M}:{},...V!=null&&!isNaN(V)?{parentId:V}:{}});}if(d&&d.parentByParaId.size>0){let f=new Map;for(let y=0;y<u.length;y++){let C=S[y];C&&f.set(C,u[y].id);}for(let y=0;y<u.length;y++){if(u[y].parentId!=null)continue;let C=S[y];if(!C)continue;let D=d.parentByParaId.get(C);if(!D)continue;let B=f.get(D);B!=null&&(u[y]={...u[y],parentId:B});}}return u}async function Ve(t,n={}){let e=t instanceof ArrayBuffer?t:await chunkQVRMX2AC_js.u(t),{onProgress:o=()=>{},preloadFonts:i=true,parseHeadersFooters:r=true,parseNotes:a=true,detectVariables:c=true}=n,g=[];try{let u=function(P,I){let U=performance.now(),oe=I(),O=performance.now()-U;return b.push({stage:P,ms:O}),O>1e3&&console.warn(`[parseDocx] ${P} took ${Math.round(O)}ms`),oe};var d=u;let h=performance.now(),b=[];async function S(P,I){let U=performance.now(),oe=await I(),O=performance.now()-U;return b.push({stage:P,ms:O}),O>1e3&&console.warn(`[parseDocx] ${P} took ${Math.round(O)}ms`),oe}o("Extracting DOCX...",0);let f=await S("unzip",()=>G(e));o("Extracted DOCX",10),o("Parsing relationships...",10);let y=u("relationships",()=>f.documentRels?chunkZ3LGMBJC_js.b(f.documentRels):new Map);o("Parsed relationships",15),o("Parsing theme...",15);let C=u("theme",()=>chunk6KYOT4E7_js.a(f.themeXml));o("Parsed theme",20),o("Parsing styles...",20);let D=null,B;u("styles",()=>{f.stylesXml&&(D=ue(f.stylesXml,C),B=ke(f.stylesXml,C));}),o("Parsed styles",30),o("Parsing numbering...",30);let v=u("numbering",()=>chunkH57LNDBH_js.a(f.numberingXml)),X=u("settings",()=>chunkFIGLFSNR_js.b(f.settingsXml));o("Parsed numbering",35),o("Processing media files...",35);let p=u("media",()=>Ze(f,y));o("Processed media",40),o("Parsing document body...",40);let x={content:[]};u("documentBody",()=>{f.documentXml?x=te(f.documentXml,D,C,v,y,p):g.push("No document.xml found in DOCX");}),o("Parsed document body",55);let F,A;if(r){o("Parsing headers/footers...",55);let P=u("headersFooters",()=>qe(f,D,C,v,y,p));F=P.headers,A=P.footers,o("Parsed headers/footers",65);}else o("Skipping headers/footers",65);let k,M,R,V;if(a){o("Parsing footnotes/endnotes...",65);let P=u("footnotesEndnotes",()=>Je(f,D,C,v,y,p));k=P.footnotes,M=P.endnotes,R=P.footnoteSeparators,V=P.endnoteSeparators,o("Parsed footnotes/endnotes",75);}else o("Skipping footnotes/endnotes",75);o("Parsing comments...",75);let L=u("comments",()=>Ne(f.commentsXml,D,C,y,p,f.commentsExtensibleXml,f.commentsExtendedXml));L.length>0&&(x.comments=L);let N;c?(o("Detecting template variables...",75),N=u("variables",()=>ee(x.content)),o("Detected variables",80)):o("Skipping variable detection",80),i?(o("Loading fonts...",80),await S("fonts",()=>Qe(C,B,x)),o("Loaded fonts",95)):o("Skipping font loading",95),o("Assembling document...",95);let _={package:{document:x,styles:B,theme:C,numbering:v.definitions,settings:X,headers:F,footers:A,footnotes:k,endnotes:M,footnoteSeparators:R,endnoteSeparators:V,relationships:y,media:p},originalBuffer:e,templateVariables:N,warnings:g.length>0?g:void 0},m=performance.now()-h;if(m>2e3){let P=b.filter(I=>I.ms>100).map(I=>`${I.stage}: ${Math.round(I.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(m)}ms`+(P?` (${P})`:""));}return o("Complete",100),_}catch(h){let b=h instanceof Error?h.message:String(h);throw console.error("[parseDocx] Failed to parse DOCX:",b,h),new Error(`Failed to parse DOCX: ${b}`)}}function Ze(t,n){let e=new Map;for(let[o,i]of t.media.entries()){let r=o.split("/").pop()||o,a=Me(o),c=new Uint8Array(i),g="";for(let S=0;S<c.length;S++)g+=String.fromCharCode(c[S]);let d=btoa(g),h=`data:${a};base64,${d}`,b={path:o,filename:r,mimeType:a,data:i,dataUrl:h};e.set(o,b);let u=o.replace(/^word\//,"");u!==o&&e.set(u,b);}return e}function ne(t,n){let e=n.toLowerCase();for(let[o,i]of t.entries())if(o.toLowerCase()===e)return i}function qe(t,n,e,o,i,r){let a=new Map,c=new Map;for(let[g,d]of i.entries())if(d.type===chunkZ3LGMBJC_js.a.header&&d.target){let h=d.target.split("/").pop()||d.target,b=ne(t.headers,h);if(b){let u=`word/_rels/${h}.rels`,S=ne(t.allXml,u),f=S?chunkZ3LGMBJC_js.b(S):i,y=chunk6KYOT4E7_js.r(b,"default",n,e,o,f,r);a.set(g,y);}}else if(d.type===chunkZ3LGMBJC_js.a.footer&&d.target){let h=d.target.split("/").pop()||d.target,b=ne(t.footers,h);if(b){let u=`word/_rels/${h}.rels`,S=ne(t.allXml,u),f=S?chunkZ3LGMBJC_js.b(S):i,y=chunk6KYOT4E7_js.s(b,"default",n,e,o,f,r);c.set(g,y);}}return {headers:a,footers:c}}function Je(t,n,e,o,i,r){let a=chunk6KYOT4E7_js.t(t.footnotesXml,n,e,o,i,r),c=chunk6KYOT4E7_js.u(t.endnotesXml,n,e,o,i,r);return {footnotes:a.getNormalFootnotes(),endnotes:c.getNormalEndnotes(),footnoteSeparators:a.footnotes.filter(chunk6KYOT4E7_js.z),endnoteSeparators:c.endnotes.filter(chunk6KYOT4E7_js.A)}}async function Qe(t,n,e){let o=new Set;if(t?.fontScheme){let{majorFont:i,minorFont:r}=t.fontScheme;i?.latin&&o.add(i.latin),r?.latin&&o.add(r.latin);}if(n?.docDefaults?.rPr?.fontFamily?.ascii&&o.add(n.docDefaults.rPr.fontFamily.ascii),n?.styles)for(let i of n.styles)i.rPr?.fontFamily?.ascii&&o.add(i.rPr.fontFamily.ascii),i.rPr?.fontFamily?.hAnsi&&o.add(i.rPr.fontFamily.hAnsi);if(e.content){for(let i of e.content)if(i.type==="paragraph")for(let r of i.content)r.type==="run"&&r.formatting?.fontFamily&&(r.formatting.fontFamily.ascii&&o.add(r.formatting.fontFamily.ascii),r.formatting.fontFamily.hAnsi&&o.add(r.formatting.fontFamily.hAnsi));}if(o.size>0)try{await chunkQVRMX2AC_js.q(Array.from(o));}catch(i){console.warn("Failed to load some fonts:",i);}}async function Et(t){return Ve(t,{preloadFonts:false,parseHeadersFooters:false,parseNotes:false,detectVariables:true})}async function Nt(t,n){return Ve(t,{onProgress:n,preloadFonts:true,parseHeadersFooters:true,parseNotes:true,detectVariables:true})}async function Vt(t){let n=await G(t);if(!n.documentXml)return [];let e=te(n.documentXml);return ee(e.content)}async function Ht(t){let n=await G(t),e=n.documentXml?ee(te(n.documentXml).content):[];return {hasDocument:n.documentXml!==null,hasStyles:n.stylesXml!==null,hasTheme:n.themeXml!==null,hasNumbering:n.numberingXml!==null,headerCount:n.headers.size,footerCount:n.footers.size,mediaCount:n.media.size,variableCount:e.length}}
|
|
2
2
|
exports.a=Ve;exports.b=Et;exports.c=Nt;exports.d=Vt;exports.e=Ht;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-QPFJJPIC.mjs';import {f as f$1,g as g$1}from'./chunk-KNY7SXPJ.mjs';function u(e){return {sdtType:e.sdtType,id:e.id??null,alias:e.alias??null,tag:e.tag??null,lock:e.lock??null,placeholder:e.placeholder??null,showingPlaceholder:e.showingPlaceholder??false,dateFormat:e.dateFormat??null,listItems:e.listItems?JSON.stringify(e.listItems):null,checked:e.checked??null,dataBinding:e.dataBinding?JSON.stringify(e.dataBinding):null,rawPropertiesXml:e.rawPropertiesXml??null,rawEndPropertiesXml:e.rawEndPropertiesXml??null}}function g(e){let i={sdtType:e.sdtType??"richText"};if(typeof e.id=="number"&&(i.id=e.id),e.alias!=null&&(i.alias=String(e.alias)),e.tag!=null&&(i.tag=String(e.tag)),e.lock!=null&&(i.lock=e.lock),e.placeholder!=null&&(i.placeholder=String(e.placeholder)),e.showingPlaceholder&&(i.showingPlaceholder=true),e.dateFormat!=null&&(i.dateFormat=String(e.dateFormat)),typeof e.listItems=="string"&&e.listItems)try{i.listItems=JSON.parse(e.listItems);}catch{}if(e.checked!=null&&(i.checked=e.checked),typeof e.dataBinding=="string"&&e.dataBinding)try{i.dataBinding=JSON.parse(e.dataBinding);}catch{}return e.rawPropertiesXml!=null&&(i.rawPropertiesXml=String(e.rawPropertiesXml)),e.rawEndPropertiesXml!=null&&(i.rawEndPropertiesXml=String(e.rawEndPropertiesXml)),i}function a(e){return !!e.wrap&&e.wrap.type!=="inline"}function w(e){let i=e.wrap?.type??"inline",t=e.wrap?.wrapText,l=e.position?.horizontal?.alignment;return {displayMode:d(i),cssFloat:p(i,t,l),wrapType:i,wrapText:t,anchorTarget:a(e)?"followingBlock":void 0,position:e.position?f(e.position):void 0,distTop:e.wrap?.distT!=null?f$1(e.wrap.distT):void 0,distBottom:e.wrap?.distB!=null?f$1(e.wrap.distB):void 0,distLeft:e.wrap?.distL!=null?f$1(e.wrap.distL):void 0,distRight:e.wrap?.distR!=null?f$1(e.wrap.distR):void 0}}function x(e){return e.anchorTarget==="followingBlock"||s(e)}function P(e){let i=e.position;if(!(!i?.horizontal&&!i?.vertical))return {horizontal:{relativeTo:i.horizontal?.relativeTo??"margin",alignment:i.horizontal?.align,posOffset:i.horizontal?.posOffset},vertical:{relativeTo:i.vertical?.relativeTo??"paragraph",alignment:i.vertical?.align,posOffset:i.vertical?.posOffset}}}function y(e){let i=e.wrapType??(e.displayMode==="float"?"square":"inline");if(!i||i==="inline")return;let t={type:i};return e.wrapText&&(t.wrapText=e.wrapText),e.distTop!=null&&(t.distT=g$1(e.distTop)),e.distBottom!=null&&(t.distB=g$1(e.distBottom)),e.distLeft!=null&&(t.distL=g$1(e.distLeft)),e.distRight!=null&&(t.distR=g$1(e.distRight)),t}function d(e){return e==="inline"?"inline":e==="topAndBottom"?"block":"float"}function s(e){return e.displayMode==="float"||a$1(e.wrapType)}function p(e,i,t){return e==="inline"||e==="topAndBottom"?"none":i==="left"?"right":i==="right"||t==="left"?"left":t==="right"?"right":"none"}function f(e){return {horizontal:e.horizontal?{relativeTo:e.horizontal.relativeTo,posOffset:e.horizontal.posOffset,align:e.horizontal.alignment}:void 0,vertical:e.vertical?{relativeTo:e.vertical.relativeTo,posOffset:e.vertical.posOffset,align:e.vertical.alignment}:void 0}}export{u as a,g as b,a as c,w as d,x as e,P as f,y as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e,b,c,a as a$1}from'./chunk-KQTB5Y7P.mjs';import {a}from'./chunk-SNTAAXXA.mjs';import {i,g}from'./chunk-MJ6XZFVD.mjs';import {TextSelection}from'prosemirror-state';function _(e){let{$from:t}=e.selection,n=null,r=null,s=null,a=-1,o=-1;for(let i=t.depth;i>0;i--){let c=t.node(i);if(c.type.name==="tableCell"||c.type.name==="tableHeader"){s=c;let l=t.node(i-1);if(l?.type.name==="tableRow"){let b=0;l.forEach((h,y,S)=>{if(o===-1){if(S===t.index(i-1)){o=b;return}b+=h.attrs.colspan||1;}});}}else if(c.type.name==="tableRow")t.node(i-1)?.type.name==="table"&&(a=t.index(i-1));else if(c.type.name==="table"){n=c,r=t.before(i);break}}return !n||r==null||!s||a<0||o<0?null:{table:n,tablePos:r,cell:s,row:a,col:o,rowspan:s.attrs.rowspan||1,colspan:s.attrs.colspan||1}}function H(e){let t=[],n=[],r=0;for(let s=0;s<e.childCount;s++){let a=e.child(s),o=0;a.forEach(i=>{for(;t[s]?.[o];)o++;let c=i.attrs.rowspan||1,l=i.attrs.colspan||1;n.push({data:i,row:s,col:o,rowspan:c,colspan:l});for(let b=s;b<s+c;b++){let h=t[b]??[];t[b]=h;for(let y=o;y<o+l;y++)h[y]=true;}o+=l,r=Math.max(r,o);});}return {anchors:n,totalCols:r}}function j(e,t,n,r,s){let a={...e.attrs},o=s.reduce((l,b)=>l+b,0),i=a$1(s,t,n),c=n!==(e.attrs.colspan||1)||r!==(e.attrs.rowspan||1);return a.colspan=n,a.rowspan=r,a.colwidth=null,o>0&&(a.width=Math.round(i/o*5e3),a.widthType="pct"),c&&(a._originalFormatting=null),a}function Y(e,t,n,r){let s=t+1;for(let a=0;a<e.childCount;a++){let o=e.child(a),i=s+1,c=0;for(let l=0;l<o.childCount;l++){let b=o.child(l);if(a===n&&c===r)return i;c+=b.attrs.colspan||1,i+=b.nodeSize;}s+=o.nodeSize;}return null}function q(e,t){let n=e.attrs.width??9360;return Array.isArray(e.attrs.columnWidths)&&e.attrs.columnWidths.length>0?[...e.attrs.columnWidths]:Array.from({length:t},()=>Math.floor(n/Math.max(t,1)))}function Q(e$1){let t=_(e$1);return t?{...e(t.rowspan,t.colspan),capturedCellRow:t.row,capturedCellCol:t.col}:null}function Z(e,t,n,r,s,a){if(n<1||r<1)return false;let o=_(e);if(!o||!t)return false;let i=o;if(s!=null&&a!=null&&(s!==o.row||a!==o.col)){let{anchors:p}=H(o.table),g=p.find(T=>T.row===s&&T.col===a);if(!g)return false;i={...o,cell:g.data,row:g.row,col:g.col,rowspan:g.rowspan,colspan:g.colspan};}if(n<i.rowspan||r<i.colspan||n===1&&r===1)return false;let{anchors:c$1,totalCols:l}=H(i.table),b$1=q(i.table,l),h=b(b$1,i.col,i.colspan,r),y=c$1.find(p=>p.row===i.row&&p.col===i.col);if(!y)return false;let S=c(c$1,y,n,r,i.table.childCount,p=>{if(p)return y.data;let g=y.data.type.schema.nodes.paragraph.create(),T=j(y.data,0,1,1,h);return y.data.type.create(T,g)}),x=i.row+i.rowspan,w=Array.from({length:S.newRowCount},(p,g)=>g<x?{...i.table.child(g)?.attrs??{}}:g<i.row+n?{...i.table.child(x-1)?.attrs??{}}:{...i.table.child(g-S.deltaRows)?.attrs??{}}),k=Array.from({length:S.newRowCount},()=>[]);S.anchors.sort((p,g)=>p.row===g.row?p.col-g.col:p.row-g.row).forEach(p=>{let g=j(p.data,p.col,p.colspan,p.rowspan,h);k[p.row].push(p.data.type.create(g,p.data.content));});let u=k.map((p,g)=>i.table.type.schema.nodes.tableRow.create(w[g],p)),d=i.table.type.create({...i.table.attrs,columnWidths:h},u),f=e.tr.replaceWith(i.tablePos,i.tablePos+i.table.nodeSize,d),C=f.doc.nodeAt(i.tablePos);if(C){let p=Y(C,i.tablePos,i.row,i.col);p!=null&&(f=f.setSelection(TextSelection.near(f.doc.resolve(p+1))));}return t(f.scrollIntoView()),true}var m=a.getCommands();function re(e,t){return m.insertTable(e,t)}function ne(e,t){return m.addRowAbove()(e,t)}function oe(e,t){return m.addRowBelow()(e,t)}function ae(e,t){return m.deleteRow()(e,t)}function ie(e,t){return m.addColumnLeft()(e,t)}function se(e,t){return m.addColumnRight()(e,t)}function le(e,t){return m.deleteColumn()(e,t)}function ce(e,t){return m.deleteTable()(e,t)}function de(e,t){return m.selectTable()(e,t)}function ue(e,t){return m.selectRow()(e,t)}function pe(e,t){return m.selectColumn()(e,t)}function me(e,t){return m.mergeCells()(e,t)}function fe(e,t){return m.splitCell()(e,t)}function ge(e,t,n){return m.setCellBorder(e,t,n)}function be(e,t){return m.setTableBorders(e,t)}function he(e,t){return m.removeTableBorders()(e,t)}function ye(e,t,n){return m.setAllTableBorders(n)(e,t)}function Ce(e,t,n){return m.setOutsideTableBorders(n)(e,t)}function Te(e,t,n){return m.setInsideTableBorders(n)(e,t)}function Se(e){return m.setCellVerticalAlign(e)}function ke(e){return m.setCellMargins(e)}function ve(e){return m.setCellTextDirection(e)}function xe(){return m.toggleNoWrap()}function we(e,t){return m.setRowHeight(e,t)}function Ie(){return m.toggleHeaderRow()}function Pe(){return m.distributeColumns()}function Ae(){return m.autoFitContents()}function Ee(e){return m.setTableProperties(e)}function Me(e){return m.applyTableStyle(e)}function Re(e){return m.setCellFillColor(e)}function Ne(e){return m.setTableBorderColor(e)}function Be(e){return m.setTableBorderWidth(e)}var Fe=a.getCommands();function O(e,t,n,r){if(!t)return true;let s=e.tr.insert(r,n),a=i(e),o=e.schema.marks.insertion;return a&&o&&s.addMark(r,r+n.nodeSize,o.create({revisionId:a.revisionId,author:a.author,date:a.date})),t(s.scrollIntoView()),true}var V=612;function We(e,t,n){let r=n?.maxWidth??V,s=new FileReader;s.onload=()=>{let a=s.result,o=new Image;o.onload=()=>{let i=o.naturalWidth,c=o.naturalHeight;i>r&&(c=Math.round(c*(r/i)),i=r);let l=e.state.schema.nodes.image.create({src:a,alt:t.name,width:i,height:c,rId:`rId_img_${Date.now()}_${Math.round(Math.random()*1e9)}`,wrapType:"inline",displayMode:"inline"});O(e.state,e.dispatch,l,e.state.selection.from),e.focus(),n?.onInserted?.();},o.onerror=()=>n?.onError?.(new Error("Failed to decode image")),o.src=a;},s.onerror=()=>n?.onError?.(s.error),s.readAsDataURL(t);}function De(e,t,n){return Fe.setImageWrapType(e,t,n)}function Le(e){return (t,n)=>{let{from:r,to:s,empty:a}=t.selection;if(a)return false;let o=t.schema.marks.comment;if(!o)return false;if(n){let i=t.tr.addMark(r,s,o.create({commentId:e}));n(i);}return true}}function ze(e){return (t,n)=>{let r=t.schema.marks.comment;if(!r)return false;if(n){let s=t.tr;t.doc.descendants((a,o)=>{if(a.isText)for(let i of a.marks)i.type===r&&i.attrs.commentId===e&&s.removeMark(o,o+a.nodeSize,i);}),s.steps.length>0&&n(s);}return true}}function $(e,t,n){return (r,s)=>{let a=r.schema.marks.insertion,o=r.schema.marks.deletion;if(!a&&!o)return false;let i=n==="accept"?a:o,c=n==="accept"?o:a;if(s){let l=r.tr,b=[];r.doc.nodesBetween(e,t,(h,y)=>{if(!h.isInline)return;let S=y+h.nodeSize,x=Math.max(e,y),w=Math.min(t,S);c&&h.marks.some(k=>k.type===c)&&b.push({from:x,to:w}),i&&h.marks.some(k=>k.type===i)&&l.removeMark(x,w,i);});for(let h of b.reverse())l.delete(h.from,h.to);l.steps.length>0&&s(l);}return true}}function He(e,t){return $(e,t,"accept")}function je(e,t){return $(e,t,"reject")}function U(e){let t=new Set,n=[],r=o=>{typeof o=="number"&&!t.has(o)&&(t.add(o),n.push(o));},s=e.schema.marks.insertion,a=e.schema.marks.deletion;return e.doc.descendants(o=>{if(o.type.name==="paragraph"){r(o.attrs.pPrIns?.revisionId),r(o.attrs.pPrDel?.revisionId);let i=o.attrs.pPrChange;if(Array.isArray(i))for(let c of i)r(c.info.id);}if(o.type.name==="tableRow"){r(o.attrs.trIns?.revisionId),r(o.attrs.trDel?.revisionId);let i=o.attrs.trPrChange;if(Array.isArray(i))for(let c of i)r(c.info.id);}if(o.type.name==="tableCell"||o.type.name==="tableHeader"){let i=o.attrs.cellMarker;r(i?.info?.revisionId);let c=o.attrs.tcPrChange;if(Array.isArray(c))for(let l of c)r(l.info.id);}if(o.type.name==="table"){let i=o.attrs.tblPrChange;if(Array.isArray(i))for(let c of i)r(c.info.id);}if(o.isInline)for(let i of o.marks)(s&&i.type===s||a&&i.type===a)&&r(i.attrs.revisionId);}),n}function _e(){return (e,t)=>{let n=U(e);if(n.length===0)return false;if(!t)return true;let r=e,s=a=>{t(a),r=r.apply(a);};for(let a of n)M(a,"accept")(r,s);return true}}function Oe(){return (e,t)=>{let n=U(e);if(n.length===0)return false;if(!t)return true;let r=e,s=a=>{t(a),r=r.apply(a);};for(let a of n)M(a,"reject")(r,s);return true}}function G(e,t){let n=e.schema.marks.insertion,r=e.schema.marks.deletion;if(!n&&!r)return null;let s=null;return e.doc.descendants((a,o)=>{if(s)return false;if(a.isInline&&!(o+a.nodeSize<=t)){for(let i of a.marks)if(i.type===n||i.type===r)return s={from:Math.max(o,t),to:o+a.nodeSize,type:i.type===n?"insertion":"deletion"},false}}),!s&&t>0?G(e,0):s}function Ve(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="paragraph")return;let a=r.attrs.pPrIns,o=r.attrs.pPrDel;a&&a.revisionId===t&&n.push({pos:s,node:r,kind:"pPrIns"}),o&&o.revisionId===t&&n.push({pos:s,node:r,kind:"pPrDel"});}),n}function $e(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="paragraph")return;let a=r.attrs.pPrChange;Array.isArray(a)&&a.forEach((o,i)=>{!o?.info||typeof o.info.id!="number"||o.info.id===t&&n.push({pos:s,node:r,entryIndex:i,prior:o.previousFormatting,current:o.currentFormatting});});}),n}function Ue(e,t){let n=[],r=e.schema.marks.insertion,s=e.schema.marks.deletion;return e.doc.descendants((a,o)=>{if(a.isInline){for(let i of a.marks)if((r&&i.type===r||s&&i.type===s)&&i.attrs.revisionId===t){let c=i.type===r?"insertion":"deletion",l=n[n.length-1];l&&l.markName===c&&l.to===o?l.to=o+a.nodeSize:n.push({from:o,to:o+a.nodeSize,markName:c});}}}),n}function Ge(e,t,n){let r=e.doc.nodeAt(t);if(!r)return;let s=t+r.nodeSize,a=e.doc.nodeAt(s);!a||a.type.name!=="paragraph"||(e.setNodeMarkup(t,void 0,{...a.attrs,pPrIns:null,pPrDel:null}),e.join(s));}function N(e,t,n){let r=e.doc.nodeAt(t);if(!r)return;let s={...r.attrs};s[n]=null,e.setNodeMarkup(t,void 0,s);}function Xe(e,t,n){let r=e.doc.nodeAt(t);if(!r)return;let s=r.attrs.pPrChange;if(!Array.isArray(s)||n<0||n>=s.length)return;let a=s.slice();a.splice(n,1),e.setNodeMarkup(t,void 0,{...r.attrs,pPrChange:a.length>0?a:null});}function Je(e,t,n){let r={...e},s=["alignment","spaceBefore","spaceAfter","lineSpacing","lineSpacingRule","beforeAutospacing","afterAutospacing","spacingExplicit","indentLeft","indentRight","indentFirstLine","hangingIndent","styleId","borders","shading","tabs","pageBreakBefore","keepNext","keepLines","contextualSpacing","bidi","outlineLevel","numPr"];for(let a of s)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a]??null);return n?.numPr&&!Object.prototype.hasOwnProperty.call(t,"numPr")&&(r.numPr=null),r.numPr==null&&(r.listIsBullet=null,r.listNumFmt=null,r.listMarker=null),r}function Ke(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="tableRow")return;let a=r.attrs.trIns,o=r.attrs.trDel;a&&a.revisionId===t&&n.push({pos:s,node:r,kind:"trIns"}),o&&o.revisionId===t&&n.push({pos:s,node:r,kind:"trDel"});}),n}function Ye(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="tableCell"&&r.type.name!=="tableHeader")return;let a=r.attrs.cellMarker;a?.info?.revisionId===t&&n.push({pos:s,node:r,cellKind:a.kind});}),n}function M(e,t){return (n,r)=>{let s=Ve(n,e),a=Ue(n,e),o=$e(n,e),i=Ke(n,e),c=Ye(n,e);if(s.length===0&&a.length===0&&o.length===0&&i.length===0&&c.length===0)return false;if(!r)return true;let l=n.tr;l.setMeta(g,true);let b=n.schema.marks.insertion,h=n.schema.marks.deletion,y=[...a].sort((u,d)=>d.from-u.from);for(let u of y){let d=u.markName==="insertion";if(t==="accept"&&!d||t==="reject"&&d)l.delete(u.from,u.to);else {let C=d?b:h;C&&l.removeMark(u.from,u.to,C);}}let S=[...s].sort((u,d)=>d.pos-u.pos);for(let u of S){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="paragraph")continue;let C=u.kind==="pPrIns"&&f.attrs.pPrIns?.revisionId===e,p=u.kind==="pPrDel"&&f.attrs.pPrDel?.revisionId===e;if(!C&&!p)continue;if(t==="reject"&&u.kind==="pPrIns"||t==="accept"&&u.kind==="pPrDel"){let T=d+f.nodeSize,R=l.doc.nodeAt(T);!R||R.type.name!=="paragraph"?N(l,d,u.kind):(N(l,d,u.kind),Ge(l,d));}else N(l,d,u.kind);}let x=[...o].sort((u,d)=>d.pos-u.pos);for(let u of x){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="paragraph")continue;let C=f.attrs.pPrChange;if(!Array.isArray(C))continue;let p=C.findIndex(g=>g.info.id===e);if(!(p<0))if(t==="reject"&&u.prior){let g=Je(f.attrs,u.prior,u.current),T=C.slice();T.splice(p,1),l.setNodeMarkup(d,void 0,{...g,pPrChange:T.length>0?T:null});}else Xe(l,d,p);}let w=[...c].sort((u,d)=>d.pos-u.pos);for(let u of w){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="tableCell"&&f.type.name!=="tableHeader")continue;let C=f.attrs.cellMarker;!C||C.info.revisionId!==e||l.setNodeMarkup(d,void 0,{...f.attrs,cellMarker:null});}let k=[...i].sort((u,d)=>d.pos-u.pos);for(let u of k){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="tableRow")continue;let C=f.attrs.trIns,p=f.attrs.trDel,g=C?.revisionId===e,T=p?.revisionId===e;if(!g&&!T)continue;if(t==="reject"&&g||t==="accept"&&T){let v=l.doc.resolve(d+1),I=v.node(v.depth-1),P=v.before(v.depth-1);if(I?.type.name==="table"&&I.childCount>1)l.delete(d,d+f.nodeSize);else if(I?.type.name==="table")if(l.doc.resolve(P).parent.childCount===1){let J=l.doc.type.schema.nodes.paragraph;l.replaceWith(P,P+I.nodeSize,J.create());}else l.delete(P,P+I.nodeSize);else {let A={...f.attrs};g&&(A.trIns=null),T&&(A.trDel=null),l.setNodeMarkup(d,void 0,A);}}else {let v={...f.attrs};g&&(v.trIns=null),T&&(v.trDel=null),l.setNodeMarkup(d,void 0,v);}}return l.steps.length===0?false:(r(l),true)}}function qe(e){return M(e,"accept")}function Qe(e){return M(e,"reject")}function X(e,t){let n=e.schema.marks.insertion,r=e.schema.marks.deletion;if(!n&&!r)return null;let s=null;return e.doc.descendants((a,o)=>{if(a.isInline){if(o>=t)return false;for(let i of a.marks)(i.type===n||i.type===r)&&(s={from:o,to:o+a.nodeSize,type:i.type===n?"insertion":"deletion"});}}),!s&&t<e.doc.content.size?X(e,e.doc.content.size):s}function Ze(e){return e.doc.attrs.watermark??null}function et(e){return (t,n)=>(n&&n(t.tr.setDocAttribute("watermark",e)),true)}export{Ie as A,Pe as B,Ae as C,Ee as D,Me as E,Re as F,Ne as G,Be as H,O as I,V as J,We as K,De as L,Le as M,ze as N,He as O,je as P,_e as Q,Oe as R,G as S,qe as T,Qe as U,X as V,Ze as W,et as X,Q as a,Z as b,re as c,ne as d,oe as e,ae as f,ie as g,se as h,le as i,ce as j,de as k,ue as l,pe as m,me as n,fe as o,ge as p,be as q,he as r,ye as s,Ce as t,Te as u,Se as v,ke as w,ve as x,xe as y,we as z};
|
|
1
|
+
import {e,b,c,a as a$1}from'./chunk-KQTB5Y7P.mjs';import {a}from'./chunk-NO6PIL32.mjs';import {i,g}from'./chunk-MJ6XZFVD.mjs';import {TextSelection}from'prosemirror-state';function _(e){let{$from:t}=e.selection,n=null,r=null,s=null,a=-1,o=-1;for(let i=t.depth;i>0;i--){let c=t.node(i);if(c.type.name==="tableCell"||c.type.name==="tableHeader"){s=c;let l=t.node(i-1);if(l?.type.name==="tableRow"){let b=0;l.forEach((h,y,S)=>{if(o===-1){if(S===t.index(i-1)){o=b;return}b+=h.attrs.colspan||1;}});}}else if(c.type.name==="tableRow")t.node(i-1)?.type.name==="table"&&(a=t.index(i-1));else if(c.type.name==="table"){n=c,r=t.before(i);break}}return !n||r==null||!s||a<0||o<0?null:{table:n,tablePos:r,cell:s,row:a,col:o,rowspan:s.attrs.rowspan||1,colspan:s.attrs.colspan||1}}function H(e){let t=[],n=[],r=0;for(let s=0;s<e.childCount;s++){let a=e.child(s),o=0;a.forEach(i=>{for(;t[s]?.[o];)o++;let c=i.attrs.rowspan||1,l=i.attrs.colspan||1;n.push({data:i,row:s,col:o,rowspan:c,colspan:l});for(let b=s;b<s+c;b++){let h=t[b]??[];t[b]=h;for(let y=o;y<o+l;y++)h[y]=true;}o+=l,r=Math.max(r,o);});}return {anchors:n,totalCols:r}}function j(e,t,n,r,s){let a={...e.attrs},o=s.reduce((l,b)=>l+b,0),i=a$1(s,t,n),c=n!==(e.attrs.colspan||1)||r!==(e.attrs.rowspan||1);return a.colspan=n,a.rowspan=r,a.colwidth=null,o>0&&(a.width=Math.round(i/o*5e3),a.widthType="pct"),c&&(a._originalFormatting=null),a}function Y(e,t,n,r){let s=t+1;for(let a=0;a<e.childCount;a++){let o=e.child(a),i=s+1,c=0;for(let l=0;l<o.childCount;l++){let b=o.child(l);if(a===n&&c===r)return i;c+=b.attrs.colspan||1,i+=b.nodeSize;}s+=o.nodeSize;}return null}function q(e,t){let n=e.attrs.width??9360;return Array.isArray(e.attrs.columnWidths)&&e.attrs.columnWidths.length>0?[...e.attrs.columnWidths]:Array.from({length:t},()=>Math.floor(n/Math.max(t,1)))}function Q(e$1){let t=_(e$1);return t?{...e(t.rowspan,t.colspan),capturedCellRow:t.row,capturedCellCol:t.col}:null}function Z(e,t,n,r,s,a){if(n<1||r<1)return false;let o=_(e);if(!o||!t)return false;let i=o;if(s!=null&&a!=null&&(s!==o.row||a!==o.col)){let{anchors:p}=H(o.table),g=p.find(T=>T.row===s&&T.col===a);if(!g)return false;i={...o,cell:g.data,row:g.row,col:g.col,rowspan:g.rowspan,colspan:g.colspan};}if(n<i.rowspan||r<i.colspan||n===1&&r===1)return false;let{anchors:c$1,totalCols:l}=H(i.table),b$1=q(i.table,l),h=b(b$1,i.col,i.colspan,r),y=c$1.find(p=>p.row===i.row&&p.col===i.col);if(!y)return false;let S=c(c$1,y,n,r,i.table.childCount,p=>{if(p)return y.data;let g=y.data.type.schema.nodes.paragraph.create(),T=j(y.data,0,1,1,h);return y.data.type.create(T,g)}),x=i.row+i.rowspan,w=Array.from({length:S.newRowCount},(p,g)=>g<x?{...i.table.child(g)?.attrs??{}}:g<i.row+n?{...i.table.child(x-1)?.attrs??{}}:{...i.table.child(g-S.deltaRows)?.attrs??{}}),k=Array.from({length:S.newRowCount},()=>[]);S.anchors.sort((p,g)=>p.row===g.row?p.col-g.col:p.row-g.row).forEach(p=>{let g=j(p.data,p.col,p.colspan,p.rowspan,h);k[p.row].push(p.data.type.create(g,p.data.content));});let u=k.map((p,g)=>i.table.type.schema.nodes.tableRow.create(w[g],p)),d=i.table.type.create({...i.table.attrs,columnWidths:h},u),f=e.tr.replaceWith(i.tablePos,i.tablePos+i.table.nodeSize,d),C=f.doc.nodeAt(i.tablePos);if(C){let p=Y(C,i.tablePos,i.row,i.col);p!=null&&(f=f.setSelection(TextSelection.near(f.doc.resolve(p+1))));}return t(f.scrollIntoView()),true}var m=a.getCommands();function re(e,t){return m.insertTable(e,t)}function ne(e,t){return m.addRowAbove()(e,t)}function oe(e,t){return m.addRowBelow()(e,t)}function ae(e,t){return m.deleteRow()(e,t)}function ie(e,t){return m.addColumnLeft()(e,t)}function se(e,t){return m.addColumnRight()(e,t)}function le(e,t){return m.deleteColumn()(e,t)}function ce(e,t){return m.deleteTable()(e,t)}function de(e,t){return m.selectTable()(e,t)}function ue(e,t){return m.selectRow()(e,t)}function pe(e,t){return m.selectColumn()(e,t)}function me(e,t){return m.mergeCells()(e,t)}function fe(e,t){return m.splitCell()(e,t)}function ge(e,t,n){return m.setCellBorder(e,t,n)}function be(e,t){return m.setTableBorders(e,t)}function he(e,t){return m.removeTableBorders()(e,t)}function ye(e,t,n){return m.setAllTableBorders(n)(e,t)}function Ce(e,t,n){return m.setOutsideTableBorders(n)(e,t)}function Te(e,t,n){return m.setInsideTableBorders(n)(e,t)}function Se(e){return m.setCellVerticalAlign(e)}function ke(e){return m.setCellMargins(e)}function ve(e){return m.setCellTextDirection(e)}function xe(){return m.toggleNoWrap()}function we(e,t){return m.setRowHeight(e,t)}function Ie(){return m.toggleHeaderRow()}function Pe(){return m.distributeColumns()}function Ae(){return m.autoFitContents()}function Ee(e){return m.setTableProperties(e)}function Me(e){return m.applyTableStyle(e)}function Re(e){return m.setCellFillColor(e)}function Ne(e){return m.setTableBorderColor(e)}function Be(e){return m.setTableBorderWidth(e)}var Fe=a.getCommands();function O(e,t,n,r){if(!t)return true;let s=e.tr.insert(r,n),a=i(e),o=e.schema.marks.insertion;return a&&o&&s.addMark(r,r+n.nodeSize,o.create({revisionId:a.revisionId,author:a.author,date:a.date})),t(s.scrollIntoView()),true}var V=612;function We(e,t,n){let r=n?.maxWidth??V,s=new FileReader;s.onload=()=>{let a=s.result,o=new Image;o.onload=()=>{let i=o.naturalWidth,c=o.naturalHeight;i>r&&(c=Math.round(c*(r/i)),i=r);let l=e.state.schema.nodes.image.create({src:a,alt:t.name,width:i,height:c,rId:`rId_img_${Date.now()}_${Math.round(Math.random()*1e9)}`,wrapType:"inline",displayMode:"inline"});O(e.state,e.dispatch,l,e.state.selection.from),e.focus(),n?.onInserted?.();},o.onerror=()=>n?.onError?.(new Error("Failed to decode image")),o.src=a;},s.onerror=()=>n?.onError?.(s.error),s.readAsDataURL(t);}function De(e,t,n){return Fe.setImageWrapType(e,t,n)}function Le(e){return (t,n)=>{let{from:r,to:s,empty:a}=t.selection;if(a)return false;let o=t.schema.marks.comment;if(!o)return false;if(n){let i=t.tr.addMark(r,s,o.create({commentId:e}));n(i);}return true}}function ze(e){return (t,n)=>{let r=t.schema.marks.comment;if(!r)return false;if(n){let s=t.tr;t.doc.descendants((a,o)=>{if(a.isText)for(let i of a.marks)i.type===r&&i.attrs.commentId===e&&s.removeMark(o,o+a.nodeSize,i);}),s.steps.length>0&&n(s);}return true}}function $(e,t,n){return (r,s)=>{let a=r.schema.marks.insertion,o=r.schema.marks.deletion;if(!a&&!o)return false;let i=n==="accept"?a:o,c=n==="accept"?o:a;if(s){let l=r.tr,b=[];r.doc.nodesBetween(e,t,(h,y)=>{if(!h.isInline)return;let S=y+h.nodeSize,x=Math.max(e,y),w=Math.min(t,S);c&&h.marks.some(k=>k.type===c)&&b.push({from:x,to:w}),i&&h.marks.some(k=>k.type===i)&&l.removeMark(x,w,i);});for(let h of b.reverse())l.delete(h.from,h.to);l.steps.length>0&&s(l);}return true}}function He(e,t){return $(e,t,"accept")}function je(e,t){return $(e,t,"reject")}function U(e){let t=new Set,n=[],r=o=>{typeof o=="number"&&!t.has(o)&&(t.add(o),n.push(o));},s=e.schema.marks.insertion,a=e.schema.marks.deletion;return e.doc.descendants(o=>{if(o.type.name==="paragraph"){r(o.attrs.pPrIns?.revisionId),r(o.attrs.pPrDel?.revisionId);let i=o.attrs.pPrChange;if(Array.isArray(i))for(let c of i)r(c.info.id);}if(o.type.name==="tableRow"){r(o.attrs.trIns?.revisionId),r(o.attrs.trDel?.revisionId);let i=o.attrs.trPrChange;if(Array.isArray(i))for(let c of i)r(c.info.id);}if(o.type.name==="tableCell"||o.type.name==="tableHeader"){let i=o.attrs.cellMarker;r(i?.info?.revisionId);let c=o.attrs.tcPrChange;if(Array.isArray(c))for(let l of c)r(l.info.id);}if(o.type.name==="table"){let i=o.attrs.tblPrChange;if(Array.isArray(i))for(let c of i)r(c.info.id);}if(o.isInline)for(let i of o.marks)(s&&i.type===s||a&&i.type===a)&&r(i.attrs.revisionId);}),n}function _e(){return (e,t)=>{let n=U(e);if(n.length===0)return false;if(!t)return true;let r=e,s=a=>{t(a),r=r.apply(a);};for(let a of n)M(a,"accept")(r,s);return true}}function Oe(){return (e,t)=>{let n=U(e);if(n.length===0)return false;if(!t)return true;let r=e,s=a=>{t(a),r=r.apply(a);};for(let a of n)M(a,"reject")(r,s);return true}}function G(e,t){let n=e.schema.marks.insertion,r=e.schema.marks.deletion;if(!n&&!r)return null;let s=null;return e.doc.descendants((a,o)=>{if(s)return false;if(a.isInline&&!(o+a.nodeSize<=t)){for(let i of a.marks)if(i.type===n||i.type===r)return s={from:Math.max(o,t),to:o+a.nodeSize,type:i.type===n?"insertion":"deletion"},false}}),!s&&t>0?G(e,0):s}function Ve(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="paragraph")return;let a=r.attrs.pPrIns,o=r.attrs.pPrDel;a&&a.revisionId===t&&n.push({pos:s,node:r,kind:"pPrIns"}),o&&o.revisionId===t&&n.push({pos:s,node:r,kind:"pPrDel"});}),n}function $e(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="paragraph")return;let a=r.attrs.pPrChange;Array.isArray(a)&&a.forEach((o,i)=>{!o?.info||typeof o.info.id!="number"||o.info.id===t&&n.push({pos:s,node:r,entryIndex:i,prior:o.previousFormatting,current:o.currentFormatting});});}),n}function Ue(e,t){let n=[],r=e.schema.marks.insertion,s=e.schema.marks.deletion;return e.doc.descendants((a,o)=>{if(a.isInline){for(let i of a.marks)if((r&&i.type===r||s&&i.type===s)&&i.attrs.revisionId===t){let c=i.type===r?"insertion":"deletion",l=n[n.length-1];l&&l.markName===c&&l.to===o?l.to=o+a.nodeSize:n.push({from:o,to:o+a.nodeSize,markName:c});}}}),n}function Ge(e,t,n){let r=e.doc.nodeAt(t);if(!r)return;let s=t+r.nodeSize,a=e.doc.nodeAt(s);!a||a.type.name!=="paragraph"||(e.setNodeMarkup(t,void 0,{...a.attrs,pPrIns:null,pPrDel:null}),e.join(s));}function N(e,t,n){let r=e.doc.nodeAt(t);if(!r)return;let s={...r.attrs};s[n]=null,e.setNodeMarkup(t,void 0,s);}function Xe(e,t,n){let r=e.doc.nodeAt(t);if(!r)return;let s=r.attrs.pPrChange;if(!Array.isArray(s)||n<0||n>=s.length)return;let a=s.slice();a.splice(n,1),e.setNodeMarkup(t,void 0,{...r.attrs,pPrChange:a.length>0?a:null});}function Je(e,t,n){let r={...e},s=["alignment","spaceBefore","spaceAfter","lineSpacing","lineSpacingRule","beforeAutospacing","afterAutospacing","spacingExplicit","indentLeft","indentRight","indentFirstLine","hangingIndent","styleId","borders","shading","tabs","pageBreakBefore","keepNext","keepLines","contextualSpacing","bidi","outlineLevel","numPr"];for(let a of s)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a]??null);return n?.numPr&&!Object.prototype.hasOwnProperty.call(t,"numPr")&&(r.numPr=null),r.numPr==null&&(r.listIsBullet=null,r.listNumFmt=null,r.listMarker=null),r}function Ke(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="tableRow")return;let a=r.attrs.trIns,o=r.attrs.trDel;a&&a.revisionId===t&&n.push({pos:s,node:r,kind:"trIns"}),o&&o.revisionId===t&&n.push({pos:s,node:r,kind:"trDel"});}),n}function Ye(e,t){let n=[];return e.doc.descendants((r,s)=>{if(r.type.name!=="tableCell"&&r.type.name!=="tableHeader")return;let a=r.attrs.cellMarker;a?.info?.revisionId===t&&n.push({pos:s,node:r,cellKind:a.kind});}),n}function M(e,t){return (n,r)=>{let s=Ve(n,e),a=Ue(n,e),o=$e(n,e),i=Ke(n,e),c=Ye(n,e);if(s.length===0&&a.length===0&&o.length===0&&i.length===0&&c.length===0)return false;if(!r)return true;let l=n.tr;l.setMeta(g,true);let b=n.schema.marks.insertion,h=n.schema.marks.deletion,y=[...a].sort((u,d)=>d.from-u.from);for(let u of y){let d=u.markName==="insertion";if(t==="accept"&&!d||t==="reject"&&d)l.delete(u.from,u.to);else {let C=d?b:h;C&&l.removeMark(u.from,u.to,C);}}let S=[...s].sort((u,d)=>d.pos-u.pos);for(let u of S){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="paragraph")continue;let C=u.kind==="pPrIns"&&f.attrs.pPrIns?.revisionId===e,p=u.kind==="pPrDel"&&f.attrs.pPrDel?.revisionId===e;if(!C&&!p)continue;if(t==="reject"&&u.kind==="pPrIns"||t==="accept"&&u.kind==="pPrDel"){let T=d+f.nodeSize,R=l.doc.nodeAt(T);!R||R.type.name!=="paragraph"?N(l,d,u.kind):(N(l,d,u.kind),Ge(l,d));}else N(l,d,u.kind);}let x=[...o].sort((u,d)=>d.pos-u.pos);for(let u of x){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="paragraph")continue;let C=f.attrs.pPrChange;if(!Array.isArray(C))continue;let p=C.findIndex(g=>g.info.id===e);if(!(p<0))if(t==="reject"&&u.prior){let g=Je(f.attrs,u.prior,u.current),T=C.slice();T.splice(p,1),l.setNodeMarkup(d,void 0,{...g,pPrChange:T.length>0?T:null});}else Xe(l,d,p);}let w=[...c].sort((u,d)=>d.pos-u.pos);for(let u of w){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="tableCell"&&f.type.name!=="tableHeader")continue;let C=f.attrs.cellMarker;!C||C.info.revisionId!==e||l.setNodeMarkup(d,void 0,{...f.attrs,cellMarker:null});}let k=[...i].sort((u,d)=>d.pos-u.pos);for(let u of k){let d=l.mapping.map(u.pos),f=l.doc.nodeAt(d);if(!f||f.type.name!=="tableRow")continue;let C=f.attrs.trIns,p=f.attrs.trDel,g=C?.revisionId===e,T=p?.revisionId===e;if(!g&&!T)continue;if(t==="reject"&&g||t==="accept"&&T){let v=l.doc.resolve(d+1),I=v.node(v.depth-1),P=v.before(v.depth-1);if(I?.type.name==="table"&&I.childCount>1)l.delete(d,d+f.nodeSize);else if(I?.type.name==="table")if(l.doc.resolve(P).parent.childCount===1){let J=l.doc.type.schema.nodes.paragraph;l.replaceWith(P,P+I.nodeSize,J.create());}else l.delete(P,P+I.nodeSize);else {let A={...f.attrs};g&&(A.trIns=null),T&&(A.trDel=null),l.setNodeMarkup(d,void 0,A);}}else {let v={...f.attrs};g&&(v.trIns=null),T&&(v.trDel=null),l.setNodeMarkup(d,void 0,v);}}return l.steps.length===0?false:(r(l),true)}}function qe(e){return M(e,"accept")}function Qe(e){return M(e,"reject")}function X(e,t){let n=e.schema.marks.insertion,r=e.schema.marks.deletion;if(!n&&!r)return null;let s=null;return e.doc.descendants((a,o)=>{if(a.isInline){if(o>=t)return false;for(let i of a.marks)(i.type===n||i.type===r)&&(s={from:o,to:o+a.nodeSize,type:i.type===n?"insertion":"deletion"});}}),!s&&t<e.doc.content.size?X(e,e.doc.content.size):s}function Ze(e){return e.doc.attrs.watermark??null}function et(e){return (t,n)=>(n&&n(t.tr.setDocAttribute("watermark",e)),true)}export{Ie as A,Pe as B,Ae as C,Ee as D,Me as E,Re as F,Ne as G,Be as H,O as I,V as J,We as K,De as L,Le as M,ze as N,He as O,je as P,_e as Q,Oe as R,G as S,qe as T,Qe as U,X as V,Ze as W,et as X,Q as a,Z as b,re as c,ne as d,oe as e,ae as f,ie as g,se as h,le as i,ce as j,de as k,ue as l,pe as m,me as n,fe as o,ge as p,be as q,he as r,ye as s,Ce as t,Te as u,Se as v,ke as w,ve as x,xe as y,we as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {t,w,q,y as y$1,o}from'./chunk-
|
|
1
|
+
import {t,w,q,y as y$1,o}from'./chunk-4QSFBX26.mjs';import {g}from'./chunk-KNY7SXPJ.mjs';import {a}from'./chunk-QYUPLKLP.mjs';var i={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},y=[`.${i.pageFloatingImage}`,`.${i.cellFloatingImage}`,`.${i.blockImage}`,`.${i.runImage}`].join(", ");function L(n){if(!(n instanceof Element))return null;let e=n.closest(y);if(!e)return null;let o=e.dataset.pmStart;if(o===void 0)return null;let t=Number(o);return Number.isNaN(t)?null:{pos:t,imageEl:e}}function b(n){if(!(n instanceof HTMLElement))return null;if(n.tagName==="IMG"&&n.classList.contains(i.runImage))return n;let e=n.closest(y);return e&&e.dataset.pmStart?e:null}function x(n,e=1){if(!n.classList.contains(i.runImage))return;let o=n.closest(`.${i.pageContent}`),t=n.closest(`.${i.paragraph}`);if(!o||!t)return;let r=n.getBoundingClientRect(),a=o.getBoundingClientRect(),l=t.getBoundingClientRect(),p=e>0?e:1;return {horizontalEmu:Math.round(g((r.left-a.left)/p)),verticalEmu:Math.round(g((r.top-l.top)/p))}}function T(n,e){return n==="inline"?"inline":n==="behind"?"behind":n==="inFront"?"inFront":n==="square"||n==="tight"||n==="through"?e==="right"?"squareRight":"squareLeft":null}var k=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function I(n,e){return true}function E(n){switch(n){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function X(n,e){let o=new Map;for(let t=0;t<n.length;t++){let r=n[t],a=e[t];r&&a&&o.set(String(r.id),{block:r,measure:a});}return o}var c=class{constructor(e={}){a(this,"container",null);a(this,"blockLookup",new Map);a(this,"pageStates",[]);a(this,"totalPages",0);a(this,"options");a(this,"doc");a(this,"resolvedCommentIds",new Set);this.options=e,this.doc=e.document??document;}setBlockLookup(e){this.blockLookup=e;}mount(e){this.container=e,this.applyContainerStyles();}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[];}applyContainerStyles(){if(!this.container)return;let e=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${e}px`,this.container.style.padding=`${e}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%";}paint(e){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:o}=e;this.totalPages=o.length,this.container.innerHTML="",this.pageStates=[];for(let t=0;t<o.length;t++){let r=o[t],a={pageNumber:r.number,totalPages:this.totalPages,section:"body",resolvedCommentIds:this.resolvedCommentIds},l=this.renderPageWithLookup(r,a);this.container.appendChild(l),this.pageStates.push({element:l,pageNumber:r.number,fragmentCount:r.fragments.length});}}renderPageWithLookup(e,o){let t=this.doc.createElement("div");t.className="layout-page",t.dataset.pageNumber=String(e.number),t.style.position="relative",t.style.width=`${e.size.w}px`,t.style.height=`${e.size.h}px`,t.style.backgroundColor=this.options.pageBackground??"var(--doc-page-bg, #ffffff)",t.style.color="var(--doc-page-text, #000000)",t.style.overflow="hidden",this.options.showShadow&&(t.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let r=this.doc.createElement("div");r.className="layout-page-content",r.style.position="absolute",r.style.top=`${e.margins.top}px`,r.style.left=`${e.margins.left}px`,r.style.right=`${e.margins.right}px`,r.style.bottom=`${e.margins.bottom}px`,r.style.overflow="visible";for(let a of e.fragments){let l=this.renderFragmentWithLookup(a,o);this.applyFragmentPosition(l,a),r.appendChild(l);}return t.appendChild(r),t}renderFragmentWithLookup(e,o$1){let t$1=this.blockLookup.get(String(e.blockId));if(e.kind==="paragraph"&&t$1){let r=t$1.block,a=t$1.measure;return t(e,r,a,o$1,{document:this.doc})}if(e.kind==="table"&&t$1){let r=t$1.block,a=t$1.measure;return w(e,r,a,o$1,{document:this.doc})}if(e.kind==="image"&&t$1){let r=t$1.block,a=t$1.measure;return q(e,r,a,o$1,{document:this.doc})}if(e.kind==="textBox"&&t$1){let r=t$1.block,a=t$1.measure;return y$1(e,r,a,o$1,{document:this.doc})}return o(e,o$1,{document:this.doc})}applyFragmentPosition(e,o){e.style.position="absolute",e.style.left=`${o.x}px`,e.style.top=`${o.y}px`,e.style.width=`${o.width}px`,"height"in o&&(e.style.height=`${o.height}px`);}getPageCount(){return this.totalPages}getPageElement(e){return this.pageStates[e]?.element??null}scrollToPage(e){let o=this.pageStates.find(t=>t.pageNumber===e);o?.element&&o.element.scrollIntoView({behavior:"smooth",block:"start"});}};function Z(n){return new c(n)}export{i as a,L as b,b as c,x as d,T as e,k as f,I as g,E as h,X as i,c as j,Z as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk34DJT72K_js=require('./chunk-34DJT72K.js'),chunkRQVHKDXK_js=require('./chunk-RQVHKDXK.js'),chunkBJSG6TEG_js=require('./chunk-BJSG6TEG.js');function D(t){return t.attrs.href||""}function H(t){let e=t.filter(n=>n.type.name!=="hyperlink");return e.length===0?"":e.map(n=>`${n.type.name}:${JSON.stringify(n.attrs)}`).sort().join("|")}function k(t){let e={};for(let n of t)switch(n.type.name){case "bold":e.bold=true,e.boldCs=true;break;case "italic":e.italic=true,e.italicCs=true;break;case "underline":{let o=n.attrs;e.underline={style:o.style||"single",color:o.color};break}case "strike":n.attrs.double?e.doubleStrike=true:e.strike=true;break;case "textColor":{let o=n.attrs;e.color={rgb:o.rgb,themeColor:o.themeColor,themeTint:o.themeTint,themeShade:o.themeShade};break}case "highlight":e.highlight=n.attrs.color;break;case "fontSize":e.fontSize=n.attrs.size,e.fontSizeCs=n.attrs.size;break;case "fontFamily":{let o=n.attrs;e.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,eastAsia:o.eastAsia||void 0,cs:o.cs||o.ascii||void 0,asciiTheme:o.asciiTheme,hAnsiTheme:o.hAnsiTheme||void 0,eastAsiaTheme:o.eastAsiaTheme||void 0,csTheme:o.csTheme||void 0};break}case "superscript":e.vertAlign="superscript";break;case "subscript":e.vertAlign="subscript";break;case "allCaps":e.allCaps=true;break;case "smallCaps":e.smallCaps=true;break;case "characterSpacing":{n.attrs.spacing!=null&&(e.spacing=n.attrs.spacing),n.attrs.position!=null&&(e.position=n.attrs.position),n.attrs.scale!=null&&(e.scale=n.attrs.scale),n.attrs.kerning!=null&&(e.kerning=n.attrs.kerning);break}case "emboss":e.emboss=true;break;case "imprint":e.imprint=true;break;case "textShadow":e.shadow=true;break;case "emphasisMark":e.emphasisMark=n.attrs.type||"dot";break;case "textOutline":e.outline=true;break;case "hidden":e.hidden=true;break;case "rtl":e.rtl=true;break;case "textEffect":e.effect=n.attrs.effect||"blinkBackground";break;case "runStyle":n.attrs.styleId&&(e.styleId=n.attrs.styleId);break}return e}function W(t){let e=t.attrs.href;return e?.startsWith("#")?{type:"hyperlink",anchor:e.substring(1),tooltip:t.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:e,tooltip:t.attrs.tooltip||void 0,rId:t.attrs.rId||void 0,children:[]}}function P(t,e){let n=e.marks.filter(o=>o.type.name!=="hyperlink");e.isText&&e.text?t.children.push(M(e.text,n)):e.type.name==="tab"?t.children.push(v()):e.type.name==="hardBreak"&&t.children.push(w());}function M(t,e){let n=k(e),o={type:"text",text:t};return {type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[o]}}function j(t,e){let n=t.content[t.content.length-1];n&&n.type==="text"?n.text+=e:t.content.push({type:"text",text:e});}function w(){return {type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function v(){return {type:"run",content:[{type:"tab"}]}}function z(t,e){let n=t.attrs,o=e&&e.length>0?k(e):void 0,i=n.displayText||"";if(!i)switch(n.fieldType){case "PAGE":i="1";break;case "NUMPAGES":i="1";break;default:i=" ";break}let r={type:"run",content:[{type:"text",text:i}],...o&&Object.keys(o).length>0?{formatting:o}:{}};return n.fieldKind==="complex"?{type:"complexField",instruction:n.instruction,fieldType:n.fieldType,fieldCode:[],fieldResult:[r],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}:{type:"simpleField",instruction:n.instruction,fieldType:n.fieldType,content:[r],fldLock:n.fldLock||void 0,dirty:n.dirty||void 0}}function V(t){let e=t.attrs;return {type:"mathEquation",display:e.display||"inline",ommlXml:e.ommlXml,plainText:e.plainText||void 0}}function R(t){let e=t.attrs,o={type:e.wrapType||"inline"};e.distTop!==void 0&&(o.distT=chunkBJSG6TEG_js.g(e.distTop)),e.distBottom!==void 0&&(o.distB=chunkBJSG6TEG_js.g(e.distBottom)),e.distLeft!==void 0&&(o.distL=chunkBJSG6TEG_js.g(e.distLeft)),e.distRight!==void 0&&(o.distR=chunkBJSG6TEG_js.g(e.distRight)),e.wrapText&&(o.wrapText=e.wrapText);let i={type:"image",rId:e.rId||"",src:e.src,alt:e.alt||void 0,title:e.title||void 0,size:{width:chunkBJSG6TEG_js.g(e.width||0),height:chunkBJSG6TEG_js.g(e.height||0)},wrap:o};if(e.transform){let a=e.transform,l={},p=a.match(/rotate\(([-\d.]+)deg\)/);p&&(l.rotation=parseFloat(p[1])),a.includes("scaleX(-1)")&&(l.flipH=true),a.includes("scaleY(-1)")&&(l.flipV=true),(l.rotation||l.flipH||l.flipV)&&(i.transform=l);}if(e.position?.horizontal&&e.position?.vertical){let a=e.position;i.position={horizontal:{relativeTo:a.horizontal.relativeTo||"column",alignment:a.horizontal.align,posOffset:a.horizontal.posOffset},vertical:{relativeTo:a.vertical.relativeTo||"paragraph",alignment:a.vertical.align,posOffset:a.vertical.posOffset}};}if(e.borderWidth&&e.borderWidth>0){let a={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};i.outline={width:chunkBJSG6TEG_js.g(e.borderWidth),color:e.borderColor?{rgb:e.borderColor.replace("#","")}:void 0,style:e.borderStyle&&a[e.borderStyle]||"solid"};}if(e.hlinkHref&&(i.hlinkHref=e.hlinkHref),e.cropTop!==void 0||e.cropRight!==void 0||e.cropBottom!==void 0||e.cropLeft!==void 0){let a={};e.cropTop!==void 0&&e.cropTop!==null&&(a.top=e.cropTop),e.cropRight!==void 0&&e.cropRight!==null&&(a.right=e.cropRight),e.cropBottom!==void 0&&e.cropBottom!==null&&(a.bottom=e.cropBottom),e.cropLeft!==void 0&&e.cropLeft!==null&&(a.left=e.cropLeft),Object.keys(a).length>0&&(i.crop=a);}if(e.opacity!==void 0&&e.opacity!==null&&e.opacity<1&&(i.opacity=e.opacity),e.layoutInCell!==void 0&&e.layoutInCell!==null&&(i.layoutInCell=e.layoutInCell),e.allowOverlap!==void 0&&e.allowOverlap!==null&&(i.allowOverlap=e.allowOverlap),e.effectExtentTop||e.effectExtentBottom||e.effectExtentLeft||e.effectExtentRight){let a={};e.effectExtentTop&&(a.top=chunkBJSG6TEG_js.g(e.effectExtentTop)),e.effectExtentBottom&&(a.bottom=chunkBJSG6TEG_js.g(e.effectExtentBottom)),e.effectExtentLeft&&(a.left=chunkBJSG6TEG_js.g(e.effectExtentLeft)),e.effectExtentRight&&(a.right=chunkBJSG6TEG_js.g(e.effectExtentRight)),Object.keys(a).length>0&&(i.padding=a);}return {type:"run",content:[{type:"drawing",image:i}]}}function S(t){let e=t.attrs,n={type:"shape",shapeType:e.shapeType||"rect",id:e.shapeId||void 0,size:{width:e.width?chunkBJSG6TEG_js.g(e.width):0,height:e.height?chunkBJSG6TEG_js.g(e.height):0}};if(e.fillType==="gradient"&&e.gradientStops)try{let i=JSON.parse(e.gradientStops);n.fill={type:"gradient",gradient:{type:e.gradientType||"linear",angle:e.gradientAngle||void 0,stops:i.map(r=>({position:r.position,color:{rgb:r.color.replace("#","")}}))}};}catch{n.fill={type:"solid",color:{rgb:(e.fillColor||"000000").replace("#","")}};}else e.fillColor?n.fill={type:e.fillType||"solid",color:{rgb:e.fillColor.replace("#","")}}:e.fillType==="none"&&(n.fill={type:"none"});if(e.outlineWidth&&e.outlineWidth>0){let i={solid:"solid",dotted:"dot",dashed:"dash"};n.outline={width:chunkBJSG6TEG_js.g(e.outlineWidth),color:e.outlineColor?{rgb:e.outlineColor.replace("#","")}:void 0,style:e.outlineStyle&&i[e.outlineStyle]||"solid"};}return {type:"run",content:[{type:"shape",shape:n}]}}function T(t){let e=t.attrs,n=J($(t),t),o=e.bookmarks;if(o&&o.length>0){let r=o.map(l=>({type:"bookmarkStart",id:l.id,name:l.name})),a=o.map(l=>({type:"bookmarkEnd",id:l.id}));n=[...r,...n,...a];}let i={type:"paragraph",paraId:e.paraId||void 0,textId:e.textId||void 0,formatting:q(e),content:n};return e.renderedPageBreakBefore&&(i.renderedPageBreakBefore=true),e.pPrIns&&(i.pPrIns={id:e.pPrIns.revisionId,author:e.pPrIns.author,...e.pPrIns.date?{date:e.pPrIns.date}:{}}),e.pPrDel&&(i.pPrDel={id:e.pPrDel.revisionId,author:e.pPrDel.author,...e.pPrDel.date?{date:e.pPrDel.date}:{}}),e.pPrChange&&e.pPrChange.length>0&&(i.propertyChanges=e.pPrChange),e._sectionProperties?i.sectionProperties=e._sectionProperties:e.sectionBreakType&&(i.sectionProperties={sectionStart:e.sectionBreakType}),i}function J(t,e){let n=new Set;if(e.forEach(a=>{for(let l of a.marks)l.type.name==="comment"&&n.add(l.attrs.commentId);}),n.size===0)return t;let o=[],i=new Set,r=0;e.forEach(a=>{let l=new Set;for(let p of a.marks)p.type.name==="comment"&&l.add(p.attrs.commentId);for(let p of [...i])l.has(p)||(o.push({type:"commentRangeEnd",id:p}),i.delete(p));for(let p of l)i.has(p)||(o.push({type:"commentRangeStart",id:p}),i.add(p));r<t.length&&o.push(t[r]),r++;});for(let a of i)o.push({type:"commentRangeEnd",id:a});return o}function _(t){return t.numPrFromStyle!=null&&t.numPr!=null&&JSON.stringify(t.numPr)===JSON.stringify(t.numPrFromStyle)}function q(t){if(t._originalFormatting){let n=t._originalFormatting,o={...n};return t.alignment!==(n.alignment||void 0)&&(o.alignment=t.alignment||void 0),_(t)?(delete o.numPr,delete o.numPrFromStyle):t.numPr!==n.numPr&&JSON.stringify(t.numPr)!==JSON.stringify(n.numPr)&&(o.numPr=t.numPr||void 0,delete o.numPrFromStyle),t.styleId!==(n.styleId||void 0)&&(o.styleId=t.styleId||void 0),t.pageBreakBefore!==(n.pageBreakBefore||void 0)&&(o.pageBreakBefore=t.pageBreakBefore||void 0),t.bidi!==(n.bidi||void 0)&&(o.bidi=t.bidi||void 0),o}if(t.alignment||t.spaceBefore||t.spaceAfter||t.lineSpacing||t.indentLeft||t.indentRight||t.indentFirstLine||t.numPr||t.styleId||t.borders||t.shading||t.tabs||t.outlineLevel!=null||t.contextualSpacing||t.bidi)return {alignment:t.alignment||void 0,spaceBefore:t.spaceBefore||void 0,spaceAfter:t.spaceAfter||void 0,lineSpacing:t.lineSpacing||void 0,lineSpacingRule:t.lineSpacingRule||void 0,indentLeft:t.indentLeft||void 0,indentRight:t.indentRight||void 0,indentFirstLine:t.indentFirstLine||void 0,hangingIndent:t.hangingIndent||void 0,numPr:_(t)?void 0:t.numPr||void 0,styleId:t.styleId||void 0,borders:t.borders||void 0,shading:t.shading||void 0,tabs:t.tabs||void 0,outlineLevel:t.outlineLevel??void 0,contextualSpacing:t.contextualSpacing||void 0,bidi:t.bidi||void 0}}function $(t){let e=[],n=null,o=null,i=null;return t.forEach(r=>{let a=r.marks.find(d=>d.type.name==="footnoteRef");if(a){n&&(e.push(n),n=null,o=null),i&&(e.push(i),i=null);let f={type:a.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(a.attrs.id,10)||0};e.push({type:"run",content:[f]});return}let l=r.marks.find(d=>d.type.name==="insertion"),p=r.marks.find(d=>d.type.name==="deletion");if(l||p){n&&(e.push(n),n=null,o=null),i&&(e.push(i),i=null);let d=l||p,f;if(r.type.name==="image")f=R(r);else if(r.type.name==="shape")f=S(r);else {let h=r.marks.filter(g=>g.type.name!=="insertion"&&g.type.name!=="deletion"),m=k(h);f={type:"run",content:r.isText&&r.text?[{type:"text",text:r.text}]:[],...Object.keys(m).length>0?{formatting:m}:{}};}let c={id:d.attrs.revisionId,author:d.attrs.author||"Unknown",date:d.attrs.date||void 0},b=d.attrs.isMovePair===true;l?b?e.push({type:"moveTo",info:c,content:[f]}):e.push({type:"insertion",info:c,content:[f]}):b?e.push({type:"moveFrom",info:c,content:[f]}):e.push({type:"deletion",info:c,content:[f]});return}let s=r.marks.find(d=>d.type.name==="hyperlink");if(s){let d=D(s),f=i?.href||(i?.anchor?`#${i.anchor}`:"");i&&f===d?P(i,r):(n&&(e.push(n),n=null,o=null),i&&e.push(i),i=W(s),P(i,r));return}if(i&&(e.push(i),i=null),r.isText){let d=H(r.marks);n&&o===d?j(n,r.text||""):(n&&e.push(n),n=M(r.text||"",r.marks),o=d);}else r.type.name==="hardBreak"?(n&&(e.push(n),n=null,o=null),e.push(w())):r.type.name==="image"?(n&&(e.push(n),n=null,o=null),e.push(R(r))):r.type.name==="shape"?(n&&(e.push(n),n=null,o=null),e.push(S(r))):r.type.name==="tab"?(n&&(e.push(n),n=null,o=null),e.push(v())):r.type.name==="field"?(n&&(e.push(n),n=null,o=null),e.push(z(r,r.marks))):r.type.name==="sdt"?(n&&(e.push(n),n=null,o=null),e.push(U(r))):r.type.name==="math"&&(n&&(e.push(n),n=null,o=null),e.push(V(r)));}),n&&e.push(n),i&&e.push(i),e}function U(t){let e=chunk34DJT72K_js.b(t.attrs),o=$(t).filter(i=>i.type==="run"||i.type==="hyperlink"||i.type==="simpleField"||i.type==="complexField"||i.type==="inlineSdt"||i.type==="mathEquation");return {type:"inlineSdt",properties:e,content:o}}function X(t){for(let e of t)for(let n of e.cells){let o=n.formatting?.borders;if(o){let i=o.top||o.left||o.right||o.bottom||o.insideH||o.insideV;return i?{top:o.top??i,bottom:o.bottom??i,left:o.left??i,right:o.right??i,insideH:o.insideH??o.bottom??i,insideV:o.insideV??o.right??i}:void 0}}}function G(t){let e=[],n=[],o=0;for(let i=0;i<t.childCount;i++){let r=t.child(i),a=0;r.forEach(l=>{if(l.type.name!=="tableCell"&&l.type.name!=="tableHeader")return;for(;e[i]?.[a];)a++;let p=l.attrs.rowspan||1,s=l.attrs.colspan||1;n.push({row:i,col:a,rowspan:p,colspan:s,cell:ee(l)});for(let d=i;d<i+p;d++){let f=e[d]??[];e[d]=f;for(let c=a;c<a+s;c++)f[c]=true;}a+=s,o=Math.max(o,a);});}return {anchors:n,totalCols:o}}function Y(t){let e=new Map;t.forEach((o,i)=>{let r=0;for(let a of o.cells){let l=r;if(r+=a.formatting?.gridSpan??1,a.formatting?.vMerge){let p=e.get(l)??[];p.push({rowIndex:i,cell:a}),e.set(l,p);}}});let n=o=>{o.formatting&&(delete o.formatting.vMerge,Object.keys(o.formatting).length===0&&(o.formatting=void 0));};for(let o of e.values()){let i=null,r=0,a=-1,l=()=>{i&&r<2&&n(i),i=null,r=0;};for(let{rowIndex:p,cell:s}of o){let d=s.formatting?.vMerge;d==="restart"?(l(),i=s,r=1,a=p):d==="continue"&&(i&&p===a+1?(r++,a=p):(l(),n(s)));}l();}}function I(t){let e=t.attrs,{anchors:n,totalCols:o}=G(t),i=new Map,r=new Map;for(let s of n){i.set(`${s.row}-${s.col}`,s);for(let d=s.row;d<s.row+s.rowspan;d++)for(let f=s.col;f<s.col+s.colspan;f++)r.set(`${d}-${f}`,s);}let a=[];for(let s=0;s<t.childCount;s++){let d=t.child(s),f=[];for(let h=0;h<o;){let m=i.get(`${s}-${h}`);if(m){let y={...m.cell.formatting??{}};m.colspan>1?y.gridSpan=m.colspan:delete y.gridSpan,m.rowspan>1?y.vMerge="restart":y.vMerge!=="restart"&&y.vMerge!=="continue"&&delete y.vMerge,f.push({...m.cell,formatting:Object.keys(y).length?y:void 0}),h+=m.colspan;continue}let g=r.get(`${s}-${h}`);if(!g){h++;continue}let x={...g.cell.formatting??{}};g.colspan>1?x.gridSpan=g.colspan:delete x.gridSpan,x.vMerge="continue",f.push({...g.cell,content:[],formatting:x}),h+=g.colspan;}let c=d.attrs,b={type:"tableRow",formatting:Z(c),cells:f};c.trIns?b.structuralChange={type:"tableRowInsertion",info:{id:c.trIns.revisionId,author:c.trIns.author,...c.trIns.date?{date:c.trIns.date}:{}}}:c.trDel&&(b.structuralChange={type:"tableRowDeletion",info:{id:c.trDel.revisionId,author:c.trDel.author,...c.trDel.date?{date:c.trDel.date}:{}}}),c.trPrChange&&c.trPrChange.length>0&&(b.propertyChanges=c.trPrChange),a.push(b);}Y(a);let l=Q(e)||void 0;if(!l?.borders){let s=X(a);if(s)if(l)l.borders=s;else return {type:"table",columnWidths:e.columnWidths||void 0,formatting:{borders:s},rows:a}}let p={type:"table",columnWidths:e.columnWidths||void 0,formatting:l,rows:a};return e.tblPrChange&&e.tblPrChange.length>0&&(p.propertyChanges=e.tblPrChange),p}function Q(t){if(t._originalFormatting){let i=t._originalFormatting,r={...i};t.styleId!==(i.styleId||void 0)&&(r.styleId=t.styleId||void 0),t.justification!==(i.justification||void 0)&&(r.justification=t.justification||void 0),t.floating!==(i.floating||void 0)&&(r.floating=t.floating||void 0),t.tableLayout!==(i.layout||void 0)&&(r.layout=t.tableLayout||void 0),t.look!==(i.look||void 0)&&(r.look=t.look||void 0);let a=i.width?.value,l=i.width?.type;return (t.width!==a||t.widthType!==l)&&(t.width!=null||t.widthType?r.width={value:t.width??0,type:t.widthType||"dxa"}:r.width=void 0),t.cellMargins&&(r.cellMargins={top:t.cellMargins.top!=null?{value:t.cellMargins.top,type:"dxa"}:void 0,bottom:t.cellMargins.bottom!=null?{value:t.cellMargins.bottom,type:"dxa"}:void 0,left:t.cellMargins.left!=null?{value:t.cellMargins.left,type:"dxa"}:void 0,right:t.cellMargins.right!=null?{value:t.cellMargins.right,type:"dxa"}:void 0}),r}if(!(t.styleId||t.width!=null||t.widthType||t.justification||t.tableLayout||t.floating||t.cellMargins||t.look))return;let n=t.cellMargins?{top:t.cellMargins.top!=null?{value:t.cellMargins.top,type:"dxa"}:void 0,bottom:t.cellMargins.bottom!=null?{value:t.cellMargins.bottom,type:"dxa"}:void 0,left:t.cellMargins.left!=null?{value:t.cellMargins.left,type:"dxa"}:void 0,right:t.cellMargins.right!=null?{value:t.cellMargins.right,type:"dxa"}:void 0}:void 0,o;return (t.width!=null||t.widthType)&&(o={value:t.width??0,type:t.widthType||"dxa"}),{styleId:t.styleId||void 0,width:o,justification:t.justification||void 0,layout:t.tableLayout||void 0,floating:t.floating||void 0,cellMargins:n,look:t.look||void 0}}function Z(t){if(t._originalFormatting){let n=t._originalFormatting,o={...n};return t.height!==(n.height?.value||void 0)&&(o.height=t.height?{value:t.height,type:"dxa"}:void 0),t.heightRule!==(n.heightRule||void 0)&&(o.heightRule=t.heightRule||void 0),t.isHeader!==(n.header||void 0)&&(o.header=t.isHeader||void 0),o}if(t.height||t.isHeader)return {height:t.height?{value:t.height,type:"dxa"}:void 0,heightRule:t.heightRule||void 0,header:t.isHeader||void 0}}function ee(t){let e=t.attrs,n=[];t.forEach(i=>{i.type.name==="paragraph"?n.push(T(i)):i.type.name==="table"&&n.push(I(i));});let o={type:"tableCell",formatting:te(e),content:n};if(e.cellMarker){let i=e.cellMarker,r={id:i.info.revisionId,author:i.info.author,...i.info.date?{date:i.info.date}:{}};i.kind==="ins"?o.structuralChange={type:"tableCellInsertion",info:r}:i.kind==="del"?o.structuralChange={type:"tableCellDeletion",info:r}:o.structuralChange={type:"tableCellMerge",info:r,...i.vMerge?{vMerge:i.vMerge}:{},...i.vMergeOrig?{vMergeOrig:i.vMergeOrig}:{}};}return e.tcPrChange&&e.tcPrChange.length>0&&(o.propertyChanges=e.tcPrChange),o}function te(t){if(t._originalFormatting){let o=t._originalFormatting,i={...o};if(t.colspan>1&&(i.gridSpan=t.colspan),t.width!=null&&(i.width={value:t.width,type:t.widthType||"dxa"}),t.verticalAlign!==(o.verticalAlign||void 0)&&(i.verticalAlign=t.verticalAlign||void 0),t.backgroundColor?t._originalResolvedFill===t.backgroundColor&&o.shading?i.shading=o.shading:i.shading={fill:{rgb:t.backgroundColor}}:o.shading&&(i.shading=void 0),t.borders&&(i.borders=t.borders),t.margins){let r=t.margins,a={};r.top!=null&&(a.top={value:r.top,type:"dxa"}),r.bottom!=null&&(a.bottom={value:r.bottom,type:"dxa"}),r.left!=null&&(a.left={value:r.left,type:"dxa"}),r.right!=null&&(a.right={value:r.right,type:"dxa"}),i.margins=a;}return t.textDirection!==(o.textDirection||void 0)&&(i.textDirection=t.textDirection||void 0),i}if(!(t.colspan>1||t.rowspan>1||t.width!=null||t.verticalAlign||t.backgroundColor||t.borders||t.margins||t.textDirection))return;let n;if(t.margins){let o=t.margins;n={},o.top!=null&&(n.top={value:o.top,type:"dxa"}),o.bottom!=null&&(n.bottom={value:o.bottom,type:"dxa"}),o.left!=null&&(n.left={value:o.left,type:"dxa"}),o.right!=null&&(n.right={value:o.right,type:"dxa"});}return {gridSpan:t.colspan>1?t.colspan:void 0,width:t.width!=null?{value:t.width,type:t.widthType||"dxa"}:void 0,verticalAlign:t.verticalAlign||void 0,textDirection:t.textDirection||void 0,shading:t.backgroundColor?{fill:{rgb:t.backgroundColor}}:void 0,borders:t.borders,margins:n}}function F(t){let e=t.attrs,n=[];t.forEach(l=>{l.type.name==="paragraph"&&n.push(T(l));});let o={type:"shape",shapeType:"rect",id:e.textBoxId||void 0,size:{width:e.width?chunkBJSG6TEG_js.g(e.width):0,height:e.height?chunkBJSG6TEG_js.g(e.height):0},textBody:{content:n.length>0?n:[{type:"paragraph",content:[]}],margins:{top:e.marginTop!=null?chunkBJSG6TEG_js.g(e.marginTop):void 0,bottom:e.marginBottom!=null?chunkBJSG6TEG_js.g(e.marginBottom):void 0,left:e.marginLeft!=null?chunkBJSG6TEG_js.g(e.marginLeft):void 0,right:e.marginRight!=null?chunkBJSG6TEG_js.g(e.marginRight):void 0}}},i=chunk34DJT72K_js.f(e);i&&(o.position=i);let r=chunk34DJT72K_js.g(e);if(r&&(o.wrap=r),e.fillColor&&(o.fill={type:"solid",color:{rgb:e.fillColor.replace("#","")}}),e.outlineWidth&&e.outlineWidth>0){let l={solid:"solid",dotted:"dot",dashed:"dash"};o.outline={width:chunkBJSG6TEG_js.g(e.outlineWidth),color:e.outlineColor?{rgb:e.outlineColor.replace("#","")}:void 0,style:e.outlineStyle&&l[e.outlineStyle]||"solid"};}return {type:"run",content:[{type:"shape",shape:o}]}}function K(t){return {type:"paragraph",content:[F(t)]}}function ne(t,e){let o={content:A(t),finalSectionProperties:e?.package.document.finalSectionProperties,sections:e?.package.document.sections,comments:e?.package.document.comments},i=e?{...e,package:{...e.package,document:o}}:{package:{document:o}},r=t.attrs.watermark??null,a=chunkRQVHKDXK_js.a(i)??null;return r!==a?chunkRQVHKDXK_js.b(i,r):i}function A(t){let e=[],n=[],o=()=>{for(let i of n)e.push({type:"paragraph",content:[i]});n=[];};return t.forEach(i=>{if(i.type.name==="paragraph"){let r=T(i);n.length>0&&(r.content=[...n,...r.content],n=[]),e.push(r);}else if(i.type.name==="table")o(),e.push(I(i));else if(i.type.name==="blockSdt")o(),e.push(ie(i));else if(i.type.name==="textBox"){let r=i.attrs;chunk34DJT72K_js.e(r)?n.push(F(i)):(o(),e.push(K(i)));}else i.type.name==="pageBreak"&&(o(),e.push(oe()));}),o(),e}function ie(t){return {type:"blockSdt",properties:chunk34DJT72K_js.b(t.attrs),content:A(t)}}function oe(){return {type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function we(t,e){return ne(e,t)}function ve(t){return A(t)}exports.a=ne;exports.b=we;exports.c=ve;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-QZPVZY6S.mjs';import {a as a$2}from'./chunk-ARHPXIBJ.mjs';import {b,a as a$3}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-QZPVZY6S.mjs';import {a as a$2}from'./chunk-ARHPXIBJ.mjs';import {b,a as a$3}from'./chunk-B6FA4MJ5.mjs';import {i,t}from'./chunk-F24WZXN4.mjs';import {a as a$1}from'./chunk-C57BOE7B.mjs';import {a}from'./chunk-QYUPLKLP.mjs';var P=class o{constructor(t){a(this,"_document");a(this,"_pendingVariables");t instanceof ArrayBuffer||ArrayBuffer.isView(t)?this._document={package:{document:{content:[]}},originalBuffer:t instanceof ArrayBuffer?t:t.buffer}:this._document=t,this._pendingVariables={};}static async fromBuffer(t){let e=await a$1(t);return new o(e)}static fromDocument(t){return new o(t)}getDocument(){return this._document}getText(){let t=this._document.package.document;return this._getBodyText(t)}getFormattedText(){let t=[],e=this._document.package.document;for(let n of e.content)n.type==="paragraph"&&this._extractParagraphSegments(n,t);return t}getVariables(){return a$2(this._document)}getStyles(){let t=this._document.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let a=r;e.push({id:n,name:a.name||n,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return e}getPageCount(){let t=this.getWordCount();return Math.max(1,Math.ceil(t/500))}getWordCount(){return this.getText().split(/\s+/).filter(n=>n.length>0).length}getCharacterCount(t=true){let e=this.getText();return t?e.length:e.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(t=>t.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(t=>t.type==="table").length}getAgentContext(t=100){let e=this._document.package.document,n=e.content.filter(i=>i.type==="paragraph"),r=n.map((i,s)=>{let c=this._getParagraphText(i),p=i.formatting?.styleId;return {index:s,preview:c.slice(0,t),style:p,isHeading:p?.toLowerCase().includes("heading")||false,headingLevel:this._parseHeadingLevel(p),isListItem:!!i.listRendering,isEmpty:c.trim().length===0}}),a=(e.sections||[]).map((i,s)=>({index:s,paragraphCount:i.content?.length||0,pageSize:i.properties?.pageWidth&&i.properties?.pageHeight?{width:i.properties.pageWidth,height:i.properties.pageHeight}:void 0,isLandscape:i.properties?.orientation==="landscape",hasHeader:!!i.properties?.headerReferences?.length,hasFooter:!!i.properties?.footerReferences?.length}));return {paragraphCount:n.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:r,sections:a,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(t,e,n={}){let r={type:"insertText",position:t,text:e,formatting:n.formatting};return this._executeCommand(r)}replaceRange(t,e,n={}){let r={type:"replaceText",range:t,text:e,formatting:n.formatting};return this._executeCommand(r)}deleteRange(t){let e={type:"deleteText",range:t};return this._executeCommand(e)}applyFormatting(t,e){let n={type:"formatText",range:t,formatting:e};return this._executeCommand(n)}applyStyle(t,e){let n={type:"applyStyle",paragraphIndex:t,styleId:e};return this._executeCommand(n)}applyParagraphFormatting(t,e){let n={type:"formatParagraph",paragraphIndex:t,formatting:e};return this._executeCommand(n)}insertTable(t,e,n,r={}){let a={type:"insertTable",position:t,rows:e,columns:n,data:r.data,hasHeader:r.hasHeader};return this._executeCommand(a)}insertImage(t,e,n={}){let r={type:"insertImage",position:t,src:e,width:n.width,height:n.height,alt:n.alt};return this._executeCommand(r)}insertHyperlink(t,e,n={}){let r={type:"insertHyperlink",range:t,url:e,displayText:n.displayText,tooltip:n.tooltip};return this._executeCommand(r)}removeHyperlink(t){let e={type:"removeHyperlink",range:t};return this._executeCommand(e)}insertParagraphBreak(t){let e={type:"insertParagraphBreak",position:t};return this._executeCommand(e)}mergeParagraphs(t,e){let n={type:"mergeParagraphs",paragraphIndex:t,count:e};return this._executeCommand(n)}setVariable(t,e){return this._pendingVariables[t]=e,this}setVariables(t){for(let[e,n]of Object.entries(t))this._pendingVariables[e]=n;return this}getPendingVariables(){return {...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(t){let e={...this._pendingVariables,...t};if(Object.keys(e).length===0)return this;let n=this._document.originalBuffer;if(!n)throw new Error("Cannot apply variables: no original buffer for processing");let{processTemplate:r}=await import('./processTemplate-GPFDLQMX.mjs'),a=r(n,e),i=await a$1(a),s=new o(i);return s._pendingVariables={},s}async toBuffer(t$1){if(this._document.originalBuffer){if(t$1?.selective){let n=await c(this._document,this._document.originalBuffer,t$1.selective);if(n)return this._document.originalBuffer=n,n}let e=await i(this._document);return this._document.originalBuffer=e,e}return t(this._document)}async toBlob(t="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let e=await this.toBuffer();return new Blob([e],{type:t})}executeCommands(t){return new o(b(this._document,t))}_executeCommand(t){let e=new o(a$3(this._document,t));return e._pendingVariables={...this._pendingVariables},e}_getBodyText(t){let e=[];for(let n of t.content)n.type==="paragraph"?e.push(this._getParagraphText(n)):n.type==="table"&&e.push(this._getTableText(n));return e.join(`
|
|
2
2
|
`)}_getParagraphText(t){let e=[];for(let n of t.content)n.type==="run"?e.push(this._getRunText(n)):n.type==="hyperlink"&&e.push(this._getHyperlinkText(n));return e.join("")}_getRunText(t){return t.content.filter(e=>e.type==="text").map(e=>e.text).join("")}_getHyperlinkText(t){let e=[];for(let n of t.children)n.type==="run"&&e.push(this._getRunText(n));return e.join("")}_getTableText(t){let e=[];for(let n of t.rows)for(let r of n.cells)for(let a of r.content)a.type==="paragraph"&&e.push(this._getParagraphText(a));return e.join(" ")}_extractParagraphSegments(t,e){for(let n of t.content)if(n.type==="run"){let r=this._getRunText(n);r&&e.push({text:r,formatting:n.formatting});}else if(n.type==="hyperlink"){let r=n.href||"";for(let a of n.children)if(a.type==="run"){let i=this._getRunText(a);i&&e.push({text:i,formatting:a.formatting,isHyperlink:true,hyperlinkUrl:r});}}}_parseHeadingLevel(t){if(!t)return;let e=t.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}_hasImages(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="run"){for(let r of n.content)if(r.type==="drawing")return true}}return false}_hasHyperlinks(){let t=this._document.package.document;for(let e of t.content)if(e.type==="paragraph"){for(let n of e.content)if(n.type==="hyperlink")return true}return false}};async function Ct(o){return P.fromBuffer(o)}function kt(o){return P.fromDocument(o)}function M(o,t={}){let{outlineMaxChars:e=100,maxOutlineParagraphs:n=50}=t,r=o.package.document,a=r.content.filter(y=>y.type==="paragraph"),i=z(a,e,n),s=a$2(o),c=W(o),p=$(r),u=U(r),d=G(r),f=r.content.some(y=>y.type==="table"),x=K(r),l=N(r);return {paragraphCount:a.length,wordCount:u,characterCount:d,variables:s,variableCount:s.length,availableStyles:c,outline:i,sections:p,hasTables:f,hasImages:x,hasHyperlinks:l}}function At(o,t,e={}){let{contextChars:n=200,includeSuggestions:r=true}=e,i=o.package.document.content.filter(m=>m.type==="paragraph"),s=i[t.start.paragraphIndex];if(!s)throw new Error(`Paragraph not found at index ${t.start.paragraphIndex}`);let c=g(s),p="";if(t.start.paragraphIndex===t.end.paragraphIndex)p=c.slice(t.start.offset,t.end.offset);else {let m=[];for(let b=t.start.paragraphIndex;b<=t.end.paragraphIndex;b++){let H=i[b];if(!H)continue;let _=g(H);b===t.start.paragraphIndex?m.push(_.slice(t.start.offset)):b===t.end.paragraphIndex?m.push(_.slice(0,t.end.offset)):m.push(_);}p=m.join(`
|
|
3
3
|
`);}let u=Y(i,t.start.paragraphIndex,t.start.offset,n),d=Z(i,t.end.paragraphIndex,t.end.offset,n),f=tt(s,t.start.offset),x=s.formatting||{},l={index:t.start.paragraphIndex,fullText:c,style:s.formatting?.styleId,wordCount:v(c)},y=false,A=et(s,t.start.offset),S=r?nt(p):[];return {selectedText:p,range:t,formatting:f,paragraphFormatting:x,textBefore:u,textAfter:d,paragraph:l,inTable:y,inHyperlink:A,suggestedActions:S}}function L(o){let t=M(o,{outlineMaxChars:50,maxOutlineParagraphs:10}),e=[`Document with ${t.paragraphCount} paragraphs, ${t.wordCount} words.`];t.hasTables&&e.push("Contains tables."),t.hasImages&&e.push("Contains images."),t.hasHyperlinks&&e.push("Contains hyperlinks."),t.variableCount>0&&e.push(`Has ${t.variableCount} template variables: ${t.variables.join(", ")}`);let n=t.outline.filter(r=>r.isHeading);if(n.length>0){e.push(`
|
|
4
4
|
Headings:`);for(let r of n.slice(0,5)){let a=r.headingLevel||1;e.push(`${" ".repeat(a-1)}- ${r.preview}`);}n.length>5&&e.push(` ... and ${n.length-5} more headings`);}return e.join(" ")}function z(o,t,e){let n=[];for(let r=0;r<Math.min(o.length,e);r++){let a=o[r],i=g(a),s=a.formatting?.styleId;n.push({index:r,preview:i.slice(0,t),style:s,isHeading:Q(s),headingLevel:X(s),isListItem:!!a.listRendering,isEmpty:i.trim().length===0});}return n}function W(o){let t=o.package.styles;if(!t?.styles)return [];let e=[];for(let[n,r]of Object.entries(t.styles))if(typeof r=="object"&&r!==null){let a=r;e.push({id:n,name:a.name||n,type:a.type==="numbering"?"paragraph":a.type||"paragraph",builtIn:a.default});}return e}function $(o){return o.sections?o.sections.map((t,e)=>({index:e,paragraphCount:t.content?.length||0,pageSize:t.properties?.pageWidth&&t.properties?.pageHeight?{width:t.properties.pageWidth,height:t.properties.pageHeight}:void 0,isLandscape:t.properties?.orientation==="landscape",hasHeader:!!t.properties?.headerReferences?.length,hasFooter:!!t.properties?.footerReferences?.length})):[]}function U(o){let t=0;for(let e of o.content)if(e.type==="paragraph"){let n=g(e);t+=v(n);}else e.type==="table"&&(t+=q(e));return t}function v(o){return o.split(/\s+/).filter(e=>e.length>0).length}function G(o){let t=0;for(let e of o.content)if(e.type==="paragraph"){let n=g(e);t+=n.length;}else e.type==="table"&&(t+=J(e));return t}function q(o){let t=0;for(let e of o.rows)for(let n of e.cells)for(let r of n.content)if(r.type==="paragraph"){let a=g(r);t+=v(a);}return t}function J(o){let t=0;for(let e of o.rows)for(let n of e.cells)for(let r of n.content)if(r.type==="paragraph"){let a=g(r);t+=a.length;}return t}function g(o){let t=[];for(let e of o.content)e.type==="run"?t.push(T(e)):e.type==="hyperlink"&&t.push(F(e));return t.join("")}function T(o){return o.content.filter(t=>t.type==="text").map(t=>t.text).join("")}function F(o){let t=[];for(let e of o.children)e.type==="run"&&t.push(T(e));return t.join("")}function K(o){for(let t of o.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="run"){for(let n of e.content)if(n.type==="drawing")return true}}return false}function N(o){for(let t of o.content)if(t.type==="paragraph"){for(let e of t.content)if(e.type==="hyperlink")return true}return false}function Q(o){return o?o.toLowerCase().includes("heading"):false}function X(o){if(!o)return;let t=o.match(/heading\s*(\d)/i);if(t)return parseInt(t[1],10)}function Y(o,t,e,n){let r=[],a=0,i=o[t];if(i){let p=g(i).slice(0,e);r.unshift(p),a+=p.length;}for(let c=t-1;c>=0&&a<n;c--){let p=o[c];if(!p)continue;let u=g(p);r.unshift(u),a+=u.length;}let s=r.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-NO6PIL32.mjs';var e=a.getCommands();function g(t){return e.setAlignment(t)}var l=e.alignLeft(),u=e.alignCenter(),x=e.alignRight(),C=e.alignJustify();function f(t,n="auto"){return e.setLineSpacing(t,n)}var S=e.singleSpacing(),L=e.oneAndHalfSpacing(),b=e.doubleSpacing();function y(t=720){return e.increaseIndent(t)}function v(t=720){return e.decreaseIndent(t)}function A(t){return e.setIndentLeft(t)}function I(t){return e.setIndentRight(t)}function h(t,n){return e.setIndentFirstLine(t,n)}var R=e.toggleBulletList(),T=e.toggleNumberedList(),P=e.increaseListLevel(),B=e.decreaseListLevel(),k=e.removeList();function E(t){return e.setSpaceBefore(t)}function F(t){return e.setSpaceAfter(t)}function H(t,n){return e.applyStyle(t,n)}var J=e.clearStyle();function N(t){return e.insertSectionBreak(t)}var O=e.removeSectionBreak();function M(t,n="left",r="none"){return e.addTabStop(t,n,r)}function j(t){return e.removeTabStop(t)}var q=e.setRtl(),w=e.setLtr(),z=e.generateTOC();export{j as A,q as B,w as C,z as D,g as a,l as b,u as c,x as d,C as e,f,S as g,L as h,b as i,y as j,v as k,A as l,I as m,h as n,R as o,T as p,P as q,B as r,k as s,E as t,F as u,H as v,J as w,N as x,O as y,M as z};
|
|
@@ -2,7 +2,7 @@ import { P as ParagraphFormatting, T as TextFormatting, a as TableFormatting, b
|
|
|
2
2
|
import { WrapType } from './docx/wrapTypes.js';
|
|
3
3
|
import { B as BorderSpec, C as ColorValue, T as ThemeColorSlot } from './colors-C3vA7HUU.js';
|
|
4
4
|
import { N as NumberFormat, c as ListRendering } from './lists-Bn29SzeS.js';
|
|
5
|
-
import { W as Watermark } from './watermark-
|
|
5
|
+
import { W as Watermark } from './watermark-D90356ZM.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Hyperlinks (`w:hyperlink`), bookmark markers (`w:bookmarkStart`/`End`),
|
|
@@ -2,7 +2,7 @@ import { P as ParagraphFormatting, T as TextFormatting, a as TableFormatting, b
|
|
|
2
2
|
import { WrapType } from './docx/wrapTypes.mjs';
|
|
3
3
|
import { B as BorderSpec, C as ColorValue, T as ThemeColorSlot } from './colors-C3vA7HUU.mjs';
|
|
4
4
|
import { N as NumberFormat, c as ListRendering } from './lists-CyGxd5Y2.mjs';
|
|
5
|
-
import { W as Watermark } from './watermark-
|
|
5
|
+
import { W as Watermark } from './watermark-D90356ZM.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Hyperlinks (`w:hyperlink`), bookmark markers (`w:bookmarkStart`/`End`),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from './types/document.js';
|
|
2
|
-
import { r as SdtType, s as SdtProperties, t as SdtDataBinding, D as DocumentBody, u as BlockSdt, B as BlockContent } from './content-
|
|
2
|
+
import { r as SdtType, s as SdtProperties, t as SdtDataBinding, D as DocumentBody, u as BlockSdt, B as BlockContent } from './content-BebvPfXc.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Content-control (SDT) addressing for the document model.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from './types/document.mjs';
|
|
2
|
-
import { r as SdtType, s as SdtProperties, t as SdtDataBinding, D as DocumentBody, u as BlockSdt, B as BlockContent } from './content-
|
|
2
|
+
import { r as SdtType, s as SdtProperties, t as SdtDataBinding, D as DocumentBody, u as BlockSdt, B as BlockContent } from './content-CbBCrsr0.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Content-control (SDT) addressing for the document model.
|
package/dist/core-plugins.d.mts
CHANGED
|
@@ -31,9 +31,9 @@ import './types/document.mjs';
|
|
|
31
31
|
import './colors-C3vA7HUU.mjs';
|
|
32
32
|
import './formatting-DFtuRFQY.mjs';
|
|
33
33
|
import './lists-CyGxd5Y2.mjs';
|
|
34
|
-
import './content-
|
|
34
|
+
import './content-CbBCrsr0.mjs';
|
|
35
35
|
import './docx/wrapTypes.mjs';
|
|
36
|
-
import './watermark-
|
|
36
|
+
import './watermark-D90356ZM.mjs';
|
|
37
37
|
import './styles-Dqec8Aw6.mjs';
|
|
38
38
|
import './types/agentApi.mjs';
|
|
39
39
|
|
package/dist/core-plugins.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ import './types/document.js';
|
|
|
31
31
|
import './colors-C3vA7HUU.js';
|
|
32
32
|
import './formatting-JhqWT_XM.js';
|
|
33
33
|
import './lists-Bn29SzeS.js';
|
|
34
|
-
import './content-
|
|
34
|
+
import './content-BebvPfXc.js';
|
|
35
35
|
import './docx/wrapTypes.js';
|
|
36
|
-
import './watermark-
|
|
36
|
+
import './watermark-D90356ZM.js';
|
|
37
37
|
import './styles-gEujs7j6.js';
|
|
38
38
|
import './types/agentApi.js';
|
|
39
39
|
|