@betteroffice/docx 0.2.1 → 0.4.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/README.md +586 -3
- package/dist/chunk-24Z6ZVFZ.mjs +1 -0
- package/dist/chunk-2QHGQA3V.mjs +1 -0
- package/dist/{chunk-ACGKK7IB.mjs → chunk-3CYO46ML.mjs} +1 -1
- package/dist/chunk-6CHGYCFU.mjs +1 -0
- package/dist/chunk-AOWJ4WDE.mjs +1 -0
- package/dist/chunk-DLXIZBB6.mjs +1 -0
- package/dist/chunk-F2VBW6RB.mjs +1 -0
- package/dist/chunk-HPZFJGGM.mjs +0 -0
- package/dist/chunk-L2ML3DDI.mjs +1 -0
- package/dist/chunk-LIGZ75FP.mjs +1 -0
- package/dist/chunk-LT2GCWZ3.mjs +0 -0
- package/dist/chunk-ND3FBCB3.mjs +16 -0
- package/dist/chunk-NMDQHUQB.mjs +57 -0
- package/dist/chunk-NVN26RHH.mjs +1 -0
- package/dist/chunk-OK5UFGX3.mjs +1 -0
- package/dist/chunk-RZQ3OXZY.mjs +2 -0
- package/dist/chunk-YLFKV2NT.mjs +1 -0
- package/dist/collaboration/index.d.mts +9 -6
- package/dist/compareDocx-IHFPGIGV.mjs +1 -0
- package/dist/computeLayout-4MNWHE2T.mjs +1 -0
- package/dist/{content-CvEtPl0c.d.mts → content-BzoC6bSz.d.mts} +48 -8
- package/dist/core.d.mts +172 -9
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-DF8F6fMl.d.mts → displayListQueries-H5YnU_hX.d.mts} +23 -5
- package/dist/docx/index.d.mts +5 -4
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +19 -9
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-b8eicJKV.d.mts → fontLoader-BNSs0E8K.d.mts} +55 -2
- package/dist/{formatting-7zKCTu5a.d.mts → formatting-gqLFeJ9X.d.mts} +8 -0
- package/dist/{frameDelta-pA4jrQ1G.d.mts → frameDelta-ByU7HBuB.d.mts} +34 -3
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/index-CHy6_Yuo.d.mts +2026 -0
- package/dist/layout/index.d.mts +6 -6
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/render/index.d.mts +122 -33
- package/dist/layout/render/index.mjs +1 -1
- package/dist/loadWasmAsset-Cr95TImt.d.mts +25 -0
- package/dist/pagedExport---0Dlmzo.d.mts +907 -0
- package/dist/parseWasm-NLAG22EU.mjs +1 -0
- package/dist/plugin-api/RenderedDomContext.d.mts +12 -9
- package/dist/plugin-api/RenderedDomContext.mjs +1 -1
- package/dist/plugin-api/index.d.mts +21 -4
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/rezip-Bxiq4Z_R.d.mts +24 -0
- package/dist/{rustDisplayList-BJqaN9tt.d.mts → rustDisplayList-LcRZHCSL.d.mts} +12 -4
- package/dist/{rustMeasureSource-C0EZB055.d.mts → rustMeasureSource-BkCx1FDx.d.mts} +14 -4
- package/dist/{selectiveSave-CRh-_Y_C.d.mts → selectiveSave-r-NMK6aI.d.mts} +1 -22
- package/dist/styles/index.d.mts +2 -2
- package/dist/{styles-7e-mq3c-.d.mts → styles-AryxLAhx.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +9 -6
- package/dist/{types-C4A8mWjU.d.mts → types-D6Pra38E.d.mts} +31 -5
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +20 -5
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/wasm-GSI2XMOH.mjs +1 -0
- package/dist/wasm-K6DRABAA.mjs +1 -0
- package/dist/wasm-NF6B3AH7.mjs +1 -0
- package/dist/wasm-edit.d.mts +420 -28
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +9 -2
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.d.mts +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.d.mts +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +8 -5
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-5F6DLQZP.mjs +0 -1
- package/dist/chunk-6LQJAKOC.mjs +0 -1
- package/dist/chunk-AFMVSI4Z.mjs +0 -57
- package/dist/chunk-GD4VNJ64.mjs +0 -1
- package/dist/chunk-HLDJMU3R.mjs +0 -1
- package/dist/chunk-J7LNO6SM.mjs +0 -1
- package/dist/chunk-JHJLG4I6.mjs +0 -16
- package/dist/chunk-PGMXWI5X.mjs +0 -1
- package/dist/chunk-WRWRCBLK.mjs +0 -1
- package/dist/chunk-WTFRNX5K.mjs +0 -1
- package/dist/index-CHl2zLJ7.d.mts +0 -1142
- package/dist/loadWasmAsset-CMvnVkfA.d.mts +0 -3
- package/dist/wasm-7SOSHNGP.mjs +0 -1
- package/dist/wasm-ZQAVP7P2.mjs +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {d,b,c}from'./chunk-RZQ3OXZY.mjs';import {a as a$2,D,v as v$1}from'./chunk-ND3FBCB3.mjs';import {a as a$3}from'./chunk-YLFKV2NT.mjs';import {a,b as b$1}from'./chunk-2QHGQA3V.mjs';import {a as a$1,d as d$1,e,f as f$1}from'./chunk-3CYO46ML.mjs';async function H(e,t={}){await a(),await a$1();let o=e instanceof ArrayBuffer?e:await a$2(e),r=t.onProgress??(()=>{});try{r("Extracting DOCX...",0);let n=a$3(o,M(t));return E(t,r),await O(n,t.preloadFonts??!0,r),r("Assembling document...",95),r("Complete",100),n.document}catch(n){let i=n instanceof Error?n.message:String(n);if(i.startsWith("Failed to parse DOCX: "))throw n;let d=R(i),F=d.code==="Container"?i.replace(/^container error: /,""):i,u=new Error(`Failed to parse DOCX: ${F}`,{cause:n});throw Object.assign(u,d),u}}function M(e){return {parseHeadersFooters:e.parseHeadersFooters??true,parseNotes:e.parseNotes??true,detectVariables:false,includeCanonical:false}}function E(e,t){t("Extracted DOCX",10),t("Parsing relationships...",10),t("Parsed relationships",15),t("Parsing theme...",15),t("Parsed theme",20),t("Parsing styles...",20),t("Parsed styles",30),t("Parsing numbering...",30),t("Parsed numbering",35),t("Processing media files...",35),t("Processed media",40),t("Parsing document body...",40),t("Parsed document body",55),e.parseHeadersFooters??true?(t("Parsing headers/footers...",55),t("Parsed headers/footers",65)):t("Skipping headers/footers",65),e.parseNotes??true?(t("Parsing footnotes/endnotes...",65),t("Parsed footnotes/endnotes",75)):t("Skipping footnotes/endnotes",75),t("Parsing comments...",75),t("Parsed comments",80);}async function O(e,t,o){if(!t){o("Skipping font loading",95);return}o("Loading fonts...",80),await B(e.document.package.theme??null,e.document.package.styles,e.document.package.document),await D(e.document.package.fontTable,e.embeddedFonts,e.fontTableRelationshipsXml),o("Loaded fonts",95);}async function B(e,t,o){let r=new Set;e?.fontScheme?.majorFont?.latin&&r.add(e.fontScheme.majorFont.latin),e?.fontScheme?.minorFont?.latin&&r.add(e.fontScheme.minorFont.latin),t?.docDefaults?.rPr?.fontFamily?.ascii&&r.add(t.docDefaults.rPr.fontFamily.ascii);for(let n of t?.styles??[])n.rPr?.fontFamily?.ascii&&r.add(n.rPr.fontFamily.ascii),n.rPr?.fontFamily?.hAnsi&&r.add(n.rPr.fontFamily.hAnsi);for(let n of o.content)if(n.type==="paragraph")for(let i of n.content)i.type==="run"&&(i.formatting?.fontFamily?.ascii&&r.add(i.formatting.fontFamily.ascii),i.formatting?.fontFamily?.hAnsi&&r.add(i.formatting.fontFamily.hAnsi));if(r.size!==0)try{await v$1([...r]);}catch(n){console.warn("Failed to load some fonts:",n);}}function R(e){let t=/(?:unsafe XML|resource limit .* exceeded|malformed XML|invalid relationship) in ([^:]+)(?::| at)/.exec(e)?.[1],o=/ at byte (\d+):/.exec(e)?.[1];return {code:e.startsWith("unsafe XML")?"UnsafeXml":e.startsWith("resource limit")?"ResourceLimit":e.startsWith("malformed XML")?"MalformedXml":e.startsWith("invalid relationship")?"Relationship":e.startsWith("container error")?"Container":e.startsWith("wire.")?"Wire":"Parse",...t?{part:t}:{},...o?{offset:Number(o)}:{}}}var k={seed:"0".repeat(64),now:"2000-01-01T00:00:00.000Z"};function l(e$1,t){let o=JSON.stringify({...t,determinism:k}),r=e$1==="S10"?d$1(o):e$1==="S11"?e(o):f$1(o),n=JSON.parse(r);if(!n||typeof n!="object")throw new TypeError(`${e$1} Rust serializer returned a non-object response`);let i=n;if(i.wireVersion!==1||i.family!==t.family||typeof i.xml!="string")throw new TypeError(`invalid ${e$1} Rust serializer response for ${String(t.family)}`);return i.xml}function Y(e){return l("S12",{family:"document",body:e.package.document})}function J(e){let t=l("S12",{family:"document",body:e}),o="<w:body>",r="</w:body>",n=t.indexOf(o),i=t.lastIndexOf(r);if(n<0||i<n)throw new Error("Rust document serializer omitted w:body");return t.slice(n+o.length,i)}function Z(e){return l("S10",{family:"section",properties:e})}async function C(){let e=new Map;e.set("[Content_Types].xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
3
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
4
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
5
|
+
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
|
|
6
|
+
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
|
7
|
+
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
|
|
8
|
+
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
|
|
9
|
+
</Types>`)),e.set("_rels/.rels",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
10
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
11
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
12
|
+
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
|
|
13
|
+
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
|
|
14
|
+
</Relationships>`)),e.set("word/_rels/document.xml.rels",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
15
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
16
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
17
|
+
</Relationships>`)),e.set("word/document.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
18
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
19
|
+
<w:body>
|
|
20
|
+
<w:p>
|
|
21
|
+
<w:r>
|
|
22
|
+
<w:t></w:t>
|
|
23
|
+
</w:r>
|
|
24
|
+
</w:p>
|
|
25
|
+
<w:sectPr>
|
|
26
|
+
<w:pgSz w:w="12240" w:h="15840"/>
|
|
27
|
+
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
|
|
28
|
+
</w:sectPr>
|
|
29
|
+
</w:body>
|
|
30
|
+
</w:document>`)),e.set("word/styles.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
31
|
+
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
32
|
+
<w:docDefaults>
|
|
33
|
+
<w:rPrDefault>
|
|
34
|
+
<w:rPr>
|
|
35
|
+
<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
|
|
36
|
+
<w:sz w:val="22"/>
|
|
37
|
+
</w:rPr>
|
|
38
|
+
</w:rPrDefault>
|
|
39
|
+
<w:pPrDefault>
|
|
40
|
+
<w:pPr>
|
|
41
|
+
<w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
|
|
42
|
+
</w:pPr>
|
|
43
|
+
</w:pPrDefault>
|
|
44
|
+
</w:docDefaults>
|
|
45
|
+
<w:style w:type="paragraph" w:default="1" w:styleId="Normal">
|
|
46
|
+
<w:name w:val="Normal"/>
|
|
47
|
+
</w:style>
|
|
48
|
+
</w:styles>`));let t=new Date().toISOString();return e.set("docProps/core.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
49
|
+
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
50
|
+
<dc:creator>OpenOOXML DOCX Editor</dc:creator>
|
|
51
|
+
<dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>
|
|
52
|
+
<dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>
|
|
53
|
+
</cp:coreProperties>`)),e.set("docProps/app.xml",b(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
54
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
|
|
55
|
+
<Application>OpenOOXML DOCX Editor</Application>
|
|
56
|
+
<AppVersion>1.0.0</AppVersion>
|
|
57
|
+
</Properties>`)),c(e)}async function v(e,t={}){if(!e.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");return (await d(e,e.originalBuffer,t)).buffer}function A(e){return new Map(Object.entries(b$1(new Uint8Array(e))))}async function ce(e,t,o={}){return I(A(e),t,o)}async function I(e,t,o={}){for(let[r,n]of t)e.set(r,b(n));return c(e)}async function pe(e){let t=await C();return v({...e,originalBuffer:t})}async function de(e,t,o){if(!N(e,t,o))return null;try{return (await d(e,t,{updateModifiedDate:!0},{changedParaIds:o.changedParaIds})).buffer}catch{return null}}function N(e,t,o){return o.structuralChange||o.hasUntrackedChanges||!t?false:!f(e.package.document.content)}function f(e){let t=o=>o.content.some(r=>r.type==="drawing"&&r.image?.src?.startsWith("data:")&&!r.image.rId);for(let o of e)if(o.type==="paragraph")for(let r of o.content){if(r.type==="run"&&t(r)||r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor)return true;if(r.type==="insertion"||r.type==="deletion"||r.type==="moveFrom"||r.type==="moveTo"){for(let n of r.content)if(n.type==="run"&&t(n))return true}}else if(o.type==="table"){for(let r of o.rows)for(let n of r.cells)if(f(n.content))return true}else if(o.type==="blockSdt"&&f(o.content))return true;return false}export{H as a,Y as b,J as c,Z as d,v as e,ce as f,pe as g,de as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(e){return e?.sections?.at(-1)?.properties??e?.finalSectionProperties}function m(e,r){let t=e.sections?.map((o,n,s)=>n===s.length-1?{...o,properties:r(o.properties)}:o);return {...e,...t?{sections:t}:{},finalSectionProperties:r(e.finalSectionProperties??{})}}var a=new WeakMap;function c(e){let r=e?.package.document;if(!r)return [{properties:{}}];let t=(r.sections??[]).map(o=>({sectionId:o.id??o.properties.sectionId,properties:o.properties}));return t.push({sectionId:t.at(-1)?.sectionId??r.finalSectionProperties?.sectionId,properties:i(r)??{}}),t}function l(e,r,t){let o=[];for(let n of e?.package.footnotes??[])n.noteType&&n.noteType!=="normal"||o.push({id:n.id,noteKind:"footnote",height:0});for(let n of e?.package.endnotes??[])n.noteType&&n.noteType!=="normal"||o.push({id:n.id,noteKind:"endnote",height:0});return {bodyStory:"body",options:{contractVersion:e?.package.contractVersion,pageGap:r},regions:{sections:c(e),settings:e?.package.settings,watermark:i(e?.package.document)?.watermark},notes:{contents:o},renderEnv:{compatibilityFlags:e?.package.settings?.compatibilityFlags,...t,...y(e,t),tocStyleIds:[...new Set([...t.tocStyleIds??[],...(e?.package.styles?.styles??[]).filter(n=>n.type==="paragraph"&&typeof n.styleId=="string"&&n.styleId&&[n.styleId,n.name].some(s=>/^TOC\s*\d+$/i.test(s??""))).map(n=>n.styleId)])]}}}function y(e,r){if(r.defaultParagraphStyleId)return {};let t=e?.package.styles?.styles??[],o=t.find(s=>s.type==="paragraph"&&s.default&&s.styleId)?.styleId;return o?{defaultParagraphStyleId:o}:t.some(s=>s.type==="paragraph"&&s.styleId==="Normal")?{defaultParagraphStyleId:"Normal"}:{}}function h(e){return a.get(e)}function k(e){let r=l(e.document,e.pageGap,e.renderEnv);r.measurement=e.measurement;let t=e.session,o=JSON.parse(t.layoutDocumentWithRegionsRetainedJson(JSON.stringify(r))),n=t.residentWorkerProbe().layoutRevision,s=null,u=()=>s??(s=JSON.parse(t.retainedKernelInputsJson(n)));return a.set(o.layout,{get measured(){return u().measured},get options(){return u().options},...o.headersFooters?{headersFooters:o.headersFooters}:{},layoutRevision:n}),{layout:o.layout,notesConverged:o.notesConverged}}function L(e,r){let t=JSON.parse(e),o=()=>{throw new Error("the measured blocks of a worker-run layout live in the worker")};return a.set(t.layout,{get measured(){return o()},get options(){return o()},...t.headersFooters?{headersFooters:t.headersFooters}:{},...r!==void 0?{layoutRevision:r}:{}}),{layout:t.layout,notesConverged:t.notesConverged}}export{i as a,m as b,l as c,h as d,k as e,L as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c as c$1}from'./chunk-6CHGYCFU.mjs';import {a}from'./chunk-TTRUPDAB.mjs';var U={};a(U,{build_display_list_json:()=>A,clear_measure_fonts:()=>D,close_display_list:()=>X,default:()=>J,hit_test_json:()=>z,hit_test_regions_by_handle:()=>N,hit_test_regions_json:()=>M,initSync:()=>S,install_panic_hook:()=>Y,layout_document_json:()=>T,measure_paragraph_json:()=>W,open_display_list:()=>K,outline_glyph_json:()=>O,range_rects_by_handle:()=>Q,range_rects_json:()=>B,range_rects_region_by_handle:()=>Z,range_rects_region_json:()=>$,register_measure_font:()=>I,register_substitute_measure_font:()=>H,update_display_list:()=>ee,vertical_move_by_handle:()=>ne,vertical_move_json:()=>te});function A(e){let n,t;try{let _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u,i=o.build_display_list_json(_,a);var r=i[0],s=i[1];if(i[3])throw r=0,s=0,g(i[2]);return n=r,t=s,p(r,s)}finally{o.__wbindgen_free(n,t,1);}}function D(){o.clear_measure_fonts();}function X(e){o.close_display_list(e);}function z(e,n,t,r){let s,_;try{let l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=o.hit_test_json(l,b,n,t,r);var a=d[0],i=d[1];if(d[3])throw a=0,i=0,g(d[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function N(e,n,t,r){let s,_;try{let l=o.hit_test_regions_by_handle(e,n,t,r);var a=l[0],i=l[1];if(l[3])throw a=0,i=0,g(l[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function M(e,n,t,r){let s,_;try{let l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=o.hit_test_regions_json(l,b,n,t,r);var a=d[0],i=d[1];if(d[3])throw a=0,i=0,g(d[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function Y(){o.install_panic_hook();}function T(e){let n,t;try{let _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u,i=o.layout_document_json(_,a);var r=i[0],s=i[1];if(i[3])throw r=0,s=0,g(i[2]);return n=r,t=s,p(r,s)}finally{o.__wbindgen_free(n,t,1);}}function W(e){let n,t;try{let _=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u,i=o.measure_paragraph_json(_,a);var r=i[0],s=i[1];if(i[3])throw r=0,s=0,g(i[2]);return n=r,t=s,p(r,s)}finally{o.__wbindgen_free(n,t,1);}}function K(e){let n=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,r=o.open_display_list(n,t);if(r[2])throw g(r[1]);return r[0]>>>0}function O(e,n){let t,r;try{let a=o.outline_glyph_json(e,n);var s=a[0],_=a[1];if(a[3])throw s=0,_=0,g(a[2]);return t=s,r=_,p(s,_)}finally{o.__wbindgen_free(t,r,1);}}function Q(e,n,t){let r,s;try{let i=o.range_rects_by_handle(e,n,t);var _=i[0],a=i[1];if(i[3])throw _=0,a=0,g(i[2]);return r=_,s=a,p(_,a)}finally{o.__wbindgen_free(r,s,1);}}function B(e,n,t){let r,s;try{let i=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=u,b=o.range_rects_json(i,l,n,t);var _=b[0],a=b[1];if(b[3])throw _=0,a=0,g(b[2]);return r=_,s=a,p(_,a)}finally{o.__wbindgen_free(r,s,1);}}function Z(e,n,t,r,s){let _,a;try{let b=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),d=u,h=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),m=u,w=o.range_rects_region_by_handle(e,b,d,h,m,r,s);var i=w[0],l=w[1];if(w[3])throw i=0,l=0,g(w[2]);return _=i,a=l,p(i,l)}finally{o.__wbindgen_free(_,a,1);}}function $(e,n,t,r,s){let _,a;try{let b=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),d=u,h=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),m=u,w=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),G=u,E=o.range_rects_region_json(b,d,h,m,w,G,r,s);var i=E[0],l=E[1];if(E[3])throw i=0,l=0,g(E[2]);return _=i,a=l,p(i,l)}finally{o.__wbindgen_free(_,a,1);}}function I(e){let n=re(e,o.__wbindgen_malloc),t=u,r=o.register_measure_font(n,t);if(r[2])throw g(r[1]);return r[0]>>>0}function H(e,n){let t=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,s=o.register_substitute_measure_font(e,t,r);if(s[2])throw g(s[1]);return s[0]>>>0}function ee(e,n){let t=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),r=u,s=o.update_display_list(e,t,r);if(s[1])throw g(s[0])}function ne(e,n,t,r){let s,_;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=o.vertical_move_by_handle(e,n,l,b,r);var a=d[0],i=d[1];if(d[3])throw a=0,i=0,g(d[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function te(e,n,t,r){let s,_;try{let l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=u,d=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),h=u,m=o.vertical_move_json(l,b,n,d,h,r);var a=m[0],i=m[1];if(m[3])throw a=0,i=0,g(m[2]);return s=a,_=i,p(a,i)}finally{o.__wbindgen_free(s,_,1);}}function q(){return {__proto__:null,"./docx_layout_bg.js":{__proto__:null,__wbg_error_21824f160ff7dd52:function(n,t){console.error(p(n,t));},__wbindgen_cast_0000000000000001:function(n,t){return p(n,t)},__wbindgen_init_externref_table:function(){let n=o.__wbindgen_externrefs,t=n.grow(4);n.set(0,void 0),n.set(t+0,void 0),n.set(t+1,null),n.set(t+2,true),n.set(t+3,false);}}}}function p(e,n){return se(e>>>0,n)}var x=null;function v(){return (x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function re(e,n){let t=n(e.length*1,1)>>>0;return v().set(e,t/1),u=e.length,t}function f(e,n,t){if(t===void 0){let i=R.encode(e),l=n(i.length,1)>>>0;return v().subarray(l,l+i.length).set(i),u=i.length,l}let r=e.length,s=n(r,1)>>>0,_=v(),a=0;for(;a<r;a++){let i=e.charCodeAt(a);if(i>127)break;_[s+a]=i;}if(a!==r){a!==0&&(e=e.slice(a)),s=t(s,r,r=a+e.length*3,1)>>>0;let i=v().subarray(s+a,s+r),l=R.encodeInto(e,i);a+=l.written,s=t(s,r,a,1)>>>0;}return u=a,s}function g(e){let n=o.__wbindgen_externrefs.get(e);return o.__externref_table_dealloc(e),n}var j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});j.decode();var oe=2146435072,L=0;function se(e,n){return L+=n,L>=oe&&(j=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),j.decode(),L=n),j.decode(v().subarray(e,e+n))}var R=new TextEncoder;"encodeInto"in R||(R.encodeInto=function(e,n){let t=R.encode(e);return n.set(t),{read:e.length,written:t.length}});var u=0,o;function F(e,n){return o=e.exports,x=null,o.__wbindgen_start(),o}async function _e(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(s){if(e.ok&&t(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}else {let r=await WebAssembly.instantiate(e,n);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function t(r){switch(r){case "basic":case "cors":case "default":return true}return false}}function S(e){if(o!==void 0)return o;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=q();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return F(t)}async function J(e){if(o!==void 0)return o;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0)throw new Error("docx-layout requires an explicit module or URL");let n=q();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await _e(await e,n);return F(t)}var c=c$1({label:"docx-layout",preloadName:"preloadLayoutWasm",assetUrl:()=>new URL("./generated/layout/docx_layout_bg.wasm",import.meta.url),initAsync:J,initSync:S});function fe(e){return c.preload(e)}function ge(e,n,t,r){return c.ensure(),M(e,n,t,r)}function be(e,n,t){return c.ensure(),B(e,n,t)}function y(e){let n=U[e];return typeof n=="function"?n:void 0}function pe(){return c.ensure(),y("open_display_list")!==void 0}function ye(){return c.ensure(),y("range_rects_region_json")!==void 0}function me(e){c.ensure();let n=y("open_display_list");if(!n)throw new Error("open_display_list is not available in the embedded layout wasm yet");return n(e)}function we(e){c.ensure(),y("close_display_list")?.(e);}function he(e,n){c.ensure();let t=y("update_display_list");if(!t)throw new Error("update_display_list is not available in the embedded layout wasm yet");t(e,n);}function xe(){return c.ensure(),y("update_display_list")!==void 0}function ve(e,n,t,r){c.ensure();let s=y("hit_test_regions_by_handle");if(!s)throw new Error("hit_test_regions_by_handle is not available in the embedded layout wasm yet");return s(e,n,t,r)}function Re(e,n,t,r){c.ensure();let s=y("vertical_move_json");if(!s)throw new Error("vertical_move_json is not available in the embedded layout wasm");return s(e,n,t,r)}function Ee(e,n,t,r){c.ensure();let s=y("vertical_move_by_handle");if(!s)throw new Error("vertical_move_by_handle is not available in the embedded layout wasm");return s(e,n,t,r)}function je(e,n,t){c.ensure();let r=y("range_rects_by_handle");if(!r)throw new Error("range_rects_by_handle is not available in the embedded layout wasm yet");return r(e,n,t)}function Le(e,n,t,r,s){c.ensure();let _=y("range_rects_region_json");if(!_)throw new Error("range_rects_region_json is not available in the embedded layout wasm yet");return _(e,n,t,r,s)}function Ae(e,n,t,r,s){c.ensure();let _=y("range_rects_region_by_handle");if(!_)throw new Error("range_rects_region_by_handle is not available in the embedded layout wasm yet");return _(e,n,t,r,s)}function De(e){return c.ensure(),A(e)}function Me(e){return c.ensure(),T(e)}function Te(e){return c.ensure(),I(e)}function We(e,n){return c.ensure(),H(e,n)}function Oe(){c.ensure(),D();}function Be(e){return c.ensure(),W(e)}function le(){let e=O;return typeof e=="function"?e:void 0}function Ie(e,n){c.ensure();let t=le();if(!t)throw new Error("outline_glyph_json is not available in the embedded layout wasm yet");return t(e,n)}export{fe as a,ge as b,be as c,pe as d,ye as e,me as f,we as g,he as h,xe as i,ve as j,Re as k,Ee as l,je as m,Le as n,Ae as o,De as p,Me as q,Te as r,We as s,Oe as t,Be as u,Ie as v};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c,a,b}from'./chunk-2QHGQA3V.mjs';import {a as a$1,g}from'./chunk-3CYO46ML.mjs';var S={image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",footnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",endnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",webSettings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",oleObject:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",diagramData:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",customProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",customXml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",commentsExtended:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",commentsIds:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",commentsExtensible:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"};var O=new TextEncoder,F=new TextDecoder("utf-8",{ignoreBOM:true});function J(e){return typeof e=="string"?O.encode(e):e instanceof Uint8Array?e:new Uint8Array(e)}function k(e){return e?F.decode(e):void 0}function K(e){let t=c(Object.fromEntries(e)),r=new ArrayBuffer(t.byteLength);return new Uint8Array(r).set(t),r}function P(e){return e.startsWith("/")?e.slice(1):`word/${e}`}function v(e){let t=[{relsPath:"word/_rels/document.xml.rels",blocks:e.package.document.content}],r=s=>(s??[]).flatMap(p=>p.content),n=[...r(e.package.footnoteSeparators),...r(e.package.footnotes)];n.length>0&&t.push({relsPath:"word/_rels/footnotes.xml.rels",blocks:n});let o=[...r(e.package.endnoteSeparators),...r(e.package.endnotes)];o.length>0&&t.push({relsPath:"word/_rels/endnotes.xml.rels",blocks:o});let a=e.package.relationships;if(!a)return t;let m=(s,p)=>{if(s)for(let[c,l]of s.entries()){let d=a.get(c);if(!d||d.type!==p||!d.target)continue;let g=P(d.target).replace(/^word\//,"");t.push({relsPath:`word/_rels/${g}.rels`,blocks:l.content});}};return m(e.package.headers,S.header),m(e.package.footers,S.footer),t}async function H(e){let t=await crypto.subtle.digest("SHA-256",Uint8Array.from(e).buffer);return Array.from(new Uint8Array(t),r=>r.toString(16).padStart(2,"0")).join("")}async function te(e,t,r={},n,o,a$2){await a(),await a$1();let m=o??{seed:await H(new Uint8Array(t)),now:new Date().toISOString()};j(m);let s=e.package,p={determinism:m,document:s.document,headerEntries:[...s.headers?.entries()??[]],footerEntries:[...s.footers?.entries()??[]],footnotes:s.footnotes??[],endnotes:s.endnotes??[],footnoteSeparators:s.footnoteSeparators??[],endnoteSeparators:s.endnoteSeparators??[],relationshipEntries:[...s.relationships?.entries()??[]],...s.numbering===void 0?{}:{numbering:s.numbering},options:{updateModifiedDate:r.updateModifiedDate??true,...r.modifiedBy===void 0?{}:{modifiedBy:r.modifiedBy}},...n===void 0?{}:{selective:{changedParaIds:[...n.changedParaIds],...n.sourceParagraphs===void 0?{}:{sourceParagraphs:n.sourceParagraphs}}},...a$2===void 0?{}:{paragraphIds:a$2}};I(p,"save");let c=g(JSON.stringify(p),new Uint8Array(t)),l=N(c);return n||C(e,t,l),{buffer:l,determinism:m}}function C(e,t,r){let n=b(new Uint8Array(t)),o=b(new Uint8Array(r));for(let s of v(e)){let p=k(n[s.relsPath])??"",c=k(o[s.relsPath])??"",l=new Set(x(p).map(i=>f(i,"Id"))),d=x(c).filter(i=>f(i,"Type")?.endsWith("/image")).map(i=>f(i,"Id")).filter(i=>!!i&&!l.has(i)),u=$(s.blocks);if(u.length>d.length)throw new Error(`Rust save image mutation mismatch in ${s.relsPath}: ${u.length} model images, ${d.length} relationships`);u.forEach((i,h)=>{i.rId=d[h];});let g=x(c).filter(i=>f(i,"Type")?.endsWith("/hyperlink")&&f(i,"TargetMode")==="External");for(let i of D(s.blocks)){if(!i.href){M(c,i.rId)||(i.rId=void 0);continue}let h=g.find(w=>W(f(w,"Target")??"")===i.href),y=h&&f(h,"Id");y&&(i.rId=y);}}let a=e.package.headers,m=e.package.relationships;if(!(!a||!m))for(let[s,p]of a){let c=p.watermark;if(!c||c.kind!=="picture")continue;let l=m.get(s);if(!l?.target)continue;let u=`word/_rels/${P(l.target).replace(/^word\//,"")}.rels`,g=k(o[u])??"";if(M(g,c.relId))continue;let i=c.mediaPath?.split("/").pop(),h=x(g).find(w=>{if(!f(w,"Type")?.endsWith("/image"))return false;let _=f(w,"Target")?.split("/").pop();return i?_===i:true}),y=h&&f(h,"Id");y&&(c.relId=y);}}function $(e){let t=[],r=n=>{for(let o of n.content)o.type==="drawing"&&o.image.src?.startsWith("data:")&&!o.image.rId&&t.push(o.image);};for(let n of e)if(n.type==="paragraph"){for(let o of n.content)if(o.type==="run")r(o);else if(o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo")for(let a of o.content)a.type==="run"&&r(a);}else if(n.type==="table")for(let o of n.rows)for(let a of o.cells)t.push(...$(a.content));return t}function D(e){let t=[];for(let r of e)if(r.type==="paragraph")for(let n of r.content)n.type==="hyperlink"&&(n.href||n.rId)&&!n.anchor&&t.push(n);else if(r.type==="table")for(let n of r.rows)for(let o of n.cells)t.push(...D(o.content));else r.type==="blockSdt"&&t.push(...D(r.content));return t}function x(e){return [...e.matchAll(/<Relationship\b[^>]*\/?>/g)].map(t=>t[0])}function f(e,t){return e.match(new RegExp(`\\b${t}="([^"]*)"`))?.[1]}function M(e,t){if(t)return x(e).find(r=>f(r,"Id")===t)}function W(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCodePoint(Number(r))).replace(/&#x([0-9A-Fa-f]+);/g,(t,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&/g,"&")}function j(e){if(!/^[0-9a-f]{64}$/i.test(e.seed))throw new TypeError("Rust save determinism seed must be a SHA-256 hex digest");if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e.now))throw new TypeError("Rust save clock must be a UTC ISO-8601 millisecond timestamp")}var L=new Set(["__proto__","constructor","prototype"]);function I(e,t,r=new WeakSet){if(!(e===null||typeof e!="object")){if(r.has(e))throw new TypeError(`${t} contains a cycle`);if(r.add(e),Array.isArray(e))e.forEach((n,o)=>I(n,`${t}[${o}]`,r));else for(let n of Object.keys(e)){if(L.has(n))throw new TypeError(`${t} contains forbidden key ${n}`);I(e[n],`${t}.${n}`,r);}r.delete(e);}}function N(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}
|
|
2
|
+
export{S as a,J as b,K as c,te as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$1,c as c$1,h as h$1}from'./chunk-3CYO46ML.mjs';function B(n){return n.length>=4&&(n[0]===73&&n[1]===73&&n[2]===42&&n[3]===0||n[0]===77&&n[1]===77&&n[2]===0&&n[3]===42)}function R(n,e,t,r){if(!B(n)||n.byteLength>33554432)return {bytes:n,mimeType:e,dataUrl:t};try{let o=r(n);return {bytes:o,mimeType:"image/png",dataUrl:`data:image/png;base64,${N(o)}`}}catch{return {bytes:n,mimeType:e,dataUrl:t}}}function N(n){let e="";for(let t=0;t<n.length;t+=32768)e+=String.fromCharCode(...n.subarray(t,t+32768));return btoa(e)}var U=new Set(["__proto__","constructor","prototype"]);function Z(n,e){return O(b$1(new Uint8Array(n),JSON.stringify(e)),n)}function O(n,e){return C(JSON.parse(n),e)}function C(n,e){h(n,"wire");let t=c(n,"wire");if(p(t,["wireVersion","document","embeddedFontParts","fontTableRelationshipsXml","canonicalBase64","canonicalSha256"],"wire",["fontTableRelationshipsXml","canonicalBase64","canonicalSha256"]),t.wireVersion!==1)throw new TypeError("wire.wireVersion must be 1");let r=X(t.document,e),o=I(t.embeddedFontParts);if((t.canonicalBase64!==void 0||t.canonicalSha256!==void 0)&&(t.canonicalBase64===void 0||t.canonicalSha256===void 0))throw new TypeError("wire canonical fields must be present together");let i=t.canonicalSha256===void 0?void 0:d(t.canonicalSha256,"wire.canonicalSha256");if(i!==void 0&&!/^[0-9a-f]{64}$/.test(i))throw new TypeError("wire.canonicalSha256 is invalid");return {wireVersion:1,document:r,embeddedFonts:o,...t.fontTableRelationshipsXml===void 0?{}:{fontTableRelationshipsXml:d(t.fontTableRelationshipsXml,"wire.fontTableRelationshipsXml")},...t.canonicalBase64===void 0?{}:{rustCanonicalBytes:b(d(t.canonicalBase64,"wire.canonicalBase64")),rustCanonicalSha256:i}}}function X(n,e){let t=c(n,"wire.document");p(t,["package","templateVariables","warnings"],"wire.document",["templateVariables","warnings"]);let o={package:_(t.package),originalBuffer:e};return t.warnings!==void 0&&(o.warnings=J(t.warnings,"wire.document.warnings")),o}function _(n){let e=c(n,"wire.document.package");p(e,["document","styles","theme","numbering","settings","fontTable","headerEntries","footerEntries","footnotes","endnotes","footnoteSeparators","endnoteSeparators","relationshipEntries","mediaEntries","chartEntries"],"wire.document.package",["styles","headerEntries","footerEntries","footnotes","endnotes","footnoteSeparators","endnoteSeparators"]);let o={document:V(e.document),theme:c(e.theme,"wire.document.package.theme"),numbering:c(e.numbering,"wire.document.package.numbering"),settings:c(e.settings,"wire.document.package.settings"),fontTable:c(e.fontTable,"wire.document.package.fontTable"),relationships:x(e.relationshipEntries,"wire.document.package.relationshipEntries"),media:j(e.mediaEntries),charts:g(e.chartEntries,"wire.document.package.chartEntries",(a,i)=>c(a,i))};e.styles!==void 0&&(o.styles=c(e.styles,"wire.document.package.styles"));for(let[a,i]of [["headerEntries","headers"],["footerEntries","footers"]]){let s=e[a];s!==void 0&&(o[i]=g(s,`wire.document.package.${a}`,(f,u)=>c(f,u)));}return e.footnotes!==void 0&&(o.footnotes=m(e.footnotes,"wire.document.package.footnotes")),e.endnotes!==void 0&&(o.endnotes=m(e.endnotes,"wire.document.package.endnotes")),e.footnoteSeparators!==void 0&&(o.footnoteSeparators=m(e.footnoteSeparators,"wire.document.package.footnoteSeparators")),e.endnoteSeparators!==void 0&&(o.endnoteSeparators=m(e.endnoteSeparators,"wire.document.package.endnoteSeparators")),o}function V(n){let e="wire.document.package.document",t=c(n,e);if(p(t,["content","sections","finalSectionProperties","customRootBindings","comments"],e,["sections","finalSectionProperties","customRootBindings","comments"]),!Array.isArray(t.content))throw new TypeError(`${e}.content must be an array`);t.content.forEach((o,a)=>c(o,`${e}.content[${a}]`));let r={content:t.content};if(t.sections!==void 0){if(!Array.isArray(t.sections))throw new TypeError(`${e}.sections must be an array`);r.sections=t.sections.map((o,a)=>{let i=`${e}.sections[${a}]`,s=c(o,i);p(s,["id","properties","contentStart","contentEnd"],i,["id"]);let f=P(s.contentStart,`${i}.contentStart`),u=P(s.contentEnd,`${i}.contentEnd`);if(f>u||u>r.content.length)throw new TypeError(`${i} has an invalid content range`);return {...s.id===void 0?{}:{id:d(s.id,`${i}.id`)},properties:c(s.properties,`${i}.properties`),content:r.content.slice(f,u)}});}return t.finalSectionProperties!==void 0&&(r.finalSectionProperties=c(t.finalSectionProperties,`${e}.finalSectionProperties`)),t.customRootBindings!==void 0&&(r.customRootBindings=m(t.customRootBindings,`${e}.customRootBindings`)),t.comments!==void 0&&(r.comments=m(t.comments,`${e}.comments`)),r}function x(n,e){return g(n,e,(t,r,o)=>W(t,r,o))}function j(n){let e="wire.document.package.mediaEntries";if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);let t=new Map,r=new Map;for(let o=0;o<n.length;o+=1){let a=`${e}[${o}]`,i=n[o];if(!Array.isArray(i)||i.length!==2)throw new TypeError(`${a} must be a key/value pair`);let s=d(i[0],`${a}[0]`);if(t.has(s))throw new TypeError(`${e} contains duplicate key ${JSON.stringify(s)}`);let f=`${a}[1]`,u=c(i[1],f);p(u,["path","filename","mimeType","base64","dataUrl"],f,["filename"]);let l=d(u.path,`${f}.path`),y=r.get(l);if(!y){let D=b(d(u.base64,`${f}.base64`)),w=R(D,d(u.mimeType,`${f}.mimeType`),d(u.dataUrl,`${f}.dataUrl`),h$1),k={path:l,...u.filename===void 0?{}:{filename:d(u.filename,`${f}.filename`)},mimeType:w.mimeType,data:M(w.bytes),dataUrl:w.dataUrl};y=k,r.set(l,k);}t.set(s,y);}return t}function I(n){let e="wire.embeddedFontParts";if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);let t=new Map;return n.forEach((r,o)=>{let a=`${e}[${o}]`,i=c(r,a);p(i,["path","base64"],a);let s=d(i.path,`${a}.path`);if(t.has(s))throw new TypeError(`${e} contains duplicate key ${JSON.stringify(s)}`);t.set(s,M(b(d(i.base64,`${a}.base64`))));}),t}function g(n,e,t){if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);let r=new Map;return n.forEach((o,a)=>{let i=`${e}[${a}]`;if(!Array.isArray(o)||o.length!==2)throw new TypeError(`${i} must be a key/value pair`);let s=d(o[0],`${i}[0]`);if(r.has(s))throw new TypeError(`${e} contains duplicate key ${JSON.stringify(s)}`);r.set(s,t(o[1],`${i}[1]`,s));}),r}function J(n,e){if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);return n.map((t,r)=>d(t,`${e}[${r}]`))}function m(n,e){if(!Array.isArray(n))throw new TypeError(`${e} must be an array`);return n.forEach((t,r)=>c(t,`${e}[${r}]`)),n}function M(n){return Uint8Array.from(n).buffer}function P(n,e){let t=H(n,e);if(!Number.isSafeInteger(t)||t<0)throw new TypeError(`${e} must be a non-negative safe integer`);return t}function v(n,e="word/_rels/document.xml.rels"){let t=JSON.parse(c$1(new TextEncoder().encode(n),e));h(t,"relationshipPart");let r=c(t,"relationshipPart");return p(r,["path","relationships","canonicalBase64","canonicalSha256"],"relationshipPart"),d(r.path,"relationshipPart.path"),x(r.relationships,"relationshipPart.relationships")}function W(n,e,t){let r=c(n,e);p(r,["id","type","target","targetMode"],e,["targetMode"]);let o=d(r.id,`${e}.id`);if(o!==t)throw new TypeError(`${e}.id does not match its map key`);let a={id:o,type:d(r.type,`${e}.type`),target:d(r.target,`${e}.target`)};if(r.targetMode!==void 0){if(r.targetMode!=="External"&&r.targetMode!=="Internal")throw new TypeError(`${e}.targetMode is invalid`);a.targetMode=r.targetMode;}return a}function h(n,e,t=new WeakSet){if(!(n===null||typeof n!="object")){if(t.has(n))throw new TypeError(`${e} contains a cycle`);t.add(n);try{for(let r of Object.keys(n)){if(U.has(r))throw new TypeError(`${e} contains forbidden key ${r}`);h(n[r],`${e}.${r}`,t);}}finally{t.delete(n);}}}function c(n,e){if(n===null||typeof n!="object"||Array.isArray(n))throw new TypeError(`${e} must be an object`);return n}function p(n,e,t,r=[]){let o=new Set(e);for(let i of Object.keys(n))if(!o.has(i))throw new TypeError(`${t} contains unknown key ${i}`);let a=new Set(r);for(let i of e)if(!a.has(i)&&!Object.prototype.hasOwnProperty.call(n,i))throw new TypeError(`${t} is missing ${i}`)}function d(n,e){if(typeof n!="string")throw new TypeError(`${e} must be a string`);return n}function H(n,e){if(typeof n!="number"||!Number.isFinite(n))throw new TypeError(`${e} must be a finite number`);return n}function b(n){let e;try{e=atob(n);}catch{throw new TypeError("wire canonicalBase64 is invalid")}let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t}export{Z as a,O as b,C as c,v as d};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { C as CollaborationReplica, b as CollaborationTransport, c as CollaborationProviderOptions, d as CollaborationStatus, e as CollaborationPeer, f as CollaborationCursor, g as CollaborationPeerListener, h as CollaborationStatusListener, i as CollaborationErrorListener, j as YrsSelection, Y as YrsSession } from '../index-
|
|
2
|
-
export { k as CollaborationAwarenessState, l as CollaborationError, m as CollaborationErrorCode, n as CollaborationPresence, o as CollaborationResolvedUser, p as CollaborationStatusChange, q as CollaborationTextInsertion, r as CollaborationTransportEvent, s as CollaborationUpdateOrigin, t as CollaborationUser } from '../index-
|
|
1
|
+
import { C as CollaborationReplica, b as CollaborationTransport, c as CollaborationProviderOptions, d as CollaborationStatus, e as CollaborationPeer, f as CollaborationCursor, g as CollaborationPeerListener, h as CollaborationStatusListener, i as CollaborationErrorListener, j as YrsSelection, Y as YrsSession } from '../index-CHy6_Yuo.mjs';
|
|
2
|
+
export { k as CollaborationAwarenessState, l as CollaborationError, m as CollaborationErrorCode, n as CollaborationPresence, o as CollaborationResolvedUser, p as CollaborationStatusChange, q as CollaborationTextInsertion, r as CollaborationTransportEvent, s as CollaborationUpdateOrigin, t as CollaborationUser } from '../index-CHy6_Yuo.mjs';
|
|
3
|
+
import '../formatting-gqLFeJ9X.mjs';
|
|
3
4
|
import '../types/document.mjs';
|
|
4
|
-
import '../content-
|
|
5
|
-
import '../formatting-7zKCTu5a.mjs';
|
|
5
|
+
import '../content-BzoC6bSz.mjs';
|
|
6
6
|
import '../docx/wrapTypes.mjs';
|
|
7
|
-
import '../styles-
|
|
8
|
-
import '../
|
|
7
|
+
import '../styles-AryxLAhx.mjs';
|
|
8
|
+
import '../pagedExport---0Dlmzo.mjs';
|
|
9
|
+
import '../frameDelta-ByU7HBuB.mjs';
|
|
10
|
+
import '../loadWasmAsset-Cr95TImt.mjs';
|
|
11
|
+
import '../rezip-Bxiq4Z_R.mjs';
|
|
9
12
|
|
|
10
13
|
declare class CollaborationProvider {
|
|
11
14
|
private readonly replica;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b,h}from'./chunk-LIGZ75FP.mjs';import {d}from'./chunk-RZQ3OXZY.mjs';import'./chunk-CTBUQRYQ.mjs';import'./chunk-LT2GCWZ3.mjs';import'./chunk-HPZFJGGM.mjs';import'./chunk-2QHGQA3V.mjs';import'./chunk-3CYO46ML.mjs';import'./chunk-6CHGYCFU.mjs';import'./chunk-TTRUPDAB.mjs';var l=1;function y(e){let s=new ArrayBuffer(e.byteLength);return new Uint8Array(s).set(e),s}async function S(e,s,g){let{createYrsSession:h$1}=await import('./yrs/index.mjs'),n=await h$1({clientId:l});try{let t=b(n),r=JSON.parse(t.compareDocx(e,s,JSON.stringify(g)));if(!r.ok)return {ok:!1,diagnostics:r.diagnostics};if(!r.save)return {ok:!0,docx:e.slice(),changes:r.changes,diagnostics:r.diagnostics};let o=r.save,d$1=n.materializeDocx();if(!d$1)throw new Error("the compared session holds no document");let i;try{let a=h(n,d$1,new Map(Object.entries(o.revisionIds))),p=await d(a,y(e),{updateModifiedDate:!1},{changedParaIds:[],sourceParagraphs:{partSha256:o.partSha256,paragraphs:o.paragraphs}},{seed:o.seed,now:o.now});i=new Uint8Array(p.buffer);}catch(a){let p=a instanceof Error?a.message:String(a);return JSON.parse(t.failComparedDocx(p))}let c=JSON.parse(t.finishComparedDocx(i));return c.ok?{...c,docx:i}:c}finally{n.destroy();}}export{S as compareDocxInSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as buildResidentRegionLayoutRequest,e as computeLayout,d as getLayoutKernelInputs,f as workerLayoutComputation}from'./chunk-NVN26RHH.mjs';import'./chunk-TTRUPDAB.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-
|
|
1
|
+
import { C as ColorValue, y as ThemeColorSlot, a as ParagraphFormatting, b as TextFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting, B as BorderSpec, m as ShapeType, k as ShapeFill, l as ShapeOutline, D as ShapeTextBody$1, P as PresetGeometryPathCommand } from './formatting-gqLFeJ9X.mjs';
|
|
2
2
|
import { WrapType } from './docx/wrapTypes.mjs';
|
|
3
3
|
|
|
4
4
|
interface ShapeFillPaint {
|
|
@@ -255,6 +255,12 @@ interface ListRendering {
|
|
|
255
255
|
markerFontFamily?: string;
|
|
256
256
|
/** Marker font size from numbering level rPr, in points */
|
|
257
257
|
markerFontSize?: number;
|
|
258
|
+
/** Marker bold from numbering level rPr, explicit false preserves Word normal */
|
|
259
|
+
markerBold?: boolean;
|
|
260
|
+
/** Marker italic from numbering level rPr */
|
|
261
|
+
markerItalic?: boolean;
|
|
262
|
+
/** Marker color from numbering level rPr */
|
|
263
|
+
markerColor?: ColorValue;
|
|
258
264
|
/**
|
|
259
265
|
* Suffix character placed after the marker before body text (§17.9.25).
|
|
260
266
|
* Default is `tab`; `space` inserts a single space; `nothing` no gap.
|
|
@@ -366,6 +372,8 @@ interface Table {
|
|
|
366
372
|
interface RawXml {
|
|
367
373
|
type: 'rawXml';
|
|
368
374
|
xml: string;
|
|
375
|
+
/** The source occurrence of its first `w:p`, on documents parsed for an editing session. */
|
|
376
|
+
sourceOrdinal?: number;
|
|
369
377
|
}
|
|
370
378
|
|
|
371
379
|
/**
|
|
@@ -565,6 +573,8 @@ interface Footnote {
|
|
|
565
573
|
}[];
|
|
566
574
|
/** Verbatim note XML for unmodeled bookmarks or custom XML. */
|
|
567
575
|
verbatimXml?: string;
|
|
576
|
+
/** The source occurrence of the verbatim note's first `w:p`, on documents parsed for an editing session. */
|
|
577
|
+
sourceOrdinal?: number;
|
|
568
578
|
}
|
|
569
579
|
/**
|
|
570
580
|
* Endnote (w:endnote)
|
|
@@ -588,6 +598,8 @@ interface Endnote {
|
|
|
588
598
|
}[];
|
|
589
599
|
/** Verbatim note XML for unmodeled blocks. */
|
|
590
600
|
verbatimXml?: string;
|
|
601
|
+
/** The source occurrence of the verbatim note's first `w:p`, on documents parsed for an editing session. */
|
|
602
|
+
sourceOrdinal?: number;
|
|
591
603
|
}
|
|
592
604
|
|
|
593
605
|
/**
|
|
@@ -1646,17 +1658,35 @@ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleFi
|
|
|
1646
1658
|
* Every paragraph carries direct formatting (`formatting`), tracked
|
|
1647
1659
|
* property changes (`propertyChanges`), inline content (`content`), and
|
|
1648
1660
|
* optional list rendering / section break metadata. `paraId` is Word's
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1661
|
+
* paragraph identifier (`w14:paraId`); editing sessions address paragraphs
|
|
1662
|
+
* by their own session keys instead.
|
|
1651
1663
|
*
|
|
1652
1664
|
* See ECMA-376 §17.3.1.
|
|
1653
1665
|
*/
|
|
1654
1666
|
interface Paragraph {
|
|
1655
1667
|
type: 'paragraph';
|
|
1656
|
-
/**
|
|
1668
|
+
/**
|
|
1669
|
+
* Word paragraph ID (`w14:paraId`), when the paragraph has a valid one.
|
|
1670
|
+
* Invalid authored values are kept verbatim in `extraAttributes` but are
|
|
1671
|
+
* not an identity.
|
|
1672
|
+
*/
|
|
1657
1673
|
paraId?: string;
|
|
1674
|
+
/** Set when `paraId` repeats an ID used earlier in the package; it is still this paragraph's own. */
|
|
1675
|
+
repeatedParaId?: boolean;
|
|
1676
|
+
/**
|
|
1677
|
+
* The extra attribute holding an invalid Word 2010 `paraId` under a prefix
|
|
1678
|
+
* other than `w14`; a save that sets `paraId` replaces it.
|
|
1679
|
+
*/
|
|
1680
|
+
paraIdAttribute?: string;
|
|
1681
|
+
/** This paragraph's `w:p` occurrence in its source part, on documents parsed for an editing session. */
|
|
1682
|
+
sourceOrdinal?: number;
|
|
1658
1683
|
/** Text ID */
|
|
1659
1684
|
textId?: string;
|
|
1685
|
+
/** `w:p` attributes the model does not type, kept verbatim so a save re-emits them. */
|
|
1686
|
+
extraAttributes?: {
|
|
1687
|
+
name: string;
|
|
1688
|
+
value: string;
|
|
1689
|
+
}[];
|
|
1660
1690
|
/** Paragraph formatting */
|
|
1661
1691
|
formatting?: ParagraphFormatting;
|
|
1662
1692
|
/** Paragraph-level tracked property changes (w:pPrChange) */
|
|
@@ -2024,10 +2054,17 @@ interface ChartTextProperties {
|
|
|
2024
2054
|
color?: string;
|
|
2025
2055
|
spacingPt?: number;
|
|
2026
2056
|
}
|
|
2057
|
+
/** A piece of a `c:tx` label: written text, or a field recomputed per point. */
|
|
2058
|
+
type ChartLabelRun = {
|
|
2059
|
+
Text: string;
|
|
2060
|
+
} | {
|
|
2061
|
+
Field: string;
|
|
2062
|
+
};
|
|
2027
2063
|
/** One `c:dLbl`: an index plus the switches it overrides. */
|
|
2028
2064
|
interface ChartPointLabel {
|
|
2029
2065
|
index?: number;
|
|
2030
2066
|
text?: string;
|
|
2067
|
+
runs?: ChartLabelRun[];
|
|
2031
2068
|
labels: ChartDataLabels;
|
|
2032
2069
|
}
|
|
2033
2070
|
/** A `c:dLbls`; every switch is optional so an unset one inherits. */
|
|
@@ -2048,7 +2085,8 @@ interface ChartDataLabels {
|
|
|
2048
2085
|
interface ChartSeries {
|
|
2049
2086
|
name?: string;
|
|
2050
2087
|
categories: string[];
|
|
2051
|
-
|
|
2088
|
+
/** A blank cell in the sheet travels as `null` and is not plotted. */
|
|
2089
|
+
values: (number | null)[];
|
|
2052
2090
|
color?: string;
|
|
2053
2091
|
index?: number;
|
|
2054
2092
|
order?: number;
|
|
@@ -2064,9 +2102,9 @@ interface ChartSeries {
|
|
|
2064
2102
|
};
|
|
2065
2103
|
smooth?: boolean;
|
|
2066
2104
|
/** `c:xVal` of a scatter or bubble series. */
|
|
2067
|
-
xValues?: number[];
|
|
2105
|
+
xValues?: (number | null)[];
|
|
2068
2106
|
/** `c:bubbleSize` of a bubble series. */
|
|
2069
|
-
bubbleSizes?: number[];
|
|
2107
|
+
bubbleSizes?: (number | null)[];
|
|
2070
2108
|
dataLabels?: ChartDataLabels;
|
|
2071
2109
|
}
|
|
2072
2110
|
interface ChartAxis {
|
|
@@ -2122,8 +2160,10 @@ interface ChartPlotGroup {
|
|
|
2122
2160
|
dataLabels?: ChartDataLabels;
|
|
2123
2161
|
}
|
|
2124
2162
|
interface ChartLegend {
|
|
2125
|
-
position?: 'left' | 'right' | 'top' | 'bottom';
|
|
2163
|
+
position?: 'left' | 'right' | 'top' | 'bottom' | 'topRight';
|
|
2126
2164
|
visible?: boolean;
|
|
2165
|
+
/** `c:overlay`: the legend sits on the plot instead of taking a band of it. */
|
|
2166
|
+
overlay?: boolean;
|
|
2127
2167
|
/** `c:txPr` on the legend; unset fields inherit from the chart. */
|
|
2128
2168
|
text?: ChartTextProperties;
|
|
2129
2169
|
}
|
package/dist/core.d.mts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
export { a as attemptSelectiveSave,
|
|
1
|
+
export { a as attemptSelectiveSave, p as parseDocx } from './selectiveSave-r-NMK6aI.mjs';
|
|
2
2
|
import { Document } from './types/document.mjs';
|
|
3
3
|
export { DocxPackage } from './types/document.mjs';
|
|
4
|
-
import { g as DocumentBody, f as SectionProperties, b4 as Table } from './content-
|
|
5
|
-
export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, T as Deletion, j as Endnote, Y as Field, a1 as FooterReference, i as Footnote, H as HeaderFooter, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, ak as Insertion, ao as ListLevel, ar as MoveFrom, au as MoveTo, h as NumberingDefinitions, P as Paragraph, aG as ParagraphContent, aK as Run, aL as RunContent, aV as Shape, b5 as TableCell, b8 as TableRow, bb as TextBox, bc as TextContent, be as TrackedChangeInfo, bf as TrackedRunChange } from './content-
|
|
4
|
+
import { g as DocumentBody, f as SectionProperties, b4 as Table } from './content-BzoC6bSz.mjs';
|
|
5
|
+
export { B as BlockContent, m as BookmarkEnd, n as BookmarkStart, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, T as Deletion, j as Endnote, Y as Field, a1 as FooterReference, i as Footnote, H as HeaderFooter, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, ak as Insertion, ao as ListLevel, ar as MoveFrom, au as MoveTo, h as NumberingDefinitions, P as Paragraph, aG as ParagraphContent, aK as Run, aL as RunContent, aV as Shape, b5 as TableCell, b8 as TableRow, bb as TextBox, bc as TextContent, be as TrackedChangeInfo, bf as TrackedRunChange } from './content-BzoC6bSz.mjs';
|
|
6
|
+
export { c as createDocx, r as repackDocx, u as updateMultipleFiles } from './rezip-Bxiq4Z_R.mjs';
|
|
7
|
+
import { D as DocxExportFailure, a as DocxExportOptions, b as DocxMarkdownContent, c as DocxStructuredContent, d as DocxPageExportOptions, e as DocxHeadlessLayoutOptions, f as DocxPagedStructuredContent, g as DocxSnapshotLayoutMap, h as DocxMarkdownOptions, i as DocxLayoutMap, j as DocxPageMarkdownOptions, k as DocxContentControlReadFailure, l as DocxContentControlQuery, m as DocxContentControlsOptions, n as DocxContentControlsSnapshot } from './pagedExport---0Dlmzo.mjs';
|
|
8
|
+
export { o as DocxAnchor, p as DocxAnchorScope, q as DocxCachedResult, r as DocxCommentMetadata, s as DocxContentControl, t as DocxContentControlDiagnostic, u as DocxContentControlSelector, v as DocxContentControlValue, w as DocxContentControlsResult, x as DocxControlMetadata, y as DocxExportBlock, z as DocxExportCell, A as DocxExportDiagnostic, B as DocxExportDiagnosticCode, C as DocxExportFailureCode, E as DocxExportInline, F as DocxExportPage, G as DocxExportRefusal, H as DocxExportResult, I as DocxExportStory, J as DocxExportTable, K as DocxFormattingMark, L as DocxFragmentGeometry, M as DocxHeadingInfo, N as DocxHeadlessFont, O as DocxInlineRevision, P as DocxLayoutProvenance, Q as DocxListInfo, R as DocxPageDiagnostic, S as DocxPageFragment, T as DocxPageMapContent, U as DocxParagraphData, V as DocxParagraphHeading, W as DocxRevisionView, X as DocxSnapshotLayoutProvenance, Y as DocxStoryKind, Z as DocxStoryOccurrence, _ as DocxStorySelection, $ as DocxUnlocatedReason } from './pagedExport---0Dlmzo.mjs';
|
|
6
9
|
export { emuToPixels, emuToTwips, formatPx, halfPointsToPixels, pixelsToEmu, pixelsToTwips, pointsToPixels, twipsToEmu, twipsToPixels } from './utils/units.mjs';
|
|
7
|
-
export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-
|
|
10
|
+
export { T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, h as generateThemeTintShadeMatrix, i as getContrastingColor, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, n as isFontsLoading, o as isGoogleFontsEnabled, p as isWhite, q as lightenColor, r as loadFont, s as loadFontFromBuffer, t as loadFonts, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from './fontLoader-BNSs0E8K.mjs';
|
|
8
11
|
export { D as DocxInput, t as toArrayBuffer } from './docxInput-DTbCa48g.mjs';
|
|
9
|
-
export { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext } from './plugin-api/index.mjs';
|
|
10
|
-
export { B as BlockExtent, F as FootnoteContent, L as Layout, b as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-
|
|
11
|
-
export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-
|
|
12
|
-
export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-
|
|
12
|
+
export { EditorPluginCore, PanelConfig, PluginPanelProps, PointPosition, PositionCoordinates, RenderedDomContext } from './plugin-api/index.mjs';
|
|
13
|
+
export { B as BlockExtent, F as FootnoteContent, L as Layout, b as LayoutBlock, P as Page, R as ResolvedLine, c as ResolvedSegment } from './types-D6Pra38E.mjs';
|
|
14
|
+
export { a as ParagraphFormatting, b as TextFormatting, f as Theme, x as ThemeColorScheme, z as ThemeFont, A as ThemeFontScheme } from './formatting-gqLFeJ9X.mjs';
|
|
15
|
+
export { d as Relationship, a as Style, S as StyleDefinitions } from './styles-AryxLAhx.mjs';
|
|
13
16
|
import './docx/wrapTypes.mjs';
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -30,6 +33,166 @@ declare function serializeDocumentBody(body: DocumentBody): string;
|
|
|
30
33
|
/** Serialize section properties. */
|
|
31
34
|
declare function serializeSectionProperties(props: SectionProperties | undefined): string;
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Headless structured export: DOCX bytes in, read-only structured content or Markdown out. The
|
|
38
|
+
* Rust engine does the reading and anchors address the returned snapshot only. Plain exports
|
|
39
|
+
* involve no session, editor, DOM or font; a paged export lays the bytes out in a private session
|
|
40
|
+
* with exactly the fonts it is given, in a font store no other session shares.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/** An export the engine refused as data: unusable options. */
|
|
44
|
+
declare class DocxExportError extends Error {
|
|
45
|
+
readonly failure: DocxExportFailure;
|
|
46
|
+
constructor(failure: DocxExportFailure);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Exports DOCX bytes as structured content. Throws {@link DocxExportError} for unusable options
|
|
50
|
+
* and an `Error` for bytes that are not a readable DOCX.
|
|
51
|
+
*/
|
|
52
|
+
declare function exportDocxStructured(bytes: Uint8Array, options: DocxExportOptions): Promise<DocxStructuredContent>;
|
|
53
|
+
/** {@link exportDocxStructured} rendered as Markdown with source anchors. */
|
|
54
|
+
declare function exportDocxMarkdown(bytes: Uint8Array, options: DocxExportOptions): Promise<DocxMarkdownContent>;
|
|
55
|
+
/** Renders structured content (schema version 1) as Markdown. */
|
|
56
|
+
declare function renderDocxMarkdown(content: DocxStructuredContent, options?: DocxMarkdownOptions): Promise<DocxMarkdownContent>;
|
|
57
|
+
/**
|
|
58
|
+
* Exports DOCX bytes as structured content with a page map. A private session opens the bytes
|
|
59
|
+
* and lays every section, header, footer and note out with exactly `layout.fonts`, registered in
|
|
60
|
+
* a measurement font store of its own so no editor's fonts change, and exports from that one
|
|
61
|
+
* captured state. Anchors address the returned snapshot and the map is deterministic for the
|
|
62
|
+
* same bytes, fonts and options. Throws {@link DocxExportError} for a refusal, a `TypeError` for
|
|
63
|
+
* an unknown, repeated or undecodable font key and an `Error` for bytes that are not a readable
|
|
64
|
+
* DOCX or fonts the engine rejects.
|
|
65
|
+
*/
|
|
66
|
+
declare function exportDocxStructuredWithPages(bytes: Uint8Array, options: DocxPageExportOptions, layout: DocxHeadlessLayoutOptions): Promise<DocxPagedStructuredContent<DocxSnapshotLayoutMap>>;
|
|
67
|
+
/**
|
|
68
|
+
* Renders a paged export as Markdown. With `pageMarkers`, each block marker is followed by
|
|
69
|
+
* `<!-- docx-pages: N=label ... -->`: the physical page indexes and percent-encoded displayed
|
|
70
|
+
* labels of every page showing the block. No page break is written into the text. Throws
|
|
71
|
+
* {@link DocxExportError} when the page map was not captured with the content.
|
|
72
|
+
*/
|
|
73
|
+
declare function renderDocxMarkdownWithPages(content: DocxPagedStructuredContent<DocxLayoutMap | DocxSnapshotLayoutMap>, options?: DocxPageMarkdownOptions): Promise<DocxMarkdownContent>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Compares the text of body paragraphs of unchanged structure in two DOCX packages into tracked
|
|
77
|
+
* changes; any other difference returns diagnostics, never a partial redline.
|
|
78
|
+
*/
|
|
79
|
+
/** Bounds a comparison enforces. The defaults are the largest values allowed; callers may tighten them. */
|
|
80
|
+
interface DocxCompareLimits {
|
|
81
|
+
/** Bytes of each input package. Default 32 MiB. */
|
|
82
|
+
maxInputBytes: number;
|
|
83
|
+
/** Inflated bytes of each input package. Default 128 MiB. */
|
|
84
|
+
maxExpandedBytes: number;
|
|
85
|
+
/** Paragraphs of each input, every story counted. Default 10,000. */
|
|
86
|
+
maxParagraphs: number;
|
|
87
|
+
/** UTF-16 units of text in every story of both inputs combined. Default 1,048,576. */
|
|
88
|
+
maxTextUnits: number;
|
|
89
|
+
/** Paragraph-alignment table cells, cumulative. Default 250,000. */
|
|
90
|
+
maxAlignmentCells: number;
|
|
91
|
+
/** Text-diff table cells, cumulative, similarity checks included. Default 4,000,000. */
|
|
92
|
+
maxDiffCells: number;
|
|
93
|
+
/** Changes, which is also the number of batch steps. Default 128. */
|
|
94
|
+
maxChanges: number;
|
|
95
|
+
/** Diagnostics; one more ends inspection with `diagnostics-truncated`. Default 256. */
|
|
96
|
+
maxDiagnostics: number;
|
|
97
|
+
/** Bytes of the encoded editing state staged for the batch. Default 64 MiB. */
|
|
98
|
+
maxStagedBytes: number;
|
|
99
|
+
/** Bytes of the result as JSON, without the output package; at least 1,024. Default 8 MiB. */
|
|
100
|
+
maxResultBytes: number;
|
|
101
|
+
/** Bytes of the output package, the unchanged original included. Default 64 MiB. */
|
|
102
|
+
maxOutputBytes: number;
|
|
103
|
+
}
|
|
104
|
+
interface DocxCompareOptions {
|
|
105
|
+
/** The author of every revision. Must not be blank or contain control characters. */
|
|
106
|
+
author: string;
|
|
107
|
+
/** RFC 3339 timestamp with an explicit offset, recorded in UTC. The clock is never read. */
|
|
108
|
+
date: string;
|
|
109
|
+
/** Unicode words, keeping punctuation and whitespace tokens (default), or grapheme clusters. */
|
|
110
|
+
granularity?: 'word' | 'char';
|
|
111
|
+
/**
|
|
112
|
+
* `fail` (default) stops at the first blocking condition; `report` keeps inspecting and
|
|
113
|
+
* returns every diagnostic. Neither returns a document while a blocking condition exists.
|
|
114
|
+
*/
|
|
115
|
+
unsupported?: 'fail' | 'report';
|
|
116
|
+
limits?: Partial<DocxCompareLimits>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Half-open UTF-16 range in the projected text of one input's body paragraph (tabs are `\t`,
|
|
120
|
+
* other inline atoms one U+FFFC). `path` is the paragraph's element-child path from the root of
|
|
121
|
+
* `part`, whose SHA-256 is `partSha256`. Spans address the inputs, not the output.
|
|
122
|
+
*/
|
|
123
|
+
interface DocxCompareTextSpan {
|
|
124
|
+
part: string;
|
|
125
|
+
partSha256: string;
|
|
126
|
+
path: number[];
|
|
127
|
+
start: number;
|
|
128
|
+
end: number;
|
|
129
|
+
text: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* One tracked replacement, ordered by original then revised position. An insertion has an empty
|
|
133
|
+
* `original` span and a deletion an empty `revised` span. `id` (`change-0`, …) is local to this
|
|
134
|
+
* result: neither an OOXML revision id nor a durable anchor.
|
|
135
|
+
*/
|
|
136
|
+
interface DocxComparedChange {
|
|
137
|
+
id: string;
|
|
138
|
+
kind: 'insertion' | 'deletion' | 'replacement';
|
|
139
|
+
original: DocxCompareTextSpan;
|
|
140
|
+
revised: DocxCompareTextSpan;
|
|
141
|
+
}
|
|
142
|
+
interface DocxCompareLocation {
|
|
143
|
+
input: 'original' | 'revised' | 'output';
|
|
144
|
+
part: string | null;
|
|
145
|
+
path: number[] | null;
|
|
146
|
+
start: number | null;
|
|
147
|
+
end: number | null;
|
|
148
|
+
}
|
|
149
|
+
type DocxCompareDiagnosticCode = 'invalid-options' | 'invalid-docx' | 'existing-revisions' | 'paragraph-insertion' | 'paragraph-deletion' | 'paragraph-move' | 'ambiguous-alignment' | 'table-change' | 'structure-change' | 'field-change' | 'object-change' | 'content-control-change' | 'formatting-change' | 'unsupported-content' | 'unsupported-formatting' | 'out-of-scope-change' | 'opaque-part-change' | 'provenance-unavailable' | 'ambiguous-identity' | 'metadata-difference' | 'limit-exceeded' | 'diagnostics-truncated' | 'batch-refused' | 'serialization-failed' | 'roundtrip-mismatch';
|
|
150
|
+
/** `error` diagnostics block the comparison; `info` and `warning` ones accompany a result. */
|
|
151
|
+
interface DocxCompareDiagnostic {
|
|
152
|
+
code: DocxCompareDiagnosticCode;
|
|
153
|
+
severity: 'info' | 'warning' | 'error';
|
|
154
|
+
message: string;
|
|
155
|
+
locations: DocxCompareLocation[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A redline, or a refusal as data; with no differences `docx` is the original bytes. Malformed
|
|
159
|
+
* options and internal failures throw.
|
|
160
|
+
*/
|
|
161
|
+
type DocxCompareResult = {
|
|
162
|
+
ok: true;
|
|
163
|
+
docx: Uint8Array;
|
|
164
|
+
changes: DocxComparedChange[];
|
|
165
|
+
diagnostics: DocxCompareDiagnostic[];
|
|
166
|
+
} | {
|
|
167
|
+
ok: false;
|
|
168
|
+
diagnostics: DocxCompareDiagnostic[];
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Compares two DOCX packages and returns the original with the revised body text differences
|
|
172
|
+
* as tracked changes by `options.author` at `options.date`.
|
|
173
|
+
*/
|
|
174
|
+
declare function compareDocx(original: Uint8Array, revised: Uint8Array, options: DocxCompareOptions): Promise<DocxCompareResult>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Headless content-control discovery: DOCX bytes in, the document's content controls out. The Rust
|
|
178
|
+
* engine does the reading; no session, editor or DOM is involved, and control ids and anchors
|
|
179
|
+
* address the returned snapshot only.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/** A read the engine refused as data: unusable options or a limit. */
|
|
183
|
+
declare class DocxContentControlsError extends Error {
|
|
184
|
+
readonly failure: DocxContentControlReadFailure;
|
|
185
|
+
constructor(failure: DocxContentControlReadFailure);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Lists the content controls of DOCX bytes in document order. Throws
|
|
189
|
+
* {@link DocxContentControlsError} for unusable options or an exceeded limit and an `Error` for
|
|
190
|
+
* bytes that are not a readable DOCX.
|
|
191
|
+
*/
|
|
192
|
+
declare function listDocxContentControls(bytes: Uint8Array, options?: DocxContentControlsOptions): Promise<DocxContentControlsSnapshot>;
|
|
193
|
+
/** The content controls of DOCX bytes that match `query` exactly; none or several. */
|
|
194
|
+
declare function findDocxContentControls(bytes: Uint8Array, query: DocxContentControlQuery, options?: DocxContentControlsOptions): Promise<DocxContentControlsSnapshot>;
|
|
195
|
+
|
|
33
196
|
/**
|
|
34
197
|
* Framework-agnostic print helpers shared by the React and Vue
|
|
35
198
|
* adapters. Lifted from packages/docx-react/src/components/ui/PrintPreview.tsx
|
|
@@ -255,4 +418,4 @@ declare class ErrorManager extends Subscribable<ErrorManagerSnapshot> {
|
|
|
255
418
|
*/
|
|
256
419
|
declare const VERSION: string;
|
|
257
420
|
|
|
258
|
-
export { type CellCoordinates, Document, DocumentBody, ErrorManager, type ErrorManagerSnapshot, type ErrorNotification, type ErrorSeverity, type PrintOptions, SectionProperties, Subscribable, TABLE_DATA_ATTRIBUTES, Table, TableSelectionManager, type TableSelectionSnapshot, VERSION, deleteTableFromDocument, findTableFromClick, formatPageRange, getDefaultPrintOptions, getTableFromDocument, isPrintSupported, openPrintWindow, parsePageRange, serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties, triggerPrint, updateTableInDocument };
|
|
421
|
+
export { type CellCoordinates, Document, DocumentBody, type DocxCompareDiagnostic, type DocxCompareDiagnosticCode, type DocxCompareLimits, type DocxCompareLocation, type DocxCompareOptions, type DocxCompareResult, type DocxCompareTextSpan, type DocxComparedChange, DocxContentControlQuery, DocxContentControlReadFailure, DocxContentControlsError, DocxContentControlsOptions, DocxContentControlsSnapshot, DocxExportError, DocxExportFailure, DocxExportOptions, DocxHeadlessLayoutOptions, DocxLayoutMap, DocxMarkdownContent, DocxMarkdownOptions, DocxPageExportOptions, DocxPageMarkdownOptions, DocxPagedStructuredContent, DocxSnapshotLayoutMap, DocxStructuredContent, ErrorManager, type ErrorManagerSnapshot, type ErrorNotification, type ErrorSeverity, type PrintOptions, SectionProperties, Subscribable, TABLE_DATA_ATTRIBUTES, Table, TableSelectionManager, type TableSelectionSnapshot, VERSION, compareDocx, deleteTableFromDocument, exportDocxMarkdown, exportDocxStructured, exportDocxStructuredWithPages, findDocxContentControls, findTableFromClick, formatPageRange, getDefaultPrintOptions, getTableFromDocument, isPrintSupported, listDocxContentControls, openPrintWindow, parsePageRange, renderDocxMarkdown, renderDocxMarkdownWithPages, serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties, triggerPrint, updateTableInDocument };
|
package/dist/core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{h as attemptSelectiveSave,g as createDocx,a as parseDocx,e as repackDocx,c as serializeDocumentBody,b as serializeDocx,d as serializeSectionProperties,f as updateMultipleFiles}from'./chunk-NMDQHUQB.mjs';import'./chunk-RZQ3OXZY.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'./chunk-LTVVQMHB.mjs';export{b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,c as pixelsToEmu,h as pixelsToTwips,d as pointsToPixels,j as twipsToEmu,g as twipsToPixels}from'./chunk-CTBUQRYQ.mjs';export{n as canRenderFont,k as getLoadedFonts,g as isFontLoaded,j as isFontsLoading,i as isGoogleFontsEnabled,e as loadFont,o as loadFontFromBuffer,f as loadFonts,l as onFontsLoaded,w as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'./chunk-ND3FBCB3.mjs';import'./chunk-YLFKV2NT.mjs';import'./chunk-LT2GCWZ3.mjs';import'./chunk-HPZFJGGM.mjs';import'./chunk-2QHGQA3V.mjs';import'./chunk-3CYO46ML.mjs';import'./chunk-6CHGYCFU.mjs';import'./chunk-DLXIZBB6.mjs';import {b as b$1}from'./chunk-TTRUPDAB.mjs';var v="0.4.0";var f=class extends Error{constructor(t){super(t.message);b$1(this,"failure");this.name="DocxExportError",this.failure=t;}};async function g(){let e=await import('./wasm-edit.mjs');return await e.preloadEditWasm(),e}function D(e){let o=JSON.parse(e);if(!o.ok)throw new f(o.failure);return o.content}async function Rt(e,o){let t=await g();return D(t.exportDocxStructuredJson(e,JSON.stringify(o)))}async function It(e,o){let t=await g();return D(t.exportDocxMarkdownJson(e,JSON.stringify(o)))}async function Ft(e,o={}){let t=await g();return D(t.renderDocxMarkdownJson(JSON.stringify(e),JSON.stringify(o)))}function Nt(e,o){let t={};for(let[n,r]of Object.entries(e.package.theme?.colorScheme??{}))typeof r=="string"&&(t[n]=r);return {themeColors:t,defaultTabStopTwips:o?.defaultTabStopTwips??e.package.settings?.defaultTabStop??null,numericIds:{},showHiddenText:o?.showHiddenText??false}}function At(e){let o;try{o=atob(e.data);}catch{throw new TypeError(`font ${JSON.stringify(e.key)} is not base64`)}let t=new Uint8Array(o.length);for(let n=0;n<o.length;n+=1)t[n]=o.charCodeAt(n);return t}async function Lt(e,o,t){await g();let[{createYrsSession:n},{buildResidentRegionLayoutRequest:r}]=await Promise.all([import('./yrs/index.mjs'),import('./computeLayout-4MNWHE2T.mjs')]),i=new Map,a=t.fonts.map((l,p)=>{if(i.has(l.key))throw new TypeError(`font key ${JSON.stringify(l.key)} is repeated`);return i.set(l.key,p),At(l)}),h=l=>l.map(p=>{let x=i.get(p);if(x===void 0)throw new TypeError(`font key ${JSON.stringify(p)} is not a font`);return x}),C=await n({clientId:1});try{let{document:l}=C.openDocx(e,!0),p=r(l,0,Nt(l,t.renderEnvironment)),x=l.package.settings?.compatibilityFlags,E={};p.measurement={fontChains:E,defaults:{fontSize:t.measurementDefaults?.fontSize??11,fontFamily:t.measurementDefaults?.fontFamily??"Calibri"},compat:{noLeading:t.compatibility?.noLeading??x?.noLeading??!1,doNotExpandShiftReturn:t.compatibility?.doNotExpandShiftReturn??x?.doNotExpandShiftReturn??!1},authoritativeShaping:!0};let L=JSON.parse(C.layoutFontRequirementsJson(JSON.stringify(p)));for(let d of L)E[d.key]=h(t.fontChains?.[d.key]??t.fontChains?.[d.family.toLowerCase()]??t.defaultChain);let P=new Uint8Array(a.reduce((d,M)=>d+M.length,0)),k=0;for(let d of a)P.set(d,k),k+=d.length;let T=C.exportSnapshotWithPrivateFonts(P,Uint32Array.from(a,d=>d.length),JSON.stringify(p),o);if(!T.ok)throw new f(T.failure);return T.content}finally{C.destroy();}}async function Mt(e,o={}){let t=await g();return D(t.renderDocxMarkdownWithPagesJson(JSON.stringify(e),JSON.stringify(o)))}async function jt(e,o,t){let{compareDocxInSession:n}=await import('./compareDocx-IHFPGIGV.mjs');return n(e,o,t)}var b=class extends Error{constructor(t){super(t.message);b$1(this,"failure");this.name="DocxContentControlsError",this.failure=t;}};async function O(){let e=await import('./wasm-edit.mjs');return await e.preloadEditWasm(),e}function R(e){let o=JSON.parse(e);if(!o.ok)throw new b(o.failure);return o.content}async function Bt(e,o={}){let t=await O();return R(t.listDocxContentControlsJson(e,JSON.stringify(o)))}async function Jt(e,o,t={}){let n=await O();return R(n.findDocxContentControlsJson(e,JSON.stringify(o),JSON.stringify(t)))}var Ut={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function Ht(){return {...Ut}}function Wt(){typeof window<"u"&&window.print();}var _t="@media print { body { margin: 0; padding: 0; } @page { margin: 0; } }";function $t(e="Document",o){if(typeof window>"u")return null;let t=window.open("","_blank");if(!t)return null;t.opener=null;let n=t.document;n.title=e;let r=n.createElement("style");r.textContent=_t,n.head.appendChild(r);let i=new DOMParser().parseFromString(o,"text/html");for(let a of Array.from(i.body.childNodes))n.body.appendChild(n.importNode(a,true));return t}function Xt(e,o){if(!e||!e.trim())return null;let t=e.trim();if(/^\d+$/.test(t)){let r=parseInt(t,10);return r>=1&&r<=o?{start:r,end:r}:null}let n=t.match(/^(\d+)-(\d+)$/);if(n){let r=parseInt(n[1],10),i=parseInt(n[2],10);if(r>=1&&i<=o&&r<=i)return {start:r,end:i}}return null}function zt(e,o){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${o} pages)`}function Vt(){return typeof window<"u"&&typeof window.print=="function"}var m=class{constructor(o){b$1(this,"listeners",new Set);b$1(this,"snapshot");b$1(this,"subscribe",o=>(this.listeners.add(o),()=>{this.listeners.delete(o);}));b$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=o;}setSnapshot(o){this.snapshot=o,this.notify();}notify(){for(let o of this.listeners)o();}};var y={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function I(e,o){if(!(e instanceof Element))return null;let t=e;for(;t&&t!==o;){if(t.tagName==="TD"||t.tagName==="TH"){let n=t.getAttribute(y.ROW_INDEX),r=t.getAttribute(y.COLUMN_INDEX);if(n!==null&&r!==null){let i=t;for(;i&&i!==o;){if(i.tagName==="TABLE"){let a=i.getAttribute(y.TABLE_INDEX);if(a!==null)return {tableIndex:parseInt(a,10),rowIndex:parseInt(n,10),columnIndex:parseInt(r,10)};break}i=i.parentElement;}}break}t=t.parentElement;}return null}function F(e,o){if(!e.package?.document?.content)return null;let t=0;for(let n of e.package.document.content)if(n.type==="table"){if(t===o)return n;t++;}return null}function N(e,o,t){if(!e.package?.document?.content)return e;let n=0,r=e.package.document.content.map(i=>{if(i.type==="table"){if(n===o)return n++,t;n++;}return i});return {...e,package:{...e.package,document:{...e.package.document,content:r}}}}function A(e,o){if(!e.package?.document?.content)return e;let t=0,n=e.package.document.content.filter(r=>{if(r.type==="table"){let i=t===o;return t++,!i}return true});return {...e,package:{...e.package,document:{...e.package.document,content:n}}}}var S=class extends m{constructor(){super({selectedCell:null});}selectCell(o){this.setSnapshot({selectedCell:o});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(o,t,n){let{selectedCell:r}=this.getSnapshot();return r?r.tableIndex===o&&r.rowIndex===t&&r.columnIndex===n:false}getSelectedCell(){return this.getSnapshot().selectedCell}};var w=class extends m{constructor(){super({notifications:[]});b$1(this,"notifications",[]);b$1(this,"idCounter",0);b$1(this,"timers",new Set);}showError(t,n){return this.addNotification(t,"error",n)}showWarning(t,n){return this.addNotification(t,"warning",n)}showInfo(t,n){return this.addNotification(t,"info",n)}dismiss(t){this.notifications=this.notifications.map(r=>r.id===t?{...r,dismissed:true}:r),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(r=>r.id!==t),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,n,r){let i=`error-${++this.idCounter}-${Date.now()}`,a={id:i,message:t,severity:n,details:r,timestamp:Date.now()};if(this.notifications=[...this.notifications,a],this.emitSnapshot(),n!=="error"){let h=setTimeout(()=>{this.timers.delete(h),this.dismiss(i);},5e3);this.timers.add(h);}return i}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Se=v;export{b as DocxContentControlsError,f as DocxExportError,w as ErrorManager,m as Subscribable,y as TABLE_DATA_ATTRIBUTES,S as TableSelectionManager,Se as VERSION,jt as compareDocx,A as deleteTableFromDocument,It as exportDocxMarkdown,Rt as exportDocxStructured,Lt as exportDocxStructuredWithPages,Jt as findDocxContentControls,I as findTableFromClick,zt as formatPageRange,Ht as getDefaultPrintOptions,F as getTableFromDocument,Vt as isPrintSupported,Bt as listDocxContentControls,$t as openPrintWindow,Xt as parsePageRange,Ft as renderDocxMarkdown,Mt as renderDocxMarkdownWithPages,Wt as triggerPrint,N as updateTableInDocument};
|