@docx-editor.dev/core 2.10.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.cts +14 -5
  3. package/dist/automation.d.ts +14 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.cts +12 -11
  7. package/dist/binding.d.ts +12 -11
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-3JON7JMD.cjs +1 -0
  10. package/dist/chunk-5V6FNKBE.cjs +2 -0
  11. package/dist/chunk-6JIJOZDW.js +1 -0
  12. package/dist/chunk-BTQKU64Q.cjs +1 -0
  13. package/dist/chunk-BXRVGHTY.cjs +18 -0
  14. package/dist/chunk-BXTTPJSH.js +5 -0
  15. package/dist/chunk-D5EHDHYV.js +1 -0
  16. package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
  17. package/dist/chunk-ILTZTY3K.cjs +10 -0
  18. package/dist/chunk-IUM7FZPA.js +2 -0
  19. package/dist/chunk-JWZG4QJ5.cjs +2 -0
  20. package/dist/chunk-JXZYDBKU.cjs +19 -0
  21. package/dist/chunk-KBOOIC2Q.js +19 -0
  22. package/dist/chunk-L6XZTLPS.js +10 -0
  23. package/dist/chunk-L7OR5TJK.cjs +5 -0
  24. package/dist/chunk-MHQNR2OU.js +2 -0
  25. package/dist/chunk-MLGPISGH.js +1 -0
  26. package/dist/chunk-NJXQABQU.js +18 -0
  27. package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
  28. package/dist/chunk-TKEGK4GQ.cjs +2 -0
  29. package/dist/chunk-VGFMPWND.js +2 -0
  30. package/dist/chunk-W77HJGYX.js +1 -0
  31. package/dist/chunk-XCFM3G5L.cjs +1 -0
  32. package/dist/chunk-ZKWRCLT2.cjs +1 -0
  33. package/dist/collaboration/replication.cjs +1 -0
  34. package/dist/collaboration/replication.d.cts +216 -0
  35. package/dist/collaboration/replication.d.ts +216 -0
  36. package/dist/collaboration/replication.js +1 -0
  37. package/dist/collaboration.cjs +1 -0
  38. package/dist/collaboration.d.cts +176 -0
  39. package/dist/collaboration.d.ts +176 -0
  40. package/dist/collaboration.js +1 -0
  41. package/dist/contracts/editor.cjs +1 -1
  42. package/dist/contracts/editor.d.cts +8 -9
  43. package/dist/contracts/editor.d.ts +8 -9
  44. package/dist/contracts/editor.js +1 -1
  45. package/dist/contracts/interaction.d.cts +8 -9
  46. package/dist/contracts/interaction.d.ts +8 -9
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.cts +21 -8
  49. package/dist/contracts/modules.d.ts +21 -8
  50. package/dist/contracts/modules.js +1 -1
  51. package/dist/custom-node-writes-CcNeHH5C.d.ts +310 -0
  52. package/dist/custom-node-writes-D4rMJIES.d.cts +310 -0
  53. package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
  54. package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
  55. package/dist/{editor-CwzY2Hcg.d.cts → editor-B76SEMZw.d.cts} +145 -49
  56. package/dist/{editor-C0my6Uta.d.ts → editor-BcdsPdbY.d.ts} +145 -49
  57. package/dist/editor.cjs +1 -1
  58. package/dist/editor.css +1 -7299
  59. package/dist/editor.d.cts +60 -26
  60. package/dist/editor.d.ts +60 -26
  61. package/dist/editor.js +1 -1
  62. package/dist/failure-BnGjoXf0.d.cts +64 -0
  63. package/dist/failure-BnGjoXf0.d.ts +64 -0
  64. package/dist/{index-kID8Ymkp.d.ts → index-BYTvklN5.d.ts} +262 -81
  65. package/dist/{index-nLFwo_17.d.cts → index-CDGhPib1.d.cts} +262 -81
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.cts +19 -18
  68. package/dist/index.d.ts +19 -18
  69. package/dist/index.js +1 -1
  70. package/dist/layout.cjs +1 -1
  71. package/dist/layout.d.cts +82 -53
  72. package/dist/layout.d.ts +82 -53
  73. package/dist/layout.js +1 -1
  74. package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-Bx7rXruA.d.ts} +1 -1
  75. package/dist/{note-properties-CQlxjic_.d.cts → note-properties-zQ8w04en.d.cts} +1 -1
  76. package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-69O1Pd8G.d.ts} +1 -1
  77. package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-BmV51rim.d.cts} +1 -1
  78. package/dist/output.cjs +1 -1
  79. package/dist/output.d.cts +6 -8
  80. package/dist/output.d.ts +6 -8
  81. package/dist/output.js +1 -1
  82. package/dist/{protocol-C7ahrdUx.d.ts → protocol-DC7ueVuo.d.ts} +2 -2
  83. package/dist/{protocol-UuZOcOp7.d.cts → protocol-FTXtrAIT.d.cts} +2 -2
  84. package/dist/{review-items-Dw-8a6Ie.d.ts → review-items-B78OsJU2.d.ts} +1 -2
  85. package/dist/{review-items-CwixiHNe.d.cts → review-items-C-2WQdEb.d.cts} +1 -2
  86. package/dist/{review-reads-BqkiJTeR.d.cts → review-reads-CbBQlb-n.d.cts} +2 -2
  87. package/dist/{review-reads-C0u-IKEA.d.ts → review-reads-UexYBp-m.d.ts} +2 -2
  88. package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-6u8lae9J.d.cts} +1 -1
  89. package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-B2v9U3qx.d.ts} +1 -1
  90. package/dist/{semantic-cell-selection-Utrf0lz7.d.ts → semantic-cell-selection-DsYz2Vg3.d.ts} +4 -4
  91. package/dist/{semantic-cell-selection-DT9x9WLf.d.cts → semantic-cell-selection-nEE7E3Z8.d.cts} +4 -4
  92. package/dist/{semantic-interaction-B6hFRQLy.d.ts → semantic-interaction-C00BpIyC.d.ts} +1 -1
  93. package/dist/{semantic-interaction-Z0xKQcB4.d.cts → semantic-interaction-DiOX0FIH.d.cts} +1 -1
  94. package/dist/{semantic-paint-CQEOC0Od.d.cts → semantic-paint-Cc11nrDL.d.cts} +2 -2
  95. package/dist/{semantic-paint-quke354p.d.ts → semantic-paint-ofuoBsYo.d.ts} +2 -2
  96. package/dist/{semantic-records-Do3-i5oB.d.ts → semantic-records-CRG1r6-a.d.cts} +5 -4
  97. package/dist/{semantic-records-CMakzQ1X.d.cts → semantic-records-CzI0ZEuR.d.ts} +5 -4
  98. package/dist/{shaped-measurer-BxwTUluj.d.ts → shaped-measurer-CkOGZQn9.d.ts} +1 -1
  99. package/dist/{shaped-measurer-DzRwWrL5.d.cts → shaped-measurer-CneACGcP.d.cts} +1 -1
  100. package/dist/store.cjs +1 -1
  101. package/dist/store.d.cts +81 -17
  102. package/dist/store.d.ts +81 -17
  103. package/dist/store.js +1 -1
  104. package/dist/{tree-op-types-DSJYmf5b.d.cts → tree-op-types-CA7qgAUF.d.cts} +1288 -18
  105. package/dist/{tree-op-types-BuOfCrkp.d.ts → tree-op-types-HKfUzt_-.d.ts} +1288 -18
  106. package/dist/{custom-node-writes-BvpWCnW8.d.ts → tree-package-fragment-Cz-v-0B3.d.cts} +107 -322
  107. package/dist/{custom-node-writes-Db8H6Z3n.d.cts → tree-package-fragment-oJZX_5iN.d.ts} +107 -322
  108. package/dist/{tree-session-contract-ByWx8eew.d.cts → tree-session-contract-BPDLrEPX.d.ts} +16 -10
  109. package/dist/{tree-session-contract-C1dfE9hy.d.ts → tree-session-contract-Cbl87xa8.d.cts} +16 -10
  110. package/dist/{tree-store-ASBtz7UB.d.ts → tree-store-B7hd6cEa.d.ts} +130 -25
  111. package/dist/{tree-store-CWOUMGN8.d.cts → tree-store-BenW0Mg_.d.cts} +130 -25
  112. package/package.json +14 -3
  113. package/dist/chunk-27APDXY2.js +0 -2
  114. package/dist/chunk-35MI6K7M.cjs +0 -10
  115. package/dist/chunk-4XL7SOWQ.cjs +0 -2
  116. package/dist/chunk-6K6QQVAZ.cjs +0 -18
  117. package/dist/chunk-7VQ7YLW3.cjs +0 -1
  118. package/dist/chunk-7ZJL5AEY.cjs +0 -1
  119. package/dist/chunk-C6LK2BYA.cjs +0 -2
  120. package/dist/chunk-GQQOL4PV.js +0 -1
  121. package/dist/chunk-HBEBUCRM.cjs +0 -5
  122. package/dist/chunk-LG5K46OM.js +0 -2
  123. package/dist/chunk-LWADHMVV.js +0 -5
  124. package/dist/chunk-N725IUO7.js +0 -18
  125. package/dist/chunk-N7DBENH4.js +0 -10
  126. package/dist/chunk-NVGFWMCO.js +0 -1
  127. package/dist/chunk-SYTWKJPJ.cjs +0 -18
  128. package/dist/chunk-YI6JXF7U.js +0 -18
  129. package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
  130. package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
  131. package/dist/note-nodes-BNCANoGN.d.ts +0 -108
  132. package/dist/note-nodes-DL-Au22P.d.cts +0 -108
  133. package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
  134. package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
  135. package/dist/tree-op-revision-attribution-CN06Xshv.d.cts +0 -24
  136. package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +0 -24
