@reviseio/engine 3.0.1 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/assets/{historyMaterializeWorker-Kl0syEbc.js → historyMaterializeWorker-BMHTnStL.js} +131 -130
  3. package/chunks/{AgentHtmlConverter-CnnB8-WI.js → AgentHtmlConverter-B5qstcmM.js} +129 -128
  4. package/chunks/{AgentPageRenderer-DLgUGrGy.js → AgentPageRenderer-JMhCw-hi.js} +4 -4
  5. package/chunks/BlockDiff-C8eiZ-sf.js +45 -0
  6. package/chunks/{CanvasRenderer-C1Vegx9Y.js → CanvasRenderer-C2vAzLWM.js} +12 -12
  7. package/chunks/DocumentCompare-DX4RWeSV.js +10 -0
  8. package/chunks/{DocumentLayoutEngine-C62pyGVf.js → DocumentLayoutEngine-BhcWXkeu.js} +45 -45
  9. package/chunks/{DocumentMutator-Bat_oLBQ.js → DocumentMutator-FEFU1YM0.js} +6 -6
  10. package/chunks/DocumentOutline-BOZoTohH.js +4 -0
  11. package/chunks/{DocumentScrubber-BZQn_z92.js → DocumentScrubber-C4N3Qagm.js} +1 -1
  12. package/chunks/{DocumentSession-BDcazSEv.js → DocumentSession-gZHWP7By.js} +1 -1
  13. package/chunks/{DocxConverter-BC31uYIL.js → DocxConverter-BOyLn5eZ.js} +709 -703
  14. package/chunks/{DocxGraft-L10HXM3U.js → DocxGraft-BbE-AaM5.js} +2 -2
  15. package/chunks/{HtmlConverter-C5ihhZ6G.js → HtmlConverter-BlzwsPEn.js} +3 -3
  16. package/chunks/MarkdownConverter-BHVskVXI.js +59 -0
  17. package/chunks/{OdtConverter-c1fTWoAt.js → OdtConverter-BdmBFOD1.js} +1 -1
  18. package/chunks/{OfficeImportShared-CrOpHpJ-.js → OfficeImportShared-B2XJgnDO.js} +4 -4
  19. package/chunks/{PdfConverter-DX7fsRH5.js → PdfConverter-DZMCHDAo.js} +6 -6
  20. package/chunks/{RtfConverter-hbJ2529G.js → RtfConverter-RqE-xZcW.js} +2 -2
  21. package/chunks/{TableBorders-DVhdvo6f.js → TableBorders-ARyTi49V.js} +1 -1
  22. package/chunks/{TxtConverter-YHv5FXWb.js → TxtConverter-EPQtb6A6.js} +1 -1
  23. package/chunks/{Typography-B4gndEdB.js → Typography-XR6scRNV.js} +9 -9
  24. package/chunks/{XmlConverter-BRRluy9k.js → XmlConverter-9sFRFaza.js} +1 -1
  25. package/chunks/{capture-i_dPkQIS.js → capture-DhGn0CWA.js} +1 -1
  26. package/chunks/{carrier-pYM9xf6x.js → carrier-D58g-gw4.js} +1 -1
  27. package/chunks/{chromeImageLayout-BiQ3Iz1-.js → chromeImageLayout-DeYYS8YP.js} +1 -1
  28. package/chunks/{engine-LMUnxdm2.js → engine-C5fxuZJo.js} +139 -139
  29. package/chunks/{footnoteFlatten-EE85Hjre.js → footnoteFlatten-coCVFd3c.js} +1 -1
  30. package/chunks/{graftExport-G-dG7Vcc.js → graftExport-FBGE2qvt.js} +1 -1
  31. package/chunks/{index-BLb10wQt.js → index-Cezk1s_y.js} +4 -4
  32. package/chunks/{serverDocumentSession-DGDU5Lh3.js → serverDocumentSession-LMu3kocH.js} +559 -560
  33. package/chunks/{signatures-DTNDS2PH.js → signatures-DsJnnIqV.js} +1 -1
  34. package/chunks/textExtraction-Bqaqt1Kg.js +2 -0
  35. package/engine.js +2 -2
  36. package/package.json +2 -2
  37. package/chunks/BlockDiff-B6-aJxHo.js +0 -42
  38. package/chunks/DocumentCompare-C8295s35.js +0 -6
  39. package/chunks/MarkdownConverter-DofaSeC4.js +0 -57
@@ -4,25 +4,25 @@ Word (DOCX)",extensions:[".docx"],mimeType:"application/vnd.openxmlformats-offic
4
4
  application/pdf",binary:!0,import:!1,export:!0},{id:"rtf",label:"Rich Text Format (RTF)",extensions:[".rtf"],mimeType:"application/rtf",binary:!1,import:!0,export:!1},{id:"xml",label:"XML",extensions:[
5
5
  ".xml"],mimeType:"application/xml",binary:!1,import:!0,export:!1},{id:"odt",label:"OpenDocument Text (ODT)",extensions:[".odt"],mimeType:"application/vnd.oasis.opendocument.text",binary:!0,import:!0,export:!1}];
