@docx-editor.dev/core 2.19.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +10 -9
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +8 -9
  6. package/dist/binding.js +1 -1
  7. package/dist/chunk-2H4ABRMB.cjs +20 -0
  8. package/dist/{chunk-YVYEJBLL.cjs → chunk-2HQXLL5L.cjs} +1 -1
  9. package/dist/chunk-3EZO3O6I.js +4 -0
  10. package/dist/{chunk-SUEX3CL7.cjs → chunk-44SIVFJT.cjs} +5 -5
  11. package/dist/chunk-6UCDHGXI.js +1 -0
  12. package/dist/chunk-7VMVDRRU.js +2 -0
  13. package/dist/{chunk-4DB7ZFQN.js → chunk-CAIWEQLC.js} +1 -1
  14. package/dist/{chunk-PBM6WERF.cjs → chunk-CEXC2VHI.cjs} +1 -1
  15. package/dist/chunk-CF3JR35B.js +11 -0
  16. package/dist/chunk-D2V4YBWJ.cjs +2 -0
  17. package/dist/chunk-DGSJZMAE.cjs +11 -0
  18. package/dist/chunk-EHBPYFRE.js +20 -0
  19. package/dist/chunk-GSEUM6AI.cjs +1 -0
  20. package/dist/chunk-H6WDEAOJ.js +18 -0
  21. package/dist/chunk-I6LSEDUL.cjs +18 -0
  22. package/dist/{chunk-ZMM5RNM6.js → chunk-IW35GWJN.js} +1 -1
  23. package/dist/chunk-JRBGCIR2.js +5 -0
  24. package/dist/chunk-K5HIOS6J.cjs +3 -0
  25. package/dist/chunk-KLQXP27K.js +3 -0
  26. package/dist/{chunk-FZ2BIMCY.cjs → chunk-MZFFU66H.cjs} +1 -1
  27. package/dist/{chunk-2ZEU42EA.js → chunk-MZPNLIP3.js} +1 -1
  28. package/dist/{chunk-NJONXJJY.cjs → chunk-OA6LFCTG.cjs} +2 -2
  29. package/dist/{chunk-OODFC5R2.js → chunk-OHVJYJOA.js} +1 -1
  30. package/dist/{chunk-THCGTV53.js → chunk-P4TGGDK3.js} +1 -1
  31. package/dist/{chunk-KDYD5TAW.cjs → chunk-PIBYJZIH.cjs} +1 -1
  32. package/dist/{chunk-CG7CP632.cjs → chunk-WTILOUPG.cjs} +1 -1
  33. package/dist/collaboration/replication.cjs +1 -1
  34. package/dist/collaboration/replication.d.ts +3 -3
  35. package/dist/collaboration/replication.js +1 -1
  36. package/dist/collaboration.d.ts +3 -3
  37. package/dist/contracts/document.d.ts +2 -2
  38. package/dist/contracts/editor.d.ts +8 -9
  39. package/dist/contracts/modules.d.ts +5 -7
  40. package/dist/contracts/types.d.ts +1 -562
  41. package/dist/{custom-node-writes-BqIv94ei.d.ts → custom-node-writes-piokwVR5.d.ts} +2 -2
  42. package/dist/{document-protection-BL5zp8cU.d.ts → document-protection-C6RvCHx-.d.ts} +1 -1
  43. package/dist/{editor-WXbTSXx1.d.ts → editor-BgtcHulQ.d.ts} +19 -14
  44. package/dist/editor.cjs +1 -1
  45. package/dist/editor.css +1 -1
  46. package/dist/editor.d.ts +25 -27
  47. package/dist/editor.js +1 -1
  48. package/dist/export.cjs +2 -2
  49. package/dist/export.d.ts +12 -13
  50. package/dist/export.js +1 -1
  51. package/dist/{font-resolver-BSrKnTeR.d.ts → font-resolver-Bv2Z25-J.d.ts} +1 -1
  52. package/dist/{headless-document-view-C4ttQJ5H.d.ts → headless-document-view-DHKMN_3Y.d.ts} +2 -2
  53. package/dist/image-resources-C51LuAAu.d.ts +210 -0
  54. package/dist/{index-C3As-Xxp.d.ts → index-3lr8xXF8.d.ts} +14 -15
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.ts +17 -18
  57. package/dist/index.js +1 -1
  58. package/dist/{layout-shaping-Dqu3JW3p.d.ts → layout-shaping-CKBUSaS7.d.ts} +1 -1
  59. package/dist/layout.cjs +1 -1
  60. package/dist/layout.d.ts +48 -19
  61. package/dist/layout.js +1 -1
  62. package/dist/{tree-package-fragment-1pdDnhZ_.d.ts → note-lifecycle-D4AOFCAt.d.ts} +142 -141
  63. package/dist/{note-properties-RjYgbmXe.d.ts → note-properties-CcXUgqr8.d.ts} +2 -2
  64. package/dist/{omml-equation-hcP9AUFX.d.ts → omml-equation-C5P6Ym3v.d.ts} +1 -1
  65. package/dist/output.cjs +1 -1
  66. package/dist/output.d.ts +7 -7
  67. package/dist/output.js +1 -1
  68. package/dist/{protocol-OdRd17KZ.d.ts → protocol-CsawNZkt.d.ts} +14 -4
  69. package/dist/{review-paragraph-order--jLHXIcd.d.ts → review-paragraph-order-BCIqjopY.d.ts} +2 -3
  70. package/dist/{revision-projection-BIHO_qvw.d.ts → revision-projection-BcRnC4Yj.d.ts} +1 -1
  71. package/dist/{semantic-cell-selection-lCYAVCCF.d.ts → semantic-cell-selection-R9wrenwR.d.ts} +4 -4
  72. package/dist/{semantic-interaction-0vQXcMZk.d.ts → semantic-interaction-B7beVwH7.d.ts} +1 -1
  73. package/dist/{semantic-paint-BSan4pBk.d.ts → semantic-paint-CLvHwf8y.d.ts} +2 -2
  74. package/dist/{semantic-records-ZcYuB4-H.d.ts → semantic-records-CbXwnS80.d.ts} +5 -4
  75. package/dist/store.cjs +1 -1
  76. package/dist/store.d.ts +13 -14
  77. package/dist/store.js +1 -1
  78. package/dist/{tree-session-contract-Cgn6fQ-M.d.ts → tree-session-contract-DTQxw2zL.d.ts} +5 -5
  79. package/dist/{tree-op-types-DbdM7fJV.d.ts → types-barrel-CEOy-Jv0.d.ts} +961 -210
  80. package/package.json +2 -2
  81. package/dist/chunk-4KMSEFIG.js +0 -3
  82. package/dist/chunk-72BDQFHY.js +0 -18
  83. package/dist/chunk-77DD4EBC.cjs +0 -11
  84. package/dist/chunk-BEOPUDAB.js +0 -5
  85. package/dist/chunk-CJCFEXTA.js +0 -11
  86. package/dist/chunk-DQS4KZUX.js +0 -4
  87. package/dist/chunk-GUPITGJQ.cjs +0 -2
  88. package/dist/chunk-LQ6XWTKQ.cjs +0 -18
  89. package/dist/chunk-MDP5SNK4.cjs +0 -3
  90. package/dist/chunk-MRPPCGCX.cjs +0 -20
  91. package/dist/chunk-MSIFK7TJ.js +0 -1
  92. package/dist/chunk-P6VGDI57.js +0 -2
  93. package/dist/chunk-QBMAXYN7.js +0 -20
  94. package/dist/chunk-ZKQX2PNF.cjs +0 -1
  95. package/dist/review-items-CJz-kAW8.d.ts +0 -370
