@docx-editor.dev/core 2.27.0 → 2.28.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 (116) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +26 -13
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +20 -9
  6. package/dist/binding.js +1 -1
  7. package/dist/chunk-2GO5T2JU.cjs +1 -0
  8. package/dist/chunk-2RC2EPND.js +3 -0
  9. package/dist/chunk-4GBTELJV.cjs +28 -0
  10. package/dist/chunk-4R3TEXMN.js +18 -0
  11. package/dist/chunk-5CSUYANV.js +1 -0
  12. package/dist/chunk-6APGXLBB.cjs +3 -0
  13. package/dist/chunk-6AWEKBLB.cjs +1 -0
  14. package/dist/chunk-6EYYL7FL.js +1 -0
  15. package/dist/chunk-E7BQA6UP.js +2 -0
  16. package/dist/chunk-EO4C5QJW.cjs +2 -0
  17. package/dist/chunk-ETTO6GK3.js +1 -0
  18. package/dist/chunk-FIJZIQXA.cjs +18 -0
  19. package/dist/chunk-FRXAOVTB.js +28 -0
  20. package/dist/chunk-J6BVWIDB.js +2 -0
  21. package/dist/chunk-JGNVNT2A.cjs +2 -0
  22. package/dist/chunk-K5U2PLDP.cjs +2 -0
  23. package/dist/chunk-KKIJG3C6.js +2 -0
  24. package/dist/chunk-LWDSDCMO.js +27 -0
  25. package/dist/chunk-O2AL2HSJ.cjs +1 -0
  26. package/dist/chunk-QMLCVPCD.cjs +1 -0
  27. package/dist/chunk-RCHS4ZEH.cjs +27 -0
  28. package/dist/chunk-SRPILEWV.cjs +5 -0
  29. package/dist/chunk-TSLBZ26X.js +1 -0
  30. package/dist/chunk-VDNNLG6X.js +2 -0
  31. package/dist/chunk-VHAVHCQY.js +7 -0
  32. package/dist/chunk-VX43VBAX.cjs +7 -0
  33. package/dist/chunk-Z6WBFXJU.js +5 -0
  34. package/dist/{chunk-2GK7YQB2.cjs → chunk-ZUHOMK52.cjs} +1 -1
  35. package/dist/collaboration/replication.cjs +1 -1
  36. package/dist/collaboration/replication.d.ts +41 -5
  37. package/dist/collaboration/replication.js +1 -1
  38. package/dist/collaboration.cjs +1 -1
  39. package/dist/collaboration.d.ts +98 -6
  40. package/dist/collaboration.js +1 -1
  41. package/dist/contracts/document.d.ts +17 -2
  42. package/dist/contracts/editor.d.ts +19 -9
  43. package/dist/contracts/interaction.d.ts +29 -0
  44. package/dist/contracts/modules.d.ts +31 -7
  45. package/dist/contracts/types.d.ts +10 -1
  46. package/dist/{custom-node-writes-Vzpq9I8_.d.ts → custom-node-writes-cvL5rhcD.d.ts} +2 -2
  47. package/dist/{document-protection-9zpIHWTE.d.ts → document-protection-BAGVGqaP.d.ts} +1 -1
  48. package/dist/{editor-B3OBYNrF.d.ts → editor-Ci7IZGmG.d.ts} +392 -140
  49. package/dist/editor.cjs +1 -1
  50. package/dist/editor.css +5 -5
  51. package/dist/editor.d.ts +415 -30
  52. package/dist/editor.js +1 -1
  53. package/dist/export.cjs +2 -2
  54. package/dist/export.d.ts +23 -13
  55. package/dist/export.js +2 -2
  56. package/dist/failure-NS2lsya4.d.ts +115 -0
  57. package/dist/{font-resolver-DN0xNOf_.d.ts → font-resolver-BVQB14qT.d.ts} +1 -1
  58. package/dist/{headless-document-view-ICYqNkQ1.d.ts → headless-document-view-qH331moE.d.ts} +2 -2
  59. package/dist/{image-resources-BDFxcu7W.d.ts → image-resources-BN-hUgCn.d.ts} +9 -9
  60. package/dist/{index-CkQVRJtJ.d.ts → index-Bsg7oIKP.d.ts} +234 -111
  61. package/dist/index.cjs +1 -1
  62. package/dist/index.d.ts +46 -19
  63. package/dist/index.js +1 -1
  64. package/dist/{layout-shaping-BvZD_VKP.d.ts → layout-shaping-BEyuiQOk.d.ts} +1 -1
  65. package/dist/layout.cjs +1 -1
  66. package/dist/layout.d.ts +170 -78
  67. package/dist/layout.js +1 -1
  68. package/dist/{note-properties-CkAk7g-n.d.ts → note-properties-4Y9o6Gyk.d.ts} +1 -1
  69. package/dist/{omml-equation-DuczgG5o.d.ts → omml-equation-CuzBL5DD.d.ts} +1 -1
  70. package/dist/output.cjs +1 -1
  71. package/dist/output.d.ts +18 -8
  72. package/dist/output.js +1 -1
  73. package/dist/{protocol-aKYr8r3u.d.ts → protocol-Bqk4Izjc.d.ts} +44 -4
  74. package/dist/review-pane-D9jm8DcY.d.ts +128 -0
  75. package/dist/{review-paragraph-order-Ddj5d6rp.d.ts → review-paragraph-order-DT-n6ouC.d.ts} +5 -2
  76. package/dist/{revision-projection-CSNFudZY.d.ts → revision-projection-DZ4kKVev.d.ts} +1 -1
  77. package/dist/{semantic-cell-selection-DoqYCz_F.d.ts → semantic-cell-selection-D9D1KSXq.d.ts} +8 -6
  78. package/dist/{semantic-interaction-G0bjmmmk.d.ts → semantic-interaction-CIC-PooQ.d.ts} +25 -34
  79. package/dist/{semantic-paint-CsMzF8-O.d.ts → semantic-paint-BME37OMv.d.ts} +4 -4
  80. package/dist/{semantic-record-queries-1du6lQqS.d.ts → semantic-record-queries-CBlZqZNa.d.ts} +1 -1
  81. package/dist/{semantic-records-B9OolWGN.d.ts → semantic-records-4B3WwFAi.d.ts} +74 -42
  82. package/dist/store.cjs +1 -1
  83. package/dist/store.d.ts +157 -134
  84. package/dist/store.js +1 -1
  85. package/dist/{tree-package-fragment-DYZIk1rY.d.ts → tree-package-fragment-BeeKxDw8.d.ts} +77 -57
  86. package/dist/{tree-session-contract-DQVJOOkv.d.ts → tree-session-contract-CVbmlMlq.d.ts} +7 -5
  87. package/dist/{types-barrel-BFKR8Pzp.d.ts → types-barrel-D3xCgQX6.d.ts} +462 -362
  88. package/package.json +2 -2
  89. package/dist/chunk-4KZ6L5YF.cjs +0 -15
  90. package/dist/chunk-55AT3MOU.cjs +0 -25
  91. package/dist/chunk-6ZQMII6V.js +0 -1
  92. package/dist/chunk-7IGCWG4H.js +0 -2
  93. package/dist/chunk-7MYITTAH.js +0 -5
  94. package/dist/chunk-AVKVRU7Z.cjs +0 -5
  95. package/dist/chunk-CWRBFNK5.cjs +0 -5
  96. package/dist/chunk-DGPA3TST.cjs +0 -27
  97. package/dist/chunk-DNXVNQEO.js +0 -1
  98. package/dist/chunk-FQN4KSFL.cjs +0 -7
  99. package/dist/chunk-GVUOWHTO.cjs +0 -1
  100. package/dist/chunk-GWQJ5774.js +0 -5
  101. package/dist/chunk-HAQ72KD7.js +0 -1
  102. package/dist/chunk-HO5XFO32.cjs +0 -3
  103. package/dist/chunk-IGR23DV2.js +0 -1
  104. package/dist/chunk-JSIX2EOH.js +0 -3
  105. package/dist/chunk-K246T47S.cjs +0 -1
  106. package/dist/chunk-KAXOGCGA.js +0 -1
  107. package/dist/chunk-LZLTN5A3.cjs +0 -1
  108. package/dist/chunk-OHAXVTWG.cjs +0 -1
  109. package/dist/chunk-S74GRBNE.js +0 -7
  110. package/dist/chunk-UBLUVNZR.js +0 -27
  111. package/dist/chunk-UMRSBLO7.js +0 -15
  112. package/dist/chunk-VIPMGGUT.js +0 -25
  113. package/dist/chunk-WG4KMSX2.cjs +0 -2
  114. package/dist/chunk-WRLKVNNR.cjs +0 -1
  115. package/dist/chunk-ZU7IVN6G.js +0 -2
  116. package/dist/failure-BIPVQbRm.d.ts +0 -65
