@betteroffice/docx 0.0.4 → 0.1.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.
Files changed (61) hide show
  1. package/README.md +2 -1
  2. package/dist/chunk-24DL53QL.mjs +1 -0
  3. package/dist/chunk-5F6DLQZP.mjs +1 -0
  4. package/dist/{chunk-YTILOUAA.mjs → chunk-BUZ2X5CT.mjs} +1 -1
  5. package/dist/{chunk-B4IR6YP4.mjs → chunk-GHEHBYQK.mjs} +1 -1
  6. package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
  7. package/dist/{chunk-4V6MDZIK.mjs → chunk-HTDNSQ44.mjs} +1 -1
  8. package/dist/{chunk-NTSSE5QK.mjs → chunk-PI2I3TO5.mjs} +1 -1
  9. package/dist/{chunk-6KDV6AIL.mjs → chunk-TMHG7OAZ.mjs} +1 -1
  10. package/dist/{chunk-NBSLB77E.mjs → chunk-VRGUAKOC.mjs} +1 -1
  11. package/dist/collaboration/index.d.mts +6 -6
  12. package/dist/{content-C3sTRz-u.d.mts → content-DrqzbIr7.d.mts} +67 -18
  13. package/dist/core.d.mts +7 -7
  14. package/dist/core.mjs +1 -1
  15. package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DGDR-OWc.d.mts} +87 -50
  16. package/dist/docx/index.d.mts +5 -5
  17. package/dist/docx/index.mjs +1 -1
  18. package/dist/editor/index.d.mts +8 -8
  19. package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-DnixuYST.d.mts} +1 -1
  20. package/dist/{formatting-BEkIBePP.d.mts → formatting-BqrFPeev.d.mts} +8 -0
  21. package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-DMgR8n13.d.mts} +15 -10
  22. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  23. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  24. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  25. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  26. package/dist/{index-2piKi4gO.d.mts → index-ImoMd0Ju.d.mts} +32 -65
  27. package/dist/layout/index.d.mts +40 -13
  28. package/dist/layout/index.mjs +1 -1
  29. package/dist/layout/pagination/index.d.mts +4 -4
  30. package/dist/layout/render/index.d.mts +33 -77
  31. package/dist/layout/render/index.mjs +1 -1
  32. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  33. package/dist/plugin-api/index.d.mts +3 -3
  34. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  35. package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-B9dQoLHI.d.mts} +74 -50
  36. package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
  37. package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
  38. package/dist/styles/index.d.mts +3 -3
  39. package/dist/{styles-BK3Jecxs.d.mts → styles-CMybYYHS.d.mts} +1 -1
  40. package/dist/types/content.d.mts +2 -2
  41. package/dist/types/document.d.mts +7 -7
  42. package/dist/{types-C1rv3KM-.d.mts → types-CXLxVF1t.d.mts} +27 -23
  43. package/dist/utils/comments.d.mts +2 -2
  44. package/dist/utils/index.d.mts +11 -13
  45. package/dist/utils/index.mjs +1 -1
  46. package/dist/utils/stylePreview.d.mts +2 -2
  47. package/dist/wasm-CJHQHBDE.mjs +1 -0
  48. package/dist/{wasm-JE7B3ROD.mjs → wasm-T2CRCO7S.mjs} +1 -1
  49. package/dist/wasm-edit.d.mts +505 -173
  50. package/dist/wasm-edit.mjs +1 -1
  51. package/dist/wasm-layout.d.mts +31 -28
  52. package/dist/wasm-layout.mjs +1 -1
  53. package/dist/wasm-opc.mjs +1 -1
  54. package/dist/wasm-parse.mjs +1 -1
  55. package/dist/yrs/index.d.mts +5 -5
  56. package/dist/yrs/index.mjs +1 -1
  57. package/dist/yrs/residentEngineWorker.mjs +1 -1
  58. package/package.json +19 -2
  59. package/dist/chunk-GGEGIQRK.mjs +0 -1
  60. package/dist/chunk-T4EZMUXM.mjs +0 -1
  61. package/dist/wasm-F2ETFAYL.mjs +0 -1
@@ -1,12 +1,12 @@
1
1
  export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
2
- export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-CMH3bZ2Z.mjs';
2
+ export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-DnixuYST.mjs';
3
3
  export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
4
- import { F as FontTable } from '../styles-BK3Jecxs.mjs';
4
+ import { F as FontTable } from '../styles-CMybYYHS.mjs';
5
5
  import { Document } from '../types/document.mjs';