@@ -0,0 +1 @@
1
+ 'use strict';var chunkI6LSEDUL_cjs=require('./chunk-I6LSEDUL.cjs'),chunkK5HIOS6J_cjs=require('./chunk-K5HIOS6J.cjs'),chunkDGSJZMAE_cjs=require('./chunk-DGSJZMAE.cjs');var wt=Object.freeze({}),xt=Object.freeze([]);function bt(e){let t=Object.keys(e);if(t.length===0)return wt;let r={};for(let n of t){let o=e[n];o!==void 0&&(r[n]=o);}return Object.freeze(r)}function Pt(e){let t=new Map(chunkDGSJZMAE_cjs.Xe(e.part())),r=new Set([e.part()]);for(let o of e.headerFooterPartsBySection())for(let a of [o.headers,o.footers])for(let i of a.values())if(!r.has(i)){r.add(i);for(let[s,p]of chunkDGSJZMAE_cjs.Xe(i))t.has(s)||t.set(s,p);}let n=e.currentPackage();for(let o of ["footnote","endnote"]){let a=chunkDGSJZMAE_cjs.Pf(n,o);if(!(!a||r.has(a))){r.add(a);for(let[i,s]of chunkDGSJZMAE_cjs.Xe(a))t.has(i)||t.set(i,s);}}return t}function vt(e,t){let r=chunkI6LSEDUL_cjs.ge(e,t);if(!r)return null;let n=e.pages[r.pageIndex];if(!n)return null;let o=chunkI6LSEDUL_cjs.ae(n),a=chunkI6LSEDUL_cjs.ce(e,t.paragraphId,r.pageIndex),i=Object.freeze({x:r.x+a.x,y:r.y+a.y,height:r.height});return Object.freeze({anchor:Object.freeze({...t}),pageIndex:r.pageIndex,pageContent:i,pageStack:Object.freeze({x:o.x+i.x,y:o.y+i.y})})}function St(e,t){let r=[];for(let n of t.values()){let o=vt(e,n);o&&r.push(o);}return r.length===0?xt:Object.freeze(r)}function Ue(e,t){return {documentMetadata:bt(e.documentProperties()),destinations:St(t,Pt(e))}}function ar(e,t){let r=e.destinations;if(r){for(let n of r)if(n.anchor.name===t)return n}}function Ye(e={}){return Object.freeze({async decode(t,r,n){let o=chunkDGSJZMAE_cjs.yb(t,r);if(!o)throw new Error(`Unsupported or malformed ${r} image`);if(o.pixelWidth>n.maxDimension||o.pixelHeight>n.maxDimension||o.pixelWidth>n.maxPixels/o.pixelHeight)throw new Error("Image dimensions exceed resource limits");return Object.freeze({pixelWidth:o.pixelWidth,pixelHeight:o.pixelHeight,dpiX:o.dpiX??96,dpiY:o.dpiY??96})},...e.convertPreserved?{convertPreserved:e.convertPreserved}:{}})}var Xe=new WeakMap,It=new Set(["shape","rect","roundrect","oval","line","group","arc","curve","polyline","image"]);function Rt(e){let t=Xe.get(e.root);if(t)return t;let r=new Set,n=[{node:e.root,scope:chunkDGSJZMAE_cjs.Va(),depth:0,mcSelected:false}],o=0;for(;n.length;){let{node:i,scope:s,depth:p,mcSelected:h}=n.pop();if(++o>chunkDGSJZMAE_cjs.fb||p>chunkDGSJZMAE_cjs.W){r.add("scan-limit");break}if(i.kind==="textValue")continue;if(o+n.length+i.children.length>chunkDGSJZMAE_cjs.fb){r.add("scan-limit");break}let y=chunkDGSJZMAE_cjs.Ua(s,i),c=chunkDGSJZMAE_cjs.Ta(i)?i:void 0;if(c){if(chunkDGSJZMAE_cjs.jb(c,y).drawing)continue;let l=chunkDGSJZMAE_cjs.ib(c,y);l.refused&&r.add("scan-limit"),l.branch&&n.push({node:l.branch,scope:y,depth:p+1,mcSelected:true});continue}if(!(!h&&chunkDGSJZMAE_cjs.Sa(i))){if(i.namespaceUri==="urn:schemas-microsoft-com:vml"&&i.localName==="textbox"){r.add("legacy-textbox");continue}i.namespaceUri==="urn:schemas-microsoft-com:vml"&&It.has(i.localName)&&!i.children.some(l=>l.kind!=="textValue"&&l.namespaceUri==="urn:schemas-microsoft-com:vml"&&l.localName==="textbox")&&r.add("legacy-drawing");for(let l of i.children)n.push({node:l,scope:y,depth:p+1,mcSelected:h});}}let a=Object.freeze([...r]);return Xe.set(e.root,a),a}function qe(e){let t=new Set([e.part()]);for(let r of e.headerFooterPartsBySection())for(let n of [r.headers,r.footers])for(let o of n.values())t.add(o);for(let r of ["footnote","endnote"]){let n=chunkDGSJZMAE_cjs.Pf(e.currentPackage(),r);n&&t.add(n);}return Object.freeze([...t].flatMap(r=>Rt(r).map(n=>Object.freeze({code:n,partName:r.name}))))}function Je(e){let t=e.defaultTabStopPt?.(),r=e.view.part().name,n={view:e.view,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:t,compatibilityMode:e.compatibilityMode?.(),inlineDrawingLayoutForPart:e.inlineDrawingLayoutForPart,drawingTokenForParagraphForPart:e.drawingTokenForParagraphForPart,drawingLayoutEpochForPart:e.drawingLayoutEpochForPart,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,showFieldCodes:e.showFieldCodes,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},o=chunkI6LSEDUL_cjs.kd(n),a={view:e.view,revision:e.revision,measurer:e.measurer,cache:e.cache,session:e.session,producer:e.producer,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:t,furniture:e.furniture,compatibilityMode:e.compatibilityMode,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,showFieldCodes:e.showFieldCodes,inlineDrawingLayout:e.inlineDrawingLayout,drawingTokenForParagraph:e.drawingTokenForParagraph,drawingLayoutEpoch:e.drawingLayoutEpoch,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},i={measurer:a.measurer,cache:a.cache,session:a.session,producer:a.producer,styleCascade:a.styleCascade?.(),defaultTabStopPt:a.defaultTabStopPt,compatibilityMode:a.compatibilityMode?.(),numberingIndex:a.numberingIndex?.(),sectionFurniture:a.furniture.sectionFurniture(),furniture:a.furniture.furniture(),projectLink:a.linkProjectors.projectLink,projectFieldLink:a.projectFieldLink,showFieldCodes:a.showFieldCodes,documentProperties:a.view.documentProperties(),inlineDrawingLayout:a.inlineDrawingLayout,drawingTokenForParagraph:a.drawingTokenForParagraph,drawingLayoutEpoch:a.drawingLayoutEpoch,projectionTokenForParagraph:s=>a.linkProjectors.tokenForParagraphForPart(r,s),projectionTokenForTable:s=>a.linkProjectors.tokenForTableForPart(r,s),projectionEpoch:a.linkProjectors.epochForPart(r),notes:o,displayMode:a.displayMode,revisionAuthorFilter:a.revisionAuthorFilter};return chunkI6LSEDUL_cjs.Sd(a.view.part(),a.revision,i)}var Ot=65536;function et(e,t){return {x:t.x-e.contentBox.x,y:t.y-e.contentBox.y}}function kt(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function Dt(e,t,r){return e.rootStory!==t?false:t==="footnote"||t==="endnote"?e.noteScopeId===r:true}function Et(e,t){if(t.story!=="textbox"||t.textboxPath.length===0)return null;let r=null;return chunkI6LSEDUL_cjs.F(e,n=>{if(r||!Dt(t,n.story,n.noteScopeId))return;let o=n.story==="header"||n.story==="footer"?a=>chunkI6LSEDUL_cjs.A(a,n.origin,{x:e.box.x,y:e.box.y}):void 0;chunkI6LSEDUL_cjs.J(n.host,(a,i)=>{if(r||i.textboxDepth===0)return;let s=i.textboxPath.map(p=>p.drawingNodeId);kt(s,t.textboxPath)&&(r=et(e,i.storyOrigin));},n.origin,o);}),r}function Mt(e,t){if(t.story==="textbox")return Et(e,t)??{x:0,y:0};switch(t.rootStory){case "body":return {x:0,y:0};case "header":return e.header?chunkI6LSEDUL_cjs.be(e,e.header.box):{x:0,y:0};case "footer":return e.footer?chunkI6LSEDUL_cjs.be(e,e.footer.box):{x:0,y:0};case "footnote":case "endnote":{let n=(t.rootStory==="footnote"?e.footnotes:e.endnotes)?.notes.find(o=>o.scopeId===t.noteScopeId);return n?chunkI6LSEDUL_cjs.be(e,n.box):{x:0,y:0}}case "note-separator":{let r=t.noteAreaKind==="endnotes"?e.endnotes:e.footnotes;return r?.separator?chunkI6LSEDUL_cjs.be(e,r.separator.box):{x:0,y:0}}default:return {x:0,y:0}}}function tt(e){return Object.freeze({x:e.x,y:e.y,width:e.width,height:e.height})}function rt(e,t){let r=chunkI6LSEDUL_cjs.ae(e);return Object.freeze({x:r.x+t.x,y:r.y+t.y,width:t.width,height:t.height})}function Lt(e,t){let r=chunkI6LSEDUL_cjs.ge(e,{paragraphId:t.source.start.paragraphId,offset:t.source.start.offset},{preferredPageIndex:t.pageIndex});if(!r||r.pageIndex!==t.pageIndex)return;let n=e.pages[r.pageIndex];if(!n)return;let o=Mt(n,t),a=Object.freeze([tt({x:r.x+o.x,y:r.y+o.y,width:0,height:r.height})]);return Object.freeze({pageContent:a,pageStack:Object.freeze(a.map(i=>rt(n,i)))})}function At(e,t,r){let n=r.filter(i=>i.pageIndex===t.pageIndex);if(n.length===0)return nt(t)?Lt(e,t):void 0;let o=e.pages[t.pageIndex];if(!o)return;let a=Object.freeze(n.map(i=>tt(i)));return Object.freeze({pageContent:a,pageStack:Object.freeze(a.map(i=>rt(o,i)))})}function nt(e){return e.source.start.paragraphId===e.source.end.paragraphId&&e.source.start.offset===e.source.end.offset}function Ze(e,t){return `${e}\0${t}`}function Ft(e,t,r){let n=Math.max(e.start,t.offset),o=Math.min(e.end,r.offset);return o>n?{start:n,end:o}:null}function Tt(e,t){let r=new Map,n=new Map,o=new Set,a=0;let i=(s,p)=>{if(a>=Ot)return false;a+=1;let h=Ze(s.pageIndex,p),y=n.get(h);return y?y.push(s):n.set(h,[s]),true};for(let[s,p]of t.entries())for(let[h,y]of p.occurrences.entries()){if(nt(y)||y.source.start.paragraphId!==y.source.end.paragraphId)continue;o.add(y.pageIndex);let c=`${s}\0${h}`,l={paragraphId:y.source.start.paragraphId,offset:y.source.start.offset},f={paragraphId:y.source.end.paragraphId,offset:y.source.end.offset},w=l.offset<=f.offset?{from:l,to:f}:{from:f,to:l};i({key:c,from:w.from,to:w.to,pageIndex:y.pageIndex},w.from.paragraphId);}if(n.size===0)return r;for(let s of e.pages)o.has(s.index)&&chunkI6LSEDUL_cjs.F(s,p=>{let h=p.story==="header"||p.story==="footer"?y=>chunkI6LSEDUL_cjs.A(y,p.origin,{x:s.box.x,y:s.box.y}):void 0;chunkI6LSEDUL_cjs.J(p.host,(y,c)=>{let l=et(s,c.storyOrigin);for(let f of y.lines)for(let w of chunkI6LSEDUL_cjs.Q(f)){let u=n.get(Ze(s.index,w.paragraphId));if(u)for(let g of u){let x=Ft(w,g.from,g.to);if(!x)continue;let b=chunkI6LSEDUL_cjs.Yd(f,x.start,void 0,w),v=chunkI6LSEDUL_cjs.Yd(f,x.end,void 0,w),R=r.get(g.key)??[];R.push({pageIndex:s.index,x:Math.min(b,v)+l.x,y:f.box.y+l.y,width:Math.abs(v-b),height:f.box.height}),r.set(g.key,R);}}},p.origin,h);});return r}function ot(e,t){let r=false;for(let o of t)if(o.occurrences.length!==0){r=true;break}if(!r)return t;let n=Tt(e,t);return t.map((o,a)=>{if(o.occurrences.length===0)return o;let i=o.occurrences.map((s,p)=>{let h=`${a}\0${p}`,y=At(e,s,n.get(h)??[]);return y?{...s,geometry:y}:s});return {...o,occurrences:Object.freeze(i)}})}function Ct(e){let t=new Map,r=[{node:e.root,depth:0}];for(;r.length>0;){let{node:n,depth:o}=r.pop();if(!(n.kind==="textValue"||o>64)){n.kind==="paragraph"&&!t.has(n.id)&&t.set(n.id,t.size);for(let a=n.children.length-1;a>=0;a-=1)r.push({node:n.children[a],depth:o+1});}}return t}function at(){let e=new Map,t=n=>{let o=e.get(n.root);if(o)return o;let a=Ct(n);return e.set(n.root,a),a},r={retainRevisionItems:false,revisionSites:chunkDGSJZMAE_cjs.wh,locations:chunkK5HIOS6J_cjs.Na,commentAnchors:chunkDGSJZMAE_cjs.qg,deepOrder:t};return Object.freeze({collectReviewItems:n=>chunkK5HIOS6J_cjs.Ra(n,r),deepParagraphOrderOfPart:t})}function jt(e,t){if(t)return true;let r=e.map(n=>n.root);for(;r.length>0;){let n=r.pop();if(chunkDGSJZMAE_cjs.uh(n))return true;if(n.kind!=="textValue")for(let o of n.children)r.push(o);}return false}function Nt(e,t){let r=[],n=new Set([t.name]),o=a=>{!a||n.has(a.name)||(n.add(a.name),r.push(a));};for(let a of chunkDGSJZMAE_cjs.Pd(e)){for(let i of a.headers.values())o(i);for(let i of a.footers.values())o(i);}return o(chunkDGSJZMAE_cjs.Pf(e,"footnote")),o(chunkDGSJZMAE_cjs.Pf(e,"endnote")),r}function _t(e,t){switch(t.story){case "body":return e.mainDocumentPart;case "header":case "footer":return t.host.partName;case "footnote":return chunkDGSJZMAE_cjs.Pf(e,"footnote")?.name??null;case "endnote":return chunkDGSJZMAE_cjs.Pf(e,"endnote")?.name??null;case "note-separator":return chunkDGSJZMAE_cjs.Pf(e,t.noteAreaKind==="footnotes"?"footnote":"endnote")?.name??null;default:return t}}function Bt(e,t){let r=new Map;for(let n of e){let o=t.get(n.partName),a=o?.get(n.start.paragraphId),i=o?.get(n.end.paragraphId);if(a===void 0||i===void 0)continue;let s=Math.min(a,i),p=Math.max(a,i),h=r.get(n.partName);r.set(n.partName,{lower:Math.min(h?.lower??s,s),upper:Math.max(h?.upper??p,p)});}return r}function Vt(e,t,r,n,o){let a=new Map(r.map(c=>[c.name,o(c)])),i=Bt(n,a),s=new Map,p=new Map,h=(c,l,f,w,u,g,x)=>{let b=a.get(c)?.get(u),v=i.get(c);if(b===void 0||!v||b<v.lower||b>v.upper)return;let R=s.get(c)??new Map;s.set(c,R);let V=p.get(c)??new Map;p.set(c,V);let N=JSON.stringify([l.story,l.noteScopeId,l.noteAreaKind]),Y=f==="textbox"?JSON.stringify([N,"textbox",w]):N,K=R.get(u)??[],z=`${u}\0${l.page.index}\0${Y}`,T=V.get(z);T||(T={pageIndex:l.page.index,story:f,rootStory:l.story,textboxPath:w,noteScopeId:l.noteScopeId,noteAreaKind:l.noteAreaKind,laneKey:Y,intervals:[],intervalKeys:new Set},V.set(z,T),K.push(T),R.set(u,K));let m=`${g}\0${x}`;T.intervalKeys?.has(m)||(T.intervalKeys?.add(m),T.intervals.push({start:g,end:x}));};chunkI6LSEDUL_cjs.G(e,c=>{let l=_t(t,c);!l||!i.has(l)||chunkI6LSEDUL_cjs.J(c.host,(f,w)=>{let u=w.textboxDepth>0?"textbox":c.story,g=w.textboxPath.map(b=>b.drawingNodeId),x=[];for(let b of f.lines){for(let v of b.spans)x.push(v.range);for(let v of b.drawings??[])x.push({paragraphId:v.paragraphId,start:v.start,end:v.start+1});}x.length===0&&x.push({paragraphId:f.range.paragraphId,start:f.range.start,end:f.range.end});for(let{paragraphId:b,start:v,end:R}of x)h(l,c,u,g,b,v,R);});}),chunkI6LSEDUL_cjs.I(e,c=>{let l=c.drawing.ownerPartName;i.has(l)&&h(l,c.root,c.story,c.textboxPath.map(f=>f.drawingNodeId),c.drawing.paragraphId,c.drawing.start,c.drawing.start+1);});for(let c of s.values())for(let l of c.values())for(let f of l){f.intervals.sort((u,g)=>u.start-g.start||u.end-g.end);let w=[];for(let u of f.intervals){let g=w.at(-1);g&&u.start<=g.end?g.end=Math.max(g.end,u.end):w.push({...u});}f.intervals.splice(0,f.intervals.length,...w),f.intervalKeys=void 0;}let y=new Map;for(let[c,l]of s){let f=a.get(c);if(!f)continue;let w=[];for(let[u,g]of l){let x=f.get(u);x!==void 0&&w.push({paragraphId:u,position:x,laneKeys:new Set(g.map(({laneKey:b})=>b))});}w.sort((u,g)=>u.position-g.position),y.set(c,w);}return {byPart:s,orderByPart:a,visibleByPart:y}}function it(e,t){let r=0,n=e.length;for(;r<n;){let o=r+n>>>1;e[o].position<t?r=o+1:n=o;}return r}function Kt(e,t){if(e.start.paragraphId===e.end.paragraphId)return [e.start.paragraphId];let r=t.orderByPart.get(e.partName),n=t.visibleByPart.get(e.partName),o=r?.get(e.start.paragraphId),a=r?.get(e.end.paragraphId);if(!r||!n||o===void 0||a===void 0)return [e.start.paragraphId,e.end.paragraphId];let i=Math.min(o,a),s=Math.max(o,a),p=new Set(t.byPart.get(e.partName)?.get(e.start.paragraphId)?.map(({laneKey:c})=>c)??[]),h=new Set(t.byPart.get(e.partName)?.get(e.end.paragraphId)?.map(({laneKey:c})=>c)??[]),y=new Set([...p].filter(c=>h.has(c)));return y.size===0?[e.start.paragraphId,e.end.paragraphId]:n.slice(it(n,i),it(n,s+1)).filter(c=>[...c.laneKeys].some(l=>y.has(l))).map(c=>c.paragraphId)}function zt(e,t,r,n){return n?e.intervals.filter(a=>a.start<=t&&t<a.end).length>0?[{start:t,end:t}]:[]:e.intervals.flatMap(o=>{if(o.start===o.end)return [];let a={start:Math.max(o.start,t),end:Math.min(o.end,r)};return a.end>a.start?[a]:[]})}function Wt(e,t){let r=Number.NEGATIVE_INFINITY;for(let n of e)for(let o of n.intervals)r=Math.max(r,o.end);return t!==r?new Set:new Set(e.filter(n=>n.intervals.some(o=>o.end===r)))}function st(e,t,r){let n=[],o=new Set;for(let[a,i]of e.entries()){let s=r===void 0?void 0:r===null?"neutral":a<r?"replaced":"replacement";for(let p of Kt(i,t)){let h=t.byPart.get(i.partName)?.get(p)??[],c=i.start.paragraphId===i.end.paragraphId&&i.start.offset===i.end.offset,l=p===i.start.paragraphId?i.start.offset:0,f=p===i.end.paragraphId?i.end.offset:Number.POSITIVE_INFINITY,w=c?Wt(h,l):new Set;for(let u of h){let g=zt(u,l,f,c);c&&g.length===0&&w.has(u)&&(g=[{start:l,end:l}]);for(let x of g){let b=`${u.pageIndex}\0${u.story}\0${u.noteScopeId??""}\0${u.noteAreaKind??""}\0${u.textboxPath.join("\0")}\0${i.partName}\0${p}\0${x.start}\0${x.end}\0${s??""}`;o.has(b)||(o.add(b),n.push({pageIndex:u.pageIndex,physicalPageNumber:u.pageIndex+1,story:u.story,rootStory:u.rootStory,textboxPath:u.textboxPath,noteScopeId:u.noteScopeId,noteAreaKind:u.noteAreaKind,...s?{revisionRole:s}:{},source:{partName:i.partName,start:{paragraphId:p,offset:x.start},end:{paragraphId:p,offset:x.end}}}));}}}}return n}function dt(e,t){let r=2166136261,n=2654435769;for(let o=0;o<t.length;o+=1){let a=t.charCodeAt(o);r=Math.imul(r^a,16777619)>>>0,n=Math.imul(n^a+o,2246822507)>>>0,n^=n>>>13;}return `${e}_${t.length.toString(36)}_${r.toString(36)}_${n.toString(36)}`}function ct(e,t,r=dt){let n=new Map;for(let a of t){let i=r(e,a),s=n.get(i)??new Set;s.add(a),n.set(i,s);}let o=new Map;for(let[a,i]of n){let s=[...i].sort();for(let[p,h]of s.entries())o.set(h,s.length===1?a:`${a}_${p.toString(36)}`);}return o}function $t(e){let t=new Set,r=new Set;for(let n of e){if(n.kind==="comment"){t.add(n.id),n.parentId!==void 0&&t.add(n.parentId),n.parentRevisionId!==void 0&&r.add(n.parentRevisionId);for(let o of n.replyIds)t.add(o);}if(n.kind==="revision"){r.add(n.id),n.pairedWith!==void 0&&r.add(n.pairedWith);for(let o of n.replyIds)t.add(o);}}return {comment:ct("comment",t),revision:ct("change",r)}}function B(e,t,r){return e.get(r)??dt(t,r)}function Ht(e,t,r){return e.kind==="revision"?{kind:"tracked-change",id:B(r.revision,"change",e.id),change:e.revisionKind,...e.markDirection?{markDirection:e.markDirection}:{},author:e.author,...e.date!==void 0?{date:e.date}:{},text:e.text,replacedText:e.replacedText,nesting:e.nesting,...e.replacedRangeCount!==void 0?{replacedRangeCount:e.replacedRangeCount}:{},readOnly:e.readOnly,...e.pairedWith!==void 0?{pairedWith:B(r.revision,"change",e.pairedWith)}:{},replyIds:e.replyIds.map(n=>B(r.comment,"comment",n)),occurrences:t?st(e.ranges,t,e.revisionKind==="replace"?e.replacedRangeCount??null:void 0):[]}:e.kind!=="comment"?null:{kind:"comment",id:B(r.comment,"comment",e.id),author:e.comment.author,initials:chunkK5HIOS6J_cjs.Da(e.comment),...e.comment.date!==void 0?{date:e.comment.date}:{},text:chunkK5HIOS6J_cjs.Ca(e.comment),resolved:e.resolved,...e.parentId!==void 0?{parentId:B(r.comment,"comment",e.parentId)}:{},...e.parentRevisionId!==void 0?{parentRevisionId:B(r.revision,"change",e.parentRevisionId)}:{},replyIds:e.replyIds.map(n=>B(r.comment,"comment",n)),orphaned:e.orphaned,occurrences:t&&e.range?st([e.range],t):[]}}function ut(e,t){let r=t.parts.get(t.mainDocumentPart);if(!r)return [];let n=Nt(t,r),o=[r,...n],a=t.parts.get(chunkK5HIOS6J_cjs.X(t,r.name));if(!jt(o,a))return [];let i=at(),s=i.collectReviewItems({storyPart:r,furnitureParts:n,commentsPart:a,commentsExtendedPart:t.parts.get(chunkK5HIOS6J_cjs.Y(t,r.name))});if(s.length===0)return [];let p=s.flatMap(c=>chunkK5HIOS6J_cjs.Ga(c)),h=p.length>0?Vt(e,t,o,p,i.deepParagraphOrderOfPart):null,y=$t(s);return s.map(c=>Ht(c,h,y)).filter(c=>c!==null)}var Gt=new Set(["part","validatedHandle"]);function lt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function U(e,t,r,n,o){if(!(n!==void 0&&Gt.has(n))){if(typeof e=="function")throw new TypeError("Semantic layout publication encountered a function value");if(!(e===null||typeof e!="object")&&!o?.has(e)){if(r.has(e))throw new TypeError("Semantic layout publication encountered a cyclic record graph");if(!t.has(e)){t.add(e),r.add(e);try{if(Array.isArray(e)){for(let a of e)U(a,t,r,void 0,o);Object.freeze(e);return}if(!lt(e))throw new TypeError("Semantic layout publication encountered a non-record value");for(let a of Reflect.ownKeys(e)){let i=Object.getOwnPropertyDescriptor(e,a);if(i){if(!("value"in i))throw new TypeError("Semantic layout publication encountered an accessor property");U(i.value,t,r,a,o);}}Object.freeze(e);}finally{r.delete(e);}}}}}function pt(e){if(!lt(e))throw new TypeError("Semantic layout publication encountered a non-record value");let t=new Set;for(let n of e.pages)if(!(n===null||typeof n!="object"))for(let o of ["header","footer"]){let a=Object.getOwnPropertyDescriptor(n,o);if(!a||!("value"in a))continue;let i=a.value;if(i===null||typeof i!="object"||t.has(i))continue;let s=new Set;s.add(e),U(i,new Set,s,o),t.add(i);}let r=(n,o)=>{let a=new Set;for(let i of n){let s=new Set;s.add(e),U(i,a,s,void 0,o);}Object.freeze(n);};for(let n of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,n);if(!o)continue;if(!("value"in o))throw new TypeError("Semantic layout publication encountered an accessor property");if(n==="pages"&&Array.isArray(o.value)){r(o.value,t);continue}if(n==="reviewArtifacts"&&Array.isArray(o.value)){r(o.value);continue}let a=new Set;a.add(e),U(o.value,new Set,a,n);}return Object.freeze(e),e}var Ut=Object.freeze([]),k=class extends Error{constructor(r,n,o){super(n,o);this.code=r;this.name="ExportResourceError";}code};function Yt(e){try{return e instanceof k}catch{return false}}function Xt(e){try{return e instanceof chunkI6LSEDUL_cjs.fd}catch{return false}}function qt(e){try{return e instanceof Error&&typeof e.message=="string"&&e.message.length>0?e.message:null}catch{return null}}function Jt(e){if(Yt(e))return e;let t=Xt(e),r=qt(e),n=r?`: ${r}`:"",o=new k(t?"layoutInvariant":"layoutFailed",t?`Authored geometry could not be represented within the bounded page model${n}`:`Export layout failed${n}`);return Object.defineProperty(o,"cause",{configurable:true,value:e}),o}function Qt(e){if(e===void 0)return 6e4;if(!Number.isFinite(e)||e<=0)throw new RangeError("resourceTimeoutMs must be a positive finite number");return Math.max(1,e)}function mt(e){if(e==="all-markup"||e==="proposed"||e==="original")return e;throw new RangeError("displayMode must be all-markup, proposed, or original")}var Zt=50,se=64;function er(e){switch(e.kind){case "pending":return true;case "ready":case "unrenderable":case "external":case "missing":return false;default:return e}}function tr(e){let t=false;return chunkI6LSEDUL_cjs.I(e,({drawing:r})=>{er(r.resource)&&(t=true);}),t}function yt(e){return !ArrayBuffer.isView(e)}function nn(e,t={}){if(t.signal?.aborted)return {ok:false,reason:"aborted"};let r=mt(t.displayMode??chunkI6LSEDUL_cjs.X),n=yt(e),o=yt(e)?{ok:true,view:e}:chunkK5HIOS6J_cjs._a(e);if(!o.ok)return o;let a=o.view,i=t.reuseAcrossRevisions??n,s=Qt(t.resourceTimeoutMs),p=t.measurer??chunkI6LSEDUL_cjs.b(),h=t.producer??(t.measurer?"host-export-measurer":"export-fixed-measurer"),y=chunkI6LSEDUL_cjs.Ja({retainAcrossPasses:i}),c=0,l=new Set,f=()=>{c+=1;for(let m of l)m();l.clear();},w=chunkI6LSEDUL_cjs.vc({session:a,decodePort:t.imageDecodePort??Ye(t.convertPreservedImage?{convertPreserved:t.convertPreservedImage}:void 0),onResourcesChanged:f}),u={view:a,measurer:p,paragraphCache:y,sessions:new Map,completed:new Map,inFlight:new Map,styles:chunkI6LSEDUL_cjs.uc(a),fieldLinks:new Map,links:chunkI6LSEDUL_cjs.md(a),drawingBundle:w,furniture:new Map},g=new AbortController,x=t.signal,b=false,v=()=>b?new k("aborted","Export resource settlement was aborted"):new k("disposed","Export session has been disposed"),R=()=>{b=true,V();};function V(){let m=u;if(m){u=null,x?.removeEventListener("abort",R),g.abort(x?.reason),m.drawingBundle.dispose(),m.paragraphCache.clear();for(let P of m.completed.values())chunkI6LSEDUL_cjs.jc(P.internal),chunkI6LSEDUL_cjs.sd(P.internal);for(let P of m.fieldLinks.values())P.registry.clear();m.fieldLinks.clear(),m.completed.clear(),m.inFlight.clear(),m.furniture.clear(),m.sessions.clear(),f();}}x?.addEventListener("abort",R,{once:true}),x?.aborted&&R();let N=()=>{if(!u)throw v();if(g.signal.aborted)throw new k("aborted","Export resource settlement was aborted")},Y=(m,P,D,d)=>c!==m||u?.view.packageRevision()!==P||u?.view.currentPackage()!==D?Promise.resolve():(N(),new Promise((_,O)=>{let E=false,C,M=A=>{E||(E=true,C!==void 0&&clearTimeout(C),l.delete(L),g.signal.removeEventListener("abort",W),A?O(A):_());},L=()=>M(),W=()=>M(new k("aborted","Export resource settlement was aborted")),$=()=>{if(u?.view.packageRevision()!==P||u?.view.currentPackage()!==D){M();return}let A=d-Date.now();if(A<=0){M(new k("timedOut",`Image resources did not settle within ${s}ms`));return}C=setTimeout($,Math.min(Zt,A));};if(l.add(L),g.signal.addEventListener("abort",W,{once:true}),c!==m||u?.view.packageRevision()!==P||u?.view.currentPackage()!==D){M();return}$();})),K=async(m,P=0,D=Date.now()+s)=>{if(N(),Date.now()>=D)throw new k("timedOut",`Export layout did not stabilize within ${s}ms`);let d=u,_=D,O=d.view.packageRevision(),E=d.view.currentPackage(),C=d.completed.get(m);if(C&&C.revision===O&&C.pkg===E)return C.published;let M=()=>{if(d.view.packageRevision()===O&&d.view.currentPackage()===E)return null;if(P>=se-1)throw new k("nonConvergent","Document revision did not stabilize during export layout");return K(m,P+1,_)},L=d.fieldLinks.get(m);if(!L||L.revision!==O||L.pkg!==E){let I=L?.registry??chunkI6LSEDUL_cjs.nd();I.clear(),L={revision:O,pkg:E,registry:I},d.fieldLinks.set(m,L),d.furniture.delete(m);}let W=L.registry,$=d.sessions.get(m)??chunkI6LSEDUL_cjs.Rd();d.sessions.set(m,$);let A=d.furniture.get(m);A||(A=chunkI6LSEDUL_cjs.jd({view:d.view,measurer:d.measurer,producer:h,cache:d.paragraphCache,styleCascade:d.styles.styleCascade,numberingIndex:d.styles.numberingIndex,defaultTabStopPt:d.styles.defaultTabStopPt,compatibilityMode:d.styles.compatibilityMode,displayMode:m,revisionAuthorFilter:void 0,showFieldCodes:false,inlineDrawingLayoutForPart:I=>d.drawingBundle.contextForPart(I),drawingLayoutTokenForPart:I=>d.drawingBundle.cacheTokenForPart(I),drawingTokenForParagraphForPart:(I,ee)=>d.drawingBundle.drawingTokenForParagraph(ee,I),linkProjectors:d.links,projectFieldLink:I=>W.project(I)}),d.furniture.set(m,A));for(let I=0;I<se;I+=1){let ee=c;d.drawingBundle.sync(d.view);let ce=M();if(ce)return ce;let j=Je({view:d.view,revision:d.view.packageRevision(),measurer:d.measurer,cache:d.paragraphCache,session:$,producer:h,styleCascade:d.styles.styleCascade,defaultTabStopPt:d.styles.defaultTabStopPt,numberingIndex:d.styles.numberingIndex,furniture:A,compatibilityMode:d.styles.compatibilityMode,linkProjectors:d.links,projectFieldLink:S=>W.project(S),inlineDrawingLayout:d.drawingBundle.bodyContext,inlineDrawingLayoutForPart:S=>d.drawingBundle.contextForPart(S),drawingTokenForParagraph:S=>d.drawingBundle.drawingTokenForParagraph(S,d.view.part().name),drawingTokenForParagraphForPart:(S,X)=>d.drawingBundle.drawingTokenForParagraph(X,S),drawingLayoutEpoch:d.drawingBundle.cacheTokenForPart(d.view.part().name),drawingLayoutEpochForPart:S=>d.drawingBundle.cacheTokenForPart(S),displayMode:m,revisionAuthorFilter:void 0,showFieldCodes:false});if(!tr(j)){let S=M();if(S)return S;i||(chunkI6LSEDUL_cjs.jc(j),chunkI6LSEDUL_cjs.sd(j),d.paragraphCache.clear(),d.sessions.delete(m),d.furniture.delete(m));let X=ut(j,E),ft=X.length===0?Ut:Object.freeze(ot(j,X)),gt=Ue(d.view,j),ht={...j,...gt,contentWarnings:qe(d.view),reviewArtifacts:ft},le=pt(ht);return d.completed.set(m,{revision:O,pkg:E,internal:j,published:le}),le}let de=ee;for(;d.drawingBundle.pendingResourceCount()>0;){await Y(de,O,E,_),de=c,N();let S=M();if(S)return S}N();let ue=M();if(ue)return ue}throw new k("nonConvergent",`Image resources did not reach quiescence after ${se} layout passes`)},z=m=>{let P;try{P=mt(m);}catch(O){return Promise.reject(O)}if(!u)return Promise.reject(v());let D=u,d=D.inFlight.get(P);if(d)return d;let _=K(P).catch(O=>{throw Jt(O)}).finally(()=>D.inFlight.delete(P));return D.inFlight.set(P,_),_};return {ok:true,session:{layout:()=>z(r),layoutFor:z,validatedImageBytes(m){let P=u;return !P||m.resource.kind!=="ready"?null:P.drawingBundle.mintValidatedBytes(m.resource.validatedHandle,m.resource.contentId)?.slice()??null},dispose:V}}}exports.a=Je;exports.b=ar;exports.c=Ye;exports.d=k;exports.e=nn;