@eigenpal/docx-editor-core 1.3.0 → 1.3.2

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 (107) hide show
  1. package/dist/chunk-2LEFMTNZ.mjs +1 -0
  2. package/dist/chunk-4MYKVWNF.js +1 -0
  3. package/dist/chunk-4PANZ3VU.js +1 -0
  4. package/dist/{chunk-Q5B5GKXD.mjs → chunk-55XWETY4.mjs} +1 -1
  5. package/dist/chunk-6WZW3NSJ.js +1 -0
  6. package/dist/chunk-HKN2NKOG.mjs +1 -0
  7. package/dist/chunk-HPJBZL37.mjs +1 -0
  8. package/dist/{chunk-TURYWKNS.js → chunk-J3YFJDZD.js} +1 -1
  9. package/dist/chunk-JHTURDPX.mjs +1 -0
  10. package/dist/chunk-KKXCBWVG.mjs +1 -0
  11. package/dist/chunk-LJE7HQEJ.mjs +1 -0
  12. package/dist/chunk-LX35TFGF.mjs +1 -0
  13. package/dist/chunk-NRWQ65NX.js +1 -0
  14. package/dist/chunk-PFMM7QON.js +1 -0
  15. package/dist/chunk-PMSGJXOE.mjs +1 -0
  16. package/dist/chunk-QVRNNRG5.js +1 -0
  17. package/dist/chunk-RSU4HTC6.js +1 -0
  18. package/dist/{chunk-L6YTCHOQ.mjs → chunk-UEPLDKKM.mjs} +1 -1
  19. package/dist/chunk-YPQACU4A.js +1 -0
  20. package/dist/{chunk-TJRROR6U.js → chunk-ZAZWHK4J.js} +1 -1
  21. package/dist/core.d.mts +2 -2
  22. package/dist/core.d.ts +2 -2
  23. package/dist/core.js +1 -1
  24. package/dist/core.mjs +1 -1
  25. package/dist/editor/index.d.mts +128 -0
  26. package/dist/editor/index.d.ts +128 -0
  27. package/dist/editor/index.js +1 -0
  28. package/dist/editor/index.mjs +1 -0
  29. package/dist/{footnotes-BtVc6VFl.d.mts → footnotes-BZ24OTAT.d.mts} +11 -1
  30. package/dist/{footnotes-DcUMWXul.d.ts → footnotes-DMsicPGd.d.ts} +11 -1
  31. package/dist/{headerFooterLayout-4E-S4Aay.d.ts → headerFooterLayout-AtAOhM8E.d.ts} +18 -2
  32. package/dist/{headerFooterLayout-DlJLWmpR.d.mts → headerFooterLayout-CU6hvszp.d.mts} +18 -2
  33. package/dist/layout-bridge/clickToPositionDom.js +1 -1
  34. package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
  35. package/dist/layout-bridge/index.d.mts +109 -5
  36. package/dist/layout-bridge/index.d.ts +109 -5
  37. package/dist/layout-bridge/index.js +1 -1
  38. package/dist/layout-bridge/index.mjs +1 -1
  39. package/dist/layout-bridge/measuring/index.d.mts +5 -95
  40. package/dist/layout-bridge/measuring/index.d.ts +5 -95
  41. package/dist/layout-bridge/measuring/index.js +1 -1
  42. package/dist/layout-bridge/measuring/index.mjs +1 -1
  43. package/dist/layout-bridge/tableInsertHover.js +1 -1
  44. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  45. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  46. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  47. package/dist/layout-engine/index.js +1 -1
  48. package/dist/layout-engine/index.mjs +1 -1
  49. package/dist/layout-painter/index.d.mts +2 -2
  50. package/dist/layout-painter/index.d.ts +2 -2
  51. package/dist/layout-painter/index.js +1 -1
  52. package/dist/layout-painter/index.mjs +1 -1
  53. package/dist/layout-painter/renderPage.d.mts +8 -3
  54. package/dist/layout-painter/renderPage.d.ts +8 -3
  55. package/dist/layout-painter/renderPage.js +1 -1
  56. package/dist/layout-painter/renderPage.mjs +1 -1
  57. package/dist/measureBlocksPipeline-BMqbRFQB.d.mts +96 -0
  58. package/dist/measureBlocksPipeline-iYNzAH-o.d.ts +96 -0
  59. package/dist/prosemirror/applyFormatting.d.mts +67 -0
  60. package/dist/prosemirror/applyFormatting.d.ts +67 -0
  61. package/dist/prosemirror/applyFormatting.js +1 -0
  62. package/dist/prosemirror/applyFormatting.mjs +1 -0
  63. package/dist/prosemirror/commentIdAllocator.d.mts +50 -0
  64. package/dist/prosemirror/commentIdAllocator.d.ts +50 -0
  65. package/dist/prosemirror/commentIdAllocator.js +1 -0
  66. package/dist/prosemirror/commentIdAllocator.mjs +1 -0
  67. package/dist/prosemirror/commentOps.d.mts +46 -0
  68. package/dist/prosemirror/commentOps.d.ts +46 -0
  69. package/dist/prosemirror/commentOps.js +1 -0
  70. package/dist/prosemirror/commentOps.mjs +1 -0
  71. package/dist/prosemirror/conversion/index.js +1 -1
  72. package/dist/prosemirror/conversion/index.mjs +1 -1
  73. package/dist/prosemirror/imageCommit.d.mts +35 -0
  74. package/dist/prosemirror/imageCommit.d.ts +35 -0
  75. package/dist/prosemirror/imageCommit.js +1 -0
  76. package/dist/prosemirror/imageCommit.mjs +1 -0
  77. package/dist/prosemirror/index.js +2 -2
  78. package/dist/prosemirror/index.mjs +1 -1
  79. package/dist/prosemirror/paraText.d.mts +52 -0
  80. package/dist/prosemirror/paraText.d.ts +52 -0
  81. package/dist/prosemirror/paraText.js +1 -0
  82. package/dist/prosemirror/paraText.mjs +1 -0
  83. package/dist/prosemirror/queries.d.mts +65 -0
  84. package/dist/prosemirror/queries.d.ts +65 -0
  85. package/dist/prosemirror/queries.js +2 -0
  86. package/dist/prosemirror/queries.mjs +2 -0
  87. package/dist/prosemirror/tableResize.d.mts +58 -0
  88. package/dist/prosemirror/tableResize.d.ts +58 -0
  89. package/dist/prosemirror/tableResize.js +1 -0
  90. package/dist/prosemirror/tableResize.mjs +1 -0
  91. package/dist/utils/autoScroll.d.mts +24 -0
  92. package/dist/utils/autoScroll.d.ts +24 -0
  93. package/dist/utils/autoScroll.js +1 -0
  94. package/dist/utils/autoScroll.mjs +1 -0
  95. package/package.json +73 -1
  96. package/dist/chunk-72KLR6TJ.mjs +0 -1
  97. package/dist/chunk-7JQVKJRN.mjs +0 -1
  98. package/dist/chunk-7WGN2OBZ.js +0 -1
  99. package/dist/chunk-B46V5G46.mjs +0 -1
  100. package/dist/chunk-BUCOTKYY.js +0 -1
  101. package/dist/chunk-FQS436KN.js +0 -1
  102. package/dist/chunk-IUVQJ6PX.mjs +0 -1
  103. package/dist/chunk-JUMHC5Z6.mjs +0 -1
  104. package/dist/chunk-MEVZCB56.mjs +0 -1
  105. package/dist/chunk-T4RYVPAB.js +0 -1
  106. package/dist/chunk-WDBZ3QVB.js +0 -1
  107. package/dist/chunk-XWC67YLW.js +0 -1
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkTE2VQJZG_js=require('./chunk-TE2VQJZG.js'),chunk4G6AJ4ZM_js=require('./chunk-4G6AJ4ZM.js'),chunkY74ANBPV_js=require('./chunk-Y74ANBPV.js'),chunkXWC67YLW_js=require('./chunk-XWC67YLW.js');require('./chunk-TJRROR6U.js');var chunkWDBZ3QVB_js=require('./chunk-WDBZ3QVB.js');require('./chunk-FQS436KN.js'),require('./chunk-7WGN2OBZ.js'),require('./chunk-TURYWKNS.js'),require('./chunk-T4RYVPAB.js'),require('./chunk-IMKU4O3P.js'),require('./chunk-DROCYKAR.js');var chunkKESNGXGO_js=require('./chunk-KESNGXGO.js'),chunk2SGJZYQF_js=require('./chunk-2SGJZYQF.js'),chunkCZSAC65M_js=require('./chunk-CZSAC65M.js'),chunkNXLJVVVE_js=require('./chunk-NXLJVVVE.js'),chunk3QPKTG2Y_js=require('./chunk-3QPKTG2Y.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkESI4BSBF_js=require('./chunk-ESI4BSBF.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkBH3ACQ3M_js=require('./chunk-BH3ACQ3M.js'),chunkNAFMAKLK_js=require('./chunk-NAFMAKLK.js'),chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkOTHV7YV2_js=require('./chunk-OTHV7YV2.js');require('./chunk-LERLET2D.js'),require('./chunk-FIGLFSNR.js');var chunkMNOHUTKE_js=require('./chunk-MNOHUTKE.js'),chunkI6PMX4BO_js=require('./chunk-I6PMX4BO.js');require('./chunk-BUCOTKYY.js'),require('./chunk-C45EFOVP.js'),require('./chunk-ISKTBM4L.js'),require('./chunk-JFZIXFRC.js'),require('./chunk-RQVHKDXK.js'),require('./chunk-SCK6ZM5V.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-WWBNJ7KF.js'),require('./chunk-4RTVLMRZ.js'),require('./chunk-BHBOAP6Z.js'),require('./chunk-MZ7LW5CH.js'),require('./chunk-N3Y5BUKV.js'),require('./chunk-WVERBZZU.js'),require('./chunk-6LVPRTB6.js'),require('./chunk-LWH66Q7Q.js'),require('./chunk-TUIEV7Q7.js'),require('./chunk-7HANRHHL.js');var chunkMJ5FQX7Q_js=require('./chunk-MJ5FQX7Q.js');require('./chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');require('./chunk-GSKMHXHG.js');var chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends chunkY74ANBPV_js.a{constructor(){super({notifications:[]});chunkDC7S76ZX_js.a(this,"notifications",[]);chunkDC7S76ZX_js.a(this,"idCounter",0);chunkDC7S76ZX_js.a(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends chunkY74ANBPV_js.a{constructor(){super({states:new Map,version:0});chunkDC7S76ZX_js.a(this,"plugins",[]);chunkDC7S76ZX_js.a(this,"pluginStates",new Map);chunkDC7S76ZX_js.a(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends chunkY74ANBPV_js.a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});chunkDC7S76ZX_js.a(this,"_hasLayout",false);chunkDC7S76ZX_js.a(this,"_selectionRects",[]);chunkDC7S76ZX_js.a(this,"_caretPosition",null);chunkDC7S76ZX_js.a(this,"_isDragging",false);chunkDC7S76ZX_js.a(this,"_dragAnchor",null);chunkDC7S76ZX_js.a(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});chunkDC7S76ZX_js.a(this,"_selectedImageInfo",null);chunkDC7S76ZX_js.a(this,"_isImageInteracting",false);chunkDC7S76ZX_js.a(this,"_isFocused",false);chunkDC7S76ZX_js.a(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends chunkY74ANBPV_js.a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});chunkDC7S76ZX_js.a(this,"_loadingState","idle");chunkDC7S76ZX_js.a(this,"_parseError",null);chunkDC7S76ZX_js.a(this,"_zoom");chunkDC7S76ZX_js.a(this,"_fontsLoaded",false);chunkDC7S76ZX_js.a(this,"_document",null);chunkDC7S76ZX_js.a(this,"_version",0);chunkDC7S76ZX_js.a(this,"onChangeCallback");chunkDC7S76ZX_js.a(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";Object.defineProperty(exports,"AutoSaveManager",{enumerable:true,get:function(){return chunkTE2VQJZG_js.a}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunkTE2VQJZG_js.b}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.e}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunkTE2VQJZG_js.c}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.d}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunkTE2VQJZG_js.f}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.a}});Object.defineProperty(exports,"TableSelectionManager",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.f}});Object.defineProperty(exports,"deleteTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.e}});Object.defineProperty(exports,"findTableFromClick",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.b}});Object.defineProperty(exports,"getTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.c}});Object.defineProperty(exports,"updateTableInDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.d}});Object.defineProperty(exports,"Subscribable",{enumerable:true,get:function(){return chunkY74ANBPV_js.a}});Object.defineProperty(exports,"convertHeaderFooterToContent",{enumerable:true,get:function(){return chunkXWC67YLW_js.w}});Object.defineProperty(exports,"FOOTNOTE_SEPARATOR_HEIGHT",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.a}});Object.defineProperty(exports,"MAX_FOOTNOTE_LAYOUT_PASSES",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.b}});Object.defineProperty(exports,"buildFootnoteContentMap",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.h}});Object.defineProperty(exports,"buildFootnoteRenderItems",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.k}});Object.defineProperty(exports,"calculateFootnoteReservedHeights",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.i}});Object.defineProperty(exports,"collectFootnoteRefs",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.d}});Object.defineProperty(exports,"footnoteReservedHeightsEqual",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.c}});Object.defineProperty(exports,"mapFootnotesToPages",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.e}});Object.defineProperty(exports,"stabilizeFootnoteLayout",{enumerable:true,get:function(){return chunkWDBZ3QVB_js.j}});Object.defineProperty(exports,"countPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.n}});Object.defineProperty(exports,"createColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.b}});Object.defineProperty(exports,"createHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.g}});Object.defineProperty(exports,"createLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.c}});Object.defineProperty(exports,"createPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.a}});Object.defineProperty(exports,"createPageBreakParagraph",{enumerable:true,get:function(){return chunkKESNGXGO_js.e}});Object.defineProperty(exports,"createPageBreakRun",{enumerable:true,get:function(){return chunkKESNGXGO_js.d}});Object.defineProperty(exports,"findPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.o}});Object.defineProperty(exports,"hasPageBreakBefore",{enumerable:true,get:function(){return chunkKESNGXGO_js.m}});Object.defineProperty(exports,"insertHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.h}});Object.defineProperty(exports,"insertPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.f}});Object.defineProperty(exports,"isBreakContent",{enumerable:true,get:function(){return chunkKESNGXGO_js.l}});Object.defineProperty(exports,"isColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.j}});Object.defineProperty(exports,"isLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.k}});Object.defineProperty(exports,"isPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.i}});Object.defineProperty(exports,"removePageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.p}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunk2SGJZYQF_js.a}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.g}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.d}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunk2SGJZYQF_js.f}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkCZSAC65M_js.c}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkCZSAC65M_js.b}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkCZSAC65M_js.a}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkNXLJVVVE_js.b}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkNXLJVVVE_js.a}});Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunk3QPKTG2Y_js.b}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.i}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.g}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.j}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.h}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkESI4BSBF_js.e}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.a}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkESI4BSBF_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkESI4BSBF_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.f}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkTE2AF7FM_js.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkTE2AF7FM_js.b}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.t}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.i}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.m}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkNAFMAKLK_js.g}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkNAFMAKLK_js.h}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkNAFMAKLK_js.c}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.a}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk4BFNWPKW_js.c}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkOTHV7YV2_js.f}});Object.defineProperty(exports,"canRenderFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.h}});Object.defineProperty(exports,"getLoadedFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.e}});Object.defineProperty(exports,"isFontLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.c}});Object.defineProperty(exports,"isFontsLoading",{enumerable:true,get:function(){return chunkMNOHUTKE_js.d}});Object.defineProperty(exports,"loadFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.a}});Object.defineProperty(exports,"loadFontFromBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.i}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.b}});Object.defineProperty(exports,"onFontsLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.f}});Object.defineProperty(exports,"preloadCommonFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.p}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.s}});Object.defineProperty(exports,"findParagraphByParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.b}});Object.defineProperty(exports,"findStartPosForParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.a}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.m}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.r}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.j}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.i}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.k}});Object.defineProperty(exports,"ensureHexPrefix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.n}});Object.defineProperty(exports,"generateThemeTintShadeMatrix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.q}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.g}});Object.defineProperty(exports,"getThemeTintShadeHex",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.p}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.e}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.f}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.l}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.h}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.c}});Object.defineProperty(exports,"resolveHighlightToCss",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.o}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.e}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.g}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.p}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.j}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.f}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.d}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.i}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.h}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.c}});exports.EditorCoordinator=g;exports.ErrorManager=d;exports.LayoutCoordinator=p;exports.PluginLifecycleManager=u;exports.VERSION=to;exports.createSelectionFromDOM=A;exports.extractFormattingFromElement=h;exports.getSelectionRuns=f;exports.injectStyles=z;exports.rgbToHex=S;
1
+ 'use strict';var chunkTE2VQJZG_js=require('./chunk-TE2VQJZG.js'),chunk4G6AJ4ZM_js=require('./chunk-4G6AJ4ZM.js'),chunkY74ANBPV_js=require('./chunk-Y74ANBPV.js'),chunk4PANZ3VU_js=require('./chunk-4PANZ3VU.js');require('./chunk-ZAZWHK4J.js');var chunkPFMM7QON_js=require('./chunk-PFMM7QON.js');require('./chunk-YPQACU4A.js'),require('./chunk-4MYKVWNF.js'),require('./chunk-J3YFJDZD.js'),require('./chunk-RSU4HTC6.js'),require('./chunk-IMKU4O3P.js'),require('./chunk-DROCYKAR.js');var chunkKESNGXGO_js=require('./chunk-KESNGXGO.js'),chunk2SGJZYQF_js=require('./chunk-2SGJZYQF.js'),chunkCZSAC65M_js=require('./chunk-CZSAC65M.js'),chunkNXLJVVVE_js=require('./chunk-NXLJVVVE.js'),chunk3QPKTG2Y_js=require('./chunk-3QPKTG2Y.js'),chunkU4UCHBZ7_js=require('./chunk-U4UCHBZ7.js'),chunkESI4BSBF_js=require('./chunk-ESI4BSBF.js'),chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkBH3ACQ3M_js=require('./chunk-BH3ACQ3M.js'),chunkNAFMAKLK_js=require('./chunk-NAFMAKLK.js'),chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkOTHV7YV2_js=require('./chunk-OTHV7YV2.js');require('./chunk-LERLET2D.js'),require('./chunk-FIGLFSNR.js');var chunkMNOHUTKE_js=require('./chunk-MNOHUTKE.js'),chunkI6PMX4BO_js=require('./chunk-I6PMX4BO.js');require('./chunk-QVRNNRG5.js'),require('./chunk-C45EFOVP.js'),require('./chunk-ISKTBM4L.js'),require('./chunk-JFZIXFRC.js'),require('./chunk-RQVHKDXK.js'),require('./chunk-SCK6ZM5V.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-WWBNJ7KF.js'),require('./chunk-4RTVLMRZ.js'),require('./chunk-BHBOAP6Z.js'),require('./chunk-MZ7LW5CH.js'),require('./chunk-N3Y5BUKV.js'),require('./chunk-WVERBZZU.js'),require('./chunk-6LVPRTB6.js'),require('./chunk-LWH66Q7Q.js'),require('./chunk-TUIEV7Q7.js'),require('./chunk-7HANRHHL.js');var chunkMJ5FQX7Q_js=require('./chunk-MJ5FQX7Q.js');require('./chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('./chunk-4Q2IP5FW.js');require('./chunk-GSKMHXHG.js');var chunkDC7S76ZX_js=require('./chunk-DC7S76ZX.js');function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends chunkY74ANBPV_js.a{constructor(){super({notifications:[]});chunkDC7S76ZX_js.a(this,"notifications",[]);chunkDC7S76ZX_js.a(this,"idCounter",0);chunkDC7S76ZX_js.a(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends chunkY74ANBPV_js.a{constructor(){super({states:new Map,version:0});chunkDC7S76ZX_js.a(this,"plugins",[]);chunkDC7S76ZX_js.a(this,"pluginStates",new Map);chunkDC7S76ZX_js.a(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends chunkY74ANBPV_js.a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});chunkDC7S76ZX_js.a(this,"_hasLayout",false);chunkDC7S76ZX_js.a(this,"_selectionRects",[]);chunkDC7S76ZX_js.a(this,"_caretPosition",null);chunkDC7S76ZX_js.a(this,"_isDragging",false);chunkDC7S76ZX_js.a(this,"_dragAnchor",null);chunkDC7S76ZX_js.a(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});chunkDC7S76ZX_js.a(this,"_selectedImageInfo",null);chunkDC7S76ZX_js.a(this,"_isImageInteracting",false);chunkDC7S76ZX_js.a(this,"_isFocused",false);chunkDC7S76ZX_js.a(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends chunkY74ANBPV_js.a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});chunkDC7S76ZX_js.a(this,"_loadingState","idle");chunkDC7S76ZX_js.a(this,"_parseError",null);chunkDC7S76ZX_js.a(this,"_zoom");chunkDC7S76ZX_js.a(this,"_fontsLoaded",false);chunkDC7S76ZX_js.a(this,"_document",null);chunkDC7S76ZX_js.a(this,"_version",0);chunkDC7S76ZX_js.a(this,"onChangeCallback");chunkDC7S76ZX_js.a(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";Object.defineProperty(exports,"AutoSaveManager",{enumerable:true,get:function(){return chunkTE2VQJZG_js.a}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunkTE2VQJZG_js.b}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.e}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunkTE2VQJZG_js.c}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunkTE2VQJZG_js.d}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunkTE2VQJZG_js.f}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.a}});Object.defineProperty(exports,"TableSelectionManager",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.f}});Object.defineProperty(exports,"deleteTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.e}});Object.defineProperty(exports,"findTableFromClick",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.b}});Object.defineProperty(exports,"getTableFromDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.c}});Object.defineProperty(exports,"updateTableInDocument",{enumerable:true,get:function(){return chunk4G6AJ4ZM_js.d}});Object.defineProperty(exports,"Subscribable",{enumerable:true,get:function(){return chunkY74ANBPV_js.a}});Object.defineProperty(exports,"convertHeaderFooterToContent",{enumerable:true,get:function(){return chunk4PANZ3VU_js.y}});Object.defineProperty(exports,"FOOTNOTE_SEPARATOR_HEIGHT",{enumerable:true,get:function(){return chunkPFMM7QON_js.a}});Object.defineProperty(exports,"MAX_FOOTNOTE_LAYOUT_PASSES",{enumerable:true,get:function(){return chunkPFMM7QON_js.b}});Object.defineProperty(exports,"buildFootnoteContentMap",{enumerable:true,get:function(){return chunkPFMM7QON_js.h}});Object.defineProperty(exports,"buildFootnoteRenderItems",{enumerable:true,get:function(){return chunkPFMM7QON_js.k}});Object.defineProperty(exports,"calculateFootnoteReservedHeights",{enumerable:true,get:function(){return chunkPFMM7QON_js.i}});Object.defineProperty(exports,"collectFootnoteRefs",{enumerable:true,get:function(){return chunkPFMM7QON_js.d}});Object.defineProperty(exports,"footnoteReservedHeightsEqual",{enumerable:true,get:function(){return chunkPFMM7QON_js.c}});Object.defineProperty(exports,"mapFootnotesToPages",{enumerable:true,get:function(){return chunkPFMM7QON_js.e}});Object.defineProperty(exports,"stabilizeFootnoteLayout",{enumerable:true,get:function(){return chunkPFMM7QON_js.j}});Object.defineProperty(exports,"countPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.n}});Object.defineProperty(exports,"createColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.b}});Object.defineProperty(exports,"createHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.g}});Object.defineProperty(exports,"createLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.c}});Object.defineProperty(exports,"createPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.a}});Object.defineProperty(exports,"createPageBreakParagraph",{enumerable:true,get:function(){return chunkKESNGXGO_js.e}});Object.defineProperty(exports,"createPageBreakRun",{enumerable:true,get:function(){return chunkKESNGXGO_js.d}});Object.defineProperty(exports,"findPageBreaks",{enumerable:true,get:function(){return chunkKESNGXGO_js.o}});Object.defineProperty(exports,"hasPageBreakBefore",{enumerable:true,get:function(){return chunkKESNGXGO_js.m}});Object.defineProperty(exports,"insertHorizontalRule",{enumerable:true,get:function(){return chunkKESNGXGO_js.h}});Object.defineProperty(exports,"insertPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.f}});Object.defineProperty(exports,"isBreakContent",{enumerable:true,get:function(){return chunkKESNGXGO_js.l}});Object.defineProperty(exports,"isColumnBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.j}});Object.defineProperty(exports,"isLineBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.k}});Object.defineProperty(exports,"isPageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.i}});Object.defineProperty(exports,"removePageBreak",{enumerable:true,get:function(){return chunkKESNGXGO_js.p}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunk2SGJZYQF_js.a}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.g}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunk2SGJZYQF_js.d}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunk2SGJZYQF_js.f}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkCZSAC65M_js.c}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkCZSAC65M_js.b}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkCZSAC65M_js.a}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkNXLJVVVE_js.b}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkNXLJVVVE_js.a}});Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunk3QPKTG2Y_js.b}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.i}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.g}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.j}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkU4UCHBZ7_js.h}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkESI4BSBF_js.e}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.a}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkESI4BSBF_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkESI4BSBF_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkESI4BSBF_js.f}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkTE2AF7FM_js.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkTE2AF7FM_js.b}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.t}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.i}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkBH3ACQ3M_js.m}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkNAFMAKLK_js.g}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkNAFMAKLK_js.h}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkNAFMAKLK_js.c}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.a}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk4BFNWPKW_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk4BFNWPKW_js.c}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkOTHV7YV2_js.f}});Object.defineProperty(exports,"canRenderFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.h}});Object.defineProperty(exports,"getLoadedFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.e}});Object.defineProperty(exports,"isFontLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.c}});Object.defineProperty(exports,"isFontsLoading",{enumerable:true,get:function(){return chunkMNOHUTKE_js.d}});Object.defineProperty(exports,"loadFont",{enumerable:true,get:function(){return chunkMNOHUTKE_js.a}});Object.defineProperty(exports,"loadFontFromBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.i}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.b}});Object.defineProperty(exports,"onFontsLoaded",{enumerable:true,get:function(){return chunkMNOHUTKE_js.f}});Object.defineProperty(exports,"preloadCommonFonts",{enumerable:true,get:function(){return chunkMNOHUTKE_js.p}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkMNOHUTKE_js.s}});Object.defineProperty(exports,"findParagraphByParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.b}});Object.defineProperty(exports,"findStartPosForParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.a}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.m}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.r}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.j}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.i}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.k}});Object.defineProperty(exports,"ensureHexPrefix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.n}});Object.defineProperty(exports,"generateThemeTintShadeMatrix",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.q}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.g}});Object.defineProperty(exports,"getThemeTintShadeHex",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.p}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.e}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.f}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.l}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.h}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.c}});Object.defineProperty(exports,"resolveHighlightToCss",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.o}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkMJ5FQX7Q_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.e}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.g}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.p}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.j}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.f}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.d}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.i}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.h}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunk4Q2IP5FW_js.c}});exports.EditorCoordinator=g;exports.ErrorManager=d;exports.LayoutCoordinator=p;exports.PluginLifecycleManager=u;exports.VERSION=to;exports.createSelectionFromDOM=A;exports.extractFormattingFromElement=h;exports.getSelectionRuns=f;exports.injectStyles=z;exports.rgbToHex=S;
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- export{a as AutoSaveManager,b as formatLastSaveTime,e as formatStorageSize,c as getAutoSaveStatusLabel,d as getAutoSaveStorageSize,f as isAutoSaveSupported}from'./chunk-6NQSIC27.mjs';export{a as TABLE_DATA_ATTRIBUTES,f as TableSelectionManager,e as deleteTableFromDocument,b as findTableFromClick,c as getTableFromDocument,d as updateTableInDocument}from'./chunk-JHZ3HLSR.mjs';import {a}from'./chunk-D6GO7UGD.mjs';export{a as Subscribable}from'./chunk-D6GO7UGD.mjs';export{w as convertHeaderFooterToContent}from'./chunk-JUMHC5Z6.mjs';import'./chunk-L6YTCHOQ.mjs';export{a as FOOTNOTE_SEPARATOR_HEIGHT,b as MAX_FOOTNOTE_LAYOUT_PASSES,h as buildFootnoteContentMap,k as buildFootnoteRenderItems,i as calculateFootnoteReservedHeights,d as collectFootnoteRefs,c as footnoteReservedHeightsEqual,e as mapFootnotesToPages,j as stabilizeFootnoteLayout}from'./chunk-7JQVKJRN.mjs';import'./chunk-B46V5G46.mjs';import'./chunk-MEVZCB56.mjs';import'./chunk-Q5B5GKXD.mjs';import'./chunk-72KLR6TJ.mjs';import'./chunk-FCJWLEKT.mjs';import'./chunk-7E5VBRDL.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-WTFLNYAT.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,d as getAgentContext,f as getDocumentSummary}from'./chunk-YNUPP7UG.mjs';export{c as attemptSelectiveSave,b as buildPatchedDocumentXml,a as validatePatchSafety}from'./chunk-FYRJTDC4.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'./chunk-CKKO4JWE.mjs';export{b as docxtemplaterPlugin}from'./chunk-DFUWJHKF.mjs';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-ARHPXIBJ.mjs';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CGJ6S3AH.mjs';export{a as executeCommand,b as executeCommands}from'./chunk-CUY2THAO.mjs';export{t as createDocx,i as repackDocx,m as updateMultipleFiles}from'./chunk-CHN26LLL.mjs';export{g as serializeDocumentBody,h as serializeDocx,c as serializeSectionProperties}from'./chunk-WWNOXNEX.mjs';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-3NRMSZX2.mjs';export{f as parseDocx}from'./chunk-UE2ZKRYB.mjs';import'./chunk-3G44SFHX.mjs';import'./chunk-MOCGHQ4A.mjs';export{h as canRenderFont,e as getLoadedFonts,c as isFontLoaded,d as isFontsLoading,a as loadFont,i as loadFontFromBuffer,b as loadFonts,f as onFontsLoaded,p as preloadCommonFonts,s as toArrayBuffer}from'./chunk-7LRR7RKE.mjs';export{b as findParagraphByParaId,a as findStartPosForParaId}from'./chunk-3SXJPJSV.mjs';import'./chunk-IUVQJ6PX.mjs';import'./chunk-7OW3VCZE.mjs';import'./chunk-LK6I3HMH.mjs';import'./chunk-QPFJJPIC.mjs';import'./chunk-GYWTUUXX.mjs';import'./chunk-7CZEZ3UL.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-4GFTMGSV.mjs';import'./chunk-SWBLJF6R.mjs';import'./chunk-MOKKS75W.mjs';import'./chunk-OZMNIX6U.mjs';import'./chunk-AMENZY5F.mjs';import'./chunk-U67MWOPZ.mjs';import'./chunk-BGY3CB37.mjs';import'./chunk-2XP6GLA4.mjs';import'./chunk-ZX26QZJ5.mjs';import'./chunk-MJ6XZFVD.mjs';export{m as blendColors,r as colorsEqual,j as createRgbColor,i as createThemeColor,k as darkenColor,n as ensureHexPrefix,q as generateThemeTintShadeMatrix,g as getContrastingColor,p as getThemeTintShadeHex,e as isBlack,f as isWhite,l as lightenColor,h as parseColorString,a as resolveColor,c as resolveHighlightColor,o as resolveHighlightToCss,d as resolveShadingColor}from'./chunk-67LVRQIR.mjs';import'./chunk-LE67NTCN.mjs';export{e as emuToPixels,g as emuToTwips,p as formatPx,j as halfPointsToPixels,f as pixelsToEmu,d as pixelsToTwips,i as pointsToPixels,h as twipsToEmu,c as twipsToPixels}from'./chunk-VW22RZ6C.mjs';import'./chunk-DI6CRWSW.mjs';import {a as a$1}from'./chunk-QYUPLKLP.mjs';function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends a{constructor(){super({notifications:[]});a$1(this,"notifications",[]);a$1(this,"idCounter",0);a$1(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends a{constructor(){super({states:new Map,version:0});a$1(this,"plugins",[]);a$1(this,"pluginStates",new Map);a$1(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});a$1(this,"_hasLayout",false);a$1(this,"_selectionRects",[]);a$1(this,"_caretPosition",null);a$1(this,"_isDragging",false);a$1(this,"_dragAnchor",null);a$1(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});a$1(this,"_selectedImageInfo",null);a$1(this,"_isImageInteracting",false);a$1(this,"_isFocused",false);a$1(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});a$1(this,"_loadingState","idle");a$1(this,"_parseError",null);a$1(this,"_zoom");a$1(this,"_fontsLoaded",false);a$1(this,"_document",null);a$1(this,"_version",0);a$1(this,"onChangeCallback");a$1(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";export{g as EditorCoordinator,d as ErrorManager,p as LayoutCoordinator,u as PluginLifecycleManager,to as VERSION,A as createSelectionFromDOM,h as extractFormattingFromElement,f as getSelectionRuns,z as injectStyles,S as rgbToHex};
1
+ export{a as AutoSaveManager,b as formatLastSaveTime,e as formatStorageSize,c as getAutoSaveStatusLabel,d as getAutoSaveStorageSize,f as isAutoSaveSupported}from'./chunk-6NQSIC27.mjs';export{a as TABLE_DATA_ATTRIBUTES,f as TableSelectionManager,e as deleteTableFromDocument,b as findTableFromClick,c as getTableFromDocument,d as updateTableInDocument}from'./chunk-JHZ3HLSR.mjs';import {a}from'./chunk-D6GO7UGD.mjs';export{a as Subscribable}from'./chunk-D6GO7UGD.mjs';export{y as convertHeaderFooterToContent}from'./chunk-2LEFMTNZ.mjs';import'./chunk-UEPLDKKM.mjs';export{a as FOOTNOTE_SEPARATOR_HEIGHT,b as MAX_FOOTNOTE_LAYOUT_PASSES,h as buildFootnoteContentMap,k as buildFootnoteRenderItems,i as calculateFootnoteReservedHeights,d as collectFootnoteRefs,c as footnoteReservedHeightsEqual,e as mapFootnotesToPages,j as stabilizeFootnoteLayout}from'./chunk-KKXCBWVG.mjs';import'./chunk-HKN2NKOG.mjs';import'./chunk-LX35TFGF.mjs';import'./chunk-55XWETY4.mjs';import'./chunk-JHTURDPX.mjs';import'./chunk-FCJWLEKT.mjs';import'./chunk-7E5VBRDL.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-WTFLNYAT.mjs';export{a as DocumentAgent,h as buildExtendedSelectionContext,g as buildSelectionContext,d as getAgentContext,f as getDocumentSummary}from'./chunk-YNUPP7UG.mjs';export{c as attemptSelectiveSave,b as buildPatchedDocumentXml,a as validatePatchSafety}from'./chunk-FYRJTDC4.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'./chunk-CKKO4JWE.mjs';export{b as docxtemplaterPlugin}from'./chunk-DFUWJHKF.mjs';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-ARHPXIBJ.mjs';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CGJ6S3AH.mjs';export{a as executeCommand,b as executeCommands}from'./chunk-CUY2THAO.mjs';export{t as createDocx,i as repackDocx,m as updateMultipleFiles}from'./chunk-CHN26LLL.mjs';export{g as serializeDocumentBody,h as serializeDocx,c as serializeSectionProperties}from'./chunk-WWNOXNEX.mjs';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-3NRMSZX2.mjs';export{f as parseDocx}from'./chunk-UE2ZKRYB.mjs';import'./chunk-3G44SFHX.mjs';import'./chunk-MOCGHQ4A.mjs';export{h as canRenderFont,e as getLoadedFonts,c as isFontLoaded,d as isFontsLoading,a as loadFont,i as loadFontFromBuffer,b as loadFonts,f as onFontsLoaded,p as preloadCommonFonts,s as toArrayBuffer}from'./chunk-7LRR7RKE.mjs';export{b as findParagraphByParaId,a as findStartPosForParaId}from'./chunk-3SXJPJSV.mjs';import'./chunk-LJE7HQEJ.mjs';import'./chunk-7OW3VCZE.mjs';import'./chunk-LK6I3HMH.mjs';import'./chunk-QPFJJPIC.mjs';import'./chunk-GYWTUUXX.mjs';import'./chunk-7CZEZ3UL.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-4GFTMGSV.mjs';import'./chunk-SWBLJF6R.mjs';import'./chunk-MOKKS75W.mjs';import'./chunk-OZMNIX6U.mjs';import'./chunk-AMENZY5F.mjs';import'./chunk-U67MWOPZ.mjs';import'./chunk-BGY3CB37.mjs';import'./chunk-2XP6GLA4.mjs';import'./chunk-ZX26QZJ5.mjs';import'./chunk-MJ6XZFVD.mjs';export{m as blendColors,r as colorsEqual,j as createRgbColor,i as createThemeColor,k as darkenColor,n as ensureHexPrefix,q as generateThemeTintShadeMatrix,g as getContrastingColor,p as getThemeTintShadeHex,e as isBlack,f as isWhite,l as lightenColor,h as parseColorString,a as resolveColor,c as resolveHighlightColor,o as resolveHighlightToCss,d as resolveShadingColor}from'./chunk-67LVRQIR.mjs';import'./chunk-LE67NTCN.mjs';export{e as emuToPixels,g as emuToTwips,p as formatPx,j as halfPointsToPixels,f as pixelsToEmu,d as pixelsToTwips,i as pointsToPixels,h as twipsToEmu,c as twipsToPixels}from'./chunk-VW22RZ6C.mjs';import'./chunk-DI6CRWSW.mjs';import {a as a$1}from'./chunk-QYUPLKLP.mjs';function L(i){if(!i||i==="transparent"||i==="inherit")return null;if(i.startsWith("#"))return i.slice(1).toUpperCase();let o=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(o){let e=parseInt(o[1]).toString(16).padStart(2,"0"),t=parseInt(o[2]).toString(16).padStart(2,"0"),n=parseInt(o[3]).toString(16).padStart(2,"0");return (e+t+n).toUpperCase()}return null}function h(i){let o=window.getComputedStyle(i),e={};(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(e.bold=true),o.fontStyle==="italic"&&(e.italic=true);let t=o.textDecoration||o.textDecorationLine;t&&t.includes("underline")&&(e.underline={style:"single"}),t&&t.includes("line-through")&&(e.strike=true);let n=parseFloat(o.fontSize);!isNaN(n)&&n>0&&(e.fontSize=Math.round(n/1.333*2));let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(e.fontFamily={ascii:r});let s=o.color;if(s&&s!=="rgb(0, 0, 0)"){let c=L(s);c&&(e.color={rgb:c});}let l=o.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=S(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function Lt(i,o){let e=document.createRange();e.selectNodeContents(i);let t=o.compareBoundaryPoints(Range.START_TO_START,e)>=0&&o.compareBoundaryPoints(Range.START_TO_END,e)<=0,n=o.compareBoundaryPoints(Range.END_TO_START,e)>=0&&o.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(t&&n)return o.toString();if(t){let r=document.createRange();return r.setStart(o.startContainer,o.startOffset),r.selectNodeContents(i),r.setEnd(e.endContainer,e.endOffset),r.toString()}else if(n){let r=document.createRange();return r.selectNodeContents(i),r.setEnd(o.endContainer,o.endOffset),r.setStart(e.startContainer,e.startOffset),r.toString()}else if(o.intersectsNode(i))return i.textContent||"";return ""}function F(i){let o=i;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){let e=o;if(e.hasAttribute("data-paragraph-index"))return e}o=o.parentNode;}return null}function f(){let i=window.getSelection();if(!i||i.isCollapsed)return [];let o=[],e=i.getRangeAt(0),t=e.commonAncestorContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!n)return o;if(n.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=Lt(s,e);if(l){let c=h(s);o.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),o.length===0){let s=i.toString();s&&o.push({type:"run",content:[{type:"text",text:s}]});}return o}function A(){let i=window.getSelection();if(!i||i.isCollapsed)return null;let o=f();if(o.length===0)return null;let e=i.toString(),t=i.getRangeAt(0),n=F(t.startContainer),r=F(t.endContainer),s=n?parseInt(n.getAttribute("data-paragraph-index")||"0",10):0,l=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:o,startParagraphIndex:s,startRunIndex:0,startOffset:t.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:t.endOffset,isMultiParagraph:s!==l}}var S=L;var d=class extends a{constructor(){super({notifications:[]});a$1(this,"notifications",[]);a$1(this,"idCounter",0);a$1(this,"timers",new Set);}showError(e,t){return this.addNotification(e,"error",t)}showWarning(e,t){return this.addNotification(e,"warning",t)}showInfo(e,t){return this.addNotification(e,"info",t)}dismiss(e){this.notifications=this.notifications.map(n=>n.id===e?{...n,dismissed:true}:n),this.emitSnapshot();let t=setTimeout(()=>{this.timers.delete(t),this.notifications=this.notifications.filter(n=>n.id!==e),this.emitSnapshot();},300);this.timers.add(t);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,t,n){let r=`error-${++this.idCounter}-${Date.now()}`,s={id:r,message:e,severity:t,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),t!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(r);},5e3);this.timers.add(l);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function z(i,o){let e=`plugin-styles-${i}`,t=document.getElementById(e);t&&t.remove();let n=document.createElement("style");return n.id=e,n.textContent=o,document.head.appendChild(n),()=>{let r=document.getElementById(e);r&&r.remove();}}var u=class extends a{constructor(){super({states:new Map,version:0});a$1(this,"plugins",[]);a$1(this,"pluginStates",new Map);a$1(this,"version",0);}initialize(e,t){this.destroyPlugins(),this.plugins=e;for(let n of e)n.initialize&&!this.pluginStates.has(n.id)&&this.pluginStates.set(n.id,n.initialize(t));this.emitSnapshot();}updateStates(e){let t=false;for(let n of this.plugins)if(n.onStateChange){let r=n.onStateChange(e);r!==void 0&&(this.pluginStates.set(n.id,r),t=true);}return t&&(this.version++,this.emitSnapshot()),t}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,t){this.pluginStates.set(e,t),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var p=class extends a{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});a$1(this,"_hasLayout",false);a$1(this,"_selectionRects",[]);a$1(this,"_caretPosition",null);a$1(this,"_isDragging",false);a$1(this,"_dragAnchor",null);a$1(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});a$1(this,"_selectedImageInfo",null);a$1(this,"_isImageInteracting",false);a$1(this,"_isFocused",false);a$1(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,t){this._selectionRects=e,this._caretPosition=t,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,t,n,r){this._columnResize={isResizing:true,startX:n,columnIndex:t,tablePmStart:e,originalWidths:r},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var g=class extends a{constructor(e={}){let t=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:t,fontsLoaded:false,version:0});a$1(this,"_loadingState","idle");a$1(this,"_parseError",null);a$1(this,"_zoom");a$1(this,"_fontsLoaded",false);a$1(this,"_document",null);a$1(this,"_version",0);a$1(this,"onChangeCallback");a$1(this,"onErrorCallback");this._zoom=t,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var to="0.0.2";export{g as EditorCoordinator,d as ErrorManager,p as LayoutCoordinator,u as PluginLifecycleManager,to as VERSION,A as createSelectionFromDOM,h as extractFormattingFromElement,f as getSelectionRuns,z as injectStyles,S as rgbToHex};
@@ -0,0 +1,128 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ import { Node } from 'prosemirror-model';
3
+ import { PageMargins, ColumnLayout, FlowBlock, Measure, Layout } from '../layout-engine/types.mjs';
4
+ import { Document } from '../types/document.mjs';
5
+ import { S as SectionProperties, y as HeaderFooter } from '../content-3xF4WDE8.mjs';
6
+ import { F as FloatPageGeometry } from '../measureBlocksPipeline-BMqbRFQB.mjs';
7
+ import { H as HeaderFooterContent, F as FootnoteRenderItem } from '../footnotes-BZ24OTAT.mjs';
8
+ import { W as Watermark } from '../watermark-DAcnAs_J.mjs';
9
+ import { T as Theme, S as StyleDefinitions } from '../styles-BOJ93SAm.mjs';
10
+ import '../formatting-BH4hcZiq.mjs';
11
+ import '../colors-C3vA7HUU.mjs';
12
+ import '../docx/wrapTypes.mjs';
13
+ import '../anchoredObjectPosition-KJEyF-wr.mjs';
14
+
15
+ /**
16
+ * The pure layout COMPUTE pass shared by the React and Vue adapters — issue
17
+ * #696 Tier 2, the clean half of the engine spine.
18
+ *
19
+ * This is the 6-step pass from React's `useLayoutPipeline` minus the DOM paint
20
+ * + scroll/event side-effects (which stay adapter-side, where the framework
21
+ * timing lives): PM doc → flow blocks → measure → header/footer resolve →
22
+ * margin extension → `layoutDocument` (+ two-pass footnote stabilization) →
23
+ * footnote render items. It is pure (no DOM, no refs, no rAF) and returns
24
+ * everything the adapter needs to paint.
25
+ *
26
+ * The one injected seam is `measureBlocks` — each adapter passes its own
27
+ * measurer (React's is caching), same pattern as `measureBlocksWithFloats`.
28
+ * `getHfPmDoc` is the HF-unification seam (prefer the persistent PM doc over
29
+ * re-parsing `HeaderFooter.content`).
30
+ */
31
+
32
+ interface PageSizePx {
33
+ w: number;
34
+ h: number;
35
+ }
36
+ /** Adapter-supplied block measurer (React's is caching). */
37
+ type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number | number[], pageGeometry?: FloatPageGeometry) => Measure[];
38
+ interface ComputeLayoutInputs {
39
+ state: EditorState;
40
+ document: Document | null;
41
+ pageSize: PageSizePx;
42
+ margins: PageMargins;
43
+ columns: ColumnLayout | undefined;
44
+ finalPageSize: PageSizePx;
45
+ finalMargins: PageMargins;
46
+ finalColumns: ColumnLayout | undefined;
47
+ pageGap: number;
48
+ contentWidth: number;
49
+ theme: Theme | null | undefined;
50
+ styles: StyleDefinitions | null | undefined;
51
+ sectionProperties: SectionProperties | null | undefined;
52
+ finalSectionProperties: SectionProperties | null | undefined;
53
+ /** Resolved HF objects for the section (default + first-page). */
54
+ headerContent: HeaderFooter | null | undefined;
55
+ footerContent: HeaderFooter | null | undefined;
56
+ firstPageHeaderContent: HeaderFooter | null | undefined;
57
+ firstPageFooterContent: HeaderFooter | null | undefined;
58
+ measureBlocks: MeasureBlocksFn;
59
+ /** HF unification: the persistent PM doc for an HF, or null to re-parse content. */
60
+ getHfPmDoc: (hf: HeaderFooter) => Node | null | undefined;
61
+ }
62
+ interface LayoutComputation {
63
+ blocks: FlowBlock[];
64
+ measures: Measure[];
65
+ layout: Layout;
66
+ headerContentForRender: HeaderFooterContent | undefined;
67
+ footerContentForRender: HeaderFooterContent | undefined;
68
+ firstPageHeaderForRender: HeaderFooterContent | undefined;
69
+ firstPageFooterForRender: HeaderFooterContent | undefined;
70
+ hasTitlePg: boolean;
71
+ watermark: Watermark | undefined;
72
+ headerDistancePx: number | undefined;
73
+ footerDistancePx: number | undefined;
74
+ pageBorders: SectionProperties['pageBorders'] | undefined;
75
+ footnotesByPage: Map<number, FootnoteRenderItem[]> | undefined;
76
+ }
77
+ /**
78
+ * Run the pure layout compute pass (the 6 steps in this file's header), lifted
79
+ * verbatim from `useLayoutPipeline`. The adapter performs the DOM paint
80
+ * (`renderPages`), scroll-restore, `painter:painted`, and state writeback with
81
+ * the returned values.
82
+ */
83
+ declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
84
+
85
+ /**
86
+ * rAF-coalescing layout scheduler shared by the React and Vue adapters
87
+ * (issue #696 Tier 2). Rapid doc-changing transactions (a burst of
88
+ * keystrokes) collapse to a single layout pass per animation frame: while a
89
+ * frame is pending, later `schedule` calls just replace the target state, so
90
+ * only the final state lays out.
91
+ *
92
+ * `scheduleFrame`/`cancelFrame` are injected so a headless/test host can pass
93
+ * a synchronous stub; they default to requestAnimationFrame.
94
+ */
95
+
96
+ interface LayoutScheduler {
97
+ /** Request a layout for `state`, coalesced into the pending frame. */
98
+ schedule(state: EditorState): void;
99
+ /** Cancel any pending frame (call on teardown). */
100
+ cancel(): void;
101
+ }
102
+ declare function createLayoutScheduler(run: (state: EditorState) => void, scheduleFrame?: (cb: () => void) => number, cancelFrame?: (handle: number) => void): LayoutScheduler;
103
+
104
+ /**
105
+ * Strip ProseMirror's internal `UPDATED_SCROLL` flag from a transaction so the
106
+ * hidden, off-screen editor's `updateState` does not force-scroll its ancestors
107
+ * to the selection — the paginated painter owns scroll, not the PM view.
108
+ *
109
+ * Shared by both adapters' `dispatchTransaction` (issue #696 Tier 2). React has
110
+ * always done this; Vue did not, so its hidden editor could yank an ancestor's
111
+ * scroll on edit. Centralizing the magic bit + the drift canary here keeps the
112
+ * two in lockstep.
113
+ *
114
+ * `Transaction.updated` is a private bitfield in `prosemirror-state` whose
115
+ * `UPDATED_SCROLL` bit is not exported. It is `4` in current PM
116
+ * (state/src/transaction.ts). If a future PM release renumbers the bits before
117
+ * SCROLL, `assertScrollFlagShape` logs once so the constant can be updated.
118
+ */
119
+
120
+ /**
121
+ * Clear the scroll-into-view flag on `transaction` in place. Call inside
122
+ * `dispatchTransaction` before `state.apply(transaction)`. `probeTr` should be
123
+ * a fresh `view.state.tr` used only for the one-shot drift canary (so the real
124
+ * transaction is never mutated by the probe).
125
+ */
126
+ declare function stripScrollFlag(transaction: Transaction, probeTr: Transaction): void;
127
+
128
+ export { type ComputeLayoutInputs, type LayoutComputation, type LayoutScheduler, type MeasureBlocksFn, computeLayout, createLayoutScheduler, stripScrollFlag };
@@ -0,0 +1,128 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ import { Node } from 'prosemirror-model';
3
+ import { PageMargins, ColumnLayout, FlowBlock, Measure, Layout } from '../layout-engine/types.js';
4
+ import { Document } from '../types/document.js';
5
+ import { S as SectionProperties, y as HeaderFooter } from '../content-C8fc_tL6.js';
6
+ import { F as FloatPageGeometry } from '../measureBlocksPipeline-iYNzAH-o.js';
7
+ import { H as HeaderFooterContent, F as FootnoteRenderItem } from '../footnotes-DMsicPGd.js';
8
+ import { W as Watermark } from '../watermark-DAcnAs_J.js';
9
+ import { T as Theme, S as StyleDefinitions } from '../styles-BWqX2AS-.js';
10
+ import '../formatting-_OXU8gLB.js';
11
+ import '../colors-C3vA7HUU.js';
12
+ import '../docx/wrapTypes.js';
13
+ import '../anchoredObjectPosition-CS-8BfhO.js';
14
+
15
+ /**
16
+ * The pure layout COMPUTE pass shared by the React and Vue adapters — issue
17
+ * #696 Tier 2, the clean half of the engine spine.
18
+ *
19
+ * This is the 6-step pass from React's `useLayoutPipeline` minus the DOM paint
20
+ * + scroll/event side-effects (which stay adapter-side, where the framework
21
+ * timing lives): PM doc → flow blocks → measure → header/footer resolve →
22
+ * margin extension → `layoutDocument` (+ two-pass footnote stabilization) →
23
+ * footnote render items. It is pure (no DOM, no refs, no rAF) and returns
24
+ * everything the adapter needs to paint.
25
+ *
26
+ * The one injected seam is `measureBlocks` — each adapter passes its own
27
+ * measurer (React's is caching), same pattern as `measureBlocksWithFloats`.
28
+ * `getHfPmDoc` is the HF-unification seam (prefer the persistent PM doc over
29
+ * re-parsing `HeaderFooter.content`).
30
+ */
31
+
32
+ interface PageSizePx {
33
+ w: number;
34
+ h: number;
35
+ }
36
+ /** Adapter-supplied block measurer (React's is caching). */
37
+ type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number | number[], pageGeometry?: FloatPageGeometry) => Measure[];
38
+ interface ComputeLayoutInputs {
39
+ state: EditorState;
40
+ document: Document | null;
41
+ pageSize: PageSizePx;
42
+ margins: PageMargins;
43
+ columns: ColumnLayout | undefined;
44
+ finalPageSize: PageSizePx;
45
+ finalMargins: PageMargins;
46
+ finalColumns: ColumnLayout | undefined;
47
+ pageGap: number;
48
+ contentWidth: number;
49
+ theme: Theme | null | undefined;
50
+ styles: StyleDefinitions | null | undefined;
51
+ sectionProperties: SectionProperties | null | undefined;
52
+ finalSectionProperties: SectionProperties | null | undefined;
53
+ /** Resolved HF objects for the section (default + first-page). */
54
+ headerContent: HeaderFooter | null | undefined;
55
+ footerContent: HeaderFooter | null | undefined;
56
+ firstPageHeaderContent: HeaderFooter | null | undefined;
57
+ firstPageFooterContent: HeaderFooter | null | undefined;
58
+ measureBlocks: MeasureBlocksFn;
59
+ /** HF unification: the persistent PM doc for an HF, or null to re-parse content. */
60
+ getHfPmDoc: (hf: HeaderFooter) => Node | null | undefined;
61
+ }
62
+ interface LayoutComputation {
63
+ blocks: FlowBlock[];
64
+ measures: Measure[];
65
+ layout: Layout;
66
+ headerContentForRender: HeaderFooterContent | undefined;
67
+ footerContentForRender: HeaderFooterContent | undefined;
68
+ firstPageHeaderForRender: HeaderFooterContent | undefined;
69
+ firstPageFooterForRender: HeaderFooterContent | undefined;
70
+ hasTitlePg: boolean;
71
+ watermark: Watermark | undefined;
72
+ headerDistancePx: number | undefined;
73
+ footerDistancePx: number | undefined;
74
+ pageBorders: SectionProperties['pageBorders'] | undefined;
75
+ footnotesByPage: Map<number, FootnoteRenderItem[]> | undefined;
76
+ }
77
+ /**
78
+ * Run the pure layout compute pass (the 6 steps in this file's header), lifted
79
+ * verbatim from `useLayoutPipeline`. The adapter performs the DOM paint
80
+ * (`renderPages`), scroll-restore, `painter:painted`, and state writeback with
81
+ * the returned values.
82
+ */
83
+ declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
84
+
85
+ /**
86
+ * rAF-coalescing layout scheduler shared by the React and Vue adapters
87
+ * (issue #696 Tier 2). Rapid doc-changing transactions (a burst of
88
+ * keystrokes) collapse to a single layout pass per animation frame: while a
89
+ * frame is pending, later `schedule` calls just replace the target state, so
90
+ * only the final state lays out.
91
+ *
92
+ * `scheduleFrame`/`cancelFrame` are injected so a headless/test host can pass
93
+ * a synchronous stub; they default to requestAnimationFrame.
94
+ */
95
+
96
+ interface LayoutScheduler {
97
+ /** Request a layout for `state`, coalesced into the pending frame. */
98
+ schedule(state: EditorState): void;
99
+ /** Cancel any pending frame (call on teardown). */
100
+ cancel(): void;
101
+ }
102
+ declare function createLayoutScheduler(run: (state: EditorState) => void, scheduleFrame?: (cb: () => void) => number, cancelFrame?: (handle: number) => void): LayoutScheduler;
103
+
104
+ /**
105
+ * Strip ProseMirror's internal `UPDATED_SCROLL` flag from a transaction so the
106
+ * hidden, off-screen editor's `updateState` does not force-scroll its ancestors
107
+ * to the selection — the paginated painter owns scroll, not the PM view.
108
+ *
109
+ * Shared by both adapters' `dispatchTransaction` (issue #696 Tier 2). React has
110
+ * always done this; Vue did not, so its hidden editor could yank an ancestor's
111
+ * scroll on edit. Centralizing the magic bit + the drift canary here keeps the
112
+ * two in lockstep.
113
+ *
114
+ * `Transaction.updated` is a private bitfield in `prosemirror-state` whose
115
+ * `UPDATED_SCROLL` bit is not exported. It is `4` in current PM
116
+ * (state/src/transaction.ts). If a future PM release renumbers the bits before
117
+ * SCROLL, `assertScrollFlagShape` logs once so the constant can be updated.
118
+ */
119
+
120
+ /**
121
+ * Clear the scroll-into-view flag on `transaction` in place. Call inside
122
+ * `dispatchTransaction` before `state.apply(transaction)`. `probeTr` should be
123
+ * a fresh `view.state.tr` used only for the one-shot drift canary (so the real
124
+ * transaction is never mutated by the probe).
125
+ */
126
+ declare function stripScrollFlag(transaction: Transaction, probeTr: Transaction): void;
127
+
128
+ export { type ComputeLayoutInputs, type LayoutComputation, type LayoutScheduler, type MeasureBlocksFn, computeLayout, createLayoutScheduler, stripScrollFlag };
@@ -0,0 +1 @@
1
+ 'use strict';require('../chunk-6WZW3NSJ.js');var chunk4PANZ3VU_js=require('../chunk-4PANZ3VU.js');require('../chunk-ZAZWHK4J.js');var chunkPFMM7QON_js=require('../chunk-PFMM7QON.js'),chunkYPQACU4A_js=require('../chunk-YPQACU4A.js');require('../chunk-4MYKVWNF.js');var chunkJ3YFJDZD_js=require('../chunk-J3YFJDZD.js'),chunkRSU4HTC6_js=require('../chunk-RSU4HTC6.js');require('../chunk-IMKU4O3P.js'),require('../chunk-DROCYKAR.js'),require('../chunk-LERLET2D.js'),require('../chunk-FIGLFSNR.js'),require('../chunk-QVRNNRG5.js'),require('../chunk-C45EFOVP.js'),require('../chunk-ISKTBM4L.js'),require('../chunk-JFZIXFRC.js'),require('../chunk-RQVHKDXK.js'),require('../chunk-SCK6ZM5V.js'),require('../chunk-Z3LGMBJC.js'),require('../chunk-3R7QHNI5.js'),require('../chunk-WWBNJ7KF.js'),require('../chunk-4RTVLMRZ.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-WVERBZZU.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-TUIEV7Q7.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f,theme:m,styles:D,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=chunkYPQACU4A_js.c(t.doc,{theme:m,pageContentHeight:oe}),ne=chunk4PANZ3VU_js.O(r,{pageSize:e,margins:o,columns:p},{pageSize:d,margins:L,columns:M}),l=g(r,ne,chunkJ3YFJDZD_js.f({size:e,margins:o})),y=chunkPFMM7QON_js.d(r),k=y.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D,theme:m,measureBlocks:g,defaultTabStopTwips:T},c=(i,u)=>{if(!i)return;let _=te(i);return _?chunk4PANZ3VU_js.z(_,f,u,w):chunk4PANZ3VU_js.y(i,f,u,w)},B=c(X,H),R=c(Y,x),F=s?.titlePg===true,v=F?c(Z,H):void 0,z=F?c(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=chunk4PANZ3VU_js.D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h,E=new Map,S=new Map;if(k){let i=chunkRSU4HTC6_js.U(r,l,P);S=chunkPFMM7QON_js.h(n.package.footnotes,y,f,{styles:D??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=chunkPFMM7QON_js.j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y,footnoteContentMap:S,initialLayout:i});h=u.layout,E=u.pageFootnoteMap;}else h=chunkRSU4HTC6_js.U(r,l,P);let W=k?chunkPFMM7QON_js.k(E,S,n):void 0;return {blocks:r,measures:l,layout:h,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance?chunk4PANZ3VU_js.I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance?chunk4PANZ3VU_js.I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}exports.computeLayout=de;exports.createLayoutScheduler=ue;exports.stripScrollFlag=ce;
@@ -0,0 +1 @@
1
+ import'../chunk-PMSGJXOE.mjs';import {O,D,I,z,y}from'../chunk-2LEFMTNZ.mjs';import'../chunk-UEPLDKKM.mjs';import {d,h,j,k}from'../chunk-KKXCBWVG.mjs';import {c}from'../chunk-HKN2NKOG.mjs';import'../chunk-LX35TFGF.mjs';import {f}from'../chunk-55XWETY4.mjs';import {U}from'../chunk-JHTURDPX.mjs';import'../chunk-FCJWLEKT.mjs';import'../chunk-7E5VBRDL.mjs';import'../chunk-3G44SFHX.mjs';import'../chunk-MOCGHQ4A.mjs';import'../chunk-LJE7HQEJ.mjs';import'../chunk-7OW3VCZE.mjs';import'../chunk-LK6I3HMH.mjs';import'../chunk-QPFJJPIC.mjs';import'../chunk-GYWTUUXX.mjs';import'../chunk-7CZEZ3UL.mjs';import'../chunk-W77JXDEV.mjs';import'../chunk-3ANZ3252.mjs';import'../chunk-4GFTMGSV.mjs';import'../chunk-SWBLJF6R.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-U67MWOPZ.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d$1,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f$1,theme:m,styles:D$1,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=c(t.doc,{theme:m,pageContentHeight:oe}),ne=O(r,{pageSize:e,margins:o,columns:p},{pageSize:d$1,margins:L,columns:M}),l=g(r,ne,f({size:e,margins:o})),y$1=d(r),k$1=y$1.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D$1,theme:m,measureBlocks:g,defaultTabStopTwips:T},c$1=(i,u)=>{if(!i)return;let _=te(i);return _?z(_,f$1,u,w):y(i,f$1,u,w)},B=c$1(X,H),R=c$1(Y,x),F=s?.titlePg===true,v=F?c$1(Z,H):void 0,z$1=F?c$1(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z$1],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d$1,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h$1,E=new Map,S=new Map;if(k$1){let i=U(r,l,P);S=h(n.package.footnotes,y$1,f$1,{styles:D$1??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y$1,footnoteContentMap:S,initialLayout:i});h$1=u.layout,E=u.pageFootnoteMap;}else h$1=U(r,l,P);let W=k$1?k(E,S,n):void 0;return {blocks:r,measures:l,layout:h$1,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z$1,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance?I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance?I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}export{de as computeLayout,ue as createLayoutScheduler,ce as stripScrollFlag};
@@ -19,8 +19,18 @@ interface HeaderFooterContent {
19
19
  blocks: FlowBlock[];
20
20
  /** Measurements for the blocks. */
21
21
  measures: Measure[];
22
- /** Total height of the content. */
22
+ /** Total height of the content (in-flow stack incl. floating blocks). */
23
23
  height: number;
24
+ /**
25
+ * In-flow band height: the height of strictly in-flow content
26
+ * (paragraphs, tables, inline images/text boxes), EXCLUDING anchored /
27
+ * floating objects. This is what grows the header/footer band and pushes
28
+ * the body margin, mirroring Word: a page/margin-anchored shape (e.g. a
29
+ * full-page letterhead in a header) is positioned independently and does
30
+ * NOT push body text down. Use this — not `height`/`visualBottom` — for
31
+ * margin extension. Falls back to `height` when undefined.
32
+ */
33
+ flowHeight?: number;
24
34
  /** Top-most visual extent relative to the nominal flow origin. */
25
35
  visualTop?: number;
26
36
  /** Bottom-most visual extent relative to the nominal flow origin. */
@@ -19,8 +19,18 @@ interface HeaderFooterContent {
19
19
  blocks: FlowBlock[];
20
20
  /** Measurements for the blocks. */
21
21
  measures: Measure[];
22
- /** Total height of the content. */
22
+ /** Total height of the content (in-flow stack incl. floating blocks). */
23
23
  height: number;
24
+ /**
25
+ * In-flow band height: the height of strictly in-flow content
26
+ * (paragraphs, tables, inline images/text boxes), EXCLUDING anchored /
27
+ * floating objects. This is what grows the header/footer band and pushes
28
+ * the body margin, mirroring Word: a page/margin-anchored shape (e.g. a
29
+ * full-page letterhead in a header) is positioned independently and does
30
+ * NOT push body text down. Use this — not `height`/`visualBottom` — for
31
+ * margin extension. Falls back to `height` when undefined.
32
+ */
33
+ flowHeight?: number;
24
34
  /** Top-most visual extent relative to the nominal flow origin. */
25
35
  visualTop?: number;
26
36
  /** Bottom-most visual extent relative to the nominal flow origin. */
@@ -3,7 +3,7 @@ import { EditorView } from 'prosemirror-view';
3
3
  import { FlowBlock, Measure, LayoutOptions, FootnoteContent, Layout, Page, PageMargins, ImageRun } from './layout-engine/types.js';
4
4
  import { F as Footnote, y as HeaderFooter } from './content-C8fc_tL6.js';
5
5
  import { S as StyleDefinitions, T as Theme } from './styles-BWqX2AS-.js';
6
- import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-DcUMWXul.js';
6
+ import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-DMsicPGd.js';
7
7
  import { Document } from './types/document.js';
8
8
 
9
9
  /**
@@ -193,6 +193,22 @@ type HeaderFooterMetrics = {
193
193
  };
194
194
  declare function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];
195
195
  declare function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;
196
+ /**
197
+ * Whether a header/footer block participates in the in-flow band height that
198
+ * pushes the body margin.
199
+ *
200
+ * OOXML semantics: Word grows the header/footer band — and shifts body text —
201
+ * based only on the story's in-flow content. A floating/anchored object
202
+ * (`wp:anchor` DrawingML or an absolutely-positioned VML shape, e.g. a
203
+ * full-page letterhead anchored to the page in a header) is removed from the
204
+ * text flow and positioned on the page; it does NOT grow the band or push the
205
+ * body. So only inline-flow blocks count here. Anchored image *runs* inside a
206
+ * paragraph are likewise out of flow, but they don't contribute to the
207
+ * paragraph's measured line height, so paragraphs need no special handling.
208
+ *
209
+ * @public
210
+ */
211
+ declare function contributesToHeaderFooterFlowHeight(block: FlowBlock): boolean;
196
212
  declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
197
213
  visualTop: number;
198
214
  visualBottom: number;
@@ -289,4 +305,4 @@ declare function computeHfSelectionRectsFromView(view: EditorView, section: 'hea
289
305
  height: number;
290
306
  }>;
291
307
 
292
- export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, convertFootnoteToContent as o, convertHeaderFooterPmDocToContent as p, invalidateHfDomCache as q, normalizeHeaderFooterMeasureBlocks as r, stabilizeFootnoteLayout as s, resolveHeaderFooterVisualTop as t };
308
+ export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, contributesToHeaderFooterFlowHeight as o, convertFootnoteToContent as p, convertHeaderFooterPmDocToContent as q, invalidateHfDomCache as r, stabilizeFootnoteLayout as s, normalizeHeaderFooterMeasureBlocks as t, resolveHeaderFooterVisualTop as u };
@@ -3,7 +3,7 @@ import { EditorView } from 'prosemirror-view';
3
3
  import { FlowBlock, Measure, LayoutOptions, FootnoteContent, Layout, Page, PageMargins, ImageRun } from './layout-engine/types.mjs';
4
4
  import { F as Footnote, y as HeaderFooter } from './content-3xF4WDE8.mjs';
5
5
  import { S as StyleDefinitions, T as Theme } from './styles-BOJ93SAm.mjs';
6
- import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-BtVc6VFl.mjs';
6
+ import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-BZ24OTAT.mjs';
7
7
  import { Document } from './types/document.mjs';
8
8
 
9
9
  /**
@@ -193,6 +193,22 @@ type HeaderFooterMetrics = {
193
193
  };
194
194
  declare function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];
195
195
  declare function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;
196
+ /**
197
+ * Whether a header/footer block participates in the in-flow band height that
198
+ * pushes the body margin.
199
+ *
200
+ * OOXML semantics: Word grows the header/footer band — and shifts body text —
201
+ * based only on the story's in-flow content. A floating/anchored object
202
+ * (`wp:anchor` DrawingML or an absolutely-positioned VML shape, e.g. a
203
+ * full-page letterhead anchored to the page in a header) is removed from the
204
+ * text flow and positioned on the page; it does NOT grow the band or push the
205
+ * body. So only inline-flow blocks count here. Anchored image *runs* inside a
206
+ * paragraph are likewise out of flow, but they don't contribute to the
207
+ * paragraph's measured line height, so paragraphs need no special handling.
208
+ *
209
+ * @public
210
+ */
211
+ declare function contributesToHeaderFooterFlowHeight(block: FlowBlock): boolean;
196
212
  declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
197
213
  visualTop: number;
198
214
  visualBottom: number;
@@ -289,4 +305,4 @@ declare function computeHfSelectionRectsFromView(view: EditorView, section: 'hea
289
305
  height: number;
290
306
  }>;
291
307
 
292
- export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, convertFootnoteToContent as o, convertHeaderFooterPmDocToContent as p, invalidateHfDomCache as q, normalizeHeaderFooterMeasureBlocks as r, stabilizeFootnoteLayout as s, resolveHeaderFooterVisualTop as t };
308
+ export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, contributesToHeaderFooterFlowHeight as o, convertFootnoteToContent as p, convertHeaderFooterPmDocToContent as q, invalidateHfDomCache as r, stabilizeFootnoteLayout as s, normalizeHeaderFooterMeasureBlocks as t, resolveHeaderFooterVisualTop as u };
@@ -1 +1 @@
1
- 'use strict';var chunk7WGN2OBZ_js=require('../chunk-7WGN2OBZ.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.e}});Object.defineProperty(exports,"clipRectToTableWindow",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.f}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.h}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.g}});
1
+ 'use strict';var chunk4MYKVWNF_js=require('../chunk-4MYKVWNF.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.e}});Object.defineProperty(exports,"clipRectToTableWindow",{enumerable:true,get:function(){return chunk4MYKVWNF_js.f}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.h}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.g}});
@@ -1 +1 @@
1
- export{e as clickToPositionDom,f as clipRectToTableWindow,h as getCaretPositionFromDom,g as getSelectionRectsFromDom}from'../chunk-MEVZCB56.mjs';import'../chunk-QYUPLKLP.mjs';
1
+ export{e as clickToPositionDom,f as clipRectToTableWindow,h as getCaretPositionFromDom,g as getSelectionRectsFromDom}from'../chunk-LX35TFGF.mjs';import'../chunk-QYUPLKLP.mjs';