@@ -0,0 +1,5 @@
1
+ import {d,f,c}from'./chunk-5CSUYANV.js';import {d as d$1}from'./chunk-E7BQA6UP.js';import {a as a$1}from'./chunk-TSLBZ26X.js';import {T,ua,ja,na,ma,ea,da,ca,aa,ba,za,ka,sa,Aa}from'./chunk-J6BVWIDB.js';import {b,a}from'./chunk-ETTO6GK3.js';import {ub,tb,g,nd,Oc,Ta,Ce,Eb,kl,if as _if,ch,Na,Bg,Ag,bd,Zj,kj,Hg,og,Ig,hi,gf,Vi,Sc,la,mb,nf,J as J$1,ef,df,rb,dh,Xi,lb,Cd,ki,li,Mg,Th,wa,ya,va,xa,jh,Uc,Wc,Ua,xj,Aj,ik,wb,vb,Rc,Ee,mi,jg,vf,$c,ob,Jd,od,fb,Qc,bf,Kc,yc,Ac,oc}from'./chunk-4R3TEXMN.js';import {Schema}from'prosemirror-model';import {EditorState,TextSelection}from'prosemirror-state';import {EditorView}from'prosemirror-view';import {keymap}from'prosemirror-keymap';import {joinBackward,deleteSelection,joinForward,splitBlock,selectTextblockEnd,selectTextblockStart,baseKeymap}from'prosemirror-commands';function J(t){return t.attributes?.val}function W(t){let e=J(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var Co=/^[0-9A-Fa-f]{6}$/,Do=/^\d{1,6}$/;function Je(t){return t===void 0||t==="auto"?null:Co.test(t)?`#${t}`:null}var Ao={single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"},Fo={black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"};function Bo(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function Mn(t,e=false){let n=nd(t);return n===null||Math.abs(n)>999999||!e&&n<0?null:n}function Q(t,e=false){let n=Mn(t,e);return n===null?null:`${n/20}pt`}function wn(t){let e=[],n=[],r=null,a=null;for(let o of t)switch(o.localName){case "b":e.push(`font-weight:${W(o)?"bold":"normal"}`);break;case "i":e.push(`font-style:${W(o)?"italic":"normal"}`);break;case "u":{let i=J(o)??"single";if(i==="none"||!W(o))break;n.push("underline"),r=Ao[i]??"solid",a=Je(o.attributes?.color);break}case "strike":W(o)&&n.push("line-through");break;case "dstrike":W(o)&&n.push("line-through");break;case "caps":W(o)&&e.push("text-transform:uppercase");break;case "smallCaps":W(o)&&e.push("font-variant:small-caps");break;case "vertAlign":{let i=J(o);i==="superscript"?e.push("vertical-align:super","font-size:0.75em"):i==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let i=Je(J(o));i&&e.push(`color:${i}`);break}case "highlight":{let i=Fo[J(o)??""];i&&e.push(`background-color:${i}`);break}case "sz":{let i=J(o);i!==void 0&&Do.test(i)&&e.push(`font-size:${Number(i)/2}pt`);break}case "rFonts":{let i=Bo(o.attributes?.ascii??o.attributes?.hAnsi);i&&e.push(`font-family:${i}`);break}case "spacing":{let i=Q(J(o),true);i&&e.push(`letter-spacing:${i}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),r&&e.push(`text-decoration-style:${r}`),a&&e.push(`text-decoration-color:${a}`)),e.join(";")}var Lo={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Cn(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let r=Lo[J(n)??""];r&&e.push(`text-align:${r}`);break}case "ind":{let r=Q(n.attributes?.left??n.attributes?.start,true),a=Q(n.attributes?.right??n.attributes?.end,true),o=Q(n.attributes?.firstLine),i=Q(n.attributes?.hanging);r&&e.push(`margin-left:${r}`),a&&e.push(`margin-right:${a}`),o?e.push(`text-indent:${o}`):i&&e.push(`text-indent:-${i}`);break}case "spacing":{let r=Q(n.attributes?.before),a=Q(n.attributes?.after);r&&e.push(`margin-top:${r}`),a&&e.push(`margin-bottom:${a}`);let o=Mn(n.attributes?.line),i=n.attributes?.lineRule;o!==null&&i!=="exact"&&i!=="atLeast"?e.push(`line-height:${(o/240).toFixed(3)}`):o!==null&&e.push(`line-height:${o/20}pt`);break}case "shd":{let r=Je(n.attributes?.fill);r&&e.push(`background-color:${r}`);break}case "pageBreakBefore":W(n)&&e.push("break-before:page");break;}return e.join(";")}var M=new Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Cn(t.attrs.props??[]);return ["p",{"data-node-id":String(t.attrs.nodeId??""),...e?{style:e}:{}},0]},parseDOM:[{tag:"p",getAttrs:t=>typeof t=="string"?null:{nodeId:t.getAttribute("data-node-id")||null,props:[]}}]},text:{group:"inline"},tab:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"tab",class:"docx-tab"},"\u2192"],parseDOM:[{tag:'span[data-token="tab"]'}]},hardBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["br"],parseDOM:[{tag:"br"}]},pageBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"page-break",class:"docx-page-break"}],parseDOM:[{tag:'span[data-token="page-break"]'}]},unknownInline:{inline:true,group:"inline",atom:true,selectable:false,draggable:false,attrs:{nodeId:{default:null},label:{default:""}},toDOM:t=>["span",{"data-token":"unknown","data-node-id":String(t.attrs.nodeId??""),contenteditable:"false",class:"docx-unknown-inline",title:String(t.attrs.label||"Content this editor cannot edit yet. It is preserved.")}],parseDOM:[{tag:'span[data-token="unknown"]',getAttrs:t=>typeof t=="string"?false:{nodeId:t.getAttribute("data-node-id")||null,label:""}}]}},marks:{runProps:{attrs:{props:{default:[]}},excludes:"runProps",toDOM:t=>{let e=t.attrs.props??[],n=wn(e);return ["span",{"data-run-props":jo(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=Ho(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function jo(t){return JSON.stringify(Array.isArray(t)?t:[])}function Ho(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let n=[];for(let r of e){if(typeof r!="object"||r===null)return null;let a=r;if(typeof a.localName!="string"||a.attributes!==void 0&&(typeof a.attributes!="object"||a.attributes===null))return null;n.push(a.attributes===void 0?{localName:a.localName}:{localName:a.localName,attributes:a.attributes});}return n}catch{return null}}function Ye(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function ve(t,e){return JSON.stringify(Te(t))===JSON.stringify(Te(e))}function Te(t){return [...t].map(e=>({localName:e.localName,attributes:Object.fromEntries(Object.entries(e.attributes??{}).sort(([n],[r])=>n<r?-1:1))})).sort((e,n)=>e.localName<n.localName?-1:1)}function Ge(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue"||n.namespaceUri!==la||n.localName==="rPrChange"||n.localName==="pPrChange")continue;let r={};for(let a of n.attributes)a.namespaceUri===la&&(r[a.localName]=a.value);e.push(Object.keys(r).length>0?{localName:n.localName,attributes:r}:{localName:n.localName});}return e}function Dn(t){return t.kind==="textValue"?"":`${{drawing:"Picture",pict:"Picture",object:"Embedded object",fldSimple:"Field",hyperlink:"Hyperlink",sdt:"Content control",tbl:"Table"}[t.localName]??t.localName} \u2014 preserved, not editable yet`}function B(t){if(t.kind==="textValue")return [];let e=[],n=o=>{if(o.kind!=="run")return;let i=o.children.find(d=>d.kind==="runProperties"),l=Ge(i);for(let d of o.children)if(d.kind!=="runProperties"){if(d.kind==="tab"){e.push({kind:"tab"});continue}if(d.kind==="hardBreak"){e.push(ob(d)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(d.kind==="text"){let u="";for(let h of d.children)h.kind==="textValue"&&(u+=h.value);u.length>0&&e.push({kind:"text",text:u,props:l});continue}e.push({kind:"unknown",nodeId:d.id,label:Dn(d),modelLength:d.kind==="drawing"||Jd(d)||od(d)||fb(d)!==null?1:0});}},r=o=>{if(o.kind==="run"){n(o);return}e.push({kind:"unknown",nodeId:o.id,label:Dn(o),modelLength:0});},a=(o,i)=>{for(let l of o)if(!(l.kind==="textValue"||l.kind==="paragraphProperties")&&!(i>=wa)){if(ya(l)&&!va(l.kind)&&i<wa){a(l.children.filter(d=>!jh(l,d)),xa(l,i));continue}if(Uc(l)){let d=Wc(l);d&&a(d,xa(l,i));continue}r(l);}};return a(t.children,0),e}function ae(t){let e=[],n=r=>{if(r.kind!=="textValue"){if(r.kind==="body"){for(let a of r.children)a.kind==="paragraph"&&e.push(a);return}for(let a of r.children)n(a);}};return n(t.root),e}var An=ub(16),Fn=tb();function $o(t,e){let n=Fn.get(t);if(!n){let r=[];Sc([t],r,0),n=Object.freeze(r),Fn.set(t,n,n.length);}for(let r of n)e.push(r);}function L(t){let e=An.get(t);if(e)return e;let n=[];for(let r of Oc(t))if(r.root.kind!=="textValue")for(let a of r.root.children)$o(a,n);return An.set(t,n),n}function V(t){let e=ae(t).map(n=>{let r=n.kind==="textValue"?void 0:n.children.find(o=>o.kind==="paragraphProperties"),a=B(n).map(o=>{switch(o.kind){case "text":return M.text(o.text,o.props.length>0?[M.marks.runProps.create({props:o.props})]:[]);case "tab":return M.node("tab");case "hardBreak":return M.node("hardBreak");case "pageBreak":return M.node("pageBreak");default:return M.node("unknownInline",{nodeId:o.nodeId,label:o.label})}});return M.node("paragraph",{nodeId:n.id,props:Ge(r)},a)});return M.node("doc",null,e.length>0?e:[M.node("paragraph")])}function zo(t,e){let n=[];return t.forEach(r=>{if(r.isText&&r.text){n.push({kind:"text",text:r.text,props:Ye(r)});return}r.type.name==="tab"?n.push({kind:"tab"}):r.type.name==="hardBreak"?n.push({kind:"hardBreak"}):r.type.name==="pageBreak"?n.push({kind:"pageBreak"}):r.type.name==="unknownInline"&&n.push({kind:"unknown",nodeId:String(r.attrs.nodeId??""),label:String(r.attrs.label??""),modelLength:e.has(String(r.attrs.nodeId??""))?1:0});}),n}function D(t){let e="";for(let n of t)n.kind==="text"?e+=n.text:n.kind==="tab"?e+=" ":n.kind==="hardBreak"?e+=`
2
+ `:n.kind==="pageBreak"?e+=mb:n.modelLength===1&&(e+=nf);return e}function j(t){let e=[],n=0;for(let r of t)r.kind==="text"?n+=r.text.length:r.kind==="tab"||r.kind==="hardBreak"||r.kind==="pageBreak"?n+=1:(e.push(`${r.nodeId}@${n}`),n+=r.modelLength);return e}function Uo(t,e){if(t===e)return null;let n=0,r=Math.min(t.length,e.length);for(;n<r&&t[n]===e[n];)n+=1;let a=t.length,o=e.length;for(;a>n&&o>n&&t[a-1]===e[o-1];)a-=1,o-=1;return {start:n,endBefore:a,endAfter:o}}function Bn(t){let e=[];for(let n of t)if(n.kind==="text")for(let r=0;r<n.text.length;r+=1)e.push(n.props);else n.kind==="tab"||n.kind==="hardBreak"||n.kind==="pageBreak"?e.push(e[e.length-1]??[]):n.kind==="unknown"&&n.modelLength===1&&e.push([]);return e}function Wo(t,e,n,r,a){let o=[],i=D(e),l=D(n),d=Uo(i,l),u=[],h=0,m=false;for(let y of e){if(y.kind!=="unknown"){h+=y.kind==="text"?y.text.length:1;continue}let p=h;y.modelLength===1&&d&&(d.start<h+1&&d.endBefore>h&&(m=true),d.endBefore<=h&&(p+=d.endAfter-d.endBefore)),u.push(`${y.nodeId}@${p}`),h+=y.modelLength;}if(m||JSON.stringify(u)!==JSON.stringify(j(n)))return {ok:false,reason:"unknown-content-moved",detail:t};if(ve(r,a)||o.push({op:"setParagraphProperties",paragraphId:t,properties:Te(a)}),d&&(d.endBefore>d.start&&o.push({op:"deleteText",paragraphId:t,start:d.start,end:d.endBefore}),d.endAfter>d.start)){let y=l.slice(d.start,d.endAfter),p=d.start,g="",P=()=>{g.length!==0&&(o.push({op:"insertText",paragraphId:t,offset:p,text:g}),p+=g.length,g="");};for(let O of y)O===" "?(P(),o.push({op:"insertTab",paragraphId:t,offset:p}),p+=1):O===`
3
+ `?(P(),o.push({op:"insertHardBreak",paragraphId:t,offset:p}),p+=1):O===mb?(P(),o.push({op:"insertPageBreak",paragraphId:t,offset:p}),p+=1):g+=O;P();}if(!d){let y=Bn(e),p=Bn(n),g=0;for(;g<p.length;){if(ve(y[g]??[],p[g])){g+=1;continue}let P=g,O=p[g];for(;g<p.length&&ve(p[g],O)&&!ve(y[g]??[],p[g]);)g+=1;o.push({op:"setRunProperties",paragraphId:t,start:P,end:g,properties:Te(O)});}}return {ok:true,ops:o}}function Ke(t,e){let n=ae(t),r=new Set;for(let l of n)for(let d of B(l))d.kind==="unknown"&&d.modelLength===1&&r.add(d.nodeId);let a=l=>zo(l,r),o=[];if(e.forEach(l=>{l.type.name==="paragraph"&&o.push(l);}),o.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let i=o.length-n.length;if(i===0){let l=[];for(let[d,u]of o.entries()){let h=n[d];if(u.attrs.nodeId!==h.id)return {ok:false,reason:"paragraph-reordered",detail:String(u.attrs.nodeId)};let m=Wo(h.id,B(h),a(u),Ge(h.kind==="textValue"?void 0:h.children.find(y=>y.kind==="paragraphProperties")),u.attrs.props??[]);if(!m.ok)return m;l.push(...m.ops);}return {ok:true,ops:l}}return i===1?Jo(n,o,a):i===-1?Yo(n,o,a):{ok:false,reason:"paragraph-count-unexplained",detail:String(i)}}function Jo(t,e,n){for(let r=0;r<t.length;r+=1){let a=t[r],o=e[r],i=e[r+1];if(!o||!i||o.attrs.nodeId!==a.id)continue;let l=i.attrs.nodeId;if(l!==null&&l!==a.id)continue;let d=n(o),u=n(i),h=B(a),m=D(d);if(m+D(u)===D(h)&&JSON.stringify(j([...d,...u]))===JSON.stringify(j(h))&&Ln(t,e,r,n)&&_n(t,e,r+1,r+2,n))return {ok:true,ops:[{op:"splitParagraph",paragraphId:a.id,offset:m.length}]}}return {ok:false,reason:"split-not-clean"}}function Yo(t,e,n){for(let r=0;r+1<t.length;r+=1){let a=t[r],o=t[r+1],i=e[r];if(!i||i.attrs.nodeId!==a.id)continue;let l=[...B(a),...B(o)],d=n(i);if(D(d)===D(l)&&JSON.stringify(j(d))===JSON.stringify(j(l))&&Ln(t,e,r,n)&&_n(t,e,r+2,r+1,n))return {ok:true,ops:[{op:"joinParagraphs",firstId:a.id,secondId:o.id}]}}return {ok:false,reason:"join-not-clean"}}function Ln(t,e,n,r){for(let a=0;a<n;a+=1){let o=e[a],i=t[a];if(!o||o.attrs.nodeId!==i.id||D(r(o))!==D(B(i))||JSON.stringify(j(r(o)))!==JSON.stringify(j(B(i))))return false}return true}function _n(t,e,n,r,a){for(let o=0;n+o<t.length;o+=1){let i=t[n+o],l=e[r+o];if(!l||l.attrs.nodeId!==i.id||D(a(l))!==D(B(i))||JSON.stringify(j(a(l)))!==JSON.stringify(j(B(i))))return false}return true}function Go(t,e){return Ta(t,e)!==null}function Xe(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return V(e);let r=new Map;t.forEach(d=>{let u=d.attrs.nodeId;typeof u=="string"&&r.set(u,d);});let a=new Set(n.dirty),o=ae(e);if(o.length!==t.childCount)return V(e);let i=V(e),l=[];for(let[d,u]of o.entries()){let h=r.get(u.id);l.push(h&&!a.has(u.id)?h:i.child(d));}return M.node("doc",null,l)}var Ko=8*1024*1024;function jn(){let t=new WeakMap;return e=>{let n=t.get(e);if(n)return n.slice();let r=Ee(e);return t=new WeakMap,r.byteLength<=Ko&&t.set(e,r.slice()),r}}function $n(t){return L(t).map(e=>Vi(t,e.id)??"").join(`
4
+ `)}var Xo=64,Hn=new WeakMap;function Qe(t,e=0){if(e>Xo)return false;let n=Hn.get(t);if(n!==void 0)return n;let r=false;for(let a of t.children)if(a.kind!=="textValue"&&(a.kind==="commentRangeStart"||a.kind==="commentReference"||Qe(a,e+1))){r=true;break}return rb(t)&&Hn.set(t,r),r}var Qo="/word/numbering.xml";function Vo(t,e,n){if(t.relationships!==e.relationships||t.contentTypes!==e.contentTypes||t.parts.size!==e.parts.size)return false;for(let[r,a]of e.parts)if(!(r===n||r===Qo)&&t.parts.get(r)!==a)return false;return true}function qo(t,e){let n=t.kind==="revision"?t.ranges[0]??null:t.range;if(!n)return null;let r=e.get(n.start.paragraphId);return r===void 0?null:r}function zn(t,e,n){for(let a of e)if(a.ranges.length===0)return false;let r=new Set;for(let a of t)a.kind!=="revision"||a.ranges.length>0||Wn(a,n)||r.add(xj(a));for(let a of e)if(r.has(xj(a)))return false;return true}function Un(t,e,n,r){let a=e.get(n);if(a===void 0)return [...t];let o=[],i=null;for(let l of t){if(l.kind==="revision"&&Wn(l,n)){i===null&&(i=o.length);continue}if(i===null){let d=qo(l,e);d!==null&&d>a&&(i=o.length);}o.push(l);}if(i===null&&(i=o.length),r.length>0){let l=r.length<2?[...r]:[...r].sort((d,u)=>Aj(d,e)-Aj(u,e));o.splice(i,0,...l);}return ik(o)}function Wn(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function Zo(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function er(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function tr(t,e){return t.ranges.length===0||!t.ranges.some(r=>r.start.paragraphId===e||r.end.paragraphId===e)?false:!t.ranges.every(r=>r.start.paragraphId===e&&r.end.paragraphId===e)}function Jn(t,e,n){return t.fromRevision!==e.bodyRevision||n.currentPackageRevision!==e.packageRevision+1&&(n.changePackage!==n.currentPackage||!Vo(e.pkg,n.currentPackage,n.part.name))||t.story!==void 0&&t.story.kind!=="body"||t.impact==="global"?false:e.commentsPart===n.commentsPart&&e.commentsExtendedPart===n.commentsExtendedPart}function Yn(t,e){let n=Ua(t,e);if(!n)return false;let r=n.children.findIndex(o=>o.id===e),a=n.children[r-1];return a?.kind==="paragraph"&&Zj({...t,root:a}).some(o=>o.paragraphMark)}function Gn(t,e,n,r){if(!Jn(t,e,r)||t.splitJoin.length!==1)return false;let a=t.splitJoin[0],o,i;if("split"in a){if(t.deleted.length>0||t.created.length!==1||t.created[0]!==a.split.tail)return false;o=i=[a.split.from,a.split.tail];}else {if(t.created.length>0||t.deleted.length!==1||t.deleted[0]!==a.join.removed)return false;o=[a.join.kept,a.join.removed],i=[a.join.kept];}for(let d of i){let u=Ta(r.part,d);if(!u||u.kind!=="paragraph"||Zj({...r.part,root:u}).length>0)return false}if(Yn(r.part,i[0]))return false;let l=d=>d!==void 0&&o.includes(d);for(let d of n){let u=d.kind==="revision"?d.ranges:d.range?[d.range]:[];for(let h of u)if(l(h.start.paragraphId)||l(h.end.paragraphId))return false}return true}function Kn(t,e,n,r){if(!Jn(t,e,r)||t.dirty.length!==1||t.created.length>0||t.deleted.length>0||t.splitJoin.length>0)return null;let{part:a}=r,o=t.dirty[0],i=Ta(a,o);if(!i||i.kind!=="paragraph"||t.impact!=="text-local"&&(Zj({...a,root:i}).length>0||t.impact==="flow-structural"&&Ua(a,o)?.localName!=="body")||Yn(a,o))return null;for(let l of n){if(l.kind==="comment"){if(Zo(l,o))return null;continue}if(l.kind==="custom"){if(l.range?.start.paragraphId===o)return null;continue}if(er(l,o)||tr(l,o))return null}return o}var Vn=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u,nr=["ascii","hAnsi","cs","eastAsia"],or=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"],rr=128,ar=/[\u0000-\u001F\u007F-\u009F]/;function A(t){return t.kind!=="textValue"}function q(t,e){return t.attributes.find(n=>n.localName===e)?.value}function qn(t,e){let n=new Map;for(let a of t)for(let o of a.children)if(A(o))for(let[i,l]of to(o,e))n.has(i)||n.set(i,l);let r=[...n.values()];return r.sort((a,o)=>a<o?-1:a>o?1:0),r}var Ve=new WeakMap,Zn=16,eo=32;function to(t,e,n=0){let r=e?.major??null,a=e?.minor??null,o=e?.majorEastAsia??null,i=e?.minorEastAsia??null,l=e?.majorBidi??null,d=e?.minorBidi??null,u=Ve.get(t);if(u&&u.major===r&&u.minor===a&&u.majorEastAsia===o&&u.minorEastAsia===i&&u.majorBidi===l&&u.minorBidi===d)return u.byFold;if(t.children.length>=Zn&&n<eo&&t.localName!=="rFonts"){let p=new Map;for(let g of t.children)if(A(g))for(let[P,O]of to(g,e,n+1))p.has(P)||p.set(P,O);return Ve.set(t,{major:r,minor:a,majorEastAsia:o,minorEastAsia:i,majorBidi:l,minorBidi:d,byFold:p}),p}let h=new Map,m=p=>{if(!p||!Vn.test(p))return;let g=p.toLowerCase();h.has(g)||h.set(g,p);},y=[t];for(;y.length>0;){let p=y.pop();if(A(p)){if(p.localName==="rFonts"){for(let g of nr)m(q(p,g));if(e)for(let g of or)m(Aa(q(p,g),e));}for(let g=p.children.length-1;g>=0;g-=1)y.push(p.children[g]);}}return Ve.set(t,{major:r,minor:a,majorEastAsia:o,minorEastAsia:i,majorBidi:l,minorBidi:d,byFold:h}),h}function no(t){let e=new Map;for(let r of t)for(let a of r.children)if(A(a))for(let[o,i]of oo(a))e.has(o)||e.set(o,i);let n=[...e.values()];return n.sort((r,a)=>r<a?-1:r>a?1:0),n}var Xn=new WeakMap,sr=new Map;function oo(t,e=0){let n=Xn.get(t);if(n)return n;let r=i=>{let l=i.size===0?sr:i;return Xn.set(t,l),l},a=new Map;if(t.children.length>=Zn&&e<eo&&t.localName!=="sym"){for(let i of t.children)if(A(i))for(let[l,d]of oo(i,e+1))a.has(l)||a.set(l,d);return r(a)}let o=[t];for(;o.length>0;){let i=o.pop();if(A(i)){if(i.localName==="sym"&&i.namespaceUri===la){let l=i.attributes.find(u=>u.localName==="font"&&(u.namespaceUri===la||u.namespaceUri===""))?.value,d=c(l);d!==null&&!a.has(d.toLowerCase())&&a.set(d.toLowerCase(),d);}for(let l=i.children.length-1;l>=0;l-=1)o.push(i.children[l]);}}return r(a)}function ro(t){let e=[...t];for(;e.length>0;){let n=e.pop();if(A(n)){if(n.localName==="t"&&n.namespaceUri===la){for(let r of n.children)if(!A(r)&&r.value.length>0)return true;continue}for(let r of n.children)e.push(r);}}return false}var ir=new Set(["paragraph","character","table","numbering"]),lr=/^[0-9A-Fa-f]{6}$/,cr=16,Qn=new Map([["normal",0],["title",1],["subtitle",2],["heading 1",11],["heading 2",12],["heading 3",13],["heading 4",14],["heading 5",15],["heading 6",16],["heading 7",17],["heading 8",18],["heading 9",19]]);function ao(t){return t.children}function qe(t,e){for(let n of ao(t))if(A(n)&&n.localName===e)return n}function dr(t){return Qn.get(t.name.toLowerCase())??Qn.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function Ze(t){return t===void 0||t.length===0||t.length>rr||ar.test(t)?null:t}function so(t,e){if(!t)return [];let n=new Map;for(let o of t.children){if(!A(o)||o.localName!=="style")continue;let i=Ze(q(o,"styleId"));i!==null&&!n.has(i)&&n.set(i,o);}let r=o=>{let i=false,l=false,d=null,u=false,h=false,m=new Set,y=o;for(let P=0;P<cr&&y!==null&&!m.has(y);P+=1){m.add(y);let O=n.get(y);if(!O)break;let b=qe(O,"rPr");for(let v of b?ao(b):[]){if(!A(v))continue;let T=q(v,"val"),E=T!=="0"&&T!=="false"&&T!=="off";v.localName==="b"&&!u?(i=E,u=true):v.localName==="i"&&!h?(l=E,h=true):v.localName==="color"&&d===null&&T&&lr.test(T)&&(d=T);}let R=qe(O,"basedOn");y=R?Ze(q(R,"val")):null;}let p=e?.(o),g=p?.fontFamily??null;return {fontFamily:g!==null&&Vn.test(g)?g:null,fontSizePt:p?.fontSizeHalfPoints!=null&&p.fontSizeHalfPoints>0?p.fontSizeHalfPoints/2:null,bold:i,italic:l,color:d}},a=[];for(let[o,i]of n){let l=q(i,"type");if(l===void 0||!ir.has(l))continue;let d=qe(i,"name"),u=Ze(d?q(d,"val"):void 0);a.push({styleId:o,name:u??o,type:l,preview:r(o)});}return a.map((o,i)=>({entry:o,index:i,rank:dr(o)})).sort((o,i)=>o.rank-i.rank||o.index-i.index).map(o=>o.entry)}var ur=128,pr=/[\u0000-\u001F\u007F-\u009F]/,fr=/[\u0000-\u001F\u007F-\u009F]/g,mr=200;function tt(t){return t.kind!=="textValue"}function io(t,e){for(let n of t.children)if(tt(n)&&n.localName===e)return n}function et(t,e){return t.attributes.find(n=>n.localName===e)?.value}function gr(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!tt(n)||n.localName!=="style"||et(n,"type")!=="paragraph")continue;let r=et(n,"styleId");if(r===void 0||r.length===0||r.length>ur||pr.test(r))continue;let a=a$1(n);a!==null&&e.set(r,a);}return e}function nt(t){let e=io(t,"pPr"),n=e?io(e,"pStyle"):void 0;return n?et(n,"val"):void 0}function lo(t,e){let n=gr(e);if(n.size===0)return [];let r=[];for(let a of ae(t)){if(!tt(a))continue;let o=nt(a);if(o===void 0)continue;let i=n.get(o);if(i===void 0)continue;let l=Vi(t,a.id)??"",d=a.kind==="paragraph"?Xi(a,l):l,u=lb(d).replace(fr," ").trim().slice(0,mr);u.length!==0&&r.push({text:u,level:i,blockId:a.id});}return r}function yr(t,e,n){let r=new Map,a=n(t);for(let o of a){let i=r.get(o.hostParagraphId);i?i.push(o):r.set(o.hostParagraphId,[o]);}return r}function hr(t,e,n){let r=[];for(let a of Rc(t.root)){let o=e.get(a.id);if(o)for(let i of o)r.push(i);}return r}function co(t,e,n=mi){let r=[],a=new Map;for(let o of t){if(r.push(o),o.scope?.kind==="note")continue;let i=a.get(o.part);i||(i=yr(o.part,e,n),a.set(o.part,i));for(let l of hr(o,i)){let d=o.scope;r.push({part:o.part,root:l.root,scope:{kind:"frame",id:l.root.id,drawingNodeId:l.drawingNodeId,hostParagraphId:l.hostParagraphId,...d?.kind==="headerFooter"?{owner:d}:{}}});}}return r}var Ne=48,xr=/[\u0000-\u001F\u007F-\u009F]/g;function kr(t){let e=[],n=jg(t),r=new Map;for(let a of n.segments)vf(a.node)&&r.set(a.node.id,a.formatRunIds??[]);return $c(t.children,0,a=>{if(a.kind==="run"){e.push({id:a.id,start:n.spanOf(a)?.start??0});return}if(vf(a))for(let o of r.get(a.id)??[]){let i=n.spanOf(o);i&&e.push({id:o,start:i.start});}},{descendRevisions:true}),e}function Pr(t){let e=Qc(t);return e?[{part:t,root:e}]:[]}function Or(t,e){let n=[];for(let r of ["header","footer"])for(let a of t){let o=r==="header"?a.headers:a.footers;for(let[i,l]of o){if(!bf(a,i)||e.has(l.part))continue;e.add(l.part);let d=Oc(l.part).find(u=>u.kind===r);d&&n.push({part:l.part,root:d.root,scope:{kind:"headerFooter",rId:l.rId}});}}return n}function uo(t,e,n){if(!t)return [];let r=[];for(let a of Kc(t.root)){let o=yc(a);!Ac(a)||o===null||!n.has(o)||r.push({part:t,root:a,scope:{kind:"note",id:oc(e,o)}});}return r}function Sr(t,e){let n=Pr(t);if(e){let r=new Set;for(let a of Or(e.headerFooterBySection,r))n.push(a);for(let a of uo(e.footnotes,"footnote",e.referencedNoteIds.footnote))n.push(a);for(let a of uo(e.endnotes,"endnote",e.referencedNoteIds.endnote))n.push(a);}return co(n)}function po(t,e){if(t.length===0)return {index:0,offset:e};for(let n=t.length-1;n>=0;n-=1){let r=t[n].start;if(e>=r)return {index:n,offset:e-r}}return {index:0,offset:e}}function br(t,e,n){let r=t.findIndex(a=>a.id===e);return r<0?null:{index:r,offset:n}}function ot(t,e){return lb(t).replace(xr," ").slice(0,e)}var Rr=1e3;function fo(t,e,n={},r){let a=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,o={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},i=e.slice(0,Rr),l=i.map(()=>({matches:[],truncated:false})),d=i.map((h,m)=>sa(h)?m:-1);if(d=d.filter(h=>h>=0),d.length===0)return l;let u=n.stories==="body"?void 0:r;for(let h of Sr(t,u)){let m=0;for(let y of Rc(h.root)){if(y.kind!=="paragraph")continue;let p=m;m+=1;let g=Vi(h.part,y.id)??"",P=d$1(y,g);if(P.text.length===0)continue;let O=null,b=false;for(let R of d){let v=l[R],T=a-v.matches.length,E=P.findOccurrences(i[R],Math.max(T,1),o);if(T===0&&E.matches.length>0){v.truncated=true,b=true;continue}for(let N of E.matches){let w=N.start+N.length;O??=kr(y);let _=P.resultRunAddressAt(N.start),Z=_?br(O,_.runId,_.offset)??po(O,N.rawStart):po(O,N.rawStart);v.matches.push({blockId:y.id,start:N.rawStart,length:N.rawEnd-N.rawStart,paragraphIndex:p,runIndex:Z.index,runOffset:Z.offset,...h.scope?{scope:h.scope}:{},text:ot(P.displaySlice(N.start,w),256),contextBefore:ot(P.displaySlice(Math.max(0,N.start-Ne),N.start),Ne),contextAfter:ot(P.displaySlice(w,w+Ne),Ne)});}E.truncated&&(v.truncated=true,b=true);}if(b&&(d=d.filter(R=>!l[R].truncated)),d.length===0)return l}}return l}var vr=32;function mo(t){let e=null;return((n,r)=>{let a=t.revision(),o=typeof n!="string",i=`${r?.matchCase===true?"c":""}${r?.wholeWord===true?"w":""}`,l=`${r?.limit??""}:${r?.stories??"all"}`,d=JSON.stringify([i,l,n]);e?.revision!==a&&(e={revision:a,results:new Map});let u=e.results.get(d);if(u)return u;let h=t.bodyPart(),m=t.currentPackage(),y={footnote:new Set,endnote:new Set};for(let P of dh(h))y[P.noteKind].add(P.noteId);let p=fo(h,o?n:[n],r,{headerFooterBySection:t.headerFooterBySection(),footnotes:ch(m,"footnote")??null,endnotes:ch(m,"endnote")??null,referencedNoteIds:y}),g=o?p:p[0];return e.results.size>=vr&&e.results.delete(e.results.keys().next().value),e.results.set(d,g),g})}var Tr=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"];function se(t,e=null,n=null){return za(t,e,n)}function go(t){let e=Cd(t),n=[];for(let r of Tr){let a=e.get(r);if(!a)return [];n.push({slot:r,hex:a});}return n}var yo=new WeakMap;function at(t){let e=yo.get(t);if(e!==void 0)return e;let n=wb(t),r=n===null||!vb(n)?null:n;return yo.set(t,r),r}var rt=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n;}get size(){return this.#e.size}get(e){if(this.#e.has(e))return this.#t.find(n=>e.startsWith(`${n.name}#`))}has(e){return this.get(e)!==void 0}*entries(){for(let e of this.#e.keys()){let n=this.get(e);n&&(yield [e,n]);}}keys(){return this.#e.keys()}*values(){for(let[,e]of this.entries())yield e;}[Symbol.iterator](){return this.entries()}forEach(e,n){for(let[r,a]of this.entries())e.call(n,a,r,this);}};function ho(t,e){return Object.freeze({...t,partByNode:new rt(t.ordinalByNode,e)})}function xo(t){let e=new Map,n=new Map,r=new Map,a=new Set,o=new Map,i=new Map,l=0;for(let d of t)for(let u of L(d)){r.set(u.id,l),o.set(u.id,d),l+=1;let h=at(u);if(h===null)continue;e.set(u.id,h);let m=h.toUpperCase(),y=i.get(m);y?(y.push(u.id),a.add(m)):(i.set(m,[u.id]),n.set(m,u.id));}return Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:r,ambiguousParaIds:a,partByNode:o,claimantsByParaId:i})}function ko(t,e){let n=t.indexOf("#");if(n<=0)return null;let r=t.slice(0,n),a=e.body.name===r?e.body:void 0;a??=e.openStories.find(l=>l.name===r);let o=a?void 0:e.otherStories.find(l=>l.name===r);if(a??=o?e.normalize(o):void 0,!a)return null;let i=Ta(a,t);return i?.kind==="paragraph"?at(i):null}var Po={committed:false,rejected:false,opCount:0};function H(t,e){return e===void 0?{committed:false,rejected:true,opCount:t}:{committed:false,rejected:true,opCount:t,reason:e}}function Oo(t,e,n={}){let r=e.filter(h=>h.ops.length>0),a=n.partOps??[],o=[...r,...a].reduce((h,m)=>h+m.ops.length,0);if(o===0)return n.packageEdits?.length?H(0,"invalidArgs"):Po;if([...r,...a].some(h=>h.ops.some(Mg))||[...r,...a].some(h=>h.ops.some(Th)))return H(o,"invalidArgs");let[i,...l]=r,d=[];for(let h of l){let m=t.partFor(h.scope);if(!m)return H(o,"unknown-part");d.push({partName:m.name,ops:h.ops});}let u=t.transact(i?.scope??{kind:"body"},h=>{for(let m of n.packageEdits??[])h.applyPackage(m);for(let m of i?.ops??[])h.apply(m);for(let m of d)for(let y of m.ops)h.applyTo(m.partName,y);for(let m of a)for(let y of m.ops)h.applyTo(m.partName,y);},n);return u.ok?{committed:true,rejected:false,opCount:o}:H(o,u.reason)}function So(t,e,n,r,a$1,o){let i=o.partOps??[],l=e.length+i.reduce((m,y)=>m+y.ops.length,0);if(l===0&&!o.packageEdits?.length)return Po;if(i.some(m=>m.ops.some(y=>Mg(y)||Th(y))))return H(l,"invalidArgs");let d=e.filter(m=>Mg(m)||Th(m)).length;if(d>0){if(i.length||o.packageEdits?.length||d!==e.length||e.length!==1)return H(e.length,"invalidArgs");let m=t.applyLifecycleOp(e[0],{actorId:o.actorId});return m.ok?{committed:true,rejected:false,opCount:1}:H(1,m.detail??m.reason)}let u=o.recordsHistory===false&&o.actorId&&o.operationId?t.partFor(a$1)?.name:void 0,h=t.transact(a$1,m=>{n!==void 0&&m.selectionBefore(n),r!==void 0&&m.selectionAfter(r);for(let y of o.packageEdits??[])m.applyPackage(y);for(let y of e)m.apply(y);for(let y of i)for(let p of y.ops)m.applyTo(y.partName,p);u&&m.applyPackage(y=>a(y,u,e));},o);return h.ok?{committed:true,rejected:false,opCount:l}:H(l,h.reason)}var Nr=Object.freeze([]);function Ir(t,e={}){return Er(Ce(t),e)}function Er(t,e={}){if(!t.ok)return {ok:false,reason:t.reason,...t.detail?{detail:t.detail}:{}};let n=t.package,r=n.parts.get(n.mainDocumentPart);if(!r)return {ok:false,reason:"no-main-document-tree",detail:n.mainDocumentPart};let a=Eb(r),o=new T(n,ua(n,a)),i=null,l=null,d$1=null,u=null,h=null;o.subscribe(s=>{u=s,h=o.currentPackage();});let m=()=>o.bodyStore(),y=()=>o.currentPackage(),p=jn(),g=Object.freeze({kind:"body"}),P=(s,c)=>{let f=c?.find(k=>k.type==="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings");if(!f)return;let x=J$1(f);return x.mode==="Internal"&&x.target.ok?s.parts.get(x.target.partName):void 0},O=(s,c,f)=>{if(s.mainRelationships!==f||s.settingsPart!==P(c,f))return false;for(let x of s.resolution)for(let k of [x.headers,x.footers])for(let S of k.values())if(c.parts.get(S.partName)!==S.part)return false;return true},b$1=()=>{let s=y(),c=s.relationships.get(s.mainDocumentPart);if(i&&u&&h===s&&O(i,s,c)&&i.packageRevision===u.fromRevision&&o.packageRevision===u.toRevision&&u.story?.kind==="body"&&u.impact==="text-local"&&u.created.length===0&&u.deleted.length===0&&u.splitJoin.length===0&&(i={...i,packageRevision:o.packageRevision,pkg:s,mainRelationships:c,settingsPart:P(s,c)}),!i||i.packageRevision!==o.packageRevision||i.pkg!==s){let f=ef(s);i={packageRevision:o.packageRevision,pkg:s,mainRelationships:c,settingsPart:P(s,c),resolution:f,parts:df(f)};}return i},R="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",v="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",T$1=null,E=()=>{let s=y(),c=(s.relationships.get(s.mainDocumentPart)??[]).find(k=>k.type===R),f;if(c){let k=J$1(c);k.mode==="Internal"&&k.target.ok&&(f=s.parts.get(k.target.partName));}f??=s.parts.get("/word/styles.xml");let x=f?.root??null;return x!==T$1&&(T$1=x,de=null,G=null),T$1},N=null,w=null,_=()=>{let s=y();if(N===s)return w;N=s;let c=(s.relationships.get(s.mainDocumentPart)??[]).find(x=>x.type===v),f;if(c){let x=J$1(c);x.mode==="Internal"&&x.target.ok&&(f=s.parts.get(x.target.partName));}return f??=s.parts.get("/word/numbering.xml"),w=f?.root??null,w},Z="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",st=null,ge=null,Y=()=>{let s=y();if(st===s)return ge;st=s;let c=(s.relationships.get(s.mainDocumentPart)??[]).find(k=>k.type===Z),f;if(c){let k=J$1(c);k.mode==="Internal"&&k.target.ok&&(f=s.parts.get(k.target.partName));}f??=s.parts.get("/word/settings.xml");let x=f?.root??null;return x!==ge&&(ge=x,he=null,de=null,G=null),ge},Ro="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",vo="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",it=(s,c)=>{let f=y(),x=(f.relationships.get("/")??[]).find(S=>S.type===s),k;if(x){let S=J$1(x);S.mode==="Internal"&&S.target.ok&&(k=f.parts.get(S.target.partName));}return k??f.parts.get(c)},lt=null,Ie=ki,To=()=>{let s=y();if(lt===s)return Ie;lt=s;let c=it(Ro,"/docProps/core.xml"),f=it(vo,"/docProps/app.xml");return Ie=li(c?.root??null,f?.root??null),Ie},No="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",ct=null,ye=null,ee=()=>{let s=y();if(ct===s)return ye;ct=s;let c=(s.relationships.get(s.mainDocumentPart)??[]).find(k=>k.type===No),f;if(c){let k=J$1(c);k.mode==="Internal"&&k.target.ok&&(f=s.parts.get(k.target.partName));}f??=s.parts.get("/word/theme/theme1.xml");let x=f?.root??null;return x!==ye&&(ye=x,he=null,Ee=null,de=null,G=null),ye},Io="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",dt=null,ut=()=>{let s=y(),c=(s.relationships.get(s.mainDocumentPart)??[]).find(k=>k.type===Io),f=c?J$1(c):null;return (f?.mode==="Internal"&&f.target.ok?s.parts.get(f.target.partName):void 0)??s.parts.get("/word/fontTable.xml")},Eo=()=>(dt??=Object.freeze(_if(y(),ut())),dt),ie=null,te=null,le=null,ce=null,de=null,Ee=null,he=null,pt=()=>{let s=[m().part.root],c=new Set;for(let f of $())c.has(f)||(c.add(f),s.push(f.root));return s},Me=()=>{let s=pt(),c=E();return c&&s.splice(1,0,c),s},G=null,xe=null,ue=null,ne=null,ft=new WeakMap,ke=null,mt=s=>{let c=ft.get(s);if(c)return c;let f=Eb(s);return ft.set(s,f),f},gt=()=>{let s=o.packageRevision,c=o.openStoryToken();if(!ne||ne.revision!==s||ne.openStories!==c){let f=o.openStoryParts(),x=new Set(f.map(F=>F.name)),k=$().filter(F=>!x.has(F.name)).map(mt),S=[m().part,...f,...k],I=ne,C=I!==null&&u!==null&&I.openStories===c&&I.revision===u.fromRevision&&s===u.toRevision&&u.impact==="text-local"&&u.created.length===0&&u.deleted.length===0&&u.splitJoin.length===0&&I.parts.length===S.length&&I.parts.every((F,oe)=>F.name===S[oe]?.name);ne={revision:s,openStories:c,parts:S,index:C&&I?ho(I.index,S):xo(S)};}return ne.index},Mo=()=>{let s=m().part.name,c=new Map;for(let f of [m().part,...$()])for(let[x,k]of ka(y(),f.name,s))c.set(x,k);return c},wo=()=>[m().part,...$()],$=()=>{let s=[],c=new Set;for(let x of b$1().parts)for(let k of [x.headers,x.footers])for(let S of k.values())c.has(S)||(c.add(S),s.push(S));let f=y();for(let x of ["footnote","endnote"]){let k=ch(f,x);!k||c.has(k)||(c.add(k),s.push(k));}return s},yt={ok:true,session:{editable:L(m().part).length>0,paragraphIds:()=>L(m().part).map(s=>s.id),paragraphIdsIn(s=g){let c=o.partFor(s);return c?L(c).map(f=>f.id):[]},part:()=>m().part,partFor:s=>o.partFor(s),currentPackage:y,collaborationPort:s=>b(o,{documentId:s}),applyTreeOps(s,c,f,x=g,k={}){return So(o,s,c,f,x,k)},applyTreeOpsAtomic(s,c={}){return Oo(o,s,c)},projectDoc:()=>V(m().part),reconcile:s=>Xe(s,m().part,u),lastCommitWasStructural:()=>u!==null&&(u.created.length>0||u.deleted.length>0||u.splitJoin.length>0||u.impact==="global"),applyPmDoc(s){let c=m(),f=Ke(c.part,s);if(!f.ok)return {committed:false,rejected:true,opCount:0,reason:f.reason};if(f.ops.length===0)return {committed:false,rejected:false,opCount:0};let x=o.transact(g,k=>{for(let S of f.ops)k.apply(S);});return x.ok?{committed:true,rejected:false,opCount:f.ops.length}:{committed:false,rejected:true,opCount:f.ops.length,reason:x.reason}},storyParts:wo,bodyText:()=>$n(m().part),storyText(s){let c=o.partFor(s);return c?L(c).map(f=>Vi(c,f.id)??"").join(`
5
+ `):null},revision:()=>m().revision,revisionFor:s=>o.revisionFor(s),packageRevision:()=>o.packageRevision,canUndo:()=>o.canUndo,canRedo:()=>o.canRedo,undo:()=>{let s=o.selectionForUndo();return o.undo()===null?null:s},redo:()=>{let s=o.selectionForRedo();return o.redo()===null?null:s},beginComposition:(s=g)=>{o.beginComposition(s);},endComposition:()=>o.endComposition(),subscribe(s){return o.subscribe(s)},save(){return p(y())},headerFooterParts:()=>{let s=b$1().parts;return s[s.length-1]??gf(y())},headerFooterPartsBySection:()=>b$1().parts,headerFooterResolutionBySection:()=>b$1().resolution,documentFonts(){return ie&&ie.revision===o.packageRevision||(ie={revision:o.packageRevision,fonts:qn(Me(),se(ee(),Y()))}),ie.fonts},symbolFontFamilies(){return le&&le.revision===o.packageRevision||(le={revision:o.packageRevision,fonts:no(Me())}),le.fonts},renderedFontFamilies(){let s=E();return te&&te.revision===o.packageRevision&&te.styles===s||(te={revision:o.packageRevision,styles:s,families:f(pt(),s,se(ee(),Y()))}),te.families},rendersText(){return ce&&ce.revision===o.packageRevision||(ce={revision:o.packageRevision,rendersText:ro(Me())}),ce.rendersText},documentStyles(){let s=E(),c=ee(),f=Y();G??=d(s,se(c,f));let x=G;return de??=so(s,k=>x(k)),de},stylesRoot:()=>E(),documentThemeFonts(){let s=ee(),c=Y();return he??=se(s,c,ut()?.root??null),he},numberingRoot:()=>_(),settingsRoot:()=>Y(),documentProperties:()=>To(),trackingSettings:()=>hi(Y()),documentThemeColors(){let s=ee();return Ee??=go(s),Ee},effectiveRunDefaults(s,c){let f=E(),x=ee(),k=Y();G??=d(f,se(x,k));let S=m();if(!xe||xe.revision!==S.revision){let I=new Map;for(let C of L(S.part))C.kind!=="textValue"&&I.set(C.id,nt(C)??null);xe={revision:S.revision,byId:I};}return G(xe.byId.get(s)??null,c)},documentOutline(){let s=m();return ue&&ue.revision===s.revision||(ue={revision:s.revision,outline:lo(s.part,E())}),ue.outline},findText:mo({revision:()=>o.packageRevision,bodyPart:()=>m().part,currentPackage:y,headerFooterBySection:()=>b$1().resolution}),embeddedFonts:Eo,paragraphAnchors:gt,paraIdOf:s=>ko(s,{body:m().part,openStories:o.openStoryParts(),otherStories:$(),normalize:mt}),nodeIdOf:s=>gt().nodeByParaId.get(s.toUpperCase())??null,relationshipTarget:(s,c=g)=>{let f=y(),x=o.partFor(c);return x?Ig(f,x.name,s):null},bookmarks:()=>{let s=o.packageRevision;if(!ke||ke.revision!==s){let c=new Map(og(m().part));for(let f of $())for(let[x,k]of og(f))c.has(x)||c.set(x,k);ke={revision:s,index:c};}return ke.index},ensureHyperlinkRelationship(s,c=g){let f=o.partFor(c);return f?Na(o,()=>{let x=y(),k=Hg(x,s,f.name);return k?(k.pkg!==x&&o.replacePackageShell(k.pkg),k.relationshipId):null},x=>x!==null):null},reviewItems(){let s=e.reviewModel;if(!s)return Nr;let c=m(),f=`${o.packageRevision}:${c.revision}`;if(l&&l.revisionKey===f)return l.items;let x=y(),k=x.parts.get(aa(x,c.part.name)),S=x.parts.get(ba(x,c.part.name)),I=()=>s.collectReviewItems({storyPart:c.part,furnitureParts:$(),stylesPart:bd(x),commentsPart:k,commentsExtendedPart:S,customNodePayloads:Mo()}),C={part:c.part,commentsPart:k,commentsExtendedPart:S,currentPackageRevision:o.packageRevision,currentPackage:x,changePackage:h},F,oe=null;if(l&&u&&Gn(u,l,l.items,C))F=l.items;else {let pe=l&&u?Kn(u,l,l.items,C):null,we=pe&&l?s.revisionItemsOfParagraph(c.part,pe):null;pe&&l&&we&&zn(l.items,we,pe)?(oe=l.paragraphOrder??kj(c.part),F=Un(l.items,oe,pe,we)):(oe=kj(c.part),F=I());}return l={revisionKey:f,bodyRevision:c.revision,packageRevision:o.packageRevision,items:F,paragraphOrder:oe,commentsPart:k,commentsExtendedPart:S,pkg:x},l.items},hasReviewContent(){let s=o.packageRevision;if(!d$1||d$1.revision!==s){let c=bd(y()),f=[m().part,...$(),...c?[c]:[]];d$1={revision:s,present:f.some(x=>Zj(x).length>0||Qe(x.root))};}return d$1.present},replyToComment(s,c,f,x,k,S=g,I){let C=ca(o,{anchor:{paragraphId:c.paragraphId,start:c.start,end:c.end,...c.endParagraphId===void 0?{}:{endParagraphId:c.endParagraphId}},author:x,text:f,...k===void 0?{}:{date:k},...s===null?{}:{replyToCommentId:s},...I===void 0?{}:{actorId:I}},S);return C.ok?C.commentId:null},setCommentResolved(s,c){return da(o,s,c).ok},deleteComment(s,c=g,f){return this.deleteComments([{commentId:s}],c,f)},deleteComments(s,c=g,f){return ea(o,s,c,f)},insertCustomNode(s,c=g){return ma(o,s,c)},removeCustomNode(s,c=g){return na(o,s,c)},sweepCustomNodePayloads(s){return Na(o,()=>{let c=m(),f=ja(o.currentPackage(),c.part.name,s);return f.ok?f.removed.length===0?{ok:true,removed:[]}:(o.replacePackageShell(f.pkg),{ok:true,removed:f.removed}):{ok:false,reason:f.reason}},c=>c.ok&&c.removed.length>0)},ensureListDefinition(s){return Na(o,()=>{let c=Ag(y(),s);return c?(o.replacePackageShell(c.pkg),N=null,w=null,c.numId):null},c=>c!==null)},ensureNumberingLevel(s,c,f){return Na(o,()=>{let x=y(),k=Bg(x,s,c,f);return k?k!==x?(o.replacePackageShell(k),N=null,w=null,{ok:true,changed:true}):{ok:true,changed:false}:{ok:false,changed:false}},x=>x.changed).ok},insertImage(s,c){return o.insertImage(s,c)},replaceImage(s,c,f,x,k,S){return o.replaceImage(s,c,f,x,k,S)},deleteImage(s,c){return o.deleteImage(s,c)},deleteImageTracked(s,c,f){return o.deleteImageTracked(s,c,f)},applyImageProperties(s,c){return o.applyImageProperties(s,c)},applyFragmentPaste(s,c){return o.applyFragmentPaste(s,c)}}};return kl(yt.session,o),yt}var Mr=g.projection;function $r(t,e,n){let r=t.filter(a=>a.localName!==e);return r.length!==t.length?r:[...r,n?{localName:e,attributes:n}:{localName:e}]}function zr(t,e,n={}){let r=null,a=false,o=()=>n.onChange?.(i()),i=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:r}),l=p=>{a=true;let g=u.state.tr.replaceWith(0,u.state.doc.content.size,p.content);g.setMeta("addToHistory",false),u.dispatch(g),a=false;},d=p=>()=>(p()&&(l(e.projectDoc()),o()),true),u=new EditorView(t,{state:EditorState.create({doc:e.projectDoc(),plugins:[keymap({...baseKeymap,Home:selectTextblockStart,End:selectTextblockEnd,"Mod-z":d(()=>e.undo()!==null),"Mod-y":d(()=>e.redo()!==null),"Shift-Mod-z":d(()=>e.redo()!==null),"Mod-b":(p,g)=>y(p,g,"b"),"Mod-i":(p,g)=>y(p,g,"i"),"Mod-u":(p,g)=>y(p,g,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:p=>(h(p),false),beforeinput:(p,g)=>{let P=g;if(p.composing)return false;h(p);let O=P.inputType;if(O==="insertText"&&P.data!=null){P.preventDefault();let{from:b,to:R}=p.state.selection;return p.dispatch(p.state.tr.insertText(P.data,b,R)),true}if(O==="deleteContentBackward"){P.preventDefault();let{from:b,empty:R}=p.state.selection;return R?b>0?p.dispatch(p.state.tr.delete(b-1,b)):joinBackward(p.state,p.dispatch):deleteSelection(p.state,p.dispatch),true}if(O==="deleteContentForward"){P.preventDefault();let{from:b,to:R,empty:v}=p.state.selection;return v?R<p.state.doc.content.size?p.dispatch(p.state.tr.delete(b,b+1)):joinForward(p.state,p.dispatch):deleteSelection(p.state,p.dispatch),true}return O==="insertParagraph"?(P.preventDefault(),splitBlock(p.state,p.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),o(),false)},dispatchTransaction(p){let g=u.state.apply(p);if(a||!p.docChanged){u.updateState(g);return}let P=e.applyPmDoc(g.doc);if(P.rejected){r=String(P.reason??"rejected"),u.updateState(g),l(e.projectDoc()),o();return}r=null,u.updateState(P.committed&&e.lastCommitWasStructural()?m(g):g),o();}});function h(p){if(p.composing||a)return;let g=p.dom.ownerDocument.getSelection(),P=g?.anchorNode,O=g?.focusNode;if(!(!g||!P||!O)&&!(!p.dom.contains(P)||!p.dom.contains(O)))try{let b=p.posAtDOM(P,g.anchorOffset),R=p.posAtDOM(O,g.focusOffset),v=p.state.selection;if(v.anchor===b&&v.head===R)return;let T=TextSelection.create(p.state.doc,b,R);p.dispatch(p.state.tr.setSelection(T).setMeta("addToHistory",!1));}catch{}}function m(p){let g=e.paragraphIds(),P=p.tr,O=false,b=0;return p.doc.forEach((R,v)=>{let T=g[b];b+=1,!(R.type.name!=="paragraph"||T===void 0)&&R.attrs.nodeId!==T&&(P=P.setNodeMarkup(v,void 0,{...R.attrs,nodeId:T}),O=true);}),O?p.apply(P.setMeta("addToHistory",false)):p}function y(p,g,P,O){let b=M.marks.runProps;if(!g)return true;let{from:R,to:v,empty:T}=p.selection;if(T)return true;let N=p.doc.resolve(R).marks().find(Z=>Z.type===b)?.attrs.props??[],w=$r(N,P,O),_=p.tr;return _.removeMark(R,v,b),w.length>0&&_.addMark(R,v,b.create({props:w})),g(_),true}return {view:u,state:i,undo:()=>d(()=>e.undo()!==null)(),redo:()=>d(()=>e.redo()!==null)(),toggleRunProperty(p,g){y(u.state,u.dispatch.bind(u),p,g);},destroy:()=>u.destroy()}}export{M as a,Ye as b,ae as c,L as d,V as e,Ke as f,Go as g,Xe as h,nt as i,Ir as j,Er as k,Mr as l,zr as m};
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkK246T47S_cjs=require('./chunk-K246T47S.cjs'),chunkAVKVRU7Z_cjs=require('./chunk-AVKVRU7Z.cjs'),chunk4KZ6L5YF_cjs=require('./chunk-4KZ6L5YF.cjs');function z(n){let r=[],s=0;for(let t of n){let o=s+t.text.length;t.resultRuns?r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,resultRuns:t.resultRuns,...t.symbolOffsets?{symbolOffsets:t.symbolOffsets}:{},...t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}):t.floatingObject?r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,floatingObject:true,projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}):r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,...t.symbol?{symbol:true}:{},...t.symbolOffsets?{symbolOffsets:t.symbolOffsets}:{},...t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}),s=o;}return r}function G(n,r){return r<=n.rawStart?n.projectedStart:r>=n.rawEnd?n.projectedEnd:n.expansion?n.projectedStart:n.projectedStart+r-n.rawStart}function I(n,r){return n.expansion?n.rawStart:n.rawStart+r-n.projectedStart}function L(n,r){return n.expansion?n.rawEnd:n.rawStart+r-n.projectedStart}var K=new Set([chunk4KZ6L5YF_cjs.Ta,"\u2011"]),Q=/[\u001e\u001f\u2011]/,Y="\uFFFF";function W(n,r){if(!Q.test(n)&&!r?.size)return {text:n,at:null};let s="",t=[];for(let o=0;o<n.length;o+=1){let l=n[o];if(r?.has(o))s+=Y;else {if(l===chunk4KZ6L5YF_cjs.Ua)continue;s+=K.has(l)?"-":l;}t.push(o);}return {text:s,at:t}}function U(n){let r;for(let s of n){if(s.symbol){r??=new Set;for(let t=s.projectedStart;t<s.projectedEnd;t+=1)r.add(t);}for(let t of s.symbolOffsets??[])(r??=new Set).add(s.projectedStart+t);}return r}function O(n){let r=z(n),s="";for(let o of n)s+=o.text;let t=null;return {text:s,projectedOffset(o){let l=0;for(let i of r){if(o<=i.rawEnd)return G(i,o);l=i.projectedEnd;}return l},rawRange(o,l){if(o<0||o>=l||l>s.length)return null;let i=r.find(d=>o>=d.projectedStart&&o<d.projectedEnd),e=r.find(d=>l>d.projectedStart&&l<=d.projectedEnd);return !i||!e?null:{start:I(i,o),end:L(e,l)}},sliceRaw(o,l){if(o>=l)return "";let i="";for(let e of r){if(e.expansion){o<=e.rawStart&&l>=e.rawEnd&&(i+=e.text);continue}let d=Math.max(o,e.rawStart),a=Math.min(l,e.rawEnd);d<a&&(i+=e.text.slice(d-e.rawStart,a-e.rawStart));}return i},displaySlice(o,l){let i="";for(let e of r){if(e.projectedEnd<=o||e.projectedStart>=l)continue;let d=Math.max(o,e.projectedStart)-e.projectedStart,a=Math.min(l,e.projectedEnd)-e.projectedStart;if(e.symbol){i+=e.symbolDisplays?.[0]??"";continue}let u=new Map;e.symbolOffsets?.forEach((f,c)=>u.set(f,e.symbolDisplays?.[c]??""));for(let f=d;f<a;f+=1)i+=u.get(f)??e.text[f];}return i},resultRunAddressAt(o){let l=r.find(e=>e.resultRuns!==void 0&&o>=e.projectedStart&&o<e.projectedEnd);if(!l?.resultRuns)return null;let i=o-l.projectedStart;for(let e of l.resultRuns)if(i>=e.start&&i<e.end)return {runId:e.runId,offset:i-e.start};return null},findOccurrences(o,l,i={}){let e=[];if(l<=0||!chunkAVKVRU7Z_cjs.Va(o)||s.length===0)return {matches:e,truncated:false};let d=i.matchCase===true,a=i.wholeWord===true;t??=W(s,U(r));let u=t,f=W(o).text;if(f.length===0||f.includes(Y))return {matches:e,truncated:false};let c=d?f:chunkAVKVRU7Z_cjs.Ta(f),j=d?u.text:chunkAVKVRU7Z_cjs.Ta(u.text),R=p=>u.at?.[p]??p,X=p=>{if(!u.at)return p;let m=0;for(;m<u.at.length&&u.at[m]<p;)m+=1;return m},v=Math.min(s.length,i.to??s.length),D=new Set,b=j.indexOf(c,X(Math.max(0,i.from??0)));for(;b>=0;){let p=b+c.length,m=R(b),x=R(p-1)+1;if(x>v)return {matches:e,truncated:false};if(r.some(y=>y.floatingObject===true&&y.projectedStart>m&&y.projectedStart<x)){b=j.indexOf(c,b+1);continue}if(!a||chunkAVKVRU7Z_cjs.Ua(u.text,b,p)){let y=r.find(h=>m>=h.projectedStart&&m<h.projectedEnd),E=r.find(h=>x>h.projectedStart&&x<=h.projectedEnd);if(!y||!E)return {matches:e,truncated:false};let S=y===E&&y.expansion?y:null;if(!S||!D.has(S)){if(e.length>=l)return {matches:e,truncated:true};e.push({start:m,length:x-m,rawStart:I(y,m),rawEnd:L(E,x)}),S&&D.add(S);}}b=j.indexOf(c,p);}return {matches:e,truncated:false}}}}function q(n){return n.length===0?O([]):O([{text:n,rawStart:0,rawEnd:n.length}])}var J="http://schemas.openxmlformats.org/markup-compatibility/2006";function Z(n){if(n.kind==="textValue")return false;if(chunk4KZ6L5YF_cjs.$c(n))return chunk4KZ6L5YF_cjs.ad(n);let r=s=>s.kind!=="textValue"&&s.children.some(t=>t.kind==="anchoredDrawing"||t.kind!=="textValue"&&t.localName==="anchor");if(n.kind==="drawing")return r(n);if(n.namespaceUri!==J||n.localName!=="AlternateContent")return false;for(let s of n.children){if(s.kind==="textValue"||s.localName!=="Choice")continue;let t=s.children.find(o=>o.kind==="drawing"||o.kind!=="textValue"&&o.localName==="drawing");if(t)return r(t)}return false}function $(n,r,s="allMarkup"){if(!r.includes(chunk4KZ6L5YF_cjs.Ve)&&!r.includes(chunk4KZ6L5YF_cjs.Va))return r.length===0?[]:[{text:r,rawStart:0,rawEnd:r.length}];let t=chunk4KZ6L5YF_cjs.of(n),o=chunk4KZ6L5YF_cjs.Qf(n,t),l=chunkK246T47S_cjs.c(n,t,s),i=new Map;for(let a of t)i.set(a.node.id,a);let e=[],d=0;for(let a of o){let u=i.get(a.node.id),f=!u&&chunk4KZ6L5YF_cjs.Wa(a.node);if(!u&&!f){Z(a.node)&&(d<a.start&&e.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),e.push({text:"",rawStart:a.start,rawEnd:a.end,floatingObject:true}),d=a.end);continue}if(d<a.start&&e.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),!u){e.push({text:chunk4KZ6L5YF_cjs.Va,rawStart:a.start,rawEnd:a.end,symbol:true,symbolDisplays:[chunkAVKVRU7Z_cjs.Ga(a.node)]}),d=a.end;continue}let c=l.get(u.node.id);u.kind==="simple"&&c?e.push({text:c.text,rawStart:a.start,rawEnd:a.end,resultRuns:c.runs,...c.symbols?{symbolOffsets:c.symbols}:{},...c.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}):e.push({text:c?.text??chunk4KZ6L5YF_cjs.Ve,rawStart:a.start,rawEnd:a.end,...c?.symbols?{symbolOffsets:c.symbols}:{},...c?.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}),d=a.end;}return d<r.length&&e.push({text:r.slice(d),rawStart:d,rawEnd:r.length}),e}function it(n,r,s="allMarkup"){return !r.includes(chunk4KZ6L5YF_cjs.Ve)&&!r.includes(chunk4KZ6L5YF_cjs.Va)?q(r):O($(n,r,s))}
1
+ 'use strict';var chunkO2AL2HSJ_cjs=require('./chunk-O2AL2HSJ.cjs'),chunkJGNVNT2A_cjs=require('./chunk-JGNVNT2A.cjs'),chunkFIJZIQXA_cjs=require('./chunk-FIJZIQXA.cjs');function z(n){let r=[],s=0;for(let t of n){let o=s+t.text.length;t.resultRuns?r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,resultRuns:t.resultRuns,...t.symbolOffsets?{symbolOffsets:t.symbolOffsets}:{},...t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}):t.floatingObject?r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,floatingObject:true,projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}):r.push({text:t.text,rawStart:t.rawStart,rawEnd:t.rawEnd,...t.symbol?{symbol:true}:{},...t.symbolOffsets?{symbolOffsets:t.symbolOffsets}:{},...t.symbolDisplays?{symbolDisplays:t.symbolDisplays}:{},projectedStart:s,projectedEnd:o,expansion:t.text.length!==t.rawEnd-t.rawStart}),s=o;}return r}function G(n,r){return r<=n.rawStart?n.projectedStart:r>=n.rawEnd?n.projectedEnd:n.expansion?n.projectedStart:n.projectedStart+r-n.rawStart}function I(n,r){return n.expansion?n.rawStart:n.rawStart+r-n.projectedStart}function L(n,r){return n.expansion?n.rawEnd:n.rawStart+r-n.projectedStart}var K=new Set([chunkFIJZIQXA_cjs.bb,"\u2011"]),Q=/[\u001e\u001f\u2011]/,Y="\uFFFF";function W(n,r){if(!Q.test(n)&&!r?.size)return {text:n,at:null};let s="",t=[];for(let o=0;o<n.length;o+=1){let l=n[o];if(r?.has(o))s+=Y;else {if(l===chunkFIJZIQXA_cjs.cb)continue;s+=K.has(l)?"-":l;}t.push(o);}return {text:s,at:t}}function U(n){let r;for(let s of n){if(s.symbol){r??=new Set;for(let t=s.projectedStart;t<s.projectedEnd;t+=1)r.add(t);}for(let t of s.symbolOffsets??[])(r??=new Set).add(s.projectedStart+t);}return r}function O(n){let r=z(n),s="";for(let o of n)s+=o.text;let t=null;return {text:s,projectedOffset(o){let l=0;for(let i of r){if(o<=i.rawEnd)return G(i,o);l=i.projectedEnd;}return l},rawRange(o,l){if(o<0||o>=l||l>s.length)return null;let i=r.find(d=>o>=d.projectedStart&&o<d.projectedEnd),e=r.find(d=>l>d.projectedStart&&l<=d.projectedEnd);return !i||!e?null:{start:I(i,o),end:L(e,l)}},sliceRaw(o,l){if(o>=l)return "";let i="";for(let e of r){if(e.expansion){o<=e.rawStart&&l>=e.rawEnd&&(i+=e.text);continue}let d=Math.max(o,e.rawStart),a=Math.min(l,e.rawEnd);d<a&&(i+=e.text.slice(d-e.rawStart,a-e.rawStart));}return i},displaySlice(o,l){let i="";for(let e of r){if(e.projectedEnd<=o||e.projectedStart>=l)continue;let d=Math.max(o,e.projectedStart)-e.projectedStart,a=Math.min(l,e.projectedEnd)-e.projectedStart;if(e.symbol){i+=e.symbolDisplays?.[0]??"";continue}let u=new Map;e.symbolOffsets?.forEach((f,c)=>u.set(f,e.symbolDisplays?.[c]??""));for(let f=d;f<a;f+=1)i+=u.get(f)??e.text[f];}return i},resultRunAddressAt(o){let l=r.find(e=>e.resultRuns!==void 0&&o>=e.projectedStart&&o<e.projectedEnd);if(!l?.resultRuns)return null;let i=o-l.projectedStart;for(let e of l.resultRuns)if(i>=e.start&&i<e.end)return {runId:e.runId,offset:i-e.start};return null},findOccurrences(o,l,i={}){let e=[];if(l<=0||!chunkJGNVNT2A_cjs.sa(o)||s.length===0)return {matches:e,truncated:false};let d=i.matchCase===true,a=i.wholeWord===true;t??=W(s,U(r));let u=t,f=W(o).text;if(f.length===0||f.includes(Y))return {matches:e,truncated:false};let c=d?f:chunkJGNVNT2A_cjs.qa(f),j=d?u.text:chunkJGNVNT2A_cjs.qa(u.text),R=p=>u.at?.[p]??p,X=p=>{if(!u.at)return p;let m=0;for(;m<u.at.length&&u.at[m]<p;)m+=1;return m},v=Math.min(s.length,i.to??s.length),D=new Set,b=j.indexOf(c,X(Math.max(0,i.from??0)));for(;b>=0;){let p=b+c.length,m=R(b),x=R(p-1)+1;if(x>v)return {matches:e,truncated:false};if(r.some(y=>y.floatingObject===true&&y.projectedStart>m&&y.projectedStart<x)){b=j.indexOf(c,b+1);continue}if(!a||chunkJGNVNT2A_cjs.ra(u.text,b,p)){let y=r.find(h=>m>=h.projectedStart&&m<h.projectedEnd),E=r.find(h=>x>h.projectedStart&&x<=h.projectedEnd);if(!y||!E)return {matches:e,truncated:false};let S=y===E&&y.expansion?y:null;if(!S||!D.has(S)){if(e.length>=l)return {matches:e,truncated:true};e.push({start:m,length:x-m,rawStart:I(y,m),rawEnd:L(E,x)}),S&&D.add(S);}}b=j.indexOf(c,p);}return {matches:e,truncated:false}}}}function q(n){return n.length===0?O([]):O([{text:n,rawStart:0,rawEnd:n.length}])}var J="http://schemas.openxmlformats.org/markup-compatibility/2006";function Z(n){if(n.kind==="textValue")return false;if(chunkFIJZIQXA_cjs.od(n))return chunkFIJZIQXA_cjs.pd(n);let r=s=>s.kind!=="textValue"&&s.children.some(t=>t.kind==="anchoredDrawing"||t.kind!=="textValue"&&t.localName==="anchor");if(n.kind==="drawing")return r(n);if(n.namespaceUri!==J||n.localName!=="AlternateContent")return false;for(let s of n.children){if(s.kind==="textValue"||s.localName!=="Choice")continue;let t=s.children.find(o=>o.kind==="drawing"||o.kind!=="textValue"&&o.localName==="drawing");if(t)return r(t)}return false}function $(n,r,s="allMarkup"){if(!r.includes(chunkFIJZIQXA_cjs.nf)&&!r.includes(chunkFIJZIQXA_cjs.db))return r.length===0?[]:[{text:r,rawStart:0,rawEnd:r.length}];let t=chunkFIJZIQXA_cjs.If(n),o=chunkFIJZIQXA_cjs.ig(n,t),l=chunkO2AL2HSJ_cjs.d(n,t,s),i=new Map;for(let a of t)i.set(a.node.id,a);let e=[],d=0;for(let a of o){let u=i.get(a.node.id),f=!u&&chunkFIJZIQXA_cjs.eb(a.node);if(!u&&!f){Z(a.node)&&(d<a.start&&e.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),e.push({text:"",rawStart:a.start,rawEnd:a.end,floatingObject:true}),d=a.end);continue}if(d<a.start&&e.push({text:r.slice(d,a.start),rawStart:d,rawEnd:a.start}),!u){e.push({text:chunkFIJZIQXA_cjs.db,rawStart:a.start,rawEnd:a.end,symbol:true,symbolDisplays:[chunkFIJZIQXA_cjs.Kj(a.node)]}),d=a.end;continue}let c=l.get(u.node.id);u.kind==="simple"&&c?e.push({text:c.text,rawStart:a.start,rawEnd:a.end,resultRuns:c.runs,...c.symbols?{symbolOffsets:c.symbols}:{},...c.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}):e.push({text:c?.text??chunkFIJZIQXA_cjs.nf,rawStart:a.start,rawEnd:a.end,...c?.symbols?{symbolOffsets:c.symbols}:{},...c?.symbolDisplays?{symbolDisplays:c.symbolDisplays}:{}}),d=a.end;}return d<r.length&&e.push({text:r.slice(d),rawStart:d,rawEnd:r.length}),e}function it(n,r,s="allMarkup"){return !r.includes(chunkFIJZIQXA_cjs.nf)&&!r.includes(chunkFIJZIQXA_cjs.db)?q(r):O($(n,r,s))}
2
2
  exports.a=O;exports.b=q;exports.c=$;exports.d=it;
@@ -1 +1 @@
1
- 'use strict';var chunkGVUOWHTO_cjs=require('../chunk-GVUOWHTO.cjs'),chunk4KZ6L5YF_cjs=require('../chunk-4KZ6L5YF.cjs');Object.defineProperty(exports,"createCollaborationDocumentPort",{enumerable:true,get:function(){return chunkGVUOWHTO_cjs.b}});Object.defineProperty(exports,"historyGroupOfJournal",{enumerable:true,get:function(){return chunk4KZ6L5YF_cjs.Ba}});Object.defineProperty(exports,"registerUndoHistoryPosition",{enumerable:true,get:function(){return chunk4KZ6L5YF_cjs.ok}});Object.defineProperty(exports,"reportHistoryGroup",{enumerable:true,get:function(){return chunk4KZ6L5YF_cjs.nk}});
1
+ 'use strict';var chunk2GO5T2JU_cjs=require('../chunk-2GO5T2JU.cjs'),chunkFIJZIQXA_cjs=require('../chunk-FIJZIQXA.cjs');Object.defineProperty(exports,"createCollaborationDocumentPort",{enumerable:true,get:function(){return chunk2GO5T2JU_cjs.b}});Object.defineProperty(exports,"mapOffsetAcrossText",{enumerable:true,get:function(){return chunk2GO5T2JU_cjs.c}});Object.defineProperty(exports,"historyGroupOfJournal",{enumerable:true,get:function(){return chunkFIJZIQXA_cjs.Ja}});Object.defineProperty(exports,"registerUndoHistoryPosition",{enumerable:true,get:function(){return chunkFIJZIQXA_cjs.il}});Object.defineProperty(exports,"reportHistoryGroup",{enumerable:true,get:function(){return chunkFIJZIQXA_cjs.hl}});
@@ -1,7 +1,23 @@
1
- import { d as HistoryGroup, T as TreePackageStore, e as TreeModelChange } from '../tree-package-fragment-DYZIk1rY.js';
2
- export { r as reportHistoryGroup } from '../tree-package-fragment-DYZIk1rY.js';
3
- import { Z as OoxmlElement, Q as OoxmlPackage } from '../types-barrel-BFKR8Pzp.js';
4
- import '../image-resources-BDFxcu7W.js';
1
+ /**
2
+ * `@docx-editor.dev/core/collaboration/replication` — the seam a replication implementation
3
+ * binds to, not the surface a host consumes.
4
+ *
5
+ * Everything here exists for the layer BETWEEN a CRDT and the canonical tree: the document
6
+ * port an adapter writes through, the primitive journal it reads, and the descriptors that
7
+ * journal is made of. A host that renders presence and reads a status needs none of it, which
8
+ * is why it lives behind its own subpath — autocomplete on
9
+ * `@docx-editor.dev/core/collaboration` should not offer `putXmlPart` and `spliceChildren` to
10
+ * somebody wiring up an avatar stack.
11
+ *
12
+ * Reach for this when you are writing a provider. `@docx-editor.dev/pro` is one.
13
+ *
14
+ * @packageDocumentation
15
+ * @public
16
+ */
17
+ import { d as HistoryGroup, T as TreePackageStore, e as TreeModelChange } from '../tree-package-fragment-BeeKxDw8.js';
18
+ export { r as reportHistoryGroup } from '../tree-package-fragment-BeeKxDw8.js';
19
+ import { Z as OoxmlElement, Q as OoxmlPackage } from '../types-barrel-D3xCgQX6.js';
20
+ import '../image-resources-BN-hUgCn.js';
5
21
  import '../editor-scope-OHPwVQ5l.js';
6
22
 
7
23
  /** Attribute name as the journal addresses it. Prefix is authored fidelity, not identity. @public */
@@ -119,6 +135,21 @@ interface CreateCollaborationDocumentPortOptions {
119
135
  /** Create the narrow collaboration view over one canonical package store. @public */
120
136
  declare function createCollaborationDocumentPort(store: TreePackageStore, options: CreateCollaborationDocumentPortOptions): CollaborationDocumentPort;
121
137
 
138
+ /**
139
+ * Offsets carried across changes to a paragraph's text, for the local caret and the carets
140
+ * peers show.
141
+ */
142
+ /**
143
+ * An offset carried across one change to a paragraph's text.
144
+ *
145
+ * The local caret and the carets peers show both stay next to the same character this way,
146
+ * whatever a peer typed or deleted around it, even when one remote update changed text on
147
+ * both sides of the offset.
148
+ *
149
+ * @public
150
+ */
151
+ declare function mapOffsetAcrossText(offset: number, before: string, after: string): number;
152
+
122
153
  /** An editor-local view action must stay between the same document undo entries. */
123
154
  interface UndoHistoryPosition {
124
155
  current(): object | null;
@@ -185,6 +216,11 @@ interface CollaborationDocumentPort {
185
216
  readonly documentId: string;
186
217
  paragraphs(): readonly CollaborationParagraph[];
187
218
  paragraphByNodeId(nodeId: string): CollaborationParagraph | null;
219
+ /**
220
+ * The model text of the paragraph with this node id in any story, or null when the editor
221
+ * shows none. A lookup by node id, whatever the paragraph's `w14:paraId`. Optional.
222
+ */
223
+ paragraphTextOf?(nodeId: string): string | null;
188
224
  /**
189
225
  * Resolve a stable `w14:paraId` in any story this replica holds.
190
226
  *
@@ -230,5 +266,5 @@ interface CollaborationDocumentPort {
230
266
  binaryPart(storageKey: string): Uint8Array | null;
231
267
  }
232
268
 
233
- export { HistoryGroup, createCollaborationDocumentPort, historyGroupOfJournal, registerUndoHistoryPosition };
269
+ export { HistoryGroup, createCollaborationDocumentPort, historyGroupOfJournal, mapOffsetAcrossText, registerUndoHistoryPosition };
234
270
  export type { CanonicalAttributeName, CanonicalBinaryDescriptor, CanonicalElementNodeDescriptor, CanonicalNodeDescriptor, CanonicalPrimitiveEffect, CanonicalPrimitiveJournal, CanonicalRelationshipRecord, CanonicalTextNodeDescriptor, CollaborationApplyResult, CollaborationDocumentPort, CollaborationMutation, CollaborationParagraph, CollaborationParagraphTextUpdate, CreateCollaborationDocumentPortOptions };
@@ -1 +1 @@
1
- export{b as createCollaborationDocumentPort}from'../chunk-DNXVNQEO.js';export{Ba as historyGroupOfJournal,ok as registerUndoHistoryPosition,nk as reportHistoryGroup}from'../chunk-UMRSBLO7.js';
1
+ export{b as createCollaborationDocumentPort,c as mapOffsetAcrossText}from'../chunk-ETTO6GK3.js';export{Ja as historyGroupOfJournal,il as registerUndoHistoryPosition,hl as reportHistoryGroup}from'../chunk-4R3TEXMN.js';
@@ -1 +1 @@
1
- 'use strict';var chunkBTQKU64Q_cjs=require('./chunk-BTQKU64Q.cjs');var u={"already-initialized":true,"authentication-failed":true,"baseline-digest-mismatch":true,"baseline-too-large":true,"blob-digest-mismatch":true,"blob-read":true,"blob-store-full":true,"blob-too-large":true,"collaboration-format-mismatch":true,"collaboration-session-destroyed":true,"collaboration-session-not-attached":true,"collaboration-session-not-ready":true,"collaboration-text-limit":true,"concurrent-seed":true,"document-id-mismatch":true,"duplicate-paragraph-id":true,"experimental-collaboration-body-text-only":true,"experimental-collaboration-existing-paragraphs-only":true,"experimental-collaboration-text-only":true,"experimental-collaboration-untracked-text-only":true,"immutable-baseline-changed":true,"immutable-metadata-changed":true,"initialization-aborted":true,"initialization-timeout":true,"invalid-baseline":true,"invalid-blob-descriptor":true,"invalid-bound":true,"invalid-document-id":true,"invalid-identity":true,"invalid-identity-color":true,"invalid-logical-id":true,"invalid-relationships":true,"invalid-saved-room":true,"invalid-session-id":true,"invalid-shared-metadata":true,"invalid-string":true,"local-mirror-failed":true,"materialize-dropped-content":true,"missing-blob":true,"missing-local-blob":true,"missing-root":true,"no-main-document-part":true,"not-initialized":true,"paragraph-set-mismatch":true,"port-already-attached":true,"protocol-version-mismatch":true,"prototype-key":true,"remote-apply-failed":true,"saved-room-unavailable":true,"schema-version-mismatch":true,"shared-schema-invalid":true,"text-too-long":true,"too-many-attributes":true,"too-many-children":true,"too-many-nodes":true,"too-many-parts":true,"too-many-relationships":true,transport:true,"transport-disconnected":true,"tree-too-deep":true,"unknown-logical-id":true,"unknown-paragraph-id":true,"unsafe-part-name":true,"unsupported-root-key":true};function c(t){return Object.hasOwn(u,t)}function b(t,o){return t===o?true:!t||!o?false:t.code===o.code&&t.detail===o.detail}function p(t,o){return Object.freeze(o!==void 0&&o.length>0?{code:t,detail:o}:{code:t})}function m(t="initializing"){let o=t,e,r,n=Object.freeze({status:o,reason:e,lastFailure:r});return {status:()=>o,snapshot:()=>n,set(i,l,s){let a=l===void 0?void 0:p(l,s);return o===i&&b(e,a)?false:(o=i,e=a,i==="error"&&a&&(r=a),n=Object.freeze({status:o,reason:e,lastFailure:r}),true)}}}Object.defineProperty(exports,"safeParticipantColor",{enumerable:true,get:function(){return chunkBTQKU64Q_cjs.a}});exports.createCollaborationStatusTracker=m;exports.isCollaborationFailureCode=c;
1
+ 'use strict';var chunkBTQKU64Q_cjs=require('./chunk-BTQKU64Q.cjs');var C={"already-initialized":true,"authentication-failed":true,"baseline-digest-mismatch":true,"baseline-too-large":true,"blob-digest-mismatch":true,"blob-read":true,"blob-store-full":true,"blob-too-large":true,"collaboration-format-mismatch":true,"collaboration-session-destroyed":true,"collaboration-session-not-attached":true,"collaboration-session-not-ready":true,"collaboration-text-limit":true,"concurrent-seed":true,"document-id-mismatch":true,"duplicate-paragraph-id":true,"experimental-collaboration-body-text-only":true,"experimental-collaboration-existing-paragraphs-only":true,"experimental-collaboration-text-only":true,"experimental-collaboration-untracked-text-only":true,"immutable-baseline-changed":true,"immutable-metadata-changed":true,"initialization-aborted":true,"initialization-timeout":true,"invalid-baseline":true,"invalid-blob-descriptor":true,"invalid-bound":true,"invalid-document-id":true,"invalid-identity":true,"invalid-identity-color":true,"invalid-logical-id":true,"invalid-relationships":true,"invalid-saved-room":true,"invalid-session-id":true,"invalid-shared-metadata":true,"invalid-string":true,"local-mirror-failed":true,"materialize-dropped-content":true,"missing-blob":true,"missing-local-blob":true,"missing-root":true,"no-main-document-part":true,"not-initialized":true,"paragraph-set-mismatch":true,"port-already-attached":true,"protocol-version-mismatch":true,"prototype-key":true,"remote-apply-failed":true,"room-generation-changed":true,"saved-room-unavailable":true,"schema-version-mismatch":true,"shared-schema-invalid":true,"text-too-long":true,"too-many-attributes":true,"too-many-children":true,"too-many-nodes":true,"too-many-parts":true,"too-many-relationships":true,transport:true,"transport-disconnected":true,"tree-too-deep":true,"unknown-logical-id":true,"unknown-paragraph-id":true,"unsafe-part-name":true,"unsupported-root-key":true};function g(e){return Object.hasOwn(C,e)}function f(e,o){return e===o?true:!e||!o?false:e.code===o.code&&e.detail===o.detail}function h(e,o){return Object.freeze(o!==void 0&&o.length>0?{code:e,detail:o}:{code:e})}function S(e="initializing"){let o=e,a,l,s=0,r=false,i=false,d=Object.freeze({status:o,reason:a,lastFailure:l,failureCount:s,recovering:r,waiting:i}),u=()=>{d=Object.freeze({status:o,reason:a,lastFailure:l,failureCount:s,recovering:r,waiting:i});};return {status:()=>o,snapshot:()=>d,set(t,c,p,m=false){let n=c===void 0?void 0:h(c,p),b=t==="error"&&m;return o===t&&f(a,n)&&r===b?false:(o=t,a=n,r=b,t==="error"&&n&&(l=n,s+=1),u(),true)},setWaiting(t){return i===t?false:(i=t,u(),true)}}}Object.defineProperty(exports,"safeParticipantColor",{enumerable:true,get:function(){return chunkBTQKU64Q_cjs.a}});exports.createCollaborationStatusTracker=S;exports.isCollaborationFailureCode=g;
@@ -1,9 +1,18 @@
1
- import { S as StoryScope } from './tree-package-fragment-DYZIk1rY.js';
2
- import { W as TreeDocOp } from './types-barrel-BFKR8Pzp.js';
1
+ /**
2
+ * `@docx-editor.dev/core/collaboration` — provider-neutral collaboration contracts.
3
+ *
4
+ * This lane names the attachment between the canonical tree and an optional replication
5
+ * implementation. It performs no networking and imports no CRDT.
6
+ *
7
+ * @packageDocumentation
8
+ * @public
9
+ */
10
+ import { S as StoryScope } from './tree-package-fragment-BeeKxDw8.js';
11
+ import { W as TreeDocOp } from './types-barrel-D3xCgQX6.js';
3
12
  import { CollaborationDocumentPort } from './collaboration/replication.js';
4
- import { C as CollaborationStatus, a as CollaborationStatusSnapshot, b as CollaborationFailureCode } from './failure-BIPVQbRm.js';
5
- export { c as CollaborationFailure, d as createCollaborationStatusTracker, i as isCollaborationFailureCode } from './failure-BIPVQbRm.js';
6
- import './image-resources-BDFxcu7W.js';
13
+ import { C as CollaborationStatus, a as CollaborationStatusSnapshot, b as CollaborationFailureCode } from './failure-NS2lsya4.js';
14
+ export { c as CollaborationFailure, d as createCollaborationStatusTracker, i as isCollaborationFailureCode } from './failure-NS2lsya4.js';
15
+ import './image-resources-BN-hUgCn.js';
7
16
  import './editor-scope-OHPwVQ5l.js';
8
17
 
9
18
  /**
@@ -36,13 +45,18 @@ declare function safeParticipantColor(value: string | undefined): string | undef
36
45
 
37
46
  /** Human or automation identity attached to authored collaboration transactions. @public */
38
47
  interface CollaborationIdentity {
48
+ /** Stable author id, 1 to 256 characters after trimming. Recorded on authored changes. */
39
49
  readonly actorId: string;
50
+ /** Display name, 1 to 256 characters after trimming. */
40
51
  readonly name: string;
52
+ /** Presence color, at most 64 characters. An unsafe CSS color falls back to the accent. */
41
53
  readonly color?: string;
54
+ /** `agent` for automation. Defaults to `human`. */
42
55
  readonly role?: 'human' | 'agent';
43
56
  }
44
57
  /** One validated identity visible through ephemeral collaboration presence. @public */
45
58
  interface CollaborationParticipant extends CollaborationIdentity {
59
+ /** True for this replica's own participant. */
46
60
  readonly isLocal: boolean;
47
61
  }
48
62
  /**
@@ -54,7 +68,9 @@ interface CollaborationParticipant extends CollaborationIdentity {
54
68
  * @public
55
69
  */
56
70
  interface CollaborationSelectionAddress {
71
+ /** The stable `w14:paraId` of the paragraph. */
57
72
  readonly paragraphId: string;
73
+ /** A UTF-16 offset in the paragraph's text. */
58
74
  readonly offset: number;
59
75
  }
60
76
  /**
@@ -75,8 +91,11 @@ type CollaborationSelectionKind = 'cells';
75
91
  * @public
76
92
  */
77
93
  interface CollaborationRemoteSelectionAddress {
94
+ /** The stable `w14:paraId` of the paragraph. */
78
95
  readonly paragraphId: string;
96
+ /** The paragraph's node id in this replica's editor tree. */
79
97
  readonly nodeId: string;
98
+ /** A UTF-16 offset in the paragraph's text. */
80
99
  readonly offset: number;
81
100
  }
82
101
  /**
@@ -87,11 +106,17 @@ interface CollaborationRemoteSelectionAddress {
87
106
  * @public
88
107
  */
89
108
  interface CollaborationRemoteSelection {
109
+ /** The participant's `actorId`. */
90
110
  readonly actorId: string;
111
+ /** The participant's display name. */
91
112
  readonly name: string;
113
+ /** The participant's presence color, when it published a safe one. */
92
114
  readonly color?: string;
115
+ /** Where the selection starts. */
93
116
  readonly anchor: CollaborationRemoteSelectionAddress;
117
+ /** Where the selection ends: the remote caret. */
94
118
  readonly head: CollaborationRemoteSelectionAddress;
119
+ /** `cells` for a table cell rectangle; absent for a character range. */
95
120
  readonly kind?: CollaborationSelectionKind;
96
121
  }
97
122
  /**
@@ -102,10 +127,42 @@ interface CollaborationRemoteSelection {
102
127
  * @public
103
128
  */
104
129
  interface CollaborationLocalSelection {
130
+ /** Where the selection starts. */
105
131
  readonly anchor: CollaborationSelectionAddress;
132
+ /** Where the selection ends: the caret. */
106
133
  readonly head: CollaborationSelectionAddress;
134
+ /** `cells` for a table cell rectangle; absent for a character range. */
107
135
  readonly kind?: CollaborationSelectionKind;
108
136
  }
137
+ /**
138
+ * Where a collaboration session carried the local selection across the last remote change.
139
+ *
140
+ * The editor uses `to` only while its selection still equals `from`: a selection the user
141
+ * moved since is the user's. @public
142
+ */
143
+ interface CollaborationSelectionMove {
144
+ /** The selection the session carried, as the editor last published it. */
145
+ readonly from: CollaborationEditorSelection;
146
+ /** Where it stands now: beside the same characters, wherever they show. */
147
+ readonly to: CollaborationEditorSelection;
148
+ }
149
+ /** A selection in this replica's editor. @public */
150
+ interface CollaborationEditorSelection {
151
+ /** Where the selection starts: it stays put when the selection extends. */
152
+ readonly anchor: CollaborationEditorPosition;
153
+ /** Where the selection ends: the caret. */
154
+ readonly head: CollaborationEditorPosition;
155
+ }
156
+ /**
157
+ * A position in this replica's editor tree. Unlike a stable paragraph id, which a remote
158
+ * change can rename on one replica, a node id names one paragraph of this editor. @public
159
+ */
160
+ interface CollaborationEditorPosition {
161
+ /** The node id of the paragraph in this replica's editor tree. */
162
+ readonly nodeId: string;
163
+ /** A UTF-16 offset in the paragraph's text. */
164
+ readonly offset: number;
165
+ }
109
166
  /**
110
167
  * Optional replication session attached to an editor or headless automation host.
111
168
  *
@@ -115,10 +172,13 @@ interface CollaborationLocalSelection {
115
172
  * @public
116
173
  */
117
174
  interface EditorCollaborationSession {
175
+ /** The room's document id. An attached port must carry the same id. */
118
176
  readonly documentId: string;
119
177
  /** Unique identity for this attachment lifetime. It prevents operation ID reuse after reconnect. */
120
178
  readonly sessionId: string;
179
+ /** The validated local identity. */
121
180
  readonly identity: CollaborationIdentity;
181
+ /** Current lifecycle state. */
122
182
  status(): CollaborationStatus;
123
183
  /**
124
184
  * Cached status, current reason, and last failure.
@@ -127,7 +187,12 @@ interface EditorCollaborationSession {
127
187
  * recovered error still reads {@link CollaborationStatusSnapshot.lastFailure}.
128
188
  */
129
189
  statusSnapshot(): CollaborationStatusSnapshot;
190
+ /** Call `listener` on each status or reason change. Returns the unsubscribe function. */
130
191
  subscribeStatus(listener: (status: CollaborationStatus, reason?: CollaborationFailureCode, detail?: string) => void): () => void;
192
+ /**
193
+ * Attach the editor's document port and start replicating. Returns the detach function.
194
+ * A second, different port moves the session to `error` with `port-already-attached`.
195
+ */
131
196
  attach(port: CollaborationDocumentPort): () => void;
132
197
  /**
133
198
  * Whether an editor has attached its document port to this replica.
@@ -138,15 +203,41 @@ interface EditorCollaborationSession {
138
203
  * production build discards; this is the same fact as a value a host can render.
139
204
  */
140
205
  readonly attached: boolean;
206
+ /**
207
+ * Check whether `ops` may commit now. Returns `null` to admit them, or the refusal code.
208
+ * Call it before every store transaction a custom port commits.
209
+ */
141
210
  gateOperations(ops: readonly TreeDocOp[], scope: StoryScope): CollaborationFailureCode | null;
211
+ /** Whether the shared undo history holds a local step to undo. */
142
212
  canUndo(): boolean;
213
+ /** Whether the shared undo history holds a local step to redo. */
143
214
  canRedo(): boolean;
215
+ /** Undo this participant's last step; others' edits stay. Returns false when refused. */
144
216
  undo(): boolean;
217
+ /** Redo this participant's last undone step. Returns false when refused. */
145
218
  redo(): boolean;
219
+ /**
220
+ * The selection the last `undo` or `redo` restored: the one its author had before the
221
+ * undone change. Null when the step recorded none. Optional; a session without it leaves
222
+ * the editor to place the caret at the change.
223
+ */
224
+ historySelection?(): CollaborationLocalSelection | null;
225
+ /**
226
+ * Where the last remote change carried the local selection, on the shared characters
227
+ * beside its endpoints, and the selection it was carried from, both in the editor's
228
+ * paragraph node ids. Null when the session could not carry it. Optional; without it the
229
+ * editor maps the selection by text.
230
+ */
231
+ remoteSelectionMove?(): CollaborationSelectionMove | null;
232
+ /** Publish the local selection through presence. `null` clears it. */
146
233
  setLocalSelection(selection: CollaborationLocalSelection | null): void;
234
+ /** Participants in presence, this replica included. Capped at 256. */
147
235
  participants(): readonly CollaborationParticipant[];
236
+ /** Call `listener` when the participant list changes. Returns the unsubscribe function. */
148
237
  subscribeParticipants(listener: (participants: readonly CollaborationParticipant[]) => void): () => void;
238
+ /** Other participants' selections, resolved into this replica's addresses. */
149
239
  remoteSelections(): readonly CollaborationRemoteSelection[];
240
+ /** Call `listener` when a remote selection changes. Returns the unsubscribe function. */
150
241
  subscribeRemoteSelections(listener: (selections: readonly CollaborationRemoteSelection[]) => void): () => void;
151
242
  /**
152
243
  * Publish queued local journals to shared state.
@@ -155,6 +246,7 @@ interface EditorCollaborationSession {
155
246
  * so a queued journal is never dropped.
156
247
  */
157
248
  flushPendingJournals(): void;
249
+ /** Stop replicating and release listeners. The status becomes `destroyed`. */
158
250
  destroy(): void;
159
251
  }
160
252
  /**
@@ -174,4 +266,4 @@ interface CollaborationModuleContribution {
174
266
  }
175
267
 
176
268
  export { CollaborationFailureCode, CollaborationStatus, CollaborationStatusSnapshot, safeParticipantColor };
177
- export type { CollaborationIdentity, CollaborationLocalSelection, CollaborationModuleContribution, CollaborationParticipant, CollaborationRemoteSelection, CollaborationRemoteSelectionAddress, CollaborationSelectionAddress, CollaborationSelectionKind, EditorCollaborationSession };
269
+ export type { CollaborationEditorPosition, CollaborationEditorSelection, CollaborationIdentity, CollaborationLocalSelection, CollaborationModuleContribution, CollaborationParticipant, CollaborationRemoteSelection, CollaborationRemoteSelectionAddress, CollaborationSelectionAddress, CollaborationSelectionKind, CollaborationSelectionMove, EditorCollaborationSession };
@@ -1 +1 @@
1
- export{a as safeParticipantColor}from'./chunk-6JIJOZDW.js';var u={"already-initialized":true,"authentication-failed":true,"baseline-digest-mismatch":true,"baseline-too-large":true,"blob-digest-mismatch":true,"blob-read":true,"blob-store-full":true,"blob-too-large":true,"collaboration-format-mismatch":true,"collaboration-session-destroyed":true,"collaboration-session-not-attached":true,"collaboration-session-not-ready":true,"collaboration-text-limit":true,"concurrent-seed":true,"document-id-mismatch":true,"duplicate-paragraph-id":true,"experimental-collaboration-body-text-only":true,"experimental-collaboration-existing-paragraphs-only":true,"experimental-collaboration-text-only":true,"experimental-collaboration-untracked-text-only":true,"immutable-baseline-changed":true,"immutable-metadata-changed":true,"initialization-aborted":true,"initialization-timeout":true,"invalid-baseline":true,"invalid-blob-descriptor":true,"invalid-bound":true,"invalid-document-id":true,"invalid-identity":true,"invalid-identity-color":true,"invalid-logical-id":true,"invalid-relationships":true,"invalid-saved-room":true,"invalid-session-id":true,"invalid-shared-metadata":true,"invalid-string":true,"local-mirror-failed":true,"materialize-dropped-content":true,"missing-blob":true,"missing-local-blob":true,"missing-root":true,"no-main-document-part":true,"not-initialized":true,"paragraph-set-mismatch":true,"port-already-attached":true,"protocol-version-mismatch":true,"prototype-key":true,"remote-apply-failed":true,"saved-room-unavailable":true,"schema-version-mismatch":true,"shared-schema-invalid":true,"text-too-long":true,"too-many-attributes":true,"too-many-children":true,"too-many-nodes":true,"too-many-parts":true,"too-many-relationships":true,transport:true,"transport-disconnected":true,"tree-too-deep":true,"unknown-logical-id":true,"unknown-paragraph-id":true,"unsafe-part-name":true,"unsupported-root-key":true};function c(t){return Object.hasOwn(u,t)}function b(t,o){return t===o?true:!t||!o?false:t.code===o.code&&t.detail===o.detail}function p(t,o){return Object.freeze(o!==void 0&&o.length>0?{code:t,detail:o}:{code:t})}function m(t="initializing"){let o=t,e,r,n=Object.freeze({status:o,reason:e,lastFailure:r});return {status:()=>o,snapshot:()=>n,set(i,l,s){let a=l===void 0?void 0:p(l,s);return o===i&&b(e,a)?false:(o=i,e=a,i==="error"&&a&&(r=a),n=Object.freeze({status:o,reason:e,lastFailure:r}),true)}}}export{m as createCollaborationStatusTracker,c as isCollaborationFailureCode};
1
+ export{a as safeParticipantColor}from'./chunk-6JIJOZDW.js';var C={"already-initialized":true,"authentication-failed":true,"baseline-digest-mismatch":true,"baseline-too-large":true,"blob-digest-mismatch":true,"blob-read":true,"blob-store-full":true,"blob-too-large":true,"collaboration-format-mismatch":true,"collaboration-session-destroyed":true,"collaboration-session-not-attached":true,"collaboration-session-not-ready":true,"collaboration-text-limit":true,"concurrent-seed":true,"document-id-mismatch":true,"duplicate-paragraph-id":true,"experimental-collaboration-body-text-only":true,"experimental-collaboration-existing-paragraphs-only":true,"experimental-collaboration-text-only":true,"experimental-collaboration-untracked-text-only":true,"immutable-baseline-changed":true,"immutable-metadata-changed":true,"initialization-aborted":true,"initialization-timeout":true,"invalid-baseline":true,"invalid-blob-descriptor":true,"invalid-bound":true,"invalid-document-id":true,"invalid-identity":true,"invalid-identity-color":true,"invalid-logical-id":true,"invalid-relationships":true,"invalid-saved-room":true,"invalid-session-id":true,"invalid-shared-metadata":true,"invalid-string":true,"local-mirror-failed":true,"materialize-dropped-content":true,"missing-blob":true,"missing-local-blob":true,"missing-root":true,"no-main-document-part":true,"not-initialized":true,"paragraph-set-mismatch":true,"port-already-attached":true,"protocol-version-mismatch":true,"prototype-key":true,"remote-apply-failed":true,"room-generation-changed":true,"saved-room-unavailable":true,"schema-version-mismatch":true,"shared-schema-invalid":true,"text-too-long":true,"too-many-attributes":true,"too-many-children":true,"too-many-nodes":true,"too-many-parts":true,"too-many-relationships":true,transport:true,"transport-disconnected":true,"tree-too-deep":true,"unknown-logical-id":true,"unknown-paragraph-id":true,"unsafe-part-name":true,"unsupported-root-key":true};function g(e){return Object.hasOwn(C,e)}function f(e,o){return e===o?true:!e||!o?false:e.code===o.code&&e.detail===o.detail}function h(e,o){return Object.freeze(o!==void 0&&o.length>0?{code:e,detail:o}:{code:e})}function S(e="initializing"){let o=e,a,l,s=0,r=false,i=false,d=Object.freeze({status:o,reason:a,lastFailure:l,failureCount:s,recovering:r,waiting:i}),u=()=>{d=Object.freeze({status:o,reason:a,lastFailure:l,failureCount:s,recovering:r,waiting:i});};return {status:()=>o,snapshot:()=>d,set(t,c,p,m=false){let n=c===void 0?void 0:h(c,p),b=t==="error"&&m;return o===t&&f(a,n)&&r===b?false:(o=t,a=n,r=b,t==="error"&&n&&(l=n,s+=1),u(),true)},setWaiting(t){return i===t?false:(i=t,u(),true)}}}export{S as createCollaborationStatusTracker,g as isCollaborationFailureCode};
@@ -1,5 +1,20 @@
1
- import { D as DocxDocument, E as ExecResult, i as ContentControlType, j as DocTarget, k as RunFormatting, l as Extent, I as InsertableContentControlType, m as ContainerRef, n as ContentControlFilter, o as DocRange, p as Revision, q as DocComment, S as StyleDefinitions } from '../types-barrel-BFKR8Pzp.js';
2
- export { B as Block, r as ColorValue, s as ContentControl, t as DocAnchor, u as DocAnchorRange, v as DocLocation, w as DocumentBody, x as ExecErrorCode, H as HeaderFooterSet, y as IndentFormatting, P as Paragraph, z as ParagraphFlags, A as ParagraphTabStop, F as RevisionType, G as Section, J as SectionProperties, K as StyleDefinition, T as Table, L as Theme, M as ThemeColorScheme } from '../types-barrel-BFKR8Pzp.js';
1
+ /**
2
+ * `@docx-editor.dev/core/contracts/document` — the document-level edit and query vocabulary.
3
+ *
4
+ * The subset that means something without a live editor: what an automation host or an LLM tool
5
+ * can ask for and change.
6
+ *
7
+ * A CONTRACT module, not a barrel. `contracts/editor` builds the `Editor` command and query
8
+ * surfaces on top of these, so they cannot live in the package root: the root re-exports
9
+ * runtime from `../editor`, and a contract importing the root would invert the dependency —
10
+ * safe today only because that import is type-only, and one accidental value import away from
11
+ * pulling the painted engine into a server bundle.
12
+ *
13
+ * @packageDocumentation
14
+ * @public
15
+ */
16
+ import { D as DocxDocument, E as ExecResult, i as ContentControlType, j as DocTarget, k as RunFormatting, l as Extent, I as InsertableContentControlType, m as ContainerRef, n as ContentControlFilter, o as DocRange, p as Revision, q as DocComment, S as StyleDefinitions } from '../types-barrel-D3xCgQX6.js';
17
+ export { B as Block, r as ColorValue, s as ContentControl, t as DocAnchor, u as DocAnchorRange, v as DocLocation, w as DocumentBody, x as ExecErrorCode, H as HeaderFooterSet, y as IndentFormatting, P as Paragraph, z as ParagraphFlags, A as ParagraphTabStop, F as RevisionType, G as Section, J as SectionProperties, K as StyleDefinition, T as Table, L as Theme, M as ThemeColorScheme } from '../types-barrel-D3xCgQX6.js';
3
18
  import '../editor-scope-OHPwVQ5l.js';
4
19
 
5
20
  /**
@@ -1,12 +1,22 @@
1
- import '../revision-projection-CSNFudZY.js';
2
- export { g as AnchorHighlightAnimation, A as AnchorHighlightOptions, K as AuthoredNoteNumbering, C as CanResult, f as ClearAnchorHighlightOptions, L as DocumentChange, M as DocumentEditingMode, N as DocumentHandle, D as DocumentSource, h as Editor, O as EditorAnchorNavigation, e as EditorCommand, P as EditorCommandShape, Q as EditorCommands, R as EditorError, U as EditorEvents, E as EditorFontError, V as EditorFontErrorCode, W as EditorFormatPainterCommands, X as EditorHeaderFooterCommands, Y as EditorHighlights, _ as EditorNoteCommands, $ as EditorPosition, a0 as EditorQueries, a1 as EditorQuery, a2 as EditorQueryResults, a3 as EditorSelection, d as EditorSnapshot, a as FontConfiguration, F as FontFaceRequest, b as FontSource, c as FontSourceSubstitution, a4 as FormatPainterLevel, a5 as FormatPainterMode, y as FormatPainterSurfaceState, a6 as FurnitureVariant, a7 as HeaderFooterSlotArgs, a8 as HeaderFooterState, k as HighlightHit, j as HighlightOptions, H as HighlightRange, l as HighlightRect, i as HighlightResult, a9 as HyperlinkInfo, I as ImageContext, m as ImageCropPercent, aa as NoteKind, ab as NotePropertiesSide, ac as NotePropertiesState, ad as PageSetup, ae as ResolveReviewChangesOptions, af as ResolvedNoteNumbering, ag as ReviewActivationOptions, ah as ReviewCommentPlacement, ai as ReviewCustomPlacement, aj as ReviewItemPlacement, ak as ReviewItemPlacementBase, al as ReviewItemQuery, am as ReviewRevisionPlacement, S as ScrollToAnchorOptions, o as SelectedImageState, z as TableBorderEdgeTarget, B as TableBorderSpec, G as TableBorderStyle, an as TableBorderTarget, ao as TableCellVerticalAlignment, ap as TableColumnDividerResizeTarget, aq as TableColumnOccurrenceTarget, J as TableContext, ar as TableRightEdgeResizeTarget, as as TableRowOccurrenceTarget, T as TextMatch, p as TrackedChangeFilterMode, q as TrackedChangePredicate, at as ZoomFitTarget, Z as ZoomMode } from '../editor-B3OBYNrF.js';
3
- export { B as Block, r as ColorValue, C as CommentRecord, m as ContainerRef, s as ContentControl, n as ContentControlFilter, i as ContentControlType, t as DocAnchor, u as DocAnchorRange, q as DocComment, v as DocLocation, o as DocRange, j as DocTarget, w as DocumentBody, D as DocxDocument, ai as DocxDocumentJSON, aj as DrawingHorizontalReferenceFrame, a9 as DrawingKind, ac as DrawingLocks, ab as DrawingPositionInput, ak as DrawingVerticalReferenceFrame, x as ExecErrorCode, E as ExecResult, l as Extent, al as FontDefinition, H as HeaderFooterSet, aa as ImageWrapTarget, y as IndentFormatting, I as InsertableContentControlType, am as NumberingRef, an as PageMargins, P as Paragraph, ao as ParagraphDisagreements, z as ParagraphFlags, ad as ParagraphFormatCommand, A as ParagraphTabStop, ap as Point, af as Rect, c as ReviewCommentItem, d as ReviewCustomItem, a as ReviewItem, e as ReviewPosition, f as ReviewRange, b as ReviewRevisionItem, g as ReviewRevisionKind, p as Revision, h as RevisionAddress, a3 as RevisionBatchResult, F as RevisionType, aq as Run, k as RunFormatting, G as Section, J as SectionProperties, ag as SelectionPin, K as StyleDefinition, S as StyleDefinitions, T as Table, ar as TableCell, as as TableRow, L as Theme, M as ThemeColorScheme, ah as Unsubscribe, ae as Watermark } from '../types-barrel-BFKR8Pzp.js';
1
+ /**
2
+ * `@docx-editor.dev/core/contracts/editor` — the `Editor` contract adapters are written against.
3
+ *
4
+ * Commands go through `can` before `exec`; queries answer against the live, laid-out document.
5
+ * Type-only declarations let adapters name the surface without importing the engine.
6
+ *
7
+ * @packageDocumentation
8
+ * @public
9
+ */
10
+ export { a as ReviewDisplayMode } from '../revision-projection-DZ4kKVev.js';
11
+ import '../review-pane-D9jm8DcY.js';
12
+ export { h as AnchorHighlightAnimation, A as AnchorHighlightOptions, L as AuthoredNoteNumbering, C as CanResult, f as ClearAnchorHighlightOptions, M as DocumentChange, N as DocumentEditingMode, O as DocumentHandle, D as DocumentSource, i as Editor, P as EditorAnchorNavigation, e as EditorCommand, Q as EditorCommandShape, U as EditorCommands, V as EditorError, W as EditorEvents, E as EditorFontError, X as EditorFontErrorCode, Y as EditorFormatPainterCommands, _ as EditorHeaderFooterCommands, $ as EditorHighlights, a0 as EditorNoteCommands, a1 as EditorPosition, a2 as EditorQueries, a3 as EditorQuery, a4 as EditorQueryResults, a5 as EditorReviewHits, a6 as EditorSelection, d as EditorSnapshot, a as FontConfiguration, F as FontFaceRequest, b as FontSource, c as FontSourceSubstitution, a7 as FormatPainterLevel, a8 as FormatPainterMode, z as FormatPainterSurfaceState, a9 as FurnitureVariant, aa as HeaderFooterSlotArgs, ab as HeaderFooterState, l as HighlightHit, k as HighlightOptions, H as HighlightRange, m as HighlightRect, j as HighlightResult, ac as HyperlinkInfo, I as ImageContext, n as ImageCropPercent, ad as NoteKind, ae as NotePropertiesSide, af as NotePropertiesState, ag as PageSetup, ah as ResolveReviewChangesOptions, ai as ResolvedNoteNumbering, aj as ReviewActivationOptions, ak as ReviewChangesAttribution, al as ReviewCommentPlacement, am as ReviewCustomPlacement, R as ReviewItemHit, an as ReviewItemPlacement, ao as ReviewItemPlacementBase, ap as ReviewItemQuery, aq as ReviewItemRevealEvent, ar as ReviewItemRevealSource, as as ReviewRevisionPlacement, g as ScrollPlacement, S as ScrollToAnchorOptions, p as SelectedImageState, at as SetReviewChangesAuthorOptions, B as TableBorderEdgeTarget, G as TableBorderSpec, J as TableBorderStyle, au as TableBorderTarget, av as TableCellVerticalAlignment, aw as TableColumnDividerResizeTarget, ax as TableColumnOccurrenceTarget, K as TableContext, ay as TableRightEdgeResizeTarget, az as TableRowOccurrenceTarget, T as TextMatch, q as TrackedChangeFilterMode, r as TrackedChangePredicate, aA as ZoomFitTarget, Z as ZoomMode } from '../editor-Ci7IZGmG.js';
13
+ export { B as Block, r as ColorValue, C as CommentRecord, m as ContainerRef, s as ContentControl, n as ContentControlFilter, i as ContentControlType, t as DocAnchor, u as DocAnchorRange, q as DocComment, v as DocLocation, o as DocRange, j as DocTarget, w as DocumentBody, D as DocxDocument, av as DocxDocumentJSON, aw as DrawingHorizontalReferenceFrame, am as DrawingKind, ap as DrawingLocks, ao as DrawingPositionInput, ax as DrawingVerticalReferenceFrame, x as ExecErrorCode, E as ExecResult, l as Extent, ay as FontDefinition, H as HeaderFooterSet, an as ImageWrapTarget, y as IndentFormatting, I as InsertableContentControlType, az as NumberingRef, aA as PageMargins, P as Paragraph, aB as ParagraphDisagreements, z as ParagraphFlags, aq as ParagraphFormatCommand, A as ParagraphTabStop, aC as Point, as as Rect, c as ReviewCommentItem, d as ReviewCustomItem, a as ReviewItem, e as ReviewPosition, f as ReviewRange, b as ReviewRevisionItem, g as ReviewRevisionKind, p as Revision, h as RevisionAddress, a3 as RevisionAuthorResult, a6 as RevisionBatchResult, F as RevisionType, aD as Run, k as RunFormatting, G as Section, J as SectionProperties, at as SelectionPin, K as StyleDefinition, S as StyleDefinitions, T as Table, aE as TableCell, aF as TableRow, L as Theme, M as ThemeColorScheme, au as Unsubscribe, ar as Watermark } from '../types-barrel-D3xCgQX6.js';
4
14
  export { ContentControlSummary, DocEdits, DocQueries, DocQueryResults, ParagraphSummary } from './document.js';
5
15
  export { b as EditorExecOptions, E as EditorScope, H as HistoryDiagnostic, a as HistoryGroup, c as HistoryGroupOutcome, V as ViewScope } from '../editor-scope-OHPwVQ5l.js';
6
16
  export { InteractionAffinity, InteractionOutcome, InteractionOutcomeCode, SemanticIdentity, SemanticTarget } from './interaction.js';
7
- export { S as SemanticPosition, a as SemanticSelection } from '../semantic-interaction-G0bjmmmk.js';
8
- export { b as ImageResourceState, P as PreservedImageMime, R as RenderableImageMime, S as SupportedImageMime, V as ValidatedImageBytesHandle, c as VectorImageMime } from '../image-resources-BDFxcu7W.js';
9
- import '../document-protection-9zpIHWTE.js';
10
- import '../failure-BIPVQbRm.js';
11
- import '../semantic-records-B9OolWGN.js';
12
- import '../omml-equation-DuczgG5o.js';
17
+ export { S as SemanticPosition, a as SemanticSelection } from '../semantic-interaction-CIC-PooQ.js';
18
+ export { b as ImageResourceState, P as PreservedImageMime, R as RenderableImageMime, S as SupportedImageMime, V as ValidatedImageBytesHandle, c as VectorImageMime } from '../image-resources-BN-hUgCn.js';
19
+ import '../document-protection-BAGVGqaP.js';
20
+ import '../failure-NS2lsya4.js';
21
+ import '../semantic-records-4B3WwFAi.js';
22
+ import '../omml-equation-CuzBL5DD.js';
@@ -1,3 +1,32 @@
1
+ /**
2
+ * `@docx-editor.dev/core/contracts/interaction` — semantic addressing and interaction outcomes.
3
+ *
4
+ * Semantic identities and targets: the vocabulary a caller uses to say WHICH text it means,
5
+ * independent of layout, DOM or any editing engine's positions. Plus the outcome type an
6
+ * interaction attempt answers with. That is the whole module.
7
+ *
8
+ * It used to be 599 lines. An "interaction frame" lived here — a revision-tagged projection
9
+ * of display, page geometry, caret and selection overlays, focus, composition and
10
+ * accessibility, plus a typed pointer-intent dispatch protocol and a render IR of glyph
11
+ * runs — and every one of those declarations was consumed by exactly nothing. They
12
+ * described an architecture the engine does not use: the paginated surface owns pointer
13
+ * interaction internally and paints through `Editor.attach`, so no frame was ever published
14
+ * and no intent ever dispatched.
15
+ * THREE of them (`CaretGeometry`, `HitTestOptions`, `ShapedCluster`) also collided by name
16
+ * with the REAL, differently-shaped types in `layout/`, so the published contract carried a
17
+ * second definition of a live concept and `import { ShapedCluster }` meant different things
18
+ * depending on which module you reached for.
19
+ * `InteractionFrameId` and a frame-tagged `SemanticSelection` outlived that cut. Both were
20
+ * the same mistake: the id was a placeholder nothing ever minted (`focus` returned a literal
21
+ * `{ value: 0 }`), and the selection could not be CONSTRUCTED without one, which made it a
22
+ * fourth name-collision with the real `SemanticSelection` in `layout/` that a caller could
23
+ * never actually satisfy.
24
+ *
25
+ * CONTRACT ONLY — declarations, not an implementation.
26
+ *
27
+ * @packageDocumentation
28
+ * @public
29
+ */
1
30
  import { V as ViewScope } from '../editor-scope-OHPwVQ5l.js';
2
31
  export { E as EditorScope } from '../editor-scope-OHPwVQ5l.js';
3
32