6
6
  import { FontOption } from './fontOptions.mjs';
7
7
  export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
8
- import { f as Comment } from '../content-C3sTRz-u.mjs';
9
- import '../formatting-BEkIBePP.mjs';
8
+ import { f as Comment } from '../content-DrqzbIr7.mjs';
9
+ import '../formatting-BqrFPeev.mjs';
10
10
  import '../docx/wrapTypes.mjs';
11
11
 
12
12
  /**
@@ -95,7 +95,7 @@ declare function getEmbeddedFontFaces(fontTable: FontTable | undefined, rawFonts
95
95
  * buffer, or the parts cannot be resolved. The zip pass goes through the
96
96
  * hardened `unzipDocx` container facade.
97
97
  *
98
- * Used by the experimental Rust measurement source, which needs the byte
98
+ * Used by measurement, which needs the byte
99
99
  * form of every embedded face for the wasm FontStore.
100
100
  *
101
101
  * @public
@@ -199,11 +199,11 @@ interface HeadingInfo {
199
199
  text: string;
200
200
  /** Outline level (0 = Heading 1, 1 = Heading 2, etc.) */
201
201
  level: number;
202
- /** ProseMirror document position of the paragraph node */
202
+ /** Document position of the paragraph node */
203
203
  pmPos: number;
204
204
  }
205
205
  /**
206
- * Collect all headings from a ProseMirror document.
206
+ * Collect all headings from a document.
207
207
  *
208
208
  * Detection logic:
209
209
  * 1. Check `outlineLevel` attr (set by OOXML parsing or style resolution)
@@ -276,12 +276,11 @@ declare function flashParagraphFragmentsByParaId(root: ParentNode, paraId: strin
276
276
  *
277
277
  * This module contains the pure layout computation for splitting a table cell:
278
278
  * column width redistribution, neighbor span adjustment, and new-cell placement.
279
- * Both the ProseMirror path (tableSplit.ts) and the Document-model path
280
- * (TableToolbar.tsx) delegate to these functions.
279
+ * The Document-model path (TableToolbar.tsx) delegates to these functions.
281
280
  */
282
281
  /** A cell's position and span within the logical grid. */
283
282
  interface CellAnchor<T> {
284
- /** Opaque payload — the caller's cell type (PMNode, TableCell, etc.) */
283
+ /** Opaque payload — the caller's cell type (TableCell, etc.) */
285
284
  data: T;
286
285
  row: number;
287
286
  col: number;
@@ -317,9 +316,8 @@ declare function redistributeColumnWidths(existing: number[], startCol: number,
317
316
  /**
318
317
  * Compute the new anchor layout after splitting a target cell.
319
318
  *
320
- * This is the core algorithm shared between ProseMirror and Document-model
321
- * paths. It adjusts neighbor spans, shifts positions for inserted rows/cols,
322
- * and creates placeholder anchors for the new split cells.
319
+ * This is the core algorithm. It adjusts neighbor spans, shifts positions for
320
+ * inserted rows/cols, and creates placeholder anchors for the new split cells.
323
321
  *
324
322
  * @param anchors All cell anchors in the current table.
325
323
  * @param target The anchor being split.
@@ -1 +1 @@
1
- export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.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,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-YTILOUAA.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-YTILOUAA.mjs';import'../chunk-6KDV6AIL.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
1
+ export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.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,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-BUZ2X5CT.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-BUZ2X5CT.mjs';import'../chunk-TMHG7OAZ.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-GHEHBYQK.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
@@ -1,5 +1,5 @@
1
- import { a as Style } from '../styles-BK3Jecxs.mjs';
2
- import '../formatting-BEkIBePP.mjs';
1
+ import { a as Style } from '../styles-CMybYYHS.mjs';
2
+ import '../formatting-BqrFPeev.mjs';
3
3
 
4
4
  /**
5
5
  * Paragraph-style preview + option resolution — shared between the React and
@@ -0,0 +1 @@
1
+ import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,a as preloadEditWasm}from'./chunk-HTDNSQ44.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1 +1 @@
1
- export{p as buildDisplayListJson,s as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,t as measureParagraphJson,f as openDisplayList,u as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-NBSLB77E.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
1
+ export{p as buildDisplayListJson,s as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,t as measureParagraphJson,f as openDisplayList,u as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-VRGUAKOC.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';