@@ -1,2 +0,0 @@
1
- import {c,d,p,f,k,j as j$1,i,Dc,Nc,ya,wa,Ba,ua,u,W,Ie,Ge,za,Da,Ee as Ee$1,Aa,ub,yf,sf,of,kf,Ab,ae as ae$1,Zf,ge as ge$1,wb,Fa,xb,N,Ia,Ud,w as w$1,na,Ma,V,Uc,da,oa,qa,$b,nc,Lb,Nb,pa,ca,ja,ia}from'./chunk-N7DBENH4.js';import {strFromU8,strToU8}from'fflate';var Eo=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],Ro=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,Co=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function gn(e){return Ro.test(e)||Co.test(e)}function _e(e,t){if(!gn(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var bo=/^(\d+)\.(\d+)\.(\d+)$/;function Y(e){let t=bo.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function Ae(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function $e(e,t){let n=Y(e),o=t.trim();if(o==="*")return true;if(o.startsWith("^")){let r=Y(o.slice(1));return Ae(n,r)<0?false:r.major>0?n.major===r.major:r.minor>0?n.major===0&&n.minor===r.minor:n.major===0&&n.minor===0}if(o.includes(" ")){let r=o.split(/\s+/);if(r.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let s=true;for(let i of r){let a=i.startsWith(">=")?">=":i.startsWith("<")?"<":null;if(!a)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let l=Y(i.slice(a.length)),c=Ae(n,l);a===">="?s=s&&c>=0:s=s&&c<0;}return s}return Ae(n,Y(o))===0}var b=class extends Error{constructor(n,o,r=[]){super(o);this.code=n;this.responsible=r;this.name="RegistryError";}code;responsible},St=(e,t)=>`${e}:${t}`;function Io(e,t={}){let n=new Map;for(let c of e){if(_e(c.id,"extension"),hn(c.version,c.id),n.has(c.id))throw new b("duplicate-extension",`duplicate extension id ${c.id}`,[c.id]);n.set(c.id,c);for(let d of c.contributions)_e(d.id,d.kind),hn(d.version,`${c.id} \u2192 ${d.id}`),d.replaces&&So(d.replaces.targetRange,`${c.id} \u2192 replaces ${d.replaces.targetId}`);}for(let c of e){for(let d of c.dependencies??[])if(!n.has(d))throw new b("missing-dependency",`${c.id} requires missing extension ${d}`,[c.id,d]);for(let d of c.conflicts??[])if(n.has(d)){let m=[c.id,d].sort();throw new b("conflict",`extensions ${m[0]} and ${m[1]} conflict`,m)}}Po(n);let o=new Set(t.availablePorts??[]);for(let c of e)for(let d of c.contributions)d.kind==="runtimePort"&&o.add(d.id);for(let c of e)for(let d of c.requiredPorts??[])if(!o.has(d))throw new b("missing-port",`${c.id} requires unavailable port ${d}`,[c.id,d]);let r=new Map,s=new Map,i=new Map;for(let c of e)for(let d of c.contributions){let m=St(d.kind,d.id);if(d.replaces){let u=St(d.kind,d.replaces.targetId),f=i.get(u)??[];f.push({ext:c.id,c:d}),i.set(u,f);continue}if(s.has(m)){let u=[r.get(m),c.id].sort();throw new b("id-collision",`${d.kind} id ${d.id} registered by both ${u[0]} and ${u[1]}`,u)}s.set(m,d),r.set(m,c.id);}let a=new Map(s);for(let[c,d]of i){let m=s.get(c);if(!m){let y=d[0];throw new b("replacement-target-missing",`${y.ext} replaces missing target ${y.c.replaces.targetId}`,[y.ext,y.c.replaces.targetId])}let u=m.replaceable??{kind:"none"};for(let{ext:y,c:O}of d){if(!$e(m.version,O.replaces.targetRange))throw new b("replacement-version-mismatch",`${y} replaces ${O.replaces.targetId}@${m.version} outside range ${O.replaces.targetRange}`,[y,O.replaces.targetId]);if(u.kind==="none")throw new b("unauthorized-replacement",`${O.replaces.targetId} does not authorize replacement (attempted by ${y})`,[y,O.replaces.targetId])}let f=ko(m,d);a.set(c,f);}return {extensions:n,contributions:a,get:(c,d)=>a.get(St(c,d))}}function ko(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let r=[...t].sort((a,l)=>(l.c.replaces.priority??0)-(a.c.replaces.priority??0)),s=r[0].c.replaces.priority??0,i=r.filter(a=>(a.c.replaces.priority??0)===s);if(i.length>1){let a=i.map(l=>l.ext).sort();throw new b("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${s}: ${a.join(", ")}`,a)}return r[0].c}let o=t.map(r=>r.ext).sort();throw new b("ambiguous-replacement",`multiple replacers of ${e.id}: ${o.join(", ")}`,o)}function Po(e){let r=new Map,s=[],i=a=>{r.set(a,1),s.push(a);let l=[...e.get(a)?.dependencies??[]].sort();for(let c of l){let d=r.get(c)??0;if(d===1){let m=s.indexOf(c),u=[...s.slice(m),c];throw new b("dependency-cycle",`dependency cycle: ${u.join(" -> ")}`,u)}d===0&&i(c);}s.pop(),r.set(a,2);};for(let a of [...e.keys()].sort())(r.get(a)??0)===0&&i(a);}function hn(e,t){try{Y(e);}catch{throw new b("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function So(e,t){try{$e("0.0.0",e);}catch{throw new b("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var q=class extends Error{constructor(t){super(t),this.name="BudgetError";}},ge=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new p(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,o=this;return {amount:t,get released(){return n},release(){n||(n=true,o.used.release(t),o.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let o=new e(t,n);return o.parent=this,o.carveAmount=n,this.children.add(o),o}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new q(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new q(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(o){t.push(o);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new q(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new q(`${this.label}: budget already released`)}};var Me=class extends Error{constructor(n,o){super(o?`cancelled: ${o}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},he=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new Me(t.derivedOnly,t._reason)}}}};var Fe=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},Tt=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new Fe(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(f.clock)}identity(){return this.resolve(f.identity)}},vt=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},wt=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function To(e){let t=k(e.limits),n=Object.freeze({...e.config??{}}),o=e.capacity??t.maxDecompressedBytes,r=e.id??"op",s={id:r,limits:t,config:n,ports:e.ports,budget:new ge(`op:${r}`,o),cancellation:new he};return Object.freeze(s)}function vo(e){e.budget.dispose();}var At=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),xn=Object.keys(At);function wo(e,t){return new p(`${At[t].phase}:${t}`,e[t])}var _t=class{counter;current=0;peak=0;constructor(t){this.counter=new p("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function _o(){for(let e of xn){let t=j$1[e],n=i[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}function xe(e,t=new Set){let n=new WeakSet,o=r=>{if(r===null)return "null";let s=typeof r;if(s==="boolean")return r?"true":"false";if(s==="number"){let i=r;if(!Number.isFinite(i))throw new Error(`non-finite number is not comparable: ${i}`);return Object.is(i,-0)?"0":String(i)}if(s==="string")return JSON.stringify(r);if(s==="bigint")return `${r.toString()}n`;if(Array.isArray(r))return `[${r.map(o).join(",")}]`;if(s==="object"){let i=r;if(n.has(i))throw new Error("cannot canonicalize a cyclic structure");n.add(i);let l=Object.keys(i).filter(c=>!t.has(c)).sort().map(c=>`${JSON.stringify(c)}:${o(i[c])}`).join(",");return n.delete(i),`{${l}}`}throw new Error(`unsupported value type in comparator input: ${s}`)};return o(e)}function $t(e,t){let n=xe(e,t),o=0xcbf29ce484222325n,r=0x100000001b3n,s=0xffffffffffffffffn;for(let i=0;i<n.length;i++)o^=BigInt(n.charCodeAt(i)),o=o*r&s;return o.toString(16).padStart(16,"0")}var A="dev.docx-editor.core.comparator",Mt={authoredState:{id:`${A}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${A}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${A}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${A}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${A}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${A}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${A}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${A}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${A}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${A}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function Ft(e,t,n,o={}){let r=Mt[e];switch(r.mode){case "sync-optimization-only":throw new Error(`${r.id} is not an equivalence basis (${r.note})`);case "tolerance":{if(o.epsilon===void 0)throw new Error(`${r.id} requires an explicit epsilon`);return {equal:On(t,n,o.epsilon)}}case "exact":case "canonical-exact":{let s=r.mode==="canonical-exact"?new Set(r.ephemera):new Set,i=xe(t,s),a=xe(n,s);return i===a?{equal:true}:{equal:false,left:i,right:a}}}}function Dt(e,t){let n=Mt[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let o=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return $t(t,o)}function On(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((o,r)=>On(o,t[r],n)):false}var En=new Set([...c,...d]),Nn=/^[0-9a-f]{16}$/,Ao=/^[0-9a-f]*$/;function Lt(e){let t=[],n=r=>t.push(r);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let o=-1;e.steps.forEach((r,s)=>{let i=`step[${s}]`;En.has(r.origin)||n(`${i}: unknown origin ${r.origin}`),(!Number.isInteger(r.baseRevision)||r.baseRevision<0)&&n(`${i}: baseRevision must be a non-negative integer`),r.baseRevision<o&&n(`${i}: baseRevision regressed below ${o}`);let a=r.expect;a.outcome==="applied"?(a.committedRevision===void 0?n(`${i}: applied step needs committedRevision`):a.committedRevision<=r.baseRevision?n(`${i}: committedRevision ${a.committedRevision} must exceed baseRevision ${r.baseRevision}`):o=a.committedRevision,a.modelChange&&$o(a.modelChange,i,n)):(a.committedRevision!==void 0&&n(`${i}: ${a.outcome} step must not commit a revision`),a.authoredStateHash!==void 0&&n(`${i}: ${a.outcome} step must not change authored state`)),a.authoredStateHash!==void 0&&!Nn.test(a.authoredStateHash)&&n(`${i}: authoredStateHash must be 16-hex`),a.outputHash!==void 0&&!Nn.test(a.outputHash)&&n(`${i}: outputHash must be 16-hex`);});for(let r of [...e.snapshots??[],...e.updates??[]])r.documentId!==e.documentId&&n(`envelope documentId ${r.documentId} != ${e.documentId}`),Ao.test(r.bytesHex)||n("envelope bytesHex must be hex"),r.bytesHex.length!==r.byteLength*2&&n(`envelope byteLength ${r.byteLength} disagrees with ${r.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function $o(e,t,n){En.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function Mo(e,t){let n=Lt(e);if(!n.valid)return {ok:false,mismatches:n.errors};let o=[];return t.init(e),e.steps.forEach((r,s)=>{let i=`step[${s}]`,a=t.applyStep(r),l=r.expect;if(a.outcome!==l.outcome){o.push(`${i}: outcome ${a.outcome} != expected ${l.outcome}`);return}if(l.outcome==="applied"&&(a.committedRevision!==l.committedRevision&&o.push(`${i}: revision ${a.committedRevision} != expected ${l.committedRevision}`),l.authoredStateHash!==void 0))if(a.authoredState===void 0)o.push(`${i}: store returned no authored state to hash`);else {Ft("authoredState",a.authoredState,a.authoredState).equal||o.push(`${i}: authored state is not self-consistent`);let d=Rn(a.authoredState);d!==l.authoredStateHash&&o.push(`${i}: authoredStateHash ${d} != expected ${l.authoredStateHash}`);}}),{ok:o.length===0,mismatches:o}}function Rn(e){return Dt("authoredState",e)}var Fo=new Map([["embedRegular","regular"],["embedBold","bold"],["embedItalic","italic"],["embedBoldItalic","boldItalic"]]),Do=32;function In(e,t){let n=t.replace(/[^0-9a-fA-F]/g,"");if(n.length!==32)return null;let o=new Uint8Array(16);for(let i=0;i<16;i+=1){let a=Number.parseInt(n.slice(i*2,i*2+2),16);if(Number.isNaN(a))return null;o[15-i]=a;}let r=new Uint8Array(e),s=Math.min(Do,r.length);for(let i=0;i<s;i+=1)r[i]=r[i]^o[i%16];return r}var Bt=(e,t)=>{if(!(e.kind==="textValue"||!("attributes"in e))){for(let n of e.attributes??[])if(n.localName===t)return n.value}},Cn=e=>e.kind==="textValue"?[]:e.children??[],bn=e=>e.kind==="textValue"||!("localName"in e)?"":e.localName;function Lo(e,t,n){for(let o of e.relationships.get(t)??[]){if(o.id!==n)continue;if(o.targetMode==="External")return null;let r=w$1(t,o.rawTarget);return r.ok?r.partName:null}return null}function Bo(e,t,n={}){if(!t)return [];let o=n.maxFontBytes??16*1024*1024,r=n.maxFonts??64,s=[],i=new Map,a=l=>{if(!(s.length>=r)){if(bn(l)==="font"){let c=Bt(l,"name");if(c&&c.length<=128)for(let d of Cn(l)){if(s.length>=r)return;let m=Fo.get(bn(d));if(!m)continue;let u=Bt(d,"id"),f=Bt(d,"fontKey");if(!u||!f)continue;let y=Lo(e,t.name,u);if(!y)continue;let O=e.partBytes.get(y);if(!O||O.length===0||O.length>o)continue;let N=i.get(y);if(N){s.push({family:c,style:m,bytes:N,partName:y});continue}let T=In(O,f);T&&(i.set(y,T),s.push({family:c,style:m,bytes:T,partName:y}));}}for(let c of Cn(l))a(c);}};return a(t.root),s}function kn(e){if(e.kind!=="textValue")for(let t of e.children){if(t.kind==="textValue")continue;if(t.kind==="hyperlink"){let o=Ma(t);if(o!==void 0&&o.length>0)return o}let n=kn(t);if(n!==void 0)return n}}function Uo(e){let t="",n=false,o=r=>{if(!(n||r.kind==="textValue")){if(r.kind==="tab"||r.localName==="ptab"||r.localName==="tab"){n=true;return}if(r.kind==="text"||r.localName==="t"){for(let s of r.children)s.kind==="textValue"&&(t+=s.value);return}for(let s of r.children)o(s);}};return o(e),Nc(t)}function Vo(e,t,n,o){let r=n.filter(l=>{if(o.has(l.blockId))return false;let c=l.level+1;return c>=t.instruction.outlineStart&&c<=t.instruction.outlineEnd}),s=new Set(r.map(l=>l.blockId)),i=Dc(e),a=new Map;for(let l of r){let c=Nc(l.text),d=a.get(c);d?d.push(l.blockId):a.set(c,[l.blockId]);}return t.resultParagraphIds.map(l=>{let c=ya(e,l);if(!c||c.kind==="textValue")return null;let d=kn(c),m=d===void 0?void 0:i.get(d);if(m&&s.has(m.paragraphId)){let y=a.get(Nc(r.find(N=>N.blockId===m.paragraphId)?.text??"")),O=y?.indexOf(m.paragraphId)??-1;return y&&O>=0&&y.splice(O,1),m.paragraphId}let u=Uo(c);if(u.length===0)return null;let f=a.get(u);return !f||f.length===0?null:f.shift()??null})}function $(e){return e.namespaceUri===da?e.localName:`{${e.namespaceUri}}${e.localName}`}function H(e){let t=[];for(let n of e.attributes)t.push(n.namespaceUri===""||n.namespaceUri===da?`${n.localName}=${n.value}`:`{${n.namespaceUri}}${n.localName}=${n.value}`);return t.sort(),t}function Sn(e,t){let n=H(e),o=n.length>0?`${$(e)}(${n.join(",")})`:$(e);if(t>=V)return o;let r=[];for(let s of e.children){if(s.kind==="textValue"){s.value!==""&&r.push(`#${s.value}`);continue}r.push(Sn(s,t+1));}return r.sort(),r.length>0?`${o}[${r.join(",")}]`:o}function Pn(e){if(!e)return [];let t=[];for(let n of e.children)n.namespaceUri===da&&t.push(Sn(n,1));return t.sort(),t}function Ut(e){if(e.kind==="textValue")return e.value;if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return $b(e);if(e.kind==="drawing")return nc();if(e.kind==="runProperties"||e.kind==="paragraphProperties"||e.kind==="generic")return "";if(e.kind==="hyperlink"||Lb(e)){let n="",o=e.kind==="hyperlink"?e.children:Nb(e)??[];for(let r of o)n+=Ut(r);return n}let t="";for(let n of e.children)t+=Ut(n);return t}function P(e,t){let n=new Map(e);for(let o of t.namespaceBindings)n.set(o.prefix,o.namespaceUri);return n}function Oe(e,t){try{return pa(e,t)}catch(n){if(n instanceof ja&&n.reason==="undeclared-prefix")return `generic-refusal:undeclared-prefix:{${e.namespaceUri}}${e.localName}`;throw n}}function Vt(e,t,n=oa){if(e.kind==="textValue")return;if(e.kind==="runProperties"||e.kind==="paragraphProperties"){let r=P(n,e),s=[];for(let i of e.children)i.namespaceUri!==da&&s.push(Oe(i,r));s.sort(),t.push(...s);return}if(e.kind==="generic"){t.push(Oe(e,n));return}if(Lb(e)){t.push(qa(e));return}if(e.kind==="bookmarkStart"||e.kind==="bookmarkEnd"){t.push(pa(e,n));return}if(e.kind==="drawing"){t.push(Tn(e));return}if(ca(e.kind))return;let o=P(n,e);for(let r of e.children)Vt(r,t,o);}function Ho(e){return `hyperlink(${e.attributes.map(n=>`${n.namespaceUri}|${n.localName}=${n.value}`).sort().join(",")})`}function jo(e){for(let t of e.children)if(t.kind==="pictureBlipFill")for(let n of t.children){if(n.kind!=="pictureBlip")continue;let o=n.attributes.find(s=>s.localName==="embed"&&s.namespaceUri===ia)?.value,r=n.attributes.find(s=>s.localName==="link"&&s.namespaceUri===ia)?.value;if(o!==void 0)return `embed=${o}`;if(r!==void 0)return `link=${r}`}}function De(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=V)return $(e);let o=P(n,e);if(e.kind==="generic")return Oe(e,o);let r=H(e),s=r.length>0?`${$(e)}(${r.join(",")})`:$(e),i=[];for(let a of e.children)a.kind!=="textValue"&&i.push(De(a,t+1,o));return i.sort(),i.length>0?`${s}[${i.join(",")}]`:s}function Xo(e,t,n){let o=P(n,e),r=[];for(let s of e.children)if(s.kind!=="textValue"){if(s.kind==="pictureBlipFill"){let i=s.children,a=i.find(c=>c.kind==="pictureBlip"),l=i.filter(c=>c.kind!=="pictureBlip").map(c=>De(c,t+1,o));if(l.sort(),a&&a.kind==="pictureBlip"){let c=H(a),d=c.length>0?`pictureBlip(${c.join(",")})`:"pictureBlip";r.push(l.length>0?`${d}[${l.join(",")}]`:d);}else for(let c of i)r.push(De(c,t+1,o));continue}r.push(De(s,t+1,o));}return r.sort(),r}function Ht(e,t,n){if(e.kind==="textValue")return `#${e.value}`;if(t>=V)return $(e);let o=P(n,e);if(e.kind==="drawingDocPr"){let a=H(e);return a.length>0?`docPr(${a.join(",")})`:"docPr"}if(e.kind==="picture"){let a=jo(e),l=Xo(e,t+1,o),c=a===void 0?"picture":`picture(${a})`;return l.length>0?`${c}[${l.join(",")}]`:c}let r=H(e),s=r.length>0?`${$(e)}(${r.join(",")})`:$(e),i=[];for(let a of e.children){if(a.kind==="picture"){i.push(Ht(a,t+1,o));continue}if(a.kind==="generic"){i.push(Oe(a,o));continue}a.kind!=="textValue"&&i.push(Ht(a,t+1,o));}return i.length>0?`${s}[${i.join(",")}]`:s}function Tn(e){let t=P(oa,e),n=e.children.find(a=>a.kind==="inlineDrawing"||a.kind==="anchoredDrawing");if(!n||n.kind==="textValue")return `drawing(${H(e).join(",")})`;let o=P(t,n),r=H(n),s=r.length>0?`${n.kind}(${r.join(",")})`:n.kind,i=[];for(let a of n.children){if(a.kind==="generic"){i.push(Oe(a,o));continue}a.kind!=="textValue"&&i.push(Ht(a,1,o));}return i.length>0?`drawing[${s};${i.join(";")}]`:`drawing[${s}]`}function Ko(e,t,n){let o=e.children.find(d=>d.kind==="paragraphProperties"),r=[],s="",i=[],a=P(oa,e),l=(d,m)=>{if(d.kind==="run"){let u=P(m,d),f=d.children.find(y=>y.kind==="runProperties");r.push(Pn(f)),s+=Ut(d);for(let y of d.children)Vt(y,i,u);return}if(d.kind==="drawing"){i.push(Tn(d));return}if(d.kind==="hyperlink"){i.push(Ho(d));let u=P(m,d);for(let f of d.children)l(f,u);return}if(d.kind==="contentControl"){i.push(qa({...d,children:d.children.filter(f=>f.kind!=="contentControlContent")}));let u=P(m,d);for(let f of d.children){if(f.kind!=="contentControlContent")continue;let y=P(u,f);for(let O of f.children)l(O,y);}return}Vt(d,i,m);};for(let d of e.children)l(d,a);let c=Uc(e);return {ordinal:t,path:n,paraId:c===null?null:c.toUpperCase(),text:s,paragraphProperties:Pn(o),runProperties:r,genericStructure:i}}function zo(e){if(e.localName==="hdr"||e.localName==="ftr"||e.kind==="body")return e;for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="body"||t.localName==="hdr"||t.localName==="ftr"))return t;return e}function vn(e,t,n,o,r,s){if(s>V)return;let i=0;for(let a of e.children){if(a.kind==="textValue"){a.value.trim()!==""&&r.push(`${t}/#text ${a.value}`);continue}let l=t===""?String(i):`${t}/${i}`;if(i+=1,a.kind==="paragraph"){n.push(a),o.push(l),r.push(`${l} p`);continue}let c=H(a);r.push(c.length>0?`${l} ${$(a)}(${c.join(",")})`:`${l} ${$(a)}`),vn(a,l,n,o,r,s+1);}}function wn(e){let t=zo(e.root),n=[],o=[],r=[];vn(t,"",n,o,r,0);let s=n.map((i,a)=>Ko(i,a,o[a]));return {partName:e.name,paragraphs:s,structure:r}}function Go(e){let t=[];for(let n of e){let o=wn(n);o&&t.push(o);}return {stories:t}}function Wo(e,t){let n=[],o=(s,i,a)=>{n.push({path:s,before:JSON.stringify(i)??"undefined",after:JSON.stringify(a)??"undefined"});};e.stories.length!==t.stories.length&&o("stories.length",e.stories.length,t.stories.length);let r=Math.min(e.stories.length,t.stories.length);for(let s=0;s<r;s+=1){let i=e.stories[s],a=t.stories[s],l=m=>`${i.partName}${m}`;i.paragraphs.length!==a.paragraphs.length&&o(l(".paragraphs.length"),i.paragraphs.length,a.paragraphs.length);let c=Math.min(i.paragraphs.length,a.paragraphs.length);for(let m=0;m<c;m+=1){let u=i.paragraphs[m],f=a.paragraphs[m];u.text!==f.text&&o(l(`.p[${m}].text`),u.text,f.text),u.path!==f.path&&o(l(`.p[${m}].path`),u.path,f.path),u.paraId!==f.paraId&&o(l(`.p[${m}].paraId`),u.paraId,f.paraId),JSON.stringify(u.paragraphProperties)!==JSON.stringify(f.paragraphProperties)&&o(l(`.p[${m}].paragraphProperties`),u.paragraphProperties,f.paragraphProperties),JSON.stringify(u.runProperties)!==JSON.stringify(f.runProperties)&&o(l(`.p[${m}].runProperties`),u.runProperties,f.runProperties),JSON.stringify(u.genericStructure)!==JSON.stringify(f.genericStructure)&&o(l(`.p[${m}].genericStructure`),u.genericStructure,f.genericStructure);}i.structure.length!==a.structure.length&&o(l(".structure.length"),i.structure.length,a.structure.length);let d=Math.min(i.structure.length,a.structure.length);for(let m=0;m<d;m+=1)i.structure[m]!==a.structure[m]&&o(l(`.structure[${m}]`),i.structure[m],a.structure[m]);}return n}var Ne="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Jo="http://schemas.openxmlformats.org/package/2006/relationships",_n="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",ie="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Zo="application/vnd.openxmlformats-package.relationships+xml",Qo="http://schemas.openxmlformats.org/package/2006/content-types",An="/[Content_Types].xml",M="/word/numbering.xml",$n=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}],Mn=["decimal","lowerLetter","lowerRoman"],jt=9;function Un(e,t){let n=720*(t+1),o='<w:start w:val="1"/>';if(e==="bullet"){let i=$n[t%$n.length];return `<w:lvl w:ilvl="${t}">${o}<w:numFmt w:val="bullet"/><w:lvlText w:val="${i.text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${n}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${i.font}" w:hAnsi="${i.font}" w:hint="default"/></w:rPr></w:lvl>`}let r=Mn[t%Mn.length],s=r==="lowerRoman";return `<w:lvl w:ilvl="${t}">${o}<w:numFmt w:val="${r}"/><w:lvlText w:val="%${t+1}."/><w:lvlJc w:val="${s?"right":"left"}"/><w:pPr><w:ind w:left="${n}" w:hanging="${s?180:360}"/></w:pPr></w:lvl>`}function er(e,t){let n=Array.from({length:jt},(o,r)=>Un(e,r)).join("");return `<w:abstractNum w:abstractNumId="${t}"><w:multiLevelType w:val="${e==="bullet"?"hybridMultilevel":"multilevel"}"/>${n}</w:abstractNum>`}function tr(){let e=ua(`<w:numbering xmlns:w="${Ne}"></w:numbering>`,{name:M,contentType:ie});return e.ok?e.part:null}var L=(e,t)=>{let n=[];for(let o of e.children)o.kind==="textValue"||o.localName!==t||o.namespaceUri===Ne&&n.push(o);return n},v=(e,t)=>e.attributes.find(n=>n.localName===t)?.value;function Vn(e,t){let n=ua(`<w:numbering xmlns:w="${Ne}">${e}</w:numbering>`,{name:M,contentType:ie});if(!n.ok)return null;let o=[];for(let r of n.part.root.children)r.kind!=="textValue"&&o.push(r);if(o.length!==t.length)return null;for(let r=0;r<t.length;r+=1){let s=o[r],i=t[r];if(s.namespaceUri!==Ne||s.localName!==i.localName||i.attribute&&v(s,i.attribute.localName)!==i.attribute.value)return null}return o}var Fn=["numPicBullet","abstractNum","num","numIdMacAtCleanup"];function Dn(e,t,n){let o=t.indexOf(n);if(o===-1)return e.length;let r=0;return e.forEach((s,i)=>{if(s.kind==="textValue")return;let a=t.indexOf(s.localName);a!==-1&&a<=o&&(r=i+1);}),r}function Ln(e,t){let n=0;for(let o of e){let r=v(o,t);!r||!/^\d{1,9}$/.test(r)||(n=Math.max(n,Number(r)));}return n+1}function nr(e,t){let n=e.parts.get(M),o=n??tr();if(!o)return null;let r=o.root,s=L(r,"abstractNum"),i=L(r,"num"),a=t==="bullet"?"bullet":"decimal",l=s.find(k=>{let B=v(k,"abstractNumId");if(!B||!/^\d{1,9}$/.test(B))return false;let de=L(k,"lvl").find(ee=>v(ee,"ilvl")==="0"||v(ee,"ilvl")===void 0),F=de?L(de,"numFmt")[0]:void 0;return F!==void 0&&v(F,"val")===a}),d=(l?Number(v(l,"abstractNumId")):null)??Ln(s,"abstractNumId"),m=Ln(i,"numId"),u=l===void 0,f=Vn((u?er(t,d):"")+`<w:num w:numId="${m}"><w:abstractNumId w:val="${d}"/></w:num>`,u?[{localName:"abstractNum",attribute:{localName:"abstractNumId",value:String(d)}},{localName:"num",attribute:{localName:"numId",value:String(m)}}]:[{localName:"num",attribute:{localName:"numId",value:String(m)}}]);if(!f)return null;let y=wa(o),O=f.map(k=>Le(k,y)),N=u?O[0]:void 0,T=O[u?1:0];if(u&&!N||!T)return null;let Z=o;if(N){let k=Ba(o,r.id,Dn(r.children,Fn,"abstractNum"),[N]);if(!k.ok)return null;Z=k.part;}let ce=Ba(Z,r.id,Dn(Z.root.children,Fn,"num"),[T]);if(!ce.ok)return null;let Q=Object.freeze({...e,parts:new Map([...e.parts,[M,ce.part]])});if(!n){let k=ar(Q);if(!k)return null;let B=dr(k);if(!B)return null;Q=B;}return {pkg:Q,numId:String(m)}}var or=["nsid","multiLevelType","tmpl","name","styleLink","numStyleLink","lvl"];function Hn(e){let t=v(e,"ilvl");return t===void 0||!/^\d{1,9}$/.test(t)?null:Number(t)}function rr(e,t){let n=0;return e.forEach((o,r)=>{if(o.kind!=="textValue"){if(o.localName==="lvl"&&o.namespaceUri===Ne){(Hn(o)??0)<t&&(n=r+1);return}or.includes(o.localName)&&(n=r+1);}}),n}function ir(e,t,n,o){if(!Number.isInteger(n)||n<0||n>=jt||t.length===0||t.length>64)return null;let r=e.parts.get(M);if(!r)return null;let s=r.root,i=L(s,"num").find(y=>v(y,"numId")===t),a=i?L(i,"abstractNumId")[0]:void 0,l=a?v(a,"val"):void 0;if(!l)return null;let c=L(s,"abstractNum").find(y=>v(y,"abstractNumId")===l);if(!c||L(c,"numStyleLink").length>0)return null;let d=L(c,"lvl");if(d.some(y=>Hn(y)===n))return e;if(d.length>=jt)return null;let m=Vn(Un(o,n),[{localName:"lvl",attribute:{localName:"ilvl",value:String(n)}}]);if(!m)return null;let u=wa(r),f=Ba(r,c.id,rr(c.children,n),[Le(m[0],u)]);return f.ok?Object.freeze({...e,parts:new Map([...e.parts,[M,f.part]])}):null}function Le(e,t){return e.kind==="textValue"?{...e,id:t()}:{...e,id:t(),children:e.children.map(n=>Le(n,t))}}function ar(e){let t=e.mainDocumentPart,n=sr(t),o=e.parts.get(n),r=lr(e),s=ua(`<Relationships xmlns="${Jo}"><Relationship Id="${r}" Type="${_n}" Target="numbering.xml"/></Relationships>`,{name:n,contentType:Zo});if(!s.ok)return null;let i=e.relationships.get(t)??[],a={ownerPart:t,id:r,type:_n,rawTarget:"numbering.xml",targetMode:"Internal",order:i.reduce((u,f)=>Math.max(u,f.order),-1)+1},l=new Map([...e.relationships,[t,[...i,a]]]);if(!o)return Object.freeze({...e,parts:new Map([...e.parts,[n,s.part]]),relationships:l});let c=wa(o),d=s.part.root.children[0];if(!d)return null;let m=Ba(o,o.root.id,o.root.children.length,[Le(d,c)]);return m.ok?Object.freeze({...e,parts:new Map([...e.parts,[n,m.part]]),relationships:l}):null}function sr(e){let t=e.lastIndexOf("/");return `${e.slice(0,t)}/_rels/${e.slice(t+1)}.rels`}function lr(e){let t=0;for(let n of e.relationships.values())for(let o of n){let r=/^rId(\d{1,9})$/.exec(o.id);r&&(t=Math.max(t,Number(r[1])));}for(let n of e.externalTargets){let o=/^rId(\d{1,9})$/.exec(n.id);o&&(t=Math.max(t,Number(o[1])));}return `rId${t+1}`}var cr=`<Override PartName="${M}" ContentType="${ie}"/>`;function dr(e){let t=e.contentTypes.overrides.get(u(M));if(t===ie)return e;if(t!==void 0)return null;let n=e.partBytes.get(An);if(!n)return null;let o=strFromU8(n),r=Bn(o);if(!r)return null;let s=o.lastIndexOf(`</${r.rootName}>`);if(s===-1)return null;let i=o.slice(0,s)+cr+o.slice(s),a=Bn(i);if(!a||a.rootName!==r.rootName)return null;let l=[...r.children,jn("Override",{PartName:M,ContentType:ie})];return a.children.length!==l.length||a.children.some((c,d)=>c!==l[d])?null:Object.freeze({...e,partBytes:new Map([...e.partBytes,[An,strToU8(i)]]),contentTypes:Object.freeze({defaults:e.contentTypes.defaults,overrides:new Map([...e.contentTypes.overrides,[u(M),ie]])})})}function Bn(e){let t=W(e);if(!t.ok)return null;let n=t.nodes.filter(a=>a.type==="element");if(n.length!==1)return null;let o=n[0],r=o.name.indexOf(":"),s=r===-1?"":o.name.slice(0,r);if(o.name.slice(r+1)!=="Types"||o.attributes[s?`xmlns:${s}`:"xmlns"]!==Qo)return null;let i=[];for(let a of o.children)a.type==="element"&&i.push(jn(a.name,a.attributes));return {rootName:o.name,children:i}}function jn(e,t){let n=Object.entries(t).map(([o,r])=>`${o}=${r}`).sort();return [e,...n].join("")}function Be(e){return e!=null&&e.kind!=="textValue"}function Xt(e,t){for(let n of e.children)if(n.kind!=="textValue"&&n.namespaceUri===da&&n.localName===t)return n;return null}function Ue(e,t){for(let n of e.attributes)if(n.namespaceUri===da&&n.localName===t)return n.value}function ae(e,t){let n=Xt(e,t);if(!n)return false;let o=Ue(n,"val");return o===void 0?true:o!=="0"&&o!=="false"&&o!=="off"}var Xn=Object.freeze({trackRevisions:false,restrictedToTrackedChanges:false,doNotTrackMoves:false,doNotTrackFormatting:false});function pr(e){if(!Be(e))return Xn;let t=Xt(e,"documentProtection"),n=t===null?void 0:Ue(t,"enforcement"),o=n!==void 0&&n!=="0"&&n!=="false"&&n!=="off";return {trackRevisions:ae(e,"trackRevisions"),restrictedToTrackedChanges:o&&t!==null&&Ue(t,"edit")==="trackedChanges",doNotTrackMoves:ae(e,"doNotTrackMoves"),doNotTrackFormatting:ae(e,"doNotTrackFormatting")}}var Kn=Object.freeze({doNotShadeFormData:false});function mr(e){return Be(e)?{doNotShadeFormData:ae(e,"doNotShadeFormData")}:Kn}function ur(e,t){let n=e.parts.get(t.storyPartName);if(!n)return {ok:false,reason:`no story part named ${t.storyPartName}`};let o=[];for(let l of Ie(n.root)){let c=Ge(l.node).tag;if(c===void 0||c.length===0)continue;let d=t.decide(c);d!=="keep"&&o.push({nodeId:l.node.id,policy:d});}let r=n,s=0,i=0;for(let{nodeId:l,policy:c}of o){let d=za(r,l);if(!d)continue;if(c==="remove"){let N=Da(r,l,{deferValidation:true});if(!N.ok)return {ok:false,reason:`a node could not be removed: ${zn(N)}`};r=N.part,i+=1;continue}let m=d.children.find(N=>N.id===l);if(!m)continue;let u=Ee$1(m),f=u?u.children:[],y=d.children.flatMap(N=>N.id===l?f:[N]),O=Aa(r,d.id,y,{deferValidation:true});if(!O.ok)return {ok:false,reason:`a node could not be unwrapped: ${zn(O)}`};r=O.part,s+=1;}let a=r===n?e:ub(e,r);if(!a.parts.has(t.storyPartName))return {ok:false,reason:"the story went missing during the export"};for(let l of t.namespaces)for(let c of yr(a,t.storyPartName,l)){let d=yf(a,c.itemId),m=sf(a,c.partName,d);if(m.pkg===a&&m.removed.length===0&&!fr(a,c.partName,d))return {ok:false,reason:`the payloads in ${l} could not be removed`};if(a=m.pkg,d.size>0)continue;let u=gr(a,c);if(!u.ok)return {ok:false,reason:`the payload store for ${l} could not be removed`};a=u.pkg;}return {ok:true,pkg:a,unwrapped:s,removed:i}}function fr(e,t,n){return of(e,t).every(o=>n.has(o.id))}function zn(e){return e.issues.map(t=>t.code).join(", ")||"the edit was refused"}function yr(e,t,n){return kf(e,t).filter(o=>o.namespaceUri===n)}function gr(e,t){let n=Ab(e,t.partName);if(!n.ok)return {pkg:e,ok:false};let o=Ab(n.pkg,t.propsPartName);return o.ok?{pkg:o.pkg,ok:true}:{pkg:e,ok:false}}var J="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Er="http://schemas.openxmlformats.org/package/2006/relationships",Rr="http://schemas.openxmlformats.org/drawingml/2006/main",Yn="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",qn="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",Jn="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Zn="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",Qn="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",eo="application/vnd.openxmlformats-package.relationships+xml",Kt=`${J}/styles`,zt=`${J}/numbering`,to=`${J}/footnotes`,no=`${J}/endnotes`,oo=`${J}/officeDocument`,Cr=`${J}/theme`;function w(e){return e.kind!=="textValue"}function Gn(e,t){return {...e,children:t}}function j(e,t){if(t(e),e.kind!=="textValue")for(let n of e.children)j(n,t);}var br=new Set(["pStyle","rStyle","tblStyle"]);function Gt(e,t){for(let n of e)j(n,o=>{if(o.kind!=="textValue"&&br.has(o.localName)&&o.namespaceUri===da){let r=Ud(o,"val");r&&t.add(r);}});}function Wt(e,t){for(let n of e)j(n,o=>{if(o.kind!=="textValue"&&o.localName==="numId"&&o.namespaceUri===da){let r=Ud(o,"val");r&&t.add(r);}});}function He(e,t){for(let n of e)j(n,o=>{if(o.kind!=="textValue")for(let r of o.attributes)r.namespaceUri===J&&r.value.length>0&&t.add(r.value);});}function Yt(e,t){let n=new Set;for(let o of e)j(o,r=>{if(r.kind!=="textValue"&&r.kind==="noteReference"&&r.localName===t){let s=Ud(r,"id");s!==void 0&&n.add(s);}});return n}function Ir(e,t){for(let n of wb(e,t)){if(n.type!==Kt||n.targetMode==="External")continue;let o=w$1(n.ownerPart,n.rawTarget);if(o.ok)return e.parts.get(o.partName)??null}return e.parts.get("/word/styles.xml")??null}function ro(e,t,n){for(let o of wb(e,t)){if(o.type!==n||o.targetMode==="External")continue;let r=w$1(o.ownerPart,o.rawTarget);if(r.ok)return e.parts.get(r.partName)??null}return null}function io(e,t){let n=Ir(e,t),o=new Map,r=[],s=null;if(n&&w(n.root))for(let i of n.root.children){if(!w(i))continue;if(i.localName==="docDefaults"&&i.namespaceUri===da){s=i;continue}if(i.localName!=="style"||i.namespaceUri!==da)continue;let a=Ud(i,"styleId");a&&o.set(a,i),(Ud(i,"default")==="1"||Ud(i,"default")==="true")&&r.push(i);}return {part:n,byId:o,defaults:r,docDefaults:s}}var kr=new Set(["basedOn","link","next"]);function qt(e,t){let n=new Set,o=[...t];for(let i of e.defaults){let a=Ud(i,"styleId");a&&o.push(a);}let r=[];for(;o.length>0;){let i=o.pop();if(n.has(i))continue;n.add(i);let a=e.byId.get(i);if(a){r.push(a);for(let l of a.children)if(w(l)&&kr.has(l.localName)&&l.namespaceUri===da){let c=Ud(l,"val");c&&o.push(c);}}}if(!e.part||!w(e.part.root))return r;let s=new Map;return e.part.root.children.forEach((i,a)=>s.set(i,a)),r.sort((i,a)=>(s.get(i)??0)-(s.get(a)??0))}function ao(e,t,n){let o=ro(e,t,zt)??e.parts.get("/word/numbering.xml")??null;if(!o||!w(o.root)||n.size===0)return {part:o,nums:[],abstracts:[]};let r=[],s=new Set;for(let a of o.root.children){if(!w(a)||a.localName!=="num"||a.namespaceUri!==da)continue;let l=Ud(a,"numId");if(!(!l||!n.has(l))){r.push(a);for(let c of a.children)if(w(c)&&c.localName==="abstractNumId"){let d=Ud(c,"val");d&&s.add(d);}}}let i=[];for(let a of o.root.children){if(!w(a)||a.localName!=="abstractNum"||a.namespaceUri!==da)continue;let l=Ud(a,"abstractNumId");l&&s.has(l)&&i.push(a);}return {part:o,nums:r,abstracts:i}}var Ve={latin:null,eastAsia:null,cs:null};function so(e,t){let n=ro(e,t,Cr);if(!n)return {major:Ve,minor:Ve};let o={major:{...Ve},minor:{...Ve}};return j(n.root,r=>{if(r.kind==="textValue"||r.namespaceUri!==Rr||r.localName!=="majorFont"&&r.localName!=="minorFont")return;let s=r.localName==="majorFont"?o.major:o.minor;for(let i of r.children){if(!w(i))continue;let a=Ud(i,"typeface");a&&(i.localName==="latin"?s.latin=a:i.localName==="ea"?s.eastAsia=a:i.localName==="cs"&&(s.cs=a));}}),{major:o.major,minor:o.minor}}function Pr(e,t){let n=t.startsWith("major")?e.major:e.minor;return t.endsWith("EastAsia")?n.eastAsia??n.latin:t.endsWith("Bidi")?n.cs??n.latin:n.latin}var Sr=[["asciiTheme","ascii"],["hAnsiTheme","hAnsi"],["eastAsiaTheme","eastAsia"],["cstheme","cs"]],Wn=new Set(["themeColor","themeTint","themeShade","themeFill","themeFillTint","themeFillShade"]);function X(e,t){if(e.kind==="textValue")return e;let n=e.attributes;if(e.localName==="rFonts"&&e.namespaceUri===da){let s=[],i=new Map;for(let a of e.attributes){let l=Sr.find(([c])=>c===a.localName);if(l&&a.namespaceUri===da){let c=Pr(t,a.value);c&&i.set(l[1],c);continue}s.push(a);}for(let[a,l]of i)s.some(c=>c.localName===a)||s.push({kind:"genericExtension",namespaceUri:da,localName:a,prefix:"w",value:l});n=s;}else e.attributes.some(s=>Wn.has(s.localName)&&s.namespaceUri===da&&e.attributes.some(i=>i.localName==="val"))&&(n=e.attributes.filter(s=>!(Wn.has(s.localName)&&s.namespaceUri===da)));let o=e.children.map(s=>X(s,t)),r=o.some((s,i)=>s!==e.children[i]);return n===e.attributes&&!r?e:{...e,attributes:n,children:o}}function lo(e,t,n){return {id:e,name:e,contentType:t,root:n}}function co(e,t){if(e.root.kind==="document"){let o=e.root.children.find(s=>s.kind==="body"),r=o&&w(o)?Gn(o,t):{id:"fragment#body",kind:"body",namespaceUri:da,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return Gn(e.root,[r])}let n={id:"fragment#body",kind:"body",namespaceUri:da,localName:"body",prefix:"w",namespaceBindings:[],attributes:[],children:t};return {id:"fragment#document",kind:"document",namespaceUri:da,localName:"document",prefix:"w",namespaceBindings:w(e.root)?e.root.namespaceBindings:[],attributes:[],children:[n]}}function Ee(e){let t=e.map(n=>{let o=n.targetMode==="External"?' TargetMode="External"':"";return `<Relationship Id="${N(n.id)}" Type="${N(n.type)}" Target="${N(n.rawTarget)}"${o}/>`}).join("");return `<Relationships xmlns="${Er}">${t}</Relationships>`}function po(e,t){let n=t;for(;e.has(`rId${n}`);)n+=1;return `rId${n}`}function mo(e){let t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}var Tr="http://schemas.openxmlformats.org/package/2006/content-types",vr=5e4;function K(e){return e.kind!=="textValue"}function se(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)se(n,t);return t}function je(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let o=je(n,t);if(o)return o}return null}function S(e,t){return {...e,children:t}}function le(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===da}function wr(e){if(e.root.kind==="document"){let t=e.root.children.find(n=>n.kind==="body");return t&&K(t)?t:null}return K(e.root)?e.root:null}function _r(e,t){return se(e).some(n=>t.has(n))}function Ar(e){let t=o=>{if(o.kind==="textValue")return o;if(le(o,"vMerge")){if(Ud(o,"val")==="restart")return o;let r=[...o.attributes.filter(s=>!(s.localName==="val"&&s.namespaceUri===da)),{kind:"wmlVal",namespaceUri:da,localName:"val",prefix:"w",value:"restart"}];return {...o,attributes:r}}if(le(o,"tc")||le(o,"tcPr")){let r=o.children.map(t);return S(o,r)}return o},n=e.children.map(t);return S(e,n)}function $r(e,t,n){let o=e.children.filter(l=>l.kind!=="textValue"&&le(l,"tr")),r=new Set(se(e).filter(l=>t.inRange.has(l)));if(r.size===0)return;let s=o.filter(l=>{let c=se(l);return c.length>0&&c.every(d=>t.covered.has(d))}),i=new Set(s.flatMap(l=>se(l)));if(s.length>0&&r.size===i.size&&[...r].every(l=>i.has(l))){let l=true,c=[];for(let d of e.children){if(!le(d,"tr")){c.push(d);continue}s.includes(d)&&(c.push(l?Ar(d):d),l=false);}n.push(S(e,c));return}for(let l of se(e)){if(!t.inRange.has(l))continue;let c=je(e,l);c&&n.push(c);}}function Jt(e,t,n){for(let o of e)if(K(o)){if(o.kind==="paragraph"){t.inRange.has(o.id)&&n.push(o);continue}if(t.fullBlocks.has(o.id)){n.push(o);continue}if(o.kind==="table"){$r(o,t,n);continue}if(o.kind==="contentControl"){let r=o.children.find(s=>s.kind==="contentControlContent");r&&K(r)&&Jt(r.children,t,n);continue}_r(o,t.inRange)&&Jt(o.children,t,n);}}var Mr=new Set(["commentRangeStart","commentRangeEnd"]);function Fr(e){return e.kind==="run"&&e.children.some(t=>t.kind==="commentReference")}function Zt(e){if(e.kind==="textValue")return e;if(Mr.has(e.localName)&&e.namespaceUri===da||Fr(e)||le(e,"sectPr"))return null;let t=false,n=[];for(let o of e.children){let r=Zt(o);if(r===null){t=true;continue}r!==o&&(t=true),n.push(r);}return t?S(e,n):e}function Dr(e){if(e.kind!=="run")return null;for(let t of e.children)if(t.kind==="fldChar"){let n=Ud(t,"fldCharType");return n==="begin"||n==="separate"||n==="end"?n:"begin"}return null}function Lr(e){return e.kind==="run"&&e.children.some(t=>t.kind==="instrText")}function Br(e){let t=[],n=l=>{if(l.kind!=="textValue"){if(l.kind==="run"){let c=Dr(l);c?t.push({nodeId:l.id,type:c}):Lr(l)&&t.push({nodeId:l.id,type:"instr"});return}for(let c of l.children)n(c);}};for(let l of e)n(l);if(t.length===0)return e;let o=new Set,r=[],s=null,i=[];for(let l of t){if(l.type==="begin"){r.push({beginId:l.nodeId,separateId:null,instrIds:[]});continue}if(l.type==="separate"){let d=r[r.length-1];d?d.separateId=l.nodeId:s=l.nodeId;continue}if(l.type==="instr"){let d=r[r.length-1];d?d.instrIds.push(l.nodeId):s===null&&i.push(l.nodeId);continue}if(!r.pop()){o.add(l.nodeId),s!==null&&o.add(s);for(let d of i)o.add(d);s=null,i=[];}}for(let l of r){o.add(l.beginId),l.separateId!==null&&o.add(l.separateId);for(let c of l.instrIds)o.add(c);}s!==null&&o.add(s);for(let l of i)o.add(l);if(o.size===0)return e;let a=l=>{if(l.kind==="textValue")return l;if(o.has(l.id))return null;let c=[],d=false;for(let m of l.children){let u=a(m);if(u===null){d=true;continue}u!==m&&(d=true),c.push(u);}return d?S(l,c):l};return e.map(l=>a(l)).filter(l=>l!==null)}function Qt(e){if(e.kind==="textValue")return e.value.length;let t=0;for(let n of e.children)t+=Qt(n);return t}function Ur(e,t){let n=[];for(let o of e.children){if(o.kind!=="contentControl"){n.push(o);continue}let r=t.get(o.id),s=Qt(o);if(r===void 0||s>=r){n.push(o);continue}if(s===0)continue;let i=o.children.find(a=>a.kind==="contentControlContent");i&&K(i)?n.push(...i.children):n.push(o);}return S(e,n)}function Vr(e){let t=new Set,n=new Set,o=i=>{if(i.kind!=="textValue"){if(i.kind==="bookmarkStart"){let a=Ud(i,"id");a!==void 0&&t.add(a);}if(i.kind==="bookmarkEnd"){let a=Ud(i,"id");a!==void 0&&n.add(a);}for(let a of i.children)o(a);}};for(let i of e)o(i);let r=new Set([...t].filter(i=>n.has(i)));if(r.size===t.size&&r.size===n.size)return e;let s=i=>{if(i.kind==="textValue")return i;if(i.kind==="bookmarkStart"||i.kind==="bookmarkEnd"){let c=Ud(i,"id");return c!==void 0&&r.has(c)?i:null}let a=[],l=false;for(let c of i.children){let d=s(c);if(d===null){l=true;continue}d!==c&&(l=true),a.push(d);}return l?S(i,a):i};return e.map(i=>s(i)??i)}function Hr(e,t,n){let o=e.parts.get(t.partName);if(!o)return {ok:false,reason:"unknown-part"};if(t.paragraphIds.length===0)return {ok:false,reason:"empty-range"};let r=t.paragraphIds[0],s=t.paragraphIds[t.paragraphIds.length-1],i=new Map;for(let p of [r,s]){let g=je(o.root,p);if(!g)return {ok:false,reason:"empty-range"};for(let h of g.children)h.kind==="contentControl"&&i.set(h.id,Qt(h));}let a=o,l=je(a.root,s);if(!l)return {ok:false,reason:"empty-range"};let c=ae$1(l);if(t.endOffset<c){let p=Zf(a,{op:"deleteText",paragraphId:s,start:t.endOffset,end:c},{deferValidation:true});if(!p.ok)return {ok:false,reason:"trim-refused"};a=p.part;}if(t.startOffset>0){let p=Zf(a,{op:"deleteText",paragraphId:r,start:0,end:t.startOffset},{deferValidation:true});if(!p.ok)return {ok:false,reason:"trim-refused"};a=p.part;}let d=wr(a);if(!d)return {ok:false,reason:"unknown-part"};let m={inRange:new Set(t.paragraphIds),covered:new Set(t.coveredParagraphIds),fullBlocks:new Set(t.fullyCoveredBlockIds)},u=[];if(Jt(d.children,m,u),u.length===0)return {ok:false,reason:"empty-range"};if(u.length>vr)return {ok:false,reason:"resource-limit"};let f=u.map(p=>Zt(p)).filter(p=>p!==null).map(p=>p.kind!=="paragraph"||p.id!==r&&p.id!==s?p:Ur(p,i));f=[...Br(f)],f=[...Vr(f)];let y=Yt(f,"footnoteReference"),O=Yt(f,"endnoteReference"),N$1=y.size>0?ge$1(e,"footnote"):null,T=O.size>0?ge$1(e,"endnote"):null,Z=(p,g)=>{if(!p||!K(p.root))return [];let h=[];for(let C of p.root.children){if(!K(C)||C.kind!=="note")continue;let I=Ud(C,"id"),R=Ud(C,"type");if(R==="separator"||R==="continuationSeparator"){h.push(C);continue}if(I!==void 0&&g.has(I)){let ne=Zt(C);ne&&K(ne)&&h.push(ne);}}return h},ce=Z(N$1,y),Q=Z(T,O),k=[...ce,...Q],B=[...f,...k],de=new Set;Gt(B,de);let F=io(e,e.mainDocumentPart),ee=qt(F,de),Ke=new Set;Wt(B,Ke),Wt(ee,Ke);let _=ao(e,e.mainDocumentPart,Ke),ze=new Set;Gt([..._.nums,..._.abstracts],ze);for(let p of [..._.nums,..._.abstracts])j(p,g=>{if(g.kind!=="textValue"&&(g.localName==="styleLink"||g.localName==="numStyleLink")&&g.namespaceUri===da){let h=Ud(g,"val");h&&ze.add(h);}});let yo=qt(F,ze).filter(p=>!ee.includes(p)),go=[...ee,...yo],te=so(e,e.mainDocumentPart),en=go.map(p=>X(p,te)),Ge=F.docDefaults?X(F.docDefaults,te):null;f=f.map(p=>X(p,te));let We=ce.map(p=>X(p,te)),Ye=Q.map(p=>X(p,te)),tn=new Set;He(f,tn);let nn=wb(e,o.name).filter(p=>tn.has(p.id)),on=new Map,rn=0,an=p=>{let g=new Set;for(let h of p){if(h.targetMode==="External")continue;let C=w$1(h.ownerPart,h.rawTarget);if(!C.ok){g.add(h.id);continue}if((xb(e,C.partName)??"").toLowerCase().startsWith("image/")&&n?.omitMedia!==true){let R=e.partBytes.get(C.partName)??e.partBytes.get(C.partName.replace(/^\//,""));R?(on.set(C.partName,R),rn+=R.byteLength):g.add(h.id);continue}g.add(h.id);}return g},qe=an(nn),Je=(p,g)=>{if(p.kind==="textValue")return p;if(p.kind==="drawing"){let I=new Set;He([p],I);for(let R of I)if(g.has(R))return null;return p}let h=[],C=false;for(let I of p.children){let R=Je(I,g);if(R===null){C=true;continue}R!==I&&(C=true),h.push(R);}return C?S(p,h):p};qe.size>0&&(f=f.map(p=>Je(p,qe)).filter(p=>p!==null));let ho=nn.filter(p=>!qe.has(p.id)),sn=(p,g)=>{if(!p)return [];let h=new Set;He(g,h);let C=wb(e,p.name).filter(R=>h.has(R.id)),I=an(C);if(I.size>0)for(let R=0;R<g.length;R+=1){let ne=Je(g[R],I);ne!==null&&(g[R]=ne);}return C.filter(R=>!I.has(R.id))},ln=sn(N$1,We),cn=sn(T,Ye),U=new Map,dn=[],pe=(p,g,h)=>{U.set(p.slice(1),Fa(na(lo(p,g,h)))),dn.push([p,g]);},Re=[...ho],pn=new Set(Re.map(p=>p.id)),mn=9001,Ce=(p,g)=>{let h=po(pn,mn);mn+=1,pn.add(h),Re.push({ownerPart:"/word/document.xml",id:h,type:p,rawTarget:g,targetMode:"Internal",order:Re.length});},xo=co(a,f);if(pe("/word/document.xml",Yn,xo),F.part&&(en.length>0||Ge)){let p=S(F.part.root,[...Ge?[Ge]:[],...en]);pe("/word/styles.xml",qn,p),Ce(Kt,"styles.xml");}if(_.part&&(_.nums.length>0||_.abstracts.length>0)){let p=S(_.part.root,[..._.abstracts.map(g=>X(g,te)),..._.nums]);pe("/word/numbering.xml",Jn,p),Ce(zt,"numbering.xml");}N$1&&We.length>0&&(pe("/word/footnotes.xml",Zn,S(N$1.root,We)),Ce(to,"footnotes.xml"),ln.length>0&&U.set("word/_rels/footnotes.xml.rels",Fa(Ee(ln)))),T&&Ye.length>0&&(pe("/word/endnotes.xml",Qn,S(T.root,Ye)),Ce(no,"endnotes.xml"),cn.length>0&&U.set("word/_rels/endnotes.xml.rels",Fa(Ee(cn))));let Ze=new Map;for(let[p,g]of on){U.set(p.slice(1),g);let h=mo(p);h&&!Ze.has(h)&&Ze.set(h,xb(e,p)??"application/octet-stream");}U.set("word/_rels/document.xml.rels",Fa(Ee(Re))),U.set("_rels/.rels",Fa(Ee([{ownerPart:"/",id:"rId1",type:oo,rawTarget:"word/document.xml",targetMode:"Internal",order:0}])));let Oo=[`<Default Extension="rels" ContentType="${eo}"/>`,'<Default Extension="xml" ContentType="application/xml"/>',...[...Ze].map(([p,g])=>`<Default Extension="${N(p)}" ContentType="${N(g)}"/>`)].join(""),No=dn.map(([p,g])=>`<Override PartName="${N(p)}" ContentType="${N(g)}"/>`).join("");return U.set("[Content_Types].xml",Fa(`<Types xmlns="${Tr}">${Oo}${No}</Types>`)),{ok:true,bytes:Ia(U),lastMarkCovered:t.lastMarkCovered,blockCount:f.length,mediaBytes:rn}}var Xe="http://purl.org/dc/elements/1.1/",uo="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",fo="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";var Yu=Object.freeze({});function z(e,t,n){if(e.kind!=="textValue")for(let o of e.children){if(o.kind==="textValue"||o.namespaceUri!==t||o.localName!==n)continue;let r=o.children.find(i=>i.kind==="textValue");if(!r||r.kind!=="textValue")return;let s=r.value.trim();return s.length===0?void 0:s.length>4096?s.slice(0,4096):s}}function qu(e,t){let n={};if(e&&e.kind!=="textValue"){let o=z(e,Xe,"title");o!==void 0&&(n.title=o);let r=z(e,Xe,"creator");r!==void 0&&(n.creator=r);let s=z(e,Xe,"subject");s!==void 0&&(n.subject=s);let i=z(e,Xe,"description");i!==void 0&&(n.description=i);let a=z(e,uo,"keywords");a!==void 0&&(n.keywords=a);let l=z(e,uo,"lastModifiedBy");l!==void 0&&(n.lastModifiedBy=l);}if(t&&t.kind!=="textValue"){let o=z(t,fo,"Company");o!==void 0&&(n.company=o);let r=z(t,fo,"Manager");r!==void 0&&(n.manager=r);}return n}
2
- export{Ft as A,Dt as B,Lt as C,Mo as D,Rn as E,In as F,Bo as G,Vo as H,wn as I,Go as J,Wo as K,nr as L,ir as M,Xn as N,pr as O,Kn as P,mr as Q,Yu as R,qu as S,ur as T,Hr as U,Eo as a,gn as b,_e as c,Y as d,Ae as e,$e as f,b as g,Io as h,q as i,ge as j,Me as k,he as l,Fe as m,Tt as n,vt as o,wt as p,To as q,vo as r,At as s,xn as t,wo as u,_t as v,_o as w,xe as x,$t as y,Mt as z};
@@ -1,5 +0,0 @@
1
- import {M,L,O,R,S,G as G$1}from'./chunk-LG5K46OM.js';import {Xe as Xe$1,b,Se,ya,sb,_c,fg,tg,cf,df,lg,kg,Bf,ng,og,bh,ad,Dc,bd,Xb,tb,_f,cd,re,Vb,Ub,E,ug,ge,sg,rg,We as We$1,Sb,Yb,hh,ih,da,Qg,Tg,ah,_b,Uc,Tc,Lb,Nb}from'./chunk-N7DBENH4.js';import {Schema}from'prosemirror-model';import {EditorState,TextSelection}from'prosemirror-state';import {EditorView}from'prosemirror-view';import {keymap}from'prosemirror-keymap';import {joinBackward,deleteSelection,joinForward,splitBlock,selectTextblockEnd,selectTextblockStart,baseKeymap}from'prosemirror-commands';function H(t){return t.attributes?.val}function j(t){let e=H(t);return e===void 0||!(e==="0"||e==="false"||e==="off")}var Un=/^[0-9A-Fa-f]{6}$/,ye=/^\d{1,6}$/,Yn=/^-?\d{1,6}$/;function _e(t){return t===void 0||t==="auto"?null:Un.test(t)?`#${t}`:null}var Gn={single:"solid",words:"solid",thick:"solid",double:"double",dotted:"dotted",dottedHeavy:"dotted",dash:"dashed",dashedHeavy:"dashed",dashLong:"dashed",dashLongHeavy:"dashed",dotDash:"dashed",dashDotHeavy:"dashed",dotDotDash:"dashed",dashDotDotHeavy:"dashed",wave:"wavy",wavyHeavy:"wavy",wavyDouble:"wavy"},Xn={black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkBlue:"#000080",darkCyan:"#008080",darkGray:"#808080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",green:"#00ff00",lightGray:"#c0c0c0",magenta:"#ff00ff",red:"#ff0000",yellow:"#ffff00",white:"#ffffff"};function Jn(t){return !t||!/^[\w \-.+]{1,64}$/.test(t)?null:`"${t}"`}function W(t,e=false){return t===void 0||!(e?Yn:ye).test(t)?null:`${Number(t)/20}pt`}function Zt(t){let e=[],n=[],r=null,s=null;for(let l of t)switch(l.localName){case "b":e.push(`font-weight:${j(l)?"bold":"normal"}`);break;case "i":e.push(`font-style:${j(l)?"italic":"normal"}`);break;case "u":{let o=H(l)??"single";if(o==="none"||!j(l))break;n.push("underline"),r=Gn[o]??"solid",s=_e(l.attributes?.color);break}case "strike":j(l)&&n.push("line-through");break;case "dstrike":j(l)&&n.push("line-through");break;case "caps":j(l)&&e.push("text-transform:uppercase");break;case "smallCaps":j(l)&&e.push("font-variant:small-caps");break;case "vertAlign":{let o=H(l);o==="superscript"?e.push("vertical-align:super","font-size:0.75em"):o==="subscript"&&e.push("vertical-align:sub","font-size:0.75em");break}case "color":{let o=_e(H(l));o&&e.push(`color:${o}`);break}case "highlight":{let o=Xn[H(l)??""];o&&e.push(`background-color:${o}`);break}case "sz":{let o=H(l);o!==void 0&&ye.test(o)&&e.push(`font-size:${Number(o)/2}pt`);break}case "rFonts":{let o=Jn(l.attributes?.ascii??l.attributes?.hAnsi);o&&e.push(`font-family:${o}`);break}case "spacing":{let o=W(H(l),true);o&&e.push(`letter-spacing:${o}`);break}}return n.length>0&&(e.push(`text-decoration-line:${[...new Set(n)].join(" ")}`),r&&e.push(`text-decoration-style:${r}`),s&&e.push(`text-decoration-color:${s}`)),e.join(";")}var Kn={left:"left",start:"left",right:"right",end:"right",center:"center",both:"justify",distribute:"justify"};function Qt(t){let e=[];for(let n of t)switch(n.localName){case "jc":{let r=Kn[H(n)??""];r&&e.push(`text-align:${r}`);break}case "ind":{let r=W(n.attributes?.left??n.attributes?.start,true),s=W(n.attributes?.right??n.attributes?.end,true),l=W(n.attributes?.firstLine),o=W(n.attributes?.hanging);r&&e.push(`margin-left:${r}`),s&&e.push(`margin-right:${s}`),l?e.push(`text-indent:${l}`):o&&e.push(`text-indent:-${o}`);break}case "spacing":{let r=W(n.attributes?.before),s=W(n.attributes?.after);r&&e.push(`margin-top:${r}`),s&&e.push(`margin-bottom:${s}`);let l=n.attributes?.line,o=n.attributes?.lineRule;l!==void 0&&ye.test(l)&&o!=="exact"&&o!=="atLeast"?e.push(`line-height:${(Number(l)/240).toFixed(3)}`):l!==void 0&&ye.test(l)&&e.push(`line-height:${Number(l)/20}pt`);break}case "shd":{let r=_e(n.attributes?.fill);r&&e.push(`background-color:${r}`);break}case "pageBreakBefore":j(n)&&e.push("break-before:page");break;}return e.join(";")}var D=new Schema({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",attrs:{nodeId:{default:null},props:{default:[]}},toDOM:t=>{let e=Qt(t.attrs.props??[]);return ["p",{"data-node-id":String(t.attrs.nodeId??""),...e?{style:e}:{}},0]},parseDOM:[{tag:"p",getAttrs:t=>typeof t=="string"?null:{nodeId:t.getAttribute("data-node-id")||null,props:[]}}]},text:{group:"inline"},tab:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"tab",class:"docx-tab"},"\u2192"],parseDOM:[{tag:'span[data-token="tab"]'}]},hardBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["br"],parseDOM:[{tag:"br"}]},pageBreak:{inline:true,group:"inline",atom:true,selectable:false,toDOM:()=>["span",{"data-token":"page-break",class:"docx-page-break"}],parseDOM:[{tag:'span[data-token="page-break"]'}]},unknownInline:{inline:true,group:"inline",atom:true,selectable:false,draggable:false,attrs:{nodeId:{default:null},label:{default:""}},toDOM:t=>["span",{"data-token":"unknown","data-node-id":String(t.attrs.nodeId??""),contenteditable:"false",class:"docx-unknown-inline",title:String(t.attrs.label||"Content this editor cannot edit yet. It is preserved.")}],parseDOM:[{tag:'span[data-token="unknown"]',getAttrs:t=>typeof t=="string"?false:{nodeId:t.getAttribute("data-node-id")||null,label:""}}]}},marks:{runProps:{attrs:{props:{default:[]}},excludes:"runProps",toDOM:t=>{let e=t.attrs.props??[],n=Zt(e);return ["span",{"data-run-props":Zn(e),...n?{style:n}:{}},0]},parseDOM:[{tag:"span[data-run-props]",getAttrs:t=>{if(typeof t=="string")return false;let e=Qn(t.getAttribute("data-run-props"));return e?{props:e}:false}}]}}});function Zn(t){return JSON.stringify(Array.isArray(t)?t:[])}function Qn(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let n=[];for(let r of e){if(typeof r!="object"||r===null)return null;let s=r;if(typeof s.localName!="string"||s.attributes!==void 0&&(typeof s.attributes!="object"||s.attributes===null))return null;n.push(s.attributes===void 0?{localName:s.localName}:{localName:s.localName,attributes:s.attributes});}return n}catch{return null}}function Le(t){for(let e of t.marks)if(e.type.name==="runProps")return e.attrs.props??[];return []}function he(t,e){return JSON.stringify(xe(t))===JSON.stringify(xe(e))}function xe(t){return [...t].map(e=>({localName:e.localName,attributes:Object.fromEntries(Object.entries(e.attributes??{}).sort(([n],[r])=>n<r?-1:1))})).sort((e,n)=>e.localName<n.localName?-1:1)}function je(t){if(!t||t.kind==="textValue")return [];let e=[];for(let n of t.children){if(n.kind==="textValue"||n.localName==="rPrChange"||n.localName==="pPrChange")continue;let r={};for(let s of n.attributes)r[s.localName]=s.value;e.push(Object.keys(r).length>0?{localName:n.localName,attributes:r}:{localName:n.localName});}return e}function qt(t){return t.kind==="textValue"?"":`${{drawing:"Picture",pict:"Picture",object:"Embedded object",fldSimple:"Field",hyperlink:"Hyperlink",sdt:"Content control",tbl:"Table"}[t.localName]??t.localName} \u2014 preserved, not editable yet`}function Y(t){if(t.kind==="textValue")return [];let e=[],n=r=>{if(r.kind!=="run")return;let s=r.children.find(o=>o.kind==="runProperties"),l=je(s);for(let o of r.children)if(o.kind!=="runProperties"){if(o.kind==="tab"){e.push({kind:"tab"});continue}if(o.kind==="hardBreak"){e.push(_b(o)?{kind:"pageBreak"}:{kind:"hardBreak"});continue}if(o.kind==="text"){let g="";for(let p of o.children)p.kind==="textValue"&&(g+=p.value);g.length>0&&e.push({kind:"text",text:g,props:l});continue}e.push({kind:"unknown",nodeId:o.id,label:qt(o)});}};return Sb(t.children,0,r=>{if(r.kind==="run"){n(r);return}e.push({kind:"unknown",nodeId:r.id,label:qt(r)});}),e}function B(t){let e=[],n=r=>{if(r.kind!=="textValue"){if(r.kind==="body"){for(let s of r.children)s.kind==="paragraph"&&e.push(s);return}for(let s of r.children)n(s);}};return n(t.root),e}var en=Xe$1(16),tn=new WeakMap;function qn(t,e){let n=tn.get(t);if(!n){let r=[];We$1([t],r,0),n=Object.freeze(r),tn.set(t,n);}for(let r of n)e.push(r);}function w(t){let e=en.get(t);if(e)return e;let n=[];for(let r of Se(t))if(r.root.kind!=="textValue")for(let s of r.root.children)qn(s,n);return en.set(t,n),n}function U(t){let e=B(t).map(n=>{let r=n.kind==="textValue"?void 0:n.children.find(l=>l.kind==="paragraphProperties"),s=Y(n).map(l=>{switch(l.kind){case "text":return D.text(l.text,l.props.length>0?[D.marks.runProps.create({props:l.props})]:[]);case "tab":return D.node("tab");case "hardBreak":return D.node("hardBreak");case "pageBreak":return D.node("pageBreak");default:return D.node("unknownInline",{nodeId:l.nodeId,label:l.label})}});return D.node("paragraph",{nodeId:n.id,props:je(r)},s)});return D.node("doc",null,e.length>0?e:[D.node("paragraph")])}function Q(t){let e=[];return t.forEach(n=>{if(n.isText&&n.text){e.push({kind:"text",text:n.text,props:Le(n)});return}n.type.name==="tab"?e.push({kind:"tab"}):n.type.name==="hardBreak"?e.push({kind:"hardBreak"}):n.type.name==="pageBreak"?e.push({kind:"pageBreak"}):n.type.name==="unknownInline"&&e.push({kind:"unknown",nodeId:String(n.attrs.nodeId??""),label:String(n.attrs.label??"")});}),e}function C(t){let e="";for(let n of t)n.kind==="text"?e+=n.text:n.kind==="tab"?e+=" ":n.kind==="hardBreak"?e+=`
2
- `:n.kind==="pageBreak"&&(e+=Yb);return e}function nn(t){let e=[],n=0;for(let r of t)r.kind==="text"?n+=r.text.length:r.kind==="tab"||r.kind==="hardBreak"||r.kind==="pageBreak"?n+=1:e.push(`${r.nodeId}@${n}`);return e}function er(t,e){if(t===e)return null;let n=0,r=Math.min(t.length,e.length);for(;n<r&&t[n]===e[n];)n+=1;let s=t.length,l=e.length;for(;s>n&&l>n&&t[s-1]===e[l-1];)s-=1,l-=1;return {start:n,endBefore:s,endAfter:l}}function rn(t){let e=[];for(let n of t)if(n.kind==="text")for(let r=0;r<n.text.length;r+=1)e.push(n.props);else (n.kind==="tab"||n.kind==="hardBreak"||n.kind==="pageBreak")&&e.push(e[e.length-1]??[]);return e}function tr(t,e,n,r,s){let l=[],o=nn(e),g=nn(n);if(JSON.stringify(o)!==JSON.stringify(g))return {ok:false,reason:"unknown-content-moved",detail:t};he(r,s)||l.push({op:"setParagraphProperties",paragraphId:t,properties:xe(s)});let p=C(e),f=C(n),m=er(p,f);if(m&&(m.endBefore>m.start&&l.push({op:"deleteText",paragraphId:t,start:m.start,end:m.endBefore}),m.endAfter>m.start)){let h=f.slice(m.start,m.endAfter),x=m.start,d="",k=()=>{d.length!==0&&(l.push({op:"insertText",paragraphId:t,offset:x,text:d}),x+=d.length,d="");};for(let P of h)P===" "?(k(),l.push({op:"insertTab",paragraphId:t,offset:x}),x+=1):P===`
3
- `?(k(),l.push({op:"insertHardBreak",paragraphId:t,offset:x}),x+=1):P===Yb?(k(),l.push({op:"insertPageBreak",paragraphId:t,offset:x}),x+=1):d+=P;k();}if(!m){let h=rn(e),x=rn(n),d=0;for(;d<x.length;){if(he(h[d]??[],x[d])){d+=1;continue}let k=d,P=x[d];for(;d<x.length&&he(x[d],P)&&!he(h[d]??[],x[d]);)d+=1;l.push({op:"setRunProperties",paragraphId:t,start:k,end:d,properties:xe(P)});}}return {ok:true,ops:l}}function He(t,e){let n=B(t),r=[];if(e.forEach(l=>{l.type.name==="paragraph"&&r.push(l);}),r.length!==e.childCount)return {ok:false,reason:"unsupported-node"};let s=r.length-n.length;if(s===0){let l=[];for(let[o,g]of r.entries()){let p=n[o];if(g.attrs.nodeId!==p.id)return {ok:false,reason:"paragraph-reordered",detail:String(g.attrs.nodeId)};let f=tr(p.id,Y(p),Q(g),je(p.kind==="textValue"?void 0:p.children.find(m=>m.kind==="paragraphProperties")),g.attrs.props??[]);if(!f.ok)return f;l.push(...f.ops);}return {ok:true,ops:l}}return s===1?nr(n,r):s===-1?rr(n,r):{ok:false,reason:"paragraph-count-unexplained",detail:String(s)}}function nr(t,e){for(let n=0;n<t.length;n+=1){let r=t[n],s=e[n],l=e[n+1];if(!s||!l||s.attrs.nodeId!==r.id)continue;let o=l.attrs.nodeId;if(o!==null&&o!==r.id)continue;let g=C(Q(s));if(g+C(Q(l))===C(Y(r))&&on(t,e,n)&&an(t,e,n+1,n+2))return {ok:true,ops:[{op:"splitParagraph",paragraphId:r.id,offset:g.length}]}}return {ok:false,reason:"split-not-clean"}}function rr(t,e){for(let n=0;n+1<t.length;n+=1){let r=t[n],s=t[n+1],l=e[n];if(!l||l.attrs.nodeId!==r.id)continue;let o=C(Y(r))+C(Y(s));if(C(Q(l))===o&&on(t,e,n)&&an(t,e,n+2,n+1))return {ok:true,ops:[{op:"joinParagraphs",firstId:r.id,secondId:s.id}]}}return {ok:false,reason:"join-not-clean"}}function on(t,e,n){for(let r=0;r<n;r+=1){let s=e[r],l=t[r];if(!s||s.attrs.nodeId!==l.id||C(Q(s))!==C(Y(l)))return false}return true}function an(t,e,n,r){for(let s=0;n+s<t.length;s+=1){let l=t[n+s],o=e[r+s];if(!o||o.attrs.nodeId!==l.id||C(Q(o))!==C(Y(l)))return false}return true}function or(t,e){return ya(t,e)!==null}function Be(t,e,n){if(!n||n.created.length>0||n.deleted.length>0||n.splitJoin.length>0)return U(e);let r=new Map;t.forEach(p=>{let f=p.attrs.nodeId;typeof f=="string"&&r.set(f,p);});let s=new Set(n.dirty),l=B(e);if(l.length!==t.childCount)return U(e);let o=U(e),g=[];for(let[p,f]of l.entries()){let m=r.get(f.id);g.push(m&&!s.has(f.id)?m:o.child(p));}return D.node("doc",null,g)}function sn(t){return w(t).map(e=>_f(t,e.id)??"").join(`
4
- `)}var ar=64,ln=new WeakMap;function $e(t,e=0){if(e>ar)return false;let n=ln.get(t);if(n!==void 0)return n;let r=false;for(let s of t.children)if(s.kind!=="textValue"&&(s.kind==="commentRangeStart"||s.kind==="commentReference"||$e(s,e+1))){r=true;break}return ln.set(t,r),r}function lr(t,e){let n=t.kind==="revision"?t.ranges[0]??null:t.range;if(!n)return null;let r=e.get(n.start.paragraphId);return r===void 0?null:r}function dn(t,e,n){for(let s of e)if(s.ranges.length===0)return false;let r=new Set;for(let s of t)s.kind!=="revision"||s.ranges.length>0||un(s,n)||r.add(Qg(s));for(let s of e)if(r.has(Qg(s)))return false;return true}function cn(t,e,n,r){let s=e.get(n);if(s===void 0)return [...t];let l=[],o=null;for(let g of t){if(g.kind==="revision"&&un(g,n)){o===null&&(o=l.length);continue}if(o===null){let p=lr(g,e);p!==null&&p>s&&(o=l.length);}l.push(g);}if(o===null&&(o=l.length),r.length>0){let g=r.length<2?[...r]:[...r].sort((p,f)=>Tg(p,e)-Tg(f,e));l.splice(o,0,...g);}return ah(l)}function un(t,e){return t.ranges.length>0&&t.ranges.every(n=>n.start.paragraphId===e&&n.end.paragraphId===e)}function sr(t,e){return t.range?t.range.start.paragraphId===e||t.range.end.paragraphId===e:false}function ir(t,e){return t.revisionKind==="structural"&&t.ranges.some(n=>n.start.paragraphId===e||n.end.paragraphId===e)}function dr(t,e){return t.ranges.length===0||!t.ranges.some(r=>r.start.paragraphId===e||r.end.paragraphId===e)?false:!t.ranges.every(r=>r.start.paragraphId===e&&r.end.paragraphId===e)}function fn(t,e,n,r,s,l,o){if(t.fromRevision!==e.bodyRevision||o!==e.packageRevision+1||t.story!==void 0&&t.story.kind!=="body"||t.impact!=="text-local"||t.dirty.length!==1||t.created.length>0||t.deleted.length>0||t.splitJoin.length>0||e.commentsPart!==s||e.commentsExtendedPart!==l)return null;let g=t.dirty[0],p=ya(r,g);if(!p||p.kind!=="paragraph")return null;for(let f of n){if(f.kind==="comment"){if(sr(f,g))return null;continue}if(f.kind==="custom"){if(f.range?.start.paragraphId===g)return null;continue}if(ir(f,g)||dr(f,g))return null}return g}var mn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,cr=["ascii","hAnsi","cs","eastAsia"],ur=["asciiTheme","hAnsiTheme","cstheme","eastAsiaTheme"],fr=128,pr=/[\u0000-\u001F\u007F-\u009F]/;function $(t){return t.kind!=="textValue"}function G(t,e){return t.attributes.find(n=>n.localName===e)?.value}function gn(t,e){let n=new Map;for(let s of t)for(let l of s.children)if($(l))for(let[o,g]of yn(l,e))n.has(o)||n.set(o,g);let r=[...n.values()];return r.sort((s,l)=>s<l?-1:s>l?1:0),r}var ze=new WeakMap,mr=16,gr=32;function yn(t,e,n=0){let r=e?.major??null,s=e?.minor??null,l=ze.get(t);if(l&&l.major===r&&l.minor===s)return l.byFold;if(t.children.length>=mr&&n<gr&&t.localName!=="rFonts"){let f=new Map;for(let m of t.children)if($(m))for(let[h,x]of yn(m,e,n+1))f.has(h)||f.set(h,x);return ze.set(t,{major:r,minor:s,byFold:f}),f}let o=new Map,g=f=>{if(!f||!mn.test(f))return;let m=f.toLowerCase();o.has(m)||o.set(m,f);},p=[t];for(;p.length>0;){let f=p.pop();if($(f)){if(f.localName==="rFonts"){for(let m of cr)g(G(f,m));if(e)for(let m of ur){let h=G(f,m);h!==void 0&&(h.startsWith("major")?g(e.major):h.startsWith("minor")&&g(e.minor));}}for(let m=f.children.length-1;m>=0;m-=1)p.push(f.children[m]);}}return ze.set(t,{major:r,minor:s,byFold:o}),o}function hn(t){let e=[...t];for(;e.length>0;){let n=e.pop();if($(n)){if(n.localName==="t"&&n.namespaceUri===da){for(let r of n.children)if(!$(r)&&r.value.length>0)return true;continue}for(let r of n.children)e.push(r);}}return false}var yr=new Set(["paragraph","character","table","numbering"]),hr=/^[0-9A-Fa-f]{6}$/,xr=16,pn=new Map([["normal",0],["title",1],["subtitle",2],["heading 1",11],["heading 2",12],["heading 3",13],["heading 4",14],["heading 5",15],["heading 6",16],["heading 7",17],["heading 8",18],["heading 9",19]]);function xn(t){return t.children}function We(t,e){for(let n of xn(t))if($(n)&&n.localName===e)return n}function kr(t){return pn.get(t.name.toLowerCase())??pn.get(t.styleId.toLowerCase())??Number.MAX_SAFE_INTEGER}function Ue(t){return t===void 0||t.length===0||t.length>fr||pr.test(t)?null:t}function kn(t,e){if(!t)return [];let n=new Map;for(let l of t.children){if(!$(l)||l.localName!=="style")continue;let o=Ue(G(l,"styleId"));o!==null&&!n.has(o)&&n.set(o,l);}let r=l=>{let o=false,g=false,p=null,f=false,m=false,h=new Set,x=l;for(let P=0;P<xr&&x!==null&&!h.has(x);P+=1){h.add(x);let N=n.get(x);if(!N)break;let v=We(N,"rPr");for(let R of v?xn(v):[]){if(!$(R))continue;let T=G(R,"val"),A=T!=="0"&&T!=="false"&&T!=="off";R.localName==="b"&&!f?(o=A,f=true):R.localName==="i"&&!m?(g=A,m=true):R.localName==="color"&&p===null&&T&&hr.test(T)&&(p=T);}let S=We(N,"basedOn");x=S?Ue(G(S,"val")):null;}let d=e?.(l),k=d?.fontFamily??null;return {fontFamily:k!==null&&mn.test(k)?k:null,fontSizePt:d?.fontSizeHalfPoints!=null&&d.fontSizeHalfPoints>0?d.fontSizeHalfPoints/2:null,bold:o,italic:g,color:p}},s=[];for(let[l,o]of n){let g=G(o,"type");if(g===void 0||!yr.has(g))continue;let p=We(o,"name"),f=Ue(p?G(p,"val"):void 0);s.push({styleId:l,name:f??l,type:g,preview:r(l)});}return s.map((l,o)=>({entry:l,index:o,rank:kr(l)})).sort((l,o)=>l.rank-o.rank||l.index-o.index).map(l=>l.entry)}var Pr=128,Or=/[\u0000-\u001F\u007F-\u009F]/,br=/[\u0000-\u001F\u007F-\u009F]/g,vr=200,Sr=/^heading ([1-9])$/i;function Ye(t){return t.kind!=="textValue"}function ie(t,e){for(let n of t.children)if(Ye(n)&&n.localName===e)return n}function se(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Rr(t){let e=new Map;if(!t)return e;for(let n of t.children){if(!Ye(n)||n.localName!=="style"||se(n,"type")!=="paragraph")continue;let r=se(n,"styleId");if(r===void 0||r.length===0||r.length>Pr||Or.test(r))continue;let s=ie(n,"name"),l=s?se(s,"val"):void 0,o=l!==void 0?Sr.exec(l):null;if(o){e.set(r,Number(o[1])-1);continue}let g=ie(n,"pPr"),p=g?ie(g,"outlineLvl"):void 0,f=p?se(p,"val"):void 0;f!==void 0&&/^[0-8]$/.test(f)&&e.set(r,Number(f));}return e}function Ge(t){let e=ie(t,"pPr"),n=e?ie(e,"pStyle"):void 0;return n?se(n,"val"):void 0}function Pn(t,e){let n=Rr(e);if(n.size===0)return [];let r=[];for(let s of B(t)){if(!Ye(s))continue;let l=Ge(s);if(l===void 0)continue;let o=n.get(l);if(o===void 0)continue;let p=(_f(t,s.id)??"").replace(br," ").trim().slice(0,vr);p.length!==0&&r.push({text:p,level:o,blockId:s.id});}return r}var ke=48,Nr=/[\u0000-\u001F\u007F-\u009F]/g;function On(t){return t.kind!=="textValue"}function Pe(t){if(t.kind==="textValue")return t.value.length;if(t.kind==="tab"||t.kind==="hardBreak")return 1;if(t.kind==="runProperties"||t.kind==="generic")return 0;if(t.kind==="hyperlink"||Lb(t)){let n=0,r=t.kind==="hyperlink"?t.children:Nb(t)??[];for(let s of r)n+=Pe(s);return n}let e=0;for(let n of t.children)e+=Pe(n);return e}function Tr(t){let e=[],n=0;return On(t)&&Sb(t.children,0,r=>{if(r.kind==="run"){e.push(n),n+=Pe(r);return}n+=Pe(r);}),e}function Ir(t,e){if(t.length===0)return {index:0,offset:e};for(let n=t.length-1;n>=0;n-=1){let r=t[n];if(e>=r)return {index:n,offset:e-r}}return {index:0,offset:e}}function Xe(t,e){return t.replace(Nr," ").slice(0,e)}function bn(t,e,n={}){let r={matches:[],truncated:false};if(!hh(e))return r;let s=n.limit!==void 0&&Number.isInteger(n.limit)&&n.limit>0?Math.min(n.limit,2e3):2e3,l={...n.matchCase===void 0?{}:{matchCase:n.matchCase},...n.wholeWord===void 0?{}:{wholeWord:n.wholeWord}},o=[],g=0;for(let p of B(t)){if(!On(p))continue;let f=g;g+=1;let m=_f(t,p.id)??"";if(m.length===0)continue;let h=ih(m,e,s-o.length,l),x=null;for(let d of h.matches){let k=d.start+d.length;x??=Tr(p);let P=Ir(x,d.start);o.push({blockId:p.id,start:d.start,length:d.length,paragraphIndex:f,runIndex:P.index,runOffset:P.offset,text:Xe(m.slice(d.start,k),256),contextBefore:Xe(m.slice(Math.max(0,d.start-ke),d.start),ke),contextAfter:Xe(m.slice(k,k+ke),ke)});}if(h.truncated)return {matches:o,truncated:true}}return {matches:o,truncated:false}}var Er=["lt1","dk1","lt2","dk2","accent1","accent2","accent3","accent4","accent5","accent6"],Dr=/^[0-9A-Fa-f]{6}$/,vn={windowText:"000000",window:"FFFFFF"};function Rn(t){return t.kind!=="textValue"}function Oe(t,e){return t.attributes.find(n=>n.localName===e)?.value}function Nn(t,e){let n=[t];for(;n.length>0;){let r=n.pop();if(Rn(r)){if(r.localName===e)return r;for(let s=r.children.length-1;s>=0;s-=1)n.push(r.children[s]);}}return null}function be(t,e){for(let n of t.children)if(Rn(n)&&(e===void 0||n.localName===e))return n;return null}function Cr(t){let e=be(t);if(!e)return null;let n;if(e.localName==="srgbClr")n=Oe(e,"val");else if(e.localName==="sysClr"){let r=Oe(e,"val")??"";n=Oe(e,"lastClr")??(Object.prototype.hasOwnProperty.call(vn,r)?vn[r]:void 0);}return n===void 0||!Dr.test(n)?null:n.toUpperCase()}var Mr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Sn(t,e){let n=be(t,e),r=n?be(n,"latin"):null,s=r?Oe(r,"typeface"):void 0;return s!==void 0&&Mr.test(s)?s:null}function de(t){if(!t)return {major:null,minor:null};let e=Nn(t,"fontScheme");return e?{major:Sn(e,"majorFont"),minor:Sn(e,"minorFont")}:{major:null,minor:null}}function Tn(t){if(!t)return [];let e=Nn(t,"clrScheme");if(!e)return [];let n=[];for(let r of Er){let s=be(e,r),l=s?Cr(s):null;if(l===null)return [];n.push({slot:r,hex:l});}return n}var wr=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;var Ar=/[\u0000-\u001F\u007F-\u009F]/;function Dn(t){return t.kind!=="textValue"}function X(t,e){for(let n of t.children)if(Dn(n)&&n.localName===e)return n}function J(t,e){return t.attributes.find(n=>n.localName===e)?.value}function In(t){return t===void 0||t.length===0||t.length>128||Ar.test(t)?null:t}function ve(t,e){return t==="minorAscii"||t==="minorHAnsi"?e.minor:t==="majorAscii"||t==="majorHAnsi"?e.major:null}function Fr(t,e){let n=ve(J(t,"asciiTheme"),e)??ve(J(t,"hAnsiTheme"),e);if(n!==null)return n;let r=J(t,"ascii")??J(t,"hAnsi");return r===void 0?null:wr.test(r)?r:null}function En(t,e){if(!t)return {fontFamily:null,fontSizeHalfPoints:null};let n=X(t,"rFonts"),r=X(t,"sz"),s=r?J(r,"val"):void 0,l=s!==void 0&&/^\d{1,4}$/.test(s)?Number(s):null;return {fontFamily:n?Fr(n,e):null,fontSizeHalfPoints:l!==null&&l>=2&&l<=3276?l:null}}function Je(t,e){let n=new Map,r={fontFamily:null,fontSizeHalfPoints:null};if(t){let o=X(t,"docDefaults"),g=o?X(o,"rPrDefault"):void 0;r=En(g?X(g,"rPr"):void 0,e);for(let p of t.children){if(!Dn(p)||p.localName!=="style")continue;let f=In(J(p,"styleId"));if(f===null||n.has(f))continue;let m=X(p,"basedOn");n.set(f,{basedOn:In(m?J(m,"val"):void 0),own:En(X(p,"rPr"),e)});}}let s=new Map,l=o=>{let g=o??"",p=s.get(g);if(p)return p;let f=null,m=null,h=new Set,x=o;for(let k=0;x!==null&&k<16&&!h.has(x);k+=1){h.add(x);let P=n.get(x);if(!P)break;f??=P.own.fontFamily,m??=P.own.fontSizeHalfPoints,x=P.basedOn;}let d={fontFamily:f??r.fontFamily,fontSizeHalfPoints:m??r.fontSizeHalfPoints};return s.set(g,d),d};return (o,g)=>{let p=l(o),f=g?.find(h=>h.localName==="rFonts"),m=f?ve(f.attributes?.asciiTheme,e)??ve(f.attributes?.hAnsiTheme,e):null;return m===null?p:{...p,fontFamily:m}}}var Cn=new WeakMap;function Ve(t){let e=Cn.get(t);if(e!==void 0)return e;let n=Uc(t),r=n===null||!Tc(n)?null:n;return Cn.set(t,r),r}var Ke=class{#e;#t;constructor(e,n){this.#e=e,this.#t=n;}get size(){return this.#e.size}get(e){if(this.#e.has(e))return this.#t.find(n=>e.startsWith(`${n.name}#`))}has(e){return this.get(e)!==void 0}*entries(){for(let e of this.#e.keys()){let n=this.get(e);n&&(yield [e,n]);}}keys(){return this.#e.keys()}*values(){for(let[,e]of this.entries())yield e;}[Symbol.iterator](){return this.entries()}forEach(e,n){for(let[r,s]of this.entries())e.call(n,s,r,this);}};function Mn(t,e){return Object.freeze({...t,partByNode:new Ke(t.ordinalByNode,e)})}function wn(t){let e=new Map,n=new Map,r=new Map,s=new Set,l=new Map,o=new Map,g=0;for(let p of t)for(let f of w(p)){r.set(f.id,g),l.set(f.id,p),g+=1;let m=Ve(f);if(m===null)continue;e.set(f.id,m);let h=m.toUpperCase(),x=o.get(h);x?(x.push(f.id),s.add(h)):(o.set(h,[f.id]),n.set(h,f.id));}return Object.freeze({paraIdByNode:e,nodeByParaId:n,ordinalByNode:r,ambiguousParaIds:s,partByNode:l,claimantsByParaId:o})}function An(t,e){let n=t.indexOf("#");if(n<=0)return null;let r=t.slice(0,n),s=e.body.name===r?e.body:void 0;s??=e.openStories.find(g=>g.name===r);let l=s?void 0:e.otherStories.find(g=>g.name===r);if(s??=l?e.normalize(l):void 0,!s)return null;let o=ya(s,t);return o?.kind==="paragraph"?Ve(o):null}var _r=Object.freeze([]);function Lr(t,e={}){let n=sb(t);if(!n.ok)return {ok:false,reason:n.reason,...n.detail?{detail:n.detail}:{}};let r=n.package,s=r.parts.get(r.mainDocumentPart);if(!s)return {ok:false,reason:"no-main-document-tree",detail:r.mainDocumentPart};let l=_c(s),o=new fg(r,l),g=null,p=null,f=null,m=null;o.subscribe(a=>{m=a;});let h=()=>o.bodyStore(),x=()=>o.currentPackage(),d=Object.freeze({kind:"body"}),k=(a,i)=>{let c=o.currentPackage(),u=a.checkpoint();a.graftPackage(()=>o.currentPackage());let y=i();return y.ok&&(a.restoreHistoryStacks(u),o.replacePackageShell(a.package),o.adoptPackageUnit(c),o.publishStoryWrite(y.change)),y},P=()=>{if(g&&m&&g.packageRevision===m.fromRevision&&o.packageRevision===m.toRevision&&m.story?.kind==="body"&&m.impact==="text-local"&&m.created.length===0&&m.deleted.length===0&&m.splitJoin.length===0&&(g={...g,packageRevision:o.packageRevision}),!g||g.packageRevision!==o.packageRevision){let a=Vb(x());g={packageRevision:o.packageRevision,resolution:a,parts:Ub(a)};}return g},N="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",v="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",S$1=null,R$1=()=>{let a=x(),i=(a.relationships.get(a.mainDocumentPart)??[]).find(y=>y.type===N),c;if(i){let y=E(i);y.mode==="Internal"&&y.target.ok&&(c=a.parts.get(y.target.partName));}c??=a.parts.get("/word/styles.xml");let u=c?.root??null;return u!==S$1&&(S$1=u,Te=null,re$1=null),S$1},T=false,A=null,Se=()=>{if(T)return A;T=true;let a=x(),i=(a.relationships.get(a.mainDocumentPart)??[]).find(u=>u.type===v),c;if(i){let u=E(i);u.mode==="Internal"&&u.target.ok&&(c=a.parts.get(u.target.partName));}return c??=a.parts.get("/word/numbering.xml"),A=c?.root??null,A},ce="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",K=-1,q=null,Ze=()=>{if(K===o.packageRevision)return q;K=o.packageRevision;let a=x(),i=(a.relationships.get(a.mainDocumentPart)??[]).find(u=>u.type===ce),c;if(i){let u=E(i);u.mode==="Internal"&&u.target.ok&&(c=a.parts.get(u.target.partName));}return c??=a.parts.get("/word/settings.xml"),q=c?.root??null,q},_n="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",Ln="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",Qe=(a,i)=>{let c=x(),u=(c.relationships.get("/")??[]).find(O=>O.type===a),y;if(u){let O=E(u);O.mode==="Internal"&&O.target.ok&&(y=c.parts.get(O.target.partName));}return y??c.parts.get(i)},qe=-1,Re=R,jn=()=>{if(qe===o.packageRevision)return Re;qe=o.packageRevision;let a=Qe(_n,"/docProps/core.xml"),i=Qe(Ln,"/docProps/app.xml");return Re=S(a?.root??null,i?.root??null),Re},Hn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",et=false,Ne=null,ee=()=>{if(et)return Ne;et=true;let a=x(),i=(a.relationships.get(a.mainDocumentPart)??[]).find(u=>u.type===Hn),c;if(i){let u=E(i);u.mode==="Internal"&&u.target.ok&&(c=a.parts.get(u.target.partName));}return c??=a.parts.get("/word/theme/theme1.xml"),Ne=c?.root??null,Ne},Bn="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",ue=null,$n=()=>{if(ue)return ue;let a=x(),i=(a.relationships.get(a.mainDocumentPart)??[]).find(u=>u.type===Bn),c;if(i){let u=E(i);u.mode==="Internal"&&u.target.ok&&(c=a.parts.get(u.target.partName));}return c??=a.parts.get("/word/fontTable.xml"),ue=Object.freeze(G$1(a,c)),ue},te=null,ne=null,Te=null,tt=null,nt=null,rt=()=>{let a=[h().part.root],i=R$1();i&&a.push(i);let c=new Set;for(let u of _())c.has(u)||(c.add(u),a.push(u.root));return a},re$1=null,fe=null,oe=null,ae=null,V=null,ot=new WeakMap,pe=null,at=a=>{let i=ot.get(a);if(i)return i;let c=_c(a);return ot.set(a,c),c},lt=()=>{let a=o.packageRevision,i=o.openStoryToken();if(!V||V.revision!==a||V.openStories!==i){let c=o.openStoryParts(),u=new Set(c.map(E=>E.name)),y=_().filter(E=>!u.has(E.name)).map(at),O=[h().part,...c,...y],b=V,I=b!==null&&m!==null&&b.openStories===i&&b.revision===m.fromRevision&&a===m.toRevision&&m.impact==="text-local"&&m.created.length===0&&m.deleted.length===0&&m.splitJoin.length===0&&b.parts.length===O.length&&b.parts.every((E,M)=>E.name===O[M]?.name);V={revision:a,openStories:i,parts:O,index:I&&b?Mn(b.index,O):wn(O)};}return V.index},st=()=>{let a=h().part.name,i=new Map;for(let c of [h().part,..._()])for(let[u,y]of ug(x(),c.name,a))i.set(u,y);return i},zn=()=>[h().part,..._()],_=()=>{let a=[],i=new Set;for(let u of P().parts)for(let y of [u.headers,u.footers])for(let O of y.values())i.has(O)||(i.add(O),a.push(O));let c=x();for(let u of ["footnote","endnote"]){let y=ge(c,u);!y||i.has(y)||(i.add(y),a.push(y));}return a};return {ok:true,session:{editable:w(h().part).length>0,paragraphIds:()=>w(h().part).map(a=>a.id),paragraphIdsIn(a=d){let i=o.partFor(a);return i?w(i).map(c=>c.id):[]},part:()=>h().part,partFor:a=>o.partFor(a),currentPackage:x,applyTreeOps(a,i,c,u=d){if(a.length===0)return {committed:false,rejected:false,opCount:0};let y=a.filter(b=>cd(b)||re(b)).length;if(y>0){if(y!==a.length||a.length!==1)return {committed:false,rejected:true,opCount:a.length,reason:"invalidArgs"};let b=o.applyLifecycleOp(a[0]);return b.ok?{committed:true,rejected:false,opCount:1}:{committed:false,rejected:true,opCount:1,reason:b.detail??b.reason}}let O=o.transact(u,b=>{i!==void 0&&b.selectionBefore(i),c!==void 0&&b.selectionAfter(c);for(let I of a)b.apply(I);});return O.ok?{committed:true,rejected:false,opCount:a.length}:{committed:false,rejected:true,opCount:a.length,reason:O.reason}},projectDoc:()=>U(h().part),reconcile:a=>Be(a,h().part,m),lastCommitWasStructural:()=>m!==null&&(m.created.length>0||m.deleted.length>0||m.splitJoin.length>0||m.impact==="global"),applyPmDoc(a){let i=h(),c=He(i.part,a);if(!c.ok)return {committed:false,rejected:true,opCount:0,reason:c.reason};if(c.ops.length===0)return {committed:false,rejected:false,opCount:0};let u=o.transact(d,y=>{for(let O of c.ops)y.apply(O);});return u.ok?{committed:true,rejected:false,opCount:c.ops.length}:{committed:false,rejected:true,opCount:c.ops.length,reason:u.reason}},storyParts:zn,bodyText:()=>sn(h().part),storyText(a){let i=o.partFor(a);return i?w(i).map(c=>_f(i,c.id)??"").join(`
5
- `):null},revision:()=>h().revision,revisionFor:a=>o.revisionFor(a),packageRevision:()=>o.packageRevision,canUndo:()=>o.canUndo,canRedo:()=>o.canRedo,undo:()=>{let a=o.selectionForUndo();return o.undo()===null?null:a},redo:()=>{let a=o.selectionForRedo();return o.redo()===null?null:a},beginComposition:(a=d)=>{o.beginComposition(a);},endComposition:()=>o.endComposition(),subscribe(a){return o.subscribe(a)},save(){return tb(x())},headerFooterParts:()=>{let a=P().parts;return a[a.length-1]??Xb(x())},headerFooterPartsBySection:()=>P().parts,headerFooterResolutionBySection:()=>P().resolution,documentFonts(){return te&&te.revision===o.packageRevision||(te={revision:o.packageRevision,fonts:gn(rt(),de(ee()))}),te.fonts},rendersText(){return ne&&ne.revision===o.packageRevision||(ne={revision:o.packageRevision,rendersText:hn(rt())}),ne.rendersText},documentStyles(){re$1??=Je(R$1(),de(ee()));let a=re$1;return Te??=kn(R$1(),i=>a(i)),Te},stylesRoot:()=>R$1(),documentThemeFonts(){return nt??=de(ee()),nt},numberingRoot:()=>Se(),settingsRoot:()=>Ze(),documentProperties:()=>jn(),trackingSettings:()=>O(Ze()),documentThemeColors(){return tt??=Tn(ee()),tt},effectiveRunDefaults(a,i){re$1??=Je(R$1(),de(ee()));let c=h();if(!fe||fe.revision!==c.revision){let u=new Map;for(let y of w(c.part))y.kind!=="textValue"&&u.set(y.id,Ge(y)??null);fe={revision:c.revision,byId:u};}return re$1(fe.byId.get(a)??null,i)},documentOutline(){let a=h();return oe&&oe.revision===a.revision||(oe={revision:a.revision,outline:Pn(a.part,R$1())}),oe.outline},findText(a,i){let c=h(),u=`${i?.matchCase===true?"c":""}${i?.wholeWord===true?"w":""}${i?.limit??""}\0${a}`;if(ae&&ae.revision===c.revision&&ae.key===u)return ae.result;let y=bn(c.part,a,i??{});return ae={revision:c.revision,key:u,result:y},y},embeddedFonts:$n,paragraphAnchors:lt,paraIdOf:a=>An(a,{body:h().part,openStories:o.openStoryParts(),otherStories:_(),normalize:at}),nodeIdOf:a=>lt().nodeByParaId.get(a.toUpperCase())??null,relationshipTarget:(a,i=d)=>{let c=x(),u=o.partFor(i);return u?bd(c,u.name,a):null},bookmarks:()=>{let a=o.packageRevision;if(!pe||pe.revision!==a){let i=new Map(Dc(h().part));for(let c of _())for(let[u,y]of Dc(c))i.has(u)||i.set(u,y);pe={revision:a,index:i};}return pe.index},ensureHyperlinkRelationship(a,i=d){let c=o.partFor(i);if(!c)return null;let u=x(),y=ad(u,a,c.name);return y?(y.pkg!==u&&o.replacePackageShell(y.pkg),y.relationshipId):null},reviewItems(){let a=e.reviewModel;if(!a)return _r;let i=h(),c=`${o.packageRevision}:${i.revision}`;if(p&&p.revisionKey===c)return p.items;let u=x(),y=u.parts.get(ng(u,i.part.name)),O=u.parts.get(og(u,i.part.name)),b=_(),I=p&&m?fn(m,p,p.items,i.part,y,O,o.packageRevision):null,E,M;if(I&&p){let F=a.revisionItemsOfParagraph(i.part,I);dn(p.items,F,I)?(E=cn(p.items,p.paragraphOrder,I,F),M=p.paragraphOrder):(M=bh(i.part),E=a.collectReviewItems({storyPart:i.part,furnitureParts:b,commentsPart:y,commentsExtendedPart:O,customNodePayloads:st()}));}else M=bh(i.part),E=a.collectReviewItems({storyPart:i.part,furnitureParts:b,commentsPart:y,commentsExtendedPart:O,customNodePayloads:st()});return p={revisionKey:c,bodyRevision:i.revision,packageRevision:o.packageRevision,items:E,paragraphOrder:M,commentsPart:y,commentsExtendedPart:O},p.items},hasReviewContent(){let a=o.packageRevision;if(!f||f.revision!==a){let i=[h().part,..._()];f={revision:a,present:i.some(c=>Bf(c).length>0||$e(c.root))};}return f.present},replyToComment(a,i,c,u,y,O=d){let b=O.kind==="body"?null:o.resolveStory(O),I=b?.ok?b.store:h(),E=o.currentPackage(),M=I.checkpoint();I.graftPackage(()=>o.currentPackage());let F=kg(I,{anchor:{paragraphId:i.paragraphId,start:i.start,end:i.end,...i.endParagraphId===void 0?{}:{endParagraphId:i.endParagraphId}},author:u,text:c,...y===void 0?{}:{date:y},...a===null?{}:{replyToCommentId:a}});return F.ok?(I.restoreHistoryStacks(M),o.replacePackageShell(I.package),o.adoptPackageUnit(E),o.publishStoryWrite(F.change),F.commentId):null},setCommentResolved(a,i){let c=h(),u=o.currentPackage(),y=c.checkpoint();c.graftPackage(()=>o.currentPackage());let O=lg(c,a,i);return O.ok?(O.changed&&(c.restoreHistoryStacks(y),o.replacePackageShell(c.package),o.adoptPackageUnit(u),o.publishStoryWrite(O.change)),true):false},deleteComment(a,i=d,c){return this.deleteComments([{commentId:a}],i,c)},deleteComments(a,i=d,c){if(a.length===0)return false;let u=i.kind==="body"?h().part:o.partFor(i);if(!u)return false;let y={storyPartName:u.name,...c===void 0?{}:{noteId:c}},O=h(),b=o.currentPackage(),I=O.checkpoint();O.graftPackage(()=>o.currentPackage());let E=false,M=false,F=O.transact(Wn=>{Wn.applyPackage(it=>{let le=it;for(let me of a){let Ie=me.parentCommentId===void 0?cf(le,me.commentId,y):df(le,me.commentId,me.parentCommentId,y);if(Ie===null)return E=true,it;M||=Ie!==le,le=Ie;}return le});});return E||!F.ok||!M?false:(O.restoreHistoryStacks(I),o.installPackageSnapshot(O.package),o.adoptPackageUnit(b),o.publishStoryWrite(F.change),true)},insertCustomNode(a,i=d){let c=i.kind==="body"?null:o.resolveStory(i),u=c?.ok?c.store:h();return k(u,()=>rg(u,a,h().part.name))},removeCustomNode(a,i=d){let c=i.kind==="body"?null:o.resolveStory(i),u=c?.ok?c.store:h();return k(u,()=>sg(u,a))},sweepCustomNodePayloads(a){let i=h(),c=tg(o.currentPackage(),i.part.name,a);return c.ok?c.removed.length===0?{ok:true,removed:[]}:(o.replacePackageShell(c.pkg),{ok:true,removed:c.removed}):{ok:false,reason:c.reason}},ensureListDefinition(a){let i=L(x(),a);return i?(o.replacePackageShell(i.pkg),T=false,A=null,i.numId):null},ensureNumberingLevel(a,i,c){let u=x(),y=M(u,a,i,c);return y?(y!==u&&(o.replacePackageShell(y),T=false,A=null),true):false},insertImage(a,i){return o.insertImage(a,i)},replaceImage(a,i,c,u,y,O){return o.replaceImage(a,i,c,u,y,O)},deleteImage(a,i){return o.deleteImage(a,i)},deleteImageTracked(a,i,c){return o.deleteImageTracked(a,i,c)},applyImageProperties(a,i){return o.applyImageProperties(a,i)},applyFragmentPaste(a,i){return o.applyFragmentPaste(a,i)}}}}var jr=b.projection;function Kr(t,e,n){let r=t.filter(s=>s.localName!==e);return r.length!==t.length?r:[...r,n?{localName:e,attributes:n}:{localName:e}]}function Vr(t,e,n={}){let r=null,s=false,l=()=>n.onChange?.(o()),o=()=>({revision:e.revision(),canUndo:e.canUndo(),canRedo:e.canRedo(),lastRejection:r}),g=d=>{s=true;let k=f.state.tr.replaceWith(0,f.state.doc.content.size,d.content);k.setMeta("addToHistory",false),f.dispatch(k),s=false;},p=d=>()=>(d()&&(g(e.projectDoc()),l()),true),f=new EditorView(t,{state:EditorState.create({doc:e.projectDoc(),plugins:[keymap({...baseKeymap,Home:selectTextblockStart,End:selectTextblockEnd,"Mod-z":p(()=>e.undo()!==null),"Mod-y":p(()=>e.redo()!==null),"Shift-Mod-z":p(()=>e.redo()!==null),"Mod-b":(d,k)=>x(d,k,"b"),"Mod-i":(d,k)=>x(d,k,"i"),"Mod-u":(d,k)=>x(d,k,"u",{val:"single"})})]}),editable:()=>e.editable,handleDOMEvents:{keydown:d=>(m(d),false),beforeinput:(d,k)=>{let P=k;if(d.composing)return false;m(d);let N=P.inputType;if(N==="insertText"&&P.data!=null){P.preventDefault();let{from:v,to:S}=d.state.selection;return d.dispatch(d.state.tr.insertText(P.data,v,S)),true}if(N==="deleteContentBackward"){P.preventDefault();let{from:v,empty:S}=d.state.selection;return S?v>0?d.dispatch(d.state.tr.delete(v-1,v)):joinBackward(d.state,d.dispatch):deleteSelection(d.state,d.dispatch),true}if(N==="deleteContentForward"){P.preventDefault();let{from:v,to:S,empty:R}=d.state.selection;return R?S<d.state.doc.content.size?d.dispatch(d.state.tr.delete(v,v+1)):joinForward(d.state,d.dispatch):deleteSelection(d.state,d.dispatch),true}return N==="insertParagraph"?(P.preventDefault(),splitBlock(d.state,d.dispatch),true):false},compositionstart:()=>(e.beginComposition(),false),compositionend:()=>(e.endComposition(),l(),false)},dispatchTransaction(d){let k=f.state.apply(d);if(s||!d.docChanged){f.updateState(k);return}let P=e.applyPmDoc(k.doc);if(P.rejected){r=String(P.reason??"rejected"),f.updateState(k),g(e.projectDoc()),l();return}r=null,f.updateState(P.committed&&e.lastCommitWasStructural()?h(k):k),l();}});function m(d){if(d.composing||s)return;let k=d.dom.ownerDocument.getSelection(),P=k?.anchorNode,N=k?.focusNode;if(!(!k||!P||!N)&&!(!d.dom.contains(P)||!d.dom.contains(N)))try{let v=d.posAtDOM(P,k.anchorOffset),S=d.posAtDOM(N,k.focusOffset),R=d.state.selection;if(R.anchor===v&&R.head===S)return;let T=TextSelection.create(d.state.doc,v,S);d.dispatch(d.state.tr.setSelection(T).setMeta("addToHistory",!1));}catch{}}function h(d){let k=e.paragraphIds(),P=d.tr,N=false,v=0;return d.doc.forEach((S,R)=>{let T=k[v];v+=1,!(S.type.name!=="paragraph"||T===void 0)&&S.attrs.nodeId!==T&&(P=P.setNodeMarkup(R,void 0,{...S.attrs,nodeId:T}),N=true);}),N?d.apply(P.setMeta("addToHistory",false)):d}function x(d,k,P,N){let v=D.marks.runProps;if(!k)return true;let{from:S,to:R,empty:T}=d.selection;if(T)return true;let Se=d.doc.resolve(S).marks().find(q=>q.type===v)?.attrs.props??[],ce=Kr(Se,P,N),K=d.tr;return K.removeMark(S,R,v),ce.length>0&&K.addMark(S,R,v.create({props:ce})),k(K),true}return {view:f,state:o,undo:()=>p(()=>e.undo()!==null)(),redo:()=>p(()=>e.redo()!==null)(),toggleRunProperty(d,k){x(f.state,f.dispatch.bind(f),d,k);},destroy:()=>f.destroy()}}export{D as a,Le as b,B as c,w as d,U as e,He as f,or as g,Be as h,Ge as i,Lr as j,jr as k,Vr as l};