@docx-editor.dev/core 2.11.0 → 2.12.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.
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +5 -5
- package/dist/automation.d.ts +5 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +8 -8
- package/dist/binding.d.ts +8 -8
- package/dist/binding.js +1 -1
- package/dist/{chunk-EJATEGJZ.cjs → chunk-3JON7JMD.cjs} +1 -1
- package/dist/{chunk-GRDFEH5Q.cjs → chunk-5V6FNKBE.cjs} +1 -1
- package/dist/chunk-BXRVGHTY.cjs +18 -0
- package/dist/chunk-BXTTPJSH.js +5 -0
- package/dist/chunk-ILTZTY3K.cjs +10 -0
- package/dist/chunk-IUM7FZPA.js +2 -0
- package/dist/chunk-JWZG4QJ5.cjs +2 -0
- package/dist/chunk-JXZYDBKU.cjs +19 -0
- package/dist/chunk-KBOOIC2Q.js +19 -0
- package/dist/chunk-L6XZTLPS.js +10 -0
- package/dist/chunk-L7OR5TJK.cjs +5 -0
- package/dist/chunk-MHQNR2OU.js +2 -0
- package/dist/chunk-MLGPISGH.js +1 -0
- package/dist/chunk-NJXQABQU.js +18 -0
- package/dist/chunk-TKEGK4GQ.cjs +2 -0
- package/dist/chunk-VGFMPWND.js +2 -0
- package/dist/{chunk-BP7ANXGA.js → chunk-W77HJGYX.js} +1 -1
- package/dist/{chunk-WPQMPHNR.cjs → chunk-XCFM3G5L.cjs} +1 -1
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.cts +3 -3
- package/dist/collaboration/replication.d.ts +3 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.cts +3 -3
- package/dist/collaboration.d.ts +3 -3
- package/dist/contracts/editor.d.cts +7 -7
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.cts +7 -7
- package/dist/contracts/interaction.d.ts +7 -7
- package/dist/contracts/modules.d.cts +7 -7
- package/dist/contracts/modules.d.ts +7 -7
- package/dist/{custom-node-writes-JfTn-Sy6.d.ts → custom-node-writes-CcNeHH5C.d.ts} +2 -2
- package/dist/{custom-node-writes-CwkYRw3V.d.cts → custom-node-writes-D4rMJIES.d.cts} +2 -2
- package/dist/{editor-C8edZgy5.d.cts → editor-B76SEMZw.d.cts} +3 -3
- package/dist/{editor-BogcVHXk.d.ts → editor-BcdsPdbY.d.ts} +3 -3
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.cts +56 -23
- package/dist/editor.d.ts +56 -23
- package/dist/editor.js +1 -1
- package/dist/{index-BNv-ZLQP.d.ts → index-BYTvklN5.d.ts} +12 -12
- package/dist/{index-Dn0lOp9Z.d.cts → index-CDGhPib1.d.cts} +12 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +29 -18
- package/dist/layout.d.ts +29 -18
- package/dist/layout.js +1 -1
- package/dist/{note-properties-BmoSdyKS.d.ts → note-properties-Bx7rXruA.d.ts} +1 -1
- package/dist/{note-properties-BvGfHk5e.d.cts → note-properties-zQ8w04en.d.cts} +1 -1
- package/dist/{omml-equation-Ciq5rgb7.d.ts → omml-equation-69O1Pd8G.d.ts} +1 -1
- package/dist/{omml-equation-CqQOt_dD.d.cts → omml-equation-BmV51rim.d.cts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -6
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-Ckl7hWsv.d.ts → protocol-DC7ueVuo.d.ts} +2 -2
- package/dist/{protocol-BB-WP3zk.d.cts → protocol-FTXtrAIT.d.cts} +2 -2
- package/dist/{review-items-CkYyXhXM.d.ts → review-items-B78OsJU2.d.ts} +1 -1
- package/dist/{review-items-BdeLNRi2.d.cts → review-items-C-2WQdEb.d.cts} +1 -1
- package/dist/{review-reads-BOLSBm5w.d.cts → review-reads-CbBQlb-n.d.cts} +2 -2
- package/dist/{review-reads-Crf0Xn42.d.ts → review-reads-UexYBp-m.d.ts} +2 -2
- package/dist/{revision-projection-C2S8PSQm.d.cts → revision-projection-6u8lae9J.d.cts} +1 -1
- package/dist/{revision-projection-Ae2CWa8E.d.ts → revision-projection-B2v9U3qx.d.ts} +1 -1
- package/dist/{semantic-cell-selection-DdmoxC-y.d.ts → semantic-cell-selection-DsYz2Vg3.d.ts} +4 -4
- package/dist/{semantic-cell-selection-C0OFD4D9.d.cts → semantic-cell-selection-nEE7E3Z8.d.cts} +4 -4
- package/dist/{semantic-interaction-COyhZ9WH.d.ts → semantic-interaction-C00BpIyC.d.ts} +1 -1
- package/dist/{semantic-interaction-Cs2jErnt.d.cts → semantic-interaction-DiOX0FIH.d.cts} +1 -1
- package/dist/{semantic-paint-UHaj3sBY.d.cts → semantic-paint-Cc11nrDL.d.cts} +2 -2
- package/dist/{semantic-paint-vA-oLSdV.d.ts → semantic-paint-ofuoBsYo.d.ts} +2 -2
- package/dist/{semantic-records-5AOQJmLX.d.cts → semantic-records-CRG1r6-a.d.cts} +3 -3
- package/dist/{semantic-records-9xhwbJ23.d.ts → semantic-records-CzI0ZEuR.d.ts} +3 -3
- package/dist/{shaped-measurer-vzsY88oK.d.ts → shaped-measurer-CkOGZQn9.d.ts} +1 -1
- package/dist/{shaped-measurer-NeF2mPSu.d.cts → shaped-measurer-CneACGcP.d.cts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +19 -13
- package/dist/store.d.ts +19 -13
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-BPyXNxyL.d.cts → tree-op-types-CA7qgAUF.d.cts} +42 -9
- package/dist/{tree-op-types-DnzAOnc9.d.ts → tree-op-types-HKfUzt_-.d.ts} +42 -9
- package/dist/{tree-package-fragment-BjZ3RWAS.d.cts → tree-package-fragment-Cz-v-0B3.d.cts} +2 -2
- package/dist/{tree-package-fragment-CDER0G3B.d.ts → tree-package-fragment-oJZX_5iN.d.ts} +2 -2
- package/dist/{tree-session-contract-DhdsFT_z.d.ts → tree-session-contract-BPDLrEPX.d.ts} +5 -5
- package/dist/{tree-session-contract-BF2FVBOM.d.cts → tree-session-contract-Cbl87xa8.d.cts} +5 -5
- package/dist/{tree-store-CNZ3O83s.d.ts → tree-store-B7hd6cEa.d.ts} +1 -1
- package/dist/{tree-store-DfZi7FqY.d.cts → tree-store-BenW0Mg_.d.cts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-34BNQUD4.js +0 -10
- package/dist/chunk-5AVHO75P.cjs +0 -19
- package/dist/chunk-6HMSC7UV.js +0 -2
- package/dist/chunk-76Y3Y45J.cjs +0 -2
- package/dist/chunk-CRZR6K5Z.js +0 -19
- package/dist/chunk-GWV65NQW.cjs +0 -10
- package/dist/chunk-GXLZCXEH.js +0 -2
- package/dist/chunk-JUQOPVSK.cjs +0 -2
- package/dist/chunk-LAETEBHD.js +0 -1
- package/dist/chunk-M6Z3KFXM.cjs +0 -5
- package/dist/chunk-UQFOYZJO.cjs +0 -18
- package/dist/chunk-WXQ245MQ.js +0 -18
- package/dist/chunk-WZHIFNSU.js +0 -5
- package/dist/chunk-X7A5XART.js +0 -2
package/dist/chunk-WZHIFNSU.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {f,x,B,A,s,r,q,o,p,ha,y,na,oa,W as W$1,Z,ga}from'./chunk-X7A5XART.js';import {b as b$1,a}from'./chunk-BP7ANXGA.js';import {Jf,b,Ef,Ca,Sb,yb,xa,zd,yd,vg,Bd,ed,Cd,Uf,wc,Tb,Xg,uc,tc,E as E$1,Xf,Yf,yc,Me,If,rc,zc,ca,Ed,Ze,Ab,Bc,sb,rb,kc,mc}from'./chunk-34BNQUD4.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 _(t){return t.attributes?.val}function F(t){let e=_(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var Yn=/^[0-9A-Fa-f]{6}$/,me=/^\d{1,6}$/,Un=/^-?\d{1,6}$/;function we(t){return t===void 0||t==="auto"?null:Yn.test(t)?`#${t}`:null}var Wn={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"},Gn={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 Xn(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function z(t,e=false){return t===void 0||!(e?Un:me).test(t)?null:`${Number(t)/20}pt`}function Vt(t){let e=[],n=[],r=null,l=null;for(let a of t)switch(a.localName){case "b":e.push(`font-weight:${F(a)?"bold":"normal"}`);break;case "i":e.push(`font-style:${F(a)?"italic":"normal"}`);break;case "u":{let o=_(a)??"single";if(o==="none"||!F(a))break;n.push("underline"),r=Wn[o]??"solid",l=we(a.attributes?.color);break}case "strike":F(a)&&n.push("line-through");break;case "dstrike":F(a)&&n.push("line-through");break;case "caps":F(a)&&e.push("text-transform:uppercase");break;case "smallCaps":F(a)&&e.push("font-variant:small-caps");break;case "vertAlign":{let o=_(a);o==="superscript"?e.push("vertical-align:super","font-size:0.75em"):o==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let o=we(_(a));o&&e.push(`color:${o}`);break}case "highlight":{let o=Gn[_(a)??""];o&&e.push(`background-color:${o}`);break}case "sz":{let o=_(a);o!==void 0&&me.test(o)&&e.push(`font-size:${Number(o)/2}pt`);break}case "rFonts":{let o=Xn(a.attributes?.ascii??a.attributes?.hAnsi);o&&e.push(`font-family:${o}`);break}case "spacing":{let o=z(_(a),true);o&&e.push(`letter-spacing:${o}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),r&&e.push(`text-decoration-style:${r}`),l&&e.push(`text-decoration-color:${l}`)),e.join(";")}var Jn={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Zt(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let r=Jn[_(n)??""];r&&e.push(`text-align:${r}`);break}case "ind":{let r=z(n.attributes?.left??n.attributes?.start,true),l=z(n.attributes?.right??n.attributes?.end,true),a=z(n.attributes?.firstLine),o=z(n.attributes?.hanging);r&&e.push(`margin-left:${r}`),l&&e.push(`margin-right:${l}`),a?e.push(`text-indent:${a}`):o&&e.push(`text-indent:-${o}`);break}case "spacing":{let r=z(n.attributes?.before),l=z(n.attributes?.after);r&&e.push(`margin-top:${r}`),l&&e.push(`margin-bottom:${l}`);let a=n.attributes?.line,o=n.attributes?.lineRule;a!==void 0&&me.test(a)&&o!=="exact"&&o!=="atLeast"?e.push(`line-height:${(Number(a)/240).toFixed(3)}`):a!==void 0&&me.test(a)&&e.push(`line-height:${Number(a)/20}pt`);break}case "shd":{let r=we(n.attributes?.fill);r&&e.push(`background-color:${r}`);break}case "pageBreakBefore":F(n)&&e.push("break-before:page");break;}return e.join(";")}var N=new Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Zt(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=Vt(e);return ["span",{"data-run-props":Vn(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=Zn(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function Vn(t){return JSON.stringify(Array.isArray(t)?t:[])}function Zn(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 l=r;if(typeof l.localName!="string"||l.attributes!==void 0&&(typeof l.attributes!="object"||l.attributes===null))return null;n.push(l.attributes===void 0?{localName:l.localName}:{localName:l.localName,attributes:l.attributes});}return n}catch{return null}}function Ae(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function ge(t,e){return JSON.stringify(ye(t))===JSON.stringify(ye(e))}function ye(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 Fe(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue"||n.localName==="rPrChange"||n.localName==="pPrChange")continue;let r={};for(let l of n.attributes)r[l.localName]=l.value;e.push(Object.keys(r).length>0?{localName:n.localName,attributes:r}:{localName:n.localName});}return e}function Qt(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 Y(t){if(t.kind==="textValue")return [];let e=[],n=r=>{if(r.kind!=="run")return;let l=r.children.find(o=>o.kind==="runProperties"),a=Fe(l);for(let o of r.children)if(o.kind!=="runProperties"){if(o.kind==="tab"){e.push({kind:"tab"});continue}if(o.kind==="hardBreak"){e.push(Bc(o)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(o.kind==="text"){let m="";for(let f of o.children)f.kind==="textValue"&&(m+=f.value);m.length>0&&e.push({kind:"text",text:m,props:a});continue}e.push({kind:"unknown",nodeId:o.id,label:Qt(o)});}};return rc(t.children,0,r=>{if(r.kind==="run"){n(r);return}e.push({kind:"unknown",nodeId:r.id,label:Qt(r)});}),e}function L(t){let e=[],n=r=>{if(r.kind!=="textValue"){if(r.kind==="body"){for(let l of r.children)l.kind==="paragraph"&&e.push(l);return}for(let l of r.children)n(l);}};return n(t.root),e}var qt=Jf(16),en=new WeakMap;function Qn(t,e){let n=en.get(t);if(!n){let r=[];If([t],r,0),n=Object.freeze(r),en.set(t,n);}for(let r of n)e.push(r);}function M(t){let e=qt.get(t);if(e)return e;let n=[];for(let r of Ef(t))if(r.root.kind!=="textValue")for(let l of r.root.children)Qn(l,n);return qt.set(t,n),n}function $(t){let e=L(t).map(n=>{let r=n.kind==="textValue"?void 0:n.children.find(a=>a.kind==="paragraphProperties"),l=Y(n).map(a=>{switch(a.kind){case "text":return N.text(a.text,a.props.length>0?[N.marks.runProps.create({props:a.props})]:[]);case "tab":return N.node("tab");case "hardBreak":return N.node("hardBreak");case "pageBreak":return N.node("pageBreak");default:return N.node("unknownInline",{nodeId:a.nodeId,label:a.label})}});return N.node("paragraph",{nodeId:n.id,props:Fe(r)},l)});return N.node("doc",null,e.length>0?e:[N.node("paragraph")])}function V(t){let e=[];return t.forEach(n=>{if(n.isText&&n.text){e.push({kind:"text",text:n.text,props:Ae(n)});return}n.type.name==="tab"?e.push({kind:"tab"}):n.type.name==="hardBreak"?e.push({kind:"hardBreak"}):n.type.name==="pageBreak"?e.push({kind:"pageBreak"}):n.type.name==="unknownInline"&&e.push({kind:"unknown",nodeId:String(n.attrs.nodeId??""),label:String(n.attrs.label??"")});}),e}function E(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+=zc);return e}function tn(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}`);return e}function qn(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 l=t.length,a=e.length;for(;l>n&&a>n&&t[l-1]===e[a-1];)l-=1,a-=1;return {start:n,endBefore:l,endAfter:a}}function nn(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]??[]);return e}function er(t,e,n,r,l){let a=[],o=tn(e),m=tn(n);if(JSON.stringify(o)!==JSON.stringify(m))return {ok:false,reason:"unknown-content-moved",detail:t};ge(r,l)||a.push({op:"setParagraphProperties",paragraphId:t,properties:ye(l)});let f=E(e),u=E(n),p=qn(f,u);if(p&&(p.endBefore>p.start&&a.push({op:"deleteText",paragraphId:t,start:p.start,end:p.endBefore}),p.endAfter>p.start)){let x=u.slice(p.start,p.endAfter),y=p.start,d="",h=()=>{d.length!==0&&(a.push({op:"insertText",paragraphId:t,offset:y,text:d}),y+=d.length,d="");};for(let O of x)O===" "?(h(),a.push({op:"insertTab",paragraphId:t,offset:y}),y+=1):O===`
|
|
3
|
-
`?(h(),a.push({op:"insertHardBreak",paragraphId:t,offset:y}),y+=1):O===zc?(h(),a.push({op:"insertPageBreak",paragraphId:t,offset:y}),y+=1):d+=O;h();}if(!p){let x=nn(e),y=nn(n),d=0;for(;d<y.length;){if(ge(x[d]??[],y[d])){d+=1;continue}let h=d,O=y[d];for(;d<y.length&&ge(y[d],O)&&!ge(x[d]??[],y[d]);)d+=1;a.push({op:"setRunProperties",paragraphId:t,start:h,end:d,properties:ye(O)});}}return {ok:true,ops:a}}function _e(t,e){let n=L(t),r=[];if(e.forEach(a=>{a.type.name==="paragraph"&&r.push(a);}),r.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let l=r.length-n.length;if(l===0){let a=[];for(let[o,m]of r.entries()){let f=n[o];if(m.attrs.nodeId!==f.id)return {ok:false,reason:"paragraph-reordered",detail:String(m.attrs.nodeId)};let u=er(f.id,Y(f),V(m),Fe(f.kind==="textValue"?void 0:f.children.find(p=>p.kind==="paragraphProperties")),m.attrs.props??[]);if(!u.ok)return u;a.push(...u.ops);}return {ok:true,ops:a}}return l===1?tr(n,r):l===-1?nr(n,r):{ok:false,reason:"paragraph-count-unexplained",detail:String(l)}}function tr(t,e){for(let n=0;n<t.length;n+=1){let r=t[n],l=e[n],a=e[n+1];if(!l||!a||l.attrs.nodeId!==r.id)continue;let o=a.attrs.nodeId;if(o!==null&&o!==r.id)continue;let m=E(V(l));if(m+E(V(a))===E(Y(r))&&rn(t,e,n)&&on(t,e,n+1,n+2))return {ok:true,ops:[{op:"splitParagraph",paragraphId:r.id,offset:m.length}]}}return {ok:false,reason:"split-not-clean"}}function nr(t,e){for(let n=0;n+1<t.length;n+=1){let r=t[n],l=t[n+1],a=e[n];if(!a||a.attrs.nodeId!==r.id)continue;let o=E(Y(r))+E(Y(l));if(E(V(a))===o&&rn(t,e,n)&&on(t,e,n+2,n+1))return {ok:true,ops:[{op:"joinParagraphs",firstId:r.id,secondId:l.id}]}}return {ok:false,reason:"join-not-clean"}}function rn(t,e,n){for(let r=0;r<n;r+=1){let l=e[r],a=t[r];if(!l||l.attrs.nodeId!==a.id||E(V(l))!==E(Y(a)))return false}return true}function on(t,e,n,r){for(let l=0;n+l<t.length;l+=1){let a=t[n+l],o=e[r+l];if(!o||o.attrs.nodeId!==a.id||E(V(o))!==E(Y(a)))return false}return true}function rr(t,e){return Ca(t,e)!==null}function Le(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return $(e);let r=new Map;t.forEach(f=>{let u=f.attrs.nodeId;typeof u=="string"&&r.set(u,f);});let l=new Set(n.dirty),a=L(e);if(a.length!==t.childCount)return $(e);let o=$(e),m=[];for(let[f,u]of a.entries()){let p=r.get(u.id);m.push(p&&!l.has(u.id)?p:o.child(f));}return N.node("doc",null,m)}function ln(t){return M(t).map(e=>Xg(t,e.id)??"").join(`
|
|
4
|
-
`)}var or=64,an=new WeakMap;function je(t,e=0){if(e>or)return false;let n=an.get(t);if(n!==void 0)return n;let r=false;for(let l of t.children)if(l.kind!=="textValue"&&(l.kind==="commentRangeStart"||l.kind==="commentReference"||je(l,e+1))){r=true;break}return an.set(t,r),r}function ar(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 sn(t,e,n){for(let l of e)if(l.ranges.length===0)return false;let r=new Set;for(let l of t)l.kind!=="revision"||l.ranges.length>0||un(l,n)||r.add(W$1(l));for(let l of e)if(r.has(W$1(l)))return false;return true}function dn(t,e,n,r){let l=e.get(n);if(l===void 0)return [...t];let a=[],o=null;for(let m of t){if(m.kind==="revision"&&un(m,n)){o===null&&(o=a.length);continue}if(o===null){let f=ar(m,e);f!==null&&f>l&&(o=a.length);}a.push(m);}if(o===null&&(o=a.length),r.length>0){let m=r.length<2?[...r]:[...r].sort((f,u)=>Z(f,e)-Z(u,e));a.splice(o,0,...m);}return ga(a)}function un(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function lr(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function ir(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function sr(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 cn(t,e,n,r,l,a,o){if(t.fromRevision!==e.bodyRevision||o!==e.packageRevision+1||t.story!==void 0&&t.story.kind!=="body"||t.impact!=="text-local"||t.dirty.length!==1||t.created.length>0||t.deleted.length>0||t.splitJoin.length>0||e.commentsPart!==l||e.commentsExtendedPart!==a)return null;let m=t.dirty[0],f=Ca(r,m);if(!f||f.kind!=="paragraph")return null;for(let u of n){if(u.kind==="comment"){if(lr(u,m))return null;continue}if(u.kind==="custom"){if(u.range?.start.paragraphId===m)return null;continue}if(ir(u,m)||sr(u,m))return null}return m}var fn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,dr=["ascii","hAnsi","cs","eastAsia"],ur=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"],cr=128,pr=/[\u0000-\u001F\u007F-\u009F]/;function j(t){return t.kind!=="textValue"}function U(t,e){return t.attributes.find(n=>n.localName===e)?.value}function mn(t,e){let n=new Map;for(let l of t)for(let a of l.children)if(j(a))for(let[o,m]of gn(a,e))n.has(o)||n.set(o,m);let r=[...n.values()];return r.sort((l,a)=>l<a?-1:l>a?1:0),r}var Be=new WeakMap,fr=16,mr=32;function gn(t,e,n=0){let r=e?.major??null,l=e?.minor??null,a=Be.get(t);if(a&&a.major===r&&a.minor===l)return a.byFold;if(t.children.length>=fr&&n<mr&&t.localName!=="rFonts"){let u=new Map;for(let p of t.children)if(j(p))for(let[x,y]of gn(p,e,n+1))u.has(x)||u.set(x,y);return Be.set(t,{major:r,minor:l,byFold:u}),u}let o=new Map,m=u=>{if(!u||!fn.test(u))return;let p=u.toLowerCase();o.has(p)||o.set(p,u);},f=[t];for(;f.length>0;){let u=f.pop();if(j(u)){if(u.localName==="rFonts"){for(let p of dr)m(U(u,p));if(e)for(let p of ur){let x=U(u,p);x!==void 0&&(x.startsWith("major")?m(e.major):x.startsWith("minor")&&m(e.minor));}}for(let p=u.children.length-1;p>=0;p-=1)f.push(u.children[p]);}}return Be.set(t,{major:r,minor:l,byFold:o}),o}function yn(t){let e=[...t];for(;e.length>0;){let n=e.pop();if(j(n)){if(n.localName==="t"&&n.namespaceUri===ca){for(let r of n.children)if(!j(r)&&r.value.length>0)return true;continue}for(let r of n.children)e.push(r);}}return false}var gr=new Set(["paragraph","character","table","numbering"]),yr=/^[0-9A-Fa-f]{6}$/,hr=16,pn=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 hn(t){return t.children}function He(t,e){for(let n of hn(t))if(j(n)&&n.localName===e)return n}function xr(t){return pn.get(t.name.toLowerCase())??pn.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function ze(t){return t===void 0||t.length===0||t.length>cr||pr.test(t)?null:t}function xn(t,e){if(!t)return [];let n=new Map;for(let a of t.children){if(!j(a)||a.localName!=="style")continue;let o=ze(U(a,"styleId"));o!==null&&!n.has(o)&&n.set(o,a);}let r=a=>{let o=false,m=false,f=null,u=false,p=false,x=new Set,y=a;for(let O=0;O<hr&&y!==null&&!x.has(y);O+=1){x.add(y);let T=n.get(y);if(!T)break;let v=He(T,"rPr");for(let R of v?hn(v):[]){if(!j(R))continue;let S=U(R,"val"),Z=S!=="0"&&S!=="false"&&S!=="off";R.localName==="b"&&!u?(o=Z,u=true):R.localName==="i"&&!p?(m=Z,p=true):R.localName==="color"&&f===null&&S&&yr.test(S)&&(f=S);}let P=He(T,"basedOn");y=P?ze(U(P,"val")):null;}let d=e?.(a),h=d?.fontFamily??null;return {fontFamily:h!==null&&fn.test(h)?h:null,fontSizePt:d?.fontSizeHalfPoints!=null&&d.fontSizeHalfPoints>0?d.fontSizeHalfPoints/2:null,bold:o,italic:m,color:f}},l=[];for(let[a,o]of n){let m=U(o,"type");if(m===void 0||!gr.has(m))continue;let f=He(o,"name"),u=ze(f?U(f,"val"):void 0);l.push({styleId:a,name:u??a,type:m,preview:r(a)});}return l.map((a,o)=>({entry:a,index:o,rank:xr(a)})).sort((a,o)=>a.rank-o.rank||a.index-o.index).map(a=>a.entry)}var kr=128,Or=/[\u0000-\u001F\u007F-\u009F]/,Pr=/[\u0000-\u001F\u007F-\u009F]/g,br=200,vr=/^heading ([1-9])$/i;function $e(t){return t.kind!=="textValue"}function ie(t,e){for(let n of t.children)if($e(n)&&n.localName===e)return n}function le(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Rr(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!$e(n)||n.localName!=="style"||le(n,"type")!=="paragraph")continue;let r=le(n,"styleId");if(r===void 0||r.length===0||r.length>kr||Or.test(r))continue;let l=ie(n,"name"),a=l?le(l,"val"):void 0,o=a!==void 0?vr.exec(a):null;if(o){e.set(r,Number(o[1])-1);continue}let m=ie(n,"pPr"),f=m?ie(m,"outlineLvl"):void 0,u=f?le(f,"val"):void 0;u!==void 0&&/^[0-8]$/.test(u)&&e.set(r,Number(u));}return e}function Ye(t){let e=ie(t,"pPr"),n=e?ie(e,"pStyle"):void 0;return n?le(n,"val"):void 0}function kn(t,e){let n=Rr(e);if(n.size===0)return [];let r=[];for(let l of L(t)){if(!$e(l))continue;let a=Ye(l);if(a===void 0)continue;let o=n.get(a);if(o===void 0)continue;let f=(Xg(t,l.id)??"").replace(Pr," ").trim().slice(0,br);f.length!==0&&r.push({text:f,level:o,blockId:l.id});}return r}var he=48,Sr=/[\u0000-\u001F\u007F-\u009F]/g;function On(t){return t.kind!=="textValue"}function xe(t){if(t.kind==="textValue")return t.value.length;if(t.kind==="tab"||t.kind==="hardBreak")return 1;if(t.kind==="runProperties"||t.kind==="generic")return 0;if(t.kind==="hyperlink"||kc(t)){let n=0,r=t.kind==="hyperlink"?t.children:mc(t)??[];for(let l of r)n+=xe(l);return n}let e=0;for(let n of t.children)e+=xe(n);return e}function Tr(t){let e=[],n=0;return On(t)&&rc(t.children,0,r=>{if(r.kind==="run"){e.push(n),n+=xe(r);return}n+=xe(r);}),e}function Nr(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];if(e>=r)return {index:n,offset:e-r}}return {index:0,offset:e}}function Ue(t,e){return t.replace(Sr," ").slice(0,e)}function Pn(t,e,n={}){let r={matches:[],truncated:false};if(!na(e))return r;let l=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,a={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},o=[],m=0;for(let f of L(t)){if(!On(f))continue;let u=m;m+=1;let p=Xg(t,f.id)??"";if(p.length===0)continue;let x=oa(p,e,l-o.length,a),y=null;for(let d of x.matches){let h=d.start+d.length;y??=Tr(f);let O=Nr(y,d.start);o.push({blockId:f.id,start:d.start,length:d.length,paragraphIndex:u,runIndex:O.index,runOffset:O.offset,text:Ue(p.slice(d.start,h),256),contextBefore:Ue(p.slice(Math.max(0,d.start-he),d.start),he),contextAfter:Ue(p.slice(h,h+he),he)});}if(x.truncated)return {matches:o,truncated:true}}return {matches:o,truncated:false}}var Ir=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"],Er=/^[0-9A-Fa-f]{6}$/,bn={windowText:"000000",window:"FFFFFF"};function Rn(t){return t.kind!=="textValue"}function ke(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Sn(t,e){let n=[t];for(;n.length>0;){let r=n.pop();if(Rn(r)){if(r.localName===e)return r;for(let l=r.children.length-1;l>=0;l-=1)n.push(r.children[l]);}}return null}function Oe(t,e){for(let n of t.children)if(Rn(n)&&(e===void 0||n.localName===e))return n;return null}function Dr(t){let e=Oe(t);if(!e)return null;let n;if(e.localName==="srgbClr")n=ke(e,"val");else if(e.localName==="sysClr"){let r=ke(e,"val")??"";n=ke(e,"lastClr")??(Object.prototype.hasOwnProperty.call(bn,r)?bn[r]:void 0);}return n===void 0||!Er.test(n)?null:n.toUpperCase()}var Mr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function vn(t,e){let n=Oe(t,e),r=n?Oe(n,"latin"):null,l=r?ke(r,"typeface"):void 0;return l!==void 0&&Mr.test(l)?l:null}function se(t){if(!t)return {major:null,minor:null};let e=Sn(t,"fontScheme");return e?{major:vn(e,"majorFont"),minor:vn(e,"minorFont")}:{major:null,minor:null}}function Tn(t){if(!t)return [];let e=Sn(t,"clrScheme");if(!e)return [];let n=[];for(let r of Ir){let l=Oe(e,r),a=l?Dr(l):null;if(a===null)return [];n.push({slot:r,hex:a});}return n}var Cr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;var wr=/[\u0000-\u001F\u007F-\u009F]/;function En(t){return t.kind!=="textValue"}function W(t,e){for(let n of t.children)if(En(n)&&n.localName===e)return n}function G(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Nn(t){return t===void 0||t.length===0||t.length>128||wr.test(t)?null:t}function Pe(t,e){return t==="minorAscii"||t==="minorHAnsi"?e.minor:t==="majorAscii"||t==="majorHAnsi"?e.major:null}function Ar(t,e){let n=Pe(G(t,"asciiTheme"),e)??Pe(G(t,"hAnsiTheme"),e);if(n!==null)return n;let r=G(t,"ascii")??G(t,"hAnsi");return r===void 0?null:Cr.test(r)?r:null}function In(t,e){if(!t)return {fontFamily:null,fontSizeHalfPoints:null};let n=W(t,"rFonts"),r=W(t,"sz"),l=r?G(r,"val"):void 0,a=l!==void 0&&/^\d{1,4}$/.test(l)?Number(l):null;return {fontFamily:n?Ar(n,e):null,fontSizeHalfPoints:a!==null&&a>=2&&a<=3276?a:null}}function We(t,e){let n=new Map,r={fontFamily:null,fontSizeHalfPoints:null};if(t){let o=W(t,"docDefaults"),m=o?W(o,"rPrDefault"):void 0;r=In(m?W(m,"rPr"):void 0,e);for(let f of t.children){if(!En(f)||f.localName!=="style")continue;let u=Nn(G(f,"styleId"));if(u===null||n.has(u))continue;let p=W(f,"basedOn");n.set(u,{basedOn:Nn(p?G(p,"val"):void 0),own:In(W(f,"rPr"),e)});}}let l=new Map,a=o=>{let m=o??"",f=l.get(m);if(f)return f;let u=null,p=null,x=new Set,y=o;for(let h=0;y!==null&&h<16&&!x.has(y);h+=1){x.add(y);let O=n.get(y);if(!O)break;u??=O.own.fontFamily,p??=O.own.fontSizeHalfPoints,y=O.basedOn;}let d={fontFamily:u??r.fontFamily,fontSizeHalfPoints:p??r.fontSizeHalfPoints};return l.set(m,d),d};return (o,m)=>{let f=a(o),u=m?.find(x=>x.localName==="rFonts"),p=u?Pe(u.attributes?.asciiTheme,e)??Pe(u.attributes?.hAnsiTheme,e):null;return p===null?f:{...f,fontFamily:p}}}var Dn=new WeakMap;function Xe(t){let e=Dn.get(t);if(e!==void 0)return e;let n=sb(t),r=n===null||!rb(n)?null:n;return Dn.set(t,r),r}var Ge=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,l]of this.entries())e.call(n,l,r,this);}};function Mn(t,e){return Object.freeze({...t,partByNode:new Ge(t.ordinalByNode,e)})}function Cn(t){let e=new Map,n=new Map,r=new Map,l=new Set,a=new Map,o=new Map,m=0;for(let f of t)for(let u of M(f)){r.set(u.id,m),a.set(u.id,f),m+=1;let p=Xe(u);if(p===null)continue;e.set(u.id,p);let x=p.toUpperCase(),y=o.get(x);y?(y.push(u.id),l.add(x)):(o.set(x,[u.id]),n.set(x,u.id));}return Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:r,ambiguousParaIds:l,partByNode:a,claimantsByParaId:o})}function wn(t,e){let n=t.indexOf("#");if(n<=0)return null;let r=t.slice(0,n),l=e.body.name===r?e.body:void 0;l??=e.openStories.find(m=>m.name===r);let a=l?void 0:e.otherStories.find(m=>m.name===r);if(l??=a?e.normalize(a):void 0,!l)return null;let o=Ca(l,t);return o?.kind==="paragraph"?Xe(o):null}var Fr={committed:false,rejected:false,opCount:0};function Je(t,e){return e===void 0?{committed:false,rejected:true,opCount:t}:{committed:false,rejected:true,opCount:t,reason:e}}function An(t,e,n,r,l,a$1){if(e.length===0)return Fr;let o=e.filter(u=>Ed(u)||Ze(u)).length;if(o>0){if(o!==e.length||e.length!==1)return Je(e.length,"invalidArgs");let u=Ab(a$1.actorId,()=>t.applyLifecycleOp(e[0]));return u.ok?{committed:true,rejected:false,opCount:1}:Je(1,u.detail??u.reason)}let m=a$1.recordsHistory===false&&a$1.actorId&&a$1.operationId?t.partFor(l)?.name:void 0,f=t.transact(l,u=>{n!==void 0&&u.selectionBefore(n),r!==void 0&&u.selectionAfter(r);for(let p of e)u.apply(p);m&&u.applyPackage(p=>a(p,m,e));},a$1);return f.ok?{committed:true,rejected:false,opCount:e.length}:Je(e.length,f.reason)}var _r=Object.freeze([]);function Lr(t,e={}){let n=Sb(t);if(!n.ok)return {ok:false,reason:n.reason,...n.detail?{detail:n.detail}:{}};let r$1=n.package,l=r$1.parts.get(r$1.mainDocumentPart);if(!l)return {ok:false,reason:"no-main-document-tree",detail:r$1.mainDocumentPart};let a=yb(l),o$1=new f(r$1,a),m=null,f$1=null,u=null,p$1=null;o$1.subscribe(i=>{p$1=i;});let x$1=()=>o$1.bodyStore(),y$1=()=>o$1.currentPackage(),d=Object.freeze({kind:"body"}),h=()=>{if(m&&p$1&&m.packageRevision===p$1.fromRevision&&o$1.packageRevision===p$1.toRevision&&p$1.story?.kind==="body"&&p$1.impact==="text-local"&&p$1.created.length===0&&p$1.deleted.length===0&&p$1.splitJoin.length===0&&(m={...m,packageRevision:o$1.packageRevision}),!m||m.packageRevision!==o$1.packageRevision){let i=uc(y$1());m={packageRevision:o$1.packageRevision,resolution:i,parts:tc(i)};}return m},O="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",T="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",v=null,P=()=>{let i=y$1(),s=(i.relationships.get(i.mainDocumentPart)??[]).find(k=>k.type===O),c;if(s){let k=E$1(s);k.mode==="Internal"&&k.target.ok&&(c=i.parts.get(k.target.partName));}c??=i.parts.get("/word/styles.xml");let g=c?.root??null;return g!==v&&(v=g,Se=null,ne=null),v},R=false,S=null,Z=()=>{if(R)return S;R=true;let i=y$1(),s=(i.relationships.get(i.mainDocumentPart)??[]).find(g=>g.type===T),c;if(s){let g=E$1(s);g.mode==="Internal"&&g.target.ok&&(c=i.parts.get(g.target.partName));}return c??=i.parts.get("/word/numbering.xml"),S=c?.root??null,S},be="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",Q=-1,B$1=null,de=()=>{if(Q===o$1.packageRevision)return B$1;Q=o$1.packageRevision;let i=y$1(),s=(i.relationships.get(i.mainDocumentPart)??[]).find(g=>g.type===be),c;if(s){let g=E$1(s);g.mode==="Internal"&&g.target.ok&&(c=i.parts.get(g.target.partName));}return c??=i.parts.get("/word/settings.xml"),B$1=c?.root??null,B$1},_n="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",Ln="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",Ke=(i,s)=>{let c=y$1(),g=(c.relationships.get("/")??[]).find(b=>b.type===i),k;if(g){let b=E$1(g);b.mode==="Internal"&&b.target.ok&&(k=c.parts.get(b.target.partName));}return k??c.parts.get(s)},Ve=-1,ve=Xf,jn=()=>{if(Ve===o$1.packageRevision)return ve;Ve=o$1.packageRevision;let i=Ke(_n,"/docProps/core.xml"),s=Ke(Ln,"/docProps/app.xml");return ve=Yf(i?.root??null,s?.root??null),ve},Bn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Ze=false,Re=null,q$1=()=>{if(Ze)return Re;Ze=true;let i=y$1(),s=(i.relationships.get(i.mainDocumentPart)??[]).find(g=>g.type===Bn),c;if(s){let g=E$1(s);g.mode==="Internal"&&g.target.ok&&(c=i.parts.get(g.target.partName));}return c??=i.parts.get("/word/theme/theme1.xml"),Re=c?.root??null,Re},Hn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",ue=null,zn=()=>{if(ue)return ue;let i=y$1(),s=(i.relationships.get(i.mainDocumentPart)??[]).find(g=>g.type===Hn),c;if(s){let g=E$1(s);g.mode==="Internal"&&g.target.ok&&(c=i.parts.get(g.target.partName));}return c??=i.parts.get("/word/fontTable.xml"),ue=Object.freeze(yc(i,c)),ue},ee=null,te=null,Se=null,Qe=null,qe=null,et=()=>{let i=[x$1().part.root],s=P();s&&i.push(s);let c=new Set;for(let g of w())c.has(g)||(c.add(g),i.push(g.root));return i},ne=null,ce=null,re=null,oe=null,X=null,tt=new WeakMap,pe=null,nt=i=>{let s=tt.get(i);if(s)return s;let c=yb(i);return tt.set(i,c),c},rt=()=>{let i=o$1.packageRevision,s=o$1.openStoryToken();if(!X||X.revision!==i||X.openStories!==s){let c=o$1.openStoryParts(),g=new Set(c.map(D=>D.name)),k=w().filter(D=>!g.has(D.name)).map(nt),b=[x$1().part,...c,...k],I=X,C=I!==null&&p$1!==null&&I.openStories===s&&I.revision===p$1.fromRevision&&i===p$1.toRevision&&p$1.impact==="text-local"&&p$1.created.length===0&&p$1.deleted.length===0&&p$1.splitJoin.length===0&&I.parts.length===b.length&&I.parts.every((D,J)=>D.name===b[J]?.name);X={revision:i,openStories:s,parts:b,index:C&&I?Mn(I.index,b):Cn(b)};}return X.index},ot=()=>{let i=x$1().part.name,s=new Map;for(let c of [x$1().part,...w()])for(let[g,k]of y(y$1(),c.name,i))s.set(g,k);return s},$n=()=>[x$1().part,...w()],w=()=>{let i=[],s=new Set;for(let g of h().parts)for(let k of [g.headers,g.footers])for(let b of k.values())s.has(b)||(s.add(b),i.push(b));let c=y$1();for(let g of ["footnote","endnote"]){let k=Me(c,g);!k||s.has(k)||(s.add(k),i.push(k));}return i};return {ok:true,session:{editable:M(x$1().part).length>0,paragraphIds:()=>M(x$1().part).map(i=>i.id),paragraphIdsIn(i=d){let s=o$1.partFor(i);return s?M(s).map(c=>c.id):[]},part:()=>x$1().part,partFor:i=>o$1.partFor(i),currentPackage:y$1,collaborationPort:i=>b$1(o$1,{documentId:i}),applyTreeOps(i,s,c,g=d,k={}){return An(o$1,i,s,c,g,k)},projectDoc:()=>$(x$1().part),reconcile:i=>Le(i,x$1().part,p$1),lastCommitWasStructural:()=>p$1!==null&&(p$1.created.length>0||p$1.deleted.length>0||p$1.splitJoin.length>0||p$1.impact==="global"),applyPmDoc(i){let s=x$1(),c=_e(s.part,i);if(!c.ok)return {committed:false,rejected:true,opCount:0,reason:c.reason};if(c.ops.length===0)return {committed:false,rejected:false,opCount:0};let g=o$1.transact(d,k=>{for(let b of c.ops)k.apply(b);});return g.ok?{committed:true,rejected:false,opCount:c.ops.length}:{committed:false,rejected:true,opCount:c.ops.length,reason:g.reason}},storyParts:$n,bodyText:()=>ln(x$1().part),storyText(i){let s=o$1.partFor(i);return s?M(s).map(c=>Xg(s,c.id)??"").join(`
|
|
5
|
-
`):null},revision:()=>x$1().revision,revisionFor:i=>o$1.revisionFor(i),packageRevision:()=>o$1.packageRevision,canUndo:()=>o$1.canUndo,canRedo:()=>o$1.canRedo,undo:()=>{let i=o$1.selectionForUndo();return o$1.undo()===null?null:i},redo:()=>{let i=o$1.selectionForRedo();return o$1.redo()===null?null:i},beginComposition:(i=d)=>{o$1.beginComposition(i);},endComposition:()=>o$1.endComposition(),subscribe(i){return o$1.subscribe(i)},save(){return Tb(y$1())},headerFooterParts:()=>{let i=h().parts;return i[i.length-1]??wc(y$1())},headerFooterPartsBySection:()=>h().parts,headerFooterResolutionBySection:()=>h().resolution,documentFonts(){return ee&&ee.revision===o$1.packageRevision||(ee={revision:o$1.packageRevision,fonts:mn(et(),se(q$1()))}),ee.fonts},rendersText(){return te&&te.revision===o$1.packageRevision||(te={revision:o$1.packageRevision,rendersText:yn(et())}),te.rendersText},documentStyles(){ne??=We(P(),se(q$1()));let i=ne;return Se??=xn(P(),s=>i(s)),Se},stylesRoot:()=>P(),documentThemeFonts(){return qe??=se(q$1()),qe},numberingRoot:()=>Z(),settingsRoot:()=>de(),documentProperties:()=>jn(),trackingSettings:()=>Uf(de()),documentThemeColors(){return Qe??=Tn(q$1()),Qe},effectiveRunDefaults(i,s){ne??=We(P(),se(q$1()));let c=x$1();if(!ce||ce.revision!==c.revision){let g=new Map;for(let k of M(c.part))k.kind!=="textValue"&&g.set(k.id,Ye(k)??null);ce={revision:c.revision,byId:g};}return ne(ce.byId.get(i)??null,s)},documentOutline(){let i=x$1();return re&&re.revision===i.revision||(re={revision:i.revision,outline:kn(i.part,P())}),re.outline},findText(i,s){let c=x$1(),g=`${s?.matchCase===true?"c":""}${s?.wholeWord===true?"w":""}${s?.limit??""}\0${i}`;if(oe&&oe.revision===c.revision&&oe.key===g)return oe.result;let k=Pn(c.part,i,s??{});return oe={revision:c.revision,key:g,result:k},k},embeddedFonts:zn,paragraphAnchors:rt,paraIdOf:i=>wn(i,{body:x$1().part,openStories:o$1.openStoryParts(),otherStories:w(),normalize:nt}),nodeIdOf:i=>rt().nodeByParaId.get(i.toUpperCase())??null,relationshipTarget:(i,s=d)=>{let c=y$1(),g=o$1.partFor(s);return g?Cd(c,g.name,i):null},bookmarks:()=>{let i=o$1.packageRevision;if(!pe||pe.revision!==i){let s=new Map(ed(x$1().part));for(let c of w())for(let[g,k]of ed(c))s.has(g)||s.set(g,k);pe={revision:i,index:s};}return pe.index},ensureHyperlinkRelationship(i,s=d){let c=o$1.partFor(s);return c?xa(o$1,()=>{let g=y$1(),k=Bd(g,i,c.name);return k?(k.pkg!==g&&o$1.replacePackageShell(k.pkg),k.relationshipId):null},g=>g!==null):null},reviewItems(){let i=e.reviewModel;if(!i)return _r;let s=x$1(),c=`${o$1.packageRevision}:${s.revision}`;if(f$1&&f$1.revisionKey===c)return f$1.items;let g=y$1(),k=g.parts.get(o(g,s.part.name)),b=g.parts.get(p(g,s.part.name)),I=w(),C=f$1&&p$1?cn(p$1,f$1,f$1.items,s.part,k,b,o$1.packageRevision):null,D,J;if(C&&f$1){let at=i.revisionItemsOfParagraph(s.part,C);sn(f$1.items,at,C)?(D=dn(f$1.items,f$1.paragraphOrder,C,at),J=f$1.paragraphOrder):(J=ha(s.part),D=i.collectReviewItems({storyPart:s.part,furnitureParts:I,commentsPart:k,commentsExtendedPart:b,customNodePayloads:ot()}));}else J=ha(s.part),D=i.collectReviewItems({storyPart:s.part,furnitureParts:I,commentsPart:k,commentsExtendedPart:b,customNodePayloads:ot()});return f$1={revisionKey:c,bodyRevision:s.revision,packageRevision:o$1.packageRevision,items:D,paragraphOrder:J,commentsPart:k,commentsExtendedPart:b},f$1.items},hasReviewContent(){let i=o$1.packageRevision;if(!u||u.revision!==i){let s=[x$1().part,...w()];u={revision:i,present:s.some(c=>vg(c).length>0||je(c.root))};}return u.present},replyToComment(i,s,c,g,k,b=d,I){let C=q(o$1,{anchor:{paragraphId:s.paragraphId,start:s.start,end:s.end,...s.endParagraphId===void 0?{}:{endParagraphId:s.endParagraphId}},author:g,text:c,...k===void 0?{}:{date:k},...i===null?{}:{replyToCommentId:i},...I===void 0?{}:{actorId:I}},b);return C.ok?C.commentId:null},setCommentResolved(i,s){return r(o$1,i,s).ok},deleteComment(i,s=d,c){return this.deleteComments([{commentId:i}],s,c)},deleteComments(i,s$1=d,c){return s(o$1,i,s$1,c)},insertCustomNode(i,s=d){return A(o$1,i,s)},removeCustomNode(i,s=d){return B(o$1,i,s)},sweepCustomNodePayloads(i){return xa(o$1,()=>{let s=x$1(),c=x(o$1.currentPackage(),s.part.name,i);return c.ok?c.removed.length===0?{ok:true,removed:[]}:(o$1.replacePackageShell(c.pkg),{ok:true,removed:c.removed}):{ok:false,reason:c.reason}},s=>s.ok&&s.removed.length>0)},ensureListDefinition(i){return xa(o$1,()=>{let s=yd(y$1(),i);return s?(o$1.replacePackageShell(s.pkg),R=false,S=null,s.numId):null},s=>s!==null)},ensureNumberingLevel(i,s,c){return xa(o$1,()=>{let g=y$1(),k=zd(g,i,s,c);return k?k!==g?(o$1.replacePackageShell(k),R=false,S=null,{ok:true,changed:true}):{ok:true,changed:false}:{ok:false,changed:false}},g=>g.changed).ok},insertImage(i,s){return o$1.insertImage(i,s)},replaceImage(i,s,c,g,k,b){return o$1.replaceImage(i,s,c,g,k,b)},deleteImage(i,s){return o$1.deleteImage(i,s)},deleteImageTracked(i,s,c){return o$1.deleteImageTracked(i,s,c)},applyImageProperties(i,s){return o$1.applyImageProperties(i,s)},applyFragmentPaste(i,s){return o$1.applyFragmentPaste(i,s)}}}}var jr=b.projection;function Kr(t,e,n){let r=t.filter(l=>l.localName!==e);return r.length!==t.length?r:[...r,n?{localName:e,attributes:n}:{localName:e}]}function Vr(t,e,n={}){let r=null,l=false,a=()=>n.onChange?.(o()),o=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:r}),m=d=>{l=true;let h=u.state.tr.replaceWith(0,u.state.doc.content.size,d.content);h.setMeta("addToHistory",false),u.dispatch(h),l=false;},f=d=>()=>(d()&&(m(e.projectDoc()),a()),true),u=new EditorView(t,{state:EditorState.create({doc:e.projectDoc(),plugins:[keymap({...baseKeymap,Home:selectTextblockStart,End:selectTextblockEnd,"Mod-z":f(()=>e.undo()!==null),"Mod-y":f(()=>e.redo()!==null),"Shift-Mod-z":f(()=>e.redo()!==null),"Mod-b":(d,h)=>y(d,h,"b"),"Mod-i":(d,h)=>y(d,h,"i"),"Mod-u":(d,h)=>y(d,h,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:d=>(p(d),false),beforeinput:(d,h)=>{let O=h;if(d.composing)return false;p(d);let T=O.inputType;if(T==="insertText"&&O.data!=null){O.preventDefault();let{from:v,to:P}=d.state.selection;return d.dispatch(d.state.tr.insertText(O.data,v,P)),true}if(T==="deleteContentBackward"){O.preventDefault();let{from:v,empty:P}=d.state.selection;return P?v>0?d.dispatch(d.state.tr.delete(v-1,v)):joinBackward(d.state,d.dispatch):deleteSelection(d.state,d.dispatch),true}if(T==="deleteContentForward"){O.preventDefault();let{from:v,to:P,empty:R}=d.state.selection;return R?P<d.state.doc.content.size?d.dispatch(d.state.tr.delete(v,v+1)):joinForward(d.state,d.dispatch):deleteSelection(d.state,d.dispatch),true}return T==="insertParagraph"?(O.preventDefault(),splitBlock(d.state,d.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),a(),false)},dispatchTransaction(d){let h=u.state.apply(d);if(l||!d.docChanged){u.updateState(h);return}let O=e.applyPmDoc(h.doc);if(O.rejected){r=String(O.reason??"rejected"),u.updateState(h),m(e.projectDoc()),a();return}r=null,u.updateState(O.committed&&e.lastCommitWasStructural()?x(h):h),a();}});function p(d){if(d.composing||l)return;let h=d.dom.ownerDocument.getSelection(),O=h?.anchorNode,T=h?.focusNode;if(!(!h||!O||!T)&&!(!d.dom.contains(O)||!d.dom.contains(T)))try{let v=d.posAtDOM(O,h.anchorOffset),P=d.posAtDOM(T,h.focusOffset),R=d.state.selection;if(R.anchor===v&&R.head===P)return;let S=TextSelection.create(d.state.doc,v,P);d.dispatch(d.state.tr.setSelection(S).setMeta("addToHistory",!1));}catch{}}function x(d){let h=e.paragraphIds(),O=d.tr,T=false,v=0;return d.doc.forEach((P,R)=>{let S=h[v];v+=1,!(P.type.name!=="paragraph"||S===void 0)&&P.attrs.nodeId!==S&&(O=O.setNodeMarkup(R,void 0,{...P.attrs,nodeId:S}),T=true);}),T?d.apply(O.setMeta("addToHistory",false)):d}function y(d,h,O,T){let v=N.marks.runProps;if(!h)return true;let{from:P,to:R,empty:S}=d.selection;if(S)return true;let be=d.doc.resolve(P).marks().find(de=>de.type===v)?.attrs.props??[],Q=Kr(be,O,T),B=d.tr;return B.removeMark(P,R,v),Q.length>0&&B.addMark(P,R,v.create({props:Q})),h(B),true}return {view:u,state:o,undo:()=>f(()=>e.undo()!==null)(),redo:()=>f(()=>e.redo()!==null)(),toggleRunProperty(d,h){y(u.state,u.dispatch.bind(u),d,h);},destroy:()=>u.destroy()}}export{N as a,Ae as b,L as c,M as d,$ as e,_e as f,rr as g,Le as h,Ye as i,Lr as j,jr as k,Vr as l};
|
package/dist/chunk-X7A5XART.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {Xe,We,Jf,we,Me,af,Ub,ta as ta$1,ca as ca$1,bc,ac,$b,Sb,xa as xa$1,ya as ya$1,Ab,b,ra as ra$1,cc,$e as $e$1,me,Sf,Ze,_e,Ed,Fd,E,yb,Bb,Cb,zb,O,ye,ub,Fa as Fa$1,bf,cf,ff,ef,Xb,Qf,Rf,uf,kg,fg,pg,jg,ig,dg,sg,eg,rg,lg,hg,ja as ja$1,Mc,ue,ve as ve$1,J as J$1,Ca as Ca$1,Ee,vg,Mf,Nf,Lf,Bd,w,a,Lb,_b,xg,Wg,Wb,fa as fa$1,Aa as Aa$1,Ae,$g,Yg,Of,td,Ga as Ga$1,Mb,Ib,Kb,Nb,Pb,Qb,Oa as Oa$1,df,vb,cg,wb,rb,Ea as Ea$1,Cc,Kc as Kc$1,ib,Hb,ug,Se,_g,ab,Wa as Wa$1,Xa as Xa$1,Za,F,pa as pa$1,g,qa as qa$1,u,Fe as Fe$1,Te,Db,_a as _a$1,oa as oa$1,P,W,Zg,Dd,Rg,Sg,da as da$1,Fb,Gb,Eb}from'./chunk-34BNQUD4.js';import {strFromU8,strToU8}from'fflate';function J(t){return t.kind!=="textValue"}function _(t,e){return t.kind!=="textValue"&&t.localName===e&&t.namespaceUri===ca$1}function ne(t,e){for(let n of t)e(n),n.kind!=="textValue"&&ne(n.children,e);}function pe(t){if(t.kind==="textValue")return `T(${t.value})`;if(t.namespaceUri===ca$1&&t.localName.startsWith("rsid"))return "";let e=t.attributes.filter(r=>!r.localName.startsWith("rsid")&&!(r.namespaceUri===fa$1&&(r.localName==="paraId"||r.localName==="textId"))).map(r=>`${r.namespaceUri}|${r.localName}=${r.value}`).sort().join(","),n=t.children.map(pe).join("");return `E(${t.namespaceUri}:${t.localName}[${e}]{${n}})`}function et(t){return `S[${t.attributes.filter(n=>n.localName!=="styleId").map(n=>`${n.localName}=${n.value}`).sort().join(",")}]${t.children.map(pe).join("")}`}function Ot(t){let e=[],n=new Map,r=new Set,a=null;if(t&&J(t.root))for(let i of t.root.children){if(!J(i))continue;if(_(i,"docDefaults")){a=i;continue}if(!_(i,"style"))continue;e.push(i);let o=we(i,"styleId");o&&n.set(o,i);let s=i.children.find(d=>_(d,"name")),l=s?we(s,"val"):void 0;l&&r.add(l);}return {part:t,styles:e,docDefaults:a,byId:n,names:r}}function xt(t,e,n){let r=new Map;if(!t)return r;let a=t.children.find(o=>_(o,e));if(!a||!J(a))return r;let i=a.children.find(o=>_(o,n));if(!i||!J(i))return r;for(let o of i.children)o.kind!=="textValue"&&r.set(o.localName,o);return r}function Qt(t,e,n,r){let a=e;for(let i=0;i<16&&a;i+=1){let o=t.byId.get(a);if(!o)return false;let s=o.children.find(d=>_(d,n));if(s&&J(s)&&s.children.some(d=>d.kind!=="textValue"&&d.localName===r))return true;let l=o.children.find(d=>_(d,"basedOn"));a=l?we(l,"val"):void 0;}return false}function ni(t,e){for(let n of t.styles){if(we(n,"type")!==e)continue;let r=we(n,"default");if(r==="1"||r==="true")return we(n,"styleId")}}function Pt(t,e){let n=t.children.find(r=>_(r,e));return n&&J(n)?n:null}var ri=new Map(["pStyle","keepNext","keepLines","pageBreakBefore","framePr","widowControl","numPr","suppressLineNumbers","pBdr","shd","tabs","suppressAutoHyphens","kinsoku","wordWrap","overflowPunct","topLinePunct","autoSpaceDE","autoSpaceDN","bidi","adjustRightInd","snapToGrid","spacing","ind","contextualSpacing","mirrorIndents","suppressOverlap","jc","textDirection","textAlignment","textboxTightWrap","outlineLvl","divId","cnfStyle","rPr","sectPr","pPrChange"].map((t,e)=>[t,e])),oi=new Map(["rStyle","rFonts","b","bCs","i","iCs","caps","smallCaps","strike","dstrike","outline","shadow","emboss","imprint","noProof","snapToGrid","vanish","webHidden","color","spacing","w","kern","position","sz","szCs","highlight","u","effect","bdr","shd","fitText","vertAlign","rtl","cs","em","lang","eastAsianLayout","specVanish","oMath","rPrChange"].map((t,e)=>[t,e]));function Zt(t,e,n){let r=xt(e.docDefaults,"rPrDefault","rPr"),a=xt(n.docDefaults,"rPrDefault","rPr"),i=xt(e.docDefaults,"pPrDefault","pPr"),o=xt(n.docDefaults,"pPrDefault","pPr"),s=(p,y,f)=>{let g=ni(p,"paragraph"),O=g?p.byId.get(g):void 0;if(!O)return g;for(let[L,U]of [["rPr",y],["pPr",f]]){let S=Pt(O,L);if(S)for(let F of S.children)F.kind!=="textValue"&&U.set(F.localName,F);}return g};s(e,r,i),s(n,a,o);let l=new Map;for(let[p,y]of r){let f=a.get(p);(!f||pe(f)!==pe(y))&&l.set(p,y);}let d=new Map;for(let[p,y]of i){if(p==="sectPr")continue;let f=o.get(p);(!f||pe(f)!==pe(y))&&d.set(p,y);}if(l.size===0&&d.size===0)return t;let c=0,u=()=>`fragment#materialized-${c++}`,m=p=>{let y=f=>f.kind==="textValue"?{id:u(),kind:"textValue",value:f.value}:{...f,id:u(),children:f.children.map(y)};return y(p)},k=(p,y,f)=>{if(f.length===0)return p;let g=Pt(p,y);if(g){let L=y==="rPr"?oi:ri,U=[...g.children];for(let F of f){let V=F.kind==="textValue"?Number.MAX_SAFE_INTEGER:L.get(F.localName)??Number.MAX_SAFE_INTEGER,Z=U.length;for(let C=0;C<U.length;C+=1){let B=U[C];if(B.kind==="textValue")continue;let $=L.get(B.localName);if($!==void 0&&$>V){Z=C;break}}U.splice(Z,0,F);}let S={...g,children:U};return {...p,children:p.children.map(F=>F===g?S:F)}}let O={id:u(),kind:y==="rPr"?"runProperties":"paragraphProperties",namespaceUri:ca$1,localName:y,prefix:"w",namespaceBindings:[],attributes:[],children:f};return {...p,children:[O,...p.children]}},h=p=>{let y=Pt(p,"pPr"),f=y?.children.find(S=>_(S,"pStyle")),g=f?we(f,"val"):void 0,O=[];for(let[S,F]of d)y?.children.some(Z=>Z.kind!=="textValue"&&Z.localName===S)||g&&Qt(e,g,"pPr",S)||O.push(m(F));let L=S=>{if(S.kind==="textValue")return S;if(S.kind==="run"){let V=Pt(S,"rPr"),Z=V?.children.find($=>_($,"rStyle")),C=Z?we(Z,"val"):void 0,B=[];for(let[$,G]of l)V?.children.some(E=>E.kind!=="textValue"&&E.localName===$)||C&&Qt(e,C,"rPr",$)||g&&Qt(e,g,"rPr",$)||B.push(m(G));return k(S,"rPr",B)}if(S.kind==="paragraphProperties"||S.kind==="runProperties")return S;let F=S.children.map(L);return F.some((V,Z)=>V!==S.children[Z])?{...S,children:F}:S};return L(k(p,"pPr",O))},P=p=>{if(p.kind==="textValue")return p;if(p.kind==="paragraph")return h(p);let y=p.children.map(P);return y.some((f,g)=>f!==p.children[g])?{...p,children:y}:p};return t.map(P)}function ai(t,e){return {...t,children:e}}function ii(t,e){return t.kind!=="textValue"&&t.localName===e&&t.namespaceUri===ca$1}var si=new Set(["commentRangeStart","commentRangeEnd"]),li=new Set(["altChunk","subDoc"]);function di(t){return t.kind==="run"&&t.children.some(e=>e.kind==="commentReference")}var ci=new Set(["DDE","DDEAUTO","INCLUDE","INCLUDEPICTURE","INCLUDETEXT","IMPORT","LINK","DATABASE","AUTOTEXT","AUTOTEXTLIST","GOTOBUTTON","MACROBUTTON","PRINT","ADDIN"]);function ro(t){if(t===void 0)return false;let e=t.trim().replace(/^"+/,"").split(/\s+/,1)[0]??"";return ci.has(e.toUpperCase())}function mi(t){if(t.kind!=="run")return null;for(let e of t.children)if(e.kind==="fldChar"){let n=we(e,"fldCharType");return n==="separate"||n==="end"?n:"begin"}return null}function ui(t){if(t.kind!=="run")return null;let e="",n=false;for(let r of t.children)if(r.kind==="instrText"){n=true;for(let a of r.children)a.kind==="textValue"&&(e+=a.value);}return n?e:null}function pi(t){let e=[],n=new Set,r=i=>{if(i.dangerous){for(let o of i.machinery)n.add(o);for(let o of i.instr)n.add(o);for(let o of i.preResult)n.add(o);}},a=i=>{if(i.kind!=="textValue"){if(i.kind==="run"){let o=mi(i);if(o==="begin"){e.push({dangerous:false,afterSeparate:false,machinery:[i.id],instr:[],preResult:[]});return}let s=e[e.length-1];if(s){if(o==="separate"){s.afterSeparate=true,s.machinery.push(i.id);return}if(o==="end"){s.machinery.push(i.id),e.pop(),r(s);return}let l=ui(i);if(l!==null){s.instr.push(i.id),ro(l)&&(s.dangerous=true);return}s.afterSeparate||s.preResult.push(i.id);return}return}for(let o of i.children)a(o);}};for(let i of t)a(i);for(;e.length>0;){let i=e.pop();i.dangerous=true,r(i);}return n}function fi(t,e){if(t.kind==="textValue")return t;if(t.namespaceUri===ca$1&&(si.has(t.localName)||t.localName==="sectPr"||li.has(t.localName))||di(t)||e.has(t.id))return "drop";if(ii(t,"fldSimple")&&ro(we(t,"instr")))return en(t.children,e);let n=en(t.children,e);return n.length===t.children.length&&n.every((r,a)=>r===t.children[a])?t:ai(t,n)}function en(t,e){let n=[];for(let r of t){let a=fi(r,e);a!=="drop"&&(Array.isArray(a)?n.push(...a):n.push(a));}return n}function tn(t){let e=pi(t);return en(t,e)}var oo="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function q(t,e,n,r){return {...t,attributes:t.attributes.map(a=>a.localName===n&&a.namespaceUri===e?{...a,value:r}:a)}}var gi=new Set(["pStyle","rStyle","tblStyle","basedOn","link","next","styleLink","numStyleLink"]),nn=Te,fe=new Map;function Ue(t,e){let n=e.styleIds??fe,r=e.numIds??fe,a=e.relIds??fe,i=e.footnoteIds??fe,o=e.endnoteIds??fe,s=e.bookmarkIds??fe,l=e.sdtIds??fe,d=e.revisionIds??fe,c=e.docPrIds??fe,u=(m,k)=>{if(m.kind==="textValue")return m;let h=m;if(m.namespaceUri===ca$1&&gi.has(m.localName)){let f=we(m,"val"),g=f!==void 0?n.get(f):void 0;g!==void 0&&(h=q(h,ca$1,"val",g));}if(_(m,"numId")){let f=we(m,"val"),g=f!==void 0?r.get(f):void 0;g!==void 0&&(h=q(h,ca$1,"val",g));}if(m.kind==="noteReference"){let f=m.localName==="footnoteReference"?i:o,g=we(m,"id"),O=g!==void 0?f.get(g):void 0;O!==void 0&&(h=q(h,ca$1,"id",O));}if(m.kind==="bookmarkStart"||m.kind==="bookmarkEnd"){let f=we(m,"id"),g=f!==void 0?s.get(f):void 0;g!==void 0&&(h=q(h,ca$1,"id",g));}if(_(m,"id")&&k==="sdtPr"){let f=we(m,"val"),g=f!==void 0?l.get(f):void 0;g!==void 0&&(h=q(h,ca$1,"val",g));}if(nn(m)){let f=we(m,"id"),g=f!==void 0?d.get(f):void 0;g!==void 0&&(h=q(h,ca$1,"id",g));}if(m.kind==="drawingDocPr"){let f=m.attributes.find(O=>O.localName==="id"&&O.namespaceUri==="")?.value,g=f!==void 0?c.get(f):void 0;g!==void 0&&(h=q(h,"","id",g));}for(let f of h.attributes){if(f.namespaceUri!==oo)continue;let g=a.get(f.value);g!==void 0&&g!==f.value&&(h=q(h,oo,f.localName,g));}let P=m.localName,p=h.children.map(f=>u(f,P));return h!==m||p.some((f,g)=>f!==h.children[g])?{...h,children:p}:m};return u(t,"")}function ao(t,e,n){let r=t,a=n.get(t)??2;for(;e.has(r);)r=`${t}${a}`,a+=1;return n.set(t,a),r}function io(t,e,n){let r=`${t} (pasted)`,a=n.get(t)??2;for(;e.has(r);)r=`${t} (pasted ${a})`,a+=1;return n.set(t,a),r}var hi=1e5;function so(t){let e=Bb(),n=yi(t,e),r=ki(t,e),a=xi(t,e);return !n||!r||!a?null:{bookmarkIds:n,revisionIds:r,docPrIds:a}}function rn(t,e,n,r){if(t)return Db(e,t,r);let a=n;return ()=>String(a++)}function lo(t,e){if(t.add(e),!/^\d{1,10}$/.test(e))return;let n=Number(e);n<=zb&&t.add(String(n));}function co(t,e){if(e===void 0)return t;let n=Number(e);return Number.isInteger(n)&&n>t?n:t}function yi(t,e){let n=new Map;if(t.fragmentBookmarkIds.length===0)return n;let r=0,a=new Set;for(let o of [t.ownerPart,...t.notesParts])ne([o.root],s=>{if(s.kind!=="bookmarkStart"&&s.kind!=="bookmarkEnd")return;let l=we(s,"id");l!==void 0&&(lo(a,l),s.kind==="bookmarkStart"&&(r=co(r,l)));});let i=rn(e,a,r+1,zb);for(let o of t.fragmentBookmarkIds){if(n.has(o))continue;let s=i();if(s===null)return null;n.set(o,s);}return n}function ki(t,e){let n=new Map;if(!t.hasRevision)return n;let r=0,a=new Set;for(let s of [t.ownerPart,...t.notesParts]){let l=s===t.ownerPart;ne([s.root],d=>{if(!Te(d))return;let c=we(d,"id");c!==void 0&&lo(a,c),l&&(r=co(r,c));});}let i=rn(e,a,r+1,zb),o=false;return ne(t.travelling,s=>{if(o||!Te(s))return;let l=we(s,"id");if(l===void 0||n.has(l))return;let d=i();d===null?o=true:n.set(l,d);}),o?null:n}function xi(t,e){let n=new Map;if(!t.hasDocPr)return n;let{used:r}=Fb(t.pkg),a=hi;if(!e){let s=Gb(t.pkg);s.ok&&(a=s.id);}let i=rn(e,r,a,Eb),o=false;return ne(t.travelling,s=>{if(o||s.kind==="textValue"||s.kind!=="drawingDocPr")return;let l=s.attributes.find(c=>c.localName==="id"&&c.namespaceUri==="")?.value;if(l===void 0||n.has(l))return;let d=i();d===null?o=true:n.set(l,d);}),o?null:n}var be="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Pi=`${be}/hyperlink`,mo=`${be}/image`,It=`${be}/numbering`,on=`${be}/styles`,uo="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",po="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function tt(t,e,n,r){for(let a of Wb(t,e)){if(a.type!==n||a.targetMode==="External")continue;let i=w(a.ownerPart,a.rawTarget);if(i.ok){let o=t.parts.get(i.partName);if(o)return o}}return t.parts.get(r)??null}function an(t,e){let n=0;return ne([t],r=>{let a=e(r);if(a===void 0)return;let i=Number(a);Number.isInteger(i)&&i>n&&(n=i);}),n}function Rt(t,e,n,r){if(n.length===0)return t;let a=Aa$1(e),i=n.map(d=>Ae(d,a)),o=$g(e,i),s=r??o.root.children.length,l=Fa$1(o,o.root.id,s,i,{deferValidation:true});return l.ok?Ub(t,l.part):null}function fo(t){let e=new Set;return ne(t,n=>{if(n.kind!=="textValue")for(let r of n.attributes)r.namespaceUri===be&&r.value.length>0&&e.add(r.value);}),e}function go(t,e){if(e.size===0)return [...t];let n=a=>{if(a.kind==="textValue")return a;if(a.kind==="drawing"){let o=false;return ne([a],s=>{if(s.kind!=="textValue")for(let l of s.attributes)l.namespaceUri===be&&e.has(l.value)&&(o=true);}),o?null:a}if(a.kind==="hyperlink"){let o=a.attributes.find(s=>s.namespaceUri===be)?.value;if(o!==void 0&&e.has(o))return r(a.children)}let i=r(a.children);return i.length===a.children.length&&i.every((o,s)=>o===a.children[s])?a:{...a,children:i}};function r(a){let i=[];for(let o of a){let s=n(o);s!==null&&(Array.isArray(s)?i.push(...s):i.push(s));}return i}return r(t)}var Oi=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),ho={"image/jpg":"image/jpeg","image/x-ms-bmp":"image/bmp","image/x-bmp":"image/bmp"};function Ii(t,e){let n=ib(t);return n==="unknown"||(Object.hasOwn(ho,e)?ho[e]:e)!==n||Oi.has(n)&&!Hb(t,n)?null:n}function yo(t,e,n){let r=e.parts.get(e.mainDocumentPart);if(!r)return {ok:false,reason:"no-fragment-document"};if(!t.parts.has(n))return {ok:false,reason:"no-target-part"};let a$1=r.root.kind==="document"?r.root.children.find(x=>x.kind==="body"):null;if(!a$1||!J(a$1))return {ok:false,reason:"no-fragment-document"};let i=tn(a$1.children.filter(x=>x.kind==="paragraph"||x.kind==="table"||x.kind==="contentControl"));if(i.length===0)return {ok:false,reason:"no-fragment-document"};let o=t,s=tt(e,e.mainDocumentPart,It,"/word/numbering.xml"),l=new Map,d=[],c=[];if(s&&J(s.root)){let x=new Map,I=[];for(let T of s.root.children)if(J(T))if(_(T,"abstractNum")){let D=we(T,"abstractNumId");D&&x.set(D,T);}else _(T,"num")&&I.push(T);let R=tt(o,o.mainDocumentPart,It,"/word/numbering.xml"),b=new Map,w=new Map;if(R&&J(R.root)){for(let T of R.root.children)if(J(T)&&_(T,"abstractNum")){let D=we(T,"abstractNumId");D&&w.set(D,T);}for(let T of R.root.children){if(!J(T)||!_(T,"num"))continue;let D=we(T,"numId");if(!D)continue;let X=T.children.find(H=>_(H,"abstractNumId")),z=X?we(X,"val"):void 0,re=z?w.get(z):void 0;b.set(`${re?et(re):"none"}::${T.children.filter(H=>_(H,"lvlOverride")).map(pe).join("")}`,D);}}let M=(R?an(R.root,T=>T.kind!=="textValue"&&_(T,"abstractNum")?we(T,"abstractNumId"):void 0):0)+1,W=(R?an(R.root,T=>T.kind!=="textValue"&&_(T,"num")?we(T,"numId"):void 0):0)+1,le=new Map;for(let T of I){let D=we(T,"numId");if(!D)continue;let X=T.children.find(he=>_(he,"abstractNumId")),z=X?we(X,"val"):void 0,re=z?x.get(z):void 0,H=`${re?et(re):"none"}::${T.children.filter(he=>_(he,"lvlOverride")).map(pe).join("")}`,K=b.get(H);if(K!==void 0){l.set(D,K);continue}let ee=z?le.get(z):void 0;ee===void 0&&re&&z&&(ee=String(M++),le.set(z,ee),c.push(q(re,ca$1,"abstractNumId",ee)));let Ne=String(W++);l.set(D,Ne);let xe=q(T,ca$1,"numId",Ne);if(ee!==void 0){let he=xe.children.map(Se=>_(Se,"abstractNumId")?q(Se,ca$1,"val",ee):Se);xe={...xe,children:he};}d.push(xe),b.set(H,Ne);}}let u=Ot(tt(e,e.mainDocumentPart,on,"/word/styles.xml")),m=tt(o,o.mainDocumentPart,on,"/word/styles.xml"),k=Ot(m),h=new Map,P=[],p=new Set(k.byId.keys()),y=new Set(k.names),f=new Map,g=new Map,O=new Map,L=(x,I)=>{let R=O.get(x);return R===void 0&&(R=et(I),O.set(x,R)),R},U=x=>({...x,attributes:x.attributes.filter(I=>!(I.localName==="default"&&I.namespaceUri===ca$1))});for(let x of u.styles){let I=we(x,"styleId");if(!I)continue;let R=k.byId.get(I),b=et(Ue(x,{styleIds:h,numIds:l}));if(R&&L(I,R)===b){h.set(I,I);continue}if(!R){h.set(I,I),p.add(I),P.push(U(x));continue}let w=ao(`${I}Pasted`,p,f);p.add(w),h.set(I,w),P.push(U(q(x,ca$1,"styleId",w)));}let S=P.map(x=>{let I=x.children.find(M=>_(M,"name")),R=I?we(I,"val"):void 0;if(!R||!y.has(R))return R&&y.add(R),x;let b=io(R,y,g);y.add(b);let w=x.children.map(M=>_(M,"name")?q(M,ca$1,"val",b):M);return {...x,children:w}}),F=null,V=1,Z=()=>{if(F)return F;let x=new Map;for(let[I,R]of o.partBytes){let b=I.startsWith("/")?I:`/${I}`;if(!b.startsWith("/word/media/"))continue;x.set(a(R),b);let w=/\/image(\d+)\./.exec(b);w&&(V=Math.max(V,Number(w[1])+1));}return F=x,x},C=new Map,B=x=>{let I=C.get(x);if(!I){I=new Map;for(let R of Wb(o,x)){if(R.targetMode==="External"||R.type!==mo)continue;let b=w(R.ownerPart,R.rawTarget);b.ok&&I.set(b.partName,R.id);}C.set(x,I);}return I},$=(x,I)=>{let R=x.lastIndexOf("."),b=R===-1?"":x.slice(R+1);return /^[A-Za-z0-9]{1,8}$/.test(b)?b.toLowerCase():I==="image/jpeg"?"jpeg":I==="image/gif"?"gif":"png"},G=(x,I,R)=>{let b=new Map,w$1=new Set,M=B(I),W=[],le=new Set,T=[],D=[],X=new Map,z=[],re=e.relationships.get(x)??[];for(let H of re){if(!R.has(H.id))continue;if(H.targetMode==="External"){if(H.type===Pi){let we=Bd(o,H.rawTarget,I);we?(o=we.pkg,b.set(H.id,we.relationshipId)):w$1.add(H.id);}else w$1.add(H.id);continue}let K=w(H.ownerPart,H.rawTarget);if(!K.ok){w$1.add(H.id);continue}let ee=e.partBytes.get(K.partName)??e.partBytes.get(K.partName.replace(/^\//,"")),Ne=(Xb(e,K.partName)??"").toLowerCase();if(!ee||!Ne.startsWith("image/")){w$1.add(H.id);continue}let xe=Ii(ee,Ne);if(xe===null){w$1.add(H.id);continue}let he=xe,Se=Z(),Bn=a(ee),oe=Se.get(Bn);if(!oe){let we=$(K.partName,he),ti=ct=>o.partBytes.has(ct)||o.partBytes.has(ct.slice(1))||o.parts.has(ct)||le.has(ct),At=`/word/media/image${V}.${we}`;for(;ti(At);)V+=1,At=`/word/media/image${V}.${we}`;V+=1,oe=At,W.push({partName:oe,bytes:ee,contentType:he}),le.add(oe),Se.set(Bn,oe);}let ei=oe.startsWith("/word/")?oe.slice(6):oe,jn=M.get(oe);if(jn!==void 0){b.set(H.id,jn);continue}let dt=X.get(oe);dt===void 0&&(dt=T.length,X.set(oe,dt),T.push(ei),D.push(oe)),z.push({recordId:H.id,index:dt});}if(W.length>0&&(o=Lb(o,W)),T.length>0){let H=_b($b(o,I),I,T.map(K=>[mo,K]));if(H.ok){o=H.pkg,H.ids.forEach((K,ee)=>{M.set(D[ee],K);});for(let K of z)b.set(K.recordId,H.ids[K.index]);}else for(let K of z)w$1.add(K.recordId);}return {relIdMap:b,dropRelIds:w$1}},ae=G(e.mainDocumentPart,n,fo(i));i=go(i,ae.dropRelIds);let E=new Map,st=new Map,Q=[];for(let x of ["footnote","endnote"]){let I=x==="footnote"?"footnoteReference":"endnoteReference",R=x==="footnote"?E:st,b=new Set;if(ne(i,D=>{if(D.kind!=="textValue"&&D.kind==="noteReference"&&D.localName===I){let X=we(D,"id");X!==void 0&&b.add(X);}}),b.size===0)continue;let w=Me(e,x);if(!w||!J(w.root))continue;let M=af(o,x);if(!M.ok||!M.package)return {ok:false,reason:"merge-refused"};o=M.package;let W=Me(o,x);if(!W)return {ok:false,reason:"merge-refused"};let le=an(W.root,D=>D.kind!=="textValue"&&D.kind==="note"?we(D,"id"):void 0)+1,T=[];for(let D of w.root.children){if(!J(D)||D.kind!=="note")continue;let X=we(D,"id"),z=we(D,"type");if(z==="separator"||z==="continuationSeparator"||X===void 0||!b.has(X))continue;let re=String(le++);R.set(X,re),T.push(q(D,ca$1,"id",re));}T.length>0&&Q.push({kind:x,fragmentPartName:w.name,bodies:tn(T)});}let We=o.parts.get(n),An=[...i,...Q.flatMap(x=>x.bodies)],_n=[],Dt=new Set,Un=false,Ln=false,Ke=new Map;ne(An,x=>{if(x.kind!=="textValue"){if(x.kind==="bookmarkStart"||x.kind==="bookmarkEnd"){let I=we(x,"id");if(I!==void 0&&_n.push(I),x.kind==="bookmarkStart"){let R=we(x,"name");R&&Dt.add(R);}return}if(nn(x)){Un=true;return}if(x.kind==="drawingDocPr"){Ln=true;return}if(x.kind==="contentControlProperties")for(let I of x.children){if(!_(I,"id"))continue;let R=we(I,"val");if(R!==void 0&&!Ke.has(R)){let b=0,w=`${R}:${Ke.size}`;for(let M=0;M<w.length;M+=1)b=b*31+w.charCodeAt(M)>>>0;Ke.set(R,String(b%2147483647||1));}}}});let lt=so({pkg:o,ownerPart:We,notesParts:Q.map(x=>Me(o,x.kind)).filter(x=>x!==null),travelling:An,fragmentBookmarkIds:_n,hasRevision:Un,hasDocPr:Ln});if(!lt)return {ok:false,reason:"merge-refused"};let Fn=lt.bookmarkIds,$n=lt.revisionIds,Hn=lt.docPrIds;if(Dt.size>0){let x=new Set;if(ne([We.root],I=>{if(I.kind!=="textValue"&&I.kind==="bookmarkStart"){let R=we(I,"name"),b=we(I,"id");R&&b!==void 0&&Dt.has(R)&&x.add(b);}}),x.size>0){let I=b=>{if(b.kind==="textValue")return b;let w=[],M=false;for(let W of b.children){if((W.kind==="bookmarkStart"||W.kind==="bookmarkEnd")&&x.has(we(W,"id")??"")){M=true;continue}let le=I(W);le!==W&&(M=true),w.push(le);}return M?{...b,children:w}:b},R=I(We.root);R!==We.root&&(o=Ub(o,{...We,root:R}));}}for(let x of Q){let I=Me(o,x.kind);if(!I)return {ok:false,reason:"merge-refused"};let R=G(x.fragmentPartName,I.name,fo(x.bodies)),b=go(x.bodies,R.dropRelIds);b=[...Zt(b,u,k)],b=b.map(M=>Ue(M,{styleIds:h,numIds:l,relIds:R.relIdMap,footnoteIds:E,endnoteIds:st,bookmarkIds:Fn,sdtIds:Ke,revisionIds:$n,docPrIds:Hn}));let w=Rt(o,o.parts.get(I.name),b);if(!w)return {ok:false,reason:"merge-refused"};o=w;}if(S.length>0){let x=S.map(R=>Ue(R,{styleIds:h,numIds:l}));if(!m){let R=ta$1(`<w:styles xmlns:w="${ca$1}"></w:styles>`,{name:"/word/styles.xml",contentType:po});if(!R.ok)return {ok:false,reason:"merge-refused"};o=bc(o,"/word/styles.xml",R.part.root,po);let b=ac($b(o,o.mainDocumentPart),o.mainDocumentPart,on,"styles.xml");if(!b.ok)return {ok:false,reason:"merge-refused"};o=b.pkg,m=o.parts.get("/word/styles.xml")??null;}if(!m)return {ok:false,reason:"merge-refused"};let I=Rt(o,o.parts.get(m.name),x);if(!I)return {ok:false,reason:"merge-refused"};o=I,k=Ot(o.parts.get(m.name)??null);}if(c.length>0||d.length>0){let x=tt(o,o.mainDocumentPart,It,"/word/numbering.xml");if(!x){let M=ta$1(`<w:numbering xmlns:w="${ca$1}"></w:numbering>`,{name:"/word/numbering.xml",contentType:uo});if(!M.ok)return {ok:false,reason:"merge-refused"};o=bc(o,"/word/numbering.xml",M.part.root,uo);let W=ac($b(o,o.mainDocumentPart),o.mainDocumentPart,It,"numbering.xml");if(!W.ok)return {ok:false,reason:"merge-refused"};o=W.pkg,x=o.parts.get("/word/numbering.xml")??null;}if(!x)return {ok:false,reason:"merge-refused"};let I=o.parts.get(x.name),R=I.root.children.findIndex(M=>_(M,"num")),b=c.map(M=>Ue(M,{styleIds:h,numIds:l})),w=Rt(o,I,b,R===-1?void 0:R);if(!w)return {ok:false,reason:"merge-refused"};if(o=w,w=Rt(o,o.parts.get(x.name),d),!w)return {ok:false,reason:"merge-refused"};o=w;}let Za=[...Zt(i,u,k)].map(x=>Ue(x,{styleIds:h,numIds:l,relIds:ae.relIdMap,footnoteIds:E,endnoteIds:st,bookmarkIds:Fn,sdtIds:Ke,revisionIds:$n,docPrIds:Hn}));return {ok:true,pkg:o,blocks:Za}}var Ri=16*1024*1024;function bi(t){let e=t.parts.get(t.mainDocumentPart);if(!e||e.root.kind!=="document")return false;let n=e.root.children.find(i=>i.kind==="body");if(!n||n.kind!=="body"||n.children.length>Yg)return false;let r=0,a=(i,o,s)=>{if(o>s||(r+=1,r>_g))return false;if(i.kind==="textValue")return true;for(let l of i.children)if(!a(l,o+1,s))return false;return true};for(let i of n.children)if(!a(i,1,Zg))return false;for(let[i,o]of t.parts)if(i!==t.mainDocumentPart&&/\/(styles|numbering|footnotes|endnotes)\.xml$/.test(i)&&!a(o.root,1,Zg*4))return false;return true}function ko(t,e,n){if(n.fragmentBytes.byteLength>Ri)return {ok:false,reason:"invalidArgs",detail:"fragment-too-large"};let r=Sb(n.fragmentBytes);if(!r.ok)return {ok:false,reason:"invalidArgs",detail:`fragment-read:${r.reason}`};let a=r.package;if(!bi(a))return {ok:false,reason:"invalidArgs",detail:"fragment-over-budget"};let i=t.resolveStory(e);if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{}};let{store:o,story:s}=i;if(o.compositionActive||t.compositionSessionOpen())return {ok:false,reason:"invalidArgs",detail:"ime-composition-active"};let l=t.currentPackage(),d=o.checkpoint(),c=o.historyDepth,u=0,m="";return xa$1(t,()=>{let k=o.transact(P=>{for(let g of n.priorOps??[])if(!P.apply(g))return;let p=null,y=P.applyPackage(g=>(p=yo(g,a,s.partName),p.ok?p.pkg:g)),f=p;if(!f||!f.ok){m=`fragment-merge:${f?f.reason:"no-merge"}`,P.apply({op:"insertText",paragraphId:"\0fragment-abort",offset:0,text:"x"});return}y&&(u=f.blocks.length,P.apply({op:"insertFragment",paragraphId:n.paragraphId,offset:n.offset,blocks:f.blocks,lastMarkCovered:n.lastMarkCovered}));},{story:s,...n.actorId?{actorId:n.actorId}:{}});return m.length>0?{ok:false,reason:"invalidArgs",detail:m}:k.ok?k.change?{ok:true,change:t.promoteStoryTransactionToPackageUnit(l,o,d,c),blockCount:u}:{ok:true,change:null,blockCount:u}:{ok:false,reason:k.reason,...k.detail?{detail:k.detail}:{}}},k=>ya$1(k))}function vi(t){if(!(t===null||t.start!==t.end))return t}var Le={"text-local":0,"paragraph-local":1,"flow-structural":2,global:3};function Ni(t){return Object.freeze({parts:new Map([[t.name,t]]),partBytes:new Map,relationships:new Map,externalTargets:[],contentTypes:{defaults:new Map,overrides:new Map([[t.name.toLowerCase(),t.contentType]])},mainDocumentPart:t.name})}var Fe=class{current;storyPartName;rev=0;commitCounter=0;undoStack=[];redoStack=[];subscribers=new Set;historyLimit;settingsPartOverride;storyRef=null;composition=null;constructor(e,n,r={}){let a="root"in e,i=typeof n=="string"?n:void 0,o=typeof n=="object"&&n!==null?n:r;this.current=a?Ni(e):e,this.storyPartName=i??(a?e.name:e.mainDocumentPart),this.historyLimit=o.historyLimit??200,this.settingsPartOverride=o.settingsPart;}setStoryRef(e){this.storyRef=e;}get part(){let e=this.current.parts.get(this.storyPartName);if(!e)throw new Error(`story part missing: ${this.storyPartName}`);return e}get package(){return this.current}get revision(){return this.rev}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}get historyDepth(){return this.undoStack.length}get compositionActive(){return this.composition!==null}graftPackage(e){this.current=e(this.current);}replacePart(e){let n=this.current.parts.get(e.name);e!==n&&(this.current=Ub(this.current,e),this.rev+=1);}checkpoint(){return {pkg:this.current,revision:this.rev,undoStack:this.undoStack.slice(),redoStack:this.redoStack.slice(),composition:this.composition?{entry:{...this.composition.entry},committed:this.composition.committed}:null}}restoreCheckpoint(e){this.current=e.pkg,this.rev=e.revision,this.undoStack.length=0,this.undoStack.push(...e.undoStack),this.redoStack.length=0,this.redoStack.push(...e.redoStack),this.composition=e.composition?{entry:{...e.composition.entry},committed:e.composition.committed}:null;}restoreHistoryStacks(e){this.undoStack.length=0,this.undoStack.push(...e.undoStack),this.redoStack.length=0,this.redoStack.push(...e.redoStack);}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}transact(e,n={}){return Ab(n.actorId,()=>this.commitTransaction(e,n))}commitTransaction(e,n){let r=n.origin??b.mutationHuman,a=this.current,i=this.rev,o=this.current,s=null,l=0,d=new Set,c=new Set,u=new Set,m=new Set,k=new Set,h=[],P=n.minimumImpact??"text-local",p=null,y=false,f=null,g=null,O=new Map,L=(C,B)=>{let $=ug.get(C.op);if($===void 0)return O.clear(),null;let G=`${B.name}\0${$}`,ae=O.get(G);ae||(ae={id:null},O.set(G,ae));let E=ae;return ()=>E.id??=Se(B)()},U=(C,B)=>{if(s)return false;let $=o.parts.get(C);if(!$)return s={reason:"unknown-part",detail:C},false;let G=xg($,this.settingsPartOverride?.()??me(o),B);if(G)return s={reason:G},false;let ae=L(B,$),E=Wg($,B,{deferValidation:true,...ae?{revisionIds:ae}:{}});if(!E.ok)return s={reason:E.reason,...E.detail?{detail:E.detail}:{}},false;if(o=Ub(o,E.part),E.part===$&&E.effect.dirty.length===0&&E.effect.created.length===0&&E.effect.deleted.length===0&&E.effect.split===void 0&&(E.effect.splits===void 0||E.effect.splits.length===0)&&E.effect.join===void 0&&E.effect.caret===void 0)return true;d.add(C),l+=1;for(let Q of E.effect.dirty)c.add(Q);for(let Q of E.effect.created)u.add(Q);for(let Q of E.effect.deleted)m.add(Q);for(let Q of E.effect.dependencyKeys)k.add(Q);E.effect.split&&h.push({split:E.effect.split});for(let Q of E.effect.splits??[])h.push({split:Q});return E.effect.join&&h.push({join:E.effect.join}),Le[E.effect.impact]>Le[P]&&(P=E.effect.impact),E.effect.caret&&(g={paragraphId:E.effect.caret.paragraphId,start:0,end:0}),true};if(e({apply:C=>U(this.storyPartName,C),applyTo:(C,B)=>U(C,B),applyPackage:C=>{if(s)return false;O.clear();let B=C(o);if(B===o)return true;for(let[$,G]of B.parts)o.parts.get($)!==G&&d.add($);return o=B,l+=1,Le["flow-structural"]>Le[P]&&(P="flow-structural"),true},selectionBefore:C=>{p=C;},selectionAfter:C=>{y=true,f=C;}}),s){let C=s;return {ok:false,reason:C.reason,...C.detail?{detail:C.detail}:{}}}if(l===0)return {ok:true,change:null};let S=y?f:g,F=y?vi(f):g??void 0;for(let C of d){let B=a.parts.get(C),$=o.parts.get(C);if($===void 0)continue;let G=B?ra$1(B,$):ra$1($,$);if(!G.ok)return {ok:false,reason:"tree-invariant",detail:JSON.stringify(G.issues)}}let V=cc(o);return V.ok?((n.recordsHistory??(r!==b.projection&&r!==b.awareness))&&(this.composition?(this.composition.committed=true,this.composition={...this.composition,entry:{...this.composition.entry,selectionAfter:S}}):(this.pushUndo({pkg:a,revision:i,selectionBefore:p,selectionAfter:S}),this.redoStack.length=0)),this.current=o,this.rev+=1,n.story&&(this.storyRef=n.story),n.minimumImpact&&Le[n.minimumImpact]>Le[P]&&(P=n.minimumImpact),{ok:true,change:this.publish(r,i,{dirty:c,created:u,deleted:m,dependencyKeys:k,splitJoin:h,impact:P,caret:F},n.story??this.storyRef??void 0,n.actorId,n.operationId)}):{ok:false,reason:"package-invariant",detail:JSON.stringify(V.issues)}}beginComposition(e=null){this.composition||(this.composition={entry:{pkg:this.current,revision:this.rev,selectionBefore:e,selectionAfter:null},committed:false});}endComposition(){let e=this.composition;this.composition=null,!(!e||!e.committed)&&(this.pushUndo(e.entry),this.redoStack.length=0);}cancelComposition(){this.composition=null;}undo(){let e=this.undoStack.pop();if(!e)return null;let n=this.rev;return this.redoStack.push({pkg:this.current,revision:this.rev,selectionBefore:e.selectionBefore,selectionAfter:e.selectionAfter}),this.current=e.pkg,this.rev+=1,this.publish(b.mutationUndo,n,null,this.storyRef??void 0)}redo(){let e=this.redoStack.pop();if(!e)return null;let n=this.rev;return this.undoStack.push({pkg:this.current,revision:this.rev,selectionBefore:e.selectionBefore,selectionAfter:e.selectionAfter}),this.current=e.pkg,this.rev+=1,this.publish(b.mutationRedo,n,null,this.storyRef??void 0)}selectionForUndo(){return this.undoStack[this.undoStack.length-1]?.selectionBefore??null}selectionForRedo(){return this.redoStack[this.redoStack.length-1]?.selectionAfter??null}pushUndo(e){this.undoStack.push(e),this.undoStack.length>this.historyLimit&&this.undoStack.shift();}publish(e,n,r,a,i,o){this.commitCounter+=1;let s={change:"model-change",fromRevision:n,toRevision:this.rev,commitId:`commit-${this.commitCounter}`,origin:e,...i?{actorId:i}:{},...o?{operationId:o}:{},dirty:r?[...r.dirty]:[],created:r?[...r.created]:[],deleted:r?[...r.deleted]:[],splitJoin:r?r.splitJoin:[],dependencyKeys:r?[...r.dependencyKeys]:[],impact:r?r.impact:a?.kind==="headerFooter"?"global":"flow-structural",...r?.caret?{caret:r.caret}:{},...a?{story:a}:{}};for(let l of this.subscribers)l(s);return s}};function sn(t,e){return [...t.values()].map(n=>n.part).filter(n=>e.parts.has(n.name))}function xo(t,e){return sn(t,e).map(n=>n.name).sort().join(",")}var vt="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Si="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";function $e(t,e){for(let n of t.children)if(n.kind!=="textValue"&&n.namespaceUri===vt&&n.localName===e)return n;return null}function bt(t,e){return t.attributes.find(n=>n.namespaceUri===vt&&n.localName===e)?.value}function wi(t){let e=bt(t,"val");return e===void 0||e==="1"||e==="true"||e==="on"}function Oo(t,e){return t.kind==="textValue"?Object.freeze({...t,id:e()}):Object.freeze({...t,id:e(),children:t.children.map(n=>Oo(n,e))})}function Ti(t){let e=ta$1(`<w:styles xmlns:w="${vt}"><w:style w:type="paragraph" w:styleId="ListParagraph"><w:pPr><w:contextualSpacing/></w:pPr></w:style></w:styles>`,{name:t.name,contentType:Si});if(!e.ok)return null;let n=$e(e.part.root,"style"),r=n?$e(n,"pPr"):null;return r?Oo(r,Aa$1(t)):null}var Po=["pStyle","keepNext","keepLines","pageBreakBefore","framePr","widowControl","numPr","suppressLineNumbers","pBdr","shd","tabs","suppressAutoHyphens","kinsoku","wordWrap","overflowPunct","topLinePunct","autoSpaceDE","autoSpaceDN","bidi","adjustRightInd","snapToGrid","spacing","ind","contextualSpacing","mirrorIndents","suppressOverlap","jc","textDirection","textAlignment","textboxTightWrap","outlineLvl","divId","cnfStyle","rPr","sectPr","pPrChange"];function Ei(t,e){let n=Po.indexOf(e),r=0;return t.forEach((a,i)=>{if(a.kind==="textValue")return;let o=Po.indexOf(a.localName);o!==-1&&o<=n&&(r=i+1);}),r}function Io(t,e){let n=td(t);if(!n)return null;let r=null;for(let d of n.root.children)if(d.kind!=="textValue"&&d.namespaceUri===vt&&d.localName==="style"&&bt(d,"type")==="paragraph"&&bt(d,"styleId")===e){r=d;break}if(!r)return null;let a=$e(r,"name");if(a&&bt(a,"val")?.trim().toLowerCase()!=="list paragraph"&&e!=="ListParagraph")return null;let i=Ti(n);if(!i)return null;let o=$e(i,"contextualSpacing");if(!o)return null;let s=$e(r,"pPr"),l;if(s){let d=$e(s,"contextualSpacing");if(d&&wi(d))return t;l=d?Ga$1(n,d.id,o):Fa$1(n,s.id,Ei(s.children,"contextualSpacing"),[o]);}else {let d=r.children.findIndex(c=>c.kind!=="textValue"&&["rPr","tblPr","tcPr","tblStylePr"].includes(c.localName));l=Fa$1(n,r.id,d===-1?r.children.length:d,[i]);}return l.ok?Object.freeze({...t,parts:new Map([...t.parts,[n.name,l.part]])}):null}var No="http://schemas.openxmlformats.org/package/2006/relationships",So="application/vnd.openxmlformats-package.relationships+xml",Di="http://schemas.openxmlformats.org/package/2006/content-types",Ro="/[Content_Types].xml",He="/word/numbering.xml",bo="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",nt="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Ai=`<Override PartName="${He}" ContentType="${nt}"/>`;function Nt(t){return `${t.ownerPart}\0${t.id}`}function wo(t,e,n){let r=new Set(e.externalTargets.filter(s=>s.type===Oa$1).map(Nt)),a=n.externalTargets.filter(s=>s.type===Oa$1&&!r.has(Nt(s)));if(a.length===0)return t;let i=new Set(t.map(Nt)),o=a.filter(s=>!i.has(Nt(s)));return o.length===0?t:Object.freeze([...t,...o])}function To(t,e,n){let r=t.filter(a=>a.ownerPart===n||e.has(a.ownerPart));return r.length===t.length?t:Object.freeze(r)}function Eo(t,e,n=[]){if(t===e)return t;let r=_i(t,e);return r=Ui(r,e,n),r}function Co(t,e){let n=new Set;for(let a of t.externalTargets)a.type===Oa$1&&a.ownerPart!==t.mainDocumentPart&&(t.parts.has(a.ownerPart)||e.has(a.ownerPart)||n.add(a.ownerPart));for(let a of t.parts.keys()){let i=Hi(a);!i||i===t.mainDocumentPart||t.parts.has(i)||e.has(i)||t.externalTargets.some(o=>o.ownerPart===i)||n.add(i);}if(n.size===0)return t;let r=t;for(let a of n)r=Bi(r,a);return r}function _i(t,e){let n=e.parts.get(He);if(!n)return t;let r=Ub(t,n),a=(e.relationships.get(e.mainDocumentPart)??[]).find(o=>o.type===bo),i=r.relationships.get(r.mainDocumentPart)??[];if(a&&!i.some(o=>o.type===bo)&&!i.some(o=>o.id===a.id)){let o=Fi(r,{...a,ownerPart:r.mainDocumentPart});o&&(r=o);}if(r.contentTypes.overrides.get(u(He))!==nt){let o=ji(r);o&&(r=o);}return r}function Ui(t,e,n){let r=n.filter(i=>i.type===Oa$1);if(r.length===0)return t;let a=t;for(let i of r){let o=Li(t,e,i.ownerPart);if(!o||a.externalTargets.some(d=>d.ownerPart===o&&d.id===i.id)||new Set((a.relationships.get(o)??[]).map(d=>d.id)).has(i.id))continue;let l=$i(a,{ownerPart:o,id:i.id,type:Oa$1,rawTarget:i.rawTarget,sinkSafe:i.sinkSafe},o);l&&(a=l);}return a}function Li(t,e,n){return n===e.mainDocumentPart?t.mainDocumentPart:typeof n!="string"||n.length===0?null:n}function Fi(t,e){let n=t.mainDocumentPart,r=ln(n),a=t.parts.get(r),i=ta$1(`<Relationships xmlns="${No}"><Relationship Id="${P(e.id,"relationship id")}" Type="${P(e.type,"relationship type")}" Target="${P(e.rawTarget,"relationship target")}"/></Relationships>`,{name:r,contentType:So});if(!i.ok)return null;let o=t.relationships.get(n)??[];if(o.some(d=>d.id===e.id))return null;let s={...e,ownerPart:n,order:o.reduce((d,c)=>Math.max(d,c.order),-1)+1},l=new Map([...t.relationships,[n,[...o,s]]]);return a?Mo(t,a,i.part.root.children[0],l):Object.freeze({...t,parts:new Map([...t.parts,[r,i.part]]),relationships:l})}function $i(t,e,n=t.mainDocumentPart){let r=n;if(typeof r!="string"||r.length===0)return null;let a=ln(r),i=t.parts.get(a),o=ta$1(`<Relationships xmlns="${No}"><Relationship Id="${P(e.id,"relationship id")}" Type="${Oa$1}" Target="${P(e.rawTarget,"relationship target")}" TargetMode="External"/></Relationships>`,{name:a,contentType:So});if(!o.ok)return null;let s=[...t.externalTargets,e];if(!i)return Object.freeze({...t,parts:new Map([...t.parts,[a,o.part]]),externalTargets:s});let l=Mo(t,i,o.part.root.children[0],t.relationships);return l?Object.freeze({...l,externalTargets:s}):null}function Mo(t,e,n,r){if(!n)return null;let a=Aa$1(e),i=Fa$1(e,e.root.id,e.root.children.length,[Do(n,a)]);return i.ok?Object.freeze({...t,parts:new Map([...t.parts,[e.name,i.part]]),relationships:r}):null}function Do(t,e){return t.kind==="textValue"?{...t,id:e()}:{...t,id:e(),children:t.children.map(n=>Do(n,e))}}function ln(t){let e=t.lastIndexOf("/");return `${t.slice(0,e)}/_rels/${t.slice(e+1)}.rels`}function Hi(t){let e=/^(.*)\/_rels\/([^/]+)\.rels$/.exec(t);if(!e)return null;let n=e[1],r=e[2];return n===""||r===""?null:`${n}/${r}`}function Bi(t,e){let n=ln(e),r=new Map(t.parts);r.delete(n);let a=new Map(t.partBytes);a.delete(n);let i=new Map(t.relationships);i.delete(e);let o=Object.freeze(t.externalTargets.filter(s=>s.ownerPart!==e));return Object.freeze({...t,parts:r,partBytes:a,relationships:i,externalTargets:o})}function ji(t){let e=t.contentTypes.overrides.get(u(He));if(e===nt)return t;if(e!==void 0)return null;let n=t.partBytes.get(Ro);if(!n)return null;let r=strFromU8(n),a=vo(r);if(!a)return null;let i=r.lastIndexOf(`</${a.rootName}>`);if(i===-1)return null;let o=r.slice(0,i)+Ai+r.slice(i),s=vo(o);if(!s||s.rootName!==a.rootName)return null;let l=[...a.children,Ao("Override",{PartName:He,ContentType:nt})];return s.children.length!==l.length||s.children.some((d,c)=>d!==l[c])?null:Object.freeze({...t,partBytes:new Map([...t.partBytes,[Ro,strToU8(o)]]),contentTypes:Object.freeze({defaults:t.contentTypes.defaults,overrides:new Map([...t.contentTypes.overrides,[u(He),nt]])})})}function vo(t){let e=W(t);if(!e.ok)return null;let n=e.nodes.filter(s=>s.type==="element");if(n.length!==1)return null;let r=n[0],a=r.name.indexOf(":"),i=a===-1?"":r.name.slice(0,a);if(r.name.slice(a+1)!=="Types"||r.attributes[i?`xmlns:${i}`:"xmlns"]!==Di)return null;let o=[];for(let s of r.children)s.type==="element"&&o.push(Ao(s.name,s.attributes));return {rootName:r.name,children:o}}function Ao(t,e){let n=Object.entries(e).map(([r,a])=>`${r}=${a}`).sort();return [t,...n].join("")}var _o=4e3,Uo=64;function Lo(t){return Me(t,"footnote")!==null||Me(t,"endnote")!==null}function Fo(t,e,n,r){if(!Lo(t))return false;if(r.has(n.paragraphId))return true;r.add(n.paragraphId);let a=Ca$1(e,n.paragraphId);return !a||a.kind!=="paragraph"?true:Ee(a).some(i=>i.node.kind==="noteReference"&&i.start<n.end&&i.end>n.start)}function $o(t,e,n,r){if(!Lo(t))return false;if(r.has(n.blockId))return true;r.add(n.blockId);let a=Ca$1(e,n.blockId);if(!a||a.kind==="textValue")return true;let i=0,o=(s,l)=>{if(i>=_o||l>Uo)return true;if(i+=1,s.kind==="textValue")return false;if(s.kind==="paragraph")return Ee(s).some(d=>d.node.kind==="noteReference");for(let d of s.children)if(o(d,l+1))return true;return false};return o(a,0)}function Ho(t,e,n){if(n.count>=_o||e>Uo)return true;if(n.count+=1,t.kind==="textValue")return false;if(t.kind==="commentRangeStart"||t.kind==="commentRangeEnd"||t.kind==="commentReference")return true;for(let r of t.children)if(Ho(r,e+1,n))return true;return false}function Bo(t,e,n,r){if(!Of(t))return false;let a=n.op==="deleteText"?n.paragraphId:n.blockId;if(r.has(a))return true;r.add(a);let i=Ca$1(e,a);return !i||i.kind==="textValue"?true:Ho(i,0,{count:0})}var dn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",cn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function jo(t,e){let r=(t.relationships.get(t.mainDocumentPart)??[]).find(a=>a.id===e);return r?r.type!==dn&&r.type!==cn?{ok:false,reason:"wrong-relationship-type",detail:r.type}:Vi(t,r):{ok:false,reason:"dangling-relationship",detail:e}}function Vi(t,e){let n=E(e);if(n.mode==="External")return {ok:false,reason:"external-relationship",detail:e.id};if(!n.target.ok)return {ok:false,reason:"bad-relationship-target",detail:n.target.reason};let r=t.parts.get(n.target.partName);if(!r)return {ok:false,reason:"missing-part",detail:n.target.partName};let a=r.root.localName;return a!=="hdr"&&a!=="ftr"?{ok:false,reason:"not-a-story-part",detail:a||r.name}:{ok:true,partName:r.name,part:r}}function ve(t,e){return e.compositionActive||t.compositionSessionOpen()?{ok:false,reason:"invalidArgs",detail:"ime-composition-active"}:null}function Vo(t,e){let n=Ca$1(t,e);return !n||n.kind!=="drawing"?null:n.children.find(a=>a.kind==="inlineDrawing"||a.kind==="anchoredDrawing")??null}function Wo(t,e,n){let r=t.parts.get(e);if(!r)return null;let a=Ca$1(r,n);return !a||a.kind!=="drawing"?null:ab(a,{ownerPartName:e,supportedMcRequires:Xa$1,limits:Wa$1,resolveRelationship:Za(t,e)})}function Ko(t,e,n){let r=F(t.relationships.get(e)??[],e,n);return r.mode==="internal"?r.partName:null}function Be(t,e,n,r){let a=t.resolveStory(e);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let i=ve(t,a.store);if(i)return i;let{store:o,story:s}=a;return xa$1(t,()=>Wi(t,o,s,n,r),l=>ya$1(l))}function Wi(t,e,n,r,a){let i=n.partName,o=t.currentPackage(),s=e.checkpoint(),l=e.historyDepth,d=null,c=false,u=false,m=e.transact(P=>{if(a?.commitGuard?.()===false){u=true;return}if(a?.expectedPackageRevision!==void 0&&t.packageRevision!==a.expectedPackageRevision){c=true;return}let p=r(P,i);if(p===null){P.apply({op:"insertText",paragraphId:"\0task12-abort",offset:0,text:"x"});return}d=p;},{story:n,...a?.actorId?{actorId:a.actorId}:{},...n.kind==="headerFooter"||n.kind==="notesPart"?{minimumImpact:"global"}:{}});if(u)return {ok:false,reason:"invalidArgs",detail:"stale drawing selection"};if(c)return {ok:false,reason:"invalidArgs",detail:"stale-package-epoch"};if(!m.ok)return {ok:false,reason:m.reason,...m.detail?{detail:m.detail}:{}};if(!m.change)return {ok:true,change:null};let k=m.change.created.find(P=>{let p=e.part;return Ca$1(p,P)?.kind==="drawing"});return k&&(d=k),{ok:true,change:t.promoteStoryTransactionToPackageUnit(o,e,s,l),...d?{drawingNodeId:d}:{}}}function zo(t,e,n){let r=t.parts.get(e);if(!r)return null;let a=Vo(r,n);return a?Rg(a):null}function mn(t,e,n,r){let a=false;return t.applyPackage(i=>{let o=i.parts.get(e);if(!o)return i;let s=Ca$1(o,n);if(!s||s.kind!=="drawing")return i;let l=Vo(o,n);if(!l)return i;let d=Sg(l,r),c=Ki(s,d),u=Ga$1(o,s.id,c,{deferValidation:true});return u.ok?(a=true,Ub(i,u.part)):i}),a}function Ki(t,e){return {...t,children:t.children.map(n=>n.id===e.id?e:n)}}async function Go(t,e,n){let r=Mb(n.widthPoints),a=Mb(n.heightPoints);if(r===null||a===null)return {ok:false,reason:"invalidArgs",detail:"invalid-dimensions"};let i=t.resolveStory(e);if(!i.ok)return {ok:false,reason:i.reason,...i.detail?{detail:i.detail}:{}};let o=ve(t,i.store);if(o)return o;let s=i.story.partName,l=await Ib(n.decodePort,n.bytes,n.mime);if(!l.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let d=l.bytes,c=Kb(t.currentPackage(),s,{bytes:d,mime:n.mime});if(!c.ok)return {ok:false,reason:"invalidArgs",detail:c.reason==="invalid-image"?"invalid-image":c.reason};let u=c.partName,m=Be(t,e,(k,h)=>{let P=t.currentPackage(),p=Kb(P,h,{bytes:d,mime:n.mime});if(!p.ok)return null;P=p.pkg,u=p.partName;let y;if(n.hyperlink){let g=Bd(P,n.hyperlink,h);if(!g)return null;P=g.pkg,y=g.relationshipId;}if(!k.applyPackage(()=>P))return null;let f=Nb({docPrId:p.docPrId,relationshipId:p.relationshipId,extentEmu:{cx:r,cy:a},...n.title!==void 0?{title:n.title}:{},...n.description!==void 0?{description:n.description}:{},...y?{hyperlinkRelationshipId:y}:{}});return k.apply({op:"insertDrawing",paragraphId:n.paragraphId,offset:n.offset,drawing:f,...n.revision?{revision:n.revision}:{}})?f.id:null},{expectedPackageRevision:n.expectedPackageRevision,...n.commitGuard?{commitGuard:n.commitGuard}:{},...n.actorId?{actorId:n.actorId}:{}});return m.ok?m.change?{...m,mediaPartName:u}:{ok:true,change:null,mediaPartName:u}:m}async function un(t,e,n,r,a,i,o){let s=t.resolveStory(e);if(!s.ok)return {ok:false,reason:s.reason,...s.detail?{detail:s.detail}:{}};let l=ve(t,s.store);if(l)return l;let d=s.story.partName,c=await Ib(i,r,a);if(!c.ok)return {ok:false,reason:"invalidArgs",detail:"invalid-image"};let u=c.bytes,m=Kb(t.currentPackage(),d,{bytes:u,mime:a});return m.ok?Be(t,e,(k,h)=>{let P=t.currentPackage(),p=Wo(P,d,n),y=p?.picture?.embeddedRelationshipId??null,f=p?.picture?.linkedRelationshipId??null,g=y??f;if(!g)return null;let O=y!==null?Ko(P,d,y):null,L=P,U=Kb(L,h,{bytes:u,mime:a});return !U.ok||(L=U.pkg,!k.applyPackage(()=>L))||!k.apply({op:"replaceDrawingResource",drawingNodeId:n,relationshipId:U.relationshipId})?null:(k.applyPackage(S=>Pb(S,h,O,g)),n)},{expectedPackageRevision:o.expectedPackageRevision,...o.commitGuard?{commitGuard:o.commitGuard}:{},...o.actorId?{actorId:o.actorId}:{}}):{ok:false,reason:"invalidArgs",detail:m.reason==="invalid-image"?"invalid-image":m.reason}}function Xo(t,e,n){let r=t.resolveStory(e);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let a=ve(t,r.store);if(a)return a;let i=r.story.partName,o=t.currentPackage(),s=Wo(o,i,n);if(!s)return {ok:false,reason:"unknown-drawing"};let l=s.picture?.embeddedRelationshipId??null,d=s.picture?.linkedRelationshipId??null,c=l??d,u=l!==null?Ko(o,i,l):null;return Be(t,e,(m,k)=>m.apply({op:"deleteDrawing",drawingNodeId:n})?(m.applyPackage(h=>Pb(h,k,u,c)),n):null)}function zi(t,e){let n=null,r=i=>{let o=false,s=false,l=(d,c)=>{if(o||d.kind==="textValue")return;if(d.id===e){o=true,s=c;return}let u=c||d.kind==="revisionDelete"||d.kind==="revisionMoveFrom";for(let m of d.children)l(m,u);};return l(i,false),s},a=i=>{if(!(n!==null||i.kind==="textValue")){if(i.kind==="paragraph"){let o=Fe$1(i).spanOf(e);if(o!==null&&o.end>o.start){let s=Ca$1(t,e);if(!s||s.kind!=="drawing"&&!_a$1(s))return;n={paragraphId:i.id,start:o.start,end:o.end,alreadyDeleted:r(i)};}return}for(let o of i.children)a(o);}};return a(t.root),n}function Yo(t,e,n,r){let a=t.resolveStory(e);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let i=ve(t,a.store);if(i)return i;let o=t.currentPackage().parts.get(a.story.partName);if(!o)return {ok:false,reason:"unknown-drawing"};let s=zi(o,n);return s?s.alreadyDeleted?{ok:true,change:null}:Be(t,e,l=>l.apply({op:"deleteText",paragraphId:s.paragraphId,start:s.start,end:s.end,revision:r})?n:null):{ok:false,reason:"unknown-drawing"}}async function Jo(t,e,n,r,a,i,o,s){let l=await Qb(a,r,i,void 0,o);return l.ok?un(t,e,n,l.bytes,l.mime,o,{expectedPackageRevision:t.packageRevision,...s?{actorId:s}:{}}):{ok:false,reason:"invalidArgs",detail:`${l.reason}${l.detail?`:${l.detail}`:""}`}}function qo(t,e,n,r,a,i){let o=t.resolveStory(e);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let s=ve(t,o.store);return s||Be(t,e,(l,d)=>{let c=zo(t.currentPackage(),d,n),u=null;if(i!==null){let k=Bd(t.currentPackage(),i,d);if(!k||!l.applyPackage(()=>k.pkg))return null;u=k.relationshipId;}if(!l.apply({op:"setDrawingMetadata",drawingNodeId:n,title:r,description:a,...i===null?{hyperlink:null}:{}}))return null;if(i!==null&&u!==null){if(!mn(l,d,n,u))return null}else if(i===null&&!mn(l,d,n,null))return null;let m=false;return l.applyPackage(k=>{let h=Dd(k,d,c);return h===null?(m=true,k):h}),m?null:n})}function Qo(t,e,n){let r=t.resolveStory(e);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};let a=ve(t,r.store);return a||Be(t,e,(i,o)=>{let s=zo(t.currentPackage(),o,n.drawingNodeId),l=null;if(n.hyperlink!==null){let c=Bd(t.currentPackage(),n.hyperlink,o);if(!c||!i.applyPackage(()=>c.pkg))return null;l=c.relationshipId;}for(let c of n.ops)if(!i.apply(c))return null;if(!mn(i,o,n.drawingNodeId,n.hyperlink===null?null:l))return null;let d=false;return i.applyPackage(c=>{let u=Dd(c,o,s);return u===null?(d=true,c):u}),d?null:n.drawingNodeId})}function Gi(t,e){if(t===e)return true;if(t.byteLength!==e.byteLength)return false;for(let n=0;n<t.byteLength;n+=1)if(t[n]!==e[n])return false;return true}function Zo(t,e){if(t===e)return true;if(t.size!==e.size)return false;for(let[n,r]of t)if(e.get(n)!==r)return false;return true}function Xi(t,e){return t===e||t.ownerPart===e.ownerPart&&t.id===e.id&&t.type===e.type&&t.rawTarget===e.rawTarget&&t.targetMode===e.targetMode&&t.order===e.order}function Yi(t,e){if(t===e)return true;if(t.size!==e.size)return false;for(let[n,r]of t){let a=e.get(n);if(!a||a.length!==r.length||a!==r&&r.some((i,o)=>!Xi(i,a[o])))return false}return true}function Ji(t,e){return t===e?true:t.length!==e.length?false:t.every((n,r)=>{let a=e[r];return n===a||n.ownerPart===a.ownerPart&&n.id===a.id&&n.type===a.type&&n.rawTarget===a.rawTarget&&n.sinkSafe===a.sinkSafe})}function qi(t,e){if(t===e)return true;if(t.size!==e.size)return false;for(let[n,r]of t){let a=e.get(n);if(!a||!Gi(r,a))return false}return true}function Qi(t,e){return t.contentTypes===e.contentTypes||Zo(t.contentTypes.defaults,e.contentTypes.defaults)&&Zo(t.contentTypes.overrides,e.contentTypes.overrides)}var St=Object.freeze({equal:true,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"}),wt=Object.freeze({equal:false,dirty:Object.freeze([]),dependencyKeys:Object.freeze([]),impact:"global"});function ea(t){for(let[e,n]of t)if(!oa$1(e,n))return wt;return St}function Zi(t,e){if(t===e)return St;if(t.mainDocumentPart!==e.mainDocumentPart||t.parts.size!==e.parts.size||!qi(t.partBytes,e.partBytes)||!Yi(t.relationships,e.relationships)||!Ji(t.externalTargets,e.externalTargets)||!Qi(t,e))return wt;let n=[];for(let[o,s]of t.parts){let l=e.parts.get(o);if(!l)return wt;s!==l&&n.push([s,l]);}if(n.length===0)return St;let[r,a]=n[0];if(n.length>1||r.name!==t.mainDocumentPart)return ea(n);let i=pa$1(a.root,r.root);return i.undecided?ea(n):i.equal?St:!i.idsPreserved||i.reach==="outside-paragraph"||i.paragraphIds.length===0?wt:{equal:false,dirty:i.paragraphIds,dependencyKeys:[g.story],impact:i.reach==="paragraph-text"?"text-local":"flow-structural"}}function pn(t){return {ok:false,reason:"package-invariant",detail:t}}function es(t,e){if(!t.parts.get(t.mainDocumentPart))return pn("no-main-document");for(let[r,a]of t.parts){let i=e?.parts.get(r);if(i===a)continue;let o=i?ra$1(i,a):qa$1(a);if(!o.ok)return pn(`invalid-part:${r}:${o.issues[0]?.code??"invalid"}`)}let n=cc(t);return n.ok?null:pn(n.issues[0]?.code??"package-invariant")}function ta(t,e,n){let r=t.currentPackage(),a=Zi(e,r);if(a.equal)return {ok:true,change:null};let i=es(e,r);if(i)return i;let o=t.bodyStore().part.name,s=a.impact!=="global"&&e.mainDocumentPart===o;return xa$1(t,()=>{let l=t.packageRevision;return t.installAuthoritativePackageSnapshot(e),{ok:true,change:t.publishStoryWrite({change:"model-change",fromRevision:l,toRevision:l+1,commitId:`pkg-remote-${l+1}`,origin:n.origin,...n.actorId?{actorId:n.actorId}:{},...n.operationId?{operationId:n.operationId}:{},dirty:s?a.dirty:[],created:[],deleted:[],splitJoin:[],dependencyKeys:s?a.dependencyKeys:[],impact:s?a.impact:"global",story:{kind:"body",partName:o}})}},()=>false)}function oa(t,e,n,r){let a=[...e],i=new Set;for(let o of a)t.parts.has(o)&&i.add(o);for(let o of n)na(o,a,i);for(let o of r)na(o,a,i);return i}function aa(t,e,n,r,a){let i=new Set(t);i.add(e),i.add(n);for(let o of r)ra(o,i);for(let o of a)ra(o,i);return i}function na(t,e,n){if(t.kind==="story"){n.add(t.partName);return}for(let r of e)(t.before.parts.has(r)||t.after.parts.has(r))&&n.add(r);}function ra(t,e){if(t.kind==="story"){e.add(t.partName);return}for(let n of t.before.parts.keys())e.add(n);for(let n of t.after.parts.keys())e.add(n);}var ia=new Set(["acceptRevision","rejectRevision","acceptAllRevisions","rejectAllRevisions"]),ts=new Set(["deleteTableRow","deleteTableColumn","removeContentControl","removeRepeatingSectionItem"]),ns=64,sa=class{pkg;packageRev=0;body;stories=new Map;rIdToPartName=new Map;undoOrder=[];redoOrder=[];subscribers=new Set;historyLimit;maxEditableStoryParts;cascadeNoteReferences;lastChange=null;shellHyperlinks=Object.freeze([]);compositionSession=null;commitCounter=0;currentPackageMemo=null;constructor(e,n,r={}){this.pkg=Ub(e,n),this.historyLimit=r.historyLimit??200,this.maxEditableStoryParts=r.maxEditableStoryParts??ns,this.cascadeNoteReferences=r.cascadeDeletedNoteReferences??$e$1,this.body=new Fe(this.pkg,n.name,{historyLimit:this.historyLimit,settingsPart:()=>me(this.pkg)}),this.body.setStoryRef({kind:"body",partName:n.name});}get packageRevision(){return this.packageRev}get canUndo(){return this.undoOrder.length>0}get canRedo(){return this.redoOrder.length>0}get lastModelChange(){return this.lastChange}bodyStore(){return this.body}currentPackage(){let e=this.currentPackageMemo;if(e&&e.pkg===this.pkg&&e.bodyPart===this.body.part){let a=0,i=true;for(let o of this.stories.values()){if(e.storyParts[a]!==o.part){i=false;break}a+=1;}if(i&&a===e.storyParts.length)return e.result}let n=Ub(this.pkg,this.body.part),r=[];for(let a of this.stories.values())r.push(a.part),this.pkg.parts.has(a.part.name)&&(n=Ub(n,a.part));return this.currentPackageMemo={pkg:this.pkg,bodyPart:this.body.part,storyParts:r,result:n},n}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}resolveStory(e){return e.kind==="body"?{ok:true,story:{kind:"body",partName:this.body.part.name},store:this.body}:e.kind==="notesPart"?e.noteKind!=="footnote"&&e.noteKind!=="endnote"?{ok:false,reason:"unknown-scope",detail:String(e.noteKind)}:this.openNotesPartStore(e.noteKind):e.kind!=="headerFooter"||typeof e.rId!="string"||e.rId.length===0?{ok:false,reason:"unknown-scope",detail:String(e.kind)}:this.openHeaderFooterStore(e.rId)}partFor(e){let n=this.resolveStory(e);return n.ok?n.store.part:null}revisionFor(e){let n=this.resolveStory(e);return n.ok?n.store.revision:null}transact(e,n,r={}){return xa$1(this,()=>this.commitStoryTransaction(e,n,r),ya$1)}commitStoryTransaction(e,n,r={}){let a=this.resolveStory(e);if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{}};let{store:i,story:o}=a,s=this.currentPackage(),l=i.historyDepth,d=i.compositionActive,c=i.checkpoint(),u=false,m=new Set,k=false,h=new Set,P=false,p,y=i.transact(g=>{n({...g,apply:O=>(O.op==="setListNumbering"&&O.numId!==null&&(P=true),O.op==="setParagraphProperties"&&(p??=O.properties.find(L=>L.localName==="pStyle")?.attributes?.val),u||(O.op==="deleteText"&&Fo(this.pkg,i.part,O,m)||O.op==="deleteBlock"&&$o(this.pkg,i.part,O,m)||ia.has(O.op))&&(u=true),k||(O.op==="deleteText"||O.op==="deleteBlock"?k=Bo(this.pkg,i.part,O,h):(ia.has(O.op)||ts.has(O.op))&&(k=true)),g.apply(O)),selectionBefore:O=>g.selectionBefore(O),selectionAfter:O=>g.selectionAfter(O)});},{...r,story:o,...o.kind==="headerFooter"||o.kind==="notesPart"?{minimumImpact:"global"}:{}});if(!y.ok)return {ok:false,reason:y.reason,...y.detail?{detail:y.detail}:{}};if(this.syncPackageFromStore(i),P&&p){let g=Io(this.pkg,p);g&&this.replacePackageShell(g);}let f=false;if(y.change&&u){let g=this.currentPackage(),O=this.cascadeNoteReferences(s,g);if(O===null)return i.restoreCheckpoint(c),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"note-cascade-failed"};O!==g&&(this.installPackageSnapshotInternal(O),d?this.compositionSession&&(this.compositionSession.packageWideEffects=true):i.restoreHistoryStacks(c),f=true);}if(y.change&&k){let g=this.currentPackage(),O=Sf(s,g,{storyPartName:o.partName});if(O===null)return i.restoreCheckpoint(c),this.installPackageSnapshotInternal(s),{ok:false,reason:"invalidArgs",detail:"comment-cascade-failed"};O!==g&&(this.installPackageSnapshotInternal(O),d?this.compositionSession&&(this.compositionSession.packageWideEffects=true):i.restoreHistoryStacks(c),f=true);}if(y.change){this.packageRev+=1,!d&&(i.historyDepth>l||f)&&(f?this.pushUndoPointer({kind:"package",before:s,after:this.currentPackage()}):this.pushUndoPointer({kind:"story",partName:o.partName,story:o}));let g=f?this.publishSynthetic(y.change.origin,"global",o,y.change.created):y.change;return f||this.publish(g),{ok:true,change:g}}return {ok:true,change:y.change}}compositionSessionOpen(){return this.compositionSession!==null}beginComposition(e,n=null){let r=this.resolveStory(e);return !r.ok||this.compositionSession&&this.compositionSession.partName!==r.story.partName&&(this.endComposition(),r=this.resolveStory(e),!r.ok)?false:(this.compositionSession||(this.compositionSession={partName:r.story.partName,beforePackage:this.currentPackage(),storyCheckpoint:r.store.checkpoint(),packageWideEffects:false}),r.store.beginComposition(n),true)}endComposition(){let e=this.compositionSession;if(this.compositionSession=null,!e){this.body.endComposition();return}let n=e.partName===this.body.part.name?this.body:this.stories.get(e.partName);if(!n)return;let r=n.historyDepth;if(n.endComposition(),e.packageWideEffects){n.restoreHistoryStacks(e.storyCheckpoint),this.syncPackageFromStore(n),this.pushUndoPointer({kind:"package",before:e.beforePackage,after:this.currentPackage()});return}if(n.historyDepth>r){let a=e.partName===this.body.part.name?{kind:"body",partName:e.partName}:this.storyRefForPart(e.partName);a&&this.pushUndoPointer({kind:"story",partName:e.partName,story:a});}this.syncPackageFromStore(n);}cancelComposition(){let e=this.compositionSession;if(this.compositionSession=null,!e){this.body.cancelComposition();return}let n=e.partName===this.body.part.name?this.body:this.stories.get(e.partName);if(e.packageWideEffects){n&&n.restoreCheckpoint(e.storyCheckpoint),this.installPackageSnapshotInternal(e.beforePackage),this.packageRev+=1;let r=e.partName===this.body.part.name?{kind:"body",partName:e.partName}:this.storyRefForPart(e.partName);this.publishSynthetic(b.mutationHuman,"global",r??{kind:"body",partName:this.body.part.name},[]);return}n?.cancelComposition();}applyLifecycleOp(e){return xa$1(this,()=>this.commitLifecycleOp(e),ya$1)}commitLifecycleOp(e){let n=this.currentPackage();if(Ze(e)){let o=_e(n,e);if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};if(o.package===n)return {ok:true,change:null};this.installPackageSnapshotInternal(o.package),this.pushUndoPointer({kind:"package",before:n,after:o.package}),this.packageRev+=1;let s={kind:"body",partName:this.body.part.name},l=this.publishSynthetic(b.mutationHuman,o.impact,s,o.createdPartName?[o.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:l}}if(!Ed(e))return {ok:false,reason:"invalidArgs",detail:"not-lifecycle-op"};let r=Fd(n,e);if(!r.ok)return {ok:false,reason:r.reason,...r.detail?{detail:r.detail}:{}};this.installPackageSnapshotInternal(r.package),this.pushUndoPointer({kind:"package",before:n,after:r.package}),this.packageRev+=1;let a={kind:"body",partName:this.body.part.name},i=this.publishSynthetic(b.mutationHuman,r.impact,a,r.createdPartName?[r.createdPartName]:[]);return this.evictUnreachableStories(),{ok:true,change:i}}undo(){let e=this.undoOrder.pop();if(!e)return null;if(e.kind==="package"){this.installPackageSnapshotInternal(e.before),this.redoOrder.push(e),this.packageRev+=1;let a=this.publishSynthetic(b.mutationUndo,"global",{kind:"body",partName:this.body.part.name},[]);return this.evictUnreachableStories(),a}let n=e.partName===this.body.part.name?this.body:this.stories.get(e.partName);if(!n)return null;let r=n.undo();return r?(this.redoOrder.push(e),this.syncPackageFromStore(n),this.packageRev+=1,this.publish(r),this.evictUnreachableStories(),r):null}redo(){let e=this.redoOrder.pop();if(!e)return null;if(e.kind==="package"){this.installPackageSnapshotInternal(e.after),this.undoOrder.push(e),this.packageRev+=1;let a=this.publishSynthetic(b.mutationRedo,"global",{kind:"body",partName:this.body.part.name},[]);return this.evictUnreachableStories(),a}let n=e.partName===this.body.part.name?this.body:this.stories.get(e.partName);if(!n)return null;let r=n.redo();return r?(this.undoOrder.push(e),this.syncPackageFromStore(n),this.packageRev+=1,this.publish(r),this.evictUnreachableStories(),r):null}selectionForUndo(){let e=this.undoOrder[this.undoOrder.length-1];return !e||e.kind==="package"?null:(e.partName===this.body.part.name?this.body:this.stories.get(e.partName))?.selectionForUndo()??null}selectionForRedo(){let e=this.redoOrder[this.redoOrder.length-1];return !e||e.kind==="package"?null:(e.partName===this.body.part.name?this.body:this.stories.get(e.partName))?.selectionForRedo()??null}openStoryParts(){return sn(this.stories,this.pkg)}openedStoryCount(){return 1+this.stories.size}openStoryToken(){return xo(this.stories,this.pkg)}insertImage(e,n){return Go(this,e,n)}applyFragmentPaste(e,n){return ko(this,e,n)}replaceImage(e,n,r,a,i,o){return un(this,e,n,r,a,i,o)}deleteImage(e,n){return Xo(this,e,n)}deleteImageTracked(e,n,r){return Yo(this,e,n,r)}embedExternalImage(e,n,r,a,i,o,s){return Jo(this,e,n,r,a,i,o,s)}setDrawingMetadataWithHyperlink(e,n,r,a,i){return qo(this,e,n,r,a,i)}applyImageProperties(e,n){return Qo(this,e,n)}promoteStoryTransactionToPackageUnit(e,n,r,a){this.installPackageSnapshotInternal(n.package),n.historyDepth>a&&n.restoreHistoryStacks(r),this.pushUndoPointer({kind:"package",before:e,after:this.currentPackage()}),this.packageRev+=1;let i=n.part.name===this.body.part.name?{kind:"body",partName:n.part.name}:this.storyRefForPart(n.part.name);return this.publishSynthetic(b.mutationHuman,i?.kind==="headerFooter"?"global":"flow-structural",i??{kind:"body",partName:this.body.part.name},[])}publishStoryWrite(e){return e?(this.packageRev+=1,this.publish(e),e):null}adoptPackageUnit(e){let n=this.currentPackage();e!==n&&this.pushUndoPointer({kind:"package",before:e,after:n});}installPackageSnapshot(e){this.installPackageSnapshotInternal(e);}installAuthoritativePackageSnapshot(e){this.installPackageSnapshotInternal(e,false);}publishRemotePackage(e,n){return ta(this,e,n)}replacePackageShell(e){this.shellHyperlinks=wo(this.shellHyperlinks,this.pkg,e);let n=e;n=Ub(n,this.body.part);for(let r of this.stories.values())e.parts.has(r.part.name)&&(n=Ub(n,r.part));this.pkg=n;}installPackageSnapshotInternal(e,n=true){let r=n?Eo(e,this.pkg,this.shellHyperlinks):e,a=r.parts.get(r.mainDocumentPart);if(!a)return;this.body.replacePart(a);for(let[o,s]of this.stories){let l=r.parts.get(o);l&&s.replacePart(l);}this.rIdToPartName.clear();let i=r.relationships.get(r.mainDocumentPart)??[];for(let o of i){if(o.type!==dn&&o.type!==cn)continue;let s=E(o);s.mode!=="Internal"||!s.target.ok||this.stories.has(s.target.partName)&&r.parts.has(s.target.partName)&&this.rIdToPartName.set(o.id,s.target.partName);}this.pkg=r,this.pkg=Ub(this.pkg,this.body.part);for(let o of this.stories.values())this.pkg.parts.has(o.part.name)&&(this.pkg=Ub(this.pkg,o.part));}openNotesPartStore(e){let n=Me(this.currentPackage(),e);if(!n)return {ok:false,reason:"missing-part",detail:e};let r=this.stories.get(n.name);if(r)return {ok:true,story:{kind:"notesPart",partName:n.name,noteKind:e},store:r};if(this.openedStoryCount()>=this.maxEditableStoryParts&&this.evictUnreachableStories(),this.openedStoryCount()>=this.maxEditableStoryParts)return {ok:false,reason:"too-many-story-stores",detail:String(this.maxEditableStoryParts)};let a=yb(n),i=new Fe(a,{historyLimit:this.historyLimit,settingsPart:()=>me(this.pkg)}),o={kind:"notesPart",partName:a.name,noteKind:e};return i.setStoryRef(o),this.stories.set(a.name,i),a!==n&&(this.pkg=Ub(this.pkg,a)),{ok:true,story:o,store:i}}openHeaderFooterStore(e){let n=this.rIdToPartName.get(e);if(n){let l=this.stories.get(n);if(l)return {ok:true,story:{kind:"headerFooter",partName:n,rId:e},store:l}}let r=jo(this.currentPackage(),e);if(!r.ok)return r;let a=this.stories.get(r.partName);if(a)return this.rIdToPartName.set(e,r.partName),{ok:true,story:{kind:"headerFooter",partName:r.partName,rId:e},store:a};if(this.openedStoryCount()>=this.maxEditableStoryParts&&this.evictUnreachableStories(),this.openedStoryCount()>=this.maxEditableStoryParts)return {ok:false,reason:"too-many-story-stores",detail:String(this.maxEditableStoryParts)};let i=yb(r.part),o=new Fe(i,{historyLimit:this.historyLimit,settingsPart:()=>me(this.pkg)}),s={kind:"headerFooter",partName:i.name,rId:e};return o.setStoryRef(s),this.stories.set(i.name,o),this.rIdToPartName.set(e,i.name),i!==r.part&&(this.pkg=Ub(this.pkg,i)),{ok:true,story:s,store:o}}storyRefForPart(e){if(e===this.body.part.name)return {kind:"body",partName:e};for(let[r,a]of this.rIdToPartName)if(a===e)return {kind:"headerFooter",partName:e,rId:r};let n=this.currentPackage().parts.get(e);return n?.root.localName==="footnotes"?{kind:"notesPart",partName:e,noteKind:"footnote"}:n?.root.localName==="endnotes"?{kind:"notesPart",partName:e,noteKind:"endnote"}:null}syncPackageFromStore(e){this.pkg=Ub(this.pkg,e.part);}pushUndoPointer(e){this.undoOrder.push(e),this.redoOrder.length=0,this.undoOrder.length>this.historyLimit&&this.undoOrder.shift(),this.evictUnreachableStories();}evictUnreachableStories(){let e=oa(this.pkg,this.stories.keys(),this.undoOrder,this.redoOrder);for(let[a]of [...this.stories])if(!e.has(a)){this.stories.delete(a);for(let[i,o]of [...this.rIdToPartName])o===a&&this.rIdToPartName.delete(i);}let n=aa(e,this.pkg.mainDocumentPart,this.body.part.name,this.undoOrder,this.redoOrder),r=Co(this.pkg,n);r!==this.pkg&&(this.pkg=r),this.shellHyperlinks=To(this.shellHyperlinks,n,this.pkg.mainDocumentPart);}publish(e){this.lastChange=e;for(let n of this.subscribers)n(e);}publishSynthetic(e,n,r,a){this.commitCounter+=1;let i=this.packageRev-1,o={change:"model-change",fromRevision:i<0?0:i,toRevision:this.packageRev,commitId:`pkg-commit-${this.commitCounter}`,origin:e,dirty:[],created:[...a],deleted:[],splitJoin:[],dependencyKeys:[],impact:n,story:r};return this.publish(o),o}};function rs(t,e,n){for(let r of t.attributes)if(r.localName===n&&r.namespaceUri===e)return r.value}function la(t,e){if(!t){let o=Bb(e);return o?Cb(new Set,o,zb):"0"}let n=-1,r=new Set,a=o=>{if(o.kind!=="textValue"){if(o.kind==="comment"){let s=rs(o,ca$1,"id");if(s!==void 0&&/^\d{1,10}$/.test(s)){let l=Number(s);Number.isSafeInteger(l)&&l<=zb&&(r.add(String(l)),l>n&&(n=l));}}for(let s of o.children)a(s);}};a(t.root);let i=Bb(e);return i?Cb(r,i,zb):String(n+1)}var os=256,as=65535,da=64;function Tt(t,e){return t.length>e}function ca(t){return typeof t!="string"||t.trim().length===0?"invalid-author":Tt(t,os)?"resource-limit":O(t)?null:"invalid-author"}function ma(t){return typeof t!="string"||t.length===0?"invalid-text":Tt(t,as)?"resource-limit":O(t)?null:"invalid-text"}function fn(t){if(typeof t!="string")return {ok:false,rejection:"invalid-date"};let e=t.trim();if(Tt(e,da))return {ok:false,rejection:"resource-limit"};if(!O(e))return {ok:false,rejection:"invalid-date"};let n=ye(e);return n===null?{ok:false,rejection:"invalid-date"}:Tt(n,da)?{ok:false,rejection:"resource-limit"}:{ok:true,value:n}}function Ic(t){if(t===void 0)return null;let e=fn(t);return e.ok?null:e.rejection}function gn(t){switch(t){case "invalid-author":return "invalid-author";case "invalid-text":return "invalid-text";case "invalid-date":return "invalid-property-value";case "resource-limit":return "resource-limit"}}function ua(t,e){if(t.kind==="textValue")return t;let n=e.get(t.id);if(n!==void 0)return n;let r=false,a=[];for(let i of t.children){let o=ua(i,e);o!==i&&(r=true),a.push(o);}return r?{...t,children:a}:t}function ls(t,e,n){let r=ua(t.root,e);if(r.kind==="textValue")return {ok:false,issues:[{code:"known-node-invariant",path:t.root.id,nodeId:t.root.id}]};let a=n===null?r:{...r,namespaceBindings:[...r.namespaceBindings,{prefix:n,namespaceUri:fa$1}]};return Ga$1(t,t.root.id,a,{deferValidation:true})}function pa(t,e,n){let r=new Map;for(let i of e){if(i.stampParagraph===null)continue;let o=r.get(i.commentsPartName);o||(o=new Map,r.set(i.commentsPartName,o)),o.set(i.stampParagraph.id,{paragraph:i.stampParagraph,paraId:i.paraId});}let a=t;for(let[i,o]of r){let s=a.parts.get(i);if(!s)return null;let l=wb(s.root),d=l??"w14",c=new Map;for(let m of o.values())c.set(m.paragraph.id,n(m.paragraph,m.paraId,d));let u=ls(s,c,l===null?d:null);if(!u.ok)return null;a=Ub(a,u.part);}return a}function fa(t,e,n){let r=t.root.children.map(a=>a.kind==="textValue"?a:e.get(a.id)??a);return Ea$1(t,t.root.id,[...r,...n],{deferValidation:true})}var ya="/word/comments.xml",ka="/word/commentsExtended.xml",Pn="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",On="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",ds=[On,"application/vnd.ms-word.commentsExtended+xml"],xa="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",In="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",ke="http://schemas.microsoft.com/office/word/2012/wordml";function ot(t,e,n){for(let r of t.attributes)if(r.localName===n&&r.namespaceUri===e)return r.value}function je(t,e){return {kind:"genericExtension",namespaceUri:ca$1,localName:t,prefix:"w",value:e}}function ge(t,e,n,r,a,i,o,s=[]){return {id:t,kind:e,namespaceUri:n,localName:a,prefix:r,namespaceBindings:s,attributes:i,children:o}}function Pa(t,e,n,r,a){let i=e===t.mainDocumentPart?[e]:[e,t.mainDocumentPart];for(let o of i)for(let s of Wb(t,o)){if(s.type!==n)continue;let l=w(o,s.rawTarget);if(!l.ok)continue;if(!t.parts.has(l.partName))return l.partName;let d=Xb(t,l.partName);if(d!==null&&(typeof r=="string"?d===r:r.includes(d)))return l.partName}return a}function hn(t,e,n){let r=t.mainDocumentPart;for(let i of Wb(t,r)){if(i.type!==e)continue;let o=w(r,i.rawTarget);if(o.ok&&o.partName===n)return t}let a=$b(t,r);return ac(a,r,e,cg(r,n)).pkg}function Rn(t,e){return Pa(t,e,xa,Pn,ya)}function Oa(t,e){let n=cf(t,e),r=df(t,e,n).extended;return r!==null?r:Pa(t,e,In,ds,ka)}function ga(t){let e=new Set;for(let n of t.parts.values())for(let r of vb(n.root))e.add(r);return e}function cs(t,e){if(!t)return null;let n=null,r=a=>{if(!(n!==null||a.kind==="textValue")){if(a.kind==="comment"&&ot(a,ca$1,"id")===e){for(let i=a.children.length-1;i>=0;i-=1){let o=a.children[i];if(o.kind!=="paragraph")continue;let s=ot(o,fa$1,"paraId");s!==void 0&&rb(s)&&(n=s.toUpperCase());return}return}for(let i of a.children)r(i);}};return r(t.root),n}function ms(t,e){if(!t)return null;let n=null,r=a=>{if(!(n!==null||a.kind==="textValue")){if(a.kind==="comment"&&ot(a,ca$1,"id")===e){for(let i=a.children.length-1;i>=0;i-=1){let o=a.children[i];if(o.kind==="paragraph"){n=o;return}}return}for(let i of a.children)r(i);}};return r(t.root),n}function Ia(t){let e=wb(t.root);if(e!==null)return {part:t,prefix:e};let n={...t.root,namespaceBindings:[...t.root.namespaceBindings,{prefix:"w14",namespaceUri:fa$1}]},r=Ga$1(t,t.root.id,n,{deferValidation:true});return {part:r.ok?r.part:{...t,root:n},prefix:"w14"}}function Ra(t,e,n){return ge(t.id,"paragraph",t.namespaceUri,t.prefix??"w",t.localName,[...t.attributes.filter(r=>!(r.namespaceUri===fa$1&&r.localName==="paraId")),{kind:"genericExtension",namespaceUri:fa$1,localName:"paraId",prefix:n,value:e}],t.children,t.namespaceBindings)}function us(t,e,n,r){let a=t.parts.get(e);if(!a)return t;let i=Ia(a),o=Ca$1(i.part,n);if(!o||o.kind!=="paragraph")return Ub(t,i.part);let s=Ga$1(i.part,o.id,Ra(o,r,i.prefix),{deferValidation:true});return Ub(t,s.ok?s.part:i.part)}function ps(t,e,n,r){let a=`${ya}#comment-${t}`,i=n.text!==n.text.trim(),o=ge(`${a}.t`,"text",ca$1,"w","t",i?[{kind:"xmlSpace",namespaceUri:da$1,localName:"space",prefix:"xml",value:"preserve"}]:[],[{id:`${a}.tv`,kind:"textValue",value:n.text}]),s=ge(`${a}.rPr`,"runProperties",ca$1,"w","rPr",[],[ge(`${a}.rStyle`,"generic",ca$1,"w","rStyle",[je("val","CommentReference")],[])]),l=ge(`${a}.r`,"run",ca$1,"w","r",[],[s,o]),d=ge(`${a}.pPr`,"paragraphProperties",ca$1,"w","pPr",[],[ge(`${a}.pStyle`,"generic",ca$1,"w","pStyle",[je("val","CommentText")],[])]),c=ge(`${a}.p`,"paragraph",ca$1,"w","p",[{kind:"genericExtension",namespaceUri:fa$1,localName:"paraId",prefix:r,value:e}],[d,l]);return ge(a,"comment",ca$1,"w","comment",[je("id",t),je("author",n.author),...n.initials===void 0?[]:[je("initials",n.initials)],...n.date===void 0?[]:[je("date",n.date)]],[c])}function yn(t,e){let n=ta$1(e,{name:t,contentType:"application/xml"});return n.ok?n.part.root:null}function ba(t,e){for(let y of [ca(e.author),ma(e.text)])if(y)return {ok:false,reason:gn(y)};let n;if(e.date!==void 0){let y=fn(e.date);if(!y.ok)return {ok:false,reason:gn(y.rejection)};n=y.value;}let r={...e,...n===void 0?{}:{date:n}},a=t.package,i=t.part.name,o=Rn(a,i),s=Oa(a,i),l=a.parts.get(o),d=la(l,r.actorId),c=ub(`${o}#${d}`,ga(a)),u=e.replyToCommentId===void 0?null:cs(l,e.replyToCommentId),m=e.replyToCommentId!==void 0&&u===null?ms(l,e.replyToCommentId):null;if(e.replyToCommentId!==void 0&&u===null&&!m)return {ok:false,reason:"unknown-revision"};let k=m?ub(`${o}#parent-${e.replyToCommentId}`,new Set([...ga(a),c])):null,h=u??k,P=e.anchor.endParagraphId??e.anchor.paragraphId,p=t.transact(y=>{y.applyPackage(f=>{let g=f.parts.has(o)?f:(()=>{let O=yn(o,`<w:comments xmlns:w="${ca$1}"/>`);return O?bc(f,o,O,Pn):null})();return g===null?f:hn(g,xa,o)}),m&&k&&y.applyPackage(f=>us(f,o,m.id,k)),y.applyPackage(f=>{let g=f.parts.get(o);if(!g)return f;let O=Ia(g),L=Fa$1(O.part,O.part.root.id,O.part.root.children.length,[ps(d,c,r,O.prefix)],{deferValidation:true});return L.ok?Ub(f,L.part):f}),h!==null&&(y.applyPackage(f=>{let g=f.parts.has(s)?f:(()=>{let O=yn(s,`<w15:commentsEx xmlns:w15="${ke}"/>`);return O?bc(f,s,O,On):null})();return g===null?f:hn(g,In,s)}),y.applyPackage(f=>{let g=f.parts.get(s);if(!g)return f;let L=[...fs(g).has(h.toUpperCase())?[]:[xn(`${s}#ex-${h}`,h,void 0,false)],xn(`${s}#ex-${c}`,c,h,false)],U=Fa$1(g,g.root.id,g.root.children.length,L,{deferValidation:true});return U.ok?Ub(f,U.part):f})),y.applyTo(i,{op:"insertCommentMarker",paragraphId:P,offset:e.anchor.end,commentId:d,marker:"reference"}),y.applyTo(i,{op:"insertCommentMarker",paragraphId:P,offset:e.anchor.end,commentId:d,marker:"end"}),y.applyTo(i,{op:"insertCommentMarker",paragraphId:e.anchor.paragraphId,offset:e.anchor.start,commentId:d,marker:"start"});},r.actorId===void 0?{}:{actorId:r.actorId});return p.ok?{ok:true,commentId:d,change:p.change}:{ok:false,reason:p.reason}}function kn(t){for(let e=t.children.length-1;e>=0;e-=1){let n=t.children[e];if(n.kind==="paragraph")return n}return null}function ha(t){let e=kn(t);if(!e)return null;let n=ot(e,fa$1,"paraId");return n!==void 0&&rb(n)?n.toUpperCase():null}function fs(t){let e=new Map;if(!t)return e;let n=r=>{if(r.kind!=="textValue"){if(r.namespaceUri===ke&&r.localName==="commentEx"){let a=ot(r,ke,"paraId");a!==void 0&&rb(a)&&e.set(a.toUpperCase(),r);}for(let a of r.children)n(a);}};return n(t.root),e}function rt(t,e){return {kind:"genericExtension",namespaceUri:ke,localName:t,prefix:"w15",value:e}}function gs(t,e){return {id:t.id,kind:"generic",namespaceUri:t.namespaceUri,localName:t.localName,...t.prefix===void 0?{}:{prefix:t.prefix},namespaceBindings:t.namespaceBindings,attributes:e,children:t.children}}function hs(t,e,n){let r=[],a=false,i=false;for(let o of t.attributes){if(o.namespaceUri===ke&&o.localName==="done"){a=true,r.push({kind:"genericExtension",namespaceUri:o.namespaceUri,localName:o.localName,...o.prefix===void 0?{}:{prefix:o.prefix},value:n?"1":"0"});continue}o.namespaceUri===ke&&o.localName==="paraIdParent"&&(i=true),r.push(o);}return !i&&e!==void 0&&r.push(rt("paraIdParent",e)),a||r.push(rt("done",n?"1":"0")),gs(t,r)}function xn(t,e,n,r){return {id:t,kind:"generic",namespaceUri:ke,localName:"commentEx",prefix:"w15",namespaceBindings:[],attributes:[rt("paraId",e),...n===void 0?[]:[rt("paraIdParent",n)],rt("done",r?"1":"0")],children:[]}}function va(t,e,n){return ys(t,e,n,bf())}function ys(t,e,n,r){let a=t.package,i=t.part.name;if(cf(a,i)===null)return {ok:false,reason:"unknown-comment"};let s=ff(a,e,{storyPartName:i},r);if(!s.ok)return {ok:false,reason:"unknown-comment"};let l=ef(a,r);if(l.truncated||r.truncated)return {ok:false,reason:"unknown-comment"};let d=l.used,c=new Map,u=[];for(let P of s.ids){let p=s.records.get(P);if(!p)return {ok:false,reason:"unknown-comment"};if(!kn(p.node))return {ok:false,reason:"unknown-comment"};let f=ha(p.node),g=f??ub(`${p.partName}#done-${P}`,d);f===null&&d.add(g),c.set(P,g);}for(let P of s.ids){let p=s.records.get(P),y=kn(p.node),f=c.get(P),g=ha(p.node),O=s.parentCommentIdByChildId.get(P),L=s.parentParaIdByCommentId.get(P)??(O===void 0?void 0:c.get(O)),U=s.commentExByParaId.get(f);u.push({paraId:f,stampParagraph:g===null?y:null,commentsPartName:p.partName,parentParaId:L,existing:U?.node,existingParentParaId:U?.parentParaId,existingDone:U?.done??false});}if(u.length===0)return {ok:false,reason:"unknown-comment"};if(u.every(P=>P.existingDone===n))return {ok:true,changed:false,change:null};let m=s.extendedPartName??ka,k=s.extendedPartName===null,h=t.transact(P=>{P.applyPackage(p=>{let y=pa(p,u,Ra);if(y===null)return p;let f=y;if(!f.parts.has(m)){let S=yn(m,`<w15:commentsEx xmlns:w15="${ke}"/>`);if(!S)return p;let F=bc(f,m,S,On);f=k?hn(F,In,m):F;}let g=f.parts.get(m);if(!g)return p;let O=new Map,L=[];for(let S of u){let F=S.existingParentParaId??S.parentParaId;S.existing?O.set(S.existing.id,hs(S.existing,F,n)):L.push(xn(`${m}#done-${S.paraId}`,S.paraId,F,n));}let U=fa(g,O,L);return U.ok?Ub(f,U.part):p});});return h.ok?{ok:true,changed:true,change:h.change}:{ok:false,reason:h.reason}}function Wc(t,e){let n=Rn(t,e);return t.parts.has(n)&&Xb(t,n)===Pn}function Kc(t,e){return Rn(t,e)}function zc(t,e){return Oa(t,e)}var Na={kind:"body"};function Qc(t,e,n=Na){let r=n.kind==="body"?null:t.resolveStory(n),a=r?.ok?r.store:t.bodyStore(),i=t.currentPackage(),o=a.checkpoint();return a.graftPackage(()=>t.currentPackage()),xa$1(t,()=>{let s=ba(a,e);return s.ok&&(a.restoreHistoryStacks(o),t.replacePackageShell(a.package),t.adoptPackageUnit(i),t.publishStoryWrite(s.change)),s},s=>ya$1(s))}function Zc(t,e,n){let r=t.bodyStore(),a=t.currentPackage(),i=r.checkpoint();return r.graftPackage(()=>t.currentPackage()),xa$1(t,()=>{let o=va(r,e,n);return !o.ok||!o.changed||(r.restoreHistoryStacks(i),t.replacePackageShell(r.package),t.adoptPackageUnit(a),t.publishStoryWrite(o.change)),o},o=>o.ok&&o.changed)}function em(t,e,n=Na,r){if(e.length===0)return false;let a=n.kind==="body"?t.bodyStore().part:t.partFor(n);if(!a)return false;let i={storyPartName:a.name,...r===void 0?{}:{noteId:r}},o=t.bodyStore(),s=t.currentPackage(),l=o.checkpoint();return o.graftPackage(()=>t.currentPackage()),xa$1(t,()=>{let d=false,c=false,u=o.transact(m=>{m.applyPackage(k=>{let h=k;for(let P of e){let p=P.parentCommentId===void 0?Qf(h,P.commentId,i):Rf(h,P.commentId,P.parentCommentId,i);if(p===null)return d=true,k;c||=p!==h,h=p;}return h});});return d||!u.ok||!c?false:(o.restoreHistoryStacks(l),t.installPackageSnapshot(o.package),t.adoptPackageUnit(s),t.publishStoryWrite(u.change),true)},d=>d)}var ks=256*1024,xs=4096;function wa(t,e,n){let r=e.payload,a=t.part.name,i=n??a;if(r){if(r.data.length>ks)return {ok:false,reason:"payload-too-large",detail:"data"};if(r.label.length>xs)return {ok:false,reason:"payload-too-large",detail:"label"}}let o=new Set(uf(t.part.root).map(m=>m.node.id)),s=e.replaceControlId===void 0?[]:Ta(t,a,e.replaceControlId),l=null,d,c=t.transact(m=>{if(e.replaceControlId!==void 0){m.apply({op:"removeContentControl",controlId:e.replaceControlId,keepContent:false});for(let P of s)m.applyPackage(p=>kg(p,P.partName,P.nodeId));}let k=e.replaceUntil;if(k!==void 0&&k<=e.offset){l="invalid-range",d="replaceUntil must be past offset";return}if(k!==void 0&&m.apply({op:"deleteText",paragraphId:e.paragraphId,start:e.offset,end:k}),!r){m.apply({op:"insertInlineContentControl",paragraphId:e.paragraphId,offset:e.offset,tag:e.tag,text:e.text,...e.alias===void 0?{}:{alias:e.alias},...e.lock===void 0?{}:{lock:e.lock}});return}let h=null;m.applyPackage(P=>{let p=fg(P,i,r.namespaceUri,r.rootLocalName);if(!p.part)return l="store-not-authored",d=`no customXml store could be created for ${r.namespaceUri}. The namespace must be free of control characters and quotes, the root name must be an XML name, and a store this document already carries for that namespace must use the same root name (${r.rootLocalName})`,P;if(h=pg(p.part,r.rootLocalName,r.nodeId),!h)return l="unaddressable-payload",d=`the node id ${JSON.stringify(r.nodeId)} or the namespace ${JSON.stringify(r.namespaceUri)} cannot be written into an XPath. Ids and root names must match [A-Za-z_][\\w.-]{0,127}; a namespace may not contain a quote, an angle bracket or an ampersand`,P;let y=jg(p.pkg,p.part.partName,{id:r.nodeId,label:r.label,data:r.data});return ig(y,p.part.partName,r.nodeId)?y:(l="store-not-authored",d="the payload node could not be written into the store",P)}),!(l!==null||!h)&&m.apply({op:"insertInlineContentControl",paragraphId:e.paragraphId,offset:e.offset,tag:e.tag,text:e.text,...e.alias===void 0?{}:{alias:e.alias},...e.lock===void 0?{}:{lock:e.lock},dataBinding:h});});if(l!==null)return {ok:false,reason:l,...d===void 0?{}:{detail:d}};if(!c.ok)return {ok:false,reason:c.reason,...c.detail===void 0?{}:{detail:c.detail}};let u=Ps(t,o);return {ok:true,change:c.change,...u===void 0?{}:{nodeId:u}}}function Ps(t,e){for(let n of uf(t.part.root))if(!e.has(n.node.id))return n.node.id}function Ta(t,e,n){let r=uf(t.part.root).find(i=>i.node.id===n);if(!r)return [];let a=[];for(let i of dg(t.package,e)){let o=sg(r.node,i.itemId);o!==null&&a.push({partName:i.partName,nodeId:o});}return a}function Ea(t,e){let n=t.part.name,r=Ta(t,n,e),a=t.transact(i=>{i.apply({op:"removeContentControl",controlId:e,keepContent:false});for(let o of r)i.applyPackage(s=>kg(s,o.partName,o.nodeId));});return a.ok?{ok:true,change:a.change}:{ok:false,reason:a.reason,...a.detail===void 0?{}:{detail:a.detail}}}function im(t,e,n){if(!t.parts.has(e)||n.length===0)return {ok:true,pkg:t,removed:[]};let r=t,a=[];for(let i of n){let o=eg(r,e,i);if(!o)continue;let s=rg(r,o.itemId),l=lg(r,o.partName,s);if(l.pkg===r&&hg(r,o.partName).some(d=>!s.has(d.id)))return {ok:false,reason:`the payload store for ${i} refused the sweep`};r=l.pkg,a.push(...l.removed);}return {ok:true,pkg:r,removed:a}}var Sa=new WeakMap;function Os(t,e){let n=Sa.get(t);n||(n=new Map,Sa.set(t,n));let r=n.get(e);if(r)return r;let a=dg(t,e).map(i=>({itemId:i.itemId,nodes:new Map(hg(t,i.partName).map(o=>[o.id,o]))}));return n.set(e,a),a}function sm(t,e,n=e){let r=new Map,a=t.parts.get(e);if(!a)return r;let i=Os(t,n);if(i.length===0)return r;for(let o of uf(a.root))for(let s of i){let l=sg(o.node,s.itemId);if(l===null)continue;let d=s.nodes.get(l);if(d){r.set(o.node.id,{nodeId:l,label:d.label,data:d.data});break}}return r}function lm(t,e,n){let r=new Map,a=eg(t,e,n);if(!a)return r;for(let i of hg(t,a.partName))r.set(i.id,{label:i.label,data:i.data});return r}var Ca={kind:"body"};function Ma(t,e,n){let r=e.kind==="body"?null:t.resolveStory(e),a=r?.ok?r.store:t.bodyStore(),i=t.currentPackage(),o=a.checkpoint();return a.graftPackage(()=>t.currentPackage()),xa$1(t,()=>{let s=n(a);return s.ok&&(a.restoreHistoryStacks(o),t.replacePackageShell(a.package),t.adoptPackageUnit(i),t.publishStoryWrite(s.change)),s},s=>ya$1(s))}function um(t,e,n=Ca){return Ma(t,n,r=>wa(r,e,t.bodyStore().part.name))}function pm(t,e,n=Ca){return Ma(t,n,r=>Ea(r,e))}var Ve="proposed";function Is(t,e){switch(t){case "revisionInsert":case "revisionMoveTo":return e!=="original";case "revisionDelete":case "revisionMoveFrom":return e!=="proposed";default:return false}}var Rs=32;function bn(t,e=Ve){let n=[];return at(t.children,e,0,n),n}function vn(t,e,n,r,a=Ve){let i=[];for(let o of bn(t,a)){let s=e.get(o.id);if(!s||s.end<=s.start)continue;let l=Math.max(s.start,n),d=Math.min(s.end,r);l>=d||i.push({run:o,start:l,end:d});}return i}function at(t,e,n,r){if(!(n>=Rs)){for(let a of t)if(!(a.kind==="textValue"||a.kind==="paragraphProperties")){if(a.kind==="run"){r.push(a);continue}if(a.kind==="hyperlink"){at(a.children,e,n+1,r);continue}if(ja$1(a.kind)){if(!Is(a.kind,e))continue;at(a.children,e,n+1,r);continue}if(Mc(a)){at(a.children,e,n+1,r);continue}if(ue(a)){let i=ve$1(a);i&&at(i.children,e,n+1,r);continue}}}}var bs=new Set(Xe),Sn=new Set(We);function vm(t){return Sn.has(t)}function Et(t,e,n){return !t||t.kind==="textValue"?void 0:t.children.find(a=>a.kind===e||a.kind==="generic"&&a.localName===n&&a.namespaceUri===ca$1)}function wn(t,e){if(!t||t.kind==="textValue")return [];let n=[];for(let r of t.children){if(r.kind==="textValue"||!e.has(r.localName))continue;let a=J$1();for(let i of r.attributes)a[i.localName]=i.value;n.push(Object.keys(a).length>0?{localName:r.localName,attributes:a}:{localName:r.localName});}return n}function Nm(t,e){let n=Ca$1(t,e);return wn(Et(n,"paragraphProperties","pPr"),bs)}function vs(t,e){let n=Ca$1(t,e),r=Et(n,"paragraphProperties","pPr");return wn(Et(r,"runProperties","rPr"),Sn)}function Da(t,e){let n=Array.isArray(e)?e:[e],r=new Set(n.map(i=>i.localName));return [...t.filter(i=>!r.has(i.localName)),...n]}var Ns=new Map([["ascii","asciiTheme"],["hAnsi","hAnsiTheme"],["eastAsia","eastAsiaTheme"],["cs","cstheme"]]);function Ss(t,e){let n=t.find(a=>a.localName==="rFonts")?.attributes;if(!n)return e;let r={...n,...e.attributes??{}};for(let a of Object.keys(e.attributes??{})){let i=Ns.get(a);i&&delete r[i];}return {localName:"rFonts",attributes:r}}function Tn(t){let e=new Map;for(let n of Ee(t)){let r=n.formatRunIds&&n.formatRunIds.length>0?n.formatRunIds:n.runId?[n.runId]:[];for(let a of r){let i=e.get(a);i?(i.start=Math.min(i.start,n.start),i.end=Math.max(i.end,n.end)):e.set(a,{start:n.start,end:n.end});}}return e}function ws(t){let e=new Set;for(let n of Ee(t))if(n.formatRunIds)for(let r of n.formatRunIds)e.add(r);return e}function Nn(t,e){if(e.localName==="rFonts")return Ss(t,e);if(e.localName!=="u")return e;let n=t.find(r=>r.localName==="u")?.attributes;return n?{localName:"u",attributes:{...n,...e.attributes??{}}}:e}function Sm(t,e,n){let r=vs(t,e),a=Array.isArray(n)?n:[n];return Da(r,a.map(i=>Nn(r,i)))}function Ts(t,e){return Array.isArray(e)?e.map(n=>Nn(t,n)):Nn(t,e)}function wm(t,e,n,r,a,i=Ve){let o=Ca$1(t,e);if(!o||o.kind!=="paragraph")return [];let s=[],l=ws(o);for(let d of vn(o,Tn(o),n,r,i)){let c=wn(Et(d.run,"runProperties","rPr"),Sn);s.push({start:d.start,end:d.end,properties:Da(c,Ts(c,a)),...l.has(d.run.id)?{targetRunIds:[d.run.id]}:{}});}return s}function Tm(t,e,n,r,a=Ve){let i=Ca$1(t,e);if(!i||i.kind!=="paragraph"||r<=n)return [];let o=[];for(let s of vn(i,Tn(i),n,r,a)){let l=o[o.length-1];l&&s.start<=l.end?l.end=Math.max(l.end,s.end):o.push({start:s.start,end:s.end});}return o}function Em(t,e,n,r,a=Ve){let i=Ca$1(t,e);if(!i||i.kind!=="paragraph")return [];let o=Tn(i),s=[];for(let l of bn(i,a)){let d=o.get(l.id);if(!d||d.end<=d.start)continue;(r>n?Math.max(d.start,n)<Math.min(d.end,r):d.start<=n&&n<d.end)&&s.push(l);}return s}function En(t){let e=_a.get(t.root);if(e)return e;let n=new Map,r=o=>{let s=Aa.get(o);if(s){for(let[d,c]of s)n.set(d,c);return}let l=new Map;Cs(o,l),Aa.set(o,l);for(let[d,c]of l)n.set(d,c);},a=(o,s)=>{if(!(o.kind==="textValue"||s>64)){if(o.kind==="paragraph"){r(o);return}for(let l of o.children)a(l,s+1);}};a(t.root,0);let i=(o,s)=>{if(!(o.kind==="textValue"||s>64)){if(o.kind==="paragraph"){let l=Ua.get(o);if(!l){let d=[];La(o,0,d),l=d,Ua.set(o,l);}for(let[d,c]of l)n.set(d,c);return}if(o.kind==="tableRow"){let l=Ct.get(o);l||(l=Fa(o),Ct.set(o,l));for(let[d,c]of l)n.set(d,c);}for(let l of o.children)i(l,s+1);}};return i(t.root,0),_a.set(t.root,n),n}function La(t,e,n){if(!(t.kind==="textValue"||e>64)){if(t.kind==="tableRow"){let r=Ct.get(t);r||(r=Fa(t),Ct.set(t,r));for(let a of r)n.push(a);}for(let r of t.children)La(r,e+1,n);}}function Fa(t){let e=null,n=(o,s)=>{if(!(e||o.kind==="textValue"||s>64)){if(o.kind==="paragraph"){e=o;return}for(let l of o.children)n(l,s+1);}};if(n(t,0),!e)return Es;let r={paragraphId:e.id,start:0,end:0},a=[],i=(o,s,l)=>{if(o.kind==="textValue"||l>64||o.kind==="paragraph")return;let d=s==="trPr"&&(o.localName==="ins"||o.localName==="del"),c=s==="tcPr"&&(o.localName==="cellIns"||o.localName==="cellDel");(d||c)&&a.push([o.id,r]);for(let u of o.children)i(u,o.localName,l+1);};return i(t,void 0,0),a}var Es=[],Aa=new WeakMap,_a=Jf(8),Ct=new WeakMap,Ua=new WeakMap;function Cs(t,e){let n=Fe$1(t),r=(o,s,l,d)=>{if(!(o.kind==="textValue"||d>64)){e.set(o.id,{paragraphId:t.id,start:s,end:l});for(let c of o.children)r(c,s,l,d+1);}},a=(o,s)=>{if(o.kind==="textValue"||s>64)return;let l=n.spanOf(o);if(o.kind==="run"){if(!l)return;e.set(o.id,{paragraphId:t.id,start:l.start,end:l.end});for(let d of o.children)d.kind==="runProperties"&&r(d,l.start,l.end,s+1);return}l&&e.set(o.id,{paragraphId:t.id,start:l.start,end:l.end});for(let d of o.children)a(d,s+1);};for(let o of t.children)o.kind!=="paragraphProperties"&&a(o,0);let i=t.children.find(o=>o.kind==="paragraphProperties");i&&r(i,n.length,n.length,0);}function _m(t){return `${t.kind}-${t.id}`}function Ha(t){return t.kind==="revision"?t.ranges:t.range?[t.range]:[]}function Ms(t){return Ha(t)[0]??null}function Cn(t,e){let n=Ms(t);if(!n)return Number.MAX_SAFE_INTEGER;let r=e.get(n.start.paragraphId);return r===void 0?Number.MAX_SAFE_INTEGER:r*1e6+Math.min(n.start.offset,999999)}function Ds(t,e){let n=e.get(t.start.paragraphId),r=e.get(t.end.paragraphId);return n===void 0||r===void 0?Number.MAX_SAFE_INTEGER:(r-n)*1e6+(t.end.offset-t.start.offset)}var As=0,_s=1,Us=2;function Ls(t,e,n){let r=n.get(e.paragraphId),a=n.get(t.start.paragraphId),i=n.get(t.end.paragraphId);return r===void 0||a===void 0||i===void 0||r<a||r>i||r===a&&e.offset<t.start.offset||r===i&&e.offset>t.end.offset?null:a===i&&t.start.offset===t.end.offset?As:r===i&&e.offset===t.end.offset?Us:_s}function Fs(t,e,n){let r=null;for(let a of Ha(t)){let i=Ls(a,e,n);if(i===null)continue;let o=Ds(a,n);(r===null||i<r.grip||i===r.grip&&o<r.width)&&(r={grip:i,width:o});}return r}var $a={comment:0,custom:1,revision:2};function $s(t,e,n){let r=[];for(let a of t){let i=Fs(a,e,n);i!==null&&r.push({item:a,grip:i.grip,width:i.width});}return r.sort((a,i)=>a.grip!==i.grip?a.grip-i.grip:a.width!==i.width?a.width-i.width:a.item.kind!==i.item.kind?$a[a.item.kind]-$a[i.item.kind]:a.item.kind==="revision"&&i.item.kind==="revision"?i.item.nesting-a.item.nesting:0).map(a=>a.item)}function Um(t,e,n){let a=$s(t,e,n).filter(i=>!(i.kind==="comment"&&i.resolved))[0];return a?a.kind==="comment"?Ba(t,a):a:null}function Lm(t,e){return Ba(t,e)}function Ba(t,e){let n=new Map,r=new Map;for(let o of t)o.kind==="comment"?n.set(o.id,o):o.kind==="revision"&&r.set(o.id,o);let a=new Set([e.id]),i=e;for(;i.parentId!==void 0;){let o=n.get(i.parentId);if(!o||a.has(o.id))break;a.add(o.id),i=o;}if(i.parentRevisionId!==void 0){let o=r.get(i.parentRevisionId);if(o)return o}return i}var Hs={ins:"insert",del:"delete",moveFrom:"moveFrom",moveTo:"moveTo"};function Gm(t){let e=[],n=r=>{if(r.kind==="textValue"){e.push(r.value);return}for(let a of r.children)n(a);};for(let r of t.blocks)n(r);return e.join("")}function Xm(t){if(t.initials&&t.initials.trim().length>0)return t.initials.trim();let e=t.author.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function Mt(t,e){for(let n of t.attributes)if(n.localName===e&&n.namespaceUri===ca$1)return n.value}function it(t){if(t.kind==="textValue")return t.value;if(t.kind==="tab")return " ";if(t.kind==="hardBreak")return Cc(t);if(Kc$1(t))return "";let e="";for(let n of t.children)e+=it(n);return e}function Mn(t){return `${t.id}\0${t.author}\0${t.date??""}`}var Bs={revisionInsert:"insert",revisionDelete:"delete",revisionMoveFrom:"moveFrom",revisionMoveTo:"moveTo"};function js(t){let e=t.root.kind!=="paragraph";if(e){let r=ja.get(t.root);if(r&&r.name===t.name)return r.items}let n=Vs(t);return e&&ja.set(t.root,{name:t.name,items:n}),n}var ja=Jf(8);function Vs(t){let e=vg(t);if(e.length===0)return [];let n=En(t),r=new Map;for(let i of e){let o=Mt(i.node,"id");if(o===void 0)continue;let s=Mt(i.node,"author")??"",l=Mt(i.node,"author")===void 0,d=Mt(i.node,"date"),c=d===void 0?{id:o,author:s}:{id:o,author:s,date:d},u=i.propertyChange?"format":i.paragraphMark?"paragraphMark":Bs[i.node.kind]??"structural",m=i.paragraphMark?Hs[i.node.localName]:void 0,k=n.get(i.node.id),h=k?{partName:t.name,start:{paragraphId:k.paragraphId,offset:k.start},end:{paragraphId:k.paragraphId,offset:k.end}}:null,P=u==="structural"?`structural\0${Mn(c)}`:`${i.node.localName}\0${Mn(c)}`,p=r.get(P);if(p){h&&!p.ranges.some(y=>y.partName===h.partName&&y.start.paragraphId===h.start.paragraphId&&y.start.offset===h.start.offset&&y.end.paragraphId===h.end.paragraphId&&y.end.offset===h.end.offset)&&p.ranges.push(h),u!=="structural"&&p.revisionKind==="structural"&&(p.revisionKind=u),(u==="insert"&&p.revisionKind==="delete"||u==="delete"&&p.revisionKind==="insert"||p.revisionKind==="replace")&&(p.revisionKind="replace"),p.readOnly||=i.refused||l,i.nesting>p.nesting&&(p.nesting=i.nesting),u==="delete"||u==="moveFrom"?p.deletedText+=it(i.node):u!=="format"&&u!=="paragraphMark"&&(p.text+=it(i.node));continue}r.set(P,{address:c,revisionKind:u,...m?{markDirection:m}:{},author:s,...d===void 0?{}:{date:d},text:u==="format"||u==="paragraphMark"||u==="delete"||u==="moveFrom"?"":it(i.node),deletedText:u==="delete"||u==="moveFrom"?it(i.node):"",ranges:h?[h]:[],nesting:i.nesting,readOnly:i.refused||l});}let a=[...r.values()].map(i=>({kind:"revision",id:`${i.revisionKind}-${t.name}\0${Mn(i.address)}`,address:i.address,addresses:[i.address],revisionKind:i.revisionKind,...i.markDirection?{markDirection:i.markDirection}:{},author:i.author,...i.date===void 0?{}:{date:i.date},text:i.revisionKind==="replace"?i.text:i.text||i.deletedText,replacedText:i.revisionKind==="replace"?i.deletedText:"",ranges:i.ranges,nesting:i.nesting,readOnly:i.readOnly,replyIds:[]}));return Ws(a,Dn(t))}function Ws(t,e){let n=Ks(t),r=n.filter(l=>(l.revisionKind==="insert"||l.revisionKind==="delete")&&!l.readOnly&&l.ranges.length>0),a=new Set,i=new Map,o=new Map;for(let l of r){if(l.revisionKind!=="insert")continue;let d=l.ranges[0].start,c=`${d.paragraphId}\0${d.offset}`,u=o.get(c);u?u.push(l):o.set(c,[l]);}for(let l of r){if(l.revisionKind!=="delete"||a.has(l.id))continue;let d=l.ranges[l.ranges.length-1].end,c=o.get(`${d.paragraphId}\0${d.offset}`)??[],u=c.length>1?[...c].sort((m,k)=>(m.text.length>0?0:1)-(k.text.length>0?0:1)):c;for(let m of u){if(a.has(m.id)||m.author!==l.author)continue;a.add(l.id),a.add(m.id);let k=Js(l.ranges[0],m.ranges[0],e)?l:m,h=Ys(l.date,m.date);i.set(l.id,{...k,id:`replace-${l.id}-${m.id}`,revisionKind:"replace",...h===void 0?{}:{date:h},addresses:Xs([...l.addresses,...m.addresses]),text:m.text,replacedText:l.text,ranges:[...l.ranges,...m.ranges],replacedRangeCount:l.ranges.length,readOnly:l.readOnly||m.readOnly});break}}let s=[];for(let l of n){let d=i.get(l.id);if(d){s.push(d);continue}a.has(l.id)||s.push(l);}return s}function Ks(t){let e=t.filter(l=>(l.revisionKind==="insert"||l.revisionKind==="delete")&&!l.readOnly&&l.ranges.length>0);if(e.length<2)return t;let n=(l,d)=>`${l.revisionKind}\0${l.author}\0${d.paragraphId}\0${d.offset}`,r=new Map,a=new Set;for(let l of e)r.set(n(l,l.ranges[0].start),l),a.add(n(l,l.ranges[l.ranges.length-1].end));let i=new Set,o=new Map;for(let l of e){if(i.has(l.id)||a.has(n(l,l.ranges[0].start)))continue;let d=[l],c=l;for(;;){let u=r.get(n(c,c.ranges[c.ranges.length-1].end));if(!u||u===c||i.has(u.id))break;i.add(u.id),d.push(u),c=u;}d.length>1&&o.set(l.id,zs(d));}if(o.size===0)return t;let s=[];for(let l of t)i.has(l.id)||s.push(o.get(l.id)??l);return s}function zs(t){let e=t[0],n=[...e.addresses],r=[...e.ranges],a=e.text,i=e.date;for(let o of t.slice(1)){for(let s of o.addresses)n.some(l=>Ya(l,s))||n.push(s);for(let s of o.ranges)r.push(s);a+=o.text,i=Gs(i,o.date);}return {...e,id:t.map(o=>o.id).join("+"),addresses:n,ranges:r,text:a,...i===void 0?{}:{date:i}}}function Gs(t,e){if(t===void 0)return e;if(e===void 0)return t;let n=Date.parse(t),r=Date.parse(e);return Number.isNaN(n)||Number.isNaN(r)?t:r>n?e:t}function Xs(t){let e=[];for(let n of t)e.some(r=>Ya(r,n))||e.push(n);return e}function Ya(t,e){return t.id===e.id&&t.author===e.author&&(t.date??"")===(e.date??"")}function Ys(t,e){if(e===void 0)return t;if(t===void 0)return e;let n=Date.parse(t),r=Date.parse(e);return Number.isNaN(n)||Number.isNaN(r)?e:n>r?t:e}function Js(t,e,n){let r=n.get(t.start.paragraphId)??0,a=n.get(e.start.paragraphId)??0;return r!==a?r<a:t.start.offset<=e.start.offset}function qs(t,e,n){let r=new Map(e.map(c=>[c.commentId,c])),a=new Map,i=new Map;for(let c of t)c.paraId&&a.set(c.paraId.toUpperCase(),c),i.set(c.id,c);let o=new Map,s=new Map;for(let c of t){let u=r.get(c.id);if(!u||u.orphaned||u.start.paragraphId===u.end.paragraphId&&u.start.offset===u.end.offset)continue;let m=`${u.start.paragraphId}:${u.start.offset}|${u.end.paragraphId}:${u.end.offset}`;o.has(m)?s.set(c.id,o.get(m)):o.set(m,c.id);}let l=new Map;for(let c of t){let u=c.paraId?n.get(c.paraId.toUpperCase()):void 0,m=u?.parentParaId?a.get(u.parentParaId):void 0,k=c.parentCommentId?i.get(c.parentCommentId):void 0,h=u===void 0?s.get(c.id):void 0,P=h?i.get(h):void 0,p=m??k??P;p&&p.id!==c.id&&l.set(c.id,p.id);}for(let c of [...l.keys()]){let u=new Set([c]),m=l.get(c);for(;m!==void 0;){if(u.has(m)){l.delete(c);break}u.add(m),m=l.get(m);}}let d=new Map;for(let[c,u]of l){let m=d.get(u);m?m.push(c):d.set(u,[c]);}return t.map(c=>{let u=r.get(c.id),m=c.paraId?n.get(c.paraId.toUpperCase()):void 0,k=l.get(c.id);return {kind:"comment",id:c.id,comment:c,range:u?{partName:u.partName,start:u.start,end:u.end}:null,resolved:m?.done??false,...k===void 0?{}:{parentId:k},replyIds:d.get(c.id)??[],orphaned:u===void 0||u.orphaned}})}function Ym(t){let e=[t.storyPart],n=new Set([t.storyPart.name]);for(let d of t.furnitureParts??[])n.has(d.name)||(n.add(d.name),e.push(d));let r=t.commentsPart?Mf(t.commentsPart):[],a=t.commentsExtendedPart?Nf(t.commentsExtendedPart):new Map,i=[],o=[],s=e.length===1?Dn(e[0]):new Map;for(let d of e){for(let m of js(d))i.push(m);for(let m of Lf(d))o.push(m);if(e.length===1)continue;let c=s,u=c.size;for(let[m,k]of Dn(d))c.has(m)||c.set(m,u+k);}return Qs([...i,...qs(r,o,a)]).sort((d,c)=>Cn(d,s)-Cn(c,s))}function Va(t){return `${t.partName}\0${t.start.paragraphId}:${t.start.offset}|${t.end.paragraphId}:${t.end.offset}`}function Qs(t){let e=new Map;for(let o of t)if(o.kind==="revision")for(let s of o.ranges??[]){if(s.start.paragraphId===s.end.paragraphId&&s.start.offset===s.end.offset)continue;let l=Va(s),d=o.nesting??0,c=e.get(l);(c===void 0||d>c.nesting)&&e.set(l,{id:o.id,nesting:d});}let n=new Map;for(let o of t)o.kind==="comment"&&o.replyIds&&o.replyIds.length>0&&n.set(o.id,o.replyIds);let r=o=>{let s=[],l=new Set([o]),d=[...n.get(o)??[]];for(;d.length>0;){let c=d.shift();l.has(c)||(l.add(c),s.push(c),d.push(...n.get(c)??[]));}return s},a=new Map,i=new Map;for(let o of t){if(o.kind!=="comment"||o.parentId!==void 0||o.orphaned||!o.range)continue;let s=e.get(Va(o.range))?.id;if(s===void 0)continue;let l=[o.id,...r(o.id)];for(let c of l)i.set(c,s);let d=a.get(s);d?d.push(...l):a.set(s,l);}return t.map(o=>{if(o.kind==="revision"){let s=a.get(o.id)??[];return s.length===0&&(o.replyIds??[]).length===0?o:{...o,replyIds:s}}if(o.kind==="comment"){let s=i.get(o.id);if(s===void 0){if(o.parentRevisionId===void 0)return o;let{parentRevisionId:l,...d}=o;return d}return o.parentRevisionId===s?o:{...o,parentRevisionId:s}}return o})}function Dn(t){let e=Wa.get(t.root);if(e)return e;let n=new Map,r=(a,i)=>{if(!(a.kind==="textValue"||i>64)){if(a.kind==="paragraph"){n.has(a.id)||n.set(a.id,n.size);return}if(a.kind==="table"){let o=Xa.get(a);if(!o){let s=[],l=(d,c)=>{if(!(d.kind==="textValue"||c>64)){if(d.kind==="paragraph"){s.push(d.id);return}for(let u of d.children)l(u,c+1);}};for(let d of a.children)l(d,0);o=s,Xa.set(a,o);}for(let s of o)n.has(s)||n.set(s,n.size);return}for(let o of a.children)r(o,i+1);}};return r(t.root,0),Wa.set(t.root,n),n}var Wa=Jf(8);function Jm(t){let e=Ga.get(t.root);if(e)return e;let n=new Map;for(let r of Ja(t.root,0))n.has(r)||n.set(r,n.size);return Ga.set(t.root,n),n}var Ka=Object.freeze([]),za=new WeakMap;function Ja(t,e){if(t.kind==="textValue"||e>64)return Ka;let n=za.get(t);if(n&&n.depth===e)return n.ids;let r=null;t.kind==="paragraph"&&(r??=[]).push(t.id);for(let i of t.children){let o=Ja(i,e+1);if(o.length!==0){r??=[];for(let s of o)r.push(s);}}let a=r??Ka;return za.set(t,{depth:e,ids:a}),a}var Ga=Jf(8),Xa=new WeakMap;var Zm=256,eu=2e3,qa=/[\p{L}\p{N}_]/u;function Qa(t){let e=t.toLowerCase();if(e.length===t.length)return e;let n="";for(let r=0;r<t.length;r+=1){let a=t[r],i=a.toLowerCase();n+=i.length===1?i:a;}return n}function Zs(t,e,n){let r=e>0?t[e-1]:void 0,a=n<t.length?t[n]:void 0;return !(r!==void 0&&qa.test(r)||a!==void 0&&qa.test(a))}function el(t){return typeof t=="string"&&t.length>0&&t.length<=256}function tu(t,e,n,r={}){let a={matches:[],truncated:false};if(!el(e)||t.length===0||n<=0)return a;let i=r.matchCase===true,o=r.wholeWord===true,s=i?e:Qa(e),l=i?t:Qa(t),d=Math.max(0,r.from??0),c=Math.min(t.length,r.to??t.length),u=[],m=l.indexOf(s,d);for(;m>=0;){let k=m+s.length;if(k>c)return {matches:u,truncated:false};if(!o||Zs(t,m,k)){if(u.length>=n)return {matches:u,truncated:true};u.push({start:m,length:s.length});}m=l.indexOf(s,k);}return {matches:u,truncated:false}}
|
|
2
|
-
export{Um as $,um as A,pm as B,Ve as C,bn as D,vn as E,bs as F,Sn as G,vm as H,Et as I,wn as J,Nm as K,vs as L,Da as M,Ss as N,Tn as O,ws as P,Nn as Q,Sm as R,wm as S,Tm as T,Em as U,En as V,_m as W,Ha as X,Ms as Y,Cn as Z,$s as _,yo as a,Lm as aa,Ri as b,Gm as ba,ko as c,Xm as ca,Fe as d,js as da,ns as e,qs as ea,sa as f,Ym as fa,ca as g,Qs as ga,ma as h,Dn as ha,fn as i,Jm as ia,Ic as j,Zm as ja,la as k,eu as ka,ba as l,Qa as la,va as m,Zs as ma,Wc as n,el as na,Kc as o,tu as oa,zc as p,Qc as q,Zc as r,em as s,ks as t,xs as u,wa as v,Ea as w,im as x,sm as y,lm as z};
|