6
6
  function cn(e){return sn.find(t=>t.extensions.some(n=>e.toLowerCase().endsWith(n)))}async function ln(e,t,n,r){const i={name:t||`document.${n}`,arrayBuffer:async()=>new Uint8Array(e).buffer},a=async()=>(await import("./TextFileDecoder-BZBBejlR.js")).
7
- decodeTextBytes(e,{kind:n==="html"?"html":"plain",mimeType:r});switch(n){case"xml":return(await import("./XmlConverter-BRRluy9k.js")).XmlConverter.fromBytes(e);case"markdown":return(await import("./MarkdownConverter-DofaSeC4.js")).
8
- MarkdownConverter.fromMarkdown(await a());case"txt":return(await import("./TxtConverter-YHv5FXWb.js")).TxtConverter.fromText(await a());case"html":{const o=await a(),{htmlHasMathMl:s,loadMathMlToLatex:c}=await import("./MathRenderer-Bz9WEVvF.js").
9
- then(d=>d.f);s(o)&&await c();const{cssNeedsFullColorParser:l,loadFullColorParser:u}=await Promise.resolve().then(()=>Li);return l(o)&&await u(),(await import("./HtmlConverter-C5ihhZ6G.js")).HtmlConverter.
10
- fromHtml(o)}case"docx":{const o=await(await import("./DocxConverter-BC31uYIL.js")).DocxConverter.parseFile(i,{retainSource:!0}),s=new Uint8Array(e);return o.pendingDocxCarrier={bytes:s,hash:await(await import("./DocxGraft-L10HXM3U.js")).
11
- hashBytes(s)},o}case"rtf":return(await import("./RtfConverter-hbJ2529G.js")).RtfConverter.parseFile(i);case"odt":return(await import("./OdtConverter-c1fTWoAt.js")).OdtConverter.parseFile(i);default:throw new Error(
12
- "This format does not support headless import: "+n)}}async function at(e,t,n={}){switch(t){case"markdown":return(await import("./MarkdownConverter-DofaSeC4.js")).MarkdownConverter.toMarkdown(e);case"t\
13
- xt":return(await import("./TxtConverter-YHv5FXWb.js")).TxtConverter.toText(e,n.text);case"html":return(await import("./HtmlConverter-C5ihhZ6G.js")).HtmlConverter.toStyledHtml(e,n.html);case"docx":return(await import("./DocxConverter-BC31uYIL.js")).
14
- DocxConverter.toBlob(e,n.syntaxTheme,n.docx);case"pdf":return(await import("./PdfConverter-DX7fsRH5.js")).PdfConverter.toBlob(e,n.title,n.syntaxTheme);default:throw new Error("This format is import-on\
7
+ decodeTextBytes(e,{kind:n==="html"?"html":"plain",mimeType:r});switch(n){case"xml":return(await import("./XmlConverter-9sFRFaza.js")).XmlConverter.fromBytes(e);case"markdown":return(await import("./MarkdownConverter-BHVskVXI.js")).
8
+ MarkdownConverter.fromMarkdown(await a());case"txt":return(await import("./TxtConverter-EPQtb6A6.js")).TxtConverter.fromText(await a());case"html":{const o=await a(),{htmlHasMathMl:s,loadMathMlToLatex:c}=await import("./MathRenderer-Bz9WEVvF.js").
9
+ then(d=>d.f);s(o)&&await c();const{cssNeedsFullColorParser:l,loadFullColorParser:u}=await Promise.resolve().then(()=>Li);return l(o)&&await u(),(await import("./HtmlConverter-BlzwsPEn.js")).HtmlConverter.
10
+ fromHtml(o)}case"docx":{const o=await(await import("./DocxConverter-BOyLn5eZ.js")).DocxConverter.parseFile(i,{retainSource:!0}),s=new Uint8Array(e);return o.pendingDocxCarrier={bytes:s,hash:await(await import("./DocxGraft-BbE-AaM5.js")).
11
+ hashBytes(s)},o}case"rtf":return(await import("./RtfConverter-RqE-xZcW.js")).RtfConverter.parseFile(i);case"odt":return(await import("./OdtConverter-BdmBFOD1.js")).OdtConverter.parseFile(i);default:throw new Error(
12
+ "This format does not support headless import: "+n)}}async function at(e,t,n={}){switch(t){case"markdown":return(await import("./MarkdownConverter-BHVskVXI.js")).MarkdownConverter.toMarkdown(e);case"t\
13
+ xt":return(await import("./TxtConverter-EPQtb6A6.js")).TxtConverter.toText(e,n.text);case"html":return(await import("./HtmlConverter-BlzwsPEn.js")).HtmlConverter.toStyledHtml(e,n.html);case"docx":return(await import("./DocxConverter-BOyLn5eZ.js")).
14
+ DocxConverter.toBlob(e,n.syntaxTheme,n.docx);case"pdf":return(await import("./PdfConverter-DZMCHDAo.js")).PdfConverter.toBlob(e,n.title,n.syntaxTheme);default:throw new Error("This format is import-on\
15
15
  ly: "+t)}}const qr=Object.freeze(Object.defineProperty({__proto__:null,DOCUMENT_FORMATS:sn,detectDocumentFormat:cn,parseDocumentFormat:ln,serializeDocumentFormat:at},Symbol.toStringTag,{value:"Module"})),
16
16
  Vr="chromeImageBands",st="chromeImages",Te="__legacyMirrorHash",un=[["header","default"],["header","first"],["header","even"],["footer","default"],["footer","first"],["footer","even"]],Re=(e,t)=>`${e}\
17
- :${t}`,Y=e=>e.getMap(Vr),se=e=>e.getMap("metadata").get(st);function ct(e){if(e===void 0)return"none";const t=JSON.stringify(e)??"";let n=2166136261;for(let r=0;r<t.length;r++)n=Math.imul(n^t.charCodeAt(
18
- r),16777619);return(n>>>0).toString(36)}function dn(e){const t=Y(e).get(Te);return typeof t=="string"&&t!==ct(se(e))}function Oe(e){const t=se(e);return Array.isArray(t)?t:[]}const fn=new WeakMap,lt=new WeakMap;
17
+ :${t}`,Y=e=>e.getMap(Vr),ce=e=>e.getMap("metadata").get(st);function ct(e){if(e===void 0)return"none";const t=JSON.stringify(e)??"";let n=2166136261;for(let r=0;r<t.length;r++)n=Math.imul(n^t.charCodeAt(
18
+ r),16777619);return(n>>>0).toString(36)}function dn(e){const t=Y(e).get(Te);return typeof t=="string"&&t!==ct(ce(e))}function Oe(e){const t=ce(e);return Array.isArray(t)?t:[]}const fn=new WeakMap,lt=new WeakMap;
19
19
  function Jr(e){let t=fn.get(e);if(!t){const n={version:0};Y(e).observe(()=>{n.version++}),fn.set(e,n),t=n}return t.version}function Le(e){lt.delete(e)}function gn(e){if(dn(e))return Oe(e);const t=Y(e),
20
- n=Oe(e).filter(i=>!t.has(Re(i.side,i.slot))),r=un.flatMap(([i,a])=>{const o=t.get(Re(i,a));return Array.isArray(o)?o:[]});return[...n,...r]}function ut(e){const t=se(e),n=Jr(e),r=lt.get(e);if(r&&r.legacy===
20
+ n=Oe(e).filter(i=>!t.has(Re(i.side,i.slot))),r=un.flatMap(([i,a])=>{const o=t.get(Re(i,a));return Array.isArray(o)?o:[]});return[...n,...r]}function ut(e){const t=ce(e),n=Jr(e),r=lt.get(e);if(r&&r.legacy===
21
21
  t&&r.version===n)return r.records;const i=gn(e),a=i.length>0?i:void 0;return lt.set(e,{legacy:t,version:n,records:a}),a}function Yr(e,t,n){return(ut(e)??[]).filter(r=>r.side===t&&r.slot===n)}function Kr(e,t,n,r){
22
22
  Le(e),Zr(e);const i=Re(t,n),a=Y(e);r.length>0?a.set(i,r):Oe(e).some(o=>o.side===t&&o.slot===n)?a.set(i,[]):a.has(i)&&a.delete(i),mn(e)}function Zr(e){dn(e)&&pn(e,Oe(e))}function pn(e,t){const n=Y(e);for(const[
23
- r,i]of un){const a=Re(r,i),o=t.filter(s=>s.side===r&&s.slot===i);o.length>0?n.set(a,o):n.has(a)&&n.delete(a)}n.set(Te,ct(se(e)))}function mn(e){Le(e);const t=gn(e);e.getMap("metadata").set(st,t.map(n=>({
24
- ...n}))),Y(e).set(Te,ct(se(e))),Le(e)}function hn(e,t){Le(e);const n=Y(e);for(const r of Array.from(n.keys()))r!==Te&&n.delete(r);e.getMap("metadata").set(st,[]),pn(e,t??[]),mn(e)}const ce=["lineSpaci\
25
- ng","spaceBefore","spaceAfter"];function Qr(e,t){for(const n of ce)t[n]!==void 0?e.setAttribute(n,String(t[n])):e.doc&&e.removeAttribute(n)}const bn=128,eo=1<<29,E=(e,t)=>e>>>t|e<<32-t,to=e=>E(e,2)^E(
23
+ r,i]of un){const a=Re(r,i),o=t.filter(s=>s.side===r&&s.slot===i);o.length>0?n.set(a,o):n.has(a)&&n.delete(a)}n.set(Te,ct(ce(e)))}function mn(e){Le(e);const t=gn(e);e.getMap("metadata").set(st,t.map(n=>({
24
+ ...n}))),Y(e).set(Te,ct(ce(e))),Le(e)}function hn(e,t){Le(e);const n=Y(e);for(const r of Array.from(n.keys()))r!==Te&&n.delete(r);e.getMap("metadata").set(st,[]),pn(e,t??[]),mn(e)}const le=["lineSpaci\
25
+ ng","spaceBefore","spaceAfter"];function Qr(e,t){for(const n of le)t[n]!==void 0?e.setAttribute(n,String(t[n])):e.doc&&e.removeAttribute(n)}const bn=128,eo=1<<29,E=(e,t)=>e>>>t|e<<32-t,to=e=>E(e,2)^E(
26
26
  e,13)^E(e,22),no=e=>E(e,6)^E(e,11)^E(e,25),ro=e=>E(e,7)^E(e,18)^e>>>3,oo=e=>E(e,17)^E(e,19)^e>>>10,io=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,
27
27
  3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,
28
28
  3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,
@@ -35,29 +35,29 @@ const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<t.length;i++)for(let o=3;o>
35
35
  _W[15]=t.byteLength*8,this._updateHash();const a=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let s=0;s<4;s++)a[o*4+s]=this._H[o]>>>(3-s)*8;return a}}const co=e=>new so().digest(e),Ee="revi\
36
36
  se:styles:v1",yn="sharedStylesVersion",lo=Symbol.for("revise.shared-styles.migration"),B="_reviseTextStyle",je="_reviseParagraphStyle",uo=Object.freeze({_reviseStyleUnset:1}),X=new Set(["fontFamily","\
37
37
  fontSize","bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","superscript","subscript","hidden","color","backgroundColor","letterSpacing","lang","code","docxRunPro\
38
- pertyResets","oxmlRPr"]),le=new Set(["align","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","direction","tabStops","borders","shading","leftIndent","firstLineIndent","pagination"]);class K extends Error{constructor(){
38
+ pertyResets","oxmlRPr"]),ue=new Set(["align","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","direction","tabStops","borders","shading","leftIndent","firstLineIndent","pagination"]);class K extends Error{constructor(){
39
39
  super(...arguments),this.name="SharedStyleError"}}function dt(e){return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).sort(([t],[n])=>t<n?-1:t>n?1:0)))}function xn(e,t){return`${e}\
40
40
  :${Array.from(co(new TextEncoder().encode(t)).subarray(0,16),n=>n.toString(16).padStart(2,"0")).join("")}`}function z(e){return!!e?.share.has("metadata")&&e.getMap("metadata").get(yn)===1}function ft(e,t,n){
41
41
  const r=dt(n),i=xn(t,r),a=e.getMap(Ee),o=a.get(i);if(o!==void 0&&o!==r)throw new K("Shared style identity collision or modified definition");return o===void 0&&a.set(i,r),i}const Sn=new WeakMap;function gt(e,t,n){
42
42
  if(t==null)return{};if(!e||typeof t!="string"||!t.startsWith(`${n}:`))throw new K("Invalid shared style reference");const r=e.getMap(Ee).get(t);if(typeof r!="string")throw new K("Missing shared style \
43
43
  definition; resync the document");let i=Sn.get(e);i||Sn.set(e,i=new Map);const a=i.get(t);if(a?.json===r)return a.marks;if(xn(n,r)!==t)throw new K("Modified shared style definition");const o=JSON.parse(
44
- r),s=n==="t"?X:le;if(!o||typeof o!="object"||Array.isArray(o)||Object.entries(o).some(([c,l])=>!s.has(c)||!["string","number","boolean"].includes(typeof l)))throw new K("Invalid shared style propertie\
44
+ r),s=n==="t"?X:ue;if(!o||typeof o!="object"||Array.isArray(o)||Object.entries(o).some(([c,l])=>!s.has(c)||!["string","number","boolean"].includes(typeof l)))throw new K("Invalid shared style propertie\
45
45
  s");return Object.freeze(o),i.size>=4096&&i.clear(),i.set(t,{json:r,marks:o}),o}function fo(e,t={}){const n={...gt(e.doc,t[B],"t"),...t};delete n[B];for(const[r,i]of Object.entries(t))X.has(r)&&i!==null&&
46
- typeof i=="object"&&i._reviseStyleUnset===1&&Object.keys(i).length===1&&delete n[r];return n}function ue(e){if(!z(e.doc))return e.toDelta();const t=[];for(const n of e.toDelta()){const r=fo(e,n.attributes),
46
+ typeof i=="object"&&i._reviseStyleUnset===1&&Object.keys(i).length===1&&delete n[r];return n}function de(e){if(!z(e.doc))return e.toDelta();const t=[];for(const n of e.toDelta()){const r=fo(e,n.attributes),
47
47
  i={...n};Object.keys(r).length?i.attributes=r:delete i.attributes;const a=t[t.length-1];a&&typeof a.insert=="string"&&typeof i.insert=="string"&&dt(a.attributes??{})===dt(i.attributes??{})?a.insert+=i.
48
48
  insert:t.push(i)}return t}function wn(e,t,n,r){if(B in r)throw new K("Existing style bases are immutable");if(!e.doc||!z(e.doc)||!Object.keys(r).some(i=>X.has(i))){e.format(t,n,r);return}e.doc.transact(
49
49
  ()=>{let i=t;for(const a of kn(e,t,n,r))e.format(i,a.retain,a.attributes),i+=a.retain})}function kn(e,t,n,r){if(!Object.entries(r).some(([o,s])=>X.has(o)&&s===null))return[{retain:n,attributes:r}];const i=[];
50
50
  let a=0;for(const o of e.toDelta()){const s=a+(typeof o.insert=="string"?o.insert.length:1),c=Math.min(s,t+n)-Math.max(a,t);if(c>0){const l=gt(e.doc,o.attributes?.[B],"t");i.push({retain:c,attributes:Object.
51
51
  fromEntries(Object.entries(r).map(([u,d])=>[u,X.has(u)&&d===null&&u in l?uo:d]))})}if(a=s,a>=t+n)break}return i}function Be(e,t){const n=Object.fromEntries(Object.entries(t).filter(([i,a])=>X.has(i)&&
52
- a!==null&&a!==void 0));if(Object.keys(n).length<2)return{...t};const r=Object.fromEntries(Object.entries(t).filter(([i])=>!X.has(i)));return r[B]=ft(e,"t",n),r}function de(e,t,n,r){if(!r||!e.doc||!z(e.
52
+ a!==null&&a!==void 0));if(Object.keys(n).length<2)return{...t};const r=Object.fromEntries(Object.entries(t).filter(([i])=>!X.has(i)));return r[B]=ft(e,"t",n),r}function fe(e,t,n,r){if(!r||!e.doc||!z(e.
53
53
  doc)){e.insert(t,n,r);return}e.doc.transact(()=>e.insert(t,n,Be(e.doc,r)))}function go(e,t,n){if(!e.doc||!z(e.doc)){e.applyDelta(t,n);return}e.doc.transact(()=>{let r=0;const i=t.flatMap(a=>{const o=r;
54
54
  return a.retain!==void 0?r+=a.retain:a.delete!==void 0&&(r+=a.delete),a.attributes?a.insert!==void 0?[{...a,attributes:Be(e.doc,a.attributes)}]:a.retain!==void 0?kn(e,o,a.retain,a.attributes):[a]:[a]});
55
- e.applyDelta(i,n)})}function Z(e,t){const n=e.getAttribute(t);return n!=null||!le.has(t)||!e.doc?n:gt(e.doc,e.getAttribute(je),"p")[t]}function pt(e,t){e.doc&&z(e.doc)&&le.has(t)?e.setAttribute(t,""):
56
- e.removeAttribute(t)}function po(e,t){const n=Object.fromEntries(Object.entries(t).filter(([r,i])=>le.has(r)&&i!==""));return Object.keys(n).length<2?t:{...Object.fromEntries(Object.entries(t).filter(
55
+ e.applyDelta(i,n)})}function Z(e,t){const n=e.getAttribute(t);return n!=null||!ue.has(t)||!e.doc?n:gt(e.doc,e.getAttribute(je),"p")[t]}function pt(e,t){e.doc&&z(e.doc)&&ue.has(t)?e.setAttribute(t,""):
56
+ e.removeAttribute(t)}function po(e,t){const n=Object.fromEntries(Object.entries(t).filter(([r,i])=>ue.has(r)&&i!==""));return Object.keys(n).length<2?t:{...Object.fromEntries(Object.entries(t).filter(
57
57
  ([r])=>!(r in n))),[je]:ft(e,"p",n)}}function mo(e,t){if(!t.exclusive)throw new K("Shared style migration requires exclusive access");let n=0,r=0;const i=e.getMap(Ee).size;return e.transact(()=>{z(e)||
58
58
  e.getMap("metadata").set(yn,1);const a=o=>{if(o?.constructor?.name==="YXmlText"||o?.constructor?.name==="YText"){let s=0;for(const c of o.toDelta()){const l=typeof c.insert=="string"?c.insert.length:1,
59
59
  u=c.attributes??{};if(!u[B]){const d=Be(e,u);if(d[B]){const g={[B]:d[B]};for(const p of Object.keys(u))X.has(p)&&(g[p]=null);o.format(s,l,g),n++}}s+=l}}else if(typeof o?.toArray=="function"){if(o.nodeName===
60
- "paragraph"&&!o.getAttribute(je)){const s={};for(const c of le){const l=o.getAttribute(c);typeof l=="string"&&l!==""&&(s[c]=l)}if(Object.keys(s).length>=2){o.setAttribute(je,ft(e,"p",s));for(const c of Object.
60
+ "paragraph"&&!o.getAttribute(je)){const s={};for(const c of ue){const l=o.getAttribute(c);typeof l=="string"&&l!==""&&(s[c]=l)}if(Object.keys(s).length>=2){o.setAttribute(je,ft(e,"p",s));for(const c of Object.
61
61
  keys(s))o.removeAttribute(c);r++}}for(const s of o.toArray())a(s)}};for(const o of["content","chrome","notes"])e.share.has(o)&&a(e.getXmlFragment(o))},lo),{textSpans:n,paragraphs:r,definitions:e.getMap(
62
62
  Ee).size-i}}const ho=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function vn(e){if(!Number.isFinite(e)||e<1)return"";let t=Math.
63
63
  floor(e),n="";for(const[r,i]of ho)for(;t>=r;)n+=i,t-=r;return n}function bo(e){if(!/^[mdclxvi]+$/.test(e))return null;const t={m:1e3,d:500,c:100,l:50,x:10,v:5,i:1};let n=0;for(let r=0;r<e.length;r++){
@@ -74,14 +74,14 @@ noteRef","footnotePendingBody","footnotePendingKind","sdtInline"],wo=[...Nn,"aiG
74
74
  or","link","footnotePendingBody"],vo=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","letterSpacing","code","superscript","subscript","fontSize","color","backg\
75
75
  roundColor","fontFamily","oxmlRPr"];function Po(e){if(!e)return;const t={};for(const n of vo)n in e&&e[n]!==void 0&&e[n]!==!1&&(t[n]=e[n]);return e.footnoteRef&&delete t.superscript,Object.keys(t).length>
76
76
  0?t:void 0}const Ao=["align","heading","leftIndent","firstLineIndent","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","keepNext","keepLines","widowControl","styleId","direction","borders",
77
- "shading","tabStops"];function No(e,t){return Ao.every(n=>e[n]===t[n])}const fe={style:"single",width:1,color:"#A6A6A6"};function In(e={}){return JSON.stringify({bottom:{...fe,...e}})}const Io={thin:{},
77
+ "shading","tabStops"];function No(e,t){return Ao.every(n=>e[n]===t[n])}const ge={style:"single",width:1,color:"#A6A6A6"};function In(e={}){return JSON.stringify({bottom:{...ge,...e}})}const Io={thin:{},
78
78
  thick:{width:3},double:{style:"double"},dashed:{style:"dashed"},dotted:{style:"dotted",width:2},stars:{style:"stars"},diamonds:{style:"diamonds"}},Mo=[{pattern:/^-\*\*-$/,style:"stars",contexts:["typi\
79
79
  ng","markdown"]},{pattern:/^-<>-$/,style:"diamonds",contexts:["typing","markdown"]},{pattern:/^-{3,}$/,style:"thin",contexts:["typing"]},{pattern:/^_{3,}$/,style:"thick",contexts:["typing"]},{pattern:/^={3,}$/,
80
80
  style:"double",contexts:["typing"]},{pattern:/^\*{3,}$/,style:"dotted",contexts:["typing"]},{pattern:/^([-*_])[ \t]*(?:\1[ \t]*){2,}$/,style:"thin",contexts:["markdown"]}];function Co(e,t){let n;{if(/^ {4,}/.
81
81
  test(e))return null;n=e.trim()}for(const r of Mo)if(r.contexts.includes(t)&&r.pattern.test(n))return r.style;return null}const Fo=new Set(["single","dashed","dotted","double","none","stars","diamonds"]);
82
82
  function Mn(e){if(e.type!=="paragraph"||!e.borders||e.shading!==void 0||e.heading!==void 0||e.styleId!==void 0||e.align!==void 0||e.leftIndent!==void 0||e.firstLineIndent!==void 0||e.tabStops!==void 0||
83
83
  e.children.some(a=>a.text!==""))return null;let t;try{t=JSON.parse(e.borders)}catch{return null}const n=a=>a!=null&&a.style!=="none",r=t?.bottom;if(!n(r)||n(t.top)||n(t.left)||n(t.right))return null;const i=r.
84
- style;return{style:i&&Fo.has(i)?i:fe.style,width:r.width??fe.width,color:r.color??fe.color}}const To=e=>Mn(e)!==null,Ro=new Set(["left","right","center","decimal"]),Oo=new Set(["dot","hyphen","undersc\
84
+ style;return{style:i&&Fo.has(i)?i:ge.style,width:r.width??ge.width,color:r.color??ge.color}}const To=e=>Mn(e)!==null,Ro=new Set(["left","right","center","decimal"]),Oo=new Set(["dot","hyphen","undersc\
85
85
  ore"]),_e=new Map,Lo=512;function Eo(e){if(!e)return null;const t=_e.get(e);if(t!==void 0)return t;let n=null;try{const r=JSON.parse(e);if(Array.isArray(r)){const i=[];for(const a of r)if(a&&typeof a==
86
86
  "object"&&typeof a.pos=="number"&&Number.isFinite(a.pos)&&a.pos>=0&&typeof a.align=="string"&&Ro.has(a.align)){const o={pos:a.pos,align:a.align};typeof a.leader=="string"&&Oo.has(a.leader)&&(o.leader=
87
87
  a.leader),i.push(o)}i.length>0&&(i.sort((a,o)=>a.pos-o.pos),n=i)}}catch{n=null}return _e.size>=Lo&&_e.clear(),_e.set(e,n),n}function $e(e){const t=[];return e.keepNext&&t.push("keepNext"),e.keepLines&&
@@ -126,8 +126,8 @@ e,n),n}const Xe=new Set(["serif","sans-serif","monospace","cursive","fantasy","s
126
126
  if(Q!==void 0)return Q;if(typeof document>"u")return Q=null,null;try{const e=document.createElement("canvas");e.width=4,e.height=4,Q=e.getContext("2d")}catch{Q=null}return Q??null}const En=new Map;function Ko(e){
127
127
  const t=D(e.split(",")[0]);if(!t)return!1;if(Xe.has(t.toLowerCase()))return!0;const n=t.toLowerCase(),r=En.get(n);if(r!==void 0)return r;const i=Yo();if(!i)return!1;let a=!1;try{for(const o of["monosp\
128
128
  ace","sans-serif","serif"]){i.font=`${Ln}px ${o}`;const s=i.measureText(On).width;i.font=`${Ln}px '${t}', ${o}`;const c=i.measureText(On).width;if(s>0&&Math.abs(c-s)>.5){a=!0;break}}}catch{a=!1}return En.
129
- set(n,a),a}function Zo(){return typeof window<"u"&&"queryLocalFonts"in window}let ge=null;async function Qo(){if(ge)return ge;const e=await window.queryLocalFonts();return ge=e,e}async function ei(){if(!Zo())
130
- return"denied";try{return(await navigator.permissions.query({name:"local-fonts"})).state}catch{return"prompt"}}async function ti(){return ge?!0:await ei()==="granted"}async function ni(){return ge||(await ti()?
129
+ set(n,a),a}function Zo(){return typeof window<"u"&&"queryLocalFonts"in window}let pe=null;async function Qo(){if(pe)return pe;const e=await window.queryLocalFonts();return pe=e,e}async function ei(){if(!Zo())
130
+ return"denied";try{return(await navigator.permissions.query({name:"local-fonts"})).state}catch{return"prompt"}}async function ti(){return pe?!0:await ei()==="granted"}async function ni(){return pe||(await ti()?
131
131
  await Qo():null)}function ri(e){if(e.length<4)return"unknown";const t=String.fromCharCode(e[0],e[1],e[2],e[3]);return t==="OTTO"?"otf":t==="ttcf"?"ttc":t==="true"||e[0]===0&&e[1]===1&&e[2]===0&&e[3]===
132
132
  0?"ttf":"unknown"}function oi(e){const t=(e??"").toLowerCase();return{bold:t.includes("bold")||t.includes("black")||t.includes("heavy"),italic:t.includes("italic")||t.includes("oblique")}}const ii=new Set(
133
133
  mt.map(e=>D(e.cssValue.split(",")[0]).toLowerCase()));function ai(e){const t=new Map,n=i=>{const a=i.marks?.fontFamily;if(!a)return;const o=D(a.split(",")[0]);if(!o)return;const s=o.toLowerCase();t.has(
@@ -135,8 +135,8 @@ s)||t.set(s,{value:a,family:o,available:Ko(o),builtin:ii.has(s)})},r=i=>{if(!(!i
135
135
  children)r(i);for(const i of e.chrome??[])r(i);for(const i of e.notes??[])r(i);return Array.from(t.values())}const ze=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","al\
136
136
  lCaps","hidden","superscript","subscript"],si=new Set(["color","highlight"]);function ci(e){return ze.filter(t=>e[t]===!1)}function jn(e){const t=Array.from(new Set((e??"").split(",").map(n=>n.trim()).
137
137
  filter(n=>si.has(n)))).sort();return t.length>0?t.join(","):void 0}function li(e,t,n){const r=new Set((t??"").split(",").map(a=>a.trim()).filter(Boolean));for(const a of ze)r.has(a)&&(e[a]=!1);const i=jn(
138
- n);i&&(e.docxRunPropertyResets=i)}const pe="Arial, sans-serif",ui=new Set(ze);function St(e){const t=Bn(e);for(const n of ui)e?.[n]===!1&&(t[n]=!1);return t}function Bn(e){const t={};for(const[n,r]of Object.
139
- entries(e??{}))r===!0?t[n]=!0:(typeof r=="string"&&r!==""||typeof r=="number")&&(t[n]=r);return t.fontFamily||(t.fontFamily=pe),t}function di(e){const t=e;return JSON.stringify(Object.keys(t).sort().map(
138
+ n);i&&(e.docxRunPropertyResets=i)}const ee="Arial, sans-serif",ui=new Set(ze);function St(e){const t=Bn(e);for(const n of ui)e?.[n]===!1&&(t[n]=!1);return t}function Bn(e){const t={};for(const[n,r]of Object.
139
+ entries(e??{}))r===!0?t[n]=!0:(typeof r=="string"&&r!==""||typeof r=="number")&&(t[n]=r);return t.fontFamily||(t.fontFamily=ee),t}function di(e){const t=e;return JSON.stringify(Object.keys(t).sort().map(
140
140
  n=>[n,t[n]]))}function _n(e){const t=[];let n=null;for(const r of e){const i=di(r.marks??{}),a=t[t.length-1];if(a&&i===n){t[t.length-1]={...a,text:a.text+r.text};continue}t.push(r),n=i}return t}const fi=72/
141
141
  96,gi={paddingPx:16,borderColor:"#cccccc",borderWidthPx:1},pi={cellPaddingPx:8,borderColor:"#cccccc",borderWidthPx:1},mi={maxIndentLevel:2,sublistIndentPx:20,markerWidthPx:20,variantIndentPx:{todo:35,
142
142
  ordered:30,unordered:25},todoCheckboxSizePx:16,todoCheckboxRadiusPx:3,todoCheckboxOffsetPx:4},hi={fontSizePx:14,lineHeightMultiplier:1.5,paddingPx:12,borderRadiusPx:4,diagramMinHeightPx:120,diagramSourceGapPx:10},
@@ -144,8 +144,8 @@ bi={gutterPx:26,verticalPaddingPx:4,blockSpacingPx:2,separatorSpacePx:18,inlineE
144
144
  separatorWidthFraction:.3},U={paddingYPx:10,levelIndentPx:24,pageNumberGapPx:6,labelClipGapPx:12,leaderStartGapPx:4,minimumLeaderWidthPx:8},yi={displayHeightPx:20,indicatorInsetXPx:0,indicatorWidthPx:36,
145
145
  caretOffsetXPx:12,iconInsetXPx:2,iconInsetYPx:2},xi={blockInsertMarkerMarginXPx:16,blockInsertMarkerOffsetYPx:13,blockInsertMarkerArmPx:4,blockInsertMarkerLineWidthPx:2,breakTintOpacity:.12,breakIconOpacity:.55,
146
146
  tocTintOpacity:.08,placeholderTintOpacity:.25,tableTintOpacity:{insert:.08,delete:.06},tableRowTintOpacity:{insert:.2,delete:.15},tableRowRailOpacity:.8,tableCellRailWidthPx:2,pendingBreakLabelFontSizePx:10,
147
- pendingBreakRuleStartPx:24,pendingBreakLabelGapPx:8,pendingBreakDashPx:3,pendingBreakRuleOpacity:.65,pendingBreakLabelOpacity:.9};let ee=null,wt=null;function $n(){return ee?Promise.resolve(ee):(wt||(wt=
148
- import("./ColorParserFull-BKH72fK8.js").then(e=>(ee=e.parseCssColorFull,ee))),wt)}const Si=/\b(?:hwb|lab|lch|oklab|oklch|color|color-mix|device-cmyk|calc|var)\s*\(|\b(?:rgba?|hsla?)\s*\([^)]*(?:%|deg|rad|grad|turn|none)/i;
147
+ pendingBreakRuleStartPx:24,pendingBreakLabelGapPx:8,pendingBreakDashPx:3,pendingBreakRuleOpacity:.65,pendingBreakLabelOpacity:.9};let te=null,wt=null;function $n(){return te?Promise.resolve(te):(wt||(wt=
148
+ import("./ColorParserFull-BKH72fK8.js").then(e=>(te=e.parseCssColorFull,te))),wt)}const Si=/\b(?:hwb|lab|lch|oklab|oklch|color|color-mix|device-cmyk|calc|var)\s*\(|\b(?:rgba?|hsla?)\s*\([^)]*(?:%|deg|rad|grad|turn|none)/i;
149
149
  function wi(e){return Si.test(e)}const ki=Object.fromEntries("aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffe\
150
150
  bcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkbl\
151
151
  ue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkgrey:a9a9a9,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b\
@@ -165,7 +165,7 @@ Math.min(255,Math.round(e))),De=e=>Math.max(0,Math.min(1,e));function Gn(e){cons
165
165
  ""):e,r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16),o=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{r,g:i,b:a,a:o}}function Ii(e){if(e[0]==="#")return Gn(e.
166
166
  slice(1));const t=e.toLowerCase();if(t==="transparent")return{r:0,g:0,b:0,a:0};const n=ki[t];if(n)return Gn(n);if(/^[a-z]+$/.test(t))return null;let r=t.match(vi)??t.match(Pi);if(r)return{r:kt(Number(
167
167
  r[1])),g:kt(Number(r[2])),b:kt(Number(r[3])),a:r[4]===void 0?1:De(Number(r[4]))};if(r=t.match(Ai)??t.match(Ni),r){const i=(Number(r[1])%360+360)%360/360;return{...Pt(i,De(Number(r[2])/100),De(Number(r[3])/
168
- 100)),a:r[4]===void 0?1:De(Number(r[4]))}}}function me(e){const t=e.trim();if(!t)return null;const n=Ii(t);return n!==void 0?n:ee?ee(t):($n(),null)}function he(e){const t=me(e);return t?{r:t.r,g:t.g,b:t.
168
+ 100)),a:r[4]===void 0?1:De(Number(r[4]))}}}function me(e){const t=e.trim();if(!t)return null;const n=Ii(t);return n!==void 0?n:te?te(t):($n(),null)}function he(e){const t=me(e);return t?{r:t.r,g:t.g,b:t.
169
169
  b}:null}function vt({r:e,g:t,b:n}){const r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return{h:0,s:0,l:c};const l=o-s,u=c>.5?l/(2-o-s):l/(o+s);let d;return o===r?d=((i-
170
170
  a)/l+(i<a?6:0))/6:o===i?d=((a-r)/l+2)/6:d=((r-i)/l+4)/6,{h:d,s:u,l:c}}function Pt(e,t,n){if(t===0){const o=Math.round(n*255);return{r:o,g:o,b:o}}const r=(o,s,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<1/6?o+(s-o)*
171
171
  6*c:c<1/2?s:c<2/3?o+(s-o)*(2/3-c)*6:o),i=n<.5?n*(1+t):n+t-n*t,a=2*n-i;return{r:Math.round(r(a,i,e+1/3)*255),g:Math.round(r(a,i,e)*255),b:Math.round(r(a,i,e-1/3)*255)}}function At({r:e,g:t,b:n}){const r=i=>i.
@@ -190,9 +190,9 @@ e)?0:Math.max(0,e)}function Tt(e){return typeof e!="number"||!Number.isFinite(e)
190
190
  0?-1:t>0?1:0}function We(e){const t=Tt(e);return t>0?t:void 0}function He(e){const t=Rt(e);return t===0?void 0:t}function qi(e){return Tt(e.leftIndent)}function Vi(e){return Rt(e.firstLineIndent)}function Jn(e,t=L){
191
191
  return Lt(qi(e),t)}function Yn(e,t=L){const n=Vi(e);return Math.sign(n)*Lt(Math.abs(n),t)}function Ot(e,t,n=L){const r=Jn(e,n),i=Yn(e,n);return r+(t===0?i:0)}function Ji(e,t,n,r=L){return n==="rtl"?0:
192
192
  Ot(e,t,r)}function Yi(e,t,n,r=L){return Math.max(Ui,e-Ot(t,n,r))}function Kn(e,t=L){return!Number.isFinite(t)||t<=0?0:Math.max(0,Math.round(Hi(e)/t))}function Lt(e,t=L){return!Number.isFinite(t)||t<=0?
193
- 0:Math.max(0,Math.round(e))*t}function te(e,t){const n=t?.indentStepPx??L;if(t?.firstLine){const i=t?.storedAsUnits?Rt(e):e&&e<0?-1:Kn(e,n)>0?Vn:0;return i===0?void 0:i}const r=t?.storedAsUnits?Tt(e):
193
+ 0:Math.max(0,Math.round(e))*t}function ne(e,t){const n=t?.indentStepPx??L;if(t?.firstLine){const i=t?.storedAsUnits?Rt(e):e&&e<0?-1:Kn(e,n)>0?Vn:0;return i===0?void 0:i}const r=t?.storedAsUnits?Tt(e):
194
194
  Kn(e,n);return r>0?r:void 0}function Ki(e){if(!e)return;const t=e.trim().match(Wi);if(!t)return;const n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return;const r=(t[2]||"px").toLowerCase(),i={px:1,
195
- pt:F/72,in:F,cm:F/2.54,mm:F/25.4};return n*i[r]}function Zi(e,t){const n=Ki(e);if(n!==void 0)return n===0?0:t?.firstLine?n<0?-1:Vn:te(n,{indentStepPx:t?.indentStepPx,storedAsUnits:!1,firstLine:t?.firstLine})}
195
+ pt:F/72,in:F,cm:F/2.54,mm:F/25.4};return n*i[r]}function Zi(e,t){const n=Ki(e);if(n!==void 0)return n===0?0:t?.firstLine?n<0?-1:Vn:ne(n,{indentStepPx:t?.indentStepPx,storedAsUnits:!1,firstLine:t?.firstLine})}
196
196
  function Zn(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function Et(e){return e instanceof S.XmlElement||Zn(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute==
197
197
  "function"}function Qi(e){return e instanceof S.XmlText||Zn(e,"YXmlText")&&typeof e.toDelta=="function"}const Qn="Arial, sans-serif",T=[{attr:"structuralSuggestionId",kind:"string"},{attr:"structuralS\
198
198
  uggestionKind",kind:"enum",enum:["insert","delete","split","merge","change"]},{attr:"structuralSuggestionRole",kind:"enum",enum:["before","after"]},{attr:"structuralSuggestionLabel",kind:"string"},{attr:"\
@@ -201,65 +201,65 @@ return(_[e]?.attrs??[]).map(t=>t.attr)}function ta(e){return _[e]?.children==="r
201
201
  kind:"int"},{attr:"align",kind:"string"},{attr:"lineSpacing",kind:"float"},{attr:"spaceBefore",kind:"float"},{attr:"spaceAfter",kind:"float"},{attr:"contextualSpacing",kind:"boolean"},{attr:"styleId",
202
202
  kind:"string"},{attr:"direction",kind:"string"},{attr:"tabStops",kind:"string"},{attr:"borders",kind:"string"},{attr:"shading",kind:"string"},{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlPPr",kind:"str\
203
203
  ing"},{attr:"leftIndent",kind:"float"},{attr:"firstLineIndent",kind:"float"},...T,...M],children:"text"},{type:"list",attrs:[{attr:"variant",kind:"string"},{attr:"startNumber",kind:"int"},{attr:"numbe\
204
- ringChainId",kind:"string"},{attr:"numberingFormat",kind:"string"},...ce.map(e=>({attr:e,kind:"float"})),{attr:"contextualSpacing",kind:"boolean"},...T,...M],children:"list-items"},{type:"list-item",attrs:[
205
- ...ce.map(e=>({attr:e,kind:"float"})),{attr:"checked",kind:"boolean"},{attr:"indentLevel",kind:"int",validate:e=>e>0},{attr:"direction",kind:"string"},...T],children:"text"},{type:"table",attrs:[{attr:"\
206
- columnWidths",kind:"json"},{attr:"tableWidth",kind:"int"},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"borderColor",kind:"string"},{attr:"borderWidth",kind:"int"},{attr:"borders",kind:"\
207
- string"},{attr:"cellPadding",kind:"int"},{attr:"hasHeader",kind:"booleanTrue"},{attr:"docxTablePropertyOverrides",kind:"string"},{attr:"oxmlTblPr",kind:"string"},...T,...M],children:"table-rows"},{type:"\
208
- table-row",attrs:[{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlTrPr",kind:"string"},...M,...T],children:"blocks"},{type:"table-cell",attrs:[{attr:"verticalAlign",kind:"string"},{attr:"backgroundColor",
209
- kind:"string"},{attr:"borders",kind:"string"},{attr:"padding",kind:"string"},{attr:"colSpan",kind:"int",validate:e=>e>1},{attr:"rowSpan",kind:"int",validate:e=>e>1},{attr:"oxmlTcPr",kind:"string"},...M,
210
- ...T],children:"blocks"},{type:"container",attrs:[{attr:"borderColor",kind:"string"},{attr:"padding",kind:"int"},...T,...M],children:"blocks"},{type:"header-footer",attrs:[{attr:"side",kind:"enum",enum:[
211
- "header","footer"]},{attr:"slot",kind:"enum",enum:["default","first","even"]},{attr:"sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},{type:"footnote",attrs:[{attr:"noteKind",kind:"enum",
212
- enum:["endnote"]},...T,...M],children:"blocks"},{type:"code",attrs:[{attr:"language",kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"renderDiagram",kind:"boolean"},{attr:"showDiagramSource",kind:"\
213
- boolean"},...M,...T],children:"rawtext"},{type:"math",attrs:[{attr:"displayMode",kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"showDiagramSource",
214
- kind:"boolean"},...M,...T],children:"rawtext"},{type:"image",attrs:[{attr:"src",kind:"string"},{attr:"sourceUrl",kind:"string"},{attr:"width",kind:"int"},{attr:"height",kind:"int"},{attr:"alt",kind:"s\
215
- tring"},{attr:"align",kind:"string"},{attr:"uploading",kind:"boolean"},{attr:"tempId",kind:"string"},{attr:"originalFormat",kind:"enum",enum:["emf","wmf"]},{attr:"originalDataUrl",kind:"string"},{attr:"\
216
- anchorXml",kind:"string"},...M,...T],children:"none"},{type:"page-break",attrs:[...M,{attr:"structuralSuggestionRecord",kind:"string"}],children:"none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"strin\
217
- g"},{attr:"tagName",kind:"string"},{attr:"detail",kind:"string"},{attr:"origin",kind:"enum",enum:["run","body"]},...T,...M],children:"none"},{type:"section-break",attrs:[{attr:"layout",kind:"json"},{attr:"\
218
- breakType",kind:"enum",enum:["nextPage","continuous","evenPage","oddPage"]},...M],children:"none"},{type:"toc",attrs:[{attr:"direction",kind:"enum",enum:["rtl","ltr"]},{attr:"align",kind:"enum",enum:[
219
- "left","center","right","justify"]},{attr:"levels",kind:"int",validate:e=>e>=1&&e<=6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"string"},{attr:"fontSize",kind:"float",validate:e=>e>=Ct&&e<=
220
- Ft},{attr:"color",kind:"string"},...M,{attr:"structuralSuggestionRecord",kind:"string"}],children:"none"},{type:"placeholder",attrs:[{attr:"height",kind:"int"}],children:"none"}].map(e=>[e.type,e])),ra={
221
- image:{src:"",width:200,height:200},code:{content:""},math:{displayMode:"block"},placeholder:{height:100},list:{variant:"unordered"}};function oa(e,t){if(!(t==null||t===""))switch(e.kind){case"string":
222
- return t;case"int":{const n=parseInt(t,10);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"float":{const n=parseFloat(t);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"\
223
- boolean":return t==="true"?!0:t==="false"?!1:void 0;case"booleanTrue":return t==="true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{return}case"enum":return e.enum?.includes(t)?t:void 0}}function er(e,t){
224
- if(t==null)return null;switch(e.kind){case"string":case"enum":return typeof t=="string"&&t!==""?t:null;case"int":case"float":return typeof t=="number"?String(t):null;case"boolean":return typeof t=="bo\
225
- olean"?String(t):null;case"booleanTrue":return t===!0?"true":null;case"json":return JSON.stringify(t)}}function ia(e){const t=[],n=ue(e);for(const r of n){if(typeof r.insert!="string")continue;const i=r.
226
- attributes||{},a={type:"text",text:r.insert,marks:St(i)};t.push(a)}return _n(t)}function tr(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(Qi(n))return n}return null}function nr(e){const t=Z(e,"_e\
227
- mptyTextMarks");let n={fontFamily:Qn};if(t)try{n=JSON.parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function aa(e){const t=tr(e);if(!t)return nr(e);const n=ia(t);return n.length>0?n:nr(e)}function sa(e,t){
228
- for(const[n,r]of[["leftIndent",!1],["firstLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const i=te(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:r});i===void 0?
229
- delete e[n]:e[n]=i}}function be(e,t,n,r){const i=e.nodeName,a=_[i]??_.paragraph,o=_[i]?i:"paragraph",s={type:o,id:Z(e,"id")||P()};for(const l of a.attrs){const u=oa(l,Z(e,l.attr));u!==void 0&&(s[l.field??
230
- l.attr]=u)}o==="paragraph"&&Ge(s,Z(e,"pagination"));const c=ra[o];if(c)for(const[l,u]of Object.entries(c))s[l]===void 0&&(s[l]=u);switch(a.children){case"text":s.children=aa(e);break;case"rawtext":{const l=tr(
231
- e);s.content=l?l.toString():"";break}case"blocks":{const l=[];for(const u of e.toArray())if(Et(u)){const d=r?r(u):be(u,t);d&&l.push(d)}s.children=l;break}case"list-items":{const l=[];for(const u of e.
232
- toArray())if(Et(u)&&u.nodeName==="list-item"){const d=r?r(u):be(u,t);d&&l.push(d)}s.children=l;break}case"table-rows":{const l=[];for(const u of e.toArray())if(Et(u)&&u.nodeName==="table-row"){const d=r?
233
- r(u):be(u,t);d&&l.push(d)}s.children=l,s.columnWidths===void 0&&(s.columnWidths=[]);break}}return(o==="paragraph"||a.children==="text")&&sa(s,t),s}function ca(e,t){const n=new S.XmlText,r=new Set;for(const o of e){
234
- const s=o;if(s?.type==="text"&&s.marks)for(const c of Object.keys(s.marks))r.add(c)}let i=0;for(const o of e){const s=o;if(s?.type!=="text"||!s.text)continue;const c=s.marks??{};if(t&&z(t)){n.insert(i,
235
- s.text,Be(t,c)),i+=s.text.length;continue}de(n,i,s.text);for(const l of r)wn(n,i,s.text.length,{[l]:l in c?c[l]:null});i+=s.text.length}let a=null;if(i===0){const o=e.find(s=>s?.type==="text"&&s.text.
236
- length===0&&s.marks&&Object.keys(s.marks).length>0);o?.marks&&(a=o.marks)}return{yText:n,emptyMarks:a}}function la(e,t,n){const r=_[t.type];if(!r)return;let i={id:String(t.id??P())};for(const a of r.attrs){
237
- const o=a.field??a.attr;let s=t[o];o==="leftIndent"&&typeof s=="number"?s=s===0?0:We(s):o==="firstLineIndent"&&typeof s=="number"&&(s=s===0?0:He(s));const c=er(a,s);c!==null&&(i[a.attr]=c)}if(r.type===
238
- "paragraph"){const a=$e(t);a!==void 0&&(i.pagination=a)}t.type==="paragraph"&&n&&z(n)&&(i=po(n,i));for(const[a,o]of Object.entries(i))e.setAttribute(a,o)}function ua(e,t){const n=t,r=_[n.type];if(!r)return;
239
- const i=String(n.id??P());e.getAttribute("id")!==i&&e.setAttribute("id",i);for(const a of r.attrs){const o=a.field??a.attr;let s=n[o];o==="leftIndent"&&typeof s=="number"?s=s===0?0:We(s):o==="firstLin\
240
- eIndent"&&typeof s=="number"&&(s=s===0?0:He(s));const c=er(a,s);if(c===null){const l=Z(e,a.attr);l!==void 0&&l!==""&&pt(e,a.attr)}else Z(e,a.attr)!==c&&e.setAttribute(a.attr,c)}if(r.type==="paragraph"){
241
- const a=$e(n);a===void 0?pt(e,"pagination"):e.setAttribute("pagination",a)}}function rr(e,t){const n=e.children;if(!Array.isArray(n))return e;const r=n.flatMap(i=>{if(i?.type==="text"){const a=t(i);return Array.
242
- isArray(a)?a:[a]}return[rr(i,t)]});return{...e,children:r}}function jt(e,t){const n=e,r=_[n.type]??_.paragraph,i=new S.XmlElement(r.type);la(i,n,t);let a=0;switch(r.children){case"text":{const{yText:o,
243
- emptyMarks:s}=ca(n.children??[],t);i.insert(a++,[o]),s&&i.setAttribute("_emptyTextMarks",JSON.stringify(s));break}case"rawtext":{const o=new S.XmlText,s=typeof n.content=="string"?n.content:"";s&&de(o,
244
- 0,s),i.insert(a++,[o]);break}case"blocks":case"list-items":case"table-rows":{const o=n.children??[];for(const s of o)i.insert(a++,[jt(s,t)]);break}}return i}function ye(e,t,n,r){const i=a=>e.find(o=>o.
245
- type==="header-footer"&&o.side===t&&o.slot===n&&o.sectionIndex===a);if(r!==void 0){const a=i(r);if(a)return a}return i(void 0)}function da(e,t,n,r){if(n===1){const i=ye(e,t,"first",r);if(i)return i}if(n%
246
- 2===0){const i=ye(e,t,"even",r);if(i)return i}return ye(e,t,"default",r)}const xe=[void 0,"center","right"];function fa(e,t){const n=xe[e];return{type:"paragraph",id:P(),children:[{type:"text",text:"",
247
- ...t?{marks:{fontFamily:t}}:{}}],...n?{align:n}:{}}}function ga(e,t){if(!t)return e;let n=!1;const r=e.children.map(i=>i.type!=="text"||i.marks?.fontFamily?i:(n=!0,{...i,marks:{...i.marks??{},fontFamily:t}}));
248
- return n?{...e,children:r}:e}function pa(e,t){const n=xe[t];return!n||e.align?e:{...e,align:n}}function or(e,t,n,r,i){const a=n??[],o=s=>a[s]?ga(pa(a[s],s),r):fa(s,r);return{type:"header-footer",id:P(),
249
- side:e,slot:t,...i!==void 0?{sectionIndex:i}:{},children:[o(0),o(1),o(2)]}}function ir(e){return!!e?.children.some(t=>t.type==="text"&&t.text.trim()!=="")}function ma(e){return e.children.some(t=>ir(t))}
250
- function Bt(e){const t=e.children,n=[2,1,0].find(i=>ir(t[i]))??-1;if(n===-1)return;const r=[];for(let i=0;i<=n;i++){i>0&&r.push({type:"text",text:" "});for(const a of t[i]?.children??[])a.type==="text"&&
251
- a.text&&r.push(a)}return{type:"paragraph",id:e.id?`${e.id}-zone`:P(),children:r}}function ar(e){const t=[[],[],[]],n=e?.[0],r=!!n?.children.some(o=>o.type==="text"&&o.text.includes(" "));let i=!r&&n?.
252
- align==="right"?2:!r&&n?.align==="center"?1:0;const a=n?.children??[];for(const o of a)o.type==="text"&&o.text.split(" ").forEach((s,c)=>{c>0&&i<2&&(i+=1),s&&t[i].push({type:"text",text:s,...o.marks?{
253
- marks:{...o.marks}}:{}})});for(const o of e?.slice(1)??[])for(const s of o.children)s.type==="text"&&s.text&&t[0].push({...s});return t.map((o,s)=>({type:"paragraph",id:P(),children:o.length>0?o:[{type:"\
254
- text",text:""}],...xe[s]?{align:xe[s]}:{}}))}function sr(e){const t={},n={};for(const r of e){if(r.type!=="header-footer"||r.sectionIndex!==void 0)continue;const i=Bt(r);if(!i)continue;const a=r.side===
255
- "header"?t:n;a[r.slot]=[i]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:{}}}function ha(e,t){const n={},r={};for(const i of["header","footer"])for(const a of[
256
- "default","first","even"]){const o=ye(e,i,a,t);if(!o)continue;const s=Bt(o);if(!s)continue;const c=i==="header"?n:r;c[a]=[s]}return{...Object.keys(n).length>0?{headers:n}:{},...Object.keys(r).length>0?
257
- {footers:r}:{}}}function ba(e){return e.some(t=>t.type==="header-footer"&&t.sectionIndex!==void 0)}function _t(e,t,n){const r=[];for(const[i,a]of[["header",e],["footer",t]])if(a)for(const o of["defaul\
258
- t","first","even"]){const s=a[o];!s||s.length===0||r.push(or(i,o,ar(s),n))}return r}function ya(e){for(const t of e)if(!(t.type==="header-footer"||t.type==="footnote")){if(t.type==="paragraph"){for(const n of t.
259
- children)if(n.type==="text"&&n.marks?.fontFamily)return n.marks.fontFamily}else if(t.type==="list"){for(const n of t.children)for(const r of n.children)if(r.type==="text"&&r.marks?.fontFamily)return r.
260
- marks.fontFamily}}}function xa(e){let t="";for(const r of e?.children??[])r.type==="text"&&(r.marks?.field==="page"?t+="{PAGE}":r.marks?.field==="numPages"?t+="{PAGES}":t+=r.text);const n=t.replace(/\s+/g,
261
- " ").trim();return n.length>60?`${n.slice(0,59)}…`:n}const cr={default:"default","default page":"default","default pages":"default",all:"default","all pages":"default",first:"first","first page":"fi\
262
- rst",title:"first","title page":"first",titlepg:"first",even:"even","even page":"even","even pages":"even"};function Sa(e){if(e==null)return;if(typeof e!="string")return null;const t=e.trim().toLowerCase().
204
+ ringChainId",kind:"string"},{attr:"numberingFormat",kind:"string"},...le.map(e=>({attr:e,kind:"float"})),{attr:"contextualSpacing",kind:"boolean"},...T,...M],children:"list-items"},{type:"list-item",attrs:[
205
+ ...le.map(e=>({attr:e,kind:"float"})),{attr:"checked",kind:"boolean"},{attr:"indentLevel",kind:"int",validate:e=>e>0},{attr:"direction",kind:"string"},{attr:"heading",kind:"int",validate:e=>e>=1&&e<=6},
206
+ ...T],children:"text"},{type:"table",attrs:[{attr:"columnWidths",kind:"json"},{attr:"tableWidth",kind:"int"},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"borderColor",kind:"string"},
207
+ {attr:"borderWidth",kind:"int"},{attr:"borders",kind:"string"},{attr:"cellPadding",kind:"int"},{attr:"hasHeader",kind:"booleanTrue"},{attr:"docxTablePropertyOverrides",kind:"string"},{attr:"oxmlTblPr",
208
+ kind:"string"},...T,...M],children:"table-rows"},{type:"table-row",attrs:[{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlTrPr",kind:"string"},...M,...T],children:"blocks"},{type:"table-cell",attrs:[{attr:"\
209
+ verticalAlign",kind:"string"},{attr:"backgroundColor",kind:"string"},{attr:"borders",kind:"string"},{attr:"padding",kind:"string"},{attr:"colSpan",kind:"int",validate:e=>e>1},{attr:"rowSpan",kind:"int",
210
+ validate:e=>e>1},{attr:"oxmlTcPr",kind:"string"},...M,...T],children:"blocks"},{type:"container",attrs:[{attr:"borderColor",kind:"string"},{attr:"padding",kind:"int"},...T,...M],children:"blocks"},{type:"\
211
+ header-footer",attrs:[{attr:"side",kind:"enum",enum:["header","footer"]},{attr:"slot",kind:"enum",enum:["default","first","even"]},{attr:"sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},
212
+ {type:"footnote",attrs:[{attr:"noteKind",kind:"enum",enum:["endnote"]},...T,...M],children:"blocks"},{type:"code",attrs:[{attr:"language",kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"render\
213
+ Diagram",kind:"boolean"},{attr:"showDiagramSource",kind:"boolean"},...M,...T],children:"rawtext"},{type:"math",attrs:[{attr:"displayMode",kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",
214
+ enum:["left","center","right"]},{attr:"showDiagramSource",kind:"boolean"},...M,...T],children:"rawtext"},{type:"image",attrs:[{attr:"src",kind:"string"},{attr:"sourceUrl",kind:"string"},{attr:"width",
215
+ kind:"int"},{attr:"height",kind:"int"},{attr:"alt",kind:"string"},{attr:"align",kind:"string"},{attr:"uploading",kind:"boolean"},{attr:"tempId",kind:"string"},{attr:"originalFormat",kind:"enum",enum:[
216
+ "emf","wmf"]},{attr:"originalDataUrl",kind:"string"},{attr:"anchorXml",kind:"string"},...M,...T],children:"none"},{type:"page-break",attrs:[...M,{attr:"structuralSuggestionRecord",kind:"string"}],children:"\
217
+ none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"string"},{attr:"tagName",kind:"string"},{attr:"detail",kind:"string"},{attr:"origin",kind:"enum",enum:["run","body"]},...T,...M],children:"none"},{type:"\
218
+ section-break",attrs:[{attr:"layout",kind:"json"},{attr:"breakType",kind:"enum",enum:["nextPage","continuous","evenPage","oddPage"]},...M],children:"none"},{type:"toc",attrs:[{attr:"direction",kind:"e\
219
+ num",enum:["rtl","ltr"]},{attr:"align",kind:"enum",enum:["left","center","right","justify"]},{attr:"levels",kind:"int",validate:e=>e>=1&&e<=6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"str\
220
+ ing"},{attr:"fontSize",kind:"float",validate:e=>e>=Ct&&e<=Ft},{attr:"color",kind:"string"},...M,{attr:"structuralSuggestionRecord",kind:"string"}],children:"none"},{type:"placeholder",attrs:[{attr:"he\
221
+ ight",kind:"int"}],children:"none"}].map(e=>[e.type,e])),ra={image:{src:"",width:200,height:200},code:{content:""},math:{displayMode:"block"},placeholder:{height:100},list:{variant:"unordered"}};function oa(e,t){
222
+ if(!(t==null||t===""))switch(e.kind){case"string":return t;case"int":{const n=parseInt(t,10);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"float":{const n=parseFloat(t);return Number.
223
+ isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"boolean":return t==="true"?!0:t==="false"?!1:void 0;case"booleanTrue":return t==="true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{return}case"\
224
+ enum":return e.enum?.includes(t)?t:void 0}}function er(e,t){if(t==null)return null;switch(e.kind){case"string":case"enum":return typeof t=="string"&&t!==""?t:null;case"int":case"float":return typeof t==
225
+ "number"?String(t):null;case"boolean":return typeof t=="boolean"?String(t):null;case"booleanTrue":return t===!0?"true":null;case"json":return JSON.stringify(t)}}function ia(e){const t=[],n=de(e);for(const r of n){
226
+ if(typeof r.insert!="string")continue;const i=r.attributes||{},a={type:"text",text:r.insert,marks:St(i)};t.push(a)}return _n(t)}function tr(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(Qi(n))return n}
227
+ return null}function nr(e){const t=Z(e,"_emptyTextMarks");let n={fontFamily:Qn};if(t)try{n=JSON.parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function aa(e){const t=tr(e);if(!t)return nr(e);const n=ia(
228
+ t);return n.length>0?n:nr(e)}function sa(e,t){for(const[n,r]of[["leftIndent",!1],["firstLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const i=ne(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.
229
+ storedAsUnits,firstLine:r});i===void 0?delete e[n]:e[n]=i}}function be(e,t,n,r){const i=e.nodeName,a=_[i]??_.paragraph,o=_[i]?i:"paragraph",s={type:o,id:Z(e,"id")||P()};for(const l of a.attrs){const u=oa(
230
+ l,Z(e,l.attr));u!==void 0&&(s[l.field??l.attr]=u)}o==="paragraph"&&Ge(s,Z(e,"pagination"));const c=ra[o];if(c)for(const[l,u]of Object.entries(c))s[l]===void 0&&(s[l]=u);switch(a.children){case"text":s.
231
+ children=aa(e);break;case"rawtext":{const l=tr(e);s.content=l?l.toString():"";break}case"blocks":{const l=[];for(const u of e.toArray())if(Et(u)){const d=r?r(u):be(u,t);d&&l.push(d)}s.children=l;break}case"\
232
+ list-items":{const l=[];for(const u of e.toArray())if(Et(u)&&u.nodeName==="list-item"){const d=r?r(u):be(u,t);d&&l.push(d)}s.children=l;break}case"table-rows":{const l=[];for(const u of e.toArray())if(Et(
233
+ u)&&u.nodeName==="table-row"){const d=r?r(u):be(u,t);d&&l.push(d)}s.children=l,s.columnWidths===void 0&&(s.columnWidths=[]);break}}return(o==="paragraph"||a.children==="text")&&sa(s,t),s}function ca(e,t){
234
+ const n=new S.XmlText,r=new Set;for(const o of e){const s=o;if(s?.type==="text"&&s.marks)for(const c of Object.keys(s.marks))r.add(c)}let i=0;for(const o of e){const s=o;if(s?.type!=="text"||!s.text)continue;
235
+ const c=s.marks??{};if(t&&z(t)){n.insert(i,s.text,Be(t,c)),i+=s.text.length;continue}fe(n,i,s.text);for(const l of r)wn(n,i,s.text.length,{[l]:l in c?c[l]:null});i+=s.text.length}let a=null;if(i===0){
236
+ const o=e.find(s=>s?.type==="text"&&s.text.length===0&&s.marks&&Object.keys(s.marks).length>0);o?.marks&&(a=o.marks)}return{yText:n,emptyMarks:a}}function la(e,t,n){const r=_[t.type];if(!r)return;let i={
237
+ id:String(t.id??P())};for(const a of r.attrs){const o=a.field??a.attr;let s=t[o];o==="leftIndent"&&typeof s=="number"?s=s===0?0:We(s):o==="firstLineIndent"&&typeof s=="number"&&(s=s===0?0:He(s));const c=er(
238
+ a,s);c!==null&&(i[a.attr]=c)}if(r.type==="paragraph"){const a=$e(t);a!==void 0&&(i.pagination=a)}t.type==="paragraph"&&n&&z(n)&&(i=po(n,i));for(const[a,o]of Object.entries(i))e.setAttribute(a,o)}function ua(e,t){
239
+ const n=t,r=_[n.type];if(!r)return;const i=String(n.id??P());e.getAttribute("id")!==i&&e.setAttribute("id",i);for(const a of r.attrs){const o=a.field??a.attr;let s=n[o];o==="leftIndent"&&typeof s=="nu\
240
+ mber"?s=s===0?0:We(s):o==="firstLineIndent"&&typeof s=="number"&&(s=s===0?0:He(s));const c=er(a,s);if(c===null){const l=Z(e,a.attr);l!==void 0&&l!==""&&pt(e,a.attr)}else Z(e,a.attr)!==c&&e.setAttribute(
241
+ a.attr,c)}if(r.type==="paragraph"){const a=$e(n);a===void 0?pt(e,"pagination"):e.setAttribute("pagination",a)}}function rr(e,t){const n=e.children;if(!Array.isArray(n))return e;const r=n.flatMap(i=>{if(i?.
242
+ type==="text"){const a=t(i);return Array.isArray(a)?a:[a]}return[rr(i,t)]});return{...e,children:r}}function jt(e,t){const n=e,r=_[n.type]??_.paragraph,i=new S.XmlElement(r.type);la(i,n,t);let a=0;switch(r.
243
+ children){case"text":{const{yText:o,emptyMarks:s}=ca(n.children??[],t);i.insert(a++,[o]),s&&i.setAttribute("_emptyTextMarks",JSON.stringify(s));break}case"rawtext":{const o=new S.XmlText,s=typeof n.content==
244
+ "string"?n.content:"";s&&fe(o,0,s),i.insert(a++,[o]);break}case"blocks":case"list-items":case"table-rows":{const o=n.children??[];for(const s of o)i.insert(a++,[jt(s,t)]);break}}return i}function ye(e,t,n,r){
245
+ const i=a=>e.find(o=>o.type==="header-footer"&&o.side===t&&o.slot===n&&o.sectionIndex===a);if(r!==void 0){const a=i(r);if(a)return a}return i(void 0)}function da(e,t,n,r){if(n===1){const i=ye(e,t,"fir\
246
+ st",r);if(i)return i}if(n%2===0){const i=ye(e,t,"even",r);if(i)return i}return ye(e,t,"default",r)}const xe=[void 0,"center","right"];function fa(e,t){const n=xe[e];return{type:"paragraph",id:P(),children:[
247
+ {type:"text",text:"",...t?{marks:{fontFamily:t}}:{}}],...n?{align:n}:{}}}function ga(e,t){if(!t)return e;let n=!1;const r=e.children.map(i=>i.type!=="text"||i.marks?.fontFamily?i:(n=!0,{...i,marks:{...i.
248
+ marks??{},fontFamily:t}}));return n?{...e,children:r}:e}function pa(e,t){const n=xe[t];return!n||e.align?e:{...e,align:n}}function or(e,t,n,r,i){const a=n??[],o=s=>a[s]?ga(pa(a[s],s),r):fa(s,r);return{
249
+ type:"header-footer",id:P(),side:e,slot:t,...i!==void 0?{sectionIndex:i}:{},children:[o(0),o(1),o(2)]}}function ir(e){return!!e?.children.some(t=>t.type==="text"&&t.text.trim()!=="")}function ma(e){return e.
250
+ children.some(t=>ir(t))}function Bt(e){const t=e.children,n=[2,1,0].find(i=>ir(t[i]))??-1;if(n===-1)return;const r=[];for(let i=0;i<=n;i++){i>0&&r.push({type:"text",text:" "});for(const a of t[i]?.children??
251
+ [])a.type==="text"&&a.text&&r.push(a)}return{type:"paragraph",id:e.id?`${e.id}-zone`:P(),children:r}}function ar(e){const t=[[],[],[]],n=e?.[0],r=!!n?.children.some(o=>o.type==="text"&&o.text.includes(
252
+ " "));let i=!r&&n?.align==="right"?2:!r&&n?.align==="center"?1:0;const a=n?.children??[];for(const o of a)o.type==="text"&&o.text.split(" ").forEach((s,c)=>{c>0&&i<2&&(i+=1),s&&t[i].push({type:"text",
253
+ text:s,...o.marks?{marks:{...o.marks}}:{}})});for(const o of e?.slice(1)??[])for(const s of o.children)s.type==="text"&&s.text&&t[0].push({...s});return t.map((o,s)=>({type:"paragraph",id:P(),children:o.
254
+ length>0?o:[{type:"text",text:""}],...xe[s]?{align:xe[s]}:{}}))}function sr(e){const t={},n={};for(const r of e){if(r.type!=="header-footer"||r.sectionIndex!==void 0)continue;const i=Bt(r);if(!i)continue;
255
+ const a=r.side==="header"?t:n;a[r.slot]=[i]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:{}}}function ha(e,t){const n={},r={};for(const i of["header","footer"])
256
+ for(const a of["default","first","even"]){const o=ye(e,i,a,t);if(!o)continue;const s=Bt(o);if(!s)continue;const c=i==="header"?n:r;c[a]=[s]}return{...Object.keys(n).length>0?{headers:n}:{},...Object.keys(
257
+ r).length>0?{footers:r}:{}}}function ba(e){return e.some(t=>t.type==="header-footer"&&t.sectionIndex!==void 0)}function _t(e,t,n){const r=[];for(const[i,a]of[["header",e],["footer",t]])if(a)for(const o of[
258
+ "default","first","even"]){const s=a[o];!s||s.length===0||r.push(or(i,o,ar(s),n))}return r}function ya(e){for(const t of e)if(!(t.type==="header-footer"||t.type==="footnote")){if(t.type==="paragraph"){
259
+ for(const n of t.children)if(n.type==="text"&&n.marks?.fontFamily)return n.marks.fontFamily}else if(t.type==="list"){for(const n of t.children)for(const r of n.children)if(r.type==="text"&&r.marks?.fontFamily)
260
+ return r.marks.fontFamily}}}function xa(e){let t="";for(const r of e?.children??[])r.type==="text"&&(r.marks?.field==="page"?t+="{PAGE}":r.marks?.field==="numPages"?t+="{PAGES}":t+=r.text);const n=t.replace(
261
+ /\s+/g," ").trim();return n.length>60?`${n.slice(0,59)}…`:n}const cr={default:"default","default page":"default","default pages":"default",all:"default","all pages":"default",first:"first","first pa\
262
+ ge":"first",title:"first","title page":"first",titlepg:"first",even:"even","even page":"even","even pages":"even"};function Sa(e){if(e==null)return;if(typeof e!="string")return null;const t=e.trim().toLowerCase().
263
263
  replace(/[\s_-]+/g," ");return Object.prototype.hasOwnProperty.call(cr,t)?cr[t]:null}function wa(e){const t=new Set,n=[];for(const r of e){if(r.type!=="header-footer")continue;const i=r.sectionIndex===
264
264
  void 0?"all sections":`section ${r.sectionIndex+1} only`,a=`${r.side}:${r.slot}:${r.sectionIndex??""}`,o=t.has(a);t.add(a);const s=["left","center","right"].map((c,l)=>{const u=xa(r.children[l]);return u?
265
265
  `${c} ${JSON.stringify(u)}`:null}).filter(c=>c!==null);n.push(`${r.side} ${r.slot} (${i})${o?" [duplicate, not rendered]":""}: ${s.length>0?s.join(" | "):"(empty)"}`)}return n}function ka(e,t){const n=[
@@ -267,10 +267,10 @@ void 0?"all sections":`section ${r.sectionIndex+1} only`,a=`${r.side}:${r.slot}:
267
267
  return null}const lr=["decimal","lowerRoman","upperRoman"],va=3999,Pa=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function $t(e){
268
268
  return typeof e=="string"&&lr.includes(e)}function Aa(e){let t=e,n="";for(const[r,i]of Pa)for(;t>=r;)n+=i,t-=r;return n}function ur(e,t="decimal"){if(!Number.isFinite(e))return"";const n=Math.round(e);
269
269
  if((t==="lowerRoman"||t==="upperRoman")&&n>=1&&n<=va){const r=Aa(n);return t==="lowerRoman"?r.toLowerCase():r}return String(n)}const Gt=["top","right","bottom","left"],Na=["single","double","dotted","\
270
- dashed"];function ne(e){if(e===null||e==="")return null;if(e===void 0)return;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.
270
+ dashed"];function re(e){if(e===null||e==="")return null;if(e===void 0)return;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.
271
271
  offsetFrom==="page"?"page":"text",display:t.display==="firstPage"||t.display==="notFirstPage"?t.display:"allPages",zOrder:t.zOrder==="back"?"back":"front"};for(const r of Gt){const i=t[r];if(i!=null){
272
272
  if(!Na.includes(i.style)||typeof i.color!="string"||!/^#[0-9a-f]{6}$/i.test(i.color)||typeof i.widthPt!="number"||!Number.isFinite(i.widthPt)||i.widthPt<.25||i.widthPt>12||typeof i.spacePt!="number"||
273
- !Number.isFinite(i.spacePt)||i.spacePt<0||i.spacePt>31)return;n[r]={style:i.style,color:i.color.toLowerCase(),widthPt:i.widthPt,spacePt:i.spacePt}}}return n}function Xt(e){const t=ne(e);return t===void 0?
273
+ !Number.isFinite(i.spacePt)||i.spacePt<0||i.spacePt>31)return;n[r]={style:i.style,color:i.color.toLowerCase(),widthPt:i.widthPt,spacePt:i.spacePt}}}return n}function Xt(e){const t=re(e);return t===void 0?
274
274
  void 0:t===null?"":JSON.stringify(t)}function Ia(e,t,n,r,i){if(!e||e.display==="firstPage"&&!i||e.display==="notFirstPage"&&i)return[];const a=d=>{const g=e[d]?.spacePt??0,p=(e[d]?.widthPt??0)/2;return e.
275
275
  offsetFrom==="page"?g+p:r[d]-g-p},o=Math.max(0,a("left")),s=Math.min(t,t-a("right")),c=Math.max(0,a("top")),l=Math.min(n,n-a("bottom")),u={top:[o,c,s,c],right:[s,c,s,l],bottom:[o,l,s,l],left:[o,c,o,l]};
276
276
  return Gt.flatMap(d=>{const g=e[d];if(!g)return[];const[p,f,h,b]=u[d];return[{...g,x1:p,y1:f,x2:h,y2:b}]})}function Ma(e,t){e.save(),e.globalAlpha=1,e.lineCap="square",e.scale(96/72,96/72);for(const n of t){
@@ -279,8 +279,8 @@ double"?[-n.widthPt/3,n.widthPt/3]:[0];for(const i of r){const a=n.x1===n.x2?i:0
279
279
  if(!e)return;const t={offsetFrom:e.getAttribute("w:offsetFrom")==="page"?"page":"text",display:e.getAttribute("w:display")||"allPages",zOrder:e.getAttribute("w:zOrder")==="back"?"back":"front"};for(const n of Gt){
280
280
  const r=Array.from(e.children).find(o=>o.localName===n);if(!r)continue;const i=r.getAttribute("w:val");if(i==="none"||i==="nil")continue;if(r.hasAttribute("w:themeColor")||["1","true","on"].includes(r.
281
281
  getAttribute("w:shadow")??"")||["1","true","on"].includes(r.getAttribute("w:frame")??"")||Array.from(r.attributes).some(o=>o.namespaceURI==="http://schemas.openxmlformats.org/officeDocument/2006/relat\
282
- ionships"))return;const a=r.getAttribute("w:color")||"auto";t[n]={style:i,color:a==="auto"?"#000000":`#${a}`,widthPt:Number(r.getAttribute("w:sz")||8)/8,spacePt:Number(r.getAttribute("w:space")||0)}}return ne(
283
- t)??void 0}function dr(e){const t=ne(e?.pageBorders),n=e?.oxmlSectPr||"";if(t===void 0)return n||void 0;const r=n.replace(/<w:pgBorders\b[^>]*(?:\/>|>[\s\S]*?<\/w:pgBorders>)/g,"");if(t===null)return r||
282
+ ionships"))return;const a=r.getAttribute("w:color")||"auto";t[n]={style:i,color:a==="auto"?"#000000":`#${a}`,widthPt:Number(r.getAttribute("w:sz")||8)/8,spacePt:Number(r.getAttribute("w:space")||0)}}return re(
283
+ t)??void 0}function dr(e){const t=re(e?.pageBorders),n=e?.oxmlSectPr||"";if(t===void 0)return n||void 0;const r=n.replace(/<w:pgBorders\b[^>]*(?:\/>|>[\s\S]*?<\/w:pgBorders>)/g,"");if(t===null)return r||
284
284
  void 0;const i=["top","left","bottom","right"].map(a=>{const o=t[a];return o?`<w:${a} w:val="${o.style}" w:color="${o.color.slice(1).toUpperCase()}" w:sz="${Math.round(o.widthPt*8)}" w:space="${Math.round(
285
285
  o.spacePt)}"/>`:""}).join("");return`${r}<w:pgBorders w:offsetFrom="${t.offsetFrom}" w:display="${t.display}" w:zOrder="${t.zOrder}">${i}</w:pgBorders>`}function Fa(e,t){const n=/<w:pgBorders\b/.test(
286
286
  t?.oxmlSectPr??"");return dr({pageBorders:t?.pageBorders!==void 0?t.pageBorders:n?void 0:e?.pageBorders,oxmlSectPr:t?.oxmlSectPr})}const Se=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?
@@ -306,11 +306,11 @@ parseFloat(t[1]);if(Number.isFinite(n))switch((t[2]??"px").toLowerCase()){case"p
306
306
  !Number.isFinite(t)||t<=0)return;const n=e>t?"landscape":"portrait",r=Ae(Math.min(e,t)),i=Ae(Math.max(e,t));let a=N.pageSize,o=Number.POSITIVE_INFINITY;for(const s of Ea){const c=Math.abs(r-s.width)+Math.
307
307
  abs(i-s.height);c<o&&(o=c,a=s.pageSize)}return{pageSize:a,orientation:n}}const ja=0,Ba=3*F,_a=.125*F,$a=2*F,Ga=0,Xa=2*F,za=12,br=1,Da=99999,N={pageSize:"letter",orientation:"portrait",marginTopPx:Ue,marginRightPx:Ue,
308
308
  marginBottomPx:Ue,marginLeftPx:Ue,indentStepPx:L,blockSpacingPx:za,showPageNumbers:!1,pageNumberPosition:"top-right",pageNumberStart:1,pageNumberFormat:"decimal",noteMode:"footnotes",columnCount:1,columnGapTwips:720,
309
- hyphenationEnabled:!1,lineNumbering:null,pleadingGrid:null};function re(e,t,n){return Math.max(t,Math.min(n,e))}function Pe(e){return typeof e!="number"||!Number.isFinite(e)?N.marginLeftPx:re(e,ja,Ba)}
310
- function Ua(e){return typeof e!="number"||!Number.isFinite(e)?N.indentStepPx:re(e,_a,$a)}function Wa(e){return typeof e!="number"||!Number.isFinite(e)?N.blockSpacingPx:re(e,Ga,Xa)}function Ha(e){return Je(
311
- e)?e:N.pageNumberPosition}function qa(e){return typeof e!="number"||!Number.isFinite(e)?N.pageNumberStart:re(Math.round(e),br,Da)}function Va(e){return typeof e!="number"||!Number.isFinite(e)?N.columnCount:
312
- re(Math.round(e),1,12)}function Ja(e){return typeof e!="number"||!Number.isFinite(e)?N.columnGapTwips:re(Math.round(e),0,14400)}function j(e){const t=e?.pageSize&&Ye(e.pageSize)?e.pageSize:N.pageSize,
313
- n=e?.orientation==="landscape"||e?.orientation==="portrait"?e.orientation:N.orientation,r=Pe(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:ne(e?.pageBorders),marginTopPx:Pe(e?.marginTopPx??
309
+ hyphenationEnabled:!1,lineNumbering:null,pleadingGrid:null};function oe(e,t,n){return Math.max(t,Math.min(n,e))}function Pe(e){return typeof e!="number"||!Number.isFinite(e)?N.marginLeftPx:oe(e,ja,Ba)}
310
+ function Ua(e){return typeof e!="number"||!Number.isFinite(e)?N.indentStepPx:oe(e,_a,$a)}function Wa(e){return typeof e!="number"||!Number.isFinite(e)?N.blockSpacingPx:oe(e,Ga,Xa)}function Ha(e){return Je(
311
+ e)?e:N.pageNumberPosition}function qa(e){return typeof e!="number"||!Number.isFinite(e)?N.pageNumberStart:oe(Math.round(e),br,Da)}function Va(e){return typeof e!="number"||!Number.isFinite(e)?N.columnCount:
312
+ oe(Math.round(e),1,12)}function Ja(e){return typeof e!="number"||!Number.isFinite(e)?N.columnGapTwips:oe(Math.round(e),0,14400)}function j(e){const t=e?.pageSize&&Ye(e.pageSize)?e.pageSize:N.pageSize,
313
+ n=e?.orientation==="landscape"||e?.orientation==="portrait"?e.orientation:N.orientation,r=Pe(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:re(e?.pageBorders),marginTopPx:Pe(e?.marginTopPx??
314
314
  r),marginRightPx:Pe(e?.marginRightPx??r),marginBottomPx:Pe(e?.marginBottomPx??r),marginLeftPx:Pe(e?.marginLeftPx??r),indentStepPx:Ua(e?.indentStepPx),blockSpacingPx:Wa(e?.blockSpacingPx),showPageNumbers:e?.
315
315
  showPageNumbers===!0,pageNumberPosition:Ha(e?.pageNumberPosition),pageNumberStart:qa(e?.pageNumberStart),pageNumberFormat:$t(e?.pageNumberFormat)?e.pageNumberFormat:N.pageNumberFormat,...e?.pageNumberRestart===
316
316
  !0?{pageNumberRestart:!0}:{},noteMode:e?.noteMode==="endnotes"?"endnotes":"footnotes",columnCount:Va(e?.columnCount),columnGapTwips:Ja(e?.columnGapTwips),hyphenationEnabled:e?.hyphenationEnabled===!0,
@@ -345,7 +345,7 @@ m.pageNumberPosition),g=e.get(m.pageNumberStart),p=e.get(m.hyphenationEnabled),f
345
345
  t)?t:void 0;return j({pageSize:v,orientation:n==="portrait"||n==="landscape"?n:void 0,marginTopPx:typeof r=="number"?r:void 0,marginRightPx:typeof i=="number"?i:void 0,marginBottomPx:typeof a=="number"?
346
346
  a:void 0,marginLeftPx:typeof o=="number"?o:void 0,marginPx:typeof s=="number"?s:void 0,indentStepPx:typeof c=="number"?c:void 0,blockSpacingPx:typeof l=="number"?l:void 0,showPageNumbers:typeof u=="bo\
347
347
  olean"?u:void 0,pageNumberPosition:Je(d)?d:void 0,pageNumberStart:typeof g=="number"?g:void 0,pageNumberFormat:$t(e.get(m.pageNumberFormat))?e.get(m.pageNumberFormat):void 0,pageNumberRestart:e.get(m.
348
- pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof p=="boolean"?p:void 0,pageBorders:ne(e.get(m.pageBorders)),lineNumbering:typeof f=="string"?f:void 0,pleadingGrid:typeof h=="string"?h:void 0,
348
+ pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof p=="boolean"?p:void 0,pageBorders:re(e.get(m.pageBorders)),lineNumbering:typeof f=="string"?f:void 0,pleadingGrid:typeof h=="string"?h:void 0,
349
349
  columnCount:typeof b=="number"?b:void 0,columnGapTwips:typeof x=="number"?x:void 0,oxmlSectPr:typeof y=="string"&&y?y:void 0})}function Cr(e,t){for(const[n,r]of e.afterState){const i=e.beforeState.get(
350
350
  n)??0;if(i>=r)continue;const a=e.doc.store.clients.get(n);if(a)for(let o=S.findIndexSS(a,i);o<a.length&&a[o].id.clock<r;o++){const s=a[o];s instanceof S.Item&&t(s)}}}function Ie(e,t){return typeof e==
351
351
  "object"&&e!==null&&e.constructor?.name===t}function I(e){return e instanceof S.XmlElement||Ie(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="function"&&typeof e.setAttribute==
@@ -383,14 +383,14 @@ ldren");return s&&s.forEach(c=>{const l=Kt(c,t,n,r);l&&o.push([l])}),o}case"para
383
383
  heading",String(e.get("heading"))),e.get("align")!==void 0&&o.setAttribute("align",e.get("align")),e.get("lineSpacing")!==void 0&&o.setAttribute("lineSpacing",String(e.get("lineSpacing")));{const f={};
384
384
  Ge(f,e.get("pagination"));const h=$e(f);h!==void 0&&o.setAttribute("pagination",h)}{const f=e.get("styleId");typeof f=="string"&&f&&o.setAttribute("styleId",f)}{const f=e.get("direction");(f==="rtl"||
385
385
  f==="ltr")&&o.setAttribute("direction",f)}{const f=e.get("tabStops");typeof f=="string"&&f&&o.setAttribute("tabStops",f)}{const f=e.get("borders");typeof f=="string"&&f&&o.setAttribute("borders",f)}{const f=e.
386
- get("shading");typeof f=="string"&&f&&o.setAttribute("shading",f)}const s=e.get("leftIndent"),c=s===0?0:We(te(s,{indentStepPx:n,storedAsUnits:r}));c!==void 0&&o.setAttribute("leftIndent",String(c));const l=e.
387
- get("firstLineIndent"),u=l===0?0:He(te(l,{indentStepPx:n,storedAsUnits:r,firstLine:!0}));u!==void 0&&o.setAttribute("firstLineIndent",String(u));const d=e.get("content"),g=new S.XmlText;if(d){const f=ue(
388
- d);let h=0;for(const b of f)if(typeof b.insert=="string"){const x=b.attributes||{};t&&!x.fontFamily&&(x.fontFamily=t),de(g,h,b.insert,x),h+=b.insert.length}}const p=e.get("_emptyTextMarks");return p&&
386
+ get("shading");typeof f=="string"&&f&&o.setAttribute("shading",f)}const s=e.get("leftIndent"),c=s===0?0:We(ne(s,{indentStepPx:n,storedAsUnits:r}));c!==void 0&&o.setAttribute("leftIndent",String(c));const l=e.
387
+ get("firstLineIndent"),u=l===0?0:He(ne(l,{indentStepPx:n,storedAsUnits:r,firstLine:!0}));u!==void 0&&o.setAttribute("firstLineIndent",String(u));const d=e.get("content"),g=new S.XmlText;if(d){const f=de(
388
+ d);let h=0;for(const b of f)if(typeof b.insert=="string"){const x=b.attributes||{};t&&!x.fontFamily&&(x.fontFamily=t),fe(g,h,b.insert,x),h+=b.insert.length}}const p=e.get("_emptyTextMarks");return p&&
389
389
  o.setAttribute("_emptyTextMarks",JSON.stringify(p)),o.push([g]),o}}}function as(e,t){if(!e)return null;const n=new S.XmlElement("list-item");n.setAttribute("id",e.get("id")||P()),e.get("checked")!==void 0&&
390
390
  n.setAttribute("checked",String(e.get("checked"))),typeof e.get("indentLevel")=="number"&&e.get("indentLevel")>0&&n.setAttribute("indentLevel",String(e.get("indentLevel"))),(e.get("direction")==="rtl"||
391
- e.get("direction")==="ltr")&&n.setAttribute("direction",e.get("direction"));const r=e.get("content"),i=new S.XmlText;if(r){const o=ue(r);let s=0;for(const c of o)if(typeof c.insert=="string"){const l=c.
392
- attributes||{};t&&!l.fontFamily&&(l.fontFamily=t),de(i,s,c.insert,l),s+=c.insert.length}}const a=e.get("_emptyTextMarks");return a&&n.setAttribute("_emptyTextMarks",JSON.stringify(a)),n.push([i]),n}const Rr={
393
- indentStepPx:j(void 0).indentStepPx,storedAsUnits:!1};function Or(e,t,n=!1){return te(e,{indentStepPx:t.indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function ss(e,t){return cs(e,t)}function cs(e,t){
391
+ e.get("direction")==="ltr")&&n.setAttribute("direction",e.get("direction"));const r=e.get("content"),i=new S.XmlText;if(r){const o=de(r);let s=0;for(const c of o)if(typeof c.insert=="string"){const l=c.
392
+ attributes||{};t&&!l.fontFamily&&(l.fontFamily=t),fe(i,s,c.insert,l),s+=c.insert.length}}const a=e.get("_emptyTextMarks");return a&&n.setAttribute("_emptyTextMarks",JSON.stringify(a)),n.push([i]),n}const Rr={
393
+ indentStepPx:j(void 0).indentStepPx,storedAsUnits:!1};function Or(e,t,n=!1){return ne(e,{indentStepPx:t.indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function ss(e,t){return cs(e,t)}function cs(e,t){
394
394
  const n=new S.Doc({gc:!0,autoLoad:!1,shouldLoad:!1}),r=n.getXmlFragment("content"),i=n.getMap("metadata");if(t?.sharedStyles&&i.set("sharedStylesVersion",1),e.title&&i.set("title",e.title),e.pageless!==
395
395
  void 0?i.set("pageless",e.pageless):i.has("pageless")||i.set("pageless",!1),qt(i,e.pageLayout),e.coreProperties&&Object.keys(e.coreProperties).length>0&&i.set("coreProperties",e.coreProperties),e.fontSubstitutes&&
396
396
  Object.keys(e.fontSubstitutes).length>0&&i.set("fontSubstitutes",e.fontSubstitutes),e.comments&&e.comments.length>0){const a=n.getMap("comments");for(const o of e.comments)a.set(o.id,o)}if(e.sdtWrappers&&
@@ -398,14 +398,14 @@ e.sdtWrappers.length>0){const a=n.getMap("sdt-wrappers");for(const o of e.sdtWra
398
398
  a.set(o.id,o)}return e.stylesXml&&i.set("stylesXml",e.stylesXml),e.stylesheet&&e.stylesheet.paragraphStyles.length>0&&i.set("stylesheet",e.stylesheet),e.docxSource&&i.set("docxSource",e.docxSource),e.
399
399
  watermark&&i.set("watermark",e.watermark),e.chromeImages&&e.chromeImages.length>0&&hn(n,e.chromeImages),n.transact(()=>{const a=n.getXmlFragment("chrome"),o=e.chrome&&e.chrome.length>0?e.chrome:e.children.
400
400
  some(l=>l.type==="header-footer")?e.children.filter(l=>l.type==="header-footer"):_t(e.headers,e.footers),s=n.getXmlFragment("notes"),c=e.notes&&e.notes.length>0?e.notes:e.children.filter(l=>l.type==="\
401
- footnote");e.children.forEach(l=>{l.type==="header-footer"||l.type==="footnote"||oe(l,r)}),o.forEach(l=>{oe(l,a)}),c.forEach(l=>{oe(l,s)})}),n}function Lr(e,t){const n=e.getXmlFragment("content"),r=e.
401
+ footnote");e.children.forEach(l=>{l.type==="header-footer"||l.type==="footnote"||ie(l,r)}),o.forEach(l=>{ie(l,a)}),c.forEach(l=>{ie(l,s)})}),n}function Lr(e,t){const n=e.getXmlFragment("content"),r=e.
402
402
  getMap("metadata");e.transact(()=>{if(t.title&&r.set("title",t.title),t.pageless!==void 0&&r.set("pageless",t.pageless),qt(r,t.pageLayout),t.coreProperties&&Object.keys(t.coreProperties).length>0&&r.set(
403
403
  "coreProperties",t.coreProperties),t.fontSubstitutes&&Object.keys(t.fontSubstitutes).length>0&&r.set("fontSubstitutes",t.fontSubstitutes),t.comments&&t.comments.length>0){const c=e.getMap("comments");
404
404
  for(const l of t.comments)c.set(l.id,l)}if(t.sdtWrappers&&t.sdtWrappers.length>0){const c=e.getMap("sdt-wrappers");for(const l of t.sdtWrappers)c.set(l.id,l)}if(t.oxmlRanges&&t.oxmlRanges.length>0){const c=e.
405
405
  getMap("oxml-ranges");for(const l of t.oxmlRanges)c.set(l.id,l)}t.stylesXml&&r.set("stylesXml",t.stylesXml),t.stylesheet&&t.stylesheet.paragraphStyles.length>0&&r.set("stylesheet",t.stylesheet),t.docxSource&&
406
406
  r.set("docxSource",t.docxSource),t.watermark&&r.set("watermark",t.watermark),t.chromeImages&&t.chromeImages.length>0&&hn(e,t.chromeImages);const i=e.getXmlFragment("chrome"),a=t.chrome&&t.chrome.length>
407
407
  0?t.chrome:t.children.some(c=>c.type==="header-footer")?t.children.filter(c=>c.type==="header-footer"):_t(t.headers,t.footers),o=e.getXmlFragment("notes"),s=t.notes&&t.notes.length>0?t.notes:t.children.
408
- filter(c=>c.type==="footnote");t.children.forEach(c=>{c.type==="header-footer"||c.type==="footnote"||oe(c,n)}),a.forEach(c=>{oe(c,i)}),s.forEach(c=>{oe(c,o)})})}function ls(e,t){const n=Gr(e,t);if(!n)
408
+ filter(c=>c.type==="footnote");t.children.forEach(c=>{c.type==="header-footer"||c.type==="footnote"||ie(c,n)}),a.forEach(c=>{ie(c,i)}),s.forEach(c=>{ie(c,o)})})}function ls(e,t){const n=Gr(e,t);if(!n)
409
409
  return null;const r=e.getMap("metadata"),i=j(Ke(r));return Qe(n,{indentStepPx:i.indentStepPx,storedAsUnits:Vt(r)})}function Er(e){const t=e.getMap("metadata"),n=t?.get("title"),r=t?.get("pageless"),i=Ke(
410
410
  t),a={indentStepPx:j(i).indentStepPx,storedAsUnits:Vt(t)},o=e.getXmlFragment("content");let s;if(o.length>0){s=[];for(const k of o.toArray())if(I(k)){const w=Qe(k,a);w&&s.push(w)}}else{const k=e.getArray(
411
411
  "paragraphs"),w=t?.get("defaultFontFamily");s=[],k.forEach(G=>{const O=Me(G,w,a);O&&s.push(O)})}const c={type:"doc",children:s};n&&(c.title=n),r!==void 0&&(c.pageless=r),i&&(c.pageLayout=i);const l=t?.
@@ -419,7 +419,7 @@ w.set(O.id,Fe)});const G=O=>O.blockIds?.[0]??O.startBlockId??"";k.sort((O,Fe)=>(
419
419
  k}}const R=e.getMap("oxml-ranges");if(R.size>0){const k=[];R.forEach(w=>{w&&typeof w=="object"&&k.push(w)}),k.length>0&&(k.sort((w,G)=>w.id.localeCompare(G.id)),c.oxmlRanges=k)}const q=e.getMap("metad\
420
420
  ata").get("stylesXml");typeof q=="string"&&q.length>0&&(c.stylesXml=q);const V=e.getMap("metadata").get("stylesheet");V&&typeof V=="object"&&Array.isArray(V.paragraphStyles)&&V.paragraphStyles.length>
421
421
  0&&(c.stylesheet=V);const J=e.getMap("metadata").get("docxSource");J&&typeof J=="object"&&Array.isArray(J.spans)&&(c.docxSource=J);const it=e.getMap("metadata").get("watermark");typeof it=="string"&&it.
422
- length>0&&(c.watermark=it);const an=ut(e);return an&&(c.chromeImages=an),c}function oe(e,t){t.push([jt(e,t.doc??void 0)])}function Qe(e,t=Rr){return be(e,t)}function Me(e,t,n=Rr){const r=e.get("type")||
422
+ length>0&&(c.watermark=it);const an=ut(e);return an&&(c.chromeImages=an),c}function ie(e,t){t.push([jt(e,t.doc??void 0)])}function Qe(e,t=Rr){return be(e,t)}function Me(e,t,n=Rr){const r=e.get("type")||
423
423
  "paragraph",i=e.get("id")||P();switch(r){case"page-break":const a={type:"page-break",id:i};{const o=e.get("diffState"),s=e.get("suggestionId");(o==="insert"||o==="delete"||o==="equal")&&(a.diffState=o),
424
424
  typeof s=="string"&&(a.suggestionId=s)}return a;case"section-break":{const o={type:"section-break",id:i},s=e.get("layout");if(typeof s=="string")try{o.layout=JSON.parse(s)}catch{}const c=e.get("breakT\
425
425
  ype");(c==="nextPage"||c==="continuous"||c==="evenPage"||c==="oddPage")&&(o.breakType=c);const l=e.get("diffState"),u=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&(o.diffState=
@@ -452,11 +452,11 @@ y)}{const y=e.get("tabStops");typeof y=="string"&&y&&(o.tabStops=y)}{const y=e.g
452
452
  get("oxmlAttrs");typeof y=="string"&&y&&(o.oxmlAttrs=y);const v=e.get("oxmlPPr");typeof v=="string"&&v&&(o.oxmlPPr=v)}typeof g=="string"&&(o.structuralSuggestionId=g),(p==="insert"||p==="delete"||p===
453
453
  "split"||p==="merge"||p==="change")&&(o.structuralSuggestionKind=p),(f==="before"||f==="after")&&(o.structuralSuggestionRole=f);const h=Or(u,n);u===0?o.leftIndent=0:h!==void 0&&(o.leftIndent=h);const b=Or(
454
454
  d,n,!0);d===0?o.firstLineIndent=0:b!==void 0&&(o.firstLineIndent=b);const x=e.get("content");if(x){const y=jr(x);if(y.length>0)o.children=y;else{const v=e.get("_emptyTextMarks"),C={type:"text",text:""};
455
- v&&Object.keys(v).length>0?C.marks=v:C.marks={fontFamily:pe},o.children=[C]}}else o.children=[{type:"text",text:"",marks:{fontFamily:pe}}];return t&&o.children.forEach(y=>{y.type==="text"&&(y.marks={fontFamily:t,
455
+ v&&Object.keys(v).length>0?C.marks=v:C.marks={fontFamily:ee},o.children=[C]}}else o.children=[{type:"text",text:"",marks:{fontFamily:ee}}];return t&&o.children.forEach(y=>{y.type==="text"&&(y.marks={fontFamily:t,
456
456
  ...y.marks||{}})}),o}}}function us(e){if(!e)return null;const t={type:"list-item",id:e.get("id")||P(),children:[]},n=e.get("checked");n!==void 0&&(t.checked=n);const r=e.get("indentLevel");typeof r=="\
457
- number"&&r>0&&(t.indentLevel=r);for(const o of ce){const s=e.get(o);typeof s=="number"&&Number.isFinite(s)&&s>=0&&(t[o]=s)}const i=e.get("direction");(i==="rtl"||i==="ltr")&&(t.direction=i);const a=e.
458
- get("content");if(a){const o=jr(a);if(o.length>0)t.children=o;else{const s=e.get("_emptyTextMarks");t.children=[{type:"text",text:"",marks:s||{fontFamily:pe}}]}}else t.children=[{type:"text",text:"",marks:{
459
- fontFamily:pe}}];return t}function jr(e){const t=[];return ue(e).forEach(n=>{if(typeof n.insert=="string"){const r=n.attributes||{},i={type:"text",text:n.insert};i.marks=St(r),t.push(i)}}),_n(t)}function et(e){
457
+ number"&&r>0&&(t.indentLevel=r);for(const o of le){const s=e.get(o);typeof s=="number"&&Number.isFinite(s)&&s>=0&&(t[o]=s)}const i=e.get("direction");(i==="rtl"||i==="ltr")&&(t.direction=i);const a=e.
458
+ get("content");if(a){const o=jr(a);if(o.length>0)t.children=o;else{const s=e.get("_emptyTextMarks");t.children=[{type:"text",text:"",marks:s||{fontFamily:ee}}]}}else t.children=[{type:"text",text:"",marks:{
459
+ fontFamily:ee}}];return t}function jr(e){const t=[];return de(e).forEach(n=>{if(typeof n.insert=="string"){const r=n.attributes||{},i={type:"text",text:n.insert};i.marks=St(r),t.push(i)}}),_n(t)}function et(e){
460
460
  return e.getXmlFragment("content")}const Br="block-id-repair";function ds(e,t){let n=0;const r=i=>{for(const a of i.toArray())I(a)&&(a.getAttribute("id")===t&&n++,r(a))};for(const i of["content","chro\
461
461
  me","notes"])e.share.has(i)&&r(e.getXmlFragment(i));return n}function fs(e){const t=new Set,n=r=>{if(r instanceof S.XmlFragment){if(I(r)){const i=r.getAttribute("id");i&&t.add(i)}for(const i of r.toArray())
462
462
  n(i)}};return Cr(e,r=>{if(r.deleted)return;const i=r.content;if(i instanceof S.ContentType)n(i.type);else if(r.parentSub==="id"&&I(r.parent)){const a=r.parent.getAttribute("id");a&&t.add(a)}}),t}function tt(e,t,n){
@@ -473,17 +473,17 @@ const c=["content","chrome","notes"].filter(f=>e.share.has(f)).map(f=>e.getXmlFr
473
473
  "id");if(b&&(l.has(b)&&(d=!0),l.add(b),!s||s.has(b))){const x=u.get(b);x?x.push(h):u.set(b,[h])}g(h)}};if(c.forEach(g),!d&&!o)return a;const p=new Set;if(t.shouldDrop)for(const f of u.values()){if(f.length<
474
474
  2)continue;const h=f.filter(b=>t.shouldDrop(b));if(!(h.length===0||h.length===f.length))for(const b of h)p.add(b),i.push(b.getAttribute("id"))}return e.transact(()=>{for(const f of c)_r(f,n,r,l,p);if(o){
475
475
  const f=e.getArray("paragraphs");$r(f,n,r)}},Br),{duplicatesFound:r.length+i.length,remappedIds:r,droppedIds:i}}function hs(e){return Yt(e)?et(e).length:Ze(e)?e.getArray("paragraphs").length:0}function Gr(e,t){
476
- const n=os(e),r=n.get(t)??null,i=r?r._item:null;return r&&!i?.deleted&&r.getAttribute("id")===t?r:(Jt.get(e).rebuild(),n.get(t)??null)}function ie(e,t){const n=e.toArray();for(let r=0;r<n.length;r++){
476
+ const n=os(e),r=n.get(t)??null,i=r?r._item:null;return r&&!i?.deleted&&r.getAttribute("id")===t?r:(Jt.get(e).rebuild(),n.get(t)??null)}function ae(e,t){const n=e.toArray();for(let r=0;r<n.length;r++){
477
477
  const i=n[r];if(I(i)){if(i.getAttribute("id")===t)return{yBlock:i,yParent:e,index:r};if(i.nodeName==="list"||i.nodeName==="container"||i.nodeName==="footnote"||i.nodeName==="header-footer"||i.nodeName===
478
- "table-cell"){const a=ie(i,t);if(a)return a}if(i.nodeName==="table"){const a=i.toArray();for(let o=0;o<a.length;o++){const s=a[o];if(I(s)&&s.nodeName==="table-row"){if(s.getAttribute("id")===t)return{
479
- yBlock:s,yParent:i,index:o};const c=ie(s,t);if(c)return c}}}if(i.nodeName==="table-row"){const a=ie(i,t);if(a)return a}}}return null}function bs(e,t){const n=et(e),r=ie(n,t);return r||ie(e.getXmlFragment(
480
- "chrome"),t)||ie(e.getXmlFragment("notes"),t)}function ys(e){for(const t of e.toArray())if(ts(t))return t;return null}let xs=0;function Ss(){const e=Date.now().toString(36),t=Math.random().toString(36).
478
+ "table-cell"){const a=ae(i,t);if(a)return a}if(i.nodeName==="table"){const a=i.toArray();for(let o=0;o<a.length;o++){const s=a[o];if(I(s)&&s.nodeName==="table-row"){if(s.getAttribute("id")===t)return{
479
+ yBlock:s,yParent:i,index:o};const c=ae(s,t);if(c)return c}}}if(i.nodeName==="table-row"){const a=ae(i,t);if(a)return a}}}return null}function bs(e,t){const n=et(e),r=ae(n,t);return r||ae(e.getXmlFragment(
480
+ "chrome"),t)||ae(e.getXmlFragment("notes"),t)}function ys(e){for(const t of e.toArray())if(ts(t))return t;return null}let xs=0;function Ss(){const e=Date.now().toString(36),t=Math.random().toString(36).
481
481
  substring(2,9),n=(xs++).toString(36);return`${e}-${t}-${n}`}const Xr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function zr(){const e=new Uint8Array(8);crypto.getRandomValues(e);
482
482
  let t="";for(let n=0;n<8;n++)t+=Xr[e[n]%Xr.length];return t}const Zt="seed-claims",ws="revise:seed-race-repair";function Qt(e){const t=[];for(const n of e.toArray())if(n instanceof S.XmlElement){const r=n.
483
483
  getAttribute("id");r&&t.push(r)}return t}function Dr(e){return{blockIds:Qt(e.getXmlFragment("content")),chromeIds:Qt(e.getXmlFragment("chrome")),noteIds:Qt(e.getXmlFragment("notes")),commentIds:[...e.
484
- getMap("comments").keys()],sdtIds:[...e.getMap("sdt-wrappers").keys()],oxmlRangeIds:[...e.getMap("oxml-ranges").keys()]}}function ae(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function en(e,t){
485
- const n=Dr(e);e.transact(()=>{Lr(e,t);const r=Dr(e),i={clientId:e.clientID,blockIds:ae(r.blockIds,n.blockIds),chromeIds:ae(r.chromeIds,n.chromeIds),noteIds:ae(r.noteIds,n.noteIds),commentIds:ae(r.commentIds,
486
- n.commentIds),sdtIds:ae(r.sdtIds,n.sdtIds),oxmlRangeIds:ae(r.oxmlRangeIds,n.oxmlRangeIds)},a=`${Date.now().toString(36).padStart(9,"0")}-${zr()}`;e.getMap("metadata").set("seedNonce",a),e.getMap(Zt).set(
484
+ getMap("comments").keys()],sdtIds:[...e.getMap("sdt-wrappers").keys()],oxmlRangeIds:[...e.getMap("oxml-ranges").keys()]}}function se(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function en(e,t){
485
+ const n=Dr(e);e.transact(()=>{Lr(e,t);const r=Dr(e),i={clientId:e.clientID,blockIds:se(r.blockIds,n.blockIds),chromeIds:se(r.chromeIds,n.chromeIds),noteIds:se(r.noteIds,n.noteIds),commentIds:se(r.commentIds,
486
+ n.commentIds),sdtIds:se(r.sdtIds,n.sdtIds),oxmlRangeIds:se(r.oxmlRangeIds,n.oxmlRangeIds)},a=`${Date.now().toString(36).padStart(9,"0")}-${zr()}`;e.getMap("metadata").set("seedNonce",a),e.getMap(Zt).set(
487
487
  a,i)})}function Ur(e){const t=e._item;return typeof t?.id?.client=="number"?t.id.client:null}function tn(e,t,n,r){if(t.size===0)return 0;const i=new Set,a=[],o=new Set;if(r!==void 0){for(const s of e.
488
488
  toArray())if(s instanceof S.XmlElement&&Ur(s)===r){const c=s.getAttribute("id");c&&o.add(c)}}for(let s=0;s<e.length;s++){const c=e.get(s);if(!(c instanceof S.XmlElement))continue;const l=c.getAttribute(
489
489
  "id")??"";t.has(l)&&(n.has(l)&&(r!==void 0&&o.has(l)?Ur(c)===r&&!i.has(l):!i.has(l))?i.add(l):a.push(s))}for(let s=a.length-1;s>=0;s--)e.delete(a[s],1);return a.length}function Wr(e){const t=e.getMap(
@@ -499,22 +499,22 @@ let t;try{t=await import("jsdom")}catch(i){const a=new Error("@reviseio/editor/s
499
499
  vs(()=>new n("<!doctype html><html><body></body></html>",{virtualConsole:new r,url:"https://headless.revise-sdk.invalid/"}))}const As=["docx","odt","rtf","markdown","txt","html"];function Ns(e){const t=cn(
500
500
  e);if(t&&As.includes(t.id))return t.id;throw new Error(`Revise: cannot read "${e}" on the server. Readable formats: .docx, .odt, .rtf, .md, .txt, .html.`)}async function on(e,t){await Ce();const n=Ns(
501
501
  t);return ln(e,t,n)}async function rt(e,t){await Ce();const n=await at(e,"docx",{docx:t?.originalDocx?{graft:{originalDocx:t.originalDocx,...t.onGraftOutcome?{onOutcome:t.onGraftOutcome}:{}}}:void 0});
502
- return new Uint8Array(await n.arrayBuffer())}async function Is(e,t){const n=await on(e,t),r=nn();return en(r,n),await Hr(r,n,e),r}async function Hr(e,t,n){if(!t.docxSource?.sourceHash)return;const{storeDocxCarrier:r}=await import("./DocxGraft-L10HXM3U.js");
502
+ return new Uint8Array(await n.arrayBuffer())}async function Is(e,t){const n=await on(e,t),r=nn();return en(r,n),await Hr(r,n,e),r}async function Hr(e,t,n){if(!t.docxSource?.sourceHash)return;const{storeDocxCarrier:r}=await import("./DocxGraft-BbE-AaM5.js");
503
503
  await r(e,n,{hash:t.docxSource.sourceHash})}async function Ms(e,t,n){if(Tr(e))return Wr(e),!1;const r=await on(t,n);return en(e,r),await Hr(e,r,t),!0}function ot(e){return Er(e)}async function Cs(e){const{
504
- loadDocxCarrier:t}=await import("./DocxGraft-L10HXM3U.js"),n=t(e);return rt(ot(e),{...n?{originalDocx:n.bytes}:{}})}async function Fs(e,t={}){await Ce();const{format:n="docx",mode:r="review",title:i}=t,
505
- a=typeof e.getXmlFragment=="function";if(n==="docx"&&r==="review")return a?Cs(e):rt(e);let o=a?ot(e):e;if(r==="final"){const{scrubDocument:l}=await import("./DocumentScrubber-BZQn_z92.js");o=l(o,{removeComments:!0,
506
- resolveSuggestions:"accept"}).doc}if(n==="docx"){const l=a?(await import("./DocxGraft-L10HXM3U.js")).loadDocxCarrier(e):null;return rt(o,l?{originalDocx:l.bytes}:void 0)}const{DocumentMutator:s}=await import("./DocumentMutator-Bat_oLBQ.js").
507
- then(l=>l.y);o=s.materializeAcceptedSuggestions(o);const c=await at(o,n,n==="html"?{html:{title:i,includeWrapper:!0}}:{});return typeof c=="string"?new TextEncoder().encode(c):new Uint8Array(await c.arrayBuffer())}
508
- async function Ts(e){const{computeSourceFidelity:t,getDocxCarrierMeta:n}=await import("./DocxGraft-L10HXM3U.js");return t(ot(e),n(e))}function Rs(e){return S.encodeStateAsUpdate(e)}function Os(e){const t=nn();
509
- return S.applyUpdate(t,e,"revise-backend"),t}async function Ls(e,t){await Ce();const{createServerDocumentSession:n}=await import("./serverDocumentSession-DGDU5Lh3.js");return n(e,t)}const Es={agentHtml:()=>import("./AgentHtmlConverter-CnnB8-WI.js").
510
- then(e=>e.p),compare:()=>import("./DocumentCompare-C8295s35.js"),documentFormats:()=>Promise.resolve().then(()=>qr),documentLayout:()=>import("./DocumentLayout-CsU5MR-3.js"),mutator:()=>import("./DocumentMutator-Bat_oLBQ.js").
511
- then(e=>e.y),documentSession:()=>import("./DocumentSession-BDcazSEv.js"),docxGraft:()=>import("./DocxGraft-L10HXM3U.js"),pageLayout:()=>Promise.resolve().then(()=>Qa),pageRenderer:()=>import("./AgentPageRenderer-DLgUGrGy.js"),
512
- scrubber:()=>import("./DocumentScrubber-BZQn_z92.js"),serverSession:()=>import("./serverDocumentSession-DGDU5Lh3.js"),xmlScan:()=>import("./xmlScan-DXjt2cTS.js")};export{Nn as $,pt as A,Qn as B,Z as C,
513
- ze as D,bs as E,ue as F,de as G,Po as H,Gr as I,et as J,wn as K,ys as L,wo as M,He as N,We as O,m as P,Zi as Q,Ar as R,go as S,rr as T,$e as U,No as V,Nt as W,Wn as X,Ct as Y,Ft as Z,Ge as _,P as a,li as a$,
514
- Cr as a0,ea as a1,na as a2,ya as a3,xe as a4,Yr as a5,Kr as a6,_t as a7,or as a8,ha as a9,mr as aA,Pr as aB,Je as aC,Dt as aD,ke as aE,qe as aF,we as aG,hr as aH,qt as aI,ms as aJ,To as aK,is as aL,xr as aM,
515
- te as aN,Ae as aO,wr as aP,ci as aQ,qn as aR,Mn as aS,fe as aT,mt as aU,It as aV,Lt as aW,In as aX,ji as aY,Ei as aZ,_o as a_,Mr as aa,ar as ab,Bt as ac,ma as ad,yo as ae,Pn as af,Ze as ag,hs as ah,Qr as ai,
516
- jo as aj,ce as ak,ko as al,ds as am,ua as an,ls as ao,ta as ap,Br as aq,Wt as ar,Sa as as,ye as at,ne as au,$t as av,lr as aw,pr as ax,Ir as ay,Ye as az,Lr as b,Ms as b$,Gi as b0,So as b1,xo as b2,Co as b3,
517
- Go as b4,Io as b5,$o as b6,Xo as b7,ve as b8,Rn as b9,oi as bA,ht as bB,kr as bC,zr as bD,Yi as bE,Un as bF,Dn as bG,Ji as bH,Jn as bI,Yn as bJ,xi as bK,yi as bL,zi as bM,Bo as bN,Jo as bO,Wo as bP,Ma as bQ,
518
- me as bR,Es as bS,nn as bT,Ls as bU,Os as bV,rt as bW,Rs as bX,Fs as bY,Is as bZ,on as b_,Ca as ba,ba as bb,Fa as bc,dr as bd,$i as be,Hn as bf,Eo as bg,Bn as bh,St as bi,L as bj,fi as bk,mi as bl,ri as bm,
519
- ai as bn,Sr as bo,ur as bp,Ia as bq,Nr as br,Ot as bs,bi as bt,U as bu,Bi as bv,gi as bw,pi as bx,hi as by,ni as bz,Ht as c,Ts as c0,ot as c1,en as c2,ss as d,yr as e,ka as f,Ss as g,da as h,wa as i,Ce as j,
520
- Tr as k,Cn as l,mo as m,ut as n,ks as o,he as p,Ke as q,j as r,Ve as s,Ut as t,be as u,sr as v,An as w,jt as x,Er as y,jn as z};
504
+ loadDocxCarrier:t}=await import("./DocxGraft-BbE-AaM5.js"),n=t(e);return rt(ot(e),{...n?{originalDocx:n.bytes}:{}})}async function Fs(e,t={}){await Ce();const{format:n="docx",mode:r="review",title:i}=t,
505
+ a=typeof e.getXmlFragment=="function";if(n==="docx"&&r==="review")return a?Cs(e):rt(e);let o=a?ot(e):e;if(r==="final"){const{scrubDocument:l}=await import("./DocumentScrubber-C4N3Qagm.js");o=l(o,{removeComments:!0,
506
+ resolveSuggestions:"accept"}).doc}if(n==="docx"){const l=a?(await import("./DocxGraft-BbE-AaM5.js")).loadDocxCarrier(e):null;return rt(o,l?{originalDocx:l.bytes}:void 0)}const{DocumentMutator:s}=await import("./DocumentMutator-FEFU1YM0.js").
507
+ then(l=>l.x);o=s.materializeAcceptedSuggestions(o);const c=await at(o,n,n==="html"?{html:{title:i,includeWrapper:!0}}:{});return typeof c=="string"?new TextEncoder().encode(c):new Uint8Array(await c.arrayBuffer())}
508
+ async function Ts(e){const{computeSourceFidelity:t,getDocxCarrierMeta:n}=await import("./DocxGraft-BbE-AaM5.js");return t(ot(e),n(e))}function Rs(e){return S.encodeStateAsUpdate(e)}function Os(e){const t=nn();
509
+ return S.applyUpdate(t,e,"revise-backend"),t}async function Ls(e,t){await Ce();const{createServerDocumentSession:n}=await import("./serverDocumentSession-LMu3kocH.js");return n(e,t)}const Es={agentHtml:()=>import("./AgentHtmlConverter-B5qstcmM.js").
510
+ then(e=>e.p),compare:()=>import("./DocumentCompare-DX4RWeSV.js"),documentFormats:()=>Promise.resolve().then(()=>qr),documentLayout:()=>import("./DocumentLayout-CsU5MR-3.js"),mutator:()=>import("./DocumentMutator-FEFU1YM0.js").
511
+ then(e=>e.x),outline:()=>import("./DocumentOutline-BOZoTohH.js"),documentSession:()=>import("./DocumentSession-gZHWP7By.js"),docxGraft:()=>import("./DocxGraft-BbE-AaM5.js"),pageLayout:()=>Promise.resolve().
512
+ then(()=>Qa),pageRenderer:()=>import("./AgentPageRenderer-JMhCw-hi.js"),scrubber:()=>import("./DocumentScrubber-C4N3Qagm.js"),serverSession:()=>import("./serverDocumentSession-LMu3kocH.js"),xmlScan:()=>import("./xmlScan-DXjt2cTS.js")};
513
+ export{Nn as $,pt as A,Qn as B,Z as C,ze as D,bs as E,de as F,fe as G,Po as H,Gr as I,et as J,wn as K,ys as L,wo as M,He as N,We as O,m as P,Zi as Q,Ar as R,go as S,rr as T,$e as U,No as V,Nt as W,Wn as X,
514
+ Ct as Y,Ft as Z,Ge as _,P as a,li as a$,Cr as a0,ea as a1,na as a2,ya as a3,xe as a4,Yr as a5,Kr as a6,_t as a7,or as a8,ha as a9,mr as aA,Pr as aB,Je as aC,Dt as aD,ke as aE,qe as aF,we as aG,hr as aH,
515
+ qt as aI,ms as aJ,To as aK,is as aL,xr as aM,ne as aN,Ae as aO,wr as aP,ci as aQ,qn as aR,Mn as aS,ge as aT,mt as aU,It as aV,Lt as aW,In as aX,ji as aY,Ei as aZ,_o as a_,Mr as aa,ar as ab,Bt as ac,ma as ad,
516
+ yo as ae,Pn as af,Ze as ag,hs as ah,Qr as ai,jo as aj,le as ak,ko as al,ds as am,ua as an,ls as ao,ta as ap,Br as aq,Wt as ar,Sa as as,ye as at,re as au,$t as av,lr as aw,pr as ax,Ir as ay,Ye as az,Lr as b,
517
+ on as b$,Gi as b0,So as b1,xo as b2,Co as b3,Go as b4,Io as b5,$o as b6,Xo as b7,ve as b8,Rn as b9,ni as bA,oi as bB,ht as bC,kr as bD,zr as bE,Yi as bF,Un as bG,Dn as bH,Ji as bI,Jn as bJ,Yn as bK,xi as bL,
518
+ yi as bM,zi as bN,Bo as bO,Jo as bP,Wo as bQ,Ma as bR,me as bS,Es as bT,nn as bU,Ls as bV,Os as bW,rt as bX,Rs as bY,Fs as bZ,Is as b_,Ca as ba,ba as bb,Fa as bc,dr as bd,$i as be,ee as bf,Hn as bg,Eo as bh,
519
+ Bn as bi,St as bj,L as bk,fi as bl,mi as bm,ri as bn,ai as bo,Sr as bp,ur as bq,Ia as br,Nr as bs,Ot as bt,bi as bu,U as bv,Bi as bw,gi as bx,pi as by,hi as bz,Ht as c,Ms as c0,Ts as c1,ot as c2,en as c3,
520
+ ss as d,yr as e,ka as f,Ss as g,da as h,wa as i,Ce as j,Tr as k,Cn as l,mo as m,ut as n,ks as o,he as p,Ke as q,j as r,Ve as s,Ut as t,be as u,sr as v,An as w,jt as x,Er as y,jn as z};