@docx-editor.dev/core 2.36.0 → 2.37.0-canary.20261110032710.sha-525df6f

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 (102) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +6 -6
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +11 -11
  6. package/dist/binding.js +1 -1
  7. package/dist/{chrome-print-B9U_PiqL.d.ts → chrome-print-BSsqYQtt.d.ts} +51 -19
  8. package/dist/chunk-36NJQDWI.cjs +31 -0
  9. package/dist/chunk-3OKDY5TX.cjs +3 -0
  10. package/dist/{chunk-I34OVDHO.cjs → chunk-4QLFADOG.cjs} +1 -1
  11. package/dist/chunk-6EGRB3J4.js +6 -0
  12. package/dist/chunk-6I6V2JDF.cjs +7 -0
  13. package/dist/chunk-77L2HX42.js +1 -0
  14. package/dist/chunk-ATU65CUF.cjs +32 -0
  15. package/dist/chunk-EB5XLX3A.js +4 -0
  16. package/dist/chunk-G7GO4CNK.cjs +2 -0
  17. package/dist/chunk-JK4HBRVP.js +7 -0
  18. package/dist/{chunk-D75AXVLG.cjs → chunk-JZXMWGF4.cjs} +1 -1
  19. package/dist/{chunk-HLMY6NFI.js → chunk-MLJJL4QG.js} +1 -1
  20. package/dist/chunk-MYNOUTWY.js +1 -0
  21. package/dist/{chunk-QTRRXJXQ.cjs → chunk-NPPHSBFT.cjs} +3 -3
  22. package/dist/{chunk-7ZSPY7WH.cjs → chunk-OTZNA6FP.cjs} +1 -1
  23. package/dist/chunk-Q3FUAUL4.js +31 -0
  24. package/dist/chunk-RFMMFHWX.cjs +6 -0
  25. package/dist/chunk-T6MYXF6V.js +32 -0
  26. package/dist/chunk-TTPQZXYS.js +3 -0
  27. package/dist/{chunk-4RDU6QVH.cjs → chunk-UMDB6PEV.cjs} +1 -1
  28. package/dist/{chunk-NTDLU6W6.cjs → chunk-UP5TM6T6.cjs} +1 -1
  29. package/dist/{chunk-2BVJFI6B.js → chunk-WMM772MS.js} +1 -1
  30. package/dist/chunk-XI5HK3TZ.js +282 -0
  31. package/dist/chunk-XMJFDVE2.js +4 -0
  32. package/dist/chunk-XPBKJQTG.cjs +282 -0
  33. package/dist/{chunk-VS2MXS62.js → chunk-YCOHPEF2.js} +1 -1
  34. package/dist/{chunk-IMTQS6N5.cjs → chunk-YVK3NMR6.cjs} +1 -1
  35. package/dist/{chunk-K3UKJU4K.js → chunk-YVLF7HBD.js} +1 -1
  36. package/dist/chunk-Z6NPBOE6.js +2 -0
  37. package/dist/chunk-ZY7HJR3R.cjs +4 -0
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +2 -2
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/contracts/document.d.ts +2 -2
  42. package/dist/contracts/editor.d.ts +8 -8
  43. package/dist/contracts/modules.d.ts +9 -9
  44. package/dist/contracts/types.d.ts +3 -3
  45. package/dist/{custom-node-writes-DqzeiTpY.d.ts → custom-node-writes-Buryuzow.d.ts} +2 -2
  46. package/dist/{document-protection-CGnc6WX7.d.ts → document-protection-Denp0lhl.d.ts} +1 -1
  47. package/dist/{drawing-graphic-kind-Dw4Qu9VA.d.ts → drawing-graphic-kind-DjGMFeSM.d.ts} +2 -2
  48. package/dist/{drawing-preview-package-BuFluWSg.d.ts → drawing-preview-package-LHyHuTVq.d.ts} +1 -1
  49. package/dist/{editor-CoU0Ipa9.d.ts → editor-B0xPJSXd.d.ts} +233 -9
  50. package/dist/editor.cjs +1 -1
  51. package/dist/editor.css +2 -2
  52. package/dist/editor.d.ts +309 -26
  53. package/dist/editor.js +1 -1
  54. package/dist/export.cjs +2 -2
  55. package/dist/export.d.ts +2 -2
  56. package/dist/export.js +1 -1
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.d.ts +17 -17
  59. package/dist/index.js +1 -1
  60. package/dist/{layout-shaping-B7ifvgm-.d.ts → layout-shaping-CFTk9pWQ.d.ts} +1 -1
  61. package/dist/layout.cjs +1 -1
  62. package/dist/layout.d.ts +16 -14
  63. package/dist/layout.js +1 -1
  64. package/dist/{note-properties-CrO9A0Ju.d.ts → note-properties-C8_cURo1.d.ts} +1 -1
  65. package/dist/output.cjs +1 -1
  66. package/dist/output.d.ts +9 -9
  67. package/dist/output.js +1 -1
  68. package/dist/{protocol-C-LfGgrt.d.ts → protocol-CG_ybtKt.d.ts} +2 -2
  69. package/dist/{review-paragraph-order-gZ8-oIWd.d.ts → review-paragraph-order-3oV2aI2q.d.ts} +1 -1
  70. package/dist/{revision-projection-BAUauksK.d.ts → revision-projection-C9oujZwA.d.ts} +1 -1
  71. package/dist/{semantic-cell-selection--xgumqWx.d.ts → semantic-cell-selection-BiYMYlbf.d.ts} +2 -2
  72. package/dist/{semantic-interaction-B_AAT9S2.d.ts → semantic-interaction-BTba0_1e.d.ts} +1 -1
  73. package/dist/{semantic-paint-Cl4VyItm.d.ts → semantic-paint-B_xi9H5m.d.ts} +4 -4
  74. package/dist/{semantic-record-queries-BKX8sDqa.d.ts → semantic-record-queries-TdjLU-AU.d.ts} +1 -1
  75. package/dist/{semantic-records-DkDc4E1z.d.ts → semantic-records-C5qbT1sK.d.ts} +29 -5
  76. package/dist/store.cjs +1 -1
  77. package/dist/store.d.ts +12 -12
  78. package/dist/store.js +1 -1
  79. package/dist/{tree-op-types-BJTz6t_O.d.ts → tree-op-types-DzstjXTb.d.ts} +12 -2
  80. package/dist/{tree-package-fragment-DDV5xjSI.d.ts → tree-package-fragment-DLbxcboK.d.ts} +67 -65
  81. package/dist/{tree-session-contract-CAsZn-VN.d.ts → tree-session-contract-BiKgucBu.d.ts} +92 -11
  82. package/dist/{unsupported-elements-1Tj829Bk.d.ts → unsupported-elements-KboafN7A.d.ts} +1 -1
  83. package/package.json +2 -2
  84. package/dist/chunk-3DLIAAXE.js +0 -2
  85. package/dist/chunk-3KSO2I22.js +0 -4
  86. package/dist/chunk-4K5QXGVN.js +0 -31
  87. package/dist/chunk-5JHQHJRH.js +0 -3
  88. package/dist/chunk-5W6DLXVG.cjs +0 -3
  89. package/dist/chunk-6VTHQTM3.js +0 -1
  90. package/dist/chunk-7MOZVKCN.js +0 -282
  91. package/dist/chunk-BR7AQCGM.cjs +0 -31
  92. package/dist/chunk-DZO5K26E.js +0 -1
  93. package/dist/chunk-K5FZYV6Z.cjs +0 -32
  94. package/dist/chunk-MK4MO7RT.cjs +0 -7
  95. package/dist/chunk-N5RYSQN5.js +0 -4
  96. package/dist/chunk-O2AEJ5T4.js +0 -5
  97. package/dist/chunk-PSVIEQUU.js +0 -32
  98. package/dist/chunk-PXF5BBEK.cjs +0 -2
  99. package/dist/chunk-R42NW5FO.js +0 -7
  100. package/dist/chunk-TCWCSTAF.cjs +0 -282
  101. package/dist/chunk-XFDDD65J.cjs +0 -4
  102. package/dist/chunk-XTNY4DBY.cjs +0 -5
@@ -0,0 +1,31 @@
1
+ import {a as a$2}from'./chunk-YD3KSZJM.js';import {s,o as o$1,j,i,v,w as w$1,q as q$1,k as k$1,n,p,f as f$1,g as g$1,e as e$2,d as d$2,h as h$1,t}from'./chunk-EB5XLX3A.js';import {w,x,o,s as s$1,u,g as g$2,a as a$4,k as k$2,j as j$3,i as i$2,F as F$2,I as I$1,h as h$2,b as b$4,G as G$3,f as f$5,D as D$3,v as v$1,l as l$3,J as J$2,K as K$2,C as C$1,A as A$2,y as y$1,c as c$4}from'./chunk-Z6NPBOE6.js';import {k,e,r,X,ea as ea$1,la as la$1,ja as ja$1,da as da$1,j as j$2,na as na$1,Y,Z,_,ma as ma$1,ha as ha$1,ga as ga$1,oa as oa$1,pa as pa$1,qa as qa$1,fa as fa$1,ka,ia as ia$1,G as G$2,U as U$1,c as c$3,t as t$1,ca as ca$2}from'./chunk-TTPQZXYS.js';import {B,D,u as u$1,q,s as s$2,r as r$1,j as j$1,c as c$1,x as x$1,G,L,K,E,I,M,A as A$1,F,i as i$1,e as e$3,C,N,O,a as a$8,b as b$3,d as d$3,g as g$4,f as f$4,h as h$4}from'./chunk-JK4HBRVP.js';import {b as b$1,a as a$6,f as f$3,e as e$4,g as g$5}from'./chunk-MYNOUTWY.js';import {d as d$1,hb as hb$1,a as a$1,l,Te,wf as wf$1,Pg,Qf as Qf$1,dg,eg,Mg,df as df$1,lb as lb$1,jg,Zd,hg,ef as ef$1,Eb as Eb$1,$a,la as la$2,Xb as Xb$1,se,he,Cb as Cb$1,Of as Of$1,mb as mb$1,nb as nb$1,pb as pb$1,ob as ob$1,sd,td,ud,Ve as Ve$2,sf as sf$1,Ja as Ja$2,nd,Ud,ag,pe,oe,Qb as Qb$1,Yb as Yb$1,gg,kf as kf$1,mf as mf$1,lf as lf$1,rf as rf$1,fb as fb$2,qf as qf$1,vd,gf as gf$1,Ka as Ka$2,We,Wb as Wb$1,hf as hf$1,cb as cb$1,Yd,Af as Af$1,Zb as Zb$2,$b as $b$1,Ia,Sf as Sf$2,He,wc as wc$1,qa,ff as ff$1,Ne as Ne$1,Je,Wf as Wf$1,Tf as Tf$1,Uf as Uf$1,Vf as Vf$1,ib as ib$1,xc as xc$1,qe as qe$1,If as If$2,Kf as Kf$1,Rd,nf as nf$1,eb as eb$2,me,db as db$1,Za as Za$1,cf as cf$1,Ze as Ze$2,jf as jf$1,E as E$2,D as D$1,T as T$1,ca as ca$1,_ as _$1,Qd as Qd$1,Ff as Ff$2,Ga as Ga$1,Ic as Ic$2,Hf as Hf$2,Le,Me,Pe,_e,Ye,Ce,tf as tf$1,_b as _b$1,Pf as Pf$1,pd as pd$1,Xa as Xa$1,ab as ab$1,Vb as Vb$1,_a,Sa,Ee,Ab as Ab$1,zf as zf$1,aa as aa$1,Ra,Pd,Xd,Hc as Hc$2,Kc as Kc$1,qd,fg,bb as bb$1,Cd,yf as yf$1,jd,Od,J as J$1,yb as yb$1,Cg,Dd,_d as _d$1,Og as Og$1,Ng,h as h$3,uf as uf$1,q as q$2,p as p$1,Bg,md as md$1,af as af$1,mc as mc$1,Ag,Sd}from'./chunk-T6MYXF6V.js';import {d,A,B as B$1,a as a$3,b,c,e as e$1,r as r$2,j as j$4,i as i$3,w as w$2,n as n$1,h,f as f$2,g as g$3,l as l$2,y,x as x$2,k as k$3,m,z}from'./chunk-6EGRB3J4.js';import {a as a$7}from'./chunk-WMM772MS.js';import {T,Ja as Ja$1,Ba,G as G$1,F as F$1,E as E$1,D as D$2,M as M$1,J,L as L$1}from'./chunk-XMJFDVE2.js';import {a as a$5,b as b$2}from'./chunk-WN7ICTA5.js';import {c as c$2}from'./chunk-MLJJL4QG.js';import {eb as eb$1,f,Ff as Ff$1,wm,Re,Hk,Ik,Jk,g,Fh as Fh$1,Ti,Yh as Yh$1,aj as aj$1,_i,$i,ql,En as En$1,Ih as Ih$1,Ri,tj as tj$1,Hb as Hb$1,pi as pi$1,Sf as Sf$1,Xf as Xf$1,nn,Ze as Ze$1,Se,Te as Te$1,Ve as Ve$1,wn,yn,xn,U,rn,tn as tn$1,on as on$1,sn,fk,an as an$1,Un as Un$1,Sn as Sn$1,wb as wb$1,km,Qk,vi as vi$1,hi as hi$1,gi as gi$1,ii as ii$1,Ka as Ka$1,al,Mk,Lk,Uk,pl,pg,lj as lj$1,Ic as Ic$1,jn as jn$1,Zb as Zb$1,fb as fb$1,ld,fj as fj$1,nj as nj$1,Hc as Hc$1,zl as zl$1,Bh as Bh$1,cd,Gf as Gf$1,Hf as Hf$1,Df as Df$1,Ef as Ef$1,If as If$1,Jf as Jf$1,zi,Ai,si as si$1,ri as ri$1,fi as fi$1,ei as ei$1,ci as ci$1,Fk,Nb as Nb$1,id,Nm,cl,Tm,Um,Xm,Ym,Zg,Eh as Eh$1,Ii,ce as ce$1,Zh as Zh$1,ki,Bi,di as di$1,qe,l as l$1,vb as vb$1,Ci,Di,Ph as Ph$1,qc as qc$1,Wk,Dk,dn,Gk,Yk,Ij as Ij$1,Gj as Gj$1,Rn,gn,rl,$j as $j$1,wl,Oh as Oh$1,sc as sc$1,sm as sm$1,wc as wc$2,vc as vc$1,_d,dg as dg$1,cg,Ki,kn,ln,Qd,fd,Ig,ck,ad,Tc as Tc$1,Rc as Rc$1,Bl,r as r$3,th as th$1,qi,pa as pa$2,md,pd,Cm,Ud as Ud$1,ma as ma$2,va,oa as oa$2,Wm,Fl,Gl as Gl$1,Yg,ae,bj as bj$1,Ua as Ua$1,Rk,um as um$1,nm as nm$1,pm as pm$1,Sl,lm as lm$1,bm as bm$1,dm as dm$1,_b as _b$2,mj as mj$1,hd,Pa,Sh as Sh$1,in as _in,hn,uj as uj$1,Gi,Nc as Nc$1,Qg,Kg,Mg as Mg$1,_k,$k,hl,ud as ud$1,lb as lb$2,vg,Hj as Hj$1,Ln,Kk,Vm,Xh as Xh$1,nl,Jl as Jl$1,mm as mm$1,kc as kc$1,hc as hc$1,Dn,Wh as Wh$1,Uh as Uh$1,Aa,Ba as Ba$1,Ca,tl,sl,ol,xg,Rb as Rb$1,Nk,Ji,Ch as Ch$1,Nn,wa,E as E$3,Nh as Nh$1,gm as gm$1,hh as hh$1,rg,ef as ef$2,W,df as df$2,ba as ba$1,Pg as Pg$1,nd as nd$1,ya as ya$1,Og,Rg,V,Z as Z$1,K as K$1,Ke,Yb as Yb$2,fh as fh$1,Ub as Ub$1,cc as cc$1,jj as jj$1,zb,qg,ab as ab$2}from'./chunk-XI5HK3TZ.js';import {a}from'./chunk-S6J4O5XP.js';import {zipSync,strToU8}from'fflate';import {createT,en,isApplePlatform,locales,deepMerge}from'@docx-editor.dev/i18n';function ZR(e){return e===void 0?void 0:Object.freeze({maxFontBytes:j$2(e).maxFontBytes})}function E5(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var zR=false;function XR(e){if(zR)return;zR=true;let t=e.diagnostic?`: ${e.diagnostic}`:".";console.error(`[@docx-editor.dev/core] text shaping is disabled${t}
2
+ Text is being measured with fallback metrics, so line and page breaks will not match Word.`);}function Ka(e$1){if(e$1 instanceof a)return e$1;if(e$1 instanceof d$1)return new a(e$1.code,e$1.message,{request:E5(e$1.request),diagnostic:e$1.diagnostic});if(e$1 instanceof k)return new a("overLimit",e$1.message,{diagnostic:e$1.message});if(e$1 instanceof e){let t=e$1.code==="wasmUnavailable"||e$1.code==="shapingLibraryMismatch"?"wasmUnavailable":"initializationFailed";return new a(t,e$1.message,{diagnostic:e$1.diagnostic??e$1.message,cause:e$1})}return new a("initializationFailed",e$1 instanceof Error?e$1.message:"Font initialization failed",{diagnostic:e$1 instanceof Error?e$1.message:String(e$1),cause:e$1})}async function Kl(e,t,n){try{return await r(e,t,n)}catch(r){throw Ka(r)}}var Vu=Object.freeze({opening:"auto",overflow:"float",revisionsIn:"pane",commentMarkers:"icon"}),th={opening:["auto","manual"],overflow:["float","shrinkPage","scroll"],revisionsIn:["pane","balloons"],commentMarkers:["initials","icon"]};function Gu(e,t=Vu){if(e===void 0)return t;if(e===null||typeof e!="object")throw new TypeError("review pane settings must be an object");let n=t;for(let[r,o]of Object.entries(e)){if(o===void 0)continue;if(!Object.hasOwn(th,r))throw new TypeError(`unknown review pane setting ${r}`);let a=r;if(typeof o!="string"||!th[a].includes(o))throw new TypeError(`review pane ${a} must be ${th[a].join(" or ")}`);n[a]!==o&&(n={...n,[a]:o});}return n===t?t:Object.freeze(n)}function nh(e,t){return e==="pane"?true:t.kind==="revision"?false:!(t.kind==="comment"&&t.parentRevisionId!==void 0)}var O5=Object.freeze({revisionMarkup:hb$1,reviewPane:Vu,scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,openFailure:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,chart:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false,collaborationStatus:"inactive"});function M5(e){return o(t=>{let n=[],r=s$1([e],t,{onOriginFailure:o=>n.push(o.cause)}).then(o=>n.length>0?{sources:[],...o,failures:n}:o,o=>t.signal?.aborted?void 0:{sources:[],failures:[o]});return {sources:[],deferred:r}})}var QR="http://schemas.openxmlformats.org/wordprocessingml/2006/main",L5="http://schemas.openxmlformats.org/package/2006/content-types",JR="http://schemas.openxmlformats.org/package/2006/relationships",F5="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",D5="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",N5=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${L5}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/></Types>`,H5=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${JR}"><Relationship Id="rId1" Type="${F5}" Target="word/document.xml"/></Relationships>`,_5=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${JR}"><Relationship Id="rId1" Type="${D5}" Target="styles.xml"/></Relationships>`,B5=[{level:1,before:240,color:"2F5496",halfPoints:32,italic:false},{level:2,before:40,color:"2F5496",halfPoints:26,italic:false},{level:3,before:40,color:"1F3763",halfPoints:24,italic:false},{level:4,before:40,color:"2F5496",halfPoints:null,italic:true},{level:5,before:40,color:"2F5496",halfPoints:null,italic:false},{level:6,before:40,color:"1F3763",halfPoints:null,italic:false},{level:7,before:40,color:"1F3763",halfPoints:null,italic:true},{level:8,before:40,color:"272727",halfPoints:21,italic:false},{level:9,before:40,color:"272727",halfPoints:21,italic:true}],$5=e=>`<w:style w:type="paragraph" w:styleId="Heading${e.level}"><w:name w:val="heading ${e.level}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="${e.before}" w:after="0"/><w:outlineLvl w:val="${e.level-1}"/></w:pPr><w:rPr>`+(e.italic?"<w:i/><w:iCs/>":"")+`<w:color w:val="${e.color}"/>`+(e.halfPoints===null?"":`<w:sz w:val="${e.halfPoints}"/><w:szCs w:val="${e.halfPoints}"/>`)+"</w:rPr></w:style>",W5=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${QR}"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Calibri" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="259" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>`+B5.map($5).join("")+'<w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="table" w:default="1" w:styleId="TableNormal"><w:name w:val="Normal Table"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style><w:style w:type="numbering" w:default="1" w:styleId="NoList"><w:name w:val="No List"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="10"/><w:qFormat/><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/><w:contextualSpacing/></w:pPr><w:rPr><w:spacing w:val="-10"/><w:kern w:val="28"/><w:sz w:val="56"/><w:szCs w:val="56"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Subtitle"><w:name w:val="Subtitle"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="11"/><w:qFormat/><w:rPr><w:color w:val="5A5A5A"/><w:spacing w:val="15"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="29"/><w:qFormat/><w:pPr><w:spacing w:before="160"/><w:jc w:val="center"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Caption"><w:name w:val="caption"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="35"/><w:semiHidden/><w:unhideWhenUsed/><w:pPr><w:spacing w:after="0"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/><w:sz w:val="18"/><w:szCs w:val="18"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="NoSpacing"><w:name w:val="No Spacing"/><w:uiPriority w:val="1"/><w:qFormat/><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/></w:pPr></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:uiPriority w:val="34"/><w:qFormat/><w:pPr><w:ind w:left="720"/><w:contextualSpacing/></w:pPr></w:style></w:styles>',YR=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${QR}"><w:body><w:p/><w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr></w:body></w:document>`,q5=/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8}){0,4}$/;function rh(e={}){let t=e.direction==="rtl",n=e.bidiLanguage!==void 0&&q5.test(e.bidiLanguage)?e.bidiLanguage:null,r=W5.replace('<w:sz w:val="22"/><w:szCs w:val="22"/>',`<w:sz w:val="22"/><w:szCs w:val="22"/>${n?`<w:lang w:bidi="${n}"/>`:""}`).replace("<w:pPrDefault><w:pPr>",`<w:pPrDefault><w:pPr>${t?"<w:bidi/>":""}`),o=t?YR.replace("</w:sectPr>","<w:bidi/></w:sectPr>"):YR;return zipSync({"[Content_Types].xml":strToU8(N5),"_rels/.rels":strToU8(H5),"word/_rels/document.xml.rels":strToU8(_5),"word/document.xml":strToU8(o),"word/styles.xml":strToU8(r)})}function Ua(e){if(e){if(e.nodeType===9)return e;if(e.ownerDocument)return e.ownerDocument}return globalThis.document}function Ae(e){return Ua(e)?.defaultView??globalThis}var eP=new WeakMap;function tP(e,t){eP.set(e,t);}function K5(e){return Io(e)}function Io(e){return eP.get(e)?.()??null}function nP(e){let t=e.ownerDocument?.defaultView;return t?t.closed?"attach() needs an element in an open window; this window has closed":null:"attach() needs an element in a document with a window; this one has none"}function U5(e){return Ua(Io(e))}function j5(e){return Ae(Io(e))}function Ft(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function zr(e){return Ft(e)&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function V5(e){return typeof e=="object"&&e!==null&&e.nodeType===3}function Ro(e){return typeof e=="object"&&e!==null&&typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function zu(e,t){return zr(e)&&e.localName===t}function oh(){return globalThis}function rt(e){let t=0,n=new Map,r=new Map;function o(f,p){f.win=p,f.native=f.kind==="frame"&&typeof p.requestAnimationFrame=="function"?p.requestAnimationFrame(f.fire):p.setTimeout(()=>f.fire(p.performance?.now()??Date.now()),Math.max(0,f.dueAt-Date.now())),i(p);}function a(f){f.kind==="frame"&&typeof f.win.cancelAnimationFrame=="function"?f.win.cancelAnimationFrame(f.native):f.win.clearTimeout(f.native);}function i(f){if(r.has(f)||f===oh())return;let p=()=>{s(f);let g=Ae(e()),y=g===f?oh():g;for(let h of n.values())h.win===f&&(a(h),o(h,y));};f.addEventListener("pagehide",p),r.set(f,p);}function s(f){let p=r.get(f);p&&(r.delete(f),f.removeEventListener("pagehide",p));}function l(f){let p=n.get(f);if(p){n.delete(f);for(let g of n.values())if(g.win===p.win)return;s(p.win);}}function c(){if(n.size===0)return;let f=Ae(e());for(let p of n.values()){if(p.win===f)continue;let g=p.win;a(p),o(p,f);let y=false;for(let h of n.values())h.win===g&&(y=true);y||s(g);}}function d(f,p,g=0){c();let y=++t,h={kind:f,win:oh(),native:0,dueAt:Date.now()+g,fire:b=>{l(y),p(b);}};return n.set(y,h),o(h,Ae(e())),y}function u(f){if(f==null)return;let p=n.get(f);p&&(a(p),l(f));}return {setTimeout:(f,p)=>d("timeout",()=>f(),p),clearTimeout:u,requestAnimationFrame:f=>d("frame",f),cancelAnimationFrame:u,migrate:c}}function ja(e){return typeof e.key=="string"&&"repeat"in e}function Zu(e){return typeof e.pointerId=="number"}function G5(e){return typeof e.button=="number"&&"clientX"in e}function ah(e){return typeof e.inputType=="string"}var z5=1;function Z5(e){let t=Ae(e);if(t.getComputedStyle(e).direction==="rtl")return ()=>{};let n=()=>e.scrollWidth-e.clientWidth,r=true,o=null,a=()=>{r&&(e.scrollLeft=n(),o=e.scrollLeft);},i=()=>{e.scrollLeft!==o&&(o=null,r=e.scrollLeft>=n()-z5);};a(),e.addEventListener("scroll",i,{passive:true}),e.addEventListener("transitionend",a);let s=null;if(typeof t.ResizeObserver=="function"){s=new t.ResizeObserver(a),s.observe(e);for(let l of Array.from(e.children))s.observe(l);}return ()=>{s?.disconnect(),e.removeEventListener("scroll",i),e.removeEventListener("transitionend",a);}}function X5(e,t,n,r){let o=Math.min(e.right,n.width-t.width-8),a=Math.max(8,e.left-t.width),i=e.right+t.width<=n.width-8,s=e.left-t.width>=8,l=r?s?a:o:i?o:a,c=Math.max(8,Math.min(e.top-4,n.height-t.height-8));return {left:l,top:c}}function Y5(e){return e?{open:"ArrowLeft",close:"ArrowRight"}:{open:"ArrowRight",close:"ArrowLeft"}}function ih(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return "host"in t?t.host??null:null}function Q5(e){for(let t=e;t;t=ih(t)){let n=t.getAttribute("dir")?.toLowerCase();if(n==="rtl"||n==="ltr")return n}return "ltr"}function J5(e,t){let n=Ae(e);if(typeof n.MutationObserver!="function")return ()=>{};let r=i=>{for(let s=e;s;s=ih(s))if(s===i)return true;return false},o=new n.MutationObserver(i=>{i.some(s=>r(s.target))&&t();}),a={attributes:true,attributeFilter:["dir"],subtree:true};o.observe(e.ownerDocument.documentElement,a);for(let i=e;i;i=ih(i)){let s=i.getRootNode();s!==e.ownerDocument&&!i.parentElement&&o.observe(s,a);}return ()=>o.disconnect()}var rP="http://schemas.microsoft.com/office/2004/12/omml",eB="http://www.w3.org/1998/Math/MathML",tB=4096,oP=32;function aP(e,t){return e.failed||t>oP||e.left<=0?(e.failed=true,false):(e.left-=1,true)}function jl(e,t){return e.kind!=="textValue"&&e.namespaceUri===Ig&&(t===void 0||e.localName===t)}function sh(e,t){if(e.kind!=="textValue")return e.attributes.find(n=>n.localName==="val"&&n.namespaceUri===t)?.value}function iP(e,t,n){if(!aP(t,n))return "";if(e.kind==="textValue")return e.value;let r="";for(let o of e.children)r+=iP(o,t,n+1);return r}function nB(e,t,n){if(e.kind==="textValue")return "";let r="",o,a=false,i;for(let d of e.children)if(jl(d,"t"))r+=iP(d,t,n+1);else if(jl(d,"rPr")&&d.kind!=="textValue")for(let u of d.children)jl(u,"sty")&&(o=sh(u,Ig)),jl(u,"nor")&&(a=true);else if(d.kind!=="textValue"&&d.namespaceUri===pa$2&&d.localName==="rPr"){let u=d.children.find(p=>p.kind!=="textValue"&&p.localName==="color"),f=u?sh(u,pa$2):void 0;f&&/^[0-9A-Fa-f]{6}$/.test(f)&&(i=f.toUpperCase());}if(r.length===0)return "";let s=`<m:r>${V(r)}</m:r>`;i!==void 0&&(s=`<span style="color:#${i}">${s}</span>`);let l=!a&&(o===void 0||o==="i"||o==="bi"),c=o==="b"||o==="bi";return l&&(s=`<i>${s}</i>`),c&&(s=`<b>${s}</b>`),s}function sP(e,t,n){if(e.kind==="textValue"||!jl(e)||!aP(t,n))return "";if(e.localName==="r")return nB(e,t,n);if(e.localName==="ctrlPr")return "";let r=sh(e,Ig),o=r===void 0?"":` m:val="${W(r)}"`,a="";for(let i of e.children)a+=sP(i,t,n+1);return a.length>0?`<m:${e.localName}${o}>${a}</m:${e.localName}>`:`<m:${e.localName}${o}/>`}function rB(e){let t="";for(let n of e.match(/\d+(?:\.\d+)?|\p{L}|\s+|./gu)??[]){if(/^\s+$/.test(n))continue;let r=V(n);/^\d/.test(n)?t+=`<mn>${r}</mn>`:/^\p{L}$/u.test(n)?t+=`<mi>${r}</mi>`:t+=`<mo>${r}</mo>`;}return t}function lh(e,t){if(t>oP)return "";let n=r=>`<mrow>${lh(r,t+1)}</mrow>`;switch(e.kind){case "text":return e.format?.normalText?`<mtext>${V(e.value)}</mtext>`:rB(e.value);case "fallback":return `<mtext>${V(e.text)}</mtext>`;case "row":return e.items.map(r=>lh(r,t+1)).join("");case "bar":return e.position==="top"?`<mover accent="true">${n(e.body)}<mo>\xAF</mo></mover>`:`<munder accentunder="true">${n(e.body)}<mo>\xAF</mo></munder>`;case "borderBox":return `<menclose notation="${[e.hidden.top?"":"top",e.hidden.bottom?"":"bottom",e.hidden.left?"":"left",e.hidden.right?"":"right",e.strikes.horizontal?"horizontalstrike":"",e.strikes.vertical?"verticalstrike":"",e.strikes.bottomLeftToTopRight?"updiagonalstrike":"",e.strikes.topLeftToBottomRight?"downdiagonalstrike":""].filter(Boolean).join(" ")}">${n(e.body)}</menclose>`;case "fraction":return `<mfrac>${n(e.numerator)}${n(e.denominator)}</mfrac>`;case "radical":return e.degree===void 0?`<msqrt>${n(e.radicand)}</msqrt>`:`<mroot>${n(e.radicand)}${n(e.degree)}</mroot>`;case "script":{let r=n(e.base);return e.subscript&&e.superscript?`<msubsup>${r}${n(e.subscript)}${n(e.superscript)}</msubsup>`:e.subscript?`<msub>${r}${n(e.subscript)}</msub>`:e.superscript?`<msup>${r}${n(e.superscript)}</msup>`:r}case "nary":{let r=`<mo>${V(e.operator)}</mo>`,o=e.lowerLimit?n(e.lowerLimit):"",a=e.upperLimit?n(e.upperLimit):"",[i,s,l]=e.limitLocation==="subSup"?["msubsup","msub","msup"]:["munderover","munder","mover"];return `<mrow>${o&&a?`<${i}>${r}${o}${a}</${i}>`:o?`<${s}>${r}${o}</${s}>`:a?`<${l}>${r}${a}</${l}>`:r}${n(e.body)}</mrow>`}}}function lP(e){if(!Pg$1(e))return "";let t=Og(e),n=t?Rg(e):Kg(e),r={left:tB,failed:false},o=sP(e,r,0),a=n===null?"":`<math xmlns="${eB}"${t?' display="block"':""}>${lh(n.expression,0)}</math>`;return r.failed||o.length===0?a:`<!--[if gte msEquation 12]>${o}<![endif]--><![if !msEquation]>${a}<![endif]>`}function cP(e){return e.includes("<!--[if gte msEquation 12]>")}var is="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oB=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<is.length;t+=1)e[is.charCodeAt(t)]=t;return e})();function Xu(e,t){if(e.length===0)return null;let n=e.length%4;if(n===1)return null;let r=n===0?e:e+"=".repeat(4-n),o=r.endsWith("==")?2:r.endsWith("=")?1:0,a=r.length/4*3-o;if(a<=0||a>t)return null;let i=new Uint8Array(a),s=0;for(let l=0;l<r.length;l+=4){let c=0,d=0;for(let u=0;u<4;u+=1){let f=r.charCodeAt(l+u);if(f===61){if(l+u<r.length-o)return null;continue}let p=f<128?oB[f]:-1;if(p<0)return null;c=c<<6|p,d+=6;}c<<=24-d,d>=12&&(i[s++]=c>>>16&255),d>=18&&(i[s++]=c>>>8&255),d>=24&&(i[s++]=c&255);}return s===a?i:null}function Yu(e){let t=[],n="";for(let r=0;r<e.length;r+=3){let o=e[r],a=r+1<e.length?e[r+1]:0,i=r+2<e.length?e[r+2]:0;n+=is[o>>2]+is[(o&3)<<4|a>>4],n+=r+1<e.length?is[(a&15)<<2|i>>6]:"=",n+=r+2<e.length?is[i&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var aB=16*1024*1024,uP=64*1024*1024,fP="data-docx-fragment",pP="data-docx-fragment-end",iB=Yu;function mP(e,t){let n=t?.lastMarkCovered?"covered":"open",r=t?`<div ${fP}="${iB(t.bytes)}" ${pP}="${n}">${e}</div>`:`<div>${e}</div>`;return cP(e)?`<html xmlns:m="${rP}"><body>${r}</body></html>`:r}function dP(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>uP)return null;let o=r+n.length,a=e.indexOf('"',o);return a===-1?null:e.slice(o,a)}function Yo(e,t=aB){if(e.length>uP)return null;let n=dP(e,fP);if(n===null||n.length===0)return null;let r=Xu(n,t);if(r===null||r.byteLength===0)return null;let o=dP(e,pP);return {bytes:r,lastMarkCovered:o==="covered"}}function Va(e){if(e==null)return null;let t=e.trim();return /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8}){0,3}$/.test(t)?t:null}function Wn(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(!(r!==9&&(r<32||r===65534||r===65535))){if(r>=55296&&r<=56319){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(t+=e[n]+e[n+1],n+=1);continue}r>=56320&&r<=57343||(t+=e[n]);}}return t}var ch="Unknown",fh=255,dh='w:id="?"';function gP(e){let t=Wn(e??"").replace(/[\t\n\r]+/g," ").trim().slice(0,fh);return t.length>0?t:ch}function sB(e){if(e===null||e.length>4*fh)return ch;let t=/^\s*mailto:(.*)$/i.exec(e);if(!t)return ch;let n=t[1];try{n=decodeURIComponent(n);}catch{}return gP(n)}function Vl(e,t,n){let r=Number(e);return r>=t&&r<=n}function hP(e,t,n,r,o){if(!Vl(e,1,9999)||!Vl(t,1,12)||!Vl(r,0,23)||!Vl(o,0,59))return;let a=new Date(Date.UTC(2e3,Number(t),0)).getUTCDate(),i=Number(e)%4===0&&(Number(e)%100!==0||Number(e)%400===0);if(Vl(n,1,t==="02"&&!i?28:a))return `${e}-${t}-${n}T${r}:${o}:00Z`}function lB(e){let t=/^\s*(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(e??"");return t?hP(t[1],t[2],t[3],t[4],t[5]):void 0}function uh(e){if(e===void 0||e.length>4*fh)return null;let t=/^\s*"([^"]*)"\s+(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})/.exec(e);if(!t)return null;let n=hP(t[2],t[3],t[4],t[5],t[6]);return {author:gP(t[1]),...n===void 0?{}:{date:n}}}function yP(e,t,n){if(t!=="ins"&&t!=="del")return null;let r=e.getAttribute("cite");if(!n&&!/^\s*mailto:/i.test(r??""))return null;let o=lB(e.getAttribute("datetime"));return {kind:t,author:sB(r),...o===void 0?{}:{date:o}}}function Qo(e){return `${dh} w:author="${W(e.author)}"`+(e.date===void 0?"":` w:date="${e.date}"`)}function bP(e){return e.replace(/<w:t(?=[ >/])/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>")}var cB=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/;function vP(e,t){let n=[],r="",o=()=>{r.length!==0&&(n.push(`<w:${e.kind} ${Qo(e)}>${r}</w:${e.kind}>`),r="");};for(let a of t){let i=e.kind==="del"?bP(a):a;i.includes("<w:hyperlink")||cB.test(i)?(o(),n.push(i)):r+=i;}return o(),n}function xP(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){let o=e[r],a=o.kind==="del"?bP(n):n;n=`<w:${o.kind} ${Qo(o)}>${a}</w:${o.kind}>`;}return n}function SP(e){let t=e.find(r=>r.kind==="ins"),n=e.find(r=>r.kind==="del");return (t?`<w:ins ${Qo(t)}/>`:"")+(n?`<w:del ${Qo(n)}/>`:"")}function ph(e){return uh(e.get("mso-prop-change"))}function wP(e){let t=uh(e.get("mso-table-inserted")),n=uh(e.get("mso-table-deleted"));return (t?`<w:ins ${Qo(t)}/>`:"")+(n?`<w:del ${Qo(n)}/>`:"")}function mh(e){return /!\s*msorm\s*$/i.test(e)}function gh(e,t){let n=e.getAttribute("style");if(!n||n.length>8192||!/msorm/i.test(n))return t;let r=new Map(t);for(let o of n.split(";")){let a=o.indexOf(":");if(a<=0)continue;let i=o.slice(a+1).trim();if(!mh(i))continue;let s=o.slice(0,a).trim().toLowerCase();r.set(s,i.replace(/!\s*msorm\s*$/i,"").trim());}return r}function kP(e,t){return `<w:rPrChange ${Qo(e)}>${t||"<w:rPr/>"}</w:rPrChange>`}function IP(e,t){return `<w:pPrChange ${Qo(e)}>${t||"<w:pPr/>"}</w:pPrChange>`}function RP(e){if(e.changeXml===void 0)return e;let{changeXml:t,...n}=e;return n}function PP(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1){let o=n[r];o.includes(dh)&&(n[r]=o.replaceAll(dh,()=>`w:id="${t++}"`));}}var yh=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],hh={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText",TOCHeading:"MsoTocHeading",...Object.fromEntries(Array.from({length:9},(e,t)=>[`TOC${t+1}`,`MsoToc${t+1}`]))},bh=new Map([...Object.entries(hh).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function CP(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(hh,e)?hh[e]:null}var vh=Object.fromEntries(s),xh={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function TP(e){let t=e.trim();if(t.length===0||t.length>255)return null;let n=t.replace(/[^\p{L}\p{N} _.,-]/gu,"");return n.length===0?null:`"${Z$1(n)}"`}var dB=new Map([["single","solid"],["thick","solid"],["double","double"],["triple","double"],["dotted","dotted"],["dashed","dashed"],["dashSmallGap","dashed"],["dotDash","dashed"],["dotDotDash","dashed"],["wave","solid"],["hairline","solid"],["inset","solid"],["outset","solid"]]);function Ga(e){if(e===null)return null;let t=Nh$1(e,"val",pa$2);if(t===void 0||t==="nil"||t==="none")return null;let n=dB.get(t)??"solid",r=Nh$1(e,"sz",pa$2),o=r!==void 0&&/^\d{1,4}$/.test(r)?Number.parseInt(r,10):0,a=o>0?o/8:.5,i=`${Math.round(a*100)/100}pt`,s=Nh$1(e,"color",pa$2),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${i} ${n} ${l.toLowerCase()}`}function EP(e,t){return e===null||e<=0?[]:t==="exact"||t==="atLeast"?[`line-height:${`${Math.round(e/20*100)/100}pt`}`,`mso-line-height-rule:${t==="exact"?"exactly":"at-least"}`]:[`line-height:${Math.round(e/240*100)/100}`]}var uB=new Map([["double","double"],["wavyDouble","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"]]),fB=new Set(yh);function OP(e){if(e===null)return [];let t=Nh$1(e,"val",pa$2),n=[],r=t===void 0?void 0:uB.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&fB.has(t)&&n.push(`text-underline:${t}`);let o=Nh$1(e,"color",pa$2);return o!==void 0&&/^[0-9A-Fa-f]{6}$/.test(o)&&n.push(`text-decoration-color:#${o.toLowerCase()}`),t==="thick"&&n.push("text-decoration-thickness:2px"),n}function MP(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function AP(e,t,n,r){if(e.namespaceUri!==pa$2)return "";let o=e.localName==="footnoteRef"?"footnote":e.localName==="endnoteRef"?"endnote":null,a=e.localName==="footnoteReference"?"footnote":e.localName==="endnoteReference"?"endnote":null,i=o??a;if(i===null)return "";let s=Nh$1(e,"id",pa$2),l=o===null?s!==void 0&&/^\d{1,10}$/.test(s)?Number.parseInt(s,10):void 0:t?.id;if(l===void 0||!Number.isInteger(l)||l<1||o!==null&&t?.kind!==o||l>2147483647||o===null&&!r(i,l))return "";let c=i==="footnote",d=o!==null,u=c?"MsoFootnoteReference":"MsoEndnoteReference",f=c?"ftn":"edn",p=d?`#_${f}ref${l}`:`#_${f}${l}`,g=d?`_${f}${l}`:`_${f}ref${l}`;return `<a style="mso-${c?"footnote":"endnote"}-id:${f}${l}" href="${p}" name="${g}"><span class="${u}"><span style="mso-special-character:footnote">[${n(i,l)}]</span></span></a>`}function LP(e){if(e.namespaceUri!==pa$2||e.localName!=="ptab")return "";let t=Nh$1(e,"alignment",pa$2),n=Nh$1(e,"relativeTo",pa$2),r=Nh$1(e,"leader",pa$2)??"none";if(t!=="left"&&t!=="center"&&t!=="right")return "";let o=n==="margin"||n==="leftMargin"?"margin":n==="indent"?"indent":null;return o===null||r!=="none"&&r!=="dot"&&r!=="hyphen"&&r!=="underscore"&&r!=="middleDot"&&r!=="heavy"?"":`<w:PTab Alignment="${t.toUpperCase()}" RelativeTo="${o.toUpperCase()}" Leader="${r.toUpperCase()}"></w:PTab>`}function Et(e){let t=e.trim().toLowerCase();if(/^-?0+(\.0+)?$/.test(t))return 0;let n=/^(-?(?:\d+(?:\.\d+)?|\.\d+))(px|pt|in|cm|mm|pc)$/.exec(t);if(!n)return null;let r=Number.parseFloat(n[1]);if(!Number.isFinite(r))return null;switch(n[2]){case "px":return r*.75;case "in":return r*72;case "cm":return r*72/2.54;case "mm":return r*72/25.4;case "pc":return r*12;default:return r}}function NP(e){return e.includes("urn:schemas-microsoft-com:office")||e.includes("mso-")||e.includes("<o:p")||e.includes("class=Mso")||e.includes('class="Mso')||e.includes("class='Mso")}function HP(e,t){for(let r of e.classList){let o=/^MsoHeading([1-9])$/.exec(r);if(o)return `Heading${o[1]}`;let a=/^Heading([1-9])$/.exec(r);if(a)return `Heading${a[1]}`;let i=bh.get(r);if(i!==void 0)return i}if(e.classList.contains("docx-outline"))return;let n=t?/^h([1-6])$/.exec(Qe(e)):null;return n?`Heading${n[1]}`:void 0}var _P=262144,pB=4096,mB=256,gB=2048,hB=8,yB=new Set(["MsoNormal",...bh.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),bB=new Map([["left","left"],["start","start"],["center","center"],["right","right"],["end","end"],["justify","both"]]),vB=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function xB(e){let t="";for(let n=0;n<e.length;n+=1){if(e.startsWith("<!--",n)){n+=3;continue}if(e.startsWith("-->",n)){n+=2;continue}t+=e[n];}return t}function SB(e,t){let n=0;for(let r=t;r<e.length;r+=1){let o=e[r];if(o==="{"){if(n+=1,n>4)return null}else if(o==="}"&&(n-=1,n===0))return r+1}return null}function wB(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return SB(e,n)}return null}function kB(e){let t=e.split(",");if(t.length===0||t.length>hB)return null;let n=[];for(let r of t){let o=vB.exec(r);if(!o)return null;let a=o[2];if(!yB.has(a))return null;n.includes(a)||n.push(a);}return n}function IB(e){let t;for(let n of e.split(";")){let r=n.indexOf(":");if(r<=0||n.slice(0,r).trim().toLowerCase()!=="text-align")continue;let a=n.slice(r+1).trim().toLowerCase();if(a.length===0||a.length>32||a.includes("("))continue;let i=0;for(;i<a.length&&a.charCodeAt(i)>32;)i+=1;let s=bB.get(a.slice(0,i));s!==void 0&&(t=s);}return t}function RB(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>_P)return n();let r=xB(e),o=0,a=0;for(;o<r.length&&a<pB;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let f=wB(r,o);if(f===null)return n();o=f;continue}let i=r.indexOf("{",o);if(i<0)return n();let s=r.slice(o,i),l=r.indexOf("}",i+1);if(l<0)return n();let c=r.slice(i+1,l);if(a+=1,o=l+1,s.length>mB||c.length>gB||c.includes("{"))return n();let d=kB(s),u=IB(c);if(!(!d||u===void 0))for(let f of d)t.set(f,u);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function BP(e){let t=new Map,n=e.getElementsByTagName("style");if(n.length>16)return new Map;for(let r=0;r<n.length;r+=1){let o=n[r]?.textContent??"";if(o.length>_P)return new Map;let a=RB(o);if(!a.ok)return new Map;for(let[i,s]of a.alignments)t.set(i,s);}return t}var PB=262144;function $P(e,t=PB){let n=e.getElementsByTagName("style"),r="";for(let o=0;o<n.length&&o<16;o+=1){let a=n[o]?.textContent??"";a.length>t||r.length+a.length>t||(r+=`
3
+ ${a}`);}return r}function WP(e,t,n){for(let o of t.classList){let a=n.get(o);if(a!==void 0){e.jc=a;break}}let r=t.getAttribute("align")?.trim().toLowerCase();r==="left"||r==="center"||r==="right"?e.jc=r:r==="justify"&&(e.jc="both");}function Sh(e,t,n,r){let o=Et(t.get(n)??"");if(o!==null&&o>0)return o/.75;let a=e.getAttribute(n)?.trim()??"";if(!/^[1-9]\d{0,4}$/.test(a))return null;let i=Number.parseInt(a,10);return r?i/.75:i}function ss(e){return e.nodeType===1}function Qe(e){return e.tagName.toLowerCase()}var CB=new Map("black:000000 white:FFFFFF red:FF0000 green:008000 blue:0000FF yellow:FFFF00 gray:808080 grey:808080 silver:C0C0C0 maroon:800000 navy:000080 purple:800080 orange:FFA500 aqua:00FFFF cyan:00FFFF fuchsia:FF00FF magenta:FF00FF lime:00FF00 olive:808000 windowtext:000000".split(" ").map(e=>e.split(":"))),TB=new Map([["yellow","yellow"],["aqua","cyan"],["cyan","cyan"],["fuchsia","magenta"],["magenta","magenta"],["lime","green"],["green","green"],["olive","darkYellow"],["red","red"],["blue","blue"],["black","black"],["white","white"],["darkblue","darkBlue"],["darkcyan","darkCyan"],["darkgray","darkGray"],["darkgrey","darkGray"],["darkgreen","darkGreen"],["darkmagenta","darkMagenta"],["darkred","darkRed"],["darkyellow","darkYellow"],["lightgray","lightGray"],["lightgrey","lightGray"]]),EB=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,OB=new Map(yh.map(e=>[e.toLowerCase(),e])),FP=new WeakMap;function Pt(e){let t=FP.get(e);if(t!==void 0)return t;let n=new Map;FP.set(e,n);let r=e.getAttribute("style");if(!r||r.length>8192)return n;for(let o of r.split(";")){let a=o.indexOf(":");if(a<=0)continue;let i=o.slice(0,a).trim().toLowerCase(),s=o.slice(a+1).trim();i.length>0&&s.length>0&&!mh(s)&&(n.delete(i),n.set(i,s));}return n}function Jo(e){let t=e.trim().toLowerCase(),n=CB.get(t);if(n)return n;let r=/^#([0-9a-f]{6})$/.exec(t);if(r)return r[1].toUpperCase();let o=/^#([0-9a-f]{3})$/.exec(t);if(o){let[i,s,l]=o[1];return `${i}${i}${s}${s}${l}${l}`.toUpperCase()}let a=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,[^)]*)?\)$/.exec(t);if(a){let i=s=>Math.min(255,Number.parseInt(s,10)).toString(16).padStart(2,"0");return `${i(a[1])}${i(a[2])}${i(a[3])}`.toUpperCase()}return null}function MB(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return TB.get(t)}function DP(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||EB.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:Jo(t)}function qn(e,t,n){return Math.min(n,Math.max(t,e))}function Ju(e){let t=null;for(let[n,r]of e)if(n==="background")t=DP(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let a=DP(r);a!==null&&(t=a);}return t}var AB=new Set(["left","center","right","decimal","bar"]),LB=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function FB(e){if(e===void 0||e.length===0||e.length>512)return;let t="left",n,r=[];for(let o of e.trim().toLowerCase().split(/\s+/)){if(AB.has(o)){t=o;continue}if(o==="list"){t="left";continue}let a=LB.get(o);if(a!==void 0){n=a;continue}let i=Et(o);if(!(i===null||i<0)){if(r.push({val:t,posTwips:qn(Math.round(i*20),0,31680),...n===void 0?{}:{leader:n}}),r.length>=32)break;t="left",n=void 0;}}return r.length>0?r:void 0}var DB=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function wh(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var NB=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function Qu(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let a of wh(e)){let i=a.toLowerCase();if(i==="none"||i==="hidden"){n=true;continue}let s=DB.get(i);if(s!==void 0){t=s;continue}let l=NB.get(a.toLowerCase())??Et(a);if(l!==null){r=l;continue}let c=Jo(a);if(c!==null){o=c;continue}return}if(n)return "suppressed";if(t!==void 0)return r===void 0?{val:t,szEighthPoints:4,color:o??"000000"}:r<=0?"suppressed":{val:t,szEighthPoints:qn(Math.round(r*8),2,96),color:o??"000000"}}function ef(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function Gl(e,t){return t==="b"||t==="strong"?{...e,bold:true}:t==="i"||t==="em"?{...e,italic:true}:t==="u"||t==="ins"?{...e,underline:true}:t==="s"||t==="strike"||t==="del"?{...e,strike:true}:t==="sub"?{...e,vertAlign:"subscript"}:t==="sup"?{...e,vertAlign:"superscript"}:t==="code"||t==="tt"||t==="kbd"||t==="samp"?{...e,font:"Courier New"}:e}function za(e,t){if(t.size===0)return e;let n={...e},r=t.get("font-weight")?.toLowerCase();if(r!==void 0){let S=Number.parseInt(r,10);r==="bold"||S>=600?n.bold=true:(r==="normal"||S<600)&&(n.bold=false);}let o=t.get("font-style");o!==void 0&&(n.italic=o.toLowerCase().includes("italic"));let a=(t.get("text-decoration")??t.get("text-decoration-line"))?.toLowerCase();a!==void 0&&(a.includes("underline")&&(n.underline=true),a.includes("line-through")&&(n.strike=true),a.includes("none")&&(n.underline=n.strike=false));let i=t.get("font-variant")?.toLowerCase();i!==void 0&&(i.includes("small-caps")?n.smallCaps=true:(i.includes("normal")||i.includes("none"))&&(n.smallCaps=false));let s=t.get("text-transform")?.trim().toLowerCase();s==="uppercase"?n.caps=true:s==="none"&&(n.caps=false);let l=t.get("text-underline");if(l!==void 0&&l.length<=128)for(let S of l.trim().split(/\s+/)){let x=S.toLowerCase(),k=OB.get(x);if(k!==void 0)n.underline=true,n.underlineVal=k;else {let T=Jo(S);T!==null&&(n.underlineColor=T);}}let c=t.get("text-decoration-style")?.trim().toLowerCase();if(c==="double"&&n.strike&&!n.underline&&(n.doubleStrike=true),n.underline){c==="double"?n.underlineVal="double":c==="dotted"?n.underlineVal="dotted":c==="dashed"?n.underlineVal="dash":c==="wavy"&&(n.underlineVal="wave");let S=Jo(t.get("text-decoration-color")??"");S!==null&&(n.underlineColor=S);}let d=Jo(t.get("color")??"");d&&(n.color=d);let u=MB(t.get("mso-highlight"));if(u)n.highlight=u,delete n.shdFill;else {let S=Ju(t);S&&(n.shdFill=S);}let f=Et(t.get("font-size")??"");f!==null&&f>0&&(n.szHalfPoints=qn(Math.round(f*2),2,3276));let p=t.get("font-family");if(p!==void 0){let S=p.split(",")[0].trim().replace(/^['"]|['"]$/g,"");S.length>0&&S.length<=64&&(n.font=S);}let g=Et(t.get("letter-spacing")??"");g!==null&&(n.charSpacingTwentieths=qn(Math.round(g*20),-31680,31680));let y=t.get("vertical-align")?.trim().toLowerCase();y==="sub"?n.vertAlign="subscript":y==="super"&&(n.vertAlign="superscript");let h=Va(t.get("mso-ansi-language")),b=Va(t.get("mso-fareast-language")),v=Va(t.get("mso-bidi-language"));return h!==null&&(n.langVal=h),b!==null&&(n.langEastAsia=b),v!==null&&(n.langBidi=v),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function Za(e,t){let n=za(e,Pt(t)),r=Va(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function tf(e,t){let n=t.get("text-align")?.toLowerCase();n==="left"||n==="right"||n==="start"||n==="end"?e.jc=n:n==="center"?e.jc="center":n==="justify"&&(e.jc="both"),t.get("direction")?.trim().toLowerCase()==="rtl"&&(e.bidi=true);let r={top:null,right:null,bottom:null,left:null},o=t.get("margin");if(o!==void 0&&o.length<=128){let b=o.trim().split(/\s+/).map(v=>Et(v));if(b.length>=1&&b.length<=4&&!b.some(v=>v===null)){let[v,S=v,x=v,k=S]=b.length===2?[b[0],b[1],b[0],b[1]]:b.length===3?[b[0],b[1],b[2],b[1]]:b;r.top=v??null,r.right=S??null,r.bottom=x??null,r.left=k??null;}}let a=Et(t.get("margin-left")??"")??r.left;a!==null&&(a>0||a===0&&!e.numPr)&&(e.indLeftTwips=qn(Math.round(a*20),0,31680));let i=Et(t.get("margin-right")??"")??r.right;i!==null&&i>=0&&(e.indRightTwips=qn(Math.round(i*20),0,31680));let s=Et(t.get("mso-text-indent-alt")??"");if(s!==null)e.firstLineTwips=qn(Math.round(s*20),-31680,31680);else {let b=Et(t.get("text-indent")??"");if(b!==null&&b!==0){let v=qn(Math.round(b*20),-31680,31680);v!==0&&(e.firstLineTwips=v);}}let l=Et(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=qn(Math.round(l*20),0,31680));let c=Et(t.get("margin-bottom")??"")??r.bottom;c!==null&&c>=0&&(e.spacingAfterTwips=qn(Math.round(c*20),0,31680));let d=t.get("line-height")?.trim()??"",u=t.get("mso-line-height-rule")?.trim().toLowerCase(),f=Et(d);if(f!==null&&f>0)e.lineTwentieths=qn(Math.round(f*20),24,31680),e.lineRule=u==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(d)&&Number.parseFloat(d)>0)e.lineTwentieths=qn(Math.round(240*Number.parseFloat(d)),24,9600),e.lineRule="auto";else if(/^\d+(\.\d+)?%$/.test(d)){let b=Number.parseFloat(d);b>0&&(e.lineTwentieths=qn(Math.round(2.4*b),24,9600),e.lineRule="auto");}(t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page")&&(e.pageBreakBefore=true),t.get("page-break-after")?.trim().toLowerCase()==="avoid"&&(e.keepNext=true),t.get("page-break-inside")?.trim().toLowerCase()==="avoid"&&(e.keepLines=true),(/^[2-9]\d?$/.test(t.get("widows")?.trim()??"")||/^[2-9]\d?$/.test(t.get("orphans")?.trim()??""))&&(e.widowControl=true);let p=Ju(t);p&&(e.shdFill=p);let g=FB(t.get("tab-stops"));g!==void 0&&(e.tabs=g);let y=Qu(t.get("mso-border-alt"))??Qu(t.get("border")),h={};for(let b of ["top","left","bottom","right"]){let v=Qu(t.get(`mso-border-${b}-alt`))??Qu(t.get(`border-${b}`))??y;v!==void 0&&v!=="suppressed"&&(h[b]=v);}Object.keys(h).length>0&&(e.borders=h);}var HB="http://schemas.openxmlformats.org/drawingml/2006/picture",_B=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,BB=new Map([["image/png","png"],["image/jpeg","jpeg"],["image/gif","gif"],["image/bmp","bmp"],["image/webp","webp"],["image/svg+xml","svg"],["image/tiff","tiff"],["image/x-emf","emf"],["image/x-wmf","wmf"]]);function qP(e,t,n){return Math.min(n,Math.max(t,e))}function KP(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let a=_B.exec(o);if(!a)return;let i=n.mediaBySrc.get(o),s=i===void 0?void 0:n.media.get(i),l=s??Xu(a[1],n.maxImageBytes);if(l==null)return;let c=Sf$1(l),d=BB.get(c);if(d===void 0)return;let u=c==="image/png"||c==="image/jpeg"||c==="image/gif"||c==="image/bmp"||c==="image/webp"?Xf$1(l,c):null,f=Pt(e),p=Sh(e,f,"width",n.wordHtml),g=Sh(e,f,"height",n.wordHtml);u!==null?p===null&&g===null?(p=u.pixelWidth*96/(u.dpiX??96),g=u.pixelHeight*96/(u.dpiY??96)):p!==null&&g===null?g=p*u.pixelHeight/u.pixelWidth:p===null&&g!==null&&(p=g*u.pixelWidth/u.pixelHeight):p!==null&&g===null?g=p*2/3:p===null&&g!==null&&(p=g*3/2);let y=p===null?381e4:qP(Math.round(p*9525),9525,3e7),h=g===null?254e4:qP(Math.round(g*9525),9525,3e7),b=s===void 0?void 0:i;b===void 0&&(n.imageCount+=1,b=`word/media/image${n.imageCount}.${d}`,n.media.set(b,l),n.mediaBySrc.set(o,b),n.mediaExtensions.has(d)||n.mediaExtensions.set(d,c));let v=r(b.replace("word/",""));n.docPrId+=1,t.push(`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${y}" cy="${h}"/><wp:docPr id="${n.docPrId}" name=""/><wp:cNvGraphicFramePr/><a:graphic><a:graphicData uri="${HB}"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="" descr=""/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${v}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${y}" cy="${h}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`);}function Tn(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${W(e.rStyle)}"/>`),e.font!==void 0){let i=W(Wn(e.font));t+=e.rtl?`<w:rFonts w:cs="${i}"/>`:`<w:rFonts w:ascii="${i}" w:hAnsi="${i}"/>`;}e.bold?t+="<w:b/>":e.bold===false&&(t+='<w:b w:val="0"/>'),e.italic?t+="<w:i/>":e.italic===false&&(t+='<w:i w:val="0"/>'),e.caps?t+="<w:caps/>":e.caps===false&&(t+='<w:caps w:val="0"/>'),e.smallCaps?t+="<w:smallCaps/>":e.smallCaps===false&&(t+='<w:smallCaps w:val="0"/>'),e.doubleStrike?t+="<w:dstrike/>":e.strike?t+="<w:strike/>":e.strike===false&&(t+='<w:strike w:val="0"/>'),e.color!==void 0&&(t+=`<w:color w:val="${e.color}"/>`),e.charSpacingTwentieths!==void 0&&(t+=`<w:spacing w:val="${e.charSpacingTwentieths}"/>`),e.szHalfPoints!==void 0&&(t+=`<w:sz w:val="${e.szHalfPoints}"/>`),e.highlight!==void 0&&(t+=`<w:highlight w:val="${W(e.highlight)}"/>`),e.underline?t+=`<w:u w:val="${e.underlineVal??"single"}"${e.underlineColor===void 0?"":` w:color="${e.underlineColor}"`}/>`:e.underline===false&&(t+='<w:u w:val="none"/>'),e.shdFill!==void 0&&(t+=`<w:shd w:val="clear" w:color="auto" w:fill="${e.shdFill}"/>`),e.vertAlign!==void 0&&(t+=`<w:vertAlign w:val="${e.vertAlign}"/>`),e.rtl&&(t+="<w:rtl/>");let n=e.langVal,r=e.langEastAsia,o=e.langBidi;e.lang!==void 0&&(e.rtl?o??=e.lang:/^(?:zh|ja|ko)(?:-|$)/i.test(e.lang)?r??=e.lang:n??=e.lang);let a=`${n===void 0?"":` w:val="${W(n)}"`}${r===void 0?"":` w:eastAsia="${W(r)}"`}${o===void 0?"":` w:bidi="${W(o)}"`}`;return a.length>0&&(t+=`<w:lang${a}/>`),e.changeXml!==void 0&&(t+=e.changeXml),t.length>0?`<w:rPr>${t}</w:rPr>`:""}function nf(e,t){return `<w:r>${Tn(t)}<w:t xml:space="preserve">${V(Wn(e))}</w:t></w:r>`}function kh(e){let t="";if(e.styleId!==void 0&&(t+=`<w:pStyle w:val="${W(e.styleId)}"/>`),e.keepNext&&(t+="<w:keepNext/>"),e.keepLines&&(t+="<w:keepLines/>"),e.pageBreakBefore&&(t+="<w:pageBreakBefore/>"),e.widowControl&&(t+="<w:widowControl/>"),e.numPr&&(t+=`<w:numPr><w:ilvl w:val="${e.numPr.ilvl}"/><w:numId w:val="${W(e.numPr.numId)}"/></w:numPr>`),e.borders!==void 0){let i="";for(let s of ["top","left","bottom","right"]){let l=e.borders[s];l!==void 0&&(i+=`<w:${s} w:val="${l.val}" w:sz="${l.szEighthPoints}" w:space="0" w:color="${l.color}"/>`);}i.length>0&&(t+=`<w:pBdr>${i}</w:pBdr>`);}if(e.shdFill!==void 0&&(t+=`<w:shd w:val="clear" w:color="auto" w:fill="${e.shdFill}"/>`),e.tabs!==void 0&&e.tabs.length>0&&(t+=`<w:tabs>${e.tabs.map(i=>`<w:tab w:val="${i.val}" w:pos="${i.posTwips}"`+(i.leader===void 0?"/>":` w:leader="${i.leader}"/>`)).join("")}</w:tabs>`),e.bidi&&(t+="<w:bidi/>"),e.spacingBeforeTwips!==void 0||e.spacingAfterTwips!==void 0||e.lineTwentieths!==void 0){let i="<w:spacing";e.spacingBeforeTwips!==void 0&&(i+=` w:before="${e.spacingBeforeTwips}"`),e.spacingAfterTwips!==void 0&&(i+=` w:after="${e.spacingAfterTwips}"`),e.lineTwentieths!==void 0&&(i+=` w:line="${e.lineTwentieths}" w:lineRule="${e.lineRule??"auto"}"`),t+=`${i}/>`;}let n=e.firstLineTwips,[r,o]=e.bidi?[e.indRightTwips,e.indLeftTwips]:[e.indLeftTwips,e.indRightTwips];if(r!==void 0||o!==void 0||n!==void 0){let i="<w:ind";r!==void 0&&(i+=` w:left="${r}"`),o!==void 0&&(i+=` w:right="${o}"`),n!==void 0&&(i+=n>=0?` w:firstLine="${n}"`:` w:hanging="${-n}"`),t+=`${i}/>`;}let a=e.jc==="start"?"left":e.jc==="end"?"right":e.bidi&&(e.jc==="left"||e.jc==="right")?e.jc==="left"?"right":"left":e.jc;return a!==void 0&&(t+=`<w:jc w:val="${a}"/>`),e.markRevisionXml&&(t+=`<w:rPr>${e.markRevisionXml}</w:rPr>`),e.changeXml!==void 0&&(t+=e.changeXml),t.length>0?`<w:pPr>${t}</w:pPr>`:""}function Xa(e,t){return `<w:p>${kh(e)}${t.join("")}</w:p>`}var jP={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function rf(e){let t=e[e.length-1];if(t?.endsWith("</w:p>")){e[e.length-1]=`${t.slice(0,-6)}<w:r><w:br w:type="page"/></w:r></w:p>`;return}e.push('<w:p><w:r><w:br w:type="page"/></w:r></w:p>');}var $B=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,UP=new WeakMap;function Ih(e){let t=UP.get(e);for(t||(t={checked:0,furniture:true},UP.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=$B.test(e[t.checked]),t.checked+=1;return t.furniture}var WB=64,Ph=31680;function VP(e){let t=new Map,n=a=>{let i=a.indexOf(":");if(i<=0)return;let s=a.slice(0,i).trim().toLowerCase(),l=a.slice(i+1).trim();s.length===0||s.length>64||(t.delete(s),t.set(s,l));},r=0,o=null;for(let a=0;a<e.length;a+=1){let i=e[a];if(i==="\\"){a+=1;continue}if(o!==null){i===o&&(o=null);continue}i==='"'||i==="'"?o=i:i===";"&&(n(e.slice(r,a)),r=a+1);}return n(e.slice(r)),t}function qB(e){let t=e.trim(),n=t[0];(n==='"'||n==="'")&&t.length>=2&&t.endsWith(n)&&(t=t.slice(1,-1));let r="";for(let o=0;o<t.length;o+=1){let a=t[o];if(a!=="\\"){r+=a;continue}let i=/^[0-9a-fA-F]{1,6}/.exec(t.slice(o+1,o+7));if(i===null){o+1<t.length&&(r+=t[o+1]),o+=1;continue}let s=Number.parseInt(i[0],16);o+=i[0].length,/\s/.test(t[o+1]??"")&&(o+=1),s>0&&s<=1114111&&(s<55296||s>57343)&&(r+=String.fromCodePoint(s));}return r}var Rh=(e,t)=>{let n=Et(e??"");if(n!==null)return Math.min(Ph,Math.max(t,Math.round(n*20)))};function KB(e){let t=new Map,n=(o,a=o)=>{let i=e.get(o);i!==void 0&&t.set(a,i);};if(n("font-family"),n("color"),n("font-weight"),n("mso-ansi-font-weight","font-weight"),n("font-style"),n("mso-ansi-font-style","font-style"),n("font-size"),n("mso-ansi-font-size","font-size"),n("text-decoration"),n("text-underline"),t.size===0)return;let r=Tn(za({},t));return r.length>0?r:void 0}function GP(e){let t=e.get("mso-level-text"),n=t===void 0?void 0:Wn(qB(t)),r=KB(e),o=Rh(e.get("margin-left"),-Ph),a=Rh(e.get("text-indent"),-Ph),i=Rh(e.get("mso-level-tab-stop"),0),s={...n!==void 0&&n.length<=WB?{text:n}:{},...r!==void 0?{runXml:r}:{},...o!==void 0?{leftTwips:o}:{},...a!==void 0?{firstLineTwips:a}:{},...i!==void 0?{tabTwips:i}:{}};return Object.keys(s).length>0?s:void 0}var UB="http://schemas.openxmlformats.org/wordprocessingml/2006/main",jB='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',zP=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function ZP(e,t,n){let r=e?.leftTwips??720*(t+1),o=e?.firstLineTwips??-n,a=e?.tabTwips!==void 0&&e.tabTwips>0?`<w:tabs><w:tab w:val="num" w:pos="${e.tabTwips}"/></w:tabs>`:"",i=o<0?`w:hanging="${-o}"`:`w:firstLine="${o}"`;return `<w:pPr>${a}<w:ind w:left="${r}" ${i}/></w:pPr>`}function XP({kind:e,start:t,align:n,format:r},o){if(e==="bullet"){let s=zP[o%zP.length],l=r?.text!==void 0?r.runXml??"":`<w:rPr><w:rFonts w:ascii="${s.font}" w:hAnsi="${s.font}" w:hint="default"/></w:rPr>`;return `<w:lvl w:ilvl="${o}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${W(r?.text??s.text)}"/><w:lvlJc w:val="${n??"left"}"/>${ZP(r,o,360)}${l}</w:lvl>`}let a=n??(e==="lowerRoman"||e==="upperRoman"?"right":"left"),i=r?.text??`%${o+1}.`;return `<w:lvl w:ilvl="${o}"><w:start w:val="${t}"/><w:numFmt w:val="${e}"/><w:lvlText w:val="${W(i)}"/><w:lvlJc w:val="${a}"/>${ZP(r,o,a==="right"?180:360)}${r?.runXml??""}</w:lvl>`}var VB=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),GB=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),zB=new Map([["left","left"],["center","center"],["right","right"]]),YP=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function QP(e){let t=new Map;if(e.length===0||e.length>262200)return t;YP.lastIndex=0;let n,r=0;for(;(n=YP.exec(e))!==null&&r<512;){r+=1;let o="decimal",a=null,i,s=VP(n[4]);for(let[d,u]of s){let f=u.toLowerCase();d==="mso-level-number-format"?o=GB.get(f)??null:d==="mso-level-start-at"&&/^\d{1,5}$/.test(f)?a=Math.min(32767,Number.parseInt(f,10)):d==="mso-level-number-position"&&(i=zB.get(f));}if(o===null)continue;let l=n[3]===void 0?`l${n[1]}:level${n[2]}`:`l${n[1]}:level${n[2]}:lfo${n[3]}`,c=GP(s);t.has(l)||t.set(l,{kind:o,start:a,...i?{align:i}:{},...c?{format:c}:{}});}return t}function JP(e,t){let n=e.trim().replace(/^\(/,"");if(t==="decimal"){let r=/^(\d{1,5}(?:\.\d{1,5})*)/.exec(n);if(!r)return null;let o=r[1].split(".");return Math.min(32767,Number.parseInt(o[o.length-1],10))}if(t==="lowerRoman"||t==="upperRoman"){let r=/^([A-Za-z]{1,8})/.exec(n);return r?eC(r[1]):null}if(t==="lowerLetter"||t==="upperLetter"){let r=/^(([A-Za-z])\2{0,4})(?![A-Za-z])/.exec(n);if(!r)return null;let o=r[2].toLowerCase().charCodeAt(0);return Math.min(32767,(r[1].length-1)*26+(o-96))}return null}var ZB=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function eC(e){let t=e.toLowerCase();if(!ZB.test(t))return null;let n=0,r=0;for(let o of t){let a=VB.get(o);if(a===void 0)return null;n+=a,r>0&&r<a&&(n-=2*r),r=a;}return n>0&&n<=32767?n:null}function tC(e){let t=e.trim().replace(/^\(/,""),n=/^(\d{1,5}(?:\.\d{1,5})*)[.)]/.exec(t);if(n){let i=n[1].split(".");return {kind:"decimal",start:Math.min(32767,Number.parseInt(i[i.length-1],10))}}let r=/^([A-Za-z])[.)]/.exec(t);if(r){let i=r[1].toLowerCase();if(i==="i"||i==="v"||i==="x"){let l=i==="i"?1:i==="v"?5:10;return {kind:r[1]===i?"lowerRoman":"upperRoman",start:l}}let s=r[1].charCodeAt(0);return s>=97?{kind:"lowerLetter",start:s-96}:{kind:"upperLetter",start:s-64}}let o=/^([A-Za-z]{2,8})[.)]/.exec(t);if(o){let i=o[1],s=i===i.toLowerCase(),l=/^([A-Za-z])\1+$/.test(i);if(!l||/^[iI]+$/.test(i)){let c=eC(i);if(c!==null)return {kind:s?"lowerRoman":"upperRoman",start:c}}if(l){let c=i.toLowerCase().charCodeAt(0),d=Math.min(32767,(i.length-1)*26+(c-96));return {kind:s?"lowerLetter":"upperLetter",start:d}}}let a=/\d{1,5}/.exec(t);return a?{kind:"decimal",start:Math.min(32767,Number.parseInt(a[0],10))}:{kind:"bullet",start:1}}var XB=new Map([["none","none"],["decimal","decimal"],["upper-alpha","upperLetter"],["upper-latin","upperLetter"],["lower-alpha","lowerLetter"],["lower-latin","lowerLetter"],["upper-roman","upperRoman"],["lower-roman","lowerRoman"]]);function of(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=Pt(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:XB.get(t);if(n!==void 0)return n;let r=e.getAttribute("type");return r==="A"?"upperLetter":r==="a"?"lowerLetter":r==="I"?"upperRoman":r==="i"?"lowerRoman":"decimal"}function zl(e){let t=e.getAttribute("start")?.trim();return t!==void 0&&/^\d{1,5}$/.test(t)?Math.min(32767,Number.parseInt(t,10)):1}function nC(e){let t=e.map((r,o)=>{let a=r.levels.get(0)??r.levels.values().next().value??{kind:"decimal"},i=Array.from({length:9},(s,l)=>{let c=r.levels.get(l);return XP(c||{kind:a.kind==="bullet"?"bullet":"decimal",start:1},l)}).join("");return `<w:abstractNum w:abstractNumId="${o}"><w:multiLevelType w:val="hybridMultilevel"/>${i}</w:abstractNum>`}).join(""),n=e.map((r,o)=>`<w:num w:numId="${r.numId}"><w:abstractNumId w:val="${o}"/></w:num>`).join("");return `${jB}<w:numbering xmlns:w="${UB}">${t}${n}</w:numbering>`}function kr(e){if(e==null)return null;let t=e.trim();if(t.length===0||t.length>256)return null;if(/^[A-Za-z_][A-Za-z0-9_]{0,39}$/.test(t))return t;let n=t.replace(/[^A-Za-z0-9_]/g,"_");if(n.replace(/_/g,"").length===0)return null;let r=5381;for(let i=0;i<t.length;i+=1)r=(Math.imul(r,33)^t.charCodeAt(i))>>>0;let o=`_${r.toString(36)}`,a=n.slice(0,40-o.length);return /^[A-Za-z_]/.test(a)||(a=`_${a.slice(0,39-o.length)}`),`${a}${o}`}function rC(e){if(e===null)return false;if(e.startsWith("#"))return kr(e.slice(1))!==null;let t=U(e);return t?.ok===true&&t.href.length>0}function oC(e,t){if(e!==void 0&&e.startsWith("#")){let o=kr(e.slice(1)),a=kr(t)??o;return a===null?null:`#${a}`}let n=e===void 0?null:U(e),r=kr(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function aC(){let e=null;return (t,n,r)=>{if(e!==null&&e.html===t&&e.key===n){let i=e.value;return e=null,i}let o=r(),a={html:t,key:n,value:o};return e=a,globalThis.setTimeout(()=>{e===a&&(e=null);},0),o}}var YB=new Set(["HYPERLINK","NOTEREF","IF","MERGEFIELD","SECTIONPAGES","SECTION","NUMWORDS","NUMCHARS","AUTHOR","TITLE","SUBJECT","CREATEDATE","SAVEDATE","PRINTDATE","DOCPROPERTY","SYMBOL","EQ","LISTNUM","SET","XE","TC","INDEX"]),QB=/^(?:https?|mailto|tel|ftp):/i;function JB(e){let t=jd(e);if(!t)return false;if(t.target===null)return t.anchor!==null;let n=U(t.target);return n.ok&&QB.test(n.href)}function e4(e){let t=e.trim().split(/\s+/)[0]?.toUpperCase()??"";return t==="HYPERLINK"?JB(e):ba$1(e)||YB.has(t)}var t4=16384,iC=2048,n4=3e4,r4='<w:r><w:fldChar w:fldCharType="begin"/></w:r>',o4='<w:r><w:fldChar w:fldCharType="separate"/></w:r>',a4='<w:r><w:fldChar w:fldCharType="end"/></w:r>',dC=/<w:r><w:fldChar w:fldCharType="(begin|separate|end)"\/><\/w:r>|<w:r><w:instrText xml:space="preserve">([^<]*)<\/w:instrText><\/w:r>/g,sC={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function uC(e){return e.replace(/&(#x[0-9a-fA-F]{1,6}|#[0-9]{1,7}|[a-zA-Z]{2,8});/g,(t,n)=>{let r=String(n);if(r.startsWith("#")){let o=r[1]==="x"?Number.parseInt(r.slice(2),16):Number(r.slice(1));return Number.isInteger(o)&&o>=32&&o<=1114111&&!(o>=55296&&o<=57343)?String.fromCodePoint(o):""}return Object.hasOwn(sC,r)?sC[r]:t})}function i4(e){let t=uC(e).replace(/[\t\r\n\f\v ]+/g," ");return t.trim()===""?"":`<w:r><w:instrText xml:space="preserve">${V(t)}</w:instrText></w:r>`}var lC=new WeakMap,cC=new WeakMap;function fC(e,t){if(!e.startsWith("[if supportFields]>")||e.length>t4)return [];let n=e.slice(19).replace(/<!\[endif\]\s*$/,""),r=[],o="",a=cC.get(t);a||cC.set(t,a=[]);let i=a,s=()=>i.length>0&&i[i.length-1]===true,l=()=>{if(o.length>iC)return false;let c=s()?i4(o):"";return c&&r.push(c),o="",true};for(let c of n.matchAll(/<([^<>]{0,1024})>|([^<]+)/g)){if(c[2]!==void 0){if(s()&&(o+=c[2]),o.length>iC)return [];continue}let d=/mso-element:\s*field-(begin|separator|end)/i.exec(c[1])?.[1];if(!d)continue;if(!l())return [];let u=lC.get(t)??n4;if(u<=0)return [];lC.set(t,u-1);let f=d.toLowerCase();r.push(f==="begin"?r4:f==="separator"?o4:a4),f==="begin"?i.push(true):f==="separator"?i[i.length-1]=false:i.pop();}return l()?r:[]}function s4(e){let t=e.map(()=>true),n=[];for(let[r,o]of e.entries()){let a=n[n.length-1];if(o.kind==="begin")a&&!a.separated&&a.instruction.trim()===""&&(a.nestedFirst=true),n.push({separated:false,own:[r],instruction:"",begin:r,separator:-1,nestedFirst:false});else if(o.kind==="instruction")a&&!a.separated?(a.own.push(r),a.instruction+=uC(o.text)):t[r]=false;else if(o.kind==="separate"){if(!a||a.separated)return e.map(()=>false);a.separated=true,a.separator=r,a.own.push(r);}else {let i=n.pop();if(!i)return e.map(()=>false);if(i.own.push(r),i.nestedFirst||!e4(i.instruction)){for(let l of i.own)t[l]=false;let s=i.separator<0?r:i.separator;for(let l=i.begin;l<s;l+=1)t[l]=false;}}}return n.length===0?t:e.map(()=>false)}function l4(e){let t=[];for(let n of e)for(let r of n.matchAll(dC))t.push(r[1]!==void 0?{kind:r[1],text:""}:{kind:"instruction",text:r[2]});return t}function Ch(e){if(!e.some(r=>r.includes("<w:fldChar")||r.includes("<w:instrText")))return e;let t=s4(l4(e));if(t.every(Boolean))return e;let n=0;return e.map(r=>r.replace(dC,o=>t[n++]?o:""))}function pC(e){let t={};for(let n of Object.keys(e)){let r=new Map;for(let[o,a]of e[n])r.set(o,Ch(a));t[n]=r;}return t}var c4=/^(ftn|edn)([1-9]\d{0,9})$/i,d4={footnote:"ftn",endnote:"edn"};function mC(e,t){let n=e===null?null:c4.exec(e);if(!n||n[1].toLowerCase()!==d4[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function Th(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=mC(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function u4(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=mC(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function gC(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],a=u4(o,Pt(o));a!==null&&t.push({...a,element:o});}return t}function hC(e,t,n){let r=new Map(t.map(i=>[i.element,i])),o=i=>{let s=i.parentElement;for(let l=0;s!==null&&l<128;l+=1){let c=r.get(s);if(c!==void 0)return c;s=s.parentElement;}return null},a=e.getElementsByTagName("a");for(let i=0;i<a.length&&i<2e4;i+=1){let s=a[i],l=Th(Pt(s));if(l===null)continue;let c=o(s);c!==null&&c.kind===l.kind&&c.id===l.id||n[l.kind].add(l.id);}}function yC(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var f4=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function ls(e,t,n){return e.replace(f4,(r,o,a)=>{let i=`${o}:${a}`;return t.has(i)?n?.get(i)??"":r})}function Eh(e,t){let n="";for(let[r,o]of t)n+=`<w:${e} w:id="${r}">${o.join("")}</w:${e}>`;return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${e}s xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">${n}</w:${e}s>`}function bC(e,t,n,r){let o=new Set,a={footnote:new Set,endnote:new Set},i=()=>{a.footnote.clear(),a.endnote.clear();let s=[],l=(c,d)=>{o.has(`${c}:${d}`)||!e.notes[c].has(d)||a[c].has(d)||(a[c].add(d),s.push({kind:c,id:d}));};for(let c of ["footnote","endnote"])for(let d of e.bodyNoteRefs[c])l(c,d);for(let c of o)for(let d of e.noteNoteRefs.get(c)??[])l(d.kind,d.id);for(;s.length>0;){let c=s.pop();for(let d of e.noteNoteRefs.get(`${c.kind}:${c.id}`)??[])l(d.kind,d.id);}};for(;;){i();let s=false;for(let l of ["footnote","endnote"]){for(let c of e.notes[l].keys()){let d=`${l}:${c}`;if(!(a[l].has(c)||o.has(d))){o.add(d),s=true;break}}if(s)break}if(!s)break}if(o.size>0)for(let s of ["footnote","endnote"])for(let[l,c]of e.notes[s])o.has(`${s}:${l}`)||e.notes[s].set(l,c.map(d=>ls(d,o,e.noteMarkFallbacks)));for(let s of ["footnote","endnote"])for(let[l,c]of [...e.notes[s]]){if(!o.has(`${s}:${l}`))continue;e.notes[s].delete(l),t[s].delete(l);let d=new Map;for(let u of c){let f=ls(u.replace(/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(?:footnote|endnote)Ref\/><\/w:r>/g,""),o,e.noteMarkFallbacks).replace(/ r:(id|embed)="([^"]{1,32})"/g,(p,g,y)=>{let h=d.get(y);if(h===void 0){let b=e.noteRels[s].find(v=>v.id===y);if(b===void 0)return p;h=r(e,b.type,b.target,b.external),d.set(y,h);}return ` r:${g}="${h}"`});n.push(f),e.lastMarkCovered=false;}}}function Oh(e,t,n,r=0){let o=e.lists.get(t);if(o)return o.levels.has(r)||o.levels.set(r,n),o.numId;let a=String(1001+e.lists.size),i={numId:a,levels:new Map([[r,n]])};return e.lists.set(t,i),e.listsByNumId.set(a,i),a}function vC(e,t,n,r){let o=t.get("mso-list");if(o===void 0)return;let a=/\bl(\d{1,4})\s+level(\d{1,2})\b/i.exec(o);if(!a)return;let i=Math.min(Math.max(Number.parseInt(a[2],10)-1,0),8),s=m4(e,n),l=/\blfo(\d{1,4})\b/i.exec(o),c=(l!==null?n.listDefinitions.get(`l${a[1]}:level${a[2]}:lfo${l[1]}`):void 0)??n.listDefinitions.get(`l${a[1]}:level${a[2]}`),d=c!==void 0?{kind:c.kind,start:JP(s,c.kind)??c.start??1,...c.align?{align:c.align}:{},...c.format?{format:c.format}:{}}:s.trim().length>0?tC(s):p4(e),f=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${a[1]}${l?`:lfo${l[1]}`:""}`;return {numId:Oh(n,f,d,i),ilvl:i}}function p4(e){let t=e.parentElement;return t===null||Qe(t)!=="ol"&&Qe(t)!=="ul"?{kind:"bullet",start:1}:{kind:of(t),start:zl(t)}}function m4(e,t){let n="",r=(o,a)=>{if(!(n.length>0||a>8||t.nodesLeft<=0)&&ss(o)){if(ef(o)){n=(o.textContent??"").slice(0,16);return}for(let i of Array.from(o.childNodes))r(i,a+1);}};for(let o of Array.from(e.childNodes))r(o,0);return n}var g4="http://schemas.openxmlformats.org/package/2006/relationships",h4="http://schemas.openxmlformats.org/package/2006/content-types",y4="application/vnd.openxmlformats-package.relationships+xml",Lh='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',b4="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Ah="http://schemas.openxmlformats.org/officeDocument/2006/relationships",v4="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",x4="http://schemas.openxmlformats.org/drawingml/2006/main",S4="http://schemas.openxmlformats.org/drawingml/2006/picture",w4="http://schemas.openxmlformats.org/officeDocument/2006/math",xC={document:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",numbering:"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",footnotes:"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",endnotes:"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"};function Mh(e){let t=e.map(n=>`<Relationship Id="${W(n.id)}" Type="${W(n.type)}" Target="${W(n.target)}"${n.external?' TargetMode="External"':""}/>`).join("");return `${Lh}<Relationships xmlns="${g4}">${t}</Relationships>`}function k4(e){let t=new Map;t.set("word/document.xml",ef$2(e.documentXml)),t.set("word/_rels/document.xml.rels",ef$2(Mh(e.rels))),t.set("_rels/.rels",ef$2(Mh([{id:"rId1",type:`${Ah}/officeDocument`,target:"word/document.xml",external:false}])));let n=[["numbering",e.numberingXml],["footnotes",e.footnotesXml],["endnotes",e.endnotesXml]],r=`<Override PartName="/word/document.xml" ContentType="${xC.document}"/>`;for(let[a,i]of n)i!==void 0&&(t.set(`word/${a}.xml`,ef$2(i)),r+=`<Override PartName="/word/${a}.xml" ContentType="${xC[a]}"/>`);for(let[a,i]of [["footnotes",e.footnotesRels],["endnotes",e.endnotesRels]])i!==void 0&&i.length>0&&t.set(`word/_rels/${a}.xml.rels`,ef$2(Mh(i)));for(let[a,i]of e.media)t.set(a,i);let o=`<Default Extension="rels" ContentType="${y4}"/><Default Extension="xml" ContentType="application/xml"/>`;for(let[a,i]of e.mediaExtensions)o+=`<Default Extension="${W(a)}" ContentType="${W(i)}"/>`;return t.set("[Content_Types].xml",ef$2(`${Lh}<Types xmlns="${h4}">${o}${r}</Types>`)),df$2(t)}function SC(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${Ah}/${o}`,target:`${o}.xml`,external:false});};e.lists.length>0&&n("numbering");for(let o of ["footnote","endnote"])e.notes[o].size>0&&n(`${o}s`);let r=`${Lh}<w:document xmlns:w="${b4}" xmlns:r="${Ah}" xmlns:wp="${v4}" xmlns:a="${x4}" xmlns:pic="${S4}" xmlns:m="${w4}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return k4({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:nC(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:Eh("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:Eh("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}var Ya=32;function ar(e){return e.left<=0?(e.truncated=true,false):(e.left-=1,e.visited+=1,true)}var wC=Object.freeze({});function kC(e,t){let n={...t};return e.bold!==void 0&&(n.bold=e.bold),e.italic!==void 0&&(n.italic=e.italic),e.color!==void 0&&(n.color=e.color),e.highlight!==void 0&&(n.highlight=e.highlight),e.shdFill!==void 0&&(n.shdFill=e.shdFill),e.szHalfPoints!==void 0&&(n.szHalfPoints=e.szHalfPoints),n}function I4(e){return e.replace(/ /g," ").replace(/[⁡-⁤]/g,"").replace(/[ \t\r\n\f\v]+/g," ")}function Po(e,t,n){let r=V(Wn(I4(e)));if(r.length===0)return "";let a=n.uprightUnlessItalic===true&&n.italic!==true?n.bold?"b":"p":n.bold?"bi":null,i=t.length>0?t:a?`<m:sty m:val="${a}"/>`:"",s=Tn({...n.color!==void 0?{color:n.color}:{},...n.highlight!==void 0?{highlight:n.highlight}:{},...n.shdFill!==void 0?{shdFill:n.shdFill}:{},...n.szHalfPoints!==void 0?{szHalfPoints:n.szHalfPoints}:{}});return `<m:r>${i.length>0?`<m:rPr>${i}</m:rPr>`:""}${s}<m:t xml:space="preserve">${r}</m:t></m:r>`}var R4=512,IC=new Set(["\u2211","\u220F","\u2210","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"]),P4=new Map([["^","\u0302"],["\u02C6","\u0302"],["\u0302","\u0302"],["~","\u0303"],["\u02DC","\u0303"],["\u0303","\u0303"],["\u02D9","\u0307"],["\u0307","\u0307"],["\xA8","\u0308"],["\u0308","\u0308"],["\u2192","\u20D7"],["\u20D7","\u20D7"],["\xB4","\u0301"],["`","\u0300"],["\u02C7","\u030C"],["\u02D8","\u0306"]]),RC=new Set(["\xAF","\u203E","_","\u2015","\u2014","\u0305","-"]),PC=new Map([["(",")"],["[","]"],["{","}"],["|","|"],["\u2016","\u2016"],["\u27E8","\u27E9"],["\u2329","\u232A"],["\u230A","\u230B"],["\u2308","\u2309"]]),C4=new Set(["annotation","annotation-xml","none","mprescripts","mspace","maligngroup","malignmark","mphantom"]),T4=new Set(["msub","msup","msubsup","munder","mover","munderover"]);function Co(e){return e.localName.toLowerCase()}function Xl(e){return Array.from(e.children)}function ea(e){return (e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim().slice(0,R4)}function Qa(e){return W(Wn(e))}function Ve(e,t){return t.length>0?`<m:${e}>${t}</m:${e}>`:`<m:${e}/>`}function CC(e,t){let n=t,r=e.getAttribute("mathcolor")?.trim()??"",o=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(r)?.[1];if(o!==void 0){let i=o.length===3?o.replace(/./g,s=>s+s):o;n={...n,color:i.toUpperCase()};}let a=e.getAttribute("mathvariant")?.trim().toLowerCase();return (a==="bold"||a==="bold-italic")&&(n={...n,bold:true}),n}function Zl(e){if(e===void 0||Co(e)!=="mo")return null;let t=ea(e);return [...t].length===1?t:null}var Fh=class{constructor(t){this.state=t;}state;node(t,n,r){if(n>Ya)return this.state.truncated=true,"";if(!ar(this.state))return "";let o=Co(t),a=CC(t,r),i=Xl(t),s=l=>i[l]?this.node(i[l],n+1,a):"";if(C4.has(o))return "";switch(o){case "semantics":return s(0);case "mi":return this.identifier(t,a);case "mn":case "mo":return Po(ea(t),"",a);case "mtext":return Po(ea(t),"<m:nor/>",a);case "ms":return Po(`"${ea(t)}"`,"<m:nor/>",a);case "msub":return `<m:sSub>${Ve("e",s(0))}${Ve("sub",s(1))}</m:sSub>`;case "msup":return `<m:sSup>${Ve("e",s(0))}${Ve("sup",s(1))}</m:sSup>`;case "msubsup":return `<m:sSubSup>${Ve("e",s(0))}${Ve("sub",s(1))}${Ve("sup",s(2))}</m:sSubSup>`;case "mfrac":return this.fraction(t,s(0),s(1));case "msqrt":return `<m:rad><m:radPr><m:degHide m:val="1"/></m:radPr><m:deg/>${Ve("e",this.row(i,n+1,a))}</m:rad>`;case "mroot":return `<m:rad>${Ve("deg",s(1))}${Ve("e",s(0))}</m:rad>`;case "munder":return this.under(i[1],s(0),s(1));case "mover":return this.over(t,i[1],s(0),s(1));case "munderover":return `<m:limUpp>${Ve("e",`<m:limLow>${Ve("e",s(0))}${Ve("lim",s(1))}</m:limLow>`)}${Ve("lim",s(2))}</m:limUpp>`;case "mfenced":return this.fenced(t,i,n,a);case "menclose":return `<m:borderBox>${Ve("e",this.row(i,n+1,a))}</m:borderBox>`;case "mtable":return this.table(i,n,a);case "mmultiscripts":return this.multiscripts(i,n,a);default:return this.row(i,n+1,a)}}identifier(t,n){let r=ea(t),o=t.getAttribute("mathvariant")?.trim().toLowerCase(),a="";return o==="normal"||o===void 0&&[...r].length>1?a='<m:sty m:val="p"/>':o==="bold"?a='<m:sty m:val="b"/>':o==="bold-italic"&&(a='<m:sty m:val="bi"/>'),Po(r,a,n)}fraction(t,n,r){let o=t.getAttribute("linethickness")?.trim().toLowerCase(),a=t.getAttribute("bevelled")?.trim().toLowerCase()==="true",i=o!==void 0&&/^0(?:\.0*)?(?:px|pt|em|ex|%)?$/.test(o)?"noBar":a?"skw":null;return `<m:f>${i===null?"":`<m:fPr><m:type m:val="${i}"/></m:fPr>`}${Ve("num",n)}${Ve("den",r)}</m:f>`}under(t,n,r){let o=Zl(t);return o!==null&&RC.has(o)?`<m:bar><m:barPr><m:pos m:val="bot"/></m:barPr>${Ve("e",n)}</m:bar>`:`<m:limLow>${Ve("e",n)}${Ve("lim",r)}</m:limLow>`}over(t,n,r,o){let a=Zl(n);if(a!==null&&RC.has(a))return `<m:bar><m:barPr><m:pos m:val="top"/></m:barPr>${Ve("e",r)}</m:bar>`;let i=a===null?void 0:P4.get(a);return i!==void 0||a!==null&&t.getAttribute("accent")?.trim()==="true"?`<m:acc><m:accPr><m:chr m:val="${Qa(i??a)}"/></m:accPr>${Ve("e",r)}</m:acc>`:`<m:limUpp>${Ve("e",r)}${Ve("lim",o)}</m:limUpp>`}fenced(t,n,r,o){let a=[...t.getAttribute("open")??"("].slice(0,1).join(""),i=[...t.getAttribute("close")??")"].slice(0,1).join(""),s=[...(t.getAttribute("separators")??",").trim()][0]??"",l=n.map(c=>Ve("e",this.node(c,r+1,o)));return `<m:d><m:dPr><m:begChr m:val="${Qa(a)}"/>${s.length>0?`<m:sepChr m:val="${Qa(s)}"/>`:""}<m:endChr m:val="${Qa(i)}"/></m:dPr>${l.join("")||"<m:e/>"}</m:d>`}table(t,n,r){let o="";for(let a of t){if(!ar(this.state))break;let i=Co(a);if(i!=="mtr"&&i!=="mlabeledtr")continue;let s=Xl(a).slice(i==="mlabeledtr"?1:0);o+="<m:mr>"+s.map(l=>Ve("e",Co(l)==="mtd"?this.row(Xl(l),n+2,r):this.node(l,n+2,r))).join("")+"</m:mr>";}return o.length>0?`<m:m>${o}</m:m>`:""}multiscripts(t,n,r){let o=c=>c===void 0||Co(c)==="none"?"":this.node(c,n+1,r),a=t.findIndex(c=>Co(c)==="mprescripts"),i=a<0?t.slice(1):t.slice(1,a),s=a<0?[]:t.slice(a+1),l=o(t[0]);return i.length>0&&(l=`<m:sSubSup>${Ve("e",l)}${Ve("sub",o(i[0]))}${Ve("sup",o(i[1]))}</m:sSubSup>`),s.length>0?`<m:sPre>${Ve("sub",o(s[0]))}${Ve("sup",o(s[1]))}${Ve("e",l)}</m:sPre>`:l}nary(t,n,r,o){let a=Co(t),i=Xl(t),s=ea(a==="mo"?t:i[0]),l=g=>i[g]?this.node(i[g],r+1,o):"",c="",d="";a==="msub"||a==="munder"?c=l(1):a==="msup"||a==="mover"?d=l(1):(a==="msubsup"||a==="munderover")&&(c=l(1),d=l(2));let u=a==="munder"||a==="mover"||a==="munderover"?"undOvr":"subSup",f=`<m:chr m:val="${Qa(s)}"/><m:limLoc m:val="${u}"/>${c.length===0?'<m:subHide m:val="1"/>':""}${d.length===0?'<m:supHide m:val="1"/>':""}`,p=n?this.node(n,r+1,o):"";return `<m:nary><m:naryPr>${f}</m:naryPr>${Ve("sub",c)}${Ve("sup",d)}${Ve("e",p)}</m:nary>`}isNary(t){let n=Co(t);if(n==="mo")return IC.has(ea(t));if(!T4.has(n))return false;let r=t.children[0];return r!==void 0&&IC.has(Zl(r)??"")}row(t,n,r){if(n>Ya)return this.state.truncated=true,"";let o=Zl(t[0]),a=Zl(t[t.length-1]);if(t.length>=2&&o!==null&&a!==null&&PC.has(o)&&[...PC.values()].includes(a)){let l=this.row(t.slice(1,-1),n+1,r);return `<m:d><m:dPr><m:begChr m:val="${Qa(o)}"/><m:endChr m:val="${Qa(a)}"/></m:dPr>${Ve("e",l)}</m:d>`}let i="";for(let s=0;s<t.length;s+=1){let l=t[s];if(this.isNary(l)){let c=t[s+1];i+=this.nary(l,c,n,r),c!==void 0&&(s+=1);continue}i+=this.node(l,n,r);}return i}};function Dh(e){return Co(e)==="math"}function TC(e){return e.getAttribute("display")?.trim().toLowerCase()==="block"||e.getAttribute("mode")?.trim().toLowerCase()==="display"}function EC(e,t,n){return new Fh(t).row(Xl(e),1,CC(e,n))}var E4="acc accPr aln alnScr argPr argSz bar barPr baseJc begChr borderBox borderBoxPr box boxPr brk brkBin brkBinSub cGp cGpRule chr count cSp ctrlPr d defJc deg degHide den diff dispDef dPr e endChr eqArr eqArrPr f fName fPr func funcPr groupChr groupChrPr grow hideBot hideLeft hideRight hideTop interSp intLim intraSp jc lim limLoc limLow limLowPr limUpp limUppPr lit lMargin m mathFont mathPr maxDist mc mcJc mcPr mcs mPr mr nary naryLim naryPr noBreak nor num objDist oMath oMathPara oMathParaPr opEmu phant phantPr plcHide pos postSp preSp r rad radPr rMargin rPr rSp rSpRule scr sepChr show shp smallFrac sPre sPrePr sSub sSubPr sSubSup sSubSupPr sSup sSupPr strikeBLTR strikeH strikeTLBR strikeV sty sub subHide sup supHide t transp type vertJc wrapIndent wrapRight zeroAsc zeroDesc zeroWid".split(" "),MC=new Map(E4.map(e=>[`m:${e.toLowerCase()}`,e])),O4=new Set(["oMath","e","num","den","sub","sup","deg","lim","fName"]),M4=512,A4=512,L4=64,F4=64,D4=2,N4=256,OC=/^\[if\s+gte\s+msEquation\b[^\]]*\]>([\s\S]*)<!\[endif\]$/i,H4=/^\[if\s+!msEquation\s*\]$/i,_4=/^\[if\b[^\]]*\]$/i,B4=/^\[endif\]$/i,$4=Object.freeze({byElement:new Map,visited:0,truncated:false});function AC(e){return /<m:omath|msEquation|<math[\s>]/i.test(e)}function Yl(e){return e.nodeType===1?MC.get(Qe(e)):void 0}function LC(e,t,n,r){if(!(n>Ya||!ar(t))){if(e.nodeType===3){r.push(e.nodeValue??"");return}if(!(e.nodeType!==1||Qe(e)==="o:p"))for(let o of Array.from(e.childNodes))LC(o,t,n+1,r);}}function Nh(e,t){return kC(Za(Gl({},Qe(e)),e),t)}function W4(e,t,n,r){let o="",a=[],i=r;for(let s of Array.from(e.childNodes)){let l=Yl(s);if(l==="rPr")o+=af(s,"rPr",t,n+1,r);else {if(s.nodeType===1&&Qe(s)==="w:rpr")continue;s.nodeType===1&&l===void 0&&(i=Nh(s,i)),LC(s,t,n+1,a);}}return Po(a.join(""),o,i)}function af(e,t,n,r,o){let a="",i="",s=O4.has(t);for(let l of Array.from(e.childNodes)){if(l.nodeType===3){if(!ar(n))break;s&&(i+=l.nodeValue??"");continue}l.nodeType===1&&(i.trim().length>0&&(a+=Po(i,"",o)),i="",a+=FC(l,t,n,r+1,o));}return i.trim().length>0&&(a+=Po(i,"",o)),a}function FC(e,t,n,r,o){if(r>Ya)return n.truncated=true,"";if(!ar(n))return "";let a=MC.get(Qe(e));if(a===void 0)return Qe(e)==="o:p"?"":af(e,t,n,r,Nh(e,o));if(a==="ctrlPr"||a==="oMathPara"||a==="oMath")return "";if(a==="r"||a==="t")return W4(e,n,r,o);let i=e.getAttribute("m:val"),s=i!==null&&i.length<=L4?` m:val="${W(Wn(i))}"`:"",l=af(e,a,n,r,o);return l.length>0?`<m:${a}${s}>${l}</m:${a}>`:`<m:${a}${s}/>`}function DC(e,t,n){if(!ar(t))return null;let r=af(e,"oMath",t,1,n);return r.length>0?`<m:oMath>${r}</m:oMath>`:null}function NC(e,t,n,r,o){if(!(n>Ya||!ar(t)))for(let a of Array.from(e.children)){let i=Yl(a);if(i==="oMath"){let s=DC(a,t,r);s!==null&&o.equations.push(s);}else i==="oMathParaPr"&&o.properties.length===0?o.properties=FC(a,"oMathPara",t,n+1,r):i===void 0&&NC(a,t,n+1,Nh(a,r),o);}}function q4(e){let t=Yl(e);return t==="oMath"||t==="oMathPara"||Dh(e)}function K4(e){let t=0;for(let n=e.parentElement;n!==null;n=n.parentElement)if((t+=1)>N4||q4(n))return true;return false}function U4(e,t){if(typeof e.createTreeWalker!="function")return;let n=e.createTreeWalker(e.body,128),r=[];for(let o=n.nextNode();o!==null;o=n.nextNode()){if(!ar(t))return;let a=o.data;if(/<m:omath|<math[\s>]/i.test(a)&&OC.test(a)){if(r.length>=A4){t.truncated=true;break}r.push(o);}}for(let o of r){let a=OC.exec(o.data)?.[1]??"",i;try{i=new DOMParser().parseFromString(a,"text/html");}catch{continue}let s=o.parentNode;if(!(s===null||i.body===null)){for(let l of Array.from(i.body.childNodes))s.insertBefore(e.importNode(l,true),o);s.removeChild(o);}}}function j4(e){return e.nodeType===3?(e.nodeValue??"").replace(/[\s ]/g,"").length>0:e.nodeType===1||e.nodeType===8}function V4(e){let t=e;for(let n=0;n<=D4;n+=1){let r=t.nextSibling;for(;r!==null&&!j4(r);)r=r.nextSibling;if(r!==null){if(r.nodeType!==8||!H4.test(r.data.trim()))return;let i=[r],s=1;for(let l=r.nextSibling;l!==null&&i.length<=F4;l=l.nextSibling)if(i.push(l),l.nodeType===8){let c=l.data.trim();if(B4.test(c)?s-=1:_4.test(c)&&(s+=1),s===0){for(let d of i)d.parentNode?.removeChild(d);return}}return}let o=t.parentElement;if(o===null||Yl(o)!==void 0)return;let a=Qe(o);if(a!=="span"&&a!=="i"&&a!=="b"&&a!=="font")return;t=o;}}function G4(e,t){let n=e.getElementsByTagName("i").length>0?{uprightUnlessItalic:true}:wC;if(Dh(e)){if(!ar(t))return null;let r=EC(e,t,n);return r.length===0?null:TC(e)?`<m:oMathPara><m:oMath>${r}</m:oMath></m:oMathPara>`:`<m:oMath>${r}</m:oMath>`}if(Yl(e)==="oMathPara"){let r={properties:"",equations:[]};return NC(e,t,1,n,r),r.equations.length===0?null:`<m:oMathPara>${r.properties}${r.equations.join("")}</m:oMathPara>`}return DC(e,t,n)}function HC(e,t){if(e.body===null||t<=0)return $4;let n={left:t,visited:0,truncated:false};U4(e,n);let r=new Map,o=[];for(let a of ["m:omathpara","m:omath","math"]){let i=e.body.getElementsByTagName(a);for(let s=0;s<i.length;s+=1){if(o.length>=M4){n.truncated=true;break}if(!ar(n))break;let l=i[s];K4(l)||o.push(l);}}for(let a of o){if(n.left<=0){n.truncated=true;break}let i=G4(a,n);i===null||n.truncated||(r.set(a,[i]),V4(a));}return {byElement:r,visited:n.visited,truncated:n.truncated}}function Hh(e){return e.startsWith("<m:oMath>")||e.startsWith("<m:oMathPara>")}var _C=new Map;function BC(e,t,n,r){let o=ph(n)??e.runChange,a=gh(t,e.originalRunStyle);if(r===null&&o===void 0&&a===void 0)return e;let i=e.run;if(o!==void 0){let s=RP(i),l=za(s,a??_C);i={...s,changeXml:kP(o,Tn(l))};}return {...e,run:i,...r===null?{}:{revisions:[...e.revisions??[],r]},...o===void 0?{}:{runChange:o},...a===void 0?{}:{originalRunStyle:a}}}function $C(e,t,n){let r=ph(n);if(r===null)return;let o={...e};tf(o,gh(t,void 0)??_C),e.changeXml=IP(r,kh(o));}function sf(e,t){let n=t.markRevision;return t.markRevisionTaken=n!==null,n===null?e:(t.markRevision=null,{...e,markRevisionXml:n})}function WC(e,t){let n=[e],r=[];for(let o of ["footnote","endnote"])for(let[a,i]of t[o]){let s=[...i];r.push({kind:o,id:a,blocks:s}),n.push(s);}PP(n);for(let o of r)t[o.kind].set(o.id,o.blocks);}function Ir(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var ta=31680;function To(e,t,n){return Math.min(n,Math.max(t,e))}function qC(e){let t=Et(Pt(e).get("width")??"");if(t!==null&&t>0)return t;let n=e.getAttribute("width")?.trim();if(n===void 0||!/^\d{1,6}(\.\d+)?$/.test(n))return null;let r=Number.parseFloat(n);return Number.isFinite(r)&&r>0?r*.75:null}function z4(e){return Ja(e,"colspan",63)}function KC(e){return Array.from(e.children).flatMap(t=>{let n=Qe(t);return n==="tr"?[t]:n!=="thead"&&n!=="tbody"&&n!=="tfoot"?[]:Array.from(t.children).filter(r=>Qe(r)==="tr")})}function Ja(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:To(Number.parseInt(r,10),1,n)}function UC(e,t){let n=(Pt(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${To(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=qC(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let a=To(Math.round(o*20),1,ta);return {xml:`<w:tblW w:w="${a}" w:type="dxa"/>`,twips:a}}function jC(e){let n=Pt(e).get("mso-table-left")?.trim().toLowerCase(),r=(n==="left"||n==="center"||n==="right"?n:void 0)??e.getAttribute("align")?.trim().toLowerCase();return r==="left"||r==="center"||r==="right"?r:void 0}function VC(e){let t=Pt(e),n=t.get("mso-table-anchor-horizontal")?.trim().toLowerCase(),r=t.get("mso-table-anchor-vertical")?.trim().toLowerCase();if(n===void 0&&r===void 0)return "";let o=l=>l==="margin"||l==="page"?l:"text",a=` w:horzAnchor="${o(n)}" w:vertAnchor="${o(r)}"`,i=t.get("mso-table-left")?.trim().toLowerCase();if(i==="left"||i==="center"||i==="right")a+=` w:tblpXSpec="${i}"`;else {let l=Et(i??"");l!==null&&(a+=` w:tblpX="${To(Math.round(l*20),-ta,ta)}"`);}let s=Et(t.get("mso-table-top")??"");return s!==null&&(a+=` w:tblpY="${To(Math.round(s*20),-ta,ta)}"`),`<w:tblpPr${a}/>`}function GC(e,t,n){let r=Math.max(1,Math.floor(n/t)),o=-1,a=Array.from({length:t},()=>r),i=new Array(t).fill(null);for(let d of e){let u=Array.from({length:t},()=>r),f=0,p=0,g=i.map(b=>b?b.span:null);for(let b=0;b<t;b+=1){let v=i[b];v&&(v.remaining-=1,v.remaining<=0&&(i[b]=null));}let y=Array.from(d.children).filter(b=>/^t[dh]$/.test(Qe(b))),h=0;for(;p<t;){let b=g[p];if(b!==null){p+=b;continue}let v=y[h];if(v===void 0)break;h+=1;let S=Math.min(z4(v),t-p);for(let T=p+1;T<p+S;T+=1)if(g[T]!==null){S=T-p;break}let x=Ja(v,"rowspan",1e3);x>1&&(i[p]={remaining:x-1,span:S});let k=qC(v);if(k!==null){let T=To(Math.round(k*20/S),1,ta);for(let R=0;R<S;R+=1)u[p+R]=T;f+=S;}p+=S;}f>o&&(o=f,a=u);}let s=a.reduce((d,u)=>d+u,0);if(s<=0)return a;let l=a.map(d=>Math.max(1,Math.round(d*n/s))),c=n-l.reduce((d,u)=>d+u,0);return l[l.length-1]=Math.max(1,l[l.length-1]+c),l}function _h(e,t,n){let r=0;for(let o=0;o<n;o+=1)r+=e[t+o]??0;return Math.max(1,r)}var zC=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),ZC=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function XC(e){return To(Math.round(e*8),2,96)}function Zr(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of wh(e)){let a=zC.get(o.toLowerCase());if(a!==void 0){t=a;continue}let i=ZC.get(o.toLowerCase())??Et(o);if(i!==null){n=i;continue}let s=Jo(o);if(s!==null){r=s;continue}return}if(t!==void 0){if(t==="nil")return {val:t,size:0,color:r??"auto"};if(n===void 0)return {val:t,size:4,color:r??"000000"};if(!(n<=0))return {val:t,size:XC(n),color:r??"000000"}}}function lf(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=zC.get(n.split(/\s+/)[0].toLowerCase());if(r===void 0)return;if(r==="nil")return {val:r,size:0,color:"auto"};let o=e.get(`${t}-width`)?.trim().split(/\s+/)[0],a=o===void 0||o.length>64?null:ZC.get(o.toLowerCase())??Et(o);if(a!==null&&a<=0)return;let i=e.get(`${t}-color`)?.trim().split(/\s+/)[0],s=i===void 0||i.length>64?null:Jo(i);return {val:r,size:a===null?4:XC(a),color:s??"000000"}}function YC(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function QC(e,t=false){let n=Pt(e),o=Zr(n.get("mso-border-alt"))??Zr(n.get("border"))??lf(n,"border")??(e.getAttribute("border")?.trim()&&e.getAttribute("border")?.trim()!=="0"?{val:"single",size:4,color:"auto"}:void 0),a=[["top","top"],["left","left"],["bottom","bottom"],["right","right"],["insideH","insideh"],["insideV","insidev"]],i="";for(let[s,l]of a){let c=Ir(l,t),d=Zr(n.get(`mso-border-${c}-alt`))??Zr(n.get(`mso-border-${c}`))??Zr(n.get(`border-${c}`))??lf(n,`border-${c}`)??o;d!==void 0&&(i+=YC(s,d));}return i.length>0?`<w:tblBorders>${i}</w:tblBorders>`:""}function JC(e){let t=Pt(e),n=wP(t),r=Et(t.get("height")??"");if(r===null||r<=0)return n?`<w:trPr>${n}</w:trPr>`:"";let o=To(Math.round(r*20),1,ta),i=t.get("mso-height-rule")?.trim().toLowerCase()==="exactly"?"exact":"atLeast";return `<w:trPr><w:trHeight w:val="${o}" w:hRule="${i}"/>${n}</w:trPr>`}function Z4(e,t){let n={top:null,right:null,bottom:null,left:null},r=e.get("padding");if(r!==void 0&&r.length<=128){let a=r.trim().split(/\s+/).map(i=>Et(i));if(a.length>=1&&a.length<=4&&!a.some(i=>i===null||i<0)){let[i,s=i,l=i,c=s]=a.length===2?[a[0],a[1],a[0],a[1]]:a.length===3?[a[0],a[1],a[2],a[1]]:a;n.top=i??null,n.right=s??null,n.bottom=l??null,n.left=c??null;}}for(let a of ["top","right","bottom","left"]){let i=Et(e.get(`padding-${a}`)??"");i!==null&&i>=0&&(n[a]=i);}let o="";for(let a of ["top","left","bottom","right"]){let i=Ir(a,t),s=n[i];s!==null&&(o+=`<w:${a} w:w="${To(Math.round(s*20),0,ta)}" w:type="dxa"/>`);}return o.length>0?`<w:tcMar>${o}</w:tcMar>`:""}function eT(e,t=false){let n=Pt(e),r=Zr(n.get("mso-border-alt"))??Zr(n.get("border"))??lf(n,"border"),o="";for(let l of ["top","left","bottom","right"]){let c=Ir(l,t),d=Zr(n.get(`mso-border-${c}-alt`))??Zr(n.get(`mso-border-${c}`))??Zr(n.get(`border-${c}`))??lf(n,`border-${c}`)??r;d!==void 0&&(o+=YC(l,d));}let a=o.length>0?`<w:tcBorders>${o}</w:tcBorders>`:"",i=Ju(n);i&&(a+=`<w:shd w:val="clear" w:color="auto" w:fill="${i}"/>`),a+=Z4(n,t);let s=n.get("vertical-align")?.toLowerCase()??e.getAttribute("valign")?.toLowerCase();return s==="top"?a+='<w:vAlign w:val="top"/>':s==="middle"||s==="center"?a+='<w:vAlign w:val="center"/>':s==="bottom"&&(a+='<w:vAlign w:val="bottom"/>'),a}var X4=9360;function tT(e,t,n,r,o,a){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let R of Array.from(e.children))Qe(R)==="caption"&&a(Array.from(R.childNodes),t+1,n,r,o,true);let i=KC(e);if(i.length===0)return;let s=1,l=r.nodesLeft,c=[];for(let R of i){if(l<=0||s>=63)break;let C=c.map(w=>w?w.span:null);for(let w=0;w<c.length;w+=1){let O=c[w];O&&(O.remaining-=1,O.remaining<=0&&(c[w]=null));}let A=Array.from(R.children).filter(w=>/^t[dh]$/.test(Qe(w))),E=0,P=0;for(;P<63&&(l-=1,!(l<=0));){let w=P<C.length?C[P]:null;if(w!=null){P+=w;continue}let O=A[E];if(O===void 0)break;E+=1;let _=Math.min(Ja(O,"colspan",63),63-P);for(let K=P+1;K<P+_;K+=1)if(K<C.length&&C[K]!=null){_=K-P;break}let q=Ja(O,"rowspan",1e3);if(q>1){for(;c.length<=P;)c.push(null);c[P]={remaining:q-1,span:_};}P+=_;}for(let w=P;w<C.length&&w<63;w+=1){let O=C[w];O!=null&&(P=Math.max(P,w+O));}s=Math.max(s,P);}s=Math.min(Math.max(s,1),63);let d=UC(e,X4),u=d.twips,f=i.length>r.nodesLeft?i.slice(0,Math.max(1,r.nodesLeft)):i,p=GC(f,s,u),y=(Pt(e).get("direction")??e.getAttribute("dir"))?.trim().toLowerCase()==="rtl",h=QC(e,y),b=VC(e),v=jC(e)??(y?"left":void 0),S=v===void 0?"":`<w:jc w:val="${Ir(v,y)}"/>`,x=p.map(R=>`<w:gridCol w:w="${R}"/>`).join(""),k=new Array(s).fill(null),T=[];for(let R of i){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let C=k.map(_=>_?_.span:null);for(let _=0;_<s;_+=1){let q=k[_];q&&(q.remaining-=1,q.remaining<=0&&(k[_]=null));}let A=Array.from(R.children).filter(_=>/^t[dh]$/.test(Qe(_))),E=0,P=[],w=0,O=true;for(;w<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,O=false;break}let _=C[w];if(_!==null){let M=_>1?`<w:gridSpan w:val="${_}"/>`:"";P.push(`<w:tc><w:tcPr><w:tcW w:w="${_h(p,w,_)}" w:type="dxa"/>${M}<w:vMerge/></w:tcPr><w:p/></w:tc>`),w+=_;continue}let q=A[E];if(q===void 0){P.push(`<w:tc><w:tcPr><w:tcW w:w="${p[w]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),w+=1;continue}E+=1;let K=Math.min(Ja(q,"colspan",63),s-w);for(let M=w+1;M<w+K;M+=1)if(C[M]!==null){K=M-w;break}let U=Ja(q,"rowspan",1e3);U>1&&(k[w]={remaining:U-1,span:K}),P.push(Y4(q,K,_h(p,w,K),U>1,t,n,r,a,y)),w+=K;}if(!O)break;T.push(`<w:tr>${JC(R)}${P.join("")}</w:tr>`);}T.length!==0&&(o.push(`<w:tbl><w:tblPr>${y?"<w:bidiVisual/>":""}${b}${d.xml}${S}${h}</w:tblPr><w:tblGrid>${x}</w:tblGrid>${T.join("")}</w:tbl>`),r.lastMarkCovered=false);}function Y4(e,t,n,r,o,a,i,s,l){let c=Qe(e)==="th",d=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(d+=`<w:gridSpan w:val="${t}"/>`),r&&(d+='<w:vMerge w:val="restart"/>'),d+=eT(e,l);let u={run:c?{...a.run,bold:true}:a.run,para:c?{jc:"center"}:{},paragraphMarkCovered:false,pre:false,list:null,...a.noteBody?{noteBody:a.noteBody}:{},...a.rels?{rels:a.rels}:{}},f=[];return s(Array.from(e.childNodes),o+2,u,i,f,true),(f.length===0||f[f.length-1].endsWith("</w:tbl>"))&&f.push("<w:p/>"),`<w:tc><w:tcPr>${d}</w:tcPr>${f.join("")}</w:tc>`}function nT(e){if(e===void 0)return "";let t=e.trim();return /^\d{1,4}$/.test(t)?"<w:tab/>".repeat(Math.min(Number.parseInt(t,10),64)):""}function rT(e){let t=e.getAttribute("alignment")?.trim().toLowerCase(),n=e.getAttribute("relativeto")?.trim().toLowerCase(),r=e.getAttribute("leader")?.trim().toLowerCase();return t!=="left"&&t!=="center"&&t!=="right"||n!=="margin"&&n!=="indent"||r!=="none"&&r!=="dot"&&r!=="hyphen"&&r!=="underscore"&&r!=="middledot"?"":`<w:ptab w:alignment="${t}" w:relativeTo="${n}" w:leader="${r==="middledot"?"middleDot":r}"/>`}function oT(e){if(Qe(e)!=="br")return false;let t=Pt(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function aT(e){if(oT(e))return true;if(Qe(e)!=="span"||e.childNodes.length>8)return false;let t=false;for(let n=0;n<e.childNodes.length;n+=1){let r=e.childNodes[n];if(!(r.nodeType===3&&(r.nodeValue??"").trim().length===0)){if(r.nodeType!==1||t||!oT(r))return false;t=true;}}return t}function iT(e){if(Qe(e)!=="p")return false;let t=null;for(let o=0;o<e.childNodes.length;o+=1){let a=e.childNodes[o];if(a.nodeType===3){if((a.nodeValue??"").replace(/[\s\u00a0]/g,"").length===0)continue;return false}if(a.nodeType!==1||t!==null)return false;t=a;}if(t===null)return false;let n=Pt(e);for(let o of n.keys())if(o==="background"||o==="background-color"||o.startsWith("border"))return false;if(Qe(t)!=="o:p"||t.childNodes.length>3)return false;let r="";for(let o=0;o<t.childNodes.length;o+=1){let a=t.childNodes[o];if(a.nodeType!==3)return false;r+=a.nodeValue??"";}return r.includes("\xA0")&&r.replace(/[\s\u00a0]/g,"").length===0}function Bh(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var $h=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),Wh=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),qh=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),Q4=new Set([...Wh,...qh,"table","ol","ul","w:sdt"]);function Kh(e){for(let t=0;t<e.children.length;t+=1)if(Q4.has(Qe(e.children[t])))return true;return false}var J4=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function sT(e){if(Qe(e)!=="w:sdt")return null;let t=[e],n=0;for(let r=0;r<t.length&&n<64;r+=1){let o=t[r];for(let a=0;a<o.children.length&&n<64;a+=1){let i=o.children[a];n+=1;let s=Qe(i);if(J4.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(i);}}return null}var e3=4*1024*1024,t3=1e5,n3=64,r3=2*1024*1024,lT="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Uh(e,t,n,r,o=e.rels){let a=`rId${o.length+1}`;return o.push({id:a,type:t,target:n,external:r}),a}var o3=/<w:br\/><\/w:r>(?:<\/w:(?:ins|del)>)*$/;function Ql(e,t,n,r,o){if(o.nodesLeft<=0){o.truncated=true;return}if(t>o.maxDepth)return;if(o.nodesLeft-=1,e.nodeType===3){let v=e.nodeValue??"";if(n.pre){let x=v.replace(/\r\n?/g,`
4
+ `).split(`
5
+ `);for(let k=0;k<x.length;k+=1){if(k>0){if(o.nodesLeft-=1,o.nodesLeft<=0){o.truncated=true;return}r.push(`<w:r>${Tn(n.run)}<w:br/></w:r>`);}let T=x[k];T.length>0&&r.push(nf(T,n.run));}return}let S=v.replace(/[ \t\r\n\f\v]+/g," ");if(S.startsWith(" ")&&o3.test(r[r.length-1]??"")&&(S=S.slice(1)),S.length===0||S===" "&&Ih(r))return;r.push(nf(S,n.run));return}if(e.nodeType===8&&o.wordHtml)for(let v of fC(e.nodeValue??"",o))r.push(v);if(!ss(e))return;let a=o.equations.get(e);if(a!==void 0){for(let v of a)r.push(v);return}let i=Qe(e);if($h.has(i))return;let s=Pt(e);if(ef(e)&&n.para.numPr!==void 0||s.get("mso-element")?.trim().toLowerCase()==="comment-reference"||s.get("mso-special-character")?.trim().toLowerCase()==="comment"||e.classList.contains("msocomanchor")||o.definedNoteElements.has(e))return;if(i==="w:ptab"){let v=rT(e);v.length>0&&r.push(`<w:r>${Tn(n.run)}${v}</w:r>`);return}let c=nT(s.get("mso-tab-count"));if(c.length>0){if(o.nodesLeft-=c.split("<w:tab/>").length-2,o.nodesLeft<=0){o.truncated=true;return}let v=za(Gl(n.run,i),s);if(r.push(`<w:r>${Tn(v)}${c}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(i==="br"){let v=s.get("page-break-before")?.trim().toLowerCase()==="always"||s.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${Tn(n.run)}${v?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(i==="img"){KP(e,r,o,v=>Uh(o,`${lT}/image`,v,false,n.rels??o.rels));return}let d=yP(e,i,o.wordHtml),f=d?.kind==="ins"&&n.revisions?.some(v=>v.kind==="del")?null:d,p=d===null?Gl(n.run,i):n.run,g=i==="a"?e.getAttribute("href"):null,y=i==="a"?Th(s):null;y===null&&rC(g)&&(p={...p,rStyle:"Hyperlink"});let h=Za(p,e),b=BC({...n,run:h,pre:n.pre||i==="pre"},e,s,f);if(f!==null){let v=[];for(let S of Array.from(e.childNodes))Ql(S,t+1,b,v,o);for(let S of vP(f,v))r.push(S);return}if(y!==null){let v={...b.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===y.kind&&n.noteBody.id===y.id){let S=y.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${Tn(v)}<w:${S}/></w:r>`);return}if(o.definedNotes[y.kind].has(y.id)){let S=y.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${Tn(v)}<w:${S} w:id="${y.id}"/></w:r>`);let x=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),k=`${y.kind}:${y.id}`;if(x.length>0&&!o.noteMarkFallbacks.has(k)&&o.noteMarkFallbacks.set(k,nf(x,v)),n.noteBody===void 0)o.bodyNoteRefs[y.kind].add(y.id);else {let T=`${n.noteBody.kind}:${n.noteBody.id}`,R=o.noteNoteRefs.get(T)??[];R.push({kind:y.kind,id:y.id}),o.noteNoteRefs.set(T,R);}return}for(let S of Array.from(e.childNodes))Ql(S,t+1,b,r,o);return}if(i==="a"){let v=e.getAttribute("href"),S=kr(e.getAttribute("name")||e.getAttribute("id")),x=[];for(let C of Array.from(e.childNodes))Ql(C,t+1,b,x,o);let k=v?.startsWith("#")?kr(v.slice(1)):null,T=x.join(""),R=()=>b.revisions===void 0?T:xP(b.revisions,T);if(k!==null)T=`<w:hyperlink w:anchor="${W(k)}">${R()}</w:hyperlink>`;else if(v!==null&&!v.startsWith("#")){let C=U(v);C.ok&&C.href.length>0&&(T=`<w:hyperlink r:id="${Uh(o,`${lT}/hyperlink`,C.href,true,n.rels??o.rels)}">${R()}</w:hyperlink>`);}if(S!==null){let C=String(o.nextBookmarkId++);T=`<w:bookmarkStart w:id="${C}" w:name="${W(S)}"/>${T}<w:bookmarkEnd w:id="${C}"/>`;}T.length>0&&r.push(T);return}i==="o:p"&&n.revisions!==void 0&&(o.markRevision=SP(n.revisions));for(let v of Array.from(e.childNodes))Ql(v,t+1,b,r,o);}function cT(e,t,n,r){let o=Qe(e),a=Pt(e),i={};r&&(i.pageBreakBefore=true);let s=HP(e,n.wordHtml);s!==void 0&&(i.styleId=s),t.para.numPr&&(i.numPr=t.para.numPr),t.para.jc&&(i.jc=t.para.jc),t.para.bidi&&(i.bidi=true);let l={...t.run},c=jP[o];c!==void 0&&s===void 0&&!e.classList.contains("docx-outline")&&(l.bold=true,l.szHalfPoints=c);let d=t.pre||o==="pre";o==="pre"&&(l.font="Courier New");let u=vC(e,a,n,t.noteBody);return u&&(i.numPr=u),WP(i,e,n.classAlignments),tf(i,a),$C(i,e,a),l=Za(l,e),e.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(i.bidi=true),{run:l,para:i,paragraphMarkCovered:i.styleId!==void 0||i.numPr!==void 0,pre:d,list:t.list,...t.noteBody?{noteBody:t.noteBody}:{},...t.rels?{rels:t.rels}:{}}}function dT(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.markRevision=null;let i=cT(e,n,r,a);na(Array.from(e.childNodes),t+1,i,r,o,true,void 0,false);}function uT(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;let i=of(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:Oh(r,`sem:${r.semanticListCount}`,{kind:i,start:zl(e)}),level:0};if(n.list){let d=r.listsByNumId.get(s.numId);d!==void 0&&!d.levels.has(s.level)&&d.levels.set(s.level,{kind:i,start:zl(e)});}let l={...n,list:s,para:{numPr:{numId:s.numId,ilvl:s.level}}},c=a;for(let d of Array.from(e.childNodes)){if(r.nodesLeft<=0){r.truncated=true;break}if(!ss(d))continue;let u=Qe(d);if(u==="li")r.nodesLeft-=1,dT(d,t+1,l,r,o,c),c=false;else if(u==="ol"||u==="ul"){let f=o.length;uT(d,t+1,{...n,list:s},r,o,c),o.length>f&&(c=false);}}}function na(e,t,n,r,o,a=false,i,s=true){if(t>r.maxDepth)return;let l=o.length,c=i===void 0,d=[],u=[],f=n.para,p=i??{pending:false,skipSpacer:false},g=()=>({...f,pageBreakBefore:void 0,numPr:void 0}),y=()=>{if(d.length===0)return;if(!d.some(b=>b.includes("<w:r")||Hh(b))){if(o.length===l){u=u.concat(d),d=[];return}let b=o[o.length-1];b?.endsWith("</w:p>")?(o[o.length-1]=`${b.slice(0,-6)}${d.join("")}</w:p>`,d=[]):b!==void 0&&d.length>0&&(o.push(Xa(g(),d)),d=[],r.lastMarkCovered=false);return}let h=p.pending?{...f,pageBreakBefore:true}:f;o.push(Xa(sf(h,r),d)),f.pageBreakBefore&&(f={...f,pageBreakBefore:void 0}),p.pending=false,p.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered||r.markRevisionTaken,d=[];};for(let h of e){if(r.nodesLeft<=0){r.truncated=true;break}if(ss(h)){let b=Qe(h),v=b==="w:sdt"?sT(h):null;if(s&&aT(h)){y(),r.nodesLeft-=1,p.pending&&rf(o),p.pending=true,p.skipSpacer=true;continue}if($h.has(b)&&!r.equations.has(h)){r.nodesLeft-=1;continue}let S=Pt(h);if(S.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(yC(S)){y(),r.nodesLeft-=1,na(Array.from(h.childNodes),t+1,n,r,o,false,p,s);continue}if(r.definedNoteElements.has(h)){r.nodesLeft-=1;continue}if(Wh.has(b)){if(y(),r.nodesLeft-=1,p.pending&&p.skipSpacer&&iT(h)){p.skipSpacer=false;continue}if(b==="div"&&Kh(h)){let k=cT(h,n,r,false);k.para.pageBreakBefore&&(p.pending=true),na(Array.from(h.childNodes),t+1,k,r,o,false,p,s);continue}let x=o.length;dT(h,t,n,r,o,p.pending),o.length>x&&(p.pending=false,p.skipSpacer=false);continue}if(b==="ol"||b==="ul"){y();let x=o.length;uT(h,t,n,r,o,p.pending),o.length>x&&(p.pending=false,p.skipSpacer=false);continue}if(b==="table"){y(),p.pending&&rf(o),a3(h,t,n,r,o),p.pending=false,p.skipSpacer=false;continue}if(qh.has(b)||v!==null||b==="span"&&Kh(h)){y(),r.nodesLeft-=1,na(v??Array.from(h.childNodes),t+1,n,r,o,false,p,s);continue}}if(h.nodeType===3&&/^[\s\u00a0]+$/.test(h.nodeValue??"")&&Ih(d)){r.nodesLeft-=1;continue}Ql(h,t,n,d,r);}if(a&&o.length===l&&d.length>0&&!d.some(h=>h.includes("<w:r")||Hh(h))&&(o.push(Xa(sf(f,r),d)),d=[],r.lastMarkCovered=n.paragraphMarkCovered||r.markRevisionTaken),y(),u.length>0){let h=o[l];h!==void 0&&h.startsWith("<w:p>")?o[l]=h.replace(/^(<w:p>(?:<w:pPr>(?:(?!<\/w:pPr>)[\s\S])*?<\/w:pPr>)?)/,`$1${u.join("")}`):h!==void 0?o.splice(l,0,Xa(g(),u)):d=u.concat(d),u=[];}d.length>0&&(o.push(Xa(g(),d)),d=[],r.lastMarkCovered=false),c&&p.pending&&(rf(o),p.pending=false,p.skipSpacer=false,r.lastMarkCovered=false),a&&o.length===l&&(o.push(Xa(sf(f,r),d)),d=[],r.lastMarkCovered=n.paragraphMarkCovered||r.markRevisionTaken);}function a3(e,t,n,r,o){tT(e,t,n,r,o,na);}function i3(e,t){return SC({blocks:Ch(t),rels:e.rels,lists:[...e.lists.values()],notes:pC(e.notes),noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function s3(e,t){let n=t.maxHtmlBytes??e3;if(e.length>n)return {ok:false,reason:"too-large"};if(e.length*3>n&&new TextEncoder().encode(e).byteLength>n)return {ok:false,reason:"too-large"};if(typeof DOMParser>"u")return {ok:false,reason:"parse-unavailable"};let r;try{r=new DOMParser().parseFromString(e,"text/html");}catch{return {ok:false,reason:"parse-unavailable"}}let o=r.body;if(!o)return {ok:false,reason:"no-content"};let a=t.maxNodes??t3,i=AC(e)?HC(r,a):null,s=gC(r),l={footnote:new Set,endnote:new Set},c=new Set,d={footnote:new Set,endnote:new Set};hC(r,s,d);let u={nodesLeft:a-(i?.visited??0),maxDepth:t.maxDepth??n3,maxImageBytes:t.maxImageBytes??r3,wordHtml:NP(e),truncated:false,lastMarkCovered:false,markRevision:null,markRevisionTaken:false,rels:[],media:new Map,mediaExtensions:new Map,mediaBySrc:new Map,lists:new Map,listsByNumId:new Map,semanticListCount:0,imageCount:0,docPrId:0,nextBookmarkId:1,classAlignments:BP(r),listDefinitions:QP($P(r)),notes:{footnote:new Map,endnote:new Map},noteRels:{footnote:[],endnote:[]},definedNotes:l,bodyNoteRefs:{footnote:new Set,endnote:new Set},noteNoteRefs:new Map,noteMarkFallbacks:new Map,definedNoteElements:c,equations:i?.byElement??new Map},f={};f=Za(f,r.documentElement),f=Za(f,o);let p={run:f,para:f.rtl?{bidi:true}:{},paragraphMarkCovered:false,pre:false,list:null},g=[];for(let S of s)d[S.kind].has(S.id)&&(l[S.kind].has(S.id)||(l[S.kind].add(S.id),c.add(S.element),g.push(S)));g.sort((S,x)=>Bh(x.element)-Bh(S.element)),u.lastMarkCovered=false;let y=[];na(Array.from(o.childNodes),0,p,u,y);let h=u.lastMarkCovered,b=u.truncated,v=false;for(let S=0;S<g.length;S+=1){let x=g[S];u.truncated=false;let k=u.nodesLeft,T=[];if(na(Array.from(x.element.childNodes),0,{...p,noteBody:{kind:x.kind,id:x.id},rels:u.noteRels[x.kind]},u,T,true),u.truncated||T.length===0){v=true;let R=new Set;for(let C=S;C<g.length;C+=1){let A=g[C];l[A.kind].delete(A.id),c.delete(A.element),u.notes[A.kind].delete(A.id),u.bodyNoteRefs[A.kind].delete(A.id),R.add(`${A.kind}:${A.id}`);}if(R.size>0){for(let C=0;C<y.length;C+=1)y[C]=ls(y[C],R,u.noteMarkFallbacks);for(let C of ["footnote","endnote"])for(let[A,E]of u.notes[C])u.notes[C].set(A,E.map(P=>ls(P,R,u.noteMarkFallbacks)));}u.nodesLeft=k;for(let C=S;C<g.length&&u.nodesLeft>0;C+=1)na(Array.from(g[C].element.childNodes),0,p,u,y);break}u.notes[x.kind].set(x.id,T);}return u.truncated=b||v,u.lastMarkCovered=h,bC(u,l,y,Uh),y.length===0?{ok:false,reason:"no-content"}:(WC(y,u.notes),{ok:true,projection:u,blocks:y})}var l3=aC();function fT(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return l3(e,n,()=>s3(e,t))}function pT(e,t={}){let n=fT(e,t);return n.ok?{ok:true,fragmentBytes:i3(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function mT(e,t={}){let n=fT(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var c3={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function gT(e){return e.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(t,n)=>{if(n.startsWith("#")){let r=n.startsWith("#x")?Number.parseInt(n.slice(2),16):Number.parseInt(n.slice(1),10);return !Number.isFinite(r)||r<0||r>1114111||r>=55296&&r<=57343?t:String.fromCodePoint(r)}return c3[n.toLowerCase()]??t})}var d3=new Set(["script","style","title","template"]),u3=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),f3=new Set(["td","th"]),hT=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),p3=e=>hT(e)||e!==void 0&&e>="0"&&e<="9",yT=e=>e===" "||e===" "||e===`
6
+ `||e==="\r"||e==="\f";function m3(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!hT(e[n]))return null;let o=n;for(;n<e.length&&p3(e[n]);)n+=1;let a=e.slice(o,n).toLowerCase(),i="",s=false;for(;n<e.length;){let l=e[n];if(i!=="")l===i&&(i="");else if(l==="=")s=true;else if(s&&(l==='"'||l==="'"))i=l,s=false;else {if(l===">")return {name:a,closing:r,end:n+1};yT(l)||(s=false);}n+=1;}return {name:a,closing:r,end:e.length}}function g3(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===9;)t-=1;return t===e.length?e:e.slice(0,t)}function h3(e,t,n){for(let r=n;r<e.length;){let o=e.indexOf("</",r);if(o===-1)return e.length;let a=o+2;if(e.slice(a,a+t.length).toLowerCase()===t){for(a+=t.length;a<e.length&&yT(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function*bT(e){let t=0;for(;t<e.length;){let n=e.indexOf("<",t);if(n===-1){yield e.slice(t);break}if(n>t&&(yield e.slice(t,n)),e.startsWith("<!--",n)){if(e[n+4]===">"){t=n+5;continue}if(e[n+4]==="-"&&e[n+5]===">"){t=n+6;continue}let o=e.indexOf("-->",n+4);t=o===-1?e.length:o+3;continue}if(e[n+1]==="!"||e[n+1]==="?"){let o=e.indexOf(">",n+1);t=o===-1?e.length:o+1;continue}let r=m3(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&d3.has(r.name)?t=h3(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
7
+ `:r.closing&&f3.has(r.name)?yield " ":r.closing&&u3.has(r.name)&&(yield `
8
+ `);}}function y3(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of bT(t))n+=r;return gT(n).replace(/\r\n?/g,`
9
+ `).split(`
10
+ `).map(g3).join(`
11
+ `).replace(/\n{3,}/g,`
12
+
13
+ `).trim()}function cf(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r===12){t+=`
14
+ `;continue}if(r===13){t+=`
15
+ `,e.charCodeAt(n+1)===10&&(n+=1);continue}if(r===9||r===10){t+=e[n];continue}if(!(r<32||r===65534||r===65535)){if(r>=55296&&r<=56319){let o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(t+=e[n]+e[n+1],n+=1);continue}r>=56320&&r<=57343||(t+=e[n]);}}return t}var vT=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function xT(e){return vT.test(e)}function jh(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of bT(t)){let r=n.includes("&")?gT(n):n;if(vT.test(r))return true}return false}function Vh(e){if(!e)return "";let t=e.getData("text/plain");if(t.length>0)return t;let n=e.getData("text/html");return n.length>0?y3(n):""}function Gh(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function b3(e){if(!e)return false;if(xT(Gh(e,"text/plain")))return true;let t=Gh(e,"text/html");if(t.length===0)return false;if(jh(t))return true;let n=Yo(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:mT(t).imageCount>0}function v3(e){return e?jh(Gh(e,"text/html")):false}var x3="popup,width=1000,height=900",ST=["class","style","data-theme","data-color-mode","dir","lang"];async function S3(e={}){let t=globalThis.window;if(!t?.open)return null;let n=e.url??"about:blank",r=t.open(n,e.name??"docx-editor",e.features??x3);if(!r)return null;n!=="about:blank"&&await w3(r);let o=r.document;e.title&&(o.title=e.title),o.body.style.margin="0";let a=o.createElement("div");a.style.height="100vh",o.body.append(a);let i=e.styles??true,s=i===false?()=>{}:i===true?kT(t.document,o):i(t.document,o),l=new Set,c=false,d=()=>{if(!c){c=true,r.removeEventListener("pagehide",d),t.removeEventListener("pagehide",u),s();for(let f of [...l])try{f();}catch(p){console.error(p);}l.clear();}},u=()=>{d(),r.close();};return r.addEventListener("pagehide",d),t.addEventListener("pagehide",u),{window:r,element:a,onClose(f){return l.add(f),()=>l.delete(f)},close:u}}function w3(e){return new Promise(t=>{let n=false,r=()=>{n||(n=true,t());};e.addEventListener("load",r,{once:true});try{e.document.readyState==="complete"&&e.location.href!=="about:blank"&&r();}catch{}})}function kT(e,t){let n=new Map,r=y=>{if(n.has(y))return;let h=t.importNode(y,true),b=y.sheet;y.localName==="style"&&b&&!(y.textContent??"").trim()&&(h.textContent=zh(b)),t.head.append(h),n.set(y,h);},o=y=>y.nodeType===1&&(y.localName==="style"||y.localName==="link"&&(y.getAttribute("rel")??"").split(/\s+/).includes("stylesheet"));for(let y of Array.from(e.querySelectorAll('link[rel~="stylesheet"], style')))r(y);let a=t.createElement("style");a.dataset.docxAdopted="",t.head.append(a);let i="",s=()=>{let y=e.adoptedStyleSheets??[],h=y.map(b=>wT(b)).join(",");h!==i&&(i=h,a.textContent=y.map(zh).join(`
16
+ `));};s();let l=()=>{for(let y of ST){let h=e.documentElement.getAttribute(y);h===null?t.documentElement.removeAttribute(y):t.documentElement.setAttribute(y,h);}};l();let c=new Map,d=()=>{for(let[y,h]of n){let b=y.sheet;if(y.localName!=="style"||!b)continue;let v=wT(b);if(c.get(y)===v)continue;let S=!c.has(y);c.set(y,v),S||(h.textContent=zh(b));}s();};d();let u=t.defaultView?.setInterval(d,k3),f=()=>{u!==void 0&&t.defaultView?.clearInterval(u);},p=e.defaultView?.MutationObserver;if(typeof p!="function")return f;let g=new p(y=>{for(let h of y){if(h.type==="attributes"){l();continue}for(let v of Array.from(h.addedNodes))if(o(v))r(v);else if(v.nodeType===1)for(let S of Array.from(v.querySelectorAll("style, link")))o(S)&&r(S);for(let v of Array.from(h.removedNodes)){let S=n.get(v);S&&(n.delete(v),S.parentNode?.removeChild(S));}let b=h.target;if(h.type==="characterData"||b.localName==="style"&&n.has(b)){let v=h.type==="characterData"?h.target.parentNode:b,S=v&&n.get(v);S&&(S.textContent=v.textContent);}}});return g.observe(e.head,{childList:true,subtree:true,characterData:true}),g.observe(e.documentElement,{attributes:true,attributeFilter:ST}),()=>{g.disconnect(),f();}}var k3=250;function wT(e){try{return e.cssRules.length}catch{return -1}}function zh(e){try{return Array.from(e.cssRules,t=>t.cssText).join(`
17
+ `)}catch{return ""}}function I3(e,t,n,r){let o=e.top-n-r;return t!==void 0&&o<t?e.bottom+r:o}var IT=new WeakMap;function Jl(e){let t=IT.get(e);if(t)return t;let n=[],r=e.contentBox;for(let a of [e.header,e.footer]){if(!a)continue;let i=(s,l)=>{!s.textboxStory||s.accessibility.hidden||n.push(Object.freeze({drawing:s,kind:a.kind,...a.rId!==void 0?{rId:a.rId}:{},origin:Object.freeze({x:l.x-r.x,y:l.y-r.y})}));};for(let s of a.anchoredDrawings??[])i(s,Ia(s,a.box,e.box));for(let s of Ka$2(a.fragments,true))for(let l of s.lines)for(let c of l.drawings??[])i(c,{x:a.box.x+c.x,y:a.box.y+c.y});}let o=Object.freeze(n);return IT.set(e,o),o}function R3(e,t){let n=fb$1(e,t),r=n&&fb$1(e,n.id);if(!r)return false;let o=Ud$1(r.children,{namespaceUri:ma$2,localName:"spPr"}),a=o&&Ud$1(o.children,{namespaceUri:va,localName:"xfrm"}),i=Ud$1(r.children,{namespaceUri:ma$2,localName:"bodyPr"}),s=a&&oa$2(a.attributes,"rot"),l=i&&oa$2(i.attributes,"rot"),c=i&&oa$2(i.attributes,"vert");return !!s&&Number(s)!==0||!!l&&Number(l)!==0||!!c&&c!=="horz"}function df(e,t,n){let r=n.textboxStory;return !!r&&!R3(e,t)&&n.transform.rotationDegrees===0&&r.contentRotation===void 0&&r.fragments.length>0&&r.fragments.every(o=>o.kind==="paragraph")}function RT(e,t,n){if(!t.owner)return Te(e,t.drawingNodeId);let r=e.pages[n],o=r?.index===n?[r,...e.pages]:e.pages;for(let a of o){let i=Jl(a).find(d=>d.drawing.drawingNodeId===t.drawingNodeId);if(!i)continue;let{drawing:s,origin:l}=i,c=s.paintBounds;return c.width<=0||c.height<=0?null:Object.freeze({pageIndex:a.index,x:l.x+c.x-s.x,y:l.y+c.y-s.y,width:c.width,height:c.height,record:s})}return null}function PT(e,t){if(!e.textboxStory)return {};let n=fk(t).find(r=>r.drawingNodeId===e.drawingNodeId);return {textEditable:!!n&&df(t,n.root.id,e)}}function P3(e,t){return !e.textbox||t==="view"?null:e.textEditable===false?"imageOverlay.textLocked":!e.canMove&&!e.canResize?"imageOverlay.locked":null}var C3=Object.freeze({kind:"body"});function ce(e,t){if(t===void 0)return null;let n=t.indexOf("#");return n===-1?e.storyParts?.().find(r=>eb$1(r,t)!==null)??null:n===0?null:e.currentPackage().parts.get(t.slice(0,n))??null}function uf(e,t,n){let r=t.indexOf("#"),o=n.indexOf("#");if(r>0&&o>0)return r===o&&t.startsWith(n.slice(0,o+1));let a=ce(e,t);return a!==null&&a.name===ce(e,n)?.name}function Ot(e,t,n){let r=t?.indexOf("#")??-1,o=r===-1?ce(e,t)?.name??"":t.slice(0,r);return Zh(e,o,n)}function Zh(e,t,n){if(t.length===0||t===e.part().name)return {kind:"body"};for(let r of e.headerFooterResolutionBySection())for(let o of [r.headers,r.footers])for(let a of o.values())if(a.partName===t)return {kind:"headerFooter",rId:a.rId};for(let r of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:r})?.name===t)return {kind:"notesPart",noteKind:r};return n}function ff(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=Ic$1(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function TT(e,t){return e?e.scope:t||C3}function T3(e,t,n){if(n){let o=[];for(let a of [e.footnotes,e.endnotes])if(a)for(let i of a.notes)i.scopeId===n&&o.push(...CT(i.fragments));return o}if(!t)return Ja$2(e);let r=cs(e,t);return r?CT(r.fragments):[]}function cs(e,t){let n=t.kind==="header"?e.header:e.footer;if(n&&(n.rId&&n.rId===t.scope.rId||!n.rId&&n.partName===t.partName))return n}function ET(e,t){for(let n of e.pages)for(let r of ["header","footer"]){let o=n[r];if(o?.rId===t)return {pageIndex:n.index,kind:r,story:o}}return null}function pf(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function mf(e,t,n){let r=Je(e,t.y),o=e.pages[r];if(!o)return false;let a=t.x-n(r),i=t.y,s=o.contentBox;return a>=s.x&&a<s.x+s.width&&i>=s.y&&i<s.y+s.height}function Xh(e,t,n,r,o={}){return Ne$1(e,t,n.fragments,r,o)}function E3(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=cs(r,t);return o?cf$1(e,t.pageIndex,o.fragments,n):null}function O3(e,t,n){let r=[];for(let o of e.pages)for(let a of [o.footnotes,o.endnotes]){let i=a?.notes.find(s=>s.scopeId===t);i&&r.push(...cf$1(e,o.index,i.fragments,n));}return r.length>0?r:null}function OT(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function MT(e,t,n){let r=e.querySelectorAll("[data-docx-note-scope]"),o=null;for(let a of r){if(a.dataset.docxNoteScope!==t||!a.matches("[data-docx-note]"))continue;o??=a;let i=Number(a.closest("[data-page-index]")?.dataset.pageIndex);if(n!==null&&i===n)return a}return o}function AT(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!cs(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(cs(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function LT(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function FT(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Yh(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function Qh(e,t,n,r,o,a,i,s){let l=o?E3(e,o,i):a?O3(e,a,i):null,c=hf$1(e,t,n,r,{...i?{measurer:i}:{},...l?{stops:l}:{},...s!==void 0?{lineId:s}:{}});if(!c)return null;let u=(l?.find(p=>p.position.paragraphId===c.position.paragraphId&&p.position.offset===c.position.offset&&(c.lineId===void 0||p.lineId===c.lineId))??l?.find(p=>p.position.paragraphId===c.position.paragraphId&&p.position.offset===c.position.offset))?.pageIndex,f=c.lineId===void 0?null:df$1(e,c.position,{...i?{measurer:i}:{},...u!==void 0?{preferredPageIndex:u}:{},preferredLineId:c.lineId});return {position:c.position,desiredX:c.desiredX,...u!==void 0?{pageIndex:u}:{},...f?{caret:f}:{}}}function gf(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of [r.footnotes,r.endnotes])if(a)for(let i of a.notes){let s=i.box,l=s.x+o,c=s.y;if(t.x>=l&&t.x<l+s.width&&t.y>=c&&t.y<c+s.height)return {pageIndex:r.index,scopeId:i.scopeId,noteKind:i.noteKind,noteId:i.noteId,local:{x:t.x-l,y:t.y-c},fragments:i.fragments}}}return null}function DT(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let c=o.y,d=r.y,u=n?Math.max(d,n.box.y+n.box.height):d,f=n?Math.min(c,n.box.y):c;return u<=f?null:{x:r.x,y:f,width:r.width,height:u-f}}let a=r.y+r.height,i=o.y+o.height,s=n?Math.min(a,n.box.y):a,l=n?Math.max(i,n.box.y+n.box.height):i;return l<=s?null:{x:r.x,y:s,width:r.width,height:l-s}}function Jh(e,t,n){for(let r of e.pages){if(r.parityBlank)continue;let o=n(r.index);for(let a of ["header","footer"]){if(r[a])continue;let i=DT(r,a);if(!i)continue;let s=i.x+o;if(t.x>=s&&t.x<s+i.width&&t.y>=i.y&&t.y<i.y+i.height)return {pageIndex:r.index,kind:a}}}return null}function ey(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){let i=r[a];if(!i)continue;let s=i.box,l=DT(r,a)??s,c=l.x+o,d=l.y;if(t.x>=c&&t.x<c+l.width&&t.y>=d&&t.y<d+l.height)return {pageIndex:r.index,kind:a,story:i,local:{x:t.x-(s.x+o),y:t.y-s.y}}}}return null}function NT(e,t,n,r,o,a){let i=e.pages[t.pageIndex];if(!i)return false;let s=i.contentBox,l=n.x-r(i.index)-s.x,c=n.y-s.y;if(l<0||l>=s.width||c<0||c>=s.height)return false;let d=a?{measurer:a}:{},{story:u,local:f}=t,p=Le(u.anchoredDrawings,f,i.index)!==null||Ne$1(e,i.index,u.fragments,f,d)?.onGlyphs===true;if(o&&p)return false;let g=Me(e,i.index,{x:l,y:c},d),y=gf(e,n,r),h=g?.onGlyphs===true&&g.pageIndex===i.index||y?.pageIndex===i.index&&Ne$1(e,i.index,y.fragments,y.local,d)?.onGlyphs===true;return o?h:h||!p}function ds(e,t,n){if(!t&&!n)return db$1(e);let r=new Set,o=[];for(let a of e.pages)for(let i of T3(a,t,n)){for(let s of i.lines)for(let l of Za$1(s))r.has(l.paragraphId)||(r.add(l.paragraphId),o.push(l.paragraphId));i.lines.length===0&&!r.has(i.paragraphId)&&(r.add(i.paragraphId),o.push(i.paragraphId));}return o}function hf(e,t,n,r){let o=ds(e,n,r);if(o.length===0)return t;let a=new Set(o),i=s=>a.has(s.paragraphId)?s:{paragraphId:o[0],offset:0};return {anchor:i(t.anchor),head:i(t.head)}}function CT(e){let t=[],n=r=>{for(let o of r){if(o.kind==="paragraph"){t.push(o);continue}for(let a of o.rows)if(!a.isHeaderRepeat)for(let i of a.cells)n(i.blocks);}};return n(e),t}function HT(e,t){for(let n of e.pages)for(let r of [n.footnotes,n.endnotes])if(r){for(let o of r.notes)for(let a of Ka$2(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function _T(e){return e.family.trim().length===0?"font family must not be empty":!Number.isInteger(e.weight)||e.weight<1||e.weight>1e3?"font weight must be an integer from 1 through 1000":e.style!=="normal"&&e.style!=="italic"?"font style must be normal or italic":null}function M3(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function A3(e,t){if(!e)return null;try{let n=await e.match(t);return n?new Uint8Array(await n.arrayBuffer()):null}catch{return null}}async function L3(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function F3(e,t){if(e)try{await e.delete(t);}catch{}}async function ty(e){let t=()=>{if(e.signal?.aborted)throw e.signal.reason};t();let n=e.fetcher??fetch,r=e.maxFontBytes??a$1,o=await M3(e.cacheName??"docx-editor-fonts");t();async function a(c){t();let d=Object.freeze({family:c.family,weight:c.weight,style:c.style}),u=_T(d);if(u)return {failure:{url:c.url,request:d,reason:"invalidRequest",diagnostic:u}};let f$1=(b,v)=>{if(b.byteLength===0)return {url:c.url,request:d,reason:"emptyResponse"};if(b.byteLength>r)return {url:c.url,request:d,reason:"overLimit"};let S=l(b,c.faceIndex??0);if(!S.valid)return {url:c.url,request:d,reason:"malformed",diagnostic:S.diagnostic};let x=f(b);return c.hash!==void 0&&c.hash!==x?{url:c.url,request:d,reason:"hashMismatch",expectedHash:c.hash,actualHash:x,...v?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:d,id:`url:${c.url}`,bytes:b,hash:x,faceIndex:c.faceIndex??0}},p=await A3(o,c.url);if(t(),p){let b=f$1(p,true);if(!("reason"in b))return {source:b};await F3(o,c.url),t();}let g;try{g=e.signal?await n(c.url,{signal:e.signal}):await n(c.url),t();}catch(b){return t(),{failure:{url:c.url,request:d,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}if(!g.ok)return {failure:{url:c.url,request:d,reason:"httpError",status:g.status}};let y;try{y=new Uint8Array(await g.arrayBuffer()),t();}catch(b){return t(),{failure:{url:c.url,request:d,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}let h=f$1(y,false);return "reason"in h?{failure:h}:(await L3(o,c.url,y),t(),{source:h})}let i=await Promise.all(e.sources.map(c=>a(c)));t();let s=[],l$1=[];for(let c of i)"source"in c?s.push(c.source):l$1.push(c.failure);return {sources:s,failures:l$1}}function D3(e,t,n={}){let r=Object.freeze({family:t.family,weight:t.weight,style:t.style}),o=n.id??`bytes:${r.family}#${r.weight}#${r.style}`,a=_T(r);if(a)return {failure:{url:o,request:r,reason:"invalidRequest",diagnostic:a}};if(e.byteLength===0)return {failure:{url:o,request:r,reason:"emptyResponse"}};if(e.byteLength>(n.maxFontBytes??a$1))return {failure:{url:o,request:r,reason:"overLimit"}};let i=t.faceIndex??0,s=l(e,i);return s.valid?{source:{request:r,id:o,bytes:e,hash:f(e),faceIndex:i}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:s.diagnostic}}}var N3=e=>e.trim().toLowerCase(),BT=e=>JSON.stringify([N3(e.family),e.weight,e.style]);function H3(e){return o(async t=>{if(t.signal?.aborted)throw t.signal.reason;let n=new Set((t.resolvedFaces??[]).map(BT)),r=e.sources.filter(s=>!n.has(BT(s)));if(r.length===0)return {sources:[],failures:[]};let{onFailure:o,...a}=e,i=await ty({...a,sources:r,signal:t.signal});if(t.signal?.aborted)throw t.signal.reason;for(let s of i.failures)o?o(s):console.warn(`[fonts] ${s.request.family} (${s.url}): ${s.reason}`);return i})}var _3=96,$T=37.79527559055118;function B3(e,t){if(!Number.isFinite(e)||e<=0)return [];let n=[];if(t==="inch"){let i=Math.floor(e/12);for(let s=0;s<=i;s+=1){let l=s*12;if(s%8===0){let c=s/8;n.push({position:l,height:10,...c>0?{label:String(c)}:{}});}else s%4===0?n.push({position:l,height:6}):s%2===0?n.push({position:l,height:4}):n.push({position:l,height:2});}return n}let r=$T/10,o=Math.floor(e/r);for(let a=0;a<=o;a+=1){let i=a*r;if(a%10===0){let s=a/10;n.push({position:i,height:10,...s>0?{label:String(s)}:{}});}else a%5===0?n.push({position:i,height:6}):n.push({position:i,height:3});}return n}function $3(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var W3=1440,q3=567,K3=180,U3=56.7,WT=e=>({pageWidth:e.pageWidth,leftMargin:e.rightMargin,rightMargin:e.leftMargin}),yf=(e,t,n)=>n<t||e<t?t:e>n?n:e;function qT(e,t,n){if(t.rtl)return n.pageWidth-qT(e,{...t,rtl:false},WT(n));switch(e){case "firstLine":return n.leftMargin+t.left+t.firstLine;case "hanging":case "left":return n.leftMargin+t.left;case "right":return n.pageWidth-n.rightMargin-t.right}}function KT(e,t,n){if(n)return Math.round(e);let r=t==="cm"?56.7:180;return Math.round(Math.round(e/r)*r)}function UT(e,t,n,r,o={}){if(n.rtl)return {...UT(e,r.pageWidth-t,{...n,rtl:false},WT(r),o),rtl:true};let a=KT(t,o.unit??"inch",o.precise??false),i=r.pageWidth-r.rightMargin-n.right,s=r.leftMargin+n.left+Math.max(0,n.firstLine);switch(e){case "firstLine":{let l=yf(a,0,i);return {...n,firstLine:l-r.leftMargin-n.left}}case "left":{let l=-r.leftMargin-Math.min(0,n.firstLine),c=i-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:yf(a-r.leftMargin,l,c)}}case "hanging":{let l=yf(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=yf(a,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}function j3(e,t,n){return n.rtl?t.pageWidth-t.rightMargin-e:t.leftMargin+e}function V3(e,t,n){if(!Number.isFinite(e.pageWidth)||e.pageWidth<=0)return [];let r=t.rtl?e.pageWidth-e.rightMargin:e.leftMargin,o=n==="inch"?8:10,a=(n==="inch"?1440:567)/o,i=[],s=-Math.floor(r/a),l=Math.floor((e.pageWidth-r)/a);for(let c=s;c<=l;c+=1){let d=r+c*a,u=Math.abs(c)%o;if(u===0){let f=Math.abs(c)/o,p=f>0&&d>0&&d<e.pageWidth;i.push({position:d,height:8,...p?{label:String(f)}:{}});}else u===o/2?i.push({position:d,height:5}):n==="cm"||u%2===0?i.push({position:d,height:3}):i.push({position:d,height:2});}return i}function jT(e,t){let n=e.snapshot().formatting;if(n)switch(t){case "text.color":return n.color?.kind==="hex"?n.color.value.replace(/^#/,""):void 0;case "text.highlight":return n.highlight;case "styles.style":return n.styleId;case "font.family":return n.fontFamily;case "font.size":return n.fontSizePt===void 0?void 0:String(n.fontSizePt*2);case "list.lineSpacing":return n.lineSpacing?.rule==="multiple"?String(n.lineSpacing.value):void 0;default:return}}function G3(e){if(!(!e||typeof e!="object"||"preventDefault"in e))return e}var VT="no formatting has been copied",bf="there is nothing at the selection to copy",ny="the selection has nothing to paint",vf=Object.freeze({mode:"off",level:"none"});function GT(e,t){let n=Math.round(t*12700),r=1143e3,o=`<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:r>
18
+ <w:drawing xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
19
+ <wp:anchor distT="0" distB="0" distL="91440" distR="91440" simplePos="0" relativeHeight="251658240" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1">
20
+ <wp:simplePos x="0" y="0"/><wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>
21
+ <wp:extent cx="${n}" cy="${r}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/><wp:docPr id="${e}" name="Text Box ${e}"/><wp:cNvGraphicFramePr/>
22
+ <a:graphic><a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"><wps:wsp><wps:cNvSpPr txBox="1"/><wps:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${n}" cy="${r}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill><a:ln w="12700"><a:solidFill><a:srgbClr val="000000"/></a:solidFill></a:ln></wps:spPr><wps:txbx><w:txbxContent><w:p/></w:txbxContent></wps:txbx><wps:bodyPr lIns="91440" rIns="91440" tIns="45720" bIns="45720" anchor="t"><a:noAutofit/></wps:bodyPr></wps:wsp></a:graphicData></a:graphic>
23
+ </wp:anchor></w:drawing></w:r></w:p></w:body></w:document>`,a=Pa(o,{name:"/word/document.xml",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"});if(!a.ok)throw new Error("Cannot build textbox drawing");let i=l=>{if(l.kind==="drawing")return l;if(l.kind==="textValue")return null;for(let c of l.children){let d=i(c);if(d)return d}return null},s=i(a.part.root);if(!s)throw new Error("Textbox drawing is missing");return s}function ry(e){let t=e.activeScope();if(e.editingMode()!=="edit"||t.kind!=="body"&&t.kind!=="frame")return {ok:false,code:"unsupported",reason:"Textboxes can only be inserted in body editing mode"};let n=t.kind==="frame"?t.hostParagraphId:e.state().selection.head.paragraphId;return e.layout().pages.some(r=>r.fragments.some(o=>o.kind==="paragraph"&&o.paragraphId===n))?null:{ok:false,code:"unsupported",reason:"Select a body paragraph outside a table to insert a textbox"}}function zT(e){let t=ry(e);if(t)return t;let n=e.activeScope(),r=n.kind==="frame"?n.hostParagraphId:e.state().selection.head.paragraphId,o=e.session.part(),a=eb$1(o,r);if(!a||a.kind!=="paragraph")return {ok:false,code:"notFound",reason:"Textbox anchor is missing"};let i=cg(e.session.currentPackage(),e.collaborationSession()?.identity.actorId);if(!i.ok)return {ok:false,code:"invalidArgs",reason:"Cannot allocate textbox identity"};let s=new Set(fk(o).map(p=>p.root.id)),l=e.layout().pages.flatMap(p=>p.fragments).find(p=>p.kind==="paragraph"&&p.paragraphId===r),c=Math.min(300,l?.box.width??300);n.kind==="frame"&&e.setActiveScope({kind:"body"});let d=Ki(a);e.setSelection({anchor:{paragraphId:r,offset:d},head:{paragraphId:r,offset:d}});let u=e.applyDrawingOps([{op:"insertDrawing",paragraphId:r,offset:d,drawing:GT(i.id,c)}]);if(u.rejected)return {ok:false,code:"invalidArgs",reason:u.reason??"Textbox insertion was refused"};let f=fk(e.session.part()).find(p=>!s.has(p.root.id));return f&&e.setActiveScope({kind:"frame",id:f.root.id,drawingNodeId:f.drawingNodeId,hostParagraphId:f.hostParagraphId}),e.focus(),{ok:true,changed:u.committed}}var oy=new WeakMap;function Eo(e){let t=oy.get(e);if(t)return t;let n=Fh$1(e);if(n.length===0)return oy.set(e,[]),[];let r=[];for(let o of n){let a=Eh$1(o);for(let i of new Set([o.beginParagraphId,...o.resultParagraphIds,o.endParagraphId])){let s=eb$1(e,i);if(s?.kind!=="paragraph")continue;let l=Ii(s),c=i===o.beginParagraphId,d=i===o.endParagraphId;r.push({toc:o,paragraphId:i,length:l.length,startsHere:c,endsHere:d,start:c?l.spanOf(o.beginNodeId)?.start??0:0,end:d&&a?l.spanOf(a.endNodeId)?.end??l.length:l.length});}}return oy.set(e,r),r}function xf(e){return new Set(Eo(e).filter(t=>t.start===0&&t.end===t.length&&!(t.endsHere&&!t.startsHere&&t.end===0)).map(t=>t.paragraphId))}function ay(e,t){return e.endsHere&&!e.startsHere&&e.end===0||e.startsHere&&e.start>0&&t<=e.start||e.endsHere&&e.end<e.length&&t>=e.end?false:t>=e.start&&t<=e.end}function ir(e,t){return Eo(e).find(n=>n.paragraphId===t.paragraphId&&ay(n,t.offset))?.toc}function ZT(e,t){let{anchor:n,head:r}=t;if(n.paragraphId===r.paragraphId){let o=Math.min(n.offset,r.offset),a=Math.max(n.offset,r.offset);return Eo(e).some(i=>i.paragraphId===n.paragraphId&&(o===a?ay(i,o):o<i.end&&a>i.start))}return ir(e,n)!==void 0||ir(e,r)!==void 0}function XT(e,t){let n=Eo(e);if(n.length===0)return false;let r=um$1(t);if(r.kind==="nodes")return r.targets.some(i=>n.some(s=>{if(i.nodeId!==s.paragraphId)return false;if(i.range){let{start:l,end:c}=i.range;return l===c?ay(s,l):l<s.end&&c>s.start}return t.op==="joinParagraphs"&&t.firstId===s.paragraphId&&s.endsHere&&s.end===0?false:i.removes||i.structural?true:s.end>s.start||s.length===0&&!s.endsHere}));let o=new Set(n.map(i=>i.paragraphId)),a=(i,s="")=>typeof i=="string"?/(?:Id|Ids)$/.test(s)&&o.has(i):Array.isArray(i)?i.some(l=>a(l,s)):!!i&&typeof i=="object"&&Object.entries(i).some(([l,c])=>a(c,l));return a(t)}function YT(e,t,n){let r=ir(e,t);if(!r)return null;let o=Eo(e).find(a=>a.toc.id===r.id&&(n?a.startsHere&&a.start>0:a.endsHere&&a.end<a.length));return o?{paragraphId:o.paragraphId,offset:n?o.start:o.end}:null}function QT(e,t){return !Eo(t).some(r=>r.toc.id===e.id&&(r.start>0||r.end<r.length))&&e.contentControlId?e.contentControlId:`toc:${e.id}`}function JT(e,t,n){if(!t)return;let r=n?.closest("[data-start]");return Eo(e).find(o=>o.paragraphId===t&&(r?Number(r.dataset.start)<o.end&&Number(r.dataset.end)>o.start:xf(e).has(t)))?.toc}function eE(e,t){return Fh$1(e).some(n=>n.beginParagraphId===t||n.endParagraphId===t||n.resultParagraphIds.includes(t))}var nE="suggesting cannot merge or split cells; stop suggesting to change the table structure",z3="select two or more cells that form a rectangle to merge them",Z3="select two or more cells to merge them";function rE(e){switch(e){case "cells-not-rectangle":return {code:"invalidArgs",reason:z3};case "split-rows-not-divisor":return {code:"invalidArgs",reason:"a merged cell splits only into a number of rows that divides its rows"};case "split-needs-grid":return {code:"invalidArgs",reason:"this table has no column grid, so the cell splits only into a divisor of its columns"};case "cell-too-narrow":return {code:"invalidArgs",reason:"the cell is too narrow to split into that many columns"};case "cell-has-revision":return {code:"unsupported",reason:"the cells have a tracked change; accept or reject it first"};default:return null}}function tE(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=Wm}function oE(e){return tE(e.rows)&&tE(e.cols)&&e.rows*e.cols>=2?null:`splitCell rows and cols must be whole numbers from 1 to ${Wm}, and not both 1`}function Sf(e){let t=e.author()?.trim();return e.editingMode()==="suggest"&&t?{suggestingAuthor:t}:{}}function aE(e,t,n){return !n||t.op!=="mergeTableCells"&&t.op!=="splitTableCell"?t:an$1(e.root,t.tableId,n)?{...t,revision:{author:n}}:t}function iE(e,t,n){return e.type==="mergeCells"?!n||t.cellIds.length<2?{ok:false,code:"invalidArgs",reason:Z3}:{ok:true,op:{op:"mergeTableCells",tableId:t.tableId,cellIds:t.cellIds}}:t.cellIds.length>1?{ok:false,code:"invalidArgs",reason:"select one cell to split it"}:{ok:true,op:{op:"splitTableCell",tableId:t.tableId,cellId:t.cellId,rows:e.rows,columns:e.cols}}}function sE(e,t,n){let r=Xm(e,t.tableId);if(!r.ok)return null;let o=null;for(let a of t.cellIds){let i=r.table.index.byId.get(a);if(!i)continue;let s=Ym(r.table,i),l=n==="above"?s.rowFrom:s.rowTo;o=o===null?l:n==="above"?Math.min(o,l):Math.max(o,l);}return o===null?null:r.table.topology.rows[o]?.row.id??null}function lE(e,t,n){let r=Xm(e,t.tableId);if(!r.ok)return null;let o=null;for(let a of t.cellIds){let i=r.table.index.byId.get(a);if(!i)continue;let s=Ym(r.table,i),l=n==="left"?s.colFrom:s.colTo;o=o===null?l:n==="left"?Math.min(o,l):Math.max(o,l);}return o===null?null:r.table.topology.gridColumns[o]?.id??null}var ec=/^[0-9A-Fa-f]{6}$/,cE={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folhlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedhyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"},X3={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"};function iy(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function wf(e){return Math.max(0,Math.min(1,e))}function dE(e){let t=e.replace(/^#/,"").padStart(6,"0").slice(0,6);return {r:parseInt(t.slice(0,2),16)||0,g:parseInt(t.slice(2,4),16)||0,b:parseInt(t.slice(4,6),16)||0}}function uE(e,t,n){let r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return `${r(e)}${r(t)}${r(n)}`.toUpperCase()}function fE(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-wf(t))*255)))/255,o=dE(e);return uE(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function pE(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(wf(t)*255)))/255,o=dE(e);return uE(r*o.r,r*o.g,r*o.b)}function sy(e){return cE[e]??cE[e.toLowerCase()]??null}function Y3(e,t){let n=sy(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&ec.test(r))return r.toUpperCase();let o=X3[n];return o&&ec.test(o)?o.toUpperCase():null}function kf(e,t){let n=Y3(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!iy(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!iy(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=fE(r,wf(e.tint)):e.shade!==void 0&&(r=pE(r,wf(e.shade))),{ok:true,hex:r}}var Q3="000000";function ly(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return ec.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"border colour requires a six-digit hex value"}}if(e.kind==="auto")return {ok:true,color:{kind:"auto",resolvedHex:Q3}};let n=kf(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:sy(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function cy(e,t){if(e.kind==="auto")return {ok:false,reason:"automatic fill cannot be written without a resolved colour"};if(e.kind==="hex"){let o=e.value.toUpperCase();return ec.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=kf(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:sy(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function J3(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return ec.test(o)?`#${o}`:`#${n}`}let r=kf(e,t);return `#${r.ok?r.hex:n}`}function mE(e,t){if(t.region!=="table")return {ok:false,code:"unsupported",reason:`selecting a table ${t.region} is not supported yet`};let n=e.cellSelection?.tableId??na$1(e.layout,e.selection.head.paragraphId)?.tableId,r=n===void 0?null:ga$1(e.layout,n);return r?{ok:true,ops:[],selection:{kind:"selectCells",cells:r}}:{ok:false,code:"unsupported",reason:"the selection is not inside a table"}}function gE(e,t,n){return n==="suggest"||!t||!ha$1(e,t)?null:{ok:true,ops:[{op:"deleteBlock",blockId:t.tableId}],selection:{kind:"adoptCommittedCaret"}}}function dy(e,t){return Sf$2(e).occurrences.some(n=>n.table.tableId===t&&n.row.cells.some(r=>r.logicalGridColumn!==void 0))}function hE(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var r$=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function ra(e){return r$.has(e.type)}function be(e,t){return {ok:false,code:e,reason:t}}function uy(e,t){let n=rE(e);if(n)return be(n.code,n.reason);switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return be("invalidArgs","the table target is no longer valid");case "table-has-merge":return be("unsupported","this table uses a legacy horizontal merge the editor cannot change");case "row-hides-cell":case "tree-invariant":return be("unsupported","this table has a cell the editor cannot place in the grid");case "block-required":return be("unsupported","the table must keep at least one row or column");case "resource-limit":return be("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return be("invalidArgs","the table command arguments are invalid");default:return be("unsupported",`the table operation was refused (${e})`)}}function on(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Un(e,t){return !on(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function xE(e){if(!on(e))return false;let t=e.kind;if(t==="hex")return Un(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return Un(e,["kind"]);if(t==="theme"){if(typeof e.slot!="string")return false;let n=["kind","slot"];if(e.tint!==void 0){if(typeof e.tint!="number"||!Number.isFinite(e.tint))return false;n.push("tint");}if(e.shade!==void 0){if(typeof e.shade!="number"||!Number.isFinite(e.shade))return false;n.push("shade");}return Un(e,n)}return false}function SE(e){return on(e)&&Un(e,["sourceRevision","tableId","rowId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&e.tableId.length>0&&typeof e.rowId=="string"&&e.rowId.length>0&&typeof e.isHeaderRepeat=="boolean"}function wE(e){return on(e)&&Un(e,["sourceRevision","tableId","gridColumnId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&e.tableId.length>0&&typeof e.gridColumnId=="string"&&e.gridColumnId.length>0&&typeof e.isHeaderRepeat=="boolean"}function o$(e){return on(e)&&Un(e,["sourceRevision","tableId","leftGridColumnId","rightGridColumnId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&typeof e.leftGridColumnId=="string"&&typeof e.rightGridColumnId=="string"&&typeof e.isHeaderRepeat=="boolean"}function a$(e){return on(e)&&Un(e,["sourceRevision","tableId","gridColumnId","isHeaderRepeat"])&&typeof e.sourceRevision=="number"&&Number.isInteger(e.sourceRevision)&&typeof e.tableId=="string"&&typeof e.gridColumnId=="string"&&typeof e.isHeaderRepeat=="boolean"}function i$(e){return !on(e)||!Un(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&xE(e.color)}function yE(e){return !("target"in e)||e.target===void 0||SE(e.target)}function bE(e){return !("target"in e)||e.target===void 0||wE(e.target)}function s$(e){switch(e.type){case "splitCell":{let t=oE(e);return t?be("invalidArgs",t):null}case "insertRow":return !on(e)||e.type!=="insertRow"?be("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?be("invalidArgs","insertRow where must be above or below"):yE(e)?null:be("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !on(e)||e.type!=="deleteRow"?be("invalidArgs","deleteRow command shape is invalid"):yE(e)?null:be("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !on(e)||e.type!=="insertColumn"?be("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?be("invalidArgs","insertColumn where must be left or right"):bE(e)?null:be("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !on(e)||e.type!=="deleteColumn"?be("invalidArgs","deleteColumn command shape is invalid"):bE(e)?null:be("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !on(e)||!Un(e,["type"])?be("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !on(e)||!Un(e,["type","color"])?be("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!xE(e.color)?be("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !on(e)||!Un(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?be("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !on(e)||e.type!=="setTableBorders"?be("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?be("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!i$(e.spec)?be("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !on(e)||!Un(e,["type","target","leftWidthTwips","rightWidthTwips"])||!o$(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?be("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !on(e)||!Un(e,["type","target","columnWidthTwips","tableWidthTwips"])||!a$(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?be("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function l$(e){return !("target"in e)||e.target===void 0?null:SE(e.target)?e.target:null}function c$(e){return !("target"in e)||e.target===void 0?null:wE(e.target)?e.target:null}function d$(e,t){let n=Tm(e.root,t.tableId);if(!n.ok)return {rowIds:[t.rowId],wholeTable:false};let r=new Set(t.cellIds),o=n.topology.rows.filter(a=>a.cells.some(i=>r.has(i.id))).map(a=>a.row.id);return o.length===0?{rowIds:[t.rowId],wholeTable:false}:{rowIds:o,wholeTable:o.length===n.topology.rows.length}}function u$(e,t){let n=Tm(e.root,t.tableId);if(!n.ok||!n.topology.grid)return {gridColumnIds:[],wholeTable:false};let r=new Set(t.cellIds),o=new Set;for(let a of n.topology.rows){let i=0;for(let s of a.cells){let l=kE(s);if(r.has(s.id))for(let c=0;c<l;c+=1){let d=n.topology.gridColumns[i+c];d&&o.add(d.id);}i+=l;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function vE(e,t,n){let r=Tm(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function f$(e){let t=oa$1(e.layout,e.selection.head.paragraphId,e.cellSelection);return t?{tableId:t.tableId,rowId:t.rowId,cellId:t.cellId,cellIds:[...t.cellIds],gridColumnIndex:t.gridColumnIndex,isHeaderRepeat:t.isHeaderRepeat}:null}function kE(e){let t=Fl(e,"tcPr"),n=t&&Fl(t,"gridSpan"),r=n&&Gl$1(n,"val");if(!r||!/^\d{1,7}$/.test(r))return 1;let o=Number(r);return Number.isInteger(o)&&o>1?Math.min(o,1024):1}function p$(e,t,n){let r=e.gridColumns.findIndex(o=>o.id===n);if(r===-1)return null;for(let{row:o,cells:a}of e.rows){let i=0;for(let s of a){let l=kE(s);if(r>=i&&r<i+l)return {tableId:t,rowId:o.id,cellId:s.id,cellIds:[s.id],gridColumnIndex:r,isHeaderRepeat:false};i+=l;}}return null}function m$(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=Tm(e.part.root,t.tableId);if(!n.ok)return null;let r=n.topology.rows.findIndex(i=>i.row.id===t.rowId);if(r===-1)return null;let a=n.topology.rows[r].cells[0];return a?{tableId:t.tableId,rowId:t.rowId,cellId:a.id,cellIds:[a.id],gridColumnIndex:0,isHeaderRepeat:false}:null}function g$(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=Tm(e.part.root,t.tableId);return n.ok?p$(n.topology,t.tableId,t.gridColumnId):null}function IE(e,t){for(let n of t){let r=En$1(e,n);if(r)return uy(r)}return null}function Kn(e,t,n){let r=IE(e,t);return r||{ok:true,ops:t,selection:n}}function h$(e,t){if(!Um.includes(e.style))return {ok:false,reason:"border style is not allowlisted"};if(!Number.isInteger(e.size)||e.size<1)return {ok:false,reason:"border size is out of range"};if(e.size>96)return {ok:false,reason:"border size is out of range"};let n=ly(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function tc(e,t,n){return n!==e.storeRevision?be("invalidArgs","the table target is stale"):Tm(e.part.root,t).ok?null:be("invalidArgs","the table target is no longer valid")}function y$(e){return e?.isHeaderRepeat?be("unsupported","repeated header rows cannot be edited"):null}function b$(e,t,n,r){let o=tc(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return be("invalidArgs","column widths must be whole twips");if(n<300||r<300)return be("invalidArgs","column widths are below the minimum");let a=Tm(e.part.root,t.tableId);if(!a.ok){let u=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return uy(u)}let i=a.topology.gridColumns.find(u=>u.id===t.leftGridColumnId),s=a.topology.gridColumns.find(u=>u.id===t.rightGridColumnId);if(!i||!s)return be("invalidArgs","the table target is no longer valid");let l=a.topology.gridColumns.indexOf(i),c=a.topology.gridColumns.indexOf(s);if(Math.abs(c-l)!==1)return be("invalidArgs","the column divider target is not adjacent");let d={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:l<c?t.leftGridColumnId:t.rightGridColumnId,rightGridColumnId:l<c?t.rightGridColumnId:t.leftGridColumnId,leftWidthTwips:l<c?n:r,rightWidthTwips:l<c?r:n};return Kn(e.part,[d],{kind:"preserveSelection"})}function v$(e,t,n,r){let o=tc(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return be("invalidArgs","column widths must be whole twips");if(n<300)return be("invalidArgs","column widths are below the minimum");let a=Tm(e.part.root,t.tableId);if(!a.ok){let l=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return uy(l)}let i=a.topology.gridColumns[a.topology.gridColumns.length-1];if(!i||i.id!==t.gridColumnId)return be("invalidArgs","the resize target is not the table right edge");let s={op:"setTableRightEdgeWidth",tableId:t.tableId,gridColumnId:t.gridColumnId,columnWidthTwips:n,tableWidthTwips:r};return Kn(e.part,[s],{kind:"preserveSelection"})}function RE(e,t,n){if(e.viewing||!e.editable)return be("locked","the document is open for viewing");let r=tc(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return be("invalidArgs","row height is outside the supported range");let o={op:"setTableRowHeight",tableId:t.tableId,rowId:t.rowId,heightTwips:n};return Kn(e.part,[o],{kind:"preserveSelection"})}function Rr(e){let{command:t,part:n,viewing:r,editable:o}=e;if(t.type==="selectTableRegion")return mE(e,t);if(r||!o)return be("locked","the document is open for viewing");switch(t.type){case "toggleHeaderRow":case "setTableProperties":return be("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=s$(t);if(a)return a;let i=l$(t),s=c$(t),l=y$(i??s);if(l)return l;if(i){let d=tc(e,i.tableId,i.sourceRevision);if(d)return d}if(s){let d=tc(e,s.tableId,s.sourceRevision);if(d)return d}let c=i!==null?m$(e,i):s!==null?g$(e,s):f$(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!c)return i||s?be("invalidArgs","the table target is no longer valid"):be("unsupported","the selection is not inside a table");if(c?.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");switch(t.type){case "mergeCells":case "splitCell":{if(!c)return be("unsupported","the selection is not inside a table");let d=iE(t,c,e.cellSelection!==null);if(!d.ok)return be(d.code,d.reason);let u=aE(n,d.op,e.suggestingAuthor);return IE(n,[u])??{ok:true,ops:[d.op],selection:{kind:"adoptCommittedCaret"}}}case "insertRow":{if(!c)return be("unsupported","the selection is not inside a table");let d=(i?null:sE(n,c,t.where))??c.rowId,u={op:"insertTableRow",tableId:c.tableId,rowId:d,where:t.where};return Kn(n,[u],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!c)return be("unsupported","the selection is not inside a table");let d=d$(n,c),u=d.wholeTable?[{op:"deleteBlock",blockId:c.tableId}]:d.rowIds.map(f=>({op:"deleteTableRow",tableId:c.tableId,rowId:f,...f===c.rowId?{referenceCellId:c.cellId}:{}}));return Kn(n,u,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!c)return be("unsupported","the selection is not inside a table");let d=s?.tableId??c.tableId,u=dy(e.layout,d)?t.where==="left"?"right":"left":t.where,f=s?.gridColumnId??lE(n,c,u)??vE(n,d,c.gridColumnIndex),p=f?{op:"insertTableColumn",tableId:d,where:u,gridColumnId:f}:{op:"insertTableColumn",tableId:d,where:u,referenceCellId:c.cellId};return Kn(n,[p],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!c)return be("unsupported","the selection is not inside a table");let d=s?.tableId??c.tableId,u=s?.gridColumnId??vE(n,d,c.gridColumnIndex);if(!u)return be("invalidArgs","the table has no grid column to delete");let f=s?.gridColumnId===void 0?u$(n,c):{gridColumnIds:[u],wholeTable:false};if(f.wholeTable)return Kn(n,[{op:"deleteBlock",blockId:d}],{kind:"adoptCommittedCaret"});let g=(f.gridColumnIds.length>0?f.gridColumnIds:[u]).map(y=>({op:"deleteTableColumn",tableId:d,gridColumnId:y}));return Kn(n,g,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!c)return be("unsupported","the selection is not inside a table");let d={op:"deleteBlock",blockId:c.tableId};return Kn(n,[d],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!c)return be("unsupported","the selection is not inside a table");let d;if(t.color===null)d=null;else {let f=cy(t.color,e.themeColors);if(!f.ok)return be("invalidArgs",f.reason);d=f.color;}let u={op:"setTableCellFill",tableId:c.tableId,cellIds:c.cellIds,color:d};return Kn(n,[u],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!c)return be("unsupported","the selection is not inside a table");let d={op:"setTableCellVerticalAlignment",tableId:c.tableId,cellIds:c.cellIds,alignment:t.alignment};return Kn(n,[d],{kind:"preserveSelection"})}case "setTableBorders":{if(!c)return be("unsupported","the selection is not inside a table");if(t.scope==="none"){let f={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:"none",target:hE(t.target,dy(e.layout,c.tableId))};return Kn(n,[f],{kind:"preserveSelection"})}let d=h$(t.spec,e.themeColors);if(!d.ok)return be("invalidArgs",d.reason);let u={op:"setTableCellBorders",tableId:c.tableId,cellIds:c.cellIds,scope:hE(t.scope,dy(e.layout,c.tableId)),spec:d.spec};return Kn(n,[u],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return b$(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return v$(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return be("unsupported",`command '${t.type}' is not a table command`)}}function PE(e){if(!ra(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "toggleHeaderRow":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}var If="Calibri",fy=new Set(["image/png","image/jpeg","image/gif","image/bmp","image/webp"]),x$=4e3,us=e=>Math.max(1,Math.min(x$,e));function S$(e,t,n,r){let o={...la$2,fontFamily:t.fontFamily,bold:t.bold,italic:t.italic,fontSizePt:t.size??100},a=r?.measure(e,o)??NaN,i=r?.lineMetrics(o).height??NaN;if(a>0||(a=.55*o.fontSizePt*Array.from(e).length),i>0||(i=1.22*o.fontSizePt),t.size!==null)return {width:us(a),height:us(i)};let s=i/a,l=Math.min(n.width,n.height),c=t.diagonal?l*Math.SQRT2/(1+s):n.width;return {width:us(c),height:us(c*s)}}function w$(e,t,n){let r=Sf$1(e);if(!fy.has(r))return null;let o=Xf$1(e,r);if(!o)return null;let a=o.pixelWidth*72/(o.dpiX&&o.dpiX>0?o.dpiX:96),i=o.pixelHeight*72/(o.dpiY&&o.dpiY>0?o.dpiY:96);if(!(a>0)||!(i>0))return null;let s=t??Math.min(n.width/a,n.height/i);return {width:us(a*s),height:us(i*s)}}function nc(e,t,n){if(e.imageData)return w$(e.imageData,e.scale??null,t);let r=e.text??"";return r===""?null:S$(r,{fontFamily:e.fontFamily?.trim()||If,bold:e.bold??false,italic:e.italic??false,size:e.fontSizePt??null,diagonal:(e.layout??"diagonal")==="diagonal"},t,n)}var k$="C0C0C0",I$=.5,R$=/^[^"';{}<>\\\u0000-\u001f]{1,64}$/u;function Rf(e){if(!e)return null;let t=lj$1(e.session.currentPackage());return t?t.kind==="picture"?Object.freeze({kind:"image",washout:t.washout}):Object.freeze({kind:"text",text:t.text,fontFamily:t.fontFamily,fontSizePt:t.fontSizePt,bold:t.bold,italic:t.italic,color:t.colorHex,transparency:Math.round((1-t.opacity)*1e3)/1e3,layout:t.diagonal?"diagonal":"horizontal"}):null}function TE(e){let t=Rf(e);if(!t||!e)return null;if(t.kind==="text"){let{kind:a,...i}=t;return Object.freeze(i)}let n=e.session.currentPackage(),r=lj$1(n),o=r?.kind==="picture"&&r.mediaPartName?n.partBytes.get(r.mediaPartName):void 0;return Object.freeze({washout:t.washout??false,scale:null,...o?{imageData:o}:{}})}var py=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n;function my(e){if(e===null)return null;if(typeof e!="object"||e===void 0)return "watermark must be an object or null";let t=e,n=t.text!==void 0,r=t.imageData!==void 0;if(n===r)return "set exactly one of text and imageData";if(n){if(typeof t.text!="string"||!t.text.trim())return "text must be a non-empty string";if(t.text.length>_d)return `text is longer than ${_d}`;if(/[\r\n\v\f\u2028\u2029]/u.test(t.text))return "text must be one line";if(/[\u0000-\u0008\u000e-\u001f]/u.test(t.text))return "text holds a control character";if(t.fontFamily!==void 0&&(typeof t.fontFamily!="string"||!R$.test(t.fontFamily.trim())))return "fontFamily is not a font name";if(t.fontSizePt!==void 0&&t.fontSizePt!==null&&!py(t.fontSizePt,1,1e3))return "fontSizePt must be from 1 to 1000";if(t.color!==void 0&&(typeof t.color!="string"||!/^[0-9a-f]{6}$/iu.test(t.color)))return "color must be RRGGBB";if(t.transparency!==void 0&&!py(t.transparency,0,1))return "transparency must be from 0 to 1";if(t.layout!==void 0&&t.layout!=="diagonal"&&t.layout!=="horizontal")return "layout must be 'diagonal' or 'horizontal'";for(let a of ["bold","italic"])if(t[a]!==void 0&&typeof t[a]!="boolean")return `${a} must be a boolean`;return t.scale!==void 0||t.washout!==void 0?"scale and washout apply to a picture watermark":null}if(!(t.imageData instanceof Uint8Array))return "imageData must be a Uint8Array";let o=Sf$1(t.imageData);if(!fy.has(o))return "imageData is not a PNG, JPEG, GIF, BMP or WebP picture";if(!dg$1(t.imageData,o))return "imageData is not a readable picture";if(t.scale!==void 0&&t.scale!==null&&!py(t.scale,.01,10))return "scale must be from 0.01 to 10";if(t.washout!==void 0&&typeof t.washout!="boolean")return "washout must be a boolean";for(let a of ["fontFamily","fontSizePt","bold","italic","color","transparency","layout"])if(t[a]!==void 0)return `${a} applies to a text watermark`;return null}function EE(e){let{pageSize:t,margins:n}=e,r=(t.widthTwips-n.leftTwips-n.rightTwips-n.gutterTwips)/20,o=(t.heightTwips-n.topTwips-n.bottomTwips)/20;return {width:Math.max(72,r),height:Math.max(72,o)}}function CE(e,t,n){let r=e.session.currentPackage(),o=r.parts.get(r.mainDocumentPart);if(o)return pe(o).map(a=>{let i=nc(t,EE(a.properties),n);return i?{widthPt:i.width,heightPt:i.height}:null})}function P$(e,t){let n=EE(e.sectionPropertiesAt(e.state().selection.head.paragraphId)),r=e.textMeasurer?.();if(t.imageData){let u=Sf$1(t.imageData),f=nc(t,n);return f?{kind:"picture",washout:t.washout??true,widthPt:f.width,heightPt:f.height,sectionSizes:CE(e,t,r),image:{bytes:t.imageData,mime:u}}:null}let o=t.text??"",a=t.fontFamily?.trim()||If,i=t.bold??false,s=t.italic??false,l=(t.layout??"diagonal")==="diagonal",c=t.fontSizePt??null,d=nc(t,n,r);return {kind:"text",text:o,fontFamily:a,fontSizePt:c,bold:i,italic:s,colorHex:(t.color??k$).toUpperCase(),opacity:1-(t.transparency??I$),diagonal:l,widthPt:d.width,heightPt:d.height,sectionSizes:CE(e,t,r)}}function OE(e,t){let n=my(t);if(n)return {ok:false,code:"invalidArgs",reason:n};if(typeof e.applyHeaderFooterLifecycle!="function")return {ok:false,code:"unsupported",reason:"watermarks are not available"};let r=t?P$(e,t):null;if(t&&!r)return {ok:false,code:"invalidArgs",reason:"imageData is not a readable picture"};if(!t&&!lj$1(e.session.currentPackage()))return {ok:true,changed:false};let o={op:"setWatermark",watermark:r},a=e.applyHeaderFooterLifecycle(o);return a.ok?{ok:true,changed:true}:{ok:false,code:a.reason==="locked"?"locked":"invalidArgs",reason:`the watermark was not written: ${a.reason}`}}function Zt(e){if(typeof e!="object"||e===null)return false;let t=e;return typeof t.paraId=="string"&&t.paraId.length>0&&(t.search===void 0||typeof t.search=="string"&&t.search.length>0)&&(t.occurrence===void 0||typeof t.occurrence=="number"&&Number.isInteger(t.occurrence)&&t.occurrence>=1)}function ei(e){if(typeof e!="object"||e===null)return false;let t=e;return Zt(t.from)&&Zt(t.to)}function ME(e,t,n){let r=[],o=e.indexOf(t);for(;o>=0&&r.length<n;)r.push(o),o=e.indexOf(t,o+1);return r}function jn(e,t,n){if(typeof n.paraId!="string"||n.paraId.length===0)return {ok:false,code:"invalidArgs",reason:"paraId must be a non-empty string"};let r=n.paraId.toUpperCase();if(t.ambiguousParaIds.has(r))return {ok:false,code:"ambiguous",reason:`paraId '${n.paraId}' is claimed by more than one story`};let o=t.nodeByParaId.get(r);if(o===void 0)return {ok:false,code:"notFound",reason:`no paragraph with paraId '${n.paraId}'`};let a=Nm(t.partByNode.get(o)??e,o)??"";if(n.search===void 0)return {ok:true,span:{nodeId:o,start:0,end:a.length}};if(n.search.length===0)return {ok:false,code:"invalidArgs",reason:"search must be a non-empty phrase"};if(n.occurrence!==void 0){if(!Number.isInteger(n.occurrence)||n.occurrence<1)return {ok:false,code:"invalidArgs",reason:"occurrence must be a positive integer (1-based)"};let s=ME(a,n.search,n.occurrence),l=s[n.occurrence-1];return l===void 0?{ok:false,code:"notFound",reason:`'${n.search}' matches ${s.length} time(s) in paragraph '${n.paraId}'; occurrence ${n.occurrence} does not exist`}:{ok:true,span:{nodeId:o,start:l,end:l+n.search.length}}}let i=ME(a,n.search,2);return i.length===0?{ok:false,code:"notFound",reason:`'${n.search}' does not occur in paragraph '${n.paraId}'`}:i.length>1?{ok:false,code:"ambiguous",reason:`'${n.search}' matches more than once in paragraph '${n.paraId}'; pass occurrence to disambiguate`}:{ok:true,span:{nodeId:o,start:i[0],end:i[0]+n.search.length}}}function AE(e,t,n){if("anchor"in n){let s=jn(e,t,n.anchor);if(!s.ok)return {ok:false,code:s.code,reason:s.reason,target:n.anchor};let l={paragraphId:s.span.nodeId,offset:s.span.start};return {ok:true,selection:{anchor:l,head:l}}}let{from:r,to:o}=n.range;if(!Zt(r)||!Zt(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=jn(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=jn(e,t,o);return i.ok?{ok:true,selection:{anchor:{paragraphId:a.span.nodeId,offset:a.span.start},head:{paragraphId:i.span.nodeId,offset:i.span.end}}}:{ok:false,code:i.code,reason:i.reason,target:o}}function LE(e){let t=e.match;return typeof t?.blockId!="string"||t.blockId.length===0||!Number.isInteger(t.start)||t.start<0||!Number.isInteger(t.length)||t.length<0?"match must carry a blockId and offsets":typeof e.text!="string"?"replaceMatch requires text":/[\r\n\v\f\u2028\u2029]/.test(e.text)?"replaceMatch requires text without a paragraph mark":null}function gy(e,t){let n=t.scope??{kind:"body"},r=e.activeScope();return (n.kind==="body"?r.kind==="body":n.kind==="headerFooter"?r.kind==="headerFooter"&&r.rId===n.rId:n.kind==="note"?r.kind==="note"&&r.id===n.id:false)?null:{ok:false,code:"unsupported",reason:n.kind==="frame"?"replaceMatch does not replace text in a text box":"replaceMatch replaces text only in the open story"}}function FE(e,t){let n=gy(e,t.match);if(n)return n;let{blockId:r,start:o,length:a}=t.match;return e.replaceTextInPlace(r,o,o+a,t.text)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"replaceMatch was refused"}}var C$=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function T$(e,t){return e===t?true:!e||!t?false:C$.every(n=>e[n]===t[n])}function hy(e,t){if(e===t)return true;if(!e||!t||e.bold!==t.bold||e.italic!==t.italic||e.underline!==t.underline||e.strike!==t.strike||e.superscript!==t.superscript||e.subscript!==t.subscript||e.highlight!==t.highlight||e.fontFamily!==t.fontFamily||e.fontSizePt!==t.fontSizePt||e.alignment!==t.alignment||e.direction!==t.direction||e.styleId!==t.styleId||e.spaceBeforePt!==t.spaceBeforePt||e.spaceAfterPt!==t.spaceAfterPt||e.lineSpacing?.rule!==t.lineSpacing?.rule||e.lineSpacing?.value!==t.lineSpacing?.value||e.indent?.left!==t.indent?.left||e.indent?.right!==t.indent?.right||e.indent?.firstLine!==t.indent?.firstLine||e.indent?.mixed.left!==t.indent?.mixed.left||e.indent?.mixed.right!==t.indent?.mixed.right||e.indent?.mixed.firstLine!==t.indent?.mixed.firstLine||e.indent?.rtl!==t.indent?.rtl||e.paragraphFlags?.contextualSpacing!==t.paragraphFlags?.contextualSpacing||e.paragraphFlags?.keepNext!==t.paragraphFlags?.keepNext||e.paragraphFlags?.keepLines!==t.paragraphFlags?.keepLines||e.paragraphFlags?.widowControl!==t.paragraphFlags?.widowControl||e.paragraphFlags?.pageBreakBefore!==t.paragraphFlags?.pageBreakBefore||!T$(e.disagrees,t.disagrees)||e.tabStops?.length!==t.tabStops?.length||(e.tabStops??[]).some((a,i)=>a.positionTwips!==t.tabStops?.[i]?.positionTwips||a.alignment!==t.tabStops?.[i]?.alignment||(a.leader??"none")!==(t.tabStops?.[i]?.leader??"none")))return false;if(e.color===t.color)return true;if(!e.color||!t.color)return false;let n=e.color,r=t.color,o=new Set([...Object.keys(n),...Object.keys(r)]);for(let a of o)if(n[a]!==r[a])return false;return true}function yy(e,t){return e.current===t.current&&e.total===t.total}function by(e,t){return e===t?true:!e||!t?false:e.pageWidthTwips===t.pageWidthTwips&&e.pageHeightTwips===t.pageHeightTwips&&e.orientation===t.orientation&&e.marginsTwips.top===t.marginsTwips.top&&e.marginsTwips.right===t.marginsTwips.right&&e.marginsTwips.bottom===t.marginsTwips.bottom&&e.marginsTwips.left===t.marginsTwips.left&&e.gutterTwips===t.gutterTwips}function DE(e,t){if(e===t)return true;if(!e||!t)return false;let n=e,r=t;return n.paraId===r.paraId&&n.search===r.search&&n.occurrence===r.occurrence}function vy(e,t){return e===t?true:!e||!t||!ei(e)||!ei(t)?false:DE(e.from,t.from)&&DE(e.to,t.to)}function xy(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var E$={scope:"compared",isLoading:"compared",isOpening:"compared",parseError:"compared",openFailure:"compared",editable:"compared",zoom:"compared",zoomMode:"compared",selection:"compared",selectionCollapsed:"compared",formatting:"compared",table:"compared",tocContext:"compared",image:"compared",chart:"compared",page:"compared",canUndo:"compared",canRedo:"compared",pageSetup:"compared",reviewPaneOpen:"compared",reviewPane:"compared",showParagraphMarks:"compared",showBookmarks:"compared",documentProtection:"compared",reviewDisplayMode:"compared",revisionMarkup:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},O$=Object.keys(E$);function Sy(e,t){return O$.every(n=>e[n]===t[n])}function Pf(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)Pf(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))Pf(t[n]);return Object.freeze(e)}var wy=new Map([["bold",{localName:"b"}],["italic",{localName:"i"}],["underline",{localName:"u",attributes:{val:"single"}}],["strike",{localName:"strike"}],["superscript",{localName:"vertAlign",attributes:{val:"superscript"}}],["subscript",{localName:"vertAlign",attributes:{val:"subscript"}}]]),M$=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),A$=/^[0-9A-Fa-f]{6}$/;function ky(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||a$7(n)===null?{ok:false,code:"invalidArgs",reason:"fontFamily requires a family name of 1-64 letters, digits, or [ -.+_,;]"}:{ok:true,localName:"rFonts",attributes:{ascii:n,hAnsi:n}};case "fontSize":return typeof n!="number"||!Number.isInteger(n)||n<2||n>3276?{ok:false,code:"invalidArgs",reason:"fontSize requires an integer half-point value between 2 and 3276"}:{ok:true,localName:"sz",attributes:{val:String(n)}};case "color":return typeof n!="string"||n!=="auto"&&!A$.test(n)?{ok:false,code:"invalidArgs",reason:"color requires a six-digit hex value like FF0000, or 'auto'"}:{ok:true,localName:"color",attributes:{val:n}};case "highlight":return typeof n!="string"||!M$.has(n)?{ok:false,code:"invalidArgs",reason:"highlight requires an ST_HighlightColor name (yellow, cyan, ...)"}:{ok:true,localName:"highlight",attributes:{val:n}};default:return {ok:false,code:"unsupported",reason:`mark '${t}' is not supported by setMarkAttr`}}}function BE(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function Iy(e){return typeof e=="object"&&e!==null&&BE(e.anchor)&&BE(e.head)}function an(e,t){let n=new Error(t);return n.code=e,n}function Cf(e,t){return e===t?true:!e||!t?false:e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}function Ry(e){return e==="blank"?rh():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function $E(e){return typeof e=="string"?`'${e}' is not a document; pass DOCX bytes, or 'blank' for an empty one`:"a DocumentHandle cannot be re-loaded; pass DOCX bytes"}function ti(e){switch(e.type){case "toggleMark":return wy.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=ky(e);return t.ok?{supported:true,mutating:true}:{supported:false,reason:t.reason,code:t.code}}case "setAlignment":return {supported:true,mutating:true};case "setParagraphDirection":return e.direction==="ltr"||e.direction==="rtl"?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"setParagraphDirection requires a direction of 'ltr' or 'rtl'"};case "clearFormatting":return {supported:true,mutating:true};case "copyFormatting":return {supported:true,mutating:false};case "pasteFormatting":return {supported:true,mutating:true};case "setLineSpacing":{if(!["multiple","exact","atLeast"].includes(e.rule))return {supported:false,code:"invalidArgs",reason:"setLineSpacing requires a rule of 'multiple', 'exact' or 'atLeast'"};let n=e.rule==="multiple"?e.value*240:e.value*20;return !Number.isFinite(e.value)||e.value<=0||Math.round(n)>31680?{supported:false,code:"invalidArgs",reason:"setLineSpacing requires a positive value no taller than 1584pt"}:{supported:true,mutating:true}}case "setParagraphSpacing":{for(let t of ["beforePt","afterPt"]){let n=e[t];if(n!=null&&(!Number.isFinite(n)||n<0||n>1584))return {supported:false,code:"invalidArgs",reason:`setParagraphSpacing requires ${t} between 0 and 1584 points`}}return {supported:true,mutating:true}}case "setParagraphStyle":return e.target!==void 0?{supported:false,reason:"DocTarget addressing is not supported; the style applies at the selection"}:typeof e.styleId!="string"||e.styleId.length===0||e.styleId.length>128||/[\u0000-\u001f\u007f-\u009f]/.test(e.styleId)?{supported:false,code:"invalidArgs",reason:"setParagraphStyle requires a styleId of 1-128 printable characters"}:{supported:true,mutating:true};case "insertHyperlink":return e.target!==void 0?{supported:false,reason:"DocTarget addressing is not supported; a link applies at the selection"}:typeof e.href!="string"||e.href.length===0?{supported:false,code:"invalidArgs",reason:"insertHyperlink requires an href"}:{supported:true,mutating:true};case "removeHyperlink":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; unlink acts at the selection"};case "setParagraphFormat":{let t=[e.indentLeftTwips,e.indentRightTwips,e.indentFirstLineTwips];for(let r of t)if(r!=null&&(!Number.isInteger(r)||Math.abs(r)>Ud))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${Ud}`};for(let r of ["spaceBeforePt","spaceAfterPt"]){let o=e[r];if(o!=null&&(!Number.isFinite(o)||o<0||o>1584))return {supported:false,code:"invalidArgs",reason:`setParagraphFormat requires ${r} between 0 and 1584 points`}}let n=e.lineSpacing;if(n!=null){if(n.rule!=="multiple"&&n.rule!=="exact"&&n.rule!=="atLeast")return {supported:false,code:"invalidArgs",reason:"lineSpacing requires a rule of 'multiple', 'exact' or 'atLeast'"};let r=n.rule==="multiple"?n.value*240:n.value*20;if(!Number.isFinite(n.value)||n.value<=0||Math.round(r)>31680)return {supported:false,code:"invalidArgs",reason:"lineSpacing requires a positive value no taller than 1584pt"}}if(e.alignment!==void 0&&!["left","center","right","justify"].includes(e.alignment))return {supported:false,code:"invalidArgs",reason:"unknown alignment"};if(e.direction!==void 0&&!["ltr","rtl"].includes(e.direction))return {supported:false,code:"invalidArgs",reason:"unknown direction"};if(e.tabStops!==void 0){if(e.tabStops.length>64)return {supported:false,code:"invalidArgs",reason:"setParagraphFormat accepts at most 64 tab stops"};let r=new Set;for(let o of e.tabStops){if(typeof o!="object"||o===null)return {supported:false,code:"invalidArgs",reason:"a tab stop must be an object"};if(!Number.isInteger(o.positionTwips)||o.positionTwips<0||o.positionTwips>31680)return {supported:false,code:"invalidArgs",reason:"tab stop positions must be whole twips between 0 and 31680"};if(!["left","center","right","decimal"].includes(o.alignment))return {supported:false,code:"invalidArgs",reason:"unknown tab alignment"};if(o.leader!==void 0&&!["none","dot","hyphen","underscore","heavy","middleDot"].includes(o.leader))return {supported:false,code:"invalidArgs",reason:"unknown tab leader"};if(r.has(o.positionTwips))return {supported:false,code:"invalidArgs",reason:"two tab stops cannot share a position"};r.add(o.positionTwips);}}return {supported:true,mutating:true}}case "setIndent":{let t=[e.left,e.right,e.firstLine];if(t.every(n=>n===void 0))return {supported:false,reason:"setIndent requires at least one indent field"};for(let n of t)if(n!=null){if(!Number.isInteger(n))return {supported:false,reason:"indent values must be whole twips"};if(Math.abs(n)>Ud)return {supported:false,reason:`indent values must be within \xB1${Ud} twips`}}return {supported:true,mutating:true}}case "toggleList":return e.kind==="bullet"||e.kind==="ordered"?{supported:true,mutating:true}:{supported:false,reason:`list kind '${e.kind}' is not supported`};case "adjustIndent":return e.direction==="increase"||e.direction==="decrease"?{supported:true,mutating:true}:{supported:false,reason:`indent direction '${e.direction}' is not supported`};case "insertBreak":return e.kind==="line"||e.kind==="page"||e.kind==="section"||e.kind==="sectionContinuous"?{supported:true,mutating:true}:{supported:false,reason:`break kind '${e.kind}' is not supported`};case "insertText":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; text inserts at the selection"};case "deleteText":return e.target===void 0?{supported:true,mutating:true}:{supported:false,reason:"DocTarget addressing is not supported; deletion removes the selection"};case "proposeInsertion":case "proposeReplacement":{let t=e.type==="proposeInsertion"?e.text:e.replaceWith;return typeof t!="string"||t.length===0?{supported:false,code:"invalidArgs",reason:`${e.type} requires non-empty text`}:/[\r\n\v\f\u2028\u2029]/.test(t)?{supported:false,code:"invalidArgs",reason:`${e.type} requires text without a paragraph mark`}:e.author!==void 0&&e.author.trim().length===0?{supported:false,code:"invalidArgs",reason:`${e.type} requires a non-empty author`}:{supported:true,mutating:true}}case "replaceMatch":{let t=LE(e);return t?{supported:false,code:"invalidArgs",reason:t}:{supported:true,mutating:true}}case "proposeDeletion":return e.author!==void 0&&e.author.trim().length===0?{supported:false,code:"invalidArgs",reason:"proposeDeletion requires a non-empty author"}:{supported:true,mutating:true};case "setPageSetup":{let t=[e.pageWidth,e.pageHeight],n=[e.marginTop,e.marginRight,e.marginBottom,e.marginLeft];if(t.every(r=>r===void 0)&&n.every(r=>r===void 0)&&e.orientation===void 0)return {supported:false,reason:"setPageSetup requires at least one field"};for(let r of t)if(r!==void 0&&(!Number.isInteger(r)||r<1||r>63360))return {supported:false,code:"invalidArgs",reason:"page dimensions must be integer twips between 1 and 63360"};for(let r of n)if(r!==void 0&&(!Number.isInteger(r)||r<0||r>31680))return {supported:false,code:"invalidArgs",reason:"margins must be integer twips between 0 and 31680"};return e.orientation!==void 0&&e.orientation!=="portrait"&&e.orientation!=="landscape"?{supported:false,code:"invalidArgs",reason:"orientation must be 'portrait' or 'landscape'"}:e.scope!==void 0&&e.scope!=="document"&&e.scope!=="section"?{supported:false,code:"invalidArgs",reason:"scope must be 'document' or 'section'"}:{supported:true,mutating:true}}case "undo":case "redo":return {supported:true,mutating:true};case "insertTable":return Number.isInteger(e.rows)&&Number.isInteger(e.cols)&&e.rows>=1&&e.cols>=1&&e.rows<=32767&&e.cols<=63&&e.rows*e.cols<=2e4?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:`insertTable needs whole rows and cols of at least 1, at most ${32767}\xD7${63}, and at most ${2e4} cells`};case "insertToc":return {supported:true,mutating:true};case "editTextFormField":return {supported:true,mutating:false};case "refreshToc":return e.mode!==void 0&&e.mode!=="entire"&&e.mode!=="pageNumbers"?{supported:false,code:"invalidArgs",reason:"refreshToc mode must be 'entire' or 'pageNumbers'"}:e.tocId!==void 0&&(typeof e.tocId!="string"||e.tocId.length===0)?{supported:false,code:"invalidArgs",reason:"refreshToc tocId must be a non-empty string"}:{supported:true,mutating:true};case "removeToc":return e.tocId!==void 0&&(typeof e.tocId!="string"||e.tocId.length===0)?{supported:false,code:"invalidArgs",reason:"removeToc tocId must be a non-empty string"}:{supported:true,mutating:true};case "editHeaderFooter":return e.position!=="header"&&e.position!=="footer"?{supported:false,reason:"editHeaderFooter requires position 'header' or 'footer'"}:e.variant!==void 0&&e.variant!=="default"&&e.variant!=="first"&&e.variant!=="even"?{supported:false,reason:"editHeaderFooter variant must be 'default', 'first', or 'even'"}:{supported:true,mutating:true};case "exitHeaderFooter":return {supported:true,mutating:false};case "removeHeaderFooter":case "linkHeaderFooterToPrevious":case "unlinkHeaderFooterFromPrevious":return "variant"in e&&e.variant!==void 0&&e.variant!=="default"&&e.variant!=="first"&&e.variant!=="even"?{supported:false,reason:"furniture variant must be 'default', 'first', or 'even'"}:{supported:true,mutating:true};case "setHeaderFooterOptions":return e.titlePage===void 0&&e.evenAndOddHeaders===void 0&&e.headerDistanceTwips===void 0&&e.footerDistanceTwips===void 0?{supported:false,reason:"setHeaderFooterOptions requires at least one option"}:{supported:true,mutating:true};case "insertPageField":return e.field==="PAGE"||e.field==="NUMPAGES"||e.field==="SECTIONPAGES"||e.field==="PAGE_X_OF_Y"?{supported:true,mutating:true}:{supported:false,reason:"insertPageField field must be 'PAGE', 'NUMPAGES', 'SECTIONPAGES', or 'PAGE_X_OF_Y'"};case "insertNote":return e.noteKind==="footnote"||e.noteKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"insertNote noteKind must be 'footnote' or 'endnote'"};case "deleteNote":return e.noteKind==="footnote"||e.noteKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"deleteNote noteKind must be 'footnote' or 'endnote'"};case "convertNote":return e.fromKind==="footnote"||e.fromKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"convertNote fromKind must be 'footnote' or 'endnote'"};case "convertAllNotes":return e.fromKind==="footnote"||e.fromKind==="endnote"?{supported:true,mutating:true}:{supported:false,reason:"convertAllNotes fromKind must be 'footnote' or 'endnote'"};case "setNoteProperties":return e.endnote?.position==="pageBottom"?{supported:false,reason:"endnote-pageBottom"}:e.footnote!==void 0||e.endnote!==void 0?{supported:true,mutating:true}:{supported:false,reason:"setNoteProperties requires footnote and/or endnote fields"};case "selectAll":case "copy":return {supported:true,mutating:false};case "cut":return {supported:true,mutating:true};case "paste":case "pasteWithoutFormatting":{if(typeof e.text!="string")return {supported:false,code:"invalidArgs",reason:"paste requires text"};let t=e.type==="paste"?e.html:void 0;return t!==void 0&&typeof t!="string"?{supported:false,code:"invalidArgs",reason:"paste html must be a string"}:e.text===""&&(t===void 0||t==="")?{supported:false,code:"invalidArgs",reason:"there is nothing to paste"}:{supported:true,mutating:true}}case "insertRow":case "deleteRow":case "insertColumn":case "deleteColumn":case "deleteTable":case "setCellFill":case "setTableCellVerticalAlignment":case "setTableBorders":case "commitTableColumnDividerResize":case "commitTableRightEdgeResize":case "mergeCells":case "splitCell":case "toggleHeaderRow":case "setTableProperties":{let t=PE(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "selectTableRegion":return e.region==="table"?{supported:true,mutating:false}:{supported:false,reason:`selecting a table ${e.region} is not supported yet`};case "setSelection":return "range"in e&&(Iy(e.range)||ei(e.range))||"anchor"in e&&Zt(e.anchor)?{supported:true,mutating:false}:{supported:false,reason:"setSelection accepts { anchor: { paraId } }, a { range } whose from/to are paraId anchors, or a { range } carrying a semantic { anchor: { paragraphId, offset }, head } selection"};case "insertTextBox":return {supported:true,mutating:true};case "insertChart":case "setChartData":case "setChartType":case "setChartFormat":case "setChartColor":return {supported:true,mutating:true};case "insertImage":return e.data instanceof Uint8Array&&(e.mime==="image/png"||e.mime==="image/jpeg"||e.mime==="image/gif")&&Number.isFinite(e.widthPoints)&&Number.isFinite(e.heightPoints)&&e.widthPoints>0&&e.heightPoints>0?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"insertImage requires png/jpeg/gif bytes and finite dimensions"};case "replaceImage":return e.data instanceof Uint8Array?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};case "deleteImage":return {supported:true,mutating:true};case "setImageWrapType":return ["inline","square","squareLeft","squareRight","tight","through","topAndBottom","behind","inFront"].includes(e.target)?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported wrap target"};case "transformImage":return e.action==="rotateCW"||e.action==="rotateCCW"||e.action==="flipH"||e.action==="flipV"?{supported:true,mutating:true}:{supported:false,code:"invalidArgs",reason:"unsupported transform action"};case "setImagePosition":return {supported:true,mutating:true};case "setImageProperties":return {supported:true,mutating:true};case "insertBookmark":case "deleteBookmark":case "keepFirstBookmark":case "goToBookmark":return typeof e.name=="string"&&e.name.length>0?{supported:true,mutating:e.type!=="goToBookmark"}:{supported:false,code:"invalidArgs",reason:`${e.type} needs a name`};case "setWatermark":{let t=my(e.watermark);return t?{supported:false,code:"invalidArgs",reason:t}:{supported:true,mutating:true}}default:return {supported:false,reason:Py(e.type)}}}function Py(e){return `command '${e}' is not supported by the tree editor`}var Wt="comments and tracked changes require the pro review module (@docx-editor.dev/pro)",WE="realtime collaboration requires the pro collaboration module (@docx-editor.dev/pro)",Xr="suggesting mode needs an author; configure author before enabling it",L$="this document asks for tracked changes, but no author is configured",Tf="this document is protected for filling in forms, which does not track changes",Ty="this document permits editing only as tracked changes",Ef="image changes are not supported in suggesting mode",fs="this revision kind has no structural accept/reject yet",ni="this document is protected against editing; open it in Word to change that",ri="this document is protected for comments only",Cy={mode:null,rejection:null};function Ey(e,t){if(e===void 0||e==="view")return Cy;if(e==="edit")return {mode:"editing",rejection:null};let n=qE(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function qE(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:Xr}:{ok:false,code:"unsupported",reason:Wt}}function KE(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==Xr||t||n!==null||(n=globalThis.setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let a=`${Xr}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(an("suggestingNeedsAuthor",a)),r(`[@docx-editor.dev/core] ${a}`);},0));},dispose(){n!==null&&globalThis.clearTimeout(n),n=null;}}}function Oy(e){if(e.restrictedToReadOnly)return e.currentMode==="viewing"?Cy:{mode:"viewing",rejection:ni};let t=e.currentMode,n=null;e.engineAdoptedViewing&&t==="viewing"&&!e.viewOnly&&(n="editing",t="editing");let r=n===null?Cy:{mode:n,rejection:null};return e.restrictedToComments?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:ri}:r:e.restrictedToForms?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:Tf}:r:e.viewOnly||t!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?r:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:n,rejection:L$}}function UE(e){return e===null?{enter:true,rejection:null}:{enter:false,rejection:e.reason}}function jE(e,t){return t!=="viewing"&&e.restrictedToReadOnly?{ok:false,code:"locked",reason:ni}:t==="suggesting"&&e.restrictedToComments?{ok:false,code:"locked",reason:ri}:t==="suggesting"&&e.restrictedToForms?{ok:false,code:"locked",reason:Tf}:t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:Ty}}function VE(e,t,n,r){return e&&r!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(r==="suggesting"?qE(t()):null)??jE(n(),r)}function GE(e,t,n,r,o,a=false){let i=Ey(e,t),s=e==="view"?"viewing":i.mode??o,l=Oy({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:s,engineAdoptedViewing:a});l.mode!==null&&(s=l.mode);let c=jE(n,s),d=n.restrictedToReadOnly?"viewing":r;return {mode:c===null?s:d,rejection:l.rejection??c?.reason??null,configurationRejection:i.rejection}}function zE(e,t,n,r,o=false){return o?n+r:(Cm(e,t,n)?.offset??n)+r}function ps(e){if(e&&!(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")&&!e.bound&&!(e.controlType==="checkbox"||e.controlType==="picture"))return e.id}function ZE(e,t,n){return {op:"insertText",paragraphId:e.paragraphId,offset:e.offset,text:t,...n===void 0?{}:{inside:n}}}var XE=new WeakMap;function YE(e,t){XE.set(e,t);}var My=new WeakMap;function QE(e,t){let n=Uk(t);n&&My.set(e,n);}function Ay(e){return My.get(e)}var Ly="this document is protected for tracked changes; their authors cannot change",oi="this document is protected; only form fields can be filled";function Vn(e,t){if(e.type==="undo"||e.type==="redo"||e.type==="toggleDocumentProtection")return null;let n=Ff$1(t.session.currentPackage()),r=nj$1(n?.root);if(!r.enforced)return null;if(r.edit==="readOnly"||r.edit==="comments")return {ok:false,code:"locked",reason:r.edit==="comments"?ri:ni};if(r.edit==="trackedChanges"&&e.type==="setReviewChangesAuthor")return {ok:false,code:"locked",reason:Ly};if(r.edit!=="forms"||ra(e))return null;let o="structure",a,i=false;switch(e.type){case "insertText":o="text",a=e.text;break;case "paste":case "pasteWithoutFormatting":o="text",a=e.text,i=true;break;case "deleteText":case "cut":o="text";break;case "toggleMark":case "setMarkAttr":case "pasteFormatting":o="runFormat";break;case "clearFormatting":case "setAlignment":case "setParagraphDirection":case "setLineSpacing":case "setParagraphSpacing":case "setIndent":case "adjustIndent":case "toggleList":case "setParagraphStyle":case "setParagraphFormat":case "removeTabMark":o="paragraph";break;case "setPageSetup":case "setHeaderFooterOptions":case "setWatermark":case "convertAllNotes":case "insertToc":case "refreshToc":case "removeToc":case "replaceAllMatches":case "resolveAllReviewChanges":case "setReviewChangesAuthor":case "acceptRevision":case "rejectRevision":case "acceptAllRevisions":case "rejectAllRevisions":o="document";break}let s=t.state().selection,l=ce(t.session,s.head.paragraphId);if(!l)return {ok:false,code:"locked",reason:oi};let c=s.anchor.paragraphId===s.head.paragraphId&&s.anchor.offset===s.head.offset,d=o==="text"&&a!==void 0&&!cf(a).includes(`
24
+ `)&&c?ps(t.contentControls.atCaret()):void 0,u=t.state().cellSelection;return (u&&(o==="runFormat"||o==="paragraph")?[...ja$1(t.layout(),u.cellIds)].map(g=>({anchor:{paragraphId:g,offset:0},head:{paragraphId:g,offset:(Nm(l,g)??"").length}})):[s]).some(g=>cl(l,n,{selection:g,intent:o,text:a,paste:i,fieldId:XE.get(t)?.()??void 0,...d===void 0?{}:{inside:d},contentLockPolicy:My.get(t)}))?{ok:false,code:"locked",reason:oi}:null}function JE(e,t){if(e!=="locked")return e;let n=nj$1(t);return n.enforced?n.edit==="comments"?ri:n.edit==="forms"?oi:ni:"this content is locked"}function eO(e){return e!==null&&Vn({type:"resolveAllReviewChanges"},e)!==null}function tO(e,t){return ()=>e()??(t()?null:"the document is read-only")}var Fy="this content is locked",F$=new Set(["toggleMark","setMarkAttr","clearFormatting"]),Of=Number.MAX_SAFE_INTEGER;function D$(e){let t=e.state(),n=t.cellSelection;if(n)return [...ja$1(e.layout(),n.cellIds)].map(y=>({paragraphId:y,start:0,end:Of}));let{anchor:r,head:o}=t.selection;if(r.paragraphId===o.paragraphId)return r.offset===o.offset?[{paragraphId:o.paragraphId,start:o.offset,end:o.offset}]:[{paragraphId:r.paragraphId,start:Math.min(r.offset,o.offset),end:Math.max(r.offset,o.offset)}];let a=Ot(e.session,r.paragraphId,{kind:"body"}),i=e.session.paragraphIdsIn(a),s=i.indexOf(r.paragraphId),l=i.indexOf(o.paragraphId);if(s===-1||l===-1)return [{paragraphId:r.paragraphId,start:0,end:Of},{paragraphId:o.paragraphId,start:0,end:Of}];let[c,d]=s<l?[r,o]:[o,r],[u,f]=s<l?[s,l]:[l,s],p=i.slice(u,f+1).map((y,h,b)=>({paragraphId:y,start:h===0?c.offset:0,end:h===b.length-1?d.offset:Of})),g=p[p.length-1];return g&&g.end===0?p.slice(0,-1):p}function N$(e){return sc$1(e.root).some(t=>wc$2(qc$1(t.node).lock))}function nO(e,t,n){if(!F$.has(e.type))return null;let r=e.type==="clearFormatting",o=t.editingMode()==="suggest"&&!!t.author()?.trim()&&!t.session.trackingSettings().doNotTrackFormatting,a=n?.allowFormattingInLockedContent===true&&!o,{selection:i,cellSelection:s}=t.state(),l=!s&&i.anchor.paragraphId===i.head.paragraphId&&i.anchor.offset===i.head.offset;if(a&&!r&&!l)return null;let c={ok:false,code:"locked",reason:Fy};for(let d of D$(t)){let u=ce(t.session,d.paragraphId)??t.session.part();if(!N$(u))continue;let f=eb$1(u,d.paragraphId);if(!f||f.kind!=="paragraph")continue;if(Oh$1(u,d.paragraphId).content)return c;if(a&&!l)continue;let p=sc$1(f);if(p.length===0)continue;let g=Ii(f),y=d.start===d.end;for(let h of p){let b=g.spanOf(h.node);if(!b||!(y?b.start<d.start&&d.start<b.end:b.end>d.start&&b.start<d.end))continue;let S=sm$1(u,h.node.id).map(x=>qc$1(x).lock);if(wc$2(vc$1(S)))return c}}return null}var Dy="this content is locked; only alignment, indents, spacing, and line and page breaks can change",H$=new Set(["setAlignment","setParagraphDirection","setLineSpacing","setParagraphSpacing","setIndent","adjustIndent","toggleList","setParagraphStyle","setParagraphFormat"]),_$=["direction","contextualSpacing","tabStops"];function B$(e){switch(e.type){case "setAlignment":return "alignment";case "setLineSpacing":case "setParagraphSpacing":case "setIndent":return "placement";case "adjustIndent":return "indentStep";case "setParagraphDirection":case "toggleList":case "setParagraphStyle":return "locked";case "setParagraphFormat":{if(_$.some(a=>e[a]!==void 0))return "locked";let{type:t,alignment:n,...r}=e;return n!==void 0&&Object.values(r).every(a=>a===void 0)?"alignment":"placement"}}}function $$(e){let t=e.state(),n=t.cellSelection;if(n)return [...ja$1(e.layout(),n.cellIds)];let{anchor:r,head:o}=t.selection;if(r.paragraphId===o.paragraphId)return [o.paragraphId];let a=Ot(e.session,r.paragraphId,{kind:"body"}),i=e.session.paragraphIdsIn(a),s=i.indexOf(r.paragraphId),l=i.indexOf(o.paragraphId);return s===-1||l===-1?[r.paragraphId,o.paragraphId]:i.slice(Math.min(s,l),Math.max(s,l)+1)}var rO=new WeakMap;function W$(e){let t=rO.get(e.root);if(t)return t;let n=new Set;for(let r of sc$1(e.root)){if(!wc$2(qc$1(r.node).lock))continue;let o=[r.node];for(;o.length>0;){let a=o.pop();if(a.kind!=="textValue"){a.kind==="paragraph"&&n.add(a.id);for(let i of a.children)o.push(i);}}}return rO.set(e.root,n),n}var oO=new WeakMap;function q$(e){let t=oO.get(e);if(t)return t;let n=new Set;for(let r of e.pages)for(let o of Xa$1(r))if(o.marker){n.add(o.paragraphId);for(let a of ab$1(o))n.add(a);}return oO.set(e,n),n}function K$(e,t){let n=eb$1(e,t);if(n?.kind!=="paragraph")return false;let r=ei$1(n,"paragraphProperties","pPr");return r!==void 0&&r.kind!=="textValue"&&r.children.some(o=>o.kind!=="textValue"&&o.localName==="pPrChange")}function U$(e,t,n){let r=gi$1(e,t),o=r.filter(a=>a.localName!==n);return o.length===r.length?[...r,{localName:n}]:o}function j$(e,t,n,r){let o=r!==void 0?{revision:{author:r}}:{};return n==="alignment"?{op:"setParagraphProperties",paragraphId:t,properties:[...gi$1(e,t).filter(a=>a.localName!=="jc"),{localName:"jc",attributes:{val:"center"}}],...o}:{op:"setParagraphProperties",paragraphId:t,properties:U$(e,t,n==="placement"?"ind":"contextualSpacing"),...n==="placement"?o:{}}}function aO(e,t,n){if(!H$.has(e.type))return null;let r=B$(e),o=t.author()?.trim(),a=t.editingMode()==="suggest"&&o&&!t.session.trackingSettings().doNotTrackFormatting?o:void 0,i=t.state().selection.head.paragraphId,s=ce(t.session,i)??t.session.part(),l=W$(s);if(l.size===0)return null;let c=r==="indentStep"?q$(t.layout()):null;for(let d of $$(t)){if(!l.has(d))continue;let u=r!=="indentStep"?r:c?.has(d)?"locked":"placement";if(u!=="locked"&&(a===void 0||!K$(s,d)))continue;if(En$1(s,j$(s,d,u,a),{contentLockPolicy:n})==="locked")return {ok:false,code:"locked",reason:u==="locked"?Dy:Fy}}return null}function iO(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function sO(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function lO(e){return e.widthEmu!==void 0||e.heightEmu!==void 0||e.alt!==void 0||e.title!==void 0||e.description!==void 0||e.hyperlink!==void 0||e.crop!==void 0||e.wrap!==void 0||e.resetToNaturalSize===true||rn(e)}function cO(e,t){for(let n of e.pages){let r=V$(n.fragments,t);if(r!==void 0)return r}return null}function V$(e,t){for(let n of e)if(n.kind==="paragraph")for(let r of n.lines)for(let o of r.drawings??[]){if(o.drawingNodeId!==t)continue;if(n.fragmentIndex!==0||n.positionedFrame||n.outOfFlow)return null;let a=Math.round(o.x*12700),i=Math.round((o.y-n.box.y)*12700);return !Number.isFinite(a)||!Number.isFinite(i)?null:Object.freeze({mode:"frame",horizontalEmu:a,verticalEmu:i,relativeToH:"margin",relativeToV:"paragraph"})}}var dO=12700,G$=new Set(["page","margin","topMargin","bottomMargin","insideMargin","outsideMargin"]);function Ny(e,t){if(e.kind==="drawing"&&t.add(e.id),"children"in e)for(let n of e.children)Ny(n,t);return t}function z$(e,t){let n=e.session.part(),r=fb$1(n,t.id);if(!r||r.kind!=="run")return false;let o=false,a=i=>{o||(i.kind!=="textValue"&&i.localName==="txbxContent"?o=true:"children"in i&&i.children.forEach(a));};return a(t),!o}function Z$(e,t){let n=e.layout().pages;for(let r of n){let o=r.anchoredDrawings?.find(a=>a.drawingNodeId===t);if(o)return {page:r,record:o}}return null}function X$(e,t){return t.mode!=="frame"||t.verticalEmu===void 0||t.relativeToV!==void 0&&t.relativeToV!==e.verticalFrame?null:e.verticalFrameOrigin+t.verticalEmu/dO}function Y$(e,t,n){if(e.storyScope().kind!=="body"||e.editingMode()!=="edit")return null;let r=Z$(e,t);if(!r)return null;let{page:o,record:a}=r;if(a.horizontalFrame==="character"||a.verticalFrame==="line")return null;let i=o.fragments.filter(y=>y.kind==="paragraph"&&!y.positionedFrame&&!y.outOfFlow);if(!i.some(y=>y.kind==="paragraph"&&y.paragraphId===a.anchorParagraphId))return null;let s=X$(a,n);if(s===null||!Number.isFinite(s))return null;let l=i.find(y=>y.box.y<=s&&s<y.box.y+y.box.height)??(s<(i[0]?.box.y??0)?i[0]:i[i.length-1]);if(!l||l.kind!=="paragraph"||l.paragraphId===a.anchorParagraphId||l.fragmentIndex!==0)return null;let c=e.session.part(),d=eb$1(c,t);if(!d||d.kind!=="drawing"||!z$(e,d))return null;let u=a.verticalFrame==="paragraph"?Math.round((s-l.box.y)*dO):G$.has(a.verticalFrame)?n.verticalEmu:void 0;if(u===void 0)return null;let f=0,p=Dn(d,{...n,verticalEmu:u},()=>`reanchor-${++f}`);if(!p)return null;let g=eb$1(c,l.paragraphId);return g?{ops:[{op:"deleteDrawing",drawingNodeId:t},{op:"insertDrawing",paragraphId:l.paragraphId,offset:0,drawing:p}],paragraphId:l.paragraphId,previousDrawingIds:Ny(g,new Set)}:null}function Q$(e,t){let n=eb$1(e.session.part(),t.paragraphId);if(!n)return null;for(let r of Ny(n,new Set))if(!t.previousDrawingIds.has(r))return r;return null}function uO(e,t,n){let r=Y$(e,t,n);if(!r||e.applyDrawingOps(r.ops).rejected)return false;let o=Q$(e,r);return o&&e.selectDrawing(o,r.paragraphId),true}function J$(e,t,n=e.extentEmu){let r=e.picture?.transform.rotationDegrees;return e.kind==="inline"==(t==="inline")||r===void 0||Math.abs(r%180)!==90||n.cx===n.cy?null:{cx:n.cy,cy:n.cx}}function fO(e,t,n,r,o=e.drawingNodeId){let a=J$(e,t);if(!a)return;let i=n.findIndex(l=>l.op==="resizeDrawing"),s=n[i];s?.op==="resizeDrawing"?n[i]={...s,extentEmu:{cx:r?.widthEmu!==void 0||r?.resetToNaturalSize?s.extentEmu.cx:a.cx,cy:r?.heightEmu!==void 0||r?.resetToNaturalSize?s.extentEmu.cy:a.cy}}:n.push({op:"resizeDrawing",drawingNodeId:o,extentEmu:a});}var pO=new WeakMap;function mO(e,t){pO.set(e,t);}function gO(e,t,n){pO.get(e)?.(t,n);}var eW="this drawing is a chart; only delete applies, and it removes the whole chart",tW="this drawing is a chart; only its size, position, wrap and alt text change";function Hy(e,t,n){let r=ce(e.session,t)??e.session.part(),o=wn(r,t);return o?{chart:xn(o,"resizeDrawing")?"frame":"locked",locks:yn(o.chartDrawing)??n.locks}:{chart:"none",locks:n.locks}}function nW(e){return e.type==="replaceImage"||e.type==="transformImage"?true:e.type!=="setImageProperties"?false:e.crop!==void 0||e.resetToNaturalSize===true||e.borderWidthEmu!==void 0||e.borderColor!==void 0}function _y(e,t,n){if(t.type==="deleteImage")return null;let r=ce(e.session,n)??e.session.part(),o=wn(r,n);return o?xn(o,"resizeDrawing")?nW(t)?{ok:false,code:"unsupported",reason:tW}:null:{ok:false,code:"unsupported",reason:eW}:null}function By(e,t){return e===t?true:!e||!t?false:e.id===t.id&&e.kind===t.kind&&e.widthEmu===t.widthEmu&&e.heightEmu===t.heightEmu&&e.crop.left===t.crop.left&&e.crop.top===t.crop.top&&e.crop.right===t.crop.right&&e.crop.bottom===t.crop.bottom&&e.rotationDegrees===t.rotationDegrees&&e.wrap===t.wrap&&e.name===t.name&&e.title===t.title&&e.description===t.description&&e.hyperlink===t.hyperlink&&e.hidden===t.hidden&&e.resourceStatus===t.resourceStatus&&e.canResize===t.canResize&&e.canMove===t.canMove&&e.canChangeWrap===t.canChangeWrap&&e.canCrop===t.canCrop&&e.locks.select===t.locks.select&&e.locks.move===t.locks.move&&e.locks.resize===t.locks.resize&&e.locks.changeAspect===t.locks.changeAspect&&(e.position?.mode??"frame")===(t.position?.mode??"frame")&&(e.position?.horizontalEmu??null)===(t.position?.horizontalEmu??null)&&(e.position?.verticalEmu??null)===(t.position?.verticalEmu??null)&&(e.position?.relativeToH??null)===(t.position?.relativeToH??null)&&(e.position?.relativeToV??null)===(t.position?.relativeToV??null)&&(e.intrinsic?.pixelWidth??null)===(t.intrinsic?.pixelWidth??null)&&(e.intrinsic?.pixelHeight??null)===(t.intrinsic?.pixelHeight??null)&&(e.intrinsic?.dpiX??null)===(t.intrinsic?.dpiX??null)&&(e.intrinsic?.dpiY??null)===(t.intrinsic?.dpiY??null)}function rW(e){return [e.left,e.top,e.right,e.bottom]}function $y(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function oW(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function rc(e){return Math.round(e*1e3)}function oc(e){return e/1e3}function Wy(e){return Object.freeze({left:rc(e.left),top:rc(e.top),right:rc(e.right),bottom:rc(e.bottom)})}function aW(e){return Object.freeze({left:oc(e.left),top:oc(e.top),right:oc(e.right),bottom:oc(e.bottom)})}function qy(e){return rW(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var Mf=12700;function Dt(e){return Math.round(e*12700)}function ai(e){return e/12700}function hO(e,t,n,r,o,a){let i=ai(e),s=ai(t),l=i/s,c=n.includes("e")?r:n.includes("w")?-r:0,d=n.includes("s")?o:n.includes("n")?-o:0;if(i=Math.max(1,i+c),s=Math.max(1,s+d),a)if(n.length===2){let f=Math.max(i/ai(e),s/ai(t));i=Math.max(1,ai(e)*f),s=Math.max(1,i/l);}else n==="e"||n==="w"?s=Math.max(1,i/l):i=Math.max(1,s*l);return Object.freeze({cx:Dt(i),cy:Dt(s)})}function Af(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+Dt(t),verticalEmu:(e.verticalEmu??0)+Dt(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+Dt(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+Dt(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}var iW=new Set(["insertImage","replaceImage"]),sW=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function Ky(e,t,n){return e.accessibility.hidden||n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function bO(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&Ky(o,n,r))return o;return null}function lW(e,t,n,r){if(!r)return null;for(let o of Wb$1(e.layout(),t)){let a=bO(o.line,t,n,r);if(a)return a}return null}function cW(e,t,n,r){let o=e.layout();for(let a of o.pages){for(let i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&Ky(i,n,r))return i;for(let i of [a.header,a.footer])if(i){for(let s of i.anchoredDrawings??[])if(s.anchorParagraphId===t&&Ky(s,n,r))return s}}return null}function vO(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function tn(e){if(!e)return null;let t=e.drawingSelectionIntent();if(t.kind==="none")return null;let{anchor:n,head:r}=e.state().selection;if(n.paragraphId!==r.paragraphId||n.offset!==r.offset)return null;let o=Xb$1(e.layout(),n.paragraphId,n.offset),a=t.kind==="pointer"?t.drawingNodeId:null;return bO(o,n.paragraphId,n.offset,a)??lW(e,n.paragraphId,n.offset,a)??cW(e,n.paragraphId,n.offset,a)}function jy(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=eb$1(r,t.drawingNodeId);return o?o.kind!=="drawing"?nn(r,t.drawingNodeId):Ze$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:Te$1,limits:Se,resolveRelationship:Ve$1(e.session.currentPackage(),t.ownerPartName)}):null}function xO(e){if(e.kind!=="anchored"||!e.position)return null;let t=e.position;return e.anchor?.simplePos?Object.freeze({mode:"simple",horizontalEmu:t.simplePosition.xEmu,verticalEmu:t.simplePosition.yEmu}):Object.freeze({mode:"frame",...t.horizontal.offsetEmu!==null?{horizontalEmu:t.horizontal.offsetEmu}:{},...t.vertical.offsetEmu!==null?{verticalEmu:t.vertical.offsetEmu}:{},relativeToH:t.horizontal.relativeFrom,relativeToV:t.vertical.relativeFrom})}function dW(e){let t=e.resource;return t.kind!=="ready"?null:Object.freeze({pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,dpiX:t.dpiX,dpiY:t.dpiY})}function SO(e,t){let n=t==="locked"?{resize:true,move:true,changeAspect:true}:e.locks,r=e.kind==="inline"&&e.textboxStory!==null;return Object.freeze({canResize:!n.resize&&!e.hidden,canMove:!r&&!n.move&&!e.hidden,canChangeWrap:(t==="frame"||t==="none"&&e.picture!==null)&&!n.move&&!e.hidden,canCrop:t==="none"&&e.picture!==null&&!n.resize&&!n.changeAspect&&!e.hidden})}function uW(e){return e.kind==="inlineDrawing"?"inline":e.wrap}var wO=e=>e.placeholderGraphicKind===null||!!e.textboxStory||e.placeholderGraphicKind==="chart"||!!e.chart;function Yr(e){let t=tn(e);if(!t||!wO(t))return null;let n=e?jy(e,t):null;if(!n)return null;let{chart:r,locks:o}=Hy(e,t.drawingNodeId,n);if(n.hidden||o.select)return null;let a=t.transform;return Object.freeze({id:t.drawingNodeId,kind:n.kind,widthEmu:n.extentEmu.cx,heightEmu:n.extentEmu.cy,crop:$y(t.crop),rotationDegrees:a.rotationDegrees,wrap:uW(t),position:xO(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:o,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:dW(t),...SO(n,r)})}function Vy(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function kO(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function Gy(e){return Vy(e)!==void 0||kO(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function zy(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=kO(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=Vy(t),i=Yr(r);if(a!==void 0&&(!i||i.id!==a))return {ok:false,code:"notFound",reason:"stale drawing selection"};if(t.type==="setImageProperties"&&t.selectionParagraphId!==void 0&&t.selectionOffset!==void 0){let{anchor:s,head:l}=r.state().selection;if(s.paragraphId!==t.selectionParagraphId||s.offset!==t.selectionOffset||l.paragraphId!==t.selectionParagraphId||l.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return ms(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function oa(e,t){let n=Yr(e),r=Vy(t);return r?!n||n.id!==r?{ok:false,code:"notFound",reason:"stale drawing selection"}:{id:r}:n?{id:n.id}:{ok:false,code:"notFound",reason:"no drawing is selected"}}function fW(e){return e.rejected?{ok:false,code:"invalidArgs",reason:e.reason==="drawing-locked"?"the drawing is locked":e.reason==="unknown-drawing"?"stale drawing selection":typeof e.reason=="string"?e.reason:"the image change was refused"}:null}function yO(e,t,n){if(n==="inline")return [];let r=cO(e.layout(),t);return r?[{op:"positionDrawing",drawingNodeId:t,position:r}]:[]}function Uy(e,t,n,r){let o=tn(e),a=o&&jy(e,o);a&&fO(a,t,n,r,o.drawingNodeId);}function Lf(e,t){return fW(e.applyDrawingOps(t))}function pW(e){if(!e.intrinsic)return null;let t=Math.round(e.intrinsic.pixelWidth*914400/e.intrinsic.dpiX),n=Math.round(e.intrinsic.pixelHeight*914400/e.intrinsic.dpiY);return !Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:{cx:t,cy:n}}function IO(e,t){return t?.position?.mode==="simple"?Object.freeze({mode:"simple",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu}:{}}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}function ac(e){return sW.has(e.type)}function mW(e){return iW.has(e.type)}function RO(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function PO(e,t){if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=e.editingMode();return n==="view"?{ok:false,code:"locked",reason:"the document is open for viewing"}:n==="suggest"&&t==="replaceImage"?{ok:false,code:"invalidArgs",reason:Ef}:null}function ic(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=Yr(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function ms(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};if(e.mountGeneration!==t.mountGeneration)return {ok:false,code:"notFound",reason:"the editor is no longer attached"};let{anchor:o,head:a}=r.state().selection;if(o.paragraphId!==t.selectionParagraphId||o.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(o.paragraphId!==a.paragraphId||o.offset!==a.offset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(n?.requireDrawing){let i=Yr(r),s=n.drawingNodeId??t.drawingNodeId;if(!i||!s||i.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}var Zy="a picture is selected; place the caret in text to insert a picture";function ii(e,t){if(!ac(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=Vn(e,t);if(n)return n;if(e.type==="insertImage")return tn(t)?{ok:false,code:"invalidArgs",reason:Zy}:!(e.data instanceof Uint8Array)||e.data.byteLength===0?{ok:false,code:"invalidArgs",reason:"insertImage requires image bytes"}:!Number.isFinite(e.widthPoints)||!Number.isFinite(e.heightPoints)?{ok:false,code:"invalidArgs",reason:"insertImage requires finite dimensions"}:e.widthPoints<=0||e.heightPoints<=0?{ok:false,code:"invalidArgs",reason:"insertImage dimensions must be positive"}:null;let r=tn(t);if(r&&"textboxStory"in r&&r.textboxStory&&(e.type==="replaceImage"||e.type==="transformImage"||e.type==="setImageProperties"&&e.hyperlink!==void 0))return {ok:false,code:"unsupported",reason:"this operation is not supported for textboxes"};if(e.type==="replaceImage"){if(!(e.data instanceof Uint8Array)||e.data.byteLength===0)return {ok:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};let c=oa(t,e);return "ok"in c?c:_y(t,e,c.id)}let a=oa(t,e);if("ok"in a)return a;let i=_y(t,e,a.id);if(i)return i;let s=Yr(t);if(!s)return {ok:false,code:"notFound",reason:"no drawing is selected"};let l=e.type==="setImageWrapType"?e.target:e.type==="setImageProperties"?e.wrap:void 0;if(l!==void 0&&s.locks.resize){let c=[];if(Uy(t,l,c),c.length)return {ok:false,code:"locked",reason:"the drawing size is locked"}}switch(e.type){case "deleteImage":return s.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return s.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return s.locks.changeAspect||s.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!s.canMove||s.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!sO(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let c=s.position?.mode??"frame";return tn$1(e,c)?on$1(IO(e,s))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(iO(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!lO(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!s.intrinsic)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};if(e.widthEmu!==void 0&&(!Number.isFinite(e.widthEmu)||e.widthEmu<=0))return {ok:false,code:"invalidArgs",reason:"widthEmu must be a positive finite number"};if(e.heightEmu!==void 0&&(!Number.isFinite(e.heightEmu)||e.heightEmu<=0))return {ok:false,code:"invalidArgs",reason:"heightEmu must be a positive finite number"};if(e.widthEmu!==void 0&&!s.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!s.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!qy(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!s.canCrop)return {ok:false,code:"locked",reason:"crop cannot be changed on this drawing"};if(e.hyperlink!==void 0&&e.hyperlink!==null&&!U(e.hyperlink).ok)return {ok:false,code:"invalidArgs",reason:"unsafe hyperlink URL"};if(e.wrap!==void 0&&!s.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(rn(e)){if(!s.canMove||s.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let d=s.position?.mode??"frame";if(!tn$1(e,d))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!on$1(sn(e,s)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function Xy(e,t){let n=PO(t,e.type);if(n)return n;let r=ii(e,t);return r||{ok:true}}function CO(e,t){let n=ii(e,t);return n||RO(e)}function Yy(e,t,n){if(mW(t))return RO(t);let r=n&&Gy(t)?ic(n):null;if(r&&n){let o=zy(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=oa(e,t);if("ok"in o)return o;let a=e.deleteImage(o.id);return a.ok?null:{ok:false,code:"invalidArgs",reason:a.detail??a.reason??"deleteImage was refused"}}case "setImageWrapType":{let o=oa(e,t);if("ok"in o)return o;let a=[];return Uy(e,t.target,a),Lf(e,[...a,{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target},...yO(e,o.id,t.target)])}case "transformImage":{let o=oa(e,t);return "ok"in o?o:Lf(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=oa(e,t);if("ok"in o)return o;let a=Yr(e),i=IO(t,a);return uO(e,o.id,i)?null:Lf(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=oa(e,t);if("ok"in o)return o;let a=Yr(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let c=pW(a);if(!c)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:c});}else (t.widthEmu!==void 0||t.heightEmu!==void 0)&&i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:{cx:t.widthEmu??a.widthEmu,cy:t.heightEmu??a.heightEmu}});t.crop!==void 0&&i.push({op:"cropDrawing",drawingNodeId:o.id,crop:Wy(t.crop)});let s=t.title??t.alt,l=t.description??t.alt;if((s!==void 0||l!==void 0)&&i.push({op:"setDrawingMetadata",drawingNodeId:o.id,title:s??a.title,description:l??a.description}),t.wrap!==void 0&&(Uy(e,t.wrap,i,t),i.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),i.push(...yO(e,o.id,t.wrap))),rn(t)){let c=sn(t,a);i.push({op:"positionDrawing",drawingNodeId:o.id,position:c});}if(t.hyperlink!==void 0){let c=e.applyImageProperties({drawingNodeId:o.id,ops:i,hyperlink:t.hyperlink});return c.ok?null:{ok:false,code:"invalidArgs",reason:c.detail??c.reason??"setImageProperties was refused"}}return i.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:Lf(e,i)}default:return null}}function gW(e,t,n,r,o){let a=se(e.sectionPropertiesAt(t)),i=a.width-a.margin.left-a.margin.right,s=he(a),l=a.height-s.top-s.bottom,c=Xb$1(e.layout(),t,n),d=c&&c.box.width>0?Math.min(c.box.width,i):i,u=Math.min(1,d/r,l/o);return u>=1?{widthPoints:r,heightPoints:o}:{widthPoints:r*u,heightPoints:o*u}}async function Qy(e,t){let n=await hW(e,t);return gO(e,t,n),n}async function hW(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=PO(n,t.type);if(r)return r;let o=ii(t,n);if(o)return o;let a=ic(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:u}=n.state().selection,f=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let p=gW(n,u.paragraphId,u.offset,t.widthPoints,t.heightPoints),g=await n.insertImage({paragraphId:u.paragraphId,offset:u.offset,bytes:t.data,mime:t.mime,widthPoints:p.widthPoints,heightPoints:p.heightPoints,expectedPackageRevision:f,commitGuard:()=>ms(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),y=ms(e,a);return y||(g.ok?{ok:true,changed:g.change!==null}:{ok:false,code:"invalidArgs",reason:g.detail==="stale-package-epoch"?"stale package revision":g.detail??g.reason??"insertImage was refused"})}let i=oa(n,t);if("ok"in i)return i;let s=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let l=t.mime??"image/png",c=await n.replaceImage(i.id,t.data,l,{expectedPackageRevision:s,commitGuard:()=>ms(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),d=ms(e,a,{requireDrawing:true,drawingNodeId:i.id});return d||(c.ok?{ok:true,changed:c.change!==null}:{ok:false,code:"invalidArgs",reason:c.detail==="stale-package-epoch"?"stale package revision":c.detail??c.reason??"replaceImage was refused"})}var yW=1,bW=10;function vW(e,t,n){if(!t||t.hidden||!wO(e))return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let r=SO(t,n);return Object.freeze({canResize:r.canResize,canMove:r.canMove,aspectLocked:n==="locked"||t.locks.changeAspect})}function xW(e){if(!e)return null;let t=e.activeScope(),{anchor:n,head:r}=e.state().selection;if(t.kind!=="frame"&&(n.paragraphId!==r.paragraphId||n.offset!==r.offset))return null;let o=t.kind==="frame"?null:tn(e);if(t.kind!=="frame"&&!o)return null;let a=e.layout(),i=t.kind==="frame"?RT(a,t,e.currentPage("caret")-1):null,s=t.kind==="frame"?i?.record:o;if(!s||s.accessibility.hidden)return null;let l=i??Te(a,s.drawingNodeId);if(!l)return null;let c=jy(e,s),d=c?Hy(e,s.drawingNodeId,c):null,u=d!==null&&!d.locks.select;if(!u&&t.kind!=="frame")return null;let f=u?vW(s,c,d.chart):{canResize:false,canMove:false,aspectLocked:true},g=e.editingMode()!=="view"&&e.session.editable?f:{...f,canResize:false,canMove:false},y=s.kind==="anchoredDrawing"?Object.freeze({x:s.horizontalFrameOrigin+l.x-s.paintBounds.x,y:s.verticalFrameOrigin+l.y-s.paintBounds.y}):null;return Object.freeze({id:s.drawingNodeId,textbox:"textboxStory"in s&&!!s.textboxStory,...PT(s,ce(e.session,s.drawingNodeId)??e.session.part()),pageIndex:l.pageIndex,x:l.x,y:l.y,width:l.width,height:l.height,kind:s.kind==="inlineDrawing"?"inline":"anchored",widthEmu:c?.extentEmu.cx??Dt(l.width),heightEmu:c?.extentEmu.cy??Dt(l.height),position:c?xO(c):null,anchorFrameOrigin:y,transform:s.transform,...g})}function SW(e,t){let n=e.surface;return n?n.publishedLayout().revision!==t.layoutRevision?{ok:false,code:"notFound",reason:"stale layout revision"}:n.session.packageRevision()!==t.packageRevision?{ok:false,code:"notFound",reason:"stale package revision"}:ms(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}var Jy="suggesting cannot move a table; stop suggesting to move it",eb="suggesting cannot change a form field checkbox or dropdown; stop suggesting to change it",tb="suggesting cannot delete a whole table; stop suggesting to delete it, or delete its rows one at a time";function wW(e){return t=>{let n=ce(e,t);return n!==null&&eb$1(n,t)?.kind==="table"}}function nb(e,t){return n=>{let r=t?.trim()?ce(e,n):null;return r!==null&&an$1(r.root,n,t)}}function TO(e,t,n){return rb(n,wW(e),nb(e,t))}function rb(e,t,n=()=>false){if(e.some(a=>a.op==="deleteNote"))return "suggesting cannot delete a note outright; strike its reference to propose the deletion";let r=a=>a.op==="removeContentControl"&&a.keepContent===false;if(e.some(r))return "suggesting cannot remove a content control outright";if(e.some(a=>a.op==="removeToc"))return "suggesting cannot remove a table of contents outright";let o=a=>(a.op==="mergeTableCells"||a.op==="splitTableCell")&&!n(a.tableId);return e.some(o)?nE:e.some(a=>a.op==="deleteBlock"&&t(a.blockId))?tb:e.some(a=>a.op==="moveTable")?Jy:e.some(a=>a.op==="setLegacyCheckbox"||a.op==="setLegacyDropdown")?eb:null}function ob(e,t){for(let n of [e.footnotes,e.endnotes]){let r=n?.notes.find(o=>Ka$2(o.fragments).some(a=>a.paragraphId===t));if(r)return r}}function sc(e,t){for(let n of [e.header,e.footer]){if(!n)continue;if(Ka$2(n.fragments).some(o=>o.paragraphId===t))return n.box}return ob(e,t)?.box??e.contentBox}var kW={empty:"a bookmark needs a name",tooLong:"a bookmark name has at most 40 characters",invalidStart:"a bookmark name starts with a letter",invalidCharacter:"a bookmark name holds only letters, digits and underscores"};function ab(e){let t=_i(e);return t?kW[t]:e.startsWith("_")?"a bookmark name starts with a letter":null}var EO=new WeakMap;function IW(e){let t=EO.get(e);return t||(t=bj$1(e),EO.set(e,t)),t}function RW(e,t){return e.kind==="body"?"body":e.kind==="notesPart"?e.noteKind:t.root.localName==="ftr"?"footer":"header"}function OO(e){return e.kind==="body"?"body":e.kind==="headerFooter"?"headerFooter":"note"}function LO(e){let t=e.options.showBookmarks===true,n=null;e.options.bookmarkMarks?.onChange(()=>{t&&n?.isConnected&&e.repaint();});let r=null,o=()=>{let c=e.session.storyParts();if(r?.parts.length===c.length&&r.parts.every((u,f)=>u===c[f]))return r.entries;let d=[];for(let u of c){let f=Zh(e.session,u.name,{kind:"body"}),p=RW(f,u);for(let g of IW(u))d.push({record:g,scope:f,partName:u.name,place:p});}return r={parts:c,entries:d},d},a=c=>{let d=aj$1(c);return o().find(u=>aj$1(u.record.name)===d)??null},i=(c,d,u=[])=>{let f=false;return e.commit(()=>(f=e.session.applyTreeOps([c],void 0,void 0,d,{packageEdits:u}).committed,f)),f},s=c=>ab(c)??e.writeRefusal(),l=()=>{let c=e.orderedRange().from,d=JSON.stringify(e.storyScope()),u,f=g=>(u??=new Map(e.session.paragraphIdsIn(e.storyScope()).map((y,h)=>[y,h]))).get(g)??-1,p=(g,y)=>g===c.paragraphId?[0,y-c.offset]:[f(g)-f(c.paragraphId),0];return (g,y)=>{if(JSON.stringify(y)!==d)return false;let[h,b]=p(g.start.paragraphId,g.start.offset),[v,S]=p(g.end.paragraphId,g.end.offset),x=h<0||h===0&&b<=0,k=v>0||v===0&&S>=0;return x&&k}};return {list(){let c=l(),d=new Map;for(let{record:p}of o()){let g=aj$1(p.name);d.set(g,(d.get(g)??0)+p.copies);}let u=new Set,f=[];for(let{record:p,scope:g,place:y}of o()){let h=aj$1(p.name);u.has(h)||(u.add(h),f.push(Object.freeze({name:p.name,hidden:p.hidden,story:OO(g),place:y,order:f.length,empty:p.start.paragraphId===p.end.paragraphId&&p.start.offset===p.end.offset,atSelection:c(p,g),duplicates:(d.get(h)??1)-1})));}return f},insertRefusal:s,insert(c){if(s(c))return false;let d=e.storyScope(),u=e.orderedRange(),f=aj$1(c),p=new Set(o().filter(g=>aj$1(g.record.name)===f&&JSON.stringify(g.scope)!==JSON.stringify(d)).map(g=>g.partName));return i({op:"insertBookmark",name:c,start:{paragraphId:u.from.paragraphId,offset:u.from.offset},end:{paragraphId:u.to.paragraphId,offset:u.to.offset}},d,[...p].map(g=>y=>Qk(y,g,c)))},remove(c){let d=a(c);if(!d||e.writeRefusal()!==null)return false;let u=aj$1(c),f=new Set(o().filter(p=>aj$1(p.record.name)===u&&p.partName!==d.partName).map(p=>p.partName));return i({op:"deleteBookmark",name:c},d.scope,[...f].map(p=>g=>Qk(g,p,c)))},keepFirst(c){let d=a(c);if(!d||e.writeRefusal()!==null)return false;let u=aj$1(c),p=[...new Set(o().filter(y=>aj$1(y.record.name)===u&&y.partName!==d.partName).map(y=>y.partName))].map(y=>h=>Qk(h,y,c));if(d.record.copies>1)return i({op:"deleteBookmark",name:c,keepFirst:true},d.scope,p);if(p.length===0)return false;let g=false;return e.commit(()=>(g=e.session.applyTreeOps([],void 0,void 0,d.scope,{packageEdits:p}).committed,g)),g},writeRefusal:()=>e.writeRefusal(),goTo(c){let d=a(c);if(!d)return false;let{start:u,end:f}=d.record,p=e.goToPosition(u,{orShow:true,center:true});return p?(p===true&&e.setSelection({anchor:u,head:f}),true):false},shown:()=>t,setShown(c){c!==t&&(e.beforeChange(),t=c,e.repaint());},paint(c){if(n=c.layer,!t){c.layer.replaceChildren();return}let d=e.options.bookmarkMarks?.current()??{};c.layer.classList.toggle("docx-bookmark-overlay--print",d.print===true);let u=d.include??"visible",f=[],p=new Set;for(let{record:g,scope:y,partName:h}of o()){let b=aj$1(g.name);if(p.has(b))continue;p.add(b);let v={name:g.name,hidden:g.hidden,story:OO(y)};if(u==="visible"?g.hidden:u!=="all"&&!u(v))continue;let S=g.start.paragraphId===g.end.paragraphId&&g.start.offset===g.end.offset,x=y.kind==="headerFooter"?h:void 0;if(S){f.push({...v,edge:"point",...g.start,repeats:x});continue}f.push({...v,edge:"start",...g.start,repeats:x},{...v,edge:"end",...g.end,repeats:x});}CW(c,f,d.decorate,e.options.bookmarkMarks?.reportError);}}}var MO=new WeakMap,AO=new WeakSet;function PW(e){AO.has(e)||(AO.add(e),e.addEventListener("mousedown",t=>{let r=t.target?.localName;r==="input"||r==="select"||r==="textarea"||t.preventDefault();}));}function CW(e,t,n,r){let{layer:o,layout:a,scale:i}=e,s=o.ownerDocument;PW(o),o.style.setProperty("--docx-bookmark-scale",String(i));let l=[],c=e.pages?[...e.pages]:a.pages.map((f,p)=>p),d=MO.get(a);d||MO.set(a,d=new Map);let u=d;for(let f of t){let p={paragraphId:f.paragraphId,offset:f.offset},g=(b,v)=>{let S=`${f.paragraphId}:${b}:${v??""}`;if(u.has(S))return u.get(S);let x=df$1(a,{paragraphId:f.paragraphId,offset:b},{...e.measurer?{measurer:e.measurer}:{},...v!==void 0?{preferredPageIndex:v}:{}});return u.set(S,x),x},y=f.repeats?c.map(b=>g(p.offset,b)):[g(p.offset)],h=new Set;for(let b of y){if(!b||!(b.height>0)||h.has(b.pageIndex)||e.pages&&!e.pages.has(b.pageIndex))continue;let v=a.pages[b.pageIndex];if(!v)continue;let S=e.pageOffsetX?.get(b.pageIndex)??0,x=f.repeats?[v.header,v.footer].find(E=>E?.partName===f.repeats):f.story==="note"?ob(v,f.paragraphId):void 0;if((f.repeats||f.story==="note")&&!x)continue;let k=x?.box??v.contentBox;h.add(b.pageIndex);let T=s.createElement("div");T.className=`docx-bookmark-mark docx-bookmark-mark--${f.edge}`;let R=f.edge==="end"?p.offset-1:p.offset+1,C=R>=0?g(R,f.repeats?b.pageIndex:void 0):null;C?.lineId===b.lineId&&(f.edge==="end"?C.x>b.x:C.x<b.x)&&T.classList.add("docx-bookmark-mark--rtl");let A={name:f.name,hidden:f.hidden,story:f.story,edge:f.edge};try{T=n?.(T,A)??T;}catch(E){r?.(E);}T.dataset.bookmarkName=f.name,T.dataset.bookmarkHidden=String(f.hidden),T.dataset.bookmarkEdge=f.edge,T.dataset.bookmarkStory=f.story,T.dataset.docxMarker="",T.setAttribute("contenteditable","false"),T.style.position="absolute",T.style.left=`${(k.x+b.x+S)*i}px`,T.style.top=`${(k.y+b.y)*i}px`,T.style.height=`${b.height*i}px`,l.push(T);}}o.replaceChildren(...l);}function TW(e){return e.type==="insertBookmark"||e.type==="deleteBookmark"||e.type==="keepFirstBookmark"||e.type==="goToBookmark"}function EW(e,t){let n=aj$1(t);return e.bookmarkEditing.list().some(r=>aj$1(r.name)===n)}function ib(e,t){if(!TW(t))return null;if(t.type==="insertBookmark"){let n=ab(t.name);if(n)return {ok:false,code:"invalidArgs",reason:n};let r=e.bookmarkEditing.insertRefusal(t.name);return r?{ok:false,code:"locked",reason:r}:null}if(!EW(e,t.name))return {ok:false,code:"notFound",reason:"the document has no bookmark with that name"};if(t.type==="keepFirstBookmark"){let n=aj$1(t.name);if(!e.bookmarkEditing.list().find(o=>aj$1(o.name)===n)?.duplicates)return {ok:false,code:"unsupported",reason:"the bookmark has no copies"}}if(t.type!=="goToBookmark"){let n=e.bookmarkEditing.writeRefusal();if(n)return {ok:false,code:"locked",reason:n}}return null}function sb(e,t,n,r="bookmark dialog"){return t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.canOpen()?(n&&e.open(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:`no ${r} is registered`}}function FO(e,t){let n=ib(e,t);return n||(t.type==="goToBookmark"?e.bookmarkEditing.goTo(t.name)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the bookmark cannot be shown"}:(t.type==="insertBookmark"?e.bookmarkEditing.insert(t.name):t.type==="keepFirstBookmark"?e.bookmarkEditing.keepFirst(t.name):e.bookmarkEditing.remove(t.name))?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:e.state().lastRejection??`${t.type} was refused`})}function DO(e){if(!e)return null;let t=e.formatting();return {bold:t.bold,italic:t.italic,underline:t.underline,strike:t.strikethrough,superscript:t.superscript,subscript:t.subscript,...t.color?{color:{kind:"hex",value:t.color}}:{},...t.highlight?{highlight:t.highlight}:{},...t.fontFamily?{fontFamily:t.fontFamily}:{},...t.fontSizeHalfPoints!==null?{fontSizePt:t.fontSizeHalfPoints/2}:{},...t.alignment?{alignment:t.alignment}:{},...t.direction?{direction:t.direction}:{},...t.styleId?{styleId:t.styleId}:{},...t.lineSpacing?{lineSpacing:t.lineSpacing}:{},...t.spaceBeforePt!==null?{spaceBeforePt:t.spaceBeforePt}:{},...t.spaceAfterPt!==null?{spaceAfterPt:t.spaceAfterPt}:{},...t.indent!==null?{indent:t.indent}:{},paragraphFlags:t.paragraphFlags,disagrees:t.disagrees,...t.tabStops!==null?{tabStops:t.tabStops}:{}}}var lb=new WeakMap;function NO(e,t){let n=e.isScheduled(),r=cb(t);return r?lb.set(e,r):n||lb.delete(e),r??(n?lb.get(e)??null:null)}function cb(e){if(!e)return null;let t=e.sectionPropertiesAt(e.state().selection.head.paragraphId);return {pageWidthTwips:t.pageSize.widthTwips,pageHeightTwips:t.pageSize.heightTwips,orientation:t.landscape?"landscape":"portrait",marginsTwips:{top:t.margins.topTwips,right:t.margins.rightTwips,bottom:t.margins.bottomTwips,left:t.margins.leftTwips},gutterTwips:t.margins.gutterTwips}}function Ff(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let c=e.session.paraIdOf(t.paragraphId);return c===null?null:{from:{paraId:c},to:{paraId:c}}}let r=e.session.paragraphAnchors(),o=r.paraIdByNode.get(t.paragraphId),a=r.paraIdByNode.get(n.paragraphId);if(o===void 0||a===void 0)return null;let i=r.ordinalByNode.get(t.paragraphId)??0,s=r.ordinalByNode.get(n.paragraphId)??0;return s<i||s===i&&n.offset<t.offset?{from:{paraId:a},to:{paraId:o}}:{from:{paraId:o},to:{paraId:a}}}function HO(e){if(!e)return null;let t=e.hyperlinks.linkAtCaret();if(!t)return null;let n=e.session.paraIdOf(t.paragraphId);return n===null?null:{href:t.href??"",range:{from:{paraId:n},to:{paraId:n}},...t.tooltip!==void 0?{tooltip:t.tooltip}:{}}}function _O(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return r$2(n).map(o=>{let a=r.paraIdByNode.get(o.id),i=o.kind==="textValue"?void 0:w$2(o);return {...a!==void 0?{paraId:a}:{},text:Nm(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function gs(e){return e?e.state().pageCount:0}function db(e,t="caret"){return e?e.currentPage(t):1}function OW(e,t){if(!ra(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=Df(e,t);return n.can.ok?{ok:true,tablePlan:n.plan}:{ok:false,refusal:{ok:false,code:n.can.code,reason:n.can.reason}}}function BO(e,t){return {command:e,part:t.session.partFor(t.storyScope())??t.session.part(),layout:t.layout(),storeRevision:t.session.packageRevision(),selection:t.state().selection,cellSelection:t.state().cellSelection,themeColors:t.session.documentThemeColors(),editable:t.session.editable,viewing:t.editingMode()==="view",...Sf(t)}}function Df(e,t){let n=BO(e,t),r=Rr(n),o=Ff$1(t.session.currentPackage());if(r.ok&&r.ops.some(a=>wm(n.part,o,a))&&(r={ok:false,code:"locked",reason:oi}),r.ok&&t.editingMode()==="suggest"){let a=rb(r.ops,i=>eb$1(n.part,i)?.kind==="table",nb(t.session,t.author()));a&&(r={ok:false,code:"unsupported",reason:a});}return r.ok?{can:{ok:true},plan:r}:{can:{ok:false,code:r.code,reason:r.reason},plan:r}}function lc(e,t,n,r){if(r?.scope){if(r.scope.kind==="all")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"the all scope is read-only"}};if(r.scope.kind==="note"||r.scope.kind==="frame")return {ok:false,refusal:{ok:false,code:"unsupported",reason:`scope kind '${r.scope.kind}' is not supported`}};if(r.scope.kind==="headerFooter"){let d=t?.activeScope?.()??{kind:"body"};if(d.kind!=="headerFooter"||d.rId!==r.scope.rId)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"open that header or footer before dispatching against its scope"}}}}let o=ti(e);if(!o.supported)return {ok:false,refusal:{ok:false,code:o.code??"unsupported",reason:o.reason}};if(!t)return {ok:false,refusal:{ok:false,code:"notFound",reason:"no document is loaded"}};if(o.mutating&&(n==="view"||!t.session.editable))return {ok:false,refusal:{ok:false,code:"locked",reason:"the document is read-only"}};let a=o.mutating?Vn(e,t):null;if(a)return {ok:false,refusal:a};let i=nO(e,t,Ay(t));if(i)return {ok:false,refusal:i};let s=aO(e,t,Ay(t));if(s)return {ok:false,refusal:s};if(e.type==="insertTextBox"){let d=ry(t);return d?{ok:false,refusal:d}:{ok:true}}if(e.type==="adjustIndent"&&!t.canAdjustIndent(e.direction))return {ok:false,refusal:{ok:false,code:"unsupported",reason:e.direction==="decrease"?"the selection is already at the outermost level":"the selection cannot indent any further"}};if(e.type==="deleteText"&&tn(t)){let d=ii({type:"deleteImage"},t);return d&&!d.ok?{ok:false,refusal:d}:{ok:true}}if((e.type==="copy"||e.type==="cut")&&MW(t)){if(e.type==="copy")return {ok:true};let d=ii({type:"deleteImage"},t);return d&&!d.ok?{ok:false,refusal:d}:{ok:true}}if(e.type==="copy"||e.type==="cut"||e.type==="deleteText"){let{anchor:d,head:u}=t.state().selection;if(d.paragraphId===u.paragraphId&&d.offset===u.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(d=>d.type==="paragraph"))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"this document defines no paragraph styles"}};if(e.type==="pasteFormatting"&&t.formatPainter.state().level==="none")return {ok:false,refusal:{ok:false,code:"notFound",reason:VT}};if(e.type==="undo"&&!t.state().canUndo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to undo"}};if(e.type==="redo"&&!t.state().canRedo)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to redo"}};if(e.type==="insertTable"&&!t.canInsertTable(e.rows,e.cols))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table can only be inserted at a caret in editable body, cell, or note text"}};let l=ib(t,e);if(l)return {ok:false,refusal:l};if(e.type==="insertToc"&&!t.canInsertToc())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a table of contents can only be inserted in the editable document body"}};if(e.type==="editTextFormField"&&!t.canEditTextFormField())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"field options are unavailable"}};if(e.type==="refreshToc"&&!t.canRefreshToc(e.tocId))return {ok:false,refusal:{ok:false,code:"notFound",reason:"there is no refreshable table of contents at the selection"}};if(e.type==="removeToc"){let d=t.removeTocRefusal(e.tocId);if(d)return {ok:false,refusal:{ok:false,...d}}}if(e.type==="insertPageField"&&(t.activeScope?.()??{kind:"body"}).kind!=="headerFooter")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertPageField requires an open header or footer scope"}};if(e.type==="insertNote"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"insertNote requires body scope"}};if(e.type==="insertBreak"&&(e.kind==="section"||e.kind==="sectionContinuous")){if((t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a section break can only be inserted in the editable document body"}};let u=t.sectionBreakRefusal(e.kind==="section"?"nextPage":"continuous");if(u)return {ok:false,refusal:{ok:false,code:"unsupported",reason:u}}}if(e.type==="insertBreak"&&e.kind==="page"&&(t.activeScope?.()??{kind:"body"}).kind!=="body")return {ok:false,refusal:{ok:false,code:"unsupported",reason:"a page break can only be inserted in the editable document body"}};if(e.type==="linkHeaderFooterToPrevious"){let d=t.headerFooterState?.();if((e.sectionIndex??d?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(ra(e)){let d=OW(e,t);return d.ok?{ok:true,tablePlan:d.tablePlan}:d}let c=ii(e,t);return c&&!c.ok?{ok:false,refusal:c}:{ok:true}}function $O(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!eb$1(n,t))return true;let r=fb$1(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=fb$1(n,r.id);}return false}function WO(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!$O(e,t.selection.head.paragraphId))return null;let r=na$1(e.layout(),t.selection.head.paragraphId);return r?{blockId:r.tableId,rowCount:r.rows,columnCount:r.columns,cell:{row:n?n.rows.from:r.rowIndex,column:n?n.columns.from:r.columnIndex}}:null}function Nf(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!$O(e,t.selection.head.paragraphId))return null;let r=na$1(e.layout(),t.selection.head.paragraphId);return r?{rows:r.rows,columns:r.columns,rowIndex:n?n.rows.from:r.rowIndex,columnIndex:n?n.columns.from:r.columnIndex}:null}function qO(e){if(!e)return null;let t=BO({type:"splitCell",rows:1,cols:2},e),n=oa$1(t.layout,t.selection.head.paragraphId,t.cellSelection);if(!n||n.cellIds.length>1)return null;let r=gn(t.part,n.tableId,n.cellId);return r?{...r}:null}function KO(e){return e?{...e.bold!==void 0?{bold:e.bold}:{},...e.italic!==void 0?{italic:e.italic}:{},...e.underline!==void 0?{underline:e.underline}:{},...e.fontFamily?{fontFamily:e.fontFamily}:{},...e.fontSizePt!==void 0?{fontSizeHalfPoints:Math.round(e.fontSizePt*2)}:{},...e.styleId?{styleId:e.styleId}:{},...e.alignment?{alignment:e.alignment}:{}}:null}function UO(e){return !!e&&ir(e.session.part(),e.state().selection.head)!==void 0}function MW(e){let t=tn(e);if(!t)return false;let n=e.session.currentPackage();return n$1(n,t.ownerPartName,t.drawingNodeId)!==null}var de={undo:["M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"],redo:["M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"],print:["M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"],file_download:["M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],file_upload:["M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"],format_bold:["M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"],format_italic:["M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"],format_underlined:["M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"],strikethrough_s:["M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"],superscript:["M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"],subscript:["M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"],link:["M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"],format_clear:["m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"],format_paragraph:["M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"],format_shapes:["M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"],lock:["M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"],format_align_left:["M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"],format_align_center:["M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"],format_align_right:["M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"],format_align_justify:["M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"],format_line_spacing:["M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"],format_list_bulleted:["M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"],format_list_numbered:["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],format_indent_increase:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"],format_indent_decrease:["M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"],format_color_text:["M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"],ink_highlighter:["M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"],format_color_reset:["M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"],arrow_drop_down:["M480-360 280-560h400L480-360Z"],table:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"],table_chart:["M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"],grid_on:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"],table_rows:["M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"],view_column:["M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"],border_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],select_all:["M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"],border_outer:["M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"],border_inner:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"],border_clear:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],add:["M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"],remove:["M200-440v-80h560v80H200Z"],delete:["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],delete_sweep:["M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"],call_merge:["m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"],call_split:["M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"],drag_indicator:["M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"],image:["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"],format_image_left:["M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"],format_image_right:["M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"],horizontal_rule:["M160-440v-80h640v80H160Z"],flip_to_back:["M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],flip_to_front:["M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],open_with:["M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"],tune:["M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"],rotate_right:["M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"],rotate_left:["M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"],swap_horiz:["M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"],swap_vert:["M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"],shapes:["M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"],format_paint:["M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"],expand_more:["M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"],expand_less:["m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"],border_top:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_bottom:["M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_left:["M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"],border_right:["M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"],border_horizontal:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],border_vertical:["M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"],padding:["M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],text_rotation_none:["M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"],wrap_text:["M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"],insert_chart:["M280-280h80v-280h-80v280Zm160 0h80v-400h-80v400Zm160 0h80v-160h-80v160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"],bar_chart:["M640-160v-280h160v280H640Zm-240 0v-640h160v640H400Zm-240 0v-440h160v440H160Z"],align_horizontal_left:["M80-80v-800h80v800H80Zm160-200v-120h400v120H240Zm0-280v-120h640v120H240Z"],show_chart:["m140-220-60-60 300-300 160 160 284-320 56 56-340 384-160-160-240 240Z"],area_chart:["M120-160v-520l160 120 200-280 200 160h160v520H120Zm200-120 160-220 280 218v-318H652L496-725 298-447l-98-73v144l120 96Z"],pie_chart:["M520-520h278q-15-110-91.5-186.5T520-798v278Zm-80 358v-636q-121 15-200.5 105.5T160-480q0 122 79.5 212.5T440-162Zm80 0q110-14 187-91t91-187H520v278Zm-40-318Zm0 400q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 155.5 31.5t127 86q54.5 54.5 86 127T880-480q0 82-31.5 155T763-197.5q-54 54.5-127 86T480-80Z"],donut_large:["M441-82Q287-97 184-211T81-480q0-155 103-269t257-129v120q-104 14-172 93t-68 185q0 106 68 185t172 93v120Zm80 0v-120q94-12 159-78t79-160h120q-14 143-114.5 243.5T521-82Zm238-438q-14-94-79-160t-159-78v-120q143 14 243.5 114.5T879-520H759Z"],scatter_plot:["M680-120q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm0-80q33 0 56.5-23.5T760-280q0-33-23.5-56.5T680-360q-33 0-56.5 23.5T600-280q0 33 23.5 56.5T680-200Zm-400-40q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm0-80q33 0 56.5-23.5T360-400q0-33-23.5-56.5T280-480q-33 0-56.5 23.5T200-400q0 33 23.5 56.5T280-320Zm160-240q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm0-80q33 0 56.5-23.5T520-720q0-33-23.5-56.5T440-800q-33 0-56.5 23.5T360-720q0 33 23.5 56.5T440-640Zm240 360ZM280-400Zm160-320Z"],hexagon:["M300-120 60-480l240-360h360l240 360-240 360H300Zm44-80h272l188-280-188-280H344L156-480l188 280Zm136-280Z"],height:["M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"],fit_width:["M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"],settings:["m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"],border_color:["M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"],format_color_fill:["m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"],vertical_align_top:["M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"],vertical_align_center:["M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"],vertical_align_bottom:["M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"],line_weight:["M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"],keyboard_arrow_up:["M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"],keyboard_arrow_down:["M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"],keyboard_arrow_left:["M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"],keyboard_arrow_right:["M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"],more_vert:["M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"],page_break:["M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"],branding_watermark:["M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"],arrow_back:["M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"],search:["M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"],toc:["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],bookmark:["M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z"],bookmarks:["M120-40v-640q0-33 23.5-56.5T200-760h400q33 0 56.5 23.5T680-680v640L400-160 120-40Zm80-122 200-86 200 86v-518H200v518Zm560 2v-680H240v-80h520q33 0 56.5 23.5T840-840v680h-80ZM200-680h400-400Z"],done_all:["M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"],check_circle:["m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"],chat_bubble_outline:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],chat_bubble_check:["M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],check:["M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"],close:["m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"],add_comment:["M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],comment:["M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],edit_note:["M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"],difference:["M500-520h80v-80h80v-80h-80v-80h-80v80h-80v80h80v80Zm-80 160h240v-80H420v80ZM320-200q-33 0-56.5-23.5T240-280v-560q0-33 23.5-56.5T320-920h280l240 240v400q0 33-23.5 56.5T760-200H320Zm0-80h440v-360L560-840H320v560ZM160-40q-33 0-56.5-23.5T80-120v-560h80v560h440v80H160Zm160-240v-560 560Z"],rate_review:["M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"],visibility:["M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"],format_textdirection_l_to_r:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"],format_textdirection_r_to_l:["M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"],"agent-sparkle":["m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"]};var hs={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},VO=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function ub(e){return createT(en)(e)}function cc(e){return VO.includes(e)}function FW(e){return e!=null}var GO=[{value:"all",icon:"border_all",labelKey:"table.borders.all"},{value:"outside",icon:"border_outer",labelKey:"table.borders.outside"},{value:"inside",icon:"border_inner",labelKey:"table.borders.inside"},{value:"top",icon:"border_top",labelKey:"table.borders.top"},{value:"bottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{value:"left",icon:"border_left",labelKey:"table.borders.left"},{value:"right",icon:"border_right",labelKey:"table.borders.right"},{value:"none",icon:"border_clear",labelKey:"table.borders.none"}],zO=[{value:"single",labelKey:"table.borderStyles.single",previewClass:"docx-table-line--single"},{value:"dashed",labelKey:"table.borderStyles.dashed",previewClass:"docx-table-line--dashed"},{value:"dotted",labelKey:"table.borderStyles.dotted",previewClass:"docx-table-line--dotted"},{value:"double",labelKey:"table.borderStyles.double",previewClass:"docx-table-line--double"},{value:"triple",labelKey:"table.borderStyles.triple",previewClass:"docx-table-line--triple"},{value:"thick",labelKey:"table.borderStyles.thick",previewClass:"docx-table-line--thick"}],DW=[{size:4,labelKey:"table.borderWidths.halfPt",previewThickness:.5},{size:8,labelKey:"table.borderWidths.onePt",previewThickness:1},{size:12,labelKey:"table.borderWidths.oneHalfPt",previewThickness:1.5},{size:16,labelKey:"table.borderWidths.twoPt",previewThickness:2},{size:24,labelKey:"table.borderWidths.threePt",previewThickness:3}];function NW(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function HW(e){return e==="none"||NW(e)}function jO(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function _W(e){return zO.some(t=>t.value===e)}function si(e,t,n){switch(t){case "table.borderTarget":return HW(n)?n==="none"?{command:{type:"setTableBorders",scope:"none",target:e.activeTarget},nextDraft:e}:{command:{type:"setTableBorders",scope:n,spec:e.spec},nextDraft:{activeTarget:n,spec:e.spec}}:null;case "table.borderColor":{if(!jO(n))return null;let r={...e.spec,color:n};return {command:{type:"setTableBorders",scope:e.activeTarget,spec:r},nextDraft:{activeTarget:e.activeTarget,spec:r}}}case "table.borderStyle":{if(!_W(n))return null;let r={...e.spec,style:n};return {command:{type:"setTableBorders",scope:e.activeTarget,spec:r},nextDraft:{activeTarget:e.activeTarget,spec:r}}}case "table.borderWidth":{if(typeof n!="number"||!Number.isInteger(n))return null;let r={...e.spec,size:n};return {command:{type:"setTableBorders",scope:e.activeTarget,spec:r},nextDraft:{activeTarget:e.activeTarget,spec:r}}}case "table.cellFill":return n!==null&&!jO(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function fb(e,t=hs){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return si(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return si(t,e,"single")?.command??null;case "table.borderWidth":return si(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function BW(e){return GO.find(n=>n.value===e)?.labelKey??"table.borders.all"}function pb(e){return de[e]}var $W=new RegExp("^[\\p{L}\\p{M}\\p{N}'\\u2019\\u001F\\u00AD\\u200C\\u200D]$","u"),WW=/[\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;function mb(e,t){let n=e.charCodeAt(t);if(Number.isNaN(n))return false;let r=n>=56320&&n<=57343&&t>0?t-1:t,o=e.codePointAt(r);return o!==void 0&&$W.test(String.fromCodePoint(o))}function Hf(e,t,n,r,o){let a=[],i=0;for(let s of vi$1(e,t,0,n,r,o))s.start>i&&a.push({start:i,end:s.start}),i=Math.max(i,s.end);return i<n&&a.push({start:i,end:n}),a}function gb(e,t,n){let r=gf$1(e,t).split("");for(let{line:a}of Wb$1(e,t)??[]){let i=_a(a,t);if(i)for(let s of i.spans){if(!(s.fieldAtom||s.noteNav||s.equation||s.unsupported))continue;let l=Math.min(s.range.end,r.length);for(let c=s.range.start;c<l;c+=1)r[c]=qW;}}let o=r.join("");for(let{start:a,end:i}of n){let s=Math.min(i,r.length);if(!(a<=0||s>=r.length||a>=s)&&!(!mb(o,a-1)||!mb(o,s)))for(let l=a;l<s;l+=1)r[l]="a";}return r.join("")}var qW="\uFFFC";function hb(e,t,n){let r=s=>mb(e,s);if(t<=0||t>=e.length||n.has(t)||!r(t-1)||!r(t))return null;let o=t-1;for(;o>0&&r(o-1)&&!n.has(o);)o-=1;let a=t+1;for(;a<e.length&&r(a)&&!n.has(a);)a+=1;let i=UW(e,o,a,t);return i===void 0?{start:o,end:a}:i}function yb(e,t,n,r){return KW(e,t,n)?null:hb(gb(e,t,r),n,Ze$2(e,t))}function _f(e,t){let{anchor:n,head:r}=t;if(n.paragraphId!==r.paragraphId||n.offset!==r.offset)return null;let o=yb(e,r.paragraphId,r.offset,[]);return o?{from:{paragraphId:r.paragraphId,offset:o.start},to:{paragraphId:r.paragraphId,offset:o.end}}:null}function KW(e,t,n){for(let{line:r}of Wb$1(e,t)??[]){let o=_a(r,t);if(o)for(let a of o.spans){let{start:i,end:s}=a.range;if(!(i===s||i>n||s<n)&&a.revisions?.some(l=>l.kind==="delete"||l.kind==="moveFrom"))return true}}return false}function UW(e,t,n,r){let o=e.slice(t,n);if(WW.test(o)){for(let a of G$2(o)){let i=t+a.utf16From,s=t+a.utf16To;if(r===i)return null;if(r>i&&r<s)return {start:i,end:s}}return null}}function dc(e){let t=[];return {current:()=>t[t.length-1]??e,push:n=>(t.push(n),()=>{let r=t.lastIndexOf(n);r>=0&&t.splice(r,1);})}}function ys(e){let t=dc({}),n=false,r=false,o=()=>t.current().onRequest!==void 0,a=()=>{o()!==n&&(n=o(),e?.());};return {canOpen:o,open(){let i=t.current().onRequest;return i?.(),i!==void 0},shortcutOn:()=>t.current().shortcut!==false,openFromShortcut(){if(t.current().shortcut===false)return false;let i=t.current().onRequest;return i?.(),i!==void 0},current:()=>t.current(),register(i){let s=t.push(i);return a(),()=>{s(),!r&&(r=true,globalThis.queueMicrotask(()=>{r=false,a();}));}}}}function ZO(e={}){let t=ys(e.changed),n=ys(e.changed),r=dc({}),o=null,a={current:r.current,onChange:i=>{o=i;},reportError:i=>e.error?.(i)};return {surfaceOptions:{onRequestBookmark:t.open,onRequestGoTo:n.openFromShortcut,bookmarkMarks:a},bookmarkDialog:t,goTo:n,setters:{setBookmarkChrome:i=>t.register(i),setGoToChrome:i=>n.register(i),setBookmarkMarks(i){let s=r.push(i);return o?.(),()=>{s(),o?.();}}}}}var jW=256,XO=new WeakMap;function VW(e){let t=fk(e),n=XO.get(t);return n||(n=new Map(t.map(r=>[r.root.id,r])),XO.set(t,n)),n}function QO(e,t){let n=VW(e);if(n.size===0||!eb$1(e,t))return null;let r=fb$1(e,t);for(let o=0;r&&o<jW;o+=1){let a=r.id,i=n.get(a);if(i)return {kind:"frame",id:i.root.id,drawingNodeId:i.drawingNodeId,hostParagraphId:i.hostParagraphId};r=fb$1(e,a);}return null}var YO=new WeakMap;function Bf(e,t){let n=e&&ce(e.session,t);if(!n)return null;let r=YO.get(n.root);r||YO.set(n.root,r=new Map);let o=r.get(t);if(o!==void 0)return o;let a=QO(n,t)?.hostParagraphId??null;return r.set(t,a),a}function bb(e,t,n){let r=ce(e.session,t.paragraphId),o=r&&QO(r,t.paragraphId);o&&e.setActiveScope(n?{...o,owner:{kind:"headerFooter",rId:n}}:o)&&e.setSelection({anchor:t,head:t});}function JO(e){let t=new Map,n=e.activeScope();if(n.kind!=="frame")return t;let r=ce(e.session,n.id),o=r&&eb$1(r,n.id);if(!o)return t;let a=[o];for(;a.length>0;){let i=a.pop();i.kind==="paragraph"&&t.set(i.id,t.size);let s="children"in i?i.children:void 0;if(s)for(let l=s.length-1;l>=0;l-=1)a.push(s[l]);}return t}function eM(e,t){e.exitNote?.(),e.exitHeaderFooter?.(),bb(e,t);}var $f="no comment draft view is registered",tM=new WeakMap;function nM(e={}){let t=ys(e.changed);return {requests:{canOpen:t.canOpen,open:t.open},setters:{setCommentDraftChrome:r=>t.register(r)}}}function rM(e,t){tM.set(e,t);}function vb(e){return tM.get(e)??null}function xb(e){let t=e.surface;if(!t||t.activatedReviewKey()!==null)return null;let n=t.state().selection;return _f(t.publishedLayout(),n)??GW(t,n)}function GW(e,{anchor:t,head:n}){if(t.paragraphId!==n.paragraphId||t.offset!==n.offset||Bf(e,n.paragraphId)===null)return null;let r=ce(e.session,n.paragraphId),o=r&&Nm(r,n.paragraphId),a=o?hb(o,n.offset,new Set):null;return a?{from:{paragraphId:n.paragraphId,offset:a.start},to:{paragraphId:n.paragraphId,offset:a.end}}:null}function Sb(e){let t="review.addComment",n=o=>({id:t,enabled:false,disabledReason:o,active:false}),r=e.can({type:"toggleReviewPane"});return r.ok?(e.getEditingMode?.()??"editing")==="viewing"?n("the document is open for viewing"):vb(e)?.canOpen()?e.getSelectionPlacement()===null&&!xb(e)?n("a comment needs a selected range"):{id:t,enabled:true,disabledReason:null,active:false}:n($f):n(r.reason)}var Wf="no link view is registered",wb={type:"insertHyperlink",href:"https://example.com"},oM=new WeakMap;function aM(e){let t=ys(e);return {requests:{canOpen:t.canOpen,open:t.open},current:t.current,open:t.open,register:r=>t.register(r)}}function iM(e,t){oM.set(e,t);}function kb(e){return oM.get(e)??null}function Ib(e){let t=r=>({id:"text.link",enabled:false,disabledReason:r,active:false}),n=e.can(wb);return n.ok?kb(e)?.canOpen()?{id:"text.link",enabled:true,disabledReason:null,active:false}:t(Wf):t(n.reason)}var qf=new WeakMap,Rb=new WeakMap;function Kf(e,t,n){let r={pane:t,focus:n?.focus??true};Rb.set(e,r);let o=qf.get(e);if(!o||o.size===0)return false;for(let a of [...o])a(r);return true}function zW(e){let t=Rb.get(e)??null;return Rb.delete(e),t}function ZW(e,t){let n=qf.get(e);return n||qf.set(e,n=new Set),n.add(t),()=>n.delete(t)}function XW(e){return e!==null&&(qf.get(e)?.size??0)>0}var YW=["columnClustered","barClustered","line","area","pie","doughnut","scatter"],sM={column:"bar_chart",bar:"align_horizontal_left",line:"show_chart",area:"area_chart",pie:"pie_chart",doughnut:"donut_large",radar:"hexagon",scatter:"scatter_plot"};function QW(e){let t=Object.keys(sM).find(n=>e.startsWith(n));return t&&de[sM[t]]||[]}var JW=e=>`chart.types.${e}`;function Pb(e){return e$1(e)?{type:"insertChart",chartType:e}:null}function cM(e,t){if(t==="insert.chart"){let n=e.can({type:"insertChart",chartType:d[0]});return n.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:n.reason,active:false}}return t==="image.editChart"?e.snapshot().chart?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:"chart.errors.noChart",active:false}:null}function dM(e,t){return e.snapshot().chart?.drawingNodeId!==t?false:(Kf(e,"chart"),true)}var lM=e=>Ft(e)?e.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id")??null:null;function eq(e,t){let{target:n}=t,r=lM(n)??(Ft(n)?lM(n.ownerDocument.elementFromPoint(t.clientX,t.clientY)):null);return r?dM(e,r):false}function uM(e,t,n){if(t==="image.editChart")return e.snapshot().chart?(Kf(e,"chart",{focus:true}),{ok:true,changed:false}):{ok:false,code:"notFound",reason:"chart.errors.noChart"};if(t!=="insert.chart"||n===void 0)return null;let r=Pb(n);if(!r)return {ok:false,code:"invalidArgs",reason:"chart.errors.unsupportedType"};let o=e.can(r);if(!o.ok)return {ok:false,code:o.code,reason:o.reason};let a=e.exec(r);return a.ok&&Kf(e,"chart",{focus:false}),a}function Oo(e){return e.surface??null}var tq={"review.revisionMarkup":{type:"openRevisionMarkupDialog"},"review.compareDocuments":{type:"openCompareDocumentsDialog"},"review.comments":{type:"toggleReviewPane"},"review.paragraphMarks":{type:"toggleParagraphMarks"},"review.bookmarks":{type:"toggleBookmarks"},"insert.bookmark":{type:"openBookmarkDialog"},"insert.goToBookmark":{type:"openGoTo"},"review.protectDocument":{type:"toggleDocumentProtection"},"review.simpleMarkup":{type:"setReviewDisplayMode",mode:"simple-markup"},"review.allMarkup":{type:"setReviewDisplayMode",mode:"all-markup"},"review.noMarkup":{type:"setReviewDisplayMode",mode:"proposed"},"review.original":{type:"setReviewDisplayMode",mode:"original"},"review.previousChange":{type:"navigateReviewChange",direction:"previous"},"review.nextChange":{type:"navigateReviewChange",direction:"next"},"review.acceptAllChanges":{type:"resolveAllReviewChanges",action:"accept"},"review.rejectAllChanges":{type:"resolveAllReviewChanges",action:"reject"},"history.undo":{type:"undo"},"history.redo":{type:"redo"},"text.bold":{type:"toggleMark",mark:"bold"},"text.italic":{type:"toggleMark",mark:"italic"},"text.underline":{type:"toggleMark",mark:"underline"},"text.strike":{type:"toggleMark",mark:"strike"},"script.super":{type:"toggleMark",mark:"superscript"},"script.sub":{type:"toggleMark",mark:"subscript"},"format.clear":{type:"clearFormatting"},"alignment.left":{type:"setAlignment",align:"left"},"alignment.center":{type:"setAlignment",align:"center"},"alignment.right":{type:"setAlignment",align:"right"},"alignment.justify":{type:"setAlignment",align:"justify"},"direction.ltr":{type:"setParagraphDirection",direction:"ltr"},"direction.rtl":{type:"setParagraphDirection",direction:"rtl"},"list.bullet":{type:"toggleList",kind:"bullet"},"list.numbered":{type:"toggleList",kind:"ordered"},"list.indent":{type:"adjustIndent",direction:"increase"},"list.outdent":{type:"adjustIndent",direction:"decrease"},"insert.textBox":{type:"insertTextBox"},"insert.footnote":{type:"insertNote",noteKind:"footnote"},"insert.endnote":{type:"insertNote",noteKind:"endnote"},"insert.pageNumber":{type:"insertPageField",field:"PAGE"},"insert.totalPages":{type:"insertPageField",field:"NUMPAGES"},"insert.sectionPages":{type:"insertPageField",field:"SECTIONPAGES"},"insert.pageXofY":{type:"insertPageField",field:"PAGE_X_OF_Y"},"insert.pageBreak":{type:"insertBreak",kind:"page"},"insert.sectionBreakNextPage":{type:"insertBreak",kind:"section"},"insert.sectionBreakContinuous":{type:"insertBreak",kind:"sectionContinuous"},"insert.toc":{type:"insertToc"},"contentControl.remove":{type:"removeContentControl"},"table.mergeCells":{type:"mergeCells"}};function nq(e){return mM[e]??null}var fM=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),pM={"file.pageSetup":"page setup is not a command; render DocxEditor.PageSetupDialog with open and onClose","paragraph.dialog":"the paragraph dialog is not a command; render DocxEditor.ParagraphDialog with open and onClose"},mM={"text.link":wb,"image.insert":{type:"insertImage",data:fM,mime:"image/png",widthPoints:72,heightPoints:72},"image.properties":{type:"setImageProperties",description:"probe"},"table.insert":{type:"insertTable",rows:1,cols:1},"file.pageSetup":{type:"setPageSetup",orientation:"portrait"},"paragraph.dialog":{type:"setParagraphFormat",alignment:"left"},"insert.watermark":{type:"setWatermark",watermark:{text:"DRAFT"}},"table.splitCell":{type:"splitCell",rows:1,cols:2}};function jf(e){return tq[e]??null}var rq={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},gM={"font.family":"Arial","font.size":22,"text.color":"000000","text.highlight":"yellow","styles.style":"Normal","list.lineSpacing":1,"image.wrap":"square","image.altText":"probe alt text","insert.chart":"columnClustered"};function hM(e,t,n){return si(n,e,t)?.command??null}function Uf(e,t){if(e==="review.editingMode")return {type:"setEditingMode",mode:t};if(e==="styles.style")return {type:"setParagraphStyle",styleId:t};if(e==="list.lineSpacing")return {type:"setLineSpacing",rule:"multiple",value:t};if(cc(e))return hM(e,t,hs);if(e==="image.wrap")return typeof t!="string"||!Re.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};if(e==="insert.chart")return Pb(t);let n=rq[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function yM(e,t,n=hs){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=fb(t,n);if(!r)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let o=e.can(r);return o.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:o.reason,active:false}}var oq=["editing","suggesting","viewing"];function bM(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(cc(t))return yM(e,t);let n=cM(e,t);if(n)return n;if(t==="review.editingMode"){let i=e.getEditingMode?.()??"editing",s=oq.filter(d=>d!==i).map(d=>e.can(Uf(t,d))),l=s.some(d=>d.ok),c=s.find(d=>!d.ok);return {id:t,enabled:l,disabledReason:!l&&c&&!c.ok?c.reason:null,active:false,value:i}}if(t==="format.painter"){let i=Oo(e);if(!i)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let s=i.formatPainter.state();if(s.mode!=="off")return {id:t,enabled:true,disabledReason:null,active:true,value:s.mode};let l=e.can({type:"clearFormatting"});return l.ok?{id:t,enabled:true,disabledReason:null,active:false,value:s.mode}:{id:t,enabled:false,disabledReason:l.reason,active:false,value:s.mode}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let i=Oo(e),s=i?.state().contentControls,l=t==="contentControl.showAll"?s?.showAll??false:s?.formFill??false;return {id:t,enabled:i!==null,disabledReason:i?null:"editor is not ready",active:l}}if(t==="contentControl.inspector"){let i=Oo(e);return i?i.state().contentControls.activeControlId?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:"no content control at the selection",active:false}:{id:t,enabled:false,disabledReason:"editor is not ready",active:false}}if(t==="review.addComment")return Sb(e);if(t==="text.link")return Ib(e);if(t==="review.authors"){let i=e.can({type:"toggleReviewPane"});return i.ok?(e.getReviewAuthors?.().length??0)>0?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:"the document has no review authors",active:false}:{id:t,enabled:false,disabledReason:i.reason,active:false}}let r=jf(t);if(!r){let i=gM[t];if(i!==void 0){let l=Uf(t,i);if(!l)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let c=e.can(l),d=e.getSelectedImage?.()??null,u=t==="image.wrap"?d?.wrap:t==="image.altText"?d?.description:jT(e,t);return c.ok?{id:t,enabled:true,disabledReason:null,active:false,...u!==void 0?{value:u}:{}}:{id:t,enabled:false,disabledReason:c.reason,active:false,...u!==void 0?{value:u}:{}}}let s=mM[t];if(s){if(t==="image.insert"&&s.type==="insertImage"){let d=e.canExecuteImageCommand?.({type:"insertImage",data:fM,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="image.properties"&&s.type==="setImageProperties"){let d=e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="table.insert"&&s.type==="insertTable"){let d=e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="table.splitCell"&&s.type==="splitCell"){let d=e.can(s),u=d.ok?null:e.query({type:"splitCellConfig"});for(let f of u?[2,u.maxRows]:[]){if(d.ok||f<2)break;let p=e.can({type:"splitCell",rows:f,cols:1});p.ok&&(d=p);}return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="paragraph.dialog"&&s.type==="setParagraphFormat"){let d=e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}let l=e.can(s);if(!l.ok)return {id:t,enabled:false,disabledReason:l.reason,active:false};let c=pM[t];if(c)return {id:t,enabled:false,disabledReason:c,active:false}}return t==="file.exportMarkdown"||t==="file.exportPdf"?{id:t,enabled:false,active:false,disabledReason:"export is not a command; run it with runChromeExport(editor, format, handlers)"}:t==="file.print"?{id:t,enabled:false,active:false,disabledReason:"print is not a command; run it with runChromePrint(editor, handlers)"}:t==="file.save"?{id:t,enabled:false,disabledReason:"save is not a command; run it with runSave(editor)",active:false}:t==="file.open"?{id:t,enabled:false,disabledReason:"open is not a command; run it with editor.load(bytes)",active:false}:{id:t,enabled:false,disabledReason:"not wired to an editor command",active:false}}let o=e.can(r),a=e.isActive?.(r)??false;return o.ok?{id:t,enabled:true,disabledReason:null,active:a}:{id:t,enabled:false,disabledReason:o.reason,active:a}}function aq(e){if(e==="format.painter")return true;let t=jf(e);return t?.type==="toggleMark"||t?.type==="toggleParagraphMarks"||t?.type==="toggleBookmarks"||t?.type==="toggleDocumentProtection"||t?.type==="setReviewDisplayMode"||t?.type==="setAlignment"||t?.type==="setParagraphDirection"}function iq(e,t){return t.map(n=>bM(e,n))}function sq(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=si(r,t,n);if(!o)return {result:{ok:false,code:"unsupported",reason:"invalid table chrome value"},nextDraft:null};let a=e.can(o.command);if(!a.ok)return {result:{ok:false,code:a.code,reason:a.reason},nextDraft:null};let i=e.exec(o.command);return i.ok?{result:i,nextDraft:o.nextDraft}:{result:i,nextDraft:null}}var lq=new Set(["format.painter","contentControl.showAll","contentControl.formFill","contentControl.inspector","contentControl.remove","review.addComment"]);function cq(e,t,n,r){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(n&&typeof n=="object"&&("historyGroup"in n||"scope"in n||Object.keys(n).length===0)){if(r||gM[t]!==void 0||cc(t))return {ok:false,code:"invalidArgs",reason:"pass a toolbar value before command options"};r=n,n=void 0;}if(r?.historyGroup!==void 0&&lq.has(t))return {ok:false,code:"unsupported",reason:`${t} does not take a history group`};let o=uM(e,t,n);if(o)return o;if(t==="format.painter"){let s=Oo(e);if(!s)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(s.formatPainter.state().mode==="off"){let l=e.can({type:"clearFormatting"});if(!l.ok)return {ok:false,code:l.code,reason:l.reason}}return s.formatPainter.press()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:bf}}if(t==="text.link"){let s=Ib(e);return s.enabled?kb(e)?.open()?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:Wf}:{ok:false,code:"unsupported",reason:s.disabledReason??Wf}}if(t==="review.addComment"){let s=Sb(e);if(!s.enabled)return {ok:false,code:"unsupported",reason:s.disabledReason??$f};let l=e.getSelectionPlacement()===null?xb(e):null,c=l?Oo(e):null,d=c?.state().selection;return l&&c?.setSelection({anchor:l.from,head:l.to}),vb(e)?.open()?{ok:true,changed:false}:(d&&c?.setSelection(d),{ok:false,code:"unsupported",reason:$f})}if(t==="contentControl.showAll"){let s=Oo(e);return s?(s.contentControls.setShowAll(!s.contentControls.showAll()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.formFill"){let s=Oo(e);return s?(s.contentControls.setFormFill(!s.contentControls.formFill()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.inspector"){let s=Oo(e);return s?s.state().contentControls.activeControlId?{ok:true,changed:false}:{ok:false,code:"notFound",reason:"no content control at the selection"}:{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.remove"){let s=Oo(e);if(!s)return {ok:false,code:"unsupported",reason:"editor is not ready"};let l=s.state().contentControls.activeControlId;if(!l)return {ok:false,code:"notFound",reason:"no content control at the selection"};let c=s.contentControls.disabledReason(l,"remove");return c?{ok:false,code:c==="bound"?"bound":"locked",reason:c}:s.contentControls.remove(l)?{ok:true,changed:true}:{ok:false,code:s.state().lastRejection??"unsupported",reason:s.state().lastRejection??"removeContentControl was refused"}}let a=n===void 0?jf(t):Uf(t,n);if(!a){if(n!==void 0)return {ok:false,code:"unsupported",reason:"invalid value for toolbar command"};if(t==="file.exportMarkdown"||t==="file.exportPdf")return {ok:false,code:"unsupported",reason:"export is not a command; run it with runChromeExport(editor, format, handlers)"};if(t==="file.print")return {ok:false,code:"unsupported",reason:"print is not a command; run it with runChromePrint(editor, handlers)"};if(t==="file.save")return {ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"};if(t==="file.open")return {ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"};let s=pM[t];return s?{ok:false,code:"unsupported",reason:s}:{ok:false,code:"unsupported",reason:"not wired to an editor command"}}let i=e.can(a,r);return i.ok?e.exec(a,r):{ok:false,code:i.code,reason:i.reason}}function dq(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function uq(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=Df(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function fq(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};let r=e.can(t,n);return r.ok?e.exec(t,n):{ok:false,code:r.code,reason:r.reason}}function Cb(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(Cb):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,Cb(e[t])]))}function pq(e){return JSON.stringify(Cb(e))}var Tb=["zoom","script","format","list","alignment","styles","font","text","history"],mq=new Set(["review"]),Eb=24;function vM(e,t=Tb){let n=t.indexOf(e);return n===-1?void 0:(n+1)*10}function gq(e,t=Tb,n){let r=[],o=[];return e.forEach((a,i)=>{let s=n?.get(a)??vM(a,t);s===void 0||Number.isNaN(s)?o.push(a):r.push({id:a,priority:s,position:i});}),r.sort((a,i)=>a.priority-i.priority||i.position-a.position),[...o.reverse(),...r.map(a=>a.id)]}function hq(e,t){let n=[...e],r=new Map,o=t.filter(a=>!e.includes(a.id));for(;o.length>0;){let a=[];for(let i of o){let s=i.after;if(s===void 0||s===i.id){n.push(i.id);continue}if(!n.includes(s)){a.push(i);continue}let l=r.get(s)??s;n.splice(n.indexOf(l)+1,0,i.id),r.set(s,i.id);}if(a.length===o.length){n.push(...a.map(i=>i.id));break}o=a;}return n}var Ob=8;function yq(e){let t=e.margin??Ob,n=Math.max(0,e.viewportWidth-t*2),r=Math.min(e.panelWidth,n),o=t,a=e.viewportWidth-t-r,i=e.triggerRight-r;if(i>=o&&i<=a)return {left:i,maxWidth:n,anchor:"end"};let s=e.triggerLeft;return s>=o&&s<=a?{left:s,maxWidth:n,anchor:"start"}:{left:Math.max(o,Math.min(i,a)),maxWidth:n,anchor:"clamped"}}function bq(e){let t=e.margin??Ob,n=e.viewportWidth-t-e.popupWidth;return Math.max(t,Math.min(e.anchorLeft,n))}var Gf="data-toolbar-item",Mb="host-content",SM=new Map;function wM(e,t){return `${e}\0${t}`}function vq(e){return e.map(t=>[t.id,...t.items].join("")).join("\0")}function xq(e,t){return t?[...e,Mb]:[...e]}function Sq(e,t){return e?t.includes(Mb):t.length>0}function kM(e,t,n){return Math.max(0,n-(e.get(t)??0))}function IM(e,t,n){return e.itemWidths.get(wM(t,n))??0}function uc(e,t,n){if(n<=0)return 0;let r=0,o=0;for(let i=0;i<n&&i<t.items.length;i+=1){let s=IM(e,t.id,t.items[i]);s>0&&(r+=s,o+=1);}let a=e.groupGaps?.get(t.id)??e.gap;return (e.groupBases.get(t.id)??0)+r+Math.max(0,o-1)*a}function xM(e,t){let n=e.fixed;for(let a of e.groups)n+=uc(e,a,a.items.length);if(n<=t)return SM;n+=e.more;let r=new Map(e.groups.map(a=>[a.id,a])),o=new Map;for(let a of e.order){if(n<=t)break;let i=r.get(a);if(!i||o.has(a))continue;let s=i.items.length;for(let l=s-1;l>=0;l-=1){let c=uc(e,i,l+1)-uc(e,i,l);if(!(c<=0)){if(n-=c,o.set(a,s-l),l>0&&!wq(e,i,l)){n-=uc(e,i,l),o.set(a,s);break}if(n<=t)break}}}return o}function wq(e,t,n){for(let r=0;r<n&&r<t.items.length;r+=1)if(IM(e,t.id,t.items[r])>0)return true;return false}function kq(e,t){let n=e.fixed;for(let r of e.groups)n+=uc(e,r,kM(t,r.id,r.items.length));return t.size>0?n+e.more:n}function Vf(e){let t=0;for(let n of e.values())t+=n;return t}function RM(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let[n,r]of e)if(t.get(n)!==r)return false;return true}function Iq(e,t){let n=new Map(t.map(r=>[r.id,r.items.length]));for(let[r,o]of e){let a=n.get(r);if(a===void 0||o>a)return null}return e}function Rq(e){if(!(e.available>0))return SM;let t=xM(e,e.available),n=e.previous?Iq(e.previous,e.groups):null;if(!n||n.size===0||Vf(t)>=Vf(n))return t;let r=xM(e,e.available-(e.hysteresis??Eb));return RM(r,n)?n:Vf(r)>Vf(n)?kq(e,n)<=e.available?n:t:r}function PM(e,t,n,r){return e+t+n+r*2}function Ab(e,t){return e+t}function CM(e){let t=Number.parseFloat(e.marginInlineStart||e.marginLeft),n=Number.parseFloat(e.marginInlineEnd||e.marginRight);return {start:Number.isFinite(t)?t:0,end:Number.isFinite(n)?n:0}}function Pr(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function TM(e){return Pr(e.columnGap)}function EM(e){if(!(e.parentContent>0))return e.own;let t=e.parentContent-e.siblings-e.margins;return e.maxWidth!==null&&(t=Math.min(t,e.maxWidth)),Math.max(e.own,t-e.chrome)}function OM(e){return e.position==="absolute"||e.position==="fixed"||e.display==="none"}function MM(e){let t=e.computedStyleMap;if(typeof t!="function")return null;try{return t.call(e)}catch{return null}}function Lb(e,t){let n=e?.get(t);return n&&typeof n.value=="string"?n.value:null}var Pq=new Set(["auto","max-content","fit-content","min-content"]);function AM(e){return e.display.includes("flex")&&!e.flexDirection.startsWith("column")&&!e.flexWrap.startsWith("wrap")}function Zf(e,t,n){return Lb(e,`margin-${n}`)==="auto"?0:Pr(n==="left"?t.marginLeft:t.marginRight)}function Cq(e){return /^(input|textarea|select|button|img|video|canvas|iframe|svg)$/i.test(e.tagName)?true:e.children.length>0||(e.textContent??"").trim().length>0}function Tq(e,t,n){let r=t.flexBasis.trim(),o=r.endsWith("px")?Pr(r):0,a=Lb(n,"min-width")??t.minWidth.trim();return a==="auto"||a===""?Cq(e)?null:o:/^[\d.]+px$/.test(a)?Math.max(o,Pr(a)):null}function LM(e,t,n){for(let r of e.childNodes){if(r.nodeType===3&&(r.textContent??"").trim().length>0)return false;if(!Ft(r))continue;let o=Ae(r).getComputedStyle(r);if(o.display==="contents"){if(!LM(r,t,n))return false;continue}if(OM(o)||(n.items+=1,r===t))continue;let a=MM(r),s=Number.parseFloat(o.flexGrow)>0?Tq(r,o,a):r.getBoundingClientRect().width;if(s===null)return false;n.width+=s+Zf(a,o,"left")+Zf(a,o,"right");}return true}function Eq(e,t){if(!AM(t)||!e.parentElement)return 0;let n={width:0,items:0};return LM(e.parentElement,e,n)?n.width+Math.max(0,n.items-1)*Pr(t.columnGap):null}function Oq(e,t,n){let r=e.maxWidth.trim();if(r==="none"||r==="")return null;let o;if(/^-?[\d.]+%$/.test(r))o=Number.parseFloat(r)/100*t;else if(/^-?[\d.]+px$/.test(r))o=Number.parseFloat(r);else return;if(Number.isFinite(o))return e.boxSizing==="border-box"?o:o+n}var Mq="[data-toolbar-group], [data-toolbar-fixed], [data-toolbar-more]";function Fb(e,t){let n=e.getBoundingClientRect();if(!(n.width>0))return null;let r=n.left+e.clientLeft+Pr(t.paddingLeft),o=n.left+e.clientLeft+e.clientWidth-Pr(t.paddingRight);for(let a of e.querySelectorAll(Mq)){let i=a.getBoundingClientRect();if(i.width!==0&&(i.right>o+1||i.left<r-1))return true}return false}var fc=new WeakMap,zf=new WeakMap;function Aq(e,t,n,r){let o=e.parentElement;if(!o||OM(t)||(t.cssFloat||t.getPropertyValue("float")||"none")!=="none")return null;let a=MM(e),i=Lb(a,"width");if(i===null||!Pq.has(i))return null;let s=Ae(o).getComputedStyle(o),l=AM(s),c=s.display.includes("flex")&&s.flexDirection.startsWith("column"),d=(s.display==="block"||s.display==="flow-root"||c)&&!t.display.startsWith("inline");if(!l&&!d||l&&Number.parseFloat(t.flexGrow)>0)return null;let u=o.clientWidth-Pr(s.paddingLeft)-Pr(s.paddingRight),f=Math.max(0,e.offsetWidth-e.clientWidth)+r,p=Eq(e,s),g=Oq(t,u,f);return p===null||g===void 0?null:{room:EM({own:n,parentContent:u,siblings:p,margins:Zf(a,t,"left")+Zf(a,t,"right"),chrome:f,maxWidth:g}),parentContent:u}}function FM(e,t){let n=Pr(t.paddingLeft)+Pr(t.paddingRight),r=e.clientWidth-n,o=Aq(e,t,r,n);if(!o)return fc.delete(e),zf.delete(e),r;let a=fc.get(e);if(a&&a.parentContent!==o.parentContent&&fc.delete(e),Fb(e,t)===true)return zf.get(e)&&fc.set(e,{parentContent:o.parentContent,cap:r}),zf.set(e,false),r;let i=fc.get(e)?.cap??Number.POSITIVE_INFINITY,s=Math.max(r,Math.min(o.room,i));return zf.set(e,s>r),s}function Lq(e){let t=e.getBoundingClientRect().width;return t>0&&e.offsetWidth>0?e.offsetWidth/t:1}function pc(e,t){let n=e.getBoundingClientRect().width;if(n>0)return n*t;let r=e.offsetWidth;return typeof r=="number"&&r>0?r:0}function Fq(e){if(e.children.length>0)return true;for(let t of e.childNodes)if(t.nodeType===3&&(t.textContent??"").length>0)return true;return false}function Dq(e,t,n){let r=e.getComputedStyle(t).columnGap.trim();return r==="normal"?0:/^-?[\d.]+px$/.test(r)?Number.parseFloat(r):n}function Nq(e,t,n){let r=Ae(e),o=r.getComputedStyle(e),a=TM(o),i=FM(e,o),s=Lq(e),l=e.querySelector(".docx-toolbar__separator"),c=a*2;if(l){let f=CM(r.getComputedStyle(l));c=PM(pc(l,s),f.start,f.end,a);}for(let f of e.querySelectorAll("[data-toolbar-group]")){let p=f.getAttribute("data-toolbar-group"),g=pc(f,s);if(!p||!(g>0))continue;let y=[];for(let x of f.children)x.hasAttribute(Gf)&&y.push(x);if(y.length===0){t.itemWidths.set(n(p,p),g),t.groupBases.set(p,c);continue}let h=Dq(r,f,a);t.groupGaps.set(p,h);let b=0,v=0;for(let x of y){let k=x.getAttribute(Gf)??"";if(!Fq(x)){t.itemWidths.set(n(p,k),0);continue}let T=pc(x,s);T>0&&(t.itemWidths.set(n(p,k),T),b+=T,v+=1);}let S=Math.max(0,g-b-Math.max(0,v-1)*h);t.groupBases.set(p,c+S);}let d=0;for(let f of e.querySelectorAll("[data-toolbar-fixed]")){let p=pc(f,s);p>0&&(d+=Ab(p,a));}let u=e.querySelector("[data-toolbar-more]");if(u){let f=pc(u,s);f>0&&(t.more=Ab(f,a));}return {available:i,gap:a,fixed:d,more:t.more,overflowing:Fb(e,o)}}var _q=/^[a-z]$/;function Xf(e){let t=e.key.toLowerCase();if(_q.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function Db(e,t=isApplePlatform()){if(e.shiftKey||e.isComposing)return false;if(t){if(!e.metaKey||!e.altKey||e.ctrlKey)return false}else if(!e.ctrlKey||e.metaKey||e.altKey)return false;return Xf(e)==="g"}function DM(e){let t=[],n=r=>{for(let o of r)o.kind==="item"?t.push(o.slot):o.kind==="submenu"&&n(o.items);};for(let r of e)n(r.entries);return t}var NM={id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:de.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:de.file_download,state:{kind:"save"}},{id:"exportMarkdown",labelKey:"toolbar.exportMarkdown",paths:de.file_download,state:{kind:"export"}},{id:"exportPdf",labelKey:"toolbar.exportPdf",paths:de.file_download,state:{kind:"export"}},{id:"print",labelKey:"toolbar.print",paths:de.print,state:{kind:"export"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:de.settings,state:{kind:"command"}}]};var HM={id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"revisionMarkup",shape:"icon",labelKey:"revisionMarkup.title",defaultToolbar:false,paths:de.edit_note,state:{kind:"command"}},{id:"simpleMarkup",shape:"icon",labelKey:"review.simpleMarkup",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"allMarkup",shape:"icon",labelKey:"review.allMarkup",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"noMarkup",shape:"icon",labelKey:"review.noMarkup",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"original",shape:"icon",labelKey:"review.original",defaultToolbar:false,paths:de.visibility,state:{kind:"command"}},{id:"previousChange",shape:"icon",labelKey:"review.previousChange",defaultToolbar:false,paths:de.keyboard_arrow_up,state:{kind:"command"}},{id:"nextChange",shape:"icon",labelKey:"review.nextChange",defaultToolbar:false,paths:de.keyboard_arrow_down,state:{kind:"command"}},{id:"acceptAllChanges",shape:"icon",labelKey:"review.acceptAllChanges",defaultToolbar:false,paths:de.check,state:{kind:"command"}},{id:"rejectAllChanges",shape:"icon",labelKey:"review.rejectAllChanges",defaultToolbar:false,paths:de.close,state:{kind:"command"}},{id:"paragraphMarks",shape:"icon",labelKey:"formattingBar.paragraphMarks",defaultToolbar:false,paths:de.format_paragraph,state:{kind:"command"}},{id:"bookmarks",shape:"icon",labelKey:"formattingBar.showBookmarks",defaultToolbar:false,paths:de.bookmarks,state:{kind:"command"}},{id:"protectDocument",shape:"icon",labelKey:"review.protectDocument",defaultToolbar:false,paths:de.lock,state:{kind:"command"}},{id:"compareDocuments",shape:"icon",labelKey:"review.compareDocuments",defaultToolbar:false,paths:de.difference,state:{kind:"command"}},{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:de.comment,state:{kind:"command"}},{id:"addComment",shape:"icon",labelKey:"formattingBar.addComment",defaultToolbar:false,paths:de.add_comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:de.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:de.edit_note,state:{kind:"command"}}]};var _M={id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"textBox",labelKey:"toolbar.insertTextBox",paths:de.format_shapes,state:{kind:"command"}},{id:"chart",shape:"dropdown",labelKey:"chart.insert",paths:de.insert_chart,valueKey:"chart.insert",state:{kind:"value"}},{id:"footnote",labelKey:"toolbar.insertFootnote",paths:de.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:de.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:de.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:de.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:de.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:de.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:de.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:de.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:de.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:de.toc,state:{kind:"command"}},{id:"bookmark",labelKey:"toolbar.bookmark",paths:de.bookmark,state:{kind:"command"}},{id:"goToBookmark",labelKey:"toolbar.goToBookmark",paths:de.bookmarks,state:{kind:"command"}},{id:"watermark",labelKey:"toolbar.watermark",paths:de.branding_watermark,state:{kind:"command"}}]};var Hb=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:de.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:de.redo,state:{kind:"command"}}]},{id:"zoom",labelKey:"formattingBar.groups.zoom",controls:[{id:"level",shape:"stepper",valueText:"100%",labelKey:"formattingBar.groups.zoom",paths:null,valueKey:"zoom.zoomLevel",state:{kind:"command"}}]},{id:"styles",labelKey:"formattingBar.groups.styles",controls:[{id:"style",shape:"dropdown",labelKey:"styles.selectAriaLabel",paths:null,valueKey:"styles.normalText",state:{kind:"value"}}]},{id:"font",labelKey:"formattingBar.groups.font",controls:[{id:"family",shape:"dropdown",labelKey:"font.selectAriaLabel",paths:null,valueKey:"font.sansSerif",state:{kind:"value"}},{id:"size",shape:"stepper",valueText:"11",labelKey:"fontSize.listLabel",paths:null,valueKey:"fontSize.label",state:{kind:"value"}}]},{id:"text",labelKey:"formattingBar.groups.textFormatting",controls:[{id:"bold",labelKey:"formattingBar.boldShortcut",paths:de.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:de.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:de.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:de.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:de.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:de.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:de.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:de.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:de.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:de.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:de.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:de.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:de.format_align_justify,state:{kind:"command"}}]},{id:"direction",labelKey:"formattingBar.groups.direction",contextual:true,controls:[{id:"ltr",labelKey:"toolbar.leftToRight",paths:de.format_textdirection_l_to_r,state:{kind:"command"}},{id:"rtl",labelKey:"toolbar.rightToLeft",paths:de.format_textdirection_r_to_l,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:de.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:de.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:de.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:de.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:de.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:de.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:de.format_clear,state:{kind:"command"}}]},HM,{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:de.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:de.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:de.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:de.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:de.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:de.tune,state:{kind:"command"}},{id:"editChart",labelKey:"chart.edit",paths:de.insert_chart,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:de.wrap_text,valueKey:"imageWrap.inline",state:{kind:"value"}},{id:"altText",shape:"dropdown",labelKey:"formattingBar.altText",paths:null,valueKey:"imageProperties.altText",state:{kind:"value"}}]},{id:"table",labelKey:"formattingBar.groups.table",contextual:true,controls:[{id:"insert",labelKey:"toolbar.table",paths:de.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:de.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:de.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:de.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:de.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:de.format_color_fill,state:{kind:"value"}},{id:"mergeCells",labelKey:"table.mergeCells",paths:de.call_merge,state:{kind:"command"}},{id:"splitCell",labelKey:"table.splitCell",paths:de.call_split,state:{kind:"command"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:de.format_line_spacing,state:{kind:"command"}}]},NM,_M],Nb=Hb;function Bq(e,t){return `${e.id}.${t.id}`}function BM(){return Nb.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function $q(e,t){let n=BM(),r=t?.direction?Nb.find(s=>s.id==="direction"):void 0,o=n.findIndex(s=>s.id==="alignment")+1;if(r&&o>0&&(n=[...n.slice(0,o),r,...n.slice(o)]),!e)return n;let a=Nb.find(s=>s.id==="image");if(!a)return n;if(t?.chart)return [...n,a];let i=a.controls.filter(s=>s.id!=="editChart");return [...n,{...a,controls:i}]}var $M=[{id:"file",labelKey:"toolbar.file",entries:[{kind:"item",slot:"file.open",shortcutKey:"toolbar.openShortcut"},{kind:"item",slot:"file.save",labelKey:"toolbar.save",shortcutKey:"toolbar.saveShortcut"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.export",paths:de.file_download,items:[{kind:"item",slot:"file.exportMarkdown"},{kind:"item",slot:"file.exportPdf"}]},{kind:"item",slot:"file.print",shortcutKey:"toolbar.printShortcut"},{kind:"item",slot:"file.pageSetup"}]},{id:"format",labelKey:"toolbar.format",entries:[{kind:"item",slot:"text.bold",labelKey:"formattingBar.bold"},{kind:"item",slot:"text.italic",labelKey:"formattingBar.italic"},{kind:"item",slot:"text.underline",labelKey:"formattingBar.underline"},{kind:"item",slot:"text.strike"},{kind:"separator"},{kind:"item",slot:"alignment.left"},{kind:"item",slot:"alignment.center"},{kind:"item",slot:"alignment.right"},{kind:"item",slot:"alignment.justify"},{kind:"separator"},{kind:"item",slot:"direction.ltr"},{kind:"item",slot:"direction.rtl"},{kind:"separator"},{kind:"item",slot:"paragraph.dialog"},{kind:"separator"},{kind:"item",slot:"format.painter",labelKey:"formattingBar.formatPainter"},{kind:"item",slot:"format.clear"}]},{id:"insert",labelKey:"toolbar.insert",entries:[{kind:"item",slot:"image.insert"},{kind:"item",slot:"insert.textBox"},{kind:"item",slot:"insert.chart",picker:"chartType"},{kind:"item",slot:"table.insert",picker:"tableGrid"},{kind:"separator"},{kind:"item",slot:"insert.footnote"},{kind:"item",slot:"insert.endnote"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.break",paths:de.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"},{kind:"item",slot:"insert.bookmark",shortcutKey:"toolbar.bookmarkShortcut"},{kind:"item",slot:"insert.goToBookmark"},{kind:"item",slot:"insert.watermark"}]},{id:"review",labelKey:"toolbar.review",entries:[{kind:"submenu",labelKey:"review.displayForReview",paths:de.visibility,items:[{kind:"item",slot:"review.simpleMarkup"},{kind:"item",slot:"review.allMarkup"},{kind:"item",slot:"review.noMarkup"},{kind:"item",slot:"review.original"}]},{kind:"separator"},{kind:"item",slot:"review.revisionMarkup"},{kind:"item",slot:"review.previousChange"},{kind:"item",slot:"review.nextChange"},{kind:"separator"},{kind:"item",slot:"review.acceptAllChanges"},{kind:"item",slot:"review.rejectAllChanges"},{kind:"separator"},{kind:"item",slot:"review.paragraphMarks"},{kind:"item",slot:"review.bookmarks"},{kind:"separator"},{kind:"item",slot:"review.protectDocument"},{kind:"separator"},{kind:"item",slot:"review.compareDocuments"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function Wq(){return DM($M)}function qq(){return Hb.reduce((e,t)=>e+t.controls.length,0)}var Kq="formattingBar.unavailableInPreview";function Uq(e,t){let n=eb$1(e,t);if(!n||n.kind==="textValue")return null;let r=fb$1(e,t),o="http://schemas.openxmlformats.org/markup-compatibility/2006";if(r?.namespaceUri===o&&(r.localName==="Choice"||r.localName==="Fallback")){let a=fb$1(e,r.id);if(a?.namespaceUri===o&&a.localName==="AlternateContent")return a}return n}function mc(e){return e.map(t=>{if(t.match!==void 0&&typeof t.match!="function")throw new TypeError("UnsupportedElement match must be a function.");if(t.includePartial!==void 0&&typeof t.includePartial!="boolean")throw new TypeError("UnsupportedElement includePartial must be a boolean.");let n=t.layout;if(n&&(!Number.isFinite(n.width)||!Number.isFinite(n.height)||n.width<=0||n.height<=0||n.width>1e5||n.height>1e5))throw new RangeError("UnsupportedElement layout requires positive dimensions up to 100000 points.");return Object.freeze({...t,...n?{layout:Object.freeze({...n})}:{}})})}function _b(e){let t=new Map;return {...Cb$1(r=>{let o=e.find(i=>i.match?.(r)??true),a=o?o.layout??(r.placement==="block"?{width:240,height:96}:{width:120,height:24}):null;return t.set(`${r.ownerPartName}\0${r.nodeId}`,a?`${a.width},${a.height}`:"hidden"),a}),includePartial:e.some(r=>r.includePartial===true),geometryKey:()=>JSON.stringify([...t].sort(([r],[o])=>r.localeCompare(o)))}}function WM(e,t){let n=mc(e??[]);return {current:()=>n,set(r){let o=mc(r);t()?.setUnsupportedElementRules(o),n=o;}}}function qM(e,t){return {includePartial:e.includePartial,unsupportedOwnerPartName:n=>ce(t,n)?.name??t.part().name,unsupportedSource:(n,r)=>{let o=r?t.currentPackage().parts.get(r):ce(t,n);return o?Uq(o,n):null}}}var Yf=class{constructor(t,n,r,o,a=()=>null,i=()=>{}){this.selection=n;this.part=r;this.revision=o;this.drawing=a;this.outsidePrompt=i;this.position=t?Un$1(t):void 0;}selection;part;revision;drawing;outsidePrompt;entries=new WeakMap;position;lastClosed=null;save(){let t=this.part(),n=o=>{let a=eb$1(t,o.paragraphId);return {nodeId:o.paragraphId,stableId:a&&a.kind!=="textValue"?wb$1(a):null,offset:o.offset}},r=this.selection();return {partName:t.name,anchor:n(r.anchor),head:n(r.head),drawing:this.drawing(),outsidePromptId:this.outsidePrompt()}}begin(){if(!this.position)return ()=>{};let t=this.revision(),n=this.save();return ()=>{let r=this.position.current();!r||t===this.revision()||(this.entries.set(r,{before:this.entries.get(r)?.before??n,after:this.save()}),this.lastClosed={key:r,revision:this.revision()},queueMicrotask(()=>{this.lastClosed=null;}));}}noteSelectionAfterEdit(){let t=this.lastClosed;if(!t||this.position?.current()!==t.key||this.revision()!==t.revision)return;let n=this.entries.get(t.key);n&&this.entries.set(t.key,{before:n.before,after:this.save()});}step(t,n){let r=this.position?.current(),o=n(),a=t==="undo"?r:this.position?.current(),i=a?this.entries.get(a):void 0,s=t==="undo"?i?.before:i?.after;return {changed:o,selection:s?this.resolve(s):null,drawing:s?.drawing??null,outsidePromptId:s?.outsidePromptId}}resolve(t){let n=this.part();if(n.name!==t.partName)return null;let r=new Map,o=[n.root];for(;o.length;){let l=o.pop();for(let d of l.children)d.kind!=="textValue"&&o.push(d);if(l.kind!=="paragraph")continue;let c=wb$1(l);c&&r.set(c,l.id);}let a=l=>{let c=l.stableId?r.get(l.stableId):l.nodeId;return c?{paragraphId:c,offset:l.offset}:null},i=a(t.anchor),s=a(t.head);return i&&s?{anchor:i,head:s}:null}};var jq=new Set(["Shift","Control","Alt","AltGraph","Meta","OS","Hyper","Super","Symbol","Fn","FnLock","CapsLock","NumLock","ScrollLock","SymbolLock"]),Vq=["opening","fonts","drawing-resources"];function KM(e){return !jq.has(e.key)}function UM(e){return e.paragraphIds.size>0||!Vq.some(t=>e.dependencyKeys.has(t))}var Gq=new Set;function gc(e,t){let n=Hf$2(e,t.displayMode,t.authorFilter),r=Kc$1(n);if(r===n)return Gq;let o=new Set(n.map(a=>a.id));return new Set(r.flatMap(a=>o.has(a.id)?[]:[a.id]))}function zq(e,t,n){let r=Hf$2(e,n.displayMode,n.authorFilter),o=Kc$1(r);if(o===r)return null;let a=new Set(r.map(l=>l.id));if(a.has(t))return null;let i=o.findIndex(l=>l.id===t);if(i===-1)return null;let s=o.slice(i+1).find(l=>a.has(l.id));return s?.kind==="paragraph"?s.id:null}function Zq(e,t,n,r){let o=c=>e.findIndex(d=>d.kind!=="textValue"&&d.id===c),a=o(t),i=o(n);if(a===-1||i<=a)return null;let s=[];for(let c=a+1;c<i;c+=1){let d=e[c];if(d.kind==="textValue")return null;s.push(d.id);}if(s.length===0)return s;let l=r();return s.every(c=>l.has(c))?s:null}function jM(e,t,n,r){let o=fb$1(e,t);if(o===null||fb$1(e,n)?.id!==o.id)return null;let a=Zq(o.children,t,n,()=>gc(o.children,r));return a===null?null:[...a,n].map(i=>({op:"joinParagraphs",firstId:t,secondId:i}))}function VM(e,t,n,r){if(Wb$1(e,n.paragraphId).length>0)return n;let o=fb$1(t,n.paragraphId);if(o===null)return n;let a=zq(o.children,n.paragraphId,r);return a===null?n:{paragraphId:a,offset:0}}function Xq(e,t,n,r,o){if(Wb$1(e,n.paragraphId).length>0)return null;let a=fb$1(t,n.paragraphId);if(a===null||!gc(a.children,r).has(n.paragraphId))return null;let i=a.children,s=i.findIndex(d=>d.kind!=="textValue"&&d.id===n.paragraphId),l;for(let d=s-1;d>=0&&l===void 0;d-=1)i[d].kind!=="textValue"&&(l=i[d]);if(l===void 0||l.kind!=="paragraph")return null;let c=o==="backward"?{paragraphId:l.id,offset:(Nm(t,l.id)??"").length}:VM(e,t,n,r);return {ops:[{op:"joinParagraphs",firstId:l.id,secondId:n.paragraphId}],caret:c}}function Yq(e,t,n){let r=fb$1(e,t);if(r===null)return null;let o=r.children,a=o.findIndex(l=>l.kind!=="textValue"&&l.id===t);if(a===-1)return null;let i=null,s=[];for(let l=a+1;l<o.length;l+=1){let c=o[l];if(c.kind!=="textValue"){if(i??=gc(o,n),!i.has(c.id))break;s.push({op:"joinParagraphs",firstId:t,secondId:c.id});}}return s.length>0?s:null}function GM(e){let t=n=>VM(e.layout(),e.part(),n,e.view());return {joinOps:(n,r)=>jM(e.part(),n,r,e.view()),forwardJoinOps:(n,r)=>jM(e.part(),n,r,e.view())??Yq(e.part(),n,e.view()),shown:t,removedCaretEdit:(n,r)=>Xq(e.layout(),e.part(),n,e.view(),r),shownRange:n=>{let{from:r,to:o}=n;if(r.paragraphId!==o.paragraphId||r.offset!==o.offset)return n;let a=t(r);return a===r?n:{from:a,to:a}},shownSelection:n=>{let{anchor:r,head:o}=n;if(r.paragraphId!==o.paragraphId||r.offset!==o.offset)return n;let a=t(o);return a===o?n:{...n,anchor:a,head:a}}}}function Qq(e){return e.level==="inline"&&e.range!==void 0&&e.range.start<e.range.end&&(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")}function Bb(e,t,n){let r=(e.contentControls??[]).filter(l=>Qq(l)&&l.range.paragraphId===t.paragraphId&&l.range.start>=t.offset&&l.range.end<=n.offset),o=r.filter(l=>!r.some(c=>c!==l&&c.range.start<=l.range.start&&c.range.end>=l.range.end&&c.nestingDepth<l.nestingDepth)).sort((l,c)=>c.range.start-l.range.start);if(o.length===0)return null;let a=t.paragraphId,i=[],s=n.offset;for(let l of o)l.range.end<s&&i.push({op:"deleteText",paragraphId:a,start:l.range.end,end:s}),i.push({op:"removeContentControl",controlId:l.id,keepContent:false}),s=l.range.start;return t.offset<s&&i.push({op:"deleteText",paragraphId:a,start:t.offset,end:s}),i}function zM(e){let{anchor:t,head:n}=e.selection;if(t.paragraphId!==n.paragraphId)return null;if(t.offset!==n.offset){if(e.tracked)return null;let[l,c]=t.offset<n.offset?[t,n]:[n,t],d=Bb(e.layout,l,c);return d?{kind:"remove",ops:d,collapseTo:l}:null}let r=e.shown(n),o=e.direction==="backward",a=e.controlBeside(r,o?"before":"after");if(!a)return null;let i={paragraphId:r.paragraphId,offset:a.start},s={paragraphId:r.paragraphId,offset:a.end};if(a.struck){let l=o?i:s;return {kind:"select",selection:{anchor:l,head:l}}}return a.contentLocked?{kind:"select",selection:o?{anchor:s,head:i}:{anchor:i,head:s}}:{kind:"remove",ops:e.tracked?[{op:"deleteText",paragraphId:r.paragraphId,start:a.start,end:a.end}]:[{op:"removeContentControl",controlId:a.controlId,keepContent:false}],collapseTo:o?i:e.tracked?s:r}}var ZM="\uFFFC",Qf="\0";function XM(e,t){return (n,r)=>{let o=e(n,r),a=new Uint8Array(o.length);for(let{line:s}of Wb$1(n,r)??[]){let l=_a(s,r);if(l){for(let c of l.spans)a.fill(1,Math.min(c.range.start,o.length),Math.min(c.range.end,o.length));for(let c of l.drawings)c.start<o.length&&(a[c.start]=1);}}if(!t)for(let s of Yb$1(n,r))a.fill(0,Math.min(s.start,o.length),Math.min(s.end,o.length));if(!a.includes(0))return o;let i="";for(let s=0;s<o.length;s+=1)i+=a[s]?o[s]:Qf;return i}}function Jq(e,t){let n=new Map,r=new Set,o=Wb$1(e,t),a=o[0],i=a&&e.pages.find(l=>l.index===a.pageIndex),s=a&&[i?.header,i?.footer].some(l=>l?Ka$2(l.fragments).some(c=>c.lines.includes(a.line)):false);for(let{line:l,pageIndex:c}of o)if(!(s&&c!==a.pageIndex)&&!r.has(l)){r.add(l);for(let d of _a(l,t)?.spans??[])!d.fieldAtom&&!d.projected||d.range.end-d.range.start===1&&n.set(d.range.start,(n.get(d.range.start)??"")+d.text);}for(let[l,c]of n)c.length<=1&&n.delete(l);return n}function hc(e,t){let n=new Map,r=a=>{let i=n.get(a);return i||n.set(a,i=Jq(e,a)),i},o=a=>{let i=t(e,a).split("");for(let s of r(a).keys())s<i.length&&i[s]!==Qf&&(i[s]=ZM);return i};return {markedText:(a,i)=>o(i).join(""),resultAt:(a,i)=>r(a).get(i)??null,spelledText:(a,i)=>{let s=r(i);return o(i).map((l,c)=>l===ZM?s.get(c)??l:l).join("")}}}var eK=/[\p{L}\p{N}_'’]/u,$b=e=>e!==void 0&&eK.test(e);function Jf(e,t,n,r="after",o=gf$1(e,t.paragraphId)){let a=t.paragraphId,i=Math.max(0,Math.min(t.offset,o.length)),s=-1;if(r==="before"&&i>0&&$b(o[i-1])?s=i-1:$b(o[i])?s=i:i>0&&$b(o[i-1])&&(s=i-1),s===-1){let l=i,c=i;for(;l>0&&/\s/.test(o[l-1]??"");)l-=1;for(;c<o.length&&/\s/.test(o[c]??"");)c+=1;return l===c&&c<o.length&&(c+=1),{from:{paragraphId:a,offset:l},to:{paragraphId:a,offset:c}}}return {from:{paragraphId:a,offset:Ve$2(o,s+1,-1,n)},to:{paragraphId:a,offset:Ve$2(o,s,1,n)}}}function Ne(e){return {anchor:e,head:e}}function li(e){if(e.anchor.paragraphId!==e.head.paragraphId)return null;let t=Math.min(e.anchor.offset,e.head.offset),n=Math.max(e.anchor.offset,e.head.offset);return {paragraphId:e.head.paragraphId,start:t,end:n}}function ep(e,t,n){let{anchor:r,head:o}=t;if(r.paragraphId===o.paragraphId)return r.offset<=o.offset?{from:r,to:o}:{from:o,to:r};let a=n??db$1(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function aa(e,t,n){let r=t[0],o=a=>{let i=t.includes(a.paragraphId),s=i?a.paragraphId:r??a.paragraphId,l=i?a.offset:0,c=gf$1(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,c))}};return {anchor:o(n.anchor),head:o(n.head)}}function Wb(e,t,n,r,o,a=gf$1,i){let s=(p,g,y)=>o===void 0||!g.includes("\uFFFC")?g:g.replace(/\uFFFC/g,(h,b)=>o(p,y+b)??h);if(t.paragraphId===n.paragraphId)return s(t.paragraphId,a(e,t.paragraphId).slice(t.offset,n.offset),t.offset);let l=r??db$1(e),c=l.indexOf(t.paragraphId),d=l.indexOf(n.paragraphId);if(c===-1||d===-1)return "";let u=l.slice(c,d+1),f=s(t.paragraphId,a(e,t.paragraphId).slice(t.offset),t.offset);for(let p=1;p<u.length;p+=1){let g=u[p],y=a(e,g),h=$a(e,g).includes(u[p-1])||i?.(u[p-1])?"":`
25
+ `;f+=h+s(g,p===u.length-1?y.slice(0,n.offset):y,0);}return f}function QM(e,t,n,r){let o=hc(e,gf$1);return Wb(e,t,n,r,o.resultAt,o.markedText)}function JM(e,t){return ma$1(e,t,hc(e,gf$1).spelledText)}function qb(e){let t=[],n=r=>{if(r.kind!=="textValue"){r.kind==="paragraph"&&t.push(r.id);for(let o of r.children)n(o);}};return n(e),t}function eA(e){return e.kind}function tA(e){return e.kind!=="textValue"&&eA(e)==="contentControl"}function YM(e){return e.kind!=="textValue"&&eA(e)==="contentControlContent"}function tK(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=qb(o);if(a.length>0&&a.every(i=>t.has(i))){n.set(o.id,a);return}}for(let a of o.children)r(a);}};return r(e.root),n}function nK(e,t,n){let r=new Set,o=(a,i)=>{if(a.kind!=="textValue"){if(a.kind==="table"&&n.has(a.id)){for(let s of a.children)o(s,true);return}if(tA(a)){let s=qb(a);!i&&s.length>0&&s.every(l=>t.has(l))&&r.add(a.id);for(let l of a.children)o(l,i);return}for(let s of a.children)o(s,i);}};return o(e.root,false),r}function nA(e,t,n,r,o,a){let i=new Set;for(let s=n;s<=r;s+=1){let l=t[s];(s===n?o.offset===0&&(s!==r||a.offset===e(l).length):s!==r||a.offset===e(l).length)&&i.add(l);}return i}function rK(e,t,n){let r=[],o=a=>{if(a.kind!=="textValue"){if(a.kind==="table"||tA(a)){let s=qb(a).filter(l=>n.has(l));if(s.length>0&&s.every(l=>t.has(l))){r.push(a.id);return}}for(let i of a.children)o(i);}};return o(e.root),r}function rA(e,t,n,r,o){let a=f=>gf$1(e,f);if(n.paragraphId===r.paragraphId&&n.offset===r.offset)return null;let i=o??db$1(e),s=i.indexOf(n.paragraphId),l=i.indexOf(r.paragraphId);if(s===-1||l===-1||s>l)return null;let c=i.slice(s,l+1),d=nA(a,i,s,l,n,r),u=i[l];return {partName:t.name,paragraphIds:c,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...d],fullyCoveredBlockIds:rK(t,d,new Set(i)),lastMarkCovered:r.offset===a(u).length}}function oA(e,t,n,r,o,a={displayMode:e.displayMode??"all-markup",authorFilter:void 0},i=false){let s=P=>gf$1(e,P),l=(P,w,O)=>(i?null:Bb(e,{paragraphId:P,offset:w},{offset:O}))??[{op:"deleteText",paragraphId:P,start:w,end:O}];if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:l(n.paragraphId,n.offset,r.offset),collapseTo:n};let c=o??db$1(e),d=c.indexOf(n.paragraphId),u=c.indexOf(r.paragraphId);if(d===-1||u===-1)return {ops:[],collapseTo:n};let f=nA(s,c,d,u,n,r),p=i?new Map:tK(t,f),g=new Map;for(let[P,w]of p)for(let O of w)g.set(O,P);let y=nK(t,f,p),h=d;if(g.has(n.paragraphId)){h=-1;for(let P=d+1;P<=u;P+=1)if(!g.has(c[P])){h=P;break}if(h===-1){let P=g.get(n.paragraphId);for(let w of p.get(P)??[])g.delete(w);p.delete(P),h=d;}}let b=c[h],v=h===d?n:{paragraphId:b,offset:0},S=[];for(let P=d;P<=u;P+=1){let w=c[P];if(g.has(w))continue;let O=s(w).length,_=P===d?n.offset:0,q=P===u?r.offset:O;_<q&&S.push(...l(w,_,q));}for(let P of p.keys())S.push({op:"deleteBlock",blockId:P});for(let P of y)S.push({op:"removeContentControl",controlId:P});let x=P=>{let w=fb$1(t,P);for(;w&&YM(w);){let O=fb$1(t,w.id);if(!O||!y.has(O.id))break;w=fb$1(t,O.id);}return w},k=new Map,T=P=>{let w=k.get(P.id);return w||k.set(P.id,w=gc(P.children,a)),w},R=P=>{let w=[],O=_=>{for(let q of _)if(q.kind!=="textValue"&&!p.has(q.id)){if(y.has(q.id)){let K=q.children.find(YM);K&&K.kind!=="textValue"&&O(K.children);continue}if(q.kind==="paragraph"){w.push(q.id);continue}w.push(`\0barrier:${q.id}`);}};return O(P.children),w},C=(P,w)=>{let O=x(P);if(!O||x(w)!==O)return null;let _=R(O),q=_.indexOf(P),K=_.indexOf(w);if(q===-1||K<=q)return null;let U=_.slice(q+1,K);if(U.length===0)return U;let M=T(O);return U.every(Y=>M.has(Y))?U:null},A=b,E=b;for(let P=h+1;P<=u;P+=1){let w=c[P];if(g.has(w))continue;let O=C(E,w);if(O)for(let _ of [...O,w])S.push({op:"joinParagraphs",firstId:A,secondId:_});else A=w;E=w;}return {ops:S,collapseTo:v}}function aA(e,t,n,r){return t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset?[]:lf$1(e,t,n(),r)}function Kb(e,t){if(!e)return null;let n=e.position,r=o=>o.paragraphId===n.paragraphId&&o.offset===n.offset;return r(t.anchor)&&r(t.head)?e:null}function iA(e,t,n,r){if(n===null||n.length===0)return t?null:void 0;let{anchor:o,head:a}=e;if(!(o.paragraphId!==a.paragraphId||o.offset!==a.offset))return {position:a,properties:n,base:Kb(t,e)?.base??r()}}function sA(e,t,n){let r=aa(t,n,e.selection),o=n.includes(e.selection.head.paragraphId);return {selection:r,format:o&&e.format?{...e.format,position:r.head}:null}}var tp=class{undo=[];redo=[];moving=false;group;position;constructor(t){this.position=Un$1(t);}get canUndo(){return this.matches(this.undo.at(-1))}get canRedo(){return this.matches(this.redo.at(-1))}matches(t){return !!t&&!!this.position&&t.anchor===this.position.current()}record(t,n,r){if(!this.position)return;let o=this.undo.at(-1);if(r!==void 0&&r===this.group&&this.matches(o)){this.undo[this.undo.length-1]={...o,after:n},Sn$1(r,"extended");return}this.group=r,this.position.split(),this.redo.length=0,this.undo.push({anchor:this.position.current(),before:t,after:n}),this.undo.length>200&&this.undo.shift(),Sn$1(r,"started");}endGroup(){this.group=void 0;}noteEdit(){this.endGroup(),this.moving||(this.redo.length=0);}step(t,n,r){let o=t==="undo"?this.undo:this.redo,a=t==="undo"?this.redo:this.undo;this.endGroup(),this.moving=true;try{if(this.matches(o.at(-1))){let i=o.pop();a.push(i),n(t==="undo"?i.before:i.after);}else r();}finally{this.moving=false;}}};var dA=32,lA=new WeakMap,cA=new WeakMap,oK=new WeakMap,aK=new WeakMap;function np(e){let t=lA.get(e);if(t)return t;let n=[e.fragments];e.header&&n.push(e.header.fragments),e.footer&&n.push(e.footer.fragments);for(let o of [e.footnotes,e.endnotes])if(o)for(let a of o.notes)n.push(a.fragments);let r={stories:n,sparse:new Map,complete:null};return lA.set(e,r),r}function uA(e,t){let n=t?aK:oK,r=n.get(e);return r||(r={fragment:e,indent:{indent:e.indent,inTable:t},emptyStyle:e.emptyParagraphStyle},n.set(e,r)),r}function fA(e,t){return e?!e.emptyStyle&&t.emptyStyle?{...e,emptyStyle:t.emptyStyle}:e:t}function yc(e,t,n){let r=e.get(t),o=fA(r,n);o!==r&&e.set(t,o);}function iK(e,t){let n=(r,o)=>{for(let a of r){if(a.kind==="paragraph"){t(a,o);continue}for(let i of a.rows)if(!i.isHeaderRepeat)for(let s of i.cells)n(s.blocks,true);}};for(let r of e)n(r,false);}function Ub(e){if(e.complete)return e.complete;let t=new Map;iK(e.stories,(n,r)=>{let o=uA(n,r);for(let a of ab$1(n))yc(t,a,o);});for(let[n,r]of e.sparse)r&&t.set(n,r);return e.sparse.clear(),e.complete=t,t}function sK(e,t){if(e.paragraphId===t)return true;for(let n of e.lines??[])if(n.range.paragraphId===t||n.spans.some(r=>r.range.paragraphId===t)||(n.drawings??[]).some(r=>r.paragraphId===t))return ab$1(e).includes(t);return false}function pA(e,t){if(e.complete)return e.complete.get(t);let n=e.sparse.get(t);if(n!==void 0)return n??void 0;if(e.sparse.size>=dA)return Ub(e).get(t);let r,o=(a,i)=>{for(let s of a){if(s.kind==="paragraph"){if(!sK(s,t))continue;if(r=fA(r,uA(s,i)),r.emptyStyle)return true;continue}if(fg(s).has(t)){for(let l of s.rows)if(!l.isHeaderRepeat){for(let c of l.cells)if(o(c.blocks,true))return true}}}return false};for(let a of e.stories)if(o(a,false))break;return e.sparse.set(t,r??null),r}function lK(e,t,n){for(let[r,o]of n)mA(e,t,r,o);for(let r=0;r<t.frontier;r+=1)for(let[o,a]of Ub(np(e.pages[r])))n.has(o)||yc(t.entries,o,a);t.progress=null;}function mA(e,t,n,r){for(let o=r;o<t.frontier;o+=1){let a=pA(np(e.pages[o]),n);a&&yc(t.entries,n,a);}}function bc(e,t,n=false){let r=cA.get(e);r||(r={frontier:0,entries:new Map,progress:new Map},cA.set(e,r));let o=()=>{let s=r.entries.get(t);return s&&(!n||s.emptyStyle)?s:void 0},a=r.progress;if(a&&!a.has(t)&&a.size>=dA&&lK(e,r,a),r.progress){mA(e,r,t,r.progress.get(t)??0);let s=o();for(;!s&&r.frontier<e.pages.length;){let l=pA(np(e.pages[r.frontier++]),t);l&&yc(r.entries,t,l),s=o();}return r.progress.set(t,r.frontier),s??r.entries.get(t)}let i=o();for(;!i&&r.frontier<e.pages.length;){for(let[s,l]of Ub(np(e.pages[r.frontier++])))yc(r.entries,s,l);i=o();}return i??r.entries.get(t)}var jb=e=>Kf$1(e)?"rtl":"ltr";function hA(e,t){return bc(e,t,true)?.emptyStyle}var yA=Object.freeze([]);function Gn(e,t){return bc(e,t)?.fragment.props??yA}function vc(e,t){return bc(e,t)?.fragment.tabStops??null}function rp(e){return Math.round((e.hanging>0?-e.hanging:e.firstLine)*20)}function xc(e,t){return bc(e,t)?.indent??null}function bA(e,t,n,r,o=Yh$1,a){let i=eb$1(e,t);if(!i||i.kind!=="paragraph")return false;for(let s of Zh$1(i,ki(i),n,r,o,a))if(fi$1(ei$1(s.run,"runProperties","rPr"),ci$1).length>0)return true;return false}function ia(e,t,n,r=Yh$1,o){let a=eb$1(e,t);if(!a||a.kind!=="paragraph")return [];let i=zi(a,n)?Ai(a,n):void 0;if(i?.kind==="none")return [];if(!i&&si$1(a,n)===null)return [];let s=ri$1(a,n,r,o);return s?fi$1(ei$1(s,"runProperties","rPr"),ci$1):hi$1(e,t)}function ci(e,t,n){let r=e?.find(a=>a.localName===t);if(!r)return null;let o=r.attributes?.val;return t==="vertAlign"?o===n:(t==="u"||o!=="0"&&o!=="false"&&o!=="off")&&o!=="none"}function vA(e,t){if(!t||t.length===0)return e;let n=e;for(let r of t){let o=r.attributes?.val;switch(r.localName){case "b":n={...n,bold:ci(t,"b")===true};break;case "i":n={...n,italic:ci(t,"i")===true};break;case "u":n={...n,underline:ci(t,"u")===true};break;case "strike":n={...n,strikethrough:ci(t,"strike")===true};break;case "vertAlign":n={...n,superscript:o==="superscript",subscript:o==="subscript"};break;case "rFonts":n={...n,fontFamily:r.attributes?.ascii??n.fontFamily};break;case "sz":{let a=Number(o);Number.isFinite(a)&&(n={...n,fontSizeHalfPoints:a});break}case "color":n={...n,color:o==="auto"?null:o??n.color};break;case "highlight":n={...n,highlight:o==="none"?null:o??n.highlight};break;}}return n}function Vb(e,t,n,r){return (n&&n.length>0?ka(e,n):jf$1(e,t,r??(t.anchor.paragraphId===t.head.paragraphId?[]:fb$2(e)))).map(a=>{let i=E$2(D$1(a.style));return i===a.style?a:{...a,style:i}})}function op(e,t){let n=e.indexOf(t.from.paragraphId),r=e.indexOf(t.to.paragraphId);if(n===-1||r===-1)return [];let o=r>n&&t.to.offset===0?r-1:r;return e.slice(n,o+1)}function ap(e,t,n,r){return Vb(e,t,n,r)[0]?.style??null}function xA(e,t,n,r,o,a){let i=Vb(e,t,r,a),s=i.length===0&&!r?.length&&t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset?hA(e,t.head.paragraphId):void 0,l=i.length>0?i.map(d=>d.style):s?[s]:[];if(l.length===0)return false;let c=d=>{switch(n){case "b":return d.bold;case "i":return d.italic;case "u":return d.underline!==null;case "strike":return d.strike;case "vertAlign":return d.verticalAlign===o;default:return false}};return l.every(c)}var cK=/\p{L}/u;function dK(e,t,n){let r=e.range.paragraphId===t.paragraphId?t.offset:e.range.start,o=e.range.paragraphId===n.paragraphId?n.offset:e.range.end;return e.text.slice(Math.max(0,r-e.range.start),Math.max(0,o-e.range.start))}function SA(e,t,n,r,o,a,i,s=true){let l=s?Vb(e,t,r,a):[],c=l.length===0?gA(e,t,r,a).map(H=>hA(e,H)).filter(H=>H!==void 0):[],d=c.length>0?c:l.map(H=>H.style),u=H=>{if(d.length===0)return null;let G=H(d[0]);return d.every(D=>H(D)===G)?G:null},f=(H,G=(D,B)=>D===B)=>H.length>0&&H.every(D=>G(D,H[0]))?H[0]:null,p=(H,G)=>H.props.some(D=>D.localName===G),g=l.some(H=>H.fontSlot==="eastAsia"),{anchor:y,head:h}=t,b=y.paragraphId===h.paragraphId&&y.offset===h.offset,v=!g||b||r?.length?null:ff$1(t,y.paragraphId===h.paragraphId?[]:a??fb$2(e)),S=g?l.filter(H=>cK.test(v?dK(H,v.from,v.to):H.text)):[],x=S.length>0?S:l,k=H=>Ga$1(H.style,H.fontSlot).fontFamily??n?.(H.range.paragraphId,H.props).fontFamily??null,T=H=>p(H,"sz")?Math.round(H.style.fontSizePt*2):n?.(H.range.paragraphId,H.props).fontSizeHalfPoints??Math.round(H.style.fontSizePt*2),R=c.length>0?{fontFamily:u(H=>H.fontFamily??i??null),fontSizeHalfPoints:u(H=>Math.round(H.fontSizePt*2))}:l.length===0?n?.(t.head.paragraphId,[]):void 0,C=gA(e,t,r,a),A=H=>f(C.map(G=>H(Gn(e,G)))),E=(H,G=(D,B)=>D===B)=>{if(C.length<2)return false;let D=H(Gn(e,C[0]));return C.some((B,Z)=>Z>0&&!G(H(Gn(e,B)),D))},P=A(H=>Qd$1(H)),w=A(jb),O=A(H=>_$1(H,"pStyle")?.val??o??void 0)??null,_=H=>_$1(H,"spacing")??void 0,q=H=>{if(H===yA)return "";let G=aa$1(H),D=B=>Math.round(B*100)/100;return G.rule==="auto"?`multiple:${D(G.value/240)}`:`${G.rule}:${D(G.value)}`},K=A(q),U=(()=>{if(!K)return null;let[H,G]=K.split(":");return {rule:H,value:Number(G)}})(),M=(H,G)=>{let D=Qd(_(H)?.[G]);return D===null?null:Math.round(D/20*100)/100},Y=H=>A(G=>M(G,H)),ne=(()=>{let H=Q=>jb(Gn(e,Q))==="rtl",G=C.map(Q=>{let ue=xc(e,Q);return !ue||!H(Q)?ue:{...ue,indent:{...ue.indent,left:ue.indent.right,right:ue.indent.left}}}),D=G[0];if(!D||G.some(Q=>Q===null||Q.inTable))return null;let B=H(C[0]),Z=Q=>Math.round(Q*20),X=G,N=Z(D.indent.left),j=Z(D.indent.right),z=rp(D.indent);return {left:N,right:j,firstLine:z,mixed:{left:X.some(Q=>Z(Q.indent.left)!==N),right:X.some(Q=>Z(Q.indent.right)!==j),firstLine:X.some(Q=>rp(Q.indent)!==z)},...B?{rtl:B}:{}}})(),le=H=>A(G=>H(Ff$2(G))),se=A(T$1),W=A(ca$1);return {bold:d.length>0&&d.every(H=>H.bold),italic:d.length>0&&d.every(H=>H.italic),underline:d.length>0&&d.every(H=>H.underline!==null),strikethrough:d.length>0&&d.every(H=>H.strike),superscript:d.length>0&&d.every(H=>H.verticalAlign==="superscript"),subscript:d.length>0&&d.every(H=>H.verticalAlign==="subscript"),fontFamily:l.length>0?f(x.map(k)):R?.fontFamily??null,fontSizeHalfPoints:l.length>0?f(l.map(T)):R?.fontSizeHalfPoints??null,color:u(H=>H.color),highlight:u(H=>H.highlight),alignment:P,direction:w,styleId:O,lineSpacing:U,spaceBeforePt:Y("before"),spaceAfterPt:Y("after"),disagrees:{alignment:E(H=>Qd$1(H)),direction:E(jb),spaceBeforePt:E(H=>M(H,"before")),spaceAfterPt:E(H=>M(H,"after")),lineSpacing:E(q),tabStops:(()=>{if(C.length<2)return false;let H=JSON.stringify(vc(e,C[0])?.stops??null);return C.some((G,D)=>D>0&&JSON.stringify(vc(e,G)?.stops??null)!==H)})()},indent:ne,tabStops:f(C.map(H=>vc(e,H)?.stops??null),(H,G)=>H===null||G===null?H===G:H.length===G.length&&H.every((D,B)=>Math.round(D.positionPt*20)===Math.round(G[B].positionPt*20)&&D.alignment===G[B].alignment&&(D.leader??"none")===(G[B].leader??"none")))?.map(H=>({positionTwips:Math.round(H.positionPt*20),alignment:H.alignment,...H.leader?{leader:H.leader}:{}}))??null,paragraphFlags:{contextualSpacing:W,keepNext:le(H=>H.keepNext),keepLines:le(H=>H.keepLines),widowControl:le(H=>H.widowControl),pageBreakBefore:se}}}function gA(e,t,n,r){if(n&&n.length>0)return [...ja$1(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??fb$2(e),a=o.indexOf(t.anchor.paragraphId),i=o.indexOf(t.head.paragraphId);return a===-1||i===-1?[t.head.paragraphId]:o.slice(Math.min(a,i),Math.max(a,i)+1)}function wA(e,t,n,r){return t.paragraphId!==n.paragraphId?[]:t.offset!==0||n.offset!==e.length?[]:e.length===0?[]:[{op:"setParagraphMarkProperties",paragraphId:t.paragraphId,properties:r}]}var uK=/\p{L}/u;function fK(e){for(let t of e)if(uK.test(t))return Ab$1.test(t)?"rtl":"ltr";return null}function kA(e,t,n){return (r,o,a,i)=>{let{paragraphId:s,offset:l}=r,c=o-a.length;if(fK(a)!=="rtl")return [...i];let d=t(),u=n(),f=ce(e,s)??e.part();if(qi(f,s,l,b$3(e.stylesRoot(),e.settingsRoot(),d,u),d,u))return [...i];let g=h=>[...h.filter(b=>b.localName!=="rtl"),{localName:"rtl"}],y=i.findIndex(h=>h.op==="setRunProperties"&&h.paragraphId===s&&h.start===c&&h.end===c+a.length);return y>=0?i.map((h,b)=>b===y&&h.op==="setRunProperties"?{...h,properties:g(h.properties)}:h):[...i,{op:"setRunProperties",paragraphId:s,start:c,end:c+a.length,properties:g(ia(f,s,l,d,u))}]}}function IA(e,t,n,r){let o=e??hb$1,a,i,s;return {current:()=>o,filter(){let l=t();return (!s||l!==a||o!==i)&&(a=l,i=o,s={...l,hiddenAuthors:l?.hiddenAuthors??new Set,revisionMarkup:o,cacheKey:`${l?.cacheKey??""}|markup:${JSON.stringify(o)}`}),s},set(l){JSON.stringify(l)!==JSON.stringify(o)&&(n(),o=l,r());}}}function RA(e){return e?.root.children.some(t=>t.kind!=="textValue"&&(t.localName==="mirrorMargins"||t.localName==="evenAndOddHeaders")&&!t.attributes.some(n=>n.localName==="val"&&["0","false","off"].includes(n.value)))??false}function PA(e,t,n,r){let o=eb$1(e,t);if(o?.kind!=="paragraph")return false;if(!Ic$2(o,n,r))return true;let a=fb$1(e,t);return a?Hf$2(a.children,n,r).some(i=>i.kind==="paragraph"&&i.id===t):false}function pK(e){if(e.altKey)return false;let t=e.key.toLowerCase();return (e.ctrlKey||e.metaKey)&&!e.shiftKey&&(t==="c"||t==="x")?true:e.ctrlKey&&t==="insert"||e.shiftKey&&!e.ctrlKey&&t==="delete"}var mK=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),Gb=new WeakSet;function CA(e){return Gb.has(e)}function TA(e){let t=null,n=o=>{if(!Zu(o))return;let{clientX:a,clientY:i}=o,s=Date.now(),l=t===null?-1:s-t.time,c=t!==null&&l>=0&&l<=500&&Math.abs(a-t.x)<=4&&Math.abs(i-t.y)<=4;return t=c?null:{time:s,x:a,y:i},{clientX:a,clientY:i,double:c}},r=(o,a)=>e.surface.selectDrawing(o,a)?(e.setIntent({kind:"pointer",drawingNodeId:o}),true):false;return {onDrawingPointerGesture(o){if(Zu(o)&&o.button!==0||e.surface.editingMode()==="view")return;let a=Ft(o.target)?o.target:null,i=e.textbox()?.preparePointer(a,n(o));i&&Gb.add(o);let s=i?null:e.textbox()?.takeRefusedPress();if(s&&r(s.drawingNodeId,s.hostParagraphId)){Gb.add(o),o.preventDefault(),o.stopImmediatePropagation();return}let l=!i&&a?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");if(l&&a?.closest(".docx-drawing-textbox")){let c;for(let d of e.surface.layout().pages)if(c=$b$1(d,l),c)break;if(c&&r(l,c.paragraphId)){o.preventDefault(),o.stopImmediatePropagation();return}}e.setIntent(l?{kind:"pointer",drawingNodeId:l}:{kind:"none"});},onDrawingKeyGesture(o){if(ja(o)&&mK.has(o.key)||ja(o)&&pK(o))return;let a=e.textbox(),i=a?.active();if(ja(o)&&o.key==="Escape"&&i){a.exit(),r(i.drawingNodeId,i.hostParagraphId),o.preventDefault(),o.stopImmediatePropagation();return}let s=ja(o)&&o.key==="Enter"&&!o.shiftKey&&!o.altKey&&!o.ctrlKey&&!o.metaKey,l=e.intent();if(s&&!i&&l.kind==="pointer"&&a?.enterDrawing(l.drawingNodeId)){e.setIntent({kind:"none"}),o.preventDefault(),o.stopImmediatePropagation();return}if((ja(o)&&(o.key==="Delete"||o.key==="Backspace")&&!o.altKey&&!o.ctrlKey&&!o.metaKey||ah(o)&&(o.inputType==="deleteContentBackward"||o.inputType==="deleteContentForward"))&&e.intent().kind==="pointer"){let d=tn(e.surface);if(d!==null){o.preventDefault(),o.stopImmediatePropagation(),e.setIntent({kind:"none"}),e.surface.deleteImage(d.drawingNodeId);return}}e.setIntent({kind:"none"});}}}function EA(e,t,n){let r=t.owner;if(!r){for(let i of e.pages){let s=$b$1(i,t.drawingNodeId);if(s)return {pageIndex:i.index,drawing:s,origin:s}}return null}if(r.kind!=="headerFooter")return null;let o=n===void 0?void 0:e.pages[n],a=o?.index===n?o:void 0;for(let i of a?[a,...e.pages]:e.pages){let s=Jl(i).find(l=>l.drawing.drawingNodeId===t.drawingNodeId&&(l.rId===void 0||l.rId===r.rId));if(s)return {pageIndex:i.index,drawing:s.drawing,origin:s.origin,kind:s.kind}}return null}function gK(e,t,n){if(!t.double&&n===void 0)return null;let r=e?.closest("[data-page-index]");if(!r)return null;let o=n!==void 0&&!!e?.closest("[data-docx-hf-active] [data-start]"),a=[...r.querySelectorAll(".docx-drawing-textbox-content")].reverse();for(let i of a){let s=i.closest("[data-docx-hf], [data-docx-hf-front], [data-docx-hf-behind]"),l=!!s?.hasAttribute("data-docx-hf-behind");if(!s||l&&(n===void 0||o))continue;let c=i.getBoundingClientRect();if(t.clientX>=c.left&&t.clientX<=c.right&&t.clientY>=c.top&&t.clientY<=c.bottom)return i}return null}function hK(e){let n=e.closest(".docx-editor__scroll-container")?.getBoundingClientRect()??{top:0,bottom:e.ownerDocument.defaultView?.innerHeight??0};for(let r of e.querySelectorAll(".docx-page[data-page-index]")){let o=r.getBoundingClientRect();if(o.bottom>n.top&&o.top<n.bottom)return Number(r.dataset.pageIndex)}}function OA(e){let t=null,n,r=null,o=null,a=y=>y.owner?e.partOf(y.drawingNodeId):e.session.part(),i=y=>{let h=a(y);return h?fk(h).find(b=>b.root.id===y.id&&b.drawingNodeId===y.drawingNodeId):void 0},s=()=>t&&i(t),l=y=>!y.owner||y.owner.kind==="headerFooter"&&e.headerFooter.active()?.rId===y.owner.rId,c=()=>{if(t&&!l(t)){d(false);return}if(t&&!s()){d();return}let h=t?.owner?.kind==="headerFooter"?e.headerFooter.active():null;h&&n!==h.pageIndex&&(n=h.pageIndex,o=null);for(let b of e.pagesLayer.querySelectorAll(".docx-drawing-textbox")){let v=b.dataset.drawingNodeId===t?.drawingNodeId&&(n===void 0||b.closest("[data-page-index]")?.getAttribute("data-page-index")===String(n)),S=b.dataset.docxTextboxActive;if(S!==String(v)){if(b.dataset.docxTextboxActive=String(v),b.contentEditable=v?"true":"false",b.setAttribute("role",v?"textbox":"img"),v)b.removeAttribute("aria-hidden"),b.setAttribute("aria-multiline","true");else if(b.removeAttribute("aria-multiline"),b.hasAttribute("aria-label")||b.setAttribute("aria-hidden","true"),S!=="true")continue;for(let x of b.querySelectorAll("[data-textbox-paragraph-id]"))v?x.dataset.paragraphId=x.dataset.textboxParagraphId:delete x.dataset.paragraphId;}}},d=(y=true)=>{t&&(e.flush(),t=null,n=void 0,o=null,c(),y&&r&&e.setSelection(r),r=null);},u=(y,h)=>{if(y.owner&&y.owner.kind!=="headerFooter"||!e.writable())return false;e.flush();let b=a(y),v=b&&fk(b).find(E=>E.root.id===y.id&&E.drawingNodeId===y.drawingNodeId&&E.hostParagraphId===y.hostParagraphId),S=e.headerFooter.active(),x=y.owner,k=h??(x?S?.rId===x.rId?S.pageIndex:hK(e.pagesLayer):void 0),T=EA(e.layout(),y,k),R=T?.drawing;if(!b||!v||!T||!R||!df(b,v.root.id,R))return false;let C=R.textboxStory.fragments[0];if(!C||C.kind!=="paragraph")return false;if(t?.id===y.id&&n===(x?T.pageIndex:void 0))return true;if(d(),x&&(S?.rId!==x.rId||S.pageIndex!==T.pageIndex)&&(!T.kind||!e.headerFooter.enter(x.rId,T.pageIndex,T.kind)))return false;e.leaveOtherStories(x),r=e.selection(),t=y,n=x?T.pageIndex:void 0,o=null,c();let A={paragraphId:C.paragraphId,offset:C.range.start};return e.setSelection({anchor:A,head:A}),true},f=y=>t?EA(y,t,n):null,p=null,g=(y,h)=>{let b=fk(e.session.part()).find(R=>R.drawingNodeId===y);if(b)return {scope:{kind:"frame",id:b.root.id,drawingNodeId:y,hostParagraphId:b.hostParagraphId}};let v=e.partOf(y),S=v&&fk(v).find(R=>R.drawingNodeId===y);if(!S)return null;let x=e.layout(),k=h===void 0?void 0:x.pages[h],T=k&&k.index===h?[k,...x.pages]:x.pages;for(let R of T){let C=Jl(R).find(A=>A.drawing.drawingNodeId===y);if(C?.rId)return {scope:{kind:"frame",id:S.root.id,drawingNodeId:y,hostParagraphId:S.hostParagraphId,owner:{kind:"headerFooter",rId:C.rId}},pageIndex:R.index,kind:C.kind}}return null};return {active:()=>t,replacementFormatOps(y,h,b){let{anchor:v,head:S}=e.selection(),x=t&&a(t);if(!x||b===0||v.paragraphId===S.paragraphId&&v.offset===S.offset)return [];let k=ia(x,y,h);return k.length?[{op:"setRunProperties",paragraphId:y,start:h,end:h+b,properties:k}]:[]},enter:y=>u(y),exit:d,syncDom:c,contains:y=>{let h=s();return !!h&&id(h.root).some(b=>b.id===y)},paragraphIds:()=>{let y=s();return y?id(y.root).map(h=>h.id):[]},caretInput(y){let h=f(y);if(!h)return {};let b=h.drawing.drawingNodeId,S=[...e.pagesLayer.querySelectorAll(".docx-drawing-textbox")].find(k=>k.dataset.drawingNodeId===b&&k.closest("[data-page-index]")?.dataset.pageIndex===String(h.pageIndex))?.querySelector(".docx-drawing-textbox-content");if(!S)return {};let x=h.drawing.textboxStory;return {scopedHost:S,scopedHostKind:"textbox",scopedOrigin:{x:h.origin.x+x.contentOffset.x,y:h.origin.y+x.contentOffset.y}}},layout(y){if(!t)return y;if(o?.base===y&&o.id===t.id)return o.layout;let h=f(y),b=h?.drawing.textboxStory,v=h&&b?b.fragments.flatMap(x=>x.kind==="paragraph"?[Pf$1(x,h.origin.x+b.contentOffset.x,h.origin.y+b.contentOffset.y)]:[]):[],S={...y,pages:y.pages.map(x=>({...x,header:void 0,footer:void 0,footnotes:void 0,endnotes:void 0,anchoredDrawings:[],fragments:t.owner?x.index===h?.pageIndex?v:[]:$b$1(x,t.drawingNodeId)?v:[]}))};return o={base:y,id:t.id,layout:S},S},enterDrawing(y){let h=e.headerFooter.active(),b=g(y,h?.pageIndex);return !!b&&u(b.scope,b.pageIndex)},takeRefusedPress(){let y=p;return p=null,y},preparePointer(y,h){p=null;let b=y?.closest(".docx-drawing-textbox-content")??(h?gK(y,h,e.headerFooter.active()?.rId):null),v=b?.closest("[data-drawing-node-id]")?.dataset.drawingNodeId,S=Number(b?.closest("[data-page-index]")?.dataset.pageIndex),x=v?g(v,Number.isInteger(S)?S:void 0):null;if(x&&u(x.scope,x.pageIndex))return true;d(false);let k=x?.scope.owner;if(x&&k?.kind==="headerFooter"&&x.kind&&x.pageIndex!==void 0){let T=e.headerFooter.active();(T?.rId===k.rId&&T.pageIndex===x.pageIndex||e.headerFooter.enter(k.rId,x.pageIndex,x.kind))&&(p={drawingNodeId:x.scope.drawingNodeId,hostParagraphId:x.scope.hostParagraphId});}return false}}}function MA(e,t){return e?.active()?null:t?.getActive()??null}function AA(e,t,n){let r={session:e,headerFooter:()=>n().hfScope,sectionAtPage:t,exitNote:()=>n().noteOps?.exitNote()};return {partOf:o=>ce(r.session,o)??null,leaveOtherStories:o=>{r.exitNote();let a=r.headerFooter();o&&a?.getActive()?.scope.rId===o.rId||a?.exitHeaderFooter();},headerFooter:{active:()=>{let o=r.headerFooter()?.getActive();return o?{rId:o.scope.rId,pageIndex:o.pageIndex}:null},enter:(o,a,i)=>r.headerFooter()?.enterHeaderFooter({rId:o,pageIndex:a,sectionIndex:r.sectionAtPage(a).sectionIndex,kind:i})??false}}}function LA(e,t,n){return (r,o)=>{let a=t(),i=n();return qi(ce(e,r)??e.part(),r,o,a$8(e.stylesRoot(),e.settingsRoot(),a,i),a,i)}}var bK=[["--docx-hf-add-header","headerFooter.addHeaderHint"],["--docx-hf-add-footer","headerFooter.addFooterHint"],["--docx-hf-edit-header","headerFooter.editHeaderHint"],["--docx-hf-edit-footer","headerFooter.editFooterHint"]];function vK(e){return `"${e.replace(/[\\"]/g,"\\$&").replace(/[\n\r\f]/g," ")}"`}function Zb(e,t){e.setAttribute("aria-label",t?.("editor.documentContent")??en.editor.documentContent);for(let[n,r]of bK){let o=t?.(r);o&&o!==r?e.style.setProperty(n,vK(o)):e.style.removeProperty(n);}}var kc="An external document refresh is in progress.",Ic="rejected",Cr="A preview is open. Commit or discard it before editing.",vs=new WeakSet,wc=new WeakSet,FA=new WeakMap,lr=e=>vs.has(e)||wc.has(e),DA=e=>vs.has(e),xs=e=>!vs.has(e)&&wc.has(e)?Cr:kc;function sa(e,t){t?vs.add(e):vs.delete(e);}function Xb(e,t){t?wc.add(e):wc.delete(e);}function NA(e,t){FA.set(e,t);}var ip=e=>FA.get(e)?.()??false,xK=new Set(["toggleReviewPane","toggleParagraphMarks","selectAll","setSelection","copyFormatting"]),SK=(e,t)=>!vs.has(e)&&wc.has(e)&&xK.has(t.type),Yb=(e,t)=>e&&lr(e)&&!SK(e,t)?{ok:false,code:"unsupported",reason:xs(e)}:null;function HA(e){let t="select[data-docx-form-dropdown]",n=c=>Ft(c)?c.closest(t):null,r=c=>{let d=c.closest("[data-start][data-paragraph-id]"),u=d?.dataset.paragraphId;if(!d||!u)return null;let f=e.part(u),p=eb$1(f,u);if(p?.kind!=="paragraph")return null;let g=Number(d.dataset.start),y=Gk(p).find(b=>b.start<=g&&g<b.end);if(!y)return null;let h={op:"setLegacyDropdown",paragraphId:u,fieldNodeId:y.fieldNodeId,selectedIndex:c.selectedIndex};return {field:y,paragraphId:u,op:h,enabled:e.editable()&&e.canApply(h)&&Yk(e.settings(),h)===null&&En$1(f,h)===null}},o=()=>{for(let c of e.pagesLayer.querySelectorAll(t))c.disabled=!r(c)?.enabled;},a=c=>{let d=n(c.target);d&&(c.stopPropagation(),r(d)?.enabled||c.preventDefault());},i=c=>{let d=n(c.target);d&&(d.disabled=!r(d)?.enabled);},s=c=>{let d=n(c.target);if(!d)return;c.stopPropagation();let u=r(d);if(!u)return;if(!u.enabled||!e.apply(u.op)){d.selectedIndex=u.field.selectedIndex;return}e.select({anchor:{paragraphId:u.paragraphId,offset:u.field.start},head:{paragraphId:u.paragraphId,offset:u.field.end}}),[...e.pagesLayer.querySelectorAll(t)].find(p=>{let g=p.closest("[data-start][data-paragraph-id]");return g?.dataset.paragraphId===u.paragraphId&&Number(g.dataset.start)===u.field.start})?.focus({preventScroll:true});},l=new(Ae(e.pagesLayer)).MutationObserver(c=>{for(let d of c)for(let u of d.addedNodes){if(!Ft(u))continue;let f=u.matches(t)?[u]:u.querySelectorAll(t);for(let p of f)p.disabled=!r(p)?.enabled;}});return l.observe(e.pagesLayer,{childList:true,subtree:true}),e.pagesLayer.addEventListener("pointerdown",a,true),e.pagesLayer.addEventListener("focusin",i),e.pagesLayer.addEventListener("change",s),o(),{sync:o,keydown(c){let d=n(c.target);if(!d)return false;c.stopPropagation();let u=c.key.toLowerCase();return (c.ctrlKey||c.metaKey)&&!c.altKey&&(u==="z"||u==="y")?(c.preventDefault(),e.pagesLayer.focus({preventScroll:true}),e.history(u==="y"||c.shiftKey?"redo":"undo"),true):(!r(d)?.enabled&&c.key!=="Tab"&&c.preventDefault(),true)},destroy(){l.disconnect(),e.pagesLayer.removeEventListener("pointerdown",a,true),e.pagesLayer.removeEventListener("focusin",i),e.pagesLayer.removeEventListener("change",s);}}}function _A(e,t){let n=fb$1(e,t.id);for(let a=0;n&&a<64&&(n.namespaceUri===pa$2&&n.localName==="customXml"||ld(n)||md(n));a+=1)n=fb$1(e,n.id);if(!n)return [];let r=pd(n.children),o=r.findIndex(a=>a.id===t.id);return o>=2?r.slice(o-2,o):[]}function BA(e){let t=n=>n.kind==="textValue"?/^[ \t\u00a0]*$/.test(n.value):n.namespaceUri!==pa$2?false:n.localName==="pPr"?!n.children.some(r=>r.kind!=="textValue"&&r.localName==="sectPr"):n.localName==="rPr"||n.localName==="tab"||["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","proofErr"].includes(n.localName)?true:["p","r","t","hyperlink"].includes(n.localName)?n.children.every(t):false;return t(e)}function $A(e,t,n,r,o,a,i,s){let l=eb$1(e,n.paragraphId);if(l?.kind!=="paragraph")return null;let[c,d]=_A(e,l);if(d?.kind!=="paragraph"||c?.kind!=="paragraph"||!BA(d))return null;let u=cb$1(t,l.id),f=cb$1(t,c.id);if(!u||u.numId!==f?.numId||u.level!==f.level||cb$1(t,d.id))return null;let p=(T,R,C,A)=>({id:T,kind:R,localName:C,namespaceUri:pa$2,prefix:"w",namespaceBindings:[],attributes:[],children:A}),g=l.children.find(T=>T.kind==="paragraphProperties"),y=g&&{...g,children:g.children.filter(T=>T.localName!=="sectPr")},h=Fk({localName:"pStyle",attributes:{val:o}},"separator-style"),b=r.map((T,R)=>Fk(T,`separator-format-${R}`));i&&b.push(Fk({localName:"ins",attributes:{id:Nb$1(e,s)(),author:i.author,...i.date?{date:i.date}:{}}},"separator-insertion"));let v=p("separator-mark","runProperties","rPr",b),S=p("separator-properties","paragraphProperties","pPr",[...h?[h]:[],...b.length?[v]:[]]),x=[...S.children],k=a?.styles.has(o)?S:p("separator-defaults","paragraphProperties","pPr",[]);return a&&Yd(Af$1(a,k).paragraphPropertyNodes)&&x.splice(h?1:0,0,p("separator-numbering","generic","numPr",[Fk({localName:"numId",attributes:{val:"0"}},"separator-number-id")])),{op:"insertFragment",paragraphId:l.id,offset:n.offset,blocks:[p("separator-head","paragraph","p",y?[y]:[]),p("separator-blank","paragraph","p",[p("separator-properties-final","paragraphProperties","pPr",x)])],lastMarkCovered:true}}function WA(e,t=true){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:t})??false}function Qb(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}var qA=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve","revision-attribution"]);var wK="list paragraph",kK="ListParagraph",Jb=e=>e.localName==="ind";function IK(e,t){if(!t||!Jb(e))return e;if(t==="all")return null;let n=Object.entries(e.attributes??{}).filter(([r])=>!Nn.has(r));return n.length>0?{...e,attributes:Object.fromEntries(n)}:null}function KA(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function sp(e){let t=null;for(let n of e)if(n.type==="paragraph"){if(n.name.trim().toLowerCase()===wK)return n.styleId;t===null&&n.styleId===kK&&(t=n.styleId);}return t}function UA(e){let{session:t}=e,n;function r(){let o=t.stylesRoot();return (n===void 0||n.root!==o)&&(n={root:o,styleId:zf$1(o,t.documentThemeFonts()).defaultParagraphStyleId}),n.styleId}return {applyOps(o,a){let i=sp(t.documentStyles()),s=r(),l=e.storyPart(),c=[];for(let d of o){let u=gi$1(l,d),f=a?.(d)===true&&u.some(Jb),p=f?u.filter(h=>!Jb(h)):u,g=KA(u),y=i!==null&&(g===void 0||g===s);!y&&!f||c.push({op:"setParagraphProperties",paragraphId:d,properties:y&&i!==null?ii$1(p,{localName:"pStyle",attributes:{val:i}}):p});}return c},linkedStyleOp(o,a,i=false){if(!t.documentStyles().some(c=>c.type==="paragraph"&&c.styleId===a))return null;let l=gi$1(e.storyPart(),o).flatMap(c=>{if(c.localName==="numPr")return [];let d=IK(c,i);return d?[d]:[]});return {op:"setParagraphProperties",paragraphId:o,properties:ii$1(l,{localName:"pStyle",attributes:{val:a}})}},clearOp(o){let a=sp(t.documentStyles());if(a===null)return null;let i=gi$1(e.storyPart(),o);return KA(i)!==a?null:{op:"setParagraphProperties",paragraphId:o,properties:i.filter(s=>s.localName!=="pStyle")}}}}function jA(e,t){return h$4(t,n=>n("style",{type:"paragraph",styleId:t},[n("name",{val:"List Paragraph"}),...e?[n("basedOn",{val:e})]:[],n("uiPriority",{val:"34"}),n("qFormat"),n("pPr",{},[n("ind",{left:"720"}),n("contextualSpacing")])]))}function lp(e,t){let n=e.ownerDocument,r=e.dataset.docxCcId,o=()=>{n.removeEventListener("pointerdown",a,true),n.removeEventListener("keydown",i,true);},a=s=>{if(e.parentNode===null){o();return}let l=s.target,c=Ft(l)?l.closest("[data-docx-cc-widget]"):null;l&&(e.contains(l)||c?.getAttribute("data-docx-cc-id")===r)||(o(),t());},i=s=>{s.key!=="Escape"||s.isComposing||(s.preventDefault(),o(),e.parentNode!==null&&(s.stopPropagation(),t()));};return n.addEventListener("pointerdown",a,true),n.addEventListener("keydown",i,true),o}function VA(e,t,n,r,o){let i=ef$1(e).find(u=>u.id===n)?.fragments[0],s=i?e.pages[i.pageIndex]:void 0;if(!i||!s)return null;let l=o?.get(i.pageIndex)??0,c=s.contentBox.x-s.box.x,d=s.contentBox.y-s.box.y;return {left:(s.box.x+l+c+i.box.x)*t,top:(s.box.y+d+i.box.y+i.box.height)*t,element:[...r.querySelectorAll("[data-docx-content-control]")].find(u=>u.dataset.docxContentControl===n)?.querySelector(".docx-content-control-boundary")??void 0,sheetLeft:(s.box.x+l)*t,sheetRight:(s.box.x+l+s.box.width)*t}}function GA(e){return e.kind==="textValue"?e.value:e.localName==="sdtPr"?"":e.children.map(GA).join("")}function ev(e,t){let n=e?GA(e):"";return t.find(r=>r.displayText===n)?.value??n}function zA(e){let t=e?.children.find(n=>n.kind!=="textValue"&&n.localName==="sdtPr");if(!(!t||t.kind==="textValue")){for(let n of t.children)if(n.kind!=="textValue"){if(n.localName==="dropDownList")return "dropdown";if(n.localName==="comboBox"||n.localName==="date")return n.localName;if(n.localName==="checkbox")return "checkbox";if(n.localName==="picture")return "picture";if(n.localName==="docPartList")return "buildingBlockGallery"}}}var RK=["dropdown","comboBox","date","checkbox","picture","buildingBlockGallery"];function ZA(e){let t=null,n=false,r=()=>{let o=t;t=null,o&&(e.setOpen(o.id,false),o.controller.abort());};return {cancel:r,destroy(){n=true,r();},open(o,a){if(r(),n||!e.request||!RK.includes(a))return false;let i=new AbortController;t={controller:i,id:o};let s=()=>!n&&t?.controller===i&&!i.signal.aborted,l=()=>s()&&zA(e.find(o))===a&&e.allowed(o),c=e.find(o),d=e.items(o).map(y=>({...y})),u=ev(c,d),f=a==="picture"?e.picture(o):void 0;if(a==="picture"&&!f)return r(),false;let p=false,g={controlId:o,kind:a,items:d,value:a==="date"?e.date(o)??"":a==="checkbox"?String(e.checked(o)):a==="picture"?f:a==="buildingBlockGallery"?"":u,locale:e.locale(),anchor:[...e.layer.querySelectorAll("[data-docx-content-control]")].find(y=>y.getAttribute("data-docx-content-control")===o)?.querySelector(".docx-content-control-boundary")??null,signal:i.signal,canApply:l,apply(y){return a==="picture"||!l()||!e.apply(o,y)?false:(s()&&r(),true)},cancel(){s()&&r();},...a==="picture"?{async replaceImage(y){if(p||!l())return false;p=true;try{return await e.replaceImage(o,y,()=>l()&&e.picture(o)===f)?(s()&&r(),!0):!1}finally{p=false;}}}:{}};return e.setOpen(o,true),e.request(g)?true:(g.cancel(),false)}}}function XA(e,t){if(!e)return [];if(t&&QA(e))return fj$1(t(),e).map(n=>({displayText:n.name,value:n.name}));for(let n of e.children)if(n.kind!=="textValue"&&!(n.kind!=="contentControlProperties"&&n.localName!=="sdtPr"))for(let r of n.children){if(r.kind==="textValue"||r.localName!=="dropDownList"&&r.localName!=="comboBox")continue;let o=[];for(let a of r.children){if(a.kind==="textValue"||a.localName!=="listItem")continue;let i=a.attributes.find(l=>l.localName==="value")?.value??"",s=a.attributes.find(l=>l.localName==="displayText")?.value??i;o.push({displayText:s,value:i});}return o}return []}function YA(e){if(e){for(let t of e.children)if(t.kind==="contentControlProperties"){for(let n of t.children)if(n.kind==="contentControlDate")return n.attributes.find(r=>r.localName==="fullDate")?.value}}}function QA(e){return zA(e&&e.kind!=="textValue"?e:null)==="buildingBlockGallery"}function JA(e,t,n,r){if(!e||!QA(e))return [{op:"setContentControlValue",controlId:n,value:r}];let o=fj$1(t(),e).filter(i=>i.name===r),a=o.length===1?o[0]:void 0;return a?[{op:"insertBuildingBlock",controlId:n,name:a.name,blocks:a.blocks}]:null}function eL(e){let t=-1,n=true;return ()=>{let r=e.packageRevision();return t!==r&&(t=r,n=!ck(e.settingsRoot()).doNotShadeFormData),n}}var di="switch to field results before editing a form value";function tL(e,t){let{anchor:n,head:r}=t,o=n.paragraphId===r.paragraphId;for(let a of [n,r]){let i=e(a.paragraphId),s=i&&eb$1(i,a.paragraphId);if(s?.kind!=="paragraph")continue;let l=o?Math.min(n.offset,r.offset):a.offset,c=o?Math.max(n.offset,r.offset):a.offset,d=Ii(s);if(th$1(s).filter(f=>f.addressing==="editable-result").map(f=>{let p=d.spanOf(f.node)?.start??0,g=p;for(let y of f.removeNodeIds)g=Math.max(g,d.spanOf(y)?.end??g);return {start:p,end:g}}).some(f=>l===c?l>=f.start&&(l<f.end||f.start===f.end):l<f.end&&c>f.start))return true}return false}function nL(e,t,n,r){let o=e.contentControlId?ef$1(t).find(d=>d.id===e.contentControlId):void 0,a=Eo(n).filter(d=>d.toc.id===e.id),i=a.some(d=>d.start>0||d.end<d.length);if(o&&!i)return {tocId:e.id,boundary:o,additional:false};let s=new Map(a.map(d=>[d.paragraphId,d])),l=a.filter(d=>d.start>0||d.end<d.length).flatMap(d=>kf$1(t,{anchor:{paragraphId:d.paragraphId,offset:d.start},head:{paragraphId:d.paragraphId,offset:d.end}},[d.paragraphId],r)),c=t.pages.flatMap(d=>{let u=Ja$2(d).filter(h=>{let b=s.get(h.paragraphId);return b&&b.start===0&&b.end===b.length}).map(xc$1);if(u.push(...l.filter(h=>h.pageIndex===d.index)),u.length===0)return [];let f=Math.min(...u.map(h=>h.x)),p=Math.min(...u.map(h=>h.y)),g=Math.max(...u.map(h=>h.x+h.width)),y=Math.max(...u.map(h=>h.y+h.height));return [{pageIndex:d.index,box:{x:f,y:p,width:g-f,height:y-p}}]});return c.length===0?null:{tocId:e.id,additional:true,boundary:{id:`toc:${e.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:c}}}var PK="there is no table of contents to remove",cp="the table of contents cannot be removed",rL={locked:"the table of contents is locked",bound:"the table of contents is bound to data","carries-section-mark":"the table of contents holds a section break","not-a-block":"the table of contents holds a table or a content control"};function CK(e,t){let n=t.indexOf(e.endParagraphId),r=t.indexOf(e.beginParagraphId),o=(n>=0?t[n+1]:void 0)??(r>0?t[r-1]:void 0);return o===void 0?void 0:{paragraphId:o,start:0,end:0}}function oL(e){function t(i){let s=CK(i,e.session.paragraphIds());return s&&e.pointedTocId()===i.id&&e.select({paragraphId:s.paragraphId,offset:0}),s}function n(i){if(e.editingMode()==="view"||!e.session.editable)return false;let s=e.target(i);if(!s||!Ih$1(e.session.part(),e.session.documentOutline(),s.instruction))return false;let l={op:"rewriteTocPageNumbers",tocId:s.id,updates:[]};return En$1(e.session.part(),l)===null}function r(i){let s=e.target(i);if(!s)return {refusal:{code:"notFound",reason:PK}};let l={op:"removeToc",tocId:s.id},c=En$1(e.session.part(),l),d=c?rL[c]??cp:e.writeRefusal([l]);return {op:l,toc:s,refusal:d?{code:"unsupported",reason:d}:null}}function o(i){return e.session.editable?r(i).refusal:{code:"unsupported",reason:cp}}function a(i){let{op:s,toc:l,refusal:c}=r(i);if(!s||!l||c)return e.refuse(c?.reason??cp,"table-of-contents-refused"),false;let d,u=e.session.subscribe(p=>{p.caret&&(d=p.caret);}),f;try{f=e.apply([s],t(l));}finally{u();}if(!f.committed){let p=f.reason??cp;return e.refuse(rL[p]??p,p),false}return d&&e.select({paragraphId:d.paragraphId,offset:d.start}),e.removed(),true}return {canRefreshToc:n,pointAtToc:t,removal:{removeTocRefusal:o,removeToc:a}}}var aL=new WeakMap;function iL(e,t,n,r){aL.set(e,(o,a)=>{let i=t();e.flushPendingInput();try{n(o),r();}catch(s){throw a&&(n(i),r()),s}});}function tv(e,t,n=true){let r=aL.get(e);if(!r)throw new Error("Surface does not support measurement updates");r(t,n);}var dp=new WeakMap,TK=96;function sL(e){if(e.host){e.status.replaceChildren();return}let t=e.status.ownerDocument.createElement("span");t.className="docx-editor__loading-spinner",t.setAttribute("aria-hidden","true"),e.status.replaceChildren(t);}function lL(e,t){let n=t.ownerDocument,r=n.createElement("div");r.className="docx-opening-indicator",r.contentEditable="false";let o=n.createElement("div");o.className="docx-editor__loading-page-status",o.setAttribute("role","status"),r.append(o);let a={frame:r,status:o,host:null};dp.set(e,a),sL(a);let i=()=>{let s=r.parentElement?.querySelector(":scope > .docx-pages"),l=s?.querySelector(":scope > .docx-page");r.hidden=!s||!l,!(!s||!l)&&(r.style.left=l.style.left,r.style.top=s.style.height,r.style.width=l.style.width,r.style.height=`${TK}px`);};return t.append(r),i(),{place:i,remove:()=>{dp.get(e)===a&&(dp.delete(e),r.remove(),a.host?.publish(null));}}}function nv(e,t){let n=dp.get(e);if(!n||n.host===t)return;let r=n.host;n.host=t,r?.publish(null),sL(n),t?.publish(n.status);}var Rc=64,Mo=new WeakMap,la=new WeakMap,EK=48;function MK(e,t){Mo.set(e,t);}function Pc(e,t){let n=Mo.get(e);if(!n)return true;let r=n(t);return r&&Mo.delete(e),r}function Tr(e){return Mo.has(e)}var AK=6e4,LK=300,FK=16,dL=4096;function DK(e,t,n){let r=0,o=e;for(;o<t&&o-e<dL&&(o-e<FK||r<AK);)r+=HK(n(o)),o+=1;return o}function NK(e,t,n){let r=[];for(let o=e;o<t;o+=1){let a=n(o);if(a?.kind==="table"){for(let i of a.children)r.push(i);r.push(a);}}return r}var cL=new WeakMap;function HK(e){if(typeof e!="object"||e===null)return 1;let t=cL.get(e);if(t!==void 0)return t;let n=1,r=[e];for(;r.length>0;){let o=r.pop();if(o.kind==="textValue")n+=o.value?.length??0;else if(o.children)for(let a of o.children)r.push(a);}return cL.set(e,n),n}function uL(e,t,n,r){let o=r,a=n.now(),i=null,s=null,l=[],c=0,d=()=>{let v=i;i=null,v&&jg(v);},u=(v,S=false)=>{if(!S&&n.composing())return false;let x=n.now()+(la.has(e)?Math.max(v,EK):v);for(;n.limit()!==null&&!n.destroyed();){if(!i){if(n.busy()){if(!S)return false;n.finishBusy();}let C=n.limit(),A=n.bodyBlockCount();if(A!==void 0&&C>=A)return n.finish(),S&&n.busy()&&n.finishBusy(),true;s===null&&(s=A===void 0?C+o:DK(C,A,E=>n.bodyBlock(E)),l=NK(C,s,E=>n.bodyBlock(E)),c=0);for(let E=0;c<l.length;E+=1){if(E>0&&(n.now()>=x||n.inputPending()))return false;uf$1([l[c++]]);}if(s<=n.limit()){s=null;continue}n.setLimit(s),i=n.prefixPass(s),s=null;}let k;do k=i.next();while(!k.done&&n.now()<x&&!n.inputPending());if(!k.done)return false;i=null;let T=la.get(e),R=T?.covers(k.value)===true;if(n.limit()!==null&&(R||n.now()-a>=LK)&&(n.publish(k.value),a=n.now()),R&&(la.delete(e),T.reveal()),o=Math.min(dL,o*2),n.now()>=x||n.inputPending())return false}return true};if(t().removeAttribute("data-docx-opening-preview"),n.limit()===null)return {finishPaused:d,stop:()=>{}};t().setAttribute("data-docx-opening-preview",""),t().setAttribute("data-docx-layout-pending","");let f=lL(e,t()),p=()=>{la.delete(e);},g=["pointerdown","keydown","wheel"],y=n.pages();for(let v of g)y.addEventListener(v,p,{capture:true});let h=false,b=()=>{if(!h){h=true,Mo.delete(e),i=null,s=null,l=[];for(let v of g)y.removeEventListener(v,p,true);t().removeAttribute("data-docx-opening-preview"),n.busy()||t().removeAttribute("data-docx-layout-pending"),f.remove();}};return MK(e,(v,S)=>{if(!u(v,S))return f.place(),false;b();let k=la.get(e);return la.delete(e),n.destroyed()||k?.reveal(),true}),{finishPaused:d,stop:b}}function ca(e){if(!Mo.has(e))return false;for(;!Mo.get(e)?.(Number.POSITIVE_INFINITY,true)&&Mo.has(e););return true}function _K(e){la.delete(e);}function BK(e,t,n,r,o){if(!Mo.has(e)||typeof t!="number"&&!r(t.paragraphId))return false;let a=s=>typeof t=="number"?s.pages.length>t:df$1(s,t)!==null,i=o();return la.set(e,{covers:a,reveal:()=>{Math.abs(o()-i)<1&&n();}}),true}function fL(e,t){return {begin(){t.flushLayout(),_K(e());},later(n,r){return t.scroller()!==null&&BK(e(),n,r,o=>t.paragraphIds().includes(o),()=>t.scroller()?.scrollTop??0)}}}function pL(e,t,n,r){let o=r?.offsetPx??24,a=r?.block??"start",i=e.clientHeight;if(a==="nearest"||a==="centerIfNeeded"){let c=t<e.scrollTop,d=t+n>e.scrollTop+i;if(!c&&!d)return false}let s=a==="center"||a==="centerIfNeeded"?t-Math.max(0,(i-n)/2):a==="nearest"&&t>e.scrollTop?t+n+o-i:t-o,l=Math.max(0,e.scrollHeight-i);return e.scrollTo({top:Math.max(0,Math.min(s,l)),behavior:r?.behavior??"auto"}),true}var $K=40,WK=12,qK=8;function rv(e,t){if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e();},n.port2.postMessage(null);return}(t??globalThis).setTimeout(e,0);}function UK(e,t){let n=t??globalThis;if(typeof n.requestAnimationFrame=="function"){n.requestAnimationFrame(()=>rv(e,t));return}rv(e,t);}function mL(e){let t=null,n=0,r=(l,c)=>{l&&e.passTimed?.(c);},o=l=>{let c=t===null!=(l===null);t=l,c&&e.pendingChanged?.(l!==null);},a=(l,c)=>{e.revision()===c&&e.publish(l);},i=()=>{let l=t;if(!l)return;let c=e.now(),d=c+WK;for(;;){let u=l.steps.next();if(!u.done&&u.value?.wrapUp&&(l.wrapUp=u.value.wrapUp),u.done){o(null),a(u.value,l.revision),r(l.timed,l.spent+e.now()-c);return}if(e.now()>=d)break}l.spent+=e.now()-c,rv(i,e.view?.());},s=()=>{let l=t;if(!l)return;let c=e.now();o(null),a(jg(l.steps),l.revision),r(l.timed,l.spent+e.now()-c);};return {run(l,c,d=true){let u=e.snapshot(),f=e.now(),p=d?n:0;d&&(n=0);let g=f+$K,y=e.pageAfterView(),h=e.current(),b=e.partial?.()===true,v=null;for(;;){let S=l.next();if(S.done)return r(d,p+e.now()-f),S.value;if(S.value&&(v=S.value),y===void 0||!v?.finalize||v.pages.length<=y||e.now()<g||!h||!b&&!v.settled&&h.pages.length-v.pages.length<qK)continue;let x=v.settled?v.pages:[...v.pages,...h.pages.slice(v.pages.length)];return o({steps:l,revision:c,restore:u,spent:p+e.now()-f,timed:d,restorable:v.restorable!==false,wrapUp:v.wrapUp,settled:v.settled===true}),UK(i,e.view?.()),v.finalize(x)}},finish:s,abandon(){let l=t;if(l){if(l.settled){o(null),l.timed&&(n+=l.spent);return}if(!l.restorable)return l.wrapUp?.(),s();o(null),l.restore(),l.timed&&(n+=l.spent);}},pending:()=>t!==null,cancel(){o(null);}}}var jK=1e3,VK=12,gL=100;function hL(e,t){let n=o=>{let a=o.fragments[0];if(!a)return "";let i=a.kind==="paragraph"?a.lines[0]:void 0;return `${a.id}:${i?.range.start??""}`},r=o=>(o.footnotes?.notes??[]).map(a=>`${a.noteId}${a.continuation?"c":""}:${a.box.height}`).join(",");return `${e.pages.map(o=>`${n(o)}/${r(o)}`).join("|")}#${Bg(t)}`}function yL(e){let t=null,n=false,r=false,o=null,a=()=>{t?.(),t=null;},i=(l,c)=>{a(),!r&&(t=e.schedule(()=>{t=null,r||l();},c));},s=()=>{if(e.busy())return i(s,gL);let l=e.live().notePageBottomReserves,c=e.current();if(!l||!c)return;let d=hL(c,l);if(d===o)return;let u=e.revision(),f=e.createSession(),p=e.pass(u,f),g=()=>{if(e.revision()!==u)return;let h=e.now()+VK;for(;;){let b=p.next();if(b.done)return y(b.value);if(e.now()>=h)break}i(g,0);},y=h=>{if(e.revision()!==u)return;if(e.busy())return i(()=>y(h),gL);let b=e.live().notePageBottomReserves,v=f.notePageBottomReserves??new Map;if(b&&Ag(b,v)){o=d;return}n=true;try{e.adopt(f,h);}finally{n=false;}o=hL(h,v);};g();};return {request(){n||r||i(s,jK);},cancel(){r=true,a();}}}var GK=1e4;function bL(e){let t=null,n=()=>{let i=[],s=new Set([e.part()]);for(let l of e.headerFooterPartsBySection())for(let c of [l.headers,l.footers])for(let d of c.values())s.has(d)||(s.add(d),i.push(d));for(let l of ["footnote","endnote"]){let c=e.partFor({kind:"notesPart",noteKind:l});!c||s.has(c)||(s.add(c),i.push(c));}return i},r=(i,s)=>i.length===s.length&&i.every((l,c)=>l===s[c]),o=i=>{let s=eb$1(e.part(),i);if(!s||s.kind!=="paragraph")return false;let l=0,c=[...s.children];for(;c.length>0;){let d=c.pop();if(++l>GK)return false;if(d.kind!=="textValue"){if(d.namespaceUri===pa$2&&d.localName==="p")return false;for(let u of d.children)c.push(u);}}return true},a=(i,s)=>{if(i.splitJoin.length!==1||i.story!==void 0&&i.story.kind!=="body")return false;let l=i.splitJoin[0];if("split"in l){let{from:u,tail:f}=l.split,p=s.get(u);if(p===void 0||s.has(f)||i.deleted.length>0||i.created.length!==1||i.created[0]!==f||!o(u)||!o(f))return false;for(let[g,y]of s)y>p&&s.set(g,y+1);return s.set(f,p+1),true}let{kept:c,removed:d}=l.join;return !s.has(c)||i.created.length>0||i.deleted.length!==1||i.deleted[0]!==d||!o(c)?false:(s.delete(d),true)};return {retain(i){if(!t)return;let s=i.created.length>0||i.deleted.length>0||i.splitJoin.length>0,l=i.impact==="text-local"&&!s?t.otherParts:n();i.impact!=="global"&&(i.impact==="text-local"||r(t.otherParts,l))&&(!s||r(t.otherParts,l)&&a(i,t.index))?t={packageRevision:e.packageRevision(),bodyRoot:e.part().root,index:t.index,otherParts:l}:t=null;},index(){let i=e.packageRevision(),s=e.part().root;if(t&&t.packageRevision===i&&t.bodyRoot===s)return t.index;let l=new Map,c=u=>{let f=l.size;for(let[p,g]of u)l.has(p)||l.set(p,f+g);};c(Wk(e.part()));let d=n();for(let u of d)c(Wk(u));return t={packageRevision:i,bodyRoot:s,index:l,otherParts:d},l}}}var zK=`revision-${rl}`,Ss=new WeakMap;function ws(e){return e?Ss.get(e)??null:null}function up(e){let t=Ss.get(e);return t?[e,t.deletion,t.insertion]:[e]}var vL=tl,xL=new WeakMap;function ZK(e,t,n){let r=xL.get(e);if(r&&Ss.get(r)?.insertion===t)return r;let o=t.date??e.date,a={kind:"revision",id:sl(e.id,t.id),address:n.address,addresses:[...e.addresses,...t.addresses],replacedText:e.text,revisionKind:"replace",author:t.author,...o!==void 0?{date:o}:{},text:t.text,ranges:[...e.ranges,...t.ranges],nesting:e.nesting,replacedRangeCount:e.ranges.length,readOnly:e.readOnly||t.readOnly,replyIds:[...e.replyIds,...t.replyIds]};return Ss.set(a,{deletion:e,insertion:t}),xL.set(e,a),ol(a,[...pl(e),...pl(t)])}function kL(e){let t=e.filter(i=>i.kind==="revision"),n=new Map,r=new Set,o=new Map;for(let i=0;i+1<t.length;i+=1){let s=t[i],l=t[i+1],c=s.revisionKind==="insert",d=t[i+2];if(c&&d&&vL(l,d))continue;let[u,f]=c?[l,s]:[s,l];if(!vL(u,f))continue;let p=ZK(u,f,s);n.set(s,p),r.add(l),o.set(u.id,p.id),o.set(f.id,p.id),i+=1;}if(n.size===0)return {items:e,renamed:o};let a=[];for(let i of e)r.has(i)||a.push(n.get(i)??i);return {items:a,renamed:o}}function IL(e,t){let n=`${ov(t)}|${[...t?.excludeRevisionKinds??[]].sort().join(",")}`,r=SL.get(e),o=r?.get(n);if(o)return o;let a=XK(e,t);return r||SL.set(e,r=new Map),r.set(n,a),a}var SL=new WeakMap;function XK(e,t){let n=new Set(t?.excludeRevisionKinds??[]),r=s=>s.kind!=="revision"||!n.has(s.revisionKind),o=n.size>0?e.filter(r):e,a=new Map;if(ov(t)){let s=kL(o);a=s.renamed,o=n.size>0?s.items.filter(r):s.items;}if(n.size===0&&a.size===0)return o;let i=new Set(o.filter(s=>s.kind==="revision").map(s=>s.id));return o.map(s=>{if(s.kind!=="comment"||s.parentRevisionId===void 0)return s;let l=a.get(s.parentRevisionId)??s.parentRevisionId;if(i.has(l))return l===s.parentRevisionId?s:{...s,parentRevisionId:l};let{parentRevisionId:c,...d}=s;return d})}function fp(e,t,n){if(t===null)return new Set;let r=n?YK(e(),t):null;return new Set(r===null?[t]:[t,r])}function YK(e,t){for(let n of kL(e).items){let r=Ss.get(n);if(!r)continue;let o=ql(r.deletion),a=ql(r.insertion);if(o===t)return a;if(a===t)return o}return null}function RL(e,t){let n=null;return {set:r=>n=r,lightsPair:()=>e()||n!==null&&t()?.activatedReviewKey()===n}}function ov(e){return e?.pairReplacements!==false}function da(e){return e.startsWith(zK)}function Qr(e,t){let n={placement:false,pairReplacements:da(t)};return e(n).find(r=>r.key===t)}function ks(e){let t=Ss.get(e);return t?[ql(t.deletion),ql(t.insertion)]:[ql(e)]}function av(e,t,n){return t===null||!ov(n)?t:e({...n,placement:false}).find(o=>da(o.key)&&ks(o.item).includes(t))?.key??t}function iv(e,t){let n=da(t.key)?t.key:av(e,t.key,{pairReplacements:true});return n!==null&&da(n)?{...t,pairKey:n}:t}function PL(e,t){if(!t.skipped.length)return t;let n=new Map;for(let r of e({placement:false,pairReplacements:true}))if(da(r.key))for(let o of ks(r.item))n.set(o,r.key);return {...t,skipped:t.skipped.map(r=>{let o=n.get(r.key);return o===void 0?r:{...r,pairKey:o}})}}var wL=new WeakMap;function CL(e){let t=wL.get(e);if(!t){let n=new Map;for(let r of e)n.set(ql(r),r);wL.set(e,t=n);}return t}var TL=2,EL=100;function*OL(e,t){if(!t||t.size===0)return yield*e;let n=1/0,r=-1/0;for(let l of t)n=Math.min(n,l),r=Math.max(r,l);let o=l=>l<n-TL||l>r+TL,a;for(;;){let l=sd(o,()=>e.next());if(l.done){a=l.value;break}let c=l.value,d=c?.finalize;yield c&&d?{...c,finalize:u=>sd(o,()=>d(u))}:c;}let i=a.pages.length,s=a.pages.findIndex(l=>td(l,i));if(s<0)return a;for(;s<i;s+=EL){let l=a;yield {pages:l.pages,finalize:()=>l,settled:true},a=ud(a,s,s+EL);}return a}var eU=createT(en);function cr(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return eU(t)}}var ML=new WeakMap;function pp(e,t){let n=new Map;return ML.set(e,n),(r,o,a="textContent")=>{let i=n.get(r);i||n.set(r,i=new Map),i.set(a,o),a==="textContent"?r.textContent=t(o):r.setAttribute(a,t(o));}}function AL(e,t){let n=ML.get(e);if(n)for(let[r,o]of n){if(r!==e&&!e.contains(r)){n.delete(r);continue}for(let[a,i]of o)a==="textContent"?r.textContent=t(i):r.setAttribute(a,t(i));}}function LL(e,t){let n=e.ownerDocument.defaultView;if(!n)return;if(n.getComputedStyle(e).position==="fixed"){let C=t.getBoundingClientRect();e.style.maxHeight="";let A=Number.parseFloat(n.getComputedStyle(e).maxHeight),E=Number.isFinite(A)?A:n.innerHeight;e.style.maxWidth=`${Math.max(0,n.innerWidth-16)}px`,e.style.maxHeight=`${Math.max(0,Math.min(E,n.innerHeight-16))}px`;let P=e.getBoundingClientRect(),w=Math.max(0,n.innerHeight-8-C.bottom-4),O=Math.max(0,C.top-8-4),_=P.height>w&&O>w,q=Math.min(P.height,_?O:w);e.style.maxHeight=`${q}px`,e.style.left=`${Math.max(8,Math.min(C.left,n.innerWidth-8-P.width))}px`;let K=_?C.top-4-q:C.bottom+4;e.style.top=`${Math.max(8,Math.min(K,n.innerHeight-8-q))}px`,e.dataset.placement=_?"top":"bottom";return}let r=e.offsetParent;if(!r)return;let o=t.getBoundingClientRect(),a=t.closest(".docx-page")?.getBoundingClientRect(),i=t.closest(".docx-editor__scroll-container")?.getBoundingClientRect(),s=Math.max(0,a?.left??0,i?.left??0),l=Math.min(n.innerWidth,a?.right??n.innerWidth,i?.right??n.innerWidth),c=Math.max(0,i?.top??0),d=Math.min(n.innerHeight,i?.bottom??n.innerHeight);e.style.maxWidth=`${Math.max(0,l-s)}px`,e.style.maxHeight=`${Math.max(0,d-c)}px`;let u=e.getBoundingClientRect(),f=d-o.bottom,p=o.top-c,g=u.height>f&&p>f,y=Math.max(0,g?p:f);e.style.maxHeight=`${Math.max(0,Math.min(d-c,y))}px`;let h=Math.min(u.height,y),b=Math.max(s,Math.min(o.left,l-u.width)),v=Math.max(c,g?o.top-h:o.bottom),S=r.getBoundingClientRect(),x=r.offsetWidth?S.width/r.offsetWidth:1,k=r.offsetHeight?S.height/r.offsetHeight:1;e.style.left=`${(b-S.left)/x-r.clientLeft+r.scrollLeft}px`,e.style.top=`${(v-S.top)/k-r.clientTop+r.scrollTop}px`,e.dataset.placement=g?"top":"bottom";}function Cc(e,t){let n=e.ownerDocument.defaultView,r=t.closest(".docx-pages")??e.closest(".docx-editor")?.querySelector(".docx-pages"),o=t.closest("[data-docx-content-control]")?.dataset.docxContentControl,a=t,i=()=>{if(!a.isConnected&&r&&o){let c=[...r.querySelectorAll("[data-docx-content-control]")].find(d=>d.dataset.docxContentControl===o)?.querySelector(".docx-content-control-boundary");c&&(s?.unobserve(a),a=c,s?.observe(a));}a.isConnected&&LL(e,a);},s=typeof n?.ResizeObserver=="function"?new n.ResizeObserver(i):null;s?.observe(e),s?.observe(a);let l=typeof n?.MutationObserver=="function"?new n.MutationObserver(i):null;return r&&l?.observe(r,{childList:true,subtree:true}),i(),n?.addEventListener("resize",i),e.ownerDocument.addEventListener("scroll",i,true),()=>{s?.disconnect(),l?.disconnect(),n?.removeEventListener("resize",i),e.ownerDocument.removeEventListener("scroll",i,true);}}function Tc(e,t,n){if(t.stopPropagation(),t.isComposing||(t.key==="Escape"&&(t.preventDefault(),n()),t.key!=="Tab"))return;let r=[...e.querySelectorAll("button,input,select,textarea,[href],[tabindex]")].filter(i=>i.tabIndex>=0&&!i.hasAttribute("disabled")&&!i.closest("[hidden]")&&e.ownerDocument.defaultView?.getComputedStyle(i).display!=="none");if(!r.length){t.preventDefault(),e.focus();return}let o=e.ownerDocument.activeElement,a=t.shiftKey&&(o===r[0]||o===e)?r.at(-1):!t.shiftKey&&(o===r.at(-1)||o===e)?r[0]:null;a&&(t.preventDefault(),a.focus());}function tU(e){let t=e?.ownerDocument??(typeof globalThis.document>"u"?null:globalThis.document),n=t?.activeElement;return n&&n!==t?.body?n:e?.closest(".docx-pages")??null}var sv="image/png,image/jpeg,image/gif,image/bmp,image/webp",nU=new Set(sv.split(",")),rU=8;function oU(e){if(!e||e.kind==="textValue")return;let t=(n,r)=>{if(!(n.kind==="textValue"||r>rU)){if(n.kind==="drawing")return n.id;if(n.localName!=="sdtPr")for(let o of n.children){let a=t(o,r+1);if(a)return a}}};return t(e,0)}function FL(e){let t=null,n=null,r=null,o,a,i=0,s=false,l=()=>{i++,o?.(),a?.(),r?.remove(),r=null;let u=n;t?.remove(),t=null,n=null,u&&(e.setOpen(u,false),s||e.layer.focus({preventScroll:true}));},c=u=>oU(e.find(u)),d=async(u,f,p=()=>true)=>{if(s||!p()||!e.allowed(u))return false;if(f.byteLength>r$3.maxEncodedBytes)return e.reject("image-resource-limit"),false;let g=c(u);if(!g)return e.reject("no-picture"),false;let y=Sf$1(f);if(!nU.has(y))return e.reject("unsupported-image"),false;let h=await e.replaceImage(g,f,y,()=>!s&&p()&&e.allowed(u)&&c(u)===g);return h.ok?true:(e.reject(h.detail??h.reason),false)};return {drawingOf:c,replace:d,cancel:l,select(u){let f=c(u),p=f?Te(e.layout(),f):null;return p?e.selectDrawing(f,p.record.paragraphId):false},pick(u){if(l(),s||!e.allowed(u))return;let f=i,p=()=>!s&&i===f;if(!c(u)){e.reject("no-picture");return}let g=e.document.createElement("input");g.type="file",g.accept=sv,g.className="docx-content-control-picture-picker",g.dataset.docxMarker="",g.dataset.docxCcId=u,g.setAttribute("contenteditable","false"),g.setAttribute("aria-hidden","true"),g.tabIndex=-1;let y=cr(e.translate),h=e.document.createElement("div");h.className="docx-content-control-menu",h.style.position="absolute",h.style.zIndex="20",h.style.pointerEvents="auto",h.dataset.docxCcId=u,h.dataset.docxMarker="",h.setAttribute("role","dialog"),h.setAttribute("aria-label",y("contentControl.types.picture")),h.setAttribute("contenteditable","false"),h.hidden=true;let b=e.document.createElement("div");b.className="docx-content-control-widget-error",b.setAttribute("role","alert"),b.textContent=y("disabledReason.invalidValue");let v=e.document.createElement("button");v.type="button",v.textContent=y("common.cancel"),v.addEventListener("click",l),h.addEventListener("pointerdown",S=>S.stopPropagation()),h.addEventListener("keydown",S=>{Tc(h,S,l),S.stopPropagation();}),h.append(b,v),g.addEventListener("change",()=>{let S=g.files?.[0];!S||!p()||(g.value="",g.disabled=true,(async()=>{let x=false;try{S.size>r$3.maxEncodedBytes?e.reject("image-resource-limit"):x=await d(u,new Uint8Array(await S.arrayBuffer()),p);}catch{p()&&e.reject("image-read-failed");}if(!p())return;if(x){l();return}g.disabled=false,g.className="docx-content-control-picture-input",g.removeAttribute("aria-hidden"),g.tabIndex=0,g.setAttribute("aria-label",y("contentControl.types.picture")),g.setAttribute("aria-invalid","true"),h.prepend(g),h.hidden=false;let k=[...e.layer.querySelectorAll("[data-docx-content-control]")].find(T=>T.getAttribute("data-docx-content-control")===u)?.querySelector(".docx-content-control-boundary");a?.(),o?.(),k&&(a=Cc(h,k)),o=lp(h,l),g.focus();})());}),g.addEventListener("cancel",l),e.layer.append(g),(e.layer.closest(".docx-editor__scroll-container")??e.layer).append(h),r=h,t=g,n=u,e.setOpen(u,true),g.click();},destroy(){s=true,l();}}}var aU=22,lv=3;function iU(e,t,n){let r=e.ownerDocument;if(typeof r.elementFromPoint!="function")return null;let o=r.elementFromPoint(t,n)?.closest(".docx-page");if(!o)return null;for(let a of o.querySelectorAll("[data-docx-content-control]:not([data-docx-toc])"))for(let i of a.querySelectorAll(".docx-content-control-boundary")){let s=i.getBoundingClientRect();if(t>=s.left-lv&&t<=s.right+aU&&n>=s.top-lv&&n<=s.bottom+lv)return a}return null}function DL(e){let t=null,n=rt(()=>e),r=0,o=null,a=c=>{c!==t&&(t?.isConnected&&delete t.dataset.hover,t=c,c&&(c.dataset.hover=""));},i=()=>{r=0,o&&a(iU(e,o.x,o.y));},s=c=>{o={x:c.clientX,y:c.clientY},n.migrate(),r===0&&(r=n.requestAnimationFrame(i));},l=()=>{o=null,a(null);};return e.addEventListener("pointermove",s),e.addEventListener("pointerleave",l),{destroy(){e.removeEventListener("pointermove",s),e.removeEventListener("pointerleave",l),n.cancelAnimationFrame(r),a(null);}}}var Ec=.25;function NL(e,t,n){let r=(s,l)=>{let c=df$1(e,s,n);return c?af$1(e,{x:c.x+l,y:c.y+c.height/2,pageIndex:c.pageIndex}):null},o=r(t.head,0);if(o)return o;if(t.anchor.paragraphId===t.head.paragraphId&&t.anchor.offset===t.head.offset)return sU(e,t.head)??r(t.head,-Ec);let i=t.head.paragraphId===t.anchor.paragraphId&&t.head.offset<t.anchor.offset;return r(t.head,i?Ec:-Ec)??r(t.anchor,i?-Ec:Ec)}function sU(e,t){let n=null;for(let r of e.contentControls??[]){let o=r.range;!o||o.paragraphId!==t.paragraphId||o.end!==t.offset||o.start===o.end||(!n||r.nestingDepth>n.nestingDepth)&&(n=r);}return n}function HL(e,t,n){let r,o,a=null;return ()=>{let i=e(),s=t();return (i!==r||s!==o)&&(a=n(),r=i,o=s),a}}function _L(e,t,n){for(let r=fb$1(e,t);r;r=fb$1(e,r.id))if(ld(r)){let o=r.id;return n.contentControls?.find(a=>a.id===o)??gg(e).find(a=>a.id===o)??null}return null}function BL(e,t,n,r,o){let a=r==="left"?-1:1,i=df$1(e,t.from,o),s=df$1(e,t.to,o),l=i?We(e,i)??1:1,c=a*l===-1?t.from:t.to;if(!i||!s||i.lineId!==s.lineId||i.pageIndex!==s.pageIndex)return c;let d=Wb$1(e,t.from.paragraphId)?.find(({line:g})=>g.id===i.lineId)?.line;if(!d?.spans.some(g=>g.style.shaping))return c;let u=n.indexOf(t.from.paragraphId),f=n.indexOf(t.to.paragraphId),p;for(let g of d.spans){let y=g.range.paragraphId,h=n.indexOf(y);if(h<u||h>f)continue;let b=Math.max(g.range.start,y===t.from.paragraphId?t.from.offset:0),v=Math.min(g.range.end,y===t.to.paragraphId?t.to.offset:1/0);if(!(b>=v))for(let S of [b,v]){let x={paragraphId:y,offset:S},k=df$1(e,x,o);if(!k||k.lineId!==i.lineId||k.pageIndex!==i.pageIndex)continue;let T=k.x;(!p||(T-p.x)*a>0)&&(p={position:x,x:T});}}return p?.position??c}function $L(e,t,n){let r=e;return {get:()=>r,set(o){o!==r&&(t(),r=o,n());}}}function WL(e,t,n,r){let o=cr(r),a=e.ownerDocument,i=a.createElement("dialog"),s=pp(i,o);i.className="docx-text-form-dialog",i.setAttribute("role","alertdialog"),i.setAttribute("data-docx-modal",""),s(i,"textFormField.invalidTitle","aria-label"),s(i,`textFormField.invalid${t==="number"?"Number":"Date"}`,"aria-description");let l=a.createElement("h2");l.className="docx-text-form-dialog__header",s(l,"textFormField.invalidTitle");let c=a.createElement("div");c.className="docx-text-form-dialog__body",s(c,`textFormField.invalid${t==="number"?"Number":"Date"}`);let d=a.createElement("div");d.className="docx-text-form-dialog__footer";let u=a.createElement("button");u.type="button",u.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",s(u,"textFormField.apply");let f=false,p=()=>{f||(f=true,n());};return u.addEventListener("click",p),i.addEventListener("keydown",g=>{g.key!=="Enter"||g.isComposing||(g.preventDefault(),g.stopPropagation(),p());}),i.addEventListener("cancel",g=>{g.preventDefault(),p();}),d.append(u),i.append(l,c,d),e.append(i),i.showModal(),u.focus(),i}function qL(e,t,n,r,o){let a=cr(o),i=e.ownerDocument,s=i.createElement("dialog"),l=pp(s,a);s.className="docx-text-form-dialog",s.setAttribute("data-docx-modal",""),l(s,"textFormField.title","aria-label");let c=i.createElement("h2");c.className="docx-text-form-dialog__header",l(c,"textFormField.title");let d=i.createElement("div");d.className="docx-text-form-dialog__body";let u=i.createElement("div");u.className="docx-text-form-dialog__footer",s.append(c,d,u);let f=(E,P)=>{let w=i.createElement("label");w.className="docx-text-form-dialog__row";let O=i.createElement("span");O.className="docx-text-form-dialog__label",l(O,E),P.className="docx-text-form-dialog__input",w.append(O,P),d.append(w);},p=i.createElement("input");p.type="text",p.value=t.defaultText,f("textFormField.defaultText",p);let g=i.createElement("select"),y=["regular","number","date"];for(let E of y){let P=i.createElement("option");P.value=E,l(P,`textFormField.${E}`),g.append(P);}if(!y.includes(t.type)){let E=i.createElement("option");E.value=t.type,l(E,"textFormField.preservedType"),E.disabled=true,g.append(E);}g.value=t.type,f("textFormField.type",g);let h=i.createElement("input");h.type="number",h.min="0",h.max="32767",h.step="1",h.value=String(t.maxLength),f("textFormField.maxLength",h);let b=i.createElement("select"),v=E=>{b.replaceChildren();let P=Kk[g.value]??[];for(let w of P){let O=i.createElement("option");O.value=w;let q={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[w];q||!w?l(O,q??"textFormField.noFormat"):O.textContent=w,b.append(O);}if(!P.includes(E)){let w=i.createElement("option");w.value=E,E?w.textContent=E:l(w,"textFormField.noFormat"),w.disabled=true,b.append(w);}b.value=E;};v(t.format),g.addEventListener("change",()=>v("")),f("textFormField.format",b);let S=i.createElement("input");S.type="checkbox",S.checked=t.enabled;let x=i.createElement("label");x.className="docx-text-form-dialog__checkbox-row";let k=i.createElement("span");l(k,"textFormField.enabled"),x.append(S,k),d.append(x);let T=i.createElement("p");T.className="docx-text-form-dialog__error",T.setAttribute("role","alert"),d.append(T);let R=i.createElement("button");R.type="button",R.className="docx-text-form-dialog__button",l(R,"textFormField.cancel"),R.addEventListener("click",r);let C=i.createElement("button");C.type="button",C.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(C,"textFormField.apply");let A=()=>{if(!h.value||!h.checkValidity()||!n(p.value,{type:g.value,maxLength:Number(h.value),format:b.value,enabled:S.checked})){l(T,"textFormField.invalidOptions");return}r();};return C.addEventListener("click",A),s.addEventListener("keydown",E=>{E.key==="Enter"&&!E.isComposing&&zu(E.target,"input")&&(E.preventDefault(),A());}),s.addEventListener("cancel",E=>{E.preventDefault(),r();}),u.append(R,C),e.append(s),s.showModal(),p.focus(),p.select(),s}function KL(e,t,n){let r=[],o=[];for(let i of e)for(let s of Wk(i).keys()){let l=eb$1(i,s);if(l?.kind==="paragraph")for(let c of al(l)){let d=t.get(c.fieldNodeId);if(!d)continue;let u=(Nm(i,s)??"").slice(c.start,c.end),f=Lk(u,c,"fill",d.locale);if(f===null)return {reason:"invalidArgs"};if(f===u)continue;let p={op:"commitTextFormField",paragraphId:s,fieldNodeId:c.fieldNodeId,locale:d.locale},g=En$1(i,p);if(g)return {reason:g};r.push(p),o.push({paragraphId:s,start:c.start,end:c.end,length:f.length});}}let a=i=>{let s=i.offset;for(let l of o)l.paragraphId!==i.paragraphId||i.offset<=l.start||(s+=i.offset>=l.end?l.length-(l.end-l.start):Math.min(i.offset-l.start,l.length)-(i.offset-l.start));return s===i.offset?i:{...i,offset:s}};return {ops:r,selection:{anchor:a(n.anchor),head:a(n.head)}}}var cv=new WeakMap,mp=new WeakMap;function lU(e){for(let t of Array.from(e.children))if(t.classList.contains("docx-pages"))return t;return null}function jL(e){let t=lU(e);return (t&&mp.get(t)?.())??null}function UL(e){return [...Wk(e).keys()].flatMap(t=>{let n=eb$1(e,t);return n?.kind==="paragraph"?al(n):[]})}function VL(e,t){let n=cr(e.translate),r,o=false,a=new Map,i=()=>e.parts?.()??[e.part()];if(t?.length)for(let W of i()){let H=t.filter(D=>D.partName===W.name);if(!H.length)continue;let G=UL(W);for(let D of H){let B=G[D.fieldIndex];B&&a.set(B.fieldNodeId,{text:D.text,locale:D.locale});}}let s=new WeakMap,l=new WeakMap,c=(W=e.part())=>{s.set(W,new Map([...a].filter(([H])=>H.startsWith(`${W.name}#`))));},d=()=>(a=new Map(i().flatMap(W=>[...s.get(W)??[]])),l.get(e.part())??null),u=W=>{a.delete(W),c();};i().forEach(c);let f=()=>{if(!a.size)return null;if(o)return "invalidState";let W=KL(i(),a,e.selection());if("reason"in W)return W.reason;if(W.ops.length&&!e.editable())return "locked";let H=i();i().forEach(c);let G=a;W.ops.length&&l.set(e.part(),e.selection()),a=new Map,o=true;try{let D=W.ops.length?e.save?e.save(W.ops,W.selection):"unsupported":null;return D?a=G:(delete se.dataset.fieldError,W.ops.length&&l.set(e.part(),W.selection)),i().forEach(c),D}catch(D){throw i().every(B=>H.includes(B))&&(a=G),i().forEach(c),D}finally{o=false;}};mp.set(e.pagesLayer,f);let p=()=>a.size?i().flatMap(W=>UL(W).flatMap((H,G)=>{let D=a.get(H.fieldNodeId);return D?[{partName:W.name,fieldIndex:G,...D}]:[]})):[];cv.set(e.pagesLayer,p);let g,y=(W,H)=>(Nm(e.part(),W)??"").slice(H.start,H.end),h=null,b=null,v=null,S=false,x=false,k=()=>{let W=v;v=null,x=false,h?.remove(),h=null,W?.abort();},T=()=>{if(!h&&!v)return;let W=e.selection();k(),!S&&(e.pagesLayer.focus({preventScroll:true}),e.select(W));};function R(W,H,G="plain"){g={paragraphId:W,fieldNodeId:H.fieldNodeId},e.select({anchor:{paragraphId:W,offset:H.start},head:{paragraphId:W,offset:H.end}},G==="press"?"pressed":void 0);let D=e.selection().head.paragraphId===W&&e.selection().head.offset>=H.start&&e.selection().head.offset<=H.end;D&&(b=g??b),g=void 0,D&&G==="travel"&&e.reveal?.({paragraphId:W,offset:H.start});}function C(W,H){if(S)return;T();let G=e.locale?.()??"en-US",D=new AbortController;v=D;let B=()=>{if(S||D.signal.aborted||v!==D)return false;let X=eb$1(e.part(W),W);return X?.kind==="paragraph"&&al(X).some(N=>N.fieldNodeId===H.fieldNodeId)&&e.editable()&&!e.protected(W)},Z={field:{...H},signal:D.signal,canApply:B,apply(X,N){if(!B()||!e.apply({op:"setTextFormFieldDefault",locale:G,paragraphId:W,fieldNodeId:H.fieldNodeId,text:X,options:N}))return false;if(S||v!==D||D.signal.aborted)return true;let j=eb$1(e.part(W),W),z=j?.kind==="paragraph"?al(j).find(Q=>Q.fieldNodeId===H.fieldNodeId):null;return z&&R(W,z),T(),true},cancel(){v===D&&!D.signal.aborted&&T();}};e.onRequest?.(Z)||D.signal.aborted||(h=qL(e.container,H,Z.apply,Z.cancel,n));}let A=W=>{let G=W.target?.closest('[data-field-atom="form"][data-start]'),D=G?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!G||!D||!e.editable())return null;let B=eb$1(e.part(),D);if(B?.kind!=="paragraph")return null;let Z=Number(G.dataset.start),X=al(B).find(N=>N.start<=Z&&Z<N.end);return X?{paragraphId:D,field:X}:null},E=null,P=W=>W.shiftKey||W.altKey||W.ctrlKey||W.metaKey,w=W=>{if(r=void 0,E=null,W.button!==0)return;let H=A(W);H&&!P(W)&&!e.protected(H.paragraphId)&&(E={x:W.clientX,y:W.clientY,paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId,moved:false}),g=H?{paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",w,{capture:true});let O=W=>{E&&Math.hypot(W.clientX-E.x,W.clientY-E.y)>4&&(E.moved=true);},_=()=>{E=null;},q=(W,H=false)=>{let G=E;if(E=null,!G||G.moved||h||W.button!==0||W.detail>1||Math.hypot(W.clientX-G.x,W.clientY-G.y)>4||!e.editable()||P(W)||e.protected(G.paragraphId))return;let D=eb$1(e.part(),G.paragraphId),B=D?.kind==="paragraph"?al(D).find(X=>X.fieldNodeId===G.fieldNodeId):null;if(!B)return;let Z=e.selection();H&&(Z.anchor.paragraphId!==Z.head.paragraphId||Z.anchor.offset!==Z.head.offset)&&!(Z.anchor.paragraphId===G.paragraphId&&Z.head.paragraphId===G.paragraphId&&Math.min(Z.anchor.offset,Z.head.offset)===B.start&&Math.max(Z.anchor.offset,Z.head.offset)===B.end)||R(G.paragraphId,B,"press");},K=[e.listeners.onDocument("pointermove",O),e.listeners.onDocument("pointercancel",_)];e.pagesLayer.addEventListener("click",q);let U=W=>{if(W.shiftKey||W.altKey||W.ctrlKey||W.metaKey||e.pagesLayer.contentEditable==="false")return false;let H=A(W);if(!H)return false;let{paragraphId:G,field:D}=H;return W.preventDefault(),R(G,D,"press"),e.protected(G)||C(G,D),true};e.pagesLayer.addEventListener("dblclick",U);function M(){let W=e.selection();if(W.anchor.paragraphId!==W.head.paragraphId)return null;let H=W.head.paragraphId,G=eb$1(e.part(),H);if(G?.kind!=="paragraph")return null;let D=Math.min(W.anchor.offset,W.head.offset),B=Math.max(W.anchor.offset,W.head.offset),Z=al(G).filter(N=>N.start<=D&&N.end>=B&&(N.start===N.end||D!==B||D<N.end||e.protected(H))),X=Z.find(N=>b?.paragraphId===H&&N.fieldNodeId===b.fieldNodeId)??Z.find(N=>N.start===D&&N.end===B)??Z[0];return X?{paragraphId:H,field:X}:null}function Y(){if(r===void 0)return M();if(!r)return null;let W=eb$1(e.part(),r.paragraphId),H=W?.kind==="paragraph"?al(W).find(G=>G.fieldNodeId===r.fieldNodeId):null;return H?{paragraphId:r.paragraphId,field:H}:null}let ne=W=>{let H=W.button===-1||W.clientX===0&&W.clientY===0?M():A(W);r=H?{paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",ne);let le=()=>{let W=Y();return !!W&&e.editable()&&!e.protected(W.paragraphId)&&!En$1(e.part(),{op:"setTextFormFieldDefault",paragraphId:W.paragraphId,fieldNodeId:W.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},se=e.pagesLayer.ownerDocument.createElement("span");return se.className="docx-text-form-status",e.container.append(se),{doubleClick:U,pointerUp:W=>q(W,true),canEdit:le,edit(){if(!le())return false;let W=Y();return R(W.paragraphId,W.field,"travel"),C(W.paragraphId,W.field),true},selectForDeletion(W){let H=e.selection(),{paragraphId:G,offset:D}=H.head;if(!e.editable()||e.protected(G)||H.anchor.paragraphId!==G||H.anchor.offset!==D)return false;let B=eb$1(e.part(),G);if(B?.kind!=="paragraph")return false;let Z=al(B).find(X=>X.start<X.end&&(W==="backward"?X.end===D:X.start===D));return Z?(R(G,Z),true):false},wordDeletionBoundary(W,H,G,D){let B=Ve$2(W,H,G,D),Z=e.selection().head.paragraphId;if(e.protected(Z))return B;let X=eb$1(e.part(Z),Z);if(X?.kind!=="paragraph")return B;let N=al(X),j=N.find(Q=>Q.start<Q.end&&(G===-1?Q.end===H:Q.start===H));if(j)return G===-1?j.start:j.end;let z=B;for(let Q of N)for(let ue of [Q.start,Q.end])G===-1&&ue<H&&ue>z&&(z=ue),G===1&&ue>H&&ue<z&&(z=ue);return z},beforeSelect(W){let H=xe=>{if(g!==void 0)b=g;else if(W.anchor.paragraphId!==W.head.paragraphId||b?.paragraphId!==W.head.paragraphId)b=null;else {let He=eb$1(e.part(),W.head.paragraphId),$e=He?.kind==="paragraph"?al(He).find(Je=>Je.fieldNodeId===b?.fieldNodeId):null;(!$e||Math.min(W.anchor.offset,W.head.offset)<$e.start||Math.max(W.anchor.offset,W.head.offset)>$e.end)&&(b=null);}return g=void 0,delete se.dataset.fieldError,xe};if(o||x)return null;if(!e.editable())return W;let G=M();if(!G||!e.protected(G.paragraphId)||!G.field.enabled||!Mk(G.field))return H(W);let{field:D,paragraphId:B}=G;if((!g||g.fieldNodeId===D.fieldNodeId)&&W.anchor.paragraphId===B&&W.head.paragraphId===B&&Math.min(W.anchor.offset,W.head.offset)>=D.start&&Math.max(W.anchor.offset,W.head.offset)<=D.end)return H(W);let Z=a.get(D.fieldNodeId),X=Z?.text,N=Z?.locale??e.locale?.()??"en-US",j=y(B,D);if(D.type==="date"&&X===void 0)return u(D.fieldNodeId),H(W);let z=Lk(j,D,"fill",N);if(z===j||z===null&&(X===void 0||X===j))return u(D.fieldNodeId),H(W);o=true;let Q=e.part();c(Q);let ue=a;a=new Map(ue),a.delete(D.fieldNodeId);let oe;try{oe=e.apply({op:"commitTextFormField",locale:N,paragraphId:B,fieldNodeId:D.fieldNodeId}),oe||(a=ue);}catch(xe){throw e.part()===Q&&(a=ue),xe}finally{c(),o=false;}if(!oe){if(g=void 0,se.setAttribute("role","alert"),se.dataset.fieldError="true",se.textContent=n("textFormField.invalidValue"),z===null&&(D.type==="number"||D.type==="date")){k();let xe=new AbortController;v=xe,x=true;let He=()=>{if(S||xe.signal.aborted||v!==xe||(k(),S))return;let Je=e.selection(),et=()=>{e.pagesLayer.focus({preventScroll:true}),e.select(Je);},_e=eb$1(e.part(),B),bt=_e?.kind==="paragraph"?al(_e).find(sn=>sn.fieldNodeId===D.fieldNodeId):null;if(!bt||!e.editable()||!e.protected(B)||y(B,bt)!==j||!bt.enabled||!Mk(bt)||bt.type!==D.type||bt.format!==D.format||Lk(j,bt,"fill",N)!==null){et();return}o=true;try{if(e.apply({op:"deleteText",paragraphId:B,start:bt.start,end:bt.end,textFormFieldId:bt.fieldNodeId})){u(bt.fieldNodeId),delete se.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let sn={paragraphId:B,offset:bt.start};o=!1,e.select({anchor:sn,head:sn}),b={paragraphId:B,fieldNodeId:bt.fieldNodeId};}else o=!1,et();}finally{o=false;}},$e={type:D.type,signal:xe.signal,acknowledge:He,cancel(){v===xe&&!xe.signal.aborted&&T();}};!e.onInvalidRequest?.($e)&&!xe.signal.aborted&&(h=WL(e.container,D.type,He,n));}return null}u(D.fieldNodeId);let te=eb$1(e.part(),B),me=te?.kind==="paragraph"?al(te).find(xe=>xe.fieldNodeId===D.fieldNodeId):null,Se=me?me.end-D.end:0,qe=xe=>xe.paragraphId===B&&xe.offset>=D.end?{...xe,offset:xe.offset+Se}:xe;return H({anchor:qe(W.anchor),head:qe(W.head)})},update(){h&&AL(h,n);let W=M(),H=e.selection(),G=!!W&&H.anchor.offset!==H.head.offset&&Math.min(H.anchor.offset,H.head.offset)===W.field.start&&Math.max(H.anchor.offset,H.head.offset)===W.field.end;for(let D of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let B=D.closest("[data-paragraph-id]")?.dataset.paragraphId,Z=Number(D.dataset.start);!!W&&B===W.paragraphId&&Z>=W.field.start&&Z<W.field.end?D.dataset.textFormSelection=G?"whole":"caret":delete D.dataset.textFormSelection;}if(se.dataset.fieldError){se.textContent=n("textFormField.invalidValue");return}W?se.setAttribute("role","status"):se.removeAttribute("role"),se.textContent=W?n(G?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>M()?.field.fieldNodeId??null,afterApply(W){W?c():d();},restoreAfterHistory:d,annotate(W){(!o||W.some(G=>G.op!=="commitTextFormField"))&&c(),W.some(G=>G.op==="insertText"||G.op==="deleteText")&&delete se.dataset.fieldError;let H=M();return b=H?{paragraphId:H.paragraphId,fieldNodeId:H.field.fieldNodeId}:null,W.map(G=>{if(!b||G.op!=="insertText"&&G.op!=="deleteText"||G.revision||G.paragraphId!==b.paragraphId||!e.protected(G.paragraphId))return G;let D=eb$1(e.part(),G.paragraphId),B=D?.kind==="paragraph"?al(D).find(N=>N.fieldNodeId===b.fieldNodeId):null,Z=G.op==="insertText"?G.offset:G.start,X=G.op==="insertText"?G.offset:G.end;return !B||Z<B.start||X>B.end?G:(a.has(B.fieldNodeId)||a.set(B.fieldNodeId,{text:y(G.paragraphId,B),locale:e.locale?.()??"en-US"}),{...G,textFormFieldId:B.fieldNodeId})})},keydown(W){if(W.key==="F10"&&W.shiftKey&&!W.altKey&&!W.ctrlKey&&!W.metaKey)return r=void 0,W.preventDefault(),e.pagesLayer.dispatchEvent(new(Ae(e.pagesLayer)).MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if(W.key!=="Tab"||W.altKey||W.ctrlKey||W.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let H=[],G=[e.part().root];for(;G.length;){let z=G.pop();if(z.kind==="paragraph")for(let Q of al(z))e.protected(z.id)&&Q.enabled&&Mk(Q)&&!En$1(e.part(),{op:"insertText",paragraphId:z.id,offset:Q.start,text:"x"})&&H.push({paragraphId:z.id,field:Q});else for(let Q=z.children.length-1;Q>=0;Q--){let ue=z.children[Q];ue.kind!=="textValue"&&G.push(ue);}}if(!H.length)return false;let D=e.selection(),B=D.head,Z=b?H.findIndex(z=>z.paragraphId===b.paragraphId&&z.field.fieldNodeId===b.fieldNodeId&&z.field.start<=Math.min(D.anchor.offset,B.offset)&&z.field.end>=Math.max(D.anchor.offset,B.offset)):-1,X=Z>=0?Z:H.findIndex(z=>z.paragraphId===B.paragraphId&&z.field.start<=Math.min(D.anchor.offset,B.offset)&&z.field.end>=Math.max(D.anchor.offset,B.offset)),N=X<0?W.shiftKey?H.length-1:0:(X+(W.shiftKey?-1:1)+H.length)%H.length,j=H[N];return W.preventDefault(),R(j.paragraphId,j.field,"travel"),true},destroy(){S=true,k(),mp.get(e.pagesLayer)===f&&mp.delete(e.pagesLayer),cv.get(e.pagesLayer)===p&&cv.delete(e.pagesLayer);for(let W of K)W();e.pagesLayer.removeEventListener("click",q),e.pagesLayer.removeEventListener("contextmenu",ne),se.remove(),e.pagesLayer.removeEventListener("dblclick",U),e.pagesLayer.removeEventListener("pointerdown",w,{capture:true}),h?.remove(),h=null;}}}function GL(e,t,n,r=o=>o){let o,a=e.subscribe(i=>{for(let s of i.splitJoin)"split"in s&&s.split.from===t&&(o=s.split.tail);});try{n(()=>{let i=o&&r(o,t);if(!i)return null;let s={paragraphId:i,offset:0};return {anchor:s,head:s}});}finally{a();}}var gp=new WeakMap;function Oc(e){let t=gp.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function zL(e){let t=gp.get(e)??{depth:0};return t.depth++,gp.set(e,t),()=>{--t.depth===0&&(gp.delete(e),t.resolve?.());}}var cU=12;function Mc(e,t){if(typeof MessageChannel!="function"){t.setTimeout(e,0);return}let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e();},n.port2.postMessage(null);}function ZL(e,t,n=cU){let r=globalThis.performance??Date;return new Promise((o,a)=>{let i=()=>{let s=r.now()+n;try{for(;;){let l=e.next();if(l.done){o(l.value);return}if(r.now()>=s)break}}catch(l){a(l);return}Mc(i,Ae(t));};i();})}async function XL(e,t,n){if(!e)throw an("notFound","no document is loaded");let r=t?Oc(t):void 0;if(r&&(await r,n()!==e))throw an("invalidState","The document changed before the pending save could finish.");return (await ZL(e.saveSteps(),t)).slice().buffer}function YL(e,t,n){return JL(e,t,n,()=>e.session.save())}function QL(e,t,n){return JL(e,t,n,()=>e.session.saveSteps())}function JL(e,t,n,r){let o=()=>{if(n())throw an("destroyed","Cannot save a destroyed surface.")};if(o(),Oc(t))throw an("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),o();let a=jL(t);if(a)throw an(a,"Cannot save pending text form input. Enter a valid value in each field.");o(),e.refreshRefFieldResults(),o();let i=DA(t);sa(t,true);try{return r()}finally{sa(t,i);}}function hp(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function eF(e,t,n){let r=n.refusal();if(r)return r;let o=new Map;for(let i of e){if(i.op!=="commitTextFormField")return "invalidArgs";let s=Ot(n.session,i.paragraphId,{kind:"body"}),l=JSON.stringify(s),c=o.get(l)??{scope:s,ops:[]};c.ops.push(i),o.set(l,c);}for(let i of o.values()){let s=n.gate(i.ops,i.scope);if(s)return s}if(n.collaborationActive)return "unsupported";let a;return n.commit(()=>a=n.session.applyTreeOpsAtomic([...o.values()]),()=>t),a?.rejected?a.reason??"invalidArgs":null}function tF(e,t){let n=Hk(e);return {get:()=>n,set(r){let o=Hk(r);n!==o&&(t(),n=o);}}}var dU=42,uU=/^(\d{4})-(\d{2})-(\d{2})/,fU=new Set(["AG","AS","BD","BR","BS","BT","BW","BZ","CA","CO","DM","DO","ET","GT","GU","HK","HN","ID","IL","IN","JM","JP","KE","KH","KR","LA","MH","MM","MO","MT","MX","MZ","NI","NP","PA","PE","PH","PK","PR","PT","PY","SA","SG","SV","TH","TT","TW","UM","US","VE","VI","WS","YE","ZA","ZW"]),pU=new Set(["AE","AF","BH","DJ","DZ","EG","IQ","IR","JO","KW","LY","OM","QA","SD","SY"]);function ui(e){return `${String(e.getFullYear()).padStart(4,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Ao(e){let t=uU.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),o=Number(t[3]);if(r<1||r>12||o<1||o>31)return null;let a=new Date(n,r-1,o);return a.getFullYear()!==n||a.getMonth()!==r-1||a.getDate()!==o?null:a}function yp(e){let t=Hk(e);try{let n=new Intl.Locale(t),r=n,o=r.getWeekInfo?.().firstDay??r.weekInfo?.firstDay;if(typeof o=="number"&&o>=1&&o<=7)return o%7;let a=n.maximize().region;if(a&&fU.has(a))return 0;if(a&&pU.has(a))return 6}catch{}return 1}function nF(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function rF(e,t,n){return new Intl.DateTimeFormat(Hk(n),{calendar:"gregory",month:"long",year:"numeric"}).format(new Date(e,t,1))}function oF(e){let t=Hk(e),n=new Intl.DateTimeFormat(t,{calendar:"gregory",weekday:"narrow"}),r=yp(t);return Array.from({length:7},(o,a)=>n.format(new Date(2024,0,7+(r+a)%7)))}function dv(e,t,n={}){let r=Hk(n.locale),o=n.selected?Ao(n.selected):null,a=n.today??new Date,i=new Intl.DateTimeFormat(r,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric"}),s=yp(r),l=(new Date(e,t,1).getDay()-s+7)%7,c=[];for(let d=0;d<dU;d+=1){let u=new Date(e,t,d-l+1);c.push({iso:ui(u),day:u.getDate(),label:i.format(u),otherMonth:u.getMonth()!==t,selected:o!==null&&nF(u,o),today:nF(u,a)});}return {year:e,month:t,title:rF(e,t,r),weekdays:oF(r),days:c}}function bp(e,t,n){let r=new Date(e,t+n,1);return {year:r.getFullYear(),month:r.getMonth()}}function uv(e,t,n,r=false){let o=Ao(e);if(!o)return null;let a={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7},i=(o.getDay()-yp(n)+7)%7;if(t==="PageUp"||t==="PageDown"){let s=o.getDate();o.setDate(1),o.setMonth(o.getMonth()+(t==="PageUp"?-1:1)*(r?12:1));let l=new Date(o.getFullYear(),o.getMonth()+1,0).getDate();o.setDate(Math.min(s,l));}else {let s=t==="Home"?-i:t==="End"?6-i:a[t];if(s===void 0)return null;o.setDate(o.getDate()+s);}return o.getFullYear()>=100&&o.getFullYear()<=9999?ui(o):null}function vp(e,t){let n=Ao(e);if(!n)return "";let r=Hk(t),o=new Intl.NumberFormat(r,{useGrouping:false}).format(0);return new Intl.DateTimeFormat(r,{calendar:"gregory",year:"numeric",month:"numeric",day:"numeric"}).formatToParts(n).map(a=>a.type==="year"?a.value.padStart(4,o):a.value).join("")}function fv(e,t){if(e.length>100)return null;let n=e.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n)){let s=Ao(n);return s?ui(s):null}let r=Ik(Hk(t)),o=r.pattern.exec(Jk(n,r));if(!o)return null;let a={year:"",month:"",day:""};if(r.order.forEach((s,l)=>{a[s]=o[l+1];}),a.year.length!==4)return null;let i=`${a.year}-${a.month.padStart(2,"0")}-${a.day.padStart(2,"0")}`;return Ao(i)?i:null}function pv(e){let t=new Intl.DateTimeFormat(Hk(e),{calendar:"gregory",month:"long"});return Array.from({length:12},(n,r)=>t.format(new Date(2e3,r,1)))}function mv(e){let t="",n=0,r=new Intl.Collator(Hk(e),{usage:"search",sensitivity:"base"});return {reset(){t="",n=0;},keyDown(o,a){if(o.defaultPrevented||o.isComposing||o.altKey||o.ctrlKey||o.metaKey)return;let i=o.target.tagName==="INPUT",s=[...a.querySelectorAll('[role="option"]')].filter(d=>!d.hasAttribute("disabled"));if(!s.length)return;let l=s.indexOf(a.ownerDocument.activeElement),c;if(o.key==="ArrowDown")c=Math.min(s.length-1,l+1);else if(o.key==="ArrowUp")c=l<0?s.length-1:Math.max(0,l-1);else if(!i&&o.key==="Home")c=0;else if(!i&&o.key==="End")c=s.length-1;else if(!i&&o.key.length===1&&o.key!==" "){let d=Date.now();t=d-n>700?o.key:(t+o.key).slice(-100),n=d;let u=[...t].every(f=>r.compare(f,o.key)===0)?o.key:t;for(let f=1;f<=s.length;f++){let p=(Math.max(-1,l)+f)%s.length;if(r.compare((s[p].textContent??"").slice(0,u.length),u)===0){c=p;break}}}c!==void 0&&(o.preventDefault(),s.forEach((d,u)=>{d.tabIndex=u===c?0:-1;}),s[c]?.focus({preventScroll:true}),s[c]?.scrollIntoView?.({block:"nearest"}));}}}var mU=0;function aF(e,t){let n=e.document.createElement("div");n.className="docx-content-control-menu",n.dataset.docxMarker="",n.dataset.docxPart="popup",n.addEventListener("keydown",r=>Tc(n,r,()=>e.close(n))),n.dataset.docxCcId=t,n.setAttribute("contenteditable","false"),n.style.position="absolute",n.style.zIndex="20",n.style.pointerEvents="auto",n.addEventListener("pointerdown",r=>r.stopPropagation());for(let r of ["keydown","beforeinput","input","compositionstart","compositionupdate","compositionend","copy","cut","paste"])n.addEventListener(r,o=>o.stopPropagation());return n}function iF(e,t,n){if(!n){t.append(e);return}e.style.left=`${n.left}px`,e.style.top=`${n.top}px`;let r=n.element?t.closest(".docx-editor__scroll-container")??t.parentElement??t:t;if(r.append(e),n.element){let i=Cc(e,n.element),s=new(Ae(e)).MutationObserver(()=>{e.isConnected||(i(),s.disconnect());});s.observe(r,{childList:true});return}let o=e.offsetWidth;if(o<=0)return;let a=n.left+o-n.sheetRight;a>0&&(e.style.left=`${Math.max(n.sheetLeft,n.left-a)}px`);}function xp(e,t,n,r){if(e.setValue(n,r))return e.close(t),true;let o=t.querySelector("[data-docx-part=error]");return o||(o=e.document.createElement("div"),o.dataset.docxPart="error",o.className="docx-content-control-widget-error",o.setAttribute("role","alert"),t.append(o)),o.hidden=false,o.textContent=cr(e.translate)("disabledReason.invalidValue"),false}function sF(e,t,n,r,o,a){let i=aF(e,t),s=cr(e.translate);i.setAttribute("role","dialog"),i.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let l=e.document.createElement("div");l.className="docx-content-control-menu-list",l.dataset.docxPart="list",l.id=`docx-engine-cc-list-${++mU}`,l.setAttribute("role","listbox"),l.setAttribute("aria-label",o||s(`contentControl.types.${n}`));let c=mv(e.locale());i.addEventListener("keydown",u=>c.keyDown(u,i));let d=r.findIndex(u=>u.value===a);for(let[u,f]of r.entries()){let p=e.document.createElement("button");p.type="button",p.className="docx-content-control-menu-item",p.dataset.docxPart="item",p.dataset.value=f.value,p.setAttribute("role","option"),p.setAttribute("aria-selected",String(f.value===a)),p.tabIndex=u===Math.max(0,d)?0:-1,p.textContent=f.displayText,p.addEventListener("click",()=>{xp(e,i,t,f.value);}),l.append(p);}if(n==="buildingBlockGallery"&&r.length===0){let u=e.document.createElement("div");u.className="docx-content-control-menu-empty",u.dataset.docxPart="empty",u.setAttribute("role","note"),u.tabIndex=0,u.textContent=s("contentControl.gallery.empty"),l.append(u);}if(n==="comboBox"){let u=e.document.createElement("input");u.type="text",u.className="docx-content-control-menu-input",u.dataset.docxPart="input",u.value=a??"",u.setAttribute("aria-label",o||s("contentControl.types.comboBox")),u.setAttribute("aria-autocomplete","list"),u.setAttribute("role","combobox"),u.setAttribute("aria-expanded","true"),u.setAttribute("aria-controls",l.id),u.addEventListener("keydown",p=>{p.key!=="Enter"||p.isComposing||(p.preventDefault(),xp(e,i,t,u.value));}),i.append(u);let f=e.document.createElement("div");f.className="docx-dialog__footer",f.dataset.docxPart="footer";for(let p of ["cancel","apply"]){let g=e.document.createElement("button");g.type="button",g.className=`docx-dialog__button${p==="apply"?" docx-dialog__button--primary":""}`,g.dataset.docxPart=p,g.textContent=s(`common.${p}`),g.addEventListener("click",()=>{p==="apply"?xp(e,i,t,u.value):e.close(i);}),f.append(g);}i.append(l,f);}else i.append(l);return i}function Sp(e,t){let n=(t?e.querySelector(`[data-iso="${t}"]`):null)??e.querySelector("[data-selected]")??e.querySelector("[data-today]:not([data-other-month])")??e.querySelector(".docx-content-control-calendar-day:not([data-other-month])");for(let r of e.querySelectorAll("[data-iso]"))r.tabIndex=r===n?0:-1;n?.focus({preventScroll:true});}function lF(e,t,n,r){let o=cr(e.translate),a=aF(e,t);a.classList.add("docx-content-control-calendar"),a.setAttribute("role","dialog"),a.setAttribute("aria-label",r||o("contentControl.types.date"));let i=n?Ao(n):null,s=i?ui(i):null,l=new Date,c={year:(i??l).getFullYear(),month:(i??l).getMonth()},d=null,u=vp(s??"",e.locale()),f=b=>{xp(e,a,t,b);},p=b=>{b.addEventListener("mousedown",v=>v.stopPropagation());},g=e.document.createElement("div");g.className="docx-content-control-calendar-title docx-content-control-calendar-announcement",g.dataset.docxPart="title",g.setAttribute("aria-live","polite");let y=()=>{let b=e.document.activeElement?.dataset.docxCalendarNav,v=dv(c.year,c.month,{locale:e.locale(),selected:s,today:l}),S=e.document.createElement("div");S.className="docx-content-control-calendar-header",S.dataset.docxPart="header";let x=e.document.createElement("button");x.type="button",x.className="docx-content-control-calendar-nav",x.dataset.docxPart="previousMonth",x.dataset.docxCalendarNav="previous",x.textContent="\u2039",x.setAttribute("aria-label",o("contentControl.calendar.previousMonth")),g.textContent=v.title;let k=e.document.createElement("button");k.type="button",k.className="docx-content-control-calendar-nav",k.dataset.docxPart="nextMonth",k.dataset.docxCalendarNav="next",k.textContent="\u203A",k.setAttribute("aria-label",o("contentControl.calendar.nextMonth")),p(x),p(k),x.addEventListener("click",()=>{c=bp(c.year,c.month,-1),d=null,y();}),k.addEventListener("click",()=>{c=bp(c.year,c.month,1),d=null,y();});let T=e.document.createElement("div");T.className="docx-content-control-calendar-navigation",T.dataset.docxPart="navigation";let R=e.document.createElement("select");R.className="docx-content-control-calendar-month",R.dataset.docxPart="month",R.dataset.docxCalendarNav="month",R.setAttribute("aria-label",o("contentControl.calendar.month"));for(let[U,M]of pv(e.locale()).entries()){let Y=e.document.createElement("option");Y.value=String(U),Y.textContent=M,R.append(Y);}R.value=String(c.month);let C=e.document.createElement("input");C.type="number",C.min="100",C.max="9999",C.value=String(c.year),C.className="docx-content-control-calendar-year",C.dataset.docxPart="year",C.dataset.docxCalendarNav="year",C.addEventListener("keydown",U=>{U.key==="Enter"&&!U.isComposing&&(U.preventDefault(),C.blur());}),C.setAttribute("aria-label",o("contentControl.calendar.year")),R.addEventListener("change",()=>{c.month=Number(R.value),d=null,y();}),C.addEventListener("change",()=>{let U=Number(C.value);if(!Number.isInteger(U)||U<100||U>9999){C.value=String(c.year);return}c.year=U,d=null,y();}),T.append(R,C);let A=e.document.createElement("div");A.className="docx-content-control-calendar-weekdays",A.dataset.docxPart="weekdays";for(let U of v.weekdays){let M=e.document.createElement("span");M.textContent=U,A.append(M);}let E=e.document.createElement("div");E.className="docx-content-control-calendar-grid",E.dataset.docxPart="grid",E.setAttribute("role","grid"),E.setAttribute("aria-label",v.title);for(let U=0;U<v.days.length;U+=7){let M=e.document.createElement("div");M.className="docx-content-control-calendar-week",M.setAttribute("role","row");for(let Y of v.days.slice(U,U+7))M.append(h(Y));E.append(M);}let P=e.document.createElement("div");P.className="docx-content-control-calendar-entry",P.dataset.docxPart="dateEntry";let w=e.document.createElement("button");w.type="button",w.className="docx-content-control-calendar-today",w.dataset.docxPart="today",w.textContent=o("contentControl.calendar.today"),p(w),w.addEventListener("click",()=>f(ui(l)));let O=e.document.createElement("input");O.type="text",O.className="docx-content-control-menu-input",O.dataset.docxPart="input",O.setAttribute("aria-label",o("contentControl.types.date")),O.placeholder=vp("2006-11-22",e.locale()),O.value=u,O.addEventListener("input",()=>{u=O.value,O.removeAttribute("aria-invalid"),_.hidden=true;});let _=e.document.createElement("div");_.className="docx-content-control-widget-error",_.dataset.docxPart="error",_.setAttribute("role","alert"),_.hidden=true,_.textContent=o("disabledReason.invalidValue");let q=()=>{let U=fv(u,e.locale());U?f(U):(_.hidden=false,O.setAttribute("aria-invalid","true"),O.focus());};O.addEventListener("keydown",U=>{U.key==="Enter"&&!U.isComposing&&(U.preventDefault(),q());});let K=e.document.createElement("div");K.className="docx-dialog__footer",K.dataset.docxPart="footer";for(let U of ["cancel","apply"]){let M=e.document.createElement("button");M.type="button",M.dataset.docxPart=U,M.className=`docx-dialog__button${U==="apply"?" docx-dialog__button--primary":""}`,M.textContent=o(`common.${U}`),M.addEventListener("click",U==="apply"?q:()=>e.close(a)),K.append(M);}S.append(x,T,k,g),P.append(w,O),a.replaceChildren(S,A,E,P,_,K),Sp(a,d),b==="previous"&&x.focus({preventScroll:true}),b==="next"&&k.focus({preventScroll:true}),b==="month"&&R.focus({preventScroll:true}),b==="year"&&C.focus({preventScroll:true});},h=b=>{let v=e.document.createElement("button");return v.type="button",v.className="docx-content-control-calendar-day",v.dataset.docxPart="day",v.textContent=String(b.day),v.dataset.iso=b.iso,v.setAttribute("role","gridcell"),v.setAttribute("aria-label",b.label),b.otherMonth&&(v.dataset.otherMonth=""),b.selected&&(v.dataset.selected="",v.setAttribute("aria-selected","true")),v.setAttribute("aria-selected",String(b.selected)),b.today&&(v.dataset.today="",v.setAttribute("aria-current","date")),p(v),v.addEventListener("click",()=>f(b.iso)),v.addEventListener("keydown",S=>{if(S.isComposing||S.altKey||S.ctrlKey||S.metaKey)return;let x=uv(b.iso,S.key,e.locale(),S.shiftKey);if(!x)return;S.preventDefault();let k=Ao(x);if(d=x,k.getFullYear()!==c.year||k.getMonth()!==c.month){c={year:k.getFullYear(),month:k.getMonth()},y();return}Sp(a,d);}),v};return y(),a}function gv(e,t){let r=(Ft(t)?t:null)?.closest("[data-docx-form-checkbox][data-start]"),o=r?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!r||!o)return null;let a=eb$1(e.part(o),o);if(a?.kind!=="paragraph")return null;let i=Number(r.dataset.start),s=dn(a).find(l=>l.start<=i&&i<l.end);return s?{paragraphId:o,field:s}:null}function cF(e){return e.shiftKey||e.altKey||e.ctrlKey||e.metaKey}function dF(e){let t=(a,i)=>{if(!e.editable()||!i.enabled)return false;let s=e.apply({op:"setLegacyCheckbox",paragraphId:a,fieldNodeId:i.fieldNodeId,checked:!i.checked});return s&&(e.pagesLayer.focus({preventScroll:true}),e.select({anchor:{paragraphId:a,offset:i.start},head:{paragraphId:a,offset:i.end}})),s},n=a=>{if(a.button!==0||cF(a))return;let i=gv(e,a.target);!i||!e.editable()||!i.field.enabled||(a.preventDefault(),a.stopPropagation(),t(i.paragraphId,i.field));};e.pagesLayer.addEventListener("pointerdown",n,{capture:true});let r=a=>{let i=gv(e,a.target);i&&zr(a.target)&&a.target.setAttribute("aria-disabled",String(!e.editable()||!i.field.enabled));};e.pagesLayer.addEventListener("focusin",r);let o=()=>{let a=e.selection();if(a.anchor.paragraphId!==a.head.paragraphId)return null;let i=a.head.paragraphId,s=eb$1(e.part(i),i);if(s?.kind!=="paragraph")return null;let l=Math.min(a.anchor.offset,a.head.offset),c=Math.max(a.anchor.offset,a.head.offset),d=dn(s).find(u=>u.start===l&&u.end===c||l===c&&l===u.start&&e.protected(i));return d?{paragraphId:i,field:d}:null};return {keydown(a){let i=gv(e,a.target);if(i&&a.key==="Tab")return true;if(i&&a.key.length===1&&a.key!==" "&&!a.ctrlKey&&!a.metaKey&&!a.altKey)return a.preventDefault(),true;if(a.key!==" "||cF(a)||a.isComposing)return false;let s=i??o();if(!s)return false;if(!e.editable()||!s.field.enabled)return i?(a.preventDefault(),true):false;a.preventDefault();let l=t(s.paragraphId,s.field);return i&&l&&[...e.pagesLayer.querySelectorAll("[data-docx-form-checkbox][data-start]")].find(c=>c.dataset.paragraphId===s.paragraphId&&Number(c.dataset.start)===s.field.start)?.focus({preventScroll:true}),true},destroy(){e.pagesLayer.removeEventListener("pointerdown",n,{capture:true}),e.pagesLayer.removeEventListener("focusin",r);}}}var gU=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertComplexField","insertEquation","setFieldResult","insertInlineContentControl","insertNote","insertTable","insertTableRow","deleteTableRow","mergeTableCells","splitTableCell","setRunProperties","setParagraphProperties","setParagraphMarkProperties","setListNumbering","setListLevel","setContentControlValue"]);function uF(e){return gU.has(e.op)}function Ac(e){if(uF(e))return e.revision!==void 0;switch(e.op){case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "insertContentControl":case "authorTable":case "splitParagraphMany":return e.revision!==void 0;default:return false}}var hU=e=>hl.has(e);function Lc(e,t,n){return e.flatMap(r=>uF(r)?!n&&hU(r.op)?[r]:[r.revision!==void 0?r:{...r,revision:t}]:r.op==="splitParagraphMany"?[{...r,revision:t}]:r.op==="splitParagraph"?[r,{op:"setParagraphMarkRevision",paragraphId:r.paragraphId,kind:"ins",revision:t}]:r.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:r.secondId,revision:t}]:[r])}function wp(e,t,n,r,o){let{past:a,landing:i}=Ij$1(e,{start:t,end:n},n,r,o),s=Gj$1(e,t,a,r);return (a-t>s?i:a)-s}function yv(e){return e?.trim()||void 0}var hv=new Map;function fF(e){let t=hv.get(e);if(t!==void 0)return t;let n=e.trim().split(/\s+/).filter(Boolean),r=n.length===0?"?":n.slice(0,2).map(o=>o[0].toUpperCase()).join("");return hv.size<256&&hv.set(e,r),r}function kp(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}var pF="data-docx-editor-chart",bv="the copied chart is no longer available; copy the chart again",Ip=null;function yU(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function bU(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vU(e){let t=[e];for(;t.length;){let n=t.pop();if(n.kind!=="textValue"){if(n.namespaceUri===wa&&n.localName==="docPr")return n.attributes.find(o=>o.namespaceUri===""&&o.localName==="name")?.value??"";for(let r of n.children)t.push(r);}}return ""}function mF(e,t,n){let r=e.parts.get(t);if(!r||!n$1(e,t,n))return null;let o=wn(r,n);return !o||o.chartDrawing.kind!=="drawing"?null:{pkg:e,ownerPart:t,drawing:o.chartDrawing}}function gF(e){let t=yU();Ip={token:t,source:e};let n=vU(e.drawing);return {text:n,html:`<meta charset="utf-8"><span ${pF}="${t}">${bU(n)}</span>`}}function hF(e){if(!e||!e.includes(pF))return null;let t=/data-docx-editor-chart="([0-9a-f]{32})"/.exec(e);return t?t[1]:null}function yF(e){return Ip&&Ip.token===e?Ip.source:null}var Fc="the document is open for viewing",Dc="chart changes are not supported in suggesting mode";function bF(e){let t=()=>{let r=e.editingMode();return r==="view"?{ok:false,reason:"invalidArgs",detail:Fc}:r==="suggest"?{ok:false,reason:"invalidArgs",detail:Dc}:null},n=r=>{let o=t();if(o)return o;let a={ok:false,reason:"invalidArgs"};return e.commit(()=>(a=r(),{committed:a.ok,rejected:!a.ok,opCount:a.ok?1:0,...a.ok?{}:{reason:a.detail??a.reason}})),a};return {insertChart(r){let o=e.actorId();return n(()=>e.session.charts().insert(e.storyScope(),{...r,...e.outsidePromptAt?.(r.paragraphId,r.offset)?{bias:"left"}:{},...o?{actorId:o}:{}}))},editChart(r,o){let a=e.actorId();return n(()=>e.session.charts().edit(e.storyScope(),r,o,a?{actorId:a}:void 0))}}}var vF=e=>({committed:false,rejected:true,opCount:0,reason:e});function xF(e){if(e.cellSelection())return null;let{from:t,to:n}=e.orderedRange();if(t.paragraphId!==n.paragraphId||t.offset!==n.offset)return null;let r=e.selectedDrawing?.();if(!r)return null;let o=mF(e.session.currentPackage(),r.ownerPartName,r.drawingNodeId);return o?{...gF(o),chartDrawingNodeId:r.drawingNodeId}:null}function SF(e,t){let n=hF(t);if(n===null||e.richPasteAllowed?.()===false)return null;let r=yF(n),o=e.editingMode(),a=r?o==="view"?Fc:o==="suggest"?Dc:null:bv;if(a||!r)return e.commit(()=>vF(a??bv)),false;e.flushPendingInputAndLayout();let i=e.typingSelectionPlan?.()??e.deleteSelectionPlan(),s=i.replaceAt??i.collapseTo,l=e.storyScope(),c=null;return e.commit(()=>{let d=e.collaborationGate(i.ops,l);if(d)return vF(d);let u=e.actorId(),f=e.session.charts().duplicate(l,{source:r,paragraphId:s.paragraphId,offset:s.offset,priorOps:i.ops,...i.outsidePromptId?{bias:"left"}:{},...u?{actorId:u}:{}});return f.ok&&(c=f.drawingNodeId??null),{committed:f.ok,rejected:!f.ok,opCount:f.ok?1:0,...f.ok?{}:{reason:f.detail??f.reason}}},()=>Ne(s)),c===null?false:(e.selectPastedDrawing?.(c,s.paragraphId),true)}function wF(e,t,n){e.selectDrawing(t,n)&&e.revealPosition(e.state().selection.head,{block:"nearest"});}function Is(e,t,n){if(!e)return null;let r=Te(e,t);return !r||r.record.paragraphId!==n?null:{paragraphId:n,offset:r.record.start}}var kF="docx-field-atom--active",xU="docx-field-atom",IF=new WeakMap;function vv(e,t,n){let r=IF.get(e);r||(r={caretKey:null,marked:[]},IF.set(e,r));let o=t?`${t.paragraphId}\0${t.offset}`:null;if(!n?.domReplaced&&o===r.caretKey)return;for(let i of r.marked)i.classList.remove(kF);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${xU}`);for(let i of a){if(i.dataset.paragraphId!==t.paragraphId)continue;let s=Number(i.dataset.fieldResultStart??i.dataset.start),l=Number(i.dataset.fieldResultEnd??i.dataset.end);!Number.isFinite(s)||!Number.isFinite(l)||t.offset<s||t.offset>l||(i.classList.add(kF),r.marked.push(i));}}var RF=new WeakMap;function SU(e){let t=[],n={x:e.box.x,y:e.box.y};for(let r of [e.header,e.footer]){if(!r)continue;let o={x:r.box.x,y:r.box.y};Ra(r,(a,i)=>{i.textboxDepth===0||i.textboxOwner?.accessibility.hidden||i.textboxOwner?.textboxStory?.contentRotation||t.push(Pf$1(a,i.storyOrigin.x-e.contentBox.x,i.storyOrigin.y-e.contentBox.y));},o,a=>Ia(a,o,n));}return t}function fi(e){let t=RF.get(e);if(t)return t;let n=e.pages.map(o=>{let a=TF(o);return a.length?{...o,fragments:[...o.fragments,...a]}:o}),r=n.every((o,a)=>o===e.pages[a])?e:{...e,pages:n};return RF.set(e,r),r}function TF(e){let t=_b$1(e).flatMap(n=>{let r=n.textboxStory;return r.contentRotation?[]:r.fragments.flatMap(o=>o.kind==="paragraph"?[Pf$1(o,n.x+r.contentOffset.x,n.y+r.contentOffset.y)]:[])});return t.push(...SU(e)),t}var PF=new WeakMap,CF=new WeakMap;function xv(e){let t=PF.get(e);if(t)return t;let n=e.pages.map(o=>{let a=CF.get(o);if(!a){let{header:i,footer:s,footnotes:l,endnotes:c,...d}=o;a={...d,fragments:TF(o)},CF.set(o,a);}return a}),r={...e,pages:n};return PF.set(e,r),r}function EF(e,t,n,r){let o=nf$1(e,t,n,r),a=null,i=t.filter(s=>o.has(s.key)||!s.key.startsWith("comment-")?false:(a??=eb$2(e),!a.has(s.from.paragraphId)));if(i.length===0)return o;for(let[s,l]of nf$1(xv(e),i,n,r))o.set(s,l);return o}var wU={kind:"body"};function OF(e){let{session:t}=e;if(e.editingMode==="view"||!t.editable)return true;if(e.collaborationActive)return false;let n,r=e.reviewerFilterActive?l=>(n??=Y(e.canonicalUnfilteredLayout()),n(l)):Y(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},a=Z(t.part(),o),i=_(t.part(),o);if(!a&&i.length===0)return true;let s=[];a&&s.push({scope:wU,ops:[a]});for(let l of i)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function kU(e,t,n){return t==="all-markup"||t==="simple-markup"?Ce(e,y(n.reviewItems()),t==="simple-markup"):e}function MF(e,t,n){return e.filter(kU(t.filterForSession(n),e.view(),n))}function AF(){let e=new WeakMap;return {record(t,n){e.set(t,[n?.cacheKey,n?.unlisted]);},moved(t,n){let[r,o]=e.get(t)??[];return n?.cacheKey!==r||n?.unlisted!==o}}}function FF(e){let t=0,n=null,r="",o=null,a=true,i=null,s="";return ()=>{let l=e.surface(),c=`${l?.session.packageRevision()??-1}:${l?.session.revision()??-1}`,d=e.activeKey(),u=e.paneOpen(),f=e.selectionAnchor(),p=e.authorFilterKey();return (l!==n||c!==r||d!==o||u!==a||f!==i||p!==s)&&(n=l,r=c,o=d,a=u,i=f,s=p,t+=1),t}}function Rp(e=[]){let t=new Set(e),n=Object.freeze([...t]),r=pb$1(t),o=null,a="accept",i=null,s="accept",l=new WeakMap,c=null,d=false,u=0,f=null,p=[],g=null,y=[],h=r,b=t,v=new Set,S="accept",x=new WeakSet,k=new WeakMap,T=new Map,R=()=>{u+=1,f=null,p=[],g=null;},C=P=>JSON.stringify([P.id,pl(P)]),A=(P,w,O)=>{let _=IU(O),q=t,K=r?.hiddenAuthors??ob$1,U=a,M;q===b&&RU(_,v)&&(_.size===0||U===S)?M=h:_.size===0&&q.size===0?M=void 0:M=Object.freeze({hiddenAuthors:K,includes:ne=>!q.has(ne.author)&&!_.has(ne.nodeId),includesNode:(ne,le)=>!q.has(le)&&!_.has(ne),excludedNodeMode:(ne,le)=>q.has(le)?"proposed":_.has(ne)&&U==="reject"?"original":"proposed",cacheKey:PU(q,_,U)});let Y=[];for(let ne of P){let le=LF(ne);le!==null&&q.has(le)||ne.kind==="revision"&&w.has(ne)||Y.push(ne);}y=Y.length===P.length?P:km(Y),g=P,x=w,h=M,b=q,v=_,S=U,d=false,i=null,s="accept",l=new WeakMap,c=null;},E=P=>{if(P===g)return;let w=new WeakSet,O=[],_=[];try{for(let K of P){if(K.kind!=="revision")continue;let U=!t.has(K.author),M=k.get(K);M===void 0&&(M=o?.(K)??!0,_.push([K,M])),!(U&&M)&&(w.add(K),M||O.push(K));}}catch(K){if(d)o=i,a=s,k=l,g=c,i=null,s="accept",l=new WeakMap,c=null,u+=1;else {let U=new WeakSet,M=[];for(let Y of P){if(Y.kind!=="revision")continue;let ne=T.get(C(Y))??true;(t.has(Y.author)||!ne)&&U.add(Y),ne||M.push(Y);}A(P,U,M);}throw d=false,K}for(let[K,U]of _)k.set(K,U);let q=new Map;for(let K of P)K.kind==="revision"&&q.set(C(K),k.get(K)??true);T=q,A(P,w,O);};return {get hiddenAuthors(){return r?.hiddenAuthors??ob$1},get hiddenAuthorList(){return n},get stateKey(){return String(u)},get hasFilter(){return t.size>0||o!==null},get hasPredicate(){return o!==null},filterFor(P){return o?(E(P),h):r},filterForSession(P){return o?(E(P.reviewItems()),h):r},filterItems(P){if(!o){if(t.size===0)return P;if(P===f)return p;let w=P.filter(O=>{let _=LF(O);return _===null||!t.has(_)});return f=P,p=w.length===P.length?P:km(w),p}return E(P),y},includesRevisionItem(P){return !x.has(P)},setPredicate(P,w="accept"){return o===null&&P===null?false:P===null?(o=null,a="accept",i=null,s="accept",d=false,k=new WeakMap,l=new WeakMap,T=new Map,c=null,y=[],x=new WeakSet,h=r,b=t,v=new Set,S="accept",R(),true):(i=o,s=a,l=k,c=g,d=true,o=P,a=w,k=new WeakMap,R(),true)},isVisible:P=>!t.has(P),setVisible(P,w){if(w===!t.has(P))return false;let O=new Set(t);return w?O.delete(P):O.add(P),t=O,n=Object.freeze([...O]),r=pb$1(O),R(),true},setAllVisible(P,w){let O=w?new Set:new Set(P);return O.size===t.size&&[...O].every(_=>t.has(_))?false:(t=O,n=Object.freeze([...O]),r=pb$1(O),R(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,R(),true)}}}function DF(e,t){return t.filterItems(e)}function IU(e){let t=new Set;for(let n of e)for(let r of pl(n))t.add(r);return t}function RU(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function PU(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function LF(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function NF(e,t){let n=r=>{if(!t.enabled)return;let o=t.surface();if(o)return o.setAllRevisionAuthorsVisible(r);!r||!e.showAll()||t.notify();};return {isReviewAuthorVisible:e.isVisible,setReviewAuthorVisible(r,o){if(!t.enabled)return;let a=t.surface();if(a)return a.setRevisionAuthorVisible(r,o);e.setVisible(r,o)&&t.notify();},setAllReviewAuthorsVisible:n,showAllReviewAuthors:()=>n(true)}}var CU=Object.freeze({mode:"atomic",run:e=>e(),wrap:e=>e,methods:e=>e,listeners:()=>{},selectsWholeFieldWhen:()=>{},edits:e=>e});function TU(e){if(e===void 0||e==="atomic")return "atomic";if(e==="editable")return "editable";throw new TypeError('Invalid fieldResults: use "atomic" or "editable"')}var Sv='fieldResults "editable" is not supported in a collaboration session: shared paragraph text keeps each field one unit';function EU(e){if(e==="atomic")return CU;let t=o=>Yg(e,o),n=o=>function(...a){return t(()=>o.apply(this,a))},r=()=>false;return {mode:e,run:t,wrap:n,selectsWholeFieldWhen(o){r=o;},edits:o=>function(...a){return r()?Zg(()=>o.apply(this,a)):o.apply(this,a)},methods(o){for(let a of Reflect.ownKeys(o)){let i=Object.getOwnPropertyDescriptor(o,a);if(i?.configurable){if(typeof i.value=="function")i.value=n(i.value);else if(i.get||i.set)i.get&&(i.get=n(i.get)),i.set&&(i.set=n(i.set));else continue;Object.defineProperty(o,a,i);}}return o},listeners(o){let a=o.addEventListener,i=o.removeEventListener,s=new WeakMap,l=c=>{let d=s.get(c);return d||(d=typeof c=="function"?function(u){return t(()=>c.call(this,u))}:u=>t(()=>c.handleEvent(u)),s.set(c,d)),d};Object.defineProperty(o,"addEventListener",{configurable:true,writable:true,value(c,d,u){d&&a.call(o,c,l(d),u);}}),Object.defineProperty(o,"removeEventListener",{configurable:true,writable:true,value(c,d,u){d&&i.call(o,c,s.get(d)??d,u);}});}}}function HF(e,t){if(t.mode==="atomic")return e;let n=e,r=n.subscribe.bind(n),o=n.applyTreeOps.bind(n),a=n.applyTreeOpsAtomic.bind(n);return n.subscribe=i=>r(t.wrap(i)),n.applyTreeOps=t.edits(o),n.applyTreeOpsAtomic=t.edits(a),t.methods(e)}function Pp(e){let t=TU(e.fieldResults);if(t==="editable"&&e.collaborationModel)throw new TypeError(Sv);return EU(t)}function Cp(e,t){let n=e.part(t),r=n?eb$1(n,t):null;return r?.kind!=="paragraph"?[]:Dk(r).filter(o=>o.start<o.end)}function OU(e,t){return Cp(e,t.paragraphId).find(n=>t.offset>n.start&&t.offset<n.end)}function MU(e,t){let n=(a,i)=>{let s=OU(e,a);if(!s||i.paragraphId===a.paragraphId&&i.offset>=s.start&&i.offset<=s.end)return a;let l=e.compare(i,a)<0?s.end:s.start;return {paragraphId:a.paragraphId,offset:l}},r=n(t.anchor,t.head),o=n(t.head,t.anchor);return r===t.anchor&&o===t.head?t:{anchor:r,head:o}}function AU(e,t){if(t.length!==2)return t;let[n,r]=t;if(n?.op!=="deleteText"||r?.op!=="insertText"||r.paragraphId!==n.paragraphId||n.start>=n.end||r.offset!==n.start&&r.offset!==n.end)return t;let{start:o,end:a}=n,i=Cp(e,n.paragraphId).find(l=>l.start<=o&&a<=l.end);if(!i||o!==i.start&&a!==i.end)return t;let s=r.text.length;return [{...r,offset:o,...o===i.start?{bias:"right"}:{}},{...n,start:o+s,end:a+s}]}function _F(e,t,n){if(n.mode==="atomic")return e;let{selectForDeletion:r,wordDeletionBoundary:o,beforeSelect:a,annotate:i}=e,s=null,l=d=>s!==null&&d.anchor.paragraphId===s.anchor.paragraphId&&d.head.paragraphId===s.head.paragraphId&&d.anchor.offset===s.anchor.offset&&d.head.offset===s.head.offset;n.selectsWholeFieldWhen(()=>l(t.selection()));let c=d=>{let{anchor:u,head:f}=t.selection();if(!(u.paragraphId!==f.paragraphId||u.offset!==f.offset))return Cp(t,f.paragraphId).find(p=>d===-1?p.end===f.offset:p.start===f.offset)};return Object.assign(e,{annotate:n.wrap(d=>i.call(e,l(t.selection())?d:AU(t,d))),selectForDeletion:n.wrap(d=>{let u=t.writable()?c(d==="backward"?-1:1):void 0;if(!u)return r.call(e,d);let{paragraphId:f}=t.selection().head;return s={anchor:{paragraphId:f,offset:u.start},head:{paragraphId:f,offset:u.end}},t.select(s),true}),wordDeletionBoundary:n.wrap((d,u,f,p)=>{let g=o.call(e,d,u,f,p),y=Cp(t,t.selection().head.paragraphId),h=y.find(v=>f===-1?v.end===u:v.start===u);if(h)return f===-1?h.start:h.end;let b=g;for(let v of y)for(let S of [v.start,v.end])f===-1&&S<u&&S>b&&(b=S),f===1&&S>u&&S<b&&(b=S);return b}),beforeSelect:n.wrap(d=>(l(d)||(s=null),a.call(e,MU(t,d))))})}function BF(e,t){let n,r=()=>{n!==void 0&&(n=void 0,t());};return ()=>{let o=e.ownerDocument?.defaultView??null;n!==void 0&&n===o||(n=o,o&&typeof o.requestAnimationFrame=="function"?o.requestAnimationFrame(r):queueMicrotask(r));}}var $F=Of$1;function WF(e){let{session:t,...n}=e;return ag({view:t,...n})}function _t(e){return e.closest(".docx-editor__scroll-container")}function qF(e){return Number.isFinite(e.scrollWidth)?Math.max(0,e.scrollWidth-e.clientWidth):Number.POSITIVE_INFINITY}function KF(e){return Ae(e).getComputedStyle(e).direction==="rtl"}function Ps(e){let t=qF(e);return KF(e)&&Number.isFinite(t)?e.scrollLeft+t:e.scrollLeft}function Rs(e,t){let n=qF(e),r=Math.min(Math.max(0,t),n);e.scrollLeft=KF(e)&&Number.isFinite(n)?r-n:r;}function UF(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.width!==0||r.width!==0}function jF(e,t,n){let r=t.clientWidth/2;return UF(e,t)?(t.getBoundingClientRect().left+t.clientLeft+r-e.getBoundingClientRect().left)/n:(Ps(t)-e.offsetLeft+r)/n}function VF(e,t,n,r){let o=t.clientWidth/2;if(!UF(e,t)){Rs(t,n*r+e.offsetLeft-o);return}let a=t.getBoundingClientRect().left+t.clientLeft,i=e.getBoundingClientRect().left+n*r-(a+o);Rs(t,Ps(t)+i);}function GF(e){let t=_t(e);t&&(t.scrollTop=0,t.scrollLeft=0);}function zF(e,t,n){let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();return {top:(t.scrollTop!==0&&r.top===0&&o.top===0?t.scrollTop-e.offsetTop:o.top+t.clientTop-r.top)/n,height:t.clientHeight/n}}function ZF(e,t,n){let r=_t(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=zF(e,r,n),a=o.top+o.height/2;for(let i of t.pages)if(a<i.box.y+i.box.height)return i.index+1;return t.pages.length}function XF(e,t,n,r){let o=_t(e);if(!o||o.clientHeight===0)return;let a=zF(e,o,r),i=[];for(let s of [n.anchor,n.head]){let l=df$1(t,s);l&&i.push(l.pageIndex);}return da$1({layout:t,viewport:a,overscanPages:1,pinnedPages:i})}function wv(e,t){if(e===t)return true;if(!e||!t||e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function Tp(e,t){let n=e.pages[e.pages.length-1],r=n?n.box.y+n.box.height:0,o=t?e.pages.filter(s=>t.has(s.index)):e.pages,a=0;for(let s of o)a=Math.max(a,s.box.x+s.box.width);let i=new Map;if(new Set(o.map(s=>s.box.width)).size>1)for(let s of e.pages)i.set(s.index,(a-s.box.width)/2-s.box.x);return {width:a,height:r,pageOffsetX:i}}function YF(e,t){if(e.width!==t.width||e.height!==t.height||e.pageOffsetX.size!==t.pageOffsetX.size)return false;for(let[n,r]of e.pageOffsetX)if(t.pageOffsetX.get(n)!==r)return false;return true}function QF(e,t,n,r){for(let o of t.pages){let a=e.children.item(o.index);if(a?.dataset.pageIndex!==String(o.index))continue;let i=n.pageOffsetX.get(o.index)??0;a.style.left=`${(o.box.x+i)*r}px`;}}function JF(e){let{pagesLayer:t,listeners:n}=e,r=n.onDocument("selectionchange",e.onSelectionChange),o=BF(t,e.rematerialize),a=n.onDocument("scroll",p=>{let g=_t(e.container());!g||p.target!==g||o();},{capture:true,passive:true}),i=n.onWindow("resize",o,{passive:true}),s=null,l=null,c=null,d=false;function u(){s?.disconnect(),s=null,l=null,c=null;}function f(){if(d)return;let p=Ae(t);if(p!==l&&(u(),l=p,s=typeof p.ResizeObserver=="function"?new p.ResizeObserver(o):null),!s)return;let g=_t(e.container());g!==c&&(s.disconnect(),c=g,g&&s.observe(g));}return f(),{schedule:o,watchScrollerSize:f,rebind(){d=false,f(),o();},suspend(){d=true,u();},destroy(){r(),a(),i(),u();}}}function eD(e){let t=new Set,n=false;function r(s){return s==="document"?Ua(e()):Ae(e())}function o(s){s.bound?.removeEventListener(s.type,s.listener,s.options),s.bound=null;}function a(s){let l=r(s.target);s.bound!==l&&(o(s),l.addEventListener(s.type,s.listener,s.options),s.bound=l);}function i(s,l,c,d){let u={target:s,type:l,listener:c,options:d,bound:null};return t.add(u),n||a(u),()=>{o(u),t.delete(u);}}return {onDocument(s,l,c){return i("document",s,l,c)},onWindow(s,l,c){return i("window",s,l,c)},rebind(){n=false;for(let s of t)a(s);},suspend(){n=true;for(let s of t)o(s);},clear(){for(let s of t)o(s);t.clear();},stale(){if(n)return false;for(let s of t)if(s.bound!==r(s.target))return true;return false}}}var LU=["docx-paginated-surface--viewing","docx-paginated-surface--hf-editing"],FU=["data-docx-layout-pending","data-docx-opening-preview"];function DU(e,t){if(e===t)return;t.style.position="relative";let n=Array.from(e.childNodes);t.replaceChildren();for(let r of n)t.appendChild(r);for(let r of LU)e.classList.contains(r)&&(e.classList.remove(r),t.classList.add(r));for(let r of FU){let o=e.getAttribute(r);o!==null&&(e.removeAttribute(r),t.setAttribute(r,o));}e.style.removeProperty("position"),e.style.removeProperty("width"),e.style.removeProperty("height");}var tD=["focusin","pointerdown","pointerenter","wheel"],NU=5,HU=2e3;function _U(e){return Ft(e)?e.localName==="input"||e.localName==="textarea"||e.localName==="select"||zr(e)&&e.isContentEditable:false}function nD(e){let t=null,n=null,r=false,o=Number.NEGATIVE_INFINITY,a=f=>{let p=f.relatedTarget;Ro(p)&&e.pagesLayer.contains(p)||(o=_U(p)?Number.NEGATIVE_INFINITY:Date.now());};e.pagesLayer.addEventListener("focusout",a);let i=rt(()=>e.pagesLayer);function s(f){if(t!==null)return;let p=_t(f),g=e.scale();n=p?{x:(Ps(p)-f.offsetLeft)/g,y:(p.scrollTop-f.offsetTop)/g}:null;let y=e.pagesLayer.ownerDocument.activeElement;r=!!y&&e.pagesLayer.contains(y)||Date.now()-o<HU;}function l(){let f=n;if(n=null,!f)return;let p=()=>{let h=e.container(),b=_t(h);if(!b)return false;let v=e.scale();return b.scrollTop=Math.max(0,f.y*v+h.offsetTop),Rs(b,f.x*v+h.offsetLeft),true};p();let g=0,y=()=>{t!==null||p()||++g>NU||i.requestAnimationFrame(y);};queueMicrotask(y);}function c(f){s(e.container()),e.settle(),e.listeners.suspend(),e.viewport()?.suspend(),DU(e.container(),f),e.setContainer(f);}let d=false;function u(){if(!(d||t!==null||e.destroyed()||!e.listeners.stale())){d=true;try{e.listeners.rebind(),e.viewport()?.rebind(),e.settle(),e.onHostMoved?.(e.pagesLayer.ownerDocument);}finally{d=false;}}}for(let f of tD)e.pagesLayer.addEventListener(f,u,{capture:true,passive:true});return {moveTo(f,p){if(!e.destroyed()){if(f===e.container()&&t===null)return u();c(f),t=null,e.listeners.rebind(),e.viewport()?.rebind(),(p?.focus??r)&&e.pagesLayer.focus({preventScroll:true}),e.repaint(),l();}},park(){if(e.destroyed()||t!==null)return;let f=e.pagesLayer.ownerDocument.createElement("div");c(f),t=f;},parked:()=>t!==null,heal:u,destroy(){for(let f of tD)e.pagesLayer.removeEventListener(f,u,{capture:true});e.pagesLayer.removeEventListener("focusout",a);}}}function kv(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function rD(e){let t=null;return {get(){let n=e.layout(),r=e.items(),o=e.styles(),a=t;if(a?.layout===n&&a.items===r&&a.styles===o)return a;let i=e.slots.resolve(h$1(n),(function*(){for(let f of r){let p=kv(f);p!==null&&(yield p);}})()),s=a?.value,l=s!==void 0&&s.size===i.size&&[...i].every(([u,f])=>s.get(u)===f),c=l?s:i,d=a!==null&&l&&a.styles===o?a.resolved:new Map(g$1(c,o).map(u=>[u.author,u]));return t={layout:n,items:r,styles:o,value:c,resolved:d},t},releaseLayout(){t!==null&&(t={...t,layout:null,items:null});}}}function oD(e){let t=null;return {forAuthor(n){let r=e.roster(),o=r.resolved.get(n);if(o)return a$5(o.color)??e$2(o.slot);let a=e.slots.resolve(r.value,[n]).get(n);return a===void 0?void 0:e$2(a)},declaredFor(n){let r=e.styles();return (t===null||t.styles!==r)&&(t={styles:r,resolved:f$1(r)}),a$5(t.resolved.get(n)?.color)}}}function ua(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function iD(e,t,n){let r=t(e.anchor.paragraphId),o=t(e.head.paragraphId);return !r||!o?null:{anchor:{paragraphId:r.paragraphId,offset:Math.max(0,e.anchor.offset)},head:{paragraphId:o.paragraphId,offset:Math.max(0,e.head.offset)},...n?{kind:n}:{}}}function sD(e,t){let n=eb$1(e,t);if(!n||n.kind==="textValue")return null;let r=wb$1(n);return !r||!vb$1(r)?null:{paragraphId:r.toUpperCase(),nodeId:t,text:""}}var Iv=new WeakMap;function BU(e,t,n){return e.map(r=>a$5(n?.(r.name))??a$5(r.color)??a$5(t?.(r.name)))}function $U(e,t){let n="";for(let[r,o]of e.entries())n+=`${o.actorId} ${o.name} ${t[r]??""} ${o.kind??""} `,n+=`${o.anchor.nodeId}:${o.anchor.offset} `,n+=`${o.head.nodeId}:${o.head.offset}
26
+ `;return n}function WU(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function qU(e){if(!e||e.size===0)return "";let t=[];for(let[n,r]of e)t.push(`${n}:${r}`);return t.sort(),t.join(",")}function KU(e,t,n){return e.layout===n.layout&&e.fingerprint===n.fingerprint&&e.pagesKey===n.pagesKey&&e.scale===n.scale&&e.offsetKey===n.offsetKey&&e.labelHost===n.labelHost&&e.childCount===t.childElementCount}function aD(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function UU(e,t){let n=pa$1(e,t.anchor.nodeId),r=pa$1(e,t.head.nodeId);if(!n||!r)return [];let o=fa$1(e,n,r);return o?la$1(e,o.cellIds).map(a=>({...a,className:"docx-remote-selection-rect"})):[]}function lD(e,t,n,r){t=fi(t);let{scale:o,pageOffsetX:a,pages:i,colorForAuthor:s,declaredColorFor:l}=r,c=r.labelHost??null,d=BU(n,s,l),u={layout:t,fingerprint:$U(n,d),pagesKey:WU(i),scale:o,offsetKey:qU(a),labelHost:c},f=Iv.get(e);if(f&&KU(f,e,u))return;Iv.delete(e);let p=[],g=[],y=[],h=[];for(let[x,k]of n.entries())k.kind==="cells"||aD(k)||h.push({key:String(x),from:{paragraphId:k.anchor.nodeId,offset:k.anchor.offset},to:{paragraphId:k.head.nodeId,offset:k.head.offset}});let b=h.length>0?rf$1(t,h,fb$2(t),i,r.measurer):null;for(let[x,k]of n.entries()){let T=d[x],R=df$1(t,{paragraphId:k.head.nodeId,offset:k.head.offset},r.measurer);if(R){let A=qf$1(t,k.head.nodeId,R.pageIndex);y.push({selection:k,...T?{color:T}:{},pageIndex:R.pageIndex,x:R.x+A.x,y:R.y+A.y});}if(k.kind==="cells"){let A=UU(t,k);if(A.length>0){for(let E of A)p.push(E),g.push(T);continue}}if(aD(k)){let A=df$1(t,{paragraphId:k.anchor.nodeId,offset:k.anchor.offset},r.measurer);if(!A)continue;let E=qf$1(t,k.anchor.nodeId,A.pageIndex);p.push({pageIndex:A.pageIndex,x:A.x+E.x,y:A.y+E.y,width:Math.max(1/o,1),height:A.height,className:"docx-remote-caret"}),g.push(T);continue}let C=b?.get(String(x));if(C)for(let A of C)p.push({...A,className:"docx-remote-selection-rect"}),g.push(T);}w$1(e,t,p,{scale:o,pageOffsetX:a}),[...e.children].forEach((x,k)=>{let T=a$5(g[k]);!T||!zr(x)||x.style.setProperty("--doc-remote-color",T);});let v=e.ownerDocument,S=[];for(let x of y){let k=t.pages[x.pageIndex];if(!k)continue;let T=v.createElement("div");T.className="docx-remote-caret-label",c?(T.setAttribute("data-docx-remote-actor",x.selection.actorId),S.push({element:T,selection:x.selection})):T.textContent=x.selection.name,T.style.left=`${(k.contentBox.x+x.x+(a?.get(x.pageIndex)??0))*o}px`,T.style.top=`${(k.contentBox.y+x.y)*o}px`;let R=a$5(x.color);R&&T.style.setProperty("--doc-remote-color",R),e.append(T);}Iv.set(e,{...u,childCount:e.childElementCount}),c&&c.publish(S);}function Ep(e,t,n){if(n<e+40){let r=Math.max(0,e+40-n);return -Math.min(12,r/40*12)}if(n>t-40){let r=Math.max(0,n-(t-40));return Math.min(12,r/40*12)}return 0}function cD(e){let t=null,n=0,r=a=>{let i=a.getBoundingClientRect();return Ep(i.top,i.bottom,n)},o=()=>{t=null;let a=e.scroller(),i=a?r(a):0;!a||i===0||(a.scrollTop+=i,e.onScroll(),t=e.frames.requestAnimationFrame(o));};return {follow(a){n=a;let i=e.scroller();t===null&&i&&r(i)!==0&&(t=e.frames.requestAnimationFrame(o));},stop(){t!==null&&e.frames.cancelAnimationFrame(t),t=null;}}}function dD(e,t,n){let r=Xh$1(t,n);if(!r)return [];let o=r.children.filter(c=>c.kind==="paragraph"||c.kind==="table"),a=o.findIndex(c=>c.id===n),i=new Map(o.map((c,d)=>[c.id,d===a||d===a+1])),s=[],l=(c,d,u)=>{for(let f of c){let p=f.kind==="paragraph"?f.paragraphId:f.tableId,g=i.get(p);if(f.fragmentIndex===0&&g!==void 0){let{x:y,y:h,width:b}=f.box;s.push({beforeBlockId:p,stays:g,pageIndex:d,x:y,y:h,width:b,origin:u});}if(f.kind==="table")for(let y of f.rows)for(let h of y.cells)l(h.blocks,d,u);}};return e.pages.forEach((c,d)=>{l(c.fragments,d,c.contentBox);for(let u of [c.header,c.footer])u&&l(u.fragments,d,u.box);}),s}function uD(e,t,n,r){let o=l=>l.origin.x+l.x+r(l.pageIndex),a=l=>{let c=Math.abs(l.origin.y+l.y-n),d=o(l);if(t>=d&&t<=d+l.width)return [0,c];let u=Math.min(Math.abs(t-d),Math.abs(t-d-l.width));return [1,Math.hypot(u,c)]},i=null,s=[2,0];for(let l of e){let[c,d]=a(l);(c<s[0]||c===s[0]&&d<s[1])&&(i=l,s=[c,d]);}return i}var jU=4;function fD(e,t){return {ok:true,ops:[{op:"moveTable",tableId:e,beforeBlockId:t}],selection:{kind:"preserveSelection"}}}function pD(e){let t=null,n=null,r=e.layer.ownerDocument.createElement("div");r.className="docx-table-drop-indicator",r.style.position="absolute",r.style.pointerEvents="none";let o=cD({scroller:()=>e.pagesLayer.closest(".docx-editor__scroll-container"),frames:e.frames,onScroll:()=>a()});function a(){if(!t?.slots)return;let u=e.pagesLayer.getBoundingClientRect(),f=e.scale();t.slot=uD(t.slots,(t.lastX-u.left)/f,(t.lastY-u.top)/f,e.pageOffsetX);let p=t.slot;if(!p||p.stays){r.remove();return}let g=p.origin.x+p.x+e.pageOffsetX(p.pageIndex);r.style.left=`${g*f}px`,r.style.top=`${(p.origin.y+p.y)*f-1}px`,r.style.width=`${p.width*f}px`,r.parentNode!==e.layer&&e.layer.append(r);}function i(u){if(!(!t||u.pointerId!==t.pointerId)){if(t.lastX=u.clientX,t.lastY=u.clientY,!t.slots){if(Math.hypot(u.clientX-t.startX,u.clientY-t.startY)<jU)return;t.slots=t.mode==="move"?dD(e.layout(),e.partOf(t.tableId),t.tableId):[],t.handle.dataset.dragging="true";}a(),o.follow(u.clientY);}}function s(u){if(!t||u.pointerId!==t.pointerId)return;let{tableId:f,slot:p,slots:g,mode:y}=t;d(),p&&!p.stays?e.applyTableCommandPlan(fD(f,p.beforeBlockId)):y==="refuse"&&g&&e.applyTableCommandPlan(fD(f,f));}function l(u){t&&u.pointerId===t.pointerId&&d();}function c(u){u.key!=="Escape"||!t?.slots||(u.preventDefault(),d());}function d(){if(o.stop(),r.remove(),n?.(),n=null,!t)return;let{handle:u,pointerId:f}=t;delete u.dataset.dragging,u.hasPointerCapture?.(f)&&u.releasePointerCapture(f),u.removeEventListener("pointermove",i),u.removeEventListener("pointerup",s),u.removeEventListener("pointercancel",l),t=null;}return {press(u,f,p,g){u.button===0&&(d(),t={pointerId:u.pointerId,startX:u.clientX,startY:u.clientY,tableId:f,handle:p,mode:g,lastX:u.clientX,lastY:u.clientY,slots:null,slot:null},p.setPointerCapture?.(u.pointerId),p.addEventListener("pointermove",i),p.addEventListener("pointerup",s),p.addEventListener("pointercancel",l),n=e.listeners.onDocument("keydown",c));},dragging:()=>(t?.slots??null)!==null,cancel:d,destroy:d}}function Lo(e,t){return ce(e,t)??e.part()}function Rv(e,t,n){return !t||t.kind==="tableBody"?null:uf(e,t.tableId,n)?t:null}function Nc(e,t,n){let r=i=>{for(let s of i)if(s.kind==="table"){if(s.tableId===t)return s;for(let l of s.rows)for(let c of l.cells){let d=r(c.blocks);if(d)return d}}return null},o=e.pages[n];if(!o)return null;let a=r(o.fragments);if(a)return {table:a,origin:o.contentBox};for(let i of [o.header,o.footer]){if(!i)continue;let s=r(i.fragments);if(s)return {table:s,origin:i.box}}return null}var VU=120,GU=16,zU=2;function hD(e,t){return e.tableId===t?true:e.rows.some(n=>n.cells.some(r=>r.blocks.some(o=>o.kind==="table"&&hD(o,t))))}function mD(e,t,n){let r=e.pages[n];if(!r)return null;let o=i=>i.find(s=>s.kind==="table"&&hD(s,t))??null,a=o(r.fragments);if(a)return {table:a,origin:r.contentBox};for(let i of [r.header,r.footer]){let s=i?o(i.fragments):null;if(s&&i)return {table:s,origin:i.box}}return null}var gD="http://www.w3.org/2000/svg";function ZU(e){let t=e.createElementNS(gD,"svg");t.setAttribute("viewBox","0 -960 960 960"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");for(let n of pb("open_with")){let r=e.createElementNS(gD,"path");r.setAttribute("d",n),t.append(r);}return t}function yD(e){let{layer:t}=e,n=rt(()=>t),r=null,o=null,a=null,i=false,s=pD({pagesLayer:e.pagesLayer,layer:t,listeners:e.listeners,frames:n,scale:()=>e.scale(),pageOffsetX:y=>e.pageOffsetX(y),layout:()=>e.read().layout,partOf:y=>Lo(e.session(),y),applyTableCommandPlan:y=>e.applyTableCommandPlan(y)}),l=t.ownerDocument.createElement("button");l.type="button",l.className="docx-table-select-handle",l.append(ZU(t.ownerDocument)),l.style.position="absolute",l.style.pointerEvents="auto";let c=y=>{y.preventDefault(),y.stopPropagation();};l.addEventListener("pointerdown",y=>{c(y);let h=e.read().editingMode;!a||i||h==="view"||(d(),s.press(y,a,l,h==="suggest"?"refuse":"move"));}),l.addEventListener("mousedown",c),l.addEventListener("click",y=>{c(y);let h=a?ga$1(e.read().layout,a):null;h&&(e.setCellSelection(h),e.pagesLayer.focus({preventScroll:true}));}),l.addEventListener("pointerenter",()=>d());function d(){o!==null&&(n.clearTimeout(o),o=null);}function u(y,h){let b=na$1(y,h.head.paragraphId)?.tableId,v=b===void 0?void 0:df$1(y,h.head)?.pageIndex;return b===void 0||v===void 0?null:{tableId:b,pageIndex:v}}function f(){let{layout:y,selection:h,editingMode:b}=e.read(),v=h.head.paragraphId,S=r?mD(y,r.tableId,r.pageIndex):null;r&&!S&&(r=null,d());let x=b!=="view"&&r!==null&&S!==null&&uf(e.session(),r.tableId,v),k=b==="view"?null:x?r:u(y,h),T=k?x?S:mD(y,k.tableId,k.pageIndex):null;if(!k||!T){a=null,s.dragging()&&s.cancel(),l.remove();return}let{table:R,origin:C}=T,A=e.scale(),E=e.pageOffsetX(k.pageIndex);a=R.tableId,i=R.floatingWrap!==void 0,l.dataset.tableId=R.tableId,l.dataset.draggable=String(!i&&b==="edit"),l.setAttribute("aria-label",e.label("table.selectTable")),l.title=e.label("table.selectTable");let P=GU+zU;l.style.left=`${(C.x+R.box.x+E)*A-P}px`,l.style.top=`${(C.y+R.box.y)*A-P}px`,l.parentNode!==t&&t.append(l);}function p(y){if(l.contains(y.target)||s.dragging())return;let{layout:b}=e.read(),v=e.pagesLayer.getBoundingClientRect(),S=e.scale(),x=(y.clientX-v.left)/S,k=(y.clientY-v.top)/S,T=Je(b,k),R=T>=0?Wf$1(Sf$2(b),x,k,b,e.pageOffsetX(T),T):null;if(R){if(d(),r?.tableId===R.tableId&&r.pageIndex===R.pageIndex)return;r={tableId:R.tableId,pageIndex:R.pageIndex},f();return}!r||o!==null||(n.migrate(),o=n.setTimeout(()=>{o=null,r=null,f();},VU));}let g=e.listeners.onDocument("pointermove",p);return {update:f,destroy(){d(),s.destroy(),g(),t.remove();}}}function XU(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var kD=/^[^\s]{1,512}$/,Pv=/["\\\u0000-\u001f\u007f]/;function ID(e,t){return !e||t===void 0||!/^\d{1,9}$/.test(t)||!kD.test(e)||e==="__proto__"?null:{paragraphId:e,offset:Number(t)}}function fa(e){let t=ID(e.dataset?.paragraphId,e.dataset?.start);if(!t)return null;let{paragraphId:n,offset:r}=t,o=e.dataset?.end,a=o!==void 0&&/^\d{1,9}$/.test(o)&&Number(o)>=r?Number(o):r+(e.textContent?.length??0);return {paragraphId:n,start:r,end:a}}function Cs(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return null;let t=e;return !t.classList.contains("docx-inline-drawing-advance")||t.parentElement?.dataset.paragraphId===void 0?null:ID(t.dataset.drawingParagraphId,t.dataset.drawingStart)}function YU(e,t){let n=Pv.test(t)?"[data-paragraph-id][data-start], .docx-inline-drawing-advance":`[data-paragraph-id="${t}"][data-start], .docx-inline-drawing-advance[data-drawing-paragraph-id="${t}"]`,r=[],o=[];for(let a of e.querySelectorAll(n))a.classList.contains("docx-inline-drawing-advance")?Cs(a)?.paragraphId===t&&o.push(a):r.push(a);return {spans:r,spacers:o}}function Mp(e,t,n){return Pv.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function RD(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=fa(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function PD(e){return e.querySelector("[data-docx-hf-active]")}function pi(e,t){if(!e||t&&!t.contains(e))return;let o=(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest("[data-page-index]")?.dataset?.pageIndex;if(!(o===void 0||!/^\d{1,9}$/.test(o)))return Number(o)}function QU(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function Op(e,t){let n=PD(e),r=n?.closest(".docx-page");if(n)return r&&r!==e?[n,r,e]:[n,e];let o=QU(e,t);return o&&o!==e?[o,e]:[e]}function bD(e,t){let n=l=>({paragraphId:l.paragraphId,offset:t?l.end:l.start}),r=l=>t?{...l,offset:l.offset+1}:l,o=RD(e);if(o)return n(o.identity);let a=Cs(e);if(a)return r(a);if(e.nodeType!==Node.ELEMENT_NODE)return null;let i=e.querySelectorAll("[data-paragraph-id][data-start], .docx-inline-drawing-advance"),s=t?[...i].reverse():[...i];for(let l of s){let c=Cs(l);if(c)return r(c);let d=fa(l);if(d)return n(d)}return null}function vD(e,t,n=false){let r=[...e.childNodes];if(r.length===0)return null;let o=Cs(r[t-1]);if(o)return {paragraphId:o.paragraphId,offset:o.offset+1};for(let a=Math.max(0,t);!n&&a<r.length;a+=1){let i=bD(r[a],false);if(i)return i}for(let a=Math.min(t,r.length)-1;a>=0;a-=1){let i=bD(r[a],true);if(i)return i}return null}function xD(e,t,n){if(!n.contains(e))return null;let r=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(r?.closest("[data-docx-field]"))return null;let o=r?.closest("[data-docx-hf]");if(o&&!o.hasAttribute("data-docx-hf-active")||PD(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]"),i=Cs(a??void 0);if(i)return t>0?{...i,offset:i.offset+1}:i;let s=r?.closest(".docx-terminator-seat");if(s?.querySelector(".docx-line-break-mark")&&s.parentElement){let d=s.parentElement,u=[...d.querySelectorAll(".layout-run[data-start]")].filter(g=>g.closest(".docx-line")===d).flatMap(g=>{let y=fa(g);return y?[{run:g,identity:y}]:[]}),f=u.at(-1)?.identity.paragraphId,p;for(let g of u)g.identity.paragraphId===f&&(!p||g.identity.start>p.identity.start)&&(p=g);if(p){let g=p.run.textContent===`
27
+ `,{start:y,end:h}=p.identity;return {paragraphId:p.identity.paragraphId,offset:g?y:h}}}let l=s??(a?.classList.contains("docx-wrap-advance")?a:null);if(l?.parentElement){let d=[...l.parentElement.childNodes],u=d.indexOf(l);if(s){let g="[data-start], a, br, .docx-inline-drawing-advance, .docx-wrap-advance";for(;u>0&&!d[u-1].matches?.(g);)u-=1;}let f=!s&&t>0?1:0,p=vD(l.parentElement,u+f,!!s);if(p)return p}if(a)return a.parentElement?CD(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let d=e,u=fa(d);if(u)return {paragraphId:u.paragraphId,offset:t>0?u.end:u.start};let f=vD(d,t);return f||nj(d)}let c=RD(e);return c?{paragraphId:c.identity.paragraphId,offset:XU(c.identity,t)}:null}function Ts(e,t){if(!t||t.rangeCount===0)return null;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:a}=t;if(!n||!o)return null;let i=xD(n,r,e),s=xD(o,a,e);if(!i||!s){let l=i??s;return l?{anchor:l,head:l}:null}return {anchor:i,head:s}}function Cv(e,t){if(!t||t.rangeCount===0)return false;let{anchorNode:n,focusNode:r}=t;return !!n&&e.contains(n)||!!r&&e.contains(r)}function SD(e,t,n,r){if(r!==void 0)for(let o of Op(e,n)){let a=Pv.test(r)?"[data-line-id]":`[data-line-id="${r}"]`;for(let i of o.querySelectorAll(a)){if(i.dataset.lineId!==r)continue;let s=wD(i,t);if(s)return s}}for(let o of Op(e,n)){let a=wD(o,t);if(a)return a}return null}function JU(e,t){let n=null;for(let r of e){if(!r.hasAttribute("data-docx-field")||!r.parentNode)continue;let o=fa(r);if(o?.paragraphId===t.paragraphId){if(o.start===t.offset)return {node:r.parentNode,offset:[...r.parentNode.childNodes].indexOf(r)};o.end===t.offset&&(n=r);}}if(n){let r=fa(n);for(let o of e){let a=fa(o);a?.paragraphId===t.paragraphId&&a.start===r.start&&a.end===r.end&&(n=o);}}return n?.parentNode?{node:n.parentNode,offset:[...n.parentNode.childNodes].indexOf(n)+1}:null}function wD(e,t){let{spans:n,spacers:r}=YU(e,t.paragraphId),o=JU(n,t);if(o)return o;let a=null,i=false;for(let p of n){let g=fa(p);if(!g||g.paragraphId!==t.paragraphId)continue;let y=ej(p),h=p.textContent?.length??0,b=g.end;if(y){if(p.closest?.("[data-docx-field]")){i=true;continue}if(i=true,t.offset>=g.start&&t.offset<=b){let v={node:y,offset:Math.min(t.offset-g.start,h)};if(t.offset<b)return v;a=v;}}}let s=p=>r.find(g=>Cs(g)?.offset===p)??null,l=s(t.offset);if(a&&l?.parentNode&&!l.parentNode.contains(a.node))return {node:l.parentNode,offset:[...l.parentNode.childNodes].indexOf(l)};if(a)return a;let c=l,d=c?null:s(t.offset-1),u=c??d;if(u?.parentNode)return {node:u.parentNode,offset:[...u.parentNode.childNodes].indexOf(u)+(d?1:0)};if(i||=r.length>0,i)return null;let f=tj(e,t.paragraphId);return f?{node:f,offset:0}:null}function ej(e){let t=e.firstChild;for(;t&&t.nodeType===Node.ELEMENT_NODE;)t=t.firstChild;return t&&t.nodeType===Node.TEXT_NODE?t:null}function tj(e,t){let n=null;for(let r of Mp(e,t,""))if(r.dataset?.paragraphId===t&&r.dataset?.start===void 0){if(r.dataset?.lineId!==void 0)return r;n??=r;}return n}function CD(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!kD.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function nj(e){let t=CD(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function TD(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??pi(n.anchorNode,e),i=Nt(t,{anchor:t.head,head:t.head})?r?.preferredLineId:void 0,s=SD(e,t.anchor,o,i),l=SD(e,t.head,o,i);if(!s||!l)return false;let c=Ts(e,n);if(c&&Nt(c,t)){let d=pi(n.anchorNode,e),f=(n.focusNode?.nodeType===Node.ELEMENT_NODE?n.focusNode:n.focusNode?.parentElement)?.closest("[data-line-id]")?.dataset.lineId;if((o===void 0||d===o)&&(i===void 0||f===i))return true}try{return n.setBaseAndExtent(s.node,s.offset,l.node,l.offset),!0}catch{return false}}function Nt(e,t){return e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}var rj='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function ED(e,t,n){let r=e.dataset.end;if(r===void 0||!/^\d{1,9}$/.test(r))return n;let o=Number(r);return o>=t?o:n}function OD(e,t){if(e.dataset.paragraphId!==t)return null;let n=e.dataset.start;return n===void 0||!/^\d{1,9}$/.test(n)?null:Number(n)}function oj(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function aj(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function MD(e,t,n,r){if(e.dataset.docxField!==void 0){let a=ED(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:ED(e,t,t+o.length),text:o,seq:r}}function AD(e,t){for(let n of e.childNodes){if(n.nodeType===Node.TEXT_NODE){let s=n.textContent??"";s.length>0&&(t.pieces.push({start:t.end,end:t.end,text:s,seq:t.seq}),t.seq+=1);continue}if(n.nodeType!==Node.ELEMENT_NODE)continue;let r=n,o=OD(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0)continue;let s=r.dataset?.drawingStart;if(r.dataset?.drawingParagraphId===t.paragraphId&&s!==void 0&&/^\d{1,9}$/.test(s)){t.end=Math.max(t.end,Number(s)+1);continue}if(r.matches?.(rj))continue;AD(r,t);continue}let a=MD(r,o,t.modelText,t.seq);t.seq+=1,t.end=Math.max(t.end,a.end);let i=`${a.start}:${a.end}`;t.ranges.has(i)||(t.ranges.add(i),t.pieces.push(a));}}function ij(e,t,n,r){let o=[];for(let i of Mp(e,t,"")){let s=i;s.dataset.paragraphId===t&&s.dataset.start===void 0&&(o.some(l=>l.contains(s))||o.push(s));}let a=new Map;for(let i of o){let s=i.dataset.fragmentIndex??"",l=aj(i,n,r),c=a.get(s);(!c||l>c.affinity)&&a.set(s,{element:i,affinity:l});}return [...a.values()].map(i=>i.element)}function sj(e,t,n){for(let r of Mp(e,n.paragraphId,"[data-start]")){let o=r,a=OD(o,n.paragraphId);if(a===null||t.some(l=>l.contains(o)))continue;let i=MD(o,a,n.modelText,n.seq);n.seq+=1;let s=`${i.start}:${i.end}`;n.ranges.has(s)||(n.ranges.add(s),n.pieces.push(i));}}function lj(e,t){let n=[...e].sort((a,i)=>a.start-i.start||a.seq-i.seq),r="",o=0;for(let a of n)a.start>o&&(r+=t.slice(o,a.start)),r+=a.text,o=Math.max(o,a.end);return o<t.length&&(r+=t.slice(o)),r}function LD(e,t,n,r){let o=ij(e,t,r,oj(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let i of o)AD(i,a);return sj(e,o,a),a.pieces.length===0?null:lj(a.pieces,n)}function Tv(e){if(!(e.metaKey||e.ctrlKey))return null;let t=e.key.toLowerCase();return t==="y"?"redo":t==="z"?e.shiftKey?"redo":"undo":null}function DD(e){return e.altKey||e.ctrlKey}function ND(e){return pa$1(e.layout(),e.state().selection.head.paragraphId)!==null}function HD(e,t){let{selection:n,cellSelection:r}=e.state(),o=qa$1(e.layout(),n.head.paragraphId,t);if(o===null)return false;let a=r&&r.cellIds.length>1&&r.cellIds[0];return a?(FD(e,ja$1(e.layout(),[a])),true):o==="end"?(t==="next"&&cj(e),true):(FD(e,o.paragraphIds),true)}function FD(e,t){let n=t[0],r=t.at(-1);if(n===void 0||r===void 0)return;let o=eb$1(ce(e.session,r)??e.session.part(),r),a=o?.kind==="paragraph"?Ki(o):0;e.setSelection({anchor:{paragraphId:n,offset:0},head:{paragraphId:r,offset:a}});}function cj(e){let t=e.state(),n=Rr({command:{type:"insertRow",where:"below"},part:ce(e.session,t.selection.head.paragraphId)??e.session.part(),layout:e.layout(),storeRevision:e.session.packageRevision(),selection:t.selection,cellSelection:t.cellSelection,themeColors:e.session.documentThemeColors(),editable:e.session.editable,viewing:e.editingMode()==="view"});if(!e.applyTableCommandPlan(n).ok)return;let r=qa$1(e.layout(),t.selection.head.paragraphId,"next"),o=typeof r=="object"?r?.paragraphIds[0]:void 0;o!==void 0&&e.setSelection({anchor:{paragraphId:o,offset:0},head:{paragraphId:o,offset:0}});}var qD={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"};function dj(e){return qD[e.key]||e.key==="PageUp"||e.key==="PageDown"?e.shiftKey:(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="a"}var _D={l:"left",e:"center",r:"right",j:"both"},BD={1:"240",5:"360",2:"480"},$D={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function uj(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}function KD(e,t={}){return n=>{if(n.defaultPrevented)return;let r=e.editingMode()==="view"||n.currentTarget?.contentEditable==="false";if(n.key==="F5"&&n.shiftKey&&(n.ctrlKey||n.metaKey)&&!n.altKey&&!n.isComposing&&t.onRequestBookmark?.()){n.preventDefault();return}if(Db(n)&&t.onRequestGoTo?.()){n.preventDefault();return}if(n.key==="F9"&&n.altKey&&!n.ctrlKey&&!n.metaKey&&!n.shiftKey&&!n.isComposing&&t.onToggleFieldCodes){n.preventDefault(),t.onToggleFieldCodes();return}if(!n.altKey&&!n.isComposing&&(n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.key==="8"||n.ctrlKey&&!n.metaKey&&n.shiftKey&&(n.code==="Digit8"||n.key==="*"))&&t.onToggleParagraphMarks){n.preventDefault(),t.onToggleParagraphMarks();return}if(r&&!dj(n))return;if(n.key==="Escape"&&e.formatPainter.state().mode!=="off"){e.formatPainter.disarm(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="headerFooter"){e.exitHeaderFooter(),n.preventDefault();return}if(n.key==="Escape"&&e.activeScope().kind==="note"){e.exitNote(),n.preventDefault();return}let o=Xf(n);if(uj(n,o)&&!n.shiftKey){let l=o;if(l==="f"){n.preventDefault(),e.insertNote("footnote");return}if(l==="d"){n.preventDefault(),e.insertNote("endnote");return}if(l==="c"){n.preventDefault(),e.formatPainter.capture();return}if(l==="v"){n.preventDefault(),e.formatPainter.apply();return}}let a=n.metaKey||n.ctrlKey,i=qD[n.key];if(i){let l=i;n.key==="Home"||n.key==="End"?a&&(l=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?l=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?l=n.key==="ArrowLeft"?"lineStart":"lineEnd":a&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(l=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(l,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(a?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){a||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){a||n.altKey?e.deleteWordForward():e.deleteForward(),n.preventDefault();return}if(n.key==="Tab"){if(e.contentControls.formFill()&&e.contentControls.navigate(n.shiftKey?"previous":"next")){n.preventDefault();return}if(DD(n)&&!n.isComposing){if(ND(e)){(e.state().cellSelection?.cellIds.length??0)<=1&&e.insertTab(),n.preventDefault();return}}else if(!n.isComposing&&HD(e,n.shiftKey?"previous":"next")){n.preventDefault();return}let l=n.shiftKey?"decrease":"increase";e.isListParagraph()?e.adjustIndent(l):e.indentWithTab(l)||(n.shiftKey?e.adjustIndent("decrease"):e.insertTab()),n.preventDefault();return}if(n.key==="Enter"){a?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(a&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(a&&n.shiftKey&&n.key.toLowerCase()==="v"){e.armForcePlainPaste();return}if(a&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){if(t.onRequestHyperlink()===false)return;n.preventDefault();return}if(a&&!n.shiftKey&&$D[n.key.toLowerCase()]){let l=$D[n.key.toLowerCase()];e.toggleRunProperty(l.localName,l.attributes),n.preventDefault();return}if(a&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(a&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(a&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(a&&!n.shiftKey&&_D[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperties([{localName:"jc",attributes:{val:_D[n.key.toLowerCase()]},physicalAlignment:true}]),n.preventDefault();return}if(a&&!n.shiftKey&&BD[n.key]){e.setParagraphProperty("spacing",{line:BD[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}let s=Tv(n);s&&(s==="redo"?e.redo():e.undo(),n.preventDefault());}}function UD(e){let t=i=>{let s=e.copyFlavours();return s.reason?(i.preventDefault(),false):!s.text&&!s.chartDrawingNodeId||!i.clipboardData?false:(i.clipboardData?.setData("text/plain",s.text),s.html&&i.clipboardData?.setData("text/html",s.html),n=s.chartDrawingNodeId??null,true)},n=null;return {onCopy:i=>{t(i)&&i.preventDefault();},onCut:i=>{if(e.editingMode()==="view"){i.preventDefault();return}t(i)&&(n?e.deleteImage(n):e.deleteSelection(),i.preventDefault());},onPaste:i=>{let s=Vh(i.clipboardData),l=i.clipboardData?.getData("text/html")??"";i.preventDefault(),!(!s&&!l)&&e.pasteRich(s,l.length>0?l:null);}}}function WD(e){let t=Vh(e.dataTransfer);return t.length>0?t:null}function jD(e,t){return n=>{if(n.preventDefault(),!t.isComposing()){if(n.inputType==="insertText"&&n.data!=null){e.enqueueType(n.data);return}if(n.inputType!=="insertFromPaste"){if(n.inputType==="insertReplacementText"){let r=n.data??WD(n);if(!r)return;gj(e,pj(n),r),t.onBrowserSelectionFixup?.();return}if(n.inputType==="deleteContentBackward"){e.deleteBackward();return}if(n.inputType==="deleteWordBackward"){e.deleteWordBackward();return}if(n.inputType==="deleteContentForward"){e.deleteForward();return}if(n.inputType==="deleteWordForward"){e.deleteWordForward();return}if(n.inputType==="insertLineBreak"){e.insertLineBreak();return}if(n.inputType==="insertFromDrop"||n.inputType==="insertFromPasteAsQuotation"){let r=WD(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function fj(e){let{startContainer:t,endContainer:n}=e;if(t===n&&t.nodeType===Node.TEXT_NODE)return (t.textContent??"").slice(e.startOffset,e.endOffset);let r=t.ownerDocument;if(!r)return null;try{let o=r.createRange();return o.setStart(t,e.startOffset),o.setEnd(n,e.endOffset),o.toString()}catch{return null}}function pj(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=fj(n);return r?{text:r,paragraphId:mj(n)}:null}function mj(e){let t=e.startContainer;return t.isConnected?(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement??null)?.closest("[data-paragraph-id]")?.getAttribute("data-paragraph-id")??null:null}function gj(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,a=t.text;if(Nt(r.selection,Ne(o))&&o.offset>=a.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let i=ce(e.session,o.paragraphId)??e.session.part(),s=Nm(i,o.paragraphId);s!==null&&s.slice(o.offset-a.length,o.offset)===a&&e.setSelection({anchor:{paragraphId:o.paragraphId,offset:o.offset-a.length},head:o});}}e.type(n);}function VD(e,t,n,r=null){for(let o of Op(e)){let a=LD(o,t,n,r);if(a!==null)return a}return null}function GD(e,t,n){if(n===t)return null;let r=0;for(;r<n.length&&r<t.length&&n[r]===t[r];)r+=1;let o=0;for(;o<n.length-r&&o<t.length-r&&n[n.length-1-o]===t[t.length-1-o];)o+=1;let a=n.slice(r,n.length-o),i=[];return t.length-o>r&&i.push({op:"deleteText",paragraphId:e,start:r,end:t.length-o}),a.length>0&&i.push({op:"insertText",paragraphId:e,offset:r,text:a}),i.length===0?null:{ops:i,caret:r+a.length}}function hj(e,t){for(let n=fb$1(e,t);n;n=fb$1(e,n.id)){if(n.kind==="revisionDelete")return true;if(n.kind==="paragraph")return false}return false}function Fo(e,t,n=new Set){let r=eb$1(e,t);if(!r||r.kind!=="paragraph")return [];let o=l=>!n.has(l.id)&&qc$1(l).showingPlaceholder,a=(l,c,d,u)=>({control:l,paragraphId:t,start:c,end:d,block:u,locked:qc$1(l).lock!=="unlocked",struck:hj(e,u?r.id:l.id)}),i=sm$1(e,t).find(o);if(i)return [a(i,0,Ki(r),true)];let s=Ii(r);return sc$1(r).flatMap(l=>{let c=o(l.node)?s.spanOf(l.node):null;return c&&c.start<c.end?[a(l.node,c.start,c.end,false)]:[]})}function Ov(e,t){let{anchor:n,head:r}=t;if(n.paragraphId!==r.paragraphId)return null;let o=Math.min(n.offset,r.offset),a=Math.max(n.offset,r.offset);return o===a?null:Fo(e,r.paragraphId).find(i=>i.start===o&&i.end===a)??null}function yj(e){let t=[e],n=0;for(let r=0;t.length>0&&r<1e4;r++){let o=t.pop();if(o.kind==="paragraph"&&++n>1)return true;"children"in o&&o.kind!=="paragraph"&&t.push(...o.children);}return false}function zD(e,t,n){if(e.locked||e.struck||e.block&&(t||yj(e.control)))return null;let{paragraphId:r,start:o,end:a}=e,i={op:"deleteText",paragraphId:r,start:o,end:a};if(t)return {ops:[i],collapseTo:{paragraphId:r,offset:n==="backward"?o:a}};let s={paragraphId:r,offset:o};return e.block?{ops:[{op:"removeContentControl",controlId:e.control.id},i],collapseTo:s}:{ops:[{op:"removeContentControl",controlId:e.control.id,keepContent:false}],collapseTo:s}}function bj(e,t,n){let r=[],o=e;for(let a of [...n].sort((i,s)=>i.start-s.start))a.end<=o||a.start>=t||(a.start>o&&r.push({start:o,end:a.start}),o=Math.max(o,a.end));return o<t&&r.push({start:o,end:t}),r}function Ev(e,t){return !t.block&&e.start<=t.start&&e.end>=t.end&&(e.start<t.start||e.end>t.end)}function ZD(e,t,n){let r=new Set(t.ops.flatMap(f=>f.op==="removeContentControl"?[f.controlId]:[])),o=new Set,a=false,i=false,s=null,l=t.ops.flatMap(f=>{if(f.op!=="deleteText")return [f];let p=Fo(e,f.paragraphId,r).filter(h=>h.start<f.end&&h.end>f.start);if(p.length===0)return [f];a=true;let g=p.filter(h=>!Ev(f,h));for(let h of p)Ev(f,h)&&o.add(h.control.id);g.some(h=>h.locked)&&(i=true),s??=g[0]??null;let y=bj(f.start,f.end,n?g:p).map(h=>({start:h.start,op:{...f,...h}}));if(!n)for(let h of p){if(!Ev(f,h))continue;let b=h.control.id;y.push({start:h.start,op:{op:"removeContentControl",controlId:b,keepContent:false}});}return y.sort((h,b)=>b.start-h.start).map(h=>h.op)});if(!a)return null;if(l.length===0&&s)return {kind:"reached",prompt:s};if(i)return {kind:"refused"};let{paragraphId:c,offset:d}=t.collapseTo,u=Fo(e,c,r).find(f=>!o.has(f.control.id)&&d>=f.start&&d<f.end);return {kind:"plan",plan:{ops:l,collapseTo:u?{paragraphId:c,offset:u.end}:t.collapseTo}}}function XD(e,t,n){let r=(s,l)=>{let c=Fo(e,s.paragraphId).find(d=>s.offset>d.start&&s.offset<d.end);return c?{paragraphId:s.paragraphId,offset:c[l]}:s},o=r(n.from,"start"),a=r(n.to,"end");return o===n.from&&a===n.to?null:t.anchor.paragraphId===n.from.paragraphId&&t.anchor.offset===n.from.offset?{anchor:o,head:a}:{anchor:a,head:o}}var vj="equation replacement is not supported in suggesting mode",xj="in suggesting mode, remove the whole equation block rather than one equation",YD=new WeakMap,QD=new WeakSet,Sj="compact linear text cannot spell this equation";function Mv(e,t){let n=eb$1(e,t);if(!n||n.kind!=="paragraph")return [];let r=YD.get(n);if(r)return r;let o=[];for(let i of Gi(n))for(let s of Qg(i.node)){let l=Kg(s);if(!l)continue;let c=Object.freeze({id:s.id,paragraphId:t,start:i.start,end:i.end,linear:Mg$1(l.expression),fallbackText:l.fallbackText,supported:ur(l.expression)});dr(l.expression)&&QD.add(c),o.push(c);}let a=Object.freeze(o);return YD.set(n,a),a}function JD(e,t,n){let r=Mv(e,t).filter(o=>o.start===n);return r.length===0?null:r.map(o=>o.linear||o.fallbackText).join(" ")}function e1(e){return "controlProperties"in e&&e.controlProperties===true}function dr(e){if(e1(e))return true;switch(e.kind){case "bar":case "borderBox":return true;case "text":return e.format!==void 0;case "fallback":return false;case "row":return e.items.some(dr);case "fraction":return dr(e.numerator)||dr(e.denominator);case "radical":return dr(e.radicand)||e.degree!==void 0&&dr(e.degree);case "script":return dr(e.base)||e.subscript!==void 0&&dr(e.subscript)||e.superscript!==void 0&&dr(e.superscript);case "nary":return e.limitLocation==="subSup"||dr(e.body)||e.lowerLimit!==void 0&&dr(e.lowerLimit)||e.upperLimit!==void 0&&dr(e.upperLimit)}}function ur(e){if(e1(e))return false;switch(e.kind){case "fallback":case "bar":case "borderBox":return false;case "text":return e.format===void 0;case "row":return e.items.every(ur);case "fraction":return ur(e.numerator)&&ur(e.denominator);case "radical":return ur(e.radicand)&&(e.degree===void 0||ur(e.degree));case "script":return ur(e.base)&&(e.subscript===void 0||ur(e.subscript))&&(e.superscript===void 0||ur(e.superscript));case "nary":return ur(e.body)&&(e.lowerLimit===void 0||ur(e.lowerLimit))&&(e.upperLimit===void 0||ur(e.upperLimit))}}function t1(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function n1(e){let t=null,n=i=>{if(d$2(i)||!e.pagesLayer.ownerDocument.defaultView||!Ft(i))return null;let l=i.closest("[data-docx-equation]");return l&&e.pagesLayer.contains(l)?l:null},r=(i,s)=>{let l=e.equationById(i);l&&(e.pagesLayer.contentEditable!=="false"&&e.setSelection({anchor:{paragraphId:l.paragraphId,offset:l.start},head:{paragraphId:l.paragraphId,offset:l.end}}),e.onPopover?.({equation:l,rect:s}));},o=i=>{t=null;let s=n(i.target),l=s?.dataset.docxEquation;if(!s||!l)return;let c=s.getBoundingClientRect();t={equationId:l,rect:{left:c.left,top:c.top,right:c.right,bottom:c.bottom}};},a=i=>{let s=n(i.target),l=s?.dataset.docxEquation,c=t;if(t=null,!s||!l){if(!c)return;i.preventDefault(),r(c.equationId,c.rect);return}let d=s.getBoundingClientRect();i.preventDefault(),r(l,{left:d.left,top:d.top,right:d.right,bottom:d.bottom});};return e.pagesLayer.addEventListener("pointerdown",o,true),e.pagesLayer.addEventListener("click",a),{destroy:()=>{e.pagesLayer.removeEventListener("pointerdown",o,true),e.pagesLayer.removeEventListener("click",a);}}}function r1(e){let t=()=>e.session.partFor(e.storyScope()),n=c=>{let d=t();return d?Mv(d,c):[]},r=()=>{let c=e.selection().head;return t1(n(c.paragraphId),c)},o=c=>{let d=n(e.selection().head.paragraphId).find(u=>u.id===c);if(d)return d;for(let u of e.session.storyParts()){let f=eb$1(u,c);if(!f||f.kind!=="generic"||f.namespaceUri!==Ig||f.localName!=="oMath")continue;let p=f;for(;p&&p.kind!=="paragraph";)p=fb$1(u,p.id);return !p||p.kind!=="paragraph"?null:Mv(u,p.id).find(g=>g.id===c)??null}return null},a=c=>e.editingMode()==="suggest"?e.trackedOps([{op:"deleteText",paragraphId:c.paragraphId,start:c.start,end:c.end}]):[{op:"removeMathEquation",equationId:c.id}],i=(c,d)=>{let u=false,f={paragraphId:c.paragraphId,offset:c.start};return e.commit(()=>{let p=e.session.applyTreeOps([...d],e.selectionMark(),{paragraphId:f.paragraphId,start:f.offset,end:f.offset},e.storyScope());return u=p.committed,p},()=>({anchor:f,head:f})),u},s=(c,d)=>{let u=o(c);if(!u)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest"){if(d==="replace")return {ok:false,code:"unsupported",reason:vj};if(n(u.paragraphId).filter(y=>y.start===u.start).length>1)return {ok:false,code:"unsupported",reason:xj}}if(d==="replace"&&QD.has(u))return {ok:false,code:"unsupported",reason:"compact linear editing cannot preserve this equation source formatting"};if(d==="replace"&&u.supported&&u.linear===""&&u.fallbackText!=="")return {ok:false,code:"unsupported",reason:Sj};let[f]=d==="replace"?[{op:"setMathEquation",equationId:c,linear:u.linear}]:a(u),p=f?e.writeRefusal(f):null;return p===null?{ok:true}:{ok:false,code:"locked",reason:p}},l=c=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:c.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:s,applyEquation(c,d){let u=o(c);if(!u)return false;let f=s(c,"replace");return f.ok?u.supported&&u.linear===d?true:i(u,[{op:"setMathEquation",equationId:c,linear:d}]):l(f)},removeEquation(c){let d=o(c);if(!d)return false;let u=s(c,"remove");return u.ok?i(d,a(d)):l(u)}}}var Hc="a chart can be copied, cut or pasted only on its own, not with other content";function Av(e,t,n=E$1){for(let[r,o]of t){let a=eb$1(e,r);if(a&&a.kind!=="textValue"&&a.kind==="paragraph"&&o&&o.end>o.start){let i=Ii(a),s=[...a.children];for(;s.length;){let l=s.pop();if(l.kind!=="textValue"){if(n(l)){let c=i.spanOf(l);if(c?c.end>o.start&&c.start<o.end:o.start===0&&o.end===1/0)return true}for(let c of l.children)s.push(c);}}}}return false}function o1(e,t){return Av(e,t,D$2)}function a1(e){return _c(e)!==null}function _c(e){let t=pg(e);if(!t.ok)return null;let n=[...t.package.parts.values()].map(r=>r.root);return G$1(n)?"chart":F$1(n)?"object":null}function Ze(e){return e.kind!=="textValue"}function ge(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if(Ze(n)&&n.localName===t&&n.namespaceUri===pa$2)return n;return null}function gt(e,t="val"){return e?Nh$1(e,t,pa$2):void 0}function fr(e,t,n){return e?Nh$1(e,t,n):void 0}function Lv(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=Lv(n);return t}function Es(e,t,n){if(e.kind==="textValue")return null;if(e.localName===t&&e.namespaceUri===n)return e;for(let r of e.children){let o=Es(r,t,n);if(o)return o}return null}function pa(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function En(e){return Qd(e)}function Fv(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var Jr=Fv;function i1(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function Bc(e){let t=J$1(e);return typeof t=="string"?`#${t.toLowerCase()}`:t}function Er(e){return `${Math.round(e/20*100)/100}pt`}var wj="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",kj=Od;function $c(e,t,n){for(let o of xg(e,e.mainDocumentPart)){if(o.type!==t||o.targetMode==="External")continue;let a=E$3(o.ownerPart,o.rawTarget);if(a.ok){let i=e.parts.get(a.partName);if(i&&Ze(i.root))return i.root}}let r=e.parts.get(n);return r&&Ze(r.root)?r.root:null}function s1(e){let t=$c(e,wj,"/word/styles.xml"),n=new Map,r=null,o=null,a=null,i=null,s=null;if(!t)return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i,defaultTableStyleId:s};let l=0,c=null;for(let d of t.children){if(!Ze(d)||d.namespaceUri!==pa$2)continue;if(d.localName==="docDefaults"){c=d,r=ge(ge(d,"rPrDefault"),"rPr"),o=ge(ge(d,"pPrDefault"),"pPr");continue}if(d.localName!=="style")continue;if(l>=yf$1)break;l+=1;let u=Nh$1(d,"styleId",pa$2);if(!u)continue;n.set(u,d);let f=Nh$1(d,"default",pa$2),p=Nh$1(d,"type",pa$2);f==="1"||f==="true"||f==="on"?p==="paragraph"?a=u:p==="character"?i=u:p==="table"&&(s=u):(a===u&&(a=null),i===u&&(i=null),s===u&&(s=null));}if(t.namespaceUri===pa$2){let d=J(c);d.run&&(r=L$1("rPr","application")),d.paragraph&&(o=L$1("pPr","application"));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i,defaultTableStyleId:s}}function Do(e,t,n){let r=[],o=new Set,a=t;for(;a&&!o.has(a)&&r.length<kj;){o.add(a);let i=e.byId.get(a);if(!i)break;if(r.length===0&&n!==void 0){let s=Nh$1(i,"type",pa$2);if(s!==void 0&&s!==n)return []}r.unshift(i),a=gt(ge(i,"basedOn"));}return r}function Dv(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let a of n)r.push(a);let o=gt(ge(t,"pStyle"));for(let a of Do(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let i=ge(a,"pPr");i&&r.push(i);}return t&&r.push(t),r}function Ap(e,t,n,r){let o=[];e.docDefaultsRPr&&o.push(e.docDefaultsRPr);let a=[];if(r)for(let u of r)a.push(u);let i=[],s=gt(ge(t,"pStyle"));for(let u of Do(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let f=ge(u,"rPr");f&&i.push(f);}let l=[],c=gt(ge(n,"rStyle"))??void 0;for(let u of Do(e,c,"character")){let f=Nh$1(u,"styleId",pa$2);if(f!==void 0&&f===e.defaultCharacterStyleId)continue;let p=ge(u,"rPr");p&&l.push(p);}let d=[...o,...a,...i,...l];return n&&d.push(n),{all:d,defaults:o,tableLevel:a,paragraphLevel:i,characterLevel:l,direct:n}}function On(e,t){let n=null;for(let r of e){let o=ge(r,t);o&&(n=o);}return n}function Xt(e,t,n){let r;for(let o of e){let a=ge(o,t);if(!a)continue;let i=Nh$1(a,n,pa$2);i!==void 0&&(r=i);}return r}function Lp(e){return !(e==="0"||e==="false"||e==="off")}function eo(e,t){let n=false;for(let r of e){let o=ge(r,t);o&&(n=Lp(gt(o)));}return n}function ma(e,t){let n;for(let r of e){let o=ge(r,t);o&&(n=Lp(gt(o)));}return n}function Or(e,t){let n=e.direct?ge(e.direct,t):null;if(n)return Lp(gt(n));let r=ma(e.tableLevel,t),o=ma(e.paragraphLevel,t),a=ma(e.characterLevel,t);return a===false||a===void 0&&o===false||a===void 0&&o===void 0&&r===false?false:ma(e.defaults,t)===true?true:r===true!=(o===true)!=(a===true)}function Nv(e,t){let n=e.direct?ge(e.direct,t):null;if(n)return Lp(gt(n));let r=ma(e.characterLevel,t);if(r!==void 0)return r;let o=ma(e.paragraphLevel,t);if(o!==void 0)return o;let a=ma(e.tableLevel,t);return a!==void 0?a:ma(e.defaults,t)===true}function l1(e){return e.isLgl?"decimal":e.numFmt}function c1(e){let t=Cd(e),n=new Map,r=new Map,o=new Map,a=new Map,i=new Map,s=new Map;for(let[l,c]of t.abstractNums){c.numStyleLink!==void 0&&s.set(l,c.numStyleLink);let d=new Map,u=new Map;for(let[f,p]of c.levels)d.set(String(f),l1(p)),u.set(String(f),p.start);r.set(l,d),o.set(l,u);}for(let[l,c]of t.nums){n.set(l,c.abstractNumId);for(let[d,u]of c.overrides){let f=`${l}:${d}`,p=u.startOverride??u.level?.start;p!==void 0&&a.set(f,p),u.level!==void 0&&i.set(f,l1(u.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:a,formatOverrides:i,styleLinks:s}}function d1(e,t){return e===null?null:Qd(Nh$1(e,t,pa$2))}function Hv(e){return Bc(ge(e,"shd"))}function u1(e){return `${Math.round(e/20*100)/100}pt`}var Ij=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function Os(e,t,n){if(e===null)return null;let r=Nh$1(e,t,pa$2);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=Nh$1(e,"val",pa$2);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function _v(e,t){let n=new Map,r=new Set(Ij),o=null;for(let a of e){let i=Hv(ge(a,"tcPr"));i!==void 0&&(o=i);for(let s of a.children){if(s.kind==="textValue"||s.localName!=="tblStylePr"||s.namespaceUri!==pa$2)continue;let l=Nh$1(s,"type",pa$2);l===void 0||!r.has(l)||n.set(l,{fill:Hv(ge(s,"tcPr")),rPr:ge(s,"rPr"),pPr:ge(s,"pPr")});}}return {byType:n,styleFill:o,firstRowEnabled:Os(t,"firstRow",32)??false,lastRowEnabled:Os(t,"lastRow",64)??false,firstColumnEnabled:Os(t,"firstColumn",128)??false,lastColumnEnabled:Os(t,"lastColumn",256)??false,hBandingEnabled:!(Os(t,"noHBand",512)??false),vBandingEnabled:!(Os(t,"noVBand",1024)??false)}}function Bv(e,t,n,r,o,a){let i=e.firstRowEnabled&&t===0,s=e.lastRowEnabled&&t===n-1,l=e.firstColumnEnabled&&r,c=e.lastColumnEnabled&&o,d=u=>e.byType.get(u)??null;if(s&&l&&d("swCell"))return d("swCell");if(s&&c&&d("seCell"))return d("seCell");if(i&&l&&d("nwCell"))return d("nwCell");if(i&&c&&d("neCell"))return d("neCell");if(s&&d("lastRow"))return d("lastRow");if(i&&d("firstRow"))return d("firstRow");if(c&&d("lastCol"))return d("lastCol");if(l&&d("firstCol"))return d("firstCol");if(e.hBandingEnabled){let u=t-(e.firstRowEnabled?1:0);if(u>=0){let f=d(u%2===0?"band1Horz":"band2Horz");if(f)return f}}if(e.vBandingEnabled){let u=a-(e.firstColumnEnabled?1:0);if(u>=0){let f=d(u%2===0?"band1Vert":"band2Vert");if(f)return f}}return null}function f1(e,t,n,r,o,a,i,s,l=false,c=[]){let d=[],u=ge(e,"tcBorders"),f={top:n===0?"top":"insideH",bottom:n+o>=r?"bottom":"insideH",left:a?"left":"insideV",right:i?"right":"insideV"};for(let k of ["top","left","bottom","right"]){let T=k==="left"?"start":k==="right"?"end":k,R=ge(u,k)??ge(u,T),C=f[k],A=C==="left"?"start":C==="right"?"end":C,E=R!==null?Ga(R):Ga(ge(t,C)??ge(t,A));E&&d.push(`border-${Ir(k,l)}:${E}`);}let p=Hv(e),g=p!==void 0?p:s;g&&d.push(`background-color:${g}`);let y=ge(e,"vAlign"),h=y===null?void 0:Nh$1(y,"val",pa$2);h==="center"?d.push("vertical-align:middle"):(h==="bottom"||h==="top")&&d.push(`vertical-align:${h}`);let b=ge(e,"tcW"),v=d1(b,"w"),S=b===null?void 0:Nh$1(b,"type",pa$2);v!==null&&v>0&&(S===void 0||S==="dxa")&&d.push(`width:${u1(v)}`);let x=ge(e,"tcMar");for(let k of ["top","right","bottom","left"]){let T=k==="left"?"start":k==="right"?"end":k,R=ge(x,k)??ge(x,T)??c.map(E=>ge(E,k)??ge(E,T)).find(E=>E!==null)??null,C=d1(R,"w"),A=R===null?void 0:Nh$1(R,"type",pa$2);C!==null&&C>=0&&(A===void 0||A==="dxa")&&d.push(`padding-${Ir(k,l)}:${u1(C)}`);}return d.join(";")}function Rj(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===pa$2}function p1(e){return e.localName==="customXml"&&e.namespaceUri===pa$2}function m1(e){let t=[],n=[],r=o=>{for(let a of o)if(Ze(a)){if(a.kind==="tableRow"||a.localName==="tr"&&a.namespaceUri===pa$2){n.push({row:t.length}),t.push(a);continue}if(a.kind==="contentControl"){let i=a.children.find(s=>s.kind==="contentControlContent");i&&Ze(i)&&r(i.children);continue}if(p1(a)){r(a.children);continue}n.push({skip:a});}};return r(e.children),{rows:t,tableItems:n}}function g1(e){let t=[],n=[],r=new Set;for(let o of e){let a=new Set,i=[],s=[],l=0,c=d=>{for(let u of d)if(Ze(u)){if(Rj(u)){let f=ge(u,"tcPr"),p=Math.min(Math.max(pa(gt(ge(f,"gridSpan")))??1,1),63),g=ge(f,"vMerge"),y=g===null?null:gt(g)==="restart"?"restart":"continue",h=y==="continue"&&!r.has(l)?"restart":y;y!==null&&a.add(l);let b={cell:u,startColumn:l,span:p,vMerge:h};i.push(b),s.push({placement:b}),l+=p;continue}if(u.kind==="contentControl"){let f=u.children.find(p=>p.kind==="contentControlContent");f&&Ze(f)&&c(f.children);continue}if(p1(u)){c(u.children);continue}s.push({skip:u});}};c(o.children),r=a,t.push(i),n.push(s);}return {placements:t,items:n}}function h1(e){let t=1;for(let n of e)for(let r of n)t=Math.max(t,r.startColumn+r.span);return t}function y1(e,t,n,r){let o=new Map,a=t.byType.get("wholeTable")??null;for(let i=0;i<n.length;i+=1)for(let s of n[i]??[]){if(s.vMerge==="continue")continue;let l=Bv(t,i,n.length,s.startColumn===0,s.startColumn+s.span>=r,s.startColumn),c=[],d=[];a?.rPr&&c.push(a.rPr),a?.pPr&&d.push(a.pPr),l?.rPr&&c.push(l.rPr),l?.pPr&&d.push(l.pPr),o.set(s.cell,c.length>0||d.length>0?{...e,tableRPr:c,tablePPr:d}:e);}return o}function b1(e,t){let n=Do(e.styles,gt(ge(t,"tblStyle")),"table");return n.length>0?n:Do(e.styles,e.styles.defaultTableStyleId??void 0,"table")}function v1(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&Ze(n)?n:null,o=b1(e,r),a=_v(o,ge(r,"tblLook")),{rows:i}=m1(t),{placements:s}=g1(i);return y1(e,a,s,h1(s))}function x1(e,t,n,r){let o=t.children.find(A=>A.kind==="tableProperties"),a=o&&Ze(o)?o:null,i=null,s=b1(e,a);for(let A of s){let E=ge(ge(A,"tblPr"),"tblBorders");E&&(i=E);}let l=s.map(A=>ge(A,"tblPr")).filter(A=>A!==null);a&&l.push(a);let c=eo(l,"bidiVisual"),d=[],u;for(let A of l){let E=ge(A,"tblCellMar");E&&d.unshift(E),u=gt(ge(A,"jc"))??u;}let f=ge(a,"tblBorders");f&&(i=f);let p=_v(s,ge(a,"tblLook")),{rows:g,tableItems:y}=m1(t),{placements:h,items:b}=g1(g),v=h1(h),S=y1(e,p,h,v),x=["border-collapse:collapse"],k=ge(a,"tblW"),T=En(fr(k,"w",pa$2));T!==null&&T>0&&fr(k,"type",pa$2)==="dxa"&&x.push(`width:${Er(T)}`);let R=Ir(u==="right"||u==="end"?"right":u==="center"?"center":"left",c);R==="center"?x.push("margin-left:auto","margin-right:auto"):R==="right"?x.push("margin-left:auto","margin-right:0"):x.push("margin-left:0","margin-right:auto");for(let[A,E]of [["insideH","insideh"],["insideV","insidev"]]){let P=Ga(ge(i,A));P&&x.push(`mso-border-${E}-alt:${P}`);}let C=`<table dir="${c?"rtl":"ltr"}" align="${R}" style="${x.join(";")}">`;for(let A of y){if("skip"in A){r.advanceFieldState(A.skip,n);continue}let E=A.row,P=ge(ge(g[E]??null,"trPr"),"trHeight"),w=En(fr(P,"val",pa$2)),O=MP(w,fr(P,"hRule",pa$2)),_=O===""?"":` style="${O}"`;C+=`<tr${_}>`;for(let q of b[E]??[]){if("skip"in q){r.advanceFieldState(q.skip,n);continue}let K=q.placement;if(K.vMerge==="continue"){r.advanceFieldState(K.cell,n);continue}let U=1;if(K.vMerge==="restart")for(let H=E+1;H<h.length&&h[H].find(D=>D.startColumn===K.startColumn&&D.vMerge==="continue");H+=1)U+=1;let M=ge(K.cell,"tcPr"),Y=K.startColumn+K.span>=v,ne=Bv(p,E,h.length,K.startColumn===0,Y,K.startColumn),le=f1(M,i,E,h.length,U,K.startColumn===0,Y,ne?.fill!==void 0?ne.fill:p.styleFill,c,d),se=(K.span>1?` colspan="${K.span}"`:"")+(U>1?` rowspan="${U}"`:"")+(le===""?"":` style="${Jr(le)}"`),W=S.get(K.cell)??e;C+=`<td dir="ltr"${se}>${r.renderBlocks(W,K.cell.children,n)}</td>`;}C+="</tr>";}return `${C}</table>`}function Fp(e){if(e===void 0||!/^\d{1,10}$/.test(e))return null;let t=Number.parseInt(e,10);return t>=1&&t<=2147483647?t:null}function $v(e){let t=Nh$1(e,"type",pa$2);return t==="separator"||t==="continuationSeparator"}function Wv(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!Ze(r)||r.namespaceUri!==pa$2||r.localName!==t||$v(r))continue;let o=Fp(Nh$1(r,"id",pa$2));o!==null&&n.add(o);}return n}function Wc(e,t,n,r,o,a,i){for(let s of t.children)if(Ze(s)&&s.kind!=="drawing"){if(s.kind==="revisionDelete"||s.kind==="revisionMoveFrom"){r.inert||o(s,r);continue}if(s.kind==="table"){Wc(e,s,n,r,o,a,v1(e,s));continue}if(s.kind==="tableCell"||s.namespaceUri===pa$2&&s.localName==="tc"){let l=i?.get(s);if(l===void 0){r.inert||o(s,r);continue}Wc(l,s,n,r,o,a,i);continue}if(s.kind==="paragraph"){let l=s.children.find(c=>c.kind==="paragraphProperties");Wc(e,s,n,r,o,l&&Ze(l)?l:null,i);continue}if(s.kind==="run"){if(s.children.some(d=>d.kind==="fldChar")){r.inert||o(s,r);continue}if(s.children.some(d=>d.kind==="instrText")||!r.inert&&r.stack.some(d=>d==="instr"))continue;let l=s.children.find(d=>d.kind==="runProperties"),c=Ap(e.styles,a,l&&Ze(l)?l:null,e.tableRPr);if(Or(c,"vanish"))continue}if(s.namespaceUri===pa$2&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=Fp(Nh$1(s,"id",pa$2));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}Wc(e,s,n,r,o,a,i);}}function Pj(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!Ze(r)||r.namespaceUri!==pa$2)&&!(r.localName!==t||$v(r))&&Fp(Nh$1(r,"id",pa$2))===n)return r;return null}function S1(e,t,n){let r={footnote:new Set(e.noteOrdinals.footnote.keys()),endnote:new Set(e.noteOrdinals.endnote.keys())},o=[];for(let a of ["footnote","endnote"])for(let i of r[a])o.push({kind:a,id:i});for(;o.length>0;){let a=o.pop(),i=Pj(t[a.kind],a.kind,a.id);if(i===null)continue;let s={stack:[],inert:false};n(i,s);let l={stack:[],inert:s.stack.length>0},c=[];Wc(e,i,c,l,n,null);for(let d of c)e.availableNotes[d.kind].has(d.id)&&(r[d.kind].has(d.id)||(r[d.kind].add(d.id),o.push(d)));}return r}function qv(e,t,n,r,o){if(n===null)return "";let a=`/word/${t}s.xml`;for(let[l,c]of e.pkg.parts)c.root===n&&(a=l);let i=xg(e.pkg,a),s="";for(let l of n.children){if(!Ze(l)||l.namespaceUri!==pa$2||l.localName!==t||$v(l))continue;let c=Nh$1(l,"id",pa$2),d=Fp(c);if(c===void 0||d===null||!r.has(d))continue;let u=o({...e,noteBody:{kind:t,id:d},docRels:i},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${d}">${u===""?"<p></p>":u}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}function w1(e){if(!e)return null;let t=[];for(let n of e.children){if(!Ze(n)||n.localName!=="tab")continue;let r=gt(n),o=En(Nh$1(n,"pos",pa$2));if(o===null||o<0||r!=="left"&&r!=="center"&&r!=="right"&&r!=="decimal"&&r!=="bar")continue;let a=gt(n,"leader"),i=a==="dot"?"dotted":a==="hyphen"?"dashed":a==="underscore"?"lined":a==="middleDot"?"middledot":a==="heavy"?"heavy":"";t.push(`${r}${i?` ${i}`:""} ${Er(o)}`);}return t.length>0?`tab-stops:${t.join(" ")}`:null}var Kv="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Cj=`${Kv}/numbering`,Tj=`${Kv}/footnotes`,Ej=`${Kv}/endnotes`,Oj=2*1024*1024,Mj=8*1024*1024,k1=9525,Aj=new Map([["image/png","image/png"],["image/jpeg","image/jpeg"],["image/jpg","image/jpeg"],["image/gif","image/gif"],["image/bmp","image/bmp"],["image/x-ms-bmp","image/bmp"],["image/x-bmp","image/bmp"],["image/webp","image/webp"],["image/svg+xml","image/svg+xml"],["image/tiff","image/tiff"],["image/x-emf","image/x-emf"],["image/x-wmf","image/x-wmf"]]);function Dp(e,t,n,r){let o=e.direct!==null&&ge(e.direct,r)!==null||On(e.defaults,r)!==null||On(e.tableLevel,r)!==null||On(e.paragraphLevel,r)!==null||On(e.characterLevel,r)!==null;return Or(e,t&&o?r:n)}function Lj(e){let t=e.all;if(Or(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=eo(t,"rtl"),o=(r?Xt(t,"rFonts","cs"):void 0)??Xt(t,"rFonts","ascii")??Xt(t,"rFonts","hAnsi")??Xt(t,"rFonts","eastAsia")??(r?void 0:Xt(t,"rFonts","cs"));if(o!==void 0){let x=TP(o);x&&n.push(`font-family:${x}`);}let a=pa((r?Xt(t,"szCs","val"):void 0)??Xt(t,"sz","val")??(r?void 0:Xt(t,"szCs","val")));a!==null&&a>0&&n.push(`font-size:${Math.round(a/2*100)/100}pt`);let i={...e,direct:null},s=e.direct?t.slice(0,-1):t;Dp(e,r,"b","bCs")?n.push("font-weight:bold"):Dp(i,r,"b","bCs")&&n.push("font-weight:normal"),Dp(e,r,"i","iCs")?n.push("font-style:italic"):Dp(i,r,"i","iCs")&&n.push("font-style:normal");let l=[],c=On(t,"u"),d=c!==null&&gt(c)!=="none";d&&l.push("underline");let u=Nv(e,"dstrike");if((Or(e,"strike")||u)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let x=On(s,"u");(x!==null&&gt(x)!=="none"||Or(i,"strike")||Nv(i,"dstrike"))&&n.push("text-decoration:none");}d&&n.push(...OP(c)),u&&!d&&n.push("text-decoration-style:double");let f=i1(Xt(t,"color","val"));f&&n.push(`color:${f}`);let p=En(Xt(t,"spacing","val"));p!==null&&n.push(`letter-spacing:${Math.round(p/20*100)/100}pt`);let g=gt(On(t,"highlight")),y=g!==void 0&&Object.hasOwn(vh,g)?vh[g]:void 0,h=Bc(On(t,"shd"));y?n.push(`background-color:${y}`,`mso-highlight:${g}`):h&&n.push(`background-color:${h}`),Or(e,"caps")?n.push("text-transform:uppercase"):Or(i,"caps")&&n.push("text-transform:none"),Or(e,"smallCaps")?n.push("font-variant:small-caps"):Or(i,"smallCaps")&&n.push("font-variant:normal");let b=gt(On(t,"vertAlign")),v=b==="superscript"||b==="subscript"?b:null,S=Va((r?Xt(t,"lang","bidi"):void 0)??Xt(t,"lang","val")??Xt(t,"lang","bidi")??Xt(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:v,lang:S,rtl:r}}function Fj(e,t,n=false){let r=[],o=gt(On(e,"jc")),a=o!==void 0&&Object.hasOwn(xh,o)?xh[o]:void 0;a&&r.push(`text-align:${n&&a!=="center"&&a!=="justify"?a==="left"?"right":"left":a}`);let i=En(Xt(e,"spacing","before"));i!==null&&i>=0&&r.push(`margin-top:${Er(i)}`);let s=En(Xt(e,"spacing","after"));s!==null&&s>=0&&r.push(`margin-bottom:${Er(s)}`);let l=En(Xt(e,"spacing","line")),c=Xt(e,"spacing","lineRule");r.push(...EP(l,c));let d=null,u=null,f=null,p=null;for(let b of e){let v=ge(b,"ind");if(!v)continue;let S=En(fr(v,"left",pa$2)??fr(v,"start",pa$2));S!==null&&(d=S);let x=En(fr(v,"right",pa$2)??fr(v,"end",pa$2));x!==null&&(u=x);let k=En(fr(v,"hanging",pa$2)),T=En(fr(v,"firstLine",pa$2));k!==null?(f=k,p=null):T!==null&&(p=T,f=null);}!t&&d!==null&&r.push(`margin-${n?"right":"left"}:${Er(d)}`),u!==null&&r.push(`margin-${n?"left":"right"}:${Er(u)}`),f!==null&&f!==0?r.push(`text-indent:${Er(-f)}`):p!==null&&p!==0&&r.push(`text-indent:${Er(p)}`);let g=w1(On(e,"tabs"));g&&r.push(g),eo(e,"pageBreakBefore")&&r.push("page-break-before:always"),eo(e,"keepNext")&&r.push("page-break-after:avoid"),eo(e,"keepLines")&&r.push("page-break-inside:avoid"),eo(e,"widowControl")&&r.push("widows:2","orphans:2");let y=Bc(On(e,"shd"));y&&r.push(`background-color:${y}`);let h=On(e,"pBdr");if(h)for(let b of ["top","left","bottom","right"]){let v=Ga(ge(h,b));v&&r.push(`border-${b}:${v}`,`mso-border-${b}-alt:${v}`);}return r.join(";")}function Dj(e,t,n){let r=e.noteOrdinals[t],o=r.get(n);if(o!==void 0)return o;let a=r.size+1;return r.set(n,a),a}var I1={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function P1(e,t,n,r){let o=e.numbering.formatOverrides.get(`${t}:${r}`)??e.numbering.levelFormats.get(n)?.get(String(r))??"decimal",a=e.numbering.startOverrides.get(`${t}:${r}`)??e.numbering.levelStarts.get(n)?.get(String(r))??1;return {fmt:o,start:a}}function Nj(e,t){let n,r;for(let s of t){let l=ge(s,"numPr");if(!l)continue;let c=gt(ge(l,"numId"));c!==void 0&&(n=c);let d=gt(ge(l,"ilvl"));d!==void 0&&(r=d);}if(n===void 0||n==="0")return null;let o=e.numbering.numToAbstract.get(n);if(o===void 0)return null;for(let s=0;s<8&&!((e.numbering.levelFormats.get(o)?.size??0)>0);s+=1){let l=e.numbering.styleLinks.get(o),c=l===void 0?void 0:e.styles.byId.get(l),d=gt(ge(ge(ge(c??null,"pPr"),"numPr"),"numId")),u=d===void 0?void 0:e.numbering.numToAbstract.get(d);if(u===void 0||u===o)break;o=u;}let a=Math.min(Math.max(pa(r)??0,0),8),i=P1(e,n,o,a);return {numId:n,abstractId:o,level:a,fmt:i.fmt,start:i.start}}function Hj(e,t){let n=K$1(e.pkg.contentTypes,t);if(n.ok){let a=Aj.get(n.contentType.toLowerCase());if(a!==void 0)return a}let r=t.lastIndexOf("."),o=r===-1?"":t.slice(r+1).toLowerCase();return o==="png"?"image/png":o==="jpg"||o==="jpeg"?"image/jpeg":o==="gif"?"image/gif":o==="bmp"?"image/bmp":o==="webp"?"image/webp":o==="svg"?"image/svg+xml":o==="tif"||o==="tiff"?"image/tiff":o==="emf"?"image/x-emf":o==="wmf"?"image/x-wmf":null}function _j(e,t){let n=Es(t,"inline",wa)??Es(t,"anchor",wa);if(!n)return "";let r=Es(n,"blip",va);if(!r)return "";let o=Nh$1(r,"embed",ya$1);if(!o)return "";let a=e.docRels.find(y=>y.id===o&&y.targetMode!=="External");if(!a)return "";let i=E$3(a.ownerPart,a.rawTarget);if(!i.ok)return "";let s=e.pkg.partBytes.get(i.partName.replace(/^\//,""))??e.pkg.partBytes.get(i.partName);if(!s)return "";let l=Hj(e,i.partName);if(!l||s.byteLength>e.maxImageBytes||e.imageBudget.used+s.byteLength>e.maxTotalImageBytes)return "";e.imageBudget.used+=s.byteLength;let c=e.imageDataUris.get(i.partName);c==null&&(c=`data:${l};base64,${Yu(s)}`,e.imageDataUris.set(i.partName,c));let d=Es(n,"extent",wa),u=d?pa(Nh$1(d,"cx","")):null,f=d?pa(Nh$1(d,"cy","")):null,p=y=>Math.round(y/12700*100)/100,g=u!==null&&f!==null&&u>0&&f>0?` width="${Math.round(u/k1)}" height="${Math.round(f/k1)}" style="width:${p(u)}pt;height:${p(f)}pt"`:"";return `<img src="${c}"${g}>`}function gi(e,t,n=0){if(n>=Aa)return;let r=hh$1(e)?n+1:Ba$1(e,n);for(let o of e.children)if(Ze(o)&&o.kind!=="drawing"){if(o.kind==="contentControl"){let a=o.children.find(i=>i.kind==="contentControlContent");a&&Ze(a)&&gi(a,t,r+1);continue}if(o.kind==="fldChar"){C1(o,t);continue}gi(o,t,r);}}function C1(e,t){let n=Nh$1(e,"fldCharType",pa$2);n==="begin"?t.stack.push("instr"):n==="separate"&&t.stack.length>0?t.stack[t.stack.length-1]="result":n==="end"&&t.stack.pop();}function Bj(e,t,n,r){let o=t.children.find(c=>c.kind==="runProperties"),a=Ap(e.styles,n,o&&Ze(o)?o:null,e.tableRPr),i=Lj(a),s="";for(let c of t.children){if(!Ze(c))continue;if(c.kind==="fldChar"){r.inert||C1(c,r);continue}if(c.kind==="instrText"||!r.inert&&r.stack.some(f=>f==="instr")||i.vanish)continue;let d=LP(c);if(d!==""){s+=d;continue}let u=AP(c,e.noteBody,(f,p)=>Dj(e,f,p),(f,p)=>e.availableNotes[f].has(p));if(u!==""){s+=u;continue}switch(c.kind){case "text":s+=Fv(Lv(c));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let f=Nh$1(c,"type",pa$2);s+=f==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let f=kr(Nh$1(c,"name",pa$2));f!==null&&(s+=`<a id="${Jr(f)}"></a>`);break}case "drawing":s+=_j(e,c);break;default:s+=yb$1(c)?.text??"";break}}if(s==="")return "";i.vertAlign==="superscript"?s=`<sup>${s}</sup>`:i.vertAlign==="subscript"&&(s=`<sub>${s}</sub>`);let l=`${i.lang===null?"":` lang="${i.lang}"`}${i.rtl?' dir="rtl"':""}${i.css===""?"":` style="${Jr(i.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function mi(e,t,n,r,o=0){if(o>=Aa)return "";let a="";for(let i of t)if(Ze(i))switch(hh$1(i)?"fldSimple":i.kind){case "run":a+=Bj(e,i,n,r);break;case "hyperlink":{let s=mi(e,i.children,n,r,o+1);if(s==="")break;let l=Nh$1(i,"id",ya$1),c=l?e.docRels.find(f=>f.id===l):void 0,d=c===void 0?void 0:c.targetMode==="External"||c.rawTarget.startsWith("#")?c.rawTarget:void 0,u=oC(d,Nh$1(i,"anchor",pa$2));a+=u!==null?`<a href="${Jr(u)}">${s}</a>`:s;break}case "bookmarkStart":{let s=kr(Nh$1(i,"name",pa$2));s!==null&&(a+=`<a id="${Jr(s)}"></a>`);break}case "fldSimple":a+=mi(e,i.children,n,r,o+1);break;case "contentControl":{let s=i.children.find(l=>l.kind==="contentControlContent");s&&Ze(s)&&(a+=mi(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":a+=mi(e,i.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":gi(i,r,o);break;case "generic":if(Pg$1(i))a+=lP(i);else if(Ca(i))a+=mi(e,i.children,n,r,o+1);else {let s=nd$1(i);s&&(a+=mi(e,s,n,r,o+1));}break}return a}function $j(e,t){let n=gt(ge(t,"pStyle")),r=Do(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let a=Nh$1(r[o],"styleId",pa$2),i=a?/^Heading([1-6])$/.exec(a):null;if(i)return {level:Number(i[1]),fromStyle:true}}if(n===void 0){let o=pa(gt(ge(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function Wj(e,t){let n=Do(e.styles,gt(ge(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=CP(Nh$1(n[r],"styleId",pa$2));if(o!==null)return o}return null}function R1(e,t,n,r){let o=t.children.find(h=>h.kind==="paragraphProperties"),a=o&&Ze(o)?o:null,i=Dv(e.styles,a,e.tablePPr),s=Fj(i,n.asListItem,eo(i,"bidi")),l=mi(e,t.children,a,r),c=s===""?"":` style="${Jr(s)}"`,d=eo(i,"bidi")?' dir="rtl"':"",u=Wj(e,a),f=u===null?"":` class="${u}"`,p=$j(e,a);if(n.asListItem)return `<li${p?.fromStyle===true?` class="Heading${p.level}"`:f}${d}${c}>${l}</li>`;let g=p===null?"p":`h${p.level}`,y=p===null?f:p.fromStyle?` class="Heading${p.level}"`:' class="docx-outline"';return `<${g}${y}${d}${c}>${l}</${g}>`}var qj={renderBlocks:(e,t,n)=>Np(e,t,n),advanceFieldState:gi};function Np(e,t,n){let r="",o=[],a=null,i=new Map,s=n;if(s===void 0){let f={stack:[]};for(let p of t)Ze(p)&&gi(p,f);s={stack:[],inert:f.stack.length>0};}let l=()=>{let f=o.pop();f&&(r+=`</${f.tag}>`);},c=()=>{for(;o.length>0;)l();a=null;},d=(f,p)=>{for(a!==null&&p.level<a&&c();o.length>0&&o[o.length-1].abstractId!==p.abstractId;)l();o.length===0&&(a=p.level);let g=a??p.level,y=p.level-g+1;for(;o.length>y;)l();for(o.length===y&&o[y-1].numId!==p.numId&&l();o.length<y;){let v=g+o.length,S=P1(e,p.numId,p.abstractId,v),x=i.get(`${p.abstractId}:${p.numId}:${v}`)??0,k=S.start+x,T=S.fmt==="bullet"?"ul":"ol",R=T==="ol"?Object.hasOwn(I1,S.fmt)?I1[S.fmt]:"decimal":null,C=T==="ol"&&k!==1?` start="${k}"`:"";r+=R?`<${T}${C} style="list-style-type:${Jr(R)}">`:`<${T}>`,o.push({tag:T,numId:p.numId,abstractId:p.abstractId});}let h=`${p.abstractId}:${p.numId}:${p.level}`;i.set(h,(i.get(h)??0)+1);let b=`${p.abstractId}:`;for(let v of i.keys()){if(!v.startsWith(b))continue;let S=v.slice(v.lastIndexOf(":")+1);/^\d+$/.test(S)&&Number(S)>p.level&&i.delete(v);}r+=R1(e,f,{asListItem:true},s);},u=f=>{for(let p of f)if(Ze(p))switch(p.kind){case "paragraph":{let g=p.children.find(b=>b.kind==="paragraphProperties"),y=g&&Ze(g)?g:null,h=Nj(e,Dv(e.styles,y));h?d(p,h):(c(),r+=R1(e,p,{asListItem:false},s));break}case "table":c(),r+=x1(e,p,s,qj);break;case "contentControl":{let g=p.children.find(y=>y.kind==="contentControlContent");g&&Ze(g)&&u(g.children);break}case "generic":u(p.children);break;case "bookmarkStart":{let g=kr(Nh$1(p,"name",pa$2));g!==null&&(r+=`<a id="${Jr(g)}"></a>`);break}default:s.inert||gi(p,s);break}};return u(t),c(),r}function T1(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!Ze(n.root))return "";let r=n.root.children.find(c=>c.kind==="body");if(!r||!Ze(r))return "";let o=$c(e,Tj,"/word/footnotes.xml"),a=$c(e,Ej,"/word/endnotes.xml"),i={pkg:e,styles:s1(e),numbering:c1($c(e,Cj,"/word/numbering.xml")),docRels:xg(e,e.mainDocumentPart),maxImageBytes:Oj,maxTotalImageBytes:Mj,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:Wv(o,"footnote"),endnote:Wv(a,"endnote")},noteBody:null},s=Np(i,r.children),l=S1(i,{footnote:o,endnote:a},gi);return s+qv(i,"footnote",o,l.footnote,Np)+qv(i,"endnote",a,l.endnote,Np)}var Kj=12*1024*1024;function Uj(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function jj(e){return `<div><table>${e.split(`
28
+ `).map(n=>`<tr>${n.split(" ").map(r=>`<td>${Uj(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function Uv(e){if(e.cellRectangle)return {text:e.text,html:jj(e.text)};if(!e.coverage||!e.pkg)return {text:e.text,html:null};let t=M$1(e.pkg,e.coverage);if(!t.ok)return {text:e.text,html:null,...t.reason==="unsupported-content"?{reason:t.reason}:{}};let n=e.maxFragmentBytes??Kj,r=t.bytes;if(t.bytes.byteLength>n){let i=M$1(e.pkg,e.coverage,{omitMedia:true});r=i.ok&&i.bytes.byteLength<=n?i.bytes:null;}let o;try{o=T1(t.package);}catch(i){console.error("docx-editor: copy HTML flavour failed to render",i),o="";}let a=mP(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:a}}function E1(e,t){let n=()=>t.text.length===0?"none":(e.insertPlainText(t.text),"plain");if(t.forcePlain)return n();let r=t.html;if(r===null||r.length===0)return n();let o=Yo(r);if(!e.richLaneOpen)return o&&a1(o.bytes)?"unsupported-content":n();if(o){let i=e.pasteFragment(o.bytes,o.lastMarkCovered);if(i==="unsupported-content")return "unsupported-content";if(i)return "fragment"}let a=pT(r);if(a.ok&&a.truncated&&t.text.length>0)return n();if(a.ok){let i=e.pasteFragment(a.fragmentBytes,a.lastMarkCovered);if(i==="unsupported-content")return "unsupported-content";if(i)return "external-html"}return n()}function O1(e,t){let n=gf$1(e,t);if(!n.includes("\xAD"))return n;let r=n.split("");for(let{line:o}of Wb$1(e,t)??[])for(let a of _a(o,t)?.spans??[])Sd(a)&&a.range.start<r.length&&(r[a.range.start]=Rb$1);return r.join("")}function M1(e){return e.includes(Rb$1)?e.replaceAll(Rb$1,""):e}function A1(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!_k(e.settingsRoot()))return r;let a=ce(e,t.paragraphId)??e.part();if(!$k(a,t.paragraphId))return r;let i=eb$1(a,t.paragraphId);if(i?.kind!=="paragraph")return r;let s=al(i).find(h=>h.fieldNodeId===o&&h.start<=t.offset&&h.end>=n.offset);if(!s?.enabled||!Mk(s)||s.maxLength<=0)return r;let l=(Nm(a,t.paragraphId)??"").slice(s.start,s.end),c=l.slice(0,t.offset-s.start),d=l.slice(n.offset-s.start),u=c+d,f=h=>Nk(c+h+d,s,u)<=s.maxLength;if(f(r))return r;let p=[...r],g=s.maxLength-[...u].length;if(s.type==="number"&&s.format)for(let h of u)(h===","&&s.format.includes(",")||h==="%"&&s.format.endsWith("%"))&&g++;let y=new Set;if(s.type==="date"){let h=0;for(let b=0;b<p.length;b++)if(/\S/.test(p[b])){if(++h>18)break;y.add(b+1);}else (b+1===p.length||/\S/.test(p[b+1]))&&y.add(b+1);}else if(s.type==="number"&&s.format)for(let h=1;h<=3;h++)y.add(g+h);for(let h of [...y].sort((b,v)=>v-b)){if(h<=Math.max(0,g)||h>p.length)continue;let b=p.slice(0,h).join("");if(f(b))return b}return p.slice(0,Math.max(0,g)).join("")}function Vj(e,t){let n=eb$1(e,t);if(!n||!Hc$2(n))return false;let r=fb$1(e,t)?.children??[];return r[r.findIndex(a=>a.id===t)+1]?.kind==="paragraph"}var Gj=2e3;function L1(e){let{session:t}=e,n=null;function r(s){let l=cf(s),c=e.orderedRange(),d=A1(t,c.from,c.to,l,e.textFormFieldId?.()??null).split(`
29
+ `),u=e.typingSelectionPlan?.()??e.deleteSelectionPlan(),f=u.replaceAt??u.collapseTo,p=d.join(""),g=[...u.ops],y=e.consumePendingFormatOps(f.paragraphId,f.offset,p.length);if(p.length>0){let T=!u.outsidePromptId&&u.ops.length===0&&d.length===1?e.insertOwner?.():void 0;g.push({op:"insertText",paragraphId:f.paragraphId,offset:f.offset,text:p,...T===void 0?{}:{inside:T},...u.outsidePromptId?{bias:"left"}:{}}),g.push(...y);}let h=[],b=0;for(let T=0;T<d.length-1;T+=1)b+=d[T].length,h.push(f.offset+b);if(h.length>0&&g.push({op:"splitParagraphMany",paragraphId:f.paragraphId,offsets:h}),g.length===0)return;let v=new Set(e.paragraphIds?.()??t.paragraphIdsIn(e.storyScope())),S=d[d.length-1],x=h.length===0?e.caretMark({paragraphId:f.paragraphId,offset:f.offset+S.length}):void 0,k=g.filter(T=>!y.includes(T));e.commit(()=>e.withoutPendingOnRejection(g,k,e.selectionMark(),x),()=>{if(e.retainPromptBoundary?.(u.outsidePromptId),h.length===0)return Ne({paragraphId:f.paragraphId,offset:f.offset+S.length});let T=(e.paragraphIds?.()??t.paragraphIdsIn(e.storyScope())).filter(C=>!v.has(C)),R=T[T.length-1];return R?Ne({paragraphId:R,offset:S.length}):null});}function o(){e.flushPendingInputAndLayout();let s=xF(e);if(s)return s;let l=e.cellSelection(),c=e.orderedRange(),d=e.paragraphOrder(),u=l?ja$1(e.layout(),l.cellIds):d.slice(d.indexOf(c.from.paragraphId),d.indexOf(c.to.paragraphId)+1),f=new Map(u.map(P=>[P,{start:!l&&P===c.from.paragraphId?c.from.offset:0,end:!l&&P===c.to.paragraphId?c.to.offset:1/0}])),g=e.storyScope().kind==="body"?t.part():ce(t,u[0]??c.from.paragraphId);if(g&&Av(g,f)){let P=o1(g,f);return e.commit(()=>({committed:false,rejected:true,opCount:0,reason:P?Hc:"unsupported-content"})),{text:"",html:null,reason:P?"chart-content":"unsupported-content"}}let y=e.revisionDisplayMode?.()!=="original",h=XM(O1,!y),b=P=>M1(P).replaceAll(Qf,""),v=hc(e.layout(),h);if(l)return Uv({text:b(ma$1(e.layout(),l,v.spelledText)),cellRectangle:true,coverage:null,pkg:null});let{from:S,to:x}=e.orderedRange(),k=t.part(),T=b(Wb(e.layout(),S,x,e.paragraphOrder(),(P,w)=>v.resultAt(P,w)??(k?JD(k,P,w):null),v.markedText,y&&k?P=>Vj(k,P):void 0)),R=e.storyScope();if(S.paragraphId===x.paragraphId&&S.offset===x.offset||R.kind!=="body")return {text:T,html:null};let A=t.part(),E=rA(e.layout(),A,S,x,e.paragraphOrder());return Uv({text:T,cellRectangle:false,coverage:E,pkg:t.currentPackage()})}function a(s,l){let c=e.editingMode()==="suggest"?e.suggestion?.():void 0;if(e.editingMode()!=="edit"&&c===void 0||e.storyScope().kind!=="body"||e.cellSelection())return false;e.flushPendingInputAndLayout();let d=e.typingSelectionPlan?.()??e.deleteSelectionPlan(),u=c?e.trackedOps?.(d.ops,c.date)??d.ops:d.ops,f=d.replaceAt??d.collapseTo,p=false,g=false;return e.commit(()=>{let y=e.collaborationGate(u,{kind:"body"});if(y)return {committed:false,rejected:true,opCount:0,reason:y};let h=e.actorId(),b=t.applyFragmentPaste({kind:"body"},{paragraphId:f.paragraphId,offset:f.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:u,...h!==void 0?{actorId:h}:{},...c?{revision:c}:{}});return p=b.ok,p&&c&&e.trackedChangeLanded?.(),g=!b.ok&&b.detail==="fragment-merge:unsupported-content",{committed:b.ok,rejected:!b.ok,opCount:b.ok?1:0,...b.ok?{}:{reason:b.detail??b.reason}}},()=>{if(e.retainPromptBoundary?.(d.outsidePromptId),d.outsidePromptId){let y=t.part();for(let h=fb$1(y,d.outsidePromptId);h;h=fb$1(y,h.id)){if(h.kind!=="paragraph")continue;let b=Fo(y,h.id).find(v=>v.control.id===d.outsidePromptId);if(b)return Ne({paragraphId:h.id,offset:b.start});break}}return Ne(f)}),g?"unsupported-content":p}function i(s,l){let c=n!==null&&e.now()-n<Gj;n=null;let d=c?null:SF(e,l);if(d!==null)return d;let u=E1({richLaneOpen:(e.richPasteAllowed?.()??true)&&(e.editingMode()==="edit"||e.editingMode()==="suggest"&&e.suggestion?.()!==void 0)&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(f,p)=>a(f,p),insertPlainText:r},{html:l,text:s,forcePlain:c});if(u==="unsupported-content"){let f=l?Yo(l):null,p=f!==null&&_c(f.bytes)==="chart";return e.commit(()=>({committed:false,rejected:true,opCount:0,reason:p?Hc:"unsupported-content"})),false}return u!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:i,armForcePlainPaste:()=>{n=e.now();}}}function F1(e){let{session:t}=e,n=null,r=()=>n??e.selection(),o=()=>n?null:e.cellSelection();function a(){return li(e.selection())}function i(){e.flushPendingInputAndLayout();let w=r(),O=w.anchor.paragraphId===w.head.paragraphId?void 0:e.paragraphOrder();return ep(e.layout(),w,O)}function s(){return i().from}function l(w){return gf$1(e.layout(),w)}function c(w,O){let _=t.partFor(e.storyScope())??t.part(),q=eb$1(_,w.paragraphId);if(!q||q.kind!=="paragraph")return null;let K=O==="before"?Ci(q,w.offset):Di(q,w.offset);if(!K)return null;let U=Ph$1(_,K.controlId),M=U?qc$1(U):null;if(!M)return null;let Y=M.lock==="contentLocked"||M.lock==="sdtContentLocked";if(!(Y||M.type==="checkbox"||M.type==="picture")||!U)return null;let le=false,se=e.trackedAuthorOrNone()!==void 0;for(let W=se?fb$1(_,U.id):null;W&&(W.kind==="revisionDelete"&&(le=true),!(le||W.kind==="paragraph"));W=fb$1(_,W.id));return {...K,contentLocked:Y,...le?{struck:le}:{}}}function d(w,O,_){if(e.flushPendingInputAndLayout(),e.cellSelection())return null;let q=u(w,O,_);if(q&&q.kind!=="plan")return q;if(_!==void 0)return null;let K=zM({layout:e.layout(),selection:e.selection(),direction:w,shown:O,controlBeside:c,tracked:e.trackedAuthorOrNone()!==void 0}),U=q?.plan;return K||!U||U.ops.length===0?K:{kind:"remove",ops:U.ops,collapseTo:U.collapseTo}}function u(w,O,_){if(!e.layout().contentControls?.some(H=>H.placeholder))return null;let K=e.selection(),U=e.trackedAuthorOrNone()!==void 0,M=ce(t,K.head.paragraphId)??t.part(),Y={kind:"select",selection:K},ne=K.anchor.paragraphId!==K.head.paragraphId||K.anchor.offset!==K.head.offset,le=ne?Ov(M,K):null;if(le){let H=p(le,U,w);return H?{kind:"remove",...H}:Y}let se;if(ne)se=b();else {let H=_===void 0?O(K.head):K.head,G=_??H.offset+(w==="backward"?-1:1);if(G<0||G===H.offset||G>l(H.paragraphId).length)return null;let[D,B]=G<H.offset?[G,H.offset]:[H.offset,G],{paragraphId:Z}=H;se={ops:[{op:"deleteText",paragraphId:Z,start:D,end:B}],collapseTo:{paragraphId:Z,offset:D}};}let W=ZD(M,se,U);return W?W.kind==="refused"?Y:W.kind==="plan"?{kind:"remove",...W.plan}:f(W.prompt,w,U):ne?{kind:"plan",plan:se}:{kind:"plan"}}function f(w,O,_){let q={paragraphId:w.paragraphId,offset:w.start},K={paragraphId:w.paragraphId,offset:w.end},U=O==="backward";if(_&&w.struck){let Y=U?q:K;return {kind:"select",selection:{anchor:Y,head:Y}}}let M=_?p(w,true,O):null;return M?{kind:"remove",...M}:{kind:"select",selection:U?{anchor:K,head:q}:{anchor:q,head:K}}}function p(w,O,_){return _k(t.settingsRoot())?null:zD(w,O,_)}function g(){if(e.flushPendingInputAndLayout(),e.cellSelection()||!e.layout().contentControls?.some(K=>K.placeholder))return null;let w=e.selection(),{from:O,to:_}=i();if(O.paragraphId===_.paragraphId&&O.offset===_.offset)return null;let q=ce(t,w.head.paragraphId)??t.part();return XD(q,w,{from:O,to:_})}function y(){if(e.flushPendingInputAndLayout(),!e.layout().contentControls?.some(_=>_.placeholder))return false;let w=e.selection(),O=ce(t,w.head.paragraphId)??t.part();return Ov(O,w)!==null}function h(w){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let O=i();return O.from.paragraphId===O.to.paragraphId&&O.from.offset===O.to.offset?e.atParagraphEnd(w.paragraphId,w.offset):e.atParagraphEnd(O.to.paragraphId,O.to.offset)}function b(w){let O=w?.trim()||void 0,_=k(T(O!==void 0||e.trackedAuthorOrNone()!==void 0),!O&&e.editingMode()!=="suggest"),q=o(),K=null;return {..._,get replaceAt(){return K??=E(_,O,q),K}}}let v;function S(){let w=e.selection();if(w.anchor.paragraphId!==w.head.paragraphId||w.anchor.offset!==w.head.offset||!v)return false;let O=ce(t,w.head.paragraphId)??t.part();return Fo(O,w.head.paragraphId).some(_=>_.control.id===v&&_.start===w.head.offset&&!_.struck)}function x(){let{from:w,to:O}=i();if(o())return b();if(S())return {...b(),outsidePromptId:v};let _=ce(t,O.paragraphId)??t.part(),q=Fo(_,O.paragraphId).find(U=>O.offset>U.start&&O.offset<U.end);if(!q||q.locked||q.struck||w.paragraphId===O.paragraphId&&w.offset>=q.start)return b();let K=n;n={anchor:w,head:{...O,offset:q.start}};try{let U=b();return {...U,replaceAt:U.replaceAt??U.collapseTo,outsidePromptId:q.control.id}}finally{n=K;}}function k(w,O){if(!O||w.ops.length===0||o())return w;let{from:_,to:q}=i();if(_.paragraphId===q.paragraphId)return w;let K=ce(t,_.paragraphId)??t.part(),U=Rk(K,_,q,e.paragraphOrder());return U.length===0?w:{...w,ops:[...U,...w.ops]}}function T(w=e.trackedAuthorOrNone()!==void 0){e.flushPendingInputAndLayout();let O=o();if(O){let U=[];for(let M of ja$1(e.layout(),O.cellIds)){let Y=gf$1(e.layout(),M).length;Y>0&&U.push({op:"deleteText",paragraphId:M,start:0,end:Y});}return {ops:U,collapseTo:s()}}let _=r();if(_.anchor.paragraphId===_.head.paragraphId&&_.anchor.offset===_.head.offset)return {ops:[],collapseTo:Zb$2(e.layout(),_.head)};let{from:q,to:K}=i();return oA(e.layout(),t.partFor(e.storyScope())??t.part(),q,K,e.paragraphOrder(),e.revisionView(),w)}function R(){return b().ops}function C(w){let O=n;n=w;try{let _=b();return {ops:_.ops,replaceAt:_.replaceAt??_.collapseTo}}finally{n=O;}}function A(w,O,_){if(!(_!==void 0||e.editingMode()==="suggest")||w.paragraphId!==O.paragraphId||O.offset<=w.offset)return w.offset;let K=(_??e.author())?.trim();if(!K)return Zb$2(e.layout(),O).offset;let U=ce(t,O.paragraphId)??t.part(),M=eb$1(U,O.paragraphId);return !M||M.kind!=="paragraph"?Zb$2(e.layout(),O).offset:wp(M,w.offset,O.offset,K,e.trackedDate())}function E(w,O,_){let q=w.collapseTo;if(O===void 0&&e.editingMode()!=="suggest")return q;if(_){for(let Z of _.cellIds){let X=ia$1(e.layout(),[Z]),N=X.length>0?X:ja$1(e.layout(),[Z]);if(N.length===0)continue;let j=new Map,z=te=>{let me=j.get(te);return me===void 0&&(me=A({paragraphId:te,offset:0},{paragraphId:te,offset:l(te).length},O),j.set(te,me)),me},Q=(O??e.author())?.trim(),ue=te=>{let me=l(te);if(!Q)return /\S/.test(me);let Se=eb$1(ce(t,te)??t.part(),te);if(!Se||Se.kind!=="paragraph")return /\S/.test(me);let qe="",xe=0;for(let He of Hj$1(Se,0,me.length,Q))qe+=me.slice(xe,Math.max(xe,He.start)),xe=Math.max(xe,He.end);return qe+=me.slice(xe),/\S/.test(qe)},oe=null;for(let te=N.length-1;te>=0;te-=1){let me=N[te];if(ue(me)){oe=me;break}}if(oe===null)for(let te=N.length-1;te>=0;te-=1){let me=N[te];if(z(me)!==0){oe=me;break}}return oe??=N[N.length-1],{paragraphId:oe,offset:z(oe)}}return q}let{from:K,to:U}=i();if(K.paragraphId===U.paragraphId&&K.offset===U.offset)return q;if(K.paragraphId===U.paragraphId)return {paragraphId:U.paragraphId,offset:A(K,U,O)};let M=new Set(w.ops.flatMap(Z=>Z.op==="deleteBlock"?[Z.blockId]:[])),Y=ce(t,U.paragraphId)??t.part();if(M.size>0)for(let Z=fb$1(Y,U.paragraphId);Z;Z=fb$1(Y,Z.id)){if(!M.has(Z.id))continue;let X={paragraphId:q.paragraphId,offset:l(q.paragraphId).length};return {paragraphId:q.paragraphId,offset:A(q,X,O)}}let ne=(O??e.author())?.trim();if(!ne)return q;let le=new Set(w.ops.flatMap(Z=>Z.op==="joinParagraphs"?[Z.secondId]:[])),se=e.paragraphOrder(),W=se.indexOf(K.paragraphId),H=se.indexOf(U.paragraphId);if(W===-1||H===-1)return q;let G=Z=>{let X=eb$1(Y,Z);return X?.kind==="paragraph"&&Ln(X,ne)},D=H;for(;D>W&&le.has(se[D])&&G(se[D-1]);)D-=1;let B=0;for(let Z=D;Z<=H;Z+=1){let X=se[Z],N={paragraphId:X,offset:X===K.paragraphId?K.offset:0},j=X===U.paragraphId?Zb$2(e.layout(),U):{paragraphId:X,offset:l(X).length};Z===D&&(B+=N.offset),B+=j.offset-N.offset-P(N,j,ne);}return {paragraphId:se[D],offset:B}}function P(w,O,_){let q=_?.trim();if(!q||w.paragraphId!==O.paragraphId)return 0;let K=ce(t,O.paragraphId)??t.partFor(e.storyScope())??t.part(),U=eb$1(K,O.paragraphId);return !U||U.kind!=="paragraph"?0:Gj$1(U,w.offset,O.offset,q)}return {selectionMark:a,orderedRange:i,orderedStart:s,textOf:l,inlineControlBeside:c,atomicControlDeletion:d,selectionOverPrompts:g,promptIsSelected:y,splitEndsTheParagraph:h,deleteSelectionPlan:b,typingSelectionPlan:x,retainPromptBoundary:w=>{v=w;},clearPromptBoundary:()=>{v=void 0;},promptBoundary:()=>S()?v:void 0,deleteSelectionOps:R,deleteRangePlan:C,replacementOffset:A}}function D1(e){function t(n){if(e.promptIsSelected()||e.deleteSelection())return;let r=e.selection().head,o=n==="backward",a=(e.fieldBoundary()??Ve$2)(e.textOf(r.paragraphId),r.offset,o?-1:1,Ye(e.layout(),r.paragraphId));if(a===r.offset)return e.deleteCharacter(n);if(e.deleteAtomicControl(n,a))return;let[i,s]=o?[a,r.offset]:[r.offset,a];e.commitWord([{op:"deleteText",paragraphId:r.paragraphId,start:i,end:s}],o?{...r,offset:a}:void 0);}return {deleteWord:t}}function qc(e,t,n,r){if(r===n)return e;let o=a=>a.paragraphId===t?{...a,offset:c$2(a.offset,n,r)}:a;return {anchor:o(e.anchor),head:o(e.head)}}var H1=[24,16,12,8,6,4],zj=8;function N1(e,t,n,r,o){let a=r.textOf(e.paragraphId)??"",i=n.after.slice(0,zj);if(i&&a.slice(e.offset,e.offset+i.length)===i)return e;let s=new Set;for(let l of [e.paragraphId,t.paragraphId]){let c=o.indexOf(l);if(!(c<0))for(let d of [c,c-1,c+1])o[d]&&s.add(o[d]);}for(let l of H1){if(n.before.length<l)continue;let c=n.before.slice(-l);if(a.slice(Math.max(0,e.offset-l),e.offset)===c)return e;let d=null;for(let u of s){let f=r.textOf(u)??"";for(let p=f.indexOf(c);p>=0;p=f.indexOf(c,p+1)){if(d)return e;d={...e,paragraphId:u,offset:p+c.length};}}if(d)return d}return e}var Hp="stale",Zj=16;function _p(e,t){return e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}function _1(e){let t=null,n=false,r=a=>{let i=new Set(e.order());return a.filter(s=>i.has(s)).slice(0,Zj).map(s=>({id:s,text:e.textOf(s)??""}))};return {expectHistory(a){n=a;},note(a,i,s){let l=n;if(n=false,t!==null){l&&t!==Hp&&t.history.length===0&&(t={...t,history:r(i)});return}if(!s){t=Hp;return}let c=new Map;for(let u of [a.anchor.paragraphId,a.head.paragraphId]){let f=e.textOf(u);f!==null&&c.set(u,f);}let d=u=>{let f=c.get(u.paragraphId)??"",p=H1[0];return {before:f.slice(Math.max(0,u.offset-p),u.offset),after:f.slice(u.offset,u.offset+p)}};t={selection:a,before:c,order:e.order(),context:{anchor:d(a.anchor),head:d(a.head)},history:l?r(i):[]};},noteLocal(){t!==null&&(t=Hp);},discard(){t=null;},map(a){let i=o(a);return _p(i,a)?a:i}};function o(a){let i=t;if(t=null,!i)return a;let s=e.carried?.()??null,l=x=>s&&_p(s.from,x)&&_p(a,x)&&e.textOf(s.to.anchor.paragraphId)!==null&&e.textOf(s.to.head.paragraphId)!==null?s.to:null;if(i===Hp)return l(a)??a;let c=e.order(),d=new Set(c);for(let{id:x,text:k}of i.history){if(!d.has(x))continue;let T=e.textOf(x)??k;if(T===k)continue;let R=0;for(;R<k.length&&R<T.length&&k[R]===T[R];)R+=1;let C={paragraphId:x,offset:R+Math.max(0,T.length-k.length)};return {anchor:C,head:C}}let u=new Set(c),f=l(i.selection);if(f)return f;let p=new Set(i.order),g=x=>{let k=i.before.get(x.paragraphId),T=e.textOf(x.paragraphId);if(k===void 0||T===null||T.length>=k.length||!k.startsWith(T)||x.offset<=T.length)return null;let R=c[c.indexOf(x.paragraphId)+1];return R===void 0||p.has(R)||!(e.textOf(R)??"").startsWith(k.slice(T.length))?null:{paragraphId:R,offset:x.offset-T.length}},y=g(a.anchor),h=g(a.head),b=a;for(let[x,k]of i.before)u.has(x)&&(b=qc(b,x,k,e.textOf(x)??k));b={anchor:y??b.anchor,head:h??b.head};let v=x=>{if(u.has(x.paragraphId))return x;let k=i.order.indexOf(x.paragraphId),T=null;for(let A=k-1;A>=0&&T===null;A-=1)u.has(i.order[A])&&(T=i.order[A]);let R=i.before.get(x.paragraphId),C=T===null?"":e.textOf(T)??"";if(T!==null&&R!==void 0&&C.endsWith(R)){let A=C.length-R.length+x.offset;return {paragraphId:T,offset:A}}for(let A=k+1;k>=0&&A<i.order.length;A+=1){let E=i.order[A];if(u.has(E))return {paragraphId:E,offset:0}}return T===null?x:{paragraphId:T,offset:C.length}};return !(c.length!==i.order.length||c.some((x,k)=>x!==i.order[k]))||!_p(a,i.selection)?{anchor:v(b.anchor),head:v(b.head)}:{anchor:N1(v(b.anchor),a.anchor,i.context.anchor,e,c),head:N1(v(b.head),a.head,i.context.head,e,c)}}}function B1(e,t){let n=e?.historySelection?.()??null;return n&&t?Xj(n,t):null}function $1(e){let t=e?.remoteSelectionMove?.();if(!t)return null;let n=o=>({paragraphId:o.nodeId,offset:o.offset}),r=o=>({anchor:n(o.anchor),head:n(o.head)});return {from:r(t.from),to:r(t.to)}}function Xj(e,t){let n=a=>{let i=t.paragraphByStableId(a.paragraphId);return i?{paragraphId:i.nodeId,offset:Math.min(a.offset,i.text.length)}:null},r=n(e.anchor),o=n(e.head);return r&&o?{anchor:r,head:o}:null}function W1(e){return {atParagraphEnd(t,n){let r=Nm(e.partOf(t),t);return r!==null&&n===r.length},followerStyleId(t){let n=e.partOf(t),r=e.styleCascade();if(!r)return;let a=gi$1(n,t).find(l=>l.localName==="pStyle")?.attributes?.val??r.defaultParagraphStyleId;if(a==null)return;let i=r.styles.get(a)?.next;if(!i||i===a)return;let s=r.styles.get(i);if(!(!s||s.type!=="paragraph"))return i===r.defaultParagraphStyleId?null:i}}}var jv=4096;function q1(e){if(typeof e.defaultView?.createImageBitmap!="function")return null;let t=e.defaultView;return Object.freeze({async decode(n,r,o){let a=new Blob([new Uint8Array(n)],{type:r}),i;try{i=await t.createImageBitmap(a,{imageOrientation:"from-image"});}catch(s){if(s?.name!=="TypeError")throw s;i=await t.createImageBitmap(a);}try{let s=i.width,l=i.height;if(s<=0||l<=0)throw new Error("image dimensions invalid");if(s*l>o.maxPixels)throw new Error("image dimensions exceed limits");return Object.freeze({pixelWidth:s,pixelHeight:l,dpiX:96,dpiY:96})}finally{i.close();}},convertPreserved(n,r,o){return r==="image/tiff"?Jj(e,n,o):Yj(n,r)}})}async function Yj(e,t,n){let r=ce$1().metafile?.rasterize;if(!r)return Qj(e);let o=await r(e,t,{maxEdge:jv});return o?Object.freeze({bytes:o.bytes,mime:o.mime}):null}async function Qj(e){let{convertMetafileToDataUrl:t,getMetafileInfo:n}=await import('emf-converter'),r=new Uint8Array(e),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),a=await n(o),i=await t(o,{dpiScale:ae(Math.max(a?.width??0,a?.height??0)),maxWidth:jv,maxHeight:jv}),s="data:image/png;base64,";if(!i?.startsWith(s))return null;let l=atob(i.slice(s.length)),c=new Uint8Array(l.length);for(let d=0;d<l.length;d+=1)c[d]=l.charCodeAt(d);return Object.freeze({bytes:c,mime:"image/png"})}async function Jj(e,t,n){let r=await a$6(t,n);if(r===null)return null;let o=await eV(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function eV(e,t,n,r){let o=e.createElement("canvas");if(o.width=n,o.height=r,o.width!==n||o.height!==r)return null;let a=o.getContext("2d");if(!a)return null;let i=a.createImageData(n,r);i.data.set(t),a.putImageData(i,0,0);let s=await new Promise(l=>{o.toBlob(c=>l(c),"image/png");});return s?new Uint8Array(await s.arrayBuffer()):null}function K1(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function U1(e){return typeof URL.createObjectURL!="function"||typeof URL.revokeObjectURL!="function"?null:Object.freeze({create(t,n){let r=e.mintValidatedBytes(t,t.contentId);if(!r)throw new Error(`PaintImageUrlSource: validated bytes unavailable for ${t.resourceKey}`);let o=new Uint8Array(r);return URL.createObjectURL(new Blob([o],{type:n}))},revoke(t){URL.revokeObjectURL(t);}})}function j1(e,t){e.contentEditable=t?"true":"false",e.setAttribute("aria-readonly",t?"false":"true"),t?e.removeAttribute("tabindex"):e.tabIndex=0;}var tV="docx-editor-one-surface__caret",Vv="docx-editor-one-surface__caret--steady",nV=530;function V1(e,t,n){let r=e.ownerDocument.createElement("div");r.className=tV,r.dataset.docxCaret="",r.dataset.docxMarker="",r.setAttribute("contenteditable","false"),r.setAttribute("aria-hidden","true"),r.dataset.noColorInvert="",r.style.position="absolute",r.style.pointerEvents="none",r.style.userSelect="none",r.style.setProperty("-webkit-user-select","none");let o=false,a=rt(()=>e),i=null,s=null,l=null;function c(){let v=e.ownerDocument.activeElement;return v===e||!!v&&e.contains(v)}function d(v){return v.anchor.paragraphId===v.head.paragraphId&&v.anchor.offset===v.head.offset}function u(){s=null,i!==null&&(a.clearTimeout(i),i=null),r.classList.remove(Vv),r.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function f(){r.classList.add(Vv),i!==null&&a.clearTimeout(i),i=a.setTimeout(()=>{i=null,r.classList.remove(Vv);},nV);}function p(){if(o||!c()||n().suppress){u();return}let{layout:v,selection:S,scopedHost:x,scopedHostKind:k,scopedOrigin:T,preferredPageIndex:R,preferredLineId:C,measurer:A,typingStyle:E}=n(),P=t();if(!d(S)){u();return}let w=df$1(v,S.head,{...A?{measurer:A}:{},...R!==void 0?{preferredPageIndex:R}:{},...C!==void 0?{preferredLineId:C}:{}});if(!w||!Number.isInteger(w.pageIndex)){u();return}if(E&&A){let{pageIndex:U,lineId:M}=w,Y=Wb$1(v,S.head.paragraphId)?.find(le=>le.pageIndex===U&&le.line.id===M),ne=Y?.line;if(ne&&!ne.drawings?.length&&!He(w)&&(ne.spans.length>0||ne.box.height>0)){let le=E();if(le){let se={...ap(v,S)??la$2,...le},W=A.lineMetrics(se);if(W.height>0){let H=wc$1({...w,width:0,y:ne.spans.length>0?ne.box.y+ne.baseline-W.baseline-qa(se):w.y,height:W.height},Y?.clipBox);if(!H){u();return}w=H;}}}}let O=x??e.querySelector(`[data-page-index="${w.pageIndex}"] > .docx-page-content`);if(!O){u();return}if(!(w.height>0)){u();return}r.style.left=`${(w.x-(T?.x??0))*P}px`,r.style.top=`${(w.y-(T?.y??0))*P}px`,r.style.height=`${w.height*P}px`;let _=He(w);r.style.transformOrigin=_?"0 0":"",r.style.transform=_?"rotate(-90deg)":"",r.parentNode!==O&&O.append(r),e.style.caretColor="transparent",l&&l!==x&&l.style.removeProperty("caret-color"),l=x??null,l?.style.setProperty("caret-color","transparent");let q=O===x?k??"scoped":"body",K=`${w.pageIndex}:${q}:${w.x}:${w.y}:${w.height}`;K!==s&&(s=K,f());}let g=()=>{o=true,p();},y=()=>{o=false,p();},h=()=>p(),b=v=>{let S=v.relatedTarget;S&&e.contains(S)||u();};return e.addEventListener("compositionstart",g),e.addEventListener("compositionend",y),e.addEventListener("focusin",h),e.addEventListener("focusout",b),{update:p,destroy(){e.removeEventListener("compositionstart",g),e.removeEventListener("compositionend",y),e.removeEventListener("focusin",h),e.removeEventListener("focusout",b),u();}}}function Gv(e,t){for(let n of e)if(n.kind==="table"){t(n);for(let r of n.rows)for(let o of r.cells)Gv(o.blocks,t);}}function rV(e,t){for(let n of e.pages){let r=o=>{for(let a=0;a<o.rows.length;a+=1)t({table:o,row:o.rows[a],rowIndex:a});};Gv(n.fragments,r);for(let o of [n.header,n.footer])o&&Gv(o.fragments,r);}}function zv(e,t,n,r){let o=null;return rV(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Zv(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function G1(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function z1(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function Z1(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var aV=120,X1=20;function Bp(e){return Qd(Gl$1(e,"w"))??0}function iV(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Xv(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function Yv(e,t){return t.kind==="insertColumn"?zv(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?zv(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function Y1(e){return Math.min(160,e)}function Q1(e){let t=e.furnitureLayer;t.className="docx-table-furniture",t.setAttribute("contenteditable","false"),t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.pointerEvents="none";let n=rt(()=>t),r=null,o=null,a=null,i=null,s=null,l=null,c=false,d=0,u=0,f=null,p=null,g=null;function y(N){return zu(N,"button")&&(N.classList.contains("docx-table-insert-row")||N.classList.contains("docx-table-insert-column"))}function h(){let N=t.ownerDocument.activeElement;return N!==null&&y(N)&&N.closest(".docx-table-furniture")===t?N:null}function b(N){for(let j of [...t.children])y(j)&&j!==N&&j.remove();}function v(){p=null,g=null;}function S(){r!==null&&(n.clearTimeout(r),r=null);}function x(){for(let j of [...t.children])y(j)||j.remove();let N=h();if(!N){b(null),v();return}p=N,b(N);}function k(N){let j=p??h(),z=j!==null&&t.ownerDocument.activeElement===j;v(),t.replaceChildren(),N&&z&&e.pagesLayer.focus({preventScroll:true});}function T(){for(let N of [...t.children])y(N)||N.remove();}function R(N,j,z,Q){let oe=e.read().layout.pages[N];if(!oe)return {left:0,top:0};let te=Q??oe.contentBox,me=e.scale(),Se=e.pageOffsetX(N);return {left:(te.x+j+Se)*me,top:(te.y+z)*me}}function C(N,j){let z=e.read(),Q=Nc(z.layout,j.tableId,j.pageIndex);if(!Q)return;let{table:ue,origin:oe}=Q,te=t.ownerDocument.createElement("div");te.className="docx-table-resize-preview",te.style.position="absolute",te.style.pointerEvents="none";let me=j.kind!=="rowDivider",Se=R(j.pageIndex,me?ue.box.x+N:ue.box.x,me?ue.box.y:ue.box.y+N,oe);te.style.left=`${Se.left}px`,te.style.top=`${Se.top}px`,te.style.width=me?"2px":`${ue.box.width*e.scale()}px`,te.style.height=me?`${ue.box.height*e.scale()}px`:"2px",t.append(te);}function A(){let N=t.ownerDocument.createElement("button");return N.type="button",N.textContent="+",N.style.position="absolute",N.style.pointerEvents="auto",N}function E(N){_(N);let j=g;if(!j)return;let z=e.read();j.kind==="insertRow"?K(j,z):j.kind==="insertColumn"&&U(j,z);}function P(){queueMicrotask(()=>{!p||t.ownerDocument.activeElement===p||c||o?.kind==="insertRow"||o?.kind==="insertColumn"||(p.remove(),v());});}function w(){if(p&&t.contains(p))return p;let N=h();if(N)return p=N,N;let j=A();return j.addEventListener("pointerenter",()=>{c=true,S();}),j.addEventListener("pointerleave",()=>{c=false;}),j.addEventListener("pointerdown",_),j.addEventListener("mousedown",_),j.addEventListener("click",E),j.addEventListener("blur",P),p=j,j}function O(N,j){let z=Nc(j.layout,N.tableId,N.pageIndex);if(!z)return;let{table:Q,origin:ue}=z,oe=w();if(b(oe),g=N,oe.dataset.tableId=N.tableId,N.kind==="insertRow"){let te=Q.rows.find(qe=>qe.id===N.rowId);if(!te)return;oe.dataset.rowId=N.rowId,delete oe.dataset.gridColumnId,oe.className="docx-table-insert-row",oe.setAttribute("aria-label",e.label("table.insertRowBelow"));let me=te.box.y+te.box.height/2,Se=R(N.pageIndex,Q.box.x-14,me,ue);oe.style.left=`${Se.left}px`,oe.style.top=`${Se.top-8}px`;}else {let te=Q.rows[0]?.cells.find(xe=>xe.gridColumnId===N.gridColumnId);if(!te)return;oe.dataset.gridColumnId=N.gridColumnId,delete oe.dataset.rowId;let me=Q.columnEdges[te.gridColumn]??0,Se=Q.columnEdges[te.gridColumn+1]??Q.box.width;oe.className="docx-table-insert-column",oe.setAttribute("aria-label",e.label("table.insertColumnRight"));let qe=R(N.pageIndex,Q.box.x+(me+Se)/2-8,Q.box.y-14,ue);oe.style.left=`${qe.left}px`,oe.style.top=`${qe.top}px`;}t.contains(oe)||t.append(oe);}function _(N){N.preventDefault(),N.stopPropagation();}function q(N,j){if(T(),b(p??h()),!(l||j.editingMode==="view")){if((N.kind==="columnDivider"||N.kind==="rightEdge")&&!N.isHeaderRepeat){let z=Nc(j.layout,N.tableId,N.pageIndex);if(!z)return;let{table:Q,origin:ue}=z,oe=t.ownerDocument.createElement("div");oe.className=N.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",oe.style.position="absolute",oe.style.pointerEvents="auto",oe.style.cursor="col-resize",oe.dataset.active="true";let te=R(N.pageIndex,Q.box.x+N.edgeX,Q.box.y,ue);oe.style.left=`${te.left-3}px`,oe.style.top=`${te.top}px`,oe.style.width="6px",oe.style.height=`${Q.box.height*e.scale()}px`,oe.addEventListener("pointerdown",M),t.append(oe);}if(N.kind==="rowDivider"&&!N.isHeaderRepeat){let z=Nc(j.layout,N.tableId,N.pageIndex);if(!z)return;let{table:Q,origin:ue}=z,oe=t.ownerDocument.createElement("div");oe.className="docx-table-row-divider-handle layout-table-row-resize-handle",oe.style.position="absolute",oe.style.pointerEvents="auto",oe.style.cursor="row-resize",oe.dataset.active="true";let te=R(N.pageIndex,Q.box.x,Q.box.y+N.edgeY,ue);oe.style.left=`${te.left}px`,oe.style.top=`${te.top-3}px`,oe.style.width=`${Q.box.width*e.scale()}px`,oe.style.height="6px",oe.addEventListener("pointerdown",M),t.append(oe);}N.kind==="insertRow"&&!N.isHeaderRepeat&&O(N,j),N.kind==="insertColumn"&&!N.isHeaderRepeat&&O(N,j);}}function K(N,j){let z=Yv(j.layout,N);if(!z)return;let Q=Xv(j),ue=Rr({command:{type:"insertRow",where:"below",target:Zv(N.sourceRevision,z)},part:Lo(e.session(),N.tableId),layout:j.layout,storeRevision:j.storeRevision,selection:j.selection,cellSelection:j.cellSelection,themeColors:j.themeColors,...Q});e.applyTableCommandPlan(ue);}function U(N,j){let z=Yv(j.layout,N);if(!z)return;let Q=z.row.cells.find(me=>me.gridColumnId===N.gridColumnId);if(!Q)return;let ue=G1(N.sourceRevision,z,Q);if(!ue)return;let oe=Xv(j),te=Rr({command:{type:"insertColumn",where:"right",target:ue},part:Lo(e.session(),N.tableId),layout:j.layout,storeRevision:j.storeRevision,selection:j.selection,cellSelection:j.cellSelection,themeColors:j.themeColors,...oe});e.applyTableCommandPlan(te);}function M(N){if(N.button!==0)return;let j=e.read();if(j.editingMode==="view"||!o||o.kind!=="columnDivider"&&o.kind!=="rightEdge"&&o.kind!=="rowDivider")return;N.preventDefault(),N.stopPropagation();let z=o,Q=Yv(j.layout,z);if(!Q)return;let ue=Tm(Lo(e.session(),z.tableId).root,z.tableId);if(!ue.ok||z.kind!=="rowDivider"&&Vm(ue.topology)!==null)return;let oe=0,te=0,me=0,Se=ue.topology.gridColumns.reduce((He,$e)=>He+Bp($e),0),qe;if(z.kind==="columnDivider"){let He=ue.topology.gridColumns.find(Je=>Je.id===z.leftGridColumnId),$e=ue.topology.gridColumns.find(Je=>Je.id===z.rightGridColumnId);if(!He||!$e)return;oe=Bp(He),te=Bp($e),qe=z1(z.sourceRevision,Q,z.leftGridColumnId,z.rightGridColumnId);}else if(z.kind==="rightEdge"){let He=ue.topology.gridColumns.find($e=>$e.id===z.gridColumnId);if(!He)return;oe=Bp(He),te=0,qe=Z1(z.sourceRevision,Q,z.gridColumnId);}else me=Math.max(20,Math.round(Q.row.box.height*X1)),qe=Zv(z.sourceRevision,Q);let xe=N.currentTarget;xe.setPointerCapture(N.pointerId),d=N.clientX,u=N.clientY,l={pointerId:N.pointerId,startClientX:N.clientX,startClientY:N.clientY,startEdgePt:z.kind==="rowDivider"?z.edgeY:z.edgeX,leftTwips:oe,rightTwips:te,tableWidthTwips:Se,rowHeightTwips:me,target:z,ref:Q,resizeTarget:qe,captureElement:xe,rightEdge:z.kind==="rightEdge",vertical:z.kind==="rowDivider",cancelled:false};for(let He of [...t.children])He!==xe&&He.remove();C(z.kind==="rowDivider"?z.edgeY:z.edgeX,z);}function Y(){if(l){try{l.captureElement.hasPointerCapture(l.pointerId)&&l.captureElement.releasePointerCapture(l.pointerId);}catch{}l.cancelled=true,l=null,x(),o=null;}}function ne(){if(!l||l.cancelled){l=null,x();return}let N=l;l=null;try{N.captureElement.hasPointerCapture(N.pointerId)&&N.captureElement.releasePointerCapture(N.pointerId);}catch{}if(N.vertical?u===N.startClientY:d===N.startClientX){x();return}let j=e.read(),z=Xv(j),Q=(N.vertical?u-N.startClientY:d-N.startClientX)/e.scale(),ue=Math.round(Q*X1),oe;if(N.target.kind==="rowDivider")oe=RE({part:Lo(e.session(),N.target.tableId),layout:j.layout,storeRevision:j.storeRevision,selection:j.selection,cellSelection:j.cellSelection,themeColors:j.themeColors,...z},N.resizeTarget,Math.max(Y1(N.rowHeightTwips),N.rowHeightTwips+ue));else if(N.rightEdge&&N.target.kind==="rightEdge"){let te=Math.max(300,N.leftTwips+ue),me=Math.max(te,N.tableWidthTwips+ue);oe=Rr({command:{type:"commitTableRightEdgeResize",target:N.resizeTarget,columnWidthTwips:te,tableWidthTwips:me},part:Lo(e.session(),N.target.tableId),layout:j.layout,storeRevision:j.storeRevision,selection:j.selection,cellSelection:j.cellSelection,themeColors:j.themeColors,...z});}else if(N.target.kind==="columnDivider"){let te=N.leftTwips+ue,me=N.rightTwips-ue;te=Math.max(300,te),me=Math.max(300,me);let Se=N.leftTwips+N.rightTwips;te+me!==Se&&(te>Se-300?(te=Se-300,me=300):me=Se-te),oe=Rr({command:{type:"commitTableColumnDividerResize",target:N.resizeTarget,leftWidthTwips:te,rightWidthTwips:me},part:Lo(e.session(),N.target.tableId),layout:j.layout,storeRevision:j.storeRevision,selection:j.selection,cellSelection:j.cellSelection,themeColors:j.themeColors,...z});}else {x();return}e.applyTableCommandPlan(oe),x();}function le(N){if(!f)return null;a??=Sf$2(N.layout);let j=e.pageOffsetX(f.pageIndex);return Wf$1(a,f.x,f.y,N.layout,j,f.pageIndex)}function se(N){if(!o||l||N.editingMode==="view")return;S();let j=le(N),z=Rv(e.session(),j,N.selection.head.paragraphId);if(!z){o=null,x();return}if(Uf$1(z)!==Uf$1(o)){o=null,x();return}o=z,q(z,N);}function W(){let N=p??h(),j=N!==null&&t.ownerDocument.activeElement===N;v(),N&&t.contains(N)&&N.remove(),j&&e.pagesLayer.focus({preventScroll:true});}function H(N){if(l||N.editingMode==="view")return;let j=p??h();if(!j||!t.contains(j)){g&&v();return}if(p=j,!g||g.kind!=="insertRow"&&g.kind!=="insertColumn")return;a??=Sf$2(N.layout);let z=Uf$1(g),Q=Vf$1(a,g);if(!Q||Uf$1(Q)!==z){W();return}g=Q,O(Q,N);}function G(N){let j=e.read();if(l&&N.pointerId===l.pointerId){d=N.clientX,u=N.clientY;let me=(l.vertical?N.clientY-l.startClientY:N.clientX-l.startClientX)/e.scale();l.target.kind==="rowDivider"&&(me=Math.max(me,(Y1(l.rowHeightTwips)-l.rowHeightTwips)/20));for(let Se of [...t.children])Se!==l.captureElement&&Se.remove();C(l.startEdgePt+me,l.target);return}if(j.editingMode==="view"){k(false);return}if(Ro(N.target)&&p?.contains(N.target)){S();return}let z=iV(e,N.clientX,N.clientY),Q=Je(j.layout,z.y);Q>=0&&(f={x:z.x,y:z.y,pageIndex:Q});let ue=Q>=0?e.pageOffsetX(Q):0;a??=Sf$2(j.layout);let oe=a?Wf$1(a,z.x,z.y,j.layout,ue,Q>=0?Q:void 0):null,te=Rv(e.session(),oe,j.selection.head.paragraphId);if(!te){if(c)return;n.migrate(),!r&&o&&(r=n.setTimeout(()=>{r=null,o=null,x();},aV));return}r&&(n.clearTimeout(r),r=null),!(o&&Tf$1(te)===Tf$1(o))&&(o=te,q(te,j));}function D(N){if(!(!l||N.pointerId!==l.pointerId)){if(e.read().editingMode==="view"){Y();return}ne();}}function B(N){!l||N.pointerId!==l.pointerId||Y();}function Z(N){N.key!=="Escape"||!l||Y();}e.pagesLayer.addEventListener("pointermove",G);let X=[e.listeners.onDocument("pointermove",G),e.listeners.onDocument("pointerup",D),e.listeners.onDocument("pointercancel",B)];return e.pagesLayer.addEventListener("keydown",Z),{update(){let N=e.read(),j=i,z=s;a=null,i=N.layout.revision,s=N.storeRevision,N.editingMode==="view"?(Y(),o=null,S(),k(true)):j!==null&&(j!==N.layout.revision||z!==N.storeRevision)&&(o!==null&&se(N),H(N)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},cancelDrag:Y,refreshLabels(){let N=e.read();if(N.editingMode==="view")return;let j=p??h();if(j&&t.contains(j)&&g&&(g.kind==="insertRow"||g.kind==="insertColumn")){O(g,N);return}o&&(o.kind==="insertRow"||o.kind==="insertColumn")&&O(o,N);},destroy(){S(),Y(),v(),x(),e.pagesLayer.removeEventListener("pointermove",G);for(let N of X)N();e.pagesLayer.removeEventListener("keydown",Z),t.remove();}}}var $p={},J1=new WeakMap;function sV(e,t){let n=J1.get(e??$p);n||J1.set(e??$p,n=new WeakMap);let r=n.get(t??$p);return r||(r=zf$1(e,void 0,t),n.set(t??$p,r)),r}function eN(e,t,n=null){return Af$1(sV(t,n),ei$1(e,"paragraphProperties","pPr")).markRunProperties}var lV=e=>e==="left"||e==="center"||e==="right"||e==="both";function tN(e,t){if(!t.some(r=>r.localName==="bidi"))return e;let n=e.map(r=>r.localName).lastIndexOf("bidi");return n===-1?e:e.filter((r,o)=>o!==n)}function Wp(e,t,n,r=n){let o=()=>Kf$1([...t,...n]);if(e.paragraphDirection!==void 0&&e.localName==="bidi"){let i=e.paragraphDirection==="rtl";return o()===i?null:i?Kf$1(tN(t,r))?{localName:"bidi",remove:true}:{localName:"bidi"}:Kf$1(tN(t,r))?{localName:"bidi",attributes:{val:"0"}}:{localName:"bidi",remove:true}}let a=e.attributes?.val;return !e.physicalAlignment||e.localName!=="jc"||!lV(a)?e:{localName:"jc",attributes:{val:Rd(a,o())}}}function nN(e){let{runPropertyEdits:t,mergedParagraphMarkProperties:n}=c$1(()=>e.session.stylesRoot(),()=>e.session.settingsRoot(),()=>e.displayMode(),()=>e.authorFilter()),{session:r,commit:o,orderedRange:a,selectionMark:i,textOf:s}=e,l=()=>e.displayMode(),c=()=>e.authorFilter(),d=()=>r.partFor(e.storyScope())??r.part(),u=C=>{let{anchor:A,head:E}=C;if(A.paragraphId!==E.paragraphId||A.offset!==E.offset)return {selection:C,caretSpan:true};let P=eb$1(d(),E.paragraphId);if(P?.kind!=="paragraph")return {selection:C,caretSpan:true};let w=zi(P,E.offset)!==void 0,O=w?Bi(P,E.offset):si$1(P,E.offset);if(O===void 0)return {selection:C,caretSpan:!w};if(O===null&&w){let q=eN(P,r.stylesRoot(),r.settingsRoot());return {selection:C,caretSpan:false,markFace:q}}if(O===null)return {selection:C,caretSpan:false};let _=O.end<=E.offset?O.end-1:O.start;return {selection:{anchor:{paragraphId:E.paragraphId,offset:_},head:{paragraphId:E.paragraphId,offset:_+1}},caretSpan:true}},f=C=>{let A=C?.ascii;return !A||C.hAnsi!==A||Object.keys(C).length!==2?C:qe(A)?{...C,eastAsia:A}:C},p=(C,A,E)=>{let P=w=>r.applyTreeOps(w,A,E,e.storyScope());return e.applyOutsideToc?e.applyOutsideToc(C,P):P(C)},g=()=>{let C=e.runFormatRefusal?.();return C?e.commit(()=>({committed:false,rejected:true,opCount:0,reason:C}))??C:null},y={get value(){return e.layout()}},h={get value(){return e.selection()}},b=(C,A,E)=>{let P=d();if(C.paragraphId===A.paragraphId){let K=t(P,C.paragraphId,C.offset,A.offset,E,l(),c());if(K.length===0)return null;let U=n(P,C.paragraphId,E);return o(()=>p([...K.map(M=>({op:"setRunProperties",paragraphId:C.paragraphId,start:M.start,end:M.end,properties:M.properties,...M.targetRunIds?{targetRunIds:M.targetRunIds}:{}})),...e.paragraphMarkVisible(C.paragraphId)?wA(s(C.paragraphId),C,A,U):[]],i()))}let w=e.paragraphOrder(),O=w.indexOf(C.paragraphId),_=w.indexOf(A.paragraphId);if(O===-1||_===-1)return null;let q=[];for(let K=O;K<=_;K+=1){let U=w[K],M=s(U),Y=K===O?C.offset:0,ne=K===_?A.offset:M.length,le=Y<ne?t(P,U,Y,ne,E,l(),c()):[];for(let W of le)q.push({op:"setRunProperties",paragraphId:U,start:W.start,end:W.end,properties:W.properties,...W.targetRunIds?{targetRunIds:W.targetRunIds}:{}});(K<_||Y===0&&ne===M.length&&M.length>0)&&e.paragraphMarkVisible(U)&&q.push({op:"setParagraphMarkProperties",paragraphId:U,properties:n(P,U,E)});}return q.length===0?null:o(()=>p(q,i()))},v=(C,A)=>{let E=d(),P=[];for(let w of ja$1(y.value,C)){let O=s(w);for(let _ of t(E,w,0,O.length,A,l(),c()))P.push({op:"setRunProperties",paragraphId:w,start:_.start,end:_.end,properties:_.properties,..._.targetRunIds?{targetRunIds:_.targetRunIds}:{}});e.paragraphMarkVisible(w)&&P.push({op:"setParagraphMarkProperties",paragraphId:w,properties:n(E,w,A)});}return P.length===0?null:o(()=>p(P,i()),void 0,{keepCellSelection:true})},S=C=>{di$1(C.localName)&&e.setPendingFormats(ii$1(e.pendingFormats()??[],C));},x=(C,A)=>C.paragraphId===A.paragraphId&&C.offset===A.offset&&s(C.paragraphId).length===0&&e.paragraphMarkVisible(C.paragraphId)&&!e.pendingFormats()?.length?C.paragraphId:null,k=(C,A)=>{let E=d(),P=n(E,C,A);return JSON.stringify(P)===JSON.stringify(hi$1(E,C))?null:o(()=>p([{op:"setParagraphMarkProperties",paragraphId:C,properties:P}],i()))},T=(C,A)=>{if(C.paragraphId!==A.paragraphId||C.offset!==A.offset||e.pendingFormats()?.length)return null;let E=Hf(d(),C.paragraphId,s(C.paragraphId).length,l(),c()),P=yb(y.value,C.paragraphId,C.offset,E);return P?{from:{paragraphId:C.paragraphId,offset:P.start},to:{paragraphId:C.paragraphId,offset:P.end}}:null},R=C=>{if(C.length===0)return;let A=e.selectedCells?.(),E=A&&A.length>0?[...ja$1(y.value,A)]:null,{from:P,to:w}=a(),O=E??e.paragraphOrder(),_=E?0:O.indexOf(P.paragraphId),q=E?O.length-1:O.indexOf(w.paragraphId);if(_===-1||q===-1)return;let K=d(),U=O.slice(_,q+1).filter(M=>e.paragraphMarkVisible(M)).flatMap(M=>{let Y=gi$1(K,M),ne=Y,le=Gn(y.value,M),se=false;for(let W of C){let H=Wp(W,le,ne,Y);if(!H)continue;if(se=true,H.remove){ne=ne.filter(B=>B.localName!==H.localName);continue}let G=H.mergeAttributes?{...ne.find(B=>B.localName===H.localName)?.attributes??{},...H.attributes}:H.attributes??{},D=Object.fromEntries(Object.entries(G).filter(([,B])=>B!=null));ne=ii$1(ne,{localName:H.localName,...Object.keys(D).length>0?{attributes:D}:{}});}return se?[{op:"setParagraphProperties",paragraphId:M,properties:ne}]:[]});U.length!==0&&o(()=>p(U,i()),void 0,{keepCellSelection:E!==null});};return {setRunProperty(C,A){let E=g();if(E)return E;let P=C==="rFonts"?f(A):A,w={localName:C,...P?{attributes:P}:{}},O=e.selectedCells?.();if(O&&O.length>0)return v(O,w);let{from:_,to:q}=a(),K=x(_,q);if(K)return k(K,w);let U=C==="highlight"?null:T(_,q);return U?b(U.from,U.to,w):_.paragraphId===q.paragraphId&&_.offset===q.offset?(S(w),null):b(_,q,w)},setParagraphProperty(C,A,E){R([{localName:C,...A?{attributes:A}:{},...E??{}}]);},setParagraphProperties:R,formatting:()=>{let C=u(h.value);return vA(SA(y.value,C.selection,(A,E)=>{let P=r.effectiveRunDefaults(A,E);if(P.fontFamily!==null)return P;let w=e.defaultFontFamily?.()??null;return w===null?P:{...P,fontFamily:w}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,h.value.anchor.paragraphId===h.value.head.paragraphId?[h.value.head.paragraphId]:e.paragraphOrder(),e.defaultFontFamily?.()??null,C.caretSpan),ii$1(C.markFace??[],e.pendingFormats()??[]))},toggleRunProperty(C,A){let E=g();if(E)return E;let P=e.selectedCells?.(),w=A?.val,O=u(h.value),{from:_,to:q}=a(),K=P&&P.length>0?null:T(_,q),U=O.caretSpan?xA(y.value,O.selection,C,P,w,e.paragraphOrder()):ci(O.markFace??null,C,w)===true,M=ci(e.pendingFormats(),C,w)??U,Y=M?{localName:C,attributes:{val:cV[C]??"0"}}:{localName:C,...A?{attributes:A}:{}};if(P&&P.length>0)return v(P,Y);let ne=x(_,q);if(ne)return k(ne,Y);if(K)return b(K.from,K.to,Y);if(_.paragraphId===q.paragraphId&&_.offset===q.offset){let le=e.pendingFormats()??[];if(!M===U){let se=le.filter(W=>W.localName!==C);e.setPendingFormats(se.length>0?se:null);}else S(Y);return null}return b(_,q,Y)},clearFormatting(){if(g())return;e.setPendingFormats(null);let C=y.value,A=e.paragraphOrder(),E=e.selectedCells?.(),P=E&&E.length>0?[...ja$1(C,E)]:op(A,a());if(P.length===0)return;let w=E!==void 0&&E.length>0,O=a(),{from:_,to:q}=!w&&T(O.from,O.to)||O,K=d(),U=[];for(let M of P){let Y=s(M),ne=w||M!==_.paragraphId?0:_.offset,le=w||M!==q.paragraphId?Y.length:q.offset;for(let H of vi$1(K,M,ne,le,l(),c()))bA(K,M,H.start,H.end,l(),c())&&U.push({op:"setRunProperties",paragraphId:M,start:H.start,end:H.end,properties:[]});e.paragraphMarkVisible(M)&&hi$1(K,M).length>0&&U.push({op:"setParagraphMarkProperties",paragraphId:M,properties:[]});let se=gi$1(K,M),W=se.filter(H=>H.localName==="bidi");e.paragraphMarkVisible(M)&&se.length>W.length&&U.push({op:"setParagraphProperties",paragraphId:M,properties:W});}U.length!==0&&o(()=>p(U,i()),void 0,{keepCellSelection:w});}}}var cV={u:"none",vertAlign:"baseline"};var rN=500;function dV(e){let t=l=>({val:l?"1":"0"}),n=l=>String(Math.max(2,Math.min(3276,Math.round(l*2)))),r=e.latinLane??e,o=e.complexLane??e,a=n(r.fontSizePt),i=[{localName:"b",attributes:t(r.bold)},{localName:"i",attributes:t(r.italic)},{localName:"bCs",attributes:t(o.bold)},{localName:"iCs",attributes:t(o.italic)},{localName:"u",attributes:{val:e.underline?e.underline.variant:"none",color:e.underline?.color??"auto",themeColor:"none"}},{localName:"strike",attributes:t(e.strike)},{localName:"dstrike",attributes:t(e.doubleStrike)},{localName:"caps",attributes:t(e.caps)},{localName:"smallCaps",attributes:t(e.smallCaps)},{localName:"vertAlign",attributes:{val:e.verticalAlign}},{localName:"color",attributes:{val:e.color??"auto"}},{localName:"highlight",attributes:{val:e.highlight??"none"}},{localName:"sz",attributes:{val:a}},{localName:"szCs",attributes:{val:n(o.fontSizePt)}},{localName:"spacing",attributes:{val:String(Math.round(e.characterSpacingPt*20))}},{localName:"position",attributes:{val:String(Math.round(e.baselineShiftPt*2))}},{localName:"w",attributes:{val:String(Math.round(e.horizontalScalePercent))}},{localName:"kern",attributes:{val:String(Math.round(e.kerningMinPt*2))}}],s=e.complexLane?.fontFamily??null;return (r.fontFamily||r.fontFamilyEastAsia||s)&&i.push({localName:"rFonts",attributes:{...r.fontFamily?{ascii:r.fontFamily,hAnsi:r.fontFamily}:{},...r.fontFamilyEastAsia?{eastAsia:r.fontFamilyEastAsia}:{},...s?{cs:s}:{}}}),i}function oN(e){let{runPropertyEdits:t,mergedParagraphMarkProperties:n}=c$1(()=>e.session.stylesRoot(),()=>e.session.settingsRoot(),()=>e.displayMode(),()=>e.authorFilter()),r=e.session,o=()=>r.partFor(e.storyScope())??r.part(),a="off",i=null,s=null,l=null,c=vf,d=()=>{let v=i===null?"none":i.paragraphProperties?"paragraph":"run";return (c.mode!==a||c.level!==v)&&(c={mode:a,level:v}),c},u=(v,S,x)=>{if(x||v.paragraphId!==S.paragraphId||v.offset===S.offset)return true;let k=e.textOf(v.paragraphId);return v.offset===0&&S.offset===k.length&&k.length>0},f=()=>{let v=e.selectedCells?.(),S=v!==void 0&&v.length>0,{from:x,to:k}=e.orderedRange();if(!e.paragraphOrder().includes(x.paragraphId))return false;let T=ap(e.layout(),e.selection(),v,e.paragraphOrder()),R=u(x,k,S)?gi$1(o(),x.paragraphId):null;return !T&&R===null?false:(i={runProperties:T?dV(T):[],paragraphProperties:R},true)},p=()=>f()?(e.publish(),true):false,g=()=>{let v=i;if(!v)return {wrote:false,armed:false,built:false};let S=e.selectedCells?.(),x=S!==void 0&&S.length>0,{from:k,to:T}=e.orderedRange(),R=!x&&k.paragraphId===T.paragraphId&&k.offset===T.offset,C=R?Jf(e.layout(),k,Ze$2(e.layout(),k.paragraphId),"after",gb(e.layout(),k.paragraphId,Hf(o(),k.paragraphId,e.textOf(k.paragraphId).length,e.displayMode(),e.authorFilter()))):null,A=C?.from??k,E=C?.to??T,P=R&&A.offset===E.offset,w=x?[...ja$1(e.layout(),S)]:op(e.paragraphOrder(),{from:A,to:E});if(w.length===0)return {wrote:false,armed:false,built:false};let O=o(),_=e.displayMode(),q=[];for(let Y of w){let ne=e.textOf(Y),le=x||Y!==A.paragraphId?0:A.offset,se=x||Y!==E.paragraphId?ne.length:E.offset;if(le<se&&v.runProperties.length>0)for(let G of t(O,Y,le,se,v.runProperties,_,e.authorFilter()))q.push({op:"setRunProperties",paragraphId:Y,start:G.start,end:G.end,properties:G.properties,...G.targetRunIds?{targetRunIds:G.targetRunIds}:{}});let W=v.paragraphProperties!==null||x||Y!==E.paragraphId||le===0&&se===ne.length&&ne.length>0,H=e.paragraphMarkVisible(Y);W&&H&&v.runProperties.length>0&&q.push({op:"setParagraphMarkProperties",paragraphId:Y,properties:n(O,Y,v.runProperties)}),v.paragraphProperties&&H&&q.push({op:"setParagraphProperties",paragraphId:Y,properties:[...v.paragraphProperties]});}let K=r.packageRevision();q.length>0&&e.commit(()=>r.applyTreeOps(q,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:x});let U=r.packageRevision()!==K,M=P&&v.runProperties.length>0&&(U||q.length===0);return M&&e.armPendingFormats(v.runProperties),{wrote:U,armed:M,built:q.length>0}},y=()=>{let v=g();return v.wrote&&a==="once"&&b(),v.wrote?"painted":v.armed?"armed":v.built?"refused":"nothingToPaint"},h=()=>{a!=="off"&&(a="off",e.publish());},b=()=>{s=null,l=null,h();};return {state:d,capture:p,apply:y,disarm:b,press(){let v=e.now(),S=s!==null&&v-s<rN,x=a;s=v;let k=()=>(s=null,false);return x==="once"&&S?f()?(a="locked",e.publish(),true):(h(),k()):x!=="off"?(h(),l=x==="locked"?v:null,true):l!==null&&v-l<rN?(l=null,true):f()?(a="once",l=null,e.publish(),true):k()},applyIfArmed(){a==="off"||i===null||g().wrote&&a==="once"&&b();}}}var aN=new WeakMap;function uV(e){let t=aN.get(e);if(t!==void 0)return t;let n=[e],r=false;for(;n.length>0&&!r;){let o=n.pop();if(o.kind!=="textValue"){(o.localName==="bidi"||o.localName==="rtl")&&(r=true);for(let a of o.children)n.push(a);}}return aN.set(e,r),r}function iN(e,t=()=>null){let n=null;return {keydown(r){if(r.key==="Shift"&&(r.location===1||r.location===2)&&r.ctrlKey&&!r.altKey&&!r.metaKey&&!r.isComposing&&!r.defaultPrevented){n=r.location===2?"rtl":"ltr";return}r.key!=="Control"&&(n=null);},keyup(r){if(n===null||r.key!=="Shift"&&r.key!=="Control")return;let o=n;if(n=null,r.defaultPrevented)return;let a=t();a===null||!uV(a)||e.setParagraphProperties([{localName:"bidi",paragraphDirection:o}]);},disarm(){n=null;}}}function sN(e,t){return e.addEventListener("keyup",t.keyup),e.addEventListener("pointerdown",t.disarm,{capture:true}),e.addEventListener("focusout",t.disarm),()=>{e.removeEventListener("keyup",t.keyup),e.removeEventListener("pointerdown",t.disarm,{capture:true}),e.removeEventListener("focusout",t.disarm);}}function fV(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),o=Math.min(e.x+e.width,t.x+t.width),a=Math.min(e.y+e.height,t.y+t.height);return o<=n||a<=r?0:(o-n)*(a-r)}function pV(e,t){return fV(e,t)>0?true:e.width===0?t.x<=e.x&&e.x<=t.x+t.width&&!(e.y+e.height<t.y||t.y+t.height<e.y):false}function to(e,t,n){if(t.paragraphId===n.paragraphId)return t.offset-n.offset;let r=db$1(e);return r.indexOf(t.paragraphId)-r.indexOf(n.paragraphId)}function cN(e,t,n){if(!(t>Ee))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Ee)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)cN(a.blocks,t+1,n);}}}function Qv(e,t){if(t.range){let{paragraphId:o,start:a,end:i}=t.range;return {from:{paragraphId:o,offset:a},to:{paragraphId:o,offset:i}}}if(t.level==="inline"||t.fragments.length===0)return null;let n=null,r=null;for(let o of t.fragments){let a=e.pages[o.pageIndex];a&&cN(a.fragments,0,i=>{if(!pV(o.box,i.box))return;let s={paragraphId:i.paragraphId,offset:0},l={paragraphId:i.paragraphId,offset:gf$1(e,i.paragraphId).length};(!n||to(e,s,n)<0)&&(n=s),(!r||to(e,l,r)>0)&&(r=l);});}return n&&r?{from:n,to:r}:null}function Ms(e,t){return t.placeholder?Qv(e,t):null}function dN(e){return !e.placeholder&&e.level==="inline"&&e.range!==void 0&&(e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked")}function mV(e){return e.placeholder}var lN=new WeakMap;function gV(e,t){let n=lN.get(e);if(!n){n=new Map;for(let r of e.contentControls??[]){if(!dN(r))continue;let o=Qv(e,r),a=n.get(o.from.paragraphId)??[];a.push(o),n.set(o.from.paragraphId,a);}lN.set(e,n);}return n.get(t)??[]}function Jv(e,t){let n=null;for(let r of gV(e,t.paragraphId))t.offset<=r.from.offset||t.offset>=r.to.offset||(!n||r.from.offset<n.from.offset||r.from.offset===n.from.offset&&r.to.offset>n.to.offset)&&(n=r);return n}function uN(e,t,n){let r=Jv(e,n);if(!r)return n;let o=t.paragraphId===n.paragraphId?n.offset-t.offset:0;if(o>0)return r.to;if(o<0)return r.from;let a=(r.from.offset+r.to.offset)/2;return n.offset<a?r.from:r.to}function Kc(e,t,n={}){let r=e.contentControls??[];if(r.length===0)return t;let o=to(e,t.anchor,t.head)<=0,a=o?t.anchor:t.head,i=o?t.head:t.anchor,s=true;for(;s;){s=false;for(let l of r){let c=n.atomic===true&&dN(l);if(!l.placeholder&&!c)continue;let d=Qv(e,l);if(!d)continue;let u=to(e,a,i)===0,f=to(e,a,d.from);(u?(mV(l)?f>=0:f>0)&&to(e,a,d.to)<0:to(e,a,d.to)<0&&to(e,i,d.from)>0)&&(to(e,d.from,a)<0&&(a=d.from,s=true),to(e,d.to,i)>0&&(i=d.to,s=true));}}return o?{anchor:a,head:i}:{anchor:i,head:a}}function yV(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function ex(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=Pe(e,t.pageIndex,o);return a?.placeholder?a:null}let r=yV(e,n);return r?.placeholder?r:null}var bV=new Set(["dropdown","comboBox","date","buildingBlockGallery"]);function fN(e,t={}){if(t.mode==="native")return {dragging:()=>false,cancelGesture:()=>{},destroy:()=>{}};let{pagesLayer:n}=e,r=t.atomicInlineControls===true,o=rt(()=>n),a=null,i=null,s=null,l=0,c=0,d=0,u=0,f=null;function p(D,B){if(!s){let X=n.getBoundingClientRect();s={left:X.left,top:X.top};}let Z=e.scale()||1;return {x:(D-s.left)/Z,y:(B-s.top)/Z}}function g(D){return {scope:{kind:"headerFooter",rId:D.rId},pageIndex:D.pageIndex,kind:D.kind,partName:D.partName,variant:D.variant}}function y(D,B){let Z=e.layout(),X=p(D,B),N=Je(Z,X.y),j=Z.pages[N];if(!j)return null;let z=e.measurer();return Me(Z,N,{x:X.x-j.contentBox.x-e.pageOffsetX(N),y:X.y-j.contentBox.y},z?{measurer:z}:{})}function h(D,B){let Z=e.activeNote?.()??null;if(Z){let Q=e.layout(),ue=gf(Q,p(D,B),e.pageOffsetX);if(!ue||ue.scopeId!==Z.scopeId)return null;let oe=e.measurer();return Ne$1(Q,ue.pageIndex,ue.fragments,ue.local,{...oe?{measurer:oe}:{}})}let X=e.activeHeaderFooter?.()??null;if(!X)return y(D,B);let N=e.layout(),j=p(D,B),z=ey(N,j,e.pageOffsetX);if(z&&pf(z.story,g(X))){let Q=e.measurer();return Xh(N,z.pageIndex,z.story,z.local,Q?{measurer:Q}:{})}return null}function b(D,B){let{story:Z,pageIndex:X,kind:N}=D;return {rId:Z.rId,pageIndex:X,kind:N,partName:Z.partName,variant:Z.variant,...B?{position:B}:{}}}function v(D){let B=e.measurer();return Xh(e.layout(),D.pageIndex,D.story,D.local,B?{measurer:B}:{})?.position??void 0}let S=new WeakMap;function x(D,B){let Z=e.activeNote?.();if(Z){let z=ds(D,null,Z.scopeId).indexOf(B);return z===-1?-1:z}let X=e.activeHeaderFooter?.();if(X){let z=ds(D,g(X)).indexOf(B);return z===-1?-1:z}let N=S.get(D);return N||(N=new Map(db$1(D).map((j,z)=>[j,z])),S.set(D,N)),N.get(B)??-1}function k(D,B,Z){let X=x(D,B.paragraphId),N=x(D,Z.paragraphId);return X!==N?X<N:B.offset<Z.offset}function T(D,B,Z,X=null){if(Z==="character")return {from:B,to:B};let N=B.paragraphId;if(Z==="paragraph"){let z=gf$1(D,N);return {from:{paragraphId:N,offset:0},to:{paragraphId:N,offset:z.length}}}let j=_e(D,B,X);return Jf(D,B,Ye(D,N),j)}function R(D,B,Z,X,N){let j=N?ex(D,N):null,z=j?Ms(D,j)??T(D,Z,X,N?.contentControlId):T(D,Z,X,N?.contentControlId),Q=k(D,z.from,B.from)?{anchor:B.to,head:z.from}:{anchor:B.from,head:z.to};return Kc(D,Q,{atomic:r})}function C(){return e.container.closest(".docx-editor__scroll-container")}function A(){f!==null&&(o.cancelAnimationFrame(f),f=null);}function E(){f=null;let D=i,B=C();if(!D||!B)return;let Z=B.getBoundingClientRect(),X=Ep(Z.top,Z.bottom,D.clientY);X!==0&&(B.scrollTop+=X,s=null,w(D.clientX,D.clientY),f=o.requestAnimationFrame(E));}function P(){if(f!==null||!i)return;let D=C();if(!D)return;let B=D.getBoundingClientRect();Ep(B.top,B.bottom,i.clientY)!==0&&(f=o.requestAnimationFrame(E));}function w(D,B){let Z=i;if(!Z)return;let X=h(D,B);X&&((e.isReadOnlyPosition?.(X.position)??e.isReadOnlyParagraph?.(X.position.paragraphId))||O(Z,X)||(Z.caret=X.caret,e.setSelection(R(e.layout(),Z.anchorRange,X.position,Z.granularity,X),X.caret)));}function O(D,B){let Z=D.anchorCell;if(!Z)return false;if(!B.cell||B.cell.tableId!==Z.tableId)return D.cellDragging;if(!D.cellDragging&&B.cell.cellId===Z.cellId)return false;let X=fa$1(e.layout(),Z,B.cell);return X?(D.cellDragging=true,e.setCellSelection(X),true):D.cellDragging}function _(D){let B=Date.now(),Z=B-c;return l=Math.abs(D.clientX-d)<=4&&Math.abs(D.clientY-u)<=4&&Z>=0&&Z<=500?l+1:1,c=B,d=D.clientX,u=D.clientY,l}let q=["character","word","paragraph"],K="[data-docx-hf], [data-docx-cc-widget], [data-docx-note-ref], [data-drawing-paragraph-id], .docx-image-selection-overlay, .docx-drawing-textbox, input, textarea, select",U=D=>D.button===0&&D.ctrlKey&&!D.metaKey&&isApplePlatform();function M(D){if(D.pointerType==="touch"||D.button!==2&&!U(D)||e.activeHeaderFooter?.()||e.activeNote?.()||D.target?.closest?.(K))return;let Z=e.layout();if(!mf(Z,p(D.clientX,D.clientY),e.pageOffsetX))return;let X=y(D.clientX,D.clientY);if(!X||(e.isReadOnlyPosition?.(X.position)??e.isReadOnlyParagraph?.(X.position.paragraphId)))return;let N=e.selection(),j=k(Z,N.head,N.anchor),z=j?N.head:N.anchor,Q=j?N.anchor:N.head;if(!k(Z,X.position,z)&&!k(Z,Q,X.position))return;e.focus();let ue=ex(Z,X);if(ue){if(e.selectContentControl?.(ue.id))return;let oe=Ms(Z,ue);if(oe){e.setSelection({anchor:oe.from,head:oe.to});return}}e.setSelection({anchor:X.position,head:X.position},X.caret);}let Y=D=>{if(U(D)){D.target?.closest?.("input, textarea, select")||D.preventDefault(),M(D);return}if(D.button!==0){M(D);return}if(e.onChangeBarToggle&&D.target?.closest?.("[data-docx-change-bar-toggle]")){D.preventDefault(),D.stopPropagation(),e.onChangeBarToggle();return}let B=D.target?.closest?.("[data-docx-cc-widget]");if(B){if(D.preventDefault(),D.stopPropagation(),B.hasAttribute("disabled")||B.dataset.disabledReason)return;let Be=B.dataset.docxCcId,st=B.dataset.docxCcWidget;Be&&st&&e.onContentControlWidget?.(Be,st);return}if(D.pointerType==="touch")return;i&&W(),s=null;let Z=e.layout(),X=p(D.clientX,D.clientY),N=e.activeHeaderFooter?.()??null,j=e.activeNote?.()??null,z=ey(Z,X,e.pageOffsetX),Q=z!==null&&NT(Z,z,X,e.pageOffsetX,N!==null&&pf(z.story,g(N)),e.measurer()),ue=CA(D)||D.target?.closest('.docx-drawing-textbox[data-docx-textbox-active="true"]'),oe=Q||ue?null:z,te=gf(Z,X,e.pageOffsetX),me=Q||ue?null:D.target?.closest("[data-docx-hf]"),Se=!!(me||oe),qe=D.target,xe=qe?.closest("[data-docx-note-ref]"),He=qe?.closest("[data-docx-note-mark-back]"),$e=null,Je=()=>$e??=_(D);if(xe?.dataset.docxNoteScope){D.preventDefault(),e.focus(),e.enterNote?.(xe.dataset.docxNoteScope);return}if(He){D.preventDefault(),e.focus(),e.exitNote?.(true);return}if(te&&!Se){let Be=e.measurer?.(),st=Ne$1(Z,te.pageIndex,te.fragments,te.local,{...Be?{measurer:Be}:{}});if(!j||j.scopeId!==te.scopeId){D.preventDefault(),e.focus(),e.enterNote?.(te.scopeId,st?{paragraphId:st.position.paragraphId,offset:st.position.offset}:void 0,te.pageIndex);return}if(j.pageIndex!==te.pageIndex){D.preventDefault(),e.focus(),e.enterNote?.(te.scopeId,st?{paragraphId:st.position.paragraphId,offset:st.position.offset}:void 0,te.pageIndex);return}}else if(j){if(!mf(Z,X,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(N)if(oe&&pf(oe.story,g(N)))oe.pageIndex!==N.pageIndex&&e.enterHeaderFooter?.(b(oe,v(oe)));else if(oe&&oe.story.rId){D.preventDefault(),e.focus(),e.enterHeaderFooter?.(b(oe,v(oe)));return}else if(mf(Z,X,e.pageOffsetX)){D.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let Be=Je()>=2?Jh(Z,X,e.pageOffsetX):null;Be&&(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Be.kind,Be.pageIndex));return}else if(Se&&Je()>=2){if(oe?.story.rId)D.preventDefault(),e.focus(),e.enterHeaderFooter?.(b(oe,v(oe)));else if(zr(me)){let Be=me.dataset.docxRId,st=me.dataset.docxHf,St=me.closest("[data-page-index]")?.getAttribute("data-page-index"),wn=St!=null?Number(St):NaN;if((st==="header"||st==="footer")&&Number.isInteger(wn))if(Be){let zn=Z.pages[wn]?.[st];D.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:Be,pageIndex:wn,kind:st,partName:zn?.partName??"",variant:zn?.variant??"default"});}else Z.pages[wn]?.[st]||(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(st,wn));}return}else if(Je()>=2&&!ue){let Be=Jh(Z,X,e.pageOffsetX);if(Be){D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Be.kind,Be.pageIndex);return}}let et=h(D.clientX,D.clientY);if(!et)return;if(e.isReadOnlyPosition?.(et.position)??e.isReadOnlyParagraph?.(et.position.paragraphId)){D.preventDefault();return}if(Je()===2&&e.onTextFormDoubleClick?.(D))return;D.preventDefault(),e.focus();try{n.setPointerCapture(D.pointerId);}catch{}a=n.ownerDocument,a.addEventListener("pointermove",le),a.addEventListener("pointerup",se),a.addEventListener("pointercancel",se);let _e=Je(),bt=qe?.closest("[data-drawing-node-id]")!=null&&qe.closest(".docx-drawing-textbox")==null,sn=D.shiftKey||bt?"character":q[(_e-1)%q.length],Mn=ex(Z,et);if(Mn&&!D.shiftKey){let Be=()=>{n.contentEditable!=="false"&&_e===1&&bV.has(Mn.controlType)&&e.onContentControlWidget?.(Mn.id,Mn.controlType);};if(e.selectContentControl?.(Mn.id)){let St=e.selection(),wn=k(Z,St.anchor,St.head)||St.anchor.paragraphId===St.head.paragraphId&&St.anchor.offset===St.head.offset?{from:St.anchor,to:St.head}:{from:St.head,to:St.anchor};i={pointerId:D.pointerId,granularity:"character",anchorRange:wn,anchorCell:et.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},Be();return}let st=Ms(Z,Mn);if(st){i={pointerId:D.pointerId,granularity:"character",anchorRange:st,anchorCell:et.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},ne(()=>e.setSelection({anchor:st.from,head:st.to})),Be();return}}if(D.shiftKey){let Be=e.selection();i={pointerId:D.pointerId,granularity:sn,caret:et.caret,anchorRange:{from:Be.anchor,to:Be.anchor},anchorCell:et.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},ne(()=>e.setSelection(R(Z,{from:Be.anchor,to:Be.anchor},et.position,sn,et),et.caret));}else {let Be=(r&&sn==="word"?Jv(Z,et.position):null)??T(Z,et.position,sn,et.contentControlId);i={pointerId:D.pointerId,granularity:sn,caret:et.caret,anchorRange:Be,anchorCell:et.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},ne(()=>e.setSelection(Kc(Z,{anchor:Be.from,head:Be.to},{atomic:r}),et.caret));}};function ne(D){try{D();}catch(B){throw W(),B}}let le=D=>{let B=i;!B||D.pointerId!==B.pointerId||(D.preventDefault(),B.clientX=D.clientX,B.clientY=D.clientY,w(D.clientX,D.clientY),P());},se=D=>{let B=i;if(!B||D.pointerId!==B.pointerId)return;W();try{n.releasePointerCapture(B.pointerId);}catch{}let Z=e.cellSelection();Z?e.setCellSelection(Z):e.setSelection(e.selection(),B.caret),D.type==="pointerup"&&(e.onTextFormPointerUp?.(D),e.onSelectionSettled?.());};function W(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,s=null,A(),a?.removeEventListener("pointermove",le),a?.removeEventListener("pointerup",se),a?.removeEventListener("pointercancel",se),a=null;}let H=()=>{s=null;};n.addEventListener("pointerdown",Y);let G=[e.listeners.onWindow("scroll",H,{capture:true,passive:true}),e.listeners.onWindow("resize",H,{passive:true})];return {dragging:()=>i!==null,cancelGesture:W,destroy(){W(),n.removeEventListener("pointerdown",Y);for(let D of G)D();}}}function pN(e,t,n){let r=e??mb$1;return {view:()=>r,projection:()=>lb$1(r),changeBars:()=>t?r==="all-markup"||r==="simple-markup"?r:"none":"all-markup",set:o=>{r=o;},filter:o=>t&&lb$1(r)!=="all-markup"?nb$1(o):o,toggleByChangeBar:()=>{t&&n(r==="simple-markup"?"all-markup":"simple-markup");}}}function mN(e){let{pagesLayer:t,session:n}=e,r=()=>t.ownerDocument,o=false,a=null,i,s;function l(){let{head:E}=e.selection();return s&&s.position.paragraphId===E.paragraphId&&s.position.offset===E.offset?s.lineId:void 0}function c(E){let P=pi(E?.anchorNode,t)??pi(E?.focusNode,t);P!==void 0&&(i=P);}function d(E){return i??pi(E?.anchorNode,t)??pi(E?.focusNode,t)}let u=false,f=false,p=false,g=null,y=false,h=null;function b(){let E=r().getSelection(),P=Ts(t,E);return !P||(c(E),Nt(P,e.selection()))?false:(e.adoptSelection(P),true)}function v(){let E=r().activeElement;if(E&&t.contains(E))return true;if(E&&E!==r().body&&E!==r().documentElement)return false;let P=r().getSelection();if(!P||P.rangeCount===0)return true;let w=P.anchorNode;return !w||!w.isConnected?true:t.contains(w)}let S=()=>{let E=r().getSelection(),P=Ts(t,E);if(!P){if(!Cv(t,E))return;u=false;let w=Ne(e.selection().head);if(Nt(w,e.selection()))return;e.setSelection(w);return}u=false,c(E),!Nt(P,e.selection())&&e.setSelection(P);};function x(E,P){let w=e.textOf(E),O=VD(t,E,w,r().getSelection()?.anchorNode??null);if(O===null)return;let _=GD(E,w,O);if(!_)return;let q=_.ops.find(H=>H.op==="deleteText"),K=_.ops.find(H=>H.op==="insertText"),U=K&&q?e.replacementOffset?.(E,q.start,q.end):void 0,M=K&&!q&&P!==null&&K.offset>=P.offset?O.slice(P.offset,P.offset+K.text.length):null,Y=K&&P!==null&&M!==null&&w.slice(0,P.offset)+M+w.slice(P.offset)===O?{...K,offset:P.offset,text:M,inside:P.controlId}:null,ne=K&&U!==void 0&&U!==K.offset?_.ops.map(H=>H===K?{...K,offset:U}:H):Y?_.ops.map(H=>H===K?Y:H):_.ops,le=K?e.pendingFormatOps?.(E,Y?.offset??U??K.offset,K.text.length,q?{start:q.start,end:q.end}:void 0)??[]:[],se=Y?e.promptLanding?.(E,Y.offset,Y.text.length)??Y.offset+Y.text.length:void 0,W=e.storyScope();e.commit(()=>{let H=e.applyOps([...ne,...le],e.selectionMark(),W);return le.length===0||!H.rejected?H:e.applyOps(ne,e.selectionMark(),W)}),e.setSelection(Ne({paragraphId:E,offset:se!==void 0?se:K&&U!==void 0?U+K.text.length:_.caret}));}function k(){o||p||e.isGesturing?.()||e.holdsCellSelection?.()||T()||u&&S();}function T(){if(!f||u)return false;if(!a)return true;let E=Ts(t,r().getSelection());return E!==null&&Nt(E,a)}function R(E){E.type.startsWith("pointer")&&E.button!==0||(u=true);}let C=false;function A(E=false){if(e.updateCaret(),!E&&!v())return;o=true;let P=e.now(),w=e.domSelection?.()??e.selection();u=false;let O=r().getSelection(),_=d(O),q=l(),K=TD(t,w,O,{..._!==void 0?{preferredPageIndex:_}:{},...q!==void 0?{preferredLineId:q}:{}});K&&c(O),a=K?w:null,K||(f=true),e.recordSelectionMs(e.now()-P),queueMicrotask(()=>{o=false;});}return t.addEventListener("pointerdown",R,true),t.addEventListener("selectstart",R,true),{adoptBeforePaint(){let E=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,P=f||E||!u?false:b();return e.hasPendingInput?.()!==true&&(f=false),P},noteModelMoved(){f=true,s=void 0;},noteSelectionSettled(){f=false;},mirrorToDom:A,adoptBeforeInput:k,isComposing:()=>p,noteBrowserSelectionFixup(){C=true;},onSelectionChange:()=>{if(!o&&!p&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(C&&Cv(t,r().getSelection())){let E=Ts(t,r().getSelection());if((E===null||!Nt(E,e.selection()))&&(C=false,!u)){A();return}}T()||S();}},onCompositionStart:()=>{k(),p=true;let E=e.selection();y=E.anchor.paragraphId!==E.head.paragraphId||e.compositionUsesTyping?.()===true,g=E.head.paragraphId;let w=!y&&E.anchor.offset===E.head.offset?e.insertOwner?.():void 0;h=w===void 0?null:{offset:E.head.offset,controlId:w},n.beginComposition(e.storyScope());},onCompositionEnd:E=>{p=false;let P=g??e.selection().head.paragraphId;g=null;let w=h;h=null;let O=y;y=false;let _=e.storyScope(),q=n.revisionFor(_);if(O){let K=E?.data??"";K.length>0&&e.replaceSelectionWith?.(K);}else x(P,w);n.endComposition(),n.revisionFor(_)===q&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>i,selectionLineId:l,caretPreference(E=i){let P=l();return {...E!==void 0?{preferredPageIndex:E}:{},...P!==void 0?{preferredLineId:P}:{}}},notePointerCaret(E){s=E,E&&(i=E.pageIndex);},destroy(){t.removeEventListener("pointerdown",R,true),t.removeEventListener("selectstart",R,true),u=false;}}}function hN(e){let t=null,n=null,r=null,o=(i,s)=>(e.setLastRejection(null),e.commit(()=>{let l=e.applyOps(Array.isArray(i)?i:[i],e.selectionMark());return l.rejected&&e.setLastRejection(String(l.reason??"rejected")),l},s),e.lastRejection()===null),a=(i,s,l)=>{let c=Ic$1(i);if(!c)return e.setLastRejection("invalid note scope id"),false;let d=e.session.currentPackage(),u=tj$1(d,c.noteKind),f=u?cd(u.root,c.noteId):null;if(!u||!f)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let p=e.selection();r={anchor:{paragraphId:p.anchor.paragraphId,offset:p.anchor.offset},head:{paragraphId:p.head.paragraphId,offset:p.head.offset}};}if(t={kind:"note",id:Hc$1(c.noteKind,c.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let p=vV(f),g=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:c.noteKind})),y=p.find(h=>g.has(h.id));if(y){let h=tx(y);e.setSelection({anchor:{paragraphId:y.id,offset:h},head:{paragraphId:y.id,offset:h}});}}return e.noteModelMoved(),e.render(),n??=e.revealNote(t.id),e.notify(),true};return {insertNote(i){if(e.activeScope().kind!=="body")return e.setLastRejection("insertNote requires body scope"),false;let s=e.deleteSelectionPlan(),l=s.collapseTo;if(!(s.ops.length===0||o(s.ops,()=>({anchor:{...l},head:{...l}}))))return false;let d=gN(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:l.paragraphId,offset:l.offset},()=>{let g={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:g,head:g}}))return s.ops.length>0&&e.undo(),false;let p=[...gN(e.session.currentPackage(),i)].find(g=>!d.has(g));return p===void 0?true:a(Hc$1(i,p))},deleteNote(i,s){return o({op:"deleteNote",noteKind:i,noteId:s})},convertNote(i,s){return o({op:"convertNote",fromKind:i,noteId:s})},convertAllNotes(i){return o({op:"convertAllNotes",fromKind:i})},setNoteProperties(i){return o({op:"setNoteProperties",scope:i.scope,sectionIndex:i.sectionIndex,footnote:i.footnote,endnote:i.endnote})},enterNote:a,exitNote(i=true){if(!t)return;let s=r;t=null,n=null,r=null,e.setActiveScopeBodyOrHf({kind:"body"}),i&&s&&e.setSelection(s),e.noteModelMoved(),e.render(),e.notify();},activeNoteScope(){return t},activeNotePageIndex(){return n},setActiveNotePageIndex(i){!t||!Number.isInteger(i)||n!==i&&(n=i);}}}function vV(e){let t=[],n=(r,o)=>{if(!(o>32)){if(r.kind==="paragraph"){t.push(r);return}if("children"in r)for(let a of r.children)n(a,o+1);}};return n(e,0),t}function tx(e){let t=Gi(e)[0];return t&&Nc$1(t.node)?t.end:0}function gN(e,t){let n=tj$1(e,t),r=new Set;if(!n)return r;for(let o of ad(n.root)){if(!Tc$1(o))continue;let a=Rc$1(o);a!==null&&r.add(a);}return r}var xV=720;function nx(e,t,n=xV){return vN(e,t,e+t*n)}function bN(e,t,n){let r=t>0?Math.floor(e/n)+1:Math.ceil(e/n)-1;return vN(e,t,r*n)}function vN(e,t,n){return t>0?Math.max(e,Math.min(Ud,n)):Math.max(0,n)}function ga(e){let t;for(let r of e){if(r.localName!=="ind")continue;let o=r.attributes?.left??r.attributes?.start;o!==void 0&&(t=o);}let n=Qd(t);return n===null||Math.abs(n)>9999999?0:n}function yN(e,t){return e.kind==="midLine"?false:e.kind==="empty"||t<=e.offset}function xN(e,t,n,r,o){let{from:a,to:i}=e;if(a.paragraphId===i.paragraphId&&a.offset===i.offset)return null;let s=t.length>1?n.start(i.paragraphId):null,c=s!==null&&yN(s,i.offset)&&!(s.kind==="empty"&&n.endsStory(i.paragraphId))?t.slice(0,-1):t;if(c.length>1)return {write:"stepLeft",paragraphs:c};if(!yN(n.start(a.paragraphId),a.offset))return null;let{resolved:d,direct:u}=n.firstLine(a.paragraphId);return r==="increase"?{write:d>=0&&d<o?"setFirstLine":"stepLeft",paragraphs:c}:{write:u&&d>0?"clearFirstLine":"stepLeft",paragraphs:c}}function SV(e,t){let n=Number.POSITIVE_INFINITY,r=false;for(let{line:o}of Vb$1(e).get(t)??[]){if(!r&&(r=true,Za$1(o)[0]?.paragraphId!==t))return {kind:"midLine"};let a=_a(o,t);if(a){for(let i of a.spans)i.range.end>i.range.start&&(n=Math.min(n,i.range.start));for(let i of a.drawings)n=Math.min(n,i.start);if(Number.isFinite(n))break}}return Number.isFinite(n)?{kind:"start",offset:n}:{kind:"empty"}}var wV=["firstLine","hanging","firstLineChars","hangingChars"];function SN(e,t,n){let r=new Map;return {start(o){let a=r.get(o);if(a)return a;let i=SV(e,o);if(i.kind==="start"){let s=eb$1(t,o),l=s?.kind==="paragraph"?tx(s):0;l>i.offset&&(i={kind:"start",offset:l});}return r.set(o,i),i},endsStory:o=>n[n.length-1]===o,firstLine(o){let a=xc(e,o),i=gi$1(t,o).find(l=>l.localName==="ind")?.attributes,s=wV.some(l=>i?.[l]!==void 0);return {resolved:a?rp(a.indent):0,direct:s}}}}function wN(e,t){let n=(r,o)=>r.paragraphId===o.paragraphId&&r.offset===o.offset;return (e.contentControls??[]).some(r=>{if(!r.placeholder)return false;let o=Ms(e,r);return o!==null&&n(o.from,t.from)&&n(o.to,t.to)})}var kV=new Set(["ind"]);function kN(e){let t=r=>bb$1(e.layout(),r)?.paragraphId!==r;function n(r){let o=e.styleCascade(),a=eb$1(e.storyPart(),r);if(!o||!a)return null;let i=Uh$1(a),s=Af$1(o,i).paragraphPropertyNodes;return Yd(s.filter(l=>l!==i))}return {levelOps(r,o,a,i){let s=eb$1(e.storyPart(),r),c=!(s&&Wh$1(Uh$1(s),"numPr"))&&!t(r)&&n(r)?.numId===o,d={op:"setListLevel",paragraphId:r,level:i};return c?[{op:"setListNumbering",paragraphId:r,numId:o,level:a},d]:[d]},styleIndent(r,o=false){let a=e.styleCascade(),i=eb$1(e.storyPart(),r);if(!a||!i)return {left:0,firstLine:0,inChars:false,leftInChars:false};let s=Uh$1(i),c=Af$1(a,o?void 0:s).paragraphPropertyNodes.filter(p=>p!==s).flatMap(p=>fi$1(p,kV)),d=0,u=false,f=false;for(let{attributes:p}of c){let g=Qd(p?.hanging),y=Qd(p?.firstLine);g!==null?d=-g:y!==null&&(d=y);let h=Number(p?.hangingChars??p?.firstLineChars??NaN);Number.isFinite(h)&&(u=h!==0);let b=Number(p?.leftChars??p?.startChars??NaN);Number.isFinite(b)&&(f=b!==0);}return {left:ga(c),firstLine:d,inChars:u,leftInChars:f}},styleNumbered(r){return !t(r)&&n(r)!==null},numbered(r){if(t(r))return false;let o=eb$1(e.storyPart(),r);if(!o)return false;let i=Wh$1(Wh$1(Uh$1(o),"numPr"),"numId")?.attributes.find(s=>s.localName==="val")?.value;return i!==void 0?i!=="0":n(r)!==null},leaveOp(r){let o=!t(r)&&n(r)!==null;return {op:"setListNumbering",paragraphId:r,numId:o?"0":null}}}}var IV=9,qp=e=>Math.round(e*20);function RV(e,t){return e>0||t<0?{hanging:qp(e>0?e:-t)}:{firstLine:qp(t)}}function PV(e,t){return Array.from({length:IV},(n,r)=>{let o=Dd(e,t,r)?.level;if(!o)return;let a=md$1(o),{indent:i}=o,s=i.stated;return {...s?.left?{left:qp(i.left)}:{},...s?.right?{right:qp(i.right)}:{},...s?.firstLineOffset?RV(i.hanging,i.firstLine):{},suffix:o.suff,align:o.lvlJc,...a?{paragraphProperties:a}:{}}})}function rx(e){let t=(...n)=>e.some(r=>r.localName==="ind"&&n.some(o=>r.attributes?.[o]!==void 0));return {left:t("left","start"),right:t("right","end"),offset:t("hanging","firstLine")}}function IN(e,t){if(!e)return null;let n=t.children.find(i=>i.kind==="paragraphProperties"),r=Af$1(e,n).styleId,o=r?Pd(e,r,"paragraph"):[],a=Xd(o,n);return a>=o.length?null:rx(o.slice(a).flatMap(i=>i.paragraphProperties))}function RN(e,t){if(!e)return false;let n=Pd(e,t,"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=n[r];if(o.paragraphPropertiesNode?.children.find(i=>i.kind!=="textValue"&&i.localName==="outlineLvl"))return o.outlineLevel!==null;if(o.outlineLevel!==null)return true}return false}function PN(e,t){if(!e)return null;let n=Pd(e,t,"paragraph").flatMap(r=>r.paragraphPropertiesNode?[r.paragraphPropertiesNode]:[]);return Yd(n)}function CN(e){return {listGeometryOf:t=>PV(e(),t),listLevelKindOf:(t,n)=>CV(e(),t,n),listLevelStyleOf:(t,n)=>Dd(e(),t,n)?.level.pStyle??null,listAbstractOf:t=>e().nums.get(t)?.abstractNumId??null}}function CV(e,t,n){let r=Dd(e,t,n)?.level;return r?r.numFmt==="bullet"?"bullet":"ordered":null}function TV(e,t){for(let n=0;n<=8;n+=1)if(e.listLevelStyleOf(t,n)!==null)return true;return false}function TN(e,t,n){if(!TV(e,n.numId))return n.level;let r=e.indentOf(t),o=Math.round(e.defaultTabStopPt()*20);if(!r||!(o>0))return 0;let a=Math.round((r.left+r.firstLine-r.hanging)*20);return a>0?Math.min(8,Math.floor(a/o)):0}var EV=e=>e.numFmt==="bullet"?"bullet":"ordered",Kp=e=>Math.round(e*20);function ox(e,t,n){let r=e.order(),o=r.indexOf(t[0]??""),a=o>0?r[o-1]:void 0,i=a?e.markerOf(a):null;return i&&EV(i)===n?i:null}function ax(e,t){let n=false,r=false;for(let o of t){let a=e.markerOf(o);a===null?n=true:e.headingLevel(a.numId,a.level)||(r=true);}return !n||!r?null:e.markerOf(t[0]??"")===null?"plain-first":"item-first"}function EN(e,t,n){let r=n?e.styleNumberedIndentSides(t):null,o=r?e.indentOf(t):null;if(!n||!r||!o)return null;let a=e.directIndentSides(t),i={},s=Kp(o.left),l=Kp(o.right);r.left&&!a.left&&n.left!==void 0&&n.left!==s&&(i.left=s),r.right&&!a.right&&n.right!==void 0&&n.right!==l&&(i.right=l);let c=o.hanging>0?-Kp(o.hanging):Kp(o.firstLine),d=n.hanging!==void 0?-n.hanging:n.firstLine;return r.offset&&!a.offset&&d!==void 0&&d!==c&&(i.firstLine=c),Object.keys(i).length>0?i:null}var ON=(e,t)=>e.left===t.left&&e.right===t.right&&e.firstLine===t.firstLine;function MN(e,t){let{hanging:n,firstLine:r,...o}=e,a=t.firstLine===void 0?{...n!==void 0?{hanging:n}:{},...r!==void 0?{firstLine:r}:{}}:t.firstLine<0?{hanging:-t.firstLine}:{firstLine:t.firstLine};return {...o,...t.left!==void 0?{left:t.left}:{},...t.right!==void 0?{right:t.right}:{},...a}}function AN(e,t,n,r=()=>0,o=ax(e,t)){let a=t.map(v=>{let S=e.markerOf(v);return S&&!e.headingLevel(S.numId,S.level)?S:null}),i=v=>v===null?null:new Map(t.map(S=>[S,v])),s=v=>typeof v=="string"&&a.every(S=>e.listLevelKindOf(v,S?.level??0)===n),l=ox(e,t,n);if(o==="item-first"||o&&l&&e.headingLevel(l.numId,l.level))return i(e.ensureListDefinition(n));let c=l?.numId,d=o==="plain-first"?r(t[0]):null;if(typeof c=="string"&&t.every((v,S)=>{let x=a[S],k=x?d??x.level:e.markerOf(v)?0:r(v);return e.listLevelKindOf(c,k)===n}))return i(c);if(o!==null)return i(e.ensureListDefinition(n));let f=a.find(v=>s(v?.numId))?.numId;if(f)return i(f);let p=OV(a);if(p===null)return i(e.ensureListDefinition(n));if(n==="ordered"){let v=e.listGeometryOf(p),S=new Map;t.forEach((k,T)=>{let R=a[T],C=R?.level??0,A=R?.numId===p?EN(e,k,v[C]):null,E=S.get(C);E===void 0?S.set(C,A):E&&!(A&&ON(E,A))&&S.set(C,null);});let x=v.map((k,T)=>{let R=S.get(T);return k&&R?MN(k,R):k});return i(e.ensureListDefinition(n,x))}let g=new Map,y=v=>{let S=g.get(v);return S||(S=e.listGeometryOf(v),g.set(v,S)),S},h=[];t.forEach((v,S)=>{let x=a[S],k=x?.numId??p,T=x?.level??0,R=x?EN(e,v,y(k)[T]):null,C=h.find(A=>{if(A.numId!==k)return false;let E=A.shown.get(T);return E===void 0?true:R?E!==null&&ON(E,R):E===null});C||(C={numId:k,shown:new Map,items:[]},h.push(C)),C.shown.set(T,R),C.items.push(v);});let b=new Map;for(let v of h){let S=y(v.numId).map((k,T)=>{let R=v.shown.get(T);return k&&R?MN(k,R):k}),x=e.ensureListDefinition(n,S);if(x===null)return null;for(let k of v.items)b.set(k,x);}return b}function OV(e){let t=new Map,n=null;for(let r of e){if(!r)continue;let o=(t.get(r.numId)??0)+1;t.set(r.numId,o),(n===null||o>t.get(n))&&(n=r.numId);}return n}function LN(e,t){let n=new Map;for(let[r,o]of e){let a=t.levelOf(r)??0,i=t.listLevelStyleOf(o,a),s=i?t.styleNumberingOf(i):null;if(!i||!s||s.ilvl!==a)continue;let l=t.listAbstractOf(o);if(l===null||t.listAbstractOf(s.numId)!==l)continue;let c=t.linkedStyleOp(r,i);c&&n.set(r,c);}return n}function FN(e,t,n){if(t.every(y=>e.kindOf(y)===n))return t.map(y=>e.leaveOp(y));let r=ox(e.listSwitch,t,n),o={...e,listLevelStyleOf:e.listSwitch.listLevelStyleOf},a=new Map,i=y=>{let h=a.get(y);return h===void 0&&(h=r?TN(o,y,r):0,a.set(y,h)),h},s=ax(e.listSwitch,t),l=AN(e.listSwitch,t,n,i,s);if(l===null)return null;let c=new Map;if(r)for(let y of t){if(e.levelOf(y)!==null||l.get(y)!==r.numId)continue;let h=i(y);e.listSwitch.listLevelKindOf(r.numId,h)===n&&c.set(y,h);}let d=c.get(t[0]??""),u=new Map;if(d!==void 0&&s==="plain-first")for(let y of t){let h=e.listSwitch.markerOf(y);!h||e.listSwitch.headingLevel(h.numId,h.level)||h.level!==d&&u.set(y,d);}let f=y=>c.get(y)??e.levelOf(y),p=LN(l,{listLevelStyleOf:e.listSwitch.listLevelStyleOf,listAbstractOf:e.listSwitch.listAbstractOf,levelOf:y=>u.get(y)??f(y),styleNumberingOf:y=>PN(e.styleCascade(),y),linkedStyleOp:(y,h)=>e.listStyle.linkedStyleOp(y,h,c.has(y)?"all":u.has(y)?"level":false)}),g=[...e.listStyle.applyOps(t.filter(y=>!p.has(y)),y=>c.has(y)),...p.values()];for(let y of t){if(p.has(y))continue;let h=f(y);g.push({op:"setListNumbering",paragraphId:y,numId:l.get(y)??null,...h!==null?{level:h}:{}});let b=u.get(y);b!==void 0&&g.push({op:"setListLevel",paragraphId:y,level:b});}return g}var MV=32;function ix(e,t,n,r){if(!(e.kind==="textValue"||r>MV)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)ix(o,t,n,r+1);}}var DN=new WeakMap;function NN(e,t,n,r){if(e.kind==="paragraph"||e.kind==="textValue"){ix(e,t,n,0);return}let o=DN.get(e);if(!o){let a=new Map;ix(e,0,a,0),o=[...a.keys()],DN.set(e,o);}for(let a of o)n.has(a)||n.set(a,t);}function FV(e,t){let n=If$2(e),r=Kc$1(n),o=0,a=pe(e),i=new Map;for(let s=0;s<a.length;s+=1){let l=a[s];for(let c=l.blockStart;c<l.blockEndExclusive;c+=1){let d=n[c];if(d){for(;o<r.length&&r[o]!==d;)NN(r[o],s,i),o+=1;o+=1,NN(d,s,i);}}}return i}var HN=new WeakMap;function DV(e){return !(!e.story||e.origin===g.mutationUndo||e.origin===g.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.includes(l$1.section))}function NV(e,t){t.story&&t.story.kind!=="body"||DV(t)||(e.map=null);}function HV(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>NV(t,n)));}function _V(e,t){let n=HN.get(e);return n||(n={map:null,subscribed:false},HN.set(e,n)),HV(e,n),n.map||(n.map=FV(t)),n.map}function _N(e,t,n){return n.includes("#")&&!n.startsWith(`${t.name}#`)?null:_V(e,t).get(n)??null}var BN=32;function Uc(e,t,n,r,o="all-markup",a){let i=e.part(),s=pe(i,o,a);if(s.length<=1)return 0;let l=qe$1(i,o,a),c=f=>{let p=l.indexOf(f);if(p!==-1)return p;let g=l.findIndex(y=>y>f);return g===-1?Math.max(0,l.length-1):g},d=sx(e,t);if(d!==null)return c(d);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let f=e.headerFooterResolutionBySection().findIndex(p=>[p.headers,p.footers].some(g=>[...g.values()].some(y=>y.rId===n.rId)));return f===-1?0:c(f)}let u=$V(e,t);if(u!==null){let f=sx(e,u);if(f!==null)return c(f)}return 0}function $N(e,t,n,r,o="all-markup",a){let i=e.part(),s=pe(i);if(s.length<=1)return {kind:"whole-document"};let l=qe$1(i,o,a),c=sx(e,t),d=Uc(e,t,n,r,o,a),u=l[d]??d;if(c!==null&&c===u)return {kind:"anchor",paragraphId:t};let f=s[u];if(!f)return {kind:"unaddressable"};let p=If$2(i);for(let g=f.blockStart;g<f.blockEndExclusive;g+=1){let y=BV(p[g]);if(y!==null)return {kind:"anchor",paragraphId:y}}return {kind:"unaddressable"}}function BV(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>BN)return null;if(n.kind==="paragraph")return n.id;for(let o of n.children){let a=t(o,r+1);if(a!==null)return a}return null};return t(e,0)}function sx(e,t){return _N(e,e.part(),t)}function $V(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=tj$1(n,r);if(!(!o||!WV(o,t)))for(let a of ad(o.root)){let i=Rc$1(a);if(i===null||!qV(a,t))continue;return uj$1(e.part()).find(l=>l.noteKind===r&&l.noteId===i)?.paragraphId??null}}return null}function WV(e,t){return t.includes("#")?t.startsWith(`${e.name}#`):eb$1(e,t)!==null}function qV(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>BN)return false;if(r.kind==="paragraph"&&r.id===t)return true;for(let a of r.children)if(n(a,o+1))return true;return false};return n(e,0)}function As(e,t){if(t===void 0)return {};let n=`${e}Autospacing`,r=`${e}Lines`;return t===null?{[e]:null,[n]:null,[r]:null}:{[e]:String(Math.round(t*20)),[n]:"0",[r]:null}}function Up(e){return e===void 0?{}:e===null?{line:null,lineRule:null}:e.rule==="multiple"?{line:String(Math.round(e.value*240)),lineRule:"auto"}:{line:String(Math.round(e.value*20)),lineRule:e.rule==="exact"?"exact":"atLeast"}}function WN(e){return {val:e?"1":"0"}}function lx(e){return e.bound?"bound":e.effectiveLock==="contentLocked"||e.effectiveLock==="sdtContentLocked"?"locked":null}function qN(e){return e.effectiveLock==="sdtLocked"||e.effectiveLock==="sdtContentLocked"?"locked":null}function jp(e,t){for(let n of e.children)if(n.kind!=="textValue"&&!(n.kind!=="contentControlProperties"&&n.localName!=="sdtPr")){if(n.children.some(r=>r.kind!=="textValue"&&r.localName==="dataBinding")&&t==="edit")return "bound";for(let r of n.children){if(r.kind==="textValue"||r.localName!=="lock")continue;let o=r.attributes.find(a=>a.localName==="val")?.value;if(t==="remove"){if(o==="sdtLocked"||o==="sdtContentLocked")return "locked"}else if(o==="contentLocked"||o==="sdtContentLocked")return "locked"}}return null}var KN=["firstLine","hanging","firstLineChars","hangingChars"],KV=["left","start","leftChars","startChars"],UV=new Set(["bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","permStart","permEnd","proofErr","moveFromRangeStart","moveFromRangeEnd","moveToRangeStart","moveToRangeEnd"]),jV=["leftChars","startChars","firstLineChars","hangingChars"];function UN(e){function t(){let{from:s,to:l}=e.orderedRange();if(s.paragraphId!==l.paragraphId||s.offset!==l.offset)return null;let c=e.markerOf(s.paragraphId);return c?{position:s,marker:c}:null}function n(s){let l=ga(Gn(e.layout(),s)),c=gi$1(e.storyPart(),s),d=c.find(h=>h.localName==="ind")?.attributes,u=e.listNumbering.styleNumbered(s),f=e.listNumbering.styleIndent(s),p=u||d!==void 0||f.left!==l,g=!u&&(f.firstLine!==0||f.inChars);if(!p&&!g)return null;let y={...d??{}};for(let h of KN)delete y[h];if(g&&(y.firstLine="0"),g&&f.inChars&&(y.firstLineChars="0"),p){delete y.leftChars,delete y.startChars;let h=String(l);d?.start!==void 0&&(y.start=h),(d?.start===void 0||d.left!==void 0)&&(y.left=h);}return {op:"setParagraphProperties",paragraphId:s,properties:[...c.filter(h=>h.localName!=="ind"),{localName:"ind",attributes:y}]}}function r(s){let l=e.storyPart(),c=Xh$1(l,s)?.children??[],d=c.findIndex(u=>u.kind!=="textValue"&&u.id===s);for(let u=d-1;u>=0;u-=1){let f=c[u];if(!(f.kind==="textValue"||UV.has(f.localName)))return f.kind==="paragraph"?f.id:null}return null}function o(s){let l=e.storyPart();for(let c=Xh$1(l,s);c;c=Xh$1(l,c.id))if(c.localName==="sdt"&&jp(c,"edit")==="locked")return true;return false}function a(s){let l=Gn(e.layout(),s),c=0,d=false;for(let u of l){if(u.localName!=="ind")continue;let f=u.attributes??{},p=Qd(f.hanging),g=Qd(f.firstLine);p!==null?c=-p:g!==null&&(c=g);for(let y of jV){let h=Number(f[y]??NaN);Number.isFinite(h)&&h!==0&&(d=true);}}return {left:ga(l),firstLine:c,inChars:d}}function i(s,l){let c=r(s);if(l.firstLine!==0||l.inChars||c===null||!e.markerOf(c))return 0;let d=a(c);if(d.inChars||d.left!==l.left)return 0;let u=d.left+d.firstLine;return u>0&&u<l.left?u:0}return {exitListOnEmptyItem(){let s=t();if(!s)return false;let{position:l,marker:c}=s;if(e.paragraphTextOf(l.paragraphId).length>0)return false;let d=c.level>0&&e.listLevelExists(c,c.level-1),u=[];if(d)u.push(...e.listNumbering.levelOps(l.paragraphId,c.numId,c.level,c.level-1));else {let f=e.listStyle.clearOp(l.paragraphId);f&&u.push(f),u.push(e.listNumbering.leaveOp(l.paragraphId));}return e.commitOps(u)},removeListNumber(s){if(!e.markerOf(s)||!e.listNumbering.numbered(s))return false;let l=n(s);return e.commitOps([...l?[l]:[],e.listNumbering.leaveOp(s)]),true},removeParagraphIndent(s){if(e.markerOf(s)||e.paragraphTextOf(s).length===0||o(s))return false;let l=a(s);if(l.left===0&&l.firstLine===0&&!l.inChars)return false;let c=i(s,l),d=e.listStyle.clearOp(s)!==null,u=e.listNumbering.styleIndent(s,d),f=gi$1(e.storyPart(),s),p=f.find(b=>b.localName==="ind")?.attributes,g={...p??{}};for(let b of [...KV,...KN])delete g[b];(c!==0||u.left!==0||u.leftInChars)&&(g.left=String(c)),u.leftInChars&&(g.leftChars="0"),(u.firstLine!==0||u.inChars)&&(g.firstLine="0"),u.inChars&&(g.firstLineChars="0");let y=f.filter(b=>b.localName!=="ind"&&!(d&&b.localName==="pStyle"));if(!d&&VV(g,p??{}))return false;let h=Object.keys(g).length>0?[{localName:"ind",attributes:g}]:[];return e.commitOps([{op:"setParagraphProperties",paragraphId:s,properties:[...y,...h]}]),true}}}function VV(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>e[r]===t[r])}function jN(e,t,n){let r=false;return e(()=>{let o=t([...n]);return r=o.committed,o}),r}var jc="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",Ls="a section break cannot be inserted inside a table cell",Gp="a section break cannot change a section that a locked or linked content control holds",Vc="a section break cannot be inserted in locked or linked content";function GV(e){let t=new Set,n=new Set,r=a=>{if(a.kind==="textValue"||!("localName"in a)||a.localName!=="sdt")return false;let i=a.children?.find(s=>s.kind!=="textValue"&&"localName"in s&&s.localName==="sdtPr");return !i||i.kind==="textValue"?false:(i.children??[]).some(s=>{if(s.kind==="textValue"||!("localName"in s)||s.namespaceUri!==pa$2)return false;if(s.localName==="dataBinding")return true;if(s.localName!=="lock")return false;let l=s.attributes?.find(c=>c.localName==="val"&&c.namespaceUri===pa$2)?.value;return l==="contentLocked"||l==="sdtContentLocked"})},o=(a,i,s)=>{if(a.kind==="textValue")return;if(a.kind==="paragraph"){i&&t.add(a.id),s&&n.add(a.id);return}let l=i||a.kind==="table",c=s||r(a);for(let d of a.children??[])o(d,l,c);};return o(e.root,false,false),{inCell:t,held:n}}var zV=32;function ZV(e){let t=new Set(_in(e).map(n=>ln(n)));return hn(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function dx(e,t){let n=t.replaceAt??t.collapseTo;return jn$1(e,n.paragraphId)?t.collapseTo:n}var cx=(e,t)=>Sh$1(e,t)||Oh$1(e,t).content;function Vp(e,t,n,r){if(jn$1(e,t))return Ls;if(cx(e,t))return Vc;let{section:o,ownerId:a}=kn(e,t);return ln(o)===n?null:a!==null&&cx(e,a)?Gp:r?jc:null}function VN(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return Ls;if(e.caretParagraphId!==null)return Vp(e.part(),e.caretParagraphId,t,n);let r=GV(e.part());if(!n&&r.inCell.size===0&&r.held.size===0)return null;let{from:o,to:a}=e.orderedRange(),i=e.part(),s=kn(i,o.paragraphId),l=kn(i,a.paragraphId),c=s.section===l.section,d=c?ln(s.section):ZV(i),u=e.paragraphOrder(),f=u.indexOf(o.paragraphId),p=u.indexOf(a.paragraphId),g=f===-1||p===-1?null:u.slice(f,p+1),y=g!==null&&!g.some(b=>r.inCell.has(b))&&!g.some(b=>r.held.has(b));if(d!==null&&d!==t){if(y&&c&&s.ownerId!==null&&cx(i,s.ownerId))return Gp;if(n&&y)return jc}if(y&&d!==null)return null;if(g===null||g.length-1>zV)return n&&d!==null&&d!==t?jc:null;let h=dx(i,e.deleteSelectionPlan());return Vp(i,h.paragraphId,t,n)}var XV=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function YV(e,t){let n={...e??{}};return delete n.leftChars,delete n.startChars,e?.start!==void 0&&(n.start=t),(e?.start===void 0||e.left!==void 0)&&(n.left=t),n}function zp(e,t,n,r){let o={...e};if(delete o[`${t}Chars`],delete o[`${n}Chars`],r===null)return delete o[t],delete o[n],o;let a=String(r),i=e[n]!==void 0;return i&&(o[n]=a),(!i||e[t]!==void 0)&&(o[t]=a),o}function GN(e,t){let n={...e};return delete n.firstLineChars,delete n.hangingChars,t===null?(delete n.firstLine,delete n.hanging,n):(t>=0?(n.firstLine=String(t),n.hanging="0"):(n.hanging=String(-t),n.firstLine="0"),n)}function zN(e){let{session:t,commit:n,orderedStart:r,orderedRange:o,selectionMark:a,collapsedAt:i}=e,s=e.deleteSelectionPlan,l=()=>t.partFor(e.storyScope())??t.part(),c=(w,O,_)=>t.applyTreeOps(w,O,_,e.storyScope()),d=UA({session:t,storyPart:l}),u=kN({storyPart:l,styleCascade:e.styleCascade,layout:e.layout}),f=UN({orderedRange:o,layout:e.layout,storyPart:l,markerOf:x,listLevelExists:R,paragraphTextOf:e.paragraphTextOf,listNumbering:u,listStyle:d,commitOps:w=>jN(n,O=>c(O,a()),w)}),p=()=>e.paragraphOrder(),g={get value(){return e.layout()}};function y(){let w=e.selectedCells?.();return w&&w.length>0?w:null}function h(w){let O=false;return n(()=>{let _=w();return O=_.committed,_},void 0,{keepCellSelection:y()!==null}),O}function b(w=o()){if(y()!==null)return [...ja$1(g.value,y())];let{from:O,to:_}=w,q=p(),K=q.indexOf(O.paragraphId),U=q.indexOf(_.paragraphId);return K===-1||U===-1?null:q.slice(K,U+1)}let v=8;function S(w){return x(w)?.level??null}function x(w){return cb$1(g.value,w)}function k(w){let O=x(w);return O?O.numFmt==="bullet"?"bullet":"ordered":null}let T={listGeometryOf:e.listGeometryOf,listLevelKindOf:e.listLevelKindOf,listLevelStyleOf:e.listLevelStyleOf,listAbstractOf:e.listAbstractOf,order:p,markerOf:x,ensureListDefinition:(w,O)=>t.ensureListDefinition(w,O),headingLevel:(w,O)=>{let _=e.listLevelStyleOf(w,O);return _!==null&&RN(e.styleCascade(),_)},indentOf:w=>xc(g.value,w)?.indent??null,directIndentSides:w=>rx(gi$1(l(),w)),styleNumberedIndentSides:w=>{let O=eb$1(l(),w);return O&&O.kind!=="textValue"?IN(e.styleCascade(),O):null}};function R(w,O){return O<0||O>v?false:e.numberingLevelExists(w.numId,O)}function C(w,O){return O<0||O>v?false:e.numberingLevelExists(w.numId,O)?true:t.ensureNumberingLevel(w.numId,O,w.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(w.numId,O)}function A(w,O,_){let q=O==="increase"?1:-1,K=[];for(let U of w){let M=Gn(g.value,U),Y=x(U),ne=Y?.level??null;if(Y&&ne!==null){let G=ne+q;if(G<0||G>v||!C(Y,G))continue;K.push(...u.levelOps(U,Y.numId,ne,G));continue}let le=ga(M),se=_===void 0?nx(le,q):bN(le,q,_);if(se===le)continue;let W=gi$1(l(),U),H=W.find(G=>G.localName==="ind");K.push({op:"setParagraphProperties",paragraphId:U,properties:ii$1(W,{localName:"ind",attributes:YV(H?.attributes,String(se))})});}return K.length===0?false:h(()=>c(K,a()))}function E(w,O){let _=[];for(let q of w){let K=gi$1(l(),q),M={...K.find(Y=>Y.localName==="ind")?.attributes??{}};O.left!==void 0&&(M=zp(M,"left","start",O.left)),O.right!==void 0&&(M=zp(M,"right","end",O.right)),O.firstLine!==void 0&&(M=GN(M,O.firstLine)),_.push({op:"setParagraphProperties",paragraphId:q,properties:ii$1(K,{localName:"ind",...Object.keys(M).length>0?{attributes:M}:{}})});}return _.length===0?false:h(()=>c(_,a()))}function P(w){let O=e.typingSelectionPlan?.()??s(),_=O.replaceAt??O.collapseTo;n(()=>c([...O.ops,{op:w,paragraphId:_.paragraphId,offset:_.offset,...O.outsidePromptId?{bias:"left"}:{}}],a()),()=>(e.retainPromptBoundary?.(O.outsidePromptId),i({..._,offset:_.offset+1})));}return {insertTab(){P("insertTab");},insertLineBreak(){P("insertHardBreak");},insertPageBreak(){P("insertPageBreak");},exitListOnEmptyItem:f.exitListOnEmptyItem,removeListNumber:f.removeListNumber,removeParagraphIndent:f.removeParagraphIndent,isListParagraph(){let{paragraphId:w}=r();return S(w)!==null},isListActive(w){let O=b();if(O===null)return false;let _=w==="bullet"?"bullet":"ordered";return O.length>0&&O.every(q=>k(q)===_)},toggleList(w){let O=b();if(O===null||O.length===0)return false;let _=FN({listSwitch:T,listStyle:d,leaveOp:u.leaveOp,levelOf:S,kindOf:k,styleCascade:e.styleCascade,indentOf:T.indentOf,defaultTabStopPt:e.defaultTabStopPt},O,w);return _===null?false:h(()=>c(_,a()))},canAdjustIndent(w){let O=b();if(O===null)return false;let _=w==="increase"?1:-1;return O.some(q=>{let K=x(q);if(K){let M=K.level+_;return M>=0&&M<=v}let U=ga(Gn(g.value,q));return nx(U,_)!==U})},adjustIndent(w){let O=b();return O!==null&&A(O,w)},setIndent(w){if(w.left===void 0&&w.right===void 0&&w.firstLine===void 0)return false;let O=b();return O!==null&&E(O,w)},indentWithTab(w){let O=o();if(O.from.paragraphId===O.to.paragraphId&&O.from.offset===O.to.offset&&y()===null||wN(g.value,O))return false;let q=b(O);if(q===null)return false;let K=Math.round(Qb$1(t.settingsRoot())*20),U=SN(g.value,l(),p()),M=y()===null?xN(O,q,U,w,K):{write:"stepLeft",paragraphs:q};return M===null?false:(M.write==="stepLeft"?A(M.paragraphs,w,K):E(M.paragraphs,{firstLine:M.write==="setFirstLine"?K:null}),true)},setParagraphFormat(w){let O=b();if(O===null||O.length===0)return false;let _=[];w.direction!==void 0&&_.push({localName:"bidi",paragraphDirection:w.direction}),w.alignment!==void 0&&_.push({localName:"jc",attributes:{val:w.alignment},physicalAlignment:true});let q={...As("before",w.spaceBeforePt),...As("after",w.spaceAfterPt),...Up(w.lineSpacing)};Object.keys(q).length>0&&_.push({localName:"spacing",attributes:q,mergeAttributes:true});for(let[Y,ne]of XV){let le=w[Y];le!==void 0&&_.push({localName:ne,attributes:WN(le)});}let K=w.tabStops!==void 0,U=w.indentLeftTwips!==void 0||w.indentRightTwips!==void 0||w.indentFirstLineTwips!==void 0;if(_.length===0&&!U&&!K)return false;let M=[];for(let Y of O){let ne=gi$1(l(),Y),le=ne;if(U){let D={...ne.find(B=>B.localName==="ind")?.attributes??{}};w.indentLeftTwips!==void 0&&(D=zp(D,"left","start",w.indentLeftTwips)),w.indentRightTwips!==void 0&&(D=zp(D,"right","end",w.indentRightTwips)),w.indentFirstLineTwips!==void 0&&(D=GN(D,w.indentFirstLineTwips)),le=ii$1(le,{localName:"ind",...Object.keys(D).length>0?{attributes:D}:{}});}let se=Gn(g.value,Y),W=ne,H=false;for(let G of _){let D=Wp(G,se,le,W);if(!D)continue;if(H=true,D.remove){le=le.filter(X=>X.localName!==D.localName);continue}let B=D.mergeAttributes?{...le.find(X=>X.localName===D.localName)?.attributes??{},...D.attributes}:D.attributes??{},Z=Object.fromEntries(Object.entries(B).filter(([,X])=>X!=null));le=ii$1(le,{localName:D.localName,...Object.keys(Z).length>0?{attributes:Z}:{}});}if((H||U)&&M.push({op:"setParagraphProperties",paragraphId:Y,properties:le}),K){let G=vc(e.layout(),Y);M.push({op:"setParagraphTabStops",paragraphId:Y,stops:w.tabStops.map(D=>({positionTwips:Math.round(D.positionTwips),alignment:D.alignment,...D.leader&&D.leader!=="none"?{leader:D.leader}:{}})),...G?{inForcePositionsTwips:G.stops.map(D=>Math.round(D.positionPt*20))}:{}});}}return M.length===0?true:h(()=>c(M,a()))},sectionProperties:()=>oe(t.part()),sectionPropertiesAt(w){let O=pe(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),_=Uc(t,w,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (O[_]??O[O.length-1]).properties},sectionAnchorParagraphAt(w){return $N(t,w,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(w){let O=false;return n(()=>{let _=e.storyScope().kind==="body",q=t.applyTreeOps([{op:"setSectionProperties",...w}],_?a():void 0,void 0,{kind:"body"});return O=q.committed,q}),O},sectionBreakRefusal(w="nextPage"){return e.storyScope().kind!=="body"?null:VN({part:()=>t.part(),breakType:w,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:p,deleteSelectionPlan:s})},insertSectionBreak(w="nextPage"){if(e.storyScope().kind!=="body")return false;let O=s(),_=dx(t.part(),O),q=(jn$1(t.part(),_.paragraphId)?Ls:null)??Vp(t.part(),_.paragraphId,w,e.editingMode?.()==="suggest");if(q!==null)return e.publishRefusal?.(q),false;let K=new Set(t.paragraphIds()),U=false,M=false;return n(()=>{let Y=t.applyTreeOps([...O.ops,{op:"splitParagraph",paragraphId:_.paragraphId,offset:_.offset},{op:"setSectionMark",paragraphId:_.paragraphId,breakType:w}],a(),void 0,{kind:"body"});return U=Y.committed,M=Y.reason==="locked"||Y.reason==="bound",Y},()=>{let Y=t.paragraphIds().find(ne=>!K.has(ne));return Y?i({paragraphId:Y,offset:0}):null}),!U&&M&&e.publishRefusal?.(Vc),U}}}var QN="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function JN(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===QN}function QV(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===QN}function ux(e){return e.kind==="textValue"?[]:e.children}function eH(e,t=0){if(e.kind==="textValue")return e.value;if(t>=Aa||e.kind==="deletedText"||JV(e.kind)||fh$1(e)||e.kind==="runProperties")return "";let n=Ub$1(e);if(n!==null)return n;if(e.kind==="generic"&&!Ca(e)&&!JN(e))return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return cc$1(e);let r=Ba$1(e,t),o="";for(let a of e.children)o+=eH(a,r);return o}function JV(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function fx(e,t,n){if(!(t>=Aa))for(let r of e){if(r.kind==="hyperlink"){Ba$1(r,t)<Aa&&n(r,t);continue}if(Ca(r)){fx(ux(r),Ba$1(r,t),n);continue}if(JN(r)){for(let o of ux(r))QV(o)&&fx(ux(o),Ba$1(r,t),n);continue}n(r,t);}}function ZN(e,t,n){let r=eG(e,t);if(!r||r.kind!=="paragraph")return [];let o=Ii(r),a=[],i=0;return fx(r.children,0,(s,l)=>{let c=o.spanOf(s);if(c&&(i=Math.max(i,c.end)),s.kind!=="hyperlink")return;let d=c?c.start:i,u=c?c.end:i,f=Ke(s,n);a.push({id:s.id,paragraphId:t,start:d,end:u,text:Yb$2(eH(s,l)),kind:f.kind,href:f.href,authored:f.authored,...f.anchor!==void 0?{anchor:f.anchor}:{},...f.tooltip!==void 0?{tooltip:f.tooltip}:{}});}),a}function eG(e,t){let n=r=>{if(r.kind==="textValue")return r.id===t?r:null;if(r.id===t)return r;for(let o of r.children){let a=n(o);if(a)return a}return null};return n(e.root)}function tG(e,t){for(let n of e)if(n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)return n;return null}function nG(e,t){for(let n of Sa(e,t.paragraphId))for(let r of n.lines)for(let o of r.spans)if(!(!o.fieldAtom||!o.link)&&t.offset>=o.range.start&&t.offset<=o.range.end)return o.link.id;return null}function tH(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=d=>e.session.relationshipTarget(d,t()),o=(d,u,f,p)=>e.session.applyTreeOps(d,u,f,t(),p?.length?{packageEdits:p}:void 0),a=d=>{let u=n();return u?ZN(u,d,r):[]},i=()=>tG(a(e.selection().head.paragraphId),e.selection().head),s=()=>{let d=e.selection().head,u=nG(e.layout(),d);return u===null?null:e.fieldLinkById(u)},l=d=>{let u=e.selection().head.paragraphId,f=a(u).find(p=>p.id===d);if(f)return f;for(let p of e.session.storyParts()){let g=y=>jj$1(e.session.currentPackage(),p.name,y);for(let y of fd(p))for(let h of id(y.root)){let b=h.id,v=ZN(p,b,g).find(S=>S.id===d);if(v)return v}}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:i,fieldLinkAtCaret:s,linkById:l,selectionIsPendingDeletion:()=>{let{anchor:d,head:u}=e.selection();if(d.paragraphId!==u.paragraphId||d.offset===u.offset)return false;let f=Math.min(d.offset,u.offset),p=Math.max(d.offset,u.offset);return Yb$1(e.layout(),u.paragraphId).some(g=>g.start<=f&&p<=g.end)},wordAtCaret(){return i()||s()?null:_f(e.layout(),e.selection())},applyHyperlink(d){let u=d.text===void 0?d:{...d,text:Zb$1(d.text)},f=u.url!==void 0&&u.url.length>0,p=u.anchor!==void 0&&u.anchor.length>0;if(f===p)return false;let g=t();if(!n()||e.refusesWrite())return false;let y;if(f){let O=()=>e.session.ensureHyperlinkRelationship(u.url,g),_=e.withMintActor?e.withMintActor(O):O();if(!_)return false;y=_;}let h={...y!==void 0?{relationshipId:y}:{},...p?{anchor:u.anchor}:{},...u.tooltip!==void 0?{tooltip:u.tooltip}:{}},b=i(),v=e.orderedRange(),S=v.from.paragraphId===v.to.paragraphId&&v.from.offset===v.to.offset;if(b&&(S||rG(b,v))){let O=[],_;if(u.text!==void 0&&u.text!==Zb$1(b.text)){if(u.text.length===0)return false;let K=e.replacementLanding?.(b.paragraphId,b.start,b.end),U=e.textOf(b.paragraphId).slice(b.start,b.start+2),M=b.start+(U.length===2&&U.charCodeAt(0)>=55296&&U.charCodeAt(0)<=56319&&U.charCodeAt(1)>=56320&&U.charCodeAt(1)<=57343?2:1);if(K!=null&&K>b.start&&M<b.end)O.push({op:"setHyperlinkTarget",linkId:b.id,...h},{op:"deleteText",paragraphId:b.paragraphId,start:b.start,end:b.end},{op:"insertText",paragraphId:b.paragraphId,offset:M,text:u.text});else if(K!=null){let Y=i$1(e.session.currentPackage(),{createPart:!e.collaborative});Y.edit&&(_=[Y.edit]),O.push({op:"setHyperlinkTarget",linkId:b.id,...h},...XN(b,K,u.text),{op:"insertHyperlink",paragraphId:b.paragraphId,start:K,end:K+u.text.length,...h,...Y.styleId?{styleId:Y.styleId}:{}});}else {let Y=YN(b.paragraphId,b.start,b.end,u.text);if(!Y)return false;O.push({op:"setHyperlinkTarget",linkId:b.id,...h},...Y);}}else O.push({op:"setHyperlinkTarget",linkId:b.id,...h});let q=false;return e.commit(()=>{let K=o(O,e.selectionMark(),void 0,_);return q=K.committed,K},()=>null),q}let x=v.from.paragraphId;if(v.to.paragraphId!==x)return false;let k=[],T=v.from.offset,R=v.to.offset;if(S){let O=u.text??u.url??u.anchor??"";if(O.length===0)return false;T=e.insertionLanding?.(x,T)??T,k.push({op:"insertText",paragraphId:x,offset:T,text:O}),R=T+O.length;}else {let O=e.replacementLanding?.(x,T,R);if(O!=null){let _=u.text??e.textOf(x).slice(T,R);if(_.length===0)return false;k.push(...XN({paragraphId:x,start:T,end:R},O,_)),T=O,R=O+_.length;}else if(u.text!==void 0&&u.text!==e.textOf(x).slice(T,R)){let _=YN(x,T,R,u.text);if(!_)return false;k.push(..._),R=T+u.text.length;}}if(R<=T)return false;let{styleId:C,edit:A}=i$1(e.session.currentPackage(),{createPart:!e.collaborative}),E=A?[A]:void 0;k.push({op:"insertHyperlink",paragraphId:x,start:T,end:R,...h,...C?{styleId:C}:{}});let P=false,w={paragraphId:x,offset:R};return e.commit(()=>{let O=o(k,e.selectionMark(),{paragraphId:x,start:R,end:R},E);return P=O.committed,O},()=>({anchor:w,head:w})),P},removeHyperlink(d){if(!n())return false;let u=d?l(d):i();if(!u)return false;let f=false,p={paragraphId:u.paragraphId,offset:u.end};return e.commit(()=>{let g=o([{op:"removeHyperlink",linkId:u.id}],e.selectionMark());return f=g.committed,g},()=>({anchor:p,head:p})),f}}}function rG(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function XN(e,t,n){return [{op:"deleteText",paragraphId:e.paragraphId,start:e.start,end:e.end},{op:"insertText",paragraphId:e.paragraphId,offset:t,text:n}]}function YN(e,t,n,r){if(r.length===0)return null;let o=[{op:"insertText",paragraphId:e,offset:t,text:r,bias:"right"}];return n>t&&o.push({op:"deleteText",paragraphId:e,start:t+r.length,end:n+r.length}),o}function px(e){if(e.kind==="textValue")return JSON.stringify(e.value);let t=e.attributes.map(n=>`${n.namespaceUri??""}|${n.localName}=${n.value}`).sort().join(",");return `<${e.namespaceUri??""}|${e.localName} ${t}>${e.children.map(px).join("")}</>`}function nH(e){let t=ud$1(e)?.root;if(!t)return [];let n=new Map,r=[];for(let o of g$4(t)){let a=f$4(o,"styleId");if(!a)continue;let i=n.get(a);i?px(i)===px(o)&&r.push(o.id):n.set(a,o);}return r}function rH(e){return nH(e).length===0?null:d$3(t=>{let n=ud$1(t);if(!n)return t;for(let r of nH(t)){let o=lb$2(n,r);if(!o.ok)return t;n=o.part;}return vg(t,n)})}function oH(e){let{session:t,collaboration:n}=e,r=0,o=(d,u)=>{if(!n)return {packageEdits:d,historyToken:u};r+=1;let f=n.identity.actorId;return {packageEdits:d,origin:g.mutationHuman,actorId:f,operationId:`${f}:${n.sessionId}:browser:${r}`,recordsHistory:false,historyToken:u}},a=(d,u)=>Ua$1(()=>t.applyTreeOps([],void 0,void 0,u,o(d,void 0)));function i(d,u,f,p=e.defaultScope(),g){let y=n?.gateOperations(d,p);if(y)return {committed:false,rejected:true,opCount:0,reason:y};let h=n?(g??[]).filter(e$3):[];if(h.length>0){let v=a(h,p);if(v.rejected)return v}let b=g?.filter(v=>!h.includes(v));return t.applyTreeOps(d,u,f,p,o(b?.length?b:void 0,e.historyGroup()))}function s(){if(!n||!e.canRepair()||n.gateOperations([],{kind:"body"}))return;let d=rH(t.currentPackage());d&&a([d],{kind:"body"});}let l=false;function c(d){if(!n||l)return;let u=d.dependencyKeys;u.length>0&&u.every(f=>f===l$1.story)||(l=true,e.later(()=>{l=false,s();}));}return {apply:i,noteRemoteChange:c}}function oG(e,t,n){if(!t)return 0;let r=t.scrollTop;return e.pages.find(a=>(a.box.y+a.box.height)*n>r)?.index??0}var aG=24;function iG(e,t,n){if(!n)return Math.max(0,t-aG);let r=e.clientHeight,o=e.scrollTop;return t>=o+r*.2&&t<=o+r*.8?o:Math.max(0,t-r/2)}function aH(e){let{pagesLayer:t}=e;function n(){return e.container.closest(".docx-editor__scroll-container")}let r=u=>{if(!u||u.length===0||u.startsWith("#"))return false;let f=U(u);if(!f.ok||!f.href)return false;let p=t.ownerDocument.defaultView;return p?(p.open(f.href,"_blank","noopener,noreferrer"),true):false},o=(u,f)=>{e.beginJump?.();let p=!e.enterStoryFor||e.enterStoryFor(u.paragraphId);if(!p&&!f?.orShow)return false;let g=e.layout(),y=n(),h=df$1(g,u,p?void 0:{preferredPageIndex:oG(g,y,e.scale())});if(!h)return !p||!e.whenLaidOut?.(u,()=>o(u,f))?false:(e.setSelection(u),true);let b=g.pages[h.pageIndex];if(!b)return false;let v=sc(b,u.paragraphId).y+h.y;return y&&(y.scrollTop=iG(y,v*e.scale(),f?.center===true),e.onScrolled?.()),p?(e.setSelection(u),true):"shown"},a=u=>{let f=e.bookmarks().get(u);return f?o(f)===true:false},i=null;function s(u){if(!u||u.closest("[data-docx-hf]"))return null;let f=u.closest("a.docx-hyperlink");if(f){let g=f.dataset.docxLink;return g?{linkId:g,drawing:false}:null}let p=u.closest("[data-docx-drawing-link]");if(p){let g=p.dataset.docxDrawingLink;return g?{linkId:g,drawing:true}:null}return null}let l=u=>{if(d$2(u.target))return;i=null;let f=u.target,p=s(f);if(!p)return;let y=f.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();i={linkId:p.linkId,drawing:p.drawing,rect:{left:y.left,top:y.top,bottom:y.bottom,right:y.right}};},c=u=>{if(d$2(u.target))return;let f=u.target,p=s(f);if(!p){let h=i;if(i=null,!h)return;u.preventDefault(),d(h.linkId,h.rect,u,h.drawing);return}i=null,u.preventDefault();let y=f.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();d(p.linkId,{left:y.left,top:y.top,bottom:y.bottom,right:y.right},u,p.drawing);};function d(u,f,p,g){let y=g?e.drawingLinkById?.(u)??null:e.linkById(u);if(!y)return;if(p.metaKey||p.ctrlKey){y.kind==="external"?r(y.href):y.anchor&&a(y.anchor);return}if(e.isCollapsedSelection()){if(y.kind==="internal"){y.anchor&&a(y.anchor);return}e.onPopover?.({link:y,rect:f});}}return t.addEventListener("pointerdown",l,true),t.addEventListener("click",c),{goToPosition:o,goToBookmark:a,openExternal:r,destroy(){t.removeEventListener("pointerdown",l,true),t.removeEventListener("click",c);}}}function sG(e){let t=e.hyperlinkHref;if(!t)return null;let n=e.kind==="anchoredDrawing"?e.anchorParagraphId:e.paragraphId,r=e.kind==="inlineDrawing"?e.start:0,o=t.startsWith("#")?"internal":"external";return Object.freeze({id:e.drawingNodeId,paragraphId:n,start:r,end:r+1,text:"",kind:o,href:t,authored:t,...o==="internal"?{anchor:t.slice(1)}:{}})}function mx(e,t){return e.drawingNodeId!==t?null:sG(e)}function iH(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=mx(n,t);if(r)return r}return null}function lG(e,t){for(let r of e.anchoredDrawings??[]){let o=mx(r,t);if(o)return o}for(let r of e.fragments){if(r.kind==="table"){for(let a of r.rows)for(let i of a.cells)for(let s of i.blocks){let l=lH(s,t);if(l)return l}continue}let o=sH(r,t);if(o)return o}let n=iH(e.header,t);return n||iH(e.footer,t)}function sH(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=mx(r,t);if(o)return o}return null}function lH(e,t){if(e.kind==="table"){for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks){let a=lH(o,t);if(a)return a}return null}return sH(e,t)}function cH(e,t){for(let n of e.pages){let r=lG(n,t);if(r)return r}return null}var Zp=24;function dH(e){let t=null,n=false;return {without(r){let o=n;n=true;try{return r()}finally{n=o;}},follow(r,o){let a=n?"none":o;if(e.storyScopeOpen())return;let i=e.selection();if(!(i.anchor.paragraphId===i.head.paragraphId&&i.anchor.offset===i.head.offset)&&a!=="head")return;let l=e.pagesLayer.ownerDocument.activeElement;if(!(l===e.pagesLayer||!!l&&e.pagesLayer.contains(l))&&a!=="none")return;let d=e.preferredPageIndex(),u=e.preferredLineId?.(),f=e.layout(),p=df$1(f,i.head,{measurer:e.measurer(),...d!==void 0?{preferredPageIndex:d}:{},...u!==void 0?{preferredLineId:u}:{}});if(!p)return;let g=t!==null&&t!==p.pageIndex;if(t=p.pageIndex,a==="none"||!r&&!g)return;let y=f.pages[p.pageIndex],h=e.scroller();if(!y||!h||h.clientHeight<=0)return;let b=e.scale(),v=y.contentBox.y-y.box.y,S=(y.box.y+v+p.y)*b+e.container.offsetTop,x=S+p.height*b,k=h.scrollTop,T=k+h.clientHeight,R=k;if(S<k+Zp)R=S-Zp;else if(x>T-Zp)R=x+Zp-h.clientHeight;else return;let C=Math.max(0,h.scrollHeight-h.clientHeight),A=Math.max(0,Math.min(R,C));Math.abs(A-h.scrollTop)<.5||(h.scrollTop=A,e.scheduleRematerialize());}}}function uH(e){return (t,n,r,o)=>{if(e.settle(),/[\r\n\v\f\u2028\u2029]/.test(o))return e.refuse("replacement requires text without a paragraph mark");if(!e.storyParagraphs().includes(t))return e.refuse("that text is not in the story being edited");let a=e.textOf(t);if(n<0||r<n||r>a.length)return e.refuse("that range is outside the paragraph");let i={paragraphId:t,offset:n},s=r>n?e.rangePlan({anchor:i,head:{paragraphId:t,offset:r}}):{ops:[],replaceAt:e.insertionPoint(i)},l=[...s.ops],{paragraphId:c,offset:d}=s.replaceAt;if(o.length>0&&l.push({op:"insertText",paragraphId:c,offset:d,text:o}),l.length===0)return true;let u=e.selection();return e.commitWithoutFollow(l,e.selectionMark()??void 0,()=>{e.flushLayout();let f=e.textOf(t),p=qc(u,t,a,f);return e.selectionsEqual(p,u)?null:(e.noteModelMoved(),p)})}}function fH(e,t){let n=[],r=i=>{for(let s of i){if(s.kind==="paragraph"){n.push({id:s.id,length:Ii(s).length});continue}if(s.kind==="textValue")continue;if(s.kind==="contentControl"){r(t.contentChildrenOf(s));continue}r(s.children);}};if(r(t.contentChildrenOf(e)),n.length>0){let i=n[0],s=n[n.length-1];return {anchor:{paragraphId:i.id,offset:0},head:{paragraphId:s.id,offset:s.length}}}let o=null,a=i=>{for(let s of i){if(s.kind==="paragraph"){let l=Ii(s).spanOf(e);if(!l)continue;return o={anchor:{paragraphId:s.id,offset:l.start},head:{paragraphId:s.id,offset:l.end}},true}if(s.kind!=="textValue"&&a(s.children))return true}return false};return a(t.searchRoots()),o}function pH(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlContent"||t.localName==="sdtContent"))return t.children;return []}function mH(e){return {applyHeaderFooterLifecycle(t){let n=null;return e.commit(()=>{let r=e.applyOps([t]);return r.rejected&&(n=String(r.reason??"rejected")),r}),n?{ok:false,reason:n}:{ok:true}},insertPageField(t){if(!e.isHeaderFooterOpen())return false;let n=e.deleteSelectionPlan(),r=n.replaceAt??n.collapseTo;return e.commit(()=>e.applyOps([...n.ops,{op:"insertPageField",paragraphId:r.paragraphId,offset:r.offset,field:t}],e.selectionMark()),()=>e.collapsedAt({paragraphId:r.paragraphId,offset:r.offset+(t==="PAGE_X_OF_Y"?6:1)})),e.lastRejection()===null}}}var Gc="the document is open for viewing",cG="image changes are not supported in suggesting mode",gH="tracked changes need a non-empty author";function hH(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Gc}}return {applyDrawingOps(n){if(e.editingMode()==="view")return t();let r=e.selectionMark(),o={committed:false,rejected:true,opCount:0};return e.commit(()=>(o=e.applyOps(n,r,r),o)),o},applyImageProperties(n){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Gc};let r={ok:false,reason:"invalidArgs"};return e.commit(()=>(r=e.session.applyImageProperties(e.storyScope(),n),{committed:r.ok,rejected:!r.ok,opCount:r.ok?1:0,...r.ok?{}:{reason:r.detail??r.reason}})),r},deleteImage(n){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Gc};let r=e.editingMode()==="suggest",o=e.author();if(r&&(o===void 0||o===""))return {ok:false,reason:"invalidArgs",detail:gH};let a={ok:false,reason:"invalidArgs"};return e.commit(()=>(a=r?e.session.deleteImageTracked(e.storyScope(),n,{author:o,date:e.trackedDate()}):e.session.deleteImage(e.storyScope(),n),{committed:a.ok,rejected:!a.ok,opCount:a.ok?1:0,...a.ok?{}:{reason:a.detail??a.reason}})),a},insertImage(n){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Gc});let r=e.editingMode()==="suggest",o=e.author();if(r&&(o===void 0||o===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:gH});let a=e.actorId();return e.session.insertImage(e.storyScope(),{...n,...e.outsidePromptAt?.(n.paragraphId,n.offset)?{bias:"left"}:{},decodePort:e.decodePort(),...r?{revision:{author:o,date:e.trackedDate()}}:{},...a?{actorId:a}:{}})},replaceImage(n,r,o,a){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Gc});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:cG});let i=e.actorId();return e.session.replaceImage(e.storyScope(),n,r,o,e.decodePort(),{...a,commitGuard:()=>e.editingMode()==="edit"&&a.commitGuard?.()!==false,...i?{actorId:i}:{}})}}}function yH(e){let t=null,n=null,r="",o=()=>{let c=e.session.part(),d=e.revisionDisplayMode(),u=e.revisionAuthorFilter();return {sections:pe(c,d,u),sourceIndexes:qe$1(c,d,u)}},a=c=>{let{sourceIndexes:d}=o(),u=d.indexOf(c);if(u!==-1)return u;let f=d.findIndex(p=>p>c);return f===-1?Math.max(0,d.length-1):f},i=()=>{if(!t)return;let c=AT(e.layout(),t,e.materializedPages?.());c!==t.pageIndex&&(t={...t,pageIndex:c,sectionIndex:e.sectionAtPage(c).sectionIndex});},s=c=>{if(e.entryRefused?.()===true&&t?.scope.rId!==c.rId||!c.rId||e.session.partFor({kind:"headerFooter",rId:c.rId})===null)return false;e.leaveOtherStories?.();let d=e.layout(),u=ET(d,c.rId),f=t,p=f?.scope.rId===c.rId,g=u?null:dG(e.session,c.rId);if(!u&&!g)return false;let y=c.pageIndex??(p&&f?f.pageIndex:u?.pageIndex??0),h=c.kind??(p&&f?f.kind:u?.kind??g.kind),b=c.variant??(p&&f?f.variant:u?.story.variant??g.variant),v=p&&f?f.partName:u?.story.partName??g.partName,S=d.pages[y]??d.pages[u?.pageIndex??0],x=(S?cs(S,{scope:{kind:"headerFooter",rId:c.rId},kind:h,partName:v}):null)??u?.story??{scope:{rId:c.rId},variant:b,partName:v},k=e.selection(),T=f?f.savedBodySelection:{anchor:{...k.anchor},head:{...k.head}},R=p&&f?.sectionIndex!==void 0&&y===f.pageIndex,C=c.sectionIndex??(R?f.sectionIndex:u?e.sectionAtPage(y).sectionIndex:g?a(g.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:c.rId},pageIndex:y,...C!==void 0?{sectionIndex:C}:{},kind:h,variant:x.variant,partName:x.partName,savedBodySelection:T};let E=e.session.paragraphIdsIn(ff(t))[0];if(!E)return t=null,false;let P=c.position?hf(d,{anchor:c.position,head:c.position},t):p?hf(d,k,t):{anchor:{paragraphId:E,offset:0},head:{paragraphId:E,offset:0}};return e.setScopeSelection(P),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;e.leaveOtherStories?.();let c=t.savedBodySelection;t=null,e.setScopeSelection(hf(e.layout(),c,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>TT(t),setActiveScope(c){return c.kind==="body"?(l(),true):c.kind==="headerFooter"?s({rId:c.rId}):false},enterHeaderFooter:s,exitHeaderFooter:l,reconcileOccurrence:i,headerFooterState(){if(!t)return null;let c=e.session.headerFooterResolutionBySection(),d=t.sectionIndex??0,u=o(),f,p,g,y=S=>{let x=u.sourceIndexes[S]??S,k=c[x];if(!k)return false;let R=(t.kind==="header"?k.headers:k.footers).get(t.variant);return !R||R.rId!==t.scope.rId?false:(d=S,f=R.inherited,p=k.titlePage,g=k.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&y(t.sectionIndex))){let S;c.forEach((x,k)=>{let R=(t.kind==="header"?x.headers:x.footers).get(t.variant);!R||R.rId!==t.scope.rId||!(S===void 0||S&&!R.inherited||S===R.inherited&&a(k)<d)||(d=a(k),f=R.inherited,p=x.titlePage,g=x.evenAndOddHeaders,S=R.inherited);});}let h=u.sections[d]?.properties??u.sections.at(-1)?.properties,b=h?.margins.headerTwips,v=h?.margins.footerTwips;return {editing:t.kind,sectionIndex:d,variant:t.variant,rId:t.scope.rId,partName:t.partName,...f!==void 0?{inherited:f}:{},...p!==void 0?{titlePage:p}:{},...g!==void 0?{evenAndOddHeaders:g}:{},...b!==void 0?{headerDistanceTwips:b}:{},...v!==void 0?{footerDistanceTwips:v}:{}}},headerFooterStateStable(c){if(!t)return n=null,r="",null;let d=this.headerFooterState();if(!d)return null;let u=[c,d.editing,d.sectionIndex,d.variant??"",d.rId??"",d.partName??"",String(d.inherited),String(d.titlePage),String(d.evenAndOddHeaders),String(d.headerDistanceTwips??""),String(d.footerDistanceTwips??"")].join("|");return n&&r===u||(n=Object.freeze({...d}),r=u),n}}}function bH(e){return e.length>0&&e.every(t=>t.op==="setDocumentProtection")}function dG(e,t){let n=e.headerFooterResolutionBySection();for(let r=0;r<n.length;r+=1){let o=n[r];for(let a of ["header","footer"]){let i=a==="header"?o.headers:o.footers;for(let[s,l]of i)if(l.rId===t)return {sectionIndex:r,kind:a,variant:s,partName:l.partName}}}return null}function vH(e,t,n){let{sectionIndex:r,sectionStart:o}=e.sectionAtPage(n),a=f=>f[Math.min(r,Math.max(0,f.length-1))],i=f=>{let p=a(f);return t==="header"?p?.headers:p?.footers},s=e.session.headerFooterResolutionBySection(),l=a(s),c=e.layout.pages[n]?.pageFieldSource?.pageNumber??n+1,d=l?.evenAndOddHeaders&&c%2===0?"even":l?.titlePage&&n===o?"first":"default",u=i(s)?.get(d)?.rId;if(!u){if(!e.create({op:"createHeaderFooter",sectionIndex:r,kind:t,variant:d,...d==="first"?{titlePage:true}:{},...d==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;u=i(e.session.headerFooterResolutionBySection())?.get(d)?.rId,e.flushLayout();}u&&e.enter({rId:u,pageIndex:n,sectionIndex:r,kind:t,variant:d});}var uG=500;function fG(e,t,n,r){let o=e.part();return me(o,If$2(o,n,r),t)}function xH(e,t){if(!e)return null;let n=e.session,r=lb$1(e.revisionDisplayMode()),o=e.state().selection.head.paragraphId,a=Uc(n,o,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:Ot(n,o,{kind:"body"}),e.headerFooterState()?.sectionIndex,r,t),i=n.currentPackage(),s=Ff$1(i),l=Gf$1(s),c=Hf$1(s),d=pe(n.part(),r,t),u=fG(n,d,r,t),f=Df$1(u[a]),p=Ef$1(u[a]),g=If$1(f),y=Jf$1(p,c);return {sectionIndex:a,footnote:{resolved:g,...l?{documentAuthored:l}:{},...f?{sectionAuthored:f}:{}},endnote:{resolved:y,...c?{documentAuthored:c}:{},...p?{sectionAuthored:p}:{}}}}function SH(e,t){let n=Ic$1(t);if(!n)return null;let r=tj$1(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=cd(o.root,n.noteId);if(!a)return null;let i=[],s=uG,l=(d,u)=>{if(!(u>32||s<=0)){if(d.kind==="paragraph"&&typeof d.id=="string"){let f=(Nm(o,d.id)??"").replace(/\uFFFC/g,"").trim();if(f){let p=f.slice(0,s);i.push(p),s-=p.length;}return}if(d.kind!=="textValue")for(let f of d.children)l(f,u+1);}};l(a,0);let c=i.filter(Boolean).join(" ").trim();return c.length>0?c:null}function wH(e){return [()=>{zb(e().root);},()=>{Wk(e());},()=>{Sl(e());}]}var pG=50,mG=16;function kH(e){let t=e.schedule??((s,l)=>{let c=globalThis.setTimeout(s,l);return ()=>globalThis.clearTimeout(c)}),n=false,r=null,o=0,a=0,i=s=>{r=t(()=>{if(r=null,!(n||a>=e.steps.length||!e.shouldRun())){if(e.hasPendingInput()){if(o+=1,o>pG)return;i(mG);return}try{e.steps[a]();}catch{return}a+=1,a<e.steps.length&&i(0);}},s);};return i(0),()=>{n=true,r&&r(),r=null;}}var No=null;function Fs(e,t,n){let r=No;No=t===void 0?null:{owner:e,group:t};try{return n()}finally{No=r;}}function gx(e){if(No===null||No.owner!==e)return;let{group:t}=No;return No=null,t}function gG(e,t){No===null&&(No={owner:e,group:t});}var Xp=class{current;get value(){return this.current}around(t,n,r,o=true){let a=this.current,i=gx(t);this.current=i??(o?Symbol("command"):void 0);let s;try{s=n();}finally{this.current=a;}return i!==void 0&&!r(s)&&gG(t,i),s}};function IH(e,t){let n=t.indexOf("#"),r=n>0?t.slice(0,n):e.mainDocumentPart,o=e.parts.get(r);return o?eb$1(o,t):null}function RH(e){let{anchor:t,head:n}=e;return t.paragraphId!==n.paragraphId||t.offset!==n.offset?null:`${n.paragraphId}\0${n.offset}`}var hG=1e3,yG=2e3,Yp=class{constructor(t,n=()=>performance.now()){this.currentPackage=t;this.now=n;}currentPackage;now;group;expected=null;startedAt=0;lastTypedAt=0;paragraphId=null;landedNode=null;groupAt(t){let n=this.now();return (this.group===void 0||RH(t)!==this.expected||n-this.lastTypedAt>=hG||n-this.startedAt>=yG||n<this.lastTypedAt)&&(this.group=Symbol("typing"),this.startedAt=n),this.lastTypedAt=n,this.group}landed(t){this.expected=RH(t),this.paragraphId=this.expected===null?null:t.head.paragraphId;let n=this.paragraphId;this.landedNode=n===null?null:IH(this.currentPackage(),n),this.expected===null&&(this.group=void 0);}noteForeignChange(t){let n=this.paragraphId;if(n===null||t.origin===g.projection||t.origin===g.awareness)return;if(t.dirty.includes(n)||t.deleted.includes(n))return this.end();if(t.dirty.length>0||t.deleted.length>0)return;let r=this.landedNode,o=IH(this.currentPackage(),n);r!==o&&(r===null||o===null||!Ka$1(r,o))&&this.end();}end(){this.group=void 0,this.expected=null,this.paragraphId=null,this.landedNode=null;}};function ha(e,t,n=true){let r=e.createElement("div");return r.className=t,r.contentEditable="false",n&&r.setAttribute("aria-hidden","true"),r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",r}function PH(e,t,n){for(let r of e)r.style.width=t,r.style.height=n;}function zc(e,t$1,n$1={}){let r=n$1,o=Pp(n$1),a=r.openedSession??A(t$1,{...n$1.reviewModel?{reviewModel:n$1.reviewModel}:{},...n$1.contentLockPolicy?{contentLockPolicy:n$1.contentLockPolicy}:{}});if(!a.ok)return {ok:false,reason:a.reason,...a.detail?{detail:a.detail}:{},..."limit"in a&&a.limit?{limit:a.limit}:{}};let i$1=HF(a.session,o),s=_b(mc(n$1.unsupportedElementRules??[])),l=bL(i$1),c=l.index,d=n$1.collaborationModel?.session,u$1=n$1.author,f=n$1.scale??96/72,p={resolve:n$1.tableInteractionLabel??(m=>ub(m))},g$1="the document is open for viewing",y="the table of contents is generated and read-only",h=false,b="\0range\0",v$1=u(i$1.currentPackage()),S=n$1.measurer?null:X(f,{context:ua(e.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},serifHangulFace:v$1}),x=n$1.measurer??S.measurer,k=wf$1(),T=Pg();function R(){return n$1.measurer?n$1.producer??"host-measurer":`${n$1.producer??S?.producer??"fixed-measurer"}@scale:${f}`}let C=R(),A$1=n$1.lockedControlNavigation==="atomic",E=e.ownerDocument,P=E.createElement("div"),w=eD(()=>P);P.className="docx-pages",P.style.position="relative",o.listeners(P),P.contentEditable="true",P.spellcheck=false,P.setAttribute("role","textbox"),P.setAttribute("aria-multiline","true"),Zb(P,n$1.translate),P.style.outline="none";let O=ha(E,"docx-selection-overlay"),_=ha(E,"docx-comment-overlay"),q=ha(E,"docx-text-highlight-overlay"),K=null,U=ha(E,"docx-remote-selection-overlay"),M=ha(E,"docx-bookmark-overlay"),Y=ha(E,"docx-table-furniture",false),ne=ha(E,"docx-table-select-layer",false),le=null;e.style.position="relative";let se=[Y,ne,_,M,q,U,O];e.replaceChildren(P,...se);let W=V1(P,()=>f,()=>{let m=Xe?.getActive()??null,I=Ye?.activeNoteScope()??null,F=Ye?.activeNotePageIndex()??null,$=m?OT(P,m.pageIndex):I?MT(P,I.id,F):null;return {layout:Ce(),selection:qt.shownSelection(B),...ze.caretPreference(m?.pageIndex??F??void 0),measurer:x,...St()?{typingStyle:()=>{let V=Ei.formatting();return V.fontSizeHalfPoints?{fontSizePt:V.fontSizeHalfPoints/2,fontFamily:V.fontFamily,bold:V.bold,italic:V.italic,verticalAlign:V.superscript?"superscript":V.subscript?"subscript":"baseline"}:null}}:{},scopedHost:$,...m?{scopedHostKind:"headerFooter"}:I?{scopedHostKind:"note"}:{},...ht?.caretInput(we),suppress:Fe==="view"}}),H=xf(i$1.part()),G=i$1.paragraphIds(),D=G.find(m=>!H.has(m))??G[0]??"",B=r.initialSelection??{anchor:{paragraphId:D,offset:0},head:{paragraphId:D,offset:0}},Z=r.initialDrawingSelectionIntent??{kind:"none"};function X$1(m,I){m.kind===Z.kind&&(m.kind!=="pointer"||Z.kind==="pointer"&&m.drawingNodeId===Z.drawingNodeId)||(Z=m,I&&n$1.onChange?.(kt()));}let N=null,j$2=null;function z(m){return j$2=Q(m),n$1.onChange?.(kt()),false}function Q(m,I=m){return n$1.onRejection?.(I),m}let ue=()=>n$1.onEdit?.(er),oe=new Xp,te=new Yp(()=>i$1.currentPackage()),me="suggesting needs an author before it can propose a change",Se=false,qe=false,xe=null,He=new Map;function $e(){xe=null;for(let m of He.values())xe=m;}function Je(m,I){if(m.paragraphId===I.paragraphId)return m.offset-I.offset;let F=ot();return F.indexOf(m.paragraphId)-F.indexOf(I.paragraphId)}function et(m){if(!xe)return;let{from:I,to:F}=ep(Ce(),xe),$=m.head;Je($,I)>=0&&Je($,F)<=0||(He.clear(),xe=null);}let _e=null,bt=new tp(d??i$1),sn=new Yf(d??i$1,()=>B,()=>ce(i$1,B.head.paragraphId)??i$1.part(),()=>i$1.packageRevision(),()=>tn(ve)?.drawingNodeId??null,()=>Ed());function Mn(m){let I=null;d&&ro.expectHistory(true);let F;try{F=sn.step(m,()=>{if(d)return d[m]();let V=i$1.packageRevision();return I=i$1[m](),i$1.packageRevision()!==V});}finally{d&&ro.expectHistory(false);}if(!F.changed)return;ue();let $=m==="undo"?B1(d,Fr):null;w5($??F.selection??I),Cd(F.outsidePromptId),!$&&F.selection&&F.drawing&&ve.selectDrawing(F.drawing,F.selection.head.paragraphId);}function Be(m){ze.noteModelMoved(),jt();let I=sA(m,Ce(),ot());vt(I.selection),_e=I.format,W.update(),n$1.onChange?.(kt());}function st(){return St()?.properties??null}function St(){return Kb(_e,B)}function wn(m){if(!_e)return;let I=_e.position;m.anchor.paragraphId===I.paragraphId&&m.anchor.offset===I.offset&&m.head.paragraphId===I.paragraphId&&m.head.offset===I.offset||(_e=null);}function no(m,I,F,$,V){let J=yt([...m],F,$,Ke(),true,V);return m.length===I.length||!J.rejected?J:yt([...I],F,$,Ke(),true,V)}function zn(m,I,F,$){let V=ht?.replacementFormatOps(m,I,F);if(V?.length)return V;let J=St()??(nn(B.head.paragraphId).length===0?{base:[],properties:ia(ce(i$1,B.head.paragraphId)??i$1.part(),B.head.paragraphId,B.head.offset,Mt(),wt())}:null);if(!J||F===0||J.properties.length===0&&J.base.length===0)return [];let re=_e?.position??B.head,pe=$&&re.paragraphId===m&&re.offset>=$.start&&re.offset<=$.end?{paragraphId:m,offset:Wm({paragraphId:m,offset:$.start},{paragraphId:m,offset:$.end})}:Zb$2(Ce(),re);return pe.paragraphId!==m||pe.offset!==I?[]:[{op:"setRunProperties",paragraphId:m,start:I,end:I+F,properties:pi$1(J.base,J.properties,Us(m,I))}]}let Xe=null,Ye=null,ht=null,Ce=()=>ht?.layout(we)??we,Si=()=>ht?.active()?ht.paragraphIds():i$1.paragraphIdsIn(Ke()),ln=null,Ke=()=>ff(Xe?.getActive()??null,Ye?.activeNoteScope()??null),va=()=>Ye?.activeNoteScope()?.id??null,Zn=m=>{let I=T.multi?.spans,F=0,$=0;if(I&&I.length>0)for(let V=0;V<I.length;V+=1){let J=I[V];if(F=V,$=J.startIndex,m<J.startIndex+J.pageCount)break}return {sectionIndex:F,sectionStart:$}},Oe=(m,I)=>{if(ht?.active()){let re=ht.paragraphIds();return re.includes(m)?m:re[re.indexOf(I)+1]??null}let F=ce(i$1,m)??ce(i$1,I)??i$1.part();if(eb$1(F,m))return m;let $=fb$1(F,I),V=$?$.children.findIndex(re=>re.id===I):-1,J=$&&V>=0?$.children[V+1]:void 0;return J?.kind==="paragraph"?J.id:null},pn=()=>MA(ht,Xe),ot=()=>ds(Ce(),pn(),va()),ro=_1({textOf:m=>nn(m),order:ot,carried:()=>$1(d)}),Ee=()=>globalThis.performance?.now()??Date.now(),Ht=0,wi=0,An=0,xa=m=>{KM(m)&&n$1.onTiming?.("input",m.timeStamp);},{styleCascade:mn,numberingIndex:Xn,defaultTabStopPt:cn,compatibilityMode:Sa}=$F(i$1),Ho=W1({styleCascade:mn,partOf:m=>ce(i$1,m)??i$1.part()}),ki=null,Ii=n$1.imageDecodePort??q1(E)??K1(),kn=Qf$1({session:i$1,decodePort:Ii,onResourcesChanged:()=>ki?.()}),oo=n$1.drawingStrings??o$1,Ri$1=j(n$1.translate),qs=n$1.tocLabels,Ks=()=>B.anchor.paragraphId!==B.head.paragraphId||B.anchor.offset!==B.head.offset?null:{paragraphId:B.head.paragraphId,offset:B.head.offset},Sm=eL(i$1),td=U1({mintValidatedBytes:(m,I)=>kn.mintValidatedBytes(m,I)}),mr=false,ao=pN(n$1.revisionDisplayMode,!!n$1.reviewModel,m=>ve.setRevisionDisplayMode(m)),nd=ao.view,Mt=ao.projection,wm=ao.changeBars,gr=r.revisionAuthorVisibility??Rp(n$1.hiddenRevisionAuthors),qt=GM({layout:Ce,part:()=>i$1.partFor(Ke())??i$1.part(),view:D0}),io=IA(n$1.revisionMarkup,()=>MF(ao,gr,i$1),()=>it(),()=>{Kt=Ln(wt()),dt.invalidateAll(i$1.packageRevision(),"revision-markup"),dt.flush(),Tt(false);}),wt=io.filter,Us=LA(i$1,Mt,wt),rd=kA(i$1,Mt,wt),js=m=>{let I=ce(i$1,m)??i$1.part();return PA(I,m,Mt(),wt())},Kt,od=dg(i$1),Pi=eg(),Vs=AF(),Ln=(m,I=mr)=>{let F=WF({session:s.view(i$1),measurer:x,producer:C,cache:k,styleCascade:mn,numberingIndex:Xn,defaultTabStopPt:cn,compatibilityMode:Sa,displayMode:Mt(),showFieldCodes:I,revisionAuthorFilter:m,inlineDrawingLayoutForPart:$=>kn.contextForPart($),drawingLayoutTokenForPart:$=>kn.cacheTokenForPart($),drawingTokenForParagraphForPart:($,V)=>kn.drawingTokenForParagraph(V,$),linkProjectors:od,projectFieldLink:$=>Pi.project($)});return Vs.record(F,m),F};Kt=Ln(wt());let so={...i$1,applyTreeOps:(m,I,F,$,V)=>yt(m,I,F,$,true,V?.packageEdits),ensureListDefinition:(m,I)=>Hb$1(d?.identity.actorId,()=>i$1.ensureListDefinition(m,I)),applyPmDoc:m=>Fe==="view"?{committed:false,rejected:true,opCount:0,reason:g$1}:d?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:Nm()?{committed:false,rejected:true,opCount:0,reason:y}:i$1.applyPmDoc(m)},Ci=()=>{},ad=()=>{},Yt=mL({now:Ee,view:()=>Ae(P),pageAfterView:()=>{let m=Nr();return m&&m.size>0?Math.max(...m)+1:void 0},current:()=>we,partial:()=>Qt!==null,revision:()=>i$1.packageRevision(),publish:m=>o.wrap(()=>ka(m))(),snapshot:()=>Cg(T),pendingChanged:m=>e.toggleAttribute("data-docx-layout-pending",m||Qt!==null),passTimed:m=>n$1.onTiming?.("layout",m)}),Qt=r.progressiveOpen?Rc:null,we=Ge(),Yn=n$1.revisionStyles,lo=$L(n$1.showParagraphMarks??false,it,()=>Tt(false)),id=LO({session:so,storyScope:Ke,orderedRange:()=>go(),writeRefusal:()=>yr(true),commit:(m,I)=>We(m,I),goToPosition:(m,I)=>ie.goToPosition(m,I),setSelection:m=>vt(m),beforeChange:it,repaint:()=>Tt(false),options:n$1}),Ti$1=r.reviewAuthorSlots??i(),Ar=rD({layout:Ce,items:()=>i$1.reviewItems(),styles:()=>Yn,slots:Ti$1});function wa(m){Bt(),d?.flushPendingJournals();let I={selection:B,format:_e},F=JSON.stringify(Ei.formatting()),$=iA(B,_e,m,()=>ia(i$1.partFor(Ke())??i$1.part(),B.head.paragraphId,B.head.offset,Mt(),wt()));$!==void 0&&(_e=$,F!==JSON.stringify(Ei.formatting())&&bt.record(I,{selection:B,format:_e},gx(ve)),te.end(),W.update(),n$1.onChange?.(kt()));}let Ei=nN({runFormatRefusal:()=>Vn({type:"toggleMark"},ve)?.reason??null,session:so,applyOutsideToc:(m,I)=>{let F=m.filter($=>!G0($));if(F.length===0)return I(m);h=true;try{return I(F)}finally{h=false;}},storyScope:Ke,paragraphOrder:ot,layout:Ce,selection:()=>qt.shownSelection(B),displayMode:()=>Mt(),authorFilter:wt,paragraphMarkVisible:js,commit:(m,I,F)=>We(m,I,F),orderedRange:()=>qt.shownRange(go()),selectionMark:()=>ut(),textOf:m=>nn(m),selectedCells:()=>N?.cellIds,defaultParagraphStyleId:()=>mn()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n$1.defaultFontFamily??null,pendingFormats:()=>st(),setPendingFormats:wa}),In=oN({session:so,storyScope:Ke,layout:Ce,selection:()=>qt.shownSelection(B),displayMode:()=>Mt(),authorFilter:wt,paragraphMarkVisible:js,commit:(m,I,F)=>We(m,I,F),orderedRange:()=>qt.shownRange(go()),selectionMark:()=>ut(),textOf:m=>nn(m),paragraphOrder:ot,selectedCells:()=>N?.cellIds,armPendingFormats:m=>wa(m),now:Ee,publish:()=>{In.state().mode!=="off"?P.dataset.formatPainter="":delete P.dataset.formatPainter,n$1.onChange?.(kt());}}),sd=zN({session:so,storyScope:Ke,headerFooterSectionIndex:()=>Xe?.getActive()?.sectionIndex,revisionDisplayMode:Mt,revisionAuthorFilter:wt,paragraphOrder:ot,selectedCells:()=>N?.cellIds,editingMode:()=>Fe,publishRefusal:z,caretParagraphId:()=>B.anchor.paragraphId===B.head.paragraphId&&B.anchor.offset===B.head.offset?B.head.paragraphId:null,layout:Ce,commit:(m,I,F)=>We(m,I,{rearmPending:St()??void 0,...F?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>$m(),orderedRange:()=>go(),selectionMark:()=>ut(),collapsedAt:m=>Ne(m),deleteSelectionPlan:()=>Wo(),typingSelectionPlan:()=>Pd(),retainPromptBoundary:m=>Cd(m),paragraphTextOf:m=>nn(m),numberingLevelExists:(m,I)=>Dd(_d$1(Xn(),mn()),m,I)!==null,...CN(()=>_d$1(Xn(),mn())),styleCascade:mn,defaultTabStopPt:cn});function Fn(m,I,F){return Fe!=="suggest"?null:Wm({paragraphId:m,offset:I},{paragraphId:m,offset:F})}let co=tH({session:so,collaborative:!!d,layout:Ce,fieldLinkById:m=>Pi.linkById(m),refusesWrite:()=>yr(true)!==null,withMintActor:m=>Hb$1(d?.identity.actorId,m),storyScope:Ke,replacementLanding:Fn,insertionLanding:(m,I)=>Zb$2(Ce(),{paragraphId:m,offset:I}).offset,selection:()=>B,orderedRange:()=>go(),selectionMark:()=>ut(),textOf:m=>nn(m),commit:(m,I)=>We(m,I)}),L=r1({session:so,storyScope:Ke,editingMode:()=>Fe,writeRefusal:m=>yr(true,[m]),trackedOps:Lm,selection:()=>B,selectionMark:()=>ut(),commit:(m,I)=>We(m,I)}),ae=m=>{let I=Ot(i$1,m,{kind:"body"});if(I.kind==="body")return Ye?.exitNote(),Xe?.exitHeaderFooter(),true;if(I.kind==="headerFooter"){let $=Xe?.activeScope();return $?.kind==="headerFooter"&&$.rId===I.rId?true:(Ye?.exitNote(),Xe?.enterHeaderFooter({rId:I.rId})??false)}let F=HT(we,m);return F?Ye?.activeNoteScope()?.id===F?true:(Xe?.exitHeaderFooter(),Ye?.enterNote(F)??false):false},ie=aH({pagesLayer:P,get container(){return e},scale:()=>f,layout:Ce,bookmarks:()=>i$1.bookmarks(),linkById:m=>Pi.linkById(m)??co.linkById(m),drawingLinkById:m=>cH(we,m),setSelection:m=>vt(Ne(m)),whenLaidOut:(m,I)=>pd(m,I),beginJump:()=>fd(),enterStoryFor:m=>ae(m),isCollapsedSelection:()=>Nt(B,Ne(B.head)),onScrolled:()=>yd(),...n$1.onHyperlinkPopover?{onPopover:n$1.onHyperlinkPopover}:{}}),Me=n1({pagesLayer:P,equationById:m=>L.equationById(m),setSelection:m=>vt(m,false,"none"),...n$1.onEquationPopover?{onPopover:n$1.onEquationPopover}:{}});P.addEventListener("contextmenu",C0),P.addEventListener("click",T0),P.addEventListener("pointermove",S0),P.addEventListener("pointerleave",k0);let Te=DL(P),Le=null;function Ue(m,I,F,$){return Ci(),Yt.finish(),jg(lt(m,I,F,$))}function*lt(m,I,F,$){let V=F?F.authorFilter:wt(),J=!F||F.furnitureSource===Kt;J&&Vs.moved(Kt,V)&&(Kt=Ln(V));let re=F?.layoutSession??T,pe=J||!F?Kt:F.furnitureSource;return I&&Zd(re,I),!F&&$===void 0&&(Qt=null),kn.sync(i$1),yield*b$1({view:s.view(i$1),revision:m,measurer:x,cache:k,session:re,producer:C,styleCascade:mn,defaultTabStopPt:cn,numberingIndex:Xn,furniture:pe,compatibilityMode:Sa,linkProjectors:od,projectFieldLink:ye=>Pi.project(ye),inlineDrawingLayout:kn.bodyContext,inlineDrawingLayoutForPart:ye=>kn.contextForPart(ye),drawingTokenForParagraph:ye=>kn.drawingTokenForParagraph(ye,i$1.part().name),drawingTokenForParagraphForPart:(ye,Ie)=>kn.drawingTokenForParagraph(Ie,ye),drawingLayoutEpoch:kn.cacheTokenForPart(i$1.part().name),drawingLayoutEpochForPart:ye=>kn.cacheTokenForPart(ye),displayMode:Mt(),showFieldCodes:F&&!F.live?false:mr,fieldResults:o.mode,revisionAuthorFilter:V,bodyBlockLimit:$})}function De(){return Ue(i$1.packageRevision(),void 0,{layoutSession:Pg(),furnitureSource:Ln(void 0,false)})}function Ge(){let m=Ee(),I=Ue(i$1.packageRevision(),void 0,void 0,Qt??void 0);return Ht=Ee()-m,I}let tt=rt(()=>P),je=null,ct=0,at=false,Rn=null,Lr=false;function gn(){if(Lr)return;Lr=true;let m=i$1.packageRevision();Rn=kH({steps:wH(()=>i$1.part()),shouldRun:()=>Fe!=="view"&&i$1.editable&&i$1.packageRevision()===m,hasPendingInput:uo,schedule:(I,F)=>{let $=tt.setTimeout(I,F);return ()=>tt.clearTimeout($)}});}function uo(m=true){return WA(e,m)}function Qn(){if(ct>0){at=true,gn();return}if(!uo()){Tt(),gn();return}je===null&&(je=tt.setTimeout(o.wrap(()=>{je=null,dt.pending()===null&&(Tt(),gn());}),0));}let Jn="",fo=null,er=false;function Bt(){if(er||(fo!==null&&(tt.clearTimeout(fo),fo=null),Jn.length===0))return;let m=Jn;Jn="",er=true;try{Fs(ve,te.groupAt(B),()=>ve.type(m)),te.landed(B);}catch(I){throw Jn=m+Jn,I}finally{er=false;}}function ld$1(m){Jn+=m,fo===null&&(fo=tt.setTimeout(o.wrap(()=>{fo=null,Bt();}),0));}function Gs(m,I,F){Bt();let $=F?.trim()||u$1?.trim();if(!$)return z("tracked changes need a non-empty author");if(m!=="deletion"&&I.length===0)return z(`${m} requires non-empty text`);if(m!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(I))return z(`${m} requires text without a paragraph mark`);let V={author:$,date:j$1()},J=go(),re=J.from.paragraphId===J.to.paragraphId&&J.from.offset===J.to.offset;if(m!=="insertion"&&re&&!(m==="replacement"&&N))return z(`${m} needs a non-collapsed selection`);let pe=m==="insertion"?{ops:[],collapseTo:Zb$2(Ce(),J.from)}:Wo($),ye=Lc(pe.ops,V,L0()),Ie=pe.collapseTo;if(m==="insertion"||m==="replacement"){let he=m==="replacement"?pe.replaceAt??pe.collapseTo:pe.collapseTo;ye.push({op:"insertText",paragraphId:he.paragraphId,offset:he.offset,text:I,revision:V}),Ie={paragraphId:he.paragraphId,offset:he.offset+I.length};}let Re=false;return We(()=>{let he=yt(ye,ut(),mo(Ie));return Re=he.committed,he},()=>Ne(Ie)),Re}function Ut(m){Pa=false,bd.without(m),Pa=false;}let hn=uH({settle:()=>it(),refuse:m=>z(m),storyParagraphs:()=>ot(),textOf:m=>nn(m),rangePlan:m=>b5(m),insertionPoint:m=>Zb$2(Ce(),m),selection:()=>B,selectionMark:()=>ut(),commitWithoutFollow:(m,I,F)=>{let $=false;return Ut(()=>We(()=>{let V=yt(m,I,I,Ke(),false);return $=V.committed,V},F)),$},flushLayout:()=>jt(),noteModelMoved:()=>ze.noteModelMoved(),selectionsEqual:Nt}),dt=ea$1({run:m=>{let I=Ee();Ci(),Yt.abandon();let F=OL(lt(m.revision,m,void 0,Qt??void 0),Nr()),$=Yt.run(F,m.revision,UM(m));return Qt=Mg(T,Qt),Ht=Ee()-I,$},currentRevision:()=>i$1.packageRevision(),schedule:m=>{let I=tt.setTimeout(o.wrap(m),0);return ()=>tt.clearTimeout(I)},publish:m=>ka(m)});function ka(m){Ar.releaseLayout(),we=m;let I=ro.map(B);I!==B&&(B=I,ze.noteModelMoved(),Ca()),Qn(),zs.request();}let zs=yL({now:Ee,schedule:(m,I)=>tt.clearTimeout.bind(null,tt.setTimeout(o.wrap(m),I)),revision:()=>i$1.packageRevision(),live:()=>T,current:()=>we,busy:()=>Yt.pending()||Qt!==null,pass:(m,I)=>lt(m,void 0,{authorFilter:wt(),layoutSession:I,furnitureSource:Kt,live:true}),createSession:Pg,adopt:(m,I)=>{T=m,ka(I);}}),Ia=false;ki=()=>{Qt===null&&(dt.invalidateAll(i$1.packageRevision(),"drawing-resources"),!Ia&&(Ia=true,tt.setTimeout(o.wrap(()=>{Ia=false,jt();}),0)));};let cd=i$1.subscribe(m=>{l.retain(m),m.origin!==g.mutationRemote&&m.origin!==g.mutationUndo&&m.origin!==g.mutationRedo&&bt.noteEdit(),_e=null,er||te.noteForeignChange(m),m.origin===g.mutationRemote?(t5(m),ro.note(B,m.dirty,we.revision===m.fromRevision)):ro.noteLocal(),dt.notify(m);}),Fr=d?i$1.collaborationPort(d.documentId):null,Oi=()=>{},Ct=()=>{},hr=false,Dr=null,_o=null,Bo=d?d.subscribeRemoteSelections(()=>{hr&&Id();}):()=>{};function Nr(){let m=XF(e,we,B,f),I=Xe?.getActive()?.pageIndex??ze.selectionPageIndex();return I===void 0||m===void 0||m.has(I)?m:new Set([...m,I])}function dd(){at&&Tt();}function jt(){return dt.pending()?dt.flush():false}let Zs=8;function V6(m){!m&&dt.pending()!==null&&Ht>Zs&&uo(false)||(!jt()||m&&at)&&Tt();}function it(){Bt(),jt();}function ud(){Bt();let m=jt();return je!==null||at?(Tt(),gn(),true):m}let Xs=null;function v0(m){return QT(m,i$1.part())}function G6(){for(let m of P.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(m.getAttribute("data-docx-content-control")===Xs){m.dataset.hover="",m.dataset.boundaryVisible="";continue}delete m.dataset.hover,Se||delete m.dataset.boundaryVisible;}}function x0(m){Xs!==m&&(Xs=m,G6());}function km(m){return JT(i$1.part(),w0(m),m.target)}function S0(m){let I=km(m);x0(I?v0(I):null);}function w0(m){let I=m.target,F=I?.isConnected?I.closest("[data-paragraph-id]"):void 0;if(F)return F.dataset.paragraphId;let $=P.ownerDocument;return typeof $.elementFromPoint!="function"?void 0:$.elementFromPoint(m.clientX,m.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function k0(){x0(null);}function z6(){let m=Hr(),I=Eb$1(i$1.part()),F=Fh$1(i$1.part()),$=F.map(he=>{let It=nL(he,we,i$1.part(),x);return It?{...It,empty:I.has(he.beginParagraphId)}:null}).filter(he=>he!==null),V=new Set($.map(he=>he.boundary.id)),J=new Set($.filter(he=>he.empty).map(he=>he.boundary.id));for(let he of F)he.contentControlId&&v0(he)!==he.contentControlId&&J.add(he.contentControlId);let re=m&&!V.has(m.id)?new Set([m.id]):void 0,pe=Xs?new Set([Xs]):void 0,ye=new Set(ef$1(we).filter(he=>he.controlType==="checkbox"&&Rm(he.id)).map(he=>he.id)),Ie=$.filter(he=>he.additional&&!he.empty).map(he=>he.boundary),Re=M0()!==null;if(!(!Se&&!re&&!pe&&!Re&&ye.size===0&&Ie.length===0&&V.size===0))return {...Re?{readOnly:true}:{},...Se?{showAll:true}:{},...re?{activeIds:re}:{},...pe?{hoverIds:pe}:{},...ye.size>0?{checkedIds:ye}:{},...Ie.length>0?{additionalBoundaries:Ie}:{},...V.size>0?{tocControlIds:V}:{},...J.size>0?{suppressedIds:J}:{}}}let Z6=HL(()=>we,()=>B,()=>X6());function Hr(){let m=Ed();if(m)return _L(ce(i$1,m)??i$1.part(),m,we);let I=Ke();return I.kind==="body"?Z6():Y6(I)}function X6(){let m=NL(we,B,x);return m&&ce(i$1,m.id)?.name===i$1.part().name?m:null}function Y6(m){let I=i$1.partFor(m);return I?hg(I,B.head.paragraphId):null}function _r(m){let I=ce(i$1,m),F=eb$1(I??i$1.part(),m);return !F||!ld(F)?null:F}function I0(m){let I=_r(m);if(!I)return null;for(let F of I.children)if(F.kind!=="textValue"&&(F.kind==="contentControlProperties"||F.localName==="sdtPr"))for(let $ of F.children){if($.kind==="textValue"||$.localName!=="tabIndex")continue;let V=$.attributes.find(re=>re.localName==="val")?.value;if(V===void 0)return null;let J=Number(V);return Number.isFinite(J)?J:null}return null}function Q6(){let m=Ke(),I=m.kind==="body"?null:i$1.partFor(m),F=m.kind==="notesPart"?new Set(ot()):void 0;return (I?[...gg(I,F)]:[...ef$1(we)]).filter(V=>lx(V)===null).sort((V,J)=>{let re=I0(V.id),pe=I0(J.id);return re!==null&&pe!==null&&re!==pe?re-pe:re!==null&&pe===null?-1:re===null&&pe!==null?1:0})}let{begin:fd,later:pd}=fL(()=>ve,{flushLayout:()=>{jt();},paragraphIds:()=>i$1.paragraphIds(),scroller:()=>_t(e)});function Im(m){Xe?.getActive()||Ye?.activeNoteScope()||Ot(i$1,m.paragraphId,{kind:"body"}).kind==="body"&&ve.revealPosition(m);}function J6(m){let I=_r(m);if(!I)return false;let F=fH(I,{contentChildrenOf:pH,searchRoots:()=>(i$1.partFor(Ot(i$1,m,Ke()))??i$1.part()).root.children});if(!F)return false;let $=B;return vt(F,false,"none"),(B!==$||Nt(B,F))&&Im(B.anchor),true}let R0=m=>XA(_r(m),()=>i$1.currentPackage());function Rm(m){let I=_r(m);if(!I)return false;for(let F of I.children)if(F.kind!=="textValue"&&!(F.kind!=="contentControlProperties"&&F.localName!=="sdtPr")){for(let $ of F.children)if($.kind==="contentControlCheckbox")for(let V of $.children){if(V.kind!=="contentControlChecked")continue;let J=V.attributes.find(re=>re.localName==="val")?.value;return !(J==="0"||J==="false"||J==="off")}}return false}let P0=m=>YA(_r(m));function md(m,I){for(let F of P.querySelectorAll("[data-docx-content-control]"))F.getAttribute("data-docx-content-control")===m&&(I?F.dataset.open="":delete F.dataset.open);}let Ra=FL({get document(){return P.ownerDocument},layer:P,find:_r,layout:Ce,selectDrawing:(m,I)=>ve.selectDrawing(m,I),allowed:m=>!po.disabledReason(m,"edit"),translate:m=>Js?.(m)??m,replaceImage:(m,I,F,$)=>ve.replaceImage(m,I,F,{expectedPackageRevision:i$1.packageRevision(),commitGuard:$}),setOpen:md,reject:z}),Pm=ZA({find:_r,allowed:m=>!po.disabledReason(m,"edit"),apply:(m,I)=>po.setValue(m,I),items:R0,date:P0,checked:Rm,picture:Ra.drawingOf,replaceImage:Ra.replace,locale:()=>vd$1.get(),layer:P,setOpen:md,request:n$1.onRequestContentControlWidget}),gd=null,Cm;function Tm(m){gd===m&&(gd=null,Cm?.(),Cm=void 0);let I=m.dataset.docxCcId,F=m.contains(P.ownerDocument.activeElement);m.remove(),I&&md(I,false),F&&P.focus({preventScroll:true});}function hd(){Pm.cancel();let m=gd;return m&&Tm(m),m}function C0(m){let I=km(m),F=I&&(Bm(I.id)||!Z0.removeTocRefusal(I.id));Em(F?I.id:null);}let Mi=null;function Em(m){Mi!==m&&(Mi=m,n$1.onChange?.(kt()));}function T0(m){if(m.button===0&&Em(null),m.button!==0||m.target?.closest("a.docx-hyperlink")||!Nt(B,Ne(B.head)))return;let I=w0(m);if(!I)return;let F=Fh$1(i$1.part()).find(J=>J.resultParagraphIds.includes(I));if(!F||km(m)?.id!==F.id)return;let V=Ti(i$1.part(),F,i$1.documentOutline(),Hm(F))[F.resultParagraphIds.indexOf(I)];V&&(m.preventDefault(),ie.goToPosition({paragraphId:V,offset:0}));}let E0={get document(){return P.ownerDocument},locale:()=>vd$1.get(),translate:m=>Js?.(m)??m,setValue:(m,I)=>po.setValue(m,I),close:m=>Tm(m)};function e5(m,I){let F=po.disabledReason(m,"edit");if(F){j$2=Q(F),n$1.onChange?.(kt());return}if(Ra.cancel(),hd()?.dataset.docxCcId===m||(I==="picture"&&Ra.select(m),Pm.open(m,I)))return;if(I==="picture")return Ra.pick(m);if(I==="checkbox"){po.setValue(m,Rm(m)?"false":"true");return}let $=ef$1(we).find(J=>J.id===m)?.alias,V;if(I==="dropdown"||I==="comboBox"||I==="buildingBlockGallery"){let J=R0(m);if(J.length===0&&I==="dropdown")return;V=sF(E0,m,I,J,$,ev(_r(m),J));}else if(I==="date")V=lF(E0,m,P0(m),$);else return;gd=V,iF(V,P,VA(we,f,m,P,At?.pageOffsetX)),md(m,true),Cm=lp(V,()=>Tm(V)),I==="date"?Sp(V):(V.querySelector("input")??V.querySelector('[role=option][tabindex="0"]')??V.querySelector("button,[data-docx-part=empty]"))?.focus({preventScroll:true});}let po={setShowAll(m){Se!==m&&(Se=m,Tt());},setFormFill(m){qe!==m&&(qe=m,n$1.onChange?.(kt()));},showAll:()=>Se,formFill:()=>qe,atCaret:()=>Hr(),navigate(m){let I=Q6();if(I.length===0)return false;let F=Hr(),$=F?I.findIndex(J=>J.id===F.id):-1;m==="next"?$=$<0?0:($+1)%I.length:$=$<0?I.length-1:($-1+I.length)%I.length;let V=I[$];return J6(V.id)},setValue(m,I){let F=po.disabledReason(m,"edit");if(F)return z(F);let $=JA(_r(m),()=>i$1.currentPackage(),m,I);if(!$)return z("unknown-building-block");let V=false;return We(()=>{let J=yt($,ut(),void 0,Ot(i$1,m,Ke()),false);return V=J.committed,J}),V},remove(m){let I=m??Hr()?.id;if(!I)return z("notFound");let F=po.disabledReason(I,"remove");if(F)return z(F);let $=false;return We(()=>{let V=yt([{op:"removeContentControl",controlId:I}],ut(),void 0,Ot(i$1,I,Ke()),false);return $=V.committed,V}),$},disabledReason(m,I){let F=M0();if(F!==null)return F;let $=ef$1(we).find(J=>J.id===m);if($)return I==="remove"?qN($):lx($);let V=_r(m);return V?jp(V,I):"notFound"}},Om=()=>j1(P,Mm&&Fe!=="view");function kt(){return {revision:i$1.packageRevision(),pageCount:we.pages.length,selection:B,cellSelection:N,canUndo:bt.canUndo||(d?.canUndo()??i$1.canUndo()),canRedo:bt.canRedo||(d?.canRedo()??i$1.canRedo()),collaborationStatus:d?.status()??"inactive",lastRejection:j$2,pendingFormat:st(),contentControls:{showAll:Se,formFill:qe,activeControlId:Hr()?.id??null},contextTocId:Mi,formatPainter:In.state(),perf:{layoutMs:Ht,paintMs:wi,selectionMs:An,placed:T.stats.placed,total:T.stats.total,reusedPages:T.stats.reusedPages,fullPasses:T.stats.fullPasses,staleDiscards:dt.staleDiscards,cancelledRuns:dt.cancelledRuns}}}let yn,At,Pa=false,Ys=null,Ai=nD({pagesLayer:P,listeners:w,viewport:()=>Ys,container:()=>e,setContainer:m=>e=m,destroyed:()=>ho,scale:()=>f,settle:()=>{ud(),Ci(),Yt.finish(),hd(),Ra.cancel(),Od?.cancelGesture(),Ni.cancelDrag();},repaint:()=>Tt(false),onHostMoved:m=>n$1.onHostMoved?.(m)});function Tt(m=true){if(je!==null&&(tt.clearTimeout(je),je=null,m=true),Ai.heal(),Ai.parked()){at=false,kd(),m&&n$1.onChange?.(kt());return}at=false;let I=ze.adoptBeforePaint(),F=Ee();yn=Nr(),Xe?.reconcileOccurrence();let $=Xe?.getActive()??null,V=z6(),J=Eb$1(i$1.part());v(P,we,{scale:f,readOnlyParagraphIds:xf(i$1.part()),...J.size>0?{emptyTocPlaceholderIds:J}:{},...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},serifHangulFace:v$1,...n$1.defaultFontFamily?{defaultFontFamily:n$1.defaultFontFamily}:{},materialize:yn,ariaHidden:false,drawingStrings:oo,...qM(s,i$1),breakMarkStrings:Ri$1,...n$1.fieldShading?{fieldShading:n$1.fieldShading}:{},...Yn!==void 0?{revisionStyles:Yn}:{},revisionMarkup:io.current(),facingPages:RA(Ff$1(i$1.currentPackage())),shadeFormFields:Sm(),showParagraphMarks:lo.get(),changeBars:wm(),changeBarsToggle:!!n$1.reviewModel,...td?{imageUrlPort:td}:{},...$?{activeHeaderFooterRId:$.scope.rId,activeHeaderFooterPageIndex:$.pageIndex}:{},...V?{contentControlChrome:V}:{}},Ar.get().value),ht?.syncDom(),vv(P,Ks(),{domReplaced:true}),FT(e,P,$!=null),Yh(e,Fe),At=Tp(we,yn),QF(P,we,At,f),P.style.width=`${At.width*f}px`,P.style.height=`${At.height*f}px`,e.style.width=`${At.width*f}px`,e.style.height=`${At.height*f}px`;let{width:re,height:pe}=At;PH(se,`${re*f}px`,`${pe*f}px`),Ni.update(),wi=Ee()-F,n$1.onTiming?.("paint",wi),al(),Id(),Di(true),id.paint(V0(M)),kd(),Ys?.watchScrollerSize(),ze.mirrorToDom(),O0(Pa),Pa=false,(m||I)&&n$1.onChange?.(kt());}function yd(){it();let m=Nr(),I=Tp(we,m);At&&wv(m,yn)&&YF(I,At)||Tt(false);}let bd=dH({storyScopeOpen:()=>!!(Xe?.getActive()||Ye?.activeNoteScope()),selection:()=>qt.shownSelection(B),layout:Ce,measurer:()=>x,preferredPageIndex:()=>ze.selectionPageIndex(),preferredLineId:()=>ze.selectionLineId(),pagesLayer:P,get container(){return e},scroller:()=>_t(e),scale:()=>f,scheduleRematerialize:()=>Ys?.schedule()});function O0(m=false,I="caret"){bd.follow(m,I);}let Fe=n$1.editingMode??"edit",Mm=true,Qs=Object.freeze({kind:"body"}),vd$1=tF(n$1.locale,Bt),Js=n$1.translate,$t=null,xd=null,Am=null;function yt(m,I,F,$=Ke(),V=true,J){Bt();let re=yr(m.some(A0)||!!J?.length,m,V);if(re!==null)return {committed:false,rejected:true,opCount:0,reason:re};let pe=Lm(V&&$t?$t.annotate(m):m),ye=Li(pe,I,F,$,J);return V&&$t?.afterApply(ye.committed),ye.committed&&pe.some(Ac)&&r.onTrackedChange?.(),ye}let{apply:Li,noteRemoteChange:t5}=oH({session:i$1,collaboration:d,historyGroup:()=>oe.value,defaultScope:()=>Ke(),canRepair:()=>!ho&&Fe!=="view"&&i$1.editable,later:m=>tt.setTimeout(o.wrap(m),0)});function yr(m,I=[],F=true){if(lr(e))return xs(e);let $=bH(I);return Fe==="view"&&!$?g$1:mr&&m&&F&&!$&&tL(V=>ce(i$1,V),B)?di:m&&!$&&(F&&!h&&Nm()||I.some(V=>G0(V)))?y:Fe==="suggest"&&!u$1?.trim()&&m?me:Fe==="suggest"?TO(i$1,u$1,I):null}let M0=tO(()=>yr(true,[],false),()=>i$1.editable);function A0(m){return m.op!=="acceptRevision"&&m.op!=="rejectRevision"&&m.op!=="acceptAllRevisions"&&m.op!=="rejectAllRevisions"&&m.op!=="setRevisionAttribution"}let L0=()=>io.current().trackFormatting&&!i$1.trackingSettings().doNotTrackFormatting;function el(){let m=u$1?.trim();return Fe==="suggest"&&m?m:void 0}function F0(m,I,F){let $=ce(i$1,m)??i$1.part(),V=el()!==void 0;return zE($,m,I,F,V)}function Lm(m,I=j$1()){let F=el();return F===void 0?[...m]:Lc(m,{author:F,date:I},L0())}function D0(){return {displayMode:Mt(),authorFilter:wt()}}function N0(m){let I=qt.removedCaretEdit(B.head,m);return I===null?false:(We(()=>yt(I.ops,ut(),mo(I.caret)),()=>Ne(I.caret)),true)}let H0=D1({selection:()=>B,layout:Ce,textOf:m=>nn(m),fieldBoundary:()=>$t?.wordDeletionBoundary,promptIsSelected:()=>g5(),deleteSelection:()=>ve.deleteSelection(),deleteCharacter:m=>m==="backward"?ve.deleteBackward():ve.deleteForward(),deleteAtomicControl:Sd,commitWord:(m,I)=>{We(()=>yt(m,ut()),I&&(()=>Ne(I)),{rearmPending:St()??void 0});}});function Sd(m,I){let F=p5(m,$=>qt.shown($),I);if(F?.kind==="select")vt(F.selection);else if(F){let $=St()??void 0;We(()=>yt(F.ops,ut(),mo(F.collapseTo)),()=>Ne(F.collapseTo),{rearmPending:$});}return F!==null}function mo(m){return {paragraphId:m.paragraphId,start:m.offset,end:m.offset}}function We(...m){if(lr(e))return Q(xs(e));let I=zL(e);try{return n5(...m)}finally{I();}}function n5(m,I,F={}){Bt(),er||te.end();let $=sn.begin();F?.keepCellSelection||(N=null),_e=null,ze.noteModelMoved(),ct+=1;let V=null;try{let J=oe.around(ve,m,pe=>typeof pe=="boolean"?pe:pe.committed,!F?.automation),re=typeof J=="boolean"||!J.rejected?null:J;if(re){let pe=String(re.reason??Ic);V=j$2=Q(JE(pe,i$1.settingsRoot()),pe);}else {j$2=null,(typeof J=="boolean"?J:J.committed)&&ue();let pe=I?.();pe&&(ol(),B=pe,X$1({kind:"none"},!1),Le=null,Pa=!0);let ye=F?.rearmPending;if(ye&&ye.properties.length>0){let{anchor:Ie,head:Re}=B;Ie.paragraphId===Re.paragraphId&&Ie.offset===Re.offset&&(_e={properties:ye.properties,base:ye.base,position:Re});}}$(),Ca();}catch(J){if((ct-=1)===0&&at)try{Tt();}catch{}throw J}return ct-=1,V6(V!==null),V}function r5(){if(!yn)return true;for(let m of [B.anchor,B.head]){let I=df$1(Ce(),m);if(I&&!yn.has(I.pageIndex))return false}return true}function Ca(){let m=d;if(!m)return;let I=Fr?iD(N?.text??B,$=>{let V=ce(i$1,$)??i$1.part();return sD(V,$)},N?"cells":void 0):null,F=I?`${I.anchor.paragraphId}:${I.anchor.offset}|${I.head.paragraphId}:${I.head.offset}|${I.kind??""}`:"";F!==_o&&(_o=F,m.setLocalSelection(I));}function vt(m,I=false,F="caret",$){let V=!Nt(m,B);ht?.active()&&(!ht.contains(m.anchor.paragraphId)||!ht.contains(m.head.paragraphId))&&ht.exit(false),V&&Jn.length>0&&Bt();let J=$t?.beforeSelect(m);if(J===null)return;V&&Td(),V&&!er&&(te.end(),bt.endGroup()),m=J??m,wn(m),et(m);let re=Hr()?.id??null,pe=ir(i$1.part(),B.head)?.id;ol(),B=m,N=null,I||(Le=null),r5()||(ze.noteModelMoved(),F==="none"?bd.without(()=>Tt(!1)):Tt(false)),ze.noteSelectionSettled(),ze.notePointerCaret($),ze.mirrorToDom(true),O0(true,F),al(),Ta.clear(),Di();let ye=Hr()?.id??null,Ie=ir(i$1.part(),B.head)?.id;(re!==ye||pe!==Ie)&&Tt(false),Ca(),n$1.onChange?.(kt());}let ze=mN({session:i$1,storyScope:Ke,pagesLayer:P,selection:()=>B,setSelection:m=>vt(m),adoptSelection:m=>{let I=$t?.beforeSelect(m);I!==null&&(m=I??m,Nt(m,B)||Td(),wn(m),et(m),ol(),B=m,Le=null,Pa=true,Ca());},commit:m=>We(m),insertOwner:()=>ps(Hr()),compositionUsesTyping:()=>Pd().outsidePromptId!==void 0,promptLanding:F0,applyOps:(m,I,F)=>yt(m,I,void 0,F),hasPendingInput:()=>Jn.length>0,replacementOffset:(m,I,F)=>Wm({paragraphId:m,offset:I},{paragraphId:m,offset:F}),render:()=>Tt(),flushLayout:()=>jt(),flushToPaint:()=>ud(),updateCaret:()=>{W.update(),vv(P,Ks());},textOf:m=>nn(m),pendingFormatOps:(m,I,F,$)=>zn(m,I,F,$),selectionMark:()=>ut(),now:Ee,recordSelectionMs:m=>{An=m;},isGesturing:()=>Z.kind==="pointer"||(Od?.dragging()??false),domSelection:()=>N?Ne(N.text.anchor):B,holdsCellSelection:()=>N!==null,replaceSelectionWith:m=>ve.type(m),discardPaint:()=>t(P)});Xe=yH({session:i$1,layout:()=>we,sectionAtPage:Zn,revisionDisplayMode:Mt,revisionAuthorFilter:wt,selection:()=>B,setScopeSelection:m=>{Bt(),ol(),wn(m),Ta.clear(),B=m,N=null,Le=null,Ca();},noteModelMoved:()=>ze.noteModelMoved(),render:()=>Tt(),mirrorToDom:()=>ze.mirrorToDom(),notify:()=>n$1.onChange?.(kt()),materializedPages:()=>yn,entryRefused:()=>Fe==="view",leaveOtherStories:()=>{Ye?.exitNote(),ht?.exit();}}),Ye=hN({session:i$1,exitHeaderFooter:()=>{Xe?.exitHeaderFooter(),ht?.exit();},applyOps:yt,commit:We,selection:()=>B,selectionMark:()=>ut(),orderedStart:()=>$m(),deleteSelectionPlan:()=>Wo(),undo:()=>ve.undo(),activeScope:()=>{let m=ht?.active();if(m)return m;let I=Ye?.activeNoteScope();return I||(Xe?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:m=>Xe.setActiveScope(m),setSelection:m=>vt(m),noteModelMoved:()=>ze.noteModelMoved(),render:()=>{jt()||Tt();},revealNote:m=>{jt();for(let I of we.pages){let F=[...I.footnotes?.notes??[],...I.endnotes?.notes??[]].find($=>$.scopeId===m);if(F)return sl(F.box.y,F.box.height,{block:"nearest",offsetPx:48}),I.index}return null},notify:()=>n$1.onChange?.(kt()),lastRejection:()=>j$2,setLastRejection:m=>{j$2=m===null?null:Q(m);}});function wd(m){m&&Bt(),N=m,m&&(wn(m.text),ol(),B=m.text),Le=null,ze.noteSelectionSettled(),ze.mirrorToDom(),al(),Ta.clear(),Di(),Ca(),n$1.onChange?.(kt());}let $o=null;function o5(){let I=df$1(Ce(),B.head)?.pageIndex??0,F=new Set;for(let $=I-1;$<=I+1;$+=1)$>=0&&$<we.pages.length&&F.add($);return F}function a5(){let m=i$1.revision(),I=yn??o5();if($o?.layout===we&&$o.revision===m&&wv($o.pages,I))return $o.rects;let F=I?mf$1(we,I):()=>true,$=[];for(let re of Fi()){if(re.kind==="comment"){if(re.range===null||!F(re.range.start.paragraphId,re.range.end.paragraphId))continue;$.push({key:ql(re),from:{paragraphId:re.range.start.paragraphId,offset:re.range.start.offset},to:{paragraphId:re.range.end.paragraphId,offset:re.range.end.offset}});continue}let pe=ql(re),ye=re.kind==="revision"?re.ranges:re.range?[re.range]:[];for(let[Ie,Re]of ye.entries())F(Re.start.paragraphId,Re.end.paragraphId)&&$.push({key:ye.length===1?pe:`${pe}${b}${Ie}`,from:{paragraphId:Re.start.paragraphId,offset:Re.start.offset},to:{paragraphId:Re.end.paragraphId,offset:Re.end.offset}});}let V=EF(we,$,I,x),J=[];for(let[re,pe]of V)for(let ye of pe)J.push({...ye,key:re});return $o={layout:we,revision:m,pages:I,rects:J},J}let Ta=new Set,tl=null,nl,rl=null,Fm=false,_0=false;function ol(){Fm||(rl=null);}function B0(){let m=rl;if(!m||!B)return null;let I=($,V)=>$.paragraphId===V.paragraphId&&$.offset===V.offset;if(!I(B.anchor,m.anchor)||!I(B.head,m.head))return null;let F=Fi().find($=>ql($)===m.key);return !F||F.kind==="custom"&&!F.carded||F.kind==="revision"&&tl!==null&&tl.has(F.revisionKind)&&(F.revisionKind!=="format"||nl===void 0||nl.has(F.formattingKind??""))&&!_0?null:F}function Dm(){let m=B0();if(m)return $0(m);if(!B)return null;let F=zl$1(Fi(),B.anchor,B.head,c()).filter($=>!($.kind==="comment"&&$.resolved)&&!Ta.has(ql($))&&!($.kind==="custom"&&!$.carded)&&!($.kind==="revision"&&tl!==null&&tl.has($.revisionKind)&&($.revisionKind!=="format"||nl===void 0||nl.has($.formattingKind??""))))[0];return F?$0(F):null}function $0(m){if(m.kind!=="comment")return m;let I=Bl(Fi(),m);return Ta.has(ql(I))?null:I}function Fi(){return gr.filterItems(i$1.reviewItems())}let W0=oD({roster:Ar.get,styles:()=>Yn,slots:Ti$1}),q0=W0.forAuthor,i5=W0.declaredFor;function s5(m,I,F){let $=m.split(b),V=$[0],J=I.has(V);if(m.startsWith("comment-")){let Re=F.get(V),he=Re?.kind==="comment"&&Re.resolved;return he&&!J?null:J?`docx-comment-band docx-comment-band--active${he?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(m.startsWith("custom-"))return J?"docx-comment-band docx-comment-band--active":null;let re=F.get(V);if(!re||re.kind!=="revision")return null;let pe=$.length>1?Number($[1]):0;return `docx-revision-band docx-revision-band--${(Re=>Re==="delete"||Re==="moveFrom"?"delete":Re==="insert"||Re==="moveTo"?"insert":Re==="replace"&&re.replacedRangeCount!==void 0?pe<re.replacedRangeCount?"delete":"insert":"other")(re.revisionKind)}${J?" docx-revision-band--active":""}`}let K0=null,U0,j0=null;function Di(m=false){let I=Dm(),F=I&&ql(I),$=fp(Fi,F,n$1.pairsReplacements?.()),V=[...$].join(`
30
+ `),J=Ar.get();if(!m&&K0===we&&U0===V&&j0===J.resolved)return;let re=CL(Fi()),pe=[];for(let ye of a5()){let Ie=s5(ye.key,$,re);if(!Ie)continue;let Re=ye.key.split(b)[0],he=re.get(Re),It=he?kv(he):null,Br=It===null||It===""?void 0:J.resolved.get(It),Jt=he?.kind==="revision"&&$.has(Re)?Br?.style?.activeBackground:void 0;pe.push({...ye,className:Ie,...Br?{reviewAuthor:Br}:{},...Jt!==void 0?{activeBackground:Jt}:{}});}w$1(_,we,pe,{scale:f,...At?{pageOffsetX:At.pageOffsetX}:{}}),K0=we,U0=V,j0=J.resolved;}function al(){$t?.update(),le?.update();let m=N?la$1(we,N.cellIds):xe?kf$1(Ce(),xe,ot(),x):aA(Ce(),B,ot,x);w$1(O,we,m,{scale:f,pageOffsetX:At?.pageOffsetX,...N?{}:{className:xe?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function V0(m){return {layer:m,layout:we,revision:i$1.packageRevision(),scale:f,measurer:x,...yn?{pages:yn}:{},...At?{pageOffsetX:At.pageOffsetX}:{}}}function kd(){K?.(V0(q));}function Id(){if(!hr){U.replaceChildren();return}let m=d;if(!m){U.replaceChildren();return}lD(U,we,m.remoteSelections(),{scale:f,pageOffsetX:At?.pageOffsetX,...yn?{pages:yn}:{},colorForAuthor:q0,declaredColorFor:i5,labelHost:Dr,measurer:x});}function Rd(m){let I=Fh$1(i$1.part());if(m)return I.find(V=>V.id===m)??null;let F=Mi?I.find(V=>V.id===Mi):void 0;if(F)return F;let $=B.head.paragraphId;return I.find(V=>V.beginParagraphId===$||V.endParagraphId===$||V.resultParagraphIds.includes($))??(I.length===1?I[0]:null)}function Nm(){return ZT(i$1.part(),B)}function G0(m){return XT(i$1.part(),m)}function z0(){return new Set(Fh$1(i$1.part()).flatMap(m=>[m.beginParagraphId,...m.resultParagraphIds,m.endParagraphId]))}function Hm(m){return new Set([m.beginParagraphId,m.endParagraphId,...m.resultParagraphIds])}function l5(m){let I=0;for(let F of we.pages)for(let $ of Ja$2(F))m.has($.paragraphId)&&(I+=$.lines.length);return I}function _m(m,I){let F=new Set(I),$=new Map;for(let V of m.pages)for(let J of Ja$2(V)){if(!F.has(J.paragraphId)||$.has(J.paragraphId))continue;let re=V.pageFieldSource;$.set(J.paragraphId,vd(re?.pageNumber??V.index+1,re?.format));}return $}let{canRefreshToc:Bm,pointAtToc:c5,removal:Z0}=oL({session:i$1,editingMode:()=>Fe,target:Rd,writeRefusal:m=>yr(true,m,false),apply:(m,I)=>Li(m,I,void 0,Qs),removed:()=>Em(null),select:m=>vt(Ne(m)),pointedTocId:()=>Mi,refuse:(m,I)=>{j$2=Q(m,I);}});function X0(m,I){if(!Number.isInteger(m)||!Number.isInteger(I)||m<1||I<1)return null;let F=sd.sectionPropertiesAt(B.head.paragraphId),$=F.pageSize.widthTwips-F.margins.leftTwips-F.margins.rightTwips-F.margins.gutterTwips,V=Math.max(300,Math.floor($/I));return {op:"insertTable",beforeParagraphId:B.head.paragraphId,rows:m,cols:I,columnWidthTwips:V}}function Y0(m,I){if(ht?.active()||Fe==="view"||!i$1.editable)return false;let F=X0(m,I),$=i$1.partFor(Ke())??i$1.part();return F!==null&&En$1($,F)===null}function d5(m,I){if(!Y0(m,I))return false;let F=X0(m,I);if(!F)return false;let $=null,V=i$1.subscribe(re=>{re.caret&&($=re.caret);}),J=false;try{We(()=>{let re=yt([F],ut());return re.committed||(j$2=Q(re.reason??"the table could not be inserted here",re.reason??"table-insert-refused")),J=re.committed,re},()=>{let re=$;return re?Ne({paragraphId:re.paragraphId,offset:re.start}):null});}finally{V();}return J}let Q0='TOC \\o "1-3" \\h';function J0(){let m=Bh$1(Q0);if(!m)return null;let I=i$1.documentOutline(),F=Ri(i$1.part(),I,m,_m(ve.layout(),I.map($=>$.blockId)),z0(),d?.identity.actorId);return {op:"insertToc",beforeParagraphId:B.head.paragraphId,instruction:Q0,alias:qs?.title??"TOC",entries:F.entries,bookmarksToCreate:F.bookmarksToCreate}}function eS(){if(Fe==="view"||!i$1.editable||Nm())return false;let m=J0();return m!==null&&En$1(i$1.part(),m)===null}function u5(){if(!eS())return false;let m=J0();if(!m)return false;let I=new Set(Fh$1(i$1.part()).map(V=>V.id)),F=Li([m],ut(),void 0,Qs);if(!F.committed)return j$2=Q(F.reason??"the table of contents could not be inserted",F.reason??"table-of-contents-refused"),false;let $=Fh$1(i$1.part()).find(V=>!I.has(V.id));return $?tS($.id,"pageNumbers"):true}function tS(m,I="entire"){let F=Rd(m);if(!F||!Bm(F.id))return false;ca(ve);let $=ve.layout(),V=i$1.documentOutline(),J=Ih$1(i$1.part(),V,F.instruction);if(!J)return false;let re=J.map(Ie=>Ie.blockId),pe=c5(F);if(I==="entire"){let Ie=Ri(i$1.part(),V,F.instruction,_m($,re),Hm(F),d?.identity.actorId),Re=Li([{op:"replaceTocResult",tocId:F.id,entries:Ie.entries,bookmarksToCreate:Ie.bookmarksToCreate}],pe,void 0,Qs);if(!Re.committed)return j$2=Q(Re.reason??"the table of contents could not be refreshed",Re.reason??"table-of-contents-refused"),false;if($=ve.layout(),F=Rd(F.id),!F)return true}let ye="";for(let Ie=0;Ie<3;Ie+=1){let Re=_m($,re),he=Ti(i$1.part(),F,V,Hm(F)),It=F.resultParagraphIds.flatMap((tr,qm)=>{let ll=he[qm],nr=ll?Re.get(ll):void 0;return nr===void 0?[]:[{paragraphId:tr,pageNumberText:nr}]});if(It.length===0)break;let Br=It.map(tr=>`${tr.paragraphId}\0${tr.pageNumberText}`).join("");if(Br===ye)break;ye=Br;let Jt=Li([{op:"rewriteTocPageNumbers",tocId:F.id,updates:It}],pe,void 0,Qs);if(!Jt.committed){if(Jt.rejected)return j$2=Q(Jt.reason??"the table of contents page numbers were refused",Jt.reason??"table-of-contents-refused"),false;break}$=ve.layout(),F=Rd(F.id)??F;}return true}function f5(){return ca(ve),OF({session:i$1,editingMode:Fe,collaborationActive:d!==void 0,reviewerFilterActive:gr.filterForSession(i$1)!==void 0,layout:ve.layout(),canonicalUnfilteredLayout:De,styleCascade:mn(),numberingIndex:Xn(),displayMode:Mt()})}let{selectionMark:ut,orderedRange:go,orderedStart:$m,textOf:nn,atomicControlDeletion:p5,selectionOverPrompts:m5,promptIsSelected:g5,splitEndsTheParagraph:h5,deleteSelectionPlan:Wo,typingSelectionPlan:Pd,retainPromptBoundary:Cd,clearPromptBoundary:Td,promptBoundary:Ed,deleteSelectionOps:y5,deleteRangePlan:b5,replacementOffset:Wm}=F1({session:i$1,layout:Ce,selection:()=>B,cellSelection:()=>N,editingMode:()=>Fe,author:()=>u$1,trackedDate:j$1,storyScope:Ke,paragraphOrder:ot,flushPendingInputAndLayout:it,trackedAuthorOrNone:el,atParagraphEnd:(m,I)=>Ho.atParagraphEnd(m,I),revisionView:D0}),{insertPlainText:nS,copyFlavoursNow:v5,pasteRichNow:x5,armForcePlainPaste:S5}=L1({session:i$1,textFormFieldId:()=>$t?.fieldId()??null,typingSelectionPlan:Pd,retainPromptBoundary:Cd,insertOwner:()=>ps(Hr()),richPasteAllowed:()=>!ht?.active(),paragraphIds:Si,layout:Ce,cellSelection:()=>N,editingMode:()=>Fe,storyScope:Ke,paragraphOrder:ot,actorId:()=>d?.identity.actorId,collaborationGate:(m,I)=>d?.gateOperations(m,I)??null,now:Ee,flushPendingInputAndLayout:it,orderedRange:go,selectionMark:ut,deleteSelectionPlan:Wo,consumePendingFormatOps:zn,withoutPendingOnRejection:no,caretMark:mo,suggestion:()=>{let m=el();return m===void 0?void 0:{author:m,date:j$1()}},trackedOps:Lm,trackedChangeLanded:()=>r.onTrackedChange?.(),revisionDisplayMode:Mt,commit:We,selectedDrawing:()=>tn(ve),selectPastedDrawing:(m,I)=>wF(ve,m,I)});function il(m){m&&(ln=null,it(),Kt=Ln(wt()),dt.invalidateAll(i$1.packageRevision(),"tracked-change-filter"),dt.flush(),n$1.onChange?.(kt()));}let ho=false,ve={session:i$1,applyGatedTreeOps:(m,I,F,$)=>Li(m,I,F,$??Ke()),storyScope:Ke,imageDecodePort:()=>Ii,textMeasurer:()=>x,layout:()=>(it(),we),state:kt,currentPage:(m="caret")=>{if(it(),m==="viewport"){let F=ZF(e,we,f);if(F!==null)return F}let I=df$1(Ce(),B.head);return I?I.pageIndex+1:1},automationWriteRefusal:(m,I)=>yr(m.some(A0)||I,m,false),setScale(m){if(!(m>0)||!Number.isFinite(m))return false;if(m===f)return true;let I={scale:f,defaults:S,measurer:x,producer:C,furnitureSource:Kt};try{let F=_t(e),$=F?{x:jF(e,F,f),y:(F.scrollTop-e.offsetTop+F.clientHeight/2)/f}:null;if(f=m,n$1.measurer||(S=X(f,{context:ua(e.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},serifHangulFace:v$1}),x=S.measurer),C=R(),Kt=Ln(wt()),yn=void 0,At=void 0,$o=null,dt.invalidateAll(i$1.packageRevision(),"zoom"),dt.flush(),dd(),F&&$){let V=Math.max(0,$.y*f+e.offsetTop-F.clientHeight/2),J=Number.isFinite(F.scrollHeight)?Math.max(0,F.scrollHeight-F.clientHeight):null;VF(e,F,$.x,f),F.scrollTop=J===null?V:Math.min(V,J),yd();}return !0}catch{(({scale:f,defaults:S,measurer:x,producer:C,furnitureSource:Kt}=I)),yn=void 0,At=void 0,$o=null;try{dt.invalidateAll(i$1.packageRevision(),"zoom-rollback"),dt.flush();}catch{}return false}},enqueueType:ld$1,flushPendingInput:it,type(m){let I=Pd(),F=I.replaceAt??I.collapseTo,$=zn(F.paragraphId,F.offset,m.length),V=!I.outsidePromptId&&I.ops.length===0?ps(Hr()):void 0,J=ZE(F,m,V),re=[...I.ops,I.outsidePromptId&&J.op==="insertText"?{...J,bias:"left"}:J],pe=F0(F.paragraphId,F.offset,m.length),ye={paragraphId:F.paragraphId,start:pe,end:pe},Ie=rd(F,pe,m,$);We(()=>no([...re,...Ie],re,ut(),ye),()=>(Cd(I.outsidePromptId),Ne({paragraphId:F.paragraphId,offset:pe})));},proposeTextChange:(m,I,F)=>Gs(m,I,F),replaceTextInPlace:hn,insertPlainText:m=>nS(m),deleteBackward(){let m=gE(Ce(),N,Fe);if(m)return void ve.applyTableCommandPlan(m);if($t?.selectForDeletion("backward")||Sd("backward"))return;let I=Wo();if(I.ops.length>0){We(()=>yt(I.ops,ut(),mo(I.collapseTo)),()=>Ne(I.collapseTo));return}if(N0("backward"))return;let F=St()??void 0,$=qt.shown(B.head);if($.offset===0){for(let Ie of $a(Ce(),$.paragraphId)){let Re=nn(Ie);if(Re.length!==0){We(()=>yt([{op:"deleteText",paragraphId:Ie,start:Re.length-1,end:Re.length}],ut(),mo({paragraphId:Ie,offset:Re.length-1})),()=>Ne({paragraphId:Ie,offset:Re.length-1}),{rearmPending:F});return}}if(ve.removeListNumber($.paragraphId)||ve.removeParagraphIndent($.paragraphId))return;let V=ot(),J=V.indexOf($.paragraphId),re=V[J-1];if(!re)return;let pe=qt.joinOps(re,$.paragraphId);if(!pe){vt(Ne({paragraphId:re,offset:nn(re).length}));return}let ye=nn(re).length;We(()=>yt(pe,ut(),mo({paragraphId:re,offset:ye})),()=>Ne({paragraphId:re,offset:ye}),{rearmPending:F});return}We(()=>yt([{op:"deleteText",paragraphId:$.paragraphId,start:$.offset-1,end:$.offset}],ut(),mo({...$,offset:$.offset-1})),()=>Ne({...$,offset:$.offset-1}),{rearmPending:F});},splitParagraph(){let m=Wo(),I=m.replaceAt??m.collapseTo,F=St()??{properties:ia(ce(i$1,I.paragraphId)??i$1.part(),I.paragraphId,I.offset,Mt(),wt()),base:[]},$=h5(I),V=$?Ho.followerStyleId(I.paragraphId):void 0,J=pi$1(F.base,F.properties,Us(I.paragraphId,I.offset)),re=$&&Fe==="edit"&&J.length>0?[{op:"setParagraphMarkProperties",paragraphId:I.paragraphId,properties:J}]:[],pe={op:"splitParagraph",paragraphId:I.paragraphId,offset:I.offset,tailStyleId:V},ye=el(),Ie=ye?{author:ye,date:j$1()}:void 0,Re=i$1.documentStyles(),he=sp(Re),It=he??"ListParagraph",Br=new Set(Re.map(nr=>nr.styleId));for(let nr=1;!he&&Br.has(It);nr++)It=`ListParagraph${nr}`;let Jt=Fe!=="view"&&m.ops.every(nr=>nr.op==="deleteText"&&nr.paragraphId===I.paragraphId)&&V===void 0?$A(ce(i$1,I.paragraphId)??i$1.part(),we,I,J,It,mn(),Ie,d?.identity.actorId):null,tr=Ie?[{op:"setParagraphMarkRevision",paragraphId:I.paragraphId,kind:"ins",revision:Ie}]:[],qm=Jt?[Jt,...re,...tr]:[pe],ll=Jt?new Set(Si()):null;GL(i$1,I.paragraphId,nr=>We(()=>no([...m.ops,...re,...qm],[...m.ops,...Jt?[Jt,...tr]:[pe]],ut(),void 0,Jt&&!he?[jA(mn()?.defaultParagraphStyleId??null,It)]:void 0),()=>{if(!ll)return nr();let fS=Si().filter(T5=>!ll.has(T5)),pS=Jt?fS.at(-1):fS[0];return pS?Ne({paragraphId:pS,offset:0}):null},{rearmPending:F}),Oe);},navigate(m,I=false){if(m==="documentEnd"&&ca(ve),it(),!I&&(m==="left"||m==="right")&&(B.anchor.paragraphId!==B.head.paragraphId||B.anchor.offset!==B.head.offset)){let he=go();Le=null;let It=BL(Ce(),he,ot(),m,x);vt(Ne(It),true);return}let F=Ce(),$=Qh(F,qt.shown(B.head),m,Le,Xe?.getActive()??null,va(),x,ze.selectionLineId());if(!$)return;let V=z0(),J=YT(i$1.part(),$.position,["left","wordLeft","lineStart","up","pageUp"].includes(m));if(J&&($={...$,position:J,caret:void 0}),A$1){let he=uN(F,B.head,$.position);he!==$.position&&($={...$,position:he,caret:void 0});}if(ir(i$1.part(),$.position)){if(I)return;let It=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(m)?"up":"down",Br=l5(V)+4;for(let Jt=0;Jt<Br;Jt+=1){let tr=Qh(Ce(),$.position,It,$.desiredX,Xe?.getActive()??null,va(),x);if(!tr||tr.position.paragraphId===$.position.paragraphId&&tr.position.offset===$.position.offset)return;if($=tr,!ir(i$1.part(),$.position))break}if(ir(i$1.part(),$.position))return}Le=$.desiredX,Ye?.activeNoteScope()&&$.pageIndex!==void 0&&Number.isInteger($.pageIndex)&&Ye.setActiveNotePageIndex($.pageIndex);let pe={anchor:I?qt.shown(B.anchor):$.position,head:$.position},ye=I&&!A$1?pe:Kc(F,pe,{atomic:I&&A$1}),Ie=!I&&!Nt(ye,pe),Re=B;vt(ye,true,Ie?"none":"head",Ie?void 0:$.caret),Ie&&(B!==Re||Nt(B,ye))&&Im(B.anchor);},deleteWordBackward:()=>H0.deleteWord("backward"),deleteWordForward:()=>H0.deleteWord("forward"),deleteForward(){if($t?.selectForDeletion("forward")||Sd("forward")||ve.deleteSelection()||N0("forward"))return;let m=St()??void 0,I=qt.shown(B.head),F=nn(I.paragraphId);if(I.offset<F.length){We(()=>yt([{op:"deleteText",paragraphId:I.paragraphId,start:I.offset,end:I.offset+1}],ut()),void 0,{rearmPending:m});return}ot().at(-1)===I.paragraphId&&ca(ve);let $=ot(),V=$[$.indexOf(I.paragraphId)+1];if(V){if($a(Ce(),V).includes(I.paragraphId)){if(nn(V).length===0)return;We(()=>yt([{op:"deleteText",paragraphId:V,start:0,end:1}],ut()),()=>Ne(I),{rearmPending:m});return}We(()=>yt(qt.forwardJoinOps(I.paragraphId,V)??[{op:"joinParagraphs",firstId:I.paragraphId,secondId:V}],ut()),()=>Ne(I),{rearmPending:m});}},...sd,...Ei,setSelection:m=>{Td(),Nt(m,B)||X$1({kind:"programmatic"},false),ro.discard(),vt(m);},selectDrawing(m,I){jt();let F=Is(we,m,I);if(!F)return false;let $=Ne(F);return X$1({kind:"pointer",drawingNodeId:m},Nt($,B)),vt($,true,"none"),sn.noteSelectionAfterEdit(),tn(ve)?.drawingNodeId===m},revealPage(m,I){fd();let F=we.pages.find($=>$.index===m);return !F&&pd(m,()=>ve.revealPage(m,I))?true:F?sl(F.box.y,F.box.height,I):false},revealParagraph(m,I){fd();let F={paragraphId:m,offset:0},$=df$1(Ce(),F);if(!$&&pd(F,()=>ve.revealParagraph(m,I)))return true;if(!$)return false;let V=we.pages.find(J=>J.index===$.pageIndex);return V?sl(V.contentBox.y+$.y,$.height,I):false},revealPosition(m,I){fd();let F=df$1(Ce(),m);if(!F&&pd(m,()=>ve.revealPosition(m,I)))return true;if(!F)return false;let $=we.pages.find(J=>J.index===F.pageIndex);if(!$)return false;let V=sc($,m.paragraphId).y+F.y;return sl(V,F.height,{block:"nearest",...I})},setEditable(m){Mm=m,m||ht?.exit(),Om();},selectAll(){ca(ve);let m=ot(),I=m[0],F=m[m.length-1];!I||!F||vt({anchor:{paragraphId:I,offset:0},head:{paragraphId:F,offset:nn(F).length}});},hyperlinks:co,equations:L,contentControls:po,formatPainter:In,canInsertTable:Y0,insertTable:d5,canInsertToc:eS,insertToc:u5,canRefreshToc:Bm,canEditTextFormField:()=>$t?.canEdit()??false,editTextFormField:()=>$t?.edit()??false,refreshToc:tS,...Z0,refreshRefFieldResults:f5,save:()=>YL(ve,e,()=>ho),saveSteps:()=>QL(ve,e,()=>ho),isInsideToc:m=>eE(i$1.part(),m),retainSelection:()=>{let m=Symbol("selection-pin");return He.set(m,B),xe=B,al(),m},releaseSelection:m=>{He.delete(m)&&($e(),al());},retainedSelection:()=>xe,publishedLayout:()=>we,drawingSelectionIntent:()=>Z,overlayCoordinates:()=>Object.freeze({paintScale:f,pageOffsetX:At?.pageOffsetX??new Map}),commitReviewOps:(m,I)=>{it();let F=B.head.paragraphId,$=nn(F),V=null;return Ut(()=>{V=We(()=>{if(Fe==="view")return {committed:false,rejected:true,opCount:0,reason:g$1};if(d&&(I===void 0||!qA.has(I)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(d){let Ie=d.gateOperations([],Ke());if(Ie)return {committed:false,rejected:true,opCount:0,reason:Ie}}let J=d?.identity.actorId,re=Hb$1(J,()=>m(oe.value)),pe=typeof re.reason=="string"?{reason:re.reason}:{},ye=re.committed;return {committed:ye,rejected:!ye,opCount:0,...pe}},()=>{jt(),ze.noteModelMoved();let J=ot();if(J.length===0)return null;let re=qc(B,F,$,nn(F));return aa(Ce(),J,re)});}),V},revisionDisplayMode:nd,replacementLanding:Fn,applyAutomationOps:(m,I,F,$=false)=>{let V=null,J=I??Qs,pe=We(()=>{let ye=yr(false);if(ye!==null)return V={committed:false,rejected:true,opCount:0,reason:ye};let Ie=null,Re=m(he=>{let It=yr(true,[],false);return It===null?Hb$1(d?.identity.actorId,()=>i$1.ensureHyperlinkRelationship(he,J)):(Ie=It,null)});return Re===null?V={committed:false,rejected:true,opCount:0,reason:Ie??"this engine will not author that hyperlink target"}:!n$1.reviewModel&&($||Re.some(Ac))?V={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:V=yt(Re,void 0,void 0,J,false,F)},()=>{jt(),ze.noteModelMoved();let ye=ot();return ye.length===0?null:aa(Ce(),ye,B)},{automation:true})??Ic;return V??{committed:false,rejected:true,opCount:0,reason:pe}},editingMode:()=>Fe,author:()=>u$1,setAuthor:m=>{u$1!==m&&(Bt(),u$1=m,m?.trim()&&kp(j$2)&&(j$2=null,n$1.onChange?.(kt())));},setDrawingStrings:m=>{oo!==m&&n(oo)!==n(m)&&(oo=m,it(),Tt(false));},setLocale:vd$1.set,setTranslate:m=>{if(Js===m)return;Js=m,Zb(P,m),$t?.update();let I=j(m),F=k$1(I)!==k$1(Ri$1);Ri$1=I,F&&lo.get()&&(it(),Tt(false));},setTocLabels:m=>{qs=m;},setEditingMode:m=>{it();let I=Fe!==m;Fe=m,I&&m==="view"&&ht?.exit(),I&&m==="view"&&Xe?.exitHeaderFooter(),I&&m==="view"&&Ye?.exitNote(),I&&m==="view"&&In.disarm(),hd(),Om(),Yh(e,Fe),I&&Tt(false),j$2=null,n$1.onChange?.(kt());},revisionAuthors:()=>Ar.get().value,setRevisionDisplayMode(m){ho||m===ao.view()||(it(),ao.set(m),il(true));},hiddenRevisionAuthors:()=>gr.hiddenAuthors,setRevisionAuthorVisible(m,I){il(gr.setVisible(m,I));},setAllRevisionAuthorsVisible(m){il(gr.setAllVisible(Ar.get().value.keys(),m));},showAllRevisionAuthors(){il(gr.showAll());},setTrackedChangesFilter(m,I){il(gr.setPredicate(m,I));},collaborationSession:()=>d??null,remotePresenceColor:q0,setShowParagraphMarks:lo.set,setRevisionMarkup:io.set,setUnsupportedElementRules:m=>{let I=_b(mc(m));if(I.view(i$1).currentPackage(),s.view(i$1).currentPackage(),I.geometryKey()===s.geometryKey()){let $=I.includePartial!==s.includePartial;s=I,Kt=Ln(wt()),$&&Tt(false);return}it(),s=I,Kt=Ln(wt()),dt.invalidateAll(i$1.packageRevision(),"unsupported-content"),dt.flush(),n$1.onChange?.(kt());},setRevisionStyles:m=>{m!==Yn&&(Yn=m,it(),Tt(false));},setHighlightPainter(m){K=m,m||q.replaceChildren(),kd();},repaintHighlights:kd,setRemoteCaretLabelHost:m=>{m!==Dr&&(Dr=m,Id());},setReviewActivationExclusions(m,I){nl=I?.formattingKinds?new Set(I.formattingKinds):void 0,tl=m===null?null:new Set(m),Di(),n$1.onChange?.(kt());},activeReviewKey:()=>{let m=Dm();return m?ql(m):null},activateReview:(m,I,F)=>{if(Ta.clear(),_0=F?.allowExcluded??false,rl=I?{key:m,anchor:I.anchor,head:I.head}:{key:m,anchor:B.anchor,head:B.head},I){let $=()=>{Fm=true;try{vt(I,!1,F?.preventScroll?"none":"caret");}finally{Fm=false;}};F?.preventScroll?Ut($):$();return}Di(),n$1.onChange?.(kt());},activatedReviewKey:()=>B0()===null?null:rl?.key??null,dismissActiveReview:()=>{let m=Dm();m&&(Ta.add(ql(m)),rl=null,Di(),n$1.onChange?.(kt()));},navigation:ie,bookmarkEditing:id,bookmarks:()=>i$1.bookmarks(),selectedText(){if(N)return JM(we,N);let{from:m,to:I}=go();return QM(Ce(),m,I,ot())},copyFlavours:()=>{let m=m5();return m&&vt(m),v5()},pasteRich:(m,I)=>x5(m,I),armForcePlainPaste:S5,deleteSelection(){if(!Nt(B,Ne(B.head))&&Sd("backward"))return true;let I=Wo();return I.ops.length===0?false:(We(()=>yt(I.ops,ut(),mo(I.collapseTo)),()=>Ne(I.collapseTo)),true)},setCellSelection:wd,layoutSession:()=>T,undo:()=>{if(Fe==="view"||lr(e)){j$2=Q(g$1),n$1.onChange?.(kt());return}Bt(),te.end(),d?.flushPendingJournals(),bt.step("undo",Be,()=>Mn("undo"));},redo:()=>{if(Fe==="view"||lr(e)){j$2=Q(g$1),n$1.onChange?.(kt());return}Bt(),te.end(),d?.flushPendingJournals(),bt.step("redo",Be,()=>Mn("redo"));},sectionAtPage:Zn,activeScope:()=>{let m=ht?.active();if(m)return m;let I=Ye?.activeNoteScope();return I||Xe.activeScope()},setActiveScope:m=>(it(),m.kind==="frame"?ht.enter(m):m.kind!=="body"&&m.kind!=="headerFooter"&&m.kind!=="note"?false:(ht?.exit(),m.kind==="note"?Ye.enterNote(m.id):(Ye?.exitNote(),Xe.setActiveScope(m)))),insertNote:m=>(it(),Ye.insertNote(m)),deleteNote:(m,I)=>Ye.deleteNote(m,I),convertNote:(m,I)=>Ye.convertNote(m,I),convertAllNotes:m=>Ye.convertAllNotes(m),setNoteProperties:m=>Ye.setNoteProperties(m),enterNote:(m,I)=>(it(),Ye.enterNote(m,I)),exitNote:()=>(it(),Ye.exitNote()),notePropertiesState:()=>{let m=ve.state().selection.head.paragraphId,I=i$1.packageRevision(),F=i$1.currentPackage(),$=i$1.part(),V=Ff$1(F),J=tj$1(F,"footnote"),re=tj$1(F,"endnote"),pe=ve.activeScope().kind==="headerFooter",ye=ve.headerFooterState(),Ie=ye?.rId??null,Re=ye?.sectionIndex??null,he=ln;if(he&&he.packageRevision===I&&he.paragraphId===m&&he.bodyPart===$&&he.settingsPart===V&&he.footnotesPart===J&&he.endnotesPart===re&&he.headerFooterOpen===pe&&he.headerFooterRId===Ie&&he.headerFooterSectionIndex===Re)return he.result;let It=xH(ve,wt());return ln={packageRevision:I,paragraphId:m,bodyPart:$,settingsPart:V,footnotesPart:J,endnotesPart:re,headerFooterOpen:pe,headerFooterRId:Ie,headerFooterSectionIndex:Re,result:It},It},notePreviewText:m=>SH(i$1,m),applyTableCommandPlan(m){if(!m.ok)return {ok:false,code:m.code,reason:m.reason};if(m.selection.kind==="selectCells")return wd(m.selection.cells),{ok:true,changed:false};let I=null,F=i$1.subscribe($=>{$.caret&&(I=$.caret);});try{let $=ut(),V=m.selection.kind==="adoptCommittedCaret";We(()=>yt(m.ops,$),V?()=>{let J=I;return J?Ne({paragraphId:J.paragraphId,offset:J.start}):null}:void 0,m.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{F();}return j$2?{ok:false,code:"invalidArgs",reason:j$2}:{ok:true,changed:true}},enterHeaderFooter:m=>{it();let I=Xe.enterHeaderFooter(m);if(!I)return I;let F=Xe.getActive(),$=F?we.pages[F.pageIndex]:void 0;if(F&&$){let V=F.kind==="header"?$.header:$.footer,J=V?.box.y??(F.kind==="header"?$.box.y:$.box.y+$.box.height-1),re=V?.box.height??1;sl(J,re,{block:"nearest"});}return I},exitHeaderFooter:()=>(it(),Xe.exitHeaderFooter()),headerFooterState:()=>Xe.headerFooterStateStable(i$1.packageRevision()),...mH({applyOps:yt,commit:We,deleteSelectionOps:y5,deleteSelectionPlan:()=>Wo(),orderedStart:$m,selectionMark:ut,collapsedAt:Ne,isHeaderFooterOpen:()=>Xe?.getActive()!==null,lastRejection:()=>j$2}),...hH({session:i$1,applyOps:yt,commit:We,storyScope:Ke,outsidePromptAt:(m,I)=>!!Ed()&&B.head.paragraphId===m&&B.head.offset===I,selectionMark:ut,editingMode:()=>Fe,author:()=>u$1,trackedDate:j$1,decodePort:()=>Ii,actorId:()=>d?.identity.actorId}),...bF({session:i$1,commit:We,storyScope:Ke,outsidePromptAt:(m,I)=>!!Ed()&&B.head.paragraphId===m&&B.head.offset===I,editingMode:()=>Fe,actorId:()=>d?.identity.actorId}),focus:()=>{P.ownerDocument.activeElement!==P&&(P.focus({preventScroll:true}),ze.mirrorToDom(true));},setTableInteractionLabel(m){p.resolve=m;},refreshTableInteractionLabels(){Ni.refreshLabels();},moveTo:Ai.moveTo,park:Ai.park,parked:Ai.parked,hostElement:()=>e,destroy(){if(!ho){ho=true,ad(),Qt=null,Yt.cancel(),zs.cancel();try{ud();}finally{P.removeEventListener("pointerdown",uS,{capture:true}),P.removeEventListener("keydown",Md,{capture:true}),P.removeEventListener("keydown",xa,{capture:true}),P.removeEventListener("pointerdown",xa,{capture:true}),P.removeEventListener("beforeinput",Md,{capture:true}),P.removeEventListener("keydown",iS),C5(),P.removeEventListener("beforeinput",dS),P.removeEventListener("copy",sS),P.removeEventListener("cut",lS),P.removeEventListener("paste",cS),P.removeEventListener("compositionstart",oS),P.removeEventListener("compositionend",rS),Ys?.destroy(),w.clear(),Ai.destroy(),hd(),Pm.destroy(),Ra.destroy(),$t?.destroy(),xd?.destroy(),Am?.destroy(),Od?.destroy(),Ni.destroy(),le?.destroy(),ie.destroy(),Me.destroy(),ze.destroy(),P.removeEventListener("contextmenu",C0),P.removeEventListener("click",T0),P.removeEventListener("pointermove",S0),P.removeEventListener("pointerleave",k0),Te.destroy(),dt.cancel(),je!==null&&tt.clearTimeout(je),je=null,Rn&&Rn(),Rn=null,kn.dispose(),q$1(P),W.destroy(),Bo(),Ct(),Oi(),cd(),e.replaceChildren();}}}};function w5(m){_e=null;let I=$t?.restoreAfterHistory();if(!m&&I&&(B=I),ze.noteModelMoved(),jt(),!m){vt(aa(Ce(),ot(),B));return}if("anchor"in m){let $=ot(),V=!d&&[m.anchor,m.head].every(J=>$.includes(J.paragraphId));vt(V?m:aa(Ce(),$,m));return}let F={anchor:{paragraphId:m.paragraphId,offset:m.start},head:{paragraphId:m.paragraphId,offset:m.end}};vt(ot().includes(m.paragraphId)?F:aa(Ce(),ot(),F));}function sl(m,I,F){let $=_t(e);if(!$||$.clientHeight===0)return false;dd();let V=m*f+e.offsetTop;return pL($,V,I*f,F)&&yd(),true}let{onSelectionChange:k5,onCompositionEnd:rS}=o.methods({...ze}),oS=(...m)=>{ze.adoptBeforeInput(),ud(),ze.onCompositionStart(...m);},Od=null,I5=VL({onRequest:n$1.onRequestTextFormField,onInvalidRequest:n$1.onRequestInvalidTextFormField,locale:vd$1.get,translate:(m,I)=>Js?.(m,I)??m,pagesLayer:P,get container(){return e},listeners:w,part:m=>ce(i$1,m??B.head.paragraphId)??i$1.part(),parts:()=>i$1.storyParts(),protected:(m=B.head.paragraphId)=>_k(i$1.settingsRoot())&&$k(ce(i$1,m)??i$1.part(),m),selection:()=>B,select:(m,I)=>vt(m,false,I?"none":"caret"),reveal:Im,editable:()=>Fe==="edit"&&!mr,apply:m=>hp(m,We,yt),save:(m,I)=>eF(m,I,{session:i$1,commit:We,refusal:()=>yr(true,m,false),gate:(F,$)=>d?.gateOperations(F,$)??null,collaborationActive:d!==void 0})},r.initialTextFormInput);$t=_F(I5,{part:m=>ce(i$1,m),selection:()=>B,select:m=>vt(m),writable:()=>Fe!=="view"&&!mr,compare:Je},o),YE(ve,$t.fieldId),QE(ve,n$1.contentLockPolicy),Am=dF({pagesLayer:P,part:m=>ce(i$1,m??B.head.paragraphId)??i$1.part(),editable:()=>Fe!=="view"&&!mr,protected:m=>_k(i$1.settingsRoot())&&$k(ce(i$1,m)??i$1.part(),m),selection:()=>B,select:m=>vt(m,false,"none"),apply:m=>hp(m,We,yt)}),xd=HA({pagesLayer:P,settings:()=>Ff$1(i$1.currentPackage()),part:m=>ce(i$1,m??B.head.paragraphId)??i$1.part(),editable:()=>Fe==="edit"&&!mr,select:m=>vt(m,false,"none"),canApply:m=>i$1.editable&&yr(true,[m],false)===null,history:m=>ve[m](),apply:m=>hp(m,We,yt)});let R5=KD(ve,{...n$1,onToggleFieldCodes:()=>{it(),mr=!mr,Kt=Ln(wt()),dt.invalidateAll(i$1.packageRevision(),"field-code-view"),dt.flush();}}),aS=iN(ve,()=>(ce(i$1,B.head.paragraphId)??i$1.part()).root),iS=m=>{aS.keydown(m),!xd?.keydown(m)&&(m.defaultPrevented||ze.adoptBeforeInput(),!(Am?.keydown(m)||$t?.keydown(m))&&R5(m));},{onCopy:sS,onCut:lS,onPaste:cS}=UD(ve),P5=jD(ve,{isComposing:()=>ze.isComposing(),insertPlainText:nS,onBrowserSelectionFixup:()=>{ze.mirrorToDom(),ze.noteBrowserSelectionFixup();}}),dS=m=>{ze.adoptBeforeInput(),P5(m);},{onDrawingPointerGesture:uS,onDrawingKeyGesture:Md}=TA({surface:ve,textbox:()=>ht,intent:()=>Z,setIntent:m=>X$1(m,true)});P.addEventListener("pointerdown",uS,{capture:true}),P.addEventListener("keydown",Md,{capture:true}),P.addEventListener("beforeinput",Md,{capture:true}),P.addEventListener("keydown",xa,{capture:true}),P.addEventListener("pointerdown",xa,{capture:true}),P.addEventListener("keydown",iS);let C5=sN(P,aS);P.addEventListener("beforeinput",dS),P.addEventListener("copy",sS),P.addEventListener("cut",lS),P.addEventListener("paste",cS),P.addEventListener("compositionstart",oS),P.addEventListener("compositionend",rS),Ys=JF({pagesLayer:P,container:()=>e,listeners:w,onSelectionChange:k5,rematerialize:o.wrap(yd)}),ht=OA({session:i$1,pagesLayer:P,layout:()=>we,selection:()=>B,setSelection:m=>vt(m,false,"none"),flush:it,...AA(i$1,Zn,()=>({hfScope:Xe,noteOps:Ye})),writable:()=>Mm&&Fe!=="view"&&i$1.editable}),Od=fN({onTextFormDoubleClick:m=>$t?.doubleClick(m)??false,onTextFormPointerUp:m=>$t?.pointerUp(m),pagesLayer:P,get container(){return e},listeners:w,scale:()=>f,pageOffsetX:m=>At?.pageOffsetX.get(m)??0,layout:()=>(Pa=false,bd.without(jt),Ce()),measurer:()=>x,selection:()=>qt.shownSelection(B),setSelection:(m,I)=>{Td(),vt(m,false,"none",I);},cellSelection:()=>N,setCellSelection:m=>wd(m),focus:()=>P.focus({preventScroll:true}),onSelectionSettled:()=>In.applyIfArmed(),activeHeaderFooter:()=>LT(pn()),activeNote:()=>{let m=Ye?.activeNoteScope();return m?{scopeId:m.id,pageIndex:Ye?.activeNotePageIndex()??null}:null},enterHeaderFooter:m=>{it(),Xe?.enterHeaderFooter({rId:m.rId,pageIndex:m.pageIndex,sectionIndex:Zn(m.pageIndex).sectionIndex,kind:m.kind,...m.position?{position:m.position}:{}});},enterNote:(m,I,F)=>{Fe!=="view"&&(it(),Ye?.enterNote(m,I,F));},exitNote:m=>{it(),Ye?.exitNote(m);},exitHeaderFooter:()=>(it(),Xe?.exitHeaderFooter()),enterEmptyHeaderFooter:(m,I)=>{if(Fe==="view")return;it();let F=Xe;F&&vH({session:i$1,layout:we,sectionAtPage:Zn,create:$=>ve.applyHeaderFooterLifecycle?.($),flushLayout:jt,enter:$=>F.enterHeaderFooter($)},m,I);},onContentControlWidget:(m,I)=>e5(m,I),...n$1.reviewModel?{onChangeBarToggle:ao.toggleByChangeBar}:{},isReadOnlyPosition:m=>ir(i$1.part(),m)!==void 0},{...n$1.pointer?{mode:n$1.pointer}:{},...A$1?{atomicInlineControls:true}:{}});let Ni=Q1({pagesLayer:P,furnitureLayer:Y,listeners:w,scale:()=>f,pageOffsetX:m=>At?.pageOffsetX.get(m)??0,read:()=>({layout:we,storeRevision:i$1.packageRevision(),selection:B,cellSelection:N,editingMode:Fe,themeColors:i$1.documentThemeColors()}),session:()=>i$1,applyTableCommandPlan:m=>ve.applyTableCommandPlan(m),label:m=>p.resolve(m)});if(le=yD({pagesLayer:P,layer:ne,listeners:w,scale:()=>f,pageOffsetX:m=>At?.pageOffsetX.get(m)??0,read:()=>({layout:we,selection:B,editingMode:Fe}),label:m=>p.resolve(m),setCellSelection:m=>wd(m),session:()=>i$1,applyTableCommandPlan:m=>ve.applyTableCommandPlan(m)}),Tt(),xd?.sync(),hr=true,Id(),d&&(Ct=d.subscribeStatus(()=>{n$1.onChange?.(kt());})),d&&Fr)try{Oi=d.attach(Fr);}catch{try{d.destroy();}catch{}}return Ca(),Om(),ve.setTableInteractionLabel=m=>{p.resolve=m,Ni.refreshLabels(),le?.update();},ve.refreshTableInteractionLabels=()=>{Ni.refreshLabels(),le?.update();},iL(ve,()=>({measurer:n$1.measurer,producer:n$1.producer,fontAlias:n$1.fontAlias,defaultFontFamily:n$1.defaultFontFamily}),m=>{n$1={...n$1,...m},x=n$1.measurer??S.measurer,C=R();},()=>{ho||(Kt=Ln(wt()),yn=void 0,At=void 0,$o=null,dt.invalidateAll(i$1.packageRevision(),"fonts"),dt.flush());}),NA(ve,()=>ze.isComposing()),{finishPaused:Ci,stop:ad}=uL(ve,()=>e,{pages:()=>P,now:Ee,destroyed:()=>ho,limit:()=>Qt,setLimit:m=>Qt=m,bodyBlockCount:()=>Ng(T),bodyBlock:m=>Og$1(T)?.[m],publish:m=>ka(m),inputPending:()=>uo(false),busy:()=>Yt.pending(),finishBusy:()=>Yt.finish(),composing:()=>ze.isComposing(),prefixPass:m=>lt(i$1.packageRevision(),void 0,void 0,m),finish:o.wrap(()=>{Qt=null,dt.invalidateAll(i$1.packageRevision(),"opening"),dt.flush();})},Rc),{ok:true,surface:o.methods(ve)}}function CH(e,t=()=>null){let n,r={change:new Set,selectionChange:new Set,error:new Set,historyDiagnostic:new Set,diagnostic:new Set,revisionMarkupChange:new Set,reviewItemReveal:new Set,reviewChangesResolved:new Set,hostChange:new Set},o=()=>{let c=t();if(c===n||n===void 0&&c===null)return;n=c;let d=Object.freeze({document:c});for(let u of [...r.hostChange])u(d);},a=0,i=false,s=[],l=c=>{a>0||i?s.push(c):c();};return {defer(c){a+=1;try{return c()}finally{if(a-=1,a===0&&!i){i=true;try{for(;s.length>0;){let d=s;s=[];for(let u of d)try{u();}catch{}}}finally{i=false;}}}},emitError(c,d){l(()=>{for(let u of [...r.error]){if(d&&!d())return;u(c);}});},emitDocumentChange(c){l(()=>{for(let d of [...r.change])d(c);});},emitSelectionChange(){l(()=>{if(o(),!r.selectionChange.size)return;let c=e();for(let d of [...r.selectionChange])d(c);});},emitHistoryDiagnostic(c){l(()=>{for(let d of [...r.historyDiagnostic])d(c);});},emitDiagnostic(c){l(()=>{for(let d of [...r.diagnostic])d(c);});},emitRevisionMarkupChange(c){l(()=>{for(let d of [...r.revisionMarkupChange])d(c);});},emitReviewChangesResolved(c){l(()=>{let d=Object.freeze({...c,skipped:Object.freeze([...c.skipped])});for(let u of [...r.reviewChangesResolved])u(d);});},emitReviewItemReveal(c){l(()=>{let d=Object.freeze({...c});for(let u of [...r.reviewItemReveal])u(d);});},hasErrorHandlers:()=>r.error.size>0,hasDiagnosticHandlers:()=>r.diagnostic.size>0,hasReviewChangesResolvedHandlers:()=>r.reviewChangesResolved.size>0,clear(){s=[];for(let c of Object.values(r))c.clear();},on(c,d){return r[c].add(d),()=>{r[c].delete(d);}}}}var Qp="content controls lock every remaining change; remove the locks to decide them",Jp="every remaining change is in a data-bound content control";var TH={"paragraph-count-unexplained":"edit.unmapped-change","paragraph-reordered":"edit.unmapped-change","unknown-paragraph-id":"edit.unmapped-change","unknown-content-moved":"edit.unmapped-change","unsupported-node":"edit.unsupported-content","split-not-clean":"edit.unmapped-change","join-not-clean":"edit.unmapped-change"},MH=new Map([["the document is open for viewing","edit.read-only"],["the document is read-only","edit.read-only"],["this content is locked","edit.protected-content"],[Dy,"edit.protected-content"],[ni,"edit.read-only"],[ri,"edit.protected-content"],[oi,"edit.protected-content"],[Tf,"edit.protected-content"],[Xr,"edit.suggesting-needs-author"],[Ly,"edit.suggesting-needs-author"],[Wt,"edit.review-module-required"],[WE,"edit.unsupported-content"],[Sv,"edit.unsupported-story"],[di,"edit.field-structure"],[jc,"edit.tracked-structure-unsupported"],[tb,"edit.tracked-structure-unsupported"],[Jy,"edit.tracked-structure-unsupported"],[eb,"edit.tracked-structure-unsupported"],[Ls,"edit.section-mark"],[Gp,"edit.protected-content"],[Vc,"edit.protected-content"],[kc,"edit.refresh-in-progress"],[Cr,"edit.preview-active"],["invalid note scope id","edit.stale-target"],[Ty,"edit.tracking-required"],[Ef,"edit.tracked-image-replace-unsupported"],[Zy,"edit.picture-selected"],[fs,"edit.revision-unsupported"],["note not found","edit.stale-target"]]);function Ds(e){let t=String(e??"refused");return MH.get(t)??t}function Ns(e,t){return (Object.hasOwn(TH,e)?TH[e]:void 0)??B(e)??MH.get(e)??(t!==void 0&&Object.hasOwn(EH,t)?EH[t]:void 0)??"edit.refused"}function Bbe(e){return e===Qp?"review.locked-content":e===Jp?"review.bound-content":D(e.split(":",1)[0])}var EH={notFound:"edit.stale-target",ambiguous:"edit.invalid-argument",locked:"edit.protected-content",bound:"edit.protected-content",typeMismatch:"edit.invalid-argument",kindMismatch:"edit.invalid-argument",outOfBounds:"edit.invalid-argument",unsupported:"edit.unsupported-content",invalidArgs:"edit.invalid-argument"},OH={wasmUnavailable:"font.shaper-unavailable",initializationFailed:"font.shaper-unavailable",missing:"font.missing",forbidden:"font.load-failed",overLimit:"font.size-limit",malformed:"font.malformed",fontFaceLoadFailed:"font.load-failed",loadFailed:"font.load-failed",missingFont:"font.missing",hashMismatch:"font.integrity-mismatch",hashInvalid:"font.integrity-mismatch",metadataMismatch:"font.integrity-mismatch",fontMismatch:"font.integrity-mismatch",unsupportedFaceIndex:"font.unsupported-face",unsupportedFace:"font.unsupported-face"};function AH(e){return e!==void 0&&Object.hasOwn(OH,e)?OH[e]:"font.load-failed"}var hx=Object.freeze([16,33,50,100,200,500,1e3]),LH=2048,bG=6e4,vG=200,xG=20,SG=256,wG=6e4;function kG(){return {now:()=>globalThis.performance?.now()??Date.now(),afterNextFrame(t,n){let r=globalThis.requestAnimationFrame;return typeof r!="function"?false:(r(()=>{t(),globalThis.setTimeout(n,0);}),true)},setTimer(t,n){let r=globalThis.setTimeout(t,n);return r.unref?.(),r},clearTimer:t=>globalThis.clearTimeout(t)}}function Hs(){return {count:0,max:0,bands:new Array(hx.length+1).fill(0),samples:[]}}function FH(e,t){return e[Math.min(e.length-1,Math.ceil(t*e.length)-1)]}function IG(e){let t=[...e.samples].sort((n,r)=>n-r);return Object.freeze({count:e.count,p50Ms:Math.round(FH(t,.5)),p95Ms:Math.round(FH(t,.95)),maxMs:Math.round(e.max),bands:Object.freeze([...e.bands])})}function DH(e){let t=e.clock??kG(),n=e.windowMs??bG,r={interaction:Hs(),layout:Hs(),paint:Hs()},o=null,a=null,i=null,s=[],l=false;function c(p,g){if(!Number.isFinite(g)||g<0)return;let y=r[p];y.count+=1,y.max=Math.max(y.max,g);let h=hx.findIndex(b=>g<=b);if(y.bands[h===-1?hx.length:h]+=1,y.samples.length<LH)y.samples.push(g);else {let b=Math.floor(Math.random()*y.count);b<LH&&(y.samples[b]=g);}o===null&&(o=t.now(),a=t.setTimer(d,n));}function d(){a!==null&&t.clearTimer(a),a=null;let p=o;o=null;let g=r;if(r={interaction:Hs(),layout:Hs(),paint:Hs()},p===null)return;let y={};for(let b of ["interaction","layout","paint"])g[b].count>0&&(y[b]=IG(g[b]));let h=(y.interaction?.count??0)>=xG&&y.interaction.p95Ms>vG;e.deliver({kind:"performance",...h?{code:"performance.slow-interaction"}:{},windowMs:Math.max(0,Math.round(t.now()-p)),...i===null?{}:{pagesBucket:F(i)},...y});}let u=()=>{globalThis.document?.visibilityState==="hidden"&&(s=[],d());};globalThis.document?.addEventListener?.("visibilitychange",u);let f=()=>globalThis.document?.visibilityState==="hidden";return {timing(p,g,y){if(l||!e.enabled())return;if(y&&(i=y()),p!=="input"){c(p,g);return}if(s.length>=SG||f())return;let h=t.now(),b=g>0&&g<=h?g:h;if(s.push(b),s.length>1)return;let v=s,S=false;t.afterNextFrame(()=>{v===s&&(s=[],S=true);},()=>{if(!S||l)return;let k=t.now();for(let T of v)k-T<=wG&&c("interaction",k-T);})||(s=[]);},flush:d,dispose(){l||(d(),l=true,globalThis.document?.removeEventListener?.("visibilitychange",u));}}}function RG(){return {now:()=>globalThis.performance?.now()??Date.now(),setTimer:(e,t)=>{let n=globalThis.setTimeout(e,t);return n.unref?.(),n},clearTimer:e=>globalThis.clearTimeout(e)}}var yx=()=>({activeMs:0,inputEdits:0,commandEdits:0,automationEdits:0}),PG={input:"inputEdits",command:"commandEdits",automation:"automationEdits"};function NH(e){let t=e.clock??RG(),n=e.windowMs??6e4,r=t.now(),o=yx(),a=yx(),i=null,s=null,l=null,c=false,d=false;queueMicrotask(()=>{c||!e.enabled()||(d=true,e.deliver({kind:"session",phase:"start"}));});function u(){s!==null&&t.clearTimer(s),s=null;let y=i;i=null;let h=o;if(o=yx(),!(y===null||!d)){for(let b of Object.keys(h))a[b]+=h[b];e.deliver({kind:"session",phase:"active",durationMs:Math.max(0,Math.round(t.now()-y)),...h,activeMs:Math.round(h.activeMs)});}}function f(){if(c)return;let y=t.now();l!==null&&y-l<=3e4&&(o.activeMs+=Math.max(0,y-l)),l=y,i===null&&(i=y,s=t.setTimer(u,n));}let p=()=>{globalThis.document?.visibilityState==="hidden"&&u();};globalThis.document?.addEventListener?.("visibilitychange",p);function g(){c||(u(),c=true,globalThis.document?.removeEventListener?.("visibilitychange",p),d&&e.deliver({kind:"session",phase:"end",durationMs:Math.max(0,Math.round(t.now()-r)),...a,activeMs:Math.round(a.activeMs)}));}return {activity:f,edit(y){c||(o[PG[y]]+=1,f());},flush:u,end:g}}var bx=new Set,CG=e=>{if(!e.persisted)for(let t of [...bx])try{t();}catch{}};globalThis.addEventListener?.("pagehide",CG);function HH(e){return bx.add(e),()=>{bx.delete(e);}}function TG(e){let t=e.split(":",1)[0];return D(t)?t:"unsupported-revision"}var EG=new Set(["insertImage","openBookmarkDialog","openGoTo","openRevisionMarkupDialog","openCompareDocumentsDialog","compareDocuments","proposeDeletion","proposeInsertion","proposeReplacement","replaceImage","setEditingMode","setReviewDisplayMode","toggleDocumentProtection","toggleParagraphMarks","toggleReviewPane"]);function _H(e){if(EG.has(e.type))return e.type;try{let t=ti(e);return t.supported||t.reason!==Py(e.type)?e.type:void 0}catch{return}}function OG(e){let t=e.type;if(t==="acceptRevision"||t==="acceptAllRevisions")return "accept";if(t==="rejectRevision"||t==="rejectAllRevisions")return "reject";let n=e.action;return n==="accept"||n==="reject"?n:void 0}var BH=new WeakMap;function $H(e,t){let n=BH.get(e);return n?n(t):t()}var vx=new WeakMap;function MG(e,t,n,r){vx.get(e)?.(t,n,r);}var WH=new WeakMap;function AG(e,t,n,r){WH.get(e)?.(t,n,r);}function LG(e,t,n){vx.get(e)?.("edit.internal-invariant",n,"exception",{thrown:t});}function FG(e){let t=e?.code;return t==="notFound"?"save.no-document":t==="invalidState"?"save.document-changed":"save.failed"}var DG=new Set(["split","possible-ungrouped-gesture","possible-fragmented-gesture"]);function qH(e){let t=()=>globalThis.performance?.now()??Date.now(),n=G(()=>[...e.modules.diagnosticListeners,e.events.emitDiagnostic],e.now),r=n.deliver,o=null,a=0,i=0,s=0,l=false;e.events.on("historyDiagnostic",v=>{DG.has(v.kind)&&r({kind:"history",code:`history.${v.kind}`});}),e.customNodes?.observe(v=>{let S=v?.code;(S==="payload-invalid"||S==="payload-missing")&&r({kind:"custom-node",code:`custom-node.${S}`});});let c=e.modules.collaboration?.session,d=c?HG(c,r,t):()=>{},u=DH({deliver:r,enabled:()=>e.events.hasDiagnosticHandlers?.()===true||e.modules.wantsDiagnostic("performance"),...e.performance}),f=NH({deliver:r,enabled:()=>e.events.hasDiagnosticHandlers?.()===true||e.modules.wantsDiagnostic("session"),...e.session}),p=HH(()=>{u.flush(),f.end();}),g=v=>{let S=new Map;for(let[x,k]of v)for(let{reason:T,revision:R,detail:C$1}of x){let A=C({reason:T,...C$1===void 0?{}:{detail:C$1}});if(!A)continue;let E=N(R?.revisionKind),P=E==="format"?O(R?.formattingKind):void 0,w=M(R?.partName),O$1=I(C$1),_=[A,O$1,k,E,P,w].join("|"),q=S.get(_);q?q.count+=1:S.set(_,{count:1,event:{code:A,...k?{operation:k}:{},...E?{changeKind:E}:{},...P?{formattingKind:P}:{},...w?{part:w}:{},...O$1?{cause:O$1}:{}}});}for(let{event:x,count:k}of S.values())r({kind:"review.skipped",...x,count:k});},y=(v,S)=>g([[S.revisions?.skipped??[],OG(v)],[S.revisionAuthors?.skipped??[],"reassign"]]),h=(v,S,x)=>{try{r({kind:"edit.rejected",code:"edit.internal-invariant",origin:"command",...x,cause:K(),errorName:L(v),stage:S});}catch{}},b=v=>{if(v||a===0&&i===0){f.edit("input");return}l||(l=true,f.edit(i>0?"automation":"command"));};return {editorSessionId:n.editorSessionId,surfaceHooks(v,S){return {onRejection:x=>this.inputRejected(x,v()),onTiming:(x,k)=>this.timing(x,k,S()??void 0),onEdit:b}},openStarted(v){o={sizeBucket:E(v.byteLength),start:t()};},openDeferred(){o&&(o.start=null);},openMounting(){o&&o.start===null&&(o.start=t());},openSettled(v){if(!o)return;let{sizeBucket:S,start:x}=o;o=null,r({kind:"document.open",outcome:"opened",sizeBucket:S,pagesBucket:F(gs(v)),durationMs:x===null?0:Math.max(0,Math.round(t()-x)),...NG(v)});},openRejected(v,S,x){let k=o?.sizeBucket;o=null;let T=I(v),R=M(x);r({kind:"document.open",outcome:"rejected",code:A$1(v,S),...k?{sizeBucket:k}:{},...T?{cause:T}:{},...R?{part:R}:{}});},openCrashed(v,S="open-mount"){if(!o)return;let{sizeBucket:x}=o;o=null,r({kind:"document.open",outcome:"rejected",code:"open.failed",sizeBucket:x,cause:K(),errorName:L(v),stage:S}),e.onOpenCrash?.();},continueOpen(v){try{return v()}catch(S){throw this.openCrashed(S,"open-layout"),S}},reviewItem(v,S,x,k){return (T,R)=>{let C=S(T),A=s,E;try{E=v(T,R);}catch(q){throw a===0&&h(q,"review-item",{tracked:k()}),q}if(E.ok||a>0)return E;let P=Ns(E.reason,E.code),w=P==="edit.refresh-in-progress"||P==="edit.collaboration-not-ready",O=E.code==="locked"&&E.reason.startsWith("locked-content:")||E.code==="bound"&&E.reason.startsWith("bound-content:");if(O&&s===A&&r({kind:"edit.rejected",code:P,origin:"command",tracked:k()}),E.code==="notFound"||(E.code==="unsupported"||O)&&C&&!w){let q=C?x(C,R):{},K=C&&{revisionKind:C.revisionKind,partName:q.partName??"",...C.formattingKind?{formattingKind:C.formattingKind}:{}},U=D(E.reason.split(":",1)[0])!==null,M=E.reason===fs?q.detail??"read-only":U?q.detail??I(E.reason):I(E.reason)??q.detail;return g([[[{reason:E.code==="notFound"?"unknown-revision":TG(E.reason),...K?{revision:K}:{},detail:M}],R]]),E}if(s!==A)return E;let _=I(E.reason);return r({kind:"edit.rejected",code:P,origin:"command",tracked:k(),..._?{cause:_}:{}}),E}},exec(v,S,x,k){a===0&&i===0&&(l=false),a+=1;let T;try{T=x();}catch(R){if(a===1){let C;try{C=_H(v);}catch{C=void 0;}h(R,"command",{tracked:S,...C?{command:C}:{}});}throw R}finally{a-=1;}if(a>0)return T;if(T.ok&&!l&&k?.()&&(l=true,f.edit(i>0?"automation":"command")),!T.ok){let R=_H(v),C=I(T.reason);r({kind:"edit.rejected",code:Ns(T.reason,T.code),origin:"command",tracked:S,...R?{command:R}:{},...C?{cause:C}:{}});}return y(v,T),T},inputRejected(v,S){if(a>0||i>0)return;s+=1;let x=Ns(v),k=I(v);r({kind:"edit.rejected",code:x,origin:"input",tracked:S,...k?{cause:k}:{}});},fontFailed(v){r({kind:"font.failed",code:AH(v)});},attach(v,S){let x=v.exec,k=()=>v.getDocumentHandle().revision;v.exec=(R,C)=>{let A=k();return this.exec(R,S(),()=>x(R,C),()=>k()!==A)};let T=v.save;v.save=()=>this.save(()=>T.call(v)),BH.set(v,R=>{a===0&&i===0&&(l=false),i+=1;try{return R()}finally{i-=1;}}),mO(v,(R,C)=>{this.exec(R,S(),()=>C);}),WH.set(v,(R,C,A)=>{let E=I(A);r({kind:"review.skipped",code:R,count:1,...C?{operation:C}:{},...E?{cause:E}:{}});}),vx.set(v,(R,C,A,E)=>{let P=I(A);r({kind:"edit.rejected",code:R,origin:"automation",tracked:C,...P?{cause:P}:{},...E?{errorName:L(E.thrown),stage:"automation"}:{}});});},async save(v){let S=t(),x=()=>Math.max(0,Math.round(t()-S)),k;try{k=await v();}catch(T){try{let R=FG(T);r({kind:"document.save",outcome:"rejected",code:R,durationMs:x(),...R==="save.failed"?{cause:K(),errorName:L(T),stage:"save"}:{}});}catch{}throw T}return r({kind:"document.save",outcome:"saved",sizeBucket:E(k.byteLength),durationMs:x()}),k},timing(v,S,x){v==="input"&&f.activity(),u.timing(v,S,v==="paint"&&x?()=>gs(x):void 0);},dispose(){u.dispose(),d(),f.end(),p();}}}function NG(e){try{let{session:t}=e;return {shape:{parts:F(t.currentPackage().parts.size),paragraphs:F(t.paragraphIds().length),reviewItems:F(t.reviewItems().length),embeddedFonts:F(t.embeddedFonts().length)}}}catch{return {}}}function HG(e,t,n){let r=n(),o="none",a,i=false,s=false,l=-1,c=()=>{let f=e.statusSnapshot(),p=f.reason?.code,g=f.recovering===true;if(f.status===o&&p===a&&g===i)return;let y=f.status==="ready"&&!s,h=y&&o!=="none";y&&(s=true),t({kind:"collab.status",status:f.status,previous:o,...p?{code:`collab.${p}`}:{},recovering:g,...h?{connectMs:Math.max(0,Math.round(n()-r))}:{}}),o=f.status,a=p,i=g;},d=()=>{let f=e.participants().length;f!==l&&(l=f,t({kind:"collab.participants",count:f}));},u=[e.subscribeStatus(c),e.subscribeParticipants(d)];return c(),()=>{for(let f of u)f();}}function KH(e$1,t,n=()=>true){if(!n())return;let r=e$1.code==="wasmUnavailable"||e$1.cause instanceof e&&e$1.cause.code==="unsupportedRuntime";r&&!t.config.onFontError&&!t.events.hasErrorHandlers()&&XR(e$1);try{t.config.onFontError?.(e$1);}catch{}n()&&(t.events.emitError(e$1,n),n()&&t.diagnostics.fontFailed(r?"wasmUnavailable":e$1.code));}var _G=50,BG=7e3,$G="docx-editor-announcer";function UH(e){let t=rt(e),n=null,r=null;return {announce(o){let a=e();if(!a||!o)return;(!n||n.parentElement!==a)&&(n?.remove(),n=a.ownerDocument.createElement("div"),n.className=`docx-editor-sr-only ${$G}`,n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.setAttribute("data-docx-marker",""),n.contentEditable="false",a.append(n));let i=n;i.textContent="",r!==null&&t.clearTimeout(r),t.setTimeout(()=>{i.textContent=o;},_G),r=t.setTimeout(()=>{r=null,i.remove(),n===i&&(n=null);},BG);},dispose(){r!==null&&t.clearTimeout(r),r=null,n?.remove(),n=null;}}}function hi(e){let t=[],n=(r,o)=>{let a=o.kind,i=r.handlers.kinds??e;return typeof a!="string"||!i||i.includes(a)};return {request(r){let o=t.filter(l=>n(l,r)),a=[...o].reverse().find(l=>!l.fallback)??o.at(-1);if(!a?.handlers.onRequest)return false;let{sessions:i,handlers:s}=a;return i.add(r),r.signal.addEventListener("abort",()=>i.delete(r),{once:true}),s.onRequest(r),true},register(r,o){let a={handlers:r,fallback:o?.fallback===true,sessions:new Set};return t.push(a),()=>{let i=t.indexOf(a);if(!(i<0)){t.splice(i,1);for(let s of a.sessions)s.cancel();}}}}}var WG=()=>hi();function jH(e={}){let t=aM(e.changed),n=dc({}),r=ZO(e),o=nM(e),a=WG(),i=hi(["dropdown","comboBox","date","buildingBlockGallery"]),s=hi();return {surfaceOptions:{onRequestTextFormField:a.request,onRequestContentControlWidget:i.request,onRequestInvalidTextFormField:s.request,onHyperlinkPopover:l=>t.current().onPopover?.(l),onRequestHyperlink:()=>t.open(),onEquationPopover:l=>n.current().onPopover?.(l),...r.surfaceOptions},bookmarkDialog:r.bookmarkDialog,goTo:r.goTo,commentDraft:o.requests,link:t.requests,setters:{setTextFormFieldChrome:a.register,setContentControlWidgetChrome:i.register,setInvalidTextFormFieldChrome:s.register,setHyperlinkChrome:t.register,setEquationChrome:n.push,...r.setters,...o.setters}}}function VH(e,t){rM(e,t.commentDraft),iM(e,t.link);}var zH="documents cannot be compared while a collaboration session is attached",UG="this document is protected; only form fields can be filled",jG="this document is protected against edits",ZH="the document is open for viewing",XH="the revised document is empty",em="the dialog is closed",YH="another compare of this dialog is running",xx="the document changed while the compare ran",VG="revised must be a Uint8Array",GG=createT(en),zG=.95,GH=e=>e.engineReason===void 0?{}:{reason:e.engineReason};function tm(e,t){return t||(e.reason===zH?"collaboration":e.reason===ZH?"viewing":e.reason===XH?"empty":e.reason===em?"closed":e.reason===YH||e.reason===kc||e.reason===Cr?"busy":e.reason===xx?"documentChanged":e.reason===Wt||e.code==="notFound"?"unavailable":e.code==="locked"||e.code==="protected"?"protected":"failed")}var ZG=e=>Object.prototype.toString.call(e)==="[object Uint8Array]",XG={protected:"locked",invalidOriginal:"unsupported",tooLarge:"unsupported",unsupportedContent:"unsupported"};function YG(e){if(e.authorName!==void 0&&typeof e.authorName!="string")return "authorName must be a string";for(let t of ["detectFormatChanges","removeDateAndTime"])if(e[t]!==void 0&&typeof e[t]!="boolean")return `${t} must be a boolean`;return null}function QH(e,t){return e.type!=="compareDocuments"?t:{...t,compareDocuments:{ok:false,code:tm(t),message:t.reason}}}function JH(e){let t=null,n=null,r=hi(),o=rt(()=>e.container()),a=UH(()=>e.container()),i=S=>{let x=e.translate()??GG;a.announce(S>0?x("compareDocuments.recorded",{count:S}):x("compareDocuments.recordedNoRevisions"));},s=()=>new Promise(S=>{let x=o.setTimeout(()=>{o.cancelAnimationFrame(k),S();},250),k=o.requestAnimationFrame(()=>{o.clearTimeout(x),o.setTimeout(S,0);});}),l=()=>{if(e.destroyed())return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(!e.contribution()?.compareDocuments)return {ok:false,code:"unsupported",reason:Wt};let S=e.surface();if(!S)return {ok:false,code:"notFound",reason:"no document is open"};if(S.collaborationSession())return {ok:false,code:"unsupported",reason:zH};if(e.viewing())return {ok:false,code:"locked",reason:ZH};let x=e.container();if(x&&lr(x))return {ok:false,code:"unsupported",reason:xs(x)};let k=Vn({type:"compareDocuments"},S);if(k)return k;let T=nj$1(Ff$1(S.session.currentPackage())?.root);return T.enforced&&T.edit==="forms"?{ok:false,code:"locked",reason:UG}:T.enforced&&(T.edit==="comments"||T.edit==="trackedChanges")?{ok:false,code:"locked",reason:jG}:{ok:true}},c=()=>{let S=l();return S.ok?e.contribution()?.createCompareDocumentsDialog?e.container()?{ok:true}:{ok:false,code:"notFound",reason:"the editor is not attached"}:{ok:false,code:"unsupported",reason:Wt}:S},d=S=>{let x=l();if(!x.ok)return {refused:x};if(!ZG(S.revised))return {refused:{ok:false,code:"invalidArgs",reason:VG,engineCode:"invalidOptions"}};if(S.revised.byteLength===0)return {refused:{ok:false,code:"invalidArgs",reason:XH}};let k=YG(S);if(k)return {refused:{ok:false,code:"invalidArgs",reason:k,engineCode:"invalidOptions"}};let T=e.surface();T.flushPendingInput();let R=S.authorName?.trim()||T.author();return {options:{...R?{authorName:R}:{},detectFormatChanges:S.detectFormatChanges!==false,...S.removeDateAndTime===true?{removeDateAndTime:true}:{}}}},u=S=>({ok:false,code:XG[S.code]??"invalidArgs",reason:S.message,engineCode:S.code,...S.reason===void 0?{}:{engineReason:S.reason}}),f=(S,x)=>{let k=e.surface().session.replacePackage(S);return k.ok?{ok:true,changed:k.change!==null,revisionCount:x}:{ok:false,code:"unsupported",reason:`the compare result was refused: ${k.reason}`}},p=S=>{let x=d(S);if("refused"in x)return x.refused;let k=e.surface(),T=e.contribution().compareDocuments(k.session.currentPackage(),S.revised,x.options);return T.ok?f(T.package,T.revisionCount):u(T)},g=async(S,x,k,T)=>{let R=d(S);if("refused"in R)return R.refused;let C=e.surface(),A=C.session.currentPackage(),E=false,P;try{P=await x(rg(A),S.revised,R.options,{signal:k,onProgress:K=>{E=!0,T(K);}});}catch(K){if(E||k.aborted)throw K;return T({phase:"comparing",fraction:0}),await s(),k.throwIfAborted(),e.surface()!==C||C.session.currentPackage()!==A?{ok:false,code:"unsupported",reason:xx}:p(S)}if(!P.ok)return u(P);let w=()=>{let K=l();return K.ok&&(e.surface()!==C||C.session.currentPackage()!==A)?{ok:false,code:"unsupported",reason:xx}:K},O=w();if(!O.ok)return O;if(!P.changed||!P.bytes)return {ok:true,changed:false,revisionCount:P.revisionCount};T({phase:"applying",fraction:zG}),await s(),k.throwIfAborted();let _=w();if(!_.ok)return _;let q=pg(P.bytes);return q.ok?f(q.package,P.revisionCount):{ok:false,code:"unsupported",reason:"the compare result cannot be read"}},y=()=>{if(n){n.cancel();return}let S=t;t=null,S?.destroy();},h=()=>{let S=new AbortController,x=e.contribution()?.compareDocumentsInBackground,k=false,T={signal:S.signal,defaultAuthor:e.surface()?.author()??"",originalHasTrackedChanges:e.surface()?.session.reviewItems().some(R=>R.kind==="revision")??false,canApply:()=>n===T&&!S.signal.aborted&&!k&&l().ok,cancelable:x!==void 0,async apply(R,C){let A=0,E=P=>{S.signal.aborted||P.fraction<A||(A=P.fraction,C?.onProgress?.(P));};if(!T.canApply()){if(k&&n===T&&!S.signal.aborted)return {ok:false,code:"busy",message:YH};let P=l();return P.ok?{ok:false,code:"closed",message:em}:{ok:false,code:tm(P),message:P.reason}}k=true,await s();try{if(S.signal.aborted)return {ok:!1,code:"closed",message:em};let P=x?await g(R,x,S.signal,E):p(R);if(!P.ok)return {ok:!1,code:tm(P,P.engineCode),...GH(P),message:P.reason};let w=P.revisionCount??0;return P.changed&&(T.cancel(),e.surface()?.focus(),i(w)),{ok:!0,revisionCount:w,changed:P.changed}}catch(P){return S.signal.aborted?{ok:false,code:"closed",message:em}:{ok:false,code:"failed",message:P instanceof Error?P.message:String(P)}}finally{k=false;}},cancel(){if(S.signal.aborted)return;n===T&&(n=null);let R=t;t=null,S.abort(),R?.destroy();}};return T},b=S=>{t=e.contribution().createCompareDocumentsDialog({signal:S.signal,defaultAuthor:S.defaultAuthor,originalHasTrackedChanges:S.originalHasTrackedChanges,cancelable:S.cancelable,canApply:S.canApply,apply:S.apply,cancel:S.cancel,container:e.container(),translate:x=>e.translate()?.(x)}),S.signal.aborted?y():t.open();},v=()=>{let S=c();if(!S.ok)return S;y();let x=h();n=x;try{r.request(x)||b(x);}catch(k){throw x.cancel(),k}return {ok:true,changed:false}};return {canOpen:c,canCompare:l,open:v,compare:p,destroyDialog:y,register(S,x){return r.register(S??{onRequest:b},x)},exec(S){if(S.type==="openCompareDocumentsDialog")return v();if(S.type!=="compareDocuments")return null;let x;try{x=p(S);}catch(k){let T=k instanceof Error?k.message:String(k);return {ok:false,code:"unsupported",reason:T,compareDocuments:{ok:false,code:"failed",message:T}}}return x.ok?{ok:true,changed:x.changed,compareDocuments:{ok:true,revisionCount:x.revisionCount??0,changed:x.changed}}:{ok:false,code:x.code,reason:x.reason,compareDocuments:{ok:false,code:tm(x,x.engineCode),...GH(x),message:x.reason}}},can(S){return S.type==="openCompareDocumentsDialog"?c():S.type==="compareDocuments"?l():null}}}function e2(e,t){let n=ib$1(e),r=null,o=null,a=null,i=hi(),s=()=>t.destroyed()?{ok:false,code:"notFound",reason:"the editor was destroyed"}:t.contribution()?.createRevisionMarkupDialog?t.container()?{ok:true}:{ok:false,code:"notFound",reason:"the editor is not attached"}:{ok:false,code:"unsupported",reason:"the review module does not supply a settings dialog"},l=f=>{if(t.destroyed())return;let p=ib$1(f,n);JSON.stringify(p)!==JSON.stringify(n)&&(n=p,t.apply(n),a?.(),t.changed(n));},c=()=>{if(o){o.cancel();return}let f=r;r=null,f?.destroy();},d=()=>{let f=new AbortController,p=new Set,g=n,y=b=>{if(!(f.signal.aborted||JSON.stringify(b)===JSON.stringify(g))){g=b;for(let v of [...p])v();}},h={signal:f.signal,get:()=>g,set(b){f.signal.aborted||y(ib$1(b,g));},reset:()=>y(hb$1),subscribe(b){return f.signal.aborted?()=>{}:(p.add(b),()=>{p.delete(b);})},canApply:()=>o===h&&!f.signal.aborted&&s().ok,apply(){return h.canApply()?(l(g),h.cancel(),true):false},cancel(){if(f.signal.aborted)return;o===h&&(o=null,a=null),p.clear();let b=r;r=null,f.abort(),b?.destroy();}};return a=()=>y(n),h},u=f=>{r=t.contribution().createRevisionMarkupDialog({...f,container:t.container(),translate:p=>t.translate()?.(p)}),f.signal.aborted?c():r.open();};return {current:()=>n,set:l,canOpen:s,register(f,p){return i.register(f??{onRequest:u},p)},open(){let f=s();if(!f.ok)return f;c();let p=d();o=p;try{i.request(p)||u(p);}catch(g){throw p.cancel(),g}return {ok:true,changed:false}},destroyDialog:c}}function t2(e,t){let n=e2(e,t),r=JH(t);return {markup:n,compare:r,destroyDialogs(){n.destroyDialog(),r.destroyDialog();},exec(o){return o.type==="openRevisionMarkupDialog"?n.open():r.exec(o)},can(o){return o.type==="openRevisionMarkupDialog"?n.canOpen():r.can(o)}}}var n2=new WeakMap;function tz(e){return !(!e.story||e.origin===g.mutationUndo||e.origin===g.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.some(t=>t!==l$1.story))}function nz(e,t){tz(t)||(e.summaries=null);}function rz(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>nz(t,n)));}function o2(e){}function a2(e,t){let n=n2.get(e);return n||(n={summaries:null,subscribed:false},n2.set(e,n)),rz(e,n),n.summaries||(n.summaries=t()),n.summaries}var oz=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function az(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function iz(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(Zt(t)){let o=jn(n,r,t);return o.ok?{ok:true,span:{paragraphId:o.span.nodeId,start:o.span.start,end:o.span.end}}:{ok:false,code:o.code,reason:o.reason,target:t}}if(az(t)){if(!Zt(t.from)||!Zt(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=jn(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=jn(n,r,t.to);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:t};if(o.span.nodeId!==a.span.nodeId)return {ok:false,code:"unsupported",reason:"wrapping several paragraphs in one content control is not supported",target:t};let i=Math.min(o.span.start,a.span.start),s=Math.max(o.span.end,a.span.end);return {ok:true,span:{paragraphId:o.span.nodeId,start:i,end:s}}}return {ok:false,code:"unsupported",reason:"address the span with a paraId anchor; DocLocation targeting is not supported",target:t}}function Sx(e,t){let n=oz.get(t.subtype);if(!n)return {ok:false,code:"invalidArgs",reason:`that control type cannot be inserted (${String(t.subtype)})`,...t.target===void 0?{}:{target:t.target}};let r;if(t.target===void 0){let o=li(e.state().selection);if(!o)return {ok:false,code:"unsupported",reason:"wrapping several paragraphs in one content control is not supported"};r=o;}else {let o=iz(e,t.target);if(!o.ok)return o;r=o.span;}return {ok:true,span:r,op:{op:"insertContentControl",paragraphId:r.paragraphId,start:r.start,end:r.end,type:n,...t.tag===void 0?{}:{tag:t.tag},...t.title===void 0?{}:{alias:t.title}}}}var sz="http://schemas.microsoft.com/office/word/2010/wordml",lz="http://schemas.microsoft.com/office/word/2012/wordml";function yi(e){return ld(e)}function Zc(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function cz(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===pa$2)return t.value}}function wx(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return cz(n)}}function dz(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=uz(t);if(n!==void 0)return n}return "richText"}function uz(e){if(e.kind==="textValue")return;let t=e.kind,n=e.localName,r=e.namespaceUri;if(t==="contentControlDropDownList"||n==="dropDownList")return "dropdown";if(t==="contentControlComboBox"||n==="comboBox")return "comboBox";if(t==="contentControlDate"||n==="date")return "date";if(n==="picture")return "picture";if(n==="docPartList")return "buildingBlockGallery";if(t==="contentControlText"||n==="text")return "plainText";if(n==="richText")return "richText";if(n==="checkbox"&&(r===sz||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===lz)return "repeatingSection"}function nm(e){let t=wx(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function fz(e,t){if(nm(Zc(t)))return true;let n=fb$1(e,t.id);for(;n;){if(yi(n)&&nm(Zc(n)))return true;n=fb$1(e,n.id);}return false}function Ix(e,t){let n=Zc(e),r=wx(n,"tag"),o=wx(n,"alias"),a=t?fz(t,e):nm(n);return {id:e.id,controlType:dz(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var i2=new WeakMap;function pz(e,t){let n=[],r=fb$1(e,t.id);for(;r;)yi(r)&&n.push(`${r.id}:${nm(Zc(r))?1:0}`),r=fb$1(e,r.id);return n.join("|")}function l2(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function mz(e){return Object.freeze(e.map(t=>l2(t)))}function gz(e,t){let n=e.node,r=Zc(n),o=pz(t,n),a=i2.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let i=l2(Ix(n,t));return i2.set(n,{properties:r,lockAncestors:o,summary:i}),i}function hz(e){let t=sc$1(e.root);return o2(t.length),t.map(n=>gz(n,e))}function yz(e){return mz(e.storyParts().flatMap(t=>hz(t)))}function bz(e){return a2(e,()=>yz(e))}function kx(e,t){return t?!(t.tag!==void 0&&e.tag!==t.tag||t.alias!==void 0&&e.alias!==t.alias||t.controlType!==void 0&&e.controlType!==t.controlType):true}function vz(e){let t=[];if(e.kind!=="paragraph")return t;let n=(r,o,a,i)=>{if(i>=Aa)return o;let s=o;for(let l of r)if(l.kind!=="paragraphProperties"){if(l.kind==="run"){s+=Ji(e,l);continue}if(Ca(l)){s=n(l.children,s,a,i+1);continue}if(yi(l)){let c=s,d=a+1;s=n(kc$1(l),s,d,i+1),t.push({control:l,start:c,end:s,depth:d});continue}s+=Ji(e,l);}return s};return n(e.children,0,-1,0),t}function Rx(e,t,n){return vz(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>Ix(r.control,n))}function Px(e,t){let n=[],r=fb$1(e,t);for(;r;)yi(r)&&n.push(Ix(r,e)),r=fb$1(e,r.id);return n.reverse()}function c2(e,t){if(!e)return [];let n=bz(e.session);return t?n.filter(r=>kx(r,t)):n}function Cx(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=ce(e.session,n)??e.session.part(),a=eb$1(o,n);if(a&&a.kind==="paragraph"){for(let s of Rx(a,r,o))if(kx(s,t))return s}let i=Px(o,n);for(let s=i.length-1;s>=0;s-=1){let l=i[s];if(kx(l,t))return l}return null}function Tx(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function xz(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function Sz(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function wz(e){let t=n=>{if(n.kind==="textValue")return null;if(n.kind==="body")return n;for(let r of n.children){let o=t(r);if(o)return o}return null};return t(e.root)}function rm(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||yi(n))&&t.push(n);return t}function kz(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...rm(r.children));return t}function Iz(e){return e.kind==="table"?kz(e):yi(e)?rm(kc$1(e)):e.kind==="body"?rm(e.children):[]}function Rz(e,t,n){if(yi(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of Rx(t,r,e))return {ok:true,controlId:i.id};let a=Px(e,t.id).at(-1);if(a)return {ok:true,controlId:a.id}}return {ok:false,code:"notFound",reason:"no content control at the addressed block"}}function Pz(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=wz(e);if(!n)return {ok:false,code:"notFound",reason:"the document body was not found",target:t};if(t.path.length===0)return {ok:false,code:"notFound",reason:"DocLocation path is empty",target:t};let r=rm(n.children),o=null;for(let i=0;i<t.path.length;i+=1){if(o=r[t.path[i]]??null,!o)return {ok:false,code:"notFound",reason:`block index ${t.path[i]} is out of range`,target:t};i<t.path.length-1&&(r=Iz(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=Rz(e,o,t.offset);return a.ok?a:{...a,target:t}}function Cz(e,t,n){let r=jn(e,t,n);if(!r.ok)return {ok:false,code:r.code,reason:r.reason,target:n};let o=t.partByNode.get(r.span.nodeId)??e,a=eb$1(o,r.span.nodeId);if(!a||a.kind!=="paragraph")return {ok:false,code:"notFound",reason:`paragraph '${n.paraId}' was not found`,target:n};let i=r.span.start;for(let c of Rx(a,i,o))return {ok:true,controlId:c.id};let l=Px(o,a.id).at(-1);return l?{ok:true,controlId:l.id}:{ok:false,code:"notFound",reason:`no content control encloses paragraph '${n.paraId}'`,target:n}}function d2(e,t){if(t===void 0){let r=Cx(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(Sz(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return xz(t)?Pz(n,t):Zt(t)?Cz(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function u2(e){switch(e){case "locked":case "bound":case "typeMismatch":case "invalidArgs":case "unsupported":return e;case "unknown-control":return "notFound";case "indivisible-content":return "unsupported";default:return "unsupported"}}function f2(e){switch(e){case "locked":return "the content control is locked";case "bound":return "the content control is bound to external data";case "typeMismatch":return "the value does not match the control type";case "invalidArgs":return "the value is not valid for this control";case "unsupported":return "this control type is not supported";case "unknown-control":return "the content control was not found";case "indivisible-content":return "a content control cannot start or end inside a hyperlink, a field, or another inline control";default:return `the edit was refused (${e})`}}function p2(e,t){return {ok:false,code:u2(e),reason:f2(e),...t!==void 0?{target:t}:{}}}function Tz(e,t,n,r){return r?.scope&&r.scope.kind!=="body"&&e.target!==void 0?{ok:false,refusal:{ok:false,code:"unsupported",reason:"a location or anchor target resolves in the body only; omit it to use the caret"}}:t?n==="view"||!t.session.editable?{ok:false,refusal:{ok:false,code:"locked",reason:"the document is read-only"}}:e.type==="setContentControlValue"&&typeof e.value!="string"?{ok:false,refusal:{ok:false,code:"invalidArgs",reason:"setContentControlValue requires a string value"}}:{ok:true}:{ok:false,refusal:{ok:false,code:"notFound",reason:"no document is loaded"}}}function Ex(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function Ox(e,t,n,r){let o=Tz(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=Sx(t,e);return s.ok?s2(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let a=d2(t,e.target);if(!a.ok)return {ok:false,code:a.code,reason:a.reason};let i=e.type==="setContentControlValue"?{op:"setContentControlValue",controlId:a.controlId,value:e.value}:{op:"removeContentControl",controlId:a.controlId};return s2(t,i,a.controlId)}function s2(e,t,n){let r=ce(e.session,n)??e.session.part(),o=Ff$1(e.session.currentPackage()),a=Yk(o,t)??wm(r,o,t)??En$1(r,t);return a?{ok:false,code:u2(a),reason:f2(a)}:{ok:true}}function m2(e,t,n,r){t?.flushPendingInput();let o=Ox(e,t,n,r);return o.ok?Ez(t,e):o}function g2(e,t,n,r,o){let a=e.applyGatedTreeOps;return typeof a=="function"?a.call(e,t,n,r,o):e.session.applyTreeOps(t,n,r,o)}function Ez(e,t){if(t.type==="insertContentControl")return Oz(e,t);let n=d2(e,t.target);if(!n.ok){let i=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...i!==void 0?{target:i}:{}}}e.flushPendingInput();let r=li(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},a=g2(e,[o],r,r,Ot(e.session,n.controlId,{kind:"body"}));return a.rejected?p2(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function Oz(e,t){e.flushPendingInput();let n=Sx(e,t);if(!n.ok){let c=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...c!==void 0?{target:c}:{}}}let{paragraphId:r,start:o,end:a}=n.span,i=li(e.state().selection),s={paragraphId:r,start:o,end:a},l=g2(e,[n.op],i,s,Ot(e.session,r,{kind:"body"}));return l.rejected?p2(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}var h2=432,Lz=252/432;function om(e,t){if(!e)return null;let n=t??tn(e)?.drawingNodeId;if(!n)return null;let r=e.session.part().name,o=n$1(e.session.currentPackage(),r,n);return o?{drawingNodeId:n,target:o}:null}function y2(){let e=null,t=null,n=0;return r=>{let o=om(r);if(!o)return e=null;o.target.chartSpace!==t&&(t=o.target.chartSpace,n+=1);let a=k$3(o.target),i=j$4(o.target),s={drawingNodeId:o.drawingNodeId,editable:a.editable,...a.reason?{reason:a.reason}:{},formattable:i.ok,...i.ok?{}:{formatReason:i.reason},version:n};return e&&e.drawingNodeId===s.drawingNodeId&&e.editable===s.editable&&e.reason===s.reason&&e.formattable===s.formattable&&e.formatReason===s.formatReason&&e.version===s.version?e:e=s}}function b2(e,t){let n=om(e,t);return !n||!e?{ok:false,reason:"chart.errors.noChart"}:i$3(e.session.currentPackage(),n.target)}function v2(e,t){let n=om(e,t);return n?j$4(n.target):{ok:false,reason:"chart.errors.noChart"}}var Fz=createT(en);function Mx(e,t,n){let r=e?.(t,n);return r&&r!==t?r:Fz(t,n)}function Dz(e,t){let n=m(e);return {categories:n.categories.every(o=>/^\d+$/.test(o))?n.categories:n.categories.map((o,a)=>Mx(t,"chart.sample.category",{number:a+1})),series:n.series.map((o,a)=>({...o,name:Mx(t,"chart.sample.series",{number:a+1})}))}}function x2(e,t){if(e.ok)return {ok:true,changed:e.change!==null};let n=e.detail??e.reason;return {ok:false,code:n.startsWith("chart.errors.")?"invalidArgs":"unsupported",reason:n||t.state().lastRejection||"the chart edit was refused"}}function Nz(e,t,n){if(!e$1(t.chartType))return {ok:false,code:"invalidArgs",reason:"chart.errors.unsupportedType"};let{anchor:r,head:o}=e.state().selection,a=o.paragraphId,i=eb$1(e.session.part(),a);if(!i||i.kind!=="paragraph")return {ok:false,code:"notFound",reason:"the caret is not in a paragraph"};let s=r.paragraphId===a?Math.max(r.offset,o.offset):Math.min(o.offset,Ki(i)),l=e.layout().pages.flatMap(u=>u.fragments).find(u=>u.kind==="paragraph"&&u.paragraphId===a),c=Math.max(72,Math.min(h2,l?.box.width??h2)),d=e.insertChart({paragraphId:a,offset:s,chartType:t.chartType,data:t.data??Dz(t.chartType,n),widthPoints:c,heightPoints:Math.round(c*Lz),name:Mx(n,"chart.sample.name",{number:"{number}"})});return d.ok&&d.drawingNodeId&&e.selectDrawing(d.drawingNodeId,a)&&e.revealPosition(e.state().selection.head,{block:"nearest"}),x2(d,e)}function S2(e,t,n){if(t.type==="insertChart")return Nz(e,t,n);let r=om(e,t.drawingNodeId);if(!r)return {ok:false,code:"notFound",reason:"chart.errors.noChart"};let o=e.editChart(r.drawingNodeId,(a,i)=>{switch(t.type){case "setChartData":return l$2(a,i,t.data);case "setChartType":return {chartSpace:g$3(i.chartSpace,t.chartType)};case "setChartFormat":return {chartSpace:f$2(i.chartSpace,t.format)};default:return {chartSpace:h(i.chartSpace,t.index,t.color)}}});return x2(o,e)}function w2(e,t,n){switch(n.type){case "selectedText":return e?.selectedText()??"";case "selectionFormatting":return e?t():null;case "selection":return Ff(e);case "paragraphs":return _O(e,n.container);case "isInsideToc":return UO(e);case "hyperlinkAt":return HO(e);case "contentControls":return c2(e,n.filter);case "trackedChanges":case "revisions":case "findText":case "comments":return [];case "styles":return {paragraph:new Map,character:new Map,table:new Map};case "variables":return {};case "contentControlAt":return Cx(e,n.filter);case "tableContext":return Nf(e);case "splitCellConfig":return qO(e);case "watermark":return TE(e);case "bookmarks":return e?.bookmarkEditing.list()??[];case "chartData":return b2(e,n.drawingNodeId);case "chartFormat":return v2(e,n.drawingNodeId);default:return null}}var Hz=40,_z="docx-preview-surface",k2="data-docx-previewing";function Bz(e){let t=e.ownerDocument.defaultView;for(let n=e.parentElement;n;n=n.parentElement){let r=t?.getComputedStyle(n),o=`${r?.overflowY??""} ${r?.overflowX??""}`;if(/(auto|scroll|overlay)/.test(o))return n}return null}function I2(e,t,n){let r=e.parentElement;if(!r)return null;let o=e.ownerDocument,a=Bz(e),i=a?.scrollTop??0,s=a?.scrollLeft??0,l=o.createElement("div");l.className=_z,l.setAttribute("data-docx-preview",""),l.setAttribute("role","region"),l.setAttribute("aria-label",t),l.style.position="absolute",l.style.margin="0";let c=R=>{R.stopPropagation(),R.type!=="contextmenu"&&R.preventDefault();};for(let R of ["contextmenu","paste","cut","drop","dragover"])l.addEventListener(R,c);let d=()=>{l.style.top=`${e.offsetTop}px`,l.style.left=`${e.offsetLeft}px`,l.style.width=`${e.offsetWidth}px`,l.style.minHeight=`${e.offsetHeight}px`;};d(),r.insertBefore(l,e.nextSibling);let u=n(l);if(!u)return l.remove(),null;l.style.position="absolute",d();let f=o.activeElement,p=f&&e.contains(f)?f:null;p?.blur();let g=e.style.visibility;e.style.visibility="hidden",a&&(a.scrollTop=i,a.scrollLeft=s);let h=o.defaultView,b=h?.ResizeObserver,v=b?new b(d):null;v?.observe(e),v?.observe(r),h?.addEventListener("resize",d);let S=e.closest(".docx-editor")??r;S.setAttribute(k2,"");let x=rt(()=>l),k=null,T=()=>{k=null,Pc(u,Hz)||(k=x.setTimeout(T,0));};return Tr(u)&&(k=x.setTimeout(T,0)),{surface:u,place:d,finishOpening(){for(k!==null&&x.clearTimeout(k),k=null;!Pc(u,Number.POSITIVE_INFINITY););},remove(){k!==null&&x.clearTimeout(k),k=null,v?.disconnect(),h?.removeEventListener("resize",d),S.removeAttribute(k2);let R=a?.scrollTop??0,C=a?.scrollLeft??0;e.style.visibility=g,u.destroy(),l.remove(),a&&(a.scrollTop=R,a.scrollLeft=C),p?.isConnected&&p.focus({preventScroll:true});}}}function am(e){if(e.kind==="paragraph")return e.id;if(!("children"in e)||!Array.isArray(e.children))return null;for(let t of e.children){let n=am(t);if(n)return n}return null}function R2(e,t){let n=e.parts.get(e.mainDocumentPart)?.root,r=t.parts.get(t.mainDocumentPart)?.root;if(!n||!r||n===r)return null;let o=(i,s)=>{let l=i.children,c=s.children;for(let u=0;u<c.length;u+=1){let f=c[u],p=l[u];if(p!==f)return f.kind==="paragraph"?f.id:p&&p.kind===f.kind&&"children"in p&&"children"in f?o(p,f)??am(f):am(f)}let d=c[c.length-1];return d?am(d):null},a=o(n,r);return a&&eb$1(t.parts.get(t.mainDocumentPart),a)?a:null}var Ax="review-module-required",P2="preview-operation-unsupported";function C2(e,t,n){let r=x$1(e),o=t,a=t.collaborationSession(),i=a?.identity.actorId,s=()=>n().reviewModel!==void 0,l=()=>{let u=t.author()?.trim();return t.editingMode()==="suggest"&&u?u:void 0},c=()=>(n().revisionMarkup??hb$1).trackFormatting&&!t.session.trackingSettings().doNotTrackFormatting,d=u=>{let f=l();return f===void 0?u:Lc(u,{author:f,date:j$1()},c())};return {...r,collaborative:()=>!!a,trackedRangeReplacement:()=>!a,suggesting:()=>t.editingMode()==="suggest",revisionDisplayMode:()=>lb$1(t.revisionDisplayMode()),replacementLanding(u,f,p){let g=l();if(g===void 0)return null;if(p<=f)return f;let y=$z(e,u);return y?wp(y,f,p,g,j$1()):f},apply(u,f,p=[],g=false){let y=o.automationWriteRefusal([],false);if(y!==null)return {ok:false,reason:y};if(g&&!s())return {ok:false,reason:Ax};let h=Hb$1(i,()=>r.apply(b=>{let v=u(b);if(v===null||(y=o.automationWriteRefusal(v,p.length>0),y!==null))return null;let S=d(v);return S.some(Ac)&&!s()?y=Ax:y=a?.gateOperations(S,f)??null,y===null?S:null},f,p));return y!==null?{ok:false,reason:y}:h},applyCommentWrites(u,f){let p=o.automationWriteRefusal([],false);if(p!==null)return {ok:false,reason:p};if(f.kind!=="body")return {ok:false,reason:"unsupported-story"};if(!s())return {ok:false,reason:Ax};let g=a?.gateOperations([],f);return g?{ok:false,reason:g}:Hb$1(i,()=>r.applyCommentWrites(u,f))},applyCustomNodeWrite:()=>({ok:false,reason:P2}),applyLifecycle:()=>({ok:false,reason:P2})}}function $z(e,t){let n=e.currentPackage(),r=n.parts.get(n.mainDocumentPart),o=r?[r,...n.parts.values()]:[...n.parts.values()];for(let a of o){if(!a.root)continue;let i=eb$1(a,t);if(i?.kind==="paragraph")return i}return null}var im=new WeakMap;function T2(e,t){im.set(e,{...t,active:null});}function E2(e){im.get(e)?.active?.end();}function _s(e){let t=im.get(e)?.active;return !!t&&!t.ended&&t.shown}var qz=Object.freeze({document:true,save:false,events:false,selection:false,scrolling:false,layout:false}),Kz=new Uint8Array(0);function Uz(e){let t=im.get(e),n=e.surface;if(!t||!n||n.parked())return {ok:false,reason:"no-document"};if(t.active&&!t.active.ended)return {ok:false,reason:"preview-active"};let r=n.hostElement();if(lr(r))return {ok:false,reason:"blocked"};if(n.editingMode()==="view")return {ok:false,reason:"viewing"};if(ip(n))return {ok:false,reason:"composing"};n.flushPendingInput();let o=n.session.currentPackage(),a=o.parts.get(o.mainDocumentPart);if(!a)return {ok:false,reason:"no-document"};let i=t.displayOptions(),s=new T(o,a,i.contentLockPolicy?{contentLockPolicy:i.contentLockPolicy}:{}),l=u$1({port:C2(s,n,t.displayOptions),capabilities:qz}),c=e.mountGeneration,d=new Set,u=null,f=false,p=e.on("change",()=>{if(f)return;if(e.surface!==n||e.mountGeneration!==c){g.end();return}if(!u)return;let{scale:y,showParagraphMarks:h}=t.displayOptions();y!==void 0&&u.surface.setScale(y)&&u.place(),u.surface.setShowParagraphMarks(h??false);}),g={deferEvents:t.deferEvents,host:l,get shown(){return u!==null},get ended(){return f},show(){if(f||u)return false;let y=t.displayOptions(),h=B$1({ok:true,package:s.currentPackage()},{...y.reviewModel?{reviewModel:y.reviewModel}:{},...y.contentLockPolicy?{contentLockPolicy:y.contentLockPolicy}:{}});if(!h.ok)return false;let b=y.translate?.("editor.previewContent")??en.editor.previewContent;return u=I2(r,b,v=>{let S={...y,editingMode:"view",revisionDisplayMode:n.revisionDisplayMode(),openedSession:h,progressiveOpen:true},x=zc(v,Kz,S);return x.ok?(x.surface.setEditable(false),x.surface):null}),u?(Xb(r,true),t.changed(),true):false},reveal(){if(!u)return false;let y=R2(o,s.currentPackage());return y===null?false:(u.finishOpening(),u.surface.revealPosition({paragraphId:y,offset:0}),true)},end(){if(f)return;f=true,p();let y=u!==null;u?.remove(),u=null,y&&Xb(r,false),t.active===g&&(t.active=null),y&&t.changed();for(let h of [...d])try{h();}catch{}d.clear();},onEnd(y){return f?(y(),()=>{}):(d.add(y),()=>d.delete(y))}};return t.active=g,{ok:true,fork:g}}var O2=new WeakMap;function M2(e){let t=O2.get(e);if(!t)throw new Error("External refresh requires a mounted createDocxEditor instance.");return t}function A2(e,t){let n=null,r=null,o={...t,epoch:0,revision:0,mountedRevision:0,source:void 0,invalidated:new Set,cancel(){if(!r||r.mountedRevision!==null)return;t.cancelLoad();let a=r;r=null,sa(a.container,false),t.surface()?.setEditable(e.snapshot().editingMode!=="viewing"),o.source=void 0,a.resolve(false);try{t.changed();}catch{}},invalidate(){o.cancel(),o.epoch++,n=null,r&&(sa(r.container,false),r.resolve(false),r=null),o.source=void 0;for(let a of o.invalidated)a();},contentMounted(a){r?.bytes===a&&(r.mountedRevision=o.revision);},mounted(a,i){if(!r||r.bytes!==a)return;let s=r,l=!i&&!!t.surface();o.mountedRevision=s.mountedRevision??o.revision,l?n=null:n={top:s.top,left:s.left};let c=_t(s.container);if(l&&c&&(c.scrollTop=Math.max(0,Math.min(s.top,c.scrollHeight-c.clientHeight)),Rs(c,s.left),c.dispatchEvent(new(Ae(c)).Event("scroll"))),r===s){r=null,sa(s.container,false),t.surface()?.setEditable(e.snapshot().editingMode!=="viewing"),o.source=void 0,s.resolve(l);try{t.changed();}catch{}}},replace(a,i){let s=t.container();if(!s||r)return Promise.resolve(false);let l=_t(s);return new Promise(c=>{r={bytes:a,resolve:c,container:s,top:i==="recovery"&&n?n.top:l?.scrollTop??0,left:i==="recovery"&&n?n.left:l?Ps(l):0,mountedRevision:null},o.source=i,sa(s,true),t.surface()?.setEditable(false);try{t.load(a);}catch(d){o.mounted(a,d);}})}};return e.on("change",a=>{a.source||o.revision++;}),O2.set(e,o),o}function L2(){let e=new WeakMap,t=new WeakMap;return (n,r,o,a)=>{let i=r?e:t,s=i.get(n);if(s&&s.anchors===r&&s.revision===o)return s;let l=n.map(g=>r?pd$1(g,r):null),c=n.map(a),d=g=>l[g]?.pageIndex??null,u=s!==void 0&&n.every((g,y)=>d(y)===(s.geometries[y]?.pageIndex??null)&&c[y]===s.groups[y]),f=s?.order;if(!u||!f){let g=n.map((y,h)=>h);g.sort((y,h)=>{let b=d(y)??Number.MAX_SAFE_INTEGER,v=d(h)??Number.MAX_SAFE_INTEGER;return b!==v?b-v:c[y]!==c[h]?c[y]-c[h]:y-h}),f=g;}let p={anchors:r,revision:o,geometries:l,groups:c,order:f};return i.set(n,p),p}}function F2(){let e=new WeakMap,t=new WeakMap;return (n,r,o)=>{let a=r?e:t,i=a.get(n);return i&&i.length===o.length&&i.every((s,l)=>s===o[l])?i:(a.set(n,o),o)}}function Lx(e,t,n,r){return X(t,{context:e?ua(e.ownerDocument):null,...r?{fontAlias:r}:{},serifHangulFace:u(n.currentPackage())})}function D2(e$1,t,n,r,o,a$1){let i=new Map,s=new Set,l=p=>{let{family:g,weight:y,style:h}=p.request;return `${p.identity}|${g}|${y}|${h}`},c=a$1?{shape(p){try{return e$1.shaper.shape(p)}catch(g){let y=p.environment.font;if(g instanceof e&&g.code==="fontOverLimit"&&!s.has(l(y))){s.add(l(y));let{family:h,weight:b,style:v}=y.request;try{a$1(new a("overLimit",g.message,{request:Object.freeze({family:h,weight:b,style:v}),diagnostic:g.diagnostic??g.message,cause:g}));}catch{}}throw g}}}:e$1.shaper,d=c!==e$1.shaper&&q$2(e$1.shaper)?p$1(c):c,u=ca$2({...e$1,shaper:d},{resolveFont:p=>{let g=p.fontFamily??t.defaultFont.family;if(g.trim().length===0)return null;let y={family:g,weight:p.bold?700:400,style:p.italic?"italic":"normal"},h=h$3(y);if(i.has(h))return i.get(h)??null;let b;try{b=e$1.fonts.resolve(y);}catch{return i.set(h,null),null}let v=b instanceof d$1?null:b;return i.set(h,v),v},fallback:n.measurer}),f=`shaped:${e$1.operation.extensionFingerprint}+algorithm:${e$1.operation.shapingHash}+producer:${e$1.operation.producerVersion}+fallback:${n.producer}@scale:${r}+fonts:${o}`;return {measurer:u,producer:f}}var jz="The quick brown fox 0123 \u2014 {}#@\uF021\uF041\uF061\uF0A1\uF0E1\uE700\uE710",Vz=["monospace","serif"],Gz=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function H2(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(jz).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!Gz.test(r))return t.set(r,true),true;let a=false;for(let i of Vz){let s=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==s){a=true;break}}return t.set(r,a),a}}var N2=4;function _2(e,t,n){let r=new Set,o=[];for(let d of t){let u=d.toLowerCase();r.has(u)||(r.add(u),o.push(d));}let a=d=>new Set(e.slice(0,Math.max(d,0)).map(u=>u.toLowerCase())),i=0;for(let d=0;d<=N2;d+=1){let u=a(n-i),f=o.filter(g=>!u.has(g.toLowerCase())).length,p=Math.min(f,N2,Math.floor(n/2));if(p===i)break;i=p;}let s=e.slice(0,Math.max(n-i,0)),l=a(n-i),c=o.filter(d=>!l.has(d.toLowerCase()));return [...s,...c].slice(0,n)}function B2(e,t,n,r=new Set){let o=[];for(let a of e){if(r.has(a.toLowerCase())){o.push(a);continue}if(t(a)||n(a))continue;let i=U$1.get(a.toLowerCase());i!==void 0&&n(i)||o.push(a);}return o}function $2(e,t){let n=new Set(e.map(r=>r.request.family.toLowerCase()));for(let r=0;r<t.length;r+=1){let o=false;for(let a of t){let i=a.from.family.toLowerCase();n.has(i)||!n.has(a.to.family.toLowerCase())||(n.add(i),o=true);}if(!o)break}return n}var W2=new WeakMap,zz=0,Zz=w((e,t)=>{if(e.kind==="paragraphProperties"){let n=W2.get(e);return n||(n=String(++zz),W2.set(e,n)),{families:[n],children:[]}}return {families:e.kind==="paragraph"&&!e.children.some(n=>n.kind==="paragraphProperties")?["default-paragraph"]:[],children:x(e,t)}});function sm(e){return Zz(e,{key:""})}var q2=new WeakMap,K2=new WeakMap;function Fx(e){let t=K2.get(e);return t||K2.set(e,t=y$1()),t}function Dx(e,t){Fx(e)(t,e.stylesRoot(),e.documentThemeFonts()),A$2(t),sm(t);}function U2(e,t,n,r){let o=Fx(e).warmTableRows(t,n,r,e.stylesRoot(),e.documentThemeFonts()),a=t.children.slice(n,r);return A$2(a),sm(a),Math.max(o,t.children.length)}function j2(e){let t=e.packageRevision(),n=q2.get(e);if(n?.revision===t)return n.families;let r=n?.eastAsianFonts??Fx(e),o=e.storyParts().map(f=>f.root),a=e.stylesRoot(),i=e.numberingRoot(),s=e.documentThemeFonts(),l=sm(o),d=n&&n.stylesRoot===a&&n.numberingRoot===i&&n.theme===s&&n.numberingInputs.length===l.length&&n.numberingInputs.every((f,p)=>f===l[p])?n.numberingFamilies:C$1(o,i,a,s),u=[...e.symbolFontFamilies(),...r(o,a,s),...A$2(o),...d];return q2.set(e,{eastAsianFonts:r,revision:t,families:u,numberingInputs:l,numberingFamilies:d,numberingRoot:i,stylesRoot:a,theme:s}),u}function V2(e,t,n){let[r]=a$4([[t]]);return _2([...new Set([...r&&r!==n?[r]:[],...e.documentFonts(),...v$1(e.currentPackage(),e.documentThemeFonts())])],j2(e),c$4)}function G2(e,t){let n,r=false,o=()=>{r=false;let s=e();if(!s)return;let l=n?.generation!==s.generation;l&&(n={generation:s.generation,requested:new Set,running:false,late:[]});let c=n;if(c.running)return;let d=c.late.shift();if(d!==void 0){c.running=true;let p=t(s.families(),d);return p.finally(()=>{c.running=false,n===c&&a();}),p}if(!l&&!s.dynamic)return;let u=s.families().filter(p=>!c.requested.has(p.toLowerCase()));if(!l&&u.length===0)return;for(let p of u)c.requested.add(p.toLowerCase());c.running=true;let f=t(u);return f.finally(()=>{c.running=false,n===c&&a();}),f},a=(s=false)=>{if(s)return o();r||(r=true,queueMicrotask(o));};return {schedule:a,deliver:(s,l)=>{n?.generation===s&&(n.late.push(l),a());}}}function z2(){let e=0,t=new AbortController,n=()=>{let r=t;return {generation:e,signal:r.signal,current:()=>t===r&&!r.signal.aborted}};return {get generation(){return e},capture:n,advance(){let r=t;return t=new AbortController,e+=1,{...n(),cancelPrevious:()=>r.abort()}},dispose:()=>t.abort()}}function pr(e,t,n="unsupported"){if(e===null||e===Ic)return {ok:false,code:n,reason:t};if(e.startsWith("locked-content:"))return {ok:false,code:"locked",reason:e};if(e.startsWith("bound-content:"))return {ok:false,code:"bound",reason:e};let r=Ns(e);return {ok:false,code:r==="edit.read-only"||r==="edit.protected-content"?"locked":"unsupported",reason:e}}function X2(e){return e.kind==="custom"?`custom node '${e.name}' has no reviewCard, so it has no card to activate`:`review items of kind '${e.kind==="revision"?e.revisionKind:e.kind}' are excluded from activation`}function Nx(e,t){let n=e.review;return n?{reviewModel:x$2({...n,collectReviewItems:r=>n.collectReviewItems(e.customNodes.length>0?{...r,customNodes:e.customNodes,...e.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:t}:{}}:r)},f$3)}:{}}var Xz=["all-markup","simple-markup","proposed","original"];function Y2(e){let t=()=>e.placements({pairReplacements:true}).filter(x=>x.kind==="revision"&&(x.activatable||x.revisionKind==="format")),n=()=>e.surface()?.session.reviewItems().filter(x=>x.kind==="revision")??[],r=()=>{let x=e.surface()?.session;if(!x)return [];let k=e$4(x.currentPackage());return x.storyParts().flatMap(T=>g$5(gm$1(T),k))},o=(x,k)=>x.keys!==void 0||x.scope==="document"||e.authorVisibility.hasPredicate?[]:k().filter(T=>e.authorVisibility.isVisible(T.author)),a=(x,k=false)=>{let T=n(),R,C=M=>(R??=new Map(e.placements({placement:false,pairReplacements:true}).filter(Y=>da(Y.key)).map(Y=>[Y.key,Y])),R.get(M)),A=new Set(x.keys?.flatMap(M=>{if(!da(M))return [M];let Y=C(M);return Y?ks(Y.item):[M]})??(x.scope==="document"?T:DF(e.surface()?.session.reviewItems()??[],e.authorVisibility)).filter(M=>M.kind==="revision").map(ql)),E=new Map,P=x.keys===void 0&&(x.scope==="document"||!e.authorVisibility.hasFilter);if(P){let M=e.surface().session,Y=x.scope==="document"?null:new Set(T.flatMap(ne=>{let le=ne.kind==="revision"?pl(ne):[],se=le.length?ce(M,le[0]):null;return se?[se.name]:[]}));for(let ne of M.storyParts())(!Y||Y.has(ne.name))&&E.set(ne.name,{scope:Ot(M,ne.root.id,{kind:"body"}),part:ne,keys:[]});}let w=null,O=()=>w??=r(),_=k?o(x,O):[];for(let M of _)A.add(ql(M));let q=M=>{let Y=e.scope(M),ne=ce(e.surface().session,pl(M)[0]);if(!ne)return;let le=E.get(ne.name);le||(le={scope:Y,part:ne,keys:[]},E.set(ne.name,le));let se=ql(M);A.delete(se)&&le.keys.push(se);};for(let M of T)q(M);for(let M of _)q(M);let K=new Set(x.keys??[]);if(K.size>0&&A.size>0)for(let M of O())A.has(ql(M))&&q(M);let U=k?new Set(O().flatMap(M=>K.has(ql(M))?[]:[ql(M)])):new Set;return {scopes:[...E.values()],missing:[...A],unfilteredDocument:P,silent:U}},i=x=>!e.surface().session.storyParts().some(k=>k.name===x.name),s=x=>{let k=[],T=[];for(let{scope:R,part:C,ops:A}of x)A.length&&(i(C)?T.push({partName:C.name,ops:A}):k.push({scope:R,ops:A}));return {groups:k,partOps:T}},l=(x,k=false)=>{let{scopes:T,missing:R,unfilteredDocument:C,silent:A}=a(x,k),E=[],P=R.filter(_=>!A.has(_)).map(_=>({key:_,reason:"unknown-revision"})),w=[],O=0;for(let{scope:_,part:q,keys:K}of T){let U=Ba(q,x.action,C?void 0:K,void 0,{countRemaining:false,explicit:x.keys!==void 0});for(let M of U.result.resolved)A.has(M.key)||E.push(M);for(let M of U.result.skipped)A.has(M.key)||P.push(M);O+=U.result.remaining,w.push({scope:_,part:q,ops:U.ops});}return {...s(w),result:{resolved:E,skipped:P,remaining:O}}},c=x=>x.author===void 0?e.surface()?.author():x.author,d=x=>{let{scopes:k,missing:T}=a(x),R={author:c(x)??"",...x.date===void 0?{}:{date:x.date}},C=T.map(P=>({key:P,reason:"unknown-revision"})),A=[];for(let{scope:P,part:w,keys:O}of k){if(!O.length)continue;let _=mm$1(w,R,O,void 0,x.authors);A.push({scope:P,part:w,ops:_.ops,plan:_});}let E=P=>({updated:P.flatMap(w=>w.updated),skipped:[...C,...P.flatMap(w=>w.skipped)]});return {...s(A),result:E(A.map(({plan:P})=>P.result)),finish:()=>{let P=e.surface().session.currentPackage().parts;return E(A.map(({part:w,plan:O})=>{let _=P.get(w.name);return _?O.finish(_):O.result}))}}},u=()=>e.destroyed()?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.enabled()?e.surface()?{ok:true}:{ok:false,code:"notFound",reason:"no document is open"}:{ok:false,code:"unsupported",reason:Wt},f=x=>x.scope!==void 0&&!["visible","document"].includes(x.scope)||x.unsupported!==void 0&&!["skip","fail"].includes(x.unsupported)||x.keys!==void 0&&(!Array.isArray(x.keys)||x.keys.some(k=>typeof k!="string"))?{ok:false,code:"invalidArgs",reason:"invalid bulk revision selection"}:null,p=x=>{let k=u();if(!k.ok)return {gate:k};if(e.viewing())return {gate:{ok:false,code:"locked",reason:"the document is open for viewing"}};let T=Vn(x,e.surface());if(T)return {gate:T};let R=c(x);if(R===void 0)return {gate:{ok:false,code:"invalidArgs",reason:"pass an author, or configure the editor author, to change the author"}};if(typeof R!="string"||x.date!==void 0&&typeof x.date!="string"||lm$1({author:R,...x.date===void 0?{}:{date:x.date}}))return {gate:{ok:false,code:"invalidArgs",reason:"author must be nonblank text, and date an ISO 8601 date and time"}};let C=f(x);if(C)return {gate:C};if(x.keys!==void 0&&(x.scope!==void 0||x.authors!==void 0)||x.authors!==void 0&&(!Array.isArray(x.authors)||x.authors.some(P=>typeof P!="string")))return {gate:{ok:false,code:"invalidArgs",reason:"select by keys, or by scope and authors; authors must be a list of names"}};let A=d(x),{result:E}=A;return x.unsupported==="fail"&&E.skipped.length?{gate:{ok:false,code:"unsupported",reason:"some selected changes cannot change author"},plan:A}:E.updated.length?{gate:{ok:true},plan:A}:{gate:{ok:false,code:E.skipped.some(P=>P.reason==="unsupported-revision")?"unsupported":"notFound",reason:"no eligible selected changes to update"},plan:A}},g=x=>{e.surface()?.flushPendingInput();let{gate:k,plan:T}=p(x);if(!k.ok)return T?{...k,revisionAuthors:{...T.result,updated:[]}}:k;let R=e.surface(),{groups:C,partOps:A}=T;if(!C.length&&!A.length)return {ok:true,changed:false,revisionAuthors:T.result};let E=e.placements({placement:false,pairReplacements:false}).find(q=>q.isActive)?.key,P,w=R.commitReviewOps(q=>(P=R.session.applyTreeOpsAtomic(C,{partOps:A,historyToken:q}),P),"revision-attribution");if(!P?.committed)return pr(w,"the changes were refused");let O=T.finish(),_=O.updated.find(q=>q.previousKey===E);return _&&e.activate(_.key),{ok:true,changed:true,revisionAuthors:O}},y=x=>{if(x.type==="setReviewChangesAuthor")return p(x).gate;if(x.type!=="navigateReviewChange"&&x.type!=="resolveAllReviewChanges"&&x.type!=="setReviewDisplayMode")return null;let k=u();if(!k.ok)return k;if(x.type==="setReviewDisplayMode")return Xz.includes(x.mode)?{ok:true}:{ok:false,code:"invalidArgs",reason:"unknown review display mode"};if(x.type==="navigateReviewChange"&&!["next","previous"].includes(x.direction))return {ok:false,code:"invalidArgs",reason:"unknown review navigation direction"};if(x.type==="resolveAllReviewChanges"&&!["accept","reject"].includes(x.action))return {ok:false,code:"invalidArgs",reason:"unknown review resolution action"};if(x.type==="navigateReviewChange")return t().length?{ok:true}:{ok:false,code:"notFound",reason:"no visible changes to review"};if(e.viewing())return {ok:false,code:"locked",reason:"the document is open for viewing"};let T=Vn(x,e.surface());if(T)return T;let R=f(x);if(R)return R;let{result:C,groups:A,partOps:E}=l(x);return x.unsupported==="fail"&&C.skipped.length?{ok:false,code:"unsupported",reason:nZ}:!C.resolved.length&&!A.length&&!E.length?{ok:false,code:rZ(C.skipped),reason:oZ(C.skipped,e.authorVisibility.hasFilter)}:{ok:true}},h=(x,k)=>{let T=u();if(!T.ok)return T;if(e.viewing()){let w=e.surface().commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"revision-resolve");return pr(w,"the document is open for viewing","locked")}let R=Vn({type:"resolveAllReviewChanges"},e.surface());if(R)return R;e.surface().flushPendingInput();let C=Qr(e.placements,x)?.item;if(!C||C.kind!=="revision")return {ok:false,code:"notFound",reason:"unknown-revision: no revision with that key"};if(C.readOnly)return {ok:false,code:"unsupported",reason:fs};let A=sZ(ce(e.surface().session,pl(C)[0]),C,k);if(A)return A;let E,P=e.surface().commitReviewOps(w=>{let O=e.surface().session,_=ce(O,pl(C)[0]);if(_&&i(_)){let U=Z2(C,k,_);return U.refusal?(E={committed:false,reason:U.refusal},E):(E=O.applyTreeOpsAtomic([],{partOps:[{partName:_.name,ops:U.ops}],historyToken:w}),E)}let q=e.surface().session.partFor(e.scope(C)),K=Z2(C,k,q);return K.refusal?(E={committed:false,reason:K.refusal},E):(E=e.surface().session.applyTreeOps(K.ops,void 0,void 0,e.scope(C),{historyToken:w}),E)},"revision-resolve");return E?.committed?{ok:true,changed:true}:pr(P??(typeof E?.reason=="string"?E.reason:null),"the revision was refused")},b=x=>{if(x.type==="setReviewChangesAuthor")return g(x);if(!["navigateReviewChange","resolveAllReviewChanges","setReviewDisplayMode"].includes(x.type))return null;e.surface()?.flushPendingInput();let k=y(x);if(!k)return null;if(!k.ok){if(x.type==="resolveAllReviewChanges"&&(k.code==="notFound"||k.code==="unsupported"||k.code==="locked"||k.code==="bound")&&u().ok&&!e.viewing()){let{result:w}=l(x);return {...k,revisions:{...w,resolved:[],remaining:n().length}}}return k}let T=e.surface();if(x.type==="setReviewDisplayMode")return e.setDisplayMode(x.mode),{ok:true,changed:false};if(x.type==="navigateReviewChange"){let w=t(),O=w.findIndex(ne=>ne.isActive),_=x.direction==="next"?1:-1,q=O<0?Yz(w,T,_):(O+_+w.length)%w.length,K=w[q],U=ws(K.item),M=U?ql(U.deletion):K.key,Y=e.activate(K.key,!K.activatable&&K.revisionKind==="format");return Y.ok&&e.reveal({key:M,source:"navigate"}),Y}if(x.type!=="resolveAllReviewChanges")return null;let{groups:R,partOps:C,result:A}=l(x,true),E,P=T.commitReviewOps(w=>(E=T.session.applyTreeOpsAtomic(R,{partOps:C,historyToken:w}),E),"revision-resolve");return E?.committed?(e.activate(null),e.resolved?.({action:x.action,resolvedCount:A.resolved.length,skipped:A.skipped.map(({key:w,reason:O,detail:_})=>({key:w,reason:O,..._?{detail:_}:{}}))}),{ok:true,changed:true,revisions:{...A,remaining:n().length}}):pr(P,"the revisions were refused")},v=x=>{let k=Qr(e.placements,x)?.item;return k?.kind==="revision"?k:void 0},S=e.report?e.report.diagnostics.reviewItem(h,v,(x,k)=>{let T=e.surface()?.session,R=T&&ce(T,pl(x)[0]);if(!R)return {};try{let A=Ba(R,k,ks(x),void 0,{countRemaining:!1,explicit:!0}).result.skipped[0]?.detail;return {partName:R.name,...A?{detail:A}:{}}}catch{return {partName:R.name}}},e.report.tracked):h;return {can:y,exec:b,resolveReviewItem:S}}function Yz(e,t,n){let r=t.state().selection.head,o=ce(t.session,r.paragraphId),a=o?Wk(o):new Map,i=a.get(r.paragraphId);if(i!==void 0)for(let s=n>0?0:e.length-1;s>=0&&s<e.length;s+=n){let l=e[s],c=l.kind==="revision"?l.item.ranges[0]?.start:void 0,d=c?a.get(c.paragraphId):void 0;if(c&&d!==void 0&&(n>0?d>i||d===i&&c.offset>=r.offset:d<i||d===i&&c.offset<=r.offset))return s}return n>0?0:e.length-1}var Qz="no eligible selected changes to review",Jz="these changes would also resolve changes the filter hides; clear the filter to review them first",eZ="these changes would also resolve changes the selection leaves out; decide each card",tZ="none of the selected changes can be resolved",nZ="some selected changes cannot be resolved";function rZ(e){return e.length?e.every(t=>t.detail==="locked-content")?"locked":e.every(t=>t.detail==="bound-content")?"bound":"unsupported":"notFound"}function oZ(e,t){return e.length?e.every(n=>n.reason==="incomplete-group")?t?Jz:eZ:e.every(n=>n.detail==="locked-content")?Qp:e.every(n=>n.detail==="bound-content")?Jp:tZ:Qz}var aZ="retained-structure: the row stays because it holds a nested table with untracked rows",iZ="incomplete-group: this change resolves only together with another change, such as the deleted row that holds it; decide that change first";function Q2(e){return e.reason==="retained-structure"?aZ:e.reason==="incomplete-group"?iZ:e.detail==="locked-content"||e.detail==="bound-content"?`${e.detail}: the change stays pending`:e.detail?`${e.reason}: ${e.detail}`:e.reason}function sZ(e,t,n){let r=e&&nm$1(e)?pm$1(e,pl(t),n):null;return r?{ok:false,code:r==="locked-content"?"locked":"bound",reason:Q2({reason:"unsupported-revision",detail:r})}:null}function lZ(e,t){let n=new Set(pl(t)),r=Sl(e).filter(o=>n.has(o.node.id));return r.some(o=>o.paragraphMark)&&Jl$1(e,r,"accept").size>0}function cZ(e,t){let n=nl(e.root);return n==="everywhere"?true:n.size>0&&(t.ranges.length===0||t.ranges.some(r=>n.has(r.start.paragraphId)||n.has(r.end.paragraphId)))}function Z2(e,t,n){let r=t==="accept"?"acceptRevision":"rejectRevision";if(!n)return {ops:[]};if(e.revisionKind==="structural"||e.revisionKind==="moveFrom"||e.revisionKind==="moveTo"||e.revisionKind==="paragraphMark"||cZ(n,e)||e.revisionKind==="format"||t==="accept"&&lZ(n,e)||dZ(n,e)){let i=Ba(n,t,ks(e),void 0,{countRemaining:false,explicit:true}),s=i.result.skipped[0];return s?{ops:[],refusal:Q2(s)}:{ops:i.ops}}let o=new Set(pl(e)),a=new Map;for(let i of Sl(n)){if(!o.has(i.node.id))continue;let s=f=>i.node.attributes.find(p=>p.namespaceUri===pa$2&&p.localName===f)?.value,l=e.addresses.find(f=>f.id===s("id")&&f.author===(s("author")??"")&&(f.date??"")===(s("date")??""));if(!l)continue;let c=i.node.localName,d=JSON.stringify([l,c]),u=a.get(d);u?u.siteNodeIds.push(i.node.id):a.set(d,{revision:l,localName:c,siteNodeIds:[i.node.id]});}return {ops:[...a.values()].map(({revision:i,localName:s,siteNodeIds:l})=>({op:r,revision:i,...s===void 0?{}:{localName:s},siteNodeIds:l}))}}function dZ(e,t){if(t.revisionKind!=="insert"&&t.revisionKind!=="delete")return false;let n=new Set(pl(t));return n.size>1&&Sl(e).some(r=>r.paragraphMark&&n.has(r.node.id))}function J2(e){return e.kind==="comment"?e.comment.date:e.kind==="revision"?e.date:void 0}function t_(e,t,n,r){return e.type!=="toggleReviewPane"&&e.type!=="toggleParagraphMarks"&&e.type!=="toggleBookmarks"&&e.type!=="setEditingMode"?null:t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.type==="toggleReviewPane"&&!n?{ok:false,code:"unsupported",reason:Wt}:e.type==="setEditingMode"?r(e.mode)??{ok:true}:{ok:true}}function e_(e){let t=false;return {get:()=>t,toggle:()=>{t=!t,e(t);}}}function n_(e){let t=0,n=0,r=jH({changed:()=>{t+=1,e.changed();},error:i=>e.emitError(an("hostCallback",`a bookmark mark callback failed: ${i instanceof Error?i.message:String(i)}`))}),o=e_(i=>{e.surface()?.setShowParagraphMarks(i),e.changed();}),a=e_(i=>{e.surface()?.bookmarkEditing.setShown(i),e.changed();});return {popupChrome:r,chromeSettled(){let i=n===t;return n=t,i},capability:e.capability,surfaceOptions:()=>({showParagraphMarks:o.get(),onToggleParagraphMarks:o.toggle,showBookmarks:a.get(),...r.surfaceOptions}),snapshot:()=>({showParagraphMarks:o.get(),showBookmarks:a.get()}),dialog(i,s){if(i.type==="openGoTo"){let l=r.goTo,c=i.fromShortcut===true;return c&&l.canOpen()&&!l.shortcutOn()&&!e.destroyed()?{ok:false,code:"unsupported",reason:"the Go To shortcut is turned off"}:sb(c?{canOpen:l.canOpen,open:l.openFromShortcut}:l,e.destroyed(),s,"Go To view")}return i.type!=="openBookmarkDialog"?null:sb(r.bookmarkDialog,e.destroyed(),s)},toggle(i){if(i.type==="toggleParagraphMarks")o.toggle();else if(i.type==="toggleBookmarks")a.toggle();else return null;return {ok:true,changed:false}},isActive(i){return i.type==="toggleParagraphMarks"?o.get():i.type==="toggleBookmarks"?a.get():null}}}function r_(e,t){return e.session.subscribe(n=>{let r={revision:e.session.packageRevision(),created:n.created,deleted:n.deleted,dirty:n.dirty};n.impact!=="text-local"&&t.refitIfPageResized(),t.bump(),t.emit(r);})}var uZ=12;function o_(e,t){if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),e();},n.port2.postMessage(null);return}t.setTimeout(e,0);}function a_(e,t){if(!Tr(e))return;let n=()=>{t.current()!==e||!Tr(e)||(t.slice(()=>Pc(e,uZ))?t.settled():o_(n,t.view()));};o_(n,t.view());}function i_(e,t){let n=false;return {...e,slice:r=>{try{return e.slice(r)}catch(o){let a=t.take();if(!a)throw o;return t.crashed(o),t.mounted(a,o),n=true,true}},settled:()=>{if(n)return;let r=t.take();e.settled(),r&&t.mounted(r);}}}function s_(e,t,n){if(!t)return false;switch(e.type){case "toggleMark":switch(e.mark){case "bold":return t.bold===true;case "italic":return t.italic===true;case "underline":return t.underline===true;case "strike":return t.strike===true;case "superscript":return t.superscript===true;case "subscript":return t.subscript===true;default:return false}case "setParagraphDirection":return t.direction===e.direction;case "setAlignment":return t.alignment===(e.align==="justify"?"both":e.align);case "toggleList":return n(e.kind);default:return false}}var l_=new WeakMap;function Hx(e,t){let n=t(e?.matches??[]);return l_.set(n,e?.truncated??false),n}function c_(e){return l_.get(e)}function lm(e,t,n){return t.kind==="note"?e.enterNote?.(t.id,n)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the note could not be opened"}:(t.furnitureKind?e.enterHeaderFooter?.({rId:t.rId,kind:t.furnitureKind,position:n}):e.enterHeaderFooter?.({rId:t.rId,position:n}))?(bb(e,n,t.rId),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"the header or footer could not be opened"}}function fZ(e){return e?.kind==="headerFooter"||e?.kind==="note"}function pZ(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function cm(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.activeScope().kind==="frame"&&e.setActiveScope({kind:"body"}),e.exitNote?.(),e.exitHeaderFooter?.());}function d_(e,t){if(typeof t?.blockId!="string"||t.blockId.length===0||!Number.isInteger(t.start)||t.start<0||!Number.isInteger(t.length)||t.length<0)return {ok:false,code:"invalidArgs",reason:"match must carry a blockId and offsets"};if(t.scope?.kind==="frame"){let{drawingNodeId:r,hostParagraphId:o}=t.scope;if(typeof r!="string"||r.length===0||typeof o!="string"||o.length===0)return {ok:false,code:"invalidArgs",reason:"a frame match must carry drawing and host paragraph ids"};let a={ok:false,code:"unsupported",reason:"the text box drawing could not be selected"};if(!Is(e.layout(),r,o))return a;let i=t.scope.owner;if(i){let s=lm(e,i,{paragraphId:o,offset:0});if(!s.ok)return s}else cm(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:a}let n={paragraphId:t.blockId,offset:t.start};if(fZ(t.scope)){let r=lm(e,t.scope,n);if(!r.ok)return r}else {if(t.scope&&t.scope.kind!=="body")return {ok:false,code:"unsupported",reason:"the match scope cannot be opened"};cm(e,t.blockId);}return e.setSelection({anchor:n,head:{paragraphId:t.blockId,offset:t.start+t.length}}),e.revealParagraph(t.blockId),{ok:true,changed:false}}function u_(e,t,n,r,o){let a={...o?.matchCase!==void 0?{matchCase:o.matchCase}:{},...o?.wholeWord!==void 0?{wholeWord:o.wholeWord}:{},...e?{stories:pZ(e,t)}:{}};if(typeof r=="string")return Hx(e?.session.findText(r,a),n);let i=e?.session.findText(r,a);return r.map((s,l)=>Hx(i?.[l],n))}function Bs(e,t,n){let r=e.block??t,o=e.behavior??"instant",a=e.offsetPx??24;if(!["start","center","centerIfNeeded","nearest"].includes(r))throw new TypeError("block must be start, center, centerIfNeeded, or nearest.");if(!["instant","smooth"].includes(o))throw new TypeError("behavior must be instant or smooth.");if(!Number.isFinite(a)||a<0)throw new RangeError("offsetPx must be finite and nonnegative.");let i=n?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??false;return {block:r,offsetPx:a,behavior:i?"instant":o}}function f_(e,t,n=()=>null){return {scrollToPage(r){return !Number.isInteger(r)||r<1?false:(t(),e()?.revealPage(r-1)??false)},scrollToBlock(r,o){if(typeof r!="string"||r.length===0)return false;let a;try{a=Bs(o??{},"start",n());}catch{return false}t();let i=e();return i&&cm(i,r),i?.revealParagraph(r,a)??false}}}var p_="cubic-bezier(0.23, 1, 0.32, 1)";function bi(e,t,n,r=1/0){let o=e??t;if(!Number.isFinite(o)||o<0||o>r)throw new RangeError(r===1/0?`${n} must be a finite, nonnegative number.`:`${n} must be finite and between 0 and ${r}.`);return o}function m_(e,t=180){if(e!==void 0&&typeof e!="boolean"&&(typeof e!="object"||e===null||Array.isArray(e)))throw new TypeError("animation must be a boolean or a durationMs settings object.");return e===false?0:bi(typeof e=="object"?e.durationMs:void 0,e===true||typeof e=="object"?180:t,"animation.durationMs",1e4)}function dm(e,t,{marker:n,defaultColor:r},o){let a=[],i=new Map,s=new Set,l=null,c=null,d=r,u=.14,f=4,p=6,g=0,y=r,h="solid",b="",v=180,S=180,x,k=p_,T=rt(()=>t.container()),R,C=0,A=()=>{C++,R!==void 0&&T.clearTimeout(R),R=void 0;},E=W=>{let H=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(W!==void 0&&(typeof W!="string"||!W.trim()||/var\(|^(inherit|initial|unset|revert|revert-layer)$/i.test(W.trim())||H?.supports&&!H.supports("animation-timing-function",W)))throw new TypeError("animation.easing must be a CSS timing function without variables.");let G=t.container()?.ownerDocument.defaultView?.KeyframeEffect??globalThis.KeyframeEffect;if(W!==void 0&&G)try{new G(null,[],{easing:W});}catch{throw new TypeError("animation.easing must be one valid animation timing function.")}return W},P=(W,H)=>bi(typeof W=="object"?W.exitDurationMs:void 0,H,"animation.exitDurationMs",1e4),w=(W={})=>{if(W.includePrevious!==void 0&&typeof W.includePrevious!="boolean")throw new TypeError("includePrevious must be a boolean.");let H=bi(W.opacity,.14,"opacity",1),G=bi(W.padding,4,"padding"),D=bi(W.borderRadius,6,"borderRadius"),B=m_(W.animation),Z=P(W.animation,B),X=E(typeof W.animation=="object"?W.animation.easing:void 0),N=W.timeoutMs===null?null:bi(W.timeoutMs,3e3,"timeoutMs",2147483647),j=W.color??r,z=bi(W.borderWidth,0,"borderWidth"),Q=W.borderColor??j,ue=W.borderStyle??"solid",oe=W.className??"";if(!["solid","dashed","dotted"].includes(ue))throw new TypeError("borderStyle must be solid, dashed, or dotted.");if(typeof oe!="string")throw new TypeError("className must be a string.");let te=t.container()?.ownerDocument.defaultView?.CSS??globalThis.CSS;if(typeof j!="string"||!j.trim()||te?.supports&&!te.supports("color",j))throw new TypeError("color must be a CSS color or var() expression.");if(te?.supports&&!te.supports("color",`color-mix(in srgb, ${j} ${H*100}%, transparent)`))throw new TypeError("color must be valid inside color-mix(), including var() expressions.");if(typeof Q!="string"||!Q.trim()||te?.supports&&!te.supports("color",Q))throw new TypeError("borderColor must be a CSS color or var() expression.");if(W.changeIds!==void 0&&(!Array.isArray(W.changeIds)||W.changeIds.length>1e4||W.changeIds.some(me=>typeof me!="string"||!me)))throw new TypeError("changeIds must contain at most 10000 nonempty string IDs.");return {nextOpacity:H,nextPadding:G,nextRadius:D,nextDuration:B,nextExitDuration:Z,nextEasing:X,nextTimeout:N,nextColor:j,nextBorderWidth:z,nextBorderColor:Q,nextBorderStyle:ue,nextClassName:oe}},O=()=>x||t.container()?.ownerDocument.defaultView?.getComputedStyle(t.container()).getPropertyValue("--doc-motion-ease-out").trim()||p_,_=W=>{W.animation&&(W.animation.onfinish=null,W.animation.cancel(),W.animation=void 0);},q=(W,H)=>{_(H),H.element.remove(),i.get(W)===H&&i.delete(W);},K=()=>(c||(c=t.container()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null,c?.addEventListener("change",M)),c?.matches??false),U=()=>{c?.removeEventListener("change",M),c=null;};function M(){if(c?.matches){for(let[W,H]of i)_(H),H.exiting&&q(W,H);i.size||U();}}let Y=(W,H,G,D,B=false)=>{if(!B&&H.target===G&&!H.exiting)return;let Z=H.element.ownerDocument.defaultView,X=B?0:Number.parseFloat(Z?.getComputedStyle(H.element).opacity??String(H.target));_(H),H.target=G,H.element.style.opacity=String(G);let N=K()?Math.min(D,125):D;if(N===0||typeof H.element.animate!="function"){H.exiting&&q(W,H);return}try{let j=H.element.animate([{opacity:Number.isFinite(X)?X:G},{opacity:G}],{duration:N,easing:k});H.animation=j,j.onfinish=()=>{H.animation===j&&(H.animation=void 0,H.exiting&&q(W,H),i.size||U());};}catch{H.exiting&&q(W,H);}},ne=()=>{l?.disconnect();let W=t.surface(),H=t.container();if(!W||!H||a.length===0)return;k=O();let G=new Set(a.map(N=>N.paragraphId)),D=e.getRenderScale(),B=e.snapshot().zoom,Z=new Set,X=new Set;for(let N of W.layout().pages){let j=H.querySelector(`[data-page-index="${N.index}"] > .docx-page-content`);if(j)for(let z of Ja$2(N)){if(!G.has(z.paragraphId))continue;let Q=`${N.index}:${z.id}`;Z.add(Q);let ue=xc$1(z),oe=z.lines.length&&!z.clipToBox?1/0:ue.y,te=z.lines.length&&!z.clipToBox?-1/0:ue.y+ue.height;for(let _e of z.clipToBox?[]:z.lines)oe=Math.min(oe,_e.box.y),te=Math.max(te,_e.box.y+_e.box.height);let me=z.clipToBox?0:f*B,Se=N.contentBox.x-N.box.x,qe=N.contentBox.y-N.box.y,xe=Math.max(-Se*D,ue.x*D-me),He=Math.min((N.box.width-Se)*D,(ue.x+ue.width)*D+me);oe=Math.max(-qe*D,oe*D-me),te=Math.min((N.box.height-qe)*D,te*D+me);let $e=i.get(Q);$e&&$e.element.parentElement!==j&&(q(Q,$e),$e=void 0);let Je=!$e;if(!$e){let _e=H.ownerDocument.createElement("div");_e.setAttribute("data-docx-marker",""),_e.setAttribute(n,""),_e.setAttribute("contenteditable","false"),_e.setAttribute("aria-hidden","true"),_e.style.cssText="position:absolute;pointer-events:none;box-sizing:border-box;",$e={element:_e,paragraphId:z.paragraphId,target:-1,exiting:false},i.set(Q,$e),j.append(_e);}let et=$e.exiting;$e.exiting=false,et&&($e.target=-1),$e.element.className=b,Object.assign($e.element.style,{border:g?`${g*B}px ${h} ${y}`:"0",backgroundColor:`color-mix(in srgb, ${d} ${u*100}%, transparent)`,borderRadius:`${p*B}px`,left:`${xe}px`,top:`${oe}px`,width:`${Math.max(0,He-xe)}px`,height:`${Math.max(0,te-oe)}px`}),Y(Q,$e,1,Je&&s.has(z.paragraphId)?0:v,Je),X.add(z.paragraphId);}}for(let N of X)s.add(N);for(let[N,j]of i)Z.has(N)||(!j.element.isConnected||G.has(j.paragraphId)||S===0?q(N,j):j.exiting||(j.exiting=true,Y(N,j,0,S)));l??=new(Ae(H)).MutationObserver(ne),l.observe(H,{childList:true,subtree:true});},le=()=>{A(),a=[],s.clear(),l?.disconnect();for(let[W,H]of i)q(W,H);U();},se=(W={})=>{let H=P(W.animation,m_(W.animation,S));k=E(typeof W.animation=="object"?W.animation.easing:void 0)??O(),A(),a=[],s.clear(),l?.disconnect();for(let[D,B]of i)B.exiting&&H>0||(B.exiting=true,Y(D,B,0,H));i.size||U();};return e.on("selectionChange",()=>{a.length&&ne();}),{show(W,H={}){let{nextOpacity:G,nextPadding:D,nextRadius:B,nextDuration:Z,nextExitDuration:X,nextEasing:N,nextTimeout:j,nextColor:z,nextBorderWidth:Q,nextBorderColor:ue,nextBorderStyle:oe,nextClassName:te}=w(H),me=new Set(a.map(Se=>Se.paragraphId));if(s=new Set([...s].filter(Se=>me.has(Se))),d=z,g=Q,y=ue,h=oe,b=te,u=G,f=D,p=B,v=Z,S=X,x=N,a=W,v===0)for(let Se of i.values())Se.exiting||_(Se);if(!a.length){se();return}if(ne(),A(),j!==null){let Se=C;R=T.setTimeout(()=>{Se===C&&(R=void 0,se(),o());},j);}},validate:w,hide:se,clear:le,repaint:ne}}function g_(e,t){e.flushPendingInput();let n=jn(e.session.part(),e.session.paragraphAnchors(),t);return n.ok?n.span:null}function h_(e,t,n){let r=null,o=a=>{if(r)return r;let i=e(),s=dm(i,a,{marker:"data-docx-anchor-highlight",defaultColor:"var(--doc-anchor-highlight-color)"},()=>{});return a.invalidated.add(()=>s.clear()),i.on("change",l=>{l.source&&s.clear();}),r=s,s};return {scrollToAnchor(a,i={}){let s=t(),l=Bs(i,"centerIfNeeded",s?.container()??null);if(!Zt(a))return false;n();let c=s?.surface();if(!c)return false;let d=g_(c,a);return !!d&&c.revealPosition({paragraphId:d.nodeId,offset:d.start},l)},highlightAnchor(a,i){let s=t();if(!s)return false;let l=o(s);if(l.validate(i),!Zt(a))return false;n();let c=s.surface();if(!c||!s.container()||s.source)return false;let d=g_(c,a)?.nodeId;return !d||!c.layout().pages.some(f=>Ja$2(f).some(p=>p.paragraphId===d))&&!(Tr(c)&&c.session.paragraphIds().includes(d))?false:(l.show([{paragraphId:d}],i),true)},clearAnchorHighlight(a){let i=t();i&&o(i).hide(a);}}}function y_(e,t){if(!t.some(o=>o.scope?.kind==="frame"))return t;let n=e.publishedLayout();if(n.revision!==e.session.packageRevision())return t;let r=new Map;return t.filter(o=>{let a=o.scope;if(a?.kind!=="frame")return true;let i=`${a.drawingNodeId}\0${a.hostParagraphId}`,s=r.get(i);return s===void 0&&(s=!!Is(n,a.drawingNodeId,a.hostParagraphId),r.set(i,s)),s})}var mZ=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,gZ=/^-?[A-Za-z_][A-Za-z0-9_-]*$/,hZ=1e4,b_=32,_x=1e3;function yZ(e,t,n){let r=e?.ownerDocument.defaultView?.CSS??globalThis.CSS;return !r?.supports||r.supports(t,n)}function v_(e,t,n){if(e!==void 0){if(typeof e!="string"||!e.trim()||!yZ(n,"color",e))throw new TypeError(`${t} must be a CSS color or var() expression.`);return e}}function x_(e){if(typeof e!="string"||!mZ.test(e))throw new TypeError('Highlight set names are 1 to 64 letters, digits, "-", or "_", starting with a letter.');return e}function bZ(e,t,n,r,o){if(!Array.isArray(t))throw new TypeError("ranges must be an array of HighlightRange.");if(n!==void 0&&(typeof n!="object"||n===null))throw new TypeError("options must be an object.");let a=t.slice(0,hZ),i=t.length-a.length,s=[],l=new Int32Array(a.length),c=new Int32Array(a.length);for(let[h,b]of a.entries()){if(!(typeof b=="object"&&b!==null&&typeof b.blockId=="string"&&b.blockId.length>0&&Number.isSafeInteger(b.start)&&b.start>=0&&Number.isSafeInteger(b.length)&&b.length>=0&&b.start+b.length<=2147483647&&(b.expectedText===void 0||typeof b.expectedText=="string")))throw new TypeError(`ranges[${h}] must have a blockId string, nonnegative integer start and length, and an optional expectedText string.`);s.push(b.blockId),l[h]=b.start,c[h]=b.start+b.length;}let d=n?.activeIndex??-1;if(!Number.isInteger(d)||d<-1)throw new RangeError("activeIndex must be an integer of -1 or more.");let u=n?.priority??0;if(!Number.isInteger(u)||Math.abs(u)>_x)throw new RangeError(`priority must be an integer from -${_x} to ${_x}.`);let f=n?.className??"";if(typeof f!="string")throw new TypeError("className must be a string.");let p=f.split(/\s+/).filter(Boolean);if(p.some(h=>!gZ.test(h)))throw new TypeError("className must hold space-separated CSS class names.");let g=v_(n?.color,"color",o),y=v_(n?.activeColor,"activeColor",o);return {name:e,ranges:a,overflow:i,blockIds:s,starts:l,ends:c,...g!==void 0?{color:g}:{},...y!==void 0?{activeColor:y}:{},activeIndex:d,classes:p,priority:u,order:r,expected:null,seen:new Array(a.length).fill(null),resolved:new Uint8Array(a.length),live:new Uint8Array(a.length),checkedAt:null}}function vZ(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r+=1;let o=0;for(;o<n-r&&e.charCodeAt(e.length-1-o)===t.charCodeAt(t.length-1-o);)o+=1;return {from:r,oldTo:e.length-o,delta:t.length-e.length}}function xZ(e,t,n){return t<=n.from?0:e>=n.oldTo?n.delta:0}var qx=new WeakMap,P_=new WeakMap,S_=new WeakSet,Bx=new WeakMap,$x=new WeakMap;function SZ(e,t){return qx.has(e)?qx.get(e):typeof e.expectedText=="string"?e.expectedText:(Bx.has(e)||Bx.set(e,t),Bx.get(e))}var Wx=new WeakMap;function C_(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=ce(e.session,n),o=r?eb$1(r,n):null,a=null;return r&&o&&(Wx.has(o)?a=Wx.get(o):(a=Nm(r,n),Wx.set(o,a))),t.set(n,a),a}}function w_(e,t,n){let r=t.session,o=r.packageRevision(),a=e.checkedAt;if(a?.session===r&&a.revision===o&&a.layout===n)return;let i=C_(t),s=tf$1(n),l=e.expected===null,c=e.expected??new Array(e.ranges.length).fill(null),d=new Map;for(let u=0;u<e.ranges.length;u+=1){let f=e.ranges[u],p=e.ends[u]>e.starts[u]?i(e.blockIds[u]):null;if(!l&&p!==null&&p===e.seen[u]){e.live[u]=e.resolved[u]&&s.has(e.blockIds[u])?1:0;continue}let g=l?P_.get(f)??$x.get(f)??p:e.seen[u];if(p!==null&&g!==null&&g!==p){let S=e.blockIds[u],x=d.get(S);x?.seen!==g&&(x={seen:g,edit:vZ(g,p)},d.set(S,x));let k=xZ(e.starts[u],e.ends[u],x.edit);e.starts[u]=e.starts[u]+k,e.ends[u]=e.ends[u]+k;}e.seen[u]=p;let y=e.starts[u],h=e.ends[u],b=p!==null&&h<=p.length?p.slice(y,h):null;if(!l&&p!==null&&b!==c[u]&&g!==null){let S=p.length-g.length,x=y+S>=0?p.slice(y+S,h+S):null;S!==0&&x!==null&&x===c[u]&&(e.starts[u]=y+S,e.ends[u]=h+S,b=x);}l&&(c[u]=SZ(f,b),p!==null&&!$x.has(f)&&$x.set(f,p));let v=b!==null&&b===c[u];e.resolved[u]=v?1:0,e.live[u]=v&&s.has(e.blockIds[u])?1:0;}e.expected=c,e.checkedAt={session:r,revision:o,layout:n};}var k_=new WeakMap,I_=new WeakMap,R_=new WeakMap;function wZ(e){let t=new Map;for(let n=0;n<e.ranges.length;n+=1){if(!e.live[n])continue;let r=e.blockIds[n],o=t.get(r)??[];o.push({key:n,start:e.starts[n],end:e.ends[n]}),t.set(r,o);}return t}function kZ(e,t,n,r,o){let a=t.children[n];a||(a=e.createElement("div"),a.style.position="absolute",t.append(a));let i=r.index===o.activeIndex,s=`${r.index}|${i?1:0}|${r.left}|${r.top}|${r.width}|${r.height}`;R_.get(a)?.key!==s&&(a.className=i?"docx-text-highlight docx-text-highlight--active":"docx-text-highlight",o.classes.length>0&&a.classList.add(...o.classes),a.setAttribute("data-highlight-index",String(r.index)),a.style.left=`${r.left}px`,a.style.top=`${r.top}px`,a.style.width=`${r.width}px`,a.style.height=`${r.height}px`,R_.set(a,{key:s}));}function IZ(e){return e?[...e].sort((t,n)=>t-n).join(","):"*"}function RZ(e){return e?[...e].map(([t,n])=>`${t}:${n}`).join(","):""}function T_(e){let t=new Map,n=0,r=0,o=[],a=null,i=null,s=null,l=null,c=()=>[...t.values()].sort((h,b)=>h.priority-b.priority||h.order-b.order);function d(h){let b=e.surface();if(a=h.layer,l=h,!b||t.size===0){h.layer.childElementCount>0&&h.layer.replaceChildren(),o=[],i=null;return}let v=c();for(let A of v)w_(A,b,h.layout);let S=fi(h.layout),x=[r,b.session.packageRevision(),IZ(h.pages),h.scale,RZ(h.pageOffsetX)].join("|");if(x===i&&S===s&&h.layer.childElementCount>0)return;i=x,s=S;let k=h.layer.ownerDocument,T=[],R=[];for(let A of v){let E=u(A,S,h),P=f(k,A),w=0;for(let O of E){let _=S.pages[O.pageIndex];if(!_)continue;let q=h.pageOffsetX?.get(O.pageIndex)??0,K={set:A,index:O.key,left:(_.contentBox.x+O.x+q)*h.scale,top:(_.contentBox.y+O.y)*h.scale,width:O.width*h.scale,height:O.height*h.scale};kZ(k,P,w,K,A),w+=1,R.push(K);}for(;P.childElementCount>w;)P.lastElementChild.remove();T.push(P);}let C=h.layer.children;(C.length!==T.length||T.some((A,E)=>C[E]!==A))&&h.layer.replaceChildren(...T),o=R;}function u(h,b,v){let S=k_.get(h);S||(S=new WeakMap,k_.set(h,S));let x=[],k=new Map;for(let R of b.pages)v.pages&&!v.pages.has(R.index)||(x.push(R),S.has(R)||k.set(R.index,{page:R,rects:[]}));if(k.size>0){let R=sf$1(b,wZ(h),new Set(k.keys()),v.measurer);for(let C of R)k.get(C.pageIndex).rects.push(C);for(let{page:C,rects:A}of k.values())S.set(C,A);}let T=[];for(let R of x)for(let C of S.get(R))T.push(C);return h.activeIndex>=0&&T.sort((R,C)=>+(R.key===h.activeIndex)-+(C.key===h.activeIndex)),T}function f(h,b){let v=I_.get(b);if(v)return v;let S=h.createElement("div");return S.className="docx-text-highlight-set",S.setAttribute("data-highlight-set",b.name),b.color&&S.style.setProperty("--doc-text-highlight-set-color",b.color),b.activeColor&&S.style.setProperty("--doc-text-highlight-set-active-color",b.activeColor),I_.set(b,S),S}function p(){r+=1,e.surface()?.repaintHighlights();}function g(h){let b=e.surface();if(!b)return {applied:0,unavailable:h.ranges.length+h.overflow};let v=b.publishedLayout();w_(h,b,v);let S=v.revision!==b.session.packageRevision(),x=0;for(let k=0;k<h.ranges.length;k+=1)x+=S?h.resolved[k]:h.live[k];return {applied:x,unavailable:h.ranges.length-x+h.overflow}}return {members:{setHighlights(h,b,v){x_(h),Array.isArray(b)&&b.length>0&&e.flushOpen();let S=t.get(h),x=bZ(h,b,v,S?.order??n,e.container());if(!S&&x.ranges.length>0&&t.size>=b_)throw new RangeError(`At most ${b_} highlight sets exist at once.`);if(x.ranges.length===0)return S&&(t.delete(h),p()),{applied:0,unavailable:0};S||(n+=1),t.set(h,x);let k=g(x);return p(),k},clearHighlights(h){if(h===void 0){if(t.size===0)return;t.clear();}else if(!t.delete(x_(h)))return;p();},getHighlightsAt(h,b){if(!Number.isFinite(h)||!Number.isFinite(b))return [];let v=a;if(!v?.isConnected||o.length===0)return [];let S=v.getBoundingClientRect(),x=h-S.left,k=b-S.top,T=[],R=new Set;for(let C=o.length-1;C>=0;C-=1){let A=o[C];if(x<A.left||x>=A.left+A.width||k<A.top||k>=A.top+A.height)continue;let E=`${A.set.name}\0${A.index}`;if(R.has(E)||t.get(A.set.name)!==A.set)continue;R.add(E);let P=S.left+A.left,w=S.top+A.top;T.push({name:A.set.name,index:A.index,range:A.set.ranges[A.index],start:A.set.starts[A.index],length:A.set.ends[A.index]-A.set.starts[A.index],active:A.index===A.set.activeIndex,rect:{x:P,y:w,left:P,top:w,width:A.width,height:A.height,right:P+A.width,bottom:w+A.height}});}return T}},frame:()=>{let h=e.surface();if(!l||!h)return l;let b=h.session.packageRevision();if(l.layout.revision===b)return l;let v=h.layout();return l.layout===v?l:{...l,layout:v,revision:b}},noteMatches(h){let b=e.surface();if(!b||S_.has(h))return h;let v=y_(b,h);S_.add(v);let S=C_(b);for(let x of v){let k=S(x.blockId);k!==null&&P_.set(x,k);let T=x.start+x.length;qx.set(x,k!==null&&T<=k.length?k.slice(x.start,T):null);}return v},attach(h,b=false){i=null,l=null,b&&t.clear(),h?.setHighlightPainter(d);},reset(){t.size!==0&&(t.clear(),p());}}}var E_=new WeakMap;function O_(e){let t=E_.get(e);if(t)return t;let n=new Map,r=new Map,o=(s,l)=>{if(n.has(l))return;let c=r.get(s);c||(c=[],r.set(s,c)),n.set(l,{story:s,index:c.length}),c.push(l);},a=(s,l)=>{for(let c of Ka$2(l)){for(let d of c.lines)for(let u of Za$1(d))o(s,u.paragraphId);c.lines.length===0&&o(s,c.paragraphId);}};for(let s of e.pages){a("body",s.fragments);for(let l of [s.header,s.footer])l&&a(`part:${l.partName}`,l.fragments);for(let l of [s.footnotes,s.endnotes])for(let c of l?.notes??[])a(`notes:${c.noteKind}`,c.fragments);}let i={positions:n,paragraphs:r};return E_.set(e,i),i}function PZ(e,t,n,r){let o=(d,u,f)=>{if(f<=u)return;let p=r.get(d);p?p.push({key:t,start:u,end:f}):r.set(d,[{key:t,start:u,end:f}]);},{start:a,end:i}=e;if(a.paragraphId===i.paragraphId){o(a.paragraphId,a.offset,i.offset);return}let s=n.positions.get(a.paragraphId),l=n.positions.get(i.paragraphId);if(o(a.paragraphId,a.offset,Number.POSITIVE_INFINITY),o(i.paragraphId,0,i.offset),!s||!l||s.story!==l.story||l.index<=s.index)return;let c=n.paragraphs.get(s.story);for(let d=s.index+1;d<l.index;d+=1)o(c[d],0,Number.POSITIVE_INFINITY);}function CZ(e,t){if(e.start.paragraphId===e.end.paragraphId)return e.end.offset-e.start.offset;let n=t.positions.get(e.start.paragraphId),r=t.positions.get(e.end.paragraphId);return !n||!r||n.story!==r.story?Number.MAX_SAFE_INTEGER:(r.index-n.index)*1e6+(e.end.offset-e.start.offset)}function TZ(e){let t=e.item;return t.kind==="revision"?t.ranges:t.range?[t.range]:[]}var M_={comment:0,custom:1,revision:2};function A_(e,t){let n=new Map,r=[];return e.forEach((o,a)=>{for(let i of TZ(o)){let s=r.length;r.push({placement:a,width:CZ(i,t)}),PZ(i,s,t,n);}}),{byParagraph:n,sources:r}}function L_(e,t){return !e.pages||e.pages.has(t.index)}function F_(e,t,n,r){let o=e.pageOffsetX?.get(n.index)??0,a=t.left+(n.contentBox.x+r.x+o)*e.scale,i=t.top+(n.contentBox.y+r.y)*e.scale,s=r.width*e.scale,l=r.height*e.scale;return {x:a,y:i,left:a,top:i,width:s,height:l,right:a+s,bottom:i+l}}function D_(e){function t(){let n=e.frame();return !n?.layer.isConnected||!(n.scale>0)?null:{frame:n,origin:n.layer.getBoundingClientRect()}}return {getReviewItemsAt(n,r,o){if(!Number.isFinite(n)||!Number.isFinite(r))return [];let a=t();if(!a)return [];let{frame:i,origin:s}=a,l=(n-s.left)/i.scale,c=(r-s.top)/i.scale,d=i.layout.pages.find(x=>{if(!L_(i,x))return false;let k=x.box.x+(i.pageOffsetX?.get(x.index)??0);return l>=k&&l<k+x.box.width&&c>=x.box.y&&c<x.box.y+x.box.height});if(!d)return [];let u=e.placements(o);if(u.length===0)return [];let f=O_(i.layout),{byParagraph:p,sources:g}=A_(u,f),y=l-(i.pageOffsetX?.get(d.index)??0)-d.contentBox.x,h=c-d.contentBox.y,b=new Map,v=sf$1(fi(i.layout),p,new Set([d.index]),i.measurer);for(let x of v){if(y<x.x||y>=x.x+x.width||h<x.y||h>=x.y+x.height)continue;let k=g[x.key],T=b.get(k.placement);(!T||k.width<T.width)&&b.set(k.placement,{width:k.width,rect:x});}let S=[...b.entries()].map(([x,k])=>({at:x,...k}));return S.sort((x,k)=>{if(x.width!==k.width)return x.width-k.width;let T=u[x.at],R=u[k.at];if(T.kind!==R.kind)return M_[T.kind]-M_[R.kind];if(T.kind==="revision"&&R.kind==="revision"){let C=R.item.nesting-T.item.nesting;if(C!==0)return C}return x.at-k.at}),S.map(x=>({placement:u[x.at],rect:F_(i,s,d,x.rect)}))},getReviewItemRects(n){if(typeof n!="string"||n.length===0)return [];let r=t();if(!r)return [];let{frame:o,origin:a}=r,i=Qr(e.placements,n);if(!i)return [];let s=new Set(o.layout.pages.filter(c=>L_(o,c)).map(c=>c.index)),{byParagraph:l}=A_([i],O_(o.layout));return sf$1(fi(o.layout),l,s,o.measurer).map(c=>F_(o,a,o.layout.pages[c.pageIndex],c))}}}var EZ=new WeakMap,OZ=new WeakMap;function MZ(e,t){return e.anchorY===t.anchorY&&e.pageIndex===t.pageIndex&&e.activatable===t.activatable&&e.isActive===t.isActive&&e.locked===t.locked}function N_(e,t){let n=t.anchorY===null&&t.pageIndex===null?OZ:EZ,r=n.get(e);if(r&&MZ(r.inputs,t))return r.placement;let o=AZ(e,t);return n.set(e,{inputs:t,placement:o}),o}function AZ(e,t){let n=J2(e),r={key:ql(e),id:e.id,...n!==void 0?{date:n}:{},activatable:t.activatable,anchorY:t.anchorY,pageIndex:t.pageIndex,isActive:t.isActive};return e.kind==="comment"?{...r,kind:"comment",author:e.comment.author,initials:dm$1(e.comment),text:bm$1(e.comment),resolved:e.resolved,...e.parentId!==void 0?{parentId:e.parentId}:{},...e.parentRevisionId!==void 0?{parentRevisionId:e.parentRevisionId}:{},replyIds:e.replyIds,readOnly:false,item:e}:e.kind==="revision"?{...r,kind:"revision",revisionKind:e.revisionKind,author:e.author,initials:fF(e.author),text:_b$2(e.text),...e.replacedText?{replacedText:_b$2(e.replacedText)}:{},replyIds:e.replyIds,readOnly:e.readOnly||t.locked,item:e}:{...r,kind:"custom",author:"",initials:"",text:e.detail??e.text,replyIds:[],readOnly:true,item:e}}function LZ(e){return e==="password"?{ok:false,code:"locked",reason:H_}:e==="other-restriction"?{ok:false,code:"locked",reason:"this document declares a different editing restriction; open it in Word to change that"}:e==="no-change"?{ok:false,code:"invalidArgs",reason:"the document protection is already set"}:{ok:false,code:"unsupported",reason:"document protection could not be written"}}var H_="this document is protected with a password; open it in Word to change that";function __(e){let t=null,n=null,r=()=>{let l=e.tracking();return [l.restrictedToReadOnly,l.restrictedToComments,l.restrictedToForms,l.restrictedToTrackedChanges].join("|")},o,a=null,i=()=>{let l=e.surface();if(!l)return null;let c=l.session.settingsRoot();return (c!==o||a===null)&&(o=c,a=c?nj$1(c):mj$1),a},s=()=>{if(e.destroyed())return {ok:false,code:"notFound",reason:"the editor was destroyed"};let l=i();return l===null?{ok:false,code:"notFound",reason:"no document is loaded"}:e.hostViewOnly()?{ok:false,code:"locked",reason:"this document was opened for viewing"}:l.enforced&&l.password?{ok:false,code:"locked",reason:H_}:!l.enforced&&l.edit!=="none"&&l.edit!=="forms"?{ok:false,code:"locked",reason:"this document declares a different editing restriction; open it in Word to change that"}:null};return {sync(){let l=e.surface()?.session.settingsRoot()??null;if(l===n&&t!==null)return;n=l;let c=r();c!==t&&(t=c,e.adopt(e.decision()));},prime:()=>{n=e.surface()?.session.settingsRoot()??null,t=r();},state:i,isActive:()=>i()?.enforced===true,can(l){return l.type!=="toggleDocumentProtection"?null:s()??{ok:true}},exec(l){if(l.type!=="toggleDocumentProtection")return null;let c=s();if(c&&!c.ok)return c;let d=e.surface(),u=!i().enforced,f=d.applyHeaderFooterLifecycle?.({op:"setDocumentProtection",enforce:u});return f?f.ok?(e.publish(),{ok:true,changed:true}):LZ(f.reason):{ok:false,code:"unsupported",reason:"document protection is not available"}}}}function B_(e,t){return nh(e.revisionsIn,t)}function $_(e,t){let n=Gu(e);return {current:()=>n,set(r){if(!t.enabled)return {ok:false,code:"unsupported",reason:Wt};let o;try{o=Gu(r,n);}catch(i){return {ok:false,code:"invalidArgs",reason:i.message}}if(o===n)return {ok:true,changed:false};let a=n;return n=o,t.changed(n,a),{ok:true,changed:false}},shows:r=>r.some(o=>B_(n,o)),opensOnLoad:r=>n.opening==="auto"&&r.some(o=>B_(n,o)),opensOnTrackedChange:()=>n.opening==="auto"&&n.revisionsIn==="pane",pairsReplacements:()=>n.revisionsIn==="balloons"}}function W_(e,t){let n=wl(t)?.partName;if(!n||!e||n===e.part().name)return null;for(let r of e.headerFooterResolutionBySection())for(let o of ["header","footer"]){let a=o==="header"?r.headers:r.footers;for(let i of a.values())if(i.partName===n)return {kind:o,rId:i.rId}}return null}function q_(e,t){let n=wl(t)?.partName;if(!n||!e)return null;for(let r of ["footnote","endnote"])if(tj$1(e.currentPackage(),r)?.name===n)return {kind:"notesPart",noteKind:r};return null}var um=class e{constructor(t,n){this.positions=t;this.blocks=n;}positions;blocks;[Symbol.toStringTag]="Map";static from(t){let n=new Map,r=[];for(let[o,a]of t){let i=n.size;n.set(o,i);let s=Math.floor(i/64);(r[s]??=[]).push(a);}return new e(n,r)}updated(t){let n,r=new Map;for(let[o,a]of t){let i=this.positions.get(o);if(i===void 0)throw new Error("Cannot update an absent review anchor");let s=Math.floor(i/64),l=i%64;if(this.blocks[s][l]===a)continue;let c=r.get(s);c||(c=[...this.blocks[s]],r.set(s,c),(n??=[...this.blocks])[s]=c),c[l]=a;}return n?new e(this.positions,n):this}get size(){return this.positions.size}has(t){return this.positions.has(t)}get(t){let n=this.positions.get(t);return n===void 0?void 0:this.blocks[Math.floor(n/64)][n%64]}keys(){return this.positions.keys()}*values(){for(let t of this.blocks)yield*t;}*entries(){for(let[t,n]of this.positions)yield [t,this.blocks[Math.floor(n/64)][n%64]];}[Symbol.iterator](){return this.entries()}forEach(t,n){for(let[r,o]of this)t.call(n,o,r,this);}};function z_(e){let t=K_();if(!e)return t;let n=K_(),r=new WeakMap;return o=>{let a=t(o),i=r.get(a);if(!i){let s=()=>n(xv(o));r.set(a,i=new Ux(a,s,e));}return i}}var Ux=class{constructor(t,n,r){this.stories=t;this.boxes=n;this.hostOf=r;}stories;boxes;hostOf;[Symbol.toStringTag]="Map";hosted=new Map;get(t){let n=this.stories.get(t);if(n)return n;let r=this.hosted.get(t);if(r===void 0){let o=this.boxes().get(t);if(o)return this.hosted.set(t,o),o;let a=this.hostOf(t),i=a===null?void 0:this.stories.get(a);r=i?{pageIndex:i.pageIndex,contentY:i.contentY,fragmentY:i.fragmentY}:null,this.hosted.set(t,r);}return r??void 0}has(t){return this.get(t)!==void 0}get size(){return this.stories.size}forEach(t,n){this.stories.forEach((r,o)=>t.call(n,r,o,this));}entries(){return this.stories.entries()}keys(){return this.stories.keys()}values(){return this.stories.values()}[Symbol.iterator](){return this.stories[Symbol.iterator]()}};function K_(){let e=new WeakMap,t=null;return n=>{let r=e.get(n);if(r)return r;let o=t&&FZ(t,n);if(o)return e.set(n,o),t={pages:Ch$1(n.pages),index:Ch$1(o)},o;let a=new Map;for(let s of n.pages)for(let[l,c]of qd(s))a.has(l)||a.set(l,c);for(let s of n.pages)for(let[l,c]of jx(s))a.has(l)||a.set(l,c);let i=um.from(a);return e.set(n,i),t={pages:Ch$1(n.pages),index:Ch$1(i)},i}}function U_(e,t){if(e.size!==t.size)return false;for(let n of e.keys())if(!t.has(n))return false;return true}var j_=new WeakMap;function jx(e){let t=j_.get(e);if(t)return t;let n=new Map;for(let r of [e.header,e.footer])r&&G_(n,r.fragments,e.index,r.box.y);for(let r of [e.footnotes,e.endnotes])if(r)for(let o of r.notes)G_(n,o.fragments,e.index,o.box.y);return j_.set(e,n),n}var V_=e=>qd(e);function FZ(e,t){let n=e.pages.deref(),r=e.index.deref();if(!n||!r||n.length!==t.pages.length)return null;let o=null;for(let[a,i]of t.pages.entries()){let s=n[a];if(i===s)continue;let l=V_(i),c=V_(s);if(!U_(l,c))return null;let d=jx(i),u=jx(s);if(!U_(d,u))return null;o??=new Map;for(let[f,p]of l)r.get(f)===c.get(f)&&o.set(f,p);for(let[f,p]of d)r.get(f)===u.get(f)&&o.set(f,p);}return o?r.updated(o):r}function G_(e,t,n,r){for(let o of Ka$2(t))for(let a of ab$1(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}var Kx=new WeakSet;function Z_(e,t,n){if(Kx.has(e))return;Kx.add(e);let r=()=>{Kx.delete(e),n();};typeof t.requestIdleCallback=="function"?t.requestIdleCallback(r,{timeout:1e3}):t.setTimeout(r,200);}var X_=new WeakMap;function Q_(e){let t=X_.get(e);if(t)return t;let n=new Map;for(let r of e.pages)for(let o of [r.footnotes,r.endnotes])if(o)for(let a of o.notes)for(let i of Ka$2(a.fragments))for(let s of ab$1(i))n.has(s)||n.set(s,a.scopeId);return X_.set(e,n),n}var Y_=new WeakMap;function J_(e){let t=Y_.get(e);if(t)return t;let n=new Map;for(let[r,o]of db$1(e).entries())n.set(o,r);return Y_.set(e,n),n}var DZ={"open.zip-corrupt":"damaged","open.zip-invalid-entry-name":"damaged","open.xml-malformed":"damaged","open.content-types-invalid":"damaged","open.relationships-invalid":"damaged","open.unsupported-source":"not-docx","open.missing-main-document":"not-docx","open.zip-entry-limit":"too-large","open.zip-size-limit":"too-large","open.zip-ratio-limit":"too-large","open.xml-part-size-limit":"too-large","open.xml-depth-limit":"too-large","open.xml-element-limit":"too-large","open.relationship-limit":"too-large","open.part-limit":"too-large","open.xml-dtd-forbidden":"blocked","open.invalid-limits":"unknown","open.failed":"unknown"};function Vx(e){return Object.freeze({code:e,reason:DZ[e]??"unknown"})}function e8(e){let t=null,n=null;return {get parseError(){return t},get failure(){return n},reject(r,o,a){t=a?`${r}: ${a}`:r,n=Vx(A$1(r,o));},refuseSource(r,o=false){let a=$E(r);return o||(t=a,n=Vx("open.unsupported-source"),e()),a},crash(){t="open failed",n=Vx("open.failed"),e();},clear(){t=null,n=null;}}}function t8(e,t){if(e==="")return;let n=(t??globalThis).navigator?.clipboard;if(n?.writeText)try{n.writeText(e).catch(()=>{});}catch{}}function Gx(e,t,n){if(e===""&&(t===null||t===""))return;let r=n??globalThis,o=r.navigator?.clipboard;if(!o)return;let a=r.ClipboardItem,i=r.Blob;if(t&&o.write&&a&&i)try{let s=new a({"text/plain":new i([e],{type:"text/plain"}),"text/html":new i([t],{type:"text/html"})});o.write([s]).catch(()=>{t8(e,n);});return}catch{}t8(e,n);}function NZ(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function HZ(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function n8(e){return r8(e.children)}function r8(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||hc$1(n))&&t.push(n);return t}function _Z(e){if(hc$1(e))return r8(kc$1(e));if(e.kind!=="table")return [];let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...n8(r));return t}function BZ(e,t,n){let r=t.container,o=r.part==="body"?{kind:"body"}:r.part==="header"||r.part==="footer"?{kind:"headerFooter",rId:r.rId}:{kind:"notesPart",noteKind:r.part==="footnote"?"footnote":"endnote"},a=e.session.partFor(o);if(!a)return {ok:false,code:"notFound",reason:"the target story was not found"};let i="noteId"in r?r.noteId:null,s=r.part==="body"?hd(a):fd(a).find(p=>r.part==="header"||r.part==="footer"?p.kind===r.part:p.kind==="note"&&Rc$1(p.root)===i)?.root;if(!s||s.kind==="textValue")return {ok:false,code:"notFound",reason:"the target story was not found"};if(t.path.length===0)return {ok:false,code:"invalidArgs",reason:"DocLocation path must not be empty"};let l=n8(s),c;for(let p=0;p<t.path.length;p+=1){let g=t.path[p];if(!Number.isInteger(g)||g<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(c=l[g],!c)return {ok:false,code:"notFound",reason:`block index ${g} is out of range`};p<t.path.length-1&&(l=_Z(c));}if(!c||c.kind!=="paragraph"||!eb$1(a,c.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let d=(Nm(a,c.id)??"").length,u=t.offset??(n==="start"?0:d);if(!Number.isInteger(u)||u<0||u>d)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let f={paragraphId:c.id,offset:u};return {ok:true,selection:{anchor:f,head:f}}}function fm(e,t,n){if(NZ(t))return BZ(e,t,n);if(!Zt(t))return {ok:false,code:"invalidArgs",reason:"unrecognized DocTarget endpoint"};let r=e.session.paragraphAnchors(),o=r.nodeByParaId.get(t.paraId.toUpperCase());if(!o)return {ok:false,code:"notFound",reason:"the paragraph was not found"};let a=Ot(e.session,o,{kind:"body"}),i=e.session.partFor(a);if(!i)return {ok:false,code:"notFound",reason:"the target story was not found"};let s=jn(i,r,t);if(!s.ok)return s;let l=n==="start"?s.span.start:s.span.end,c={paragraphId:s.span.nodeId,offset:l};return {ok:true,selection:{anchor:c,head:c}}}function pm(e,t){if(!HZ(t)){let o=fm(e,t,"start");if(!o.ok)return o;let a=fm(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=fm(e,t.from,"start");if(!n.ok)return n;let r=fm(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function $Z(e){return e.evenPage?"even":e.firstPage?"first":"default"}function o8(e){return e.variant!==void 0?e.variant==="default"||e.variant==="first"||e.variant==="even"?e.variant:{ok:false,reason:"variant must be 'default', 'first', or 'even'"}:$Z(e)}function zx(e,t){let n=e.headerFooterState(),r=t.position??n?.editing??null;if(r!=="header"&&r!=="footer")return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"header/footer position is required when no furniture scope is open"}};let a=t.variant!==void 0||t.firstPage!==void 0||t.evenPage!==void 0?o8(t):n?.variant??"default";if(typeof a=="object"&&a.ok===false)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:a.reason}};let i=a,s=t.sectionIndex??n?.sectionIndex??0;return !Number.isInteger(s)||s<0?{ok:false,refusal:{ok:false,code:"invalidArgs",reason:"sectionIndex must be a non-negative integer"}}:{ok:true,sectionIndex:s,kind:r,variant:i}}function WZ(e){let t=e??"rejected";return t==="first-section"||t.includes("first-section")?{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}:{ok:false,code:"invalidArgs",reason:`header/footer lifecycle refused: ${t}`}}function Xc(e,t){if(typeof e.applyHeaderFooterLifecycle!="function")return {ok:false,code:"unsupported",reason:"header/footer lifecycle is not available"};let n=e.applyHeaderFooterLifecycle(t);return n.ok?{ok:true,changed:true}:WZ(n.reason)}function mm(e,t,n,r){let a=e.session.headerFooterResolutionBySection()[t];if(!a)return null;let s=(n==="header"?a.headers:a.footers).get(r);return s?{rId:s.rId,partName:s.partName,inherited:s.inherited,titlePage:a.titlePage,evenAndOddHeaders:a.evenAndOddHeaders}:null}function a8(e,t){if(typeof e.enterHeaderFooter!="function")return {ok:false,code:"unsupported",reason:"header/footer editing is not available"};let n=t.sectionIndex??0;if(!Number.isInteger(n)||n<0)return {ok:false,code:"invalidArgs",reason:"sectionIndex must be a non-negative integer"};let r=t.position,o=o8(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,s=mm(e,n,r,a)?.rId,l=false;if(!s){let d=Xc(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:a,...a==="first"?{titlePage:true}:{},...a==="even"?{evenAndOddHeaders:true}:{}});if(!d.ok)return d;l=true,s=mm(e,n,r,a)?.rId;}return s?e.enterHeaderFooter({rId:s,kind:r,sectionIndex:n,variant:a})?{ok:true,changed:l}:{ok:false,code:"invalidArgs",reason:"the header/footer relationship could not be opened"}:{ok:false,code:"notFound",reason:`no ${r} story is available to edit`}}function i8(e,t){let n=zx(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=Xc(e,{op:"deleteHeaderFooter",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});return a.ok&&o&&r?.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant&&e.exitHeaderFooter(),a}function s8(e,t){let n=zx(e,t);if(!n.ok)return n.refusal;if(n.sectionIndex===0)return {ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"};let r=e.headerFooterState(),o=r?.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant,a=Xc(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=mm(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function l8(e,t){let n=zx(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=!!r&&r.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant,a=r?.rId,i=Xc(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let s=mm(e,n.sectionIndex,n.kind,n.variant);return o&&s&&s.rId!==a&&e.enterHeaderFooter({rId:s.rId,kind:n.kind,sectionIndex:n.sectionIndex}),i}function c8(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return Xc(e,{op:"setSectionFurnitureOptions",...r!==void 0?{sectionIndex:r}:{},...t.titlePage!==void 0?{titlePage:t.titlePage}:{},...t.evenAndOddHeaders!==void 0?{evenAndOddHeaders:t.evenAndOddHeaders}:{},...t.headerDistanceTwips!==void 0?{headerDistanceTwips:t.headerDistanceTwips}:{},...t.footerDistanceTwips!==void 0?{footerDistanceTwips:t.footerDistanceTwips}:{}})}function d8(e,t){return e.activeScope().kind!=="headerFooter"?{ok:false,code:"unsupported",reason:"insertPageField requires an open header or footer scope"}:typeof e.insertPageField!="function"?{ok:false,code:"unsupported",reason:"page field insertion is not available"}:e.insertPageField(t.field)?{ok:true,changed:true}:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"page field insertion was refused"}}function u8(e,t){let n=e.activeScope();return n.kind==="headerFooter"?{ok:false,code:"invalidArgs",reason:"cannot insert a note reference inside a header or footer"}:n.kind==="note"?{ok:false,code:"invalidArgs",reason:"cannot insert a note reference inside another note"}:typeof e.insertNote!="function"?{ok:false,code:"unsupported",reason:"insertNote is not available"}:e.insertNote(t.noteKind)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"insertNote was refused"}}function f8(e,t){return typeof e.deleteNote!="function"?{ok:false,code:"unsupported",reason:"deleteNote is not available"}:e.deleteNote(t.noteKind,t.noteId)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"deleteNote was refused"}}function p8(e,t){return typeof e.convertNote!="function"?{ok:false,code:"unsupported",reason:"convertNote is not available"}:e.convertNote(t.fromKind,t.noteId)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"convertNote was refused"}}function m8(e,t){return typeof e.convertAllNotes!="function"?{ok:false,code:"unsupported",reason:"convertAllNotes is not available"}:e.convertAllNotes(t.fromKind)?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"convertAllNotes was refused"}}function g8(e,t){if(typeof e.setNoteProperties!="function")return {ok:false,code:"unsupported",reason:"setNoteProperties is not available"};let n=t.scope??"document";return e.setNoteProperties({scope:n,sectionIndex:t.sectionIndex,footnote:t.footnote,endnote:t.endnote})?null:{ok:false,code:"invalidArgs",reason:e.state().lastRejection??"setNoteProperties was refused"}}function h8(e){return b$2(e)?{ok:false,code:"unsupported",reason:e}:{ok:false,code:kp(e)||e==="the table of contents is generated and read-only"||e===di?"invalidArgs":"locked",reason:e}}function x8(e,t,n){switch(t.type){case "toggleMark":{let r=wy.get(t.mark),o=e.toggleRunProperty(r.localName,r.attributes);if(o)return h8(o);break}case "setMarkAttr":{let r=ky(t);if(!r.ok)return {ok:false,code:r.code,reason:r.reason};let o=e.setRunProperty(r.localName,r.attributes);if(o)return h8(o);break}case "clearFormatting":e.clearFormatting();break;case "copyFormatting":return e.formatPainter.capture()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:bf};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:ny};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??ny};break}case "setLineSpacing":e.setParagraphProperty("spacing",Up({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...As("before",t.beforePt),...As("after",t.afterPt)},{mergeAttributes:true});break;case "setAlignment":e.setParagraphProperties([{localName:"jc",attributes:{val:t.align==="justify"?"both":t.align},physicalAlignment:true}]);break;case "setParagraphDirection":e.setParagraphProperties([{localName:"bidi",paragraphDirection:t.direction}]);break;case "setParagraphStyle":{if(!e.session.documentStyles().some(o=>o.type==="paragraph"&&o.styleId===t.styleId))return {ok:false,code:"invalidArgs",reason:`style '${t.styleId}' is not a paragraph style of this document`};e.setParagraphProperty("pStyle",{val:t.styleId});break}case "setIndent":{e.setIndent({...t.left!==void 0?{left:t.left}:{},...t.right!==void 0?{right:t.right}:{},...t.firstLine!==void 0?{firstLine:t.firstLine}:{}});break}case "setParagraphFormat":{if(!e.setParagraphFormat({...t.alignment!==void 0?{alignment:t.alignment==="justify"?"both":t.alignment}:{},...t.direction!==void 0?{direction:t.direction}:{},...t.spaceBeforePt!==void 0?{spaceBeforePt:t.spaceBeforePt}:{},...t.spaceAfterPt!==void 0?{spaceAfterPt:t.spaceAfterPt}:{},...t.lineSpacing!==void 0?{lineSpacing:t.lineSpacing}:{},...t.indentLeftTwips!==void 0?{indentLeftTwips:t.indentLeftTwips}:{},...t.indentRightTwips!==void 0?{indentRightTwips:t.indentRightTwips}:{},...t.indentFirstLineTwips!==void 0?{indentFirstLineTwips:t.indentFirstLineTwips}:{},...t.contextualSpacing!==void 0?{contextualSpacing:t.contextualSpacing}:{},...t.keepNext!==void 0?{keepNext:t.keepNext}:{},...t.keepLines!==void 0?{keepLines:t.keepLines}:{},...t.widowControl!==void 0?{widowControl:t.widowControl}:{},...t.pageBreakBefore!==void 0?{pageBreakBefore:t.pageBreakBefore}:{},...t.tabStops!==void 0?{tabStops:t.tabStops}:{}}))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the paragraph format could not be written here"};break}case "setPageSetup":{let r;if(t.scope==="section"){let s=e.sectionAnchorParagraphAt(e.state().selection.head.paragraphId);if(s.kind==="unaddressable")return {ok:false,code:"unsupported",reason:"this section holds no paragraph to address it by"};r=s.kind==="anchor"?s.paragraphId:void 0;}let o=t.pageWidth,a=t.pageHeight;if(t.orientation!==void 0&&(o!==void 0||a!==void 0)){let s=r?e.sectionPropertiesAt(r):e.sectionProperties(),l=o??s.pageSize.widthTwips,c=a??s.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(l,c):Math.min(l,c),a=t.orientation==="landscape"?Math.min(l,c):Math.max(l,c);}if(!e.setSectionProperties({...o!==void 0?{pageWidthTwips:o}:{},...a!==void 0?{pageHeightTwips:a}:{},...t.orientation!==void 0?{orientation:t.orientation}:{},...t.marginTop!==void 0?{marginTopTwips:t.marginTop}:{},...t.marginRight!==void 0?{marginRightTwips:t.marginRight}:{},...t.marginBottom!==void 0?{marginBottomTwips:t.marginBottom}:{},...t.marginLeft!==void 0?{marginLeftTwips:t.marginLeft}:{},...r!==void 0?{anchorParagraphId:r}:{}}))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the page setup change was refused"};break}case "toggleList":if(!e.toggleList(t.kind))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the list change was refused"};break;case "adjustIndent":if(!e.adjustIndent(t.direction))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the selection is already at that indent level"};break;case "insertBreak":if(t.kind==="section"||t.kind==="sectionContinuous"){let r=t.kind==="section"?"nextPage":"continuous";if(!e.insertSectionBreak(r))return {ok:false,code:"invalidArgs",reason:e.sectionBreakRefusal(r)??e.state().lastRejection??"the section break was refused"};break}if(t.kind==="page"){e.insertPageBreak();break}e.insertLineBreak();break;case "insertHyperlink":{let r=t.href.startsWith("#");if(!e.hyperlinks.applyHyperlink({...r?{anchor:t.href.slice(1)}:{url:t.href},...t.text!==void 0?{text:t.text}:{}}))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??"the link was refused: the target is not an allowed scheme, or there is no text to link"};break}case "removeHyperlink":if(!e.hyperlinks.removeHyperlink())return {ok:false,code:"notFound",reason:"there is no hyperlink at the selection"};break;case "insertTextBox":return zT(e);case "insertChart":case "setChartData":case "setChartType":case "setChartFormat":case "setChartColor":return S2(e,t,n?.translate);case "insertText":if(e.type(t.text),e.state().lastRejection==="the table of contents is generated and read-only"||e.state().lastRejection===di)return {ok:false,code:"invalidArgs",reason:e.state().lastRejection};break;case "deleteText":if(tn(e))return Yy(e,{type:"deleteImage"},n?.editor);e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let a=pm(e,t.target);if(!a.ok)return {ok:false,code:a.code,reason:a.reason};e.setSelection(a.selection);}let r=t.type==="proposeInsertion"?"insertion":t.type==="proposeDeletion"?"deletion":"replacement",o=t.type==="proposeInsertion"?t.text:t.type==="proposeReplacement"?t.replaceWith:"";if(!e.proposeTextChange(r,o,t.author))return {ok:false,code:"invalidArgs",reason:e.state().lastRejection??`${t.type} was refused`};break}case "replaceMatch":return FE(e,t);case "undo":e.undo();break;case "redo":e.redo();break;case "insertTable":if(!e.insertTable(t.rows,t.cols))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table could not be inserted here"};break;case "insertToc":if(!e.insertToc())return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be inserted"};break;case "editTextFormField":return e.editTextFormField()?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"field options are unavailable"};case "refreshToc":if(!e.refreshToc(t.tocId,t.mode))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be refreshed"};break;case "removeToc":if(!e.removeToc(t.tocId))return {ok:false,code:"unsupported",reason:e.state().lastRejection??"the table of contents could not be removed"};break;case "editHeaderFooter":return a8(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return i8(e,t);case "linkHeaderFooterToPrevious":return s8(e,t);case "unlinkHeaderFooterFromPrevious":return l8(e,t);case "setHeaderFooterOptions":return c8(e,t);case "setWatermark":return OE(e,t.watermark);case "insertBookmark":case "deleteBookmark":case "keepFirstBookmark":case "goToBookmark":return FO(e,t);case "insertPageField":return d8(e,t);case "insertNote":return u8(e,t);case "deleteNote":return f8(e,t);case "convertNote":return p8(e,t);case "convertAllNotes":return m8(e,t);case "setNoteProperties":return g8(e,t);case "insertRow":case "deleteRow":case "insertColumn":case "deleteColumn":case "deleteTable":case "setCellFill":case "setTableCellVerticalAlignment":case "setTableBorders":case "commitTableColumnDividerResize":case "commitTableRightEdgeResize":case "mergeCells":case "splitCell":case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":{if(!ra(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Rr({command:t,part:e.session.part(),layout:e.layout(),storeRevision:e.session.packageRevision(),selection:e.state().selection,cellSelection:e.state().cellSelection,themeColors:e.session.documentThemeColors(),editable:e.session.editable,viewing:e.editingMode()==="view",...Sf(e)});return e.applyTableCommandPlan(r)}case "selectAll":return e.selectAll(),{ok:true,changed:false};case "copy":{let r=e.copyFlavours();return r.reason?Zx(r.reason):(Gx(r.text,r.html,y8(n?.editor)),{ok:true,changed:false})}case "cut":{let r=e.copyFlavours();if(r.reason)return Zx(r.reason);if(Gx(r.text,r.html,y8(n?.editor)),r.chartDrawingNodeId){let o=e.deleteImage(r.chartDrawingNodeId);if(!o.ok)return {ok:false,code:"unsupported",reason:o.detail??o.reason??"the chart was not deleted"}}else e.deleteSelection();break}case "paste":{let r=t.html?Yo(t.html):null,o=r?_c(r.bytes):null;if(o)return Zx(o==="chart"?"chart-content":"unsupported-content");if(!e.pasteRich(t.text,t.html??null))return {ok:true,changed:false};break}case "pasteWithoutFormatting":e.insertPlainText(t.text);break;case "setSelection":{if("range"in t&&Iy(t.range)){let i=v8(e,t.range);return i.ok?(e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):i}let r="anchor"in t&&Zt(t.anchor)?{anchor:t.anchor}:"range"in t&&ei(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=AE(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=v8(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return ac(t)?Yy(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function Zx(e){return {ok:false,code:"unsupported",reason:e==="chart-content"?Hc:e}}function y8(e){return e?Ae(Io(e)):void 0}function b8(e,t){for(let n of e.layout().pages)for(let r of [n.footnotes,n.endnotes])if(r){for(let o of r.notes)for(let a of Ka$2(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function qZ(e,t){let n=e.layout().pages;for(let r=0;r<n.length;r+=1){let o=n[r];for(let a of [o.header,o.footer])if(a){for(let i of Ka$2(a.fragments))if(i.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function KZ(e,t){return e.kind!==t.kind?false:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:e.kind==="notesPart"&&t.kind==="notesPart"?e.noteKind===t.noteKind:true}function v8(e,t){let n=Ot(e.session,t.head.paragraphId,{kind:"body"}),r=Ot(e.session,t.anchor.paragraphId,{kind:"body"});if(!KZ(n,r))return {ok:false,code:"unsupported",reason:"a selection cannot span two stories"};let o=e.activeScope();if(n.kind==="body")return o.kind!=="body"&&(e.exitNote?.(),e.exitHeaderFooter?.()),{ok:true,changed:false};if(n.kind==="headerFooter"){if(o.kind==="headerFooter"&&o.rId===n.rId)return {ok:true,changed:false};e.exitNote?.();let l=qZ(e,t.head.paragraphId);return e.enterHeaderFooter?.({rId:n.rId,...l?{pageIndex:l.pageIndex,sectionIndex:l.sectionIndex}:{}})?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"that header or footer could not be opened"}}let a=b8(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:b8(e,t.anchor.paragraphId))!==a?{ok:false,code:"unsupported",reason:"a selection cannot span two stories"}:o.kind==="note"&&o.id===a?{ok:true,changed:false}:(e.exitHeaderFooter?.(),e.enterNote?.(a)?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"that note could not be opened"}):{ok:false,code:"notFound",reason:"that note is not laid out"}}var UZ=new Set(["resolveAllReviewChanges","setReviewChangesAuthor","proposeInsertion","proposeDeletion","proposeReplacement","replaceMatch","toggleMark","setMarkAttr","setAlignment","setParagraphDirection","clearFormatting","setLineSpacing","setParagraphSpacing","setParagraphStyle","setParagraphFormat"]),jZ=Object.freeze({ok:false,code:"unsupported",reason:"historyGroup must be an open handle from this editor and document; begin a new group after end(), detach, or load"}),Xx=class{constructor(t,n,r){this.owner=t;this.diagnose=n;this.target=r;}owner;diagnose;target;records=new WeakMap;undoEpoch=0;burst;diagnoseWrites(t,n,r=false){if(t.type!=="setMarkAttr"||!n.ok||!n.changed)return;let o=`${r}:${t.mark}:${t.attr}:${this.target()}`,a=Date.now(),i=this.burst,s=i?.key===o&&a-i.time<=250?i.count+1:1;this.burst={key:o,time:a,count:s},s===3&&this.diagnose({kind:r?"possible-fragmented-gesture":"possible-ungrouped-gesture",reason:"Three rapid formatting writes started separate groups at the same selection. For a continuous control, retain one handle with bindHistoryGroup; separate clicks may be intentional."});}begin(){let t=this.owner(),n={token:Symbol("gesture"),owner:t?new WeakRef(t):void 0,closed:false,committed:false,undoEpoch:this.undoEpoch,lastOutcome:null},r=VZ(n,new WeakRef(this));return this.records.set(r,n),r}owns(t){return t!==void 0&&t===this.owner()}validate(t){let n=t?.historyGroup;return n===void 0?null:this.token(n)===void 0?jZ:null}token(t){let n=this.records.get(t);return n&&t.state==="open"?n.token:void 0}gate(t,n){let r=this.validate(n);return r||n?.historyGroup===void 0?r:UZ.has(t.type)?null:{ok:false,code:"unsupported",reason:`${t.type} does not support history grouping`}}note(t){(t.type==="undo"||t.type==="redo")&&this.undoEpoch++;}run(t,n,r,o){let a=r?.historyGroup,i=a&&this.records.get(a);if(!i){let d=Fs(t,void 0,o);return n&&this.diagnoseWrites(n,d),d}let s,l=Rn(i.token,(d,u)=>s={kind:d,reason:u},()=>Fs(t,i.token,o));if(!l.ok)return l;let c=this.settle(i,s);return c.kind==="started"&&n?this.diagnoseWrites(n,l,true):this.burst=void 0,{...l,history:c}}automationFrames(t){let n=this.token(t)===void 0?void 0:this.records.get(t);if(!n)return null;let r=[];return {bind:(o,a)=>{let i,s=Rn(n.token,(l,c)=>i={kind:l,reason:c},()=>Fs(o,n.token,a));return i&&r.push(i),s},finish:()=>{if(r.length===0)return null;this.burst=void 0;let o=r.find((a,i)=>a.kind==="split"||i>0&&a.kind==="started");return this.settle(n,o?{kind:"split",reason:o.reason}:r[0])}}}settle(t,n){let r=n?.kind==="split"||n?.kind==="started"&&t.committed,o=n===void 0?{kind:"none",reason:"no-history"}:r?{kind:"split",reason:n.reason??(t.undoEpoch!==this.undoEpoch?"undo-redo":"history-boundary")}:{kind:n.kind};return n&&(t.committed=true,t.undoEpoch=this.undoEpoch),t.lastOutcome=o,o.kind==="split"&&this.diagnose({kind:"split",reason:o.reason??"history-boundary"}),o}};function VZ(e,t){return Object.freeze({get state(){return !e.closed&&t.deref()?.owns(e.owner?.deref())?"open":"closed"},get lastOutcome(){return e.lastOutcome},end(){e.closed=true,e.owner=void 0;}})}function S8(e,t,n){let r={generation:-1,token:{}};return new Xx(()=>{let{mounted:o,generation:a}=e();return o?(r.generation!==a&&(r={generation:a,token:{}}),r.token):null},t,n)}var w8={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none",collaborationStatus:"inactive",pageCount:0};function k8(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:vO(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`,collaborationStatus:e.collaborationStatus,pageCount:e.pageCount}}function I8(){let e={...w8};return {moved(t,n){let r=k8(t,n),o=Cf(r.selection,e.selection)&&r.pendingFormat===e.pendingFormat&&r.headerFooter===e.headerFooter&&r.drawingIntent===e.drawingIntent&&r.formatPainter===e.formatPainter&&r.collaborationStatus===e.collaborationStatus,a=r.pageCount!==e.pageCount;return e=r,o?a?"pages":"nothing":"state"},adopt(t){e=k8(t.state(),t);},reset(){e={...w8};}}}var R8=512*1024;function GZ(e,t){let n=e.byteLength;if(n<22)return false;let r=new DataView(e.buffer,e.byteOffset,n),o=Math.max(0,n-(64*1024+22)),a=-1;for(let c=n-22;c>=o;c-=1)if(r.getUint32(c,true)===101010256){a=c;break}if(a<0)return false;let i=r.getUint16(a+10,true),s=r.getUint32(a+16,true),l=0;for(let c=0;c<i;c+=1){if(s+46>n||r.getUint32(s,true)!==33639248)return false;if(l+=r.getUint32(s+24,true),l>=t)return true;s+=46+r.getUint16(s+28,true)+r.getUint16(s+30,true)+r.getUint16(s+32,true);}return false}var zZ=2e3,ZZ=40;function P8(e){let t=null,n=()=>Ae(e.node?.()??null),r=()=>{if(!t)return null;let{bytes:o}=t;return t.cancel(),t=null,o};return {shouldYield:o=>typeof n().requestAnimationFrame=="function"&&typeof n().cancelAnimationFrame=="function"&&(o.byteLength>=R8||GZ(o,R8)),schedule(o){let a=rt(()=>e.node?.()??null),i=null,s=null,l=e.prepare?()=>e.prepare(o):null,c=false,d=false,u=y=>{try{return y()}catch(h){throw t===g&&(t=null,e.scheduled()),h}},f=()=>{if(c)return;if(l){let h=l;l=null;let b;try{b=h();}catch{}if(typeof b=="function"){l=b,Mc(f,n());return}if(!b){i=a.setTimeout(f,0);return}let v=true,S=()=>{v&&(v=false,i!==null&&a.clearTimeout(i),i=a.setTimeout(f,0));};i=a.setTimeout(S,zZ),b.then(S,S);return}d=true,u(()=>e.mount(o));let y=()=>{if(c||t!==g)return;let h=!e.continueOpen||u(()=>e.continueOpen(ZZ));if(!(c||t!==g)){if(!h){Mc(y,n());return}t=null,e.continueOpen&&e.scheduled();}};e.continueOpen?Mc(y,n()):t===g&&(t=null,e.scheduled());},p=a.requestAnimationFrame(()=>{s!==null&&a.clearTimeout(s),s=null,i=a.setTimeout(f,0);});s=a.setTimeout(()=>{a.cancelAnimationFrame(p),f();},250);let g={bytes:o,mounted:()=>d,cancel:()=>{c=true,a.cancelAnimationFrame(p),i!==null&&a.clearTimeout(i),s!==null&&a.clearTimeout(s);}};t=g,e.scheduled();},cancel:r,flush(){let o=t;if(!o)return;let a=o.mounted();r();try{if(a||e.mount(o.bytes),e.continueOpen)for(;!e.continueOpen(Number.POSITIVE_INFINITY););}catch(i){throw e.scheduled(),i}a&&e.scheduled();},isScheduled:()=>t!==null}}var Qx=40,Yx=16,C8=32,Jx=new WeakMap;function e0(e,t){let n=Uk(t.contentLockPolicy);return n?{...e,contentLockPolicy:n}:e}function XZ(e,t,n){let r=qg(e),o=()=>{let a=performance.now()+Qx;for(;;){let i=r.next();if(i.done){let s=B$1(i.value,t);return Jx.set(e,s),n(s)}if(performance.now()>=a)return o}};return o}function T8(e){let t=Jx.get(e);return t===void 0?{}:(Jx.delete(e),{openedSession:t,progressiveOpen:true})}function E8(e,t,n){return r=>XZ(r,e(),o=>{let a=o.ok?t(r,o.session):null;return o.ok&&a?YZ(o.session,a,n):void 0})}function O8(e){let t=null;return {set(n){t=n;let r=e();r&&nv(r,n);},adopt:n=>nv(n,t)}}function YZ(e,t,n){let r=e.part().root.children.find(g=>g.kind==="body"),o=r?.kind==="body"?r.children:[],a=[];for(let g of o.slice(0,Rc)){if(g.kind==="table")for(let y of g.children)a.push(y);a.push(g);}let i=[];for(let g=0;g<o.length;){let y=o[g];if(y.kind==="table"){for(let v=0;v<y.children.length;v+=C8){let S=v;i.push(()=>{U2(e,y,S,S+C8);});}i.push(()=>Dx(e,[y])),g+=1;continue}let h=g;for(;h<o.length&&h-g<Yx&&o[h].kind!=="table";)h+=1;let b=o.slice(g,h);i.push(()=>Dx(e,b)),g=h;}let s=0,l=0,c=false,d,u=ab$2(e.part().root),f=[()=>{let g=performance.now()+Qx;return u(()=>performance.now()>=g)},()=>(e.reviewItems(),true)],p=()=>{if(!t())return;let g=performance.now()+Qx;if(!c){for(;s<i.length&&performance.now()<g;)i[s++]();return s<i.length||(c=true,d=n()),p}if(l<a.length){for(;l<a.length&&performance.now()<g;)uf$1(a.slice(l,l+Yx)),l+=Yx;return p}let y=f[0];return y?(y()&&f.shift(),p):d};return p}function M8(e){return {...e.tableInteractionLabel?{tableInteractionLabel:e.tableInteractionLabel}:{},...e.imageDecodePort?{imageDecodePort:e.imageDecodePort}:{},...e.lockedControlNavigation==="atomic"?{lockedControlNavigation:"atomic"}:{}}}function A8(e){let t=[];return Object.assign(r=>{for(let o of [...e.customNodeDiagnostics,...t])try{o(r);}catch{}},{observe(r){t.push(r);}})}function L8(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function F8(e){return e.kind==="comment"}function D8(e){let{surface:t}=e,n=t?.retainedSelection()??t?.state().selection??null;if(!n)return null;let{anchor:r,head:o}=n;if(r.paragraphId===o.paragraphId&&r.offset===o.offset||!t?.publishedLayout())return null;let a=e.bodyOrder(),i=a.get(r.paragraphId)??-1,s=a.get(o.paragraphId)??-1;if(i===-1||s===-1){let c=e.openStoryOrder();i=c.get(r.paragraphId)??-1,s=c.get(o.paragraphId)??-1;}if(i===-1||s===-1){let c=JO(t);i=c.get(r.paragraphId)??-1,s=c.get(o.paragraphId)??-1;}return i===-1||s===-1?null:i<s||i===s&&r.offset<=o.offset?{from:r,to:o}:{from:o,to:r}}function JZ(e){let t=new Map;for(let n of e){let r=n.item;if(!F8(r))continue;let o=t.get(r.id);if(o===void 0){t.set(r.id,r);continue}if(o.comment!==r.comment)return "ambiguous"}return t}function e7(e,t){let n=e.filter(a=>a.key===t);if(n.length===0)return {ok:false,code:"notFound",reason:"no review item with that key"};let r=n.map(a=>a.item).filter(F8);if(r.length===0)return {ok:false,code:"kindMismatch",reason:"the review item is not a comment"};let o=r[0];for(let a of r)if(a.comment!==o.comment)return {ok:false,code:"ambiguous",reason:"duplicate comment records share that key"};return o}function N8(e,t,n){if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:e.proReviewReason};if(e.editingMode==="viewing"){let u=e.surface?.commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"comment-resolve"),f="the document is open for viewing";return pr(u??f,f,"locked")}let r=e.placements({pairReplacements:false}),o=e7(r,t);if(!("kind"in o))return o;if(!e.surface)return {ok:false,code:"notFound",reason:"no review item with that key"};let a=JZ(r);if(a==="ambiguous")return {ok:false,code:"ambiguous",reason:"duplicate comment records share an id"};let i=o,s=new Set;for(;i.parentId!==void 0&&!s.has(i.id);){s.add(i.id);let u=a.get(i.parentId);if(!u)break;i=u;}let l=false,c=false,d=e.surface.commitReviewOps(u=>{let f=e.surface.session.packageRevision();return l=e.surface.session.setCommentResolved(i.id,n,{historyToken:u}),c=l&&e.surface.session.packageRevision()!==f,{committed:c}},"comment-resolve");return l?(c&&e.bump(),{ok:true,changed:c}):pr(d,"the comment could not be resolved","notFound")}function H8(e,t,n){return e.kind==="comment"&&e.resolved?{ok:false,code:"unsupported",reason:"a resolved comment takes no replies"}:n.length===0||t.trim().length===0?{ok:false,code:"invalidArgs",reason:"a reply needs both an author and text"}:e.kind==="custom"?{ok:false,code:"unsupported",reason:"a custom node card takes no replies"}:null}var t7=Object.freeze({ok:false,code:"invalidArgs",reason:"pass the author as a string and options last, or options alone in place of the author"});function _8(e,t){if(e==null||typeof e=="string")return [e??void 0,t];let n=typeof e=="object"?Object.getPrototypeOf(e):void 0;return !(n===null||n!==void 0&&Object.getPrototypeOf(n)===null)||Array.isArray(e)||t!==void 0?t7:[void 0,e]}function B8(e){let t=(a,i)=>{let s=e.historyGroups.validate(a);if(s)return s;let l=e.surface();return l?e.historyGroups.run(l,void 0,a,i):i()},n=(a,i)=>{if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:Wt};let s=e.surface();s?.flushPendingInput();let l=e.commentTargetRange();if(!l||!s)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let c=(i??e.author()??"").trim();if(c.length===0||a.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let d=null,u=s.commitReviewOps(f=>(d=s.session.replyToComment(null,{paragraphId:l.from.paragraphId,start:l.from.offset,end:l.to.offset,...l.to.paragraphId===l.from.paragraphId?{}:{endParagraphId:l.to.paragraphId}},a,c,j$1(),e.storyScopeOfParagraph(l.from.paragraphId),void 0,{historyToken:f}),{committed:d!==null}),"comment-add");return d===null?pr(u,"the comment could not be committed"):{ok:true,changed:true}},r=a=>{if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:Wt};let i=e.surface(),s=Qr(e.placements,a)?.item;if(!s||!i)return {ok:false,code:"notFound",reason:"no review item with that key"};if(s.kind==="revision")return e.resolveReviewItem(a,"reject");if(s.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};let l=false,c=i.commitReviewOps(d=>{let u=e.noteHomeOf(s),f=u===null?null:Ic$1(u);return l=i.session.deleteComment(s.id,e.storyScopeOfReviewItem(s),f?.noteId,{historyToken:d}),{committed:l}},"comment-delete");return l?(e.bump(),{ok:true,changed:true}):pr(c,"the comment could not be deleted")},o=(a,i,s)=>{if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:Wt};let l=e.surface();l?.flushPendingInput();let c=Qr(e.placements,a)?.item,d=ws(c)?.insertion??c;if(!d||!l)return {ok:false,code:"notFound",reason:"no review item with that key"};let u=wl(d);if(!u)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let f=(s??e.author()??"").trim(),p=H8(d,i,f);if(p)return p;let g=d.kind==="comment"?d.id:null,y=null,h=l.commitReviewOps(b=>(y=l.session.replyToComment(g,{paragraphId:u.start.paragraphId,start:u.start.offset,end:u.end.offset},i,f,j$1(),e.storyScopeOfReviewItem(d),void 0,{historyToken:b}),{committed:y!==null}),"comment-reply");return y===null?pr(h,"the reply could not be committed"):{ok:true,changed:true}};return {addComment:(a,i,s)=>{let l=_8(i,s);if(!Array.isArray(l))return l;let[c,d]=l;return t(d,()=>n(a,c))},acceptReviewItem:(a,i)=>t(i,()=>e.resolveReviewItem(a,"accept")),rejectReviewItem:(a,i)=>t(i,()=>e.resolveReviewItem(a,"reject")),setCommentResolved:(a,i,s)=>t(s,()=>N8({reviewEnabled:e.reviewEnabled,editingMode:e.editingMode(),placements:e.placements,surface:e.surface(),proReviewReason:Wt,bump:e.bump},a,i)),deleteReviewItem:(a,i)=>t(i,()=>r(a)),replyToReviewItem:(a,i,s,l)=>{let c=_8(s,l);if(!Array.isArray(c))return c;let[d,u]=c;return t(u,()=>o(a,i,d))}}}var $8=new WeakMap;function W8(e,t){t&&$8.set(e,t);}function q8(e){return $8.get(e)}var t0=new WeakMap;function K8(e,t){t0.set(e,t);}function U8(e,t){return t0.get(e)?.automationFrames(t)??null}function j8(e,t){return t0.get(e)?.token(t)!==void 0}function V8(e,t,n){K8(e,t),W8(e,n);}var n7=1e4;function G8(e,t){return t?[e,l$3(t)]:[e]}function z8(e,t){if(!t)return false;try{let n=new Set((t.sources??[]).map(o=>h$3(o.request))),r=new Set((t.substitutions??[]).map(o=>`${h$3(o.from)}>${h$3(o.to)}`));return (e.sources??[]).every(o=>n.has(h$3(o.request)))&&(e.substitutions??[]).every(o=>r.has(`${h$3(o.from)}>${h$3(o.to)}`))}catch{return false}}function Z8(e){let t=new Map,n=(r,o=false)=>{let a=t.get(r);a!==void 0&&(globalThis.clearTimeout(a),t.delete(r),o||e.changed());};return {pending:()=>t.size>0,clear:()=>{for(let r of t.values())globalThis.clearTimeout(r);t.clear();},settle:r=>{r&&n(r.token,true);},track(r,o,a,i){let s={};t.set(s,globalThis.setTimeout(()=>n(s),e.waitMs??n7)),r.then(l=>{if(!i())return n(s);let c;try{if(typeof l!="object"||l===null)return n(s);for(let d of k$2(l))e.report(d);if(!j$3(l))return n(s);c=i$2(o,l);}catch(d){return e.report(d),n(s)}e.deliver(a,{full:c,token:s});},()=>n(s));}}}var r7=Object.freeze(["Arial","Calibri","Cambria","Consolas","Courier New","Garamond","Georgia","Helvetica","Open Sans","Roboto","Times New Roman","Verdana"]),o7=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function X8(e,t,n){let r=new Map,o=l=>{if(l===void 0||!o7.test(l))return;let c=l.toLowerCase();r.has(c)||r.set(c,l);};o(g$2(e));let a=e?.substitutions??[],i=new Set(a.map(l=>l.to.family.toLowerCase()));for(let l of a)o(l.from.family);for(let l of e?.sources??[])i.has(l.request.family.toLowerCase())||o(l.request.family);for(let l of a$4([e?.supportedFamilies]))o(l);for(let l of r7)(r.has(l.toLowerCase())||!n||n(l))&&o(l);for(let l of t)o(l);let s=[...r.values()];return s.sort((l,c)=>l<c?-1:l>c?1:0),s}var Y8=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),Q8=e=>new a(e.reason,e.reason==="overLimit"?"an embedded font exceeds the font byte budget":"an embedded font part declares an invalid family name",{request:e.request});function J8(e,t){return J$2(e,t)}function n0(e,t,n){return K$2(e,t,n)}var e6=new WeakMap;function a7(e){let t=e.packageRevision(),n=e6.get(e);if(n?.revision===t)return n.faces;let r=e.symbolFontFamilies().length>0?z(e.storyParts().map(o=>o.root)):[];return e6.set(e,{revision:t,faces:r}),r}function t6(e){let t=e.renderedFontFamilies(),n=a7(e);if(n.length===0)return t;let r=new Set(t.map(a=>a.toLowerCase())),o=n.filter(a=>!r.has(a.toLowerCase()));return o.length===0?t:[...t,...o]}var n6=a$1;function Sn(e,t){if(!e)throw new Error(t)}function r6(e){let t=0;for(let n=0;n<e.length;n+=4){let r=(e[n]||0)*16777216+(e[n+1]||0)*65536+(e[n+2]||0)*256+(e[n+3]||0)>>>0;t=t+r>>>0;}return t}function o6(e,t=0){Sn(e instanceof Uint8Array&&e.length>=12&&e.length<=n6,"Unsupported font byte length"),Sn(Number.isSafeInteger(t)&&t>=0,"Invalid face index");let n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=(x,k)=>{Sn(Number.isSafeInteger(x)&&Number.isSafeInteger(k)&&x>=0&&k>=0&&x+k<=e.length,"Font range exceeds source");},o=x=>String.fromCharCode(...e.subarray(x,x+4));if(o(0)!=="ttcf")return Sn(t===0,"Face index requires a collection"),Sn([65536,1330926671,1953658213].includes(n.getUint32(0)),"Unsupported SFNT version"),e.slice();let a=n.getUint32(4);Sn(a===65536||a===131072,"Unsupported TTC version");let i=n.getUint32(8);Sn(i>0&&t<i,"Collection face absent"),r(12,i*4+(a===131072?12:0));let s=12+i*4+(a===131072?12:0),l=n.getUint32(12+t*4);r(l,12);let c=n.getUint32(l);Sn([65536,1330926671,1953658213,1954115633].includes(c),"Unsupported face version");let d=n.getUint16(l+4);Sn(d>0,"Missing face tables"),r(l,12+d*16),Sn(l>=s,"Selected directory overlaps collection header");let u=[[0,s],[l,l+12+d*16]],f=[],p=new Set;for(let x=0;x<d;x++){let k=l+12+x*16,T=o(k),R=n.getUint32(k+8),C=n.getUint32(k+12);Sn(/^[\x20-\x7e]{4}$/.test(T)&&!p.has(T),"Invalid or duplicate table tag"),p.add(T),r(R,C);for(let[A,E]of u)Sn(C===0||R>=E||R+C<=A,"Table overlaps collection directory");f.push({name:T,offset:R,length:C,destination:0});}let g=f.filter(x=>x.length>0).sort((x,k)=>x.offset-k.offset);for(let x=1;x<g.length;x++)Sn(g[x].offset>=g[x-1].offset+g[x-1].length,"Selected face tables overlap");let y=f.find(x=>x.name==="head");Sn(y&&y.length>=54,"Missing or truncated head table"),f.sort((x,k)=>x.name<k.name?-1:x.name>k.name?1:0);let h=12+d*16;for(let x of f)x.destination=h,h+=x.length+3&-4,Sn(h<=n6,"Standalone face exceeds byte ceiling");let b=new Uint8Array(h),v=new DataView(b.buffer);v.setUint32(0,c),v.setUint16(4,d);let S=2**Math.floor(Math.log2(d));v.setUint16(6,S*16),v.setUint16(8,Math.log2(S)),v.setUint16(10,d*16-S*16);for(let[x,k]of f.entries()){let T=12+x*16;for(let R=0;R<4;R++)b[T+R]=k.name.charCodeAt(R);b.set(e.subarray(k.offset,k.offset+k.length),k.destination),k.name==="head"&&v.setUint32(k.destination+8,0),v.setUint32(T+4,r6(b.subarray(k.destination,k.destination+k.length))),v.setUint32(T+8,k.destination),v.setUint32(T+12,k.length);}return v.setUint32(y.destination+8,2981146554-r6(b)>>>0),b}var a6=Object.freeze({installed:0,alias:()=>{},showIn(){},dispose(){}});function i7(e,t){return e>=600&&!mc$1(t,0)?"599":String(e)}function s7(e){let t=0;for(let n of e)for(let r=0;r<n.length;r+=1)t=t*31+n.charCodeAt(r)>>>0;return `docx-embedded-${t.toString(36)}`}var gm=e=>e.trim().toLowerCase();function hm(e){let t=e??(typeof globalThis.document<"u"?globalThis.document:void 0),n=t?.fonts,r=t?.defaultView?.FontFace;return !n||typeof r!="function"?{}:{fontSet:n,createFontFace:(o,a,i)=>new r(o,a.slice().buffer,i)}}async function i6(e,t=hm(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return a6;let a=new Map;for(let f of e){let p=gm(f.request.family),g=a.get(p);g?g.push(f):a.set(p,[f]);}let i=new Map,s=[],l$1=[],c=f=>{let p=f.bytes,g=p.length>=4&&p[0]===116&&p[1]===116&&p[2]===99&&p[3]===102;if(g&&f.faceIndex===0&&!l(p,0).valid)throw new Error("Invalid collection face");if(!g&&f.faceIndex!==0)throw new Error("Font face index requires a collection");return g&&f.faceIndex!==0?o6(p,f.faceIndex):p};if(await Promise.all([...a].map(async([f,p])=>{let g=s7(p.map(h=>`${h.hash}:face:${h.faceIndex}`)),y=false;await Promise.all(p.map(async h=>{try{let b=c(h),v={weight:i7(h.request.weight,b),style:h.request.style},S=o(g,b,v);await S.load(),r.add(S),s.push({set:r,face:S}),l$1.push({alias:g,source:h,descriptors:v}),y=!0;}catch{}})),y&&i.set(f,g);})),s.length===0)return a6;for(let f of n){let p=gm(f.from.family);if(i.has(p))continue;let g=i.get(gm(f.to.family));g!==void 0&&i.set(p,g);}let d=false,u=new WeakSet([r]);return {installed:s.length,alias:f=>d?void 0:i.get(gm(f)),showIn(f){if(d)return;let p=hm(f);if(!(!p.fontSet||!p.createFontFace||u.has(p.fontSet))){u.add(p.fontSet);for(let{alias:g,source:y,descriptors:h}of l$1)try{let b=p.createFontFace(g,c(y),h);p.fontSet.add(b),s.push({set:p.fontSet,face:b}),b.load().catch(()=>{});}catch{}}},dispose(){if(!d){d=true;for(let{set:f,face:p}of s)try{f.delete(p);}catch{}}}}}function s6(e,t){let n=[];for(let r of e){let o=t.resolve(r.request);if(o instanceof d$1||o.id!==r.id)continue;let{id:a,hash:i,faceIndex:s}=o;n.push({request:r.request,id:a,get bytes(){return o.bytes},hash:i,faceIndex:s});}return n}var o0=44,Yc=.1,Qc=5;var $s={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},l7={type:"fit",fit:"pageWidth"},ym={type:"fixed"};function bm(e){return e==="auto"?$s:!e||typeof e!="object"?null:e.type==="fixed"?ym:e.type==="fit"&&e.fit==="pageWidth"?vm(e,$s)?$s:e:null}function vm(e,t){return e===t?true:e.type!==t.type?false:e.type!=="fit"||t.type!=="fit"?true:e.fit===t.fit&&Object.is(e.minZoom,t.minZoom)&&Object.is(e.maxZoom,t.maxZoom)}function a0(e,t,n="float"){return e?.type!=="fit"?t:n==="shrinkPage"?e.minZoom!==void 0&&Number.isFinite(e.minZoom)?r0(e.minZoom):.1:e.maxZoom!==void 0&&e.maxZoom<5?e.maxZoom:null}function Ws(e){return e.type==="fit"}function l6({availableWidthPx:e,pageWidthPx:t,gutterPx:n=24,minZoom:r=.1,maxZoom:o=5}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return null;let a=Number.isFinite(n)&&n>0?n:0,i=Math.max(e-2*a,e*.5),s=Number.isFinite(r)?r0(r):.1,l=Number.isFinite(o)?r0(o):5,c=Math.floor(i/t*100)/100;return Math.min(Math.max(c,s),Math.max(l,s))}function r0(e){return Math.min(Math.max(e,.1),5)}var c7=88;function d7(e,t=false){let n=_t(e);if(!n)return null;let r=n.clientWidth;if(!Number.isFinite(r)||r<=0)return null;let o=n.ownerDocument.defaultView?.getComputedStyle(n);if(t&&n.hasAttribute("data-review-pane")){let s=Number.parseFloat(o?.getPropertyValue("--docx-review-strip")??""),l=Number.isFinite(s)?s:c7,c=l/2,d=Number.parseFloat(o?.getPropertyValue("--docx-nav-shift")??""),u=Number.parseFloat(o?.getPropertyValue("--docx-review-gutter-start")??""),f=(Number.isFinite(d)?d:0)+(Number.isFinite(u)?u:c)-c;return Math.max(r-l-Math.max(f,0),0)}if(!o)return r;let a=Number.parseFloat(o.paddingLeft)||0,i=Number.parseFloat(o.paddingRight)||0;return Math.max(r-a-i,0)}function c6(e){let t=null,n=null,r=rt(()=>n),o=null,a=null;function i(){o!==null&&(r.cancelAnimationFrame(o),o=null);}function s(){let c=e.mode();if(!Ws(c))return;let d=e.container();if(!d)return;let u=e.reviewPaneScrolls?.()===true&&a0(c,e.zoom())!==null,f=d7(d,u);if(f===null)return;let p=e.pageWidthPx();if(p===null)return;a=e.pageWidthTwips();let g=l6({availableWidthPx:f,pageWidthPx:p,...c.minZoom!==void 0?{minZoom:c.minZoom}:{},...c.maxZoom!==void 0?{maxZoom:c.maxZoom}:{}});if(g===null||g===e.zoom())return;let y=_t(d),h=y!==null&&y.scrollLeft===0;e.applyZoom(g),h&&y&&y.scrollLeft!==0&&(y.scrollLeft=0);}function l(){if(!n||typeof Ae(n).requestAnimationFrame!="function"){s();return}r.migrate(),o===null&&(o=r.requestAnimationFrame(()=>{o=null,s();}));}return {refitIfPageResized(){let c=e.pageWidthTwips();c===null||c===a||s();},attach(){this.detach();let c=e.container();if(!c)return;let d=_t(c);if(!d)return;n=d;let u=Ae(d);typeof u.ResizeObserver=="function"&&(t=new u.ResizeObserver(l),t.observe(d)),s();},refit:s,detach(){i(),t?.disconnect(),t=null,n=null,a=null;}}}function u6(e,t){let n=e.zoom!==void 0&&Number.isFinite(e.zoom)&&e.zoom>=.1&&e.zoom<=5?e.zoom:null,r=n??1,o=bm(e.zoomMode??(n!==null?ym:"auto"))??$s;function a(l,c){if(l===r)return c?.(),true;let d=t.surface();return d&&!Qb(d,l*(96/72))?false:(r=l,c?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=ym,s.detach();}let s=c6({container:t.container,mode:()=>o,pageWidthPx:()=>{let l=t.surface()?.layout().pages[0]?.box;return l?l.width*(96/72):null},pageWidthTwips:()=>t.surface()?.sectionProperties().pageSize.widthTwips??null,zoom:()=>r,applyZoom:l=>{a(l);},reviewPaneScrolls:()=>t.reviewPaneScrolls?.()===true});return {zoom:()=>r,mode:()=>o,scale:()=>r*(96/72),attach:()=>{Ws(o)&&s.attach();},detach:()=>s.detach(),refit:()=>s.refit(),refitIfPageResized:()=>s.refitIfPageResized(),setZoom(l){if(!Number.isFinite(l)||l<.1||l>5)return {ok:false,code:"invalidArgs",reason:`zoom must be between ${.1} and ${5}, got ${l}`};let c=Ws(o);return l===r?c?(i(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(l,c?i:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${l}`}},setZoomMode(l){let c=bm(l);return c?vm(c,o)?{ok:true,changed:false}:(o=c,Ws(c)?s.attach():s.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(l)}`}}}}function d6(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function f6(e,t){return {getZoom:()=>e.zoom(),setZoom:n=>e.setZoom(n),getZoomMode:()=>e.mode(),setZoomMode:n=>e.setZoomMode(n),getRenderScale:()=>e.scale(),getPageGeometry:()=>{let n=t();return n?n.layout().pages.map(r=>({index:r.index,box:d6(r.box),contentBox:d6(r.contentBox)})):[]}}}var p6=new Map;function m6(e){let t=e,n=null,r=null;return {current:()=>t,set:o=>{t=o;},authorsFor:o=>{if(n&&n.slots===o&&n.colors===t)return n.value;let a=g$1(o,t);return n={slots:o,colors:t,value:a},a},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:f$1(t)}),r.value.get(o))}}function g6(e){let t=Hk(e),n=new Intl.Locale(t).baseName;for(;n&&!Object.hasOwn(locales,n);){let s=n.lastIndexOf("-");n=s<0?"":n.slice(0,s);}let r=new Intl.Locale(t).maximize(),o=n?void 0:Object.keys(locales).find(s=>{let l=new Intl.Locale(s).maximize();return l.language===r.language&&l.script===r.script}),a=n||o||"en",i=createT(deepMerge(en,a==="en"?void 0:locales[a]),a);return {locale:t,labels:{title:i("toolbar.tableOfContents")}}}function h6(e){let t=e.mode,n$1=e.translate,r=n$1?p(n$1):o$1,o=g6(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:a=>Ey(t,a),setMode(a){return t===a?false:(t=a,true)},translate:()=>n$1,drawingStrings:()=>r,setTranslate(a){if(n$1===a)return null;n$1=a;let i=a?p(a):o$1;return n(r)===n(i)?(r=i,null):(r=i,r)},locale:()=>o.locale,tocLabels:()=>o.labels,setLocale(a){let i=g6(a);return o.locale===i.locale?null:(o=i,o.labels)}}}function y6(e,t){return {setTranslate(n){let r=e.setTranslate(n);t.surface()?.setTranslate(e.translate()),r!==null&&(t.surface()?.setDrawingStrings(r),t.bump(),t.emitSelectionChange());},setLocale(n){let r=e.setLocale(n);r!==null&&(t.surface()?.setLocale(e.locale()),t.surface()?.setTocLabels(r),t.bump(),t.emitSelectionChange());}}}var m7=Object.freeze({kind:"body"}),g7=Object.freeze([]);function h7(e){let t=ZR(e.fontShaping),n,r=null,o$1=null,a$3=null,i$1=-1,s=()=>a$3!==null,l=h6(e),c=yv(e.author),d=e.container??null,u=a$2(e.modules),f=A8(u),p=u.review!==null,g=$_(u.review?.pane,{enabled:p,changed:(L,ae)=>{ln&&L.revisionsIn!==ae.revisionsIn&&!g.shows(M?.session.reviewItems()??[])&&(ln=false),Oe(),Ee(),cn.refit();}}),y=null,h=new WeakMap,b=P8({mount:L=>ki(L),prepare:E8(()=>e0(Nx(u,f),e),(L,ae)=>r===L?null:(a$3=ae,()=>a$3===ae),()=>$e.schedule(true)),scheduled:()=>{Oe(),Ee();},node:()=>d}),v=l.mode()==="view"?"viewing":"editing",S=null,x,k=false,T=RL(g.pairsReplacements,()=>M),R=Rp(),C=m6(e.revisionStyles),A=i(),E=false,P=false,w=null,O=()=>({reviewEnabled:p,hasAuthor:!!c}),_=false,q=null,K=KE({stillMissing:()=>!X&&c===void 0&&lo(null)===Xr,emit:L=>ot(L)}),U=l.openingModeDecision(O());U.mode!==null&&(v=U.mode),U.rejection!==null&&(w=U.rejection),K.report(U.rejection);let M=null,Y=WM(e.unsupportedElementRules,()=>M),ne=null,le=O8(()=>M),se=e8(()=>{Oe(),Ee();}),W=null,H=I8(),G=false,D=()=>{G||(G=true,globalThis.queueMicrotask(()=>{G=false,X||Ee();}));},B,Z=n_({surface:()=>M,destroyed:()=>X,changed:()=>(Oe(),Ee()),emitError:L=>ot(L),capability:L=>t_(L,X,p,Ar)}),X=false,N,j,z=null,Q=()=>{},ue=0;function oe(){z?.dispose(),z=null;}let te=0,me=0,Se=z2(),qe=e.fonts,xe,He=()=>typeof qe=="function"?xe:qe,$e=G2(()=>{let L=a$3??M?.session;if(X||!L)return null;let ae=a$3?void 0:Mt().formatting?.fontFamily;return {generation:Se.generation,dynamic:typeof qe=="function",families:()=>V2(L,ae,g$2(He()))}},async(L,ae)=>{let ie=a$3?{session:a$3}:M;et.settle(ae);try{ie&&await Sm(te,ie,L,ae?.full);}finally{ae&&!X&&(Oe(),Ee());}}),Je=false,et=Z8({deliver:(L,ae)=>$e.deliver(L,ae),changed:()=>(Oe(),Ee()),report:L=>Ks(Ka(L))}),_e=null,bt=()=>M?.session.documentFonts()??[],sn=L=>!!qe&&!He()||Mn(L),Mn=L=>(_e||(_e=H2(d?ua(d.ownerDocument):null)),_e(L)),Be=new Set,st=new Set,St=L=>Be.has(L.toLowerCase())||z?.alias(L)!==void 0,wn=()=>!M||Je||et.pending()?g7:B2(t6(M.session),St,Mn,st),no=0,zn=null,Xe,Ye=null,ht=-1,Ce=0,Si=-1,ln=false,Ke=e.reviewDisplayMode??(p?"all-markup":"proposed");if(!["all-markup","simple-markup","proposed","original"].includes(Ke))throw new TypeError("Invalid reviewDisplayMode");if(e.reviewDisplayMode&&e.reviewDisplayMode!=="proposed"&&!p)throw new TypeError("reviewDisplayMode requires a review module");let va=Pp({fieldResults:e.fieldResults,collaborationModel:u.collaboration??void 0}),Zn=__({surface:()=>M,destroyed:()=>X,editingMode:()=>v,hostViewOnly:()=>l.mode()==="view",publish:()=>{Oe(),Ee();},decision:()=>we(),tracking:Qt,adopt:L=>{w=L.rejection??lo(null),L.mode!==null&&(P=L.mode==="viewing",Yn(L.mode)),Oe(),Ee();}});function Oe(){no+=1;}let pn=CH(Mt,()=>d?.ownerDocument??null),{emitError:ot,emitDocumentChange:ro,emitSelectionChange:Ee}=pn,Ht=qH({modules:u,events:pn,customNodes:f,onOpenCrash:se.crash}),wi=()=>v==="suggesting",An=t2(e.revisionMarkup,{container:()=>d,surface:()=>M,viewing:()=>v==="viewing"||l.mode()==="view",destroyed:()=>X,contribution:()=>u.review,translate:()=>l.translate(),apply:L=>{M?.setRevisionMarkup(L),Oe();},changed:L=>{Ee(),pn.emitRevisionMarkupChange(L);}});function xa(L){An.destroyDialogs(),z?.showIn(L),cn.detach(),cn.attach(),Oe(),Ee();}let mn=()=>{};function Xn(){mn(),An.destroyDialogs(),W?.(),W=null,M?.destroy(),M=null,H.reset(),Ce+=1;}let cn=u6(e,{container:()=>d,surface:()=>M,bump:Oe,emitSelectionChange:Ee,reviewPaneScrolls:()=>g.current().overflow==="scroll"}),Sa=()=>cn.scale(),Ho=T_({surface:()=>M,container:()=>d,flushOpen:()=>b.flush()});function ki(...L){let ae=n?.source!==void 0;try{if(r===L[0]){r=null,oo(L[0],{immediate:!0,continueDeferredRefresh:!0});return}kn(...L),ae&&M&&Tr(M)?o$1=L[0]:n?.mounted(L[0]);}catch(ie){if(Ht.openCrashed(ie),n?.mounted(L[0],ie),!ae)throw ie}}function Ii(){return {unsupportedElementRules:Y.current(),scale:Sa(),...Z.snapshot(),defaultFontFamily:g$2(He()),translate:l.translate(),drawingStrings:l.drawingStrings(),locale:l.locale(),...c?{author:c}:{},...C.current()!==void 0?{revisionStyles:C.current()}:{},reviewAuthorSlots:A,revisionAuthorVisibility:R,revisionMarkup:An.markup.current(),...e0(Nx(u,f),e),pairsReplacements:T.lightsPair,...N?{measurer:N,...j?{producer:j}:{}}:{},...z?{fontAlias:z.alias}:{},...M8(e),...va.mode==="editable"?{fieldResults:va.mode}:{}}}function kn(L,ae,ie){if(ie??=h.get(L),h.delete(L),a$3=null,!d){Xn(),y=L,ie&&h.set(L,ie),se.clear(),Ht.openDeferred(),Oe();return}Ht.openMounting(),Xn();let Me=R.stateKey,Te=zc(d,L,{...Ii(),...Z.surfaceOptions(),initialSelection:ae,initialTextFormInput:ie,editingMode:v==="suggesting"?"suggest":v==="viewing"?"view":"edit",revisionDisplayMode:p?Ke:"proposed",...Ht.surfaceHooks(wi,()=>M),...T8(L),...u.collaboration?{collaborationModel:u.collaboration}:{},onHostMoved:xa,onTrackedChange:()=>{ln||!g.opensOnTrackedChange()||(ln=true,Oe(),Ee());},tocLabels:l.tocLabels(),onChange:Ue=>{if(!M)return;Oe(),Zn.sync(),$e.schedule();let lt=M?.session.packageRevision(),De=lt!==B;if(B=lt,p&&d&&M&&!De){let ct=M;Z_(ct,Ae(d),()=>{M===ct&&ct.session.reviewItems().length>0&&qt(ct.publishedLayout());});}let Ge=p&&Ke!==M.revisionDisplayMode();Ge&&(Ke=M.revisionDisplayMode());let tt=Me!==R.stateKey||Ge;Me=R.stateKey;let je=H.moved(Ue,M);!tt&&je==="nothing"||(!tt&&je==="pages"?D():Ee());}});if(!Te.ok){se.reject(Te.reason,Te.limit,Te.detail),Oe(),ot(an(Te.reason,`failed to open document: ${Te.reason}`)),Ht.openRejected(Te.reason,Te.limit,Te.detail);return}se.clear(),M=Te.surface,z?.showIn(d.ownerDocument),i$1=te,Ho.attach(M,n?.source!==void 0),Zn.prime(),ln=p&&g.opensOnLoad(M.session.reviewItems()),H.adopt(M),q!==null?Ti(q,false):id(),L8(M,u);let Le=M;Tr(Le)?a_(Le,i_({current:()=>M,view:()=>Ae(d),slice:Ue=>Ht.continueOpen(Ue),settled:()=>Ht.openSettled(Le)},{take:()=>[o$1,o$1=null][0],crashed:Ue=>Ht.openCrashed(Ue),mounted:(Ue,lt)=>n?.mounted(Ue,lt)})):Ht.openSettled(Le),Ce+=1,M.setEditable(v!=="viewing"),ne!==null&&M.setRemoteCaretLabelHost(ne),le.adopt(M),S!==null&&M.setReviewActivationExclusions(S,{formattingKinds:x}),W=r_(Te.surface,{refitIfPageResized:()=>cn.refitIfPageResized(),bump:Oe,emit:ro}),n?.contentMounted(L),cn.attach(),Oe(),ro({revision:M.session.packageRevision(),source:n?.source??"load"}),Ee(),$e.schedule(true);}function oo(L,ae={}){let ie=ae.immediate??false;if(ae.continueDeferredRefresh||(me+=1),ie||(b.cancel(),o$1=null),se.clear(),a$3=null,r=null,n?.source&&!ie&&d&&b.shouldYield(L)){r=L,b.schedule(L);return}h=new WeakMap,Ht.openStarted(L),ln=false,te+=1;let Me=Se.advance();try{A=i(),R.showAll(),Ri(),et.clear(),d&&!n?.source&&GF(d),!ie&&d&&b.shouldYield(L)?(Xn(),b.schedule(L)):ki(L);}finally{Me.cancelPrevious();}}function Ri(){N=void 0,j=void 0,xe=void 0,Be=new Set,st=new Set,oe(),Q(),Q=()=>{},Je=false;}function qs(){if(Ri(),M){let L=Lx(d,Sa(),M.session),ae=`${L.producer}+fonts:${++ue}`,ie=g$2(He()),Me={measurer:L.measurer,producer:ae,defaultFontFamily:ie};tv(M,{...Me,fontAlias:void 0},false);}Oe(),Ee();}function Ks(L,ae=te,ie=Se.generation){KH(L,{config:e,events:pn,diagnostics:Ht},()=>!X&&ae===te&&ie===Se.generation);}async function Sm(L,ae,ie,Me){let Te=Se.capture(),Le=()=>!X&&L===te&&Te.current(),Ue=Ge=>Ks(Ge,L,Te.generation),lt=qe,De=ae.session.embeddedFonts();if(!(!lt&&De.length===0)&&!(Me&&z8(Me,xe))){!Me&&!xe&&c$3().catch(()=>{}),Je=true,Oe();try{let{plan:Ge,request:tt}=F$2(ae.session,ie,He()),je={...tt,signal:Te.signal},at=!!d&&ua(d.ownerDocument)!==null?I$1(Ge.fallbacks,Mn):Ge.fallbacks,Rn=({cause:Ct})=>Ue(Ka(Ct)),Lr=Me?await s$1(G8(Me,xe),je,{onOriginFailure:Rn}):typeof lt!="function"?lt:xe?await s$1([xe,o(Ct=>lt(Ct))],je,{onOriginFailure:Rn}):await lt(je),{now:gn,later:uo}=Lr?h$2(Lr):{now:Lr},Qn=typeof lt=="function"||Me?b$4(gn):gn;if(!Le()){L===te&&Te.current()&&(Je=!1);return}if(xe=gn,uo&&et.track(uo,gn,Te.generation,Le),De.length===0&&(!Qn||gn?.supportedFamilies?.length&&!b$4(gn))){Je=!1,Oe(),Ee();return}let Jn=(Qn&&"maxFontBytes"in Qn?Qn.maxFontBytes:void 0)??a$1,fo=J8(Qn?.sources??[],Jn),er=fo.sources;for(let Ct of fo.dropped)Ue(Y8(Ct));let Bt=n0(De,er,Jn),ld=!1,Gs=()=>{if(!ld){ld=!0;for(let Ct of Bt.dropped)Ue(Q8(Ct));}},Ut=G$3(f$5({epoch:L,...Qn,sources:er},Bt),Ge,at);if(Ut.sources.length===0){Gs(),Je=!1,Oe(),Qn&&Ue(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let hn=await Kl(Ut,void 0,t),dt=()=>Le()?!1:(t$1(hn),L===te&&Te.current()&&(Je=!1),!0);if(dt())return;let ka=Ct=>{Gs(),Ct&&t$1(Ct),Je=!1,Oe();},zs=(Ct,hr)=>{let Dr=new Set;for(let _o of hr.sources??[]){let Bo=Ct.fonts.resolve(_o.request);Bo instanceof d$1&&(Ue(Ka(Bo)),Dr.add(h$3(_o.request)));}return Dr},Ia=zs(hn,Ut);try{if(Ia.size>0){let Ct=er.filter(Nr=>!Ia.has(h$3(Nr.request))),hr=Ct.length!==er.length;hr&&(Bt=n0(De,Ct,Jn));let Dr=Bt.sources.filter(Nr=>hr||!Ia.has(h$3(Nr.request))),_o=hn;if(Ut=G$3(f$5({epoch:L,...Qn,sources:Ct},{sources:Dr}),Ge,at),Ut.sources.length===0)return ka(_o);if(hn=await Kl(Ut,void 0,t),t$1(_o),dt())return;let Bo=zs(hn,Ut);if(Bo.size>0){let Nr=Ct.filter(Zs=>!Bo.has(h$3(Zs.request))),dd=Bt.sources.filter(Zs=>!Bo.has(h$3(Zs.request))),jt=hn;if(Ut=G$3(f$5({epoch:L,...Qn,sources:Nr},{sources:dd}),Ge,at),Ut.sources.length===0)return ka(jt);if(hn=await Kl(Ut,void 0,t),t$1(jt),dt())return}}}finally{Gs();}let cd=s6(Ut.sources,hn.fonts),Fr=await i6(cd,hm(d?.ownerDocument),Ut.substitutions??[]);if(!Le()){Fr.dispose(),dt();return}let Oi={embeddedFaces:z,coveredFontFamilies:Be,documentSubstitutedFamilies:st,shapedMeasurer:N,shapedProducer:j,disposeShapedFonts:Q};try{z=Fr,d&&Fr.showIn(d.ownerDocument),Be=$2(cd,Ut.substitutions??[]),st=D$3(Ut,Ge,hn.fonts,Qn?.substitutions);let Ct=Lx(d,Sa(),ae.session,z?.alias),hr=D2(hn,Ut,Ct,Sa(),++ue,Dr=>Le()&&Ue(Dr));if(N=hr.measurer,j=hr.producer,Je=!1,M&&i$1===L&&tv(M,{measurer:N,producer:j,fontAlias:z?.alias,defaultFontFamily:g$2(He())}),!Le()){Fr.dispose(),t$1(hn);return}}catch(Ct){throw Le()&&({embeddedFaces:z,coveredFontFamilies:Be,documentSubstitutedFamilies:st,shapedMeasurer:N,shapedProducer:j,disposeShapedFonts:Q}=Oi),Fr.dispose(),t$1(hn),Ct}Q=()=>t$1(hn),Oi.disposeShapedFonts(),Oi.embeddedFaces?.dispose(),Oe(),Ee();}catch(Ge){if(!Le())return;Je=false,Oe(),Ue(Ka(Ge));}}}let td=xy(),mr=y2();function ao(){let L=M?.state()??null;return {scope:M?.activeScope?.()??m7,isLoading:se.parseError===null&&M===null&&y===null&&!b.isScheduled(),isOpening:b.isScheduled()&&!n?.source,parseError:se.parseError,openFailure:se.failure,editable:M!==null&&M.session.editable&&l.mode()!=="view"&&v!=="viewing"&&!(d&&lr(d)),zoom:cn.zoom(),zoomMode:cn.mode(),selection:Ff(M),selectionCollapsed:L===null||L.selection.anchor.paragraphId===L.selection.head.paragraphId&&L.selection.anchor.offset===L.selection.head.offset,formatting:DO(M),table:Nf(M),tocContext:td(L?.contextTocId??null),image:Yr(M),chart:mr(M),page:{current:db(M),total:gs(M)},canUndo:L?.canUndo??false,canRedo:L?.canRedo??false,pageSetup:NO(b,M),reviewPaneOpen:ln,reviewPane:g.current(),...Z.snapshot(),documentProtection:Zn.state(),revisionMarkup:An.markup.current(),reviewDisplayMode:M&&p?M.revisionDisplayMode():Ke,hasReviewContent:M?.session.hasReviewContent()??false,hiddenReviewAuthors:R.hiddenAuthorList,collaborationStatus:L?.collaborationStatus??"inactive",editingMode:v,lastRejection:w??L?.lastRejection??null,fontSubstitutions:wn(),formatPainter:L?.formatPainter??vf}}let nd$1;function Mt(){if(zn&&Si===no)return zn;let L=zn,ae=He()===nd$1;nd$1=He();let ie=Z.chromeSettled(),Me=c===Xe&&ie;Xe=c;let Te=M?.state().selection??null,Le=Cf(Te,Ye);Ye=Te;let Ue=M?.session.packageRevision()??-1,lt=Ue===ht;ht=Ue;let De=ao(),Ge=De;if(L){let tt=hy(De.formatting,L.formatting)?L.formatting:De.formatting,je=yy(De.page,L.page)?L.page:De.page,ct=by(De.pageSetup??null,L.pageSetup??null)?L.pageSetup:De.pageSetup,at=vy(De.selection,L.selection)?L.selection:De.selection,Rn=By(De.image,L.image)?L.image:De.image,Lr=L.fontSubstitutions!==void 0&&De.fontSubstitutions!==void 0&&L.fontSubstitutions.length===De.fontSubstitutions.length&&De.fontSubstitutions.every((gn,uo)=>L.fontSubstitutions[uo]===gn)?L.fontSubstitutions:De.fontSubstitutions;Ge={...De,formatting:tt,page:je,pageSetup:ct,selection:at,image:Rn,fontSubstitutions:Lr},Sy(Ge,L)&&Le&&lt&&Me&&ae&&(Ge=L);}return zn=Pf(Ge),Si=no,zn}if(e.document){let L=Ry(e.document);L?oo(L):(ot(an("unsupported",se.refuseSource(e.document))),Ht.openRejected("unsupported"));}let wm=FF({surface:()=>M,activeKey:so,paneOpen:()=>ln,selectionAnchor:()=>Ln()?.anchorY??null,authorFilterKey:()=>R.stateKey});function gr(L){return wl(L)===null||L.kind==="custom"&&!L.carded?false:!(L.kind==="revision"&&S!==null&&S.includes(L.revisionKind)&&(L.revisionKind!=="format"||x===void 0||x.includes(L.formattingKind??"")))}let qt=z_(L=>Bf(M,L)),io=L=>W_(M?.session,L),wt=L=>q_(M?.session,L);function Us(L){let ae=wl(L),ie=M?.publishedLayout();return !ae||!ie?null:Q_(ie).get(ae.start.paragraphId)??null}function rd(L){let ae=io(L);return ae!==null?{kind:"headerFooter",rId:ae.rId}:wt(L)??{kind:"body"}}function js(){return D8({surface:M,bodyOrder:()=>{let L=M?.publishedLayout();return L?J_(L):new Map},openStoryOrder:Pi})}function Kt(){let L=M?.activeScope();if(L?.kind==="headerFooter")return {kind:"headerFooter",rId:L.rId};if(L?.kind==="note"){let ae=Ic$1(L.id);if(ae)return {kind:"notesPart",noteKind:ae.noteKind}}return {kind:"body"}}function od(L){if(!M)return {kind:"body"};let ae=L.indexOf("#"),ie=ae===-1?ce(M.session,L)?.name:L.slice(0,ae);if(ie===void 0)return Kt();if(ie.length===0||ie===M.session.part().name)return {kind:"body"};for(let Me of M.session.headerFooterResolutionBySection())for(let Te of [Me.headers,Me.footers])for(let Le of Te.values())if(Le.partName===ie)return {kind:"headerFooter",rId:Le.rId};for(let Me of ["footnote","endnote"])if(tj$1(M.session.currentPackage(),Me)?.name===ie)return {kind:"notesPart",noteKind:Me};return Kt()}function Pi(){if(!M)return new Map;let L=Kt();if(L.kind==="body")return new Map;let ae=new Map;for(let[ie,Me]of M.session.paragraphIdsIn(L).entries())ae.set(Me,ie);return ae}function Vs(L){if(L.kind==="revision"){let ie=L.ranges;if(ie.length===0)return null;let Te=L.revisionKind==="replace"||L.revisionKind==="insert"||L.revisionKind==="delete"?ie[ie.length-1]:ie[0];return {start:ie[0].start,end:Te.end}}let ae=wl(L);return ae?{start:ae.start,end:ae.end}:null}function Ln(){if(M&&M.activatedReviewKey()!==null)return null;let L=js(),ae=M?.publishedLayout();if(!L||!ae)return null;let ie=qt(ae).get(L.from.paragraphId);return ie?{pageIndex:ie.pageIndex,anchorY:ie.contentY+nd(ie,L.from.paragraphId,L.from.offset)}:null}function so(){return M?.activeReviewKey()??null}let Ci=L2(),ad=F2();function Yt(L){if(!p)return [];let ae=R.filterItems(M?.session.reviewItems()??[]),ie=IL(ae,L),Me=L?.placement!==false,Te=null;if(Me&&ie.length>0){let ct=M?.publishedLayout()??null;ct&&(Te=qt(ct));}let Le=fp(()=>ae,so(),T.lightsPair()),Ue=ct=>{let at=io(ct);return at===null?1:at.kind==="header"?0:2},lt=M?.session.packageRevision()??-1,De=Ci(ie,Te,lt,Ue),{geometries:Ge,order:tt}=De,je=eO(M);return ad(ie,Te!==null,tt.map(ct=>{let at=ie[ct];return N_(at,{anchorY:Ge[ct]?.y??null,pageIndex:Ge[ct]?.pageIndex??null,activatable:up(at).every(gr),isActive:Le.size>0&&up(at).some(Rn=>Le.has(ql(Rn))),locked:je})}))}function Qt(){return M?.session.trackingSettings()??$j$1}function we(L=v,ae=E){let ie=Qt();return Oy({...O(),viewOnly:l.mode()==="view",hostChoseMode:l.mode()!==void 0,readerChoseMode:ae,currentMode:L,trackRevisions:ie.trackRevisions,restrictedToTrackedChanges:ie.restrictedToTrackedChanges,restrictedToForms:ie.restrictedToForms,restrictedToReadOnly:ie.restrictedToReadOnly,restrictedToComments:ie.restrictedToComments,engineAdoptedViewing:P})}function Yn(L){q=null,v=L,M?.setEditingMode(L==="suggesting"?"suggest":L==="viewing"?"view":"edit"),M?.setEditable(L!=="viewing");}function lo(L){return L!==null?L:v==="suggesting"&&c===void 0?Xr:_?Xr:E?null:l.openingModeDecision(O()).rejection}function id(){let L=we();w=lo(L.rejection),L.mode!==null&&(P=L.mode==="viewing",Yn(L.mode));}function Ti(L="editing",ae=true){if(b.isScheduled()){q=L;return}q=null;let ie=GE(l.mode(),O(),Qt(),v,L,P);P=ie.mode==="viewing"&&l.mode()!=="view",ie.mode!==v&&Yn(ie.mode),w=lo(ie.rejection),K.report(ie.configurationRejection),ae&&(Oe(),Ee());}function Ar(L){let ae=l.mode()==="view";return VE(ae,O,Qt,L)}let wa=Y2({surface:()=>M,enabled:()=>p,destroyed:()=>X,viewing:()=>v==="viewing",placements:Yt,authorVisibility:R,scope:rd,reveal:L=>pn.emitReviewItemReveal(iv(Yt,L)),resolved:L=>{pn.hasReviewChangesResolvedHandlers()&&pn.emitReviewChangesResolved(PL(Yt,L));},activate:(L,ae)=>{k=ae??false;try{return Fn.setActiveReviewItem(L,{announce:!1})}finally{k=false;}},setDisplayMode:L=>{Ke=L,M?.setRevisionDisplayMode(L),Oe(),Ee();},report:{diagnostics:Ht,tracked:()=>v==="suggesting"}}),{resolveReviewItem:Ei}=wa,In=S8(()=>({mounted:!!M&&!!d,generation:Ce}),pn.emitHistoryDiagnostic,()=>JSON.stringify(M?.state().selection)),sd=B8({reviewEnabled:p,historyGroups:In,surface:()=>M,author:()=>c,editingMode:()=>v,commentTargetRange:js,storyScopeOfParagraph:od,storyScopeOfReviewItem:rd,noteHomeOf:Us,placements:Yt,resolveReviewItem:Ei,bump:Oe}),Fn={beginHistoryGroup(){return b.flush(),In.begin()},get mountGeneration(){return Ce},get surface(){return M},...Z.popupChrome.setters,stateVersion:()=>no,fontMeasurement:()=>({measurer:N&&!s()?"shaped":"fixed",resolving:Je||et.pending()||s(),...N&&j&&!s()?{producer:j}:{}}),async setFonts(L){if(X)throw an("destroyed","a destroyed editor cannot replace fonts");let ae=++me;if(b.flush(),M?.flushPendingInput(),X||ae!==me)return;let ie=Se.advance(),Me=()=>!X&&ie.current();try{qe=L,xe=void 0,Je=!1,et.clear(),L||qs();}finally{ie.cancelPrevious();}let Te=Q;Me()&&await $e.schedule(true),L&&Me()&&Q===Te&&qs();},attach(L,ae){let ie=nP(L);if(ie)return ot(an("invalidTarget",ie));if(d!==L&&n?.invalidate(),X){ot(an("destroyed","this editor was destroyed; create a new instance to remount"));return}if(M&&d===L)return M.moveTo(L,ae);let Me=b.cancel();if(Me&&(Xn(),y=Me),cn.detach(),d=L,_e=null,M){mn(),M.moveTo(L,ae),Ce+=1,xa(L.ownerDocument);return}let Te=y;y=null,Te&&b.shouldYield(Te)?b.schedule(Te):Te?ki(Te):Oe();},detach(){if(n?.invalidate(),X)return;cn.detach();let L=b.cancel();L?(Xn(),y=L):M&&(An.destroyDialogs(),mn(),M.park(),Ce+=1),d=null,_e=null,Oe(),Ee();},load(L){let ae=Ry(L);if(!ae){let ie=M!==null||y!==null||b.isScheduled();ot(an("unsupported",se.refuseSource(L,ie))),Ht.openRejected("unsupported");return}n?.invalidate(),Ho.reset(),oo(ae);},save(){return b.flush(),XL(M,M?.hostElement()??d,()=>M)},getDocumentHandle(){return Object.freeze({revision:M?.session.packageRevision()??0})},exec(L,ae){let ie=Yb(d,L)??In.gate(L,ae);if(ie)return QH(L,ie);b.flush();let Me=An.exec(L);if(Me)return Me;let Te=Z.dialog(L,true);if(Te)return Te;In.note(L);let Le=Z.capability(L);if(X&&Le&&!Le.ok)return Le;if(L.type==="setEditingMode"){let at=Ar(L.mode);return at!==null?(at.reason===Xr&&(_=true,w=at.reason,K.report(at.reason),Oe(),Ee()),at):(E=true,_=false,w=null,Yn(L.mode),Oe(),Ee(),{ok:true,changed:false})}let Ue=Z.toggle(L);if(Ue)return Ue;if(L.type==="toggleReviewPane")return p?(ln=!ln,Oe(),Ee(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Wt};let lt=Zn.exec(L);if(lt)return lt;let De=M&&(L.type==="resolveAllReviewChanges"||L.type==="setReviewChangesAuthor")?In.run(M,L,ae,()=>wa.exec(L)):wa.exec(L);if(De)return De;if(Tx(L))return m2(L,M,Ex(v),ae);let Ge=ti(L);if(v==="viewing"&&Ge.supported&&Ge.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let tt=lc(L,M,l.modeForGate(),ae);if(!tt.ok)return tt.refusal;let je=M,ct=je.session.packageRevision();return In.run(je,L,ae,()=>{let at=x8(je,L,{...tt.tablePlan?{admittedTablePlan:tt.tablePlan}:{},editor:Fn,translate:l.translate()});return at||{ok:true,changed:je.session.packageRevision()!==ct}})},can(L,ae){let ie=Yb(d,L);if(ie)return ie;let Me=An.can(L);if(Me)return Me;let Te=Z.dialog(L,false);if(Te)return Te;let Le=In.gate(L,ae);if(Le)return Le;if(L.type==="insertImage"||L.type==="replaceImage"){if(X)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(ae?.scope){let je=lc(L,M,l.modeForGate(),ae);if(!je.ok)return je.refusal}return CO(L,M)}let Ue=Z.capability(L);if(Ue)return Ue;let lt=Zn.can(L);if(lt)return lt;let De=wa.can(L);if(De)return De;if(Tx(L))return Ox(L,M,Ex(v),ae);let Ge=ti(L);if(v==="viewing"&&Ge.supported&&Ge.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let tt=lc(L,M,l.modeForGate(),ae);if(!tt.ok)return tt.refusal;if(L.type==="replaceMatch"){let je=gy(M,L.match);if(je)return je}if(L.type==="proposeInsertion"||L.type==="proposeDeletion"||L.type==="proposeReplacement"){if(!(L.author??c??"").trim())return {ok:false,code:"invalidArgs",reason:`${L.type} requires a non-empty author`};let ct=L.target===void 0?{ok:true,selection:M.state().selection}:pm(M,L.target);if(!ct.ok)return ct;let{anchor:at,head:Rn}=ct.selection,Lr=at.paragraphId===Rn.paragraphId&&at.offset===Rn.offset,gn=L.type==="proposeReplacement"&&L.target===void 0&&M.state().cellSelection!==null;if(L.type!=="proposeInsertion"&&Lr&&!gn)return {ok:false,code:"invalidArgs",reason:`${L.type} needs a non-collapsed selection`}}if(ac(L)&&Gy(L)){let je=ic(Fn);if(je){let ct=zy(Fn,L,je);if(ct)return ct}}return {ok:true}},isActive(L){let ae=Z.isActive(L);return ae!==null?ae:L.type==="toggleDocumentProtection"?Zn.isActive():L.type==="setReviewDisplayMode"?Ke===L.mode:L.type==="toggleReviewPane"?ln:L.type==="setEditingMode"?v===L.mode:s_(L,M?Mt().formatting:null,ie=>M?.isListActive(ie)??false)},getDocumentStyles:()=>M?.session.documentStyles()??[],getDocumentFonts:bt,getAvailableFonts:()=>X8(He(),bt(),sn),getDocumentThemeColors:()=>M?.session.documentThemeColors()??[],getOutline:()=>M?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>KO(M?Mt().formatting:null),findMatches:((L,ae)=>u_(M,v,Ho.noteMatches,L,ae)),selectMatch(L){return b.flush(),M?d_(M,L):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>Mt().image,getSelectedTable:()=>WO(M),getTableCellSelection:()=>{let L=M?.state().cellSelection;return L?{tableId:L.tableId,rows:L.rows,columns:L.columns,cellIds:L.cellIds}:null},setTableInteractionLabel(L){M?.setTableInteractionLabel(L);},canExecuteImageCommand(L,ae){if(X)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(ae?.scope){let ie=lc(L,M,l.modeForGate(),ae);if(!ie.ok)return ie.refusal}return Xy(L,M)},executeImageCommand(L){return X?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):Qy(Fn,L)},getPageSetup:()=>cb(M),getWatermark:()=>Rf(M),getTrackedChanges:()=>(M?.session.reviewItems()??[]).filter(L=>L.kind==="revision").map(L=>{let ae=io(L);return {id:L.id,kind:L.kind==="revision"?L.revisionKind:"revision",...L.kind==="revision"&&L.author?{author:L.author}:{},story:ae!==null?ae.kind:wt(L)?.noteKind??"body"}}),getReviewItems:L=>Yt(L),getCustomNodeDefinitions:()=>u.customNodes,reportCustomNodeDiagnostic:f,...sd,getSelectionPlacement:()=>Ln(),isReviewPaneOpen:()=>ln,getEditingMode:()=>v,getReviewAuthors:()=>C.authorsFor(M?.revisionAuthors()??p6),...NF(R,{enabled:p,surface:()=>M,notify:()=>{Oe(),Ee();}}),setTrackedChangesFilter(L,ae){if(M)return M.setTrackedChangesFilter(L,ae);R.setPredicate(L,ae)&&(Oe(),Ee());},getConfiguredAuthor:()=>c??null,setAuthor(L){let ae=yv(L);if(c!==ae){if(c=ae,M?.setAuthor(c),c!==void 0&&_){_=false;let ie=UE(Ar("suggesting"));if(ie.enter)E=true,Yn("suggesting");else {w=ie.rejection,Oe(),Ee();return}}else if(!E){let ie=q??v;Ti(l.mode()===void 0?ie:"editing");return}w=lo(null),K.report(w),Oe(),Ee();}},setMode(L){l.setMode(L)&&(E=false,_=false,Ti());},...y6(l,{surface:()=>M,bump:Oe,emitSelectionChange:Ee}),presenceColorFor:L=>M?.remotePresenceColor(L)??"var(--doc-accent)",collaborationSession:()=>M?.collaborationSession()??null,getReviewAuthorStyle:L=>C.styleFor(L),setOpeningIndicatorHost:le.set,setRemoteCaretLabelHost(L){ne=L,M?.setRemoteCaretLabelHost(L);},setReviewPaneOptions:g.set,setRevisionMarkup:An.markup.set,setRevisionMarkupChrome:An.markup.register,setCompareDocumentsChrome:An.compare.register,setUnsupportedElementRules:Y.set,setRevisionStyles(L){C.set(L),M?.setRevisionStyles(L),Oe(),Ee();},setEditingMode:L=>Fn.exec({type:"setEditingMode",mode:L}),getReviewRevision:()=>wm(),getActivatedReviewItemKey:L=>av(Yt,M?.activatedReviewKey()??null,L),setActiveReviewItem(L,ae){if(L===null)return M?.dismissActiveReview(),Oe(),Ee(),{ok:true,changed:false};if(!M)return {ok:false,code:"notFound",reason:"no document is open"};M.flushPendingInput();let ie=Qr(Yt,L)?.item;if(!ie)return {ok:false,code:"notFound",reason:"no review item with that key"};let Me=ws(ie),Te=T.set(Me?ql(Me.deletion):null)??L,Le=wl(ie);if(!Le)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!up(ie).every(gr)&&!(k&&ie.kind==="revision"&&ie.revisionKind==="format"))return {ok:false,code:"unsupported",reason:X2(ie)};let Ue=ie?io(ie):null,lt=Ue===null&&ie?Us(ie):null;if(Ue!==null||lt!==null){let De=Ue!==null?{kind:"headerFooter",rId:Ue.rId,furnitureKind:Ue.kind}:{kind:"note",id:lt},Ge=lm(M,De,Le.start);if(!Ge.ok)return Ge}else {eM(M,(Vs(ie)??Le).start);let De=Vs(ie)??Le,Ge={paragraphId:De.start.paragraphId,offset:De.start.offset};M.activateReview(Te,{anchor:Ge,head:Ge},{allowExcluded:k,preventScroll:true});let tt=ae?.reveal??"centerIfNeeded";tt!==false&&M.revealPosition?.(De.start,{block:tt});}return (Ue!==null||lt!==null)&&M.activateReview(Te,void 0,{allowExcluded:k}),Oe(),Ee(),ae?.announce===true&&pn.emitReviewItemReveal(iv(Yt,{key:L,source:"host"})),{ok:true,changed:false}},setReviewActivationExclusions(L,ae){S=L===null?null:[...L],x=ae?.formattingKinds?[...ae.formattingKinds]:void 0,M?.setReviewActivationExclusions(S,{formattingKinds:x});},getHeaderFooterState:()=>M?.headerFooterState()??null,getNotePropertiesState:()=>M?.notePropertiesState?.()??null,getNotePreviewText:L=>M?.notePreviewText?.(L)??null,setActiveScope(L){M?.setActiveScope(L)&&Oe();},getActiveScope:()=>M?.activeScope()??{kind:"body"},query:L=>w2(M,()=>Mt().formatting,L),snapshot:()=>Mt(),getTotalPages:()=>gs(M),getCurrentPage:L=>db(M,L),...f_(()=>M,()=>b.flush(),()=>d),...h_(()=>Fn,()=>n,()=>b.flush()),...f6(cn,()=>M),...Ho.members,...D_({frame:Ho.frame,placements:Yt}),relayout(L){L?.sync,M?.layout();},retainSelection:()=>d?M?.retainSelection()??null:null,releaseSelection:L=>M?.releaseSelection(L),focus(L){return b.flush(),M?L&&L.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:L&&!M.setActiveScope(L)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(M.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){n?.invalidate(),X=true,Se.dispose(),et.clear(),K.dispose(),b.cancel(),cn.detach(),oe(),Q(),Q=()=>{},Xn(),d=null,y=null,h=new WeakMap,Ce+=1,Oe(),Ht.dispose(),pn.clear();},on:pn.on};n=A2(Fn,{surface:()=>M,container:()=>d,collaboration:()=>u.collaboration!==null,load:oo,changed:()=>{Oe(),Ee();},cancelLoad:()=>{r=null,o$1=null,b.cancel();}}),Ht.attach(Fn,wi);let co=va.methods(Fn);return tP(co,()=>d),V8(co,In,u.review?.compareDocuments),VH(co,Z.popupChrome),mn=()=>E2(co),T2(co,{deferEvents:pn.defer,displayOptions:Ii,changed:()=>{Oe(),Ee();}}),co}var b6=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function y7(e){if(e.length===0)return;if(e.every(n=>n.kind==="delete"))return "comment-delete";if(e.length!==1)return;let t=e[0];if(t.kind==="resolve")return "comment-resolve";if(t.kind==="create")return "comment-add";if(t.kind==="reply")return "comment-reply"}function b7(e){let t,n=u$1({port:v7(e,()=>t),capabilities:b6}),r=false,o=a=>(r||e.surface?.flushPendingInput(),$H(e,()=>n.execute(a)));return {...n,save:()=>{try{return n.save()}catch(a){return {ok:false,error:{code:"transaction-refused",message:a instanceof Error?a.message:"Cannot save the document."}}}},dispose:()=>{r=true,n.dispose();},execute:o,beginHistoryGroupRun:a=>{let i=r?null:U8(e,a);if(i===null)return null;let s=false;return {execute:l=>{if(s||r||!j8(e,a))return null;let c=t;t=i;try{return o(l)}finally{t=c;}},finish:()=>{s||(s=true,i.finish());}}}}}function v7(e,t){let n=(u,f)=>{let p=t();return p===void 0?f():p.bind(u,f)},r=0,o=0,a=null,i=false,s=false,l=()=>{if(s)return null;let u=e.surface?.session??null;return u!==a&&(i&&(r+=o+1),i=true,a=u,o=0),u&&(o=u.packageRevision()),u},c,d=null;return {localChangeTracking:true,suggesting:()=>e.surface?.editingMode()==="suggest",async prepare(u){if(!u.operations.some(g=>g.op==="updateFieldResult"))return;c=void 0,d=null;let f=e.surface;if(!f)return;ca(f);let p=f.layout();c=r$1(p),d=l()?.currentPackage()??null;},fieldPageContext(u,f,p){let g=l()?.currentPackage()??null;if(!g||g!==d)return null;let y=q(g).story(u);return y?s$2(c,y.part,f,p):null},revision(){return l(),r+o},currentPackage:()=>l()?.currentPackage()??null,revisionDisplayMode:()=>e.surface?lb$1(e.surface.revisionDisplayMode()):Yh$1,collaborative:()=>!!e.surface?.collaborationSession(),...x7(e),setupOutsideUndo:()=>true,allocationActor:()=>e.surface?.collaborationSession()?.identity.actorId,trackedRangeReplacement:()=>!e.surface?.collaborationSession(),replacementLanding:(u,f,p)=>e.surface?.replacementLanding(u,f,p)??null,apply(u,f,p=[],g=false){if(l(),_s(e))return {ok:false,reason:Cr};let y=e.surface;if(!y)return {ok:false,reason:"no-document"};let h=n(y,()=>y.applyAutomationOps(u,f,p,g));return h.rejected?{ok:false,reason:Ds(h.reason)}:{ok:true,changed:h.committed}},applyLifecycle(u){if(l(),_s(e))return {ok:false,reason:Cr};let f=e.surface;if(!f)return {ok:false,reason:"no-document"};let p=n(f,()=>f.applyAutomationOps(()=>[u]));return p.rejected?{ok:false,reason:Ds(p.reason)}:{ok:true,changed:p.committed}},applyCommentWrites(u,f){let p=e.surface,g=l();if(!p||!g)return {ok:false,reason:"no-document"};if(_s(e))return {ok:false,reason:Cr};if(u.length===0)return {ok:true,changed:false};if(f.kind!=="body")return {ok:false,reason:"unsupported-story"};let y=e.can({type:"toggleReviewPane"});if(!y.ok)return {ok:false,reason:Ds(y.reason??"review-module-required")};if(u.length!==1&&!u.every(v=>v.kind==="delete"))return {ok:false,reason:"mixed-comment-writes"};let h=null,b=n(p,()=>p.commitReviewOps(v=>{if(u.every(k=>k.kind==="delete")){let k=u.find(R=>R.kind==="delete"),T=g.deleteComments(u.map(R=>{if(R.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:R.commentId,...R.parentCommentId===void 0?{}:{parentCommentId:R.parentCommentId}}}),f,k?.kind==="delete"?k.noteId:void 0,{historyToken:v});return h=T?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:T}}if(u.length!==1)return h={ok:false,reason:"mixed-comment-writes"},{committed:false};let S=u[0];if(S.kind==="resolve"){let k=g.setCommentResolved(S.commentId,S.resolved,{historyToken:v});return h=k?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:k}}if(S.kind!=="create"&&S.kind!=="reply")return h={ok:false,reason:"unsupported-comment-write"},{committed:false};let x=g.replyToComment(S.kind==="reply"?S.parentCommentId:null,S.anchor,S.text,S.author,S.date,void 0,void 0,{historyToken:v});return h=x===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:x},{committed:x!==null}},y7(u)));return h??{ok:false,reason:Ds(b??"refused")}},applyCustomNodeWrite(u,f){let p=e.surface,g=l();if(!p||!g)return {ok:false,reason:"no-document"};if(_s(e))return {ok:false,reason:Cr};if(f.kind!=="body")return {ok:false,reason:"unsupported-story"};let y=null,h=n(p,()=>p.commitReviewOps(b=>{let v=g.insertCustomNode(u,void 0,{historyToken:b});return y=v.ok?{ok:true,changed:v.change!==null}:{ok:false,reason:v.detail?`${v.reason}: ${v.detail}`:v.reason},{committed:v.ok}},"package-scoped"));return y??{ok:false,reason:Ds(h??"refused")}},save:()=>l()?e.surface?.save()??null:null,selectRefusal(u,f){if(u.kind==="body")return null;let p=e.surface;return p?.editingMode()==="view"?"a read-only editor does not open a header, footer or note to select in it":p&&!df$1(p.layout(),{paragraphId:f,offset:0})?"that header, footer or note is not shown on any page":null},select(u,f){if(!e.surface)return false;let g=f==="end"?u.end:u.start,y=f==="start"?u.start:u.end;return e.exec({type:"setSelection",range:{anchor:{paragraphId:g.paragraphId,offset:g.offset},head:{paragraphId:y.paragraphId,offset:y.offset}}}).ok},subscribe:u=>e.on("change",()=>u()),dispose(){s=true,a=null;}}}function x7(e){let t=q8(e);return t?{compareDocuments:t}:{}}function s0(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}function S7(e){let t=e.popup.ownerDocument,n=r=>{if(r.key!=="Escape"||r.isComposing||r.keyCode===229||e.skip?.(r))return;let o=r.composedPath(),a=o[0]??r.target,i=Ro(a)?a:null,s=i!==null&&e.contains(i);if(!s&&v6(i,e.popup))return;let l=[s0(e.popup),e.chromeRoot?.(),...e.editorElements?.()??[]],c=s||l.some(d=>d!=null&&o.includes(d));e.close(s),c&&(r.preventDefault(),r.stopPropagation());};return t.addEventListener("keydown",n,true),()=>t.removeEventListener("keydown",n,true)}function v6(e,t){let r=(Ft(e)?e:e?.parentElement??null)?.closest('[aria-modal="true"], [data-docx-modal]');return r?r.hasAttribute("data-docx-dialog")||r.hasAttribute("data-docx-modal")?true:s0(t)?.contains(r)===true:false}var w7='[aria-expanded="true"], [role="menu"], [role="listbox"], [role="dialog"]';function k7(e){return e?.querySelector(w7)!=null}function I7(e){let t=e.popup.ownerDocument,n=r=>{let o=r.composedPath()[0]??r.target;if(!Ro(o)||e.contains(o))return;let a=Ft(o)?o:o.parentElement;a===null||a===t.body||a===t.documentElement||a.closest(".docx-pages")||v6(a,e.popup)||e.close();};return t.addEventListener("focusin",n,true),()=>t.removeEventListener("focusin",n,true)}function R7(e){let t=e.popup,n=Ua(t),r=e.contains??(a=>t?.contains(a)===true),o=a=>{let i=a.composedPath();(i.length>0?i:[a.target]).some(l=>Ro(l)&&r(l))||e.close(a);};return n.addEventListener("pointerdown",o,true),()=>n.removeEventListener("pointerdown",o,true)}function P7(e){return e*(96/72)}function C7(e,t){return e*t}function T7(e,t){return e/t}function E7(e,t,n){let r=e.pages.find(i=>i.index===t.pageIndex)??e.pages[t.pageIndex];if(!r)return {left:0,top:0,width:0,height:0};let o=n.pageOffsetX.get(r.index)??0,a=n.paintScale;return Object.freeze({left:(r.contentBox.x+t.x+o)*a,top:(r.contentBox.y+t.y)*a,width:t.width*a,height:t.height*a})}function O7(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function S6(e,t,n,r=false){return t?true:e.length===1?false:r?n:!n}var x6=["e","se","s","sw","w","nw","n","ne"];function M7(e,t){let n=x6.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return x6[(n-r+8)%8]}function A7(e,t,n){let r=e,o=t,a=-n.rotationDegrees*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=r*i-o*s,c=r*s+o*i;return r=l,o=c,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function vi(e){return e/12700}function w6(e){let t=A7(e.deltaXPt,e.deltaYPt,e.transform),n=vi(e.startWidthEmu),r=vi(e.startHeightEmu),o=n/r,a=M7(e.handle,e.transform),i=a.includes("e")?t.x:a.includes("w")?-t.x:0,s=a.includes("s")?t.y:a.includes("n")?-t.y:0;if(n=Math.max(1,n+i),r=Math.max(1,r+s),e.preserveAspect)if(a.length===2){let x=Math.max(n/vi(e.startWidthEmu),r/vi(e.startHeightEmu));n=Math.max(1,vi(e.startWidthEmu)*x),r=Math.max(1,n/o);}else a==="e"||a==="w"?r=Math.max(1,n/o):n=Math.max(1,r*o);let l=vi(e.startWidthEmu),c=vi(e.startHeightEmu),d=n/l,u=r/c,f=e.kind==="inline"&&Math.abs(e.transform.rotationDegrees%180)===90,p=Math.max(1,f?e.startBounds.width+r-c:e.startBounds.width*d),g=Math.max(1,f?e.startBounds.height+n-l:e.startBounds.height*u),y=e.startBounds.x,h=e.startBounds.y,b=e.handle;b.includes("w")&&(y=e.startBounds.x+e.startBounds.width-p),b.includes("n")&&(h=e.startBounds.y+e.startBounds.height-g);let v=null;if(e.kind==="anchored"&&e.startPosition&&(b.includes("w")||b.includes("n")||e.anchorFrameOrigin&&(e.startPosition.horizontalEmu===void 0&&n!==l||e.startPosition.verticalEmu===void 0&&r!==c)))if(e.startPosition.mode==="simple"){let S=b.includes("w")?Dt(y-e.startBounds.x):0,x=b.includes("n")?Dt(h-e.startBounds.y):0;v=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+S,verticalEmu:(e.startPosition.verticalEmu??0)+x});}else if(e.anchorFrameOrigin)v=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...b.includes("w")||e.startPosition.horizontalEmu===void 0&&n!==l?{horizontalEmu:Dt(y-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...b.includes("n")||e.startPosition.verticalEmu===void 0&&r!==c?{verticalEmu:Dt(h-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let S=b.includes("w")?Dt(y-e.startBounds.x):0,x=b.includes("n")?Dt(h-e.startBounds.y):0;v=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+S}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+x}:{},...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{}});}return Object.freeze({widthEmu:Dt(n),heightEmu:Dt(r),previewBounds:Object.freeze({x:y,y:h,width:p,height:g}),position:v})}function L7(e,t){return Object.freeze({scrollBy(n){if(!Number.isFinite(n)||n===0)return 0;let r=e.scrollTop;return e.scrollTop+=n*t,(e.scrollTop-r)/t}})}function F7(e){if(e.session.mode==="move"){let t=e.session.startBounds.x+e.deltaXPt,n=e.session.startBounds.y+e.deltaYPt+e.accumulatedScrollPt,r=e.session.startPosition&&Af(e.session.startPosition.mode==="frame"&&e.anchorFrameOrigin?{...e.session.startPosition,horizontalEmu:e.session.startPosition.horizontalEmu??Dt(e.session.startBounds.x-e.anchorFrameOrigin.x),verticalEmu:e.session.startPosition.verticalEmu??Dt(e.session.startBounds.y-e.anchorFrameOrigin.y)}:e.session.startPosition,e.deltaXPt,e.deltaYPt+e.accumulatedScrollPt);return Object.freeze({widthEmu:e.session.startWidthEmu,heightEmu:e.session.startHeightEmu,previewBounds:Object.freeze({x:t,y:n,width:e.session.startBounds.width,height:e.session.startBounds.height}),position:r??null})}return e.session.handle?w6({handle:e.session.handle,startWidthEmu:e.session.startWidthEmu,startHeightEmu:e.session.startHeightEmu,startBounds:e.session.startBounds,startPosition:e.session.startPosition,anchorFrameOrigin:e.anchorFrameOrigin,deltaXPt:e.deltaXPt,deltaYPt:e.deltaYPt,transform:e.session.transform,preserveAspect:S6(e.session.handle,e.aspectLocked,e.shiftKey,e.textbox),kind:e.session.kind}):Object.freeze({widthEmu:e.session.startWidthEmu,heightEmu:e.session.startHeightEmu,previewBounds:e.session.startBounds,position:null})}var k6=e=>Math.round(e/1440*100)/100,D7=e=>k6(e).toLocaleString(void 0,{maximumFractionDigits:2}),N7=e=>Math.round(e*1440),H7={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},I6=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",R6=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function _7(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",direction:e.direction??"ltr",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:I6(t),specialBy:Math.abs(t??0),spaceBefore:e.spaceBeforePt??0,spaceAfter:e.spaceAfterPt??0,lineRule:e.lineSpacing?.rule??"multiple",lineValue:e.lineSpacing?.value??1.08,contextualSpacing:e.contextualSpacing===true,keepNext:e.keepNext===true,keepLines:e.keepLines===true,widowControl:e.widowControl!==false,pageBreakBefore:e.pageBreakBefore===true,tabStops:e.tabStops??[],clearedAllTabStops:false}}var P6={contextualSpacing:false,keepNext:false,keepLines:false,widowControl:false,pageBreakBefore:false,tabStops:false,alignment:false,direction:false,indentLeft:false,indentRight:false,special:false,spaceBefore:false,spaceAfter:false,lineSpacing:false};function B7(e){return {contextualSpacing:e.contextualSpacing===null,keepNext:e.keepNext===null,keepLines:e.keepLines===null,widowControl:e.widowControl===null,pageBreakBefore:e.pageBreakBefore===null,tabStops:e.disagrees.tabStops,alignment:e.disagrees.alignment,direction:e.disagrees.direction,indentLeft:e.disagrees.indentLeft||e.indentUnknown,indentRight:e.disagrees.indentRight||e.indentUnknown,special:e.disagrees.indentFirstLine||e.indentUnknown,spaceBefore:e.disagrees.spaceBeforePt,spaceAfter:e.disagrees.spaceAfterPt,lineSpacing:e.disagrees.lineSpacing}}function C6(e,t){return e===t?true:e.length!==t.length?false:e.every((n,r)=>{let o=t[r];return o!==void 0&&n.positionTwips===o.positionTwips&&n.alignment===o.alignment&&(n.leader??"none")===(o.leader??"none")})}function $7(e,t,n=P6,r=n){let o={},a=false,i=(c,d)=>{o[c]=d,a=true;},s=c=>n[c]&&!r[c];(e.direction!==t.direction||s("direction"))&&i("direction",t.direction);let l=!n.direction&&!n.alignment&&e.direction!==t.direction&&t.alignment===T6(e.alignment);return (e.alignment!==t.alignment&&!l||s("alignment"))&&i("alignment",t.alignment),(e.indentLeft!==t.indentLeft||s("indentLeft"))&&i("indentLeftTwips",t.indentLeft),(e.indentRight!==t.indentRight||s("indentRight"))&&i("indentRightTwips",t.indentRight),(e.special!==t.special||e.specialBy!==t.specialBy||s("special"))&&i("indentFirstLineTwips",R6(t.special,t.specialBy)),(e.spaceBefore!==t.spaceBefore||s("spaceBefore"))&&i("spaceBeforePt",t.spaceBefore),(e.spaceAfter!==t.spaceAfter||s("spaceAfter"))&&i("spaceAfterPt",t.spaceAfter),!r.lineSpacing&&(e.lineRule!==t.lineRule||e.lineValue!==t.lineValue||s("lineSpacing"))&&i("lineSpacing",{rule:t.lineRule,value:t.lineValue}),(e.contextualSpacing!==t.contextualSpacing||s("contextualSpacing"))&&i("contextualSpacing",t.contextualSpacing),(e.keepNext!==t.keepNext||s("keepNext"))&&i("keepNext",t.keepNext),(e.keepLines!==t.keepLines||s("keepLines"))&&i("keepLines",t.keepLines),(e.widowControl!==t.widowControl||s("widowControl"))&&i("widowControl",t.widowControl),(e.pageBreakBefore!==t.pageBreakBefore||s("pageBreakBefore"))&&i("pageBreakBefore",t.pageBreakBefore),(!C6(e.tabStops,t.tabStops)||s("tabStops")&&t.clearedAllTabStops)&&i("tabStops",t.tabStops),a?o:null}function T6(e){return e==="left"?"right":e==="right"?"left":e}function W7(e,t){return [...e.filter(r=>r.positionTwips!==t.positionTwips),t].sort((r,o)=>r.positionTwips-o.positionTwips)}function q7(e,t){if(t.key!=="Tab")return false;let n=[...e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(i=>!i.hasAttribute("disabled")&&i.tabIndex!==-1);if(n.length===0)return false;let r=n[0],o=n[n.length-1],a=e.ownerDocument.activeElement;return t.shiftKey&&(a===r||a===e)?(o.focus(),true):!t.shiftKey&&a===o?(r.focus(),true):false}var K7=63;function E6(e){return /^\d{1,3}$/.test(e.trim())?Number(e.trim()):null}function U7(e,t,n){let r=n?.maxCols??63,o=n?.maxRows??63,a=E6(e),i=E6(t);return a===null||a<1||a>r?{counts:null,problem:{kind:"range",field:"columns",max:r}}:i===null||i<1||i>o?{counts:null,problem:{kind:"range",field:"rows",max:o}}:a*i<2?{counts:null,problem:{kind:"oneCell"}}:{counts:{rows:i,cols:a},problem:null}}function j7(e,t){let n=[[1,2],[2,1],[e?.maxRows??2,1]];for(let[r,o]of n)if(r*o>=2&&t({type:"splitCell",rows:r,cols:o}).ok)return {columns:String(o),rows:String(r)};return {columns:"2",rows:"1"}}function V7(e,t,n){let r,o=false,a,i=rt(()=>t),s,l=new Set,c=[],d=()=>{i.clearTimeout(s),s=void 0,r?.end(),r=void 0,a=void 0,l.clear();},u=()=>{if(o)throw new Error("history group binding was disposed");return (!r||r.state==="closed")&&(r=e.beginHistoryGroup()),r},f=()=>{d(),u();},p=()=>{let h=r;a=void 0,l.clear(),i.clearTimeout(s),s=i.setTimeout(()=>{r===h&&d();},0);},g=(h,b,v,S=false)=>{h.addEventListener(b,v,S),c.push(()=>h.removeEventListener(b,v,S));},y=h=>n.kind==="native-color"?h==="Enter"||h===" ":["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"," ","Enter"].includes(h);if(g(t,"pointerdown",h=>{let b=h;if(!(b.button!==0||n.kind==="keyboard")&&(f(),a=b.pointerId,n.kind!=="native-color"))try{t.setPointerCapture?.(b.pointerId);}catch{}},true),g(t,"keydown",h=>{let b=h;if(b.key==="Escape"){p();return}!y(b.key)||b.altKey||b.ctrlKey||b.metaKey||(!b.repeat&&l.size===0&&f(),l.add(b.key),u());},true),g(t.ownerDocument,"keyup",h=>{let b=h.key;l.delete(b)&&n.kind!=="native-color"&&l.size===0&&p();},true),n.kind!=="native-color")for(let h of ["pointerup","pointercancel","lostpointercapture"])g(h==="lostpointercapture"?t:t.ownerDocument,h,b=>{a!==void 0&&b.pointerId===a&&p();},true);return g(t,"input",()=>{s!==void 0?f():u();},true),g(t,"change",()=>{(n.kind==="native-color"||a===void 0&&l.size===0)&&p();}),g(t,"blur",p,true),t.ownerDocument.defaultView&&g(t.ownerDocument.defaultView,"blur",p),{options:()=>({historyGroup:u()}),dispose(){if(!o){o=true,d();for(let h of c)h();}}}}var M6=Object.freeze([1,1.15,1.5,2,2.5,3]);function G7(e){return Number.isInteger(e*10)?e.toFixed(1):String(e)}function O6(e,t,n){let r=e.rule==="multiple";return {spacing:e,command:t?null:{type:"setLineSpacing",rule:e.rule,value:e.value},text:r?G7(e.value):String(e.value),labelKey:r?null:e.rule==="exact"?"lineSpacing.exactlyPoints":"lineSpacing.atLeastPoints",selected:t,preset:n}}function z7(e){let t=M6.map(o=>O6({rule:"multiple",value:o},e?.rule==="multiple"&&e.value===o,true));if(!e||t.some(o=>o.selected))return t;let n=O6(e,true,false);if(e.rule!=="multiple")return [n,...t];let r=t.findIndex(o=>o.spacing.value>e.value);return t.splice(r===-1?t.length:r,0,n),t}function Z7(e,t,n){let r={minimumFractionDigits:t,maximumFractionDigits:2};try{return new Intl.NumberFormat(n,r).format(e)}catch{return new Intl.NumberFormat("en",r).format(e)}}function X7(e,t,n){let r=n===void 0?e.text:Z7(e.spacing.value,e.spacing.rule==="multiple"?1:0,n);return e.labelKey?t(e.labelKey).replace("{value}",r):r}var ya=class extends Error{code;constructor(t,n){super(`Document capture failed: ${t}.`,{cause:n}),this.name="DocumentRefreshError",this.code=t;}};function A6(e){return JSON.stringify([e.revisionKind,e.author,e.date,e.text,e.replacedText])}function L6(e){return new Map(e.surface()?.session.reviewItems().filter(t=>t.kind==="revision").map(t=>[t.id,A6(t)]))}function F6(e,t,n,r){let o=e.surface();if(!o)return {located:[],available:false};let a=o.session.part(),i=r$2(a),s=o.session.paragraphAnchors().paraIdByNode,l=new Map,c=new Map;i.forEach((g,y)=>{c.set(g.id,y);let h=s.get(g.id);if(h){let b=h.toUpperCase();l.set(b,l.has(b)?null:g);}});let d=new Set(o.layout().pages.flatMap(g=>Ja$2(g).map(y=>y.paragraphId))),u=(g,y=JSON.stringify([typeof g.location?.text=="string"?g.location.text:null,g.unavailableReason,g.description]))=>{let h={id:g.id,resultId:t,isNew:r.get(g.id)!==y,...g.description!==void 0?{description:g.description}:{}};if(!g.location)return {fingerprint:y,change:{...h,status:g.unavailableReason??"unavailable",diagnostic:Object.freeze({code:g.unavailableReason==="deleted"?"deleted":"missing-location"})}};let b=g.location,v=T=>({fingerprint:y,change:{...h,status:"invalid",diagnostic:Object.freeze({code:T,location:Object.freeze({...b})})}});if(b.paragraphId===void 0==(b.paragraphIndex===void 0)||b.paragraphIndex!==void 0&&(!Number.isSafeInteger(b.paragraphIndex)||b.paragraphIndex<0))return v("invalid-selector");if(b.paragraphId!==void 0&&(typeof b.paragraphId!="string"||!vb$1(b.paragraphId)))return v("invalid-paragraph-id");let S=b.paragraphId!==void 0?l.get(b.paragraphId.toUpperCase()):i[b.paragraphIndex];if(S===null)return v("ambiguous-paragraph-id");if(!S)return v("paragraph-not-found");let x=S?Nm(a,S.id)??"":"";if(!Number.isSafeInteger(b.start)||!Number.isSafeInteger(b.end)||b.start<0||b.end<=b.start||b.end>x.length)return v("invalid-offsets");if(x.slice(b.start,b.end)!==b.text)return v("text-mismatch");let k=d.has(S.id);return {fingerprint:y,change:{...h,status:k?"available":"unavailable",location:Object.freeze({...b}),...k?{}:{diagnostic:Object.freeze({code:"not-rendered",location:Object.freeze({...b})})}},...k?{paragraphId:S.id,offset:b.start}:{}}};if(n)return {located:n.map(g=>u(g)),available:true};let f=o.session.reviewItems().filter(g=>g.kind==="revision");return {located:f.map(g=>{let y=A6(g),h=g.ranges[0];if(!h||h.partName!==a.name)return {fingerprint:y,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==y,status:h?"unsupported-story":"unavailable",diagnostic:Object.freeze({code:h?"unsupported-story":"missing-location"})}};let b=c.get(h.start.paragraphId)??-1;if(g.revisionKind==="delete"||g.revisionKind==="moveFrom")return {fingerprint:y,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==y,status:"deleted",diagnostic:Object.freeze({code:"deleted"})}};if(h.start.paragraphId!==h.end.paragraphId)return {fingerprint:y,change:{id:g.id,resultId:t,isNew:r.get(g.id)!==y,status:"unavailable",diagnostic:Object.freeze({code:"multiple-paragraphs"})}};let v=Nm(a,h.start.paragraphId)??"",S={paragraphIndex:b,start:h.start.offset,end:h.end.offset,text:v.slice(h.start.offset,h.end.offset)};return u({id:g.id,location:S},y)}),available:f.length>0}}var D6=new WeakMap,Y7=0;function Q7(e){let t=D6.get(e);if(t)return t;let n=M2(e),r=`refresh-${++Y7}`,o=0,a=null,i=new AbortController,s=false,l=Promise.resolve(),c=null,d=[],u=null,f=new Set,p=new Set,g=Object.freeze({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false}),y=R=>{g=Object.freeze({...g,...R});for(let C of f)try{C();}catch{}},h=dm(e,n,{marker:"data-docx-refresh-highlight",defaultColor:"var(--doc-refresh-highlight-color)"},()=>{g.highlightsVisible&&y({highlightsVisible:false});}),b=(R,C)=>{C&&y({phase:C,result:R,recoveryAvailable:c!==null});for(let A of p)try{A(R);}catch{}return R},v=(R,C,A)=>({ok:false,resultId:R,code:C,...A===void 0?{}:{recovered:A}}),S=()=>n.collaboration()?"collaboration":!n.surface()||!n.container()||e.snapshot().isOpening?"unavailable":null,x=()=>{o++,a=null,i.abort(),i=new AbortController,d=[],u=null,h.clear();};n.invalidated.add(()=>{x(),c=null,y({phase:"idle",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});}),e.on("change",R=>{R.source||u===null||n.revision===u||(d=[],h.clear(),u=null,y({changes:[],highlightsVisible:false}));});let k=async R=>{let C=n.surface(),A=n.container();if(!C||!A)throw new Error("unavailable");ip(C)&&await new Promise((w,O)=>{let _=()=>{A.removeEventListener("compositionend",q),R.removeEventListener("abort",K);},q=()=>{_(),w();},K=()=>{_(),O(new Error("cancelled"));};A.addEventListener("compositionend",q),R.addEventListener("abort",K,{once:true}),R.aborted&&K();});let E=Oc(A);if(E&&await E,R.aborted||n.surface()!==C)throw new Error("document-changed");let P=C.save();if(n.surface()!==C)throw new Error("document-changed");return {bytes:P,revision:n.revision}},T={async capture(){let R=S();if(c)throw new ya("recovery-failed");if(R||s)throw new ya(R??"busy");x(),c=null;let C=o,A=n.epoch,E=i.signal;y({phase:"capturing",result:null,changes:[],highlightsVisible:false,recoveryAvailable:false});try{let P=await k(E);if(C!==o||A!==n.epoch)throw new Error("superseded");let w=Object.freeze({id:`${r}-${C}`,bytes:P.bytes.slice().buffer});return a={token:w,epoch:A,revision:P.revision,sequence:-1,seen:L6(n)},y({phase:"processing"}),w}catch(P){throw C===o&&y({phase:"failed"}),new ya(C===o?"input-failed":"superseded",P)}},applyUpdate(R){let C=`${R.submission?.id??"unknown"}:${R.sequence}`,A;try{if(!Number.isSafeInteger(R.sequence)||R.sequence<0||!(R.bytes instanceof Uint8Array||R.bytes instanceof ArrayBuffer)||R.failures!==void 0&&(!Array.isArray(R.failures)||R.failures.length>1e4||Array.from(R.failures).some(w=>typeof w!="string"))||R.changes!==void 0&&(!Array.isArray(R.changes)||R.changes.length>1e4||new Set(R.changes.map(w=>w.id)).size!==R.changes.length||Array.from(R.changes).some(w=>!w||typeof w.id!="string"||!w.id||w.description!==void 0&&(typeof w.description!="string"||w.description.length>1e3)||w.location!==void 0&&(!w.location||typeof w.location!="object"||w.location.paragraphId!==void 0&&typeof w.location.paragraphId!="string"||w.location.paragraphIndex!==void 0&&typeof w.location.paragraphIndex!="number"||typeof w.location.start!="number"||typeof w.location.end!="number"||typeof w.location.text!="string")||w.unavailableReason!==void 0&&!["deleted","unavailable"].includes(w.unavailableReason))))throw new Error("invalid-result");A={...R,bytes:new Uint8Array((R.bytes instanceof Uint8Array,R.bytes)).slice(),changes:R.changes?.map(w=>({id:w.id,description:w.description,unavailableReason:w.unavailableReason,location:w.location?{paragraphId:w.location.paragraphId,paragraphIndex:w.location.paragraphIndex,start:w.location.start,end:w.location.end,text:w.location.text}:void 0})),failures:R.failures?.slice()};}catch{return Promise.resolve(b(v(C,"invalid-result")))}let E=async()=>{let w=a,O=S();if(O)return b(v(C,O));if(!w||w.token!==A.submission)return b(v(C,"superseded"));if(A.sequence<=w.sequence)return b(v(C,"out-of-order"));if(w.epoch!==n.epoch)return b(v(C,"document-changed"));s=true;let _=i.signal,q=()=>a===w&&w.epoch===n.epoch&&!_.aborted;try{let K=await k(_);if(!q())return b(v(C,"cancelled"));if(K.revision!==w.revision)return b(v(C,"local-edits"),"failed");let U=A.bytes;if(!pg(U).ok)return b(v(C,"invalid-document"),"failed");if(h.clear(),d=[],u=null,y({phase:"refreshing",changes:[],highlightsVisible:!1}),!q())return b(v(C,"cancelled"));let M=n.surface().save();if(!q())return b(v(C,"cancelled"));if(n.revision!==w.revision)return b(v(C,"local-edits"),"failed");c={bytes:M.slice(),epoch:n.epoch};let Y=await n.replace(U,"refresh");if(w.epoch!==n.epoch)return b(v(C,"document-changed"));if(!Y&&!q())return c=null,b(v(C,"cancelled"));if(!Y){if(y({phase:"recovering"}),w.epoch!==n.epoch)return b(v(C,"document-changed"));let W=c&&await n.replace(c.bytes,"recovery");return w.epoch!==n.epoch?b(v(C,"document-changed")):(W&&(c=null),a=null,b(v(C,W?"load-failed":"recovery-failed",!!W),"failed"))}c=null,h.clear(),w.revision=n.mountedRevision,w.sequence=A.sequence;let ne=F6(n,C,A.changes,w.seen);d=n.revision===w.revision?ne.located:[];for(let W of d)w.seen.set(W.change.id,W.fingerprint);u=w.revision;let le=Object.freeze(d.map(W=>Object.freeze(W.change))),se=Object.freeze({ok:!0,resultId:C,changes:le,changeInformation:n.revision===w.revision&&ne.available?"available":"unavailable",failures:Object.freeze(A.failures??[])});return y({changes:le,result:se,phase:"complete",recoveryAvailable:!1}),b(se)}catch{return b(v(C,q()?"input-failed":"cancelled"),q()?"failed":void 0)}finally{s=false;}},P=l.then(E);return l=P.then(()=>{},()=>{}),P},cancel(){let R=g.phase==="recovering"||!n.surface()&&c!==null;n.cancel(),o++,a=null,i.abort(),i=new AbortController,R||(c=null),y({phase:R?"failed":g.result?.ok?"complete":"idle",result:R||g.result?.ok?g.result:null,recoveryAvailable:c!==null});},finish(R){a?.token===R&&!s&&(a=null,y({phase:g.phase==="processing"?"idle":g.phase}));},snapshot:()=>g,subscribe(R){return f.add(R),()=>{f.delete(R);}},onResult(R){return p.add(R),()=>{p.delete(R);}},highlightChanges(R){if(h.validate(R),u!==n.revision)return 0;let C=R?.changeIds===void 0?null:new Set(R.changeIds),A=d.filter(E=>E.change.status==="available"&&(C?C.has(E.change.id):R?.includePrevious||E.change.isNew));return h.show(A,R),y({highlightsVisible:A.length>0}),A.length},clearHighlights(R){h.hide(R),y({highlightsVisible:false});},navigateToChange(R,C={}){if(C.focus!==void 0&&typeof C.focus!="boolean")throw new TypeError("focus must be a boolean.");let A=Bs(C,"center",n.container());if(u!==n.revision)return false;let E=d.find(w=>w.change.id===R);if(!E?.paragraphId||E.offset===void 0)return false;let P=n.surface();if(!P?.revealPosition({paragraphId:E.paragraphId,offset:E.offset},A))return false;if(C?.focus){P.setActiveScope({kind:"body"});let w={paragraphId:E.paragraphId,offset:E.offset};P.setSelection({anchor:w,head:w}),P.focus();}return true},recoveryBytes:()=>c?c.bytes.slice().buffer:null,async recover(){if(!c||c.epoch!==n.epoch||s)return false;s=true;let R=c;y({phase:"recovering"});try{if(R.epoch!==n.epoch)return !1;let C=await n.replace(R.bytes,"recovery");return R.epoch!==n.epoch?!1:(C&&(c=null),y({phase:C?"idle":"failed",recoveryAvailable:!C}),C)}finally{s=false;}}};return D6.set(e,T),T}var N6=150,J7=1e3,eX=Object.freeze({applied:0,unavailable:0});function tX(e,t,n,r={}){let{onResult:o,...a}=r,i=n,s=a,l=eX,c=false,d=rt(()=>Io(e)),u,f=0,p=b=>{b.applied===l.applied&&b.unavailable===l.unavailable||(l=b,o?.(b));},g=()=>{if(d.clearTimeout(u),u=void 0,f=0,c)return;let b=typeof i=="function"?i(e):i;p(e.setHighlights(t,b,s));},y=()=>{let b=Date.now();f===0&&(f=b),d.clearTimeout(u);let v=Math.min(N6,J7-(b-f));u=d.setTimeout(g,Math.max(0,v));},h=e.on("change",b=>{typeof i=="function"?b.source?g():y():b.source==="refresh"||b.source==="recovery"?g():b.source==="load"&&p({applied:0,unavailable:i.length});});return g(),{get result(){return l},refresh:g,update(b,v){i=b,v!==void 0&&(s=v),g();},stop(){c||(c=true,d.clearTimeout(u),h(),e.clearHighlights(t));}}}var c0=150,_6=2e3,B6="search",$6=10,l0=Object.freeze([]),nX=1e3;function rX(e,t){let n=e.activeIndex>=0?e.matches[e.activeIndex]:void 0;if(!n)return -1;let r=-1;for(let[o,a]of t.entries())a.blockId===n.blockId&&(r<0||Math.abs(a.start-n.start)<Math.abs(t[r].start-n.start))&&(r=o);return r}var H6=new WeakMap;function oX(e){let t=H6.get(e);if(t)return t;let n={query:"",matchCase:false,wholeWord:false,matches:l0,truncated:false,activeIndex:-1,activeMatch:null,isPending:false},r="",o={},a=rt(()=>Io(e)),i,s=new Set,l=new Map,c=false;function d(){let R="none";for(let C of l.values()){if(C==="all")return "all";C==="active"&&(R="active");}return R}function u(){let R=d(),{matches:C,activeIndex:A}=n,E=A>=0?C[A]:void 0,P=R==="all"?C:R==="active"&&E?[E]:[];P.length===0&&!c||(e.setHighlights(B6,P,{activeIndex:R==="all"?A:P.length>0?0:-1,priority:$6}),c=P.length>0);}function f(R){let C={...n,...R};if(C.matches!==n.matches&&R.activeIndex===void 0&&(C.activeIndex=rX(n,C.matches)),C.truncated=c_(C.matches)??C.matches.length>=_6,C.activeMatch=C.matches[C.activeIndex]??null,!!Object.keys(C).some(E=>C[E]!==n[E])){n=C,u();for(let E of [...s])E();}}function p(R=r,C=n){return R.length===0?l0:e.findMatches(R,{matchCase:C.matchCase??false,wholeWord:C.wholeWord??false})}function g(){a.clearTimeout(i),i=void 0;}function y(){g(),r=n.query,f({matches:p(),isPending:false});}let h,b=0,v=()=>{a.clearTimeout(h),h=void 0,b=0,r.length>0&&f({matches:p()});},S=()=>{h!==void 0&&v();};e.on("change",R=>{if(r.length===0)return;if(R.source)return v();let C=Date.now();b===0&&(b=C),a.clearTimeout(h);let A=Math.min(c0,nX-(C-b));h=a.setTimeout(v,Math.max(0,A));});let x=e.snapshot().editingMode;e.on("selectionChange",R=>{R.editingMode!==x&&(x=R.editingMode,v());});let k=(R,C)=>{S();let A=n.matches.length;if(A===0)return false;let E=n.activeIndex<0?R>0?-1:0:n.activeIndex;return T.goTo((E+R+A)%A,C)},T={getState:()=>n,subscribe(R){return s.add(R),()=>s.delete(R)},find(R,C={}){g(),r=R;let A=C.matchCase??n.matchCase,E=C.wholeWord??n.wholeWord,P=p(R,{matchCase:A,wholeWord:E});return C.highlight===void 0||C.highlight==="none"?l.delete(o):l.set(o,C.highlight),f({query:R,matchCase:A,wholeWord:E,matches:P,activeIndex:-1,isPending:false}),u(),C.selectFirst&&T.goTo(0),n.matches},setQuery(R){R!==n.query&&(g(),R!==r&&(i=a.setTimeout(y,c0)),f({query:R,isPending:R!==r}));},setMatchCase(R){f({matchCase:R,matches:p(r,{...n,matchCase:R})});},setWholeWord(R){f({wholeWord:R,matches:p(r,{...n,wholeWord:R})});},goTo(R,C){S();let A=n.matches[R];return !A||(C?.focus&&e.focus(),!e.selectMatch(A).ok)?false:(f({activeIndex:R}),true)},next:R=>k(1,R),previous:R=>k(-1,R),clear(){g(),r="",l.delete(o),f({query:"",matches:l0,activeIndex:-1,isPending:false});},showHighlights(R){let C={};return l.set(C,R),u(),()=>{l.delete(C)&&u();}}};return H6.set(e,T),T}var aX=[37,80,68,70,45],Jc=class extends Error{constructor(n){super(`Install @docx-editor.dev/docx-to-${n} and configure menu.exporters.${n}.`+(n==="pdf"?" PDF conversion requires a Node.js server.":""));this.format=n;this.name="ChromeExportError";}format;code="missing-exporter"};async function d0(e,t,n={},r={}){if(t==="markdown"){if(!n.markdown)throw new Jc(t);let l=await n.markdown(new Uint8Array(await e.save()));if(typeof l?.markdown!="string")throw new TypeError("The Markdown converter returned no Markdown.");return {bytes:new TextEncoder().encode(l.markdown),extension:"md",mimeType:"text/markdown;charset=utf-8"}}if(t!=="pdf")throw new TypeError("Unsupported export format.");if(!n.pdf)throw new Jc(t);let o=e.snapshot?.(),a=r.displayMode!==void 0||r.comments!==void 0,i=o||a?{displayMode:r.displayMode??o?.reviewDisplayMode??"proposed",...r.comments===void 0?{}:{comments:r.comments},revisionMarkup:o?.revisionMarkup??hb$1,...e.getReviewAuthors?{revisionAuthorSlots:Object.freeze(Object.fromEntries(e.getReviewAuthors().map(({author:l,slot:c})=>[l,c])))}:{}}:void 0,s=await n.pdf(new Uint8Array(await e.save()),i);if(!(s?.bytes instanceof Uint8Array)||s.bytes.length===0)throw new TypeError("The PDF converter returned no PDF bytes.");if(!aX.every((l,c)=>s.bytes[c]===l))throw new TypeError("The PDF converter returned a file without a PDF header.");return {bytes:s.bytes,extension:"pdf",mimeType:"application/pdf"}}var sX=15e3,Mr=class extends Error{code;constructor(t){super(t==="pdf-viewer-unavailable"?"This browser cannot display PDF files in the page.":t==="pdf-load-failed"?"The PDF did not load for printing.":t==="print-refused"?"The browser refused to print the PDF from the page.":"The print job has ended."),this.code=t,this.name="ChromePrintError";}};function lX(e){if(e.altKey||e.shiftKey||typeof e.key!="string")return false;let t=e.key.toLowerCase();return t!=="p"&&(e.code!=="KeyP"||/^[a-z]$/.test(t))?false:isApplePlatform()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}var cX=Object.freeze([{mode:"simple-markup",labelKey:"review.simpleMarkup"},{mode:"all-markup",labelKey:"review.allMarkup"},{mode:"proposed",labelKey:"review.noMarkup"},{mode:"original",labelKey:"review.original"}]);function dX(e){return {displayMode:e?.reviewDisplayMode??"proposed",comments:true}}async function uX(e,t={},n=globalThis.document,r={}){let{bytes:o,mimeType:a}=await d0(e,"pdf",t,r);return fX(o,a,n)}function fX(e,t,n){let r=n.nodeType===9?n.body:n;if(!r)throw new TypeError("Printing requires a document body.");let o=r.ownerDocument,a=o.defaultView;if(!a)throw new TypeError("Printing requires a document with a window.");let i=e.buffer instanceof ArrayBuffer?e:e.slice(),s=a.URL.createObjectURL(new a.Blob([i],{type:t})),l=null,c=null,d,u=null,f=false,p=h=>{a.clearTimeout(d),u?.(h),u=null,l?.remove(),l=null,c=null;},g=()=>{if(c)return c;let h=o.createElement("iframe");return l=h,h.setAttribute("aria-hidden","true"),h.setAttribute("tabindex","-1"),h.setAttribute("data-docx-print-frame",""),h.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;",c=new Promise((b,v)=>{u=v,d=a.setTimeout(()=>p(new Mr("pdf-load-failed")),sX),h.addEventListener("load",()=>{if(a.clearTimeout(d),!h.contentWindow){p(new Mr("pdf-load-failed"));return}u=null,b(h.contentWindow);},{once:true});}),c.catch(()=>{}),h.src=s,r.append(h),c};return {url:s,async print(h={}){if(f)throw new Mr("print-ended");if(a.navigator.pdfViewerEnabled===false)throw new Mr("pdf-viewer-unavailable");let b=await g();if(f)throw new Mr("print-ended");if(await h.beforePrint?.(),f)throw new Mr("print-ended");let v=o.activeElement;try{b.focus(),b.print();}catch{throw new Mr("print-refused")}finally{v?.isConnected&&v.focus({preventScroll:true});}},dispose(){f||(f=true,p(new Mr("print-ended")),a.URL.revokeObjectURL(s));}}}var pX=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document";function mX(e){return e.reason===void 0?`compareDocuments.errors.${e.code}`:`compareDocuments.reasons.${e.reason}`}var W6="data-docx-compare-phase",gX=e=>e!==null&&!e.disabled&&!e.closest("[hidden]");function hX(e,t){if(!e?.isConnected)return;let n=i=>e.querySelector(i),r=n('[data-docx-field="revised"] input, input[type="file"]'),a=(t==="busy"?[n('[data-docx-part="cancel"]'),n(`[${W6}]`)]:t==="unchanged"?[n('[data-docx-part="apply"]'),r]:[r,n('[data-docx-part="apply"]')]).find(gX)??e;a===e&&!e.hasAttribute("tabindex")&&(e.tabIndex=-1),a.focus({preventScroll:true});}var yX=new Intl.Collator(void 0,{numeric:true,sensitivity:"base"});function q6(e,t){let n=e.filter(r=>t.showHidden||!r.hidden);return t.sortBy==="location"?[...n].sort((r,o)=>r.order-o.order):[...n].sort((r,o)=>yX.compare(r.name,o.name)||r.order-o.order)}var u0=["body","header","footer","footnote","endnote"];function bX(e,t){let n=q6(e,t),r=aj$1(t.query.trim()),o=n;if(r.length>0){let a=[],i=[];for(let s of n){let l=aj$1(s.name);l.startsWith(r)?a.push(s):l.includes(r)&&i.push(s);}o=[...a,...i];}return t.sortBy!=="location"?o:[...o].sort((a,i)=>u0.indexOf(a.place)-u0.indexOf(i.place))}function vX(e,t,n){let r=aj$1(t.trim());return r.length===0?null:e.find(o=>aj$1(o.name)===r)??n[0]??null}function xX(e,t){let n=aj$1(t.trim()),r=aj$1(e);if(n.length===0||r.length!==e.length)return null;let o=r.indexOf(n);return o<0?null:{start:o,end:o+n.length}}function SX(e){return u0.map(t=>({place:t,rows:e.flatMap((n,r)=>n.place===t?[{row:n,index:r}]:[])})).filter(t=>t.rows.length>0)}function wX(e){return e.find(t=>t.atSelection&&!t.hidden)?.name??""}function kX(e,t,n){let r=_i(t)??($i(t)?"invalidStart":null),o=aj$1(t),a=t.length===0?null:e.find(i=>aj$1(i.name)===o)??null;return {problem:r,existing:a,canAdd:n&&r===null,canDelete:n&&a!==null,canGoTo:a!==null}}function IX(e,t){return (t.support!=="partial"||e.includePartial===true)&&(e.match?.(t)??true)}function RX(e,t,n){let r=e.surface?.session;return r?Ja$1(r.currentPackage(),t,n):{ok:false,reason:"drawing-not-found"}}function PX(e,t){return JSON.stringify([e,t.kind,t.categories.map(n=>n.label),t.series.map(n=>n.name)])}function CX(e,t){if(e===t)return true;let n=JSON.parse(e),r=JSON.parse(t);return n[0]===r[0]&&n[1]===r[1]&&n[2].length<=r[2].length&&n[3].length<=r[3].length&&n[2].every((o,a)=>o===r[2][a])&&n[3].every((o,a)=>o===r[3][a])}var TX=e=>e==null?"":String(e);function ed(e){let t=e.trim().replace(",",".");if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:void 0}function m0(e){return e.kind==="xy"&&e.categories.every(t=>typeof ed(t.label)=="number")}function EX(e,t){if(!m0(e))return t;let n=0;for(let r of e.categories)n=Math.max(n,Number(ed(r.label)));return String(Math.floor(n)+1)}var ba=e=>({ok:false,error:e});function g0(e,t,n){let r=m0(t),o=t.categories.map(i=>({...i})),a=t.series.map(i=>({...i,values:[...i.values]}));switch(n.type){case "value":{let i=ed(n.text),s=a[n.series];if(i===void 0||!s||n.category>=o.length)return ba("chart.data.fieldErrors.number");s.values[n.category]=i;break}case "seriesName":{let i=a[n.series];if(!i||n.text.length>c)return ba("chart.data.fieldErrors.tooLong");i.name=n.text;break}case "label":{let i=o[n.category];if(!i||n.text.length>c)return ba("chart.data.fieldErrors.tooLong");let s=ed(n.text);if(r&&typeof s!="number")return ba("chart.data.fieldErrors.xNumber");i.label=r?String(s):n.text;break}case "addSeries":if(a.length>=b)return ba("chart.data.fieldErrors.limit");a=[...a,{name:n.name,values:o.map(()=>null)}];break;case "removeSeries":if(a.length<=1||!a[n.series])return ba("chart.data.fieldErrors.limit");a=a.filter((i,s)=>s!==n.series);break;case "addCategory":if(o.length>=a$3)return ba("chart.data.fieldErrors.limit");o=[...o,{label:n.label}],a=a.map(i=>({...i,values:[...i.values,null]}));break;case "removeCategory":if(o.length<=1||!o[n.category])return ba("chart.data.fieldErrors.limit");o=o.filter((i,s)=>s!==n.category),a=a.map(i=>({...i,values:i.values.filter((s,l)=>l!==n.category)}));break}return {ok:true,command:{type:"setChartData",drawingNodeId:e,data:{kind:t.kind,categories:o,series:a}}}}var OX=(e,t)=>Math.max(0,Math.min(e,t-2)),MX=d,AX=["none","top","bottom","left","right"],LX=e=>e.type==="scatter"||e.type==="scatterLines";function FX(e,t){let n=e.colorsBy!==t.colorsBy&&e.colors.some(o=>o.color!==null),r=t.axisTitles===null&&!!(e.axisTitles?.category||e.axisTitles?.value);return n||r?"chart.format.typeChangeRemoved":null}function DX(e){let t=e.colors.some(r=>r.color!==null),n=!!(e.axisTitles?.category||e.axisTitles?.value);return t||n?"chart.format.typeChangeHint":null}function NX(e,t){return e.type==="pie"&&t>1?"chart.format.pieFirstSeries":null}function HX(e){return LX(e)?{category:"chart.format.xAxisTitle",value:"chart.format.yAxisTitle"}:{category:"chart.format.categoryAxisTitle",value:"chart.format.valueAxisTitle"}}function _X(e,t,n,r){let o=r.trim()===""?null:r,a=n==="title"?t.title:n==="categoryAxisTitle"?t.axisTitles?.category??null:t.axisTitles?.value??null;return o===a?null:{type:"setChartFormat",drawingNodeId:e,format:{[n]:o}}}var xi=["bg1","tx1","bg2","tx2","accent1","accent2","accent3","accent4","accent5","accent6"],BX={bg1:"colorPicker.theme.background1",tx1:"colorPicker.theme.text1",bg2:"colorPicker.theme.background2",tx2:"colorPicker.theme.text2",accent1:"colorPicker.theme.accent1",accent2:"colorPicker.theme.accent2",accent3:"colorPicker.theme.accent3",accent4:"colorPicker.theme.accent4",accent5:"colorPicker.theme.accent5",accent6:"colorPicker.theme.accent6"},h0=[{hex:"#C00000",nameKey:"colorPicker.colors.darkRed"},{hex:"#FF0000",nameKey:"colorPicker.colors.red"},{hex:"#FFC000",nameKey:"colorPicker.colors.orange"},{hex:"#FFFF00",nameKey:"colorPicker.colors.yellow"},{hex:"#92D050",nameKey:"colorPicker.colors.lightGreen"},{hex:"#00B050",nameKey:"colorPicker.colors.green"},{hex:"#00B0F0",nameKey:"colorPicker.colors.lightBlue"},{hex:"#0070C0",nameKey:"colorPicker.colors.blue"},{hex:"#002060",nameKey:"colorPicker.colors.darkBlue"},{hex:"#7030A0",nameKey:"colorPicker.colors.purple"}],U6=/^[0-9A-F]{6}$/,K6=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"];function $X(e){let t=(e??[]).map(n=>n.hex.replace(/^#/,"").toUpperCase());return t.length===K6.length&&t.every(n=>U6.test(n))?t:K6}function y0(e){return typeof e=="string"?`#${e.replace(/^#/,"").toUpperCase()}`:e.shift?`${e.theme}:${e.shift}`:e.theme}function j6(e){if(e==="auto")return null;if(e.startsWith("#"))return e;let[t,n]=e.split(":");return n?{theme:t,shift:Number(n)}:{theme:t}}var WX=e=>e.color===null?"auto":y0(e.color);function qX(e){let t=e==="auto"||xi.includes(e);return ["auto",...xi,...t?[]:[e]]}function KX(e,t,n){return {type:"setChartColor",drawingNodeId:e,index:t,color:j6(n)}}function UX(e,t){if(e==="auto")return t("colorPicker.automatic");if(e.startsWith("#")){let i=h0.find(s=>s.hex===e.toUpperCase());return i?t(i.nameKey):e.toUpperCase()}let[n,r]=e.split(":"),o=t(BX[n]),a=Number(r??0);return a>0?t("chart.format.colorLighter",{color:o,percent:a}):a<0?t("chart.format.colorDarker",{color:o,percent:-a}):o}function jX(e,t){let[n,r,o]=[0,2,4].map(b=>parseInt(e.slice(b,b+2),16)/255),a=Math.max(n,r,o),i=Math.min(n,r,o),s=(a+i)/2,l=a-i,c=l===0?0:l/(1-Math.abs(2*s-1)),d=0;l!==0&&(a===n?d=(r-o)/l%6:a===r?d=(o-n)/l+2:d=(n-r)/l+4);let u=Math.max(0,Math.min(1,s*(1-Math.abs(t)/100)+Math.max(0,t)/100)),f=(1-Math.abs(2*u-1))*c,p=f*(1-Math.abs((d%6+6)%6%2-1)),g=u-f/2,y=Math.floor((d%6+6)%6);return [[f,p,0],[p,f,0],[0,f,p],[0,p,f],[p,0,f],[f,0,p]][y].map(b=>Math.max(0,Math.min(255,Math.round((b+g)*255))).toString(16).padStart(2,"0")).join("").toUpperCase()}function xm(e,t,n){if(e==="auto")return n?xm(y0(n),t):"#000000";if(e.startsWith("#")){let s=e.slice(1).toUpperCase();return U6.test(s)?`#${s}`:"#000000"}let[r,o]=e.split(":"),a=t[xi.indexOf(r)]??"000000",i=Math.max(-100,Math.min(100,Number(o??0)));return `#${jX(a,Number.isFinite(i)?i:0)}`}function VX(e){let t=[0,2,4].map(r=>parseInt(e.slice(r,r+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[-5,-15,-25,-35,-50]:n===0?[50,35,25,15,5]:n>=.8?[-10,-25,-50,-75,-90]:[80,60,40,-25,-50]}function GX(e){let t=xi.map(a=>({pick:a,hex:xm(a,e)})),n=xi.map((a,i)=>VX(e[i]??"000000")),r=[0,1,2,3,4].map(a=>xi.map((i,s)=>{let l=`${i}:${n[s][a]}`;return {pick:l,hex:xm(l,e)}})),o=h0.map(a=>({pick:a.hex,hex:a.hex}));return {theme:[t,...r],standard:o}}function zX(e){if(!e)return;let t=e.querySelector('[aria-pressed="true"]')??e.querySelector("button");t?.classList.contains("docx-chart-pane__swatch")?p0(e,t):p0(e,b0(e)[0]??null),t?.focus({preventScroll:true}),e.scrollIntoView?.({block:"nearest"});}var f0=10,b0=e=>[...e.querySelectorAll(".docx-chart-pane__swatch")];function p0(e,t){for(let n of b0(e))n.tabIndex=n===t?0:-1;}function ZX(e,t){if(!e)return false;let n=b0(e),r=e.querySelector(".docx-chart-pane__grid-auto"),o=e.ownerDocument.activeElement,a=n.findIndex(c=>c===o),i=e.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl",s={ArrowLeft:i?1:-1,ArrowRight:i?-1:1}[t],l;if(a<0){if(o!==r||t!=="ArrowDown"&&t!=="Home")return false;l=n[0];}else if(s!==void 0)l=n[a+s];else if(t==="ArrowDown")l=n[a+f0];else if(t==="ArrowUp")l=a<f0?r:n[a-f0];else if(t==="Home")l=n[0];else if(t==="End")l=n[n.length-1];else return false;return l&&(l!==r&&p0(e,l),l.focus({preventScroll:true})),true}var XX=3;function YX(e){if(!e)return;let t=e.ownerDocument,n=r=>{if(!e.isConnected||e.contains(t.activeElement))return;let o=e.querySelector("input:not(:disabled), select:not(:disabled), button:not(:disabled)");o&&(o.focus(),!(t.activeElement===o||r===0)&&t.defaultView?.requestAnimationFrame(()=>n(r-1)));};n(XX);}var QX=Object.freeze({chart:null,data:null,format:null,readReason:null,canEditData:false,canEditFormat:false,dataDisabledReason:"chart.errors.noChart",formatDisabledReason:"chart.errors.noChart"});function JX(e){return !e.editable||e.editingMode==="viewing"?Fc:e.editingMode==="suggesting"?Dc:null}function e9(e,t,n){if(!e||!t)return QX;let r=t.drawingNodeId,o=e.query({type:"chartData",drawingNodeId:r}),a=e.query({type:"chartFormat",drawingNodeId:r}),i=JX(n),s=o.ok?o.data:null,l=a.ok?a.format:null,c=i??(t.editable?null:t.reason??null),d=i??(t.formattable?null:t.formatReason??null);return {chart:t,data:s,format:l,readReason:o.ok?a.ok?null:a.reason:o.reason,canEditData:s!==null&&t.editable&&i===null,canEditFormat:l!==null&&t.formattable&&i===null,dataDisabledReason:s===null&&c===null?"chart.errors.noChart":c,formatDisabledReason:l===null&&d===null?"chart.errors.noChart":d}}function t9(e,t,n){return !e||!t?{ok:false,code:"notFound",reason:"chart.errors.noChart"}:e.exec({...n,drawingNodeId:t.drawingNodeId})}function n9(e,t,n){if(!e||!t)return {ok:false,code:"notFound",reason:"chart.errors.noChart"};let r=e.query({type:"chartData",drawingNodeId:t.drawingNodeId});if(!r.ok)return {ok:false,code:"unsupported",reason:r.reason};let o=g0(t.drawingNodeId,r.data,n);return o.ok?e.exec(o.command):{ok:false,code:"invalidArgs",reason:o.error}}
31
+ export{pE as $,bM as $a,oF as $b,$7 as $c,_X as $d,J5 as A,Df as Aa,PM as Ab,h7 as Ac,pX as Ad,b3 as B,hs as Ba,Ab as Bb,b6 as Bc,mX as Bd,v3 as C,VO as Ca,CM as Cb,b7 as Cc,W6 as Cd,S3 as D,ub as Da,TM as Db,s0 as Dc,hX as Dd,kT as E,cc as Ea,EM as Eb,S7 as Ec,q6 as Ed,I3 as F,FW as Fa,Fb,k7 as Fc,bX as Fd,P3 as G,GO as Ga,FM as Gb,I7 as Gc,vX as Gd,ce as H,zO as Ha,Nq as Hb,R7 as Hc,xX as Hd,ty as I,DW as Ia,Xf as Ib,P7 as Ic,SX as Id,D3 as J,si as Ja,Db as Jb,C7 as Jc,wX as Jd,H3 as K,fb as Ka,Hb as Kb,T7 as Kc,kX as Kd,_3 as L,BW as La,Bq as Lb,E7 as Lc,IX as Ld,$T as M,pb as Ma,BM as Mb,O7 as Mc,RX as Md,B3 as N,Kf as Na,$q as Nb,S6 as Nc,PX as Nd,$3 as O,zW as Oa,$M as Ob,w6 as Oc,CX as Od,W3 as P,ZW as Pa,Wq as Pb,L7 as Pc,TX as Pd,q3 as Q,XW as Qa,qq as Qb,F7 as Qc,ed as Qd,K3 as R,YW as Ra,Kq as Rb,k6 as Rc,m0 as Rd,U3 as S,QW as Sa,LL as Sb,D7 as Sc,EX as Sd,qT as T,JW as Ta,Cc as Tb,N7 as Tc,g0 as Td,KT as U,dM as Ua,Tc as Ub,H7 as Uc,OX as Ud,UT as V,eq as Va,tU as Vb,I6 as Vc,MX as Vd,j3 as W,nq as Wa,sv as Wb,R6 as Wc,AX as Wd,V3 as X,jf as Xa,ui as Xb,_7 as Xc,FX as Xd,G3 as Y,hM as Ya,Ao as Yb,P6 as Yc,DX as Yd,iy as Z,Uf as Za,yp as Zb,B7 as Zc,NX as Zd,fE as _,yM as _a,rF as _b,C6 as _c,HX as _d,Ka as a,kf as aa,aq as ab,dv as ac,T6 as ad,xi as ae,Kl as b,ly as ba,iq as bb,bp as bc,W7 as bd,h0 as be,Vu as c,cy as ca,sq as cb,uv as cc,q7 as cd,$X as ce,Gu as d,J3 as da,cq as db,vp as dc,K7 as dd,y0 as de,nh as e,If as ea,dq as eb,fv as ec,U7 as ed,j6 as ee,O5 as f,nc as fa,uq as fb,pv as fc,j7 as fd,WX as fe,M5 as g,$y as ga,fq as gb,mv as gc,V7 as gd,qX as ge,rh as h,oW as ha,pq as hb,Tp as hc,M6 as hd,KX as he,Ua as i,rc as ia,Tb as ib,Tv as ic,z7 as id,UX as ie,Ae as j,oc as ja,mq as jb,t1 as jc,X7 as jd,xm as je,K5 as k,Wy as ka,Eb as kb,zc as kc,ya as kd,GX as ke,U5 as l,aW as la,vM as lb,Ns as lc,Q7 as ld,zX as le,j5 as m,qy as ma,gq as mb,Bbe as mc,N6 as md,ZX as me,Ft as n,Mf as na,hq as nb,MG as nc,tX as nd,YX as ne,zr as o,Dt as oa,Ob as ob,AG as oc,c0 as od,e9 as oe,V5 as p,ai as pa,yq as pb,LG as pc,_6 as pd,t9 as pe,Ro as q,hO as qa,bq as qb,_s as qc,B6 as qd,n9 as qe,rt as r,Af as ra,Gf as rb,Uz as rc,$6 as rd,ja as s,Yr as sa,Mb as sb,o0 as sc,oX as sd,Zu as t,ic as ta,wM as tb,Yc as tc,Jc as td,G5 as u,Xy as ua,vq as ub,Qc as uc,d0 as ud,ah as v,Qy as va,xq as vb,$s as vc,Mr as vd,Z5 as w,yW as wa,Sq as wb,l7 as wc,lX as wd,X5 as x,bW as xa,kM as xb,bm as xc,cX as xd,Y5 as y,xW as ya,RM as yb,vm as yc,dX as yd,Q5 as z,SW as za,Rq as zb,a0 as zc,uX as zd};