@docx-editor.dev/core 2.4.0 → 2.5.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 +6 -6
- package/dist/automation.d.ts +6 -6
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +12 -12
- package/dist/binding.d.ts +12 -12
- package/dist/binding.js +1 -1
- package/dist/chunk-2GSRLGUI.cjs +10 -0
- package/dist/chunk-2QIA75K3.js +2 -0
- package/dist/chunk-32NXPFYL.js +5 -0
- package/dist/chunk-3C533HSQ.cjs +18 -0
- package/dist/{chunk-YMIMLEX4.cjs → chunk-3FRSOOND.cjs} +1 -1
- package/dist/chunk-45FL7KH4.js +1 -0
- package/dist/chunk-7GYF33B5.cjs +2 -0
- package/dist/chunk-H3DZP4LE.cjs +5 -0
- package/dist/chunk-IJ4V3LGV.cjs +2 -0
- package/dist/chunk-JDHTCMFA.cjs +2 -0
- package/dist/chunk-L2GMLEHX.cjs +14 -0
- package/dist/chunk-LJIX4ZDF.js +10 -0
- package/dist/chunk-QUZM6LWQ.js +14 -0
- package/dist/chunk-T252F4US.js +18 -0
- package/dist/chunk-UVIUNAQ6.js +2 -0
- package/dist/chunk-YTZIGUXT.js +2 -0
- package/dist/{content-control-walk-CbTqHq6O.d.cts → content-control-walk-BeAFh6Xi.d.cts} +1 -1
- package/dist/{content-control-walk-D06GijR0.d.ts → content-control-walk-CQp8l6eS.d.ts} +1 -1
- package/dist/contracts/editor.d.cts +9 -9
- package/dist/contracts/editor.d.ts +9 -9
- package/dist/contracts/interaction.d.cts +9 -9
- package/dist/contracts/interaction.d.ts +9 -9
- package/dist/contracts/modules.d.cts +5 -5
- package/dist/contracts/modules.d.ts +5 -5
- package/dist/{custom-node-writes-BkMgMXxs.d.ts → custom-node-writes-2clI36T9.d.ts} +22 -7
- package/dist/{custom-node-writes-C5YRoPcc.d.cts → custom-node-writes-CIC_-wad.d.cts} +22 -7
- package/dist/{editor-DYvC9CZs.d.cts → editor-CUul9IuY.d.cts} +22 -5
- package/dist/{editor-D1qHfzOt.d.ts → editor-DIwctMcU.d.ts} +22 -5
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +32 -0
- package/dist/editor.d.cts +24 -24
- package/dist/editor.d.ts +24 -24
- package/dist/editor.js +1 -1
- package/dist/{hf-references-CgEOSw3i.d.cts → hf-references-BPET4tlK.d.cts} +2 -2
- package/dist/{hf-references-BdjsQNE_.d.ts → hf-references-CAp1xTv6.d.ts} +2 -2
- package/dist/{image-resources-DXvPZvXD.d.cts → image-resources-CSlQmPIm.d.cts} +10 -10
- package/dist/{image-resources-BG9DLyW7.d.ts → image-resources-e13t-pgy.d.ts} +10 -10
- package/dist/{index-Bb-QAg_f.d.cts → index-8t44iXTY.d.cts} +79 -14
- package/dist/{index-DpY3WZuP.d.ts → index-BUsYjxF5.d.ts} +79 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +114 -50
- package/dist/layout.d.ts +114 -50
- package/dist/layout.js +1 -1
- package/dist/{note-nodes-C6DLxlvj.d.cts → note-nodes-B2wWES2L.d.cts} +1 -1
- package/dist/{note-nodes-BPSTVDMr.d.ts → note-nodes-CZQXU6Fg.d.ts} +1 -1
- package/dist/{review-reads-CQmU9Lcl.d.ts → note-properties-BS66XmcC.d.ts} +91 -67
- package/dist/{review-reads-CxgN62yp.d.cts → note-properties-Dhqkro--.d.cts} +91 -67
- package/dist/{ooxml-package-D_CtywTW.d.ts → ooxml-package-BrxTmTsZ.d.ts} +115 -115
- package/dist/{ooxml-package-CR5us6ad.d.cts → ooxml-package-Cmbe_M04.d.cts} +115 -115
- package/dist/{ooxml-tree-BU0e3DVi.d.cts → ooxml-tree-CG0odFyi.d.cts} +1 -1
- package/dist/{ooxml-tree-BU0e3DVi.d.ts → ooxml-tree-CG0odFyi.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +7 -7
- package/dist/output.d.ts +7 -7
- package/dist/output.js +1 -1
- package/dist/{protocol-CD7slqvl.d.cts → protocol-B5oSt08P.d.cts} +2 -2
- package/dist/{protocol-DsbfgBwA.d.ts → protocol-ooK7PAXz.d.ts} +2 -2
- package/dist/{review-support-DgXTIYBW.d.ts → review-support-Bl9sN8cv.d.ts} +47 -3
- package/dist/{review-support-BJ-YjGmD.d.cts → review-support-CHuJxHmz.d.cts} +47 -3
- package/dist/{revision-projection-DHAkcD_L.d.ts → revision-projection-DRZMzoLD.d.cts} +54 -3
- package/dist/{revision-projection-72ZApe-g.d.cts → revision-projection-u4nT52xT.d.ts} +54 -3
- package/dist/{semantic-cell-selection-DZtyMXkH.d.ts → semantic-cell-selection-CdNQ-a9-.d.cts} +8 -5
- package/dist/{semantic-cell-selection--ezfezTe.d.cts → semantic-cell-selection-Dc-_enhm.d.ts} +8 -5
- package/dist/{semantic-interaction-DrgbgKg6.d.ts → semantic-interaction-CCVwyw2A.d.ts} +2 -30
- package/dist/{semantic-interaction-2yxdv7q0.d.cts → semantic-interaction-DgaWs-5w.d.cts} +2 -30
- package/dist/{semantic-paint-BYjE0Xbl.d.cts → semantic-paint-6iIB4fhx.d.cts} +2 -2
- package/dist/{semantic-paint-BedBxkyY.d.ts → semantic-paint-CKIbFkQ7.d.ts} +2 -2
- package/dist/{semantic-records-CR5hTqMK.d.ts → semantic-records-B-qbrnp2.d.ts} +107 -9
- package/dist/{semantic-records-DSD8WENa.d.cts → semantic-records-Dq8SlCY8.d.cts} +107 -9
- package/dist/{shaped-measurer-BL8g4AcW.d.ts → shaped-measurer-BT4FqYe9.d.ts} +1 -1
- package/dist/{shaped-measurer-CBOTJTV_.d.cts → shaped-measurer-Dx4llNhK.d.cts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +254 -231
- package/dist/store.d.ts +254 -231
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-8a6xyRCN.d.ts → tree-op-types-CZw9QhWX.d.ts} +219 -219
- package/dist/{tree-op-types-EZXbR8bW.d.cts → tree-op-types-DOYNkKqD.d.cts} +219 -219
- package/dist/{tree-session-SucW0znF.d.ts → tree-session-CF_EOhTW.d.ts} +14 -8
- package/dist/{tree-session-DrMm8Cj2.d.cts → tree-session-CtK3KgFU.d.cts} +14 -8
- package/dist/{tree-store-BoM6eXaL.d.ts → tree-store-9TaX-L0V.d.ts} +31 -4
- package/dist/{tree-store-UYrGKF_Q.d.cts → tree-store-Jg-q7fyf.d.cts} +31 -4
- package/package.json +3 -3
- package/dist/chunk-33F6TRXO.js +0 -2
- package/dist/chunk-4WWEDTTE.js +0 -2
- package/dist/chunk-BS554B6D.cjs +0 -2
- package/dist/chunk-DQ5HGUWG.cjs +0 -12
- package/dist/chunk-EQO762XH.cjs +0 -10
- package/dist/chunk-F6WNPYOM.js +0 -2
- package/dist/chunk-FL4GWK76.js +0 -12
- package/dist/chunk-GWG5IVVX.cjs +0 -5
- package/dist/chunk-IZIL6BAW.cjs +0 -12
- package/dist/chunk-LIJPSHRA.js +0 -5
- package/dist/chunk-MHDO6HLI.cjs +0 -2
- package/dist/chunk-SG7OH2EK.js +0 -12
- package/dist/chunk-TCX3PVWR.js +0 -10
- package/dist/chunk-YTYKNA6X.cjs +0 -2
- package/dist/chunk-ZACHY6OS.js +0 -1
package/dist/chunk-LIJPSHRA.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {b,g}from'./chunk-4WWEDTTE.js';import {M as M$1,L,O,G as G$1}from'./chunk-33F6TRXO.js';import {s,ze as ze$1,Ce,Ea,xb,Qc,Ff,Tf,Je,Ke,Lf,Kf,ff,Nf,Of,Ud,og,Uf,Sc,yc,Tc,Vb,yb,Af,Uc,_d,Tb,Ub,N,Sf,Rf,Rb,Wb,wg,xg,Kc,Jc,ng,Yb,Kb,Mb}from'./chunk-TCX3PVWR.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 j(t){let e=_(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var hn=/^[0-9A-Fa-f]{6}$/,ye=/^\d{1,6}$/,kn=/^-?\d{1,6}$/;function Ae(t){return t===void 0||t==="auto"?null:hn.test(t)?`#${t}`:null}var xn={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"},bn={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 On(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function U(t,e=false){return t===void 0||!(e?kn:ye).test(t)?null:`${Number(t)/20}pt`}function Lt(t){let e=[],n=[],o=null,s=null;for(let l of t)switch(l.localName){case "b":e.push(`font-weight:${j(l)?"bold":"normal"}`);break;case "i":e.push(`font-style:${j(l)?"italic":"normal"}`);break;case "u":{let r=_(l)??"single";if(r==="none"||!j(l))break;n.push("underline"),o=xn[r]??"solid",s=Ae(l.attributes?.color);break}case "strike":j(l)&&n.push("line-through");break;case "dstrike":j(l)&&n.push("line-through");break;case "caps":j(l)&&e.push("text-transform:uppercase");break;case "smallCaps":j(l)&&e.push("font-variant:small-caps");break;case "vertAlign":{let r=_(l);r==="superscript"?e.push("vertical-align:super","font-size:0.75em"):r==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let r=Ae(_(l));r&&e.push(`color:${r}`);break}case "highlight":{let r=bn[_(l)??""];r&&e.push(`background-color:${r}`);break}case "sz":{let r=_(l);r!==void 0&&ye.test(r)&&e.push(`font-size:${Number(r)/2}pt`);break}case "rFonts":{let r=On(l.attributes?.ascii??l.attributes?.hAnsi);r&&e.push(`font-family:${r}`);break}case "spacing":{let r=U(_(l),true);r&&e.push(`letter-spacing:${r}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),o&&e.push(`text-decoration-style:${o}`),s&&e.push(`text-decoration-color:${s}`)),e.join(";")}var Sn={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Bt(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let o=Sn[_(n)??""];o&&e.push(`text-align:${o}`);break}case "ind":{let o=U(n.attributes?.left??n.attributes?.start,true),s=U(n.attributes?.right??n.attributes?.end,true),l=U(n.attributes?.firstLine),r=U(n.attributes?.hanging);o&&e.push(`margin-left:${o}`),s&&e.push(`margin-right:${s}`),l?e.push(`text-indent:${l}`):r&&e.push(`text-indent:-${r}`);break}case "spacing":{let o=U(n.attributes?.before),s=U(n.attributes?.after);o&&e.push(`margin-top:${o}`),s&&e.push(`margin-bottom:${s}`);let l=n.attributes?.line,r=n.attributes?.lineRule;l!==void 0&&ye.test(l)&&r!=="exact"&&r!=="atLeast"?e.push(`line-height:${(Number(l)/240).toFixed(3)}`):l!==void 0&&ye.test(l)&&e.push(`line-height:${Number(l)/20}pt`);break}case "shd":{let o=Ae(n.attributes?.fill);o&&e.push(`background-color:${o}`);break}case "pageBreakBefore":j(n)&&e.push("break-before:page");break;}return e.join(";")}var E=new Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Bt(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=Lt(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=Rn(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function vn(t){return JSON.stringify(Array.isArray(t)?t:[])}function Rn(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let n=[];for(let o of e){if(typeof o!="object"||o===null)return null;let s=o;if(typeof s.localName!="string"||s.attributes!==void 0&&(typeof s.attributes!="object"||s.attributes===null))return null;n.push(s.attributes===void 0?{localName:s.localName}:{localName:s.localName,attributes:s.attributes});}return n}catch{return null}}function Le(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function he(t,e){return JSON.stringify(ke(t))===JSON.stringify(ke(e))}function ke(t){return [...t].map(e=>({localName:e.localName,attributes:Object.fromEntries(Object.entries(e.attributes??{}).sort(([n],[o])=>n<o?-1:1))})).sort((e,n)=>e.localName<n.localName?-1:1)}function Be(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue")continue;let o={};for(let s of n.attributes)o[s.localName]=s.value;e.push(Object.keys(o).length>0?{localName:n.localName,attributes:o}:{localName:n.localName});}return e}function Ht(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 G(t){if(t.kind==="textValue")return [];let e=[],n=o=>{if(o.kind!=="run")return;let s=o.children.find(r=>r.kind==="runProperties"),l=Be(s);for(let r of o.children)if(r.kind!=="runProperties"){if(r.kind==="tab"){e.push({kind:"tab"});continue}if(r.kind==="hardBreak"){e.push(Yb(r)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(r.kind==="text"){let c="";for(let p of r.children)p.kind==="textValue"&&(c+=p.value);c.length>0&&e.push({kind:"text",text:c,props:l});continue}e.push({kind:"unknown",nodeId:r.id,label:Ht(r)});}};return Rb(t.children,0,o=>{if(o.kind==="run"){n(o);return}e.push({kind:"unknown",nodeId:o.id,label:Ht(o)});}),e}function M(t){let e=[],n=o=>{if(o.kind!=="textValue"){if(o.kind==="body"){for(let s of o.children)s.kind==="paragraph"&&e.push(s);return}for(let s of o.children)n(s);}};return n(t.root),e}function $(t){let e=[];for(let n of ze$1(t))n.root.kind!=="textValue"&&Ce(n.root.children,e,0);return e}function Y(t){let e=M(t).map(n=>{let o=n.kind==="textValue"?void 0:n.children.find(l=>l.kind==="paragraphProperties"),s=G(n).map(l=>{switch(l.kind){case "text":return E.text(l.text,l.props.length>0?[E.marks.runProps.create({props:l.props})]:[]);case "tab":return E.node("tab");case "hardBreak":return E.node("hardBreak");case "pageBreak":return E.node("pageBreak");default:return E.node("unknownInline",{nodeId:l.nodeId,label:l.label})}});return E.node("paragraph",{nodeId:n.id,props:Be(o)},s)});return E.node("doc",null,e.length>0?e:[E.node("paragraph")])}function Q(t){let e=[];return t.forEach(n=>{if(n.isText&&n.text){e.push({kind:"text",text:n.text,props:Le(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 C(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+=Wb);return e}function jt(t){let e=[],n=0;for(let o of t)o.kind==="text"?n+=o.text.length:o.kind==="tab"||o.kind==="hardBreak"||o.kind==="pageBreak"?n+=1:e.push(`${o.nodeId}@${n}`);return e}function In(t,e){if(t===e)return null;let n=0,o=Math.min(t.length,e.length);for(;n<o&&t[n]===e[n];)n+=1;let s=t.length,l=e.length;for(;s>n&&l>n&&t[s-1]===e[l-1];)s-=1,l-=1;return {start:n,endBefore:s,endAfter:l}}function _t(t){let e=[];for(let n of t)if(n.kind==="text")for(let o=0;o<n.text.length;o+=1)e.push(n.props);else (n.kind==="tab"||n.kind==="hardBreak"||n.kind==="pageBreak")&&e.push(e[e.length-1]??[]);return e}function Tn(t,e,n,o,s){let l=[],r=jt(e),c=jt(n);if(JSON.stringify(r)!==JSON.stringify(c))return {ok:false,reason:"unknown-content-moved",detail:t};he(o,s)||l.push({op:"setParagraphProperties",paragraphId:t,properties:ke(s)});let p=C(e),m=C(n),h=In(p,m);if(h&&(h.endBefore>h.start&&l.push({op:"deleteText",paragraphId:t,start:h.start,end:h.endBefore}),h.endAfter>h.start)){let b=m.slice(h.start,h.endAfter),g=h.start,i="",y=()=>{i.length!==0&&(l.push({op:"insertText",paragraphId:t,offset:g,text:i}),g+=i.length,i="");};for(let k of b)k===" "?(y(),l.push({op:"insertTab",paragraphId:t,offset:g}),g+=1):k===`
|
|
3
|
-
`?(y(),l.push({op:"insertHardBreak",paragraphId:t,offset:g}),g+=1):k===Wb?(y(),l.push({op:"insertPageBreak",paragraphId:t,offset:g}),g+=1):i+=k;y();}if(!h){let b=_t(e),g=_t(n),i=0;for(;i<g.length;){if(he(b[i]??[],g[i])){i+=1;continue}let y=i,k=g[i];for(;i<g.length&&he(g[i],k)&&!he(b[i]??[],g[i]);)i+=1;l.push({op:"setRunProperties",paragraphId:t,start:y,end:i,properties:ke(k)});}}return {ok:true,ops:l}}function He(t,e){let n=M(t),o=[];if(e.forEach(l=>{l.type.name==="paragraph"&&o.push(l);}),o.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let s=o.length-n.length;if(s===0){let l=[];for(let[r,c]of o.entries()){let p=n[r];if(c.attrs.nodeId!==p.id)return {ok:false,reason:"paragraph-reordered",detail:String(c.attrs.nodeId)};let m=Tn(p.id,G(p),Q(c),Be(p.kind==="textValue"?void 0:p.children.find(h=>h.kind==="paragraphProperties")),c.attrs.props??[]);if(!m.ok)return m;l.push(...m.ops);}return {ok:true,ops:l}}return s===1?Nn(n,o):s===-1?En(n,o):{ok:false,reason:"paragraph-count-unexplained",detail:String(s)}}function Nn(t,e){for(let n=0;n<t.length;n+=1){let o=t[n],s=e[n],l=e[n+1];if(!s||!l||s.attrs.nodeId!==o.id)continue;let r=l.attrs.nodeId;if(r!==null&&r!==o.id)continue;let c=C(Q(s));if(c+C(Q(l))===C(G(o))&&$t(t,e,n)&&zt(t,e,n+1,n+2))return {ok:true,ops:[{op:"splitParagraph",paragraphId:o.id,offset:c.length}]}}return {ok:false,reason:"split-not-clean"}}function En(t,e){for(let n=0;n+1<t.length;n+=1){let o=t[n],s=t[n+1],l=e[n];if(!l||l.attrs.nodeId!==o.id)continue;let r=C(G(o))+C(G(s));if(C(Q(l))===r&&$t(t,e,n)&&zt(t,e,n+2,n+1))return {ok:true,ops:[{op:"joinParagraphs",firstId:o.id,secondId:s.id}]}}return {ok:false,reason:"join-not-clean"}}function $t(t,e,n){for(let o=0;o<n;o+=1){let s=e[o],l=t[o];if(!s||s.attrs.nodeId!==l.id||C(Q(s))!==C(G(l)))return false}return true}function zt(t,e,n,o){for(let s=0;n+s<t.length;s+=1){let l=t[n+s],r=e[o+s];if(!r||r.attrs.nodeId!==l.id||C(Q(r))!==C(G(l)))return false}return true}function Cn(t,e){return Ea(t,e)!==null}function je(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return Y(e);let o=new Map;t.forEach(p=>{let m=p.attrs.nodeId;typeof m=="string"&&o.set(m,p);});let s=new Set(n.dirty),l=M(e);if(l.length!==t.childCount)return Y(e);let r=Y(e),c=[];for(let[p,m]of l.entries()){let h=o.get(m.id);c.push(h&&!s.has(m.id)?h:r.child(p));}return E.node("doc",null,c)}function Dn(t,e){let n=t.kind==="revision"?t.ranges[0]??null:t.range;if(!n)return null;let o=e.get(n.start.paragraphId);return o===void 0?null:o}function Wt(t,e,n){for(let s of e)if(s.ranges.length===0)return false;let o=new Set;for(let s of t)s.kind!=="revision"||s.ranges.length>0||Yt(s,n)||o.add(b(s));for(let s of e)if(o.has(b(s)))return false;return true}function Ut(t,e,n,o){let s=e.get(n);if(s===void 0)return [...t];let l=[],r=null;for(let c of t){if(c.kind==="revision"&&Yt(c,n)){r===null&&(r=l.length);continue}if(r===null){let p=Dn(c,e);p!==null&&p>s&&(r=l.length);}l.push(c);}if(r===null&&(r=l.length),o.length>0){let c=o.length<2?[...o]:[...o].sort((p,m)=>g(p,e)-g(m,e));l.splice(r,0,...c);}return ng(l)}function Yt(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function Mn(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function wn(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function Fn(t,e){return t.ranges.length===0||!t.ranges.some(o=>o.start.paragraphId===e||o.end.paragraphId===e)?false:!t.ranges.every(o=>o.start.paragraphId===e&&o.end.paragraphId===e)}function Gt(t,e,n,o,s,l,r){if(t.fromRevision!==e.bodyRevision||r!==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!==s||e.commentsExtendedPart!==l)return null;let c=t.dirty[0],p=Ea(o,c);if(!p||p.kind!=="paragraph")return null;for(let m of n){if(m.kind==="comment"){if(Mn(m,c))return null;continue}if(m.kind==="custom"){if(m.range?.start.paragraphId===c)return null;continue}if(wn(m,c)||Fn(m,c))return null}return c}var Xt=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,An=["ascii","hAnsi","cs","eastAsia"],Ln=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"];var Bn=/[\u0000-\u001F\u007F-\u009F]/;function xe(t){return t.kind!=="textValue"}function K(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Jt(t,e){let n=new Map,o=r=>{if(!r||!Xt.test(r))return;let c=r.toLowerCase();n.has(c)||n.set(c,r);},s=[...t].reverse();for(;s.length>0;){let r=s.pop();if(xe(r)){if(r.localName==="rFonts"){for(let c of An)o(K(r,c));if(e)for(let c of Ln){let p=K(r,c);p!==void 0&&(p.startsWith("major")?o(e.major):p.startsWith("minor")&&o(e.minor));}}for(let c=r.children.length-1;c>=0;c-=1)s.push(r.children[c]);}}let l=[...n.values()];return l.sort((r,c)=>r<c?-1:r>c?1:0),l}var Hn=new Set(["paragraph","character","table","numbering"]),jn=/^[0-9A-Fa-f]{6}$/,_n=16,Kt=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 Zt(t){return t.children}function _e(t,e){for(let n of Zt(t))if(xe(n)&&n.localName===e)return n}function $n(t){return Kt.get(t.name.toLowerCase())??Kt.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function $e(t){return t===void 0||t.length===0||t.length>128||Bn.test(t)?null:t}function Qt(t,e){if(!t)return [];let n=new Map;for(let l of t.children){if(!xe(l)||l.localName!=="style")continue;let r=$e(K(l,"styleId"));r!==null&&!n.has(r)&&n.set(r,l);}let o=l=>{let r=false,c=false,p=null,m=false,h=false,b=new Set,g=l;for(let k=0;k<_n&&g!==null&&!b.has(g);k+=1){b.add(g);let I=n.get(g);if(!I)break;let S=_e(I,"rPr");for(let T of S?Zt(S):[]){if(!xe(T))continue;let v=K(T,"val"),H=v!=="0"&&v!=="false"&&v!=="off";T.localName==="b"&&!m?(r=H,m=true):T.localName==="i"&&!h?(c=H,h=true):T.localName==="color"&&p===null&&v&&jn.test(v)&&(p=v);}let P=_e(I,"basedOn");g=P?$e(K(P,"val")):null;}let i=e?.(l),y=i?.fontFamily??null;return {fontFamily:y!==null&&Xt.test(y)?y:null,fontSizePt:i?.fontSizeHalfPoints!=null&&i.fontSizeHalfPoints>0?i.fontSizeHalfPoints/2:null,bold:r,italic:c,color:p}},s=[];for(let[l,r]of n){let c=K(r,"type");if(c===void 0||!Hn.has(c))continue;let p=_e(r,"name"),m=$e(p?K(p,"val"):void 0);s.push({styleId:l,name:m??l,type:c,preview:o(l)});}return s.map((l,r)=>({entry:l,index:r,rank:$n(l)})).sort((l,r)=>l.rank-r.rank||l.index-r.index).map(l=>l.entry)}var zn=128,Wn=/[\u0000-\u001F\u007F-\u009F]/,Un=/[\u0000-\u001F\u007F-\u009F]/g,Yn=200,Gn=/^heading ([1-9])$/i;function ze(t){return t.kind!=="textValue"}function oe(t,e){for(let n of t.children)if(ze(n)&&n.localName===e)return n}function re(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Kn(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!ze(n)||n.localName!=="style"||re(n,"type")!=="paragraph")continue;let o=re(n,"styleId");if(o===void 0||o.length===0||o.length>zn||Wn.test(o))continue;let s=oe(n,"name"),l=s?re(s,"val"):void 0,r=l!==void 0?Gn.exec(l):null;if(r){e.set(o,Number(r[1])-1);continue}let c=oe(n,"pPr"),p=c?oe(c,"outlineLvl"):void 0,m=p?re(p,"val"):void 0;m!==void 0&&/^[0-8]$/.test(m)&&e.set(o,Number(m));}return e}function We(t){let e=oe(t,"pPr"),n=e?oe(e,"pStyle"):void 0;return n?re(n,"val"):void 0}function qt(t,e){let n=Kn(e);if(n.size===0)return [];let o=[];for(let s of M(t)){if(!ze(s))continue;let l=We(s);if(l===void 0)continue;let r=n.get(l);if(r===void 0)continue;let p=(Af(t,s.id)??"").replace(Un," ").trim().slice(0,Yn);p.length!==0&&o.push({text:p,level:r,blockId:s.id});}return o}var be=48,Xn=/[\u0000-\u001F\u007F-\u009F]/g;function Vt(t){return t.kind!=="textValue"}function Oe(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"||Kb(t)){let n=0,o=t.kind==="hyperlink"?t.children:Mb(t)??[];for(let s of o)n+=Oe(s);return n}let e=0;for(let n of t.children)e+=Oe(n);return e}function Jn(t){let e=[],n=0;return Vt(t)&&Rb(t.children,0,o=>{if(o.kind==="run"){e.push(n),n+=Oe(o);return}n+=Oe(o);}),e}function Zn(t,e){if(t.length===0)return {index:0,offset:e};for(let n=t.length-1;n>=0;n-=1){let o=t[n];if(e>=o)return {index:n,offset:e-o}}return {index:0,offset:e}}function Ue(t,e){return t.replace(Xn," ").slice(0,e)}function en(t,e,n={}){let o={matches:[],truncated:false};if(!wg(e))return o;let s=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,l={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},r=[],c=0;for(let p of M(t)){if(!Vt(p))continue;let m=c;c+=1;let h=Af(t,p.id)??"";if(h.length===0)continue;let b=xg(h,e,s-r.length,l),g=null;for(let i of b.matches){let y=i.start+i.length;g??=Jn(p);let k=Zn(g,i.start);r.push({blockId:p.id,start:i.start,length:i.length,paragraphIndex:m,runIndex:k.index,runOffset:k.offset,text:Ue(h.slice(i.start,y),256),contextBefore:Ue(h.slice(Math.max(0,i.start-be),i.start),be),contextAfter:Ue(h.slice(y,y+be),be)});}if(b.truncated)return {matches:r,truncated:true}}return {matches:r,truncated:false}}var Qn=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"],qn=/^[0-9A-Fa-f]{6}$/,tn={windowText:"000000",window:"FFFFFF"};function rn(t){return t.kind!=="textValue"}function Se(t,e){return t.attributes.find(n=>n.localName===e)?.value}function on(t,e){let n=[t];for(;n.length>0;){let o=n.pop();if(rn(o)){if(o.localName===e)return o;for(let s=o.children.length-1;s>=0;s-=1)n.push(o.children[s]);}}return null}function Pe(t,e){for(let n of t.children)if(rn(n)&&(e===void 0||n.localName===e))return n;return null}function Vn(t){let e=Pe(t);if(!e)return null;let n;if(e.localName==="srgbClr")n=Se(e,"val");else if(e.localName==="sysClr"){let o=Se(e,"val")??"";n=Se(e,"lastClr")??(Object.prototype.hasOwnProperty.call(tn,o)?tn[o]:void 0);}return n===void 0||!qn.test(n)?null:n.toUpperCase()}var er=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function nn(t,e){let n=Pe(t,e),o=n?Pe(n,"latin"):null,s=o?Se(o,"typeface"):void 0;return s!==void 0&&er.test(s)?s:null}function ae(t){if(!t)return {major:null,minor:null};let e=on(t,"fontScheme");return e?{major:nn(e,"majorFont"),minor:nn(e,"minorFont")}:{major:null,minor:null}}function an(t){if(!t)return [];let e=on(t,"clrScheme");if(!e)return [];let n=[];for(let o of Qn){let s=Pe(e,o),l=s?Vn(s):null;if(l===null)return [];n.push({slot:o,hex:l});}return n}var tr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;var nr=/[\u0000-\u001F\u007F-\u009F]/;function un(t){return t.kind!=="textValue"}function X(t,e){for(let n of t.children)if(un(n)&&n.localName===e)return n}function J(t,e){return t.attributes.find(n=>n.localName===e)?.value}function ln(t){return t===void 0||t.length===0||t.length>128||nr.test(t)?null:t}function ve(t,e){return t==="minorAscii"||t==="minorHAnsi"?e.minor:t==="majorAscii"||t==="majorHAnsi"?e.major:null}function rr(t,e){let n=ve(J(t,"asciiTheme"),e)??ve(J(t,"hAnsiTheme"),e);if(n!==null)return n;let o=J(t,"ascii")??J(t,"hAnsi");return o===void 0?null:tr.test(o)?o:null}function sn(t,e){if(!t)return {fontFamily:null,fontSizeHalfPoints:null};let n=X(t,"rFonts"),o=X(t,"sz"),s=o?J(o,"val"):void 0,l=s!==void 0&&/^\d{1,4}$/.test(s)?Number(s):null;return {fontFamily:n?rr(n,e):null,fontSizeHalfPoints:l!==null&&l>=2&&l<=3276?l:null}}function Ye(t,e){let n=new Map,o={fontFamily:null,fontSizeHalfPoints:null};if(t){let r=X(t,"docDefaults"),c=r?X(r,"rPrDefault"):void 0;o=sn(c?X(c,"rPr"):void 0,e);for(let p of t.children){if(!un(p)||p.localName!=="style")continue;let m=ln(J(p,"styleId"));if(m===null||n.has(m))continue;let h=X(p,"basedOn");n.set(m,{basedOn:ln(h?J(h,"val"):void 0),own:sn(X(p,"rPr"),e)});}}let s=new Map,l=r=>{let c=r??"",p=s.get(c);if(p)return p;let m=null,h=null,b=new Set,g=r;for(let y=0;g!==null&&y<16&&!b.has(g);y+=1){b.add(g);let k=n.get(g);if(!k)break;m??=k.own.fontFamily,h??=k.own.fontSizeHalfPoints,g=k.basedOn;}let i={fontFamily:m??o.fontFamily,fontSizeHalfPoints:h??o.fontSizeHalfPoints};return s.set(c,i),i};return (r,c)=>{let p=l(r),m=c?.find(b=>b.localName==="rFonts"),h=m?ve(m.attributes?.asciiTheme,e)??ve(m.attributes?.hAnsiTheme,e):null;return h===null?p:{...p,fontFamily:h}}}function dn(t){let e=new Map,n=new Map,o=new Map;return $(t).forEach((s,l)=>{o.set(s.id,l);let r=Kc(s);if(r===null||!Jc(r))return;e.set(s.id,r);let c=r.toUpperCase();n.has(c)||n.set(c,s.id);}),Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:o})}var or=Object.freeze([]);function ar(t,e={}){let n=xb(t);if(!n.ok)return {ok:false,reason:n.reason,...n.detail?{detail:n.detail}:{}};let o=n.package,s=o.parts.get(o.mainDocumentPart);if(!s)return {ok:false,reason:"no-main-document-tree",detail:o.mainDocumentPart};let l=Qc(s),r=new Ff(o,l),c=null,p=null,m=null,h=null;r.subscribe(a=>{h=a;});let b=()=>r.bodyStore(),g=()=>r.currentPackage(),i=Object.freeze({kind:"body"}),y=(a,u)=>{let d=r.currentPackage(),f=a.checkpoint();a.graftPackage(()=>r.currentPackage());let x=u();return x.ok&&(a.restoreHistoryStacks(f),r.replacePackageShell(a.package),r.adoptPackageUnit(d),r.publishStoryWrite(x.change)),x},k=()=>{if(!c||c.packageRevision!==r.packageRevision){let a=Tb(g());c={packageRevision:r.packageRevision,resolution:a,parts:Ub(g())};}return c},I="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",S="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",P=false,T=null,v=()=>{if(P)return T;P=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(f=>f.type===I),d;if(u){let f=N(u);f.mode==="Internal"&&f.target.ok&&(d=a.parts.get(f.target.partName));}return d??=a.parts.get("/word/styles.xml"),T=d?.root??null,T},H=false,z=null,le=()=>{if(H)return z;H=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(f=>f.type===S),d;if(u){let f=N(u);f.mode==="Internal"&&f.target.ok&&(d=a.parts.get(f.target.partName));}return d??=a.parts.get("/word/numbering.xml"),z=d?.root??null,z},q="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",se=-1,Re=null,Ge=()=>{if(se===r.packageRevision)return Re;se=r.packageRevision;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(f=>f.type===q),d;if(u){let f=N(u);f.mode==="Internal"&&f.target.ok&&(d=a.parts.get(f.target.partName));}return d??=a.parts.get("/word/settings.xml"),Re=d?.root??null,Re},mn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Ke$1=false,Ie=null,V=()=>{if(Ke$1)return Ie;Ke$1=true;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(f=>f.type===mn),d;if(u){let f=N(u);f.mode==="Internal"&&f.target.ok&&(d=a.parts.get(f.target.partName));}return d??=a.parts.get("/word/theme/theme1.xml"),Ie=d?.root??null,Ie},gn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",ie=null,yn=()=>{if(ie)return ie;let a=g(),u=(a.relationships.get(a.mainDocumentPart)??[]).find(f=>f.type===gn),d;if(u){let f=N(u);f.mode==="Internal"&&f.target.ok&&(d=a.parts.get(f.target.partName));}return d??=a.parts.get("/word/fontTable.xml"),ie=Object.freeze(G$1(a,d)),ie},ee=null,Xe=null,Je$1=null,Ze=null,ue=null,de=null,te=null,ne=null,ce=null,pe=null,Te=()=>{let a=b();return (!ce||ce.revision!==a.revision)&&(ce={revision:a.revision,index:dn(a.part)}),ce.index};return {ok:true,session:{editable:$(b().part).length>0,paragraphIds:()=>$(b().part).map(a=>a.id),paragraphIdsIn(a=i){let u=r.partFor(a);return u?$(u).map(d=>d.id):[]},part:()=>b().part,partFor:a=>r.partFor(a),currentPackage:g,applyTreeOps(a,u,d,f=i){if(a.length===0)return {committed:false,rejected:false,opCount:0};let x=a.filter(R=>Uc(R)||_d(R)).length;if(x>0){if(x!==a.length||a.length!==1)return {committed:false,rejected:true,opCount:a.length,reason:"invalidArgs"};let R=r.applyLifecycleOp(a[0]);return R.ok?{committed:true,rejected:false,opCount:1}:{committed:false,rejected:true,opCount:1,reason:R.detail??R.reason}}let O=r.transact(f,R=>{u!==void 0&&R.selectionBefore(u),d!==void 0&&R.selectionAfter(d);for(let N of a)R.apply(N);});return O.ok?{committed:true,rejected:false,opCount:a.length}:{committed:false,rejected:true,opCount:a.length,reason:O.reason}},projectDoc:()=>Y(b().part),reconcile:a=>je(a,b().part,h),lastCommitWasStructural:()=>h!==null&&(h.created.length>0||h.deleted.length>0||h.splitJoin.length>0||h.impact==="global"),applyPmDoc(a){let u=b(),d=He(u.part,a);if(!d.ok)return {committed:false,rejected:true,opCount:0,reason:d.reason};if(d.ops.length===0)return {committed:false,rejected:false,opCount:0};let f=r.transact(i,x=>{for(let O of d.ops)x.apply(O);});return f.ok?{committed:true,rejected:false,opCount:d.ops.length}:{committed:false,rejected:true,opCount:d.ops.length,reason:f.reason}},bodyText:()=>lr(b().part),storyText(a){let u=r.partFor(a);return u?$(u).map(d=>Af(u,d.id)??"").join(`
|
|
4
|
-
`):null},revision:()=>b().revision,revisionFor:a=>r.revisionFor(a),packageRevision:()=>r.packageRevision,canUndo:()=>r.canUndo,canRedo:()=>r.canRedo,undo:()=>{let a=r.selectionForUndo();return r.undo()===null?null:a},redo:()=>{let a=r.selectionForRedo();return r.redo()===null?null:a},beginComposition:(a=i)=>{r.beginComposition(a);},endComposition:()=>r.endComposition(),subscribe(a){return r.subscribe(a)},save(){return yb(g())},headerFooterParts:()=>{let a=k().parts;return a[a.length-1]??Vb(g())},headerFooterPartsBySection:()=>k().parts,headerFooterResolutionBySection:()=>k().resolution,documentFonts(){if(ee&&ee.revision===r.packageRevision)return ee.fonts;let a=k().parts,u=[b().part.root],d=v();d&&u.push(d);let f=new Set;for(let x of a){for(let O of x.headers.values())f.has(O)||(f.add(O),u.push(O.root));for(let O of x.footers.values())f.has(O)||(f.add(O),u.push(O.root));}return ee={revision:r.packageRevision,fonts:Jt(u,ae(V()))},ee.fonts},documentStyles(){ue??=Ye(v(),ae(V()));let a=ue;return Xe??=Qt(v(),u=>a(u)),Xe},stylesRoot:()=>v(),documentThemeFonts(){return Ze??=ae(V()),Ze},numberingRoot:()=>le(),settingsRoot:()=>Ge(),trackingSettings:()=>O(Ge()),documentThemeColors(){return Je$1??=an(V()),Je$1},effectiveRunDefaults(a,u){ue??=Ye(v(),ae(V()));let d=b();if(!de||de.revision!==d.revision){let f=new Map;for(let x of $(d.part))x.kind!=="textValue"&&f.set(x.id,We(x)??null);de={revision:d.revision,byId:f};}return ue(de.byId.get(a)??null,u)},documentOutline(){let a=b();return te&&te.revision===a.revision||(te={revision:a.revision,outline:qt(a.part,v())}),te.outline},findText(a,u){let d=b(),f=`${u?.matchCase===true?"c":""}${u?.wholeWord===true?"w":""}${u?.limit??""}\0${a}`;if(ne&&ne.revision===d.revision&&ne.key===f)return ne.result;let x=en(d.part,a,u??{});return ne={revision:d.revision,key:f,result:x},x},embeddedFonts:yn,paragraphAnchors:Te,paraIdOf:a=>Te().paraIdByNode.get(a)??null,nodeIdOf:a=>Te().nodeByParaId.get(a.toUpperCase())??null,relationshipTarget:(a,u=i)=>{let d=g(),f=r.partFor(u);return f?Tc(d,f.name,a):null},bookmarks:()=>{let a=b();return (!pe||pe.revision!==a.revision)&&(pe={revision:a.revision,index:yc(a.part)}),pe.index},ensureHyperlinkRelationship(a,u=i){let d=r.partFor(u);if(!d)return null;let f=g(),x=Sc(f,a,d.name);return x?(x.pkg!==f&&r.replacePackageShell(x.pkg),x.relationshipId):null},reviewItems(){let a=e.reviewModel;if(!a)return or;let u=b(),d=`${r.packageRevision}:${u.revision}`;if(p&&p.revisionKey===d)return p.items;let f=g(),x=f.parts.get(Nf(f,u.part.name)),O=f.parts.get(Of(f,u.part.name)),R=[],N=new Set;for(let A of k().parts)for(let L of [A.headers,A.footers])for(let B of L.values())N.has(B)||(N.add(B),R.push(B));for(let A of ["footnote","endnote"]){let L=Ud(f,A);!L||N.has(L)||(N.add(L),R.push(L));}let w=p&&h?Gt(h,p,p.items,u.part,x,O,r.packageRevision):null,F,D;if(w&&p){let A=a.revisionItemsOfParagraph(u.part,w);Wt(p.items,A,w)?(F=Ut(p.items,p.paragraphOrder,w,A),D=p.paragraphOrder):(D=og(u.part),F=a.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:x,commentsExtendedPart:O,customNodePayloads:Uf(g(),u.part.name)}));}else D=og(u.part),F=a.collectReviewItems({storyPart:u.part,furnitureParts:R,commentsPart:x,commentsExtendedPart:O,customNodePayloads:Uf(g(),u.part.name)});return p={revisionKey:d,bodyRevision:u.revision,packageRevision:r.packageRevision,items:F,paragraphOrder:D,commentsPart:x,commentsExtendedPart:O},p.items},hasReviewContent(){let a=b();return (!m||m.revision!==a.revision)&&(m={revision:a.revision,present:ff(a.part).length>0||pn(a.part.root)}),m.present},replyToComment(a,u,d,f,x,O=i){let R=O.kind==="body"?null:r.resolveStory(O),N=R?.ok?R.store:b(),w=r.currentPackage(),F=N.checkpoint();N.graftPackage(()=>r.currentPackage());let D=Kf(N,{anchor:{paragraphId:u.paragraphId,start:u.start,end:u.end,...u.endParagraphId===void 0?{}:{endParagraphId:u.endParagraphId}},author:f,text:d,...x===void 0?{}:{date:x},...a===null?{}:{replyToCommentId:a}});return D.ok?(N.restoreHistoryStacks(F),r.replacePackageShell(N.package),r.adoptPackageUnit(w),r.publishStoryWrite(D.change),D.commentId):null},setCommentResolved(a,u){let d=b(),f=r.currentPackage(),x=d.checkpoint();d.graftPackage(()=>r.currentPackage());let O=Lf(d,a,u);return O.ok?(O.changed&&(d.restoreHistoryStacks(x),r.replacePackageShell(d.package),r.adoptPackageUnit(f),r.publishStoryWrite(O.change)),true):false},deleteComment(a,u=i,d){return this.deleteComments([{commentId:a}],u,d)},deleteComments(a,u=i,d){if(a.length===0)return false;let f=u.kind==="body"?b().part:r.partFor(u);if(!f)return false;let x={storyPartName:f.name,...d===void 0?{}:{noteId:d}},O=b(),R=r.currentPackage(),N=O.checkpoint();O.graftPackage(()=>r.currentPackage());let w=false,F=false,D=O.transact(A=>{A.applyPackage(L=>{let B=L;for(let fe of a){let Ne=fe.parentCommentId===void 0?Je(B,fe.commentId,x):Ke(B,fe.commentId,fe.parentCommentId,x);if(Ne===null)return w=true,L;F||=Ne!==B,B=Ne;}return B});});return w||!D.ok||!F?false:(O.restoreHistoryStacks(N),r.installPackageSnapshot(O.package),r.adoptPackageUnit(R),r.publishStoryWrite(D.change),true)},insertCustomNode(a,u=i){let d=u.kind==="body"?null:r.resolveStory(u),f=d?.ok?d.store:b();return y(f,()=>Rf(f,a,b().part.name))},removeCustomNode(a,u=i){let d=u.kind==="body"?null:r.resolveStory(u),f=d?.ok?d.store:b();return y(f,()=>Sf(f,a))},sweepCustomNodePayloads(a){let u=b(),d=Tf(r.currentPackage(),u.part.name,a);return d.ok?d.removed.length===0?{ok:true,removed:[]}:(r.replacePackageShell(d.pkg),{ok:true,removed:d.removed}):{ok:false,reason:d.reason}},ensureListDefinition(a){let u=L(g(),a);return u?(r.replacePackageShell(u.pkg),H=false,z=null,u.numId):null},ensureNumberingLevel(a,u,d){let f=g(),x=M$1(f,a,u,d);return x?(x!==f&&(r.replacePackageShell(x),H=false,z=null),true):false},insertImage(a,u){return r.insertImage(a,u)},replaceImage(a,u,d,f,x,O){return r.replaceImage(a,u,d,f,x,O)},deleteImage(a,u){return r.deleteImage(a,u)},applyImageProperties(a,u){return r.applyImageProperties(a,u)}}}}function lr(t){return M(t).map(e=>Af(t,e.id)??"").join(`
|
|
5
|
-
`)}var cn=new WeakMap;function pn(t,e=0){if(e>64)return false;let n=cn.get(t);if(n!==void 0)return n;let o=false;for(let s of t.children)if(s.kind!=="textValue"&&(s.kind==="commentRangeStart"||s.kind==="commentReference"||pn(s,e+1))){o=true;break}return cn.set(t,o),o}var sr=s.projection;function kr(t,e,n){let o=t.filter(s=>s.localName!==e);return o.length!==t.length?o:[...o,n?{localName:e,attributes:n}:{localName:e}]}function xr(t,e,n={}){let o=null,s=false,l=()=>n.onChange?.(r()),r=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:o}),c=i=>{s=true;let y=m.state.tr.replaceWith(0,m.state.doc.content.size,i.content);y.setMeta("addToHistory",false),m.dispatch(y),s=false;},p=i=>()=>(i()&&(c(e.projectDoc()),l()),true),m=new EditorView(t,{state:EditorState.create({doc:e.projectDoc(),plugins:[keymap({...baseKeymap,Home:selectTextblockStart,End:selectTextblockEnd,"Mod-z":p(()=>e.undo()!==null),"Mod-y":p(()=>e.redo()!==null),"Shift-Mod-z":p(()=>e.redo()!==null),"Mod-b":(i,y)=>g(i,y,"b"),"Mod-i":(i,y)=>g(i,y,"i"),"Mod-u":(i,y)=>g(i,y,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:i=>(h(i),false),beforeinput:(i,y)=>{let k=y;if(i.composing)return false;h(i);let I=k.inputType;if(I==="insertText"&&k.data!=null){k.preventDefault();let{from:S,to:P}=i.state.selection;return i.dispatch(i.state.tr.insertText(k.data,S,P)),true}if(I==="deleteContentBackward"){k.preventDefault();let{from:S,empty:P}=i.state.selection;return P?S>0?i.dispatch(i.state.tr.delete(S-1,S)):joinBackward(i.state,i.dispatch):deleteSelection(i.state,i.dispatch),true}if(I==="deleteContentForward"){k.preventDefault();let{from:S,to:P,empty:T}=i.state.selection;return T?P<i.state.doc.content.size?i.dispatch(i.state.tr.delete(S,S+1)):joinForward(i.state,i.dispatch):deleteSelection(i.state,i.dispatch),true}return I==="insertParagraph"?(k.preventDefault(),splitBlock(i.state,i.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),l(),false)},dispatchTransaction(i){let y=m.state.apply(i);if(s||!i.docChanged){m.updateState(y);return}let k=e.applyPmDoc(y.doc);if(k.rejected){o=String(k.reason??"rejected"),m.updateState(y),c(e.projectDoc()),l();return}o=null,m.updateState(k.committed&&e.lastCommitWasStructural()?b(y):y),l();}});function h(i){if(i.composing||s)return;let y=i.dom.ownerDocument.getSelection(),k=y?.anchorNode,I=y?.focusNode;if(!(!y||!k||!I)&&!(!i.dom.contains(k)||!i.dom.contains(I)))try{let S=i.posAtDOM(k,y.anchorOffset),P=i.posAtDOM(I,y.focusOffset),T=i.state.selection;if(T.anchor===S&&T.head===P)return;let v=TextSelection.create(i.state.doc,S,P);i.dispatch(i.state.tr.setSelection(v).setMeta("addToHistory",!1));}catch{}}function b(i){let y=e.paragraphIds(),k=i.tr,I=false,S=0;return i.doc.forEach((P,T)=>{let v=y[S];S+=1,!(P.type.name!=="paragraph"||v===void 0)&&P.attrs.nodeId!==v&&(k=k.setNodeMarkup(T,void 0,{...P.attrs,nodeId:v}),I=true);}),I?i.apply(k.setMeta("addToHistory",false)):i}function g(i,y,k,I){let S=E.marks.runProps;if(!y)return true;let{from:P,to:T,empty:v}=i.selection;if(v)return true;let z=i.doc.resolve(P).marks().find(se=>se.type===S)?.attrs.props??[],le=kr(z,k,I),q=i.tr;return q.removeMark(P,T,S),le.length>0&&q.addMark(P,T,S.create({props:le})),y(q),true}return {view:m,state:r,undo:()=>p(()=>e.undo()!==null)(),redo:()=>p(()=>e.redo()!==null)(),toggleRunProperty(i,y){g(m.state,m.dispatch.bind(m),i,y);},destroy:()=>m.destroy()}}export{E as a,Le as b,M as c,$ as d,Y as e,He as f,Cn as g,je as h,We as i,ar as j,sr as k,xr as l};
|
package/dist/chunk-MHDO6HLI.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkEQO762XH_cjs=require('./chunk-EQO762XH.cjs'),fflate=require('fflate');var $t=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],At=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Dt=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function nt(e){return At.test(e)||Dt.test(e)}function Y(e,t){if(!nt(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var Ft=/^(\d+)\.(\d+)\.(\d+)$/;function k(e){let t=Ft.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function J(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function q(e,t){let n=k(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=k(r.slice(1));return J(n,o)<0?false:o.major>0?n.major===o.major:o.minor>0?n.major===0&&n.minor===o.minor:n.major===0&&n.minor===0}if(r.includes(" ")){let o=r.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let s=true;for(let a of o){let i=a.startsWith(">=")?">=":a.startsWith("<")?"<":null;if(!i)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let d=k(a.slice(i.length)),l=J(n,d);i===">="?s=s&&l>=0:s=s&&l<0;}return s}return J(n,k(r))===0}var h=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},_e=(e,t)=>`${e}:${t}`;function Lt(e,t={}){let n=new Map;for(let l of e){if(Y(l.id,"extension"),rt(l.version,l.id),n.has(l.id))throw new h("duplicate-extension",`duplicate extension id ${l.id}`,[l.id]);n.set(l.id,l);for(let c of l.contributions)Y(c.id,c.kind),rt(c.version,`${l.id} \u2192 ${c.id}`),c.replaces&&Ht(c.replaces.targetRange,`${l.id} \u2192 replaces ${c.replaces.targetId}`);}for(let l of e){for(let c of l.dependencies??[])if(!n.has(c))throw new h("missing-dependency",`${l.id} requires missing extension ${c}`,[l.id,c]);for(let c of l.conflicts??[])if(n.has(c)){let p=[l.id,c].sort();throw new h("conflict",`extensions ${p[0]} and ${p[1]} conflict`,p)}}Bt(n);let r=new Set(t.availablePorts??[]);for(let l of e)for(let c of l.contributions)c.kind==="runtimePort"&&r.add(c.id);for(let l of e)for(let c of l.requiredPorts??[])if(!r.has(c))throw new h("missing-port",`${l.id} requires unavailable port ${c}`,[l.id,c]);let o=new Map,s=new Map,a=new Map;for(let l of e)for(let c of l.contributions){let p=_e(c.kind,c.id);if(c.replaces){let u=_e(c.kind,c.replaces.targetId),m=a.get(u)??[];m.push({ext:l.id,c}),a.set(u,m);continue}if(s.has(p)){let u=[o.get(p),l.id].sort();throw new h("id-collision",`${c.kind} id ${c.id} registered by both ${u[0]} and ${u[1]}`,u)}s.set(p,c),o.set(p,l.id);}let i=new Map(s);for(let[l,c]of a){let p=s.get(l);if(!p){let f=c[0];throw new h("replacement-target-missing",`${f.ext} replaces missing target ${f.c.replaces.targetId}`,[f.ext,f.c.replaces.targetId])}let u=p.replaceable??{kind:"none"};for(let{ext:f,c:y}of c){if(!q(p.version,y.replaces.targetRange))throw new h("replacement-version-mismatch",`${f} replaces ${y.replaces.targetId}@${p.version} outside range ${y.replaces.targetRange}`,[f,y.replaces.targetId]);if(u.kind==="none")throw new h("unauthorized-replacement",`${y.replaces.targetId} does not authorize replacement (attempted by ${f})`,[f,y.replaces.targetId])}let m=Mt(p,c);i.set(l,m);}return {extensions:n,contributions:i,get:(l,c)=>i.get(_e(l,c))}}function Mt(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let o=[...t].sort((i,d)=>(d.c.replaces.priority??0)-(i.c.replaces.priority??0)),s=o[0].c.replaces.priority??0,a=o.filter(i=>(i.c.replaces.priority??0)===s);if(a.length>1){let i=a.map(d=>d.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${s}: ${i.join(", ")}`,i)}return o[0].c}let r=t.map(o=>o.ext).sort();throw new h("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function Bt(e){let o=new Map,s=[],a=i=>{o.set(i,1),s.push(i);let d=[...e.get(i)?.dependencies??[]].sort();for(let l of d){let c=o.get(l)??0;if(c===1){let p=s.indexOf(l),u=[...s.slice(p),l];throw new h("dependency-cycle",`dependency cycle: ${u.join(" -> ")}`,u)}c===0&&a(l);}s.pop(),o.set(i,2);};for(let i of [...e.keys()].sort())(o.get(i)??0)===0&&a(i);}function rt(e,t){try{k(e);}catch{throw new h("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function Ht(e,t){try{q("0.0.0",e);}catch{throw new h("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var S=class extends Error{constructor(t){super(t),this.name="BudgetError";}},M=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new chunkEQO762XH_cjs.G(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,r=this;return {amount:t,get released(){return n},release(){n||(n=true,r.used.release(t),r.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let r=new e(t,n);return r.parent=this,r.carveAmount=n,this.children.add(r),r}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new S(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new S(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(r){t.push(r);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new S(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new S(`${this.label}: budget already released`)}};var Q=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},B=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new Q(t.derivedOnly,t._reason)}}}};var Z=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},$e=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new Z(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(chunkEQO762XH_cjs.w.clock)}identity(){return this.resolve(chunkEQO762XH_cjs.w.identity)}},Ae=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},De=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function Ut(e){let t=chunkEQO762XH_cjs.B(e.limits),n=Object.freeze({...e.config??{}}),r=e.capacity??t.maxDecompressedBytes,o=e.id??"op",s={id:o,limits:t,config:n,ports:e.ports,budget:new M(`op:${o}`,r),cancellation:new B};return Object.freeze(s)}function Vt(e){e.budget.dispose();}var Le=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),ot=Object.keys(Le);function Xt(e,t){return new chunkEQO762XH_cjs.G(`${Le[t].phase}:${t}`,e[t])}var Fe=class{counter;current=0;peak=0;constructor(t){this.counter=new chunkEQO762XH_cjs.G("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function jt(){for(let e of ot){let t=chunkEQO762XH_cjs.A[e],n=chunkEQO762XH_cjs.z[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}function H(e,t=new Set){let n=new WeakSet,r=o=>{if(o===null)return "null";let s=typeof o;if(s==="boolean")return o?"true":"false";if(s==="number"){let a=o;if(!Number.isFinite(a))throw new Error(`non-finite number is not comparable: ${a}`);return Object.is(a,-0)?"0":String(a)}if(s==="string")return JSON.stringify(o);if(s==="bigint")return `${o.toString()}n`;if(Array.isArray(o))return `[${o.map(r).join(",")}]`;if(s==="object"){let a=o;if(n.has(a))throw new Error("cannot canonicalize a cyclic structure");n.add(a);let d=Object.keys(a).filter(l=>!t.has(l)).sort().map(l=>`${JSON.stringify(l)}:${r(a[l])}`).join(",");return n.delete(a),`{${d}}`}throw new Error(`unsupported value type in comparator input: ${s}`)};return r(e)}function Me(e,t){let n=H(e,t),r=0xcbf29ce484222325n,o=0x100000001b3n,s=0xffffffffffffffffn;for(let a=0;a<n.length;a++)r^=BigInt(n.charCodeAt(a)),r=r*o&s;return r.toString(16).padStart(16,"0")}var R="dev.docx-editor.core.comparator",Be={authoredState:{id:`${R}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${R}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${R}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${R}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${R}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${R}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${R}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${R}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${R}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${R}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function He(e,t,n,r={}){let o=Be[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(r.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:it(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let s=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,a=H(t,s),i=H(n,s);return a===i?{equal:true}:{equal:false,left:a,right:i}}}}function Ue(e,t){let n=Be[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let r=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return Me(t,r)}function it(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,o)=>it(r,t[o],n)):false}var st=new Set([...chunkEQO762XH_cjs.t,...chunkEQO762XH_cjs.u]),at=/^[0-9a-f]{16}$/,Kt=/^[0-9a-f]*$/;function Ve(e){let t=[],n=o=>t.push(o);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let r=-1;e.steps.forEach((o,s)=>{let a=`step[${s}]`;st.has(o.origin)||n(`${a}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&n(`${a}: baseRevision must be a non-negative integer`),o.baseRevision<r&&n(`${a}: baseRevision regressed below ${r}`);let i=o.expect;i.outcome==="applied"?(i.committedRevision===void 0?n(`${a}: applied step needs committedRevision`):i.committedRevision<=o.baseRevision?n(`${a}: committedRevision ${i.committedRevision} must exceed baseRevision ${o.baseRevision}`):r=i.committedRevision,i.modelChange&&Gt(i.modelChange,a,n)):(i.committedRevision!==void 0&&n(`${a}: ${i.outcome} step must not commit a revision`),i.authoredStateHash!==void 0&&n(`${a}: ${i.outcome} step must not change authored state`)),i.authoredStateHash!==void 0&&!at.test(i.authoredStateHash)&&n(`${a}: authoredStateHash must be 16-hex`),i.outputHash!==void 0&&!at.test(i.outputHash)&&n(`${a}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&n(`envelope documentId ${o.documentId} != ${e.documentId}`),Kt.test(o.bytesHex)||n("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&n(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function Gt(e,t,n){st.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function zt(e,t){let n=Ve(e);if(!n.valid)return {ok:false,mismatches:n.errors};let r=[];return t.init(e),e.steps.forEach((o,s)=>{let a=`step[${s}]`,i=t.applyStep(o),d=o.expect;if(i.outcome!==d.outcome){r.push(`${a}: outcome ${i.outcome} != expected ${d.outcome}`);return}if(d.outcome==="applied"&&(i.committedRevision!==d.committedRevision&&r.push(`${a}: revision ${i.committedRevision} != expected ${d.committedRevision}`),d.authoredStateHash!==void 0))if(i.authoredState===void 0)r.push(`${a}: store returned no authored state to hash`);else {He("authoredState",i.authoredState,i.authoredState).equal||r.push(`${a}: authored state is not self-consistent`);let c=lt(i.authoredState);c!==d.authoredStateHash&&r.push(`${a}: authoredStateHash ${c} != expected ${d.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function lt(e){return Ue("authoredState",e)}var Wt=new Map([["embedRegular","regular"],["embedBold","bold"],["embedItalic","italic"],["embedBoldItalic","boldItalic"]]),Yt=32;function pt(e,t){let n=t.replace(/[^0-9a-fA-F]/g,"");if(n.length!==32)return null;let r=new Uint8Array(16);for(let a=0;a<16;a+=1){let i=Number.parseInt(n.slice(a*2,a*2+2),16);if(Number.isNaN(i))return null;r[15-a]=i;}let o=new Uint8Array(e),s=Math.min(Yt,o.length);for(let a=0;a<s;a+=1)o[a]=o[a]^r[a%16];return o}var Xe=(e,t)=>{if(!(e.kind==="textValue"||!("attributes"in e))){for(let n of e.attributes??[])if(n.localName===t)return n.value}},ct=e=>e.kind==="textValue"?[]:e.children??[],dt=e=>e.kind==="textValue"||!("localName"in e)?"":e.localName;function Jt(e,t,n){for(let r of e.relationships.get(t)??[]){if(r.id!==n)continue;if(r.targetMode==="External")return null;let o=chunkEQO762XH_cjs.q(t,r.rawTarget);return o.ok?o.partName:null}return null}function qt(e,t,n={}){if(!t)return [];let r=n.maxFontBytes??16*1024*1024,o=n.maxFonts??64,s=[],a=new Map,i=d=>{if(!(s.length>=o)){if(dt(d)==="font"){let l=Xe(d,"name");if(l&&l.length<=128)for(let c of ct(d)){if(s.length>=o)return;let p=Wt.get(dt(c));if(!p)continue;let u=Xe(c,"id"),m=Xe(c,"fontKey");if(!u||!m)continue;let f=Jt(e,t.name,u);if(!f)continue;let y=e.partBytes.get(f);if(!y||y.length===0||y.length>r)continue;let g=a.get(f);if(g){s.push({family:l,style:p,bytes:g,partName:f});continue}let O=pt(y,m);O&&(a.set(f,O),s.push({family:l,style:p,bytes:O,partName:f}));}}for(let l of ct(d))i(l);}};return i(t.root),s}function ut(e){if(e.kind!=="textValue")for(let t of e.children){if(t.kind==="textValue")continue;if(t.kind==="hyperlink"){let r=chunkEQO762XH_cjs.Ra(t);if(r!==void 0&&r.length>0)return r}let n=ut(t);if(n!==void 0)return n}}function Qt(e){let t="",n=false,r=o=>{if(!(n||o.kind==="textValue")){if(o.kind==="tab"||o.localName==="ptab"||o.localName==="tab"){n=true;return}if(o.kind==="text"||o.localName==="t"){for(let s of o.children)s.kind==="textValue"&&(t+=s.value);return}for(let s of o.children)r(s);}};return r(e),chunkEQO762XH_cjs.Dc(t)}function Zt(e,t,n,r){let o=n.filter(d=>{if(r.has(d.blockId))return false;let l=d.level+1;return l>=t.instruction.outlineStart&&l<=t.instruction.outlineEnd}),s=new Set(o.map(d=>d.blockId)),a=chunkEQO762XH_cjs.yc(e),i=new Map;for(let d of o){let l=chunkEQO762XH_cjs.Dc(d.text),c=i.get(l);c?c.push(d.blockId):i.set(l,[d.blockId]);}return t.resultParagraphIds.map(d=>{let l=chunkEQO762XH_cjs.Ea(e,d);if(!l||l.kind==="textValue")return null;let c=ut(l),p=c===void 0?void 0:a.get(c);if(p&&s.has(p.paragraphId)){let f=i.get(chunkEQO762XH_cjs.Dc(o.find(g=>g.blockId===p.paragraphId)?.text??"")),y=f?.indexOf(p.paragraphId)??-1;return f&&y>=0&&f.splice(y,1),p.paragraphId}let u=Qt(l);if(u.length===0)return null;let m=i.get(u);return !m||m.length===0?null:m.shift()??null})}function C(e){return e.namespaceUri===chunkEQO762XH_cjs.la?e.localName:`{${e.namespaceUri}}${e.localName}`}function I(e){let t=[];for(let n of e.attributes)t.push(n.namespaceUri===""||n.namespaceUri===chunkEQO762XH_cjs.la?`${n.localName}=${n.value}`:`{${n.namespaceUri}}${n.localName}=${n.value}`);return t.sort(),t}function ft(e,t){let n=I(e),r=n.length>0?`${C(e)}(${n.join(",")})`:C(e);if(t>=chunkEQO762XH_cjs.ba)return r;let o=[];for(let s of e.children){if(s.kind==="textValue"){s.value!==""&&o.push(`#${s.value}`);continue}o.push(ft(s,t+1));}return o.sort(),o.length>0?`${r}[${o.join(",")}]`:r}function mt(e){if(!e)return [];let t=[];for(let n of e.children)n.namespaceUri===chunkEQO762XH_cjs.la&&t.push(ft(n,1));return t.sort(),t}function je(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return chunkEQO762XH_cjs.Zb(e);if(e.kind==="drawing")return chunkEQO762XH_cjs.kc();if(e.kind==="runProperties"||e.kind==="paragraphProperties"||e.kind==="generic")return "";if(e.kind==="hyperlink"||chunkEQO762XH_cjs.Kb(e)){let n="",r=e.kind==="hyperlink"?e.children:chunkEQO762XH_cjs.Mb(e)??[];for(let o of r)n+=je(o);return n}let t="";for(let n of e.children)t+=je(n);return t}function x(e,t){let n=new Map(e);for(let r of t.namespaceBindings)n.set(r.prefix,r.namespaceUri);return n}function U(e,t){try{return chunkEQO762XH_cjs.va(e,t)}catch(n){if(n instanceof chunkEQO762XH_cjs.pa&&n.reason==="undeclared-prefix")return `generic-refusal:undeclared-prefix:{${e.namespaceUri}}${e.localName}`;throw n}}function Ke(e,t,n=chunkEQO762XH_cjs.ua){if(e.kind==="textValue")return;if(e.kind==="runProperties"||e.kind==="paragraphProperties"){let o=x(n,e),s=[];for(let a of e.children)a.namespaceUri!==chunkEQO762XH_cjs.la&&s.push(U(a,o));s.sort(),t.push(...s);return}if(e.kind==="generic"){t.push(U(e,n));return}if(chunkEQO762XH_cjs.Kb(e)){t.push(chunkEQO762XH_cjs.wa(e));return}if(e.kind==="bookmarkStart"||e.kind==="bookmarkEnd"){t.push(chunkEQO762XH_cjs.va(e,n));return}if(e.kind==="drawing"){t.push(yt(e));return}if(chunkEQO762XH_cjs.ka(e.kind))return;let r=x(n,e);for(let o of e.children)Ke(o,t,r);}function en(e){return `hyperlink(${e.attributes.map(n=>`${n.namespaceUri}|${n.localName}=${n.value}`).sort().join(",")})`}function tn(e){for(let t of e.children)if(t.kind==="pictureBlipFill")for(let n of t.children){if(n.kind!=="pictureBlip")continue;let r=n.attributes.find(s=>s.localName==="embed"&&s.namespaceUri===chunkEQO762XH_cjs.oa)?.value,o=n.attributes.find(s=>s.localName==="link"&&s.namespaceUri===chunkEQO762XH_cjs.oa)?.value;if(r!==void 0)return `embed=${r}`;if(o!==void 0)return `link=${o}`}}function ee(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=chunkEQO762XH_cjs.ba)return C(e);let r=x(n,e);if(e.kind==="generic")return U(e,r);let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children)i.kind!=="textValue"&&a.push(ee(i,t+1,r));return a.sort(),a.length>0?`${s}[${a.join(",")}]`:s}function nn(e,t,n){let r=x(n,e),o=[];for(let s of e.children)if(s.kind!=="textValue"){if(s.kind==="pictureBlipFill"){let a=s.children,i=a.find(l=>l.kind==="pictureBlip"),d=a.filter(l=>l.kind!=="pictureBlip").map(l=>ee(l,t+1,r));if(d.sort(),i&&i.kind==="pictureBlip"){let l=I(i),c=l.length>0?`pictureBlip(${l.join(",")})`:"pictureBlip";o.push(d.length>0?`${c}[${d.join(",")}]`:c);}else for(let l of a)o.push(ee(l,t+1,r));continue}o.push(ee(s,t+1,r));}return o.sort(),o}function Ge(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=chunkEQO762XH_cjs.ba)return C(e);let r=x(n,e);if(e.kind==="drawingDocPr"){let i=I(e);return i.length>0?`docPr(${i.join(",")})`:"docPr"}if(e.kind==="picture"){let i=tn(e),d=nn(e,t+1,r),l=i===void 0?"picture":`picture(${i})`;return d.length>0?`${l}[${d.join(",")}]`:l}let o=I(e),s=o.length>0?`${C(e)}(${o.join(",")})`:C(e),a=[];for(let i of e.children){if(i.kind==="picture"){a.push(Ge(i,t+1,r));continue}if(i.kind==="generic"){a.push(U(i,r));continue}i.kind!=="textValue"&&a.push(Ge(i,t+1,r));}return a.length>0?`${s}[${a.join(",")}]`:s}function yt(e){let t=x(chunkEQO762XH_cjs.ua,e),n=e.children.find(i=>i.kind==="inlineDrawing"||i.kind==="anchoredDrawing");if(!n||n.kind==="textValue")return `drawing(${I(e).join(",")})`;let r=x(t,n),o=I(n),s=o.length>0?`${n.kind}(${o.join(",")})`:n.kind,a=[];for(let i of n.children){if(i.kind==="generic"){a.push(U(i,r));continue}i.kind!=="textValue"&&a.push(Ge(i,1,r));}return a.length>0?`drawing[${s};${a.join(";")}]`:`drawing[${s}]`}function rn(e,t,n){let r=e.children.find(c=>c.kind==="paragraphProperties"),o=[],s="",a=[],i=x(chunkEQO762XH_cjs.ua,e),d=(c,p)=>{if(c.kind==="run"){let u=x(p,c),m=c.children.find(f=>f.kind==="runProperties");o.push(mt(m)),s+=je(c);for(let f of c.children)Ke(f,a,u);return}if(c.kind==="drawing"){a.push(yt(c));return}if(c.kind==="hyperlink"){a.push(en(c));let u=x(p,c);for(let m of c.children)d(m,u);return}if(c.kind==="contentControl"){a.push(chunkEQO762XH_cjs.wa({...c,children:c.children.filter(m=>m.kind!=="contentControlContent")}));let u=x(p,c);for(let m of c.children){if(m.kind!=="contentControlContent")continue;let f=x(u,m);for(let y of m.children)d(y,f);}return}Ke(c,a,p);};for(let c of e.children)d(c,i);let l=chunkEQO762XH_cjs.Kc(e);return {ordinal:t,path:n,paraId:l===null?null:l.toUpperCase(),text:s,paragraphProperties:mt(r),runProperties:o,genericStructure:a}}function on(e){if(e.localName==="hdr"||e.localName==="ftr"||e.kind==="body")return e;for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="body"||t.localName==="hdr"||t.localName==="ftr"))return t;return e}function gt(e,t,n,r,o,s){if(s>chunkEQO762XH_cjs.ba)return;let a=0;for(let i of e.children){if(i.kind==="textValue"){i.value.trim()!==""&&o.push(`${t}/#text ${i.value}`);continue}let d=t===""?String(a):`${t}/${a}`;if(a+=1,i.kind==="paragraph"){n.push(i),r.push(d),o.push(`${d} p`);continue}let l=I(i);o.push(l.length>0?`${d} ${C(i)}(${l.join(",")})`:`${d} ${C(i)}`),gt(i,d,n,r,o,s+1);}}function ht(e){let t=on(e.root),n=[],r=[],o=[];gt(t,"",n,r,o,0);let s=n.map((a,i)=>rn(a,i,r[i]));return {partName:e.name,paragraphs:s,structure:o}}function an(e){let t=[];for(let n of e){let r=ht(n);r&&t.push(r);}return {stories:t}}function sn(e,t){let n=[],r=(s,a,i)=>{n.push({path:s,before:JSON.stringify(a)??"undefined",after:JSON.stringify(i)??"undefined"});};e.stories.length!==t.stories.length&&r("stories.length",e.stories.length,t.stories.length);let o=Math.min(e.stories.length,t.stories.length);for(let s=0;s<o;s+=1){let a=e.stories[s],i=t.stories[s],d=p=>`${a.partName}${p}`;a.paragraphs.length!==i.paragraphs.length&&r(d(".paragraphs.length"),a.paragraphs.length,i.paragraphs.length);let l=Math.min(a.paragraphs.length,i.paragraphs.length);for(let p=0;p<l;p+=1){let u=a.paragraphs[p],m=i.paragraphs[p];u.text!==m.text&&r(d(`.p[${p}].text`),u.text,m.text),u.path!==m.path&&r(d(`.p[${p}].path`),u.path,m.path),u.paraId!==m.paraId&&r(d(`.p[${p}].paraId`),u.paraId,m.paraId),JSON.stringify(u.paragraphProperties)!==JSON.stringify(m.paragraphProperties)&&r(d(`.p[${p}].paragraphProperties`),u.paragraphProperties,m.paragraphProperties),JSON.stringify(u.runProperties)!==JSON.stringify(m.runProperties)&&r(d(`.p[${p}].runProperties`),u.runProperties,m.runProperties),JSON.stringify(u.genericStructure)!==JSON.stringify(m.genericStructure)&&r(d(`.p[${p}].genericStructure`),u.genericStructure,m.genericStructure);}a.structure.length!==i.structure.length&&r(d(".structure.length"),a.structure.length,i.structure.length);let c=Math.min(a.structure.length,i.structure.length);for(let p=0;p<c;p+=1)a.structure[p]!==i.structure[p]&&r(d(`.structure[${p}]`),a.structure[p],i.structure[p]);}return n}var V="http://schemas.openxmlformats.org/wordprocessingml/2006/main",dn="http://schemas.openxmlformats.org/package/2006/relationships",xt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",w="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",pn="application/vnd.openxmlformats-package.relationships+xml",un="http://schemas.openxmlformats.org/package/2006/content-types",Nt="/[Content_Types].xml",E="/word/numbering.xml",Ot=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}],Rt=["decimal","lowerLetter","lowerRoman"],ze=9;function It(e,t){let n=720*(t+1),r='<w:start w:val="1"/>';if(e==="bullet"){let a=Ot[t%Ot.length];return `<w:lvl w:ilvl="${t}">${r}<w:numFmt w:val="bullet"/><w:lvlText w:val="${a.text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${n}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${a.font}" w:hAnsi="${a.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=Rt[t%Rt.length],s=o==="lowerRoman";return `<w:lvl w:ilvl="${t}">${r}<w:numFmt w:val="${o}"/><w:lvlText w:val="%${t+1}."/><w:lvlJc w:val="${s?"right":"left"}"/><w:pPr><w:ind w:left="${n}" w:hanging="${s?180:360}"/></w:pPr></w:lvl>`}function mn(e,t){let n=Array.from({length:ze},(r,o)=>It(e,o)).join("");return `<w:abstractNum w:abstractNumId="${t}"><w:multiLevelType w:val="${e==="bullet"?"hybridMultilevel":"multilevel"}"/>${n}</w:abstractNum>`}function fn(){let e=chunkEQO762XH_cjs.Aa(`<w:numbering xmlns:w="${V}"></w:numbering>`,{name:E,contentType:w});return e.ok?e.part:null}var b=(e,t)=>{let n=[];for(let r of e.children)r.kind==="textValue"||r.localName!==t||r.namespaceUri===V&&n.push(r);return n},N=(e,t)=>e.attributes.find(n=>n.localName===t)?.value;function kt(e,t){let n=chunkEQO762XH_cjs.Aa(`<w:numbering xmlns:w="${V}">${e}</w:numbering>`,{name:E,contentType:w});if(!n.ok)return null;let r=[];for(let o of n.part.root.children)o.kind!=="textValue"&&r.push(o);if(r.length!==t.length)return null;for(let o=0;o<t.length;o+=1){let s=r[o],a=t[o];if(s.namespaceUri!==V||s.localName!==a.localName||a.attribute&&N(s,a.attribute.localName)!==a.attribute.value)return null}return r}var Ct=["numPicBullet","abstractNum","num","numIdMacAtCleanup"];function bt(e,t,n){let r=t.indexOf(n);if(r===-1)return e.length;let o=0;return e.forEach((s,a)=>{if(s.kind==="textValue")return;let i=t.indexOf(s.localName);i!==-1&&i<=r&&(o=a+1);}),o}function Et(e,t){let n=0;for(let r of e){let o=N(r,t);!o||!/^\d{1,9}$/.test(o)||(n=Math.max(n,Number(o)));}return n+1}function yn(e,t){let n=e.parts.get(E),r=n??fn();if(!r)return null;let o=r.root,s=b(o,"abstractNum"),a=b(o,"num"),i=t==="bullet"?"bullet":"decimal";for(let O of a){let $=N(O,"numId"),Ye=b(O,"abstractNumId")[0],Je=Ye?N(Ye,"val"):void 0;if(!$||!Je)continue;let qe=s.find(X=>N(X,"abstractNumId")===Je);if(!qe)continue;let Qe=b(qe,"lvl").find(X=>N(X,"ilvl")==="0"||N(X,"ilvl")===void 0),Ze=Qe?b(Qe,"numFmt")[0]:void 0;if(Ze&&N(Ze,"val")===i)return {pkg:e,numId:$}}let d=Et(s,"abstractNumId"),l=Et(a,"numId"),c=kt(mn(t,d)+`<w:num w:numId="${l}"><w:abstractNumId w:val="${d}"/></w:num>`,[{localName:"abstractNum",attribute:{localName:"abstractNumId",value:String(d)}},{localName:"num",attribute:{localName:"numId",value:String(l)}}]);if(!c)return null;let p=chunkEQO762XH_cjs.Ca(r),[u,m]=c.map(O=>te(O,p));if(!u||!m)return null;let f=chunkEQO762XH_cjs.Ha(r,o.id,bt(o.children,Ct,"abstractNum"),[u]);if(!f.ok)return null;let y=chunkEQO762XH_cjs.Ha(f.part,o.id,bt(f.part.root.children,Ct,"num"),[m]);if(!y.ok)return null;let g=Object.freeze({...e,parts:new Map([...e.parts,[E,y.part]])});if(!n){let O=Nn(g);if(!O)return null;let $=bn(O);if(!$)return null;g=$;}return {pkg:g,numId:String(l)}}var gn=["nsid","multiLevelType","tmpl","name","styleLink","numStyleLink","lvl"];function St(e){let t=N(e,"ilvl");return t===void 0||!/^\d{1,9}$/.test(t)?null:Number(t)}function hn(e,t){let n=0;return e.forEach((r,o)=>{if(r.kind!=="textValue"){if(r.localName==="lvl"&&r.namespaceUri===V){(St(r)??0)<t&&(n=o+1);return}gn.includes(r.localName)&&(n=o+1);}}),n}function xn(e,t,n,r){if(!Number.isInteger(n)||n<0||n>=ze||t.length===0||t.length>64)return null;let o=e.parts.get(E);if(!o)return null;let s=o.root,a=b(s,"num").find(f=>N(f,"numId")===t),i=a?b(a,"abstractNumId")[0]:void 0,d=i?N(i,"val"):void 0;if(!d)return null;let l=b(s,"abstractNum").find(f=>N(f,"abstractNumId")===d);if(!l||b(l,"numStyleLink").length>0)return null;let c=b(l,"lvl");if(c.some(f=>St(f)===n))return e;if(c.length>=ze)return null;let p=kt(It(r,n),[{localName:"lvl",attribute:{localName:"ilvl",value:String(n)}}]);if(!p)return null;let u=chunkEQO762XH_cjs.Ca(o),m=chunkEQO762XH_cjs.Ha(o,l.id,hn(l.children,n),[te(p[0],u)]);return m.ok?Object.freeze({...e,parts:new Map([...e.parts,[E,m.part]])}):null}function te(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>te(n,t))}}function Nn(e){let t=e.mainDocumentPart,n=On(t),r=e.parts.get(n),o=Rn(e),s=chunkEQO762XH_cjs.Aa(`<Relationships xmlns="${dn}"><Relationship Id="${o}" Type="${xt}" Target="numbering.xml"/></Relationships>`,{name:n,contentType:pn});if(!s.ok)return null;let a=e.relationships.get(t)??[],i={ownerPart:t,id:o,type:xt,rawTarget:"numbering.xml",targetMode:"Internal",order:a.reduce((u,m)=>Math.max(u,m.order),-1)+1},d=new Map([...e.relationships,[t,[...a,i]]]);if(!r)return Object.freeze({...e,parts:new Map([...e.parts,[n,s.part]]),relationships:d});let l=chunkEQO762XH_cjs.Ca(r),c=s.part.root.children[0];if(!c)return null;let p=chunkEQO762XH_cjs.Ha(r,r.root.id,r.root.children.length,[te(c,l)]);return p.ok?Object.freeze({...e,parts:new Map([...e.parts,[n,p.part]]),relationships:d}):null}function On(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function Rn(e){let t=0;for(let n of e.relationships.values())for(let r of n){let o=/^rId(\d{1,9})$/.exec(r.id);o&&(t=Math.max(t,Number(o[1])));}for(let n of e.externalTargets){let r=/^rId(\d{1,9})$/.exec(n.id);r&&(t=Math.max(t,Number(r[1])));}return `rId${t+1}`}var Cn=`<Override PartName="${E}" ContentType="${w}"/>`;function bn(e){let t=e.contentTypes.overrides.get(chunkEQO762XH_cjs.o(E));if(t===w)return e;if(t!==void 0)return null;let n=e.partBytes.get(Nt);if(!n)return null;let r=fflate.strFromU8(n),o=Pt(r);if(!o)return null;let s=r.lastIndexOf(`</${o.rootName}>`);if(s===-1)return null;let a=r.slice(0,s)+Cn+r.slice(s),i=Pt(a);if(!i||i.rootName!==o.rootName)return null;let d=[...o.children,vt("Override",{PartName:E,ContentType:w})];return i.children.length!==d.length||i.children.some((l,c)=>l!==d[c])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[Nt,fflate.strToU8(a)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[chunkEQO762XH_cjs.o(E),w]])})})}function Pt(e){let t=chunkEQO762XH_cjs.ca(e);if(!t.ok)return null;let n=t.nodes.filter(i=>i.type==="element");if(n.length!==1)return null;let r=n[0],o=r.name.indexOf(":"),s=o===-1?"":r.name.slice(0,o);if(r.name.slice(o+1)!=="Types"||r.attributes[s?`xmlns:${s}`:"xmlns"]!==un)return null;let a=[];for(let i of r.children)i.type==="element"&&a.push(vt(i.name,i.attributes));return {rootName:r.name,children:a}}function vt(e,t){let n=Object.entries(t).map(([r,o])=>`${r}=${o}`).sort();return [e,...n].join("")}function ne(e){return e!=null&&e.kind!=="textValue"}function We(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===chunkEQO762XH_cjs.la&&n.localName===t)return n;return null}function re(e,t){for(let n of e.attributes)if(n.namespaceUri===chunkEQO762XH_cjs.la&&n.localName===t)return n.value}function _(e,t){let n=We(e,t);if(!n)return false;let r=re(n,"val");return r===void 0?true:r!=="0"&&r!=="false"&&r!=="off"}var Tt=Object.freeze({trackRevisions:false,restrictedToTrackedChanges:false,doNotTrackMoves:false,doNotTrackFormatting:false});function En(e){if(!ne(e))return Tt;let t=We(e,"documentProtection"),n=t===null?void 0:re(t,"enforcement"),r=n!==void 0&&n!=="0"&&n!=="false"&&n!=="off";return {trackRevisions:_(e,"trackRevisions"),restrictedToTrackedChanges:r&&t!==null&&re(t,"edit")==="trackedChanges",doNotTrackMoves:_(e,"doNotTrackMoves"),doNotTrackFormatting:_(e,"doNotTrackFormatting")}}var wt=Object.freeze({doNotShadeFormData:false});function Pn(e){return ne(e)?{doNotShadeFormData:_(e,"doNotShadeFormData")}:wt}function In(e,t){let n=e.parts.get(t.storyPartName);if(!n)return {ok:false,reason:`no story part named ${t.storyPartName}`};let r=[];for(let d of chunkEQO762XH_cjs.pe(n.root)){let l=chunkEQO762XH_cjs.ne(d.node).tag;if(l===void 0||l.length===0)continue;let c=t.decide(l);c!=="keep"&&r.push({nodeId:d.node.id,policy:c});}let o=n,s=0,a=0;for(let{nodeId:d,policy:l}of r){let c=chunkEQO762XH_cjs.Fa(o,d);if(!c)continue;if(l==="remove"){let g=chunkEQO762XH_cjs.Ja(o,d,{deferValidation:true});if(!g.ok)return {ok:false,reason:`a node could not be removed: ${_t(g)}`};o=g.part,a+=1;continue}let p=c.children.find(g=>g.id===d);if(!p)continue;let u=chunkEQO762XH_cjs.le(p),m=u?u.children:[],f=c.children.flatMap(g=>g.id===d?m:[g]),y=chunkEQO762XH_cjs.Ga(o,c.id,f,{deferValidation:true});if(!y.ok)return {ok:false,reason:`a node could not be unwrapped: ${_t(y)}`};o=y.part,s+=1;}let i=o===n?e:chunkEQO762XH_cjs.zb(e,o);if(!i.parts.has(t.storyPartName))return {ok:false,reason:"the story went missing during the export"};for(let d of t.namespaces)for(let l of Sn(i,t.storyPartName,d)){let c=chunkEQO762XH_cjs.df(i,l.itemId),p=chunkEQO762XH_cjs.Ze(i,l.partName,c);if(p.pkg===i&&p.removed.length===0&&!kn(i,l.partName,c))return {ok:false,reason:`the payloads in ${d} could not be removed`};if(i=p.pkg,c.size>0)continue;let u=vn(i,l);if(!u.ok)return {ok:false,reason:`the payload store for ${d} could not be removed`};i=u.pkg;}return {ok:true,pkg:i,unwrapped:s,removed:a}}function kn(e,t,n){return chunkEQO762XH_cjs.Ve(e,t).every(r=>n.has(r.id))}function _t(e){return e.issues.map(t=>t.code).join(", ")||"the edit was refused"}function Sn(e,t,n){return chunkEQO762XH_cjs.Re(e,t).filter(r=>r.namespaceUri===n)}function vn(e,t){let n=chunkEQO762XH_cjs.Fb(e,t.partName);if(!n.ok)return {pkg:e,ok:false};let r=chunkEQO762XH_cjs.Fb(n.pkg,t.propsPartName);return r.ok?{pkg:r.pkg,ok:true}:{pkg:e,ok:false}}
|
|
2
|
-
exports.A=He;exports.B=Ue;exports.C=Ve;exports.D=zt;exports.E=lt;exports.F=pt;exports.G=qt;exports.H=Zt;exports.I=ht;exports.J=an;exports.K=sn;exports.L=yn;exports.M=xn;exports.N=Tt;exports.O=En;exports.P=wt;exports.Q=Pn;exports.R=In;exports.a=$t;exports.b=nt;exports.c=Y;exports.d=k;exports.e=J;exports.f=q;exports.g=h;exports.h=Lt;exports.i=S;exports.j=M;exports.k=Q;exports.l=B;exports.m=Z;exports.n=$e;exports.o=Ae;exports.p=De;exports.q=Ut;exports.r=Vt;exports.s=Le;exports.t=ot;exports.u=Xt;exports.v=Fe;exports.w=jt;exports.x=H;exports.y=Me;exports.z=Be;
|