@arbidocs/blocks 0.4.101 → 0.4.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-6MG62I5B.cjs +272 -0
- package/dist/chunk-6MG62I5B.cjs.map +1 -0
- package/dist/chunk-EQB3WELX.js +269 -0
- package/dist/chunk-EQB3WELX.js.map +1 -0
- package/dist/document-tools/AdoptSignatureDialog.d.ts +25 -0
- package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
- package/dist/document-tools/SignatureRequestBanner.d.ts +18 -0
- package/dist/document-tools/index.cjs +175 -0
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.ts +3 -1
- package/dist/document-tools/index.js +168 -3
- package/dist/document-tools/index.js.map +1 -1
- package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +26 -0
- package/dist/document-tools/viewer/SignatureFieldsOverlay.d.ts +41 -0
- package/dist/document-tools/viewer/SignatureRequestEditor.d.ts +26 -0
- package/dist/document-tools/viewer/index.cjs +983 -0
- package/dist/document-tools/viewer/index.cjs.map +1 -1
- package/dist/document-tools/viewer/index.d.ts +3 -0
- package/dist/document-tools/viewer/index.js +983 -5
- package/dist/document-tools/viewer/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/LICENSE +21 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs +751 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.cts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.ts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js +716 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +1759 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +1736 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs +1692 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.cts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.ts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.js +1664 -0
- package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs +1852 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.cts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.ts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.js +1822 -0
- package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.cts +82 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.ts +82 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs +1627 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.cts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.ts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.js +1612 -0
- package/node_modules/@arbidocs/coedit/dist/template.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.cts +8 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.ts +8 -0
- package/node_modules/@arbidocs/coedit/package.json +68 -0
- package/node_modules/@docx-editor.dev/core/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/core/README.md +125 -0
- package/node_modules/@docx-editor.dev/core/THIRD_PARTY_NOTICES.md +56 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +162 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +164 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2GO5T2JU.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2RC2EPND.js +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-5CSUYANV.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6APGXLBB.cjs +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6AWEKBLB.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6EYYL7FL.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6JIJOZDW.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-BTQKU64Q.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-E7BQA6UP.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ETTO6GK3.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-K5U2PLDP.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O2AL2HSJ.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-QMLCVPCD.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RIYSCEFQ.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-S6J4O5XP.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-SRPILEWV.cjs +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-TSLBZ26X.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-UKVVUHZL.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VDNNLG6X.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-Z6WBFXJU.js +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ZUHOMK52.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +270 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +269 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +290 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +22 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +103 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +11 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/custom-node-writes-cvL5rhcD.d.ts +323 -0
- package/node_modules/@docx-editor.dev/core/dist/dist-PKZR6RSH.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/document-protection-BAGVGqaP.d.ts +20 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-Ci7IZGmG.d.ts +2448 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.css +15 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +1394 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/export.d.ts +391 -0
- package/node_modules/@docx-editor.dev/core/dist/export.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/failure-NS2lsya4.d.ts +115 -0
- package/node_modules/@docx-editor.dev/core/dist/font-resolver-BVQB14qT.d.ts +256 -0
- package/node_modules/@docx-editor.dev/core/dist/harfbuzz.wasm +0 -0
- package/node_modules/@docx-editor.dev/core/dist/headless-document-view-qH331moE.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/image-resources-BN-hUgCn.d.ts +211 -0
- package/node_modules/@docx-editor.dev/core/dist/index-Bsg7oIKP.d.ts +3869 -0
- package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/index.d.ts +53 -0
- package/node_modules/@docx-editor.dev/core/dist/index.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout-shaping-BEyuiQOk.d.ts +246 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +3151 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/node-module-shim-TTKTT66I.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/note-properties-4Y9o6Gyk.d.ts +68 -0
- package/node_modules/@docx-editor.dev/core/dist/omml-equation-CuzBL5DD.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/output.d.ts +97 -0
- package/node_modules/@docx-editor.dev/core/dist/output.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/protocol-Bqk4Izjc.d.ts +1651 -0
- package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +128 -0
- package/node_modules/@docx-editor.dev/core/dist/review-paragraph-order-DT-n6ouC.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +242 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-cell-selection-D9D1KSXq.d.ts +464 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-interaction-CIC-PooQ.d.ts +135 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-paint-BME37OMv.d.ts +326 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-record-queries-CBlZqZNa.d.ts +177 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-records-4B3WwFAi.d.ts +3532 -0
- package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/store.d.ts +2706 -0
- package/node_modules/@docx-editor.dev/core/dist/store.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-package-fragment-BeeKxDw8.d.ts +1201 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-session-contract-CVbmlMlq.d.ts +664 -0
- package/node_modules/@docx-editor.dev/core/dist/types-barrel-D3xCgQX6.d.ts +4269 -0
- package/node_modules/@docx-editor.dev/core/licenses/HarfBuzz-COPYING.txt +42 -0
- package/node_modules/@docx-editor.dev/core/package.json +140 -0
- package/node_modules/@docx-editor.dev/react/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/react/README.md +141 -0
- package/node_modules/@docx-editor.dev/react/THIRD_PARTY_NOTICES.md +18 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.mts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.ts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.js +4 -0
- package/node_modules/@docx-editor.dev/react/dist/index.mjs +4 -0
- package/node_modules/@docx-editor.dev/react/package.json +74 -0
- package/node_modules/@docx-editor.dev/react/src/styles/editor.css +6 -0
- package/node_modules/@docx-editor.dev/react/src/styles/zIndex.ts +28 -0
- package/package.json +26 -15
|
@@ -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};
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
+
exports.a=O;exports.b=q;exports.c=$;exports.d=it;
|
|
@@ -0,0 +1 @@
|
|
|
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}});
|
|
@@ -0,0 +1,270 @@
|
|
|
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';
|
|
21
|
+
import '../editor-scope-OHPwVQ5l.js';
|
|
22
|
+
|
|
23
|
+
/** Attribute name as the journal addresses it. Prefix is authored fidelity, not identity. @public */
|
|
24
|
+
interface CanonicalAttributeName {
|
|
25
|
+
readonly namespaceUri: string;
|
|
26
|
+
readonly localName: string;
|
|
27
|
+
readonly prefix?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Content-addressed binary part reference. Bytes stay out of the journal. @public */
|
|
30
|
+
interface CanonicalBinaryDescriptor {
|
|
31
|
+
readonly storageKey: string;
|
|
32
|
+
readonly digest: string;
|
|
33
|
+
readonly size: number;
|
|
34
|
+
readonly mediaType: string;
|
|
35
|
+
}
|
|
36
|
+
/** Text node shell. Value arrives later through `spliceText`. @public */
|
|
37
|
+
interface CanonicalTextNodeDescriptor {
|
|
38
|
+
readonly logicalId: string;
|
|
39
|
+
readonly kind: 'textValue';
|
|
40
|
+
}
|
|
41
|
+
/** OOXML element shell. Attributes, bindings, and children arrive as later effects. @public */
|
|
42
|
+
interface CanonicalElementNodeDescriptor {
|
|
43
|
+
readonly logicalId: string;
|
|
44
|
+
readonly kind: OoxmlElement['kind'];
|
|
45
|
+
readonly qname: CanonicalAttributeName;
|
|
46
|
+
}
|
|
47
|
+
/** Immutable node record required to create a registry entry. @public */
|
|
48
|
+
type CanonicalNodeDescriptor = CanonicalTextNodeDescriptor | CanonicalElementNodeDescriptor;
|
|
49
|
+
/** One relationship as the journal records it. @public */
|
|
50
|
+
interface CanonicalRelationshipRecord {
|
|
51
|
+
readonly ownerPart: string;
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly type: string;
|
|
54
|
+
readonly rawTarget: string;
|
|
55
|
+
readonly targetMode: 'Internal' | 'External';
|
|
56
|
+
readonly order: number;
|
|
57
|
+
}
|
|
58
|
+
/** One compositional tree or package effect captured from a canonical write. @public */
|
|
59
|
+
type CanonicalPrimitiveEffect = {
|
|
60
|
+
readonly kind: 'putNode';
|
|
61
|
+
readonly descriptor: CanonicalNodeDescriptor;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: 'spliceText';
|
|
64
|
+
readonly logicalId: string;
|
|
65
|
+
readonly utf16Start: number;
|
|
66
|
+
readonly deleteCount: number;
|
|
67
|
+
readonly insert: string;
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: 'setAttribute';
|
|
70
|
+
readonly logicalId: string;
|
|
71
|
+
readonly qname: CanonicalAttributeName;
|
|
72
|
+
readonly value: string | null;
|
|
73
|
+
} | {
|
|
74
|
+
readonly kind: 'setNamespaceBinding';
|
|
75
|
+
readonly logicalId: string;
|
|
76
|
+
readonly prefix: string;
|
|
77
|
+
readonly uri: string | null;
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: 'spliceChildren';
|
|
80
|
+
readonly parentLogicalId: string;
|
|
81
|
+
readonly start: number;
|
|
82
|
+
readonly deleteCount: number;
|
|
83
|
+
readonly childLogicalIds: readonly string[];
|
|
84
|
+
} | {
|
|
85
|
+
readonly kind: 'moveNode';
|
|
86
|
+
readonly logicalId: string;
|
|
87
|
+
readonly destinationParentLogicalId: string;
|
|
88
|
+
readonly destinationIndex: number;
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: 'putXmlPart';
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly rootLogicalId: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: 'deleteXmlPart';
|
|
95
|
+
readonly name: string;
|
|
96
|
+
} | {
|
|
97
|
+
readonly kind: 'putRelationship';
|
|
98
|
+
readonly owner: string;
|
|
99
|
+
readonly record: CanonicalRelationshipRecord;
|
|
100
|
+
} | {
|
|
101
|
+
readonly kind: 'deleteRelationship';
|
|
102
|
+
readonly owner: string;
|
|
103
|
+
readonly relationshipId: string;
|
|
104
|
+
} | {
|
|
105
|
+
readonly kind: 'putContentTypeOverride';
|
|
106
|
+
readonly partName: string;
|
|
107
|
+
readonly mediaType: string;
|
|
108
|
+
} | {
|
|
109
|
+
readonly kind: 'deleteContentTypeOverride';
|
|
110
|
+
readonly partName: string;
|
|
111
|
+
} | {
|
|
112
|
+
readonly kind: 'putBinary';
|
|
113
|
+
readonly descriptor: CanonicalBinaryDescriptor;
|
|
114
|
+
} | {
|
|
115
|
+
readonly kind: 'deleteBinary';
|
|
116
|
+
readonly storageKey: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* One immutable journal for one `TreePackageStore` transaction.
|
|
120
|
+
*
|
|
121
|
+
* Empty only when a committed write used a path the journal does not yet intercept.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
interface CanonicalPrimitiveJournal {
|
|
126
|
+
readonly effects: readonly CanonicalPrimitiveEffect[];
|
|
127
|
+
}
|
|
128
|
+
/** The history group the transaction behind `journal` named, if any. @public */
|
|
129
|
+
declare function historyGroupOfJournal(journal: CanonicalPrimitiveJournal): HistoryGroup | undefined;
|
|
130
|
+
|
|
131
|
+
/** Options for a canonical collaboration document port. @public */
|
|
132
|
+
interface CreateCollaborationDocumentPortOptions {
|
|
133
|
+
readonly documentId: string;
|
|
134
|
+
}
|
|
135
|
+
/** Create the narrow collaboration view over one canonical package store. @public */
|
|
136
|
+
declare function createCollaborationDocumentPort(store: TreePackageStore, options: CreateCollaborationDocumentPortOptions): CollaborationDocumentPort;
|
|
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
|
+
|
|
153
|
+
/** An editor-local view action must stay between the same document undo entries. */
|
|
154
|
+
interface UndoHistoryPosition {
|
|
155
|
+
current(): object | null;
|
|
156
|
+
/** End capture and discard the abandoned redo branch without changing document content. */
|
|
157
|
+
split(): void;
|
|
158
|
+
}
|
|
159
|
+
/** Register a document history authority for editor-local undo actions. @internal */
|
|
160
|
+
declare function registerUndoHistoryPosition(owner: object, position: UndoHistoryPosition): void;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* `@docx-editor.dev/core/collaboration/replication` — the seam a replication implementation
|
|
164
|
+
* binds to, not the surface a host consumes.
|
|
165
|
+
*
|
|
166
|
+
* Everything here exists for the layer BETWEEN a CRDT and the canonical tree: the document
|
|
167
|
+
* port an adapter writes through, the primitive journal it reads, and the descriptors that
|
|
168
|
+
* journal is made of. A host that renders presence and reads a status needs none of it, which
|
|
169
|
+
* is why it lives behind its own subpath — autocomplete on
|
|
170
|
+
* `@docx-editor.dev/core/collaboration` should not offer `putXmlPart` and `spliceChildren` to
|
|
171
|
+
* somebody wiring up an avatar stack.
|
|
172
|
+
*
|
|
173
|
+
* Reach for this when you are writing a provider. `@docx-editor.dev/pro` is one.
|
|
174
|
+
*
|
|
175
|
+
* @packageDocumentation
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
/** One existing body paragraph exposed to the replication adapter. @public */
|
|
180
|
+
interface CollaborationParagraph {
|
|
181
|
+
/** Uppercase `w14:paraId`, stable across save and reopen. */
|
|
182
|
+
readonly paragraphId: string;
|
|
183
|
+
/** Replica-local canonical node identity. Never sent as wire identity. */
|
|
184
|
+
readonly nodeId: string;
|
|
185
|
+
/** Current canonical UTF-16 text. */
|
|
186
|
+
readonly text: string;
|
|
187
|
+
}
|
|
188
|
+
/** Attribution for one collaboration-derived canonical publication. @public */
|
|
189
|
+
interface CollaborationMutation {
|
|
190
|
+
readonly origin: string;
|
|
191
|
+
readonly actorId: string;
|
|
192
|
+
readonly operationId: string;
|
|
193
|
+
}
|
|
194
|
+
/** One paragraph text value in an atomic collaboration publication. @public */
|
|
195
|
+
interface CollaborationParagraphTextUpdate {
|
|
196
|
+
readonly paragraphId: string;
|
|
197
|
+
readonly text: string;
|
|
198
|
+
}
|
|
199
|
+
/** Result of replacing one supported paragraph's canonical text. @public */
|
|
200
|
+
type CollaborationApplyResult = {
|
|
201
|
+
readonly ok: true;
|
|
202
|
+
readonly changed: boolean;
|
|
203
|
+
} | {
|
|
204
|
+
readonly ok: false;
|
|
205
|
+
readonly reason: string;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Narrow canonical document capability handed to a collaboration implementation.
|
|
209
|
+
*
|
|
210
|
+
* It deliberately exposes no mutable package or tree store. Every write returns through the
|
|
211
|
+
* same validated transaction path as browser and automation edits.
|
|
212
|
+
*
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
interface CollaborationDocumentPort {
|
|
216
|
+
readonly documentId: string;
|
|
217
|
+
paragraphs(): readonly CollaborationParagraph[];
|
|
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;
|
|
224
|
+
/**
|
|
225
|
+
* Resolve a stable `w14:paraId` in any story this replica holds.
|
|
226
|
+
*
|
|
227
|
+
* `paragraphs()` stays body-only because text publication transacts against the body
|
|
228
|
+
* store. Presence may name a header, a footer, a note, or a cell, so this lookup covers
|
|
229
|
+
* those parts too. It resolves through an index, not a scan, because a remote caret
|
|
230
|
+
* resolves two addresses per selection on every caret move.
|
|
231
|
+
*/
|
|
232
|
+
paragraphByStableId(paragraphId: string): CollaborationParagraph | null;
|
|
233
|
+
applyParagraphText(paragraphId: string, text: string, mutation: CollaborationMutation): CollaborationApplyResult;
|
|
234
|
+
applyParagraphTexts(updates: readonly CollaborationParagraphTextUpdate[], mutation: CollaborationMutation): CollaborationApplyResult;
|
|
235
|
+
/**
|
|
236
|
+
* Publish one remotely materialized canonical package as one revision.
|
|
237
|
+
*
|
|
238
|
+
* The package is frozen canonical state. This port exposes no mutable store or CRDT.
|
|
239
|
+
*/
|
|
240
|
+
applyRemotePackage(pkg: OoxmlPackage, mutation: CollaborationMutation): CollaborationApplyResult;
|
|
241
|
+
revision(): number;
|
|
242
|
+
subscribe(listener: (change: TreeModelChange) => void): () => void;
|
|
243
|
+
/**
|
|
244
|
+
* Observe one settled primitive journal per committed canonical transaction.
|
|
245
|
+
*
|
|
246
|
+
* Disabled observation allocates no journal. This is the collaboration write seam;
|
|
247
|
+
* adapters never write a CRDT through this port.
|
|
248
|
+
* Preserve the journal object's identity and deliver it synchronously to local capture.
|
|
249
|
+
* `historyGroupOfJournal` reads local identity metadata, outside replicated state.
|
|
250
|
+
* Cloning, spreading, serialization or postMessage loses that metadata. Custom worker
|
|
251
|
+
* ports must map local gesture identities explicitly; a serialized journal alone cannot
|
|
252
|
+
* preserve gesture grouping or synchronous `ExecResult.history` reporting.
|
|
253
|
+
*/
|
|
254
|
+
observePrimitiveJournal(listener: (journal: CanonicalPrimitiveJournal) => void): () => void;
|
|
255
|
+
/** True when a committed journal has not yet been frozen or delivered to observers. */
|
|
256
|
+
hasPendingJournals(): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Freeze and deliver queued journals in production order.
|
|
259
|
+
*
|
|
260
|
+
* Local edit, layout, and paint do not wait for this. Tests and teardown call it
|
|
261
|
+
* instead of sleeping on the publication timer.
|
|
262
|
+
*/
|
|
263
|
+
flushPendingJournals(): void;
|
|
264
|
+
save(): Uint8Array;
|
|
265
|
+
/** Bytes of one binary package part, or null when the part is absent. */
|
|
266
|
+
binaryPart(storageKey: string): Uint8Array | null;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export { HistoryGroup, createCollaborationDocumentPort, historyGroupOfJournal, mapOffsetAcrossText, registerUndoHistoryPosition };
|
|
270
|
+
export type { CanonicalAttributeName, CanonicalBinaryDescriptor, CanonicalElementNodeDescriptor, CanonicalNodeDescriptor, CanonicalPrimitiveEffect, CanonicalPrimitiveJournal, CanonicalRelationshipRecord, CanonicalTextNodeDescriptor, CollaborationApplyResult, CollaborationDocumentPort, CollaborationMutation, CollaborationParagraph, CollaborationParagraphTextUpdate, CreateCollaborationDocumentPortOptions };
|
|
@@ -0,0 +1 @@
|
|
|
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';
|
|
@@ -0,0 +1 @@
|
|
|
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;
|