@docx-editor.dev/core 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +11 -32
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +11 -10
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +9 -9
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-44LQJIKH.cjs +20 -0
  9. package/dist/chunk-4EHMMSFR.cjs +1 -0
  10. package/dist/{chunk-D2V4YBWJ.cjs → chunk-AFG7Q622.cjs} +1 -1
  11. package/dist/chunk-AJCCS53D.js +1 -0
  12. package/dist/{chunk-3EZO3O6I.js → chunk-AYMSP25Q.js} +3 -3
  13. package/dist/{chunk-44SIVFJT.cjs → chunk-B4KZSKF7.cjs} +5 -5
  14. package/dist/chunk-BDAY2ETZ.js +1 -0
  15. package/dist/chunk-BNZF6DYC.cjs +18 -0
  16. package/dist/chunk-BQXF2PFF.js +2 -0
  17. package/dist/chunk-GIHKVXEO.js +2 -0
  18. package/dist/chunk-ITNK6C5M.cjs +3 -0
  19. package/dist/chunk-MP3K4LC5.js +1 -0
  20. package/dist/chunk-MXOO7KRI.cjs +11 -0
  21. package/dist/chunk-NG6IQ4SI.js +11 -0
  22. package/dist/{chunk-2HQXLL5L.cjs → chunk-PYXMAUNR.cjs} +1 -1
  23. package/dist/chunk-Q2B6HX3R.js +1 -0
  24. package/dist/chunk-Q5JPPUNR.js +5 -0
  25. package/dist/chunk-S35UK656.cjs +2 -0
  26. package/dist/chunk-S6J4O5XP.js +1 -0
  27. package/dist/{chunk-GSEUM6AI.cjs → chunk-TE43S3LX.cjs} +1 -1
  28. package/dist/chunk-TKQH7BNE.cjs +1 -0
  29. package/dist/chunk-UKVVUHZL.cjs +1 -0
  30. package/dist/chunk-VH2DLEZK.js +20 -0
  31. package/dist/{chunk-OHVJYJOA.js → chunk-VUNFWXHF.js} +1 -1
  32. package/dist/{chunk-OA6LFCTG.cjs → chunk-WQFNWLNY.cjs} +3 -3
  33. package/dist/chunk-WZX4UGRQ.js +3 -0
  34. package/dist/{chunk-CAIWEQLC.js → chunk-X5QNSISI.js} +1 -1
  35. package/dist/chunk-XS4FOHH6.js +18 -0
  36. package/dist/{chunk-PIBYJZIH.cjs → chunk-XZY4Q6PJ.cjs} +1 -1
  37. package/dist/{chunk-WTILOUPG.cjs → chunk-Z2ETEZRU.cjs} +1 -1
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +13 -4
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.d.ts +4 -3
  42. package/dist/contracts/document.d.ts +3 -2
  43. package/dist/contracts/editor.cjs +1 -1
  44. package/dist/contracts/editor.d.ts +9 -9
  45. package/dist/contracts/editor.js +1 -1
  46. package/dist/contracts/interaction.d.ts +2 -2
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.ts +9 -7
  49. package/dist/contracts/modules.js +1 -1
  50. package/dist/contracts/types.d.ts +2 -1
  51. package/dist/{custom-node-writes-piokwVR5.d.ts → custom-node-writes-05qS32px.d.ts} +2 -2
  52. package/dist/{document-protection-C6RvCHx-.d.ts → document-protection-Cr59VKLO.d.ts} +1 -1
  53. package/dist/{editor-BgtcHulQ.d.ts → editor-BsLSz_7y.d.ts} +28 -29
  54. package/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
  55. package/dist/editor.cjs +1 -1
  56. package/dist/editor.css +1 -1
  57. package/dist/editor.d.ts +130 -27
  58. package/dist/editor.js +1 -1
  59. package/dist/export.cjs +2 -2
  60. package/dist/export.d.ts +13 -13
  61. package/dist/export.js +1 -1
  62. package/dist/{font-resolver-Bv2Z25-J.d.ts → font-resolver-CzwdBJDE.d.ts} +1 -1
  63. package/dist/{headless-document-view-DHKMN_3Y.d.ts → headless-document-view-B7nAiR7P.d.ts} +2 -2
  64. package/dist/{image-resources-C51LuAAu.d.ts → image-resources-C4ilLzog.d.ts} +1 -1
  65. package/dist/{index-3lr8xXF8.d.ts → index-zkvqBQ9o.d.ts} +117 -26
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.ts +18 -18
  68. package/dist/index.js +1 -1
  69. package/dist/{layout-shaping-CKBUSaS7.d.ts → layout-shaping-BJKVTI6i.d.ts} +1 -1
  70. package/dist/layout.cjs +1 -1
  71. package/dist/layout.d.ts +41 -18
  72. package/dist/layout.js +1 -1
  73. package/dist/{note-properties-CcXUgqr8.d.ts → note-properties-MNztEj5s.d.ts} +1 -1
  74. package/dist/{omml-equation-C5P6Ym3v.d.ts → omml-equation-CbnW9yXd.d.ts} +1 -1
  75. package/dist/output.cjs +1 -1
  76. package/dist/output.d.ts +8 -7
  77. package/dist/output.js +1 -1
  78. package/dist/{protocol-CsawNZkt.d.ts → protocol-Co_r0SZQ.d.ts} +2 -2
  79. package/dist/{review-paragraph-order-BCIqjopY.d.ts → review-paragraph-order-EFaU7TqH.d.ts} +1 -1
  80. package/dist/{revision-projection-BcRnC4Yj.d.ts → revision-projection-DEIvpxiq.d.ts} +16 -2
  81. package/dist/{semantic-cell-selection-R9wrenwR.d.ts → semantic-cell-selection-DXmfnDCw.d.ts} +9 -4
  82. package/dist/{semantic-interaction-B7beVwH7.d.ts → semantic-interaction-BLu3M6Nn.d.ts} +1 -1
  83. package/dist/{semantic-paint-CLvHwf8y.d.ts → semantic-paint-CPsihA6k.d.ts} +18 -2
  84. package/dist/{semantic-records-CbXwnS80.d.ts → semantic-records-CqD0b5Ex.d.ts} +146 -6
  85. package/dist/store.cjs +1 -1
  86. package/dist/store.d.ts +462 -427
  87. package/dist/store.js +1 -1
  88. package/dist/{note-lifecycle-D4AOFCAt.d.ts → tree-package-fragment-CwJDixNs.d.ts} +183 -143
  89. package/dist/{tree-session-contract-DTQxw2zL.d.ts → tree-session-contract-D9RRWE0C.d.ts} +8 -8
  90. package/dist/{types-barrel-CEOy-Jv0.d.ts → types-barrel-DLB11iSY.d.ts} +1470 -1426
  91. package/package.json +2 -2
  92. package/dist/chunk-2H4ABRMB.cjs +0 -20
  93. package/dist/chunk-6UCDHGXI.js +0 -1
  94. package/dist/chunk-7VMVDRRU.js +0 -2
  95. package/dist/chunk-CEXC2VHI.cjs +0 -1
  96. package/dist/chunk-CF3JR35B.js +0 -11
  97. package/dist/chunk-D5EHDHYV.js +0 -1
  98. package/dist/chunk-DGSJZMAE.cjs +0 -11
  99. package/dist/chunk-EHBPYFRE.js +0 -20
  100. package/dist/chunk-GOEBQ26R.js +0 -1
  101. package/dist/chunk-H6WDEAOJ.js +0 -18
  102. package/dist/chunk-I6LSEDUL.cjs +0 -18
  103. package/dist/chunk-IW35GWJN.js +0 -1
  104. package/dist/chunk-JRBGCIR2.js +0 -5
  105. package/dist/chunk-K5HIOS6J.cjs +0 -3
  106. package/dist/chunk-KLQXP27K.js +0 -3
  107. package/dist/chunk-MZFFU66H.cjs +0 -2
  108. package/dist/chunk-MZPNLIP3.js +0 -2
  109. package/dist/chunk-OHJQ7GPZ.cjs +0 -1
  110. package/dist/chunk-P4TGGDK3.js +0 -1
  111. package/dist/chunk-ZKWRCLT2.cjs +0 -1
  112. package/dist/editor-scope-DZJT4ukT.d.ts +0 -53
@@ -1,20 +0,0 @@
1
- import {a as a$3}from'./chunk-D5EHDHYV.js';import {k,h,e,n,o,f,g,l,i as i$2,b as b$1,c,a as a$7,d as d$2}from'./chunk-MZPNLIP3.js';import {p,q,i as i$1,f as f$1,a as a$8,k as k$2,b as b$3,e as e$2,r,v,t as t$1,m,n as n$1,c as c$1}from'./chunk-OHVJYJOA.js';import {d,y,t,F,a as a$1,i,da,qa as qa$1,va,wa,ta,ea,fa,ga,xa as xa$1,ka as ka$1,ia,ya,pa as pa$1,za as za$2,ra as ra$1,ua,sa as sa$1,ja as ja$2,aa,H,g as g$2,oa as oa$1}from'./chunk-3EZO3O6I.js';import {k as k$1,e as e$1,b,a as a$4}from'./chunk-7VMVDRRU.js';import {a as a$5}from'./chunk-6UCDHGXI.js';import {_c as _c$1,Ja as Ja$1,Rd as Rd$1,vc as vc$1,X,md,nd,Hb as Hb$1,ge as ge$1,ie,vd,je,qd as qd$1,_d as _d$1,S,Wd as Wd$1,le,Ud as Ud$1,ac as ac$1,uc as uc$1,Z,Y,$c as $c$1,jd as jd$1,Zb as Zb$1,Yb as Yb$1,ud,Zd as Zd$1,$d as $d$1,de,W,ce,B,gc as gc$1,ke,V,Xd as Xd$1,Td as Td$1,me as me$1,Vd as Vd$1,yb as yb$1,Ic as Ic$1,Uc as Uc$1,Rc as Rc$1,dd,ad,bd,cd,_b as _b$1,Fa as Fa$1,U,td,R,Wb as Wb$1,Xb as Xb$1,fe,C,T,Wc as Wc$1,oe,ab as ab$1,lb as lb$2,hb as hb$1,La as La$2,od,K,Tc as Tc$1,Kc as Kc$1,Cb as Cb$1,rc as rc$1,Bb as Bb$1,Ab as Ab$1,sc as sc$2,Jb as Jb$1,Q as Q$1,Ca as Ca$1,Ea as Ea$1}from'./chunk-H6WDEAOJ.js';import {j,d as d$1,i as i$3}from'./chunk-JRBGCIR2.js';import {ja as ja$1,Fa,Sa,Aa,sa,ra,ta as ta$1,Ja as Ja$2,va as va$1,ka,qa as qa$2,pa,na,xa,Ca,Da as Da$1,la,za as za$1,ya as ya$1,oa,La as La$1,Ea,I,Za as Za$1}from'./chunk-KLQXP27K.js';import {a as a$6}from'./chunk-6JIJOZDW.js';import {a as a$2,Ef,Sh as Sh$1,cb as cb$1,Ae,if as _if,Ce,qi,gf,Pf,Mb as Mb$1,_c as _c$2,Ga as Ga$1,lb as lb$1,db as db$1,eb as eb$1,gb as gb$1,L,Yh as Yh$1,_h as _h$1,Vh as Vh$1,Zh as Zh$1,bh as bh$1,gh as gh$1,eh as eh$1,dh as dh$1,Dh as Dh$1,wf,Zc as Zc$1,ye,b as b$2,ud as ud$1,Ff,Gf,Cf,Df,Hf,If,Ha as Ha$1,ki,Oh as Oh$1,rh as rh$1,Uh as Uh$1,ze as ze$1,Re,Ih as Ih$1,Eh as Eh$1,Fh as Fh$1,xd,Ad as Ad$1,qc as qc$1,Dd as Dd$1,Bg as Bg$1,Eb as Eb$1,Db as Db$1,sd,jd as jd$2,hd,ag,Zf,Ve,We,yg,Kh as Kh$1,oh as oh$1,ph as ph$1,Je as Je$1,He as He$1,Ch as Ch$1,Bh as Bh$1,Qf,Pe,sc as sc$1,uc as uc$2,dd as dd$1,Mh as Mh$1,Nh as Nh$1,Qh as Qh$1,sh as sh$1,vf,vh as vh$1,zd as zd$1,ch as ch$1,la as la$1,ma,na as na$1,_f,zh as zh$1,hc as hc$1,fh as fh$1,Se,Cc as Cc$1,da as da$1,zc as zc$1,N,w,Ge as Ge$1,M,tb as tb$1,yb as yb$2,ee,g as g$1,Oa,Ra,Fd as Fd$1,ja as ja$3,Q,ia as ia$1,ha,B as B$1,$a as $a$1,ce as ce$1,Wd as Wd$2,tf as tf$1,Hb as Hb$2,qe,Kc as Kc$2}from'./chunk-CF3JR35B.js';import {a}from'./chunk-GOEBQ26R.js';import {zipSync,strToU8}from'fflate';import {createT,en as en$1,locales,deepMerge}from'@docx-editor.dev/i18n';function bI(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var Ag=false;function Mg(e){if(Ag)return;Ag=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 mo(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:bI(e.request),diagnostic:e.diagnostic});if(e instanceof y)return new a("overLimit",e.message,{diagnostic:e.message});if(e instanceof t){let t=e.code==="wasmUnavailable"||e.code==="shapingLibraryMismatch"?"wasmUnavailable":"initializationFailed";return new a(t,e.message,{diagnostic:e.diagnostic??e.message,cause:e})}return new a("initializationFailed",e instanceof Error?e.message:"Font initialization failed",{diagnostic:e instanceof Error?e.message:String(e)})}async function La(e,t){try{return await F(e,t)}catch(n){throw mo(n)}}var vI=Object.freeze({scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false,collaborationStatus:"inactive"});var Lg="http://schemas.openxmlformats.org/wordprocessingml/2006/main",SI="http://schemas.openxmlformats.org/package/2006/content-types",Ng="http://schemas.openxmlformats.org/package/2006/relationships",wI="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",II="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",kI=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${SI}"><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>`,TI=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Ng}"><Relationship Id="rId1" Type="${wI}" Target="word/document.xml"/></Relationships>`,PI=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Ng}"><Relationship Id="rId1" Type="${II}" Target="styles.xml"/></Relationships>`,RI=[{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}],CI=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>",EI=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${Lg}"><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>`+RI.map(CI).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>',FI=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${Lg}"><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>`;function kd(){return zipSync({"[Content_Types].xml":strToU8(kI),"_rels/.rels":strToU8(TI),"word/_rels/document.xml.rels":strToU8(PI),"word/document.xml":strToU8(FI),"word/styles.xml":strToU8(EI)})}var go="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",OI=(()=>{let e=new Int16Array(128).fill(-1);for(let t=0;t<go.length;t+=1)e[go.charCodeAt(t)]=t;return e})();function rs(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 d=0,u=0;for(let p=0;p<4;p+=1){let f=r.charCodeAt(l+p);if(f===61){if(l+p<r.length-o)return null;continue}let g=f<128?OI[f]:-1;if(g<0)return null;d=d<<6|g,u+=6;}d<<=24-u,u>=12&&(i[s++]=d>>>16&255),u>=18&&(i[s++]=d>>>8&255),u>=24&&(i[s++]=d&255);}return s===a?i:null}function os(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+=go[o>>2]+go[(o&3)<<4|a>>4],n+=r+1<e.length?go[(a&15)<<2|i>>6]:"=",n+=r+2<e.length?go[i&63]:"=",n.length>=32768&&(t.push(n),n="");}return t.push(n),t.join("")}var AI=16*1024*1024,Hg=64*1024*1024,_g="data-docx-fragment",Bg="data-docx-fragment-end",MI=os;function $g(e,t){if(!t)return `<div>${e}</div>`;let n=t.lastMarkCovered?"covered":"open";return `<div ${_g}="${MI(t.bytes)}" ${Bg}="${n}">${e}</div>`}function Dg(e,t){let n=`${t}="`,r=e.indexOf(n);if(r===-1||r>Hg)return null;let o=r+n.length,a=e.indexOf('"',o);return a===-1?null:e.slice(o,a)}function as(e,t=AI){if(e.length>Hg)return null;let n=Dg(e,_g);if(n===null||n.length===0)return null;let r=rs(n,t);if(r===null||r.byteLength===0)return null;let o=Dg(e,Bg);return {bytes:r,lastMarkCovered:o==="covered"}}function Dr(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}var Pd=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble"],Td={Normal:"MsoNormal",ListParagraph:"MsoListParagraph",Title:"MsoTitle",Subtitle:"MsoSubtitle",Caption:"MsoCaption",Quote:"MsoQuote",IntenseQuote:"MsoIntenseQuote",BodyText:"MsoBodyText",FootnoteText:"MsoFootnoteText"},Rd=new Map([...Object.entries(Td).filter(([e])=>e!=="Normal").map(([e,t])=>[t,e]),["MsoListParagraphCxSpFirst","ListParagraph"],["MsoListParagraphCxSpMiddle","ListParagraph"],["MsoListParagraphCxSpLast","ListParagraph"]]);function qg(e){return e===void 0?null:/^Heading[7-9]$/.test(e)?`Mso${e}`:Object.hasOwn(Td,e)?Td[e]:null}var Cd=Object.fromEntries(k),Ed={left:"left",start:"left",center:"center",right:"right",end:"right",both:"justify",distribute:"justify"};function Zg(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:`"${Q(n)}"`}var LI=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 Hr(e){if(e===null)return null;let t=Ge$1(e,"val",da$1);if(t===void 0||t==="nil"||t==="none")return null;let n=LI.get(t)??"solid",r=Ge$1(e,"sz",da$1),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=Ge$1(e,"color",da$1),l=s!==void 0&&/^[0-9A-Fa-f]{6}$/.test(s)?`#${s}`:"#000000";return `${i} ${n} ${l.toLowerCase()}`}function Kg(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 NI=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"]]),DI=new Set(Pd);function Vg(e){if(e===null)return [];let t=Ge$1(e,"val",da$1),n=[],r=t===void 0?void 0:NI.get(t);r!==void 0&&n.push(`text-decoration-style:${r}`),t!==void 0&&t!=="single"&&DI.has(t)&&n.push(`text-underline:${t}`);let o=Ge$1(e,"color",da$1);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 zg(e,t){return e===null||e<=0?"":`height:${Math.round(e/20*100)/100}pt;mso-height-rule:${t==="exact"?"exactly":"at-least"}`}function jg(e,t,n,r){if(e.namespaceUri!==da$1)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=Ge$1(e,"id",da$1),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 d=i==="footnote",u=o!==null,p=d?"MsoFootnoteReference":"MsoEndnoteReference",f=d?"ftn":"edn",g=u?`#_${f}ref${l}`:`#_${f}${l}`,y=u?`_${f}${l}`:`_${f}ref${l}`;return `<a style="mso-${d?"footnote":"endnote"}-id:${f}${l}" href="${g}" name="${y}"><span class="${p}"><span style="mso-special-character:footnote">[${n(i,l)}]</span></span></a>`}function Wg(e){if(e.namespaceUri!==da$1||e.localName!=="ptab")return "";let t=Ge$1(e,"alignment",da$1),n=Ge$1(e,"relativeTo",da$1),r=Ge$1(e,"leader",da$1)??"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 it(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 Xg(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 Yg(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=Rd.get(r);if(i!==void 0)return i}if(e.classList.contains("docx-outline"))return;let n=t?/^h([1-6])$/.exec(Je(e)):null;return n?`Heading${n[1]}`:void 0}var Qg=262144,HI=4096,_I=256,BI=2048,$I=8,qI=new Set(["MsoNormal",...Rd.keys(),...Array.from({length:9},(e,t)=>`MsoHeading${t+1}`),...Array.from({length:9},(e,t)=>`Heading${t+1}`)]),ZI=new Map([["left","left"],["start","left"],["center","center"],["right","right"],["end","right"],["justify","both"]]),KI=/^\s*(p|li|div)\.([A-Za-z][A-Za-z0-9]{0,31})\s*$/i;function VI(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 zI(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 jI(e,t){for(let n=t+1;n<e.length;n+=1){let r=e[n];if(r===";")return n+1;if(r==="{")return zI(e,n)}return null}function WI(e){let t=e.split(",");if(t.length===0||t.length>$I)return null;let n=[];for(let r of t){let o=KI.exec(r);if(!o)return null;let a=o[2];if(!qI.has(a))return null;n.includes(a)||n.push(a);}return n}function UI(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=ZI.get(a.slice(0,i));s!==void 0&&(t=s);}return t}function GI(e){let t=new Map,n=()=>({ok:false,alignments:new Map});if(e.length===0)return {ok:true,alignments:t};if(e.length>Qg)return n();let r=VI(e),o=0,a=0;for(;o<r.length&&a<HI;){for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;if(o>=r.length)break;if(r[o]==="@"){let f=jI(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 d=r.slice(i+1,l);if(a+=1,o=l+1,s.length>_I||d.length>BI||d.includes("{"))return n();let u=WI(s),p=UI(d);if(!(!u||p===void 0))for(let f of u)t.set(f,p);}for(;o<r.length&&r.charCodeAt(o)<=32;)o+=1;return o<r.length?n():{ok:true,alignments:t}}function Jg(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>Qg)return new Map;let a=GI(o);if(!a.ok)return new Map;for(let[i,s]of a.alignments)t.set(i,s);}return t}var XI=262144;function eh(e,t=XI){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 th(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 Fd(e,t,n,r){let o=it(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 ho(e){return e.nodeType===1}function Je(e){return e.tagName.toLowerCase()}var YI=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(":"))),QI=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"]]),JI=/url\s*\(|image\s*\(|image-set\s*\(|element\s*\(|cross-fade\s*\(/i,ek=new Map(Pd.map(e=>[e.toLowerCase(),e])),Ug=new WeakMap;function Ue(e){let t=Ug.get(e);if(t!==void 0)return t;let n=new Map;Ug.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&&(n.delete(i),n.set(i,s));}return n}function dr(e){let t=e.trim().toLowerCase(),n=YI.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 tk(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!(t.length===0||t.length>32||/[^a-z]/.test(t)))return QI.get(t)}function Gg(e){if(e===void 0)return null;let t=e.trim();if(t.length===0||t.length>128||JI.test(t))return null;let n=t.toLowerCase();return n==="transparent"||n==="none"?null:dr(t)}function Ut(e,t,n){return Math.min(n,Math.max(t,e))}function ss(e){let t=null;for(let[n,r]of e)if(n==="background")t=Gg(r);else if(n==="background-color"){let o=r.trim().toLowerCase();if(o==="transparent"||o==="none"||o==="initial"){t=null;continue}let a=Gg(r);a!==null&&(t=a);}return t}var nk=new Set(["left","center","right","decimal","bar"]),rk=new Map([["dotted","dot"],["dot","dot"],["dashed","hyphen"],["hyphen","hyphen"],["lined","underscore"],["underscore","underscore"],["middledot","middleDot"],["heavy","heavy"]]);function ok(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(nk.has(o)){t=o;continue}if(o==="list"){t="left";continue}let a=rk.get(o);if(a!==void 0){n=a;continue}let i=it(o);if(!(i===null||i<0)){if(r.push({val:t,posTwips:Ut(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 ak=new Map([["solid","single"],["single","single"],["double","double"],["dotted","dotted"],["dashed","dashed"]]);function Od(e){return e.trim().replace(/\([^)]*\)/g,t=>t.replace(/\s+/g,"")).split(/\s+/)}var ik=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function is(e){if(e===void 0||e.length===0||e.length>128)return;let t,n=false,r,o;for(let a of Od(e)){let i=a.toLowerCase();if(i==="none"||i==="hidden"){n=true;continue}let s=ak.get(i);if(s!==void 0){t=s;continue}let l=ik.get(a.toLowerCase())??it(a);if(l!==null){r=l;continue}let d=dr(a);if(d!==null){o=d;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:Ut(Math.round(r*8),2,96),color:o??"000000"}}function ls(e){let t=e.getAttribute("style");return t?/mso-list\s*:[^;]{0,128}ignore/i.test(t.slice(0,8192)):false}function Ad(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 Md(e,t){if(t.size===0)return e;let n={...e},r=t.get("font-weight")?.toLowerCase();if(r!==void 0){let P=Number.parseInt(r,10);r==="bold"||P>=600?n.bold=true:(r==="normal"||P<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 P of l.trim().split(/\s+/)){let F=P.toLowerCase(),R=ek.get(F);if(R!==void 0)n.underline=true,n.underlineVal=R;else {let H=dr(P);H!==null&&(n.underlineColor=H);}}let d=t.get("text-decoration-style")?.trim().toLowerCase();if(d==="double"&&n.strike&&!n.underline&&(n.doubleStrike=true),n.underline){d==="double"?n.underlineVal="double":d==="dotted"?n.underlineVal="dotted":d==="dashed"?n.underlineVal="dash":d==="wavy"&&(n.underlineVal="wave");let P=dr(t.get("text-decoration-color")??"");P!==null&&(n.underlineColor=P);}let u=dr(t.get("color")??"");u&&(n.color=u);let p=tk(t.get("mso-highlight"));if(p)n.highlight=p,delete n.shdFill;else {let P=ss(t);P&&(n.shdFill=P);}let f=it(t.get("font-size")??"");f!==null&&f>0&&(n.szHalfPoints=Ut(Math.round(f*2),2,3276));let g=t.get("font-family");if(g!==void 0){let P=g.split(",")[0].trim().replace(/^['"]|['"]$/g,"");P.length>0&&P.length<=64&&(n.font=P);}let y=it(t.get("letter-spacing")??"");y!==null&&(n.charSpacingTwentieths=Ut(Math.round(y*20),-31680,31680));let w=t.get("vertical-align")?.trim().toLowerCase();w==="sub"?n.vertAlign="subscript":w==="super"&&(n.vertAlign="superscript");let x=Dr(t.get("mso-ansi-language")),b=Dr(t.get("mso-fareast-language")),k=Dr(t.get("mso-bidi-language"));return x!==null&&(n.langVal=x),b!==null&&(n.langEastAsia=b),k!==null&&(n.langBidi=k),t.get("direction")?.trim().toLowerCase()==="rtl"&&(n.rtl=true),n}function Da(e,t){let n=Md(e,Ue(t)),r=Dr(t.getAttribute("lang"));return r!==null&&(n={...n,lang:r}),t.getAttribute("dir")?.trim().toLowerCase()==="rtl"&&(n={...n,rtl:true}),n}function nh(e,t){let n=t.get("text-align")?.toLowerCase();n==="left"||n==="start"?e.jc="left":n==="center"?e.jc="center":n==="right"||n==="end"?e.jc="right":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(k=>it(k));if(b.length>=1&&b.length<=4&&!b.some(k=>k===null)){let[k,P=k,F=k,R=P]=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=k??null,r.right=P??null,r.bottom=F??null,r.left=R??null;}}let a=it(t.get("margin-left")??"")??r.left;a!==null&&(a>0||a===0&&!e.numPr)&&(e.indLeftTwips=Ut(Math.round(a*20),0,31680));let i=it(t.get("margin-right")??"")??r.right;i!==null&&i>=0&&(e.indRightTwips=Ut(Math.round(i*20),0,31680));let s=it(t.get("text-indent")??"");if(s!==null&&s!==0){let b=Ut(Math.round(s*20),-31680,31680);b!==0&&(e.firstLineTwips=b);}let l=it(t.get("margin-top")??"")??r.top;l!==null&&l>=0&&(e.spacingBeforeTwips=Ut(Math.round(l*20),0,31680));let d=it(t.get("margin-bottom")??"")??r.bottom;d!==null&&d>=0&&(e.spacingAfterTwips=Ut(Math.round(d*20),0,31680));let u=t.get("line-height")?.trim()??"",p=t.get("mso-line-height-rule")?.trim().toLowerCase(),f=it(u);if(f!==null&&f>0)e.lineTwentieths=Ut(Math.round(f*20),24,31680),e.lineRule=p==="exactly"?"exact":"atLeast";else if(/^\d+(\.\d+)?$/.test(u)&&Number.parseFloat(u)>0)e.lineTwentieths=Ut(Math.round(240*Number.parseFloat(u)),24,9600),e.lineRule="auto";else if(/^\d+(\.\d+)?%$/.test(u)){let b=Number.parseFloat(u);b>0&&(e.lineTwentieths=Ut(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 g=ss(t);g&&(e.shdFill=g);let y=ok(t.get("tab-stops"));y!==void 0&&(e.tabs=y);let w=is(t.get("mso-border-alt"))??is(t.get("border")),x={};for(let b of ["top","left","bottom","right"]){let k=is(t.get(`mso-border-${b}-alt`))??is(t.get(`border-${b}`))??w;k!==void 0&&k!=="suppressed"&&(x[b]=k);}Object.keys(x).length>0&&(e.borders=x);}var sk="http://schemas.openxmlformats.org/drawingml/2006/picture",lk=/^data:image\/(?:png|jpeg|jpg|gif|bmp|webp|svg\+xml|tiff|tif|x-emf|emf|x-wmf|wmf);base64,([A-Za-z0-9+/=]+)$/i,dk=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 rh(e,t,n){return Math.min(n,Math.max(t,e))}function oh(e,t,n,r){let o=e.getAttribute("src");if(o===null||o.length>n.maxImageBytes*2)return;let a=lk.exec(o);if(!a)return;let i=n.mediaBySrc.get(o),s=i===void 0?void 0:n.media.get(i),l=s??rs(a[1],n.maxImageBytes);if(l==null)return;let d=tb$1(l),u=dk.get(d);if(u===void 0)return;let p=d==="image/png"||d==="image/jpeg"||d==="image/gif"||d==="image/bmp"||d==="image/webp"?yb$2(l,d):null,f=Ue(e),g=Fd(e,f,"width",n.wordHtml),y=Fd(e,f,"height",n.wordHtml);p!==null?g===null&&y===null?(g=p.pixelWidth*96/(p.dpiX??96),y=p.pixelHeight*96/(p.dpiY??96)):g!==null&&y===null?y=g*p.pixelHeight/p.pixelWidth:g===null&&y!==null&&(g=y*p.pixelWidth/p.pixelHeight):g!==null&&y===null?y=g*2/3:g===null&&y!==null&&(g=y*3/2);let w=g===null?381e4:rh(Math.round(g*9525),9525,3e7),x=y===null?254e4:rh(Math.round(y*9525),9525,3e7),b=s===void 0?void 0:i;b===void 0&&(n.imageCount+=1,b=`word/media/image${n.imageCount}.${u}`,n.media.set(b,l),n.mediaBySrc.set(o,b),n.mediaExtensions.has(u)||n.mediaExtensions.set(u,d));let k=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="${w}" cy="${x}"/><wp:docPr id="${n.docPrId}" name=""/><wp:cNvGraphicFramePr/><a:graphic><a:graphicData uri="${sk}"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="" descr=""/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${k}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${w}" cy="${x}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`);}var ck="http://schemas.openxmlformats.org/wordprocessingml/2006/main",uk='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',ah=[{text:"\uF0B7",font:"Symbol"},{text:"o",font:"Courier New"},{text:"\uF0A7",font:"Wingdings"}];function ih(e,t,n){let r=720*(n+1);if(e==="bullet"){let a=ah[n%ah.length];return `<w:lvl w:ilvl="${n}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${N(a.text)}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${r}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="${a.font}" w:hAnsi="${a.font}" w:hint="default"/></w:rPr></w:lvl>`}let o=e==="lowerRoman"||e==="upperRoman";return `<w:lvl w:ilvl="${n}"><w:start w:val="${t}"/><w:numFmt w:val="${e}"/><w:lvlText w:val="%${n+1}."/><w:lvlJc w:val="${o?"right":"left"}"/><w:pPr><w:ind w:left="${r}" w:hanging="${o?180:360}"/></w:pPr></w:lvl>`}var fk=new Map([["i",1],["v",5],["x",10],["l",50],["c",100],["d",500],["m",1e3]]),pk=new Map([["alpha-lower","lowerLetter"],["alpha-upper","upperLetter"],["roman-lower","lowerRoman"],["roman-upper","upperRoman"],["bullet","bullet"],["image","bullet"],["decimal","decimal"],["arabic","decimal"]]),sh=/@list\s+l(\d{1,4}):level([1-9])(?:[\s:]+lfo(\d{1,4}))?\s*\{([^{}]{0,2048})\}/g;function lh(e){let t=new Map;if(e.length===0||e.length>262200)return t;sh.lastIndex=0;let n,r=0;for(;(n=sh.exec(e))!==null&&r<512;){r+=1;let o="decimal",a=null;for(let s of n[4].split(";")){let l=s.indexOf(":");if(l<=0)continue;let d=s.slice(0,l).trim().toLowerCase(),u=s.slice(l+1).trim().toLowerCase();d==="mso-level-number-format"?o=pk.get(u)??null:d==="mso-level-start-at"&&/^\d{1,5}$/.test(u)&&(a=Math.min(32767,Number.parseInt(u,10)));}if(o===null)continue;let i=n[3]===void 0?`l${n[1]}:level${n[2]}`:`l${n[1]}:level${n[2]}:lfo${n[3]}`;t.has(i)||t.set(i,{kind:o,start:a});}return t}function dh(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?ch(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 mk=/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/;function ch(e){let t=e.toLowerCase();if(!mk.test(t))return null;let n=0,r=0;for(let o of t){let a=fk.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 uh(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 d=ch(i);if(d!==null)return {kind:s?"lowerRoman":"upperRoman",start:d}}if(l){let d=i.toLowerCase().charCodeAt(0),u=Math.min(32767,(i.length-1)*26+(d-96));return {kind:s?"lowerLetter":"upperLetter",start:u}}}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 gk=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 fh(e){if(e.localName.toLowerCase()!=="ol")return "bullet";let t=Ue(e).get("list-style-type")?.trim().toLowerCase(),n=t===void 0?void 0:gk.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 Ld(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 ph(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 d=r.levels.get(l);return d?ih(d.kind,d.start,l):ih(a.kind==="bullet"?"bullet":"decimal",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 `${uk}<w:numbering xmlns:w="${ck}">${t}${n}</w:numbering>`}function dn(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 mh(e){if(e===null)return false;if(e.startsWith("#"))return dn(e.slice(1))!==null;let t=L(e);return t?.ok===true&&t.href.length>0}function gh(e,t){if(e!==void 0&&e.startsWith("#")){let o=dn(e.slice(1)),a=dn(t)??o;return a===null?null:`#${a}`}let n=e===void 0?null:L(e),r=dn(t);return n?.ok===true&&n.href.length>0?r===null?n.href:`${n.href.split("#")[0]}#${r}`:r===null?null:`#${r}`}function hh(){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,setTimeout(()=>{e===a&&(e=null);},0),o}}var hk=/^(ftn|edn)([1-9]\d{0,9})$/i,yk={footnote:"ftn",endnote:"edn"};function yh(e,t){let n=e===null?null:hk.exec(e);if(!n||n[1].toLowerCase()!==yk[t])return null;let r=Number.parseInt(n[2],10);return r<=2147483647?r:null}function Nd(e){for(let t of ["footnote","endnote"]){let n=e.get(`mso-${t}-id`),r=yh(n??null,t);if(r!==null)return {kind:t,id:r}}return null}function bk(e,t){let n=t.get("mso-element")?.trim().toLowerCase();if(n!=="footnote"&&n!=="endnote")return null;let r=yh(e.getAttribute("id"),n);return r===null?null:{kind:n,id:r}}function bh(e){let t=[],n=e.getElementsByTagName("div");for(let r=0;r<n.length&&t.length<2048;r+=1){let o=n[r],a=bk(o,Ue(o));a!==null&&t.push({...a,element:o});}return t}function vh(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 d=r.get(s);if(d!==void 0)return d;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=Nd(Ue(s));if(l===null)continue;let d=o(s);d!==null&&d.kind===l.kind&&d.id===l.id||n[l.kind].add(l.id);}}function xh(e){let t=e.get("mso-element")?.trim().toLowerCase();return t==="footnote-list"||t==="endnote-list"}var vk=/<w:r>(?:<w:rPr>(?:(?!<\/w:r>)[\s\S])*?<\/w:rPr>)?<w:(footnote|endnote)Reference w:id="(\d{1,10})"\/><\/w:r>/g;function yo(e,t,n){return e.replace(vk,(r,o,a)=>{let i=`${o}:${a}`;return t.has(i)?n?.get(i)??"":r})}function Dd(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">${n}</w:${e}s>`}function Sh(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=(d,u)=>{o.has(`${d}:${u}`)||!e.notes[d].has(u)||a[d].has(u)||(a[d].add(u),s.push({kind:d,id:u}));};for(let d of ["footnote","endnote"])for(let u of e.bodyNoteRefs[d])l(d,u);for(let d of o)for(let u of e.noteNoteRefs.get(d)??[])l(u.kind,u.id);for(;s.length>0;){let d=s.pop();for(let u of e.noteNoteRefs.get(`${d.kind}:${d.id}`)??[])l(u.kind,u.id);}};for(;;){i();let s=false;for(let l of ["footnote","endnote"]){for(let d of e.notes[l].keys()){let u=`${l}:${d}`;if(!(a[l].has(d)||o.has(u))){o.add(u),s=true;break}}if(s)break}if(!s)break}if(o.size>0)for(let s of ["footnote","endnote"])for(let[l,d]of e.notes[s])o.has(`${s}:${l}`)||e.notes[s].set(l,d.map(u=>yo(u,o,e.noteMarkFallbacks)));for(let s of ["footnote","endnote"])for(let[l,d]of [...e.notes[s]]){if(!o.has(`${s}:${l}`))continue;e.notes[s].delete(l),t[s].delete(l);let u=new Map;for(let p of d){let f=yo(p.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,(g,y,w)=>{let x=u.get(w);if(x===void 0){let b=e.noteRels[s].find(k=>k.id===w);if(b===void 0)return g;x=r(e,b.type,b.target,b.external),u.set(w,x);}return ` r:${y}="${x}"`});n.push(f),e.lastMarkCovered=false;}}}function Hd(e,t,n,r=1,o=0){let a=e.lists.get(t);if(a)return a.levels.has(o)||a.levels.set(o,{kind:n,start:r}),a.numId;let i=String(1001+e.lists.size),s={numId:i,levels:new Map([[o,{kind:n,start:r}]])};return e.lists.set(t,s),e.listsByNumId.set(i,s),i}function wh(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=xk(e,n),l=/\blfo(\d{1,4})\b/i.exec(o),d=(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]}`),u,p;d!==void 0?(u=d.kind,p=dh(s,u)??d.start??1):{kind:u,start:p}=uh(s);let g=`mso:${r===void 0?"":`${r.kind}${r.id}:`}l${a[1]}${l?`:lfo${l[1]}`:""}`;return {numId:Hd(n,g,u,p,i),ilvl:i}}function xk(e,t){let n="",r=(o,a)=>{if(!(n.length>0||a>8||t.nodesLeft<=0)&&ho(o)){if(ls(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 Sk="http://schemas.openxmlformats.org/package/2006/relationships",wk="http://schemas.openxmlformats.org/package/2006/content-types",Ik="application/vnd.openxmlformats-package.relationships+xml",$d='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',kk="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Bd="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Tk="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",Pk="http://schemas.openxmlformats.org/drawingml/2006/main",Rk="http://schemas.openxmlformats.org/drawingml/2006/picture",Ih={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 _d(e){let t=e.map(n=>`<Relationship Id="${N(n.id)}" Type="${N(n.type)}" Target="${N(n.target)}"${n.external?' TargetMode="External"':""}/>`).join("");return `${$d}<Relationships xmlns="${Sk}">${t}</Relationships>`}function Ck(e){let t=new Map;t.set("word/document.xml",Oa(e.documentXml)),t.set("word/_rels/document.xml.rels",Oa(_d(e.rels))),t.set("_rels/.rels",Oa(_d([{id:"rId1",type:`${Bd}/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="${Ih.document}"/>`;for(let[a,i]of n)i!==void 0&&(t.set(`word/${a}.xml`,Oa(i)),r+=`<Override PartName="/word/${a}.xml" ContentType="${Ih[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`,Oa(_d(i)));for(let[a,i]of e.media)t.set(a,i);let o=`<Default Extension="rels" ContentType="${Ik}"/><Default Extension="xml" ContentType="application/xml"/>`;for(let[a,i]of e.mediaExtensions)o+=`<Default Extension="${N(a)}" ContentType="${N(i)}"/>`;return t.set("[Content_Types].xml",Oa(`${$d}<Types xmlns="${wk}">${o}${r}</Types>`)),Ra(t)}function kh(e){let t=[...e.rels],n=o=>{t.push({id:`rId${t.length+1}`,type:`${Bd}/${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=`${$d}<w:document xmlns:w="${kk}" xmlns:r="${Bd}" xmlns:wp="${Tk}" xmlns:a="${Pk}" xmlns:pic="${Rk}"><w:body>${e.blocks.join("")}</w:body></w:document>`;return Ck({documentXml:r,rels:t,...e.lists.length>0?{numberingXml:ph(e.lists)}:{},...e.notes.footnote.size>0?{footnotesXml:Dd("footnote",e.notes.footnote),footnotesRels:e.noteRels.footnote}:{},...e.notes.endnote.size>0?{endnotesXml:Dd("endnote",e.notes.endnote),endnotesRels:e.noteRels.endnote}:{},media:e.media,mediaExtensions:e.mediaExtensions})}function qd(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}function cr(e){let t="";if(e.rStyle!==void 0&&(t+=`<w:rStyle w:val="${N(e.rStyle)}"/>`),e.font!==void 0){let i=N(qd(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="${N(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="${N(n)}"`}${r===void 0?"":` w:eastAsia="${N(r)}"`}${o===void 0?"":` w:bidi="${N(o)}"`}`;return a.length>0&&(t+=`<w:lang${a}/>`),t.length>0?`<w:rPr>${t}</w:rPr>`:""}function ds(e,t){return `<w:r>${cr(t)}<w:t xml:space="preserve">${M(qd(e))}</w:t></w:r>`}function Ek(e){let t="";if(e.styleId!==void 0&&(t+=`<w:pStyle w:val="${N(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="${N(e.numPr.numId)}"/></w:numPr>`),e.borders!==void 0){let r="";for(let o of ["top","left","bottom","right"]){let a=e.borders[o];a!==void 0&&(r+=`<w:${o} w:val="${a.val}" w:sz="${a.szEighthPoints}" w:space="0" w:color="${a.color}"/>`);}r.length>0&&(t+=`<w:pBdr>${r}</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(r=>`<w:tab w:val="${r.val}" w:pos="${r.posTwips}"`+(r.leader===void 0?"/>":` w:leader="${r.leader}"/>`)).join("")}</w:tabs>`),e.bidi&&(t+="<w:bidi/>"),e.spacingBeforeTwips!==void 0||e.spacingAfterTwips!==void 0||e.lineTwentieths!==void 0){let r="<w:spacing";e.spacingBeforeTwips!==void 0&&(r+=` w:before="${e.spacingBeforeTwips}"`),e.spacingAfterTwips!==void 0&&(r+=` w:after="${e.spacingAfterTwips}"`),e.lineTwentieths!==void 0&&(r+=` w:line="${e.lineTwentieths}" w:lineRule="${e.lineRule??"auto"}"`),t+=`${r}/>`;}let n=e.firstLineTwips;if(e.indLeftTwips!==void 0||e.indRightTwips!==void 0||n!==void 0){let r="<w:ind";e.indLeftTwips!==void 0&&(r+=` w:left="${e.indLeftTwips}"`),e.indRightTwips!==void 0&&(r+=` w:right="${e.indRightTwips}"`),n!==void 0&&(r+=n>=0?` w:firstLine="${n}"`:` w:hanging="${-n}"`),t+=`${r}/>`;}return e.jc!==void 0&&(t+=`<w:jc w:val="${e.jc}"/>`),t.length>0?`<w:pPr>${t}</w:pPr>`:""}function _r(e,t){return `<w:p>${Ek(e)}${t.join("")}</w:p>`}var Ph={h1:64,h2:52,h3:44,h4:36,h5:32,h6:28};function cs(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 Fk=/^(?:<w:bookmark(?:Start|End)\b[^>]*\/>)+$/,Th=new WeakMap;function Zd(e){let t=Th.get(e);for(t||(t={checked:0,furniture:true},Th.set(e,t));t.furniture&&t.checked<e.length;)t.furniture=Fk.test(e[t.checked]),t.checked+=1;return t.furniture}function cn(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var ur=31680;function qn(e,t,n){return Math.min(n,Math.max(t,e))}function Rh(e){let t=it(Ue(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 Ok(e){return Br(e,"colspan",63)}function Ch(e){return Array.from(e.children).flatMap(t=>{let n=Je(t);return n==="tr"?[t]:n!=="thead"&&n!=="tbody"&&n!=="tfoot"?[]:Array.from(t.children).filter(r=>Je(r)==="tr")})}function Br(e,t,n){let r=e.getAttribute(t);return r===null||!/^\d{1,4}$/.test(r.trim())?1:qn(Number.parseInt(r,10),1,n)}function Eh(e,t){let n=(Ue(e).get("width")??e.getAttribute("width")??"").trim(),r=/^(\d{1,3}(?:\.\d+)?)%$/.exec(n);if(r)return {xml:`<w:tblW w:w="${qn(Math.round(Number.parseFloat(r[1])*50),50,5e3)}" w:type="pct"/>`,twips:t};let o=Rh(e);if(o===null)return {xml:'<w:tblW w:w="0" w:type="auto"/>',twips:t};let a=qn(Math.round(o*20),1,ur);return {xml:`<w:tblW w:w="${a}" w:type="dxa"/>`,twips:a}}function Fh(e){let n=Ue(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 Oh(e){let t=Ue(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=it(i??"");l!==null&&(a+=` w:tblpX="${qn(Math.round(l*20),-ur,ur)}"`);}let s=it(t.get("mso-table-top")??"");return s!==null&&(a+=` w:tblpY="${qn(Math.round(s*20),-ur,ur)}"`),`<w:tblpPr${a}/>`}function Ah(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 u of e){let p=Array.from({length:t},()=>r),f=0,g=0,y=i.map(b=>b?b.span:null);for(let b=0;b<t;b+=1){let k=i[b];k&&(k.remaining-=1,k.remaining<=0&&(i[b]=null));}let w=Array.from(u.children).filter(b=>/^t[dh]$/.test(Je(b))),x=0;for(;g<t;){let b=y[g];if(b!==null){g+=b;continue}let k=w[x];if(k===void 0)break;x+=1;let P=Math.min(Ok(k),t-g);for(let H=g+1;H<g+P;H+=1)if(y[H]!==null){P=H-g;break}let F=Br(k,"rowspan",1e3);F>1&&(i[g]={remaining:F-1,span:P});let R=Rh(k);if(R!==null){let H=qn(Math.round(R*20/P),1,ur);for(let L=0;L<P;L+=1)p[g+L]=H;f+=P;}g+=P;}f>o&&(o=f,a=p);}let s=a.reduce((u,p)=>u+p,0);if(s<=0)return a;let l=a.map(u=>Math.max(1,Math.round(u*n/s))),d=n-l.reduce((u,p)=>u+p,0);return l[l.length-1]=Math.max(1,l[l.length-1]+d),l}function Kd(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 Mh=new Map([["solid","single"],["double","double"],["dotted","dotted"],["dashed","dashed"],["none","nil"],["hidden","nil"]]),Lh=new Map([["thin",.75],["medium",2.25],["thick",3.75]]);function Nh(e){return qn(Math.round(e*8),2,96)}function kn(e){if(e===void 0||e.length===0||e.length>128)return;let t,n,r;for(let o of Od(e)){let a=Mh.get(o.toLowerCase());if(a!==void 0){t=a;continue}let i=Lh.get(o.toLowerCase())??it(o);if(i!==null){n=i;continue}let s=dr(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:Nh(n),color:r??"000000"}}}function us(e,t){let n=e.get(`${t}-style`)?.trim();if(n===void 0||n.length===0||n.length>64)return;let r=Mh.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:Lh.get(o.toLowerCase())??it(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:dr(i);return {val:r,size:a===null?4:Nh(a),color:s??"000000"}}function Dh(e,t){return `<w:${e} w:val="${t.val}" w:sz="${t.size}" w:space="0" w:color="${t.color}"/>`}function Hh(e,t=false){let n=Ue(e),o=kn(n.get("mso-border-alt"))??kn(n.get("border"))??us(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 d=cn(l,t),u=kn(n.get(`mso-border-${d}-alt`))??kn(n.get(`mso-border-${d}`))??kn(n.get(`border-${d}`))??us(n,`border-${d}`)??o;u!==void 0&&(i+=Dh(s,u));}return i.length>0?`<w:tblBorders>${i}</w:tblBorders>`:""}function _h(e){let t=Ue(e),n=it(t.get("height")??"");if(n===null||n<=0)return "";let r=qn(Math.round(n*20),1,ur),a=t.get("mso-height-rule")?.trim().toLowerCase()==="exactly"?"exact":"atLeast";return `<w:trPr><w:trHeight w:val="${r}" w:hRule="${a}"/></w:trPr>`}function Ak(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=>it(i));if(a.length>=1&&a.length<=4&&!a.some(i=>i===null||i<0)){let[i,s=i,l=i,d=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=d??null;}}for(let a of ["top","right","bottom","left"]){let i=it(e.get(`padding-${a}`)??"");i!==null&&i>=0&&(n[a]=i);}let o="";for(let a of ["top","left","bottom","right"]){let i=cn(a,t),s=n[i];s!==null&&(o+=`<w:${a} w:w="${qn(Math.round(s*20),0,ur)}" w:type="dxa"/>`);}return o.length>0?`<w:tcMar>${o}</w:tcMar>`:""}function Bh(e,t=false){let n=Ue(e),r=kn(n.get("mso-border-alt"))??kn(n.get("border"))??us(n,"border"),o="";for(let l of ["top","left","bottom","right"]){let d=cn(l,t),u=kn(n.get(`mso-border-${d}-alt`))??kn(n.get(`mso-border-${d}`))??kn(n.get(`border-${d}`))??us(n,`border-${d}`)??r;u!==void 0&&(o+=Dh(l,u));}let a=o.length>0?`<w:tcBorders>${o}</w:tcBorders>`:"",i=ss(n);i&&(a+=`<w:shd w:val="clear" w:color="auto" w:fill="${i}"/>`),a+=Ak(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 Mk=9360;function $h(e,t,n,r,o,a){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;r.nodesLeft-=1;for(let L of Array.from(e.children))Je(L)==="caption"&&a(Array.from(L.childNodes),t+1,n,r,o,true);let i=Ch(e);if(i.length===0)return;let s=1,l=r.nodesLeft,d=[];for(let L of i){if(l<=0||s>=63)break;let S=d.map($=>$?$.span:null);for(let $=0;$<d.length;$+=1){let X=d[$];X&&(X.remaining-=1,X.remaining<=0&&(d[$]=null));}let T=Array.from(L.children).filter($=>/^t[dh]$/.test(Je($))),E=0,D=0;for(;D<63&&(l-=1,!(l<=0));){let $=D<S.length?S[D]:null;if($!=null){D+=$;continue}let X=T[E];if(X===void 0)break;E+=1;let N=Math.min(Br(X,"colspan",63),63-D);for(let B=D+1;B<D+N;B+=1)if(B<S.length&&S[B]!=null){N=B-D;break}let _=Br(X,"rowspan",1e3);if(_>1){for(;d.length<=D;)d.push(null);d[D]={remaining:_-1,span:N};}D+=N;}for(let $=D;$<S.length&&$<63;$+=1){let X=S[$];X!=null&&(D=Math.max(D,$+X));}s=Math.max(s,D);}s=Math.min(Math.max(s,1),63);let u=Eh(e,Mk),p=u.twips,f=i.length>r.nodesLeft?i.slice(0,Math.max(1,r.nodesLeft)):i,g=Ah(f,s,p),w=(Ue(e).get("direction")??e.getAttribute("dir"))?.trim().toLowerCase()==="rtl",x=Hh(e,w),b=Oh(e),k=Fh(e)??(w?"left":void 0),P=k===void 0?"":`<w:jc w:val="${cn(k,w)}"/>`,F=g.map(L=>`<w:gridCol w:w="${L}"/>`).join(""),R=new Array(s).fill(null),H=[];for(let L of i){if(r.nodesLeft<=0){r.truncated=true;break}r.nodesLeft-=1;let S=R.map(N=>N?N.span:null);for(let N=0;N<s;N+=1){let _=R[N];_&&(_.remaining-=1,_.remaining<=0&&(R[N]=null));}let T=Array.from(L.children).filter(N=>/^t[dh]$/.test(Je(N))),E=0,D=[],$=0,X=true;for(;$<s;){if(r.nodesLeft-=1,r.nodesLeft<=0){r.truncated=true,X=false;break}let N=S[$];if(N!==null){let J=N>1?`<w:gridSpan w:val="${N}"/>`:"";D.push(`<w:tc><w:tcPr><w:tcW w:w="${Kd(g,$,N)}" w:type="dxa"/>${J}<w:vMerge/></w:tcPr><w:p/></w:tc>`),$+=N;continue}let _=T[E];if(_===void 0){D.push(`<w:tc><w:tcPr><w:tcW w:w="${g[$]}" w:type="dxa"/></w:tcPr><w:p/></w:tc>`),$+=1;continue}E+=1;let B=Math.min(Br(_,"colspan",63),s-$);for(let J=$+1;J<$+B;J+=1)if(S[J]!==null){B=J-$;break}let G=Br(_,"rowspan",1e3);G>1&&(R[$]={remaining:G-1,span:B}),D.push(Lk(_,B,Kd(g,$,B),G>1,t,n,r,a,w)),$+=B;}if(!X)break;H.push(`<w:tr>${_h(L)}${D.join("")}</w:tr>`);}H.length!==0&&(o.push(`<w:tbl><w:tblPr>${w?"<w:bidiVisual/>":""}${b}${u.xml}${P}${x}</w:tblPr><w:tblGrid>${F}</w:tblGrid>${H.join("")}</w:tbl>`),r.lastMarkCovered=false);}function Lk(e,t,n,r,o,a,i,s,l){let d=Je(e)==="th",u=`<w:tcW w:w="${n}" w:type="dxa"/>`;t>1&&(u+=`<w:gridSpan w:val="${t}"/>`),r&&(u+='<w:vMerge w:val="restart"/>'),u+=Bh(e,l);let p={run:d?{...a.run,bold:true}:a.run,para:d?{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,p,i,f,true),(f.length===0||f[f.length-1].endsWith("</w:tbl>"))&&f.push("<w:p/>"),`<w:tc><w:tcPr>${u}</w:tcPr>${f.join("")}</w:tc>`}function qh(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 Zh(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 Kh(e){if(Je(e)!=="br")return false;let t=Ue(e);return t.get("page-break-before")?.trim().toLowerCase()==="always"||t.get("break-before")?.trim().toLowerCase()==="page"}function Vh(e){if(Kh(e))return true;if(Je(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||!Kh(r))return false;t=true;}}return t}function zh(e){if(Je(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=Ue(e);for(let o of n.keys())if(o==="background"||o==="background-color"||o.startsWith("border"))return false;if(Je(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 Vd(e){let t=0,n=e.parentElement;for(;n!==null&&t<256;)t+=1,n=n.parentElement;return t}var zd=new Set("script style head template iframe object embed noscript svg math meta link title base select textarea hr w:sdtpr".split(" ")),jd=new Set("p div h1 h2 h3 h4 h5 h6 li blockquote pre".split(" ")),Wd=new Set("thead tbody tfoot tr section article main header footer aside nav figure form body html".split(" ")),Nk=new Set([...jd,...Wd,"table","ol","ul","w:sdt"]);function Ud(e){for(let t=0;t<e.children.length;t+=1)if(Nk.has(Je(e.children[t])))return true;return false}var Dk=new Set(["p","div","table","ol","ul","section","article","main","h1","h2","h3","h4","h5","h6"]);function jh(e){if(Je(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=Je(i);if(Dk.has(s))return Array.from(e.childNodes);s!=="w:sdtpr"&&t.push(i);}}return null}var Hk=4*1024*1024,_k=1e5,Bk=64,$k=2*1024*1024,Wh="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function Gd(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}function fs(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 y=e.nodeValue??"";if(n.pre){let x=y.replace(/\r\n?/g,`
4
- `).split(`
5
- `);for(let b=0;b<x.length;b+=1){if(b>0){if(o.nodesLeft-=1,o.nodesLeft<=0){o.truncated=true;return}r.push(`<w:r>${cr(n.run)}<w:br/></w:r>`);}let k=x[b];k.length>0&&r.push(ds(k,n.run));}return}let w=y.replace(/[ \t\r\n\f\v]+/g," ");if(w.length===0||w===" "&&Zd(r))return;r.push(ds(w,n.run));return}if(!ho(e))return;let a=Je(e);if(zd.has(a))return;let i=Ue(e);if(ls(e)&&n.para.numPr!==void 0||i.get("mso-element")?.trim().toLowerCase()==="comment-reference"||i.get("mso-special-character")?.trim().toLowerCase()==="comment"||e.classList.contains("msocomanchor")||o.definedNoteElements.has(e))return;if(a==="w:ptab"){let y=Zh(e);y.length>0&&r.push(`<w:r>${cr(n.run)}${y}</w:r>`);return}let l=qh(i.get("mso-tab-count"));if(l.length>0){if(o.nodesLeft-=l.split("<w:tab/>").length-2,o.nodesLeft<=0){o.truncated=true;return}let y=Md(Ad(n.run,a),i);if(r.push(`<w:r>${cr(y)}${l}</w:r>`),(e.textContent??"").trim().length===0&&e.children.length===0)return}if(a==="br"){let y=i.get("page-break-before")?.trim().toLowerCase()==="always"||i.get("break-before")?.trim().toLowerCase()==="page";r.push(`<w:r>${cr(n.run)}${y?'<w:br w:type="page"/>':"<w:br/>"}</w:r>`);return}if(a==="img"){oh(e,r,o,y=>Gd(o,`${Wh}/image`,y,false,n.rels??o.rels));return}let d=Ad(n.run,a),u=a==="a"?e.getAttribute("href"):null,p=a==="a"?Nd(i):null;p===null&&mh(u)&&(d={...d,rStyle:"Hyperlink"});let f=Da(d,e),g={...n,run:f,pre:n.pre||a==="pre"};if(p!==null){let y={...g.run,vertAlign:"superscript"};if(n.noteBody!==void 0&&n.noteBody.kind===p.kind&&n.noteBody.id===p.id){let w=p.kind==="footnote"?"footnoteRef":"endnoteRef";r.push(`<w:r>${cr(y)}<w:${w}/></w:r>`);return}if(o.definedNotes[p.kind].has(p.id)){let w=p.kind==="footnote"?"footnoteReference":"endnoteReference";r.push(`<w:r>${cr(y)}<w:${w} w:id="${p.id}"/></w:r>`);let x=(e.textContent??"").replace(/[ \t\r\n\f\v]+/g," ").trim(),b=`${p.kind}:${p.id}`;if(x.length>0&&!o.noteMarkFallbacks.has(b)&&o.noteMarkFallbacks.set(b,ds(x,y)),n.noteBody===void 0)o.bodyNoteRefs[p.kind].add(p.id);else {let k=`${n.noteBody.kind}:${n.noteBody.id}`,P=o.noteNoteRefs.get(k)??[];P.push({kind:p.kind,id:p.id}),o.noteNoteRefs.set(k,P);}return}for(let w of Array.from(e.childNodes))fs(w,t+1,g,r,o);return}if(a==="a"){let y=e.getAttribute("href"),w=dn(e.getAttribute("name")||e.getAttribute("id")),x=[];for(let P of Array.from(e.childNodes))fs(P,t+1,g,x,o);let b=y?.startsWith("#")?dn(y.slice(1)):null,k=x.join("");if(b!==null)k=`<w:hyperlink w:anchor="${N(b)}">${k}</w:hyperlink>`;else if(y!==null&&!y.startsWith("#")){let P=L(y);P.ok&&P.href.length>0&&(k=`<w:hyperlink r:id="${Gd(o,`${Wh}/hyperlink`,P.href,true,n.rels??o.rels)}">${k}</w:hyperlink>`);}if(w!==null){let P=String(o.nextBookmarkId++);k=`<w:bookmarkStart w:id="${P}" w:name="${N(w)}"/>${k}<w:bookmarkEnd w:id="${P}"/>`;}k.length>0&&r.push(k);return}for(let y of Array.from(e.childNodes))fs(y,t+1,g,r,o);}function Uh(e,t,n,r){let o=Je(e),a=Ue(e),i={};r&&(i.pageBreakBefore=true);let s=Yg(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},d=Ph[o];d!==void 0&&s===void 0&&!e.classList.contains("docx-outline")&&(l.bold=true,l.szHalfPoints=d);let u=t.pre||o==="pre";o==="pre"&&(l.font="Courier New");let p=wh(e,a,n,t.noteBody);return p&&(i.numPr=p),th(i,e,n.classAlignments),nh(i,a),l=Da(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:u,list:t.list,...t.noteBody?{noteBody:t.noteBody}:{},...t.rels?{rels:t.rels}:{}}}function Gh(e,t,n,r,o,a=false){if(r.nodesLeft<=0){r.truncated=true;return}if(t>r.maxDepth)return;let i=Uh(e,n,r,a);fr(Array.from(e.childNodes),t+1,i,r,o,true,void 0,false);}function Xh(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=fh(e);n.list||(r.semanticListCount+=1);let s=n.list?{numId:n.list.numId,level:Math.min(n.list.level+1,8)}:{numId:Hd(r,`sem:${r.semanticListCount}`,i,Ld(e)),level:0};if(n.list){let u=r.listsByNumId.get(s.numId);u!==void 0&&!u.levels.has(s.level)&&u.levels.set(s.level,{kind:i,start:Ld(e)});}let l={...n,list:s,para:{numPr:{numId:s.numId,ilvl:s.level}}},d=a;for(let u of Array.from(e.childNodes)){if(r.nodesLeft<=0){r.truncated=true;break}if(!ho(u))continue;let p=Je(u);if(p==="li")r.nodesLeft-=1,Gh(u,t+1,l,r,o,d),d=false;else if(p==="ol"||p==="ul"){let f=o.length;Xh(u,t+1,{...n,list:s},r,o,d),o.length>f&&(d=false);}}}function fr(e,t,n,r,o,a=false,i,s=true){if(t>r.maxDepth)return;let l=o.length,d=i===void 0,u=[],p=[],f=n.para,g=i??{pending:false,skipSpacer:false},y=()=>({...f,pageBreakBefore:void 0,numPr:void 0}),w=()=>{if(u.length===0)return;if(!u.some(b=>b.includes("<w:r"))){if(o.length===l){p=p.concat(u),u=[];return}let b=o[o.length-1];b?.endsWith("</w:p>")?(o[o.length-1]=`${b.slice(0,-6)}${u.join("")}</w:p>`,u=[]):b!==void 0&&u.length>0&&(o.push(_r(y(),u)),u=[],r.lastMarkCovered=false);return}let x=g.pending?{...f,pageBreakBefore:true}:f;o.push(_r(x,u)),f.pageBreakBefore&&(f={...f,pageBreakBefore:void 0}),g.pending=false,g.skipSpacer=false,r.lastMarkCovered=n.paragraphMarkCovered,u=[];};for(let x of e){if(r.nodesLeft<=0){r.truncated=true;break}if(ho(x)){let b=Je(x),k=b==="w:sdt"?jh(x):null;if(s&&Vh(x)){w(),r.nodesLeft-=1,g.pending&&cs(o),g.pending=true,g.skipSpacer=true;continue}if(zd.has(b)){r.nodesLeft-=1;continue}let P=Ue(x);if(P.get("mso-element")?.trim().toLowerCase()==="comment-list"){r.nodesLeft-=1;continue}if(xh(P)){w(),r.nodesLeft-=1,fr(Array.from(x.childNodes),t+1,n,r,o,false,g,s);continue}if(r.definedNoteElements.has(x)){r.nodesLeft-=1;continue}if(jd.has(b)){if(w(),r.nodesLeft-=1,g.pending&&g.skipSpacer&&zh(x)){g.skipSpacer=false;continue}if(b==="div"&&Ud(x)){let R=Uh(x,n,r,false);R.para.pageBreakBefore&&(g.pending=true),fr(Array.from(x.childNodes),t+1,R,r,o,false,g,s);continue}let F=o.length;Gh(x,t,n,r,o,g.pending),o.length>F&&(g.pending=false,g.skipSpacer=false);continue}if(b==="ol"||b==="ul"){w();let F=o.length;Xh(x,t,n,r,o,g.pending),o.length>F&&(g.pending=false,g.skipSpacer=false);continue}if(b==="table"){w(),g.pending&&cs(o),qk(x,t,n,r,o),g.pending=false,g.skipSpacer=false;continue}if(Wd.has(b)||k!==null||b==="span"&&Ud(x)){w(),r.nodesLeft-=1,fr(k??Array.from(x.childNodes),t+1,n,r,o,false,g,s);continue}}if(x.nodeType===3&&/^[\s\u00a0]+$/.test(x.nodeValue??"")&&Zd(u)){r.nodesLeft-=1;continue}fs(x,t,n,u,r);}if(a&&o.length===l&&u.length>0&&!u.some(x=>x.includes("<w:r"))&&(o.push(_r(f,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered),w(),p.length>0){let x=o[l];x!==void 0&&x.startsWith("<w:p>")?o[l]=x.replace(/^(<w:p>(?:<w:pPr>(?:(?!<\/w:pPr>)[\s\S])*?<\/w:pPr>)?)/,`$1${p.join("")}`):x!==void 0?o.splice(l,0,_r(y(),p)):u=p.concat(u),p=[];}u.length>0&&(o.push(_r(y(),u)),u=[],r.lastMarkCovered=false),d&&g.pending&&(cs(o),g.pending=false,g.skipSpacer=false,r.lastMarkCovered=false),a&&o.length===l&&(o.push(_r(f,u)),u=[],r.lastMarkCovered=n.paragraphMarkCovered);}function qk(e,t,n,r,o){$h(e,t,n,r,o,fr);}function Zk(e,t){return kh({blocks:t,rels:e.rels,lists:[...e.lists.values()],notes:e.notes,noteRels:e.noteRels,media:e.media,mediaExtensions:e.mediaExtensions})}function Kk(e,t){let n=t.maxHtmlBytes??Hk;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=bh(r),i={footnote:new Set,endnote:new Set},s=new Set,l={footnote:new Set,endnote:new Set};vh(r,a,l);let d={nodesLeft:t.maxNodes??_k,maxDepth:t.maxDepth??Bk,maxImageBytes:t.maxImageBytes??$k,wordHtml:Xg(e),truncated:false,lastMarkCovered: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:Jg(r),listDefinitions:lh(eh(r)),notes:{footnote:new Map,endnote:new Map},noteRels:{footnote:[],endnote:[]},definedNotes:i,bodyNoteRefs:{footnote:new Set,endnote:new Set},noteNoteRefs:new Map,noteMarkFallbacks:new Map,definedNoteElements:s},u={};u=Da(u,r.documentElement),u=Da(u,o);let p={run:u,para:u.rtl?{bidi:true}:{},paragraphMarkCovered:false,pre:false,list:null},f=[];for(let b of a)l[b.kind].has(b.id)&&(i[b.kind].has(b.id)||(i[b.kind].add(b.id),s.add(b.element),f.push(b)));f.sort((b,k)=>Vd(k.element)-Vd(b.element)),d.lastMarkCovered=false;let g=[];fr(Array.from(o.childNodes),0,p,d,g);let y=d.lastMarkCovered,w=d.truncated,x=false;for(let b=0;b<f.length;b+=1){let k=f[b];d.truncated=false;let P=d.nodesLeft,F=[];if(fr(Array.from(k.element.childNodes),0,{...p,noteBody:{kind:k.kind,id:k.id},rels:d.noteRels[k.kind]},d,F,true),d.truncated||F.length===0){x=true;let R=new Set;for(let H=b;H<f.length;H+=1){let L=f[H];i[L.kind].delete(L.id),s.delete(L.element),d.notes[L.kind].delete(L.id),d.bodyNoteRefs[L.kind].delete(L.id),R.add(`${L.kind}:${L.id}`);}if(R.size>0){for(let H=0;H<g.length;H+=1)g[H]=yo(g[H],R,d.noteMarkFallbacks);for(let H of ["footnote","endnote"])for(let[L,S]of d.notes[H])d.notes[H].set(L,S.map(T=>yo(T,R,d.noteMarkFallbacks)));}d.nodesLeft=P;for(let H=b;H<f.length&&d.nodesLeft>0;H+=1)fr(Array.from(f[H].element.childNodes),0,p,d,g);break}d.notes[k.kind].set(k.id,F);}return d.truncated=w||x,d.lastMarkCovered=y,Sh(d,i,g,Gd),g.length===0?{ok:false,reason:"no-content"}:{ok:true,projection:d,blocks:g}}var Vk=hh();function Yh(e,t){let n=`${t.maxHtmlBytes??""}:${t.maxNodes??""}:${t.maxDepth??""}:${t.maxImageBytes??""}`;return Vk(e,n,()=>Kk(e,t))}function Qh(e,t={}){let n=Yh(e,t);return n.ok?{ok:true,fragmentBytes:Zk(n.projection,n.blocks),lastMarkCovered:n.projection.lastMarkCovered,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:n}function Jh(e,t={}){let n=Yh(e,t);return n.ok?{lands:true,imageCount:n.projection.imageCount,truncated:n.projection.truncated}:{lands:false,imageCount:0,truncated:false}}var zk={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function ey(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 zk[n.toLowerCase()]??t})}var jk=new Set(["script","style","title","template"]),Wk=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),Uk=new Set(["td","th"]),ty=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),Gk=e=>ty(e)||e!==void 0&&e>="0"&&e<="9",ny=e=>e===" "||e===" "||e===`
6
- `||e==="\r"||e==="\f";function Xk(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!ty(e[n]))return null;let o=n;for(;n<e.length&&Gk(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};ny(l)||(s=false);}n+=1;}return {name:a,closing:r,end:e.length}}function Yk(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 Qk(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&&ny(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function*ry(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=Xk(e,n);if(r===null){yield "<",t=n+1;continue}t=r.end,!r.closing&&jk.has(r.name)?t=Qk(e,r.name,r.end):!r.closing&&r.name==="br"?yield `
7
- `:r.closing&&Uk.has(r.name)?yield " ":r.closing&&Wk.has(r.name)&&(yield `
8
- `);}}function Jk(e){let t=e.length>2e6?e.slice(0,2e6):e,n="";for(let r of ry(t))n+=r;return ey(n).replace(/\r\n?/g,`
9
- `).split(`
10
- `).map(Yk).join(`
11
- `).replace(/\n{3,}/g,`
12
-
13
- `).trim()}function oy(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 ay=/[^\s\u200B-\u200F\u2060\u2066-\u2069\u061C\uFEFF\u00AD]/;function iy(e){return ay.test(e)}function Xd(e){let t=e.length>2e6?e.slice(0,2e6):e;for(let n of ry(t)){let r=n.includes("&")?ey(n):n;if(ay.test(r))return true}return false}function Yd(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?Jk(n):""}function Qd(e,t){if(typeof e.getData!="function")return "";try{return e.getData(t)??""}catch{return ""}}function eT(e){if(!e)return false;if(iy(Qd(e,"text/plain")))return true;let t=Qd(e,"text/html");if(t.length===0)return false;if(Xd(t))return true;let n=as(t);return n!==null&&n.bytes[0]===80&&n.bytes[1]===75?true:Jh(t).imageCount>0}function tT(e){return e?Xd(Qd(e,"text/html")):false}var nT=Object.freeze({kind:"body"});function Ge(e,t){let n=t?.indexOf("#")??-1;if(n===-1)return null;let r=t.slice(0,n);return r.length===0?null:e.currentPackage().parts.get(r)??null}function St(e,t,n){let r=t?.indexOf("#")??-1,o=r===-1?"":t.slice(0,r);if(o.length===0||o===e.part().name)return {kind:"body"};for(let a of e.headerFooterResolutionBySection())for(let i of [a.headers,a.footers])for(let s of i.values())if(s.partName===o)return {kind:"headerFooter",rId:s.rId};for(let a of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:a})?.name===o)return {kind:"notesPart",noteKind:a};return n}function ps(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=_c$2(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function ly(e,t){return e?e.scope:t||nT}function rT(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(...sy(i.fragments));return o}if(!t)return B(e);let r=bo(e,t);return r?sy(r.fragments):[]}function bo(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 dy(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 Jd(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function ec(e,t,n){let r=Rc$1(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 tc(e,t,n,r,o={}){return Uc$1(e,t,n.fragments,r,o)}function oT(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=bo(r,t);return o?fe(e,t.pageIndex,o.fragments,n):null}function aT(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(...fe(e,o.index,i.fragments,n));}return r.length>0?r:null}function cy(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function uy(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 fy(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!bo(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(bo(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function py(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function my(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function nc(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function rc(e,t,n,r,o,a,i){let s=o?oT(e,o,i):a?aT(e,a,i):null,l=me$1(e,t,n,r,{...i?{measurer:i}:{},...s?{stops:s}:{}});if(!l)return null;if(!s)return l;let d=s.find(u=>u.position.paragraphId===l.position.paragraphId&&u.position.offset===l.position.offset);return d?{...l,pageIndex:d.pageIndex}:l}function oc(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,d=s.y;if(t.x>=l&&t.x<l+s.width&&t.y>=d&&t.y<d+s.height)return {pageIndex:r.index,scopeId:i.scopeId,noteKind:i.noteKind,noteId:i.noteId,local:{x:t.x-l,y:t.y-d},fragments:i.fragments}}}return null}function gy(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let d=o.y,u=r.y,p=n?Math.max(u,n.box.y+n.box.height):u,f=n?Math.min(d,n.box.y):d;return p<=f?null:{x:r.x,y:f,width:r.width,height:p-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 ac(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){if(r[a])continue;let i=gy(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 ic(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=gy(r,a)??s,d=l.x+o,u=l.y;if(t.x>=d&&t.x<d+l.width&&t.y>=u&&t.y<u+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 vo(e,t,n){if(!t&&!n)return V(e);let r=new Set,o=[];for(let a of e.pages)for(let i of rT(a,t,n)){for(let s of i.lines)for(let l of R(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 ms(e,t,n,r){let o=vo(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 sy(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 hy(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 iT(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function sT(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 lT(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function dT(e,t){if(e)try{await e.delete(t);}catch{}}async function sc(e){let t=()=>{if(e.signal?.aborted)throw e.signal.reason};t();let n=e.fetcher??fetch,r=e.maxFontBytes??a$1,o=await iT(e.cacheName??"docx-editor-fonts");t();async function a(d){t();let u=Object.freeze({family:d.family,weight:d.weight,style:d.style}),p=hy(u);if(p)return {failure:{url:d.url,request:u,reason:"invalidRequest",diagnostic:p}};let f=(b,k)=>{if(b.byteLength===0)return {url:d.url,request:u,reason:"emptyResponse"};if(b.byteLength>r)return {url:d.url,request:u,reason:"overLimit"};let P=i(b,d.faceIndex??0);if(!P.valid)return {url:d.url,request:u,reason:"malformed",diagnostic:P.diagnostic};let F=a$2(b);return d.hash!==void 0&&d.hash!==F?{url:d.url,request:u,reason:"hashMismatch",expectedHash:d.hash,actualHash:F,...k?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:u,id:`url:${d.url}`,bytes:b,hash:F,faceIndex:d.faceIndex??0}},g=await sT(o,d.url);if(t(),g){let b=f(g,true);if(!("reason"in b))return {source:b};await dT(o,d.url),t();}let y;try{y=e.signal?await n(d.url,{signal:e.signal}):await n(d.url),t();}catch(b){return t(),{failure:{url:d.url,request:u,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}if(!y.ok)return {failure:{url:d.url,request:u,reason:"httpError",status:y.status}};let w;try{w=new Uint8Array(await y.arrayBuffer()),t();}catch(b){return t(),{failure:{url:d.url,request:u,reason:"networkError",diagnostic:b instanceof Error?b.message:String(b)}}}let x=f(w,false);return "reason"in x?{failure:x}:(await lT(o,d.url,w),t(),{source:x})}let i$1=await Promise.all(e.sources.map(d=>a(d)));t();let s=[],l=[];for(let d of i$1)"source"in d?s.push(d.source):l.push(d.failure);return {sources:s,failures:l}}function cT(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=hy(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$1=t.faceIndex??0,s=i(e,i$1);return s.valid?{source:{request:r,id:o,bytes:e,hash:a$2(e),faceIndex:i$1}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:s.diagnostic}}}var uT=e=>e.trim().toLowerCase(),yy=e=>JSON.stringify([uT(e.family),e.weight,e.style]);function fT(e){return i$1(async t=>{if(t.signal?.aborted)throw t.signal.reason;let n=new Set((t.resolvedFaces??[]).map(yy)),r=e.sources.filter(s=>!n.has(yy(s)));if(r.length===0)return {sources:[],failures:[]};let{onFailure:o,...a}=e,i=await sc({...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 pT=96,by=37.79527559055118;function mT(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 d=s/8;n.push({position:l,height:10,...d>0?{label:String(d)}:{}});}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=by/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 gT(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var hT=1440,yT=567,bT=180,vT=56.7,gs=(e,t,n)=>n<t||e<t?t:e>n?n:e;function xT(e,t,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 vy(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 ST(e,t,n,r,o={}){let a=vy(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=gs(a,0,i);return {...n,firstLine:l-r.leftMargin-n.left}}case "left":{let l=-r.leftMargin-Math.min(0,n.firstLine),d=i-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:gs(a-r.leftMargin,l,d)}}case "hanging":{let l=gs(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:l,firstLine:n.firstLine+(n.left-l)}}case "right":{let l=gs(a,s,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-l}}}}var xy="no formatting has been copied",hs="there is nothing at the selection to copy",lc="the selection has nothing to paint",ys=Object.freeze({mode:"off",level:"none"});var dc=new WeakMap;function Zn(e){let t=dc.get(e);if(t)return t;let n=Ae(e);if(n.length===0)return dc.set(e,[]),[];let r=[];for(let o of n){let a=ze$1(o);for(let i of new Set([o.beginParagraphId,...o.resultParagraphIds,o.endParagraphId])){let s=Ga$1(e,i);if(s?.kind!=="paragraph")continue;let l=Re(s),d=i===o.beginParagraphId,u=i===o.endParagraphId;r.push({toc:o,paragraphId:i,length:l.length,startsHere:d,endsHere:u,start:d?l.spanOf(o.beginNodeId)?.start??0:0,end:u&&a?l.spanOf(a.endNodeId)?.end??l.length:l.length});}}return dc.set(e,r),r}function bs(e){return new Set(Zn(e).filter(t=>t.start===0&&t.end===t.length&&!(t.endsHere&&!t.startsHere&&t.end===0)).map(t=>t.paragraphId))}function cc(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 Gt(e,t){return Zn(e).find(n=>n.paragraphId===t.paragraphId&&cc(n,t.offset))?.toc}function Sy(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 Zn(e).some(i=>i.paragraphId===n.paragraphId&&(o===a?cc(i,o):o<i.end&&a>i.start))}return Gt(e,n)!==void 0||Gt(e,r)!==void 0}function wy(e,t){let n=Zn(e);if(n.length===0)return false;let r=Qh$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:d}=i.range;return l===d?cc(s,l):l<s.end&&d>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,d])=>a(d,l));return a(t)}function Iy(e,t,n){let r=Gt(e,t);if(!r)return null;let o=Zn(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 ky(e,t){return !Zn(t).some(r=>r.toc.id===e.id&&(r.start>0||r.end<r.length))&&e.contentControlId?e.contentControlId:`toc:${e.id}`}function Ty(e,t,n){if(!t)return;let r=n?.closest("[data-start]");return Zn(e).find(o=>o.paragraphId===t&&(r?Number(r.dataset.start)<o.end&&Number(r.dataset.end)>o.start:bs(e).has(t)))?.toc}var Ha=/^[0-9A-Fa-f]{6}$/,Py={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"},wT={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 uc(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function vs(e){return Math.max(0,Math.min(1,e))}function Ry(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 Cy(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 Ey(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-vs(t))*255)))/255,o=Ry(e);return Cy(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function Fy(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(vs(t)*255)))/255,o=Ry(e);return Cy(r*o.r,r*o.g,r*o.b)}function fc(e){return Py[e]??Py[e.toLowerCase()]??null}function IT(e,t){let n=fc(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&Ha.test(r))return r.toUpperCase();let o=wT[n];return o&&Ha.test(o)?o.toUpperCase():null}function xs(e,t){let n=IT(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!uc(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!uc(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=Ey(r,vs(e.tint)):e.shade!==void 0&&(r=Fy(r,vs(e.shade))),{ok:true,hex:r}}var kT="000000";function pc(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return Ha.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:kT}};let n=xs(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:fc(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function mc(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 Ha.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=xs(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:fc(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function TT(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return Ha.test(o)?`#${o}`:`#${n}`}let r=xs(e,t);return `#${r.ok?r.hex:n}`}function gc(e,t){return $c$1(e).occurrences.some(n=>n.table.tableId===t&&n.row.cells.some(r=>r.logicalGridColumn!==void 0))}function Oy(e,t){return t?e==="left"?"right":e==="right"?"left":e:e}var ET=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function pr(e){return ET.has(e.type)}function be(e,t){return {ok:false,code:e,reason:t}}function hc(e,t){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 has merged cells");case "row-hides-cell":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 wt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $t(e,t){return !wt(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function Ny(e){if(!wt(e))return false;let t=e.kind;if(t==="hex")return $t(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return $t(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 $t(e,n)}return false}function Dy(e){return wt(e)&&$t(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 Hy(e){return wt(e)&&$t(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 FT(e){return wt(e)&&$t(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 OT(e){return wt(e)&&$t(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 AT(e){return !wt(e)||!$t(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&Ny(e.color)}function Ay(e){return !("target"in e)||e.target===void 0||Dy(e.target)}function My(e){return !("target"in e)||e.target===void 0||Hy(e.target)}function MT(e){switch(e.type){case "insertRow":return !wt(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"):Ay(e)?null:be("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !wt(e)||e.type!=="deleteRow"?be("invalidArgs","deleteRow command shape is invalid"):Ay(e)?null:be("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !wt(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"):My(e)?null:be("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !wt(e)||e.type!=="deleteColumn"?be("invalidArgs","deleteColumn command shape is invalid"):My(e)?null:be("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !wt(e)||!$t(e,["type"])?be("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !wt(e)||!$t(e,["type","color"])?be("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!Ny(e.color)?be("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !wt(e)||!$t(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?be("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !wt(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)||!AT(e.spec)?be("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !wt(e)||!$t(e,["type","target","leftWidthTwips","rightWidthTwips"])||!FT(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?be("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !wt(e)||!$t(e,["type","target","columnWidthTwips","tableWidthTwips"])||!OT(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?be("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function LT(e){return !("target"in e)||e.target===void 0?null:Dy(e.target)?e.target:null}function NT(e){return !("target"in e)||e.target===void 0?null:Hy(e.target)?e.target:null}function DT(e,t){let n=rh$1(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 HT(e,t){let n=rh$1(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=_y(s);if(r.has(s.id))for(let d=0;d<l;d+=1){let u=n.topology.gridColumns[i+d];u&&o.add(u.id);}i+=l;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function Ly(e,t,n){let r=rh$1(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function _T(e){let t=ya(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 _y(e){let t=oh$1(e,"tcPr"),n=t&&oh$1(t,"gridSpan"),r=n&&ph$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 BT(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=_y(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 $T(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=rh$1(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 qT(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=rh$1(e.part.root,t.tableId);return n.ok?BT(n.topology,t.tableId,t.gridColumnId):null}function ZT(e,t){for(let n of t){let r=qi(e,n);if(r)return hc(r)}return null}function Bt(e,t,n){let r=ZT(e,t);return r||{ok:true,ops:t,selection:n}}function KT(e,t){if(!Uh$1.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=pc(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function _a(e,t,n){return n!==e.storeRevision?be("invalidArgs","the table target is stale"):rh$1(e.part.root,t).ok?null:be("invalidArgs","the table target is no longer valid")}function VT(e){return e?.isHeaderRepeat?be("unsupported","repeated header rows cannot be edited"):null}function zT(e,t,n,r){let o=_a(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=rh$1(e.part.root,t.tableId);if(!a.ok){let p=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return hc(p)}if(a.topology.hasMerge)return be("unsupported","this table has merged cells");let i=a.topology.gridColumns.find(p=>p.id===t.leftGridColumnId),s=a.topology.gridColumns.find(p=>p.id===t.rightGridColumnId);if(!i||!s)return be("invalidArgs","the table target is no longer valid");let l=a.topology.gridColumns.indexOf(i),d=a.topology.gridColumns.indexOf(s);if(Math.abs(d-l)!==1)return be("invalidArgs","the column divider target is not adjacent");let u={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:l<d?t.leftGridColumnId:t.rightGridColumnId,rightGridColumnId:l<d?t.rightGridColumnId:t.leftGridColumnId,leftWidthTwips:l<d?n:r,rightWidthTwips:l<d?r:n};return Bt(e.part,[u],{kind:"preserveSelection"})}function jT(e,t,n,r){let o=_a(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=rh$1(e.part.root,t.tableId);if(!a.ok){let l=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return hc(l)}if(a.topology.hasMerge)return be("unsupported","this table has merged cells");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 Bt(e.part,[s],{kind:"preserveSelection"})}function By(e,t,n){if(e.viewing||!e.editable)return be("locked","the document is open for viewing");let r=_a(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 Bt(e.part,[o],{kind:"preserveSelection"})}function Kn(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return be("locked","the document is open for viewing");switch(t.type){case "mergeCells":return be("unsupported","cell merge is not supported yet");case "splitCell":return be("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return be("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=MT(t);if(a)return a;let i=LT(t),s=NT(t),l=VT(i??s);if(l)return l;if(i){let u=_a(e,i.tableId,i.sourceRevision);if(u)return u}if(s){let u=_a(e,s.tableId,s.sourceRevision);if(u)return u}let d=i!==null?$T(e,i):s!==null?qT(e,s):_T(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!d)return i||s?be("invalidArgs","the table target is no longer valid"):be("unsupported","the selection is not inside a table");if(d?.isHeaderRepeat)return be("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!d)return be("unsupported","the selection is not inside a table");let u={op:"insertTableRow",tableId:d.tableId,rowId:d.rowId,where:t.where};return Bt(n,[u],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!d)return be("unsupported","the selection is not inside a table");let u=DT(n,d),p=u.wholeTable?[{op:"deleteBlock",blockId:d.tableId}]:u.rowIds.map(f=>({op:"deleteTableRow",tableId:d.tableId,rowId:f,...f===d.rowId?{referenceCellId:d.cellId}:{}}));return Bt(n,p,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!d)return be("unsupported","the selection is not inside a table");let u=s?.tableId??d.tableId,p=s?.gridColumnId??Ly(n,u,d.gridColumnIndex),f=gc(e.layout,u)?t.where==="left"?"right":"left":t.where,g=p?{op:"insertTableColumn",tableId:u,where:f,gridColumnId:p}:{op:"insertTableColumn",tableId:u,where:f,referenceCellId:d.cellId};return Bt(n,[g],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!d)return be("unsupported","the selection is not inside a table");let u=s?.tableId??d.tableId,p=s?.gridColumnId??Ly(n,u,d.gridColumnIndex);if(!p)return be("invalidArgs","the table has no grid column to delete");let f=s?.gridColumnId===void 0?HT(n,d):{gridColumnIds:[p],wholeTable:false};if(f.wholeTable)return Bt(n,[{op:"deleteBlock",blockId:u}],{kind:"adoptCommittedCaret"});let y=(f.gridColumnIds.length>0?f.gridColumnIds:[p]).map(w=>({op:"deleteTableColumn",tableId:u,gridColumnId:w}));return Bt(n,y,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!d)return be("unsupported","the selection is not inside a table");let u={op:"deleteBlock",blockId:d.tableId};return Bt(n,[u],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!d)return be("unsupported","the selection is not inside a table");let u;if(t.color===null)u=null;else {let f=mc(t.color,e.themeColors);if(!f.ok)return be("invalidArgs",f.reason);u=f.color;}let p={op:"setTableCellFill",tableId:d.tableId,cellIds:d.cellIds,color:u};return Bt(n,[p],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!d)return be("unsupported","the selection is not inside a table");let u={op:"setTableCellVerticalAlignment",tableId:d.tableId,cellIds:d.cellIds,alignment:t.alignment};return Bt(n,[u],{kind:"preserveSelection"})}case "setTableBorders":{if(!d)return be("unsupported","the selection is not inside a table");if(t.scope==="none"){let f={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:"none",target:Oy(t.target,gc(e.layout,d.tableId))};return Bt(n,[f],{kind:"preserveSelection"})}let u=KT(t.spec,e.themeColors);if(!u.ok)return be("invalidArgs",u.reason);let p={op:"setTableCellBorders",tableId:d.tableId,cellIds:d.cellIds,scope:Oy(t.scope,gc(e.layout,d.tableId)),spec:u.spec};return Bt(n,[p],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return zT(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return jT(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return be("unsupported",`command '${t.type}' is not a table command`)}}function $y(e){if(!pr(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "mergeCells":return {supported:false,reason:"cell merge is not supported yet"};case "splitCell":return {supported:false,reason:"cell split is not supported yet"};case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}function Pt(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 $r(e){if(typeof e!="object"||e===null)return false;let t=e;return Pt(t.from)&&Pt(t.to)}function qy(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 un(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=ki(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=qy(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=qy(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 Zy(e,t,n){if("anchor"in n){let s=un(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(!Pt(r)||!Pt(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=un(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=un(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}}var WT=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function UT(e,t){return e===t?true:!e||!t?false:WT.every(n=>e[n]===t[n])}function yc(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.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.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||!UT(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 bc(e,t){return e.current===t.current&&e.total===t.total}function vc(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 Ky(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 xc(e,t){return e===t?true:!e||!t||!$r(e)||!$r(t)?false:Ky(e.from,t.from)&&Ky(e.to,t.to)}function Sc(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var GT={scope:"compared",isLoading:"compared",isOpening:"compared",parseError:"compared",editable:"compared",zoom:"compared",zoomMode:"compared",selection:"compared",selectionCollapsed:"compared",formatting:"compared",table:"compared",tocContext:"compared",image:"compared",page:"compared",canUndo:"compared",canRedo:"compared",pageSetup:"compared",reviewPaneOpen:"compared",showParagraphMarks:"compared",documentProtection:"compared",reviewDisplayMode:"compared",hasReviewContent:"compared",hiddenReviewAuthors:"compared",collaborationStatus:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared",formatPainter:"compared"},XT=Object.keys(GT);function wc(e,t){return XT.every(n=>e[n]===t[n])}function Ss(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)Ss(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))Ss(t[n]);return Object.freeze(e)}var Ic=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"}}]]),YT=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),QT=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,JT=/^[0-9A-Fa-f]{6}$/;function kc(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!QT.test(n)?{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"&&!JT.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"||!YT.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 Wy(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function Tc(e){return typeof e=="object"&&e!==null&&Wy(e.anchor)&&Wy(e.head)}function qt(e,t){let n=new Error(t);return n.code=e,n}function ws(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 Pc(e){return e==="blank"?kd():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Rc(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 Ba(e){switch(e.type){case "toggleMark":return Ic.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=kc(e);return t.ok?{supported:true,mutating:true}:{supported:false,reason:t.reason,code:t.code}}case "setAlignment":return {supported:true,mutating:true};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)>yb$1))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${yb$1}`};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.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)>yb$1)return {supported:false,reason:`indent values must be within \xB1${yb$1} 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 "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 "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 "selectTableRegion":case "setTableProperties":{let t=$y(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(Tc(e.range)||$r(e.range))||"anchor"in e&&Pt(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 "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};default:return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`}}}var fn="comments and tracked changes require the pro review module (@docx-editor.dev/pro)";var mr="suggesting mode needs an author; configure author before enabling it",eP="this document asks for tracked changes, but no author is configured",Uy="this document is protected for filling in forms, which does not track changes",$a="this document is protected against editing; open it in Word to change that",qa="this document is protected for comments only",Cc={mode:null,rejection:null};function Ec(e,t){if(e===void 0||e==="view")return Cc;if(e==="edit")return {mode:"editing",rejection:null};let n=Fc(t);return n!==null?{mode:null,rejection:n.reason}:{mode:"suggesting",rejection:null}}function Fc(e){return e.reviewEnabled?e.hasAuthor?null:{ok:false,code:"invalidArgs",reason:mr}:{ok:false,code:"unsupported",reason:fn}}function Gy(e){let t=false,n=null,r=e.log??(o=>console.error(o));return {report(o){o!==mr||t||n!==null||(n=setTimeout(()=>{if(n=null,!e.stillMissing())return;t=true;let a=`${mr}. Edits are not tracked until an author is set (the author option at construction, setAuthor(), or the adapter author prop).`;e.emit(qt("suggestingNeedsAuthor",a)),r(`[@docx-editor.dev/core] ${a}`);},0));},dispose(){n!==null&&clearTimeout(n),n=null;}}}function Oc(e){if(e.restrictedToReadOnly)return e.currentMode==="viewing"?Cc:{mode:"viewing",rejection:$a};let t=e.currentMode,n=null;e.engineAdoptedViewing&&t==="viewing"&&!e.viewOnly&&(n="editing",t="editing");let r=n===null?Cc:{mode:n,rejection:null};return e.restrictedToComments?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:qa}:r:e.restrictedToForms?t==="suggesting"&&!e.viewOnly?{mode:"editing",rejection:Uy}: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:eP}}function Xy(e){return e===null?{enter:true,rejection:null}:{enter:false,rejection:e.reason}}function Ac(e,t){return t!=="viewing"&&e.restrictedToReadOnly?{ok:false,code:"locked",reason:$a}:t==="suggesting"&&e.restrictedToComments?{ok:false,code:"locked",reason:qa}:t==="suggesting"&&e.restrictedToForms?{ok:false,code:"locked",reason:Uy}:t!=="editing"||!e.restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function Yy(e,t,n,r,o,a=false){let i=Ec(e,t),s=e==="view"?"viewing":i.mode??o,l=Oc({...t,...n,viewOnly:e==="view",hostChoseMode:e!==void 0,readerChoseMode:false,currentMode:s,engineAdoptedViewing:a});l.mode!==null&&(s=l.mode);let d=Ac(n,s),u=n.restrictedToReadOnly?"viewing":r;return {mode:d===null?s:u,rejection:l.rejection??d?.reason??null,configurationRejection:i.rejection}}var Qy=new WeakMap;function Jy(e,t){Qy.set(e,t);}var Za="this document is protected; only form fields can be filled";function Tn(e,t){if(e.type==="undo"||e.type==="redo"||e.type==="toggleDocumentProtection")return null;let n=Ef(t.session.currentPackage()),r=wf(n?.root);if(!r.enforced)return null;if(r.edit==="readOnly"||r.edit==="comments")return {ok:false,code:"locked",reason:r.edit==="comments"?qa:$a};if(r.edit!=="forms"||pr(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 "setLineSpacing":case "setParagraphSpacing":case "setIndent":case "adjustIndent":case "toggleList":case "setParagraphStyle":case "setParagraphFormat":case "removeTabMark":o="paragraph";break;case "setPageSetup":case "setHeaderFooterOptions":case "convertAllNotes":case "insertToc":case "refreshToc":case "replaceAllMatches":case "resolveAllReviewChanges":case "acceptRevision":case "rejectRevision":case "acceptAllRevisions":case "rejectAllRevisions":o="document";break}let s=t.state().selection,l=t.session.storyParts().find(f=>s.head.paragraphId.startsWith(`${f.name}#`));if(!l)return {ok:false,code:"locked",reason:Za};let d=t.state().cellSelection;return (d&&(o==="runFormat"||o==="paragraph")?[...ta(t.layout(),d.cellIds)].map(f=>({anchor:{paragraphId:f,offset:0},head:{paragraphId:f,offset:(ki(l,f)??"").length}})):[s]).some(f=>Oh$1(l,n,{selection:f,intent:o,text:a,paste:i,fieldId:Qy.get(t)?.()??void 0}))?{ok:false,code:"locked",reason:Za}:null}function e0(e,t){if(e!=="locked")return e;let n=wf(t);return n.enforced?n.edit==="comments"?qa:n.edit==="forms"?Za:$a:"this content is locked"}function t0(e){return e!==null&&Tn({type:"resolveAllReviewChanges"},e)!==null}function n0(e,t){return ()=>e()??(t()?null:"the document is read-only")}function tP(e){return [e.left,e.top,e.right,e.bottom]}function Mc(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function nP(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function Ka(e){return Math.round(e*1e3)}function Va(e){return e/1e3}function Lc(e){return Object.freeze({left:Ka(e.left),top:Ka(e.top),right:Ka(e.right),bottom:Ka(e.bottom)})}function rP(e){return Object.freeze({left:Va(e.left),top:Va(e.top),right:Va(e.right),bottom:Va(e.bottom)})}function Nc(e){return tP(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var oP=new Set(["insertImage","replaceImage"]),aP=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function Dc(e,t,n){return n!==null&&e.drawingNodeId!==n?false:e.start===t||e.start+1===t}function iP(e,t,n,r){if(!e)return null;for(let o of e.drawings??[])if(o.paragraphId===t&&Dc(o,n,r))return o;return null}function sP(e,t,n,r){let o=e.layout();for(let a of o.pages){for(let i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&Dc(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&&Dc(s,n,r))return s}}return null}function r0(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function za(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=Ud$1(e.layout(),n.paragraphId,n.offset),a=t.kind==="pointer"?t.drawingNodeId:null;return iP(o,n.paragraphId,n.offset,a)??sP(e,n.paragraphId,n.offset,a)}function o0(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=Ga$1(r,t.drawingNodeId);return !o||o.kind!=="drawing"?null:lb$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:eb$1,limits:db$1,resolveRelationship:gb$1(e.session.currentPackage(),t.ownerPartName)})}function a0(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 lP(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 i0(e){let t=e.locks;return Object.freeze({canResize:!t.resize&&!e.hidden,canMove:!t.move&&!e.hidden,canChangeWrap:!t.move&&e.kind==="anchored"&&!e.hidden,canCrop:!t.resize&&!t.changeAspect&&!e.hidden})}function dP(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function Pn(e){let t=za(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?o0(e,t):null;if(!n||n.hidden||n.locks.select)return null;let r=t.transform;return Object.freeze({id:t.drawingNodeId,kind:n.kind,widthEmu:n.extentEmu.cx,heightEmu:n.extentEmu.cy,crop:Mc(t.crop),rotationDegrees:r.rotationDegrees,wrap:dP(t),position:a0(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:lP(t),...i0(n)})}function s0(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 Hc(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function l0(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function _c(e){return Hc(e)!==void 0||l0(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function Bc(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=l0(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=Hc(t),i=Pn(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 So(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function gr(e,t){let n=Pn(e),r=Hc(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 cP(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 Is(e,t){return cP(e.applyDrawingOps(t))}function uP(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 fP(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function pP(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function mP(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||Yh$1(e)}function d0(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 ja(e){return aP.has(e.type)}function gP(e){return oP.has(e.type)}function c0(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function u0(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:"image changes are not supported in suggesting mode"}:null}function Wa(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=Pn(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function So(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=Pn(r),s=n.drawingNodeId??t.drawingNodeId;if(!i||!s||i.id!==s)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function Ua(e,t){if(!ja(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};let n=Tn(e,t);if(n)return n;if(e.type==="insertImage")return !(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;if(e.type==="replaceImage"){if(!(e.data instanceof Uint8Array)||e.data.byteLength===0)return {ok:false,code:"invalidArgs",reason:"replaceImage requires image bytes"};let a=gr(t,e);return "ok"in a?a:null}let r=gr(t,e);if("ok"in r)return r;let o=Pn(t);if(!o)return {ok:false,code:"notFound",reason:"no drawing is selected"};if(t.editingMode()==="suggest"&&e.type!=="deleteImage")return {ok:false,code:"invalidArgs",reason:"image changes are not supported in suggesting mode"};switch(e.type){case "deleteImage":return o.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return o.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return o.locks.changeAspect||o.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!o.canMove||o.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!pP(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let a=o.position?.mode??"frame";return _h$1(e,a)?Vh$1(d0(e,o))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(fP(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!mP(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!o.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&&!o.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!o.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!Nc(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!o.canCrop)return {ok:false,code:"locked",reason:"crop cannot be changed on this drawing"};if(e.hyperlink!==void 0&&e.hyperlink!==null&&!L(e.hyperlink).ok)return {ok:false,code:"invalidArgs",reason:"unsafe hyperlink URL"};if(e.wrap!==void 0&&!o.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(Yh$1(e)){if(!o.canMove||o.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let i=o.position?.mode??"frame";if(!_h$1(e,i))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!Vh$1(Zh$1(e,o)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function $c(e,t){let n=u0(t,e.type);if(n)return n;let r=Ua(e,t);return r||{ok:true}}function f0(e,t){let n=Ua(e,t);return n||c0(e)}function p0(e,t,n){if(gP(t))return c0(t);let r=n&&_c(t)?Wa(n):null;if(r&&n){let o=Bc(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=gr(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=gr(e,t);return "ok"in o?o:Is(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=gr(e,t);return "ok"in o?o:Is(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=gr(e,t);if("ok"in o)return o;let a=Pn(e),i=d0(t,a);return Is(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=gr(e,t);if("ok"in o)return o;let a=Pn(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let d=uP(a);if(!d)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:d});}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:Lc(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&&i.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),Yh$1(t)){let d=Zh$1(t,a);i.push({op:"positionDrawing",drawingNodeId:o.id,position:d});}if(t.hyperlink!==void 0){let d=e.applyImageProperties({drawingNodeId:o.id,ops:i,hyperlink:t.hyperlink});return d.ok?null:{ok:false,code:"invalidArgs",reason:d.detail??d.reason??"setImageProperties was refused"}}return i.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:Is(e,i)}default:return null}}function hP(e,t,n,r,o){let a=ac$1(e.sectionPropertiesAt(t)),i=a.width-a.margin.left-a.margin.right,s=a.height-a.margin.top-a.margin.bottom,l=Ud$1(e.layout(),t,n),d=l&&l.box.width>0?Math.min(l.box.width,i):i,u=Math.min(1,d/r,s/o);return u>=1?{widthPoints:r,heightPoints:o}:{widthPoints:r*u,heightPoints:o*u}}async function qc(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=u0(n,t.type);if(r)return r;let o=Ua(t,n);if(o)return o;let a=Wa(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:p}=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 g=hP(n,p.paragraphId,p.offset,t.widthPoints,t.heightPoints),y=await n.insertImage({paragraphId:p.paragraphId,offset:p.offset,bytes:t.data,mime:t.mime,widthPoints:g.widthPoints,heightPoints:g.heightPoints,expectedPackageRevision:f,commitGuard:()=>So(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),w=So(e,a);return w||(y.ok?{ok:true,changed:y.change!==null}:{ok:false,code:"invalidArgs",reason:y.detail==="stale-package-epoch"?"stale package revision":y.detail??y.reason??"insertImage was refused"})}let i=gr(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",d=await n.replaceImage(i.id,t.data,l,{expectedPackageRevision:s,commitGuard:()=>So(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),u=So(e,a,{requireDrawing:true,drawingNodeId:i.id});return u||(d.ok?{ok:true,changed:d.change!==null}:{ok:false,code:"invalidArgs",reason:d.detail==="stale-package-epoch"?"stale package revision":d.detail??d.reason??"replaceImage was refused"})}var yP=1,bP=10,Ga=12700;function vP(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=i0(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function xP(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId!==n.paragraphId||t.offset!==n.offset)return null;let r=za(e);if(!r||r.accessibility.hidden)return null;let o=e.layout(),a=_c$1(o,r.drawingNodeId);if(!a)return null;let i=o0(e,r);if(!i||i.locks.select)return null;let s=vP(r,i),d=e.editingMode()==="edit"&&e.session.editable?s:{...s,canResize:false,canMove:false},u=r.kind==="anchoredDrawing"?Object.freeze({x:r.horizontalFrameOrigin,y:r.verticalFrameOrigin}):null;return Object.freeze({id:r.drawingNodeId,pageIndex:a.pageIndex,x:a.x,y:a.y,width:a.width,height:a.height,kind:r.kind==="inlineDrawing"?"inline":"anchored",widthEmu:i.extentEmu.cx,heightEmu:i.extentEmu.cy,position:a0(i),anchorFrameOrigin:u,transform:r.transform,...d})}function Rt(e){return Math.round(e*Ga)}function xo(e){return e/Ga}function SP(e,t,n,r,o,a){let i=xo(e),s=xo(t),l=i/s,d=n.includes("e")?r:n.includes("w")?-r:0,u=n.includes("s")?o:n.includes("n")?-o:0;if(i=Math.max(1,i+d),s=Math.max(1,s+u),a)if(n.length===2){let f=Math.max(i/xo(e),s/xo(t));i=Math.max(1,xo(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:Rt(i),cy:Rt(s)})}function Zc(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+Rt(t),verticalEmu:(e.verticalEmu??0)+Rt(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+Rt(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+Rt(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}function wP(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"}:So(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function m0(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.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}:{}}}function Kc(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 Vc(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let d=e.session.paraIdOf(t.paragraphId);return d===null?null:{from:{paraId:d},to:{paraId:d}}}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 g0(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 h0(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return d$1(n).map(o=>{let a=r.paraIdByNode.get(o.id),i=o.kind==="textValue"?void 0:i$3(o);return {...a!==void 0?{paraId:a}:{},text:ki(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function zc(e){return e?e.state().pageCount:0}function jc(e,t="caret"){return e?e.currentPage(t):1}function IP(e,t){if(!pr(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=ks(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 kP(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"}}function ks(e,t){let n=kP(e,t),r=Kn(n),o=Ef(t.session.currentPackage());return r.ok&&r.ops.some(a=>Sh$1(n.part,o,a))&&(r={ok:false,code:"locked",reason:Za}),r.ok?{can:{ok:true},plan:r}:{can:{ok:false,code:r.code,reason:r.reason},plan:r}}function Xa(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 s=t?.activeScope?.()??{kind:"body"};if(s.kind!=="headerFooter"||s.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=Ba(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?Tn(e,t):null;if(a)return {ok:false,refusal:a};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==="copy"||e.type==="cut"||e.type==="deleteText"){let{anchor:s,head:l}=t.state().selection;if(s.paragraphId===l.paragraphId&&s.offset===l.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(s=>s.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:xy}};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"}};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==="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 l=t.sectionBreakRefusal(e.kind==="section"?"nextPage":"continuous");if(l)return {ok:false,refusal:{ok:false,code:"unsupported",reason:l}}}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 s=t.headerFooterState?.();if((e.sectionIndex??s?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(pr(e)){let s=IP(e,t);return s.ok?{ok:true,tablePlan:s.tablePlan}:s}let i=Ua(e,t);return i&&!i.ok?{ok:false,refusal:i}:{ok:true}}function y0(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!Ga$1(n,t))return true;let r=Ha$1(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=Ha$1(n,r.id);}return false}function b0(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!y0(e,t.selection.head.paragraphId))return null;let r=xa$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 Wc(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!y0(e,t.selection.head.paragraphId))return null;let r=xa$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 v0(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 x0(e){return !!e&&Gt(e.session.part(),e.state().selection.head)!==void 0}var me={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"],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"],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"],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"],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 wo={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},w0=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function Uc(e){return createT(en$1)(e)}function Ts(e){return w0.includes(e)}function RP(e){return e!=null}var I0=[{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"}],k0=[{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"}],CP=[{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 EP(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function FP(e){return e==="none"||EP(e)}function S0(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function OP(e){return k0.some(t=>t.value===e)}function qr(e,t,n){switch(t){case "table.borderTarget":return FP(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(!S0(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(!OP(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&&!S0(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function Gc(e,t=wo){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return qr(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return qr(t,e,"single")?.command??null;case "table.borderWidth":return qr(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function AP(e){return I0.find(n=>n.value===e)?.labelKey??"table.borders.all"}function MP(e){return me[e]}function hr(e){return e.surface??null}var LP={"review.comments":{type:"toggleReviewPane"},"review.paragraphMarks":{type:"toggleParagraphMarks"},"review.protectDocument":{type:"toggleDocumentProtection"},"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"},"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.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"}};function NP(e){return P0[e]??null}var T0=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),P0={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:T0,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"}};function Ya(e){return LP[e]??null}var DP={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},HP={"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"};function R0(e,t,n){return qr(n,e,t)?.command??null}function Ps(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(Ts(e))return R0(e,t,wo);if(e==="image.wrap")return typeof t!="string"||!cb$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=DP[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function C0(e,t,n=wo){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=Gc(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 _P=["editing","suggesting","viewing"];function E0(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(Ts(t))return C0(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",i=_P.filter(d=>d!==a).map(d=>e.can(Ps(t,d))),s=i.some(d=>d.ok),l=i.find(d=>!d.ok);return {id:t,enabled:s,disabledReason:!s&&l&&!l.ok?l.reason:null,active:false,value:a}}if(t==="format.painter"){let a=hr(e);if(!a)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let i=a.formatPainter.state();if(i.mode!=="off")return {id:t,enabled:true,disabledReason:null,active:true,value:i.mode};let s=e.can({type:"clearFormatting"});return s.ok?{id:t,enabled:true,disabledReason:null,active:false,value:i.mode}:{id:t,enabled:false,disabledReason:s.reason,active:false,value:i.mode}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let a=hr(e),i=a?.state().contentControls,s=t==="contentControl.showAll"?i?.showAll??false:i?.formFill??false;return {id:t,enabled:a!==null,disabledReason:a?null:"editor is not ready",active:s}}if(t==="contentControl.inspector"){let a=hr(e);return a?a.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.authors"){let a=e.can({type:"toggleReviewPane"});return a.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:a.reason,active:false}}let n=Ya(t);if(!n){let a=HP[t];if(a!==void 0){let s=Ps(t,a);if(!s)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let l=e.can(s),d=e.getSelectedImage?.()??null,u=t==="image.wrap"?d?.wrap:t==="image.altText"?d?.description:void 0;return l.ok?{id:t,enabled:true,disabledReason:null,active:false,...u!==void 0?{value:u}:{}}:{id:t,enabled:false,disabledReason:l.reason,active:false,...u!==void 0?{value:u}:{}}}let i=P0[t];if(i){if(t==="image.insert"&&i.type==="insertImage"){let l=e.canExecuteImageCommand?.({type:"insertImage",data:T0,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="image.properties"&&i.type==="setImageProperties"){let l=e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="table.insert"&&i.type==="insertTable"){let l=e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}if(t==="paragraph.dialog"&&i.type==="setParagraphFormat"){let l=e.can(i);return l.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:l.reason,active:false}}let s=e.can(i);if(!s.ok)return {id:t,enabled:false,disabledReason:s.reason,active:false}}return 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 r=e.can(n),o=e.isActive?.(n)??false;return r.ok?{id:t,enabled:true,disabledReason:null,active:o}:{id:t,enabled:false,disabledReason:r.reason,active:o}}function BP(e){if(e==="format.painter")return true;let t=Ya(e);return t?.type==="toggleMark"||t?.type==="toggleParagraphMarks"||t?.type==="toggleDocumentProtection"||t?.type==="setReviewDisplayMode"||t?.type==="setAlignment"}function $P(e,t){return t.map(n=>E0(e,n))}function qP(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=qr(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}}function ZP(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(t==="format.painter"){let a=hr(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(a.formatPainter.state().mode==="off"){let i=e.can({type:"clearFormatting"});if(!i.ok)return {ok:false,code:i.code,reason:i.reason}}return a.formatPainter.press()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:hs}}if(t==="contentControl.showAll"){let a=hr(e);return a?(a.contentControls.setShowAll(!a.contentControls.showAll()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.formFill"){let a=hr(e);return a?(a.contentControls.setFormFill(!a.contentControls.formFill()),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:"editor is not ready"}}if(t==="contentControl.inspector"){let a=hr(e);return a?a.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 a=hr(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};let i=a.state().contentControls.activeControlId;if(!i)return {ok:false,code:"notFound",reason:"no content control at the selection"};let s=a.contentControls.disabledReason(i,"remove");return s?{ok:false,code:s==="bound"?"bound":"locked",reason:s}:a.contentControls.remove(i)?{ok:true,changed:true}:{ok:false,code:a.state().lastRejection??"unsupported",reason:a.state().lastRejection??"removeContentControl was refused"}}let r=n===void 0?Ya(t):Ps(t,n)??Ya(t);if(!r)return n!==void 0?{ok:false,code:"unsupported",reason:"invalid value for toolbar command"}:t==="file.save"?{ok:false,code:"unsupported",reason:"save is not a command; run it with runSave(editor)"}:t==="file.open"?{ok:false,code:"unsupported",reason:"open is not a command; run it with editor.load(bytes)"}:{ok:false,code:"unsupported",reason:"not wired to an editor command"};let o=e.can(r);return o.ok?e.exec(r):{ok:false,code:o.code,reason:o.reason}}function KP(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function VP(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=ks(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function zP(e,t){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};let n=e.can(t);return n.ok?e.exec(t):{ok:false,code:n.code,reason:n.reason}}function Xc(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(Xc):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,Xc(e[t])]))}function jP(e){return JSON.stringify(Xc(e))}var F0={id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"allMarkup",shape:"icon",labelKey:"review.allMarkup",defaultToolbar:false,paths:me.visibility,state:{kind:"command"}},{id:"noMarkup",shape:"icon",labelKey:"review.noMarkup",defaultToolbar:false,paths:me.visibility,state:{kind:"command"}},{id:"original",shape:"icon",labelKey:"review.original",defaultToolbar:false,paths:me.visibility,state:{kind:"command"}},{id:"previousChange",shape:"icon",labelKey:"review.previousChange",defaultToolbar:false,paths:me.keyboard_arrow_up,state:{kind:"command"}},{id:"nextChange",shape:"icon",labelKey:"review.nextChange",defaultToolbar:false,paths:me.keyboard_arrow_down,state:{kind:"command"}},{id:"acceptAllChanges",shape:"icon",labelKey:"review.acceptAllChanges",defaultToolbar:false,paths:me.check,state:{kind:"command"}},{id:"rejectAllChanges",shape:"icon",labelKey:"review.rejectAllChanges",defaultToolbar:false,paths:me.close,state:{kind:"command"}},{id:"paragraphMarks",shape:"icon",labelKey:"formattingBar.paragraphMarks",defaultToolbar:false,paths:me.format_paragraph,state:{kind:"command"}},{id:"protectDocument",shape:"icon",labelKey:"review.protectDocument",defaultToolbar:false,paths:me.lock,state:{kind:"command"}},{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:me.comment,state:{kind:"command"}},{id:"authors",shape:"dropdown",labelKey:"reviewers.label",paths:me.visibility,defaultToolbar:false,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:me.edit_note,state:{kind:"command"}}]};var Yc=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:me.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:me.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:me.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:me.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:me.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:me.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:me.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:me.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:me.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:me.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:me.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:me.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:me.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:me.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:me.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:me.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:me.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:me.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:me.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:me.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.groups.format",controls:[{id:"painter",labelKey:"formattingBar.formatPainterShortcut",paths:me.format_paint,state:{kind:"command"}},{id:"clear",labelKey:"formattingBar.clearFormatting",paths:me.format_clear,state:{kind:"command"}}]},F0,{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:me.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:me.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:me.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:me.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:me.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:me.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:me.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:me.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:me.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:me.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:me.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:me.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:me.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:me.format_line_spacing,state:{kind:"command"}}]},{id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:me.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:me.file_download,state:{kind:"save"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:me.settings,state:{kind:"command"}}]},{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:me.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:me.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:me.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:me.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:me.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:me.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:me.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:me.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:me.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:me.toc,state:{kind:"command"}}]}],O0=Yc;function WP(e,t){return `${e.id}.${t.id}`}function A0(){return O0.filter(e=>!e.contextual).map(e=>({...e,controls:e.controls.filter(t=>t.defaultToolbar!==false)}))}function UP(e){let t=A0();if(!e)return t;let n=O0.find(r=>r.id==="image");return n?[...t,n]:t}var M0=[{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:"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:"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:"table.insert",picker:"tableGrid"},{kind:"separator"},{kind:"item",slot:"insert.footnote"},{kind:"item",slot:"insert.endnote"},{kind:"separator"},{kind:"submenu",labelKey:"toolbar.break",paths:me.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"}]},{id:"review",labelKey:"toolbar.review",entries:[{kind:"submenu",labelKey:"review.displayForReview",paths:me.visibility,items:[{kind:"item",slot:"review.allMarkup"},{kind:"item",slot:"review.noMarkup"},{kind:"item",slot:"review.original"}]},{kind:"separator"},{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:"separator"},{kind:"item",slot:"review.protectDocument"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function GP(){let e=[],t=n=>{for(let r of n)r.kind==="item"?e.push(r.slot):r.kind==="submenu"&&t(r.items);};for(let n of M0)t(n.entries);return e}function XP(){return Yc.reduce((e,t)=>e+t.controls.length,0)}var YP="formattingBar.unavailableInPreview";function L0(e){let t=-1,n=true;return ()=>{let r=e.packageRevision();return t!==r&&(t=r,n=!Bg$1(e.settingsRoot()).doNotShadeFormData),n}}var Rs="switch to field results before editing a form value";function N0(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&&Ga$1(i,a.paragraphId);if(s?.kind!=="paragraph")continue;let l=o?Math.min(n.offset,r.offset):a.offset,d=o?Math.max(n.offset,r.offset):a.offset,u=Re(s);if(qe(s).filter(f=>f.addressing==="editable-result").map(f=>{let g=u.spanOf(f.node)?.start??0,y=g;for(let w of f.removeNodeIds)y=Math.max(y,u.spanOf(w)?.end??y);return {start:g,end:y}}).some(f=>l===d?l>=f.start&&(l<f.end||f.start===f.end):l<f.end&&d>f.start))return true}return false}function D0(e,t,n,r){let o=e.contentControlId?je(t).find(u=>u.id===e.contentControlId):void 0,a=Zn(n).filter(u=>u.toc.id===e.id),i=a.some(u=>u.start>0||u.end<u.length);if(o&&!i)return {tocId:e.id,boundary:o,additional:false};let s=new Map(a.map(u=>[u.paragraphId,u])),l=a.filter(u=>u.start>0||u.end<u.length).flatMap(u=>Zd$1(t,{anchor:{paragraphId:u.paragraphId,offset:u.start},head:{paragraphId:u.paragraphId,offset:u.end}},[u.paragraphId],r)),d=t.pages.flatMap(u=>{let p=B(u).filter(x=>{let b=s.get(x.paragraphId);return b&&b.start===0&&b.end===b.length}).map(td);if(p.push(...l.filter(x=>x.pageIndex===u.index)),p.length===0)return [];let f=Math.min(...p.map(x=>x.x)),g=Math.min(...p.map(x=>x.y)),y=Math.max(...p.map(x=>x.x+x.width)),w=Math.max(...p.map(x=>x.y+x.height));return [{pageIndex:u.index,box:{x:f,y:g,width:y-f,height:w-g}}]});return d.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:d}}}var H0=new WeakMap;function _0(e,t,n,r){H0.set(e,o=>{let a=t();e.flushPendingInput();try{n(o),r();}catch(i){throw n(a),r(),i}});}function B0(e,t){let n=H0.get(e);if(!n)throw new Error("Surface does not support measurement updates");n(t);}function $0(e){return e.kind==="textValue"?e.value:e.localName==="sdtPr"?"":e.children.map($0).join("")}function QP(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}}}function q0(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||!["dropdown","comboBox","date"].includes(a))return false;let i=new AbortController;t={controller:i,id:o};let s=()=>!n&&t?.controller===i&&!i.signal.aborted,l=()=>s()&&QP(e.find(o))===a&&e.allowed(o),d=e.find(o),u=e.items(o).map(y=>({...y})),p=d?$0(d):"",f=u.find(y=>y.displayText===p)?.value??p,g={controlId:o,kind:a,items:u,value:a==="date"?e.date(o)??"":f,anchor:[...e.layer.querySelectorAll("[data-docx-content-control]")].find(y=>y.getAttribute("data-docx-content-control")===o)??null,signal:i.signal,canApply:l,apply(y){return !l()||!e.apply(o,y)?false:(s()&&r(),true)},cancel(){s()&&r();}};return e.setOpen(o,true),e.request(g)?true:(g.cancel(),false)}}}function Z0(e){if(!e)return [];for(let t of e.children)if(t.kind!=="textValue"&&!(t.kind!=="contentControlProperties"&&t.localName!=="sdtPr"))for(let n of t.children){if(n.kind==="textValue"||n.localName!=="dropDownList"&&n.localName!=="comboBox")continue;let r=[];for(let o of n.children){if(o.kind==="textValue"||o.localName!=="listItem")continue;let a=o.attributes.find(s=>s.localName==="value")?.value??"",i=o.attributes.find(s=>s.localName==="displayText")?.value??a;r.push({displayText:i,value:a});}return r}return []}function K0(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 V0(e,t,n,r,o){let a=r==="left"?-1:1,i=ge$1(e,t.from,o),s=ge$1(e,t.to,o),l=i?Xd$1(e,i)??1:1,d=a*l===-1?t.from:t.to;if(!i||!s||i.lineId!==s.lineId||i.pageIndex!==s.pageIndex)return d;let u=Td$1(e).get(t.from.paragraphId)?.find(({line:y})=>y.id===i.lineId)?.line;if(!u?.spans.some(y=>y.style.shaping))return d;let p=n.indexOf(t.from.paragraphId),f=n.indexOf(t.to.paragraphId),g;for(let y of u.spans){let w=y.range.paragraphId,x=n.indexOf(w);if(x<p||x>f)continue;let b=Math.max(y.range.start,w===t.from.paragraphId?t.from.offset:0),k=Math.min(y.range.end,w===t.to.paragraphId?t.to.offset:1/0);if(!(b>=k))for(let P of [b,k]){let F={paragraphId:w,offset:P},R=ge$1(e,F,o);if(!R||R.lineId!==i.lineId||R.pageIndex!==i.pageIndex)continue;let H=R.x;(!g||(H-g.x)*a>0)&&(g={position:F,x:H});}}return g?.position??d}function z0(e,t,n){let r=e;return {get:()=>r,set(o){o!==r&&(t(),r=o,n());}}}var tR=createT(en$1);function Io(e){return t=>{try{let n=e?.(t);if(typeof n=="string"&&n&&n!==t)return n}catch{}return tR(t)}}var j0=new WeakMap;function Cs(e,t){let n=new Map;return j0.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 W0(e,t){let n=j0.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 U0(e,t,n,r){let o=Io(r),a=e.ownerDocument,i=a.createElement("dialog"),s=Cs(i,o);i.className="docx-text-form-dialog",i.setAttribute("role","alertdialog"),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 d=a.createElement("div");d.className="docx-text-form-dialog__body",s(d,`textFormField.invalid${t==="number"?"Number":"Date"}`);let u=a.createElement("div");u.className="docx-text-form-dialog__footer";let p=a.createElement("button");p.type="button",p.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",s(p,"textFormField.apply");let f=false,g=()=>{f||(f=true,n());};return p.addEventListener("click",g),i.addEventListener("keydown",y=>{y.key!=="Enter"||y.isComposing||(y.preventDefault(),y.stopPropagation(),g());}),i.addEventListener("cancel",y=>{y.preventDefault(),g();}),u.append(p),i.append(l,d,u),e.append(i),i.showModal(),p.focus(),i}function G0(e,t,n,r,o){let a=Io(o),i=e.ownerDocument,s=i.createElement("dialog"),l=Cs(s,a);s.className="docx-text-form-dialog",l(s,"textFormField.title","aria-label");let d=i.createElement("h2");d.className="docx-text-form-dialog__header",l(d,"textFormField.title");let u=i.createElement("div");u.className="docx-text-form-dialog__body";let p=i.createElement("div");p.className="docx-text-form-dialog__footer",s.append(d,u,p);let f=(E,D)=>{let $=i.createElement("label");$.className="docx-text-form-dialog__row";let X=i.createElement("span");X.className="docx-text-form-dialog__label",l(X,E),D.className="docx-text-form-dialog__input",$.append(X,D),u.append($);},g=i.createElement("input");g.type="text",g.value=t.defaultText,f("textFormField.defaultText",g);let y=i.createElement("select"),w=["regular","number","date"];for(let E of w){let D=i.createElement("option");D.value=E,l(D,`textFormField.${E}`),y.append(D);}if(!w.includes(t.type)){let E=i.createElement("option");E.value=t.type,l(E,"textFormField.preservedType"),E.disabled=true,y.append(E);}y.value=t.type,f("textFormField.type",y);let x=i.createElement("input");x.type="number",x.min="0",x.max="32767",x.step="1",x.value=String(t.maxLength),f("textFormField.maxLength",x);let b=i.createElement("select"),k=E=>{b.replaceChildren();let D=ch$1[y.value]??[];for(let $ of D){let X=i.createElement("option");X.value=$;let _={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"}[$];_||!$?l(X,_??"textFormField.noFormat"):X.textContent=$,b.append(X);}if(!D.includes(E)){let $=i.createElement("option");$.value=E,E?$.textContent=E:l($,"textFormField.noFormat"),$.disabled=true,b.append($);}b.value=E;};k(t.format),y.addEventListener("change",()=>k("")),f("textFormField.format",b);let P=i.createElement("input");P.type="checkbox",P.checked=t.enabled;let F=i.createElement("label");F.className="docx-text-form-dialog__checkbox-row";let R=i.createElement("span");l(R,"textFormField.enabled"),F.append(P,R),u.append(F);let H=i.createElement("p");H.className="docx-text-form-dialog__error",H.setAttribute("role","alert"),u.append(H);let L=i.createElement("button");L.type="button",L.className="docx-text-form-dialog__button",l(L,"textFormField.cancel"),L.addEventListener("click",r);let S=i.createElement("button");S.type="button",S.className="docx-text-form-dialog__button docx-text-form-dialog__button--primary",l(S,"textFormField.apply");let T=()=>{if(!x.value||!x.checkValidity()||!n(g.value,{type:y.value,maxLength:Number(x.value),format:b.value,enabled:P.checked})){l(H,"textFormField.invalidOptions");return}r();};return S.addEventListener("click",T),s.addEventListener("keydown",E=>{E.key==="Enter"&&!E.isComposing&&E.target instanceof HTMLInputElement&&(E.preventDefault(),T());}),s.addEventListener("cancel",E=>{E.preventDefault(),r();}),p.append(L,S),e.append(s),s.showModal(),g.focus(),g.select(),s}function X0(e,t,n){let r=[],o=[];for(let i of e)for(let s of Ih$1(i).keys()){let l=Ga$1(i,s);if(l?.kind==="paragraph")for(let d of gh$1(l)){let u=t.get(d.fieldNodeId);if(!u)continue;let p=(ki(i,s)??"").slice(d.start,d.end),f=dh$1(p,d,"fill",u.locale);if(f===null)return {reason:"invalidArgs"};if(f===p)continue;let g={op:"commitTextFormField",paragraphId:s,fieldNodeId:d.fieldNodeId,locale:u.locale},y=qi(i,g);if(y)return {reason:y};r.push(g),o.push({paragraphId:s,start:d.start,end:d.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 Es=new WeakMap,Fs=new WeakMap;function Q0(e){return Fs.get(e)?.()??null}function Y0(e){return [...Ih$1(e).keys()].flatMap(t=>{let n=Ga$1(e,t);return n?.kind==="paragraph"?gh$1(n):[]})}function Qc(e){return Es.get(e)?.()}function J0(e,t){let n=Io(e.translate),r=e.container.ownerDocument,o,a=false,i=new Map,s=()=>e.parts?.()??[e.part()];if(t?.length)for(let M of s()){let A=t.filter(Z=>Z.partName===M.name);if(!A.length)continue;let q=Y0(M);for(let Z of A){let W=q[Z.fieldIndex];W&&i.set(W.fieldNodeId,{text:Z.text,locale:Z.locale});}}let l=new WeakMap,d=new WeakMap,u=(M=e.part())=>{l.set(M,new Map([...i].filter(([A])=>A.startsWith(`${M.name}#`))));},p=()=>(i=new Map(s().flatMap(M=>[...l.get(M)??[]])),d.get(e.part())??null),f=M=>{i.delete(M),u();};s().forEach(u);let g=()=>{if(!i.size)return null;if(a)return "invalidState";let M=X0(s(),i,e.selection());if("reason"in M)return M.reason;if(M.ops.length&&!e.editable())return "locked";let A=s();s().forEach(u);let q=i;M.ops.length&&d.set(e.part(),e.selection()),i=new Map,a=true;try{let Z=M.ops.length?e.save?e.save(M.ops,M.selection):"unsupported":null;return Z?i=q:(delete ue.dataset.fieldError,M.ops.length&&d.set(e.part(),M.selection)),s().forEach(u),Z}catch(Z){throw s().every(W=>A.includes(W))&&(i=q),s().forEach(u),Z}finally{a=false;}};Fs.set(e.container,g);let y=()=>i.size?s().flatMap(M=>Y0(M).flatMap((A,q)=>{let Z=i.get(A.fieldNodeId);return Z?[{partName:M.name,fieldIndex:q,...Z}]:[]})):[];Es.set(e.container,y);let w,x=(M,A)=>(ki(e.part(),M)??"").slice(A.start,A.end),b=null,k=null,P=null,F=false,R=false,H=()=>{let M=P;P=null,R=false,b?.remove(),b=null,M?.abort();},L=()=>{if(!b&&!P)return;let M=e.selection();H(),!F&&(e.pagesLayer.focus({preventScroll:true}),e.select(M));};function S(M,A){w={paragraphId:M,fieldNodeId:A.fieldNodeId},e.select({anchor:{paragraphId:M,offset:A.start},head:{paragraphId:M,offset:A.end}}),e.selection().head.paragraphId===M&&e.selection().head.offset>=A.start&&e.selection().head.offset<=A.end&&(k=w??k),w=void 0;}function T(M,A){if(F)return;L();let q=e.locale?.()??"en-US",Z=new AbortController;P=Z;let W=()=>{if(F||Z.signal.aborted||P!==Z)return false;let V=Ga$1(e.part(M),M);return V?.kind==="paragraph"&&gh$1(V).some(j=>j.fieldNodeId===A.fieldNodeId)&&e.editable()&&!e.protected(M)},C={field:{...A},signal:Z.signal,canApply:W,apply(V,j){if(!W()||!e.apply({op:"setTextFormFieldDefault",locale:q,paragraphId:M,fieldNodeId:A.fieldNodeId,text:V,options:j}))return false;if(F||P!==Z||Z.signal.aborted)return true;let oe=Ga$1(e.part(M),M),ie=oe?.kind==="paragraph"?gh$1(oe).find(Q=>Q.fieldNodeId===A.fieldNodeId):null;return ie&&S(M,ie),L(),true},cancel(){P===Z&&!Z.signal.aborted&&L();}};e.onRequest?.(C)||Z.signal.aborted||(b=G0(e.container,A,C.apply,C.cancel,n));}let E=M=>{let q=M.target?.closest('[data-field-atom="form"][data-start]'),Z=q?.closest("[data-paragraph-id]")?.dataset.paragraphId;if(!q||!Z||!e.editable())return null;let W=Ga$1(e.part(),Z);if(W?.kind!=="paragraph")return null;let C=Number(q.dataset.start),V=gh$1(W).find(j=>j.start<=C&&C<j.end);return V?{paragraphId:Z,field:V}:null},D=null,$=M=>M.shiftKey||M.altKey||M.ctrlKey||M.metaKey,X=M=>{if(o=void 0,D=null,M.button!==0)return;let A=E(M);A&&!$(M)&&!e.protected(A.paragraphId)&&(D={x:M.clientX,y:M.clientY,paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId,moved:false}),w=A?{paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("pointerdown",X,{capture:true});let N=M=>{D&&Math.hypot(M.clientX-D.x,M.clientY-D.y)>4&&(D.moved=true);},_=()=>{D=null;},B=(M,A=false)=>{let q=D;if(D=null,!q||q.moved||b||M.button!==0||M.detail>1||Math.hypot(M.clientX-q.x,M.clientY-q.y)>4||!e.editable()||$(M)||e.protected(q.paragraphId))return;let Z=Ga$1(e.part(),q.paragraphId),W=Z?.kind==="paragraph"?gh$1(Z).find(V=>V.fieldNodeId===q.fieldNodeId):null;if(!W)return;let C=e.selection();A&&(C.anchor.paragraphId!==C.head.paragraphId||C.anchor.offset!==C.head.offset)&&!(C.anchor.paragraphId===q.paragraphId&&C.head.paragraphId===q.paragraphId&&Math.min(C.anchor.offset,C.head.offset)===W.start&&Math.max(C.anchor.offset,C.head.offset)===W.end)||S(q.paragraphId,W);};r.addEventListener("pointermove",N),r.addEventListener("pointercancel",_),e.pagesLayer.addEventListener("click",B);let G=M=>{if(M.shiftKey||M.altKey||M.ctrlKey||M.metaKey)return false;let A=E(M);if(!A)return false;let{paragraphId:q,field:Z}=A;return M.preventDefault(),S(q,Z),e.protected(q)||T(q,Z),true};e.pagesLayer.addEventListener("dblclick",G);function J(){let M=e.selection();if(M.anchor.paragraphId!==M.head.paragraphId)return null;let A=M.head.paragraphId,q=Ga$1(e.part(),A);if(q?.kind!=="paragraph")return null;let Z=Math.min(M.anchor.offset,M.head.offset),W=Math.max(M.anchor.offset,M.head.offset),C=gh$1(q).filter(j=>j.start<=Z&&j.end>=W&&(j.start===j.end||Z!==W||Z<j.end||e.protected(A))),V=C.find(j=>k?.paragraphId===A&&j.fieldNodeId===k.fieldNodeId)??C.find(j=>j.start===Z&&j.end===W)??C[0];return V?{paragraphId:A,field:V}:null}function ve(){if(o===void 0)return J();if(!o)return null;let M=Ga$1(e.part(),o.paragraphId),A=M?.kind==="paragraph"?gh$1(M).find(q=>q.fieldNodeId===o.fieldNodeId):null;return A?{paragraphId:o.paragraphId,field:A}:null}let ce=M=>{let A=M.button===-1||M.clientX===0&&M.clientY===0?J():E(M);o=A?{paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId}:null;};e.pagesLayer.addEventListener("contextmenu",ce);let Te=()=>{let M=ve();return !!M&&e.editable()&&!e.protected(M.paragraphId)&&!qi(e.part(),{op:"setTextFormFieldDefault",paragraphId:M.paragraphId,fieldNodeId:M.field.fieldNodeId,text:"",options:{type:"regular",maxLength:0,format:"",enabled:true}})},ue=r.createElement("span");return ue.className="docx-text-form-status",e.container.append(ue),{doubleClick:G,pointerUp:M=>B(M,true),canEdit:Te,edit(){if(!Te())return false;let M=ve();return S(M.paragraphId,M.field),T(M.paragraphId,M.field),true},selectForDeletion(M){let A=e.selection(),{paragraphId:q,offset:Z}=A.head;if(!e.editable()||e.protected(q)||A.anchor.paragraphId!==q||A.anchor.offset!==Z)return false;let W=Ga$1(e.part(),q);if(W?.kind!=="paragraph")return false;let C=gh$1(W).find(V=>V.start<V.end&&(M==="backward"?V.end===Z:V.start===Z));return C?(S(q,C),true):false},wordDeletionBoundary(M,A,q,Z){let W=Wd$1(M,A,q,Z),C=e.selection().head.paragraphId;if(e.protected(C))return W;let V=Ga$1(e.part(C),C);if(V?.kind!=="paragraph")return W;let j=gh$1(V),oe=j.find(Q=>Q.start<Q.end&&(q===-1?Q.end===A:Q.start===A));if(oe)return q===-1?oe.start:oe.end;let ie=W;for(let Q of j)for(let ne of [Q.start,Q.end])q===-1&&ne<A&&ne>ie&&(ie=ne),q===1&&ne>A&&ne<ie&&(ie=ne);return ie},beforeSelect(M){let A=Pe=>{if(w!==void 0)k=w;else if(M.anchor.paragraphId!==M.head.paragraphId||k?.paragraphId!==M.head.paragraphId)k=null;else {let We=Ga$1(e.part(),M.head.paragraphId),ht=We?.kind==="paragraph"?gh$1(We).find(Oe=>Oe.fieldNodeId===k?.fieldNodeId):null;(!ht||Math.min(M.anchor.offset,M.head.offset)<ht.start||Math.max(M.anchor.offset,M.head.offset)>ht.end)&&(k=null);}return w=void 0,delete ue.dataset.fieldError,Pe};if(a||R)return null;if(!e.editable())return M;let q=J();if(!q||!e.protected(q.paragraphId)||!q.field.enabled||!eh$1(q.field))return A(M);let{field:Z,paragraphId:W}=q;if((!w||w.fieldNodeId===Z.fieldNodeId)&&M.anchor.paragraphId===W&&M.head.paragraphId===W&&Math.min(M.anchor.offset,M.head.offset)>=Z.start&&Math.max(M.anchor.offset,M.head.offset)<=Z.end)return A(M);let C=i.get(Z.fieldNodeId),V=C?.text,j=C?.locale??e.locale?.()??"en-US",oe=x(W,Z);if(Z.type==="date"&&V===void 0)return f(Z.fieldNodeId),A(M);let ie=dh$1(oe,Z,"fill",j);if(ie===oe||ie===null&&(V===void 0||V===oe))return f(Z.fieldNodeId),A(M);a=true;let Q=e.part();u(Q);let ne=i;i=new Map(ne),i.delete(Z.fieldNodeId);let Ae;try{Ae=e.apply({op:"commitTextFormField",locale:j,paragraphId:W,fieldNodeId:Z.fieldNodeId}),Ae||(i=ne);}catch(Pe){throw e.part()===Q&&(i=ne),Pe}finally{u(),a=false;}if(!Ae){if(w=void 0,ue.setAttribute("role","alert"),ue.dataset.fieldError="true",ue.textContent=n("textFormField.invalidValue"),ie===null&&(Z.type==="number"||Z.type==="date")){H();let Pe=new AbortController;P=Pe,R=true;let We=()=>{if(F||Pe.signal.aborted||P!==Pe||(H(),F))return;let Oe=e.selection(),se=()=>{e.pagesLayer.focus({preventScroll:true}),e.select(Oe);},nt=Ga$1(e.part(),W),Be=nt?.kind==="paragraph"?gh$1(nt).find(tn=>tn.fieldNodeId===Z.fieldNodeId):null;if(!Be||!e.editable()||!e.protected(W)||x(W,Be)!==oe||!Be.enabled||!eh$1(Be)||Be.type!==Z.type||Be.format!==Z.format||dh$1(oe,Be,"fill",j)!==null){se();return}a=true;try{if(e.apply({op:"deleteText",paragraphId:W,start:Be.start,end:Be.end,textFormFieldId:Be.fieldNodeId})){f(Be.fieldNodeId),delete ue.dataset.fieldError,e.pagesLayer.focus({preventScroll:!0});let tn={paragraphId:W,offset:Be.start};a=!1,e.select({anchor:tn,head:tn}),k={paragraphId:W,fieldNodeId:Be.fieldNodeId};}else a=!1,se();}finally{a=false;}},ht={type:Z.type,signal:Pe.signal,acknowledge:We,cancel(){P===Pe&&!Pe.signal.aborted&&L();}};!e.onInvalidRequest?.(ht)&&!Pe.signal.aborted&&(b=U0(e.container,Z.type,We,n));}return null}f(Z.fieldNodeId);let we=Ga$1(e.part(),W),tt=we?.kind==="paragraph"?gh$1(we).find(Pe=>Pe.fieldNodeId===Z.fieldNodeId):null,Xe=tt?tt.end-Z.end:0,Re=Pe=>Pe.paragraphId===W&&Pe.offset>=Z.end?{...Pe,offset:Pe.offset+Xe}:Pe;return A({anchor:Re(M.anchor),head:Re(M.head)})},update(){b&&W0(b,n);let M=J(),A=e.selection(),q=!!M&&A.anchor.offset!==A.head.offset&&Math.min(A.anchor.offset,A.head.offset)===M.field.start&&Math.max(A.anchor.offset,A.head.offset)===M.field.end;for(let Z of e.pagesLayer.querySelectorAll('[data-field-atom="form"][data-start]')){let W=Z.closest("[data-paragraph-id]")?.dataset.paragraphId,C=Number(Z.dataset.start);!!M&&W===M.paragraphId&&C>=M.field.start&&C<M.field.end?Z.dataset.textFormSelection=q?"whole":"caret":delete Z.dataset.textFormSelection;}if(ue.dataset.fieldError){ue.textContent=n("textFormField.invalidValue");return}M?ue.setAttribute("role","status"):ue.removeAttribute("role"),ue.textContent=M?n(q?"textFormField.selected":"textFormField.editing"):"";},fieldId:()=>J()?.field.fieldNodeId??null,afterApply(M){M?u():p();},restoreAfterHistory:p,annotate(M){(!a||M.some(q=>q.op!=="commitTextFormField"))&&u(),M.some(q=>q.op==="insertText"||q.op==="deleteText")&&delete ue.dataset.fieldError;let A=J();return k=A?{paragraphId:A.paragraphId,fieldNodeId:A.field.fieldNodeId}:null,M.map(q=>{if(!k||q.op!=="insertText"&&q.op!=="deleteText"||q.revision||q.paragraphId!==k.paragraphId||!e.protected(q.paragraphId))return q;let Z=Ga$1(e.part(),q.paragraphId),W=Z?.kind==="paragraph"?gh$1(Z).find(j=>j.fieldNodeId===k.fieldNodeId):null,C=q.op==="insertText"?q.offset:q.start,V=q.op==="insertText"?q.offset:q.end;return !W||C<W.start||V>W.end?q:(i.has(W.fieldNodeId)||i.set(W.fieldNodeId,{text:x(q.paragraphId,W),locale:e.locale?.()??"en-US"}),{...q,textFormFieldId:W.fieldNodeId})})},keydown(M){if(M.key==="F10"&&M.shiftKey&&!M.altKey&&!M.ctrlKey&&!M.metaKey)return o=void 0,M.preventDefault(),e.pagesLayer.dispatchEvent(new MouseEvent("contextmenu",{bubbles:true,cancelable:true,button:-1})),true;if(M.key!=="Tab"||M.altKey||M.ctrlKey||M.metaKey||!e.editable()||!e.protected(e.selection().head.paragraphId))return false;let A=[],q=[e.part().root];for(;q.length;){let ie=q.pop();if(ie.kind==="paragraph")for(let Q of gh$1(ie))e.protected(ie.id)&&Q.enabled&&eh$1(Q)&&!qi(e.part(),{op:"insertText",paragraphId:ie.id,offset:Q.start,text:"x"})&&A.push({paragraphId:ie.id,field:Q});else for(let Q=ie.children.length-1;Q>=0;Q--){let ne=ie.children[Q];ne.kind!=="textValue"&&q.push(ne);}}if(!A.length)return false;let Z=e.selection(),W=Z.head,C=k?A.findIndex(ie=>ie.paragraphId===k.paragraphId&&ie.field.fieldNodeId===k.fieldNodeId&&ie.field.start<=Math.min(Z.anchor.offset,W.offset)&&ie.field.end>=Math.max(Z.anchor.offset,W.offset)):-1,V=C>=0?C:A.findIndex(ie=>ie.paragraphId===W.paragraphId&&ie.field.start<=Math.min(Z.anchor.offset,W.offset)&&ie.field.end>=Math.max(Z.anchor.offset,W.offset)),j=V<0?M.shiftKey?A.length-1:0:(V+(M.shiftKey?-1:1)+A.length)%A.length,oe=A[j];return M.preventDefault(),S(oe.paragraphId,oe.field),true},destroy(){F=true,H(),Fs.get(e.container)===g&&Fs.delete(e.container),Es.get(e.container)===y&&Es.delete(e.container),r.removeEventListener("pointermove",N),r.removeEventListener("pointercancel",_),e.pagesLayer.removeEventListener("click",B),e.pagesLayer.removeEventListener("contextmenu",ce),ue.remove(),e.pagesLayer.removeEventListener("dblclick",G),e.pagesLayer.removeEventListener("pointerdown",X,{capture:true}),b?.remove(),b=null;}}}var Os=new WeakMap;function Jc(e){let t=Os.get(e);if(t)return t.settled??=new Promise(n=>{t.resolve=n;}),t.settled}function eb(e){let t=Os.get(e)??{depth:0};return t.depth++,Os.set(e,t),()=>{--t.depth===0&&(Os.delete(e),t.resolve?.());}}async function tb(e,t,n){if(!e)throw qt("notFound","no document is loaded");let r=t?Jc(t):void 0;if(r&&(await r,n()!==e))throw qt("invalidState","The document changed before the pending save could finish.");return e.save().slice().buffer}function nb(e,t,n){let r=()=>{if(n())throw qt("destroyed","Cannot save a destroyed surface.")};if(r(),Jc(t))throw qt("invalidState","Cannot save during an active edit. Retry after the edit finishes.");e.flushPendingInput(),r();let o=Q0(t);if(o)throw qt(o,"Cannot save pending text form input. Enter a valid value in each field.");return r(),e.refreshRefFieldResults(),r(),e.session.save()}function rb(e,t,n){let r=false;return t(()=>{let o=n([e]);return r=!o.rejected,o}),r}function ob(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=St(n.session,i.paragraphId,{kind:"body"}),l=JSON.stringify(s),d=o.get(l)??{scope:s,ops:[]};d.ops.push(i),o.set(l,d);}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 ab(e,t){let n=bh$1(e);return {get:()=>n,set(r){let o=bh$1(r);n!==o&&(t(),n=o);}}}var nR=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertNote","insertTableRow","deleteTableRow","setRunProperties","setParagraphProperties","setParagraphMarkProperties"]);function eu(e){return nR.has(e.op)}function tu(e){if(eu(e))return e.revision!==void 0;switch(e.op){case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "splitParagraphMany":return e.revision!==void 0;default:return false}}function nu(e){return e?.trim()||void 0}function ib(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(n=>n[0].toUpperCase()).join("")}function sb(e){return e==="suggesting needs an author before it can propose a change"||e==="tracked changes need a non-empty author"}function As(e,t,n){if(!e)return null;let r=_c$1(e,t);return !r||r.record.paragraphId!==n?null:{paragraphId:n,offset:r.record.start}}var lb="docx-field-atom--active",rR="docx-field-atom",db=new WeakMap;function ru(e,t,n){let r=db.get(e);r||(r={caretKey:null,marked:[]},db.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(lb);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${rR}`);for(let i of a){if(i.dataset.paragraphId!==t.paragraphId)continue;let s=Number(i.dataset.start),l=Number(i.dataset.end);!Number.isFinite(s)||!Number.isFinite(l)||t.offset<s||t.offset>l||(i.classList.add(lb),r.marked.push(i));}}var oR={kind:"body"};function cb(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??=ea(e.canonicalUnfilteredLayout()),n(l)):ea(e.layout),o={package:t.currentPackage(),styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,displayMode:e.displayMode,pageRefPageNumberOf:r},a=fa(t.part(),o),i=ga(t.part(),o);if(!a&&i.length===0)return true;let s=[];a&&s.push({scope:oR,ops:[a]});for(let l of i)s.push({scope:{kind:"notesPart",noteKind:l.noteKind},ops:[l.op]});return t.applyTreeOpsAtomic(s).committed}function fb(e){let t=0,n=null,r="",o=null,a=true,i=null,s="";return ()=>{let l=e.surface(),d=`${l?.session.packageRevision()??-1}:${l?.session.revision()??-1}`,u=e.activeKey(),p=e.paneOpen(),f=e.selectionAnchor(),g=e.authorFilterKey();return (l!==n||d!==r||u!==o||p!==a||f!==i||g!==s)&&(n=l,r=d,o=u,a=p,i=f,s=g,t+=1),t}}function Ms(e=[]){let t=new Set(e),n=Object.freeze([...t]),r=Z(t),o=null,a="accept",i=null,s="accept",l=new WeakMap,d=null,u=false,p=0,f=null,g=[],y=null,w=[],x=r,b=t,k=new Set,P="accept",F=new WeakSet,R=new WeakMap,H=new Map,L=()=>{p+=1,f=null,g=[],y=null;},S=D=>JSON.stringify([D.id,Ea(D)]),T=(D,$,X)=>{let N=aR(X),_=t,B=r?.hiddenAuthors??Y,G=a,J;_===b&&iR(N,k)&&(N.size===0||G===P)?J=x:N.size===0&&_.size===0?J=void 0:J=Object.freeze({hiddenAuthors:B,includes:ce=>!_.has(ce.author)&&!N.has(ce.nodeId),includesNode:(ce,Te)=>!_.has(Te)&&!N.has(ce),excludedNodeMode:(ce,Te)=>_.has(Te)?"proposed":N.has(ce)&&G==="reject"?"original":"proposed",cacheKey:sR(_,N,G)});let ve=[];for(let ce of D){let Te=ub(ce);Te!==null&&_.has(Te)||ce.kind==="revision"&&$.has(ce)||ve.push(ce);}w=ve.length===D.length?D:Sa(ve),y=D,F=$,x=J,b=_,k=N,P=G,u=false,i=null,s="accept",l=new WeakMap,d=null;},E=D=>{if(D===y)return;let $=new WeakSet,X=[],N=[];try{for(let B of D){if(B.kind!=="revision")continue;let G=!t.has(B.author),J=R.get(B);J===void 0&&(J=o?.(B)??!0,N.push([B,J])),!(G&&J)&&($.add(B),J||X.push(B));}}catch(B){if(u)o=i,a=s,R=l,y=d,i=null,s="accept",l=new WeakMap,d=null,p+=1;else {let G=new WeakSet,J=[];for(let ve of D){if(ve.kind!=="revision")continue;let ce=H.get(S(ve))??true;(t.has(ve.author)||!ce)&&G.add(ve),ce||J.push(ve);}T(D,G,J);}throw u=false,B}for(let[B,G]of N)R.set(B,G);let _=new Map;for(let B of D)B.kind==="revision"&&_.set(S(B),R.get(B)??true);H=_,T(D,$,X);};return {get hiddenAuthors(){return r?.hiddenAuthors??Y},get hiddenAuthorList(){return n},get stateKey(){return String(p)},get hasFilter(){return t.size>0||o!==null},filterFor(D){return o?(E(D),x):r},filterForSession(D){return o?(E(D.reviewItems()),x):r},filterItems(D){if(!o){if(t.size===0)return D;if(D===f)return g;let $=D.filter(X=>{let N=ub(X);return N===null||!t.has(N)});return f=D,g=$.length===D.length?D:Sa($),g}return E(D),w},includesRevisionItem(D){return !F.has(D)},setPredicate(D,$="accept"){return o===null&&D===null?false:D===null?(o=null,a="accept",i=null,s="accept",u=false,R=new WeakMap,l=new WeakMap,H=new Map,d=null,w=[],F=new WeakSet,x=r,b=t,k=new Set,P="accept",L(),true):(i=o,s=a,l=R,d=y,u=true,o=D,a=$,R=new WeakMap,L(),true)},isVisible:D=>!t.has(D),setVisible(D,$){if($===!t.has(D))return false;let X=new Set(t);return $?X.delete(D):X.add(D),t=X,n=Object.freeze([...X]),r=Z(X),L(),true},setAllVisible(D,$){let X=$?new Set:new Set(D);return X.size===t.size&&[...X].every(N=>t.has(N))?false:(t=X,n=Object.freeze([...X]),r=Z(X),L(),true)},showAll(){return t.size===0?false:(t=new Set,n=Object.freeze([]),r=void 0,L(),true)}}}function ou(e,t){return t.filterItems(e)}function aR(e){let t=new Set;for(let n of e)for(let r of Ea(n))t.add(r);return t}function iR(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function sR(e,t,n){return JSON.stringify({hiddenAuthors:[...e].sort(),excludedNodeIds:[...t].sort(),mode:t.size===0?"accept":n})}function ub(e){return e.kind==="comment"?e.comment?.author??"":e.author??null}function pb(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)}}function au(e){return e.kind==="comment"?e.comment.author:e.kind==="revision"?e.author:null}function mb(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(d$2(n),(function*(){for(let f of r){let g=au(f);g!==null&&(yield g);}})()),s=a?.value,l=s!==void 0&&s.size===i.size&&[...i].every(([p,f])=>s.get(p)===f),d=l?s:i,u=a!==null&&l&&a.styles===o?a.resolved:new Map(c(d,o).map(p=>[p.author,p]));return t={layout:n,items:r,styles:o,value:d,resolved:u},t},releaseLayout(){t!==null&&(t={...t,layout:null,items:null});}}}function gb(e){let t=null;return {forAuthor(n){let r=e.roster(),o=r.resolved.get(n);if(o)return a$6(o.color)??a$7(o.slot);let a=e.slots.resolve(r.value,[n]).get(n);return a===void 0?void 0:a$7(a)},declaredFor(n){let r=e.styles();return (t===null||t.styles!==r)&&(t={styles:r,resolved:b$1(r)}),a$6(t.resolved.get(n)?.color)}}}function ko(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function yb(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 bb(e,t){let n=Ga$1(e,t);if(!n||n.kind==="textValue")return null;let r=Eb$1(n);return !r||!Db$1(r)?null:{paragraphId:r.toUpperCase(),nodeId:t,text:""}}var iu=new WeakMap;function lR(e,t,n){return e.map(r=>a$6(n?.(r.name))??a$6(r.color)??a$6(t?.(r.name)))}function dR(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}
16
- `;return n}function cR(e){if(!e)return "*";let t=[];for(let n of e)t.push(n);return t.sort((n,r)=>n-r),t.join(",")}function uR(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 fR(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 hb(e){return e.anchor.nodeId===e.head.nodeId&&e.anchor.offset===e.head.offset}function pR(e,t){let n=za$2(e,t.anchor.nodeId),r=za$2(e,t.head.nodeId);if(!n||!r)return [];let o=ra$1(e,n,r);return o?va(e,o.cellIds).map(a=>({...a,className:"docx-remote-selection-rect"})):[]}function vb(e,t,n,r){let{scale:o$1,pageOffsetX:a,pages:i,colorForAuthor:s,declaredColorFor:l}=r,d=r.labelHost??null,u=lR(n,s,l),p={layout:t,fingerprint:dR(n,u),pagesKey:cR(i),scale:o$1,offsetKey:uR(a),labelHost:d},f=iu.get(e);if(f&&fR(f,e,p))return;iu.delete(e);let g=[],y=[],w=[],x=[];for(let[F,R]of n.entries())R.kind==="cells"||hb(R)||x.push({key:String(F),from:{paragraphId:R.anchor.nodeId,offset:R.anchor.offset},to:{paragraphId:R.head.nodeId,offset:R.head.offset}});let b=x.length>0?de(t,x,W(t),i,r.measurer):null;for(let[F,R]of n.entries()){let H=u[F],L=ge$1(t,{paragraphId:R.head.nodeId,offset:R.head.offset},r.measurer);if(L){let T=ce(t,R.head.nodeId,L.pageIndex);w.push({selection:R,...H?{color:H}:{},pageIndex:L.pageIndex,x:L.x+T.x,y:L.y+T.y});}if(R.kind==="cells"){let T=pR(t,R);if(T.length>0){for(let E of T)g.push(E),y.push(H);continue}}if(hb(R)){let T=ge$1(t,{paragraphId:R.anchor.nodeId,offset:R.anchor.offset},r.measurer);if(!T)continue;let E=ce(t,R.anchor.nodeId,T.pageIndex);g.push({pageIndex:T.pageIndex,x:T.x+E.x,y:T.y+E.y,width:Math.max(1/o$1,1),height:T.height,className:"docx-remote-caret"}),y.push(H);continue}let S=b?.get(String(F));if(S)for(let T of S)g.push({...T,className:"docx-remote-selection-rect"}),y.push(H);}o(e,t,g,{scale:o$1,pageOffsetX:a}),[...e.children].forEach((F,R)=>{let H=a$6(y[R]);!H||!(F instanceof HTMLElement)||F.style.setProperty("--doc-remote-color",H);});let k=e.ownerDocument,P=[];for(let F of w){let R=t.pages[F.pageIndex];if(!R)continue;let H=k.createElement("div");H.className="docx-remote-caret-label",d?(H.setAttribute("data-docx-remote-actor",F.selection.actorId),P.push({element:H,selection:F.selection})):H.textContent=F.selection.name,H.style.left=`${(R.contentBox.x+F.x+(a?.get(F.pageIndex)??0))*o$1}px`,H.style.top=`${(R.contentBox.y+F.y)*o$1}px`;let L=a$6(F.color);L&&H.style.setProperty("--doc-remote-color",L),e.append(H);}iu.set(e,{...p,childCount:e.childElementCount}),d&&d.publish(P);}var mR=/[\p{L}\p{N}_'’]/u,xb=e=>e!==void 0&&mR.test(e);function Ls(e,t,n){let r=ke(e,t.paragraphId),o=t.paragraphId,a=Math.max(0,Math.min(t.offset,r.length)),i=-1;if(xb(r[a])?i=a:a>0&&xb(r[a-1])&&(i=a-1),i===-1){let s=a,l=a;for(;s>0&&/\s/.test(r[s-1]??"");)s-=1;for(;l<r.length&&/\s/.test(r[l]??"");)l+=1;return s===l&&l<r.length&&(l+=1),{from:{paragraphId:o,offset:s},to:{paragraphId:o,offset:l}}}return {from:{paragraphId:o,offset:Wd$1(r,i+1,-1,n)},to:{paragraphId:o,offset:Wd$1(r,i,1,n)}}}function He(e){return {anchor:e,head:e}}function Zr(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 Ns(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??V(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function Qa(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,d=ke(e,s).length;return {paragraphId:s,offset:Math.max(0,Math.min(l,d))}};return {anchor:o(n.anchor),head:o(n.head)}}function Ds(e,t,n,r){if(t.paragraphId===n.paragraphId)return ke(e,t.paragraphId).slice(t.offset,n.offset);let o=r??V(e),a=o.indexOf(t.paragraphId),i=o.indexOf(n.paragraphId);if(a===-1||i===-1)return "";let s=o.slice(a,i+1),l=ke(e,t.paragraphId).slice(t.offset);for(let d=1;d<s.length;d+=1){let u=s[d],p=ke(e,u),f=S(e,u).includes(s[d-1])?"":`
17
- `;l+=f+(d===s.length-1?p.slice(0,n.offset):p);}return l}function su(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 wb(e){return e.kind}function Ib(e){return e.kind!=="textValue"&&wb(e)==="contentControl"}function Sb(e){return e.kind!=="textValue"&&wb(e)==="contentControlContent"}function gR(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=su(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 hR(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(Ib(a)){let s=su(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 kb(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 yR(e,t,n){let r=[],o=a=>{if(a.kind!=="textValue"){if(a.kind==="table"||Ib(a)){let s=su(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 Tb(e,t,n,r,o){let a=f=>ke(e,f);if(n.paragraphId===r.paragraphId&&n.offset===r.offset)return null;let i=o??V(e),s=i.indexOf(n.paragraphId),l=i.indexOf(r.paragraphId);if(s===-1||l===-1||s>l)return null;let d=i.slice(s,l+1),u=kb(a,i,s,l,n,r),p=i[l];return {partName:t.name,paragraphIds:d,startOffset:n.offset,endOffset:r.offset,coveredParagraphIds:[...u],fullyCoveredBlockIds:yR(t,u,new Set(i)),lastMarkCovered:r.offset===a(p).length}}function Pb(e,t,n,r,o){let a=H=>ke(e,H);if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:[{op:"deleteText",paragraphId:n.paragraphId,start:n.offset,end:r.offset}],collapseTo:n};let i=o??V(e),s=i.indexOf(n.paragraphId),l=i.indexOf(r.paragraphId);if(s===-1||l===-1)return {ops:[],collapseTo:n};let d=kb(a,i,s,l,n,r),u=gR(t,d),p=new Map;for(let[H,L]of u)for(let S of L)p.set(S,H);let f=hR(t,d,u),g=s;if(p.has(n.paragraphId)){g=-1;for(let H=s+1;H<=l;H+=1)if(!p.has(i[H])){g=H;break}if(g===-1){let H=p.get(n.paragraphId);for(let L of u.get(H)??[])p.delete(L);u.delete(H),g=s;}}let y=i[g],w=g===s?n:{paragraphId:y,offset:0},x=[];for(let H=s;H<=l;H+=1){let L=i[H];if(p.has(L))continue;let S=a(L).length,T=H===s?n.offset:0,E=H===l?r.offset:S;T<E&&x.push({op:"deleteText",paragraphId:L,start:T,end:E});}for(let H of u.keys())x.push({op:"deleteBlock",blockId:H});for(let H of f)x.push({op:"removeContentControl",controlId:H});let b=H=>{let L=Ha$1(t,H);for(;L&&Sb(L);){let S=Ha$1(t,L.id);if(!S||!f.has(S.id))break;L=Ha$1(t,S.id);}return L},k=H=>{let L=[],S=T=>{for(let E of T)if(E.kind!=="textValue"&&!u.has(E.id)){if(f.has(E.id)){let D=E.children.find(Sb);D&&D.kind!=="textValue"&&S(D.children);continue}if(E.kind==="paragraph"){L.push(E.id);continue}L.push(`\0barrier:${E.id}`);}};return S(H.children),L},P=(H,L)=>{let S=b(H);if(!S||b(L)!==S)return false;let T=k(S),E=T.indexOf(H),D=T.indexOf(L);return E!==-1&&D===E+1},F=y,R=y;for(let H=g+1;H<=l;H+=1){let L=i[H];p.has(L)||(P(R,L)?x.push({op:"joinParagraphs",firstId:F,secondId:L}):F=L,R=L);}return {ops:x,collapseTo:w}}function bR(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var Fb=/^[^\s]{1,512}$/,vR=/["\\\u0000-\u001f\u007f]/;function Hs(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!Fb.test(t)||t==="__proto__")return null;let r=Number(n),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:t,start:r,end:a}}function Ja(e,t,n){return vR.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function Ob(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=Hs(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function Ab(e){return e.querySelector("[data-docx-hf-active]")}function Kr(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 xR(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function lu(e,t){let n=Ab(e);if(n)return [n,e];let r=xR(e,t);return r&&r!==e?[r,e]:[e]}function Rb(e,t){let n=Ob(e);if(n)return n;if(e.nodeType!==Node.ELEMENT_NODE)return null;let r=e.querySelectorAll("[data-paragraph-id][data-start]"),o=t?[...r].reverse():[...r];for(let a of o){let i=Hs(a);if(i)return {element:a,identity:i}}return null}function SR(e,t){let n=[...e.childNodes];if(n.length===0)return null;for(let r=Math.max(0,t);r<n.length;r+=1){let o=Rb(n[r],false);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.start}}for(let r=Math.min(t,n.length)-1;r>=0;r-=1){let o=Rb(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function Cb(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")||Ab(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?Mb(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let s=e,l=Hs(s);if(l)return {paragraphId:l.paragraphId,offset:t>0?l.end:l.start};let d=SR(s,t);return d||TR(s)}let i=Ob(e);return i?{paragraphId:i.identity.paragraphId,offset:bR(i.identity,t)}:null}function To(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=Cb(n,r,e),s=Cb(o,a,e);if(!i||!s){let l=i??s;return l?{anchor:l,head:l}:null}return {anchor:i,head:s}}function du(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 Eb(e,t,n){for(let r of lu(e,n)){let o=wR(r,t);if(o)return o}return null}function wR(e,t){let n=Ja(e,t.paragraphId,"[data-start]"),r=null,o=false;for(let i of n){let s=Hs(i);if(!s||s.paragraphId!==t.paragraphId)continue;let l=IR(i),d=i.textContent?.length??0,u=s.end;if(l&&!i.closest?.("[data-docx-field]")&&(o=true,t.offset>=s.start&&t.offset<=u)){let p={node:l,offset:Math.min(t.offset-s.start,d)};if(t.offset<u)return p;r=p;}}if(r)return r;if(o)return null;let a=kR(e,t.paragraphId);return a?{node:a,offset:0}:null}function IR(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 kR(e,t){let n=null;for(let r of Ja(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 Mb(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!Fb.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function TR(e){let t=Mb(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function Lb(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??Kr(n.anchorNode,e),a=Eb(e,t.anchor,o),i=Eb(e,t.head,o);if(!a||!i)return false;let s=To(e,n);if(s&&Zt(s,t)){let l=Kr(n.anchorNode,e);if(o===void 0||l===o)return true}try{return n.setBaseAndExtent(a.node,a.offset,i.node,i.offset),!0}catch{return false}}function Zt(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 PR='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function Nb(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 Db(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 RR(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function CR(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function Hb(e,t,n,r){if(e.dataset.docxField!==void 0){let a=Nb(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:Nb(e,t,t+o.length),text:o,seq:r}}function _b(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=Db(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0||r.matches?.(PR))continue;_b(r,t);continue}let a=Hb(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 ER(e,t,n,r){let o=[];for(let i of Ja(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=CR(i,n,r),d=a.get(s);(!d||l>d.affinity)&&a.set(s,{element:i,affinity:l});}return [...a.values()].map(i=>i.element)}function FR(e,t,n){for(let r of Ja(e,n.paragraphId,"[data-start]")){let o=r,a=Db(o,n.paragraphId);if(a===null||t.some(l=>l.contains(o)))continue;let i=Hb(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 OR(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 Bb(e,t,n,r){let o=ER(e,t,r,RR(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let i of o)_b(i,a);return FR(e,o,a),a.pieces.length===0?null:OR(a.pieces,n)}var AR={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},$b={l:"left",e:"center",r:"right",j:"both"},qb={1:"240",5:"360",2:"480"},Zb={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function MR(e,t){return e.altKey?e.metaKey?true:e.ctrlKey?e.getModifierState?.("AltGraph")??false?e.key.toLowerCase()===t:true:false:false}var LR=/^[a-z]$/;function NR(e){let t=e.key.toLowerCase();if(LR.test(t))return t;let n=e.code??"";return n.length===4&&n.startsWith("Key")?n[3].toLowerCase():""}function Vb(e,t={}){return n=>{if(n.defaultPrevented)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(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 r=NR(n);if(MR(n,r)&&!n.shiftKey){let i=r;if(i==="f"){n.preventDefault(),e.insertNote("footnote");return}if(i==="d"){n.preventDefault(),e.insertNote("endnote");return}if(i==="c"){n.preventDefault(),e.formatPainter.capture();return}if(i==="v"){n.preventDefault(),e.formatPainter.apply();return}}let o=n.metaKey||n.ctrlKey,a=AR[n.key];if(a){let i=a;n.key==="Home"||n.key==="End"?o&&(i=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?i=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?i=n.key==="ArrowLeft"?"lineStart":"lineEnd":o&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(i=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(i,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(o?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){o||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){o||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}e.isListParagraph()?e.adjustIndent(n.shiftKey?"decrease":"increase"):n.shiftKey?e.adjustIndent("decrease"):e.insertTab(),n.preventDefault();return}if(n.key==="Enter"){o?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(o&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(o&&n.shiftKey&&n.key.toLowerCase()==="v"){e.armForcePlainPaste();return}if(o&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){t.onRequestHyperlink(),n.preventDefault();return}if(o&&!n.shiftKey&&Zb[n.key.toLowerCase()]){let i=Zb[n.key.toLowerCase()];e.toggleRunProperty(i.localName,i.attributes),n.preventDefault();return}if(o&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(o&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(o&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(o&&!n.shiftKey&&$b[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:$b[n.key.toLowerCase()]}),n.preventDefault();return}if(o&&!n.shiftKey&&qb[n.key]){e.setParagraphProperty("spacing",{line:qb[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}if(o&&n.key.toLowerCase()==="y"){e.redo(),n.preventDefault();return}(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="z"&&(n.shiftKey?e.redo():e.undo(),n.preventDefault());}}function zb(e){let t=a=>{let i=e.copyFlavours();return i.text?(a.clipboardData?.setData("text/plain",i.text),i.html&&a.clipboardData?.setData("text/html",i.html),true):false};return {onCopy:a=>{t(a)&&a.preventDefault();},onCut:a=>{t(a)&&(e.deleteSelection(),a.preventDefault());},onPaste:a=>{let i=Yd(a.clipboardData),s=a.clipboardData?.getData("text/html")??"";a.preventDefault(),!(!i&&!s)&&e.pasteRich(i,s.length>0?s:null);}}}function Kb(e){let t=Yd(e.dataTransfer);return t.length>0?t:null}function jb(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??Kb(n);if(!r)return;BR(e,HR(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=Kb(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function DR(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 HR(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=DR(n);return r?{text:r,paragraphId:_R(n)}:null}function _R(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 BR(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,a=t.text;if(Zt(r.selection,He(o))&&o.offset>=a.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let i=Ge(e.session,o.paragraphId)??e.session.part(),s=ki(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 Wb(e,t,n,r=null){for(let o of lu(e)){let a=Bb(o,t,n,r);if(a!==null)return a}return null}function Ub(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 Le(e){return e.kind!=="textValue"}function ge(e,t){if(!e||e.kind==="textValue")return null;for(let n of e.children)if(Le(n)&&n.localName===t&&n.namespaceUri===da$1)return n;return null}function ze(e,t="val"){return e?Ge$1(e,t,da$1):void 0}function Yt(e,t,n){return e?Ge$1(e,t,n):void 0}function cu(e){if(e.kind==="textValue")return e.value;let t="";for(let n of e.children)t+=cu(n);return t}function Po(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=Po(r,t,n);if(o)return o}return null}function gt(e){if(e===void 0||!/^-?\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}function uu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var Rn=uu;function _s(e){return e===void 0||e.toLowerCase()==="auto"?null:/^[0-9A-Fa-f]{6}$/.test(e)?`#${e.toLowerCase()}`:null}function Cn(e){return `${Math.round(e/20*100)/100}pt`}var $R="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",qR=Ab$1;function ei(e,t,n){for(let o of hc$1(e,e.mainDocumentPart)){if(o.type!==t||o.targetMode==="External")continue;let a=w(o.ownerPart,o.rawTarget);if(a.ok){let i=e.parts.get(a.partName);if(i&&Le(i.root))return i.root}}let r=e.parts.get(n);return r&&Le(r.root)?r.root:null}function Gb(e){let t=ei(e,$R,"/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;for(let d of t.children){if(!Le(d)||d.namespaceUri!==da$1)continue;if(d.localName==="docDefaults"){r=ge(ge(d,"rPrDefault"),"rPr"),o=ge(ge(d,"pPrDefault"),"pPr");continue}if(d.localName!=="style")continue;if(l>=Bb$1)break;l+=1;let u=Ge$1(d,"styleId",da$1);if(!u)continue;n.set(u,d);let p=Ge$1(d,"default",da$1),f=Ge$1(d,"type",da$1);p==="1"||p==="true"||p==="on"?f==="paragraph"?a=u:f==="character"?i=u:f==="table"&&(s=u):(a===u&&(a=null),i===u&&(i=null),s===u&&(s=null));}return {byId:n,docDefaultsRPr:r,docDefaultsPPr:o,defaultParagraphStyleId:a,defaultCharacterStyleId:i,defaultTableStyleId:s}}function Vn(e,t,n){let r=[],o=new Set,a=t;for(;a&&!o.has(a)&&r.length<qR;){o.add(a);let i=e.byId.get(a);if(!i)break;if(r.length===0&&n!==void 0){let s=Ge$1(i,"type",da$1);if(s!==void 0&&s!==n)return []}r.unshift(i),a=ze(ge(i,"basedOn"));}return r}function fu(e,t,n){let r=[];if(e.docDefaultsPPr&&r.push(e.docDefaultsPPr),n)for(let a of n)r.push(a);let o=ze(ge(t,"pStyle"));for(let a of Vn(e,o??e.defaultParagraphStyleId??void 0,"paragraph")){let i=ge(a,"pPr");i&&r.push(i);}return t&&r.push(t),r}function Bs(e,t,n,r){let o=[];e.docDefaultsRPr&&o.push(e.docDefaultsRPr);let a=[];if(r)for(let p of r)a.push(p);let i=[],s=ze(ge(t,"pStyle"));for(let p of Vn(e,s??e.defaultParagraphStyleId??void 0,"paragraph")){let f=ge(p,"rPr");f&&i.push(f);}let l=[],d=ze(ge(n,"rStyle"))??e.defaultCharacterStyleId??void 0;for(let p of Vn(e,d,"character")){let f=ge(p,"rPr");f&&l.push(f);}let u=[...o,...a,...i,...l];return n&&u.push(n),{all:u,defaults:o,tableLevel:a,paragraphLevel:i,characterLevel:l,direct:n}}function Qt(e,t){let n=null;for(let r of e){let o=ge(r,t);o&&(n=o);}return n}function st(e,t,n){let r;for(let o of e){let a=ge(o,t);if(!a)continue;let i=Ge$1(a,n,da$1);i!==void 0&&(r=i);}return r}function $s(e){return !(e==="0"||e==="false"||e==="off")}function zn(e,t){let n=false;for(let r of e){let o=ge(r,t);o&&(n=$s(ze(o)));}return n}function yr(e,t){let n;for(let r of e){let o=ge(r,t);o&&(n=$s(ze(o)));}return n}function pn(e,t){let n=e.direct?ge(e.direct,t):null;if(n)return $s(ze(n));let r=yr(e.tableLevel,t),o=yr(e.paragraphLevel,t),a=yr(e.characterLevel,t);return a===false||a===void 0&&o===false||a===void 0&&o===void 0&&r===false?false:yr(e.defaults,t)===true?true:r===true!=(o===true)!=(a===true)}function pu(e,t){let n=e.direct?ge(e.direct,t):null;if(n)return $s(ze(n));let r=yr(e.characterLevel,t);if(r!==void 0)return r;let o=yr(e.paragraphLevel,t);if(o!==void 0)return o;let a=yr(e.tableLevel,t);return a!==void 0?a:yr(e.defaults,t)===true}function Xb(e){return e.isLgl?"decimal":e.numFmt}function Yb(e){let t=rc$1(e),n=new Map,r=new Map,o=new Map,a=new Map,i=new Map,s=new Map;for(let[l,d]of t.abstractNums){d.numStyleLink!==void 0&&s.set(l,d.numStyleLink);let u=new Map,p=new Map;for(let[f,g]of d.levels)u.set(String(f),Xb(g)),p.set(String(f),g.start);r.set(l,u),o.set(l,p);}for(let[l,d]of t.nums){n.set(l,d.abstractNumId);for(let[u,p]of d.overrides){let f=`${l}:${u}`,g=p.startOverride??p.level?.start;g!==void 0&&a.set(f,g),p.level!==void 0&&i.set(f,Xb(p.level));}}return {numToAbstract:n,levelFormats:r,levelStarts:o,startOverrides:a,formatOverrides:i,styleLinks:s}}function Qb(e,t){if(e===null)return null;let n=Ge$1(e,t,da$1);if(n===void 0||!/^-?\d{1,9}$/.test(n))return null;let r=Number.parseInt(n,10);return Number.isSafeInteger(r)?r:null}function ev(e,t){if(e===null)return null;let n=Ge$1(e,t,da$1);return n!==void 0&&/^[0-9A-Fa-f]{6}$/.test(n)?`#${n.toLowerCase()}`:null}function Jb(e){return `${Math.round(e/20*100)/100}pt`}var ZR=["wholeTable","firstRow","lastRow","firstCol","lastCol","band1Horz","band2Horz","band1Vert","band2Vert","nwCell","neCell","swCell","seCell"];function Ro(e,t,n){if(e===null)return null;let r=Ge$1(e,t,da$1);if(r!==void 0)return !(r==="0"||r==="false"||r==="off");let o=Ge$1(e,"val",da$1);return o===void 0||!/^[0-9A-Fa-f]{1,4}$/.test(o)?null:(Number.parseInt(o,16)&n)!==0}function mu(e,t){let n=new Map,r=new Set(ZR);for(let o of e)for(let a of o.children){if(a.kind==="textValue"||a.localName!=="tblStylePr"||a.namespaceUri!==da$1)continue;let i=Ge$1(a,"type",da$1);i===void 0||!r.has(i)||n.set(i,{fill:ev(ge(ge(a,"tcPr"),"shd"),"fill"),rPr:ge(a,"rPr"),pPr:ge(a,"pPr")});}return {byType:n,firstRowEnabled:Ro(t,"firstRow",32)??false,lastRowEnabled:Ro(t,"lastRow",64)??false,firstColumnEnabled:Ro(t,"firstColumn",128)??false,lastColumnEnabled:Ro(t,"lastColumn",256)??false,hBandingEnabled:!(Ro(t,"noHBand",512)??false),vBandingEnabled:!(Ro(t,"noVBand",1024)??false)}}function gu(e,t,n,r,o,a){let i=e.firstRowEnabled&&t===0,s=e.lastRowEnabled&&t===n-1,l=e.firstColumnEnabled&&r,d=e.lastColumnEnabled&&o,u=p=>e.byType.get(p)??null;if(s&&l&&u("swCell"))return u("swCell");if(s&&d&&u("seCell"))return u("seCell");if(i&&l&&u("nwCell"))return u("nwCell");if(i&&d&&u("neCell"))return u("neCell");if(s&&u("lastRow"))return u("lastRow");if(i&&u("firstRow"))return u("firstRow");if(d&&u("lastCol"))return u("lastCol");if(l&&u("firstCol"))return u("firstCol");if(e.hBandingEnabled){let p=t-(e.firstRowEnabled?1:0);if(p>=0){let f=u(p%2===0?"band1Horz":"band2Horz");if(f)return f}}if(e.vBandingEnabled){let p=a-(e.firstColumnEnabled?1:0);if(p>=0){let f=u(p%2===0?"band1Vert":"band2Vert");if(f)return f}}return null}function tv(e,t,n,r,o,a,i,s,l=false,d=[]){let u=[],p=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 F of ["top","left","bottom","right"]){let R=F==="left"?"start":F==="right"?"end":F,H=ge(p,F)??ge(p,R),L=f[F],S=L==="left"?"start":L==="right"?"end":L,T=H!==null?Hr(H):Hr(ge(t,L)??ge(t,S));T&&u.push(`border-${cn(F,l)}:${T}`);}let g=ev(ge(e,"shd"),"fill")??s;g&&u.push(`background-color:${g}`);let y=ge(e,"vAlign"),w=y===null?void 0:Ge$1(y,"val",da$1);w==="center"?u.push("vertical-align:middle"):(w==="bottom"||w==="top")&&u.push(`vertical-align:${w}`);let x=ge(e,"tcW"),b=Qb(x,"w"),k=x===null?void 0:Ge$1(x,"type",da$1);b!==null&&b>0&&(k===void 0||k==="dxa")&&u.push(`width:${Jb(b)}`);let P=ge(e,"tcMar");for(let F of ["top","right","bottom","left"]){let R=F==="left"?"start":F==="right"?"end":F,H=ge(P,F)??ge(P,R)??d.map(T=>ge(T,F)??ge(T,R)).find(T=>T!==null)??null,L=Qb(H,"w"),S=H===null?void 0:Ge$1(H,"type",da$1);L!==null&&L>=0&&(S===void 0||S==="dxa")&&u.push(`padding-${cn(F,l)}:${Jb(L)}`);}return u.join(";")}function KR(e){return e.kind==="tableCell"?true:e.localName==="tc"&&e.namespaceUri===da$1}function nv(e){return e.localName==="customXml"&&e.namespaceUri===da$1}function rv(e){let t=[],n=[],r=o=>{for(let a of o)if(Le(a)){if(a.kind==="tableRow"||a.localName==="tr"&&a.namespaceUri===da$1){n.push({row:t.length}),t.push(a);continue}if(a.kind==="contentControl"){let i=a.children.find(s=>s.kind==="contentControlContent");i&&Le(i)&&r(i.children);continue}if(nv(a)){r(a.children);continue}n.push({skip:a});}};return r(e.children),{rows:t,tableItems:n}}function ov(e){let t=[],n=[];for(let r of e){let o=[],a=[],i=0,s=l=>{for(let d of l)if(Le(d)){if(KR(d)){let u=ge(d,"tcPr"),p=Math.min(Math.max(gt(ze(ge(u,"gridSpan")))??1,1),63),f=ge(u,"vMerge"),g=f===null?null:ze(f)==="restart"?"restart":"continue",y={cell:d,startColumn:i,span:p,vMerge:g};o.push(y),a.push({placement:y}),i+=p;continue}if(d.kind==="contentControl"){let u=d.children.find(p=>p.kind==="contentControlContent");u&&Le(u)&&s(u.children);continue}if(nv(d)){s(d.children);continue}a.push({skip:d});}};s(r.children),t.push(o),n.push(a);}return {placements:t,items:n}}function av(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 iv(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=gu(t,i,n.length,s.startColumn===0,s.startColumn+s.span>=r,s.startColumn),d=[],u=[];a?.rPr&&d.push(a.rPr),a?.pPr&&u.push(a.pPr),l?.rPr&&d.push(l.rPr),l?.pPr&&u.push(l.pPr),o.set(s.cell,d.length>0||u.length>0?{...e,tableRPr:d,tablePPr:u}:e);}return o}function sv(e,t){let n=Vn(e.styles,ze(ge(t,"tblStyle")),"table");return n.length>0?n:Vn(e.styles,e.styles.defaultTableStyleId??void 0,"table")}function lv(e,t){let n=t.children.find(l=>l.kind==="tableProperties"),r=n&&Le(n)?n:null,o=sv(e,r),a=mu(o,ge(r,"tblLook")),{rows:i}=rv(t),{placements:s}=ov(i);return iv(e,a,s,av(s))}function dv(e,t,n,r){let o=t.children.find(T=>T.kind==="tableProperties"),a=o&&Le(o)?o:null,i=null,s=sv(e,a);for(let T of s){let E=ge(ge(T,"tblPr"),"tblBorders");E&&(i=E);}let l=s.map(T=>ge(T,"tblPr")).filter(T=>T!==null);a&&l.push(a);let d=zn(l,"bidiVisual"),u=[],p;for(let T of l){let E=ge(T,"tblCellMar");E&&u.unshift(E),p=ze(ge(T,"jc"))??p;}let f=ge(a,"tblBorders");f&&(i=f);let g=mu(s,ge(a,"tblLook")),{rows:y,tableItems:w}=rv(t),{placements:x,items:b}=ov(y),k=av(x),P=iv(e,g,x,k),F=["border-collapse:collapse"],R=ge(a,"tblW"),H=gt(Yt(R,"w",da$1));H!==null&&H>0&&Yt(R,"type",da$1)==="dxa"&&F.push(`width:${Cn(H)}`);let L=cn(p==="right"||p==="end"?"right":p==="center"?"center":"left",d);L==="center"?F.push("margin-left:auto","margin-right:auto"):L==="right"?F.push("margin-left:auto","margin-right:0"):F.push("margin-left:0","margin-right:auto");for(let[T,E]of [["insideH","insideh"],["insideV","insidev"]]){let D=Hr(ge(i,T));D&&F.push(`mso-border-${E}-alt:${D}`);}let S=`<table dir="${d?"rtl":"ltr"}" align="${L}" style="${F.join(";")}">`;for(let T of w){if("skip"in T){r.advanceFieldState(T.skip,n);continue}let E=T.row,D=ge(ge(y[E]??null,"trPr"),"trHeight"),$=gt(Yt(D,"val",da$1)),X=zg($,Yt(D,"hRule",da$1)),N=X===""?"":` style="${X}"`;S+=`<tr${N}>`;for(let _ of b[E]??[]){if("skip"in _){r.advanceFieldState(_.skip,n);continue}let B=_.placement;if(B.vMerge==="continue"){r.advanceFieldState(B.cell,n);continue}let G=1;if(B.vMerge==="restart")for(let q=E+1;q<x.length&&x[q].find(W=>W.startColumn===B.startColumn&&W.vMerge==="continue");q+=1)G+=1;let J=ge(B.cell,"tcPr"),ve=B.startColumn+B.span>=k,ce=gu(g,E,x.length,B.startColumn===0,ve,B.startColumn),Te=g.byType.get("wholeTable")??null,ue=tv(J,i,E,x.length,G,B.startColumn===0,ve,ce?.fill??Te?.fill??null,d,u),M=(B.span>1?` colspan="${B.span}"`:"")+(G>1?` rowspan="${G}"`:"")+(ue===""?"":` style="${Rn(ue)}"`),A=P.get(B.cell)??e;S+=`<td dir="ltr"${M}>${r.renderBlocks(A,B.cell.children,n)}</td>`;}S+="</tr>";}return `${S}</table>`}function qs(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 hu(e){let t=Ge$1(e,"type",da$1);return t==="separator"||t==="continuationSeparator"}function yu(e,t){let n=new Set;if(e===null)return n;for(let r of e.children){if(!Le(r)||r.namespaceUri!==da$1||r.localName!==t||hu(r))continue;let o=qs(Ge$1(r,"id",da$1));o!==null&&n.add(o);}return n}function ti(e,t,n,r,o,a,i){for(let s of t.children)if(Le(s)&&s.kind!=="drawing"){if(s.kind==="revisionDelete"||s.kind==="revisionMoveFrom"){r.inert||o(s,r);continue}if(s.kind==="table"){ti(e,s,n,r,o,a,lv(e,s));continue}if(s.kind==="tableCell"||s.namespaceUri===da$1&&s.localName==="tc"){let l=i?.get(s);if(l===void 0){r.inert||o(s,r);continue}ti(l,s,n,r,o,a,i);continue}if(s.kind==="paragraph"){let l=s.children.find(d=>d.kind==="paragraphProperties");ti(e,s,n,r,o,l&&Le(l)?l:null,i);continue}if(s.kind==="run"){if(s.children.some(u=>u.kind==="fldChar")){r.inert||o(s,r);continue}if(s.children.some(u=>u.kind==="instrText")||!r.inert&&r.stack.some(u=>u==="instr"))continue;let l=s.children.find(u=>u.kind==="runProperties"),d=Bs(e.styles,a,l&&Le(l)?l:null,e.tableRPr);if(pn(d,"vanish"))continue}if(s.namespaceUri===da$1&&(s.localName==="footnoteReference"||s.localName==="endnoteReference")){let l=qs(Ge$1(s,"id",da$1));l!==null&&n.push({kind:s.localName==="footnoteReference"?"footnote":"endnote",id:l});continue}ti(e,s,n,r,o,a,i);}}function VR(e,t,n){if(e===null)return null;for(let r of e.children)if(!(!Le(r)||r.namespaceUri!==da$1)&&!(r.localName!==t||hu(r))&&qs(Ge$1(r,"id",da$1))===n)return r;return null}function cv(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=VR(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},d=[];ti(e,i,d,l,n,null);for(let u of d)e.availableNotes[u.kind].has(u.id)&&(r[u.kind].has(u.id)||(r[u.kind].add(u.id),o.push(u)));}return r}function bu(e,t,n,r,o){if(n===null)return "";let a=`/word/${t}s.xml`;for(let[l,d]of e.pkg.parts)d.root===n&&(a=l);let i=hc$1(e.pkg,a),s="";for(let l of n.children){if(!Le(l)||l.namespaceUri!==da$1||l.localName!==t||hu(l))continue;let d=Ge$1(l,"id",da$1),u=qs(d);if(d===void 0||u===null||!r.has(u))continue;let p=o({...e,noteBody:{kind:t,id:u},docRels:i},l.children);s+=`<div style="mso-element:${t}" id="${t==="footnote"?"ftn":"edn"}${u}">${p===""?"<p></p>":p}</div>`;}return s===""?"":`<div style="mso-element:${t}-list">${s}</div>`}var vu="http://schemas.openxmlformats.org/officeDocument/2006/relationships",zR=`${vu}/numbering`,jR=`${vu}/footnotes`,WR=`${vu}/endnotes`,UR=2*1024*1024,GR=8*1024*1024,uv=9525,XR=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 Zs(e,t,n,r){let o=e.direct!==null&&ge(e.direct,r)!==null||Qt(e.defaults,r)!==null||Qt(e.tableLevel,r)!==null||Qt(e.paragraphLevel,r)!==null||Qt(e.characterLevel,r)!==null;return pn(e,t&&o?r:n)}function YR(e){let t=e.all;if(pn(e,"vanish"))return {css:"",vanish:true,vertAlign:null,lang:null,rtl:false};let n=[],r=zn(t,"rtl"),o=(r?st(t,"rFonts","cs"):void 0)??st(t,"rFonts","ascii")??st(t,"rFonts","hAnsi")??st(t,"rFonts","eastAsia")??(r?void 0:st(t,"rFonts","cs"));if(o!==void 0){let F=Zg(o);F&&n.push(`font-family:${F}`);}let a=gt((r?st(t,"szCs","val"):void 0)??st(t,"sz","val")??(r?void 0:st(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;Zs(e,r,"b","bCs")?n.push("font-weight:bold"):Zs(i,r,"b","bCs")&&n.push("font-weight:normal"),Zs(e,r,"i","iCs")?n.push("font-style:italic"):Zs(i,r,"i","iCs")&&n.push("font-style:normal");let l=[],d=Qt(t,"u"),u=d!==null&&ze(d)!=="none";u&&l.push("underline");let p=pu(e,"dstrike");if((pn(e,"strike")||p)&&l.push("line-through"),l.length>0)n.push(`text-decoration:${l.join(" ")}`);else {let F=Qt(s,"u");(F!==null&&ze(F)!=="none"||pn(i,"strike")||pu(i,"dstrike"))&&n.push("text-decoration:none");}u&&n.push(...Vg(d)),p&&!u&&n.push("text-decoration-style:double");let f=_s(st(t,"color","val"));f&&n.push(`color:${f}`);let g=gt(st(t,"spacing","val"));g!==null&&n.push(`letter-spacing:${Math.round(g/20*100)/100}pt`);let y=ze(Qt(t,"highlight")),w=y!==void 0&&Object.hasOwn(Cd,y)?Cd[y]:void 0,x=_s(st(t,"shd","fill"));w?n.push(`background-color:${w}`,`mso-highlight:${y}`):x&&n.push(`background-color:${x}`),pn(e,"caps")?n.push("text-transform:uppercase"):pn(i,"caps")&&n.push("text-transform:none"),pn(e,"smallCaps")?n.push("font-variant:small-caps"):pn(i,"smallCaps")&&n.push("font-variant:normal");let b=ze(Qt(t,"vertAlign")),k=b==="superscript"||b==="subscript"?b:null,P=Dr((r?st(t,"lang","bidi"):void 0)??st(t,"lang","val")??st(t,"lang","bidi")??st(t,"lang","eastAsia"));return {css:n.join(";"),vanish:false,vertAlign:k,lang:P,rtl:r}}function QR(e,t){let n=[],r=ze(Qt(e,"jc")),o=r!==void 0&&Object.hasOwn(Ed,r)?Ed[r]:void 0;o&&n.push(`text-align:${o}`);let a=gt(st(e,"spacing","before"));a!==null&&a>=0&&n.push(`margin-top:${Cn(a)}`);let i=gt(st(e,"spacing","after"));i!==null&&i>=0&&n.push(`margin-bottom:${Cn(i)}`);let s=gt(st(e,"spacing","line")),l=st(e,"spacing","lineRule");n.push(...Kg(s,l));let d=null,u=null,p=null,f=null;for(let x of e){let b=ge(x,"ind");if(!b)continue;let k=gt(Yt(b,"left",da$1)??Yt(b,"start",da$1));k!==null&&(d=k);let P=gt(Yt(b,"right",da$1)??Yt(b,"end",da$1));P!==null&&(u=P);let F=gt(Yt(b,"hanging",da$1)),R=gt(Yt(b,"firstLine",da$1));F!==null?(p=F,f=null):R!==null&&(f=R,p=null);}!t&&d!==null&&n.push(`margin-left:${Cn(d)}`),u!==null&&n.push(`margin-right:${Cn(u)}`),p!==null&&p!==0?n.push(`text-indent:${Cn(-p)}`):f!==null&&f!==0&&n.push(`text-indent:${Cn(f)}`);let g=Qt(e,"tabs");if(g){let x=[];for(let b of g.children){if(!Le(b)||b.localName!=="tab")continue;let k=ze(b),P=gt(Ge$1(b,"pos",da$1));if(P===null||P<0||k!=="left"&&k!=="center"&&k!=="right"&&k!=="decimal"&&k!=="bar")continue;let F=ze(b,"leader"),R=F==="dot"?"dotted":F==="hyphen"?"dashed":F==="underscore"?"lined":F==="middleDot"?"middledot":F==="heavy"?"heavy":"";x.push(`${k}${R?` ${R}`:""} ${Cn(P)}`);}x.length>0&&n.push(`tab-stops:${x.join(" ")}`);}zn(e,"pageBreakBefore")&&n.push("page-break-before:always"),zn(e,"keepNext")&&n.push("page-break-after:avoid"),zn(e,"keepLines")&&n.push("page-break-inside:avoid"),zn(e,"widowControl")&&n.push("widows:2","orphans:2");let y=_s(st(e,"shd","fill"));y&&n.push(`background-color:${y}`);let w=Qt(e,"pBdr");if(w)for(let x of ["top","left","bottom","right"]){let b=Hr(ge(w,x));b&&n.push(`border-${x}:${b}`,`mso-border-${x}-alt:${b}`);}return n.join(";")}function JR(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 fv={decimal:"decimal",decimalZero:"decimal-leading-zero",lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",none:"none"};function mv(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 eC(e,t){let n,r;for(let s of t){let l=ge(s,"numPr");if(!l)continue;let d=ze(ge(l,"numId"));d!==void 0&&(n=d);let u=ze(ge(l,"ilvl"));u!==void 0&&(r=u);}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),d=l===void 0?void 0:e.styles.byId.get(l),u=ze(ge(ge(ge(d??null,"pPr"),"numPr"),"numId")),p=u===void 0?void 0:e.numbering.numToAbstract.get(u);if(p===void 0||p===o)break;o=p;}let a=Math.min(Math.max(gt(r)??0,0),8),i=mv(e,n,o,a);return {numId:n,abstractId:o,level:a,fmt:i.fmt,start:i.start}}function tC(e,t){let n=B$1(e.pkg.contentTypes,t);if(n.ok){let a=XR.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 nC(e,t){let n=Po(t,"inline",ia$1)??Po(t,"anchor",ia$1);if(!n)return "";let r=Po(n,"blip",ha);if(!r)return "";let o=Ge$1(r,"embed",ja$3);if(!o)return "";let a=e.docRels.find(w=>w.id===o&&w.targetMode!=="External");if(!a)return "";let i=w(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=tC(e,i.partName);if(!l||s.byteLength>e.maxImageBytes||e.imageBudget.used+s.byteLength>e.maxTotalImageBytes)return "";e.imageBudget.used+=s.byteLength;let d=e.imageDataUris.get(i.partName);d==null&&(d=`data:${l};base64,${os(s)}`,e.imageDataUris.set(i.partName,d));let u=Po(n,"extent",ia$1),p=u?gt(Ge$1(u,"cx","")):null,f=u?gt(Ge$1(u,"cy","")):null,g=w=>Math.round(w/12700*100)/100,y=p!==null&&f!==null&&p>0&&f>0?` width="${Math.round(p/uv)}" height="${Math.round(f/uv)}" style="width:${g(p)}pt;height:${g(f)}pt"`:"";return `<img src="${d}"${y}>`}function zr(e,t,n=0){if(n>=la$1)return;let r=ee(e)?n+1:ma(e,n);for(let o of e.children)if(Le(o)&&o.kind!=="drawing"){if(o.kind==="contentControl"){let a=o.children.find(i=>i.kind==="contentControlContent");a&&Le(a)&&zr(a,t,r+1);continue}if(o.kind==="fldChar"){gv(o,t);continue}zr(o,t,r);}}function gv(e,t){let n=Ge$1(e,"fldCharType",da$1);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 rC(e,t,n,r){let o=t.children.find(d=>d.kind==="runProperties"),a=Bs(e.styles,n,o&&Le(o)?o:null,e.tableRPr),i=YR(a),s="";for(let d of t.children){if(!Le(d))continue;if(d.kind==="fldChar"){r.inert||gv(d,r);continue}if(d.kind==="instrText"||!r.inert&&r.stack.some(f=>f==="instr")||i.vanish)continue;let u=Wg(d);if(u!==""){s+=u;continue}let p=jg(d,e.noteBody,(f,g)=>JR(e,f,g),(f,g)=>e.availableNotes[f].has(g));if(p!==""){s+=p;continue}switch(d.kind){case "text":s+=uu(cu(d));break;case "tab":s+='<span style="white-space:pre;mso-tab-count:1"> </span>';break;case "hardBreak":{let f=Ge$1(d,"type",da$1);s+=f==="page"?'<br style="page-break-before:always">':"<br>";break}case "bookmarkStart":{let f=dn(Ge$1(d,"name",da$1));f!==null&&(s+=`<a id="${Rn(f)}"></a>`);break}case "drawing":s+=nC(e,d);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="${Rn(i.css)}"`}`;return l===""?s:`<span${l}>${s}</span>`}function Vr(e,t,n,r,o=0){if(o>=la$1)return "";let a="";for(let i of t)if(Le(i))switch(ee(i)?"fldSimple":i.kind){case "run":a+=rC(e,i,n,r);break;case "hyperlink":{let s=Vr(e,i.children,n,r,o+1);if(s==="")break;let l=Ge$1(i,"id",ja$3),d=l?e.docRels.find(f=>f.id===l):void 0,u=d===void 0?void 0:d.targetMode==="External"||d.rawTarget.startsWith("#")?d.rawTarget:void 0,p=gh(u,Ge$1(i,"anchor",da$1));a+=p!==null?`<a href="${Rn(p)}">${s}</a>`:s;break}case "bookmarkStart":{let s=dn(Ge$1(i,"name",da$1));s!==null&&(a+=`<a id="${Rn(s)}"></a>`);break}case "fldSimple":a+=Vr(e,i.children,n,r,o+1);break;case "contentControl":{let s=i.children.find(l=>l.kind==="contentControlContent");s&&Le(s)&&(a+=Vr(e,s.children,n,r,o+1));break}case "revisionInsert":case "revisionMoveTo":a+=Vr(e,i.children,n,r,o+1);break;case "revisionDelete":case "revisionMoveFrom":zr(i,r,o);break;case "generic":if(na$1(i))a+=Vr(e,i.children,n,r,o+1);else {let s=Fd$1(i);s&&(a+=Vr(e,s,n,r,o+1));}break}return a}function oC(e,t){let n=ze(ge(t,"pStyle")),r=Vn(e.styles,n,"paragraph");for(let o=r.length-1;o>=0;o-=1){let a=Ge$1(r[o],"styleId",da$1),i=a?/^Heading([1-6])$/.exec(a):null;if(i)return {level:Number(i[1]),fromStyle:true}}if(n===void 0){let o=gt(ze(ge(t,"outlineLvl")));if(o!==null&&o>=0&&o<=5)return {level:o+1,fromStyle:false}}return null}function aC(e,t){let n=Vn(e.styles,ze(ge(t,"pStyle")),"paragraph");for(let r=n.length-1;r>=0;r-=1){let o=qg(Ge$1(n[r],"styleId",da$1));if(o!==null)return o}return null}function pv(e,t,n,r){let o=t.children.find(x=>x.kind==="paragraphProperties"),a=o&&Le(o)?o:null,i=fu(e.styles,a,e.tablePPr),s=QR(i,n.asListItem),l=Vr(e,t.children,a,r),d=s===""?"":` style="${Rn(s)}"`,u=zn(i,"bidi")?' dir="rtl"':"",p=aC(e,a),f=p===null?"":` class="${p}"`,g=oC(e,a);if(n.asListItem)return `<li${g?.fromStyle===true?` class="Heading${g.level}"`:f}${u}${d}>${l}</li>`;let y=g===null?"p":`h${g.level}`,w=g===null?f:g.fromStyle?` class="Heading${g.level}"`:' class="docx-outline"';return `<${y}${w}${u}${d}>${l}</${y}>`}var iC={renderBlocks:(e,t,n)=>Ks(e,t,n),advanceFieldState:zr};function Ks(e,t,n){let r="",o=[],a=null,i=new Map,s=n;if(s===void 0){let f={stack:[]};for(let g of t)Le(g)&&zr(g,f);s={stack:[],inert:f.stack.length>0};}let l=()=>{let f=o.pop();f&&(r+=`</${f.tag}>`);},d=()=>{for(;o.length>0;)l();a=null;},u=(f,g)=>{for(a!==null&&g.level<a&&d();o.length>0&&o[o.length-1].abstractId!==g.abstractId;)l();o.length===0&&(a=g.level);let y=a??g.level,w=g.level-y+1;for(;o.length>w;)l();for(o.length===w&&o[w-1].numId!==g.numId&&l();o.length<w;){let k=y+o.length,P=mv(e,g.numId,g.abstractId,k),F=i.get(`${g.abstractId}:${g.numId}:${k}`)??0,R=P.start+F,H=P.fmt==="bullet"?"ul":"ol",L=H==="ol"?Object.hasOwn(fv,P.fmt)?fv[P.fmt]:"decimal":null,S=H==="ol"&&R!==1?` start="${R}"`:"";r+=L?`<${H}${S} style="list-style-type:${Rn(L)}">`:`<${H}>`,o.push({tag:H,numId:g.numId,abstractId:g.abstractId});}let x=`${g.abstractId}:${g.numId}:${g.level}`;i.set(x,(i.get(x)??0)+1);let b=`${g.abstractId}:`;for(let k of i.keys()){if(!k.startsWith(b))continue;let P=k.slice(k.lastIndexOf(":")+1);/^\d+$/.test(P)&&Number(P)>g.level&&i.delete(k);}r+=pv(e,f,{asListItem:true},s);},p=f=>{for(let g of f)if(Le(g))switch(g.kind){case "paragraph":{let y=g.children.find(b=>b.kind==="paragraphProperties"),w=y&&Le(y)?y:null,x=eC(e,fu(e.styles,w));x?u(g,x):(d(),r+=pv(e,g,{asListItem:false},s));break}case "table":d(),r+=dv(e,g,s,iC);break;case "contentControl":{let y=g.children.find(w=>w.kind==="contentControlContent");y&&Le(y)&&p(y.children);break}case "generic":p(g.children);break;case "bookmarkStart":{let y=dn(Ge$1(g,"name",da$1));y!==null&&(r+=`<a id="${Rn(y)}"></a>`);break}default:s.inert||zr(g,s);break}};return p(t),d(),r}function hv(e,t){let n=e.parts.get(e.mainDocumentPart);if(!n||!Le(n.root))return "";let r=n.root.children.find(d=>d.kind==="body");if(!r||!Le(r))return "";let o=ei(e,jR,"/word/footnotes.xml"),a=ei(e,WR,"/word/endnotes.xml"),i={pkg:e,styles:Gb(e),numbering:Yb(ei(e,zR,"/word/numbering.xml")),docRels:hc$1(e,e.mainDocumentPart),maxImageBytes:UR,maxTotalImageBytes:GR,imageBudget:{used:0},imageDataUris:new Map,noteOrdinals:{footnote:new Map,endnote:new Map},availableNotes:{footnote:yu(o,"footnote"),endnote:yu(a,"endnote")},noteBody:null},s=Ks(i,r.children),l=cv(i,{footnote:o,endnote:a},zr);return s+bu(i,"footnote",o,l.footnote,Ks)+bu(i,"endnote",a,l.endnote,Ks)}var sC=12*1024*1024;function lC(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function dC(e){return `<div><table>${e.split(`
18
- `).map(n=>`<tr>${n.split(" ").map(r=>`<td>${lC(r)}</td>`).join("")}</tr>`).join("")}</table></div>`}function xu(e){if(e.cellRectangle)return {text:e.text,html:dC(e.text)};if(!e.coverage||!e.pkg)return {text:e.text,html:null};let t=I(e.pkg,e.coverage);if(!t.ok)return {text:e.text,html:null};let n=e.maxFragmentBytes??sC,r=t.bytes;if(t.bytes.byteLength>n){let i=I(e.pkg,e.coverage,{omitMedia:true});r=i.ok&&i.bytes.byteLength<=n?i.bytes:null;}let o;try{o=hv(t.package);}catch(i){console.error("docx-editor: copy HTML flavour failed to render",i),o="";}let a=$g(o,r?{bytes:r,lastMarkCovered:t.lastMarkCovered}:null);return {text:e.text,html:a}}function yv(e,t){let n=()=>t.text.length===0?"none":(e.insertPlainText(t.text),"plain");if(t.forcePlain||!e.richLaneOpen)return n();let r=t.html;if(r===null||r.length===0)return n();let o=as(r);if(o&&e.pasteFragment(o.bytes,o.lastMarkCovered))return "fragment";let a=Qh(r);return a.ok&&a.truncated&&t.text.length>0?n():a.ok&&e.pasteFragment(a.fragmentBytes,a.lastMarkCovered)?"external-html":n()}function bv(e,t,n,r,o){if(!o||t.paragraphId!==n.paragraphId||/[\r\n\t]/.test(r)||!Mh$1(e.settingsRoot()))return r;let a=Ge(e,t.paragraphId)??e.part();if(!Nh$1(a,t.paragraphId))return r;let i=Ga$1(a,t.paragraphId);if(i?.kind!=="paragraph")return r;let s=gh$1(i).find(x=>x.fieldNodeId===o&&x.start<=t.offset&&x.end>=n.offset);if(!s?.enabled||!eh$1(s)||s.maxLength<=0)return r;let l=(ki(a,t.paragraphId)??"").slice(s.start,s.end),d=l.slice(0,t.offset-s.start),u=l.slice(n.offset-s.start),p=d+u,f=x=>fh$1(d+x+u,s,p)<=s.maxLength;if(f(r))return r;let g=[...r],y=s.maxLength-[...p].length;if(s.type==="number"&&s.format)for(let x of p)(x===","&&s.format.includes(",")||x==="%"&&s.format.endsWith("%"))&&y++;let w=new Set;if(s.type==="date"){let x=0;for(let b=0;b<g.length;b++)if(/\S/.test(g[b])){if(++x>18)break;w.add(b+1);}else (b+1===g.length||/\S/.test(g[b+1]))&&w.add(b+1);}else if(s.type==="number"&&s.format)for(let x=1;x<=3;x++)w.add(y+x);for(let x of [...w].sort((b,k)=>k-b)){if(x<=Math.max(0,y)||x>g.length)continue;let b=g.slice(0,x).join("");if(f(b))return b}return g.slice(0,Math.max(0,y)).join("")}var cC=2e3;function vv(e){let{session:t}=e,n=null;function r(s){let l=oy(s),d=e.orderedRange(),u=bv(t,d.from,d.to,l,e.textFormFieldId?.()??null).split(`
19
- `),p=e.deleteSelectionPlan(),f=p.replaceAt??p.collapseTo,g=u.join(""),y=[...p.ops],w=e.consumePendingFormatOps(f.paragraphId,f.offset,g.length);g.length>0&&(y.push({op:"insertText",paragraphId:f.paragraphId,offset:f.offset,text:g}),y.push(...w));let x=[],b=0;for(let H=0;H<u.length-1;H+=1)b+=u[H].length,x.push(f.offset+b);if(x.length>0&&y.push({op:"splitParagraphMany",paragraphId:f.paragraphId,offsets:x}),y.length===0)return;let k=new Set(t.paragraphIdsIn(e.storyScope())),P=u[u.length-1],F=x.length===0?e.caretMark({paragraphId:f.paragraphId,offset:f.offset+P.length}):void 0,R=y.filter(H=>!w.includes(H));e.commit(()=>e.withoutPendingOnRejection(y,R,e.selectionMark(),F),()=>{if(x.length===0)return He({paragraphId:f.paragraphId,offset:f.offset+P.length});let H=t.paragraphIdsIn(e.storyScope()).filter(S=>!k.has(S)),L=H[H.length-1];return L?He({paragraphId:L,offset:P.length}):null});}function o(){e.flushPendingInputAndLayout();let s=e.cellSelection();if(s)return xu({text:wa(e.layout(),s),cellRectangle:true,coverage:null,pkg:null});let{from:l,to:d}=e.orderedRange(),u=Ds(e.layout(),l,d,e.paragraphOrder()),p=e.storyScope();if(l.paragraphId===d.paragraphId&&l.offset===d.offset||p.kind!=="body")return {text:u,html:null};let g=t.part(),y=Tb(e.layout(),g,l,d,e.paragraphOrder());return xu({text:u,cellRectangle:false,coverage:y,pkg:t.currentPackage()})}function a(s,l){if(e.editingMode()!=="edit"||e.storyScope().kind!=="body"||e.cellSelection())return false;e.flushPendingInputAndLayout();let d=e.deleteSelectionPlan(),u=d.replaceAt??d.collapseTo,p=false;return e.commit(()=>{let f=e.collaborationGate(d.ops,{kind:"body"});if(f)return {committed:false,rejected:true,opCount:0,reason:f};let g=e.actorId(),y=t.applyFragmentPaste({kind:"body"},{paragraphId:u.paragraphId,offset:u.offset,fragmentBytes:s,lastMarkCovered:l,priorOps:d.ops,...g!==void 0?{actorId:g}:{}});return p=y.ok,{committed:y.ok,rejected:!y.ok,opCount:y.ok?1:0,...y.ok?{}:{reason:y.detail??y.reason}}},()=>He(u)),p}function i(s,l){let d=n!==null&&e.now()-n<cC;return n=null,yv({richLaneOpen:e.editingMode()==="edit"&&e.storyScope().kind==="body"&&e.cellSelection()===null,pasteFragment:(p,f)=>a(p,f),insertPlainText:r},{html:l,text:s,forcePlain:d})!=="none"}return {insertPlainText:r,copyFlavoursNow:o,pasteRichNow:i,armForcePlainPaste:()=>{n=e.now();}}}function xv(e){let{session:t}=e;function n(){return Zr(e.selection())}function r(){return e.flushPendingInputAndLayout(),Ns(e.layout(),e.selection(),e.paragraphOrder())}function o(){return r().from}function a(y){return ke(e.layout(),y)}function i(y,w){let x=t.partFor(e.storyScope())??t.part(),b=Ga$1(x,y.paragraphId);return !b||b.kind!=="paragraph"?null:w==="before"?Ve(b,y.offset):We(b,y.offset)}function s(y){if(e.trackedAuthorOrNone()!==void 0||e.cellSelection())return false;let w=r();return w.from.paragraphId===w.to.paragraphId&&w.from.offset===w.to.offset?e.atParagraphEnd(y.paragraphId,y.offset):e.atParagraphEnd(w.to.paragraphId,w.to.offset)}function l(y){let w=y?.trim()||void 0,x=d(),b=e.cellSelection(),k=null;return {...x,get replaceAt(){return k??=f(x,w,b),k}}}function d(){e.flushPendingInputAndLayout();let y=e.cellSelection();if(y){let k=[];for(let P of ta(e.layout(),y.cellIds)){let F=ke(e.layout(),P).length;F>0&&k.push({op:"deleteText",paragraphId:P,start:0,end:F});}return {ops:k,collapseTo:o()}}let w=e.selection();if(w.anchor.paragraphId===w.head.paragraphId&&w.anchor.offset===w.head.offset)return {ops:[],collapseTo:Vd$1(e.layout(),w.head)};let{from:x,to:b}=r();return Pb(e.layout(),t.partFor(e.storyScope())??t.part(),x,b,e.paragraphOrder())}function u(){return l().ops}function p(y,w,x){if(!(x!==void 0||e.editingMode()==="suggest")||y.paragraphId!==w.paragraphId||w.offset<=y.offset)return y.offset;let k=(x??e.author())?.trim();if(!k)return Vd$1(e.layout(),w).offset;let P=Ge(t,w.paragraphId)??t.part(),F=Ga$1(P,w.paragraphId);if(!F||F.kind!=="paragraph")return Vd$1(e.layout(),w).offset;let R={start:y.offset,end:w.offset},{past:H,landing:L}=ag(F,R,w.offset,k,e.trackedDate()),S=Zf(F,y.offset,H,k);return (H-y.offset>S?L:H)-S}function f(y,w,x){let b=y.collapseTo;if(w===void 0&&e.editingMode()!=="suggest")return b;if(x){for(let N of x.cellIds){let _=sa$1(e.layout(),[N]),B=_.length>0?_:ta(e.layout(),[N]);if(B.length===0)continue;let G=new Map,J=ue=>{let M=G.get(ue);return M===void 0&&(M=p({paragraphId:ue,offset:0},{paragraphId:ue,offset:a(ue).length},w),G.set(ue,M)),M},ve=(w??e.author())?.trim(),ce=ue=>{let M=a(ue);if(!ve)return /\S/.test(M);let A=Ga$1(Ge(t,ue)??t.part(),ue);if(!A||A.kind!=="paragraph")return /\S/.test(M);let q="",Z=0;for(let W of _f(A,0,M.length,ve))q+=M.slice(Z,Math.max(Z,W.start)),Z=Math.max(Z,W.end);return q+=M.slice(Z),/\S/.test(q)},Te=null;for(let ue=B.length-1;ue>=0;ue-=1){let M=B[ue];if(ce(M)){Te=M;break}}if(Te===null)for(let ue=B.length-1;ue>=0;ue-=1){let M=B[ue];if(J(M)!==0){Te=M;break}}return Te??=B[B.length-1],{paragraphId:Te,offset:J(Te)}}return b}let{from:k,to:P}=r();if(k.paragraphId===P.paragraphId&&k.offset===P.offset)return b;if(k.paragraphId===P.paragraphId)return {paragraphId:P.paragraphId,offset:p(k,P,w)};let F=new Set(y.ops.flatMap(N=>N.op==="deleteBlock"?[N.blockId]:[])),R=Ge(t,P.paragraphId)??t.part();if(F.size>0)for(let N=Ha$1(R,P.paragraphId);N;N=Ha$1(R,N.id)){if(!F.has(N.id))continue;let _={paragraphId:b.paragraphId,offset:a(b.paragraphId).length};return {paragraphId:b.paragraphId,offset:p(b,_,w)}}let H=(w??e.author())?.trim();if(!H)return b;let L=new Set(y.ops.flatMap(N=>N.op==="joinParagraphs"?[N.secondId]:[])),S=e.paragraphOrder(),T=S.indexOf(k.paragraphId),E=S.indexOf(P.paragraphId);if(T===-1||E===-1)return b;let D=N=>{let _=Ga$1(R,N);return _?.kind==="paragraph"&&zh$1(_,H)},$=E;for(;$>T&&L.has(S[$])&&D(S[$-1]);)$-=1;let X=0;for(let N=$;N<=E;N+=1){let _=S[N],B={paragraphId:_,offset:_===k.paragraphId?k.offset:0},G=_===P.paragraphId?Vd$1(e.layout(),P):{paragraphId:_,offset:a(_).length};N===$&&(X+=B.offset),X+=G.offset-B.offset-g(B,G,H);}return {paragraphId:S[$],offset:X}}function g(y,w,x){let b=x?.trim();if(!b||y.paragraphId!==w.paragraphId)return 0;let k=Ge(t,w.paragraphId)??t.partFor(e.storyScope())??t.part(),P=Ga$1(k,w.paragraphId);return !P||P.kind!=="paragraph"?0:Zf(P,y.offset,w.offset,b)}return {selectionMark:n,orderedRange:r,orderedStart:o,textOf:a,inlineControlBeside:i,splitEndsTheParagraph:s,deleteSelectionPlan:l,deleteSelectionOps:u,replacementOffset:p}}function Sv(e){return {atParagraphEnd(t,n){let r=ki(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=ra(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 wv=uc$1;function Iv(e){let{session:t,...n}=e;return jd$1({view:t,...n})}function Kt(e){return e.closest(".docx-editor__scroll-container")}function kv(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 Tv(e,t,n){let r=Kt(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=kv(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 Pv(e,t,n,r){let o=Kt(e);if(!o||o.clientHeight===0)return;let a=kv(e,o,r),i=[];for(let s of [n.anchor,n.head]){let l=ge$1(t,s);l&&i.push(l.pageIndex);}return pa$1({layout:t,viewport:a,overscanPages:1,pinnedPages:i})}function Su(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 Vs(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 Rv(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 Ev(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"?pC(e,n,o):uC(n,r)}})}async function uC(e,t,n){let{convertEmfToDataUrl:r,convertWmfToDataUrl:o}=await import('emf-converter'),a=new Uint8Array(e),i=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),s={maxWidth:4096,maxHeight:4096},l=t==="image/x-emf"?await r(i,s):await o(i,s);if(!l)return null;let d="data:image/png;base64,";if(!l.startsWith(d))return null;let u=atob(l.slice(d.length)),p=new Uint8Array(u.length);for(let f=0;f<u.length;f+=1)p[f]=u.charCodeAt(f);return Object.freeze({bytes:p,mime:"image/png"})}function Cv(e,t){let n=e[t];if(!Array.isArray(n)||n.length===0)return null;let r=Number(n[0]);return Number.isSafeInteger(r)&&r>0?r:null}async function fC(e,t){let n=await import('utif2'),r=n.default??n,o=e.slice().buffer,a=r.decode(o)[0];if(!a)return null;let i=Cv(a,"t256"),s=Cv(a,"t257");if(i===null||s===null||i>t.maxDimension||s>t.maxDimension||i>t.maxPixels/s)return null;let l=i*s;if(l*4>t.maxDecodedBytes||(r.decodeImage(o,a),a.width!==i||a.height!==s))return null;let d=r.toRGBA8(a);return d.length!==l*4?null:Object.freeze({rgba:d,pixelWidth:i,pixelHeight:s})}async function pC(e,t,n){let r=await fC(t,n);if(r===null)return null;let o=await mC(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function mC(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(d=>l(d),"image/png");});return s?new Uint8Array(await s.arrayBuffer()):null}function Fv(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function Ov(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);}})}var gC="docx-editor-one-surface__caret",wu="docx-editor-one-surface__caret--steady",hC=530;function Av(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=gC,o.dataset.docxCaret="",o.dataset.docxMarker="",o.setAttribute("contenteditable","false"),o.setAttribute("aria-hidden","true"),o.dataset.noColorInvert="",o.style.position="absolute",o.style.pointerEvents="none",o.style.userSelect="none",o.style.setProperty("-webkit-user-select","none");let a=false,i=null,s=null,l=null;function d(){let k=r.activeElement;return k===e||!!k&&e.contains(k)}function u(k){return k.anchor.paragraphId===k.head.paragraphId&&k.anchor.offset===k.head.offset}function p(){s=null,i!==null&&(clearTimeout(i),i=null),o.classList.remove(wu),o.remove(),e.style.removeProperty("caret-color"),l?.style.removeProperty("caret-color"),l=null;}function f(){o.classList.add(wu),i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,o.classList.remove(wu);},hC);}function g(){if(a||!d()||n().suppress){p();return}let{layout:k,selection:P,scopedHost:F,scopedHostKind:R,preferredPageIndex:H,measurer:L}=n(),S=t();if(!u(P)){p();return}let T=ge$1(k,P.head,{...L?{measurer:L}:{},...H!==void 0?{preferredPageIndex:H}:{}});if(!T||!Number.isInteger(T.pageIndex)){p();return}let E=F??e.querySelector(`[data-page-index="${T.pageIndex}"] > .docx-page-content`);if(!E){p();return}if(!(T.height>0)){p();return}o.style.left=`${T.x*S}px`,o.style.top=`${T.y*S}px`,o.style.height=`${T.height*S}px`;let D=Ic$1(T);o.style.transformOrigin=D?"0 0":"",o.style.transform=D?"rotate(-90deg)":"",o.parentNode!==E&&E.append(o),e.style.caretColor="transparent",l&&l!==F&&l.style.removeProperty("caret-color"),l=F??null,l?.style.setProperty("caret-color","transparent");let $=E===F?R??"scoped":"body",X=`${T.pageIndex}:${$}:${T.x}:${T.y}:${T.height}`;X!==s&&(s=X,f());}let y=()=>{a=true,g();},w=()=>{a=false,g();},x=()=>g(),b=k=>{let P=k.relatedTarget;P&&e.contains(P)||p();};return e.addEventListener("compositionstart",y),e.addEventListener("compositionend",w),e.addEventListener("focusin",x),e.addEventListener("focusout",b),{update:g,destroy(){e.removeEventListener("compositionstart",y),e.removeEventListener("compositionend",w),e.removeEventListener("focusin",x),e.removeEventListener("focusout",b),p();}}}function Iu(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function jr(e,t){let n=Iu(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function ku(e,t){return !e||e.kind==="tableBody"?null:Iu(e.tableId)===Iu(t)?e:null}function ni(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 d of l.cells){let u=r(d.blocks);if(u)return u}}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}function Tu(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)Tu(o.blocks,t);}}function yC(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});};Tu(n.fragments,r);for(let o of [n.header,n.footer])o&&Tu(o.fragments,r);}}function Pu(e,t,n,r){let o=null;return yC(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Ru(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function Mv(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function Lv(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function Nv(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var bC=120,Dv=20;function zs(e){let t=ph$1(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function vC(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Cu(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function Eu(e,t){return t.kind==="insertColumn"?Pu(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Pu(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function Hv(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=null,r=null,o=null,a=null,i=null,s=null,l=false,d=0,u=0,p=null,f=null,g=null;function y(C){return C instanceof HTMLButtonElement&&(C.classList.contains("docx-table-insert-row")||C.classList.contains("docx-table-insert-column"))}function w(){let C=document.activeElement;return C!==null&&y(C)&&C.closest(".docx-table-furniture")===t?C:null}function x(C){for(let V of [...t.children])y(V)&&V!==C&&V.remove();}function b(){f=null,g=null;}function k(){n!==null&&(clearTimeout(n),n=null);}function P(){for(let V of [...t.children])y(V)||V.remove();let C=w();if(!C){x(null),b();return}f=C,x(C);}function F(C){let V=f??w(),j=V!==null&&document.activeElement===V;b(),t.replaceChildren(),C&&j&&e.pagesLayer.focus({preventScroll:true});}function R(){for(let C of [...t.children])y(C)||C.remove();}function H(C,V,j,oe){let Q=e.read().layout.pages[C];if(!Q)return {left:0,top:0};let ne=oe??Q.contentBox,Ae=e.scale(),we=e.pageOffsetX(C);return {left:(ne.x+V+we)*Ae,top:(ne.y+j)*Ae}}function L(C,V){let j=e.read(),oe=ni(j.layout,V.tableId,V.pageIndex);if(!oe)return;let{table:ie,origin:Q}=oe,ne=document.createElement("div");ne.className="docx-table-resize-preview",ne.style.position="absolute",ne.style.pointerEvents="none";let Ae=V.kind!=="rowDivider",we=H(V.pageIndex,Ae?ie.box.x+C:ie.box.x,Ae?ie.box.y:ie.box.y+C,Q);ne.style.left=`${we.left}px`,ne.style.top=`${we.top}px`,ne.style.width=Ae?"2px":`${ie.box.width*e.scale()}px`,ne.style.height=Ae?`${ie.box.height*e.scale()}px`:"2px",t.append(ne);}function S(){let C=document.createElement("button");return C.type="button",C.textContent="+",C.style.position="absolute",C.style.pointerEvents="auto",C}function T(C){X(C);let V=g;if(!V)return;let j=e.read();V.kind==="insertRow"?_(V,j):V.kind==="insertColumn"&&B(V,j);}function E(){queueMicrotask(()=>{!f||document.activeElement===f||l||r?.kind==="insertRow"||r?.kind==="insertColumn"||(f.remove(),b());});}function D(){if(f&&t.contains(f))return f;let C=w();if(C)return f=C,C;let V=S();return V.addEventListener("pointerenter",()=>{l=true,k();}),V.addEventListener("pointerleave",()=>{l=false;}),V.addEventListener("pointerdown",X),V.addEventListener("mousedown",X),V.addEventListener("click",T),V.addEventListener("blur",E),f=V,V}function $(C,V){let j=ni(V.layout,C.tableId,C.pageIndex);if(!j)return;let{table:oe,origin:ie}=j,Q=D();if(x(Q),g=C,Q.dataset.tableId=C.tableId,C.kind==="insertRow"){let ne=oe.rows.find(tt=>tt.id===C.rowId);if(!ne)return;Q.dataset.rowId=C.rowId,delete Q.dataset.gridColumnId,Q.className="docx-table-insert-row",Q.setAttribute("aria-label",e.label("table.insertRowBelow"));let Ae=ne.box.y+ne.box.height/2,we=H(C.pageIndex,oe.box.x-14,Ae,ie);Q.style.left=`${we.left}px`,Q.style.top=`${we.top-8}px`;}else {let ne=oe.rows[0]?.cells.find(Xe=>Xe.gridColumnId===C.gridColumnId);if(!ne)return;Q.dataset.gridColumnId=C.gridColumnId,delete Q.dataset.rowId;let Ae=oe.columnEdges[ne.gridColumn]??0,we=oe.columnEdges[ne.gridColumn+1]??oe.box.width;Q.className="docx-table-insert-column",Q.setAttribute("aria-label",e.label("table.insertColumnRight"));let tt=H(C.pageIndex,oe.box.x+(Ae+we)/2-8,oe.box.y-14,ie);Q.style.left=`${tt.left}px`,Q.style.top=`${tt.top}px`;}t.contains(Q)||t.append(Q);}function X(C){C.preventDefault(),C.stopPropagation();}function N(C,V){if(R(),x(f??w()),!(s||V.editingMode==="view")){if((C.kind==="columnDivider"||C.kind==="rightEdge")&&!C.isHeaderRepeat){let j=ni(V.layout,C.tableId,C.pageIndex);if(!j)return;let{table:oe,origin:ie}=j,Q=document.createElement("div");Q.className=C.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",Q.style.position="absolute",Q.style.pointerEvents="auto",Q.style.cursor="col-resize",Q.dataset.active="true";let ne=H(C.pageIndex,oe.box.x+C.edgeX,oe.box.y,ie);Q.style.left=`${ne.left-3}px`,Q.style.top=`${ne.top}px`,Q.style.width="6px",Q.style.height=`${oe.box.height*e.scale()}px`,Q.addEventListener("pointerdown",G),t.append(Q);}if(C.kind==="rowDivider"&&!C.isHeaderRepeat){let j=ni(V.layout,C.tableId,C.pageIndex);if(!j)return;let{table:oe,origin:ie}=j,Q=document.createElement("div");Q.className="docx-table-row-divider-handle layout-table-row-resize-handle",Q.style.position="absolute",Q.style.pointerEvents="auto",Q.style.cursor="row-resize",Q.dataset.active="true";let ne=H(C.pageIndex,oe.box.x,oe.box.y+C.edgeY,ie);Q.style.left=`${ne.left}px`,Q.style.top=`${ne.top-3}px`,Q.style.width=`${oe.box.width*e.scale()}px`,Q.style.height="6px",Q.addEventListener("pointerdown",G),t.append(Q);}C.kind==="insertRow"&&!C.isHeaderRepeat&&$(C,V),C.kind==="insertColumn"&&!C.isHeaderRepeat&&$(C,V);}}function _(C,V){let j=Eu(V.layout,C);if(!j)return;let oe=Cu(V),ie=Kn({command:{type:"insertRow",where:"below",target:Ru(C.sourceRevision,j)},part:jr(e.session(),C.tableId),layout:V.layout,storeRevision:V.storeRevision,selection:V.selection,cellSelection:V.cellSelection,themeColors:V.themeColors,...oe});e.applyTableCommandPlan(ie);}function B(C,V){let j=Eu(V.layout,C);if(!j)return;let oe=j.row.cells.find(Ae=>Ae.gridColumnId===C.gridColumnId);if(!oe)return;let ie=Mv(C.sourceRevision,j,oe);if(!ie)return;let Q=Cu(V),ne=Kn({command:{type:"insertColumn",where:"right",target:ie},part:jr(e.session(),C.tableId),layout:V.layout,storeRevision:V.storeRevision,selection:V.selection,cellSelection:V.cellSelection,themeColors:V.themeColors,...Q});e.applyTableCommandPlan(ne);}function G(C){if(C.button!==0)return;let V=e.read();if(V.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;C.preventDefault(),C.stopPropagation();let j=r,oe=Eu(V.layout,j);if(!oe)return;let ie=rh$1(jr(e.session(),j.tableId).root,j.tableId);if(!ie.ok||j.kind!=="rowDivider"&&ie.topology.hasMerge)return;let Q=0,ne=0,Ae=0,we=ie.topology.gridColumns.reduce((Re,Pe)=>Re+zs(Pe),0),tt;if(j.kind==="columnDivider"){let Re=ie.topology.gridColumns.find(We=>We.id===j.leftGridColumnId),Pe=ie.topology.gridColumns.find(We=>We.id===j.rightGridColumnId);if(!Re||!Pe)return;Q=zs(Re),ne=zs(Pe),tt=Lv(j.sourceRevision,oe,j.leftGridColumnId,j.rightGridColumnId);}else if(j.kind==="rightEdge"){let Re=ie.topology.gridColumns.find(Pe=>Pe.id===j.gridColumnId);if(!Re)return;Q=zs(Re),ne=0,tt=Nv(j.sourceRevision,oe,j.gridColumnId);}else Ae=Math.max(20,Math.round(oe.row.box.height*Dv)),tt=Ru(j.sourceRevision,oe);let Xe=C.currentTarget;Xe.setPointerCapture(C.pointerId),d=C.clientX,u=C.clientY,s={pointerId:C.pointerId,startClientX:C.clientX,startClientY:C.clientY,startEdgePt:j.kind==="rowDivider"?j.edgeY:j.edgeX,leftTwips:Q,rightTwips:ne,tableWidthTwips:we,rowHeightTwips:Ae,target:j,ref:oe,resizeTarget:tt,captureElement:Xe,rightEdge:j.kind==="rightEdge",vertical:j.kind==="rowDivider",cancelled:false};for(let Re of [...t.children])Re!==Xe&&Re.remove();L(j.kind==="rowDivider"?j.edgeY:j.edgeX,j);}function J(){if(s){try{s.captureElement.hasPointerCapture(s.pointerId)&&s.captureElement.releasePointerCapture(s.pointerId);}catch{}s.cancelled=true,s=null,P(),r=null;}}function ve(){if(!s||s.cancelled){s=null,P();return}let C=s;s=null;try{C.captureElement.hasPointerCapture(C.pointerId)&&C.captureElement.releasePointerCapture(C.pointerId);}catch{}if(C.vertical?u===C.startClientY:d===C.startClientX){P();return}let V=e.read(),j=Cu(V),oe=(C.vertical?u-C.startClientY:d-C.startClientX)/e.scale(),ie=Math.round(oe*Dv),Q;if(C.target.kind==="rowDivider")Q=By({part:jr(e.session(),C.target.tableId),layout:V.layout,storeRevision:V.storeRevision,selection:V.selection,cellSelection:V.cellSelection,themeColors:V.themeColors,...j},C.resizeTarget,Math.max(20,C.rowHeightTwips+ie));else if(C.rightEdge&&C.target.kind==="rightEdge"){let ne=Math.max(300,C.leftTwips+ie),Ae=Math.max(ne,C.tableWidthTwips+ie);Q=Kn({command:{type:"commitTableRightEdgeResize",target:C.resizeTarget,columnWidthTwips:ne,tableWidthTwips:Ae},part:jr(e.session(),C.target.tableId),layout:V.layout,storeRevision:V.storeRevision,selection:V.selection,cellSelection:V.cellSelection,themeColors:V.themeColors,...j});}else if(C.target.kind==="columnDivider"){let ne=C.leftTwips+ie,Ae=C.rightTwips-ie;ne=Math.max(300,ne),Ae=Math.max(300,Ae);let we=C.leftTwips+C.rightTwips;ne+Ae!==we&&(ne>we-300?(ne=we-300,Ae=300):Ae=we-ne),Q=Kn({command:{type:"commitTableColumnDividerResize",target:C.resizeTarget,leftWidthTwips:ne,rightWidthTwips:Ae},part:jr(e.session(),C.target.tableId),layout:V.layout,storeRevision:V.storeRevision,selection:V.selection,cellSelection:V.cellSelection,themeColors:V.themeColors,...j});}else {P();return}e.applyTableCommandPlan(Q),P();}function ce(C){if(!o||!p)return null;let V=e.pageOffsetX(p.pageIndex);return dd(o,p.x,p.y,C.layout,V,p.pageIndex)}function Te(C){if(!r||s||C.editingMode==="view")return;k();let V=ce(C),j=ku(V,C.selection.head.paragraphId);if(!j){r=null,P();return}if(bd(j)!==bd(r)){r=null,P();return}r=j,N(j,C);}function ue(){let C=f??w(),V=C!==null&&document.activeElement===C;b(),C&&t.contains(C)&&C.remove(),V&&e.pagesLayer.focus({preventScroll:true});}function M(C){if(s||C.editingMode==="view")return;let V=f??w();if(!V||!t.contains(V)){g&&b();return}if(f=V,!g||g.kind!=="insertRow"&&g.kind!=="insertColumn")return;if(!o){ue();return}let j=bd(g),oe=cd(o,g);if(!oe||bd(oe)!==j){ue();return}g=oe,$(oe,C);}function A(C){let V=e.read();if(s&&C.pointerId===s.pointerId){d=C.clientX,u=C.clientY;let Ae=(s.vertical?C.clientY-s.startClientY:C.clientX-s.startClientX)/e.scale();for(let we of [...t.children])we!==s.captureElement&&we.remove();L(s.startEdgePt+Ae,s.target);return}if(V.editingMode==="view"){F(false);return}let j=vC(e,C.clientX,C.clientY),oe=Rc$1(V.layout,j.y);oe>=0&&(p={x:j.x,y:j.y,pageIndex:oe});let ie=oe>=0?e.pageOffsetX(oe):0,Q=o?dd(o,j.x,j.y,V.layout,ie,oe>=0?oe:void 0):null,ne=ku(Q,V.selection.head.paragraphId);if(!ne){if(l)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,P();},bC));return}n&&(clearTimeout(n),n=null),!(r&&ad(ne)===ad(r))&&(r=ne,N(ne,V));}function q(C){if(!(!s||C.pointerId!==s.pointerId)){if(e.read().editingMode==="view"){J();return}ve();}}function Z(C){!s||C.pointerId!==s.pointerId||J();}function W(C){C.key!=="Escape"||!s||J();}return e.pagesLayer.addEventListener("pointermove",A),document.addEventListener("pointermove",A),document.addEventListener("pointerup",q),document.addEventListener("pointercancel",Z),e.pagesLayer.addEventListener("keydown",W),{update(){let C=e.read(),V=a,j=i;o=$c$1(C.layout),a=C.layout.revision,i=C.storeRevision,C.editingMode==="view"?(J(),r=null,k(),F(true)):V!==null&&(V!==C.layout.revision||j!==C.storeRevision)&&(r!==null&&Te(C),M(C)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let C=e.read();if(C.editingMode==="view")return;let V=f??w();if(V&&t.contains(V)&&g&&(g.kind==="insertRow"||g.kind==="insertColumn")){$(g,C);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&$(r,C);},destroy(){k(),J(),b(),P(),e.pagesLayer.removeEventListener("pointermove",A),document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",q),document.removeEventListener("pointercancel",Z),e.pagesLayer.removeEventListener("keydown",W),t.remove();}}}function js(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);}};n(e.fragments,false),e.header&&n(e.header.fragments,false),e.footer&&n(e.footer.fragments,false);for(let r of [e.footnotes,e.endnotes])if(r)for(let o of r.notes)n(o.fragments,false);}function Ws(e,t,n){e.has(t.paragraphId)||e.set(t.paragraphId,n);for(let r of t.lines)for(let o of Q$1(r))e.has(o.paragraphId)||e.set(o.paragraphId,n);}var _v=new WeakMap,Bv=new WeakMap;function xC(e,t){let n=Bv.get(e);if(!n){let r=new Map;for(let o of e.pages)js(o,a=>{a.emptyParagraphStyle&&Ws(r,a,a.emptyParagraphStyle);});n=r,Bv.set(e,n);}return n.get(t)}var $v=new WeakMap;function SC(e){let t=$v.get(e);if(t)return t;let n=new Map;return js(e,r=>Ws(n,r,r.props)),$v.set(e,n),n}function Eo(e,t){let n=_v.get(e);if(!n){n=new Map;for(let r of e.pages)for(let[o,a]of SC(r))n.has(o)||n.set(o,a);_v.set(e,n);}return n.get(t)??[]}var qv=new WeakMap;function wC(e){let t=qv.get(e);if(t)return t;let n=new Map;return js(e,r=>Ws(n,r,r.tabStops)),qv.set(e,n),n}function ri(e,t){let n=Zv.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of wC(o))r.has(a)||r.set(a,i);n=r,Zv.set(e,r);}return n.get(t)??null}var Zv=new WeakMap,Kv=new WeakMap,Vv=new WeakMap;function IC(e){let t=Vv.get(e);if(t)return t;let n=new Map;return js(e,(r,o)=>Ws(n,r,{indent:r.indent,inTable:o})),Vv.set(e,n),n}function kC(e,t){let n=Kv.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,i]of IC(o))r.has(a)||r.set(a,i);n=r,Kv.set(e,r);}return n.get(t)??null}function jv(e,t,n,r,o=ja$1,a){let i=Ga$1(e,t);if(!i||i.kind!=="paragraph")return false;for(let s of la(i,va$1(i),n,r,o,a))if(qa$2(pa(s.run,"runProperties","rPr"),na).length>0)return true;return false}function Fu(e,t,n,r=ja$1,o){let a=Ga$1(e,t);if(!a||a.kind!=="paragraph")return [];let i=va$1(a),s=null,l=null;for(let u of ka(a,r,o)){let p=i.get(u.id);!p||p.end<=p.start||(p.start<n&&n<=p.end&&(s=u),l===null&&p.start<=n&&n<p.end&&(l=u));}let d=s??l;return d?qa$2(pa(d,"runProperties","rPr"),na):sa(e,t)}function Co(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 Wv(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:Co(t,"b")===true};break;case "i":n={...n,italic:Co(t,"i")===true};break;case "u":n={...n,underline:Co(t,"u")===true};break;case "strike":n={...n,strikethrough:Co(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 Ou(e,t,n,r){return n&&n.length>0?ua(e,n):oe(e,t,r??W(e))}function Us(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 Uv(e,t,n,r){return Ou(e,t,n,r)[0]?.style??null}function Au(e,t,n,r,o,a){let i=Ou(e,t,r,a);if(i.length===0)return false;let s=l=>{switch(n){case "b":return l.style.bold;case "i":return l.style.italic;case "u":return l.style.underline!==null;case "strike":return l.style.strike;case "vertAlign":return l.style.verticalAlign===o;default:return false}};return i.every(s)}function Gv(e,t,n,r,o,a,i){let s=Ou(e,t,r,a),l=s.length===0?zv(e,t,r,a).map(_=>xC(e,_)).filter(_=>_!==void 0):[],d=l.length>0?l:s.map(_=>_.style),u=_=>{if(d.length===0)return null;let B=_(d[0]);return d.every(G=>_(G)===B)?B:null},p=(_,B=(G,J)=>G===J)=>_.length>0&&_.every(G=>B(G,_[0]))?_[0]:null,f=(_,B)=>_.props.some(G=>G.localName===B),g=_=>_.style.fontFamily??n?.(_.range.paragraphId,_.props).fontFamily??null,y=_=>f(_,"sz")?Math.round(_.style.fontSizePt*2):n?.(_.range.paragraphId,_.props).fontSizeHalfPoints??Math.round(_.style.fontSizePt*2),w=l.length>0?{fontFamily:u(_=>_.fontFamily??i??null),fontSizeHalfPoints:u(_=>Math.round(_.fontSizePt*2))}:s.length===0?n?.(t.head.paragraphId,[]):void 0,x=zv(e,t,r,a),b=_=>p(x.map(B=>_(Eo(e,B)))),k=(_,B=(G,J)=>G===J)=>{if(x.length<2)return false;let G=_(Eo(e,x[0]));return x.some((J,ve)=>ve>0&&!B(_(Eo(e,J)),G))},P=b(_=>La$2(_)),F=b(_=>hb$1(_,"pStyle")?.val??o??void 0)??null,R=_=>hb$1(_,"spacing")??void 0,H=_=>{let B=R(_),G=Number(B?.line);if(!Number.isFinite(G))return "";let J=B?.lineRule??"auto";return J==="auto"?`multiple:${Math.round(G/240*100)/100}`:`${J==="exact"?"exact":"atLeast"}:${Math.round(G/20*100)/100}`},L=b(H),S=(()=>{if(!L)return null;let[_,B]=L.split(":");return {rule:_,value:Number(B)}})(),T=(_,B)=>{let G=Number(R(_)?.[B]);return Number.isFinite(G)?Math.round(G/20*100)/100:null},E=_=>b(B=>T(B,_)),D=(()=>{let _=x.map(M=>kC(e,M)),B=_[0];if(!B||_.some(M=>M===null||M.inTable))return null;let G=M=>Math.round(M*20),J=M=>G(M.hanging>0?-M.hanging:M.firstLine),ve=_,ce=G(B.indent.left),Te=G(B.indent.right),ue=J(B.indent);return {left:ce,right:Te,firstLine:ue,mixed:{left:ve.some(M=>G(M.indent.left)!==ce),right:ve.some(M=>G(M.indent.right)!==Te),firstLine:ve.some(M=>J(M.indent)!==ue)}}})(),$=_=>b(B=>_(od(B))),X=b(ab$1),N=b(lb$2);return {bold:d.length>0&&d.every(_=>_.bold),italic:d.length>0&&d.every(_=>_.italic),underline:d.length>0&&d.every(_=>_.underline!==null),strikethrough:d.length>0&&d.every(_=>_.strike),superscript:d.length>0&&d.every(_=>_.verticalAlign==="superscript"),subscript:d.length>0&&d.every(_=>_.verticalAlign==="subscript"),fontFamily:s.length>0?p(s.map(g)):w?.fontFamily??null,fontSizeHalfPoints:s.length>0?p(s.map(y)):w?.fontSizeHalfPoints??null,color:u(_=>_.color),highlight:u(_=>_.highlight),alignment:P,styleId:F,lineSpacing:S,spaceBeforePt:E("before"),spaceAfterPt:E("after"),disagrees:{alignment:k(_=>La$2(_)),spaceBeforePt:k(_=>T(_,"before")),spaceAfterPt:k(_=>T(_,"after")),lineSpacing:k(H),tabStops:(()=>{if(x.length<2)return false;let _=JSON.stringify(ri(e,x[0])?.stops??null);return x.some((B,G)=>G>0&&JSON.stringify(ri(e,B)?.stops??null)!==_)})()},indent:D,tabStops:p(x.map(_=>ri(e,_)?.stops??null),(_,B)=>_===null||B===null?_===B:_.length===B.length&&_.every((G,J)=>Math.round(G.positionPt*20)===Math.round(B[J].positionPt*20)&&G.alignment===B[J].alignment&&(G.leader??"none")===(B[J].leader??"none")))?.map(_=>({positionTwips:Math.round(_.positionPt*20),alignment:_.alignment,..._.leader?{leader:_.leader}:{}}))??null,paragraphFlags:{contextualSpacing:N,keepNext:$(_=>_.keepNext),keepLines:$(_=>_.keepLines),widowControl:$(_=>_.widowControl),pageBreakBefore:X}}}function zv(e,t,n,r){if(n&&n.length>0)return [...ta(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??W(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 Xv(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}]}function Yv(e){let{session:t,commit:n,orderedRange:r,selectionMark:o,textOf:a}=e,i=()=>e.displayMode(),s=()=>e.authorFilter(),l=()=>t.partFor(e.storyScope())??t.part(),d=(b,k,P)=>t.applyTreeOps(b,k,P,e.storyScope()),u=()=>{let b=e.runFormatRefusal?.();return b?(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:b})),true):false},p={get value(){return e.layout()}},f={get value(){return e.selection()}},g=(b,k,P)=>{let F=l();if(b.paragraphId===k.paragraphId){let T=za$1(F,b.paragraphId,b.offset,k.offset,P,i(),s());if(T.length===0)return;let E=ya$1(F,b.paragraphId,P);n(()=>d([...T.map(D=>({op:"setRunProperties",paragraphId:b.paragraphId,start:D.start,end:D.end,properties:D.properties,...D.targetRunIds?{targetRunIds:D.targetRunIds}:{}})),...e.paragraphMarkVisible(b.paragraphId)?Xv(a(b.paragraphId),b,k,E):[]],o()));return}let R=e.paragraphOrder(),H=R.indexOf(b.paragraphId),L=R.indexOf(k.paragraphId);if(H===-1||L===-1)return;let S=[];for(let T=H;T<=L;T+=1){let E=R[T],D=a(E),$=T===H?b.offset:0,X=T===L?k.offset:D.length,N=$<X?za$1(F,E,$,X,P,i(),s()):[];for(let B of N)S.push({op:"setRunProperties",paragraphId:E,start:B.start,end:B.end,properties:B.properties,...B.targetRunIds?{targetRunIds:B.targetRunIds}:{}});(T<L||$===0&&X===D.length&&D.length>0)&&e.paragraphMarkVisible(E)&&S.push({op:"setParagraphMarkProperties",paragraphId:E,properties:ya$1(F,E,P)});}S.length!==0&&n(()=>d(S,o()));},y=(b,k)=>{let P=l(),F=[];for(let R of ta(p.value,b)){let H=a(R);for(let L of za$1(P,R,0,H.length,k,i(),s()))F.push({op:"setRunProperties",paragraphId:R,start:L.start,end:L.end,properties:L.properties,...L.targetRunIds?{targetRunIds:L.targetRunIds}:{}});e.paragraphMarkVisible(R)&&F.push({op:"setParagraphMarkProperties",paragraphId:R,properties:ya$1(P,R,k)});}return F.length===0?false:(n(()=>d(F,o()),void 0,{keepCellSelection:true}),true)},w=b=>{oa(b.localName)&&e.setPendingFormats(ta$1(e.pendingFormats()??[],b));},x=b=>{if(b.length===0)return;let k=e.selectedCells?.(),P=k&&k.length>0?[...ta(p.value,k)]:null,{from:F,to:R}=r(),H=P??e.paragraphOrder(),L=P?0:H.indexOf(F.paragraphId),S=P?H.length-1:H.indexOf(R.paragraphId);if(L===-1||S===-1)return;let T=l(),E=H.slice(L,S+1).filter(D=>e.paragraphMarkVisible(D)).map(D=>{let $=ra(T,D);for(let X of b){let N=X.mergeAttributes?{...$.find(B=>B.localName===X.localName)?.attributes??{},...X.attributes}:X.attributes??{},_=Object.fromEntries(Object.entries(N).filter(([,B])=>B!=null));$=ta$1($,{localName:X.localName,...Object.keys(_).length>0?{attributes:_}:{}});}return {op:"setParagraphProperties",paragraphId:D,properties:$}});E.length!==0&&n(()=>d(E,o()),void 0,{keepCellSelection:P!==null});};return {setRunProperty(b,k){if(u())return;let P={localName:b,...k?{attributes:k}:{}},F=e.selectedCells?.();if(F&&F.length>0){y(F,P);return}let{from:R,to:H}=r();if(R.paragraphId===H.paragraphId&&R.offset===H.offset){w(P);return}g(R,H,P);},setParagraphProperty(b,k,P){x([{localName:b,...k?{attributes:k}:{},...P??{}}]);},setParagraphProperties:x,formatting:()=>Wv(Gv(p.value,f.value,(b,k)=>{let P=t.effectiveRunDefaults(b,k);if(P.fontFamily!==null)return P;let F=e.defaultFontFamily?.()??null;return F===null?P:{...P,fontFamily:F}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,e.paragraphOrder(),e.defaultFontFamily?.()??null),e.pendingFormats()),toggleRunProperty(b,k){if(u())return;let P=e.selectedCells?.(),F=k?.val,R=Co(e.pendingFormats(),b,F)??Au(p.value,f.value,b,P,F,e.paragraphOrder()),H=R?{localName:b,attributes:{val:TC[b]??"0"}}:{localName:b,...k?{attributes:k}:{}};if(P&&P.length>0){y(P,H);return}let{from:L,to:S}=r();if(L.paragraphId===S.paragraphId&&L.offset===S.offset){let T=e.pendingFormats()??[],E=Au(p.value,f.value,b,void 0,F,e.paragraphOrder());if(!R===E){let D=T.filter($=>$.localName!==b);e.setPendingFormats(D.length>0?D:null);}else w(H);return}g(L,S,H);},clearFormatting(){if(u())return;e.setPendingFormats(null);let b=p.value,k=e.paragraphOrder(),P=e.selectedCells?.(),F=P&&P.length>0?[...ta(b,P)]:Us(k,r());if(F.length===0)return;let{from:R,to:H}=r(),L=P!==void 0&&P.length>0,S=l(),T=[];for(let E of F){let D=a(E),$=L||E!==R.paragraphId?0:R.offset,X=L||E!==H.paragraphId?D.length:H.offset;for(let N of Aa(S,E,$,X,i(),s()))jv(S,E,N.start,N.end,i(),s())&&T.push({op:"setRunProperties",paragraphId:E,start:N.start,end:N.end,properties:[]});e.paragraphMarkVisible(E)&&sa(S,E).length>0&&T.push({op:"setParagraphMarkProperties",paragraphId:E,properties:[]}),e.paragraphMarkVisible(E)&&ra(S,E).length>0&&T.push({op:"setParagraphProperties",paragraphId:E,properties:[]});}T.length!==0&&n(()=>d(T,o()),void 0,{keepCellSelection:L});}}}var TC={u:"none",vertAlign:"baseline"};var PC=new Set,Qv=500;function RC(e){let t=o=>({val:o?"1":"0"}),n=String(Math.max(2,Math.min(3276,Math.round(e.fontSizePt*2)))),r=[{localName:"b",attributes:t(e.bold)},{localName:"i",attributes:t(e.italic)},{localName:"bCs",attributes:t(e.bold)},{localName:"iCs",attributes:t(e.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:n}},{localName:"szCs",attributes:{val:n}},{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))}}];return (e.fontFamily||e.fontFamilyEastAsia)&&r.push({localName:"rFonts",attributes:{...e.fontFamily?{ascii:e.fontFamily,hAnsi:e.fontFamily}:{},...e.fontFamilyEastAsia?{eastAsia:e.fontFamilyEastAsia}:{}}}),r}function Jv(e){let t=e.session,n=()=>t.partFor(e.storyScope())??t.part(),r="off",o=null,a=null,i=null,s=ys,l=()=>{let x=o===null?"none":o.paragraphProperties?"paragraph":"run";return (s.mode!==r||s.level!==x)&&(s={mode:r,level:x}),s},d=(x,b,k)=>{if(k||x.paragraphId!==b.paragraphId||x.offset===b.offset)return true;let P=e.textOf(x.paragraphId);return x.offset===0&&b.offset===P.length&&P.length>0},u=()=>{let x=e.selectedCells?.(),b=x!==void 0&&x.length>0,{from:k,to:P}=e.orderedRange();if(!e.paragraphOrder().includes(k.paragraphId))return false;let F=Uv(e.layout(),e.selection(),x,e.paragraphOrder()),R=d(k,P,b)?ra(n(),k.paragraphId):null;return !F&&R===null?false:(o={runProperties:F?RC(F):[],paragraphProperties:R},true)},p=()=>u()?(e.publish(),true):false,f=()=>{let x=o;if(!x)return {wrote:false,armed:false,built:false};let b=e.selectedCells?.(),k=b!==void 0&&b.length>0,{from:P,to:F}=e.orderedRange(),R=!k&&P.paragraphId===F.paragraphId&&P.offset===F.offset,H=R?Ls(e.layout(),P,PC):null,L=H?.from??P,S=H?.to??F,T=R&&L.offset===S.offset,E=k?[...ta(e.layout(),b)]:Us(e.paragraphOrder(),{from:L,to:S});if(E.length===0)return {wrote:false,armed:false,built:false};let D=n(),$=e.displayMode(),X=[];for(let G of E){let J=e.textOf(G),ve=k||G!==L.paragraphId?0:L.offset,ce=k||G!==S.paragraphId?J.length:S.offset;if(ve<ce&&x.runProperties.length>0)for(let M of za$1(D,G,ve,ce,x.runProperties,$,e.authorFilter()))X.push({op:"setRunProperties",paragraphId:G,start:M.start,end:M.end,properties:M.properties,...M.targetRunIds?{targetRunIds:M.targetRunIds}:{}});let Te=x.paragraphProperties!==null||k||G!==S.paragraphId||ve===0&&ce===J.length&&J.length>0,ue=e.paragraphMarkVisible(G);Te&&ue&&x.runProperties.length>0&&X.push({op:"setParagraphMarkProperties",paragraphId:G,properties:ya$1(D,G,x.runProperties)}),x.paragraphProperties&&ue&&X.push({op:"setParagraphProperties",paragraphId:G,properties:[...x.paragraphProperties]});}let N=t.packageRevision();X.length>0&&e.commit(()=>t.applyTreeOps(X,e.selectionMark(),void 0,e.storyScope()),void 0,{keepCellSelection:k});let _=t.packageRevision()!==N,B=T&&x.runProperties.length>0&&(_||X.length===0);return B&&e.armPendingFormats(x.runProperties),{wrote:_,armed:B,built:X.length>0}},g=()=>{let x=f();return x.wrote&&r==="once"&&w(),x.wrote?"painted":x.armed?"armed":x.built?"refused":"nothingToPaint"},y=()=>{r!=="off"&&(r="off",e.publish());},w=()=>{a=null,i=null,y();};return {state:l,capture:p,apply:g,disarm:w,press(){let x=e.now(),b=a!==null&&x-a<Qv,k=r;a=x;let P=()=>(a=null,false);return k==="once"&&b?u()?(r="locked",e.publish(),true):(y(),P()):k!=="off"?(y(),i=k==="locked"?x:null,true):i!==null&&x-i<Qv?(i=null,true):u()?(r="once",i=null,e.publish(),true):P()},applyIfArmed(){r==="off"||o===null||f().wrote&&r==="once"&&w();}}}var CC=500,ex=4,Fo=40,Gs=12;function EC(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 tx(e,t){return EC(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 Jt(e,t,n){let r=V(e),o=r.indexOf(t.paragraphId),a=r.indexOf(n.paragraphId);return o!==a?o-a:t.offset-n.offset}function ox(e,t,n){if(!(t>Kc$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Kc$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)ox(a.blocks,t+1,n);}}}function Mu(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(i,s)=>{(!n||Jt(e,i,n)<0)&&(n=i),(!r||Jt(e,s,r)>0)&&(r=s);},a=t.level!=="inline";for(let i of t.fragments){let s=e.pages[i.pageIndex];s&&ox(s.fragments,0,l=>{if(tx(i.box,l.box)){if(a){let d=ke(e,l.paragraphId).length;o({paragraphId:l.paragraphId,offset:0},{paragraphId:l.paragraphId,offset:d});return}for(let d of l.lines)for(let u of d.spans)tx(i.box,u.box)&&o({paragraphId:u.range.paragraphId,offset:u.range.start},{paragraphId:u.range.paragraphId,offset:u.range.end});}});}return !n||!r?null:{from:n,to:r}}function FC(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function nx(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=Wc$1(e,t.pageIndex,o);return a?.placeholder?a:null}let r=FC(e,n);return r?.placeholder?r:null}function rx(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=Jt(e,t.anchor,t.head)<=0?t.anchor:t.head,o=Jt(e,t.anchor,t.head)<=0?t.head:t.anchor,a=true;for(;a;){a=false;for(let s of n){if(!s.placeholder)continue;let l=Mu(e,s);!l||!(Jt(e,r,o)===0?Jt(e,r,l.from)>=0&&Jt(e,r,l.to)<0:Jt(e,r,l.to)<0&&Jt(e,o,l.from)>0)||(Jt(e,l.from,r)<0&&(r=l.from,a=true),Jt(e,l.to,o)>0&&(o=l.to,a=true));}}return Jt(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}function ax(e,t={}){if(t.mode==="native")return {dragging:()=>false,destroy:()=>{}};let{pagesLayer:n,container:r}=e,o=n.ownerDocument,a=o.defaultView,i=null,s=null,l=0,d=0,u=0,p=0,f=null;function g(A,q){if(!s){let W=n.getBoundingClientRect();s={left:W.left,top:W.top};}let Z=e.scale()||1;return {x:(A-s.left)/Z,y:(q-s.top)/Z}}function y(A){return {scope:{kind:"headerFooter",rId:A.rId},pageIndex:A.pageIndex,kind:A.kind,partName:A.partName,variant:A.variant}}function w(A,q){let Z=e.layout(),W=g(A,q),C=Rc$1(Z,W.y),V=Z.pages[C];if(!V)return null;let j=e.measurer();return Tc$1(Z,C,{x:W.x-V.contentBox.x-e.pageOffsetX(C),y:W.y-V.contentBox.y},j?{measurer:j}:{})}function x(A,q){let Z=e.activeNote?.()??null;if(Z){let oe=e.layout(),ie=oc(oe,g(A,q),e.pageOffsetX);if(!ie||ie.scopeId!==Z.scopeId)return null;let Q=e.measurer();return Uc$1(oe,ie.pageIndex,ie.fragments,ie.local,{...Q?{measurer:Q}:{}})}let W=e.activeHeaderFooter?.()??null;if(!W)return w(A,q);let C=e.layout(),V=g(A,q),j=ic(C,V,e.pageOffsetX);if(j&&Jd(j.story,y(W))){let oe=e.measurer();return tc(C,j.pageIndex,j.story,j.local,oe?{measurer:oe}:{})}return null}function b(A,q){let{story:Z,pageIndex:W,kind:C}=A;return {rId:Z.rId,pageIndex:W,kind:C,partName:Z.partName,variant:Z.variant,...q?{position:q}:{}}}function k(A){let q=e.measurer();return tc(e.layout(),A.pageIndex,A.story,A.local,q?{measurer:q}:{})?.position??void 0}let P=new WeakMap;function F(A,q){let Z=e.activeNote?.();if(Z){let j=vo(A,null,Z.scopeId).indexOf(q);return j===-1?-1:j}let W=e.activeHeaderFooter?.();if(W){let j=vo(A,y(W)).indexOf(q);return j===-1?-1:j}let C=P.get(A);return C||(C=new Map(V(A).map((V,j)=>[V,j])),P.set(A,C)),C.get(q)??-1}function R(A,q,Z){let W=F(A,q.paragraphId),C=F(A,Z.paragraphId);return W!==C?W<C:q.offset<Z.offset}function H(A,q,Z){if(Z==="character")return {from:q,to:q};let W=q.paragraphId;if(Z==="paragraph"){let C=ke(A,W);return {from:{paragraphId:W,offset:0},to:{paragraphId:W,offset:C.length}}}return Ls(A,q,le(A,W))}function L(A,q,Z,W,C){let V=C?nx(A,C):null,j=V?Mu(A,V)??H(A,Z,W):H(A,Z,W),oe=R(A,j.from,q.from)?{anchor:q.to,head:j.from}:{anchor:q.from,head:j.to};return rx(A,oe)}let S=r.closest(".docx-editor__scroll-container");function T(){return r.closest(".docx-editor__scroll-container")}function E(A,q,Z){if(Z<A+Fo){let W=Math.max(0,A+Fo-Z);return -Math.min(Gs,W/Fo*Gs)}if(Z>q-Fo){let W=Math.max(0,Z-(q-Fo));return Math.min(Gs,W/Fo*Gs)}return 0}function D(){f!==null&&(a?.cancelAnimationFrame(f),f=null);}function $(){f=null;let A=i,q=T();if(!A||!q||!a)return;let Z=q.getBoundingClientRect(),W=E(Z.top,Z.bottom,A.clientY);W!==0&&(q.scrollTop+=W,s=null,N(A.clientX,A.clientY),f=a.requestAnimationFrame($));}function X(){if(f!==null||!a||!i)return;let A=T();if(!A)return;let q=A.getBoundingClientRect();E(q.top,q.bottom,i.clientY)!==0&&(f=a.requestAnimationFrame($));}function N(A,q){let Z=i;if(!Z)return;let W=x(A,q);W&&((e.isReadOnlyPosition?.(W.position)??e.isReadOnlyParagraph?.(W.position.paragraphId))||_(Z,W)||e.setSelection(L(e.layout(),Z.anchorRange,W.position,Z.granularity,W)));}function _(A,q){let Z=A.anchorCell;if(!Z)return false;if(!q.cell||q.cell.tableId!==Z.tableId)return A.cellDragging;if(!A.cellDragging&&q.cell.cellId===Z.cellId)return false;let W=ra$1(e.layout(),Z,q.cell);return W?(A.cellDragging=true,e.setCellSelection(W),true):A.cellDragging}function B(A){let q=Date.now(),Z=q-d;return l=Math.abs(A.clientX-u)<=ex&&Math.abs(A.clientY-p)<=ex&&Z>=0&&Z<=CC?l+1:1,d=q,u=A.clientX,p=A.clientY,l}let G=["character","word","paragraph"],J=A=>{if(A.button!==0)return;let q=A.target?.closest?.("[data-docx-cc-widget]");if(q){if(A.preventDefault(),A.stopPropagation(),q.hasAttribute("disabled")||q.dataset.disabledReason)return;let Oe=q.dataset.docxCcId,se=q.dataset.docxCcWidget;Oe&&se&&e.onContentControlWidget?.(Oe,se);return}if(A.pointerType==="touch")return;i&&ue(),s=null;let Z=e.layout(),W=g(A.clientX,A.clientY),C=e.activeHeaderFooter?.()??null,V=e.activeNote?.()??null,j=ic(Z,W,e.pageOffsetX),oe=oc(Z,W,e.pageOffsetX),ie=A.target?.closest("[data-docx-hf]"),Q=!!(ie||j),ne=A.target,Ae=ne?.closest("[data-docx-note-ref]"),we=ne?.closest("[data-docx-note-mark-back]"),tt=null,Xe=()=>tt??=B(A);if(Ae?.dataset.docxNoteScope){A.preventDefault(),e.focus(),e.enterNote?.(Ae.dataset.docxNoteScope);return}if(we){A.preventDefault(),e.focus(),e.exitNote?.(true);return}if(oe&&!Q){let Oe=e.measurer?.(),se=Uc$1(Z,oe.pageIndex,oe.fragments,oe.local,{...Oe?{measurer:Oe}:{}});if(!V||V.scopeId!==oe.scopeId){A.preventDefault(),e.focus(),e.enterNote?.(oe.scopeId,se?{paragraphId:se.position.paragraphId,offset:se.position.offset}:void 0,oe.pageIndex);return}if(V.pageIndex!==oe.pageIndex){A.preventDefault(),e.focus(),e.enterNote?.(oe.scopeId,se?{paragraphId:se.position.paragraphId,offset:se.position.offset}:void 0,oe.pageIndex);return}}else if(V){if(!ec(Z,W,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(C)if(j&&Jd(j.story,y(C)))j.pageIndex!==C.pageIndex&&e.enterHeaderFooter?.(b(j,k(j)));else if(j&&j.story.rId){A.preventDefault(),e.focus(),e.enterHeaderFooter?.(b(j,k(j)));return}else if(ec(Z,W,e.pageOffsetX)){A.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let Oe=Xe()>=2?ac(Z,W,e.pageOffsetX):null;Oe&&(A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Oe.kind,Oe.pageIndex));return}else if(Q&&Xe()>=2){if(j?.story.rId)A.preventDefault(),e.focus(),e.enterHeaderFooter?.(b(j,k(j)));else if(ie instanceof HTMLElement){let Oe=ie.dataset.docxRId,se=ie.dataset.docxHf,nt=ie.closest("[data-page-index]")?.getAttribute("data-page-index"),Be=nt!=null?Number(nt):NaN;if((se==="header"||se==="footer")&&Number.isInteger(Be))if(Oe){let $e=Z.pages[Be]?.[se];A.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:Oe,pageIndex:Be,kind:se,partName:$e?.partName??"",variant:$e?.variant??"default"});}else Z.pages[Be]?.[se]||(A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(se,Be));}return}else if(Xe()>=2){let Oe=ac(Z,W,e.pageOffsetX);if(Oe){A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(Oe.kind,Oe.pageIndex);return}}let Re=x(A.clientX,A.clientY);if(!Re)return;if(e.isReadOnlyPosition?.(Re.position)??e.isReadOnlyParagraph?.(Re.position.paragraphId)){A.preventDefault();return}if(Xe()===2&&e.onTextFormDoubleClick?.(A))return;A.preventDefault(),e.focus();try{n.setPointerCapture(A.pointerId);}catch{}o.addEventListener("pointermove",ce),o.addEventListener("pointerup",Te),o.addEventListener("pointercancel",Te);let Pe=Xe(),We=A.shiftKey?"character":G[(Pe-1)%G.length],ht=nx(Z,Re);if(ht&&!A.shiftKey){if(e.selectContentControl?.(ht.id)){let se=e.selection(),nt=R(Z,se.anchor,se.head)||se.anchor.paragraphId===se.head.paragraphId&&se.anchor.offset===se.head.offset?{from:se.anchor,to:se.head}:{from:se.head,to:se.anchor};i={pointerId:A.pointerId,granularity:"character",anchorRange:nt,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY};return}let Oe=Mu(Z,ht);if(Oe){i={pointerId:A.pointerId,granularity:"character",anchorRange:Oe,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ve(()=>e.setSelection({anchor:Oe.from,head:Oe.to}));return}}if(A.shiftKey){let Oe=e.selection();i={pointerId:A.pointerId,granularity:We,anchorRange:{from:Oe.anchor,to:Oe.anchor},anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ve(()=>e.setSelection(L(Z,{from:Oe.anchor,to:Oe.anchor},Re.position,We,Re)));}else {let Oe=H(Z,Re.position,We);i={pointerId:A.pointerId,granularity:We,anchorRange:Oe,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},ve(()=>e.setSelection(rx(Z,{anchor:Oe.from,head:Oe.to})));}};function ve(A){try{A();}catch(q){throw ue(),q}}let ce=A=>{let q=i;!q||A.pointerId!==q.pointerId||(A.preventDefault(),q.clientX=A.clientX,q.clientY=A.clientY,N(A.clientX,A.clientY),X());},Te=A=>{let q=i;if(!q||A.pointerId!==q.pointerId)return;ue();try{n.releasePointerCapture(q.pointerId);}catch{}let Z=e.cellSelection();Z?e.setCellSelection(Z):e.setSelection(e.selection()),A.type==="pointerup"&&(e.onTextFormPointerUp?.(A),e.onSelectionSettled?.());};function ue(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,s=null,D(),o.removeEventListener("pointermove",ce),o.removeEventListener("pointerup",Te),o.removeEventListener("pointercancel",Te);}let M=()=>{s=null;};return n.addEventListener("pointerdown",J),S?.addEventListener("scroll",M,{passive:true}),a?.addEventListener("scroll",M,{capture:true,passive:true}),a?.addEventListener("resize",M,{passive:true}),{dragging:()=>i!==null,destroy(){ue(),n.removeEventListener("pointerdown",J),S?.removeEventListener("scroll",M),a?.removeEventListener("scroll",M,{capture:true}),a?.removeEventListener("resize",M);}}}function ix(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,i;function s(L){let S=Kr(L?.anchorNode,n)??Kr(L?.focusNode,n);S!==void 0&&(i=S);}function l(L){return i??Kr(L?.anchorNode,n)??Kr(L?.focusNode,n)}let d=false,u=false,p=false,f=null,g=false;function y(){let L=t.getSelection(),S=To(n,L);return !S||(s(L),Zt(S,e.selection()))?false:(e.adoptSelection(S),true)}function w(){let L=t.activeElement;if(L&&n.contains(L))return true;if(L&&L!==t.body&&L!==t.documentElement)return false;let S=t.getSelection();if(!S||S.rangeCount===0)return true;let T=S.anchorNode;return !T||!T.isConnected?true:n.contains(T)}let x=()=>{let L=t.getSelection(),S=To(n,L);if(!S){if(!du(n,L))return;d=false;let T=He(e.selection().head);if(Zt(T,e.selection()))return;e.setSelection(T);return}d=false,s(L),!Zt(S,e.selection())&&e.setSelection(S);};function b(L){let S=e.textOf(L),T=Wb(n,L,S,t.getSelection()?.anchorNode??null);if(T===null)return;let E=Ub(L,S,T);if(!E)return;let D=E.ops.find(G=>G.op==="deleteText"),$=E.ops.find(G=>G.op==="insertText"),X=$&&D?e.replacementOffset?.(L,D.start,D.end):void 0,N=$&&X!==void 0&&X!==$.offset?E.ops.map(G=>G===$?{...$,offset:X}:G):E.ops,_=$?e.pendingFormatOps?.(L,X??$.offset,$.text.length,D?{start:D.start,end:D.end}:void 0)??[]:[],B=e.storyScope();e.commit(()=>{let G=e.applyOps([...N,..._],e.selectionMark(),B);return _.length===0||!G.rejected?G:e.applyOps(N,e.selectionMark(),B)}),e.setSelection(He({paragraphId:L,offset:$&&X!==void 0?X+$.text.length:E.caret}));}function k(){o||p||e.isGesturing?.()||e.holdsCellSelection?.()||P()||d&&x();}function P(){if(!u||d)return false;if(!a)return true;let L=To(n,t.getSelection());return L!==null&&Zt(L,a)}function F(L){L instanceof PointerEvent&&L.button!==0||(d=true);}let R=false;function H(L=false){if(e.updateCaret(),!L&&!w())return;o=true;let S=e.now(),T=e.domSelection?.()??e.selection();d=false;let E=t.getSelection(),D=l(E),$=Lb(n,T,E,D!==void 0?{preferredPageIndex:D}:void 0);$&&s(E),a=$?T:null,$||(u=true),e.recordSelectionMs(e.now()-S),queueMicrotask(()=>{o=false;});}return n.addEventListener("pointerdown",F,true),n.addEventListener("selectstart",F,true),{adoptBeforePaint(){let L=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,S=u||L||!d?false:y();return e.hasPendingInput?.()!==true&&(u=false),S},noteModelMoved(){u=true;},noteSelectionSettled(){u=false;},mirrorToDom:H,adoptBeforeInput:k,isComposing:()=>p,noteBrowserSelectionFixup(){R=true;},onSelectionChange:()=>{if(!o&&!p&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(R&&du(n,t.getSelection())){let L=To(n,t.getSelection());if((L===null||!Zt(L,e.selection()))&&(R=false,!d)){H();return}}P()||x();}},onCompositionStart:()=>{k(),p=true;let L=e.selection();g=L.anchor.paragraphId!==L.head.paragraphId,f=L.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:L=>{p=false;let S=f??e.selection().head.paragraphId;f=null;let T=g;g=false;let E=e.storyScope(),D=r.revisionFor(E);if(T){let $=L?.data??"";$.length>0&&e.replaceSelectionWith?.($);}else b(S);r.endComposition(),r.revisionFor(E)===D&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>i,destroy(){n.removeEventListener("pointerdown",F,true),n.removeEventListener("selectstart",F,true),d=false;}}}var OC=32;function lx(e,t,n,r){if(!(e.kind==="textValue"||r>OC)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)lx(o,t,n,r+1);}}function LC(e){let t=Fa$1(e),n=Zb$1(e),r=new Map;for(let o=0;o<n.length;o+=1){let a=n[o];for(let i=a.blockStart;i<a.blockEndExclusive;i+=1){let s=t[i];s&&lx(s,o,r,0);}}return r}var sx=new WeakMap;function NC(e){return !(!e.story||e.origin===b$2.mutationUndo||e.origin===b$2.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.includes(g$1.section))}function DC(e,t){t.story&&t.story.kind!=="body"||NC(t)||(e.map=null);}function HC(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>DC(t,n)));}function _C(e,t){let n=sx.get(e);return n||(n={map:null,subscribed:false},sx.set(e,n)),HC(e,n),n.map||(n.map=LC(t)),n.map}function dx(e,t,n){return n.startsWith(`${t.name}#`)?_C(e,t).get(n)??null:null}var cx=32;function oi(e,t,n,r,o="all-markup",a){let i=e.part(),s=Zb$1(i,o,a);if(s.length<=1)return 0;let l=_b$1(i,o,a),d=f=>{let g=l.indexOf(f);if(g!==-1)return g;let y=l.findIndex(w=>w>f);return y===-1?Math.max(0,l.length-1):y},u=Lu(e,t);if(u!==null)return d(u);if(n.kind==="headerFooter"){if(r!==void 0&&s[r]!==void 0)return r;let f=e.headerFooterResolutionBySection().findIndex(g=>[g.headers,g.footers].some(y=>[...y.values()].some(w=>w.rId===n.rId)));return f===-1?0:d(f)}let p=$C(e,t);if(p!==null){let f=Lu(e,p);if(f!==null)return d(f)}return 0}function ux(e,t,n,r,o="all-markup",a){let i=e.part(),s=Zb$1(i);if(s.length<=1)return {kind:"whole-document"};let l=_b$1(i,o,a),d=Lu(e,t),u=oi(e,t,n,r,o,a),p=l[u]??u;if(d!==null&&d===p)return {kind:"anchor",paragraphId:t};let f=s[p];if(!f)return {kind:"unaddressable"};let g=Fa$1(i);for(let y=f.blockStart;y<f.blockEndExclusive;y+=1){let w=BC(g[y]);if(w!==null)return {kind:"anchor",paragraphId:w}}return {kind:"unaddressable"}}function BC(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>cx)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 Lu(e,t){return dx(e,e.part(),t)}function $C(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=Pf(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let a of sd(o.root)){let i=hd(a);if(i===null||!qC(a,t))continue;return Qf(e.part()).find(l=>l.noteKind===r&&l.noteId===i)?.paragraphId??null}}return null}function qC(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>cx)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 Oo(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 Xs(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 fx(e){return {val:e?"1":"0"}}var ZC="list paragraph",KC="ListParagraph";function px(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function mx(e){let{session:t}=e;function n(){let a=null;for(let i of t.documentStyles())if(i.type==="paragraph"){if(i.name.trim().toLowerCase()===ZC)return i.styleId;a===null&&i.styleId===KC&&(a=i.styleId);}return a}let r;function o(){let a=t.stylesRoot();return (r===void 0||r.root!==a)&&(r={root:a,styleId:Cb$1(a,t.documentThemeFonts()).defaultParagraphStyleId}),r.styleId}return {applyOps(a){let i=n();if(i===null)return [];let s=o(),l=e.storyPart(),d=[];for(let u of a){let p=ra(l,u),f=px(p);f!==void 0&&f!==s||d.push({op:"setParagraphProperties",paragraphId:u,properties:ta$1(p,{localName:"pStyle",attributes:{val:i}})});}return d},clearOp(a){let i=n();if(i===null)return null;let s=ra(e.storyPart(),a);return px(s)!==i?null:{op:"setParagraphProperties",paragraphId:a,properties:s.filter(l=>l.localName!=="pStyle")}}}}var Nu="a section break that changes where the next section starts cannot be suggested; turn off suggesting to insert it",Qs="a section break cannot be inserted inside a table cell",gx="a section break cannot change a section that a locked or linked content control holds",Hu="a section break cannot be inserted in locked or linked content";function VC(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!==da$1)return false;if(s.localName==="dataBinding")return true;if(s.localName!=="lock")return false;let l=s.attributes?.find(d=>d.localName==="val"&&d.namespaceUri===da$1)?.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",d=s||r(a);for(let u of a.children??[])o(u,l,d);};return o(e.root,false,false),{inCell:t,held:n}}var zC=32;function jC(e){let t=new Set(Ch$1(e).map(n=>Fh$1(n)));return Bh$1(e)||t.add("nextPage"),t.size===1?[...t][0]:null}function _u(e,t){let n=t.replaceAt??t.collapseTo;return Dh$1(e,n.paragraphId)?t.collapseTo:n}var Du=(e,t)=>Je$1(e,t)||He$1(e,t).content;function Ys(e,t,n,r){if(Dh$1(e,t))return Qs;if(Du(e,t))return Hu;let{section:o,ownerId:a}=Eh$1(e,t);return Fh$1(o)===n?null:a!==null&&Du(e,a)?gx:r?Nu:null}function hx(e){let{breakType:t,suggesting:n}=e;if(e.cellRectangle)return Qs;if(e.caretParagraphId!==null)return Ys(e.part(),e.caretParagraphId,t,n);let r=VC(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=Eh$1(i,o.paragraphId),l=Eh$1(i,a.paragraphId),d=s.section===l.section,u=d?Fh$1(s.section):jC(i),p=e.paragraphOrder(),f=p.indexOf(o.paragraphId),g=p.indexOf(a.paragraphId),y=f===-1||g===-1?null:p.slice(f,g+1),w=y!==null&&!y.some(b=>r.inCell.has(b))&&!y.some(b=>r.held.has(b));if(u!==null&&u!==t){if(w&&d&&s.ownerId!==null&&Du(i,s.ownerId))return gx;if(n&&w)return Nu}if(w&&u!==null)return null;if(y===null||y.length-1>zC)return n&&u!==null&&u!==t?Nu:null;let x=_u(i,e.deleteSelectionPlan());return Ys(i,x.paragraphId,t,n)}var WC=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function UC(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 Js(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 yx(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 bx(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(),d=(T,E,D)=>t.applyTreeOps(T,E,D,e.storyScope()),u=mx({session:t,storyPart:l}),p=()=>e.paragraphOrder(),f={get value(){return e.layout()}};function g(){let T=e.selectedCells?.();return T&&T.length>0?T:null}function y(T){let E=false;return n(()=>{let D=T();return E=D.committed,D},void 0,{keepCellSelection:g()!==null}),E}function w(){if(g()!==null)return [...ta(f.value,g())];let{from:T,to:E}=o(),D=p(),$=D.indexOf(T.paragraphId),X=D.indexOf(E.paragraphId);return $===-1||X===-1?null:D.slice($,X+1)}let x=720,b=8;function k(T){return P(T)?.level??null}function P(T){return U(f.value,T)?.marker??null}function F(T){let E=P(T);return E?E.numFmt==="bullet"?"bullet":"ordered":null}function R(T,E){let D=p(),$=D.indexOf(T[0]??""),X=D.indexOf(T[T.length-1]??"");if($===-1||X===-1)return null;for(let N of [$-1,X+1]){let _=D[N];if(!_)continue;let B=P(_);if(B&&(B.numFmt==="bullet"?"bullet":"ordered")===E)return B.numId}return null}function H(T,E){return E<0||E>b?false:e.numberingLevelExists(T.numId,E)}function L(T,E){return E<0||E>b?false:e.numberingLevelExists(T.numId,E)?true:t.ensureNumberingLevel(T.numId,E,T.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(T.numId,E)}function S(T){let E;for(let D of T){if(D.localName!=="ind")continue;let $=D.attributes?.left??D.attributes?.start;$!==void 0&&(E=$);}return !E||!/^-?\d{1,7}$/.test(E)?0:Number(E)}return {insertTab(){let T=s(),E=T.replaceAt??T.collapseTo;n(()=>d([...T.ops,{op:"insertTab",paragraphId:E.paragraphId,offset:E.offset}],a()),()=>i({...E,offset:E.offset+1}));},insertLineBreak(){let T=s(),E=T.replaceAt??T.collapseTo;n(()=>d([...T.ops,{op:"insertHardBreak",paragraphId:E.paragraphId,offset:E.offset}],a()),()=>i({...E,offset:E.offset+1}));},insertPageBreak(){let T=s(),E=T.replaceAt??T.collapseTo;n(()=>d([...T.ops,{op:"insertPageBreak",paragraphId:E.paragraphId,offset:E.offset}],a()),()=>i({...E,offset:E.offset+1}));},exitListOnEmptyItem(){let{from:T,to:E}=o();if(T.paragraphId!==E.paragraphId||T.offset!==E.offset)return false;let D=P(T.paragraphId);if(!D||e.paragraphTextOf(T.paragraphId).length>0)return false;let X=D.level>0&&H(D,D.level-1),N=[];if(X)N.push({op:"setListLevel",paragraphId:T.paragraphId,level:D.level-1});else {let B=u.clearOp(T.paragraphId);B&&N.push(B),N.push({op:"setListNumbering",paragraphId:T.paragraphId,numId:null});}let _=false;return n(()=>{let B=d(N,a());return _=B.committed,B}),_},isListParagraph(){let{paragraphId:T}=r();return k(T)!==null},isListActive(T){let E=w();if(E===null)return false;let D=T==="bullet"?"bullet":"ordered";return E.length>0&&E.every($=>F($)===D)},toggleList(T){let E=w();if(E===null||E.length===0)return false;let D=E.every(N=>F(N)===T),$=D?null:R(E,T)??t.ensureListDefinition(T);if(!D&&$===null)return false;let X=D?[]:u.applyOps(E);for(let N of E){let _=k(N);X.push({op:"setListNumbering",paragraphId:N,numId:$,..._!==null?{level:_}:{}});}return y(()=>d(X,a()))},canAdjustIndent(T){let E=w();if(E===null)return false;let D=T==="increase"?1:-1;return E.some($=>{let X=P($);if(X){let _=X.level+D;return _>=0&&_<=b}let N=S(Eo(f.value,$));return Math.max(0,N+D*x)!==N})},adjustIndent(T){let E=w();if(E===null)return false;let D=T==="increase"?1:-1,$=[];for(let X of E){let N=Eo(f.value,X),_=P(X),B=_?.level??null;if(_&&B!==null){let Te=B+D;if(Te<0||Te>b||!L(_,Te))continue;$.push({op:"setListLevel",paragraphId:X,level:Te});continue}let G=S(N),J=Math.max(0,G+D*x);if(J===G)continue;let ve=ra(l(),X),ce=ve.find(Te=>Te.localName==="ind");$.push({op:"setParagraphProperties",paragraphId:X,properties:ta$1(ve,{localName:"ind",attributes:UC(ce?.attributes,String(J))})});}return $.length===0?false:y(()=>d($,a()))},setIndent(T){if(T.left===void 0&&T.right===void 0&&T.firstLine===void 0)return false;let E=w();if(E===null)return false;let D=[];for(let $ of E){let X=ra(l(),$),_={...X.find(B=>B.localName==="ind")?.attributes??{}};T.left!==void 0&&(_=Js(_,"left","start",T.left)),T.right!==void 0&&(_=Js(_,"right","end",T.right)),T.firstLine!==void 0&&(_=yx(_,T.firstLine)),D.push({op:"setParagraphProperties",paragraphId:$,properties:ta$1(X,{localName:"ind",...Object.keys(_).length>0?{attributes:_}:{}})});}return D.length===0?false:y(()=>d(D,a()))},setParagraphFormat(T){let E=w();if(E===null||E.length===0)return false;let D=[];T.alignment!==void 0&&D.push({localName:"jc",attributes:{val:T.alignment}});let $={...Oo("before",T.spaceBeforePt),...Oo("after",T.spaceAfterPt),...Xs(T.lineSpacing)};Object.keys($).length>0&&D.push({localName:"spacing",attributes:$,mergeAttributes:true});for(let[B,G]of WC){let J=T[B];J!==void 0&&D.push({localName:G,attributes:fx(J)});}let X=T.tabStops!==void 0,N=T.indentLeftTwips!==void 0||T.indentRightTwips!==void 0||T.indentFirstLineTwips!==void 0;if(D.length===0&&!N&&!X)return false;let _=[];for(let B of E){let G=ra(l(),B),J=G;if(N){let ce={...G.find(Te=>Te.localName==="ind")?.attributes??{}};T.indentLeftTwips!==void 0&&(ce=Js(ce,"left","start",T.indentLeftTwips)),T.indentRightTwips!==void 0&&(ce=Js(ce,"right","end",T.indentRightTwips)),T.indentFirstLineTwips!==void 0&&(ce=yx(ce,T.indentFirstLineTwips)),J=ta$1(J,{localName:"ind",...Object.keys(ce).length>0?{attributes:ce}:{}});}for(let ve of D){let ce=ve.mergeAttributes?{...J.find(ue=>ue.localName===ve.localName)?.attributes??{},...ve.attributes}:ve.attributes??{},Te=Object.fromEntries(Object.entries(ce).filter(([,ue])=>ue!=null));J=ta$1(J,{localName:ve.localName,...Object.keys(Te).length>0?{attributes:Te}:{}});}if((D.length>0||N)&&_.push({op:"setParagraphProperties",paragraphId:B,properties:J}),X){let ve=ri(e.layout(),B);_.push({op:"setParagraphTabStops",paragraphId:B,stops:T.tabStops.map(ce=>({positionTwips:Math.round(ce.positionTwips),alignment:ce.alignment,...ce.leader&&ce.leader!=="none"?{leader:ce.leader}:{}})),...ve?{inForcePositionsTwips:ve.stops.map(ce=>Math.round(ce.positionPt*20))}:{}});}}return _.length===0?false:y(()=>d(_,a()))},sectionProperties:()=>Yb$1(t.part()),sectionPropertiesAt(T){let E=Zb$1(t.part(),e.revisionDisplayMode(),e.revisionAuthorFilter()),D=oi(t,T,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter());return (E[D]??E[E.length-1]).properties},sectionAnchorParagraphAt(T){return ux(t,T,e.storyScope(),e.headerFooterSectionIndex?.(),e.revisionDisplayMode(),e.revisionAuthorFilter())},setSectionProperties(T){let E=false;return n(()=>{let D=e.storyScope().kind==="body",$=t.applyTreeOps([{op:"setSectionProperties",...T}],D?a():void 0,void 0,{kind:"body"});return E=$.committed,$}),E},sectionBreakRefusal(T="nextPage"){return e.storyScope().kind!=="body"?null:hx({part:()=>t.part(),breakType:T,suggesting:e.editingMode?.()==="suggest",cellRectangle:(e.selectedCells?.()?.length??0)>0,caretParagraphId:e.caretParagraphId?.()??null,orderedRange:o,paragraphOrder:p,deleteSelectionPlan:s})},insertSectionBreak(T="nextPage"){if(e.storyScope().kind!=="body")return false;let E=s(),D=_u(t.part(),E),$=(Dh$1(t.part(),D.paragraphId)?Qs:null)??Ys(t.part(),D.paragraphId,T,e.editingMode?.()==="suggest");if($!==null)return e.publishRefusal?.($),false;let X=new Set(t.paragraphIds()),N=false,_=false;return n(()=>{let B=t.applyTreeOps([...E.ops,{op:"splitParagraph",paragraphId:D.paragraphId,offset:D.offset},{op:"setSectionMark",paragraphId:D.paragraphId,breakType:T}],a(),void 0,{kind:"body"});return N=B.committed,_=B.reason==="locked"||B.reason==="bound",B},()=>{let B=t.paragraphIds().find(G=>!X.has(G));return B?i({paragraphId:B,offset:0}):null}),!N&&_&&e.publishRefusal?.(Hu),N}}}var Ix="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function kx(e){return e.kind==="textValue"?false:e.kind==="contentControl"?true:e.kind==="generic"&&e.localName==="sdt"&&e.namespaceUri===Ix}function GC(e){return e.kind==="textValue"?false:e.kind==="contentControlContent"?true:e.kind==="generic"&&e.localName==="sdtContent"&&e.namespaceUri===Ix}function Bu(e){return e.kind==="textValue"?[]:e.children}function Tx(e,t=0){if(e.kind==="textValue")return e.value;if(t>=la$1||e.kind==="deletedText"||XC(e.kind)||ce$1(e)||e.kind==="runProperties"||e.kind==="generic"&&!na$1(e)&&!kx(e))return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return Wd$2(e);let n=ma(e,t),r="";for(let o of e.children)r+=Tx(o,n);return r}function XC(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function $u(e,t,n){if(!(t>=la$1))for(let r of e){if(r.kind==="hyperlink"){ma(r,t)<la$1&&n(r,t);continue}if(na$1(r)){$u(Bu(r),ma(r,t),n);continue}if(kx(r)){for(let o of Bu(r))GC(o)&&$u(Bu(o),ma(r,t),n);continue}n(r,t);}}function vx(e,t,n){let r=YC(e,t);if(!r||r.kind!=="paragraph")return [];let o=Re(r),a=[],i=0;return $u(r.children,0,(s,l)=>{let d=o.spanOf(s);if(d&&(i=Math.max(i,d.end)),s.kind!=="hyperlink")return;let u=d?d.start:i,p=d?d.end:i,f=$a$1(s,n);a.push({id:s.id,paragraphId:t,start:u,end:p,text:Tx(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 YC(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 QC(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 JC(e,t){for(let n of K(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 Px(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=d=>e.session.relationshipTarget(d,t()),o=(d,u,p)=>e.session.applyTreeOps(d,u,p,t()),a=d=>{let u=n();return u?vx(u,d,r):[]},i=()=>QC(a(e.selection().head.paragraphId),e.selection().head),s=()=>{let d=e.selection().head,u=JC(e.layout(),d);return u===null?null:e.fieldLinkById(u)},l=d=>{let u=e.selection().head.paragraphId,p=a(u).find(f=>f.id===d);if(p)return p;for(let f of e.session.storyParts()){let g=y=>tf$1(e.session.currentPackage(),f.name,y);for(let y of xd(f))for(let w of Ad$1(y.root)){let x=w.id,b=vx(f,x,g).find(k=>k.id===d);if(b)return b}}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:i,fieldLinkAtCaret:s,linkById:l,applyHyperlink(d){let u=d.url!==void 0&&d.url.length>0,p=d.anchor!==void 0&&d.anchor.length>0;if(u===p)return false;let f=t();if(!n()||e.refusesWrite())return false;let g;if(u){let T=()=>e.session.ensureHyperlinkRelationship(d.url,f),E=e.withMintActor?e.withMintActor(T):T();if(!E)return false;g=E;}let y={...g!==void 0?{relationshipId:g}:{},...p?{anchor:d.anchor}:{},...d.tooltip!==void 0?{tooltip:d.tooltip}:{}},w=i(),x=e.orderedRange(),b=x.from.paragraphId===x.to.paragraphId&&x.from.offset===x.to.offset;if(w&&(b||eE(w,x))){let T=[];if(d.text!==void 0&&d.text!==w.text){if(d.text.length===0)return false;let D=e.replacementLanding?.(w.paragraphId,w.start,w.end),$=e.textOf(w.paragraphId).slice(w.start,w.start+2),X=w.start+($.length===2&&$.charCodeAt(0)>=55296&&$.charCodeAt(0)<=56319&&$.charCodeAt(1)>=56320&&$.charCodeAt(1)<=57343?2:1);if(D!=null&&D>w.start&&X<w.end)T.push({op:"setHyperlinkTarget",linkId:w.id,...y},{op:"deleteText",paragraphId:w.paragraphId,start:w.start,end:w.end},{op:"insertText",paragraphId:w.paragraphId,offset:X,text:d.text});else if(D!=null){let N=xx(e.session);T.push({op:"setHyperlinkTarget",linkId:w.id,...y},...Sx(w,D,d.text),{op:"insertHyperlink",paragraphId:w.paragraphId,start:D,end:D+d.text.length,...y,...N?{styleId:N}:{}});}else {let N=wx(w.paragraphId,w.start,w.end,d.text);if(!N)return false;T.push({op:"setHyperlinkTarget",linkId:w.id,...y},...N);}}else T.push({op:"setHyperlinkTarget",linkId:w.id,...y});let E=false;return e.commit(()=>{let D=o(T,e.selectionMark());return E=D.committed,D},()=>null),E}let k=x.from.paragraphId;if(x.to.paragraphId!==k)return false;let P=[],F=x.from.offset,R=x.to.offset;if(b){let T=d.text??d.url??d.anchor??"";if(T.length===0)return false;F=e.insertionLanding?.(k,F)??F,P.push({op:"insertText",paragraphId:k,offset:F,text:T}),R=F+T.length;}else {let T=e.replacementLanding?.(k,F,R);if(T!=null){let E=d.text??e.textOf(k).slice(F,R);if(E.length===0)return false;P.push(...Sx({paragraphId:k,start:F,end:R},T,E)),F=T,R=T+E.length;}else if(d.text!==void 0&&d.text!==e.textOf(k).slice(F,R)){let E=wx(k,F,R,d.text);if(!E)return false;P.push(...E),R=F+d.text.length;}}if(R<=F)return false;let H=xx(e.session);P.push({op:"insertHyperlink",paragraphId:k,start:F,end:R,...y,...H?{styleId:H}:{}});let L=false,S={paragraphId:k,offset:R};return e.commit(()=>{let T=o(P,e.selectionMark(),{paragraphId:k,start:R,end:R});return L=T.committed,T},()=>({anchor:S,head:S})),L},removeHyperlink(d){if(!n())return false;let u=d?l(d):i();if(!u)return false;let p=false,f={paragraphId:u.paragraphId,offset:u.end};return e.commit(()=>{let g=o([{op:"removeHyperlink",linkId:u.id}],e.selectionMark());return p=g.committed,g},()=>({anchor:f,head:f})),p}}}function xx(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function eE(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function Sx(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 wx(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}var tE="equation replacement and removal are not supported in suggesting mode",Rx=new WeakMap;function Cx(e,t){let n=Ga$1(e,t);if(!n||n.kind!=="paragraph")return [];let r=Rx.get(n);if(r)return r;let o=[];for(let i of Pe(n)){let s=i.node;if(s.kind==="textValue"||s.kind!=="generic"||s.namespaceUri!==qc$1||s.localName!=="oMath")continue;let l=sc$1(s);l&&o.push(Object.freeze({id:s.id,paragraphId:t,start:i.start,end:i.end,linear:uc$2(l.expression),fallbackText:l.fallbackText,supported:en(l.expression)}));}let a=Object.freeze(o);return Rx.set(n,a),a}function en(e){switch(e.kind){case "fallback":return false;case "text":return true;case "row":return e.items.every(en);case "fraction":return en(e.numerator)&&en(e.denominator);case "radical":return en(e.radicand)&&(e.degree===void 0||en(e.degree));case "script":return en(e.base)&&(e.subscript===void 0||en(e.subscript))&&(e.superscript===void 0||en(e.superscript));case "nary":return en(e.body)&&(e.lowerLimit===void 0||en(e.lowerLimit))&&(e.upperLimit===void 0||en(e.upperLimit))}}function Ex(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function Fx(e){let t=null,n=i=>{let s=e.pagesLayer.ownerDocument.defaultView;if(!s||!(i instanceof s.Element))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.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 d=s.getBoundingClientRect();t={equationId:l,rect:{left:d.left,top:d.top,right:d.right,bottom:d.bottom}};},a=i=>{let s=n(i.target),l=s?.dataset.docxEquation,d=t;if(t=null,!s||!l){if(!d)return;i.preventDefault(),r(d.equationId,d.rect);return}let u=s.getBoundingClientRect();i.preventDefault(),r(l,{left:u.left,top:u.top,right:u.right,bottom:u.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 Ox(e){let t=()=>e.session.partFor(e.storyScope()),n=l=>{let d=t();return d?Cx(d,l):[]},r=()=>{let l=e.selection().head;return Ex(n(l.paragraphId),l)},o=l=>{let d=n(e.selection().head.paragraphId).find(u=>u.id===l);if(d)return d;for(let u of e.session.storyParts()){let p=Ga$1(u,l);if(!p||p.kind!=="generic"||p.namespaceUri!==qc$1||p.localName!=="oMath")continue;let f=p;for(;f&&f.kind!=="paragraph";)f=Ha$1(u,f.id);return !f||f.kind!=="paragraph"?null:Cx(u,f.id).find(g=>g.id===l)??null}return null},a=(l,d)=>{let u=false,p={paragraphId:l.paragraphId,offset:l.start};return e.commit(()=>{let f=e.session.applyTreeOps([d],e.selectionMark(),{paragraphId:p.paragraphId,start:p.offset,end:p.offset},e.storyScope());return u=f.committed,f},()=>({anchor:p,head:p})),u},i=(l,d)=>{let u=o(l);if(!u)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest")return {ok:false,code:"unsupported",reason:tE};let p=d==="replace"?{op:"setMathEquation",equationId:l,linear:u.linear}:{op:"removeMathEquation",equationId:l},f=e.writeRefusal(p);return f===null?{ok:true}:{ok:false,code:"locked",reason:f}},s=l=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:l.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:i,applyEquation(l,d){let u=o(l);if(!u)return false;let p=i(l,"replace");return p.ok?u.supported&&u.linear===d?true:a(u,{op:"setMathEquation",equationId:l,linear:d}):s(p)},removeEquation(l){let d=o(l);if(!d)return false;let u=i(l,"remove");return u.ok?a(d,{op:"removeMathEquation",equationId:l}):s(u)}}}var nE=24;function Ax(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=f=>{if(!f||f.length===0||f.startsWith("#"))return false;let g=L(f);return !g.ok||!g.href||!n?false:(n.open(g.href,"_blank","noopener,noreferrer"),true)},a=f=>{if(e.enterStoryFor&&!e.enterStoryFor(f.paragraphId))return false;let g=e.layout(),y=ge$1(g,f);if(!y)return false;let w=g.pages[y.pageIndex];if(!w)return false;let x=w.box.y+(w.contentBox.y-w.box.y)+y.y,b=r();return b&&(b.scrollTop=Math.max(0,x*e.scale()-nE),e.onScrolled?.()),e.setSelection(f),true},i=f=>{let g=e.bookmarks().get(f);return g?a(g):false},s=null;function l(f){if(!f||f.closest("[data-docx-hf]"))return null;let g=f.closest("a.docx-hyperlink");if(g){let w=g.dataset.docxLink;return w?{linkId:w,drawing:false}:null}let y=f.closest("[data-docx-drawing-link]");if(y){let w=y.dataset.docxDrawingLink;return w?{linkId:w,drawing:true}:null}return null}let d=f=>{s=null;let g=f.target,y=l(g);if(!y)return;let x=g.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();s={linkId:y.linkId,drawing:y.drawing,rect:{left:x.left,top:x.top,bottom:x.bottom,right:x.right}};},u=f=>{let g=f.target,y=l(g);if(!y){let b=s;if(s=null,!b)return;f.preventDefault(),p(b.linkId,b.rect,f,b.drawing);return}s=null,f.preventDefault();let x=g.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();p(y.linkId,{left:x.left,top:x.top,bottom:x.bottom,right:x.right},f,y.drawing);};function p(f,g,y,w){let x=w?e.drawingLinkById?.(f)??null:e.linkById(f);if(!x)return;if(y.metaKey||y.ctrlKey){x.kind==="external"?o(x.href):x.anchor&&i(x.anchor);return}if(e.isCollapsedSelection()){if(x.kind==="internal"){x.anchor&&i(x.anchor);return}e.onPopover?.({link:x,rect:g});}}return t.addEventListener("pointerdown",d,true),t.addEventListener("click",u),{goToPosition:a,goToBookmark:i,openExternal:o,destroy(){t.removeEventListener("pointerdown",d,true),t.removeEventListener("click",u);}}}function rE(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 qu(e,t){return e.drawingNodeId!==t?null:rE(e)}function Mx(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=qu(n,t);if(r)return r}return null}function oE(e,t){for(let r of e.anchoredDrawings??[]){let o=qu(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=Nx(s,t);if(l)return l}continue}let o=Lx(r,t);if(o)return o}let n=Mx(e.header,t);return n||Mx(e.footer,t)}function Lx(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=qu(r,t);if(o)return o}return null}function Nx(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=Nx(o,t);if(a)return a}return null}return Lx(e,t)}function Dx(e,t){for(let n of e.pages){let r=oE(n,t);if(r)return r}return null}function Hx(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 ai="the document is open for viewing",Zu="image changes are not supported in suggesting mode",_x="tracked changes need a non-empty author";function Bx(e){function t(){return {committed:false,rejected:true,opCount:0,reason:ai}}function n(){return {committed:false,rejected:true,opCount:0,reason:Zu}}return {applyDrawingOps(r){if(e.editingMode()==="view")return t();if(e.editingMode()==="suggest")return n();let o=e.selectionMark(),a={committed:false,rejected:true,opCount:0};return e.commit(()=>(a=e.applyOps(r,o,o),a)),a},applyImageProperties(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:ai};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Zu};let o={ok:false,reason:"invalidArgs"};return e.commit(()=>(o=e.session.applyImageProperties(e.storyScope(),r),{committed:o.ok,rejected:!o.ok,opCount:o.ok?1:0,...o.ok?{}:{reason:o.detail??o.reason}})),o},deleteImage(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:ai};let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return {ok:false,reason:"invalidArgs",detail:_x};let i={ok:false,reason:"invalidArgs"};return e.commit(()=>(i=o?e.session.deleteImageTracked(e.storyScope(),r,{author:a,date:e.trackedDate()}):e.session.deleteImage(e.storyScope(),r),{committed:i.ok,rejected:!i.ok,opCount:i.ok?1:0,...i.ok?{}:{reason:i.detail??i.reason}})),i},insertImage(r){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:ai});let o=e.editingMode()==="suggest",a=e.author();if(o&&(a===void 0||a===""))return Promise.resolve({ok:false,reason:"invalidArgs",detail:_x});let i=e.actorId();return e.session.insertImage(e.storyScope(),{...r,decodePort:e.decodePort(),...o?{revision:{author:a,date:e.trackedDate()}}:{},...i?{actorId:i}:{}})},replaceImage(r,o,a,i){if(e.editingMode()==="view")return Promise.resolve({ok:false,reason:"invalidArgs",detail:ai});if(e.editingMode()==="suggest")return Promise.resolve({ok:false,reason:"invalidArgs",detail:Zu});let s=e.actorId();return e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),{...i,...s?{actorId:s}:{}})}}}function $x(e){let t=null,n=null,r="",o=()=>{let d=e.session.part(),u=e.revisionDisplayMode(),p=e.revisionAuthorFilter();return {sections:Zb$1(d,u,p),sourceIndexes:_b$1(d,u,p)}},a=d=>{let{sourceIndexes:u}=o(),p=u.indexOf(d);if(p!==-1)return p;let f=u.findIndex(g=>g>d);return f===-1?Math.max(0,u.length-1):f},i=()=>{if(!t)return;let d=fy(e.layout(),t,e.materializedPages?.());d!==t.pageIndex&&(t={...t,pageIndex:d,sectionIndex:e.sectionAtPage(d).sectionIndex});},s=d=>{if(e.entryRefused?.()===true&&t?.scope.rId!==d.rId||!d.rId||e.session.partFor({kind:"headerFooter",rId:d.rId})===null)return false;t?.scope.rId!==d.rId&&e.leaveOtherStories?.();let u=e.layout(),p=dy(u,d.rId),f=t,g=f?.scope.rId===d.rId,y=p?null:aE(e.session,d.rId);if(!p&&!y)return false;let w=d.pageIndex??(g&&f?f.pageIndex:p?.pageIndex??0),x=d.kind??(g&&f?f.kind:p?.kind??y.kind),b=d.variant??(g&&f?f.variant:p?.story.variant??y.variant),k=g&&f?f.partName:p?.story.partName??y.partName,P=u.pages[w]??u.pages[p?.pageIndex??0],F=(P?bo(P,{scope:{kind:"headerFooter",rId:d.rId},kind:x,partName:k}):null)??p?.story??{scope:{rId:d.rId},variant:b,partName:k},R=e.selection(),H=f?f.savedBodySelection:{anchor:{...R.anchor},head:{...R.head}},L=g&&f?.sectionIndex!==void 0&&w===f.pageIndex,S=d.sectionIndex??(L?f.sectionIndex:p?e.sectionAtPage(w).sectionIndex:y?a(y.sectionIndex):void 0);t={scope:{kind:"headerFooter",rId:d.rId},pageIndex:w,...S!==void 0?{sectionIndex:S}:{},kind:x,variant:F.variant,partName:F.partName,savedBodySelection:H};let E=e.session.paragraphIdsIn(ps(t))[0];if(!E)return t=null,false;let D=d.position?ms(u,{anchor:d.position,head:d.position},t):g?ms(u,R,t):{anchor:{paragraphId:E,offset:0},head:{paragraphId:E,offset:0}};return e.setScopeSelection(D),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},l=()=>{if(!t)return;let d=t.savedBodySelection;t=null,e.setScopeSelection(ms(e.layout(),d,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>ly(t),setActiveScope(d){return d.kind==="body"?(l(),true):d.kind==="headerFooter"?s({rId:d.rId}):false},enterHeaderFooter:s,exitHeaderFooter:l,reconcileOccurrence:i,headerFooterState(){if(!t)return null;let d=e.session.headerFooterResolutionBySection(),u=t.sectionIndex??0,p=o(),f,g,y,w=P=>{let F=p.sourceIndexes[P]??P,R=d[F];if(!R)return false;let L=(t.kind==="header"?R.headers:R.footers).get(t.variant);return !L||L.rId!==t.scope.rId?false:(u=P,f=L.inherited,g=R.titlePage,y=R.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&w(t.sectionIndex))){let P;d.forEach((F,R)=>{let L=(t.kind==="header"?F.headers:F.footers).get(t.variant);!L||L.rId!==t.scope.rId||!(P===void 0||P&&!L.inherited||P===L.inherited&&a(R)<u)||(u=a(R),f=L.inherited,g=F.titlePage,y=F.evenAndOddHeaders,P=L.inherited);});}let x=p.sections[u]?.properties??p.sections.at(-1)?.properties,b=x?.margins.headerTwips,k=x?.margins.footerTwips;return {editing:t.kind,sectionIndex:u,variant:t.variant,rId:t.scope.rId,partName:t.partName,...f!==void 0?{inherited:f}:{},...g!==void 0?{titlePage:g}:{},...y!==void 0?{evenAndOddHeaders:y}:{},...b!==void 0?{headerDistanceTwips:b}:{},...k!==void 0?{footerDistanceTwips:k}:{}}},headerFooterStateStable(d){if(!t)return n=null,r="",null;let u=this.headerFooterState();if(!u)return null;let p=[d,u.editing,u.sectionIndex,u.variant??"",u.rId??"",u.partName??"",String(u.inherited),String(u.titlePage),String(u.evenAndOddHeaders),String(u.headerDistanceTwips??""),String(u.footerDistanceTwips??"")].join("|");return n&&r===p||(n=Object.freeze({...u}),r=p),n}}}function qx(e){return e.length>0&&e.every(t=>t.op==="setDocumentProtection")}function aE(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 Kx(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 d=_c$2(i);if(!d)return e.setLastRejection("invalid note scope id"),false;let u=e.session.currentPackage(),p=Pf(u,d.noteKind),f=p?ud$1(p.root,d.noteId):null;if(!p||!f)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let g=e.selection();r={anchor:{paragraphId:g.anchor.paragraphId,offset:g.anchor.offset},head:{paragraphId:g.head.paragraphId,offset:g.head.offset}};}if(t={kind:"note",id:Zc$1(d.noteKind,d.noteId)},n=Number.isInteger(l)?l:null,s)e.setSelection({anchor:s,head:s});else {let g=iE(f),y=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:d.noteKind})),w=g.find(x=>y.has(x.id));if(w){let x=sE(w);e.setSelection({anchor:{paragraphId:w.id,offset:x},head:{paragraphId:w.id,offset:x}});}}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 u=Zx(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:l.paragraphId,offset:l.offset},()=>{let y={paragraphId:l.paragraphId,offset:l.offset+1};return {anchor:y,head:y}}))return s.ops.length>0&&e.undo(),false;let g=[...Zx(e.session.currentPackage(),i)].find(y=>!u.has(y));return g===void 0?true:a(Zc$1(i,g))},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 iE(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 sE(e){let t=Pe(e)[0];return t&&dd$1(t.node)?t.end:0}function Zx(e,t){let n=Pf(e,t),r=new Set;if(!n)return r;for(let o of sd(n.root)){if(!jd$2(o))continue;let a=hd(o);a!==null&&r.add(a);}return r}var lE=500;function dE(e,t,n,r){let o=e.part(),a=Fa$1(o,n,r),i=Wb$1(o);return t.map((s,l)=>{let d=s.blockStart<s.blockEndExclusive?a[s.blockEndExclusive-1]:void 0,u=d?.kind==="paragraph"?Xb$1(d):void 0;return u||(l===t.length-1&&i?.kind!=="textValue"?i:void 0)})}function Vx(e,t){if(!e)return null;let n=e.session,r=e.revisionDisplayMode(),o=e.state().selection.head.paragraphId,a=oi(n,o,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:St(n,o,{kind:"body"}),e.headerFooterState()?.sectionIndex,r,t),i=n.currentPackage(),s=Ef(i),l=Ff(s),d=Gf(s),u=Zb$1(n.part(),r,t),p=dE(n,u,r,t),f=Cf(p[a]),g=Df(p[a]),y=Hf(f,l),w=If(g,d);return {sectionIndex:a,footnote:{resolved:y,...l?{documentAuthored:l}:{},...f?{sectionAuthored:f}:{}},endnote:{resolved:w,...d?{documentAuthored:d}:{},...g?{sectionAuthored:g}:{}}}}function zx(e,t){let n=_c$2(t);if(!n)return null;let r=Pf(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=ud$1(o.root,n.noteId);if(!a)return null;let i=[],s=lE,l=(u,p)=>{if(!(p>32||s<=0)){if(u.kind==="paragraph"&&typeof u.id=="string"){let f=(ki(o,u.id)??"").replace(/\uFFFC/g,"").trim();if(f){let g=f.slice(0,s);i.push(g),s-=g.length;}return}if(u.kind!=="textValue")for(let f of u.children)l(f,p+1);}};l(a,0);let d=i.filter(Boolean).join(" ").trim();return d.length>0?d:null}function jx(e){return [()=>{Hb$2(e().root);},()=>{Ih$1(e());},()=>{vh$1(e());}]}var cE=50,uE=16;function Wx(e){let t=e.schedule??((s,l)=>{let d=setTimeout(s,l);return ()=>clearTimeout(d)}),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>cE)return;i(uE);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 fE=new Set(["comment-add","comment-delete","comment-reply","comment-resolve","package-scoped","revision-resolve"]);function Ux(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}function Ku(e$1,t,n$1={}){let r=n$1,o$1=j(t,n$1.reviewModel?{reviewModel:n$1.reviewModel}:{});if(!o$1.ok)return {ok:false,reason:o$1.reason,...o$1.detail?{detail:o$1.detail}:{}};let a=o$1.session,i=n$1.collaborationModel?.session,s=n$1.author,l$1=n$1.scale??96/72,d={resolve:n$1.tableInteractionLabel??(c=>Uc(c))},u="the document is open for viewing",p="the table of contents is generated and read-only",f$1="\0range\0",g$1=()=>`${new Date().toISOString().slice(0,19)}Z`,y=n$1.measurer?null:da(l$1,{context:ko(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),w=n$1.measurer??y.measurer,x=Ja$1(),b=Rd$1();function k(){return n$1.measurer?n$1.producer??"host-measurer":`${n$1.producer??y?.producer??"fixed-measurer"}@scale:${l$1}`}let P=k(),F=e$1.ownerDocument,R=F.createElement("div");R.className="docx-pages",R.style.position="relative",R.contentEditable="true",R.spellcheck=false,R.setAttribute("role","textbox"),R.setAttribute("aria-multiline","true"),R.style.outline="none";let H=F.createElement("div");H.className="docx-selection-overlay",H.contentEditable="false",H.setAttribute("aria-hidden","true"),H.style.position="absolute",H.style.left="0",H.style.top="0",H.style.pointerEvents="none";let L=F.createElement("div");L.className="docx-comment-overlay",L.contentEditable="false",L.setAttribute("aria-hidden","true"),L.style.position="absolute",L.style.left="0",L.style.top="0",L.style.pointerEvents="none";let S$1=F.createElement("div");S$1.className="docx-remote-selection-overlay",S$1.contentEditable="false",S$1.setAttribute("aria-hidden","true"),S$1.style.position="absolute",S$1.style.left="0",S$1.style.top="0",S$1.style.pointerEvents="none";let T=F.createElement("div");T.className="docx-table-furniture",T.contentEditable="false",T.style.position="absolute",T.style.left="0",T.style.top="0",T.style.pointerEvents="none",e$1.style.position="relative",e$1.replaceChildren(R,T,L,S$1,H);let E=Av(R,()=>l$1,()=>{let c=Q?.getActive()??null,m=ne?.activeNoteScope()??null,h=ne?.activeNotePageIndex()??null,I=c?cy(R,c.pageIndex):m?uy(R,m.id,h):null;return {layout:ae,selection:N,measurer:w,...c?{preferredPageIndex:c.pageIndex}:h!==null?{preferredPageIndex:h}:Ke.selectionPageIndex()!==void 0?{preferredPageIndex:Ke.selectionPageIndex()}:{},scopedHost:I,...c?{scopedHostKind:"headerFooter"}:m?{scopedHostKind:"note"}:{}}}),D=bs(a.part()),$=a.paragraphIds(),X$1=$.find(c=>!D.has(c))??$[0]??"",N=r.initialSelection??{anchor:{paragraphId:X$1,offset:0},head:{paragraphId:X$1,offset:0}},_=r.initialDrawingSelectionIntent??{kind:"none"};function B$1(c,m){c.kind===_.kind&&(c.kind!=="pointer"||_.kind==="pointer"&&c.drawingNodeId===_.drawingNodeId)||(_=c,m&&n$1.onChange?.(qe()));}let G=null,J=null,ve="suggesting needs an author before it can propose a change",ce=false,Te=false,ue=null,M=new Map;function A(){ue=null;for(let c of M.values())ue=c;}function q(c,m){if(c.paragraphId===m.paragraphId)return c.offset-m.offset;let h=Re$1();return h.indexOf(c.paragraphId)-h.indexOf(m.paragraphId)}function Z(c){if(!ue)return;let{from:m,to:h}=Ns(ae,ue),I=c.head;q(I,m)>=0&&q(I,h)<=0||(M.clear(),ue=null);}let W=null;function C$1(){return V()?.properties??null}function V(){if(!W)return null;let c=W.position,m=h=>h.paragraphId===c.paragraphId&&h.offset===c.offset;return m(N.anchor)&&m(N.head)?W:null}function j$1(c){if(!W)return;let m=W.position;c.anchor.paragraphId===m.paragraphId&&c.anchor.offset===m.offset&&c.head.paragraphId===m.paragraphId&&c.head.offset===m.offset||(W=null);}function oe(c,m,h,I){let O=je$1([...c],h,I);return c.length===m.length||!O.rejected?O:je$1([...m],h,I)}function ie$1(c,m,h,I){let O=V();if(!O||h===0)return [];let K=W.position,z=I&&K.paragraphId===c&&K.offset>=I.start&&K.offset<=I.end?{paragraphId:c,offset:kl({paragraphId:c,offset:I.start},{paragraphId:c,offset:I.end})}:Vd$1(ae,K);return z.paragraphId!==c||z.offset!==m?[]:[{op:"setRunProperties",paragraphId:c,start:m,end:m+h,properties:O.properties.reduce((U,te)=>ta$1(U,xa(U,te)),[...O.base])}]}let Q=null,ne=null,Ae$1=null,we=()=>ps(Q?.getActive()??null,ne?.activeNoteScope()??null),tt=()=>ne?.activeNoteScope()?.id??null,Xe=c=>{let m=b.multi?.spans,h=0,I=0;if(m&&m.length>0)for(let O=0;O<m.length;O+=1){let K=m[O];if(h=O,I=K.startIndex,c<K.startIndex+K.pageCount)break}return {sectionIndex:h,sectionStart:I}},Re$1=()=>vo(ae,Q?.getActive()??null,tt()),Pe=()=>globalThis.performance?.now()??Date.now(),We=0,ht=0,Oe=0,{styleCascade:se,numberingIndex:nt,defaultTabStopPt:Be,compatibilityMode:tn}=wv(a),$e=Sv({styleCascade:se,partOf:c=>Ge(a,c)??a.part()}),br=null,Lt=n$1.imageDecodePort??Ev(F)??Fv(),It=vc$1({session:a,decodePort:Lt,onResourcesChanged:()=>br?.()}),jn=n$1.drawingStrings??h,Lo=n$1.tocLabels,En=()=>N.anchor.paragraphId!==N.head.paragraphId||N.anchor.offset!==N.head.offset?null:{paragraphId:N.head.paragraphId,offset:N.head.offset},ul=L0(a),ci=Ov({mintValidatedBytes:(c,m)=>It.mintValidatedBytes(c,m)}),Wn=false,Gr=n$1.revisionDisplayMode??X,ct=()=>Gr,Fn=r.revisionAuthorVisibility??Ms(n$1.hiddenRevisionAuthors),Ye=()=>Fn.filterForSession(a),No=c=>{let m=Ge(a,c)??a.part(),h=Ga$1(m,c);if(h?.kind!=="paragraph")return false;let I=ct(),O=Ye();if(!Ca$1(h,I,O))return true;let K=Ha$1(m,c);return K?Ea$1(K.children,I,O).some(z=>z.kind==="paragraph"&&z.id===c):false},nn,Do=md(a),Xr=nd(),rn=(c,m=Wn)=>Iv({session:a,measurer:w,producer:P,cache:x,styleCascade:se,numberingIndex:nt,defaultTabStopPt:Be,compatibilityMode:tn,displayMode:ct(),showFieldCodes:m,revisionAuthorFilter:c,inlineDrawingLayoutForPart:h=>It.contextForPart(h),drawingLayoutTokenForPart:h=>It.cacheTokenForPart(h),drawingTokenForParagraphForPart:(h,I)=>It.drawingTokenForParagraph(I,h),linkProjectors:Do,projectFieldLink:h=>Xr.project(h)});nn=rn(Ye());let Un={...a,applyTreeOps:(c,m,h,I)=>je$1(c,m,h,I),ensureListDefinition:c=>Mb$1(i?.identity.actorId,()=>a.ensureListDefinition(c)),applyPmDoc:c=>Ze==="view"?{committed:false,rejected:true,opCount:0,reason:u}:i?{committed:false,rejected:true,opCount:0,reason:"collaboration-pm-doc-unproven"}:vl()?{committed:false,rejected:true,opCount:0,reason:p}:a.applyPmDoc(c)},ae=eo(),mn=n$1.revisionStyles,Ho=z0(n$1.showParagraphMarks??false,Se,()=>kt(false)),_o=r.reviewAuthorSlots??e(),Gn=mb({layout:()=>ae,items:()=>a.reviewItems(),styles:()=>mn,slots:_o});function Bo(c){if(c===null||c.length===0){if(!W)return;W=null;}else {let{anchor:m,head:h}=N;if(m.paragraphId!==h.paragraphId||m.offset!==h.offset)return;let I=V()?.base??Fu(a.partFor(we())??a.part(),h.paragraphId,h.offset,ct(),Ye());W={position:h,properties:c,base:I};}n$1.onChange?.(qe());}let ui=Yv({runFormatRefusal:()=>Tn({type:"toggleMark"},De)?.reason??null,session:Un,storyScope:we,paragraphOrder:Re$1,layout:()=>ae,selection:()=>N,displayMode:()=>ct(),authorFilter:Ye,paragraphMarkVisible:No,commit:(c,m,h)=>Ne(c,m,h),orderedRange:()=>or(),selectionMark:()=>Ve(),textOf:c=>Ct(c),selectedCells:()=>G?.cellIds,defaultParagraphStyleId:()=>se()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n$1.defaultFontFamily??null,pendingFormats:()=>C$1(),setPendingFormats:Bo}),vr=Jv({session:Un,storyScope:we,layout:()=>ae,selection:()=>N,displayMode:()=>ct(),authorFilter:Ye,paragraphMarkVisible:No,commit:(c,m,h)=>Ne(c,m,h),orderedRange:()=>or(),selectionMark:()=>Ve(),textOf:c=>Ct(c),paragraphOrder:Re$1,selectedCells:()=>G?.cellIds,armPendingFormats:c=>Bo(c),now:Pe,publish:()=>{vr.state().mode!=="off"?R.dataset.formatPainter="":delete R.dataset.formatPainter,n$1.onChange?.(qe());}}),fi=bx({session:Un,storyScope:we,headerFooterSectionIndex:()=>Q?.getActive()?.sectionIndex,revisionDisplayMode:ct,revisionAuthorFilter:Ye,paragraphOrder:Re$1,selectedCells:()=>G?.cellIds,editingMode:()=>Ze,publishRefusal:c=>{J=c,n$1.onChange?.(qe());},caretParagraphId:()=>N.anchor.paragraphId===N.head.paragraphId&&N.anchor.offset===N.head.offset?N.head.paragraphId:null,layout:()=>ae,commit:(c,m,h)=>Ne(c,m,{rearmPending:V()??void 0,...h?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>Il(),orderedRange:()=>or(),selectionMark:()=>Ve(),collapsedAt:c=>He(c),deleteSelectionPlan:()=>An(),paragraphTextOf:c=>Ct(c),numberingLevelExists:(c,m)=>sc$2(Jb$1(nt(),se()),c,m)!==null});function pi(c,m,h){return Ze!=="suggest"?null:kl({paragraphId:c,offset:m},{paragraphId:c,offset:h})}let $o=Px({session:Un,layout:()=>ae,fieldLinkById:c=>Xr.linkById(c),refusesWrite:()=>Ir(true)!==null,withMintActor:c=>Mb$1(i?.identity.actorId,c),storyScope:we,replacementLanding:pi,insertionLanding:(c,m)=>Vd$1(ae,{paragraphId:c,offset:m}).offset,selection:()=>N,orderedRange:()=>or(),selectionMark:()=>Ve(),textOf:c=>Ct(c),commit:(c,m)=>Ne(c,m)}),Yr=Ox({session:Un,storyScope:we,editingMode:()=>Ze,writeRefusal:c=>Ir(true,[c]),selection:()=>N,selectionMark:()=>Ve(),commit:(c,m)=>Ne(c,m)}),Xn=c=>{let m=St(a,c,{kind:"body"});if(m.kind==="body")return ne?.exitNote(),Q?.exitHeaderFooter(),true;if(m.kind==="headerFooter"){let I=Q?.activeScope();return I?.kind==="headerFooter"&&I.rId===m.rId?true:(ne?.exitNote(),Q?.enterHeaderFooter({rId:m.rId})??false)}let h=Qr(c);return h?ne?.activeNoteScope()?.id===h?true:(Q?.exitHeaderFooter(),ne?.enterNote(h)??false):false},Qr=c=>{for(let m of ae.pages)for(let h of [m.footnotes,m.endnotes])if(h){for(let I of h.notes)for(let O of C(I.fragments))if(O.paragraphId===c)return I.scopeId}return null},Jr=Ax({pagesLayer:R,container:e$1,scale:()=>l$1,layout:()=>ae,bookmarks:()=>a.bookmarks(),linkById:c=>Xr.linkById(c)??$o.linkById(c),drawingLinkById:c=>Dx(ae,c),setSelection:c=>vt(He(c)),enterStoryFor:c=>Xn(c),isCollapsedSelection:()=>N.anchor.paragraphId===N.head.paragraphId&&N.anchor.offset===N.head.offset,onScrolled:()=>yi(),...n$1.onHyperlinkPopover?{onPopover:n$1.onHyperlinkPopover}:{}}),xr=Fx({pagesLayer:R,equationById:c=>Yr.equationById(c),setSelection:vt,...n$1.onEquationPopover?{onPopover:n$1.onEquationPopover}:{}});R.addEventListener("contextmenu",bf),R.addEventListener("click",vf),R.addEventListener("pointermove",jo),R.addEventListener("pointerleave",df);let Ot=null;function qo(c,m,h){let I=h?h.authorFilter:Ye(),O=h?.layoutSession??b,K=h?.furnitureSource??nn;return m&&Hb$1(O,m),It.sync(a),a$5({view:a,revision:c,measurer:w,cache:x,session:O,producer:P,styleCascade:se,defaultTabStopPt:Be,numberingIndex:nt,furniture:K,compatibilityMode:tn,linkProjectors:Do,projectFieldLink:z=>Xr.project(z),inlineDrawingLayout:It.bodyContext,inlineDrawingLayoutForPart:z=>It.contextForPart(z),drawingTokenForParagraph:z=>It.drawingTokenForParagraph(z,a.part().name),drawingTokenForParagraphForPart:(z,U)=>It.drawingTokenForParagraph(U,z),drawingLayoutEpoch:It.cacheTokenForPart(a.part().name),drawingLayoutEpochForPart:z=>It.cacheTokenForPart(z),displayMode:ct(),showFieldCodes:h?false:Wn,revisionAuthorFilter:I})}function Zo(){return qo(a.packageRevision(),void 0,{layoutSession:Rd$1(),furnitureSource:rn(void 0,false)})}function eo(){let c=Pe(),m=qo(a.packageRevision());return We=Pe()-c,m}let At=null,Yn=null,gn=false;function v(){if(gn)return;gn=true;let c=a.packageRevision();Yn=Wx({steps:jx(()=>a.part()),shouldRun:()=>Ze!=="view"&&a.editable&&a.packageRevision()===c,hasPendingInput:Y});}function Y(c=true){return e$1.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:c})??false}function ee(){if(!Y()){kt(),v();return}At===null&&(At=setTimeout(()=>{At=null,ke.pending()===null&&(kt(),v());},0));}let ye$1="",fe=null,Ie=false;function Fe(){if(Ie||(fe!==null&&(clearTimeout(fe),fe=null),ye$1.length===0))return;let c=ye$1;ye$1="",Ie=true;try{De.type(c);}catch(m){throw ye$1=c+ye$1,m}finally{Ie=false;}}function xe(c){ye$1+=c,fe===null&&(fe=setTimeout(()=>{fe=null,Fe();},0));}function le$1(c,m,h){Fe();let I=h?.trim()||s?.trim();if(!I)return J="tracked changes need a non-empty author",n$1.onChange?.(qe()),false;if(c!=="deletion"&&m.length===0)return J=`${c} requires non-empty text`,n$1.onChange?.(qe()),false;if(c!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(m))return J=`${c} requires text without a paragraph mark`,n$1.onChange?.(qe()),false;let O={author:I,date:g$1()},K=or(),z=K.from.paragraphId===K.to.paragraphId&&K.from.offset===K.to.offset;if(c!=="insertion"&&z&&!(c==="replacement"&&G))return J=`${c} needs a non-collapsed selection`,n$1.onChange?.(qe()),false;let U=c==="insertion"?{ops:[],collapseTo:Vd$1(ae,K.from)}:An(I),te=Pf$1(U.ops,O,Tf()),pe=U.collapseTo;if(c==="insertion"||c==="replacement"){let re=c==="replacement"?U.replaceAt??U.collapseTo:U.collapseTo;te.push({op:"insertText",paragraphId:re.paragraphId,offset:re.offset,text:m,revision:O}),pe={paragraphId:re.paragraphId,offset:re.offset+m.length};}let he=false;return Ne(()=>{let re=je$1(te,Ve(),nr(pe));return he=re.committed,re},()=>He(pe)),he}let ke=qa$1({run:c=>{let m=Pe(),h=qo(c.revision,c);return We=Pe()-m,h},currentRevision:()=>a.packageRevision(),schedule:c=>{let m=setTimeout(c,0);return ()=>clearTimeout(m)},publish:c=>{Gn.releaseLayout(),ae=c,ee();}}),Me=false;br=()=>{ke.invalidateAll(a.packageRevision(),"drawing-resources"),!Me&&(Me=true,setTimeout(()=>{Me=false,pt();},0));};let ut=a.subscribe(c=>{Xw(c),W=null,ke.notify(c);}),Vt=i?a.collaborationPort(i.documentId):null,Qn=()=>{},ft=()=>{},yt=false,hn=null,Ko=null,mi=i?i.subscribeRemoteSelections(()=>{yt&&vi();}):()=>{};function to(){let c=Pv(e$1,ae,N,l$1),m=Q?.getActive()?.pageIndex??Ke.selectionPageIndex();return m===void 0||c===void 0||c.has(m)?c:new Set([...c,m])}function pt(){return ke.pending()?ke.flush():false}let no=8;function Vo(c){!c&&ke.pending()!==null&&We>no&&Y(false)||pt()||kt();}function Se(){Fe(),pt();}function bt(){Fe();let c=pt();return At!==null?(kt(),v(),true):c}let yn=null;function Jn(c){return ky(c,a.part())}function er(){for(let c of R.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(c.getAttribute("data-docx-content-control")===yn){c.dataset.hover="",c.dataset.boundaryVisible="";continue}delete c.dataset.hover,ce||delete c.dataset.boundaryVisible;}}function tr(c){yn!==c&&(yn=c,er());}function zo(c){return Ty(a.part(),ro(c),c.target)}function jo(c){let m=zo(c);tr(m?Jn(m):null);}function ro(c){let m=c.target,h=m?.isConnected?m.closest("[data-paragraph-id]"):void 0;if(h)return h.dataset.paragraphId;let I=R.ownerDocument;return typeof I.elementFromPoint!="function"?void 0:I.elementFromPoint(c.clientX,c.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function df(){tr(null);}function Ew(){let c=Sr(),m=qd$1(a.part()),h=Ae(a.part()),I=h.map(re=>{let ot=D0(re,ae,a.part(),w);return ot?{...ot,empty:m.has(re.beginParagraphId)}:null}).filter(re=>re!==null),O=new Set(I.map(re=>re.boundary.id)),K=new Set(I.filter(re=>re.empty).map(re=>re.boundary.id));for(let re of h)re.contentControlId&&Jn(re)!==re.contentControlId&&K.add(re.contentControlId);let z=c&&!O.has(c.id)?new Set([c.id]):void 0,U=yn?new Set([yn]):void 0,te=new Set(je(ae).filter(re=>re.controlType==="checkbox"&&mf(re.id)).map(re=>re.id)),pe=I.filter(re=>re.additional&&!re.empty).map(re=>re.boundary),he=kf()!==null;if(!(!ce&&!z&&!U&&!he&&te.size===0&&pe.length===0&&O.size===0))return {...he?{readOnly:true}:{},...ce?{showAll:true}:{},...z?{activeIds:z}:{},...U?{hoverIds:U}:{},...te.size>0?{checkedIds:te}:{},...pe.length>0?{additionalBoundaries:pe}:{},...O.size>0?{tocControlIds:O}:{},...K.size>0?{suppressedIds:K}:{}}}let Wo=null;function Sr(){let c=we();if(c.kind!=="body")return Aw(c);if(Wo&&Wo.layout===ae&&Wo.selection===N)return Wo.result;let m=Fw();return Wo={layout:ae,selection:N,result:m},m}function Fw(){let c=ge$1(ae,N.head,w);if(!c)return null;let m=ie(ae,{x:c.x,y:c.y+c.height/2,pageIndex:c.pageIndex});return m&&Ow(m.id)===a.part().name?m:null}function Ow(c){let m=c.indexOf("#");return m===-1?"":c.slice(0,m)}function Aw(c){let m=a.partFor(c);return m?vd(m,N.head.paragraphId):null}function cf(c){return c.bound?"bound":c.effectiveLock==="contentLocked"||c.effectiveLock==="sdtContentLocked"?"locked":null}function Mw(c){return c.effectiveLock==="sdtLocked"||c.effectiveLock==="sdtContentLocked"?"locked":null}function Lw(c){return Dd$1(c)}function wr(c){let m=Ge(a,c),h=Ga$1(m??a.part(),c);return !h||!Lw(h)?null:h}function uf(c){let m=wr(c);if(!m)return null;for(let h of m.children)if(h.kind!=="textValue"&&(h.kind==="contentControlProperties"||h.localName==="sdtPr"))for(let I of h.children){if(I.kind==="textValue"||I.localName!=="tabIndex")continue;let O=I.attributes.find(z=>z.localName==="val")?.value;if(O===void 0)return null;let K=Number(O);return Number.isFinite(K)?K:null}return null}function Nw(){let c=we(),m=c.kind==="body"?null:a.partFor(c),h=c.kind==="notesPart"?new Set(Re$1()):void 0;return (m?[...ud(m,h)]:[...je(ae)]).filter(O=>cf(O)===null).sort((O,K)=>{let z=uf(O.id),U=uf(K.id);return z!==null&&U!==null&&z!==U?z-U:z!==null&&U===null?-1:z===null&&U!==null?1:0})}function ff(c){for(let m of c.children)if(m.kind!=="textValue"&&(m.kind==="contentControlContent"||m.localName==="sdtContent"))return m.children;return []}function Dw(c){let m=wr(c);if(!m)return false;let h=ff(m),I=[],O=pe=>{for(let he of pe){if(he.kind==="paragraph"){I.push({id:he.id,length:Re(he).length});continue}if(he.kind==="textValue")continue;if(he.kind==="contentControl"){O(ff(he));continue}O(he.children);}};if(O(h),I.length>0){let pe=I[0],he=I[I.length-1];return vt({anchor:{paragraphId:pe.id,offset:0},head:{paragraphId:he.id,offset:he.length}}),true}let K=null,z=0,U=0,te=pe=>{for(let he of pe){if(he.kind==="paragraph"){let re=Re(he).spanOf(m);if(!re)continue;return K=he.id,z=re.start,U=re.end,true}if(he.kind!=="textValue"&&te(he.children))return true}return false};return te((a.partFor(St(a,c,we()))??a.part()).root.children),K?(vt({anchor:{paragraphId:K,offset:z},head:{paragraphId:K,offset:U}}),true):false}let pf=c=>Z0(wr(c));function mf(c){let m=wr(c);if(!m)return false;for(let h of m.children)if(h.kind!=="textValue"&&!(h.kind!=="contentControlProperties"&&h.localName!=="sdtPr")){for(let I of h.children)if(I.kind==="contentControlCheckbox")for(let O of I.children){if(O.kind!=="contentControlChecked")continue;let K=O.attributes.find(z=>z.localName==="val")?.value;return !(K==="0"||K==="false"||K==="off")}}return false}let gf$1=c=>K0(wr(c));function gi(c,m){for(let h of R.querySelectorAll("[data-docx-content-control]"))h.getAttribute("data-docx-content-control")===c&&(m?h.dataset.open="":delete h.dataset.open);}let fl=q0({find:wr,allowed:c=>!on.disabledReason(c,"edit"),apply:(c,m)=>on.setValue(c,m),items:pf,date:gf$1,layer:R,setOpen:gi,request:n$1.onRequestContentControlWidget});function bn(c){let m=c.dataset.docxCcId;c.remove(),m&&gi(m,false);}function hf(){fl.cancel();let c=R.querySelector(".docx-content-control-menu");return c&&bn(c),c}function yf(c,m){let h=c.dataset.docxCcId,I=()=>{F.removeEventListener("pointerdown",O,true),F.removeEventListener("keydown",K,true);},O=z=>{if(c.parentNode===null){I();return}let U=z.target,te=U instanceof Element?U.closest("[data-docx-cc-widget]"):null;U&&(c.contains(U)||te?.getAttribute("data-docx-cc-id")===h)||(I(),m());},K=z=>{z.key==="Escape"&&(I(),c.parentNode!==null&&(z.stopPropagation(),bn(c)));};F.addEventListener("pointerdown",O,true),F.addEventListener("keydown",K,true);}function bf(c){let m=zo(c);Hw(m&&wl(m.id)?m.id:null);}let Uo=null;function Hw(c){Uo!==c&&(Uo=c,n$1.onChange?.(qe()));}function vf(c){if(c.button!==0||c.target?.closest("a.docx-hyperlink")||N.anchor.paragraphId!==N.head.paragraphId||N.anchor.offset!==N.head.offset)return;let m=ro(c);if(!m)return;let h=Ae(a.part()).find(K=>K.resultParagraphIds.includes(m));if(!h||zo(c)?.id!==h.id)return;let O=_if(a.part(),h,a.documentOutline(),xl(h))[h.resultParagraphIds.indexOf(m)];O&&(c.preventDefault(),Jr.goToPosition({paragraphId:O,offset:0}));}function _w(c,m){let h=on.disabledReason(c,"edit");if(h){J=h,n$1.onChange?.(qe());return}if(m==="checkbox"){on.setValue(c,mf(c)?"false":"true");return}if(hf()?.dataset.docxCcId!==c&&!fl.open(c,m)){if(m==="dropdown"||m==="comboBox"){let I=pf(c);if(I.length===0&&m==="dropdown")return;let O=F.createElement("div");O.className="docx-content-control-menu",O.dataset.docxMarker="",O.dataset.docxCcId=c,O.setAttribute("contenteditable","false"),O.setAttribute("role","listbox"),O.style.position="absolute",O.style.zIndex="20",O.style.pointerEvents="auto",O.addEventListener("pointerdown",U=>U.stopPropagation());let z=je(ae).find(U=>U.id===c)?.fragments[0];if(z){let U=ae.pages[z.pageIndex],te=et?.pageOffsetX.get(z.pageIndex)??0;if(U){let pe=U.contentBox.x-U.box.x,he=U.contentBox.y-U.box.y;O.style.left=`${(U.box.x+te+pe+z.box.x+z.box.width)*l$1}px`,O.style.top=`${(U.box.y+he+z.box.y+z.box.height)*l$1}px`,O.style.transform="translateX(-100%)";}}for(let U of I){let te=F.createElement("button");te.type="button",te.className="docx-content-control-menu-item",te.dataset.docxMarker="",te.setAttribute("contenteditable","false"),te.setAttribute("role","option"),te.textContent=U.displayText,te.addEventListener("mousedown",pe=>{pe.preventDefault(),pe.stopPropagation(),bn(O),on.setValue(c,U.value);}),O.append(te);}if(m==="comboBox"){let U=F.createElement("input");U.type="text",U.className="docx-content-control-menu-input",U.dataset.docxMarker="",U.setAttribute("contenteditable","false"),U.addEventListener("mousedown",te=>te.stopPropagation()),U.addEventListener("keydown",te=>{te.key==="Enter"&&(te.preventDefault(),bn(O),on.setValue(c,U.value));}),O.append(U);}R.append(O),gi(c,true),yf(O,()=>bn(O));return}if(m==="date"){let I=F.createElement("div");I.className="docx-content-control-menu",I.dataset.docxMarker="",I.dataset.docxCcId=c,I.setAttribute("contenteditable","false"),I.style.position="absolute",I.style.zIndex="20",I.style.pointerEvents="auto",I.addEventListener("pointerdown",_e=>_e.stopPropagation());let O=je(ae).find(_e=>_e.id===c),K=O?.fragments[0];if(K){let _e=ae.pages[K.pageIndex],Pr=et?.pageOffsetX.get(K.pageIndex)??0;if(_e){let la=_e.contentBox.x-_e.box.x,da=_e.contentBox.y-_e.box.y;I.style.left=`${(_e.box.x+Pr+la+K.box.x+K.box.width)*l$1}px`,I.style.top=`${(_e.box.y+da+K.box.y+K.box.height)*l$1}px`,I.style.transform="translateX(-100%)";}}I.classList.add("docx-content-control-calendar");let z=gf$1(c),U=z?new Date(z):new Date,te=Number.isNaN(U.getTime())?null:U,pe=te??new Date,he=pe.getFullYear(),re=pe.getMonth(),ot=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),Tr=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),Mn=new Intl.DateTimeFormat(void 0,{weekday:"narrow"}),Ii=_e=>`${_e.getFullYear().toString().padStart(4,"0")}-${(_e.getMonth()+1).toString().padStart(2,"0")}-${_e.getDate().toString().padStart(2,"0")}`,ia=(_e,Pr)=>_e.getFullYear()===Pr.getFullYear()&&_e.getMonth()===Pr.getMonth()&&_e.getDate()===Pr.getDate(),sa=null,Fl=()=>{let _e=F.createElement("input");_e.type="date",_e.className="docx-content-control-calendar-input",_e.value=te?Ii(te):"";let Pr=_e.value;O?.alias&&_e.setAttribute("aria-label",O.alias);let la=()=>{if(!_e.value||_e.value===Pr)return false;let Tt=_e.value;return bn(I),on.setValue(c,Tt),true};sa=la,_e.addEventListener("keydown",Tt=>{Tt.key==="Enter"&&(Tt.preventDefault(),la()||bn(I));}),_e.addEventListener("blur",()=>{queueMicrotask(()=>{!I.isConnected||I.contains(F.activeElement)||la()||bn(I);});});let da=F.createElement("div");da.className="docx-content-control-calendar-header";let Rr=F.createElement("button");Rr.type="button",Rr.className="docx-content-control-calendar-nav",Rr.textContent="\u2039";let pI=new Date(he,re-1,1);Rr.setAttribute("aria-label",ot.format(pI));let Ol=F.createElement("div");Ol.className="docx-content-control-calendar-title",Ol.textContent=ot.format(new Date(he,re,1));let Cr=F.createElement("button");Cr.type="button",Cr.className="docx-content-control-calendar-nav",Cr.textContent="\u203A";let mI=new Date(he,re+1,1);Cr.setAttribute("aria-label",ot.format(mI)),Rr.addEventListener("mousedown",Tt=>Tt.stopPropagation()),Cr.addEventListener("mousedown",Tt=>Tt.stopPropagation()),Rr.addEventListener("click",()=>{re-=1,re<0&&(re=11,he-=1),Fl();}),Cr.addEventListener("click",()=>{re+=1,re>11&&(re=0,he+=1),Fl();}),da.append(Rr,Ol,Cr);let Al=F.createElement("div");Al.className="docx-content-control-calendar-weekdays";for(let Tt=0;Tt<7;Tt+=1){let Ln=F.createElement("span");Ln.textContent=Mn.format(new Date(2024,0,1+Tt)),Al.append(Ln);}let ki=F.createElement("div");ki.className="docx-content-control-calendar-grid",ki.setAttribute("role","grid");let gI=(new Date(he,re,1).getDay()+6)%7,hI=new Date;for(let Tt=0;Tt<42;Tt+=1){let Ln=new Date(he,re,Tt-gI+1),zt=F.createElement("button");zt.type="button",zt.className="docx-content-control-calendar-day",zt.textContent=String(Ln.getDate()),zt.setAttribute("role","gridcell"),zt.setAttribute("aria-label",Tr.format(Ln)),Ln.getMonth()!==re&&(zt.dataset.otherMonth=""),te&&ia(Ln,te)&&(zt.dataset.selected="",zt.setAttribute("aria-selected","true")),ia(Ln,hI)&&(zt.dataset.today=""),zt.addEventListener("mousedown",yI=>yI.stopPropagation()),zt.addEventListener("click",()=>{bn(I),on.setValue(c,Ii(Ln));}),ki.append(zt);}I.replaceChildren(_e,da,Al,ki);};Fl(),R.append(I),gi(c,true),yf(I,()=>{sa?.()||bn(I);}),I.querySelector("[data-selected], [data-today], .docx-content-control-calendar-day")?.focus({preventScroll:true});}}}let on={setShowAll(c){ce!==c&&(ce=c,kt());},setFormFill(c){Te!==c&&(Te=c,n$1.onChange?.(qe()));},showAll:()=>ce,formFill:()=>Te,atCaret:()=>Sr(),navigate(c){let m=Nw();if(m.length===0)return false;let h=Sr(),I=h?m.findIndex(K=>K.id===h.id):-1;c==="next"?I=I<0?0:(I+1)%m.length:I=I<0?m.length-1:(I-1+m.length)%m.length;let O=m[I];return Dw(O.id)},setValue(c,m){let h=on.disabledReason(c,"edit");if(h)return J=h,n$1.onChange?.(qe()),false;let I=false;return Ne(()=>{let O=je$1([{op:"setContentControlValue",controlId:c,value:m}],Ve(),void 0,St(a,c,we()),false);return I=O.committed,O}),I},remove(c){let m=c??Sr()?.id;if(!m)return J="notFound",n$1.onChange?.(qe()),false;let h=on.disabledReason(m,"remove");if(h)return J=h,n$1.onChange?.(qe()),false;let I=false;return Ne(()=>{let O=je$1([{op:"removeContentControl",controlId:m}],Ve(),void 0,St(a,m,we()),false);return I=O.committed,O}),I},disabledReason(c,m){let h=kf();if(h!==null)return h;let I=je(ae).find(K=>K.id===c);if(I)return m==="remove"?Mw(I):cf(I);let O=wr(c);if(!O)return "notFound";for(let K of O.children)if(K.kind!=="textValue"&&!(K.kind!=="contentControlProperties"&&K.localName!=="sdtPr")){if(K.children.some(z=>z.kind!=="textValue"&&z.localName==="dataBinding")&&m==="edit")return "bound";for(let z of K.children){if(z.kind==="textValue"||z.localName!=="lock")continue;let U=z.attributes.find(te=>te.localName==="val")?.value;if(m==="remove"){if(U==="sdtLocked"||U==="sdtContentLocked")return "locked"}else if(U==="contentLocked"||U==="sdtContentLocked")return "locked"}}return null}};function pl(){let c=Sf&&Ze!=="view";R.contentEditable=c?"true":"false",R.setAttribute("aria-readonly",c?"false":"true");}function qe(){return {revision:a.packageRevision(),pageCount:ae.pages.length,selection:N,cellSelection:G,canUndo:i?.canUndo()??a.canUndo(),canRedo:i?.canRedo()??a.canRedo(),collaborationStatus:i?.status()??"inactive",lastRejection:J,pendingFormat:C$1(),contentControls:{showAll:ce,formFill:Te,activeControlId:Sr()?.id??null},contextTocId:Uo,formatPainter:vr.state(),perf:{layoutMs:We,paintMs:ht,selectionMs:Oe,placed:b.stats.placed,total:b.stats.total,reusedPages:b.stats.reusedPages,fullPasses:b.stats.fullPasses,staleDiscards:ke.staleDiscards,cancelledRuns:ke.cancelledRuns}}}let Nt,et,ml=null,hi=false,Go=null,gl=null;function Bw(c){for(let m of ae.pages){let h=R.children.item(m.index);if(h?.dataset.pageIndex!==String(m.index))continue;let I=c.pageOffsetX.get(m.index)??0;h.style.left=`${(m.box.x+I)*l$1}px`;}}function kt(c=true){At!==null&&(clearTimeout(At),At=null,c=true);let m=Ke.adoptBeforePaint(),h=Pe();Nt=to(),Q?.reconcileOccurrence();let I=Q?.getActive()??null,O=Ew(),K=qd$1(a.part());n(R,ae,{scale:l$1,readOnlyParagraphIds:bs(a.part()),...K.size>0?{emptyTocPlaceholderIds:K}:{},...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{},...n$1.defaultFontFamily?{defaultFontFamily:n$1.defaultFontFamily}:{},materialize:Nt,ariaHidden:false,drawingStrings:jn,...n$1.fieldShading?{fieldShading:n$1.fieldShading}:{},...mn!==void 0?{revisionStyles:mn}:{},shadeFormFields:ul(),showParagraphMarks:Ho.get(),...ci?{imageUrlPort:ci}:{},...I?{activeHeaderFooterRId:I.scope.rId,activeHeaderFooterPageIndex:I.pageIndex}:{},...O?{contentControlChrome:O}:{}},Gn.get().value),ru(R,En(),{domReplaced:true}),my(e$1,R,I!=null),nc(e$1,Ze),et=Vs(ae,Nt),Bw(et),R.style.width=`${et.width*l$1}px`,R.style.height=`${et.height*l$1}px`,e$1.style.width=`${et.width*l$1}px`,e$1.style.height=`${et.height*l$1}px`,H.style.width=`${et.width*l$1}px`,H.style.height=`${et.height*l$1}px`,L.style.width=H.style.width,L.style.height=H.style.height,S$1.style.width=H.style.width,S$1.style.height=H.style.height,T.style.width=H.style.width,T.style.height=H.style.height,aa.update(),ht=Pe()-h,ta(),vi(),ao(true),rp(),Ke.mirrorToDom(),xf(hi),hi=false,(c||m)&&n$1.onChange?.(qe());}function yi(){Se();let c=to(),m=Vs(ae,c);et&&Su(c,Nt)&&Rv(m,et)||kt(false);}function xf(c=false){if(Q?.getActive()||ne?.activeNoteScope()||N.anchor.paragraphId!==N.head.paragraphId||N.anchor.offset!==N.head.offset)return;let m=F.activeElement;if(m!==R&&(!m||!R.contains(m)))return;let h=ge$1(ae,N.head,{measurer:w,...Ke.selectionPageIndex()!==void 0?{preferredPageIndex:Ke.selectionPageIndex()}:{}});if(!h)return;let I=ml!==null&&ml!==h.pageIndex;if(ml=h.pageIndex,!c&&!I)return;let O=ae.pages[h.pageIndex],K=Kt(e$1);if(!O||!K||K.clientHeight<=0)return;let z=24,U=O.contentBox.y-O.box.y,te=(O.box.y+U+h.y)*l$1+e$1.offsetTop,pe=te+h.height*l$1,he=K.scrollTop,re=he+K.clientHeight,ot=he;if(te<he+z)ot=te-z;else if(pe>re-z)ot=pe+z-K.clientHeight;else return;let Tr=Math.max(0,K.scrollHeight-K.clientHeight),Mn=Math.max(0,Math.min(ot,Tr));Math.abs(Mn-K.scrollTop)<.5||(K.scrollTop=Mn,Rl());}let Ze=n$1.editingMode??"edit",Sf=true,bi=Object.freeze({kind:"body"}),wf=0,If=ab(n$1.locale,Fe),hl=n$1.translate,rt=null;function je$1(c,m,h,I=we(),O=true,K){Fe();let z=Ir(c.some($w)||!!K?.length,c,O);if(z!==null)return {committed:false,rejected:true,opCount:0,reason:z};let U=Zw(O&&rt?rt.annotate(c):c),te=Xo(U,m,h,I,K);return O&&rt?.afterApply(te.committed),te.committed&&U.some(tu)&&r.onTrackedChange?.(),te}function Xo(c,m,h,I=we(),O){let K=i?.gateOperations(c,I);return K?{committed:false,rejected:true,opCount:0,reason:K}:(wf+=1,a.applyTreeOps(c,m,h,I,i?{packageEdits:O,origin:b$2.mutationHuman,actorId:i.identity.actorId,operationId:`${i.identity.actorId}:${i.sessionId}:browser:${wf}`,recordsHistory:false}:{packageEdits:O}))}function Ir(c,m=[],h=true){let I=qx(m);return Ze==="view"&&!I?u:Wn&&c&&h&&!I&&N0(O=>Ge(a,O),N)?Rs:c&&!I&&(h&&vl()||m.some(O=>eI(O)))?p:Ze==="suggest"&&!s?.trim()&&c?ve:Ze==="suggest"&&m.some(O=>O.op==="deleteNote")?"suggesting cannot delete a note outright; strike its reference to propose the deletion":null}let kf=n0(()=>Ir(true,[],false),()=>a.editable);function $w(c){return c.op!=="acceptRevision"&&c.op!=="rejectRevision"&&c.op!=="acceptAllRevisions"&&c.op!=="rejectAllRevisions"}let qw=c=>sh$1.has(c),Tf=()=>!a.trackingSettings().doNotTrackFormatting;function Pf$1(c,m,h){return c.flatMap(I=>eu(I)?!h&&qw(I.op)?[I]:[I.revision!==void 0?I:{...I,revision:m}]:I.op==="splitParagraphMany"?[{...I,revision:m}]:I.op==="splitParagraph"?[I,{op:"setParagraphMarkRevision",paragraphId:I.paragraphId,kind:"ins",revision:m}]:I.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:I.secondId,revision:m}]:[I])}function Rf(){let c=s?.trim();return Ze==="suggest"&&c?c:void 0}function Zw(c){let m=Rf();return m===void 0?[...c]:Pf$1(c,{author:m,date:g$1()},Tf())}function Kw(c,m,h){let I=Ct(m);if(I===h)return c;let O=0;for(;O<h.length&&O<I.length&&h[O]===I[O];)O+=1;let K=0;for(;K<h.length-O&&K<I.length-O&&h[h.length-1-K]===I[I.length-1-K];)K+=1;let z=I.length-h.length,U=te=>te.paragraphId!==m||te.offset<=O?te:te.offset>=h.length-K?{...te,offset:te.offset+z}:{...te,offset:O};return {anchor:U(c.anchor),head:U(c.head)}}function Vw(c,m){let h=a.partFor(we())??a.part(),I=Ha$1(h,c),O=Ha$1(h,m);return I!==null&&O!==null&&I.id===O.id}function nr(c){return {paragraphId:c.paragraphId,start:c.offset,end:c.offset}}function Ne(...c){let m=eb(e$1);try{zw(...c);}finally{m();}}function zw(c,m,h={}){Fe(),h?.keepCellSelection||(G=null),W=null,Ke.noteModelMoved();let I=c(),O=typeof I=="boolean"||!I.rejected?null:I;if(O)J=e0(String(O.reason??"rejected"),a.settingsRoot());else {J=null;let K=m?.();K&&(Jo(),N=K,B$1({kind:"none"},false),Ot=null,hi=true);let z=h?.rearmPending;if(z&&z.properties.length>0){let{anchor:U,head:te}=N;U.paragraphId===te.paragraphId&&U.offset===te.offset&&(W={properties:z.properties,base:z.base,position:te});}}oo(),Vo(O!==null);}function jw(){if(!Nt)return true;for(let c of [N.anchor,N.head]){let m=ge$1(ae,c);if(m&&!Nt.has(m.pageIndex))return false}return true}function oo(){let c=i;if(!c)return;let m=Vt?yb(G?.text??N,I=>{let O=Ge(a,I)??a.part();return bb(O,I)},G?"cells":void 0):null,h=m?`${m.anchor.paragraphId}:${m.anchor.offset}|${m.head.paragraphId}:${m.head.offset}|${m.kind??""}`:"";h!==Ko&&(Ko=h,c.setLocalSelection(m));}function vt(c,m=false){let h=!Zt(c,N);ye$1.length>0&&h&&Fe();let I=rt?.beforeSelect(c);if(I===null)return;c=I??c,j$1(c),Z(c);let O=Sr()?.id??null,K=Gt(a.part(),N.head)?.id;Jo(),N=c,G=null,m||(Ot=null),jw()||(Ke.noteModelMoved(),kt(false)),Ke.noteSelectionSettled(),Ke.mirrorToDom(true),xf(true),ta(),kr.clear(),ao();let z=Sr()?.id??null,U=Gt(a.part(),N.head)?.id;(O!==z||K!==U)&&kt(false),oo(),n$1.onChange?.(qe());}let Ke=ix({session:a,storyScope:we,document:F,pagesLayer:R,selection:()=>N,setSelection:c=>vt(c),adoptSelection:c=>{let m=rt?.beforeSelect(c);m!==null&&(c=m??c,j$1(c),Z(c),Jo(),N=c,Ot=null,hi=true,oo());},commit:c=>Ne(c),applyOps:(c,m,h)=>je$1(c,m,void 0,h),hasPendingInput:()=>ye$1.length>0,replacementOffset:(c,m,h)=>kl({paragraphId:c,offset:m},{paragraphId:c,offset:h}),render:()=>kt(),flushLayout:()=>pt(),flushToPaint:()=>bt(),updateCaret:()=>{E.update(),ru(R,En());},textOf:c=>Ct(c),pendingFormatOps:(c,m,h,I)=>ie$1(c,m,h,I),selectionMark:()=>Ve(),now:Pe,recordSelectionMs:c=>{Oe=c;},isGesturing:()=>Tl?.dragging()??false,domSelection:()=>G?He(G.text.anchor):N,holdsCellSelection:()=>G!==null,replaceSelectionWith:c=>De.type(c),discardPaint:()=>l(R)});Q=$x({session:a,layout:()=>ae,sectionAtPage:Xe,revisionDisplayMode:ct,revisionAuthorFilter:Ye,selection:()=>N,setScopeSelection:c=>{Fe(),Jo(),j$1(c),kr.clear(),N=c,G=null,Ot=null,oo();},noteModelMoved:()=>Ke.noteModelMoved(),render:()=>kt(),mirrorToDom:()=>Ke.mirrorToDom(),notify:()=>n$1.onChange?.(qe()),materializedPages:()=>Nt,entryRefused:()=>Ze==="view",leaveOtherStories:()=>ne?.exitNote()}),ne=Kx({session:a,exitHeaderFooter:()=>Q?.exitHeaderFooter(),applyOps:je$1,commit:Ne,selection:()=>N,selectionMark:()=>Ve(),orderedStart:()=>Il(),deleteSelectionPlan:()=>An(),undo:()=>De.undo(),activeScope:()=>{let c=ne?.activeNoteScope();return c||(Q?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:c=>Q.setActiveScope(c),setSelection:c=>vt(c),noteModelMoved:()=>Ke.noteModelMoved(),render:()=>{pt()||kt();},revealNote:c=>{pt();for(let m of ae.pages){let h=[...m.footnotes?.notes??[],...m.endnotes?.notes??[]].find(I=>I.scopeId===c);if(h)return oa(h.box.y,h.box.height,{block:"nearest",offsetPx:48}),m.index}return null},notify:()=>n$1.onChange?.(qe()),lastRejection:()=>J,setLastRejection:c=>{J=c;}});function Cf(c){c&&Fe(),G=c,c&&(j$1(c.text),Jo(),N=c.text),Ot=null,Ke.noteSelectionSettled(),Ke.mirrorToDom(),ta(),kr.clear(),ao(),oo(),n$1.onChange?.(qe());}let rr=null;function Ww(){let m=ge$1(ae,N.head)?.pageIndex??0,h=new Set;for(let I=m-1;I<=m+1;I+=1)I>=0&&I<ae.pages.length&&h.add(I);return h}let Ef$1=new WeakMap;function Uw(c){let m=Ef$1.get(c);if(m)return m;let h=new Map;for(let I of c.pages)for(let O of B(I))h.has(O.paragraphId)||h.set(O.paragraphId,I.index);return Ef$1.set(c,h),h}function Gw(){let c=a.revision(),m=Nt??Ww();if(rr?.layout===ae&&rr.revision===c&&Su(rr.pages,m))return rr.rects;let h=Uw(ae),I=(U,te)=>{if(!m)return true;let pe=h.get(U),he=h.get(te);if(pe===void 0||he===void 0)return true;for(let re=Math.min(pe,he);re<=Math.max(pe,he);re+=1)if(m.has(re))return true;return false},O=[];for(let U of ea()){if(U.kind==="comment"){if(U.range===null||!I(U.range.start.paragraphId,U.range.end.paragraphId))continue;O.push({key:Fa(U),from:{paragraphId:U.range.start.paragraphId,offset:U.range.start.offset},to:{paragraphId:U.range.end.paragraphId,offset:U.range.end.offset}});continue}let te=Fa(U),pe=U.kind==="revision"?U.ranges:U.range?[U.range]:[];for(let[he,re]of pe.entries())I(re.start.paragraphId,re.end.paragraphId)&&O.push({key:pe.length===1?te:`${te}${f$1}${he}`,from:{paragraphId:re.start.paragraphId,offset:re.start.offset},to:{paragraphId:re.end.paragraphId,offset:re.end.offset}});}let K=$d$1(ae,O,m,w),z=[];for(let[U,te]of K)for(let pe of te)z.push({...pe,key:U});return rr={layout:ae,revision:c,pages:m,rects:z},z}let On=null;function Xw(c){On&&(c.impact==="text-local"&&c.created.length===0&&c.deleted.length===0&&c.splitJoin.length===0?On={packageRevision:a.packageRevision(),bodyRoot:a.part().root,index:On.index}:On=null);}function Yw(){let c=a.packageRevision(),m=a.part().root;if(On&&On.packageRevision===c&&On.bodyRoot===m)return On.index;let h=new Map,I=K=>{let z=h.size;for(let[U,te]of K)h.has(U)||h.set(U,z+te);};I(Ih$1(a.part()));let O=new Set([a.part()]);for(let K of a.headerFooterPartsBySection())for(let z of [K.headers,K.footers])for(let U of z.values())O.has(U)||(O.add(U),I(Ih$1(U)));for(let K of ["footnote","endnote"]){let z=a.partFor({kind:"notesPart",noteKind:K});!z||O.has(z)||(O.add(z),I(Ih$1(z)));}return On={packageRevision:c,bodyRoot:m,index:h},h}let kr=new Set,Yo=null,Qo=null,yl=false,Ff=false;function Jo(){yl||(Qo=null);}function Of(){let c=Qo;if(!c||!N)return null;let m=(I,O)=>I.paragraphId===O.paragraphId&&I.offset===O.offset;if(!m(N.anchor,c.anchor)||!m(N.head,c.head))return null;let h=ea().find(I=>Fa(I)===c.key);return !h||h.kind==="revision"&&Yo!==null&&Yo.has(h.revisionKind)&&!Ff?null:h}function bl(){let c=Of();if(c)return Af(c);let m=N?.head;if(!m)return null;let I=Ja$2(ea(),m,Yw()).filter(O=>!(O.kind==="comment"&&O.resolved)&&!kr.has(Fa(O))&&!(O.kind==="revision"&&Yo!==null&&Yo.has(O.revisionKind)))[0];return I?Af(I):null}function Af(c){if(c.kind!=="comment")return c;let m=La$1(ea(),c);return kr.has(Fa(m))?null:m}function ea(){return Fn.filterItems(a.reviewItems())}let Mf=gb({roster:Gn.get,styles:()=>mn,slots:_o}),Lf=Mf.forAuthor,Qw=Mf.declaredFor;function Jw(c,m,h){let I=c.split(f$1),O=I[0],K=m!==null&&O===Fa(m);if(c.startsWith("comment-")){let he=h.get(O),re=he?.kind==="comment"&&he.resolved;return re&&!K?null:K?`docx-comment-band docx-comment-band--active${re?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(c.startsWith("custom-"))return K?"docx-comment-band docx-comment-band--active":null;let z=h.get(O);if(!z||z.kind!=="revision")return null;let U=I.length>1?Number(I[1]):0;return `docx-revision-band docx-revision-band--${(he=>he==="delete"||he==="moveFrom"?"delete":he==="insert"||he==="moveTo"?"insert":he==="replace"&&z.replacedRangeCount!==void 0?U<z.replacedRangeCount?"delete":"insert":"other")(z.revisionKind)}${K?" docx-revision-band--active":""}`}let Nf=null,Df,Hf=null;function ao(c=false){let m=bl(),h=m?Fa(m):null,I=Gn.get();if(!c&&Nf===ae&&Df===h&&Hf===I.resolved)return;let O=new Map;for(let z of ea())O.set(Fa(z),z);let K=[];for(let z of Gw()){let U=Jw(z.key,m,O);if(!U)continue;let te=z.key.split(f$1)[0],pe=O.get(te),he=pe?au(pe):null,re=he===null||he===""?void 0:I.resolved.get(he),ot=pe?.kind==="revision"&&m!==null&&te===Fa(m)?re?.style?.activeBackground:void 0;K.push({...z,className:U,...re?{reviewAuthor:re}:{},...ot!==void 0?{activeBackground:ot}:{}});}o(L,ae,K,{scale:l$1,...et?{pageOffsetX:et.pageOffsetX}:{}}),Nf=ae,Df=h,Hf=I.resolved;}function ta(){rt?.update();let c=G?va(ae,G.cellIds):ue?Zd$1(ae,ue,Re$1(),w):_d$1(ae,N,Re$1(),w);o(H,ae,c,{scale:l$1,pageOffsetX:et?.pageOffsetX,...G?{}:{className:ue?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function vi(){if(!yt){S$1.replaceChildren();return}let c=i;if(!c){S$1.replaceChildren();return}vb(S$1,ae,c.remoteSelections(),{scale:l$1,pageOffsetX:et?.pageOffsetX,...Nt?{pages:Nt}:{},colorForAuthor:Lf,declaredColorFor:Qw,labelHost:hn,measurer:w});}function xi(c){let m=Ae(a.part());if(c)return m.find(O=>O.id===c)??null;let h=Uo?m.find(O=>O.id===Uo):void 0;if(h)return h;let I=N.head.paragraphId;return m.find(O=>O.beginParagraphId===I||O.endParagraphId===I||O.resultParagraphIds.includes(I))??(m.length===1?m[0]:null)}function vl(){return Sy(a.part(),N)}function eI(c){return wy(a.part(),c)}function _f(){return new Set(Ae(a.part()).flatMap(c=>[c.beginParagraphId,...c.resultParagraphIds,c.endParagraphId]))}function xl(c){return new Set([c.beginParagraphId,c.endParagraphId,...c.resultParagraphIds])}function tI(c){let m=0;for(let h of ae.pages)for(let I of B(h))c.has(I.paragraphId)&&(m+=I.lines.length);return m}function Sl(c,m){let h=new Set(m),I=new Map;for(let O of c.pages)for(let K of B(O)){if(!h.has(K.paragraphId)||I.has(K.paragraphId))continue;let z=O.pageFieldSource;I.set(K.paragraphId,gc$1(z?.pageNumber??O.index+1,z?.format));}return I}function wl(c){if(Ze==="view"||!a.editable)return false;let m=xi(c);return !m||!Ce(a.part(),a.documentOutline(),m.instruction)?false:qi(a.part(),{op:"rewriteTocPageNumbers",tocId:m.id,updates:[]})===null}function Bf(c,m){if(!Number.isInteger(c)||!Number.isInteger(m)||c<1||m<1)return null;let h=fi.sectionPropertiesAt(N.head.paragraphId),I=h.pageSize.widthTwips-h.margins.leftTwips-h.margins.rightTwips-h.margins.gutterTwips,O=Math.max(300,Math.floor(I/m));return {op:"insertTable",beforeParagraphId:N.head.paragraphId,rows:c,cols:m,columnWidthTwips:O}}function $f(c,m){if(Ze==="view"||!a.editable)return false;let h=Bf(c,m),I=a.partFor(we())??a.part();return h!==null&&qi(I,h)===null}function nI(c,m){if(!$f(c,m))return false;let h=Bf(c,m);if(!h)return false;let I=null,O=a.subscribe(z=>{z.caret&&(I=z.caret);}),K=false;try{Ne(()=>{let z=je$1([h],Ve());return z.committed||(J=z.reason??"the table could not be inserted here"),K=z.committed,z},()=>{let z=I;return z?He({paragraphId:z.paragraphId,offset:z.start}):null});}finally{O();}return K}let qf='TOC \\o "1-3" \\h';function Zf(){let c=ye(qf);if(!c)return null;let m=a.documentOutline(),h=gf(a.part(),m,c,Sl(De.layout(),m.map(I=>I.blockId)),_f(),i?.identity.actorId);return {op:"insertToc",beforeParagraphId:N.head.paragraphId,instruction:qf,alias:Lo?.title??"TOC",entries:h.entries,bookmarksToCreate:h.bookmarksToCreate}}function Kf(){if(Ze==="view"||!a.editable||vl())return false;let c=Zf();return c!==null&&qi(a.part(),c)===null}function rI(){if(!Kf())return false;let c=Zf();if(!c)return false;let m=new Set(Ae(a.part()).map(O=>O.id)),h=Xo([c],void 0,void 0,bi);if(!h.committed)return J=h.reason??"the table of contents could not be inserted",false;let I=Ae(a.part()).find(O=>!m.has(O.id));return I?Vf(I.id,"pageNumbers"):true}function Vf(c,m="entire"){let h=xi(c);if(!h||!wl(h.id))return false;let I=De.layout(),O=a.documentOutline(),K=Ce(a.part(),O,h.instruction);if(!K)return false;let z=K.map(te=>te.blockId);if(m==="entire"){let te=gf(a.part(),O,h.instruction,Sl(I,z),xl(h),i?.identity.actorId),pe=Xo([{op:"replaceTocResult",tocId:h.id,entries:te.entries,bookmarksToCreate:te.bookmarksToCreate}],void 0,void 0,bi);if(!pe.committed)return J=pe.reason??"the table of contents could not be refreshed",false;if(I=De.layout(),h=xi(h.id),!h)return true}let U="";for(let te=0;te<3;te+=1){let pe=Sl(I,z),he=_if(a.part(),h,O,xl(h)),re=h.resultParagraphIds.flatMap((Mn,Ii)=>{let ia=he[Ii],sa=ia?pe.get(ia):void 0;return sa===void 0?[]:[{paragraphId:Mn,pageNumberText:sa}]});if(re.length===0)break;let ot=re.map(Mn=>`${Mn.paragraphId}\0${Mn.pageNumberText}`).join("");if(ot===U)break;U=ot;let Tr=Xo([{op:"rewriteTocPageNumbers",tocId:h.id,updates:re}],void 0,void 0,bi);if(!Tr.committed){if(Tr.rejected)return J=Tr.reason??"the table of contents page numbers were refused",false;break}I=De.layout(),h=xi(h.id)??h;}return true}function oI(){return cb({session:a,editingMode:Ze,collaborationActive:i!==void 0,reviewerFilterActive:Ye()!==void 0,layout:De.layout(),canonicalUnfilteredLayout:Zo,styleCascade:se(),numberingIndex:nt(),displayMode:ct()})}let{selectionMark:Ve,orderedRange:or,orderedStart:Il,textOf:Ct,inlineControlBeside:zf,splitEndsTheParagraph:aI,deleteSelectionPlan:An,deleteSelectionOps:iI,replacementOffset:kl}=xv({session:a,layout:()=>ae,selection:()=>N,cellSelection:()=>G,editingMode:()=>Ze,author:()=>s,trackedDate:g$1,storyScope:we,paragraphOrder:Re$1,flushPendingInputAndLayout:Se,trackedAuthorOrNone:Rf,atParagraphEnd:(c,m)=>$e.atParagraphEnd(c,m)}),{insertPlainText:jf,copyFlavoursNow:sI,pasteRichNow:lI,armForcePlainPaste:dI}=vv({session:a,textFormFieldId:()=>rt?.fieldId()??null,layout:()=>ae,cellSelection:()=>G,editingMode:()=>Ze,storyScope:we,paragraphOrder:Re$1,actorId:()=>i?.identity.actorId,collaborationGate:(c,m)=>i?.gateOperations(c,m)??null,now:Pe,flushPendingInputAndLayout:Se,orderedRange:or,selectionMark:Ve,deleteSelectionPlan:An,consumePendingFormatOps:ie$1,withoutPendingOnRejection:oe,caretMark:nr,commit:Ne});function na(c){c&&(Ae$1=null,Se(),nn=rn(Ye()),ke.invalidateAll(a.packageRevision(),"tracked-change-filter"),ke.flush(),n$1.onChange?.(qe()));}let ra=false,De={session:a,applyGatedTreeOps:(c,m,h,I)=>Xo(c,m,h,I??we()),storyScope:we,imageDecodePort:()=>Lt,layout:()=>(Se(),ae),state:qe,currentPage:(c="caret")=>{if(Se(),c==="viewport"){let h=Tv(e$1,ae,l$1);if(h!==null)return h}let m=ge$1(ae,N.head);return m?m.pageIndex+1:1},setScale(c){if(!(c>0)||!Number.isFinite(c))return false;if(c===l$1)return true;let m={scale:l$1,defaults:y,measurer:w,producer:P,furnitureSource:nn};try{let h=Kt(e$1),I=h?{x:(h.scrollLeft-e$1.offsetLeft+h.clientWidth/2)/l$1,y:(h.scrollTop-e$1.offsetTop+h.clientHeight/2)/l$1}:null;if(l$1=c,n$1.measurer||(y=da(l$1,{context:ko(e$1.ownerDocument),...n$1.fontAlias?{fontAlias:n$1.fontAlias}:{}}),w=y.measurer),P=k(),nn=rn(Ye()),Nt=void 0,et=void 0,rr=null,ke.invalidateAll(a.packageRevision(),"zoom"),ke.flush(),h&&I){let O=Math.max(0,I.x*l$1+e$1.offsetLeft-h.clientWidth/2),K=Math.max(0,I.y*l$1+e$1.offsetTop-h.clientHeight/2),z=Number.isFinite(h.scrollWidth)?Math.max(0,h.scrollWidth-h.clientWidth):null,U=Number.isFinite(h.scrollHeight)?Math.max(0,h.scrollHeight-h.clientHeight):null;h.scrollLeft=z===null?O:Math.min(O,z),h.scrollTop=U===null?K:Math.min(K,U),yi();}return !0}catch{(({scale:l$1,defaults:y,measurer:w,producer:P,furnitureSource:nn}=m)),Nt=void 0,et=void 0,rr=null;try{ke.invalidateAll(a.packageRevision(),"zoom-rollback"),ke.flush();}catch{}return false}},enqueueType:xe,flushPendingInput:Se,type(c){let m=An(),h=m.replaceAt??m.collapseTo,I=ie$1(h.paragraphId,h.offset,c.length),O=[...m.ops,{op:"insertText",paragraphId:h.paragraphId,offset:h.offset,text:c}],K={paragraphId:h.paragraphId,start:h.offset+c.length,end:h.offset+c.length};Ne(()=>oe([...O,...I],O,Ve(),K),()=>He({paragraphId:h.paragraphId,offset:h.offset+c.length}));},proposeTextChange:(c,m,h)=>le$1(c,m,h),insertPlainText:c=>jf(c),deleteBackward(){if(rt?.selectForDeletion("backward"))return;let c=An();if(c.ops.length>0){Ne(()=>je$1(c.ops,Ve(),nr(c.collapseTo)),()=>He(c.collapseTo));return}let m=V()??void 0,h=N.head;if(h.offset===0){for(let te of S(ae,h.paragraphId)){let pe=Ct(te);if(pe.length!==0){Ne(()=>je$1([{op:"deleteText",paragraphId:te,start:pe.length-1,end:pe.length}],Ve(),nr({paragraphId:te,offset:pe.length-1})),()=>He({paragraphId:te,offset:pe.length-1}),{rearmPending:m});return}}let O=Re$1(),K=O.indexOf(h.paragraphId),z=O[K-1];if(!z)return;if(!Vw(z,h.paragraphId)){vt(He({paragraphId:z,offset:Ct(z).length}));return}let U=Ct(z).length;Ne(()=>je$1([{op:"joinParagraphs",firstId:z,secondId:h.paragraphId}],Ve(),nr({paragraphId:z,offset:U})),()=>He({paragraphId:z,offset:U}),{rearmPending:m});return}let I=zf(h,"before");if(I){Ne(()=>je$1([{op:"removeContentControl",controlId:I.controlId,keepContent:false}],Ve(),nr({paragraphId:h.paragraphId,offset:I.start})),()=>He({paragraphId:h.paragraphId,offset:I.start}),{rearmPending:m});return}Ne(()=>je$1([{op:"deleteText",paragraphId:h.paragraphId,start:h.offset-1,end:h.offset}],Ve(),nr({...h,offset:h.offset-1})),()=>He({...h,offset:h.offset-1}),{rearmPending:m});},splitParagraph(){let c=An(),m=c.replaceAt??c.collapseTo,h=new Set(a.paragraphIdsIn(we())),I=V()??{properties:Fu(Ge(a,m.paragraphId)??a.part(),m.paragraphId,m.offset,ct(),Ye()),base:[]},O=aI(m)?$e.followerStyleId(m.paragraphId):void 0;Ne(()=>je$1([...c.ops,{op:"splitParagraph",paragraphId:m.paragraphId,offset:m.offset,tailStyleId:O}],Ve()),()=>{let K=a.paragraphIdsIn(we()).find(z=>!h.has(z));return K?He({paragraphId:K,offset:0}):null},{rearmPending:I});},navigate(c,m=false){if(Se(),!m&&(c==="left"||c==="right")&&(N.anchor.paragraphId!==N.head.paragraphId||N.anchor.offset!==N.head.offset)){let K=or();Ot=null;let z=V0(ae,K,Re$1(),c,w);vt(He(z),true);return}let h=rc(ae,N.head,c,Ot,Q?.getActive()??null,tt(),w);if(!h)return;let I=_f(),O=Iy(a.part(),h.position,["left","wordLeft","lineStart","up","pageUp"].includes(c));if(O&&(h={...h,position:O}),Gt(a.part(),h.position)){if(m)return;let z=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(c)?"up":"down",U=tI(I)+4;for(let te=0;te<U;te+=1){let pe=rc(ae,h.position,z,h.desiredX,Q?.getActive()??null,tt(),w);if(!pe||pe.position.paragraphId===h.position.paragraphId&&pe.position.offset===h.position.offset)return;if(h=pe,!Gt(a.part(),h.position))break}if(Gt(a.part(),h.position))return}Ot=h.desiredX,ne?.activeNoteScope()&&h.pageIndex!==void 0&&Number.isInteger(h.pageIndex)&&ne.setActiveNotePageIndex(h.pageIndex),vt({anchor:m?N.anchor:h.position,head:h.position},true);},deleteWordBackward(){if(De.deleteSelection())return;let c=N.head,m=(rt?.wordDeletionBoundary??Wd$1)(Ct(c.paragraphId),c.offset,-1,le(ae,c.paragraphId));if(m===c.offset){De.deleteBackward();return}Ne(()=>je$1([{op:"deleteText",paragraphId:c.paragraphId,start:m,end:c.offset}],Ve()),()=>He({...c,offset:m}),{rearmPending:V()??void 0});},deleteWordForward(){if(De.deleteSelection())return;let c=N.head,m=(rt?.wordDeletionBoundary??Wd$1)(Ct(c.paragraphId),c.offset,1,le(ae,c.paragraphId));if(m===c.offset){De.deleteForward();return}Ne(()=>je$1([{op:"deleteText",paragraphId:c.paragraphId,start:c.offset,end:m}],Ve()),void 0,{rearmPending:V()??void 0});},deleteForward(){if(rt?.selectForDeletion("forward")||De.deleteSelection())return;let c=V()??void 0,m=N.head,h=Ct(m.paragraphId);if(m.offset<h.length){let K=zf(m,"after");if(K){Ne(()=>je$1([{op:"removeContentControl",controlId:K.controlId,keepContent:false}],Ve()),()=>He(m),{rearmPending:c});return}Ne(()=>je$1([{op:"deleteText",paragraphId:m.paragraphId,start:m.offset,end:m.offset+1}],Ve()),void 0,{rearmPending:c});return}let I=Re$1(),O=I[I.indexOf(m.paragraphId)+1];if(O){if(S(ae,O).includes(m.paragraphId)){if(Ct(O).length===0)return;Ne(()=>je$1([{op:"deleteText",paragraphId:O,start:0,end:1}],Ve()),()=>He(m),{rearmPending:c});return}Ne(()=>je$1([{op:"joinParagraphs",firstId:m.paragraphId,secondId:O}],Ve()),()=>He(m),{rearmPending:c});}},...fi,...ui,setSelection:c=>{Zt(c,N)||B$1({kind:"programmatic"},false),vt(c);},selectDrawing(c,m){pt();let h=As(ae,c,m);if(!h)return false;let I=He(h);return B$1({kind:"pointer",drawingNodeId:c},Zt(I,N)),vt(I),za(De)?.drawingNodeId===c},revealPage(c,m){pt();let h=ae.pages.find(I=>I.index===c);return h?oa(h.box.y,h.box.height,m):false},revealParagraph(c,m){pt();let h=ge$1(ae,{paragraphId:c,offset:0});if(!h)return false;let I=ae.pages.find(O=>O.index===h.pageIndex);return I?oa(I.contentBox.y+h.y,h.height,m):false},revealPosition(c,m){pt();let h=ge$1(ae,c);if(!h)return false;let I=ae.pages.find(O=>O.index===h.pageIndex);return I?oa(I.contentBox.y+h.y,h.height,{block:"nearest",...m}):false},setEditable(c){Sf=c,pl();},selectAll(){let c=Re$1(),m=c[0],h=c[c.length-1];!m||!h||vt({anchor:{paragraphId:m,offset:0},head:{paragraphId:h,offset:Ct(h).length}});},hyperlinks:$o,equations:Yr,contentControls:on,formatPainter:vr,canInsertTable:$f,insertTable:nI,canInsertToc:Kf,insertToc:rI,canRefreshToc:wl,canEditTextFormField:()=>rt?.canEdit()??false,editTextFormField:()=>rt?.edit()??false,refreshToc:Vf,refreshRefFieldResults:oI,save:()=>nb(De,e$1,()=>ra),isInsideToc:c=>Ae(a.part()).some(m=>m.beginParagraphId===c||m.endParagraphId===c||m.resultParagraphIds.includes(c)),retainSelection:()=>{let c=Symbol("selection-pin");return M.set(c,N),ue=N,ta(),c},releaseSelection:c=>{M.delete(c)&&(A(),ta());},retainedSelection:()=>ue,publishedLayout:()=>ae,drawingSelectionIntent:()=>_,overlayCoordinates:()=>Object.freeze({paintScale:l$1,pageOffsetX:et?.pageOffsetX??new Map}),commitReviewOps:(c,m)=>{Se();let h=N.head.paragraphId,I=Ct(h);return Ne(()=>{if(Ze==="view")return {committed:false,rejected:true,opCount:0,reason:u};if(i&&(m===void 0||!fE.has(m)))return {committed:false,rejected:true,opCount:0,reason:"experimental-collaboration-body-text-only"};if(i){let K=i.gateOperations([],we());if(K)return {committed:false,rejected:true,opCount:0,reason:K}}let O=Mb$1(i?.identity.actorId,c);return {committed:O.committed,rejected:!O.committed,opCount:0,...typeof O.reason=="string"?{reason:O.reason}:{}}},()=>{pt(),Ke.noteModelMoved();let O=Re$1();if(O.length===0)return null;let K=Kw(N,h,I);return Qa(ae,O,K)})},revisionDisplayMode:ct,replacementLanding:pi,applyAutomationOps:(c,m,h)=>{let I={committed:false,rejected:false,opCount:0},O=m??bi;return Ne(()=>{let K=Ir(false);if(K!==null)return I={committed:false,rejected:true,opCount:0,reason:K};let z=null,U=c(te=>{let pe=Ir(true,[],false);return pe===null?Mb$1(i?.identity.actorId,()=>a.ensureHyperlinkRelationship(te,O)):(z=pe,null)});return U===null?I={committed:false,rejected:true,opCount:0,reason:z??"this engine will not author that hyperlink target"}:!n$1.reviewModel&&U.some(tu)?I={committed:false,rejected:true,opCount:0,reason:"review-module-required"}:I=je$1(U,void 0,void 0,O,false,h)},()=>{pt(),Ke.noteModelMoved();let K=Re$1();return K.length===0?null:Qa(ae,K,N)}),I},editingMode:()=>Ze,setAuthor:c=>{s!==c&&(Fe(),s=c,c?.trim()&&sb(J)&&(J=null,n$1.onChange?.(qe())));},setDrawingStrings:c=>{jn!==c&&g(jn)!==g(c)&&(jn=c,Se(),kt(false));},setLocale:If.set,setTranslate:c=>{hl!==c&&(hl=c,rt?.update());},setTocLabels:c=>{Lo=c;},setEditingMode:c=>{Se();let m=Ze!==c;Ze=c,m&&c==="view"&&Q?.exitHeaderFooter(),m&&c==="view"&&vr.disarm(),hf(),pl(),nc(e$1,Ze),m&&kt(false),J=null,n$1.onChange?.(qe());},revisionAuthors:()=>Gn.get().value,setRevisionDisplayMode(c){ra||c===Gr||(Se(),Gr=c,na(true));},hiddenRevisionAuthors:()=>Fn.hiddenAuthors,setRevisionAuthorVisible(c,m){na(Fn.setVisible(c,m));},setAllRevisionAuthorsVisible(c){na(Fn.setAllVisible(Gn.get().value.keys(),c));},showAllRevisionAuthors(){na(Fn.showAll());},setTrackedChangesFilter(c,m){na(Fn.setPredicate(c,m));},collaborationSession:()=>i??null,remotePresenceColor:Lf,setShowParagraphMarks:Ho.set,setRevisionStyles:c=>{c!==mn&&(mn=c,Se(),kt(false));},setRemoteCaretLabelHost:c=>{c!==hn&&(hn=c,vi());},setReviewActivationExclusions(c){Yo=c===null?null:new Set(c),ao(),n$1.onChange?.(qe());},activeReviewKey:()=>{let c=bl();return c?Fa(c):null},activateReview:(c,m,h)=>{if(kr.clear(),Ff=h?.allowExcluded??false,Qo=m?{key:c,anchor:m.anchor,head:m.head}:{key:c,anchor:N.anchor,head:N.head},m){yl=true;try{vt(m);}finally{yl=false;}return}ao(),n$1.onChange?.(qe());},activatedReviewKey:()=>Of()===null?null:Qo?.key??null,dismissActiveReview:()=>{let c=bl();c&&(kr.add(Fa(c)),Qo=null,ao(),n$1.onChange?.(qe()));},navigation:Jr,bookmarks:()=>a.bookmarks(),selectedText(){if(G)return wa(ae,G);let{from:c,to:m}=or();return Ds(ae,c,m,Re$1())},copyFlavours:()=>sI(),pasteRich:(c,m)=>lI(c,m),armForcePlainPaste:dI,deleteSelection(){let c=An();return c.ops.length===0?false:(Ne(()=>je$1(c.ops,Ve(),nr(c.collapseTo)),()=>He(c.collapseTo)),true)},setCellSelection:Cf,layoutSession:()=>b,undo:()=>{if(Ze==="view"){J=u,n$1.onChange?.(qe());return}if(Fe(),i){i.undo()&&Si(null);return}let c=a.packageRevision(),m=a.undo();a.packageRevision()!==c&&Si(m);},redo:()=>{if(Ze==="view"){J=u,n$1.onChange?.(qe());return}if(Fe(),i){i.redo()&&Si(null);return}let c=a.packageRevision(),m=a.redo();a.packageRevision()!==c&&Si(m);},sectionAtPage:Xe,activeScope:()=>{let c=ne?.activeNoteScope();return c||Q.activeScope()},setActiveScope:c=>(Se(),c.kind==="note"?ne.enterNote(c.id):c.kind!=="body"&&c.kind!=="headerFooter"?false:(ne?.exitNote(),Q.setActiveScope(c))),insertNote:c=>(Se(),ne.insertNote(c)),deleteNote:(c,m)=>ne.deleteNote(c,m),convertNote:(c,m)=>ne.convertNote(c,m),convertAllNotes:c=>ne.convertAllNotes(c),setNoteProperties:c=>ne.setNoteProperties(c),enterNote:(c,m)=>(Se(),ne.enterNote(c,m)),exitNote:()=>(Se(),ne.exitNote()),notePropertiesState:()=>{let c=De.state().selection.head.paragraphId,m=a.packageRevision(),h=a.currentPackage(),I=a.part(),O=Ef(h),K=Pf(h,"footnote"),z=Pf(h,"endnote"),U=De.activeScope().kind==="headerFooter",te=De.headerFooterState(),pe=te?.rId??null,he=te?.sectionIndex??null,re=Ae$1;if(re&&re.packageRevision===m&&re.paragraphId===c&&re.bodyPart===I&&re.settingsPart===O&&re.footnotesPart===K&&re.endnotesPart===z&&re.headerFooterOpen===U&&re.headerFooterRId===pe&&re.headerFooterSectionIndex===he)return re.result;let ot=Vx(De,Ye());return Ae$1={packageRevision:m,paragraphId:c,bodyPart:I,settingsPart:O,footnotesPart:K,endnotesPart:z,headerFooterOpen:U,headerFooterRId:pe,headerFooterSectionIndex:he,result:ot},ot},notePreviewText:c=>zx(a,c),applyTableCommandPlan(c){if(!c.ok)return {ok:false,code:c.code,reason:c.reason};let m=null,h=a.subscribe(I=>{I.caret&&(m=I.caret);});try{let I=Ve(),O=c.selection.kind==="adoptCommittedCaret";Ne(()=>je$1(c.ops,I),O?()=>{let K=m;return K?He({paragraphId:K.paragraphId,offset:K.start}):null}:void 0,c.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{h();}return J?{ok:false,code:"invalidArgs",reason:J}:{ok:true,changed:true}},enterHeaderFooter:c=>{Se();let m=Q.enterHeaderFooter(c);if(!m)return m;let h=Q.getActive(),I=h?ae.pages[h.pageIndex]:void 0;if(h&&I){let O=h.kind==="header"?I.header:I.footer,K=O?.box.y??(h.kind==="header"?I.box.y:I.box.y+I.box.height-1),z=O?.box.height??1;oa(K,z,{block:"nearest"});}return m},exitHeaderFooter:()=>(Se(),Q.exitHeaderFooter()),headerFooterState:()=>Q.headerFooterStateStable(a.packageRevision()),...Hx({applyOps:je$1,commit:Ne,deleteSelectionOps:iI,deleteSelectionPlan:()=>An(),orderedStart:Il,selectionMark:Ve,collapsedAt:He,isHeaderFooterOpen:()=>Q?.getActive()!==null,lastRejection:()=>J}),...Bx({session:a,applyOps:je$1,commit:Ne,storyScope:we,selectionMark:Ve,editingMode:()=>Ze,author:()=>s,trackedDate:g$1,decodePort:()=>Lt,actorId:()=>i?.identity.actorId}),focus:()=>{F.activeElement!==R&&(R.focus({preventScroll:true}),Ke.mirrorToDom(true));},setTableInteractionLabel(c){d.resolve=c;},refreshTableInteractionLabels(){aa.refreshLabels();},destroy(){if(!ra){ra=true;try{bt();}finally{F.removeEventListener("selectionchange",Wf),R.removeEventListener("pointerdown",tp,{capture:true}),R.removeEventListener("keydown",wi,{capture:true}),R.removeEventListener("beforeinput",wi,{capture:true}),R.removeEventListener("keydown",Xf),R.removeEventListener("beforeinput",ep),R.removeEventListener("copy",Yf),R.removeEventListener("cut",Qf),R.removeEventListener("paste",Jf),R.removeEventListener("compositionstart",Gf),R.removeEventListener("compositionend",Uf),F.removeEventListener("scroll",np,{capture:true}),e$1.ownerDocument.defaultView?.removeEventListener("resize",Cl),Go?.disconnect(),gl=null,fl.destroy(),rt?.destroy(),Tl?.destroy(),aa.destroy(),Jr.destroy(),xr.destroy(),Ke.destroy(),R.removeEventListener("contextmenu",bf),R.removeEventListener("click",vf),R.removeEventListener("pointermove",jo),R.removeEventListener("pointerleave",df),ke.cancel(),At!==null&&clearTimeout(At),At=null,Yn&&Yn(),Yn=null,It.dispose(),f(R),E.destroy(),mi(),ft(),Qn(),ut(),e$1.replaceChildren();}}}};function Si(c){W=null;let m=rt?.restoreAfterHistory();if(!c&&m&&(N=m),Ke.noteModelMoved(),pt(),!c){vt(Qa(ae,Re$1(),N));return}let h={anchor:{paragraphId:c.paragraphId,offset:c.start},head:{paragraphId:c.paragraphId,offset:c.end}};vt(Re$1().includes(c.paragraphId)?h:Qa(ae,Re$1(),h));}function oa(c,m,h){let I=Kt(e$1);if(!I||I.clientHeight===0)return false;let O=c*l$1+e$1.offsetTop,K=m*l$1,z=h?.offsetPx??24,U=h?.block??"start",te=I.clientHeight;if(U==="nearest"||U==="centerIfNeeded"){let re=O<I.scrollTop,ot=O+K>I.scrollTop+te;if(!re&&!ot)return true}let pe=U==="center"||U==="centerIfNeeded"?O-Math.max(0,(te-K)/2):U==="nearest"&&O>I.scrollTop?O+K+z-te:O-z,he=Math.max(0,I.scrollHeight-te);return I.scrollTo({top:Math.max(0,Math.min(pe,he)),behavior:h?.behavior??"auto"}),yi(),true}let{onSelectionChange:Wf,onCompositionEnd:Uf}=Ke,Gf=(...c)=>{Ke.adoptBeforeInput(),bt(),Ke.onCompositionStart(...c);},Tl=null;rt=J0({onRequest:n$1.onRequestTextFormField,onInvalidRequest:n$1.onRequestInvalidTextFormField,locale:If.get,translate:(c,m)=>hl?.(c,m)??c,pagesLayer:R,container:e$1,part:c=>Ge(a,c??N.head.paragraphId)??a.part(),parts:()=>a.storyParts(),protected:(c=N.head.paragraphId)=>Mh$1(a.settingsRoot())&&Nh$1(Ge(a,c)??a.part(),c),selection:()=>N,select:c=>vt(c),editable:()=>Ze==="edit"&&!Wn,apply:c=>rb(c,Ne,je$1),save:(c,m)=>ob(c,m,{session:a,commit:Ne,refusal:()=>Ir(true,c,false),gate:(h,I)=>i?.gateOperations(h,I)??null,collaborationActive:i!==void 0})},r.initialTextFormInput),Jy(De,rt.fieldId);let cI=Vb(De,{...n$1,onToggleFieldCodes:()=>{Se(),Wn=!Wn,nn=rn(Ye()),ke.invalidateAll(a.packageRevision(),"field-code-view"),ke.flush();}}),Xf=c=>{c.defaultPrevented||Ke.adoptBeforeInput(),rt?.keydown(c)||cI(c);},{onCopy:Yf,onCut:Qf,onPaste:Jf}=zb(De),uI=jb(De,{isComposing:()=>Ke.isComposing(),insertPlainText:jf,onBrowserSelectionFixup:()=>{Ke.mirrorToDom(),Ke.noteBrowserSelectionFixup();}}),ep=c=>{Ke.adoptBeforeInput(),uI(c);};F.addEventListener("selectionchange",Wf);let fI=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),tp=c=>{if(c instanceof PointerEvent&&c.button!==0)return;let h=(c.target instanceof Element?c.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");B$1(h?{kind:"pointer",drawingNodeId:h}:{kind:"none"},true);},wi=c=>{if(c instanceof KeyboardEvent&&fI.has(c.key))return;if((c instanceof KeyboardEvent&&(c.key==="Delete"||c.key==="Backspace")&&!c.altKey&&!c.ctrlKey&&!c.metaKey||c instanceof InputEvent&&(c.inputType==="deleteContentBackward"||c.inputType==="deleteContentForward"))&&_.kind==="pointer"){let h=za(De);if(h!==null){c.preventDefault(),c.stopImmediatePropagation(),B$1({kind:"none"},true),De.deleteImage(h.drawingNodeId);return}}B$1({kind:"none"},true);};R.addEventListener("pointerdown",tp,{capture:true}),R.addEventListener("keydown",wi,{capture:true}),R.addEventListener("beforeinput",wi,{capture:true}),R.addEventListener("keydown",Xf),R.addEventListener("beforeinput",ep),R.addEventListener("copy",Yf),R.addEventListener("cut",Qf),R.addEventListener("paste",Jf),R.addEventListener("compositionstart",Gf),R.addEventListener("compositionend",Uf);let Pl=false;function Rl(){if(Pl)return;Pl=true;let c=e$1.ownerDocument.defaultView?.requestAnimationFrame,m=()=>{Pl=false,yi();};c?c(m):queueMicrotask(m);}let np=c=>{let m=Kt(e$1);!m||c.target!==m||Rl();};F.addEventListener("scroll",np,{capture:true,passive:true});let Cl=()=>{Rl();},El=e$1.ownerDocument.defaultView;El?.addEventListener("resize",Cl,{passive:true}),Go=typeof El?.ResizeObserver=="function"?new El.ResizeObserver(Cl):null;function rp(){if(!Go)return;let c=Kt(e$1);c!==gl&&(Go.disconnect(),gl=c,c&&Go.observe(c));}rp(),Tl=ax({onTextFormDoubleClick:c=>rt?.doubleClick(c)??false,onTextFormPointerUp:c=>rt?.pointerUp(c),pagesLayer:R,container:e$1,scale:()=>l$1,pageOffsetX:c=>et?.pageOffsetX.get(c)??0,layout:()=>(pt(),ae),measurer:()=>w,selection:()=>N,setSelection:c=>vt(c),cellSelection:()=>G,setCellSelection:c=>Cf(c),focus:()=>R.focus({preventScroll:true}),onSelectionSettled:()=>vr.applyIfArmed(),activeHeaderFooter:()=>py(Q?.getActive()??null),activeNote:()=>{let c=ne?.activeNoteScope();return c?{scopeId:c.id,pageIndex:ne?.activeNotePageIndex()??null}:null},enterHeaderFooter:c=>{Se(),Q?.enterHeaderFooter({rId:c.rId,pageIndex:c.pageIndex,sectionIndex:Xe(c.pageIndex).sectionIndex,kind:c.kind,...c.position?{position:c.position}:{}});},enterNote:(c,m,h)=>{Se(),ne?.enterNote(c,m,h);},exitNote:c=>{Se(),ne?.exitNote(c);},exitHeaderFooter:()=>(Se(),Q?.exitHeaderFooter()),enterEmptyHeaderFooter:(c,m)=>{if(Ze==="view")return;Se();let{sectionIndex:h,sectionStart:I}=Xe(m),O=a.headerFooterResolutionBySection(),K=O[Math.min(h,Math.max(0,O.length-1))],z=ae.pages[m]?.pageFieldSource?.pageNumber??m+1,U=K?.evenAndOddHeaders&&z%2===0?"even":K?.titlePage&&m===I?"first":"default",te=he=>{let re=he[Math.min(h,Math.max(0,he.length-1))];return c==="header"?re?.headers:re?.footers},pe=te(O)?.get(U)?.rId;if(!pe){if(!De.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:h,kind:c,variant:U,...U==="first"?{titlePage:true}:{},...U==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;pe=te(a.headerFooterResolutionBySection())?.get(U)?.rId,pt();}pe&&Q?.enterHeaderFooter({rId:pe,pageIndex:m,sectionIndex:h,kind:c,variant:U});},onContentControlWidget:(c,m)=>_w(c,m),isReadOnlyPosition:c=>Gt(a.part(),c)!==void 0},n$1.pointer?{mode:n$1.pointer}:{});let aa=Hv({pagesLayer:R,furnitureLayer:T,scale:()=>l$1,pageOffsetX:c=>et?.pageOffsetX.get(c)??0,read:()=>({layout:ae,storeRevision:a.packageRevision(),selection:N,cellSelection:G,editingMode:Ze,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:c=>De.applyTableCommandPlan(c),label:c=>d.resolve(c)});if(kt(),yt=true,vi(),i&&(ft=i.subscribeStatus(()=>{n$1.onChange?.(qe());})),i&&Vt)try{Qn=i.attach(Vt);}catch{try{i.destroy();}catch{}}return oo(),pl(),De.setTableInteractionLabel=c=>{d.resolve=c,aa.refreshLabels();},De.refreshTableInteractionLabels=()=>{aa.refreshLabels();},_0(De,()=>({measurer:n$1.measurer,producer:n$1.producer,fontAlias:n$1.fontAlias,defaultFontFamily:n$1.defaultFontFamily}),c=>{n$1={...n$1,...c},w=n$1.measurer??y.measurer,P=k();},()=>{ra||(nn=rn(Ye()),Nt=void 0,et=void 0,rr=null,ke.invalidateAll(a.packageRevision(),"fonts"),ke.flush());}),{ok:true,surface:De}}function Gx(e,t,n,r,o){let a=new Map,i=oa$1(e,{resolveFont:l=>{let d$1=l.fontFamily??t.defaultFont.family;if(d$1.trim().length===0)return null;let u={family:d$1,weight:l.bold?700:400,style:l.italic?"italic":"normal"},p=g$2(u);if(a.has(p))return a.get(p)??null;let f;try{f=e.fonts.resolve(u);}catch{return a.set(p,null),null}let g=f instanceof d?null:f;return a.set(p,g),g},fallback:n.measurer}),s=`shaped:${e.operation.extensionFingerprint}+algorithm:${e.operation.shapingHash}+producer:${e.operation.producerVersion}+fallback:${n.producer}@scale:${r}+fonts:${o}`;return {measurer:i,producer:s}}function Xx(e,t){let n,r=false,o=()=>{r=false;let i=e();if(!i)return;let s=n?.generation!==i.generation;s&&(n={generation:i.generation,requested:new Set,running:false});let l=n;if(l.running||!s&&!i.dynamic)return;let d=i.dynamic?i.families().filter(u=>!l.requested.has(u.toLowerCase())):[];if(!(!s&&d.length===0)){for(let u of d)l.requested.add(u.toLowerCase());l.running=true,t(d).finally(()=>{l.running=false,n===l&&a();});}},a=(i=false)=>{if(i){o();return}r||(r=true,queueMicrotask(o));};return {schedule:a}}function Vu(){let e=[];return {request(t){let n=[...e].reverse().find(a=>!a.fallback)??e.at(-1);if(!n?.handlers.onRequest)return false;let{sessions:r,handlers:o}=n;return r.add(t),t.signal.addEventListener("abort",()=>r.delete(t),{once:true}),o.onRequest(t),true},register(t,n){let r={handlers:t,fallback:n?.fallback===true,sessions:new Set};return e.push(r),()=>{let o=e.indexOf(r);if(!(o<0)){e.splice(o,1);for(let a of r.sessions)a.cancel();}}}}}var pE=()=>Vu();function Yx(){let e=pE(),t=Vu(),n=Vu();return {surfaceOptions:{onRequestTextFormField:e.request,onRequestContentControlWidget:t.request,onRequestInvalidTextFormField:n.request},setters:{setTextFormFieldChrome:e.register,setContentControlWidgetChrome:t.register,setInvalidTextFormFieldChrome:n.register}}}function Qx(e){let t=()=>e.placements().filter(l=>l.kind==="revision"&&(l.activatable||l.revisionKind==="format")),n=()=>e.surface()?.session.reviewItems().filter(l=>l.kind==="revision")??[],r=l=>{let d=n(),u=new Set(l.keys??(l.scope==="document"?d:e.visible()).filter(x=>x.kind==="revision").map(Fa)),p=new Map;for(let x of d){let b=e.scope(x),k=Ge(e.surface().session,Ea(x)[0]);if(!k)continue;let P=p.get(k.name);P||(P={scope:b,part:k,keys:[]},p.set(k.name,P));let F=Fa(x);u.delete(F)&&P.keys.push(F);}let f=[],g=[...u].map(x=>({key:x,reason:"unknown-revision"})),y=[],w=0;for(let{scope:x,part:b,keys:k}of p.values()){let P=Za$1(b,l.action,k);f.push(...P.result.resolved),g.push(...P.result.skipped),w+=P.result.remaining,P.ops.length&&y.push({scope:x,ops:P.ops});}return {groups:y,result:{resolved:f,skipped:g,remaining:w}}},o=()=>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:fn},a=l=>{if(l.type!=="navigateReviewChange"&&l.type!=="resolveAllReviewChanges"&&l.type!=="setReviewDisplayMode")return null;let d=o();if(!d.ok)return d;if(l.type==="setReviewDisplayMode")return ["all-markup","proposed","original"].includes(l.mode)?{ok:true}:{ok:false,code:"invalidArgs",reason:"unknown review display mode"};if(l.type==="navigateReviewChange"&&!["next","previous"].includes(l.direction))return {ok:false,code:"invalidArgs",reason:"unknown review navigation direction"};if(l.type==="resolveAllReviewChanges"&&!["accept","reject"].includes(l.action))return {ok:false,code:"invalidArgs",reason:"unknown review resolution action"};if(l.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 u=Tn(l,e.surface());if(u)return u;if(l.scope!==void 0&&!["visible","document"].includes(l.scope)||l.unsupported!==void 0&&!["skip","fail"].includes(l.unsupported)||l.keys!==void 0&&(!Array.isArray(l.keys)||l.keys.some(f=>typeof f!="string")))return {ok:false,code:"invalidArgs",reason:"invalid bulk revision selection"};let{result:p}=r(l);return l.unsupported==="fail"&&p.skipped.length?{ok:false,code:"unsupported",reason:"some selected changes cannot be resolved"}:p.resolved.length?{ok:true}:{ok:false,code:p.skipped.length?"unsupported":"notFound",reason:"no eligible selected changes to review"}};return {can:a,exec:l=>{if(!["navigateReviewChange","resolveAllReviewChanges","setReviewDisplayMode"].includes(l.type))return null;e.surface()?.flushPendingInput();let d=a(l);if(!d)return null;if(!d.ok){if(l.type==="resolveAllReviewChanges"&&(d.code==="notFound"||d.code==="unsupported")&&o().ok&&!e.viewing()){let{result:y}=r(l);return {...d,revisions:{...y,resolved:[],remaining:y.remaining+y.resolved.length}}}return d}let u=e.surface();if(l.type==="setReviewDisplayMode")return e.setDisplayMode(l.mode),{ok:true,changed:false};if(l.type==="navigateReviewChange"){let y=t(),w=y.findIndex(P=>P.isActive),x=l.direction==="next"?1:-1,b=w<0?mE(y,u,x):(w+x+y.length)%y.length,k=y[b];return e.activate(k.key,!k.activatable&&k.revisionKind==="format")}if(l.type!=="resolveAllReviewChanges")return null;let{groups:p,result:f}=r(l),g;return u.commitReviewOps(()=>(g=u.session.applyTreeOpsAtomic(p),g),"revision-resolve"),g?.committed?(e.activate(null),{ok:true,changed:true,revisions:{...f,remaining:n().length}}):{ok:false,code:"unsupported",reason:typeof g?.reason=="string"?g.reason:"the revisions were refused"}},resolveReviewItem:(l,d)=>{let u=o();if(!u.ok)return u;if(e.viewing())return e.surface().commitReviewOps(()=>({committed:false,reason:"the document is open for viewing"}),"revision-resolve"),{ok:false,code:"locked",reason:"the document is open for viewing"};let p=Tn({type:"resolveAllReviewChanges"},e.surface());if(p)return p;e.surface().flushPendingInput();let f=e.placements().find(y=>y.key===l)?.item;if(!f||f.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(f.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let g;return e.surface().commitReviewOps(()=>(g=e.surface().session.applyTreeOps(gE(f,d,e.surface().session.partFor(e.scope(f))),void 0,void 0,e.scope(f)),g),"revision-resolve"),g?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof g?.reason=="string"?g.reason:"the revision was refused"}}}}function mE(e,t,n){let r=t.state().selection.head,o=t.session.storyParts().find(s=>r.paragraphId.startsWith(`${s.name}#`)),a=o?Ih$1(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],d=l.kind==="revision"?l.item.ranges[0]?.start:void 0,u=d?a.get(d.paragraphId):void 0;if(d&&u!==void 0&&(n>0?u>i||u===i&&d.offset>=r.offset:u<i||u===i&&d.offset<=r.offset))return s}return n>0?0:e.length-1}function gE(e,t,n){let r=t==="accept"?"acceptRevision":"rejectRevision";if(!n)return [];let o=new Set(Ea(e)),a=new Map;for(let i of vh$1(n)){if(!o.has(i.node.id))continue;let s=f=>i.node.attributes.find(g=>g.namespaceUri===da$1&&g.localName===f)?.value,l=e.addresses.find(f=>f.id===s("id")&&f.author===s("author")&&(f.date??"")===(s("date")??""));if(!l)continue;let d=e.revisionKind==="structural"?void 0:i.node.localName,u=JSON.stringify([l,d]),p=a.get(u);p?p.siteNodeIds.push(i.node.id):a.set(u,{revision:l,localName:d,siteNodeIds:[i.node.id]});}return [...a.values()].map(({revision:i,localName:s,siteNodeIds:l})=>({op:r,revision:i,...s===void 0?{}:{localName:s},siteNodeIds:l}))}function zu(e){return e.kind==="comment"?e.comment.date:e.kind==="revision"?e.date:void 0}function ju(e,t,n,r){return e.type!=="toggleReviewPane"&&e.type!=="toggleParagraphMarks"&&e.type!=="setEditingMode"?null:t?{ok:false,code:"notFound",reason:"the editor was destroyed"}:e.type==="toggleReviewPane"&&!n?{ok:false,code:"unsupported",reason:fn}:e.type==="setEditingMode"?r(e.mode)??{ok:true}:{ok:true}}function Jx(e){let t=false;return {get:()=>t,toggle:()=>{t=!t,e(t);}}}function eS(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 "setAlignment":return t.alignment===(e.align==="justify"?"both":e.align);case "toggleList":return n(e.kind);default:return false}}function hE(e){return e==="password"?{ok:false,code:"locked",reason:tS}: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 tS="this document is protected with a password; open it in Word to change that";function nS(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 d=l.session.settingsRoot();return (d!==o||a===null)&&(o=d,a=d?wf(d):vf),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:tS}:!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 d=r();d!==t&&(t=d,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 d=s();if(d&&!d.ok)return d;let u=e.surface(),p=!i().enforced,f=u.applyHeaderFooterLifecycle?.({op:"setDocumentProtection",enforce:p});return f?f.ok?(e.publish(),{ok:true,changed:true}):hE(f.reason):{ok:false,code:"unsupported",reason:"document protection is not available"}}}}var yE=e=>B(e);function oS(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=ja$2(t,yE);for(let o of t.pages){for(let a of [o.header,o.footer])a&&rS(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let i of a.notes)rS(r,i.fragments,o.index,i.box.y);}return e.set(t,r),r}}function rS(e,t,n,r){for(let o of C(t))for(let a of T(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}function el(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}))?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"the header or footer could not be opened"}}function bE(e){return e?.kind==="headerFooter"||e?.kind==="note"}function aS(e,t){return t!=="viewing"&&typeof e.enterHeaderFooter=="function"&&typeof e.enterNote=="function"?"all":"body"}function tl(e,t){e.activeScope().kind!=="body"&&e.session.paragraphIds().includes(t)&&(e.exitNote?.(),e.exitHeaderFooter?.());}function iS(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(!As(e.layout(),r,o))return a;let i=t.scope.owner;if(i){let s=el(e,i,{paragraphId:o,offset:0});if(!s.ok)return s}else tl(e,o);return e.revealParagraph(o),e.selectDrawing(r,o)?{ok:true,changed:false}:a}let n={paragraphId:t.blockId,offset:t.start};if(bE(t.scope)){let r=el(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"};tl(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 sS(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function Wu(e,t){if(e===""&&(t===null||t===""))return;let n=globalThis.navigator?.clipboard;if(!n)return;let r=globalThis.ClipboardItem;if(t&&n.write&&r&&typeof Blob<"u")try{let o=new r({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})});n.write([o]).catch(()=>{sS(e);});return}catch{}sS(e);}function vE(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function xE(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function lS(e){return dS(e.children)}function dS(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||zc$1(n))&&t.push(n);return t}function SE(e){if(zc$1(e))return dS(Cc$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(...lS(r));return t}function wE(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"?zd$1(a):xd(a).find(g=>r.part==="header"||r.part==="footer"?g.kind===r.part:g.kind==="note"&&hd(g.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=lS(s),d;for(let g=0;g<t.path.length;g+=1){let y=t.path[g];if(!Number.isInteger(y)||y<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(d=l[y],!d)return {ok:false,code:"notFound",reason:`block index ${y} is out of range`};g<t.path.length-1&&(l=SE(d));}if(!d||d.kind!=="paragraph"||!Ga$1(a,d.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let u=(ki(a,d.id)??"").length,p=t.offset??(n==="start"?0:u);if(!Number.isInteger(p)||p<0||p>u)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let f={paragraphId:d.id,offset:p};return {ok:true,selection:{anchor:f,head:f}}}function nl(e,t,n){if(vE(t))return wE(e,t,n);if(!Pt(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=St(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=un(i,r,t);if(!s.ok)return s;let l=n==="start"?s.span.start:s.span.end,d={paragraphId:s.span.nodeId,offset:l};return {ok:true,selection:{anchor:d,head:d}}}function rl(e,t){if(!xE(t)){let o=nl(e,t,"start");if(!o.ok)return o;let a=nl(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=nl(e,t.from,"start");if(!n.ok)return n;let r=nl(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function IE(e){return e.evenPage?"even":e.firstPage?"first":"default"}function cS(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'"}:IE(e)}function Uu(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?cS(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 kE(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 ii(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}:kE(n.reason)}function ol(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 uS(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=cS(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,s=ol(e,n,r,a)?.rId,l=false;if(!s){let u=ii(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:a,...a==="first"?{titlePage:true}:{},...a==="even"?{evenAndOddHeaders:true}:{}});if(!u.ok)return u;l=true,s=ol(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 fS(e,t){let n=Uu(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=ii(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 pS(e,t){let n=Uu(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=ii(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=ol(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function mS(e,t){let n=Uu(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=ii(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let s=ol(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 gS(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return ii(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 hS(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 yS(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 bS(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 vS(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 xS(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 SS(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 IS(e,t,n){switch(t.type){case "toggleMark":{let r=Ic.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=kc(t);if(!r.ok)return {ok:false,code:r.code,reason:r.reason};e.setRunProperty(r.localName,r.attributes);break}case "clearFormatting":e.clearFormatting();break;case "copyFormatting":return e.formatPainter.capture()?{ok:true,changed:false}:{ok:false,code:"notFound",reason:hs};case "pasteFormatting":{let r=e.formatPainter.apply();if(r==="nothingToPaint")return {ok:false,code:"notFound",reason:lc};if(r==="refused")return {ok:false,code:"locked",reason:e.state().lastRejection??lc};break}case "setLineSpacing":e.setParagraphProperty("spacing",Xs({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...Oo("before",t.beforePt),...Oo("after",t.afterPt)},{mergeAttributes:true});break;case "setAlignment":e.setParagraphProperty("jc",{val:t.align==="justify"?"both":t.align});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.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,d=a??s.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(l,d):Math.min(l,d),a=t.orientation==="landscape"?Math.min(l,d):Math.max(l,d);}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 "insertText":if(e.type(t.text),e.state().lastRejection==="the table of contents is generated and read-only"||e.state().lastRejection===Rs)return {ok:false,code:"invalidArgs",reason:e.state().lastRejection};break;case "deleteText":e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let a=rl(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 "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 "editHeaderFooter":return uS(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return fS(e,t);case "linkHeaderFooterToPrevious":return pS(e,t);case "unlinkHeaderFooterFromPrevious":return mS(e,t);case "setHeaderFooterOptions":return gS(e,t);case "insertPageField":return hS(e,t);case "insertNote":return yS(e,t);case "deleteNote":return bS(e,t);case "convertNote":return vS(e,t);case "convertAllNotes":return xS(e,t);case "setNoteProperties":return SS(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(!pr(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Kn({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"});return e.applyTableCommandPlan(r)}case "selectAll":return e.selectAll(),{ok:true,changed:false};case "copy":{let r=e.copyFlavours();return Wu(r.text,r.html),{ok:true,changed:false}}case "cut":{let r=e.copyFlavours();Wu(r.text,r.html),e.deleteSelection();break}case "paste":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&&Tc(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&Pt(t.anchor)?{anchor:t.anchor}:"range"in t&&$r(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=Zy(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=RE(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return ja(t)?p0(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function wS(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 C(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function TE(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 C(a.fragments))if(i.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function PE(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 RE(e,t){let n=St(e.session,t.head.paragraphId,{kind:"body"}),r=St(e.session,t.anchor.paragraphId,{kind:"body"});if(!PE(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=TE(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=wS(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:wS(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 kS={selection:null,pendingFormat:null,headerFooter:null,drawingIntent:"none",formatPainter:"off/none"};function TS(e,t){let n=t.headerFooterState?.();return {selection:e.selection,pendingFormat:e.pendingFormat,headerFooter:n?.editing&&n.rId?`${n.editing}:${n.rId}`:null,drawingIntent:r0(t.drawingSelectionIntent()),formatPainter:`${e.formatPainter.mode}/${e.formatPainter.level}`}}function PS(){let e={...kS};return {moved(t,n){let r=TS(t,n),o=ws(r.selection,e.selection)&&r.pendingFormat===e.pendingFormat&&r.headerFooter===e.headerFooter&&r.drawingIntent===e.drawingIntent&&r.formatPainter===e.formatPainter;return e=r,!o},adopt(t){e=TS(t.state(),t);},reset(){e={...kS};}}}function CE(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 d=n-22;d>=o;d-=1)if(r.getUint32(d,true)===101010256){a=d;break}if(a<0)return false;let i=r.getUint16(a+10,true),s=r.getUint32(a+16,true),l=0;for(let d=0;d<i;d+=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}function RS(e){let t=null,n=()=>{if(!t)return null;let{bytes:r}=t;return t.cancel(),t=null,r};return {shouldYield:r=>typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"&&(r.byteLength>=524288||CE(r,524288)),schedule(r){let o=null,a=null,i=()=>{t=null,e.mount(r);},s=requestAnimationFrame(()=>{a!==null&&clearTimeout(a),a=null,o=setTimeout(i,0);});a=setTimeout(()=>{cancelAnimationFrame(s),i();},250),t={bytes:r,cancel:()=>{cancelAnimationFrame(s),o!==null&&clearTimeout(o),a!==null&&clearTimeout(a);}},e.scheduled();},cancel:n,flush(){let r=n();r&&e.mount(r);},isScheduled:()=>t!==null}}function CS(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function ES(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function FS(e){return e.kind==="comment"}function OS(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 d=e.openStoryOrder();i=d.get(r.paragraphId)??-1,s=d.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 EE(e){let t=new Map;for(let n of e){let r=n.item;if(!FS(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 FE(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(FS);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 AS(e,t,n){if(!e.reviewEnabled)return {ok:false,code:"unsupported",reason:e.proReviewReason};if(e.editingMode==="viewing")return {ok:false,code:"locked",reason:"the document is open for viewing"};let r=e.placements(),o=FE(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=EE(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,d=false;return e.surface.commitReviewOps(()=>{let u=e.surface.session.packageRevision();return l=e.surface.session.setCommentResolved(i.id,n),d=l&&e.surface.session.packageRevision()!==u,{committed:d}},"comment-resolve"),l?(d&&e.bump(),{ok:true,changed:d}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function MS(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 LS=new WeakMap;function LE(e){return !(!e.story||e.origin===b$2.mutationUndo||e.origin===b$2.mutationRedo||e.impact!=="text-local"||e.created.length>0||e.deleted.length>0||e.splitJoin.length>0||e.dependencyKeys.some(t=>t!==g$1.story))}function NE(e,t){LE(t)||(e.summaries=null);}function DE(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>NE(t,n)));}function DS(e){}function HS(e,t){let n=LS.get(e);return n||(n={summaries:null,subscribed:false},LS.set(e,n)),DE(e,n),n.summaries||(n.summaries=t()),n.summaries}var HE=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function _E(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function BE(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(Pt(t)){let o=un(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(_E(t)){if(!Pt(t.from)||!Pt(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=un(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=un(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 Gu(e,t){let n=HE.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=Zr(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=BE(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 $E="http://schemas.microsoft.com/office/word/2010/wordml",qE="http://schemas.microsoft.com/office/word/2012/wordml";function Wr(e){return Dd$1(e)}function si(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function ZE(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===da$1)return t.value}}function Xu(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return ZE(n)}}function KE(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=VE(t);if(n!==void 0)return n}return "richText"}function VE(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(t==="contentControlText"||n==="text")return "plainText";if(n==="richText")return "richText";if(n==="checkbox"&&(r===$E||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===qE)return "repeatingSection"}function al(e){let t=Xu(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function zE(e,t){if(al(si(t)))return true;let n=Ha$1(e,t.id);for(;n;){if(Wr(n)&&al(si(n)))return true;n=Ha$1(e,n.id);}return false}function Qu(e,t){let n=si(e),r=Xu(n,"tag"),o=Xu(n,"alias"),a=t?zE(t,e):al(n);return {id:e.id,controlType:KE(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var _S=new WeakMap;function jE(e,t){let n=[],r=Ha$1(e,t.id);for(;r;)Wr(r)&&n.push(`${r.id}:${al(si(r))?1:0}`),r=Ha$1(e,r.id);return n.join("|")}function $S(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function WE(e){return Object.freeze(e.map(t=>$S(t)))}function UE(e,t){let n=e.node,r=si(n),o=jE(t,n),a=_S.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let i=$S(Qu(n,t));return _S.set(n,{properties:r,lockAncestors:o,summary:i}),i}function GE(e){let t=Kc$2(e.root);return DS(t.length),t.map(n=>UE(n,e))}function XE(e){return WE(e.storyParts().flatMap(t=>GE(t)))}function YE(e){return HS(e,()=>XE(e))}function Yu(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 QE(e){let t=[];if(e.kind!=="paragraph")return t;let n=(r,o,a,i)=>{if(i>=la$1)return o;let s=o;for(let l of r)if(l.kind!=="paragraphProperties"){if(l.kind==="run"){s+=Se(e,l);continue}if(na$1(l)){s=n(l.children,s,a,i+1);continue}if(Wr(l)){let d=s,u=a+1;s=n(Cc$1(l),s,u,i+1),t.push({control:l,start:d,end:s,depth:u});continue}s+=Se(e,l);}return s};return n(e.children,0,-1,0),t}function Ju(e,t,n){return QE(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>Qu(r.control,n))}function ef(e,t){let n=[],r=Ha$1(e,t);for(;r;)Wr(r)&&n.push(Qu(r,e)),r=Ha$1(e,r.id);return n.reverse()}function qS(e,t){if(!e)return [];let n=YE(e.session);return t?n.filter(r=>Yu(r,t)):n}function tf(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=Ge(e.session,n)??e.session.part(),a=Ga$1(o,n);if(a&&a.kind==="paragraph"){for(let s of Ju(a,r,o))if(Yu(s,t))return s}let i=ef(o,n);for(let s=i.length-1;s>=0;s-=1){let l=i[s];if(Yu(l,t))return l}return null}function nf(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function JE(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function e1(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function t1(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 il(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||Wr(n))&&t.push(n);return t}function n1(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...il(r.children));return t}function r1(e){return e.kind==="table"?n1(e):Wr(e)?il(Cc$1(e)):e.kind==="body"?il(e.children):[]}function o1(e,t,n){if(Wr(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of Ju(t,r,e))return {ok:true,controlId:i.id};let a=ef(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 a1(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=t1(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=il(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=r1(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=o1(e,o,t.offset);return a.ok?a:{...a,target:t}}function i1(e,t,n){let r=un(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=Ga$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 d of Ju(a,i,o))return {ok:true,controlId:d.id};let l=ef(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 ZS(e,t){if(t===void 0){let r=tf(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(e1(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return JE(t)?a1(n,t):Pt(t)?i1(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function KS(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 VS(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 zS(e,t){return {ok:false,code:KS(e),reason:VS(e),...t!==void 0?{target:t}:{}}}function s1(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 rf(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function of(e,t,n,r){let o=s1(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let s=Gu(t,e);return s.ok?BS(t,s.op,s.span.paragraphId):{ok:false,code:s.code,reason:s.reason}}let a=ZS(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 BS(t,i,a.controlId)}function BS(e,t,n){let r=Ge(e.session,n)??e.session.part(),o=Ef(e.session.currentPackage()),a=Kh$1(o,t)??Sh$1(r,o,t)??qi(r,t);return a?{ok:false,code:KS(a),reason:VS(a)}:{ok:true}}function jS(e,t,n,r){t?.flushPendingInput();let o=of(e,t,n,r);return o.ok?l1(t,e):o}function WS(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 l1(e,t){if(t.type==="insertContentControl")return d1(e,t);let n=ZS(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=Zr(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},a=WS(e,[o],r,r,St(e.session,n.controlId,{kind:"body"}));return a.rejected?zS(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function d1(e,t){e.flushPendingInput();let n=Gu(e,t);if(!n.ok){let d=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...d!==void 0?{target:d}:{}}}let{paragraphId:r,start:o,end:a}=n.span,i=Zr(e.state().selection),s={paragraphId:r,start:o,end:a},l=WS(e,[n.op],i,s,St(e.session,r,{kind:"body"}));return l.rejected?zS(l.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:l.committed})}var c1=Object.freeze(["Arial","Calibri","Cambria","Consolas","Courier New","Garamond","Georgia","Helvetica","Open Sans","Roboto","Times New Roman","Verdana"]),u1=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function US(e,t){let n=new Map,r=s=>{if(s===void 0||!u1.test(s))return;let l=s.toLowerCase();n.has(l)||n.set(l,s);};r(f$1(e));let o=e?.substitutions??[],a=new Set(o.map(s=>s.to.family.toLowerCase()));for(let s of o)r(s.from.family);for(let s of e?.sources??[])a.has(s.request.family.toLowerCase())||r(s.request.family);for(let s of a$8([e?.supportedFamilies]))r(s);for(let s of c1)r(s);for(let s of t)r(s);let i=[...n.values()];return i.sort((s,l)=>s<l?-1:s>l?1:0),i}var GS=e=>new a("overLimit",`font source ${e.id} exceeds the font byte budget`,{request:e.request}),XS=e=>new a(e.reason,e.reason==="overLimit"?`embedded font ${e.request.family} (${e.partName}) exceeds the font byte budget`:`embedded font part ${e.partName} declares an invalid family name`,{request:e.request});function YS(e,t){return m(e,t)}function af(e,t,n){return n$1(e,t,n)}var f1="The quick brown fox 0123 \u2014 {}#@",p1=["monospace","serif"],m1=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function JS(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(f1).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!m1.test(r))return t.set(r,true),true;let a=false;for(let i of p1){let s=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==s){a=true;break}}return t.set(r,a),a}}var QS=4;function ew(e,t,n){let r=new Set,o=[];for(let u of t){let p=u.toLowerCase();r.has(p)||(r.add(p),o.push(u));}let a=u=>new Set(e.slice(0,Math.max(u,0)).map(p=>p.toLowerCase())),i=0;for(let u=0;u<=QS;u+=1){let p=a(n-i),f=o.filter(y=>!p.has(y.toLowerCase())).length,g=Math.min(f,QS,Math.floor(n/2));if(g===i)break;i=g;}let s=e.slice(0,Math.max(n-i,0)),l=a(n-i),d=o.filter(u=>!l.has(u.toLowerCase()));return [...s,...d].slice(0,n)}function tw(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=aa.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}function nw(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 rw=new WeakMap,g1=0,h1=p((e,t)=>{if(e.kind==="paragraphProperties"){let n=rw.get(e);return n||(n=String(++g1),rw.set(e,n)),{families:[n],children:[]}}return {families:e.kind==="paragraph"&&!e.children.some(n=>n.kind==="paragraphProperties")?["default-paragraph"]:[],children:q(e,t)}});function ow(e){return h1(e,{key:""})}var aw=new WeakMap;function iw(e){let t=e.packageRevision(),n=aw.get(e);if(n?.revision===t)return n.families;let r$1=n?.eastAsianFonts??r(),o=e.storyParts().map(f=>f.root),a=e.stylesRoot(),i=e.numberingRoot(),s=e.documentThemeFonts(),l=ow(o),u=n&&n.stylesRoot===a&&n.numberingRoot===i&&n.theme===s&&n.numberingInputs.length===l.length&&n.numberingInputs.every((f,g)=>f===l[g])?n.numberingFamilies:v(o,i,a,s),p=[...e.symbolFontFamilies(),...r$1(o,a,s),...t$1(o),...u];return aw.set(e,{eastAsianFonts:r$1,revision:t,families:p,numberingInputs:l,numberingFamilies:u,numberingRoot:i,stylesRoot:a,theme:s}),p}var sw=Object.freeze({installed:0,alias:()=>{},dispose(){}});function y1(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 sl=e=>e.trim().toLowerCase();function b1(){let t=(typeof document<"u"?document:void 0)?.fonts;return !t||typeof FontFace>"u"?{}:{fontSet:t,createFontFace:(n,r,o)=>new FontFace(n,r.slice().buffer,o)}}async function lw(e,t=b1(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return sw;let a=new Map;for(let d of e){let u=sl(d.request.family),p=a.get(u);p?p.push(d):a.set(u,[d]);}let i=new Map,s=[];if(await Promise.all([...a].map(async([d,u])=>{let p=y1(u.map(g=>g.hash)),f=false;await Promise.all(u.map(async g=>{try{let y=o(p,g.bytes,{weight:String(g.request.weight),style:g.request.style});await y.load(),r.add(y),s.push(y),f=!0;}catch{}})),f&&i.set(d,p);})),s.length===0)return sw;for(let d of n){let u=sl(d.from.family);if(i.has(u))continue;let p=i.get(sl(d.to.family));p!==void 0&&i.set(u,p);}let l=false;return {installed:s.length,alias:d=>l?void 0:i.get(sl(d)),dispose(){if(!l){l=true;for(let d of s)try{r.delete(d);}catch{}}}}}var li=.1,di=5;var Ao={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},v1={type:"fit",fit:"pageWidth"},ll={type:"fixed"};function dl(e){return e==="auto"?Ao:!e||typeof e!="object"?null:e.type==="fixed"?ll:e.type==="fit"&&e.fit==="pageWidth"?cl(e,Ao)?Ao:e:null}function cl(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 Mo(e){return e.type==="fit"}function cw({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)?dw(r):.1,l=Number.isFinite(o)?dw(o):5,d=Math.floor(i/t*100)/100;return Math.min(Math.max(d,s),Math.max(l,s))}function dw(e){return Math.min(Math.max(e,.1),5)}function x1(e){let t=Kt(e);if(!t)return null;let n=t.clientWidth;if(!Number.isFinite(n)||n<=0)return null;let r=t.ownerDocument.defaultView?.getComputedStyle(t);if(!r)return n;let o=Number.parseFloat(r.paddingLeft)||0,a=Number.parseFloat(r.paddingRight)||0;return Math.max(n-o-a,0)}function uw(e){let t=null,n=null,r=null,o=null;function a(){if(r===null)return;n?.ownerDocument.defaultView?.cancelAnimationFrame(r),r=null;}function i(){let l=e.mode();if(!Mo(l))return;let d=e.container();if(!d)return;let u=x1(d);if(u===null)return;let p=e.pageWidthPx();if(p===null)return;o=e.pageWidthTwips();let f=cw({availableWidthPx:u,pageWidthPx:p,...l.minZoom!==void 0?{minZoom:l.minZoom}:{},...l.maxZoom!==void 0?{maxZoom:l.maxZoom}:{}});f===null||f===e.zoom()||e.applyZoom(f);}function s(){let l=n?.ownerDocument.defaultView;if(!l?.requestAnimationFrame){i();return}r===null&&(r=l.requestAnimationFrame(()=>{r=null,i();}));}return {refitIfPageResized(){let l=e.pageWidthTwips();l===null||l===o||i();},attach(){this.detach();let l=e.container();if(!l)return;let d=Kt(l);d&&(n=d,typeof ResizeObserver<"u"&&(t=new ResizeObserver(s),t.observe(d)),i());},refit:i,detach(){a(),t?.disconnect(),t=null,n=null,o=null;}}}function pw(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=dl(e.zoomMode??(n!==null?ll:"auto"))??Ao;function a(l,d){if(l===r)return d?.(),true;let u=t.surface();return u&&!Ux(u,l*(96/72))?false:(r=l,d?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=ll,s.detach();}let s=uw({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);}});return {zoom:()=>r,mode:()=>o,scale:()=>r*(96/72),attach:()=>{Mo(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 d=Mo(o);return l===r?d?(i(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(l,d?i:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${l}`}},setZoomMode(l){let d=dl(l);return d?cl(d,o)?{ok:true,changed:false}:(o=d,Mo(d)?s.attach():s.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(l)}`}}}}function fw(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function mw(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:fw(r.box),contentBox:fw(r.contentBox)})):[]}}}var gw=new Map;function hw(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=c(o,t);return n={slots:o,colors:t,value:a},a},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:b$1(t)}),r.value.get(o))}}function sf(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 yw(e){let t=bh$1(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$1,a==="en"?void 0:locales[a]),a);return {locale:t,labels:{title:i("toolbar.tableOfContents")}}}function bw(e){let t=e.mode,n=e.translate,r=n?i$2(n):h,o=yw(e.locale);return {mode:()=>t,modeForGate:()=>t??"edit",openingModeDecision:a=>Ec(t,a),setMode(a){return t===a?false:(t=a,true)},translate:()=>n,drawingStrings:()=>r,setTranslate(a){if(n===a)return null;n=a;let i=a?i$2(a):h;return g(r)===g(i)?(r=i,null):(r=i,r)},locale:()=>o.locale,tocLabels:()=>o.labels,setLocale(a){let i=yw(a);return o.locale===i.locale?null:(o=i,o.labels)}}}function vw(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 k1=Object.freeze({kind:"body"}),T1=Object.freeze([]);function P1(e$1){let t$1=bw(e$1),n=nu(e$1.author),r=e$1.container??null,o=a$3(e$1.modules),a$2=CS(o),i=o.review!==null,s=null,l=new WeakMap,d$1=RS({mount:v=>jn(v),scheduled:()=>{se(),$e();}}),u=t$1.mode()==="view"?"viewing":"editing",p=null,f=false,g=Ms(),y=hw(e$1.revisionStyles),w=e(),x=false,b=false,k=null,P=()=>({reviewEnabled:i,hasAuthor:!!n}),F=false,R=null,H$1=Gy({stillMissing:()=>!B&&n===void 0&&Ot(null)===mr,emit:v=>Be(v)}),L=t$1.openingModeDecision(P());L.mode!==null&&(u=L.mode),L.rejection!==null&&(k=L.rejection),H$1.report(L.rejection);let S=null,T$1=null,E=null,D=null,$=PS(),X=Yx(),N=sf({}),_=sf({}),B=false,G,J,ve=null,ce=()=>{},Te=0;function ue(){ve?.dispose(),ve=null;}let M=0,A,q=()=>typeof e$1.fonts=="function"?A:e$1.fonts,Z=Xx(()=>{if(B||!S)return null;let{session:v}=S,[Y]=a$8([[ct().formatting?.fontFamily]]);return {generation:M,dynamic:typeof e$1.fonts=="function",families:()=>ew([...new Set([...Y&&Y!==f$1(q())?[Y]:[],...v.documentFonts()])],iw(v),c$1)}},async v=>{S&&await ul(M,S,v);}),W=false,C$1=null,V$1=v=>(C$1||(C$1=JS(r?ko(r.ownerDocument):null)),C$1(v)),j=new Set,oe=v=>j.has(v.toLowerCase())||ve?.alias(v)!==void 0,ie=()=>!S||W?T1:tw(S.session.renderedFontFamilies(),oe,V$1),Q=0,ne=null,Ae,we=null,tt=-1,Xe=0,Re=-1,Pe=false,We="all-markup",ht=Jx(v=>{S?.setShowParagraphMarks(v),se(),$e();}),Oe=nS({surface:()=>S,destroyed:()=>B,editingMode:()=>u,hostViewOnly:()=>t$1.mode()==="view",publish:()=>{se(),$e();},decision:()=>Jr(),tracking:Qr,adopt:v=>{k=v.rejection??Ot(null),v.mode!==null&&(b=v.mode==="viewing",xr(v.mode)),se(),$e();}});function se(){Q+=1;}let nt={change:new Set,selectionChange:new Set,error:new Set};function Be(v){for(let Y of [...nt.error])Y(v);}function tn(v){for(let Y of [...nt.change])Y(v);}function $e(){if(nt.selectionChange.size===0)return;let v=ct();for(let Y of [...nt.selectionChange])Y(v);}function br(){D?.(),D=null,S?.destroy(),S=null,$.reset(),Xe+=1;}let Lt=pw(e$1,{container:()=>r,surface:()=>S,bump:se,emitSelectionChange:$e}),It=()=>Lt.scale();function jn(v,Y,ee){if(ee??=l.get(v),l.delete(v),!r){s=v,ee&&l.set(v,ee),E=null,se();return}br();let ye=g.stateKey,fe=Ku(r,v,{scale:It(),showParagraphMarks:ht.get(),onToggleParagraphMarks:ht.toggle,defaultFontFamily:f$1(q()),translate:t$1.translate(),drawingStrings:t$1.drawingStrings(),locale:t$1.locale(),...n?{author:n}:{},...y.current()!==void 0?{revisionStyles:y.current()}:{},reviewAuthorSlots:w,revisionAuthorVisibility:g,initialSelection:Y,initialTextFormInput:ee,editingMode:u==="suggesting"?"suggest":u==="viewing"?"view":"edit",revisionDisplayMode:i?We:"proposed",...o.review?{reviewModel:{...o.review,collectReviewItems:Ie=>o.review.collectReviewItems(o.customNodes.length>0?{...Ie,customNodes:o.customNodes,...o.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:a$2}:{}}:Ie)}}:{},...G?{measurer:G,...J?{producer:J}:{}}:{},...ve?{fontAlias:ve.alias}:{},...e$1.tableInteractionLabel?{tableInteractionLabel:e$1.tableInteractionLabel}:{},...e$1.imageDecodePort?{imageDecodePort:e$1.imageDecodePort}:{},...o.collaboration?{collaborationModel:o.collaboration}:{},onHyperlinkPopover:Ie=>N.current().onPopover?.(Ie),...X.surfaceOptions,onRequestHyperlink:()=>N.current().onRequest?.(),onEquationPopover:Ie=>_.current().onPopover?.(Ie),onTrackedChange:()=>{Pe||(Pe=true,se(),$e());},tocLabels:t$1.tocLabels(),onChange:Ie=>{if(!S)return;se(),Oe.sync(),Z.schedule();let Fe=i&&We!==S.revisionDisplayMode();Fe&&(We=S.revisionDisplayMode());let xe=ye!==g.stateKey||Fe;ye=g.stateKey,!(!xe&&!$.moved(Ie,S))&&$e();}});if(!fe.ok){E=fe.detail?`${fe.reason}: ${fe.detail}`:fe.reason,se(),Be(qt(fe.reason,`failed to open document: ${E}`));return}E=null,S=fe.surface,Oe.prime(),Pe=i&&S.session.reviewItems().length>0,$.adopt(S),R!==null?Zo(R,false):qo(),ES(S,o),Xe+=1,S.setEditable(u!=="viewing"),T$1!==null&&S.setRemoteCaretLabelHost(T$1),p!==null&&S.setReviewActivationExclusions(p),D=fe.surface.session.subscribe(Ie=>{let Fe={revision:fe.surface.session.packageRevision(),created:Ie.created,deleted:Ie.deleted,dirty:Ie.dirty};Lt.refitIfPageResized(),se(),tn(Fe);}),Lt.attach(),se(),tn({revision:S.session.packageRevision()}),$e(),Z.schedule(true);}function Lo(v){if(d$1.cancel(),l=new WeakMap,Pe=false,M+=1,w=e(),g.showAll(),G=void 0,J=void 0,A=void 0,j=new Set,ue(),ce(),ce=()=>{},W=false,r){let Y=Kt(r);Y&&(Y.scrollTop=0,Y.scrollLeft=0);}r&&d$1.shouldYield(v)?d$1.schedule(v):jn(v);}function En(v){(v.code==="wasmUnavailable"||v.cause instanceof t&&v.cause.code==="unsupportedRuntime")&&!e$1.onFontError&&nt.error.size===0&&Mg(v);try{e$1.onFontError?.(v);}catch{}Be(v);}async function ul(v,Y,ee){let ye=e$1.fonts,fe=Y.session.embeddedFonts();if(!(!ye&&fe.length===0)){W=true,se();try{let Ie={families:ee,defaultFamily:f$1(q())},Fe=typeof ye!="function"?ye:A?await k$2([A,i$1(Se=>ye(Se))],Ie,{onOriginFailure:({cause:Se})=>En(mo(Se))}):await ye(Ie),xe=typeof ye=="function"?b$3(Fe):Fe;if(B||v!==M){v===M&&(W=!1);return}if(A=Fe,fe.length===0&&(!xe||Fe?.supportedFamilies?.length&&!b$3(Fe))){W=!1,se(),$e();return}let le=(xe&&"maxFontBytes"in xe?xe.maxFontBytes:void 0)??a$1,ke=YS(xe?.sources??[],le),Me=ke.sources;for(let Se of ke.dropped)En(GS(Se));let ut=af(fe,Me,le),Vt=!1,Qn=()=>{if(!Vt){Vt=!0;for(let Se of ut.dropped)En(XS(Se));}},ft=e$2({epoch:v,...xe,sources:Me},ut);if(ft.sources.length===0){Qn(),W=!1,se(),xe&&En(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let yt=await La(ft),hn=()=>!B&&v===M?!1:(H(yt),v===M&&(W=!1),!0);if(hn())return;let Ko=Se=>{Qn(),Se&&H(Se),W=!1,se();},mi=(Se,bt)=>{let yn=new Set;for(let Jn of bt.sources??[]){let er=Se.fonts.resolve(Jn.request);er instanceof d&&(En(mo(er)),yn.add(g$2(Jn.request)));}return yn},to=mi(yt,ft);try{if(to.size>0){let Se=Me.filter(tr=>!to.has(g$2(tr.request))),bt=Se.length!==Me.length;bt&&(ut=af(fe,Se,le));let yn=ut.sources.filter(tr=>bt||!to.has(g$2(tr.request))),Jn=yt;if(ft=e$2({epoch:v,...xe,sources:Se},{sources:yn}),ft.sources.length===0)return Ko(Jn);if(yt=await La(ft),H(Jn),hn())return;let er=mi(yt,ft);if(er.size>0){let tr=Se.filter(ro=>!er.has(g$2(ro.request))),zo=ut.sources.filter(ro=>!er.has(g$2(ro.request))),jo=yt;if(ft=e$2({epoch:v,...xe,sources:tr},{sources:zo}),ft.sources.length===0)return Ko(jo);if(yt=await La(ft),H(jo),hn())return}}}finally{Qn();}let pt=ft.sources.map(Se=>{let bt=yt.fonts.resolve(Se.request);return bt instanceof d||bt.id!==Se.id?null:{request:Se.request,id:bt.id,bytes:bt.bytes,hash:bt.hash,faceIndex:bt.faceIndex}}).filter(Se=>Se!==null),no=await lw(pt,void 0,ft.substitutions??[]);if(B||v!==M){no.dispose(),hn();return}let Vo={embeddedFaces:ve,coveredFontFamilies:j,shapedMeasurer:G,shapedProducer:J,disposeShapedFonts:ce};try{ve=no,j=nw(pt,ft.substitutions??[]);let Se=da(It(),{context:r?ko(r.ownerDocument):null,...ve?{fontAlias:ve.alias}:{}}),bt=Gx(yt,ft,Se,It(),++Te);if(G=bt.measurer,J=bt.producer,W=!1,S&&B0(S,{measurer:G,producer:J,fontAlias:ve?.alias,defaultFontFamily:f$1(q())}),B||v!==M){no.dispose(),H(yt);return}}catch(Se){throw !B&&v===M&&({embeddedFaces:ve,coveredFontFamilies:j,shapedMeasurer:G,shapedProducer:J,disposeShapedFonts:ce}=Vo),no.dispose(),H(yt),Se}ce=()=>H(yt),Vo.disposeShapedFonts(),Vo.embeddedFaces?.dispose(),se(),$e();}catch(Ie){if(B||v!==M)return;W=false,se(),En(mo(Ie));}}}let ci=Sc();function Wn(){let v=S?.state()??null;return {scope:S?.activeScope?.()??k1,isLoading:E===null&&S===null&&s===null&&!d$1.isScheduled(),isOpening:d$1.isScheduled(),parseError:E,editable:S!==null&&S.session.editable&&t$1.mode()!=="view"&&u!=="viewing",zoom:Lt.zoom(),zoomMode:Lt.mode(),selection:Vc(S),selectionCollapsed:v===null||v.selection.anchor.paragraphId===v.selection.head.paragraphId&&v.selection.anchor.offset===v.selection.head.offset,formatting:m0(S),table:Wc(S),tocContext:ci(v?.contextTocId??null),image:Pn(S),page:{current:jc(S),total:zc(S)},canUndo:v?.canUndo??false,canRedo:v?.canRedo??false,pageSetup:Kc(S),reviewPaneOpen:Pe,showParagraphMarks:ht.get(),documentProtection:Oe.state(),reviewDisplayMode:S&&i?S.revisionDisplayMode():We,hasReviewContent:S?.session.hasReviewContent()??false,hiddenReviewAuthors:g.hiddenAuthorList,collaborationStatus:v?.collaborationStatus??"inactive",editingMode:u,lastRejection:k??v?.lastRejection??null,fontSubstitutions:ie(),formatPainter:v?.formatPainter??ys}}let Gr;function ct(){if(ne&&Re===Q)return ne;let v=ne,Y=q()===Gr;Gr=q();let ee=n===Ae;Ae=n;let ye=S?.state().selection??null,fe=ws(ye,we);we=ye;let Ie=S?.session.packageRevision()??-1,Fe=Ie===tt;tt=Ie;let xe=Wn(),le=xe;if(v){let ke=yc(xe.formatting,v.formatting)?v.formatting:xe.formatting,Me=bc(xe.page,v.page)?v.page:xe.page,ut=vc(xe.pageSetup??null,v.pageSetup??null)?v.pageSetup:xe.pageSetup,Vt=xc(xe.selection,v.selection)?v.selection:xe.selection,Qn=s0(xe.image,v.image)?v.image:xe.image,ft=v.fontSubstitutions!==void 0&&xe.fontSubstitutions!==void 0&&v.fontSubstitutions.length===xe.fontSubstitutions.length&&xe.fontSubstitutions.every((yt,hn)=>v.fontSubstitutions[hn]===yt)?v.fontSubstitutions:xe.fontSubstitutions;le={...xe,formatting:ke,page:Me,pageSetup:ut,selection:Vt,image:Qn,fontSubstitutions:ft},wc(le,v)&&fe&&Fe&&ee&&Y&&(le=v);}return ne=Ss(le),Re=Q,ne}if(e$1.document){let v=Pc(e$1.document);v?Lo(v):(E=Rc(e$1.document),Be(qt("unsupported",E)));}let Fn=fb({surface:()=>S,activeKey:Yr,paneOpen:()=>Pe,selectionAnchor:()=>$o()?.anchorY??null,authorFilterKey:()=>g.stateKey});function Ye(v){return v.kind==="revision"?v.ranges[0]??null:v.range}function No(v){return Ye(v)===null?false:!(v.kind==="revision"&&p!==null&&p.includes(v.revisionKind))}let nn=oS(),Do=new WeakMap;function Xr(v){let Y=Do.get(v);if(Y)return Y;let ee=new Map;for(let ye of v.pages)for(let fe of [ye.footnotes,ye.endnotes])if(fe)for(let Ie of fe.notes)for(let Fe of C(Ie.fragments))for(let xe of T(Fe))ee.has(xe)||ee.set(xe,Ie.scopeId);return Do.set(v,ee),ee}function rn(v){let Y=Ye(v)?.partName;if(!Y||!S||Y===S.session.part().name)return null;for(let ee of S.session.headerFooterResolutionBySection())for(let ye of ["header","footer"]){let fe=ye==="header"?ee.headers:ee.footers;for(let Ie of fe.values())if(Ie.partName===Y)return {kind:ye,rId:Ie.rId}}return null}function Un(v){let Y=Ye(v),ee=S?.publishedLayout();return !Y||!ee?null:Xr(ee).get(Y.start.paragraphId)??null}function ae(v){let Y=Ye(v)?.partName;if(!Y||!S)return null;for(let ee of ["footnote","endnote"])if(Pf(S.session.currentPackage(),ee)?.name===Y)return {kind:"notesPart",noteKind:ee};return null}function mn(v){let Y=rn(v);return Y!==null?{kind:"headerFooter",rId:Y.rId}:ae(v)??{kind:"body"}}let Ho=()=>`${new Date().toISOString().slice(0,19)}Z`,_o=new WeakMap;function Gn(v){let Y=_o.get(v);if(Y)return Y;let ee=new Map;for(let[ye,fe]of V(v).entries())ee.set(fe,ye);return _o.set(v,ee),ee}function Bo(){return OS({surface:S,bodyOrder:()=>{let v=S?.publishedLayout();return v?Gn(v):new Map},openStoryOrder:fi})}function ui(){let v=S?.activeScope();if(v?.kind==="headerFooter")return {kind:"headerFooter",rId:v.rId};if(v?.kind==="note"){let Y=_c$2(v.id);if(Y)return {kind:"notesPart",noteKind:Y.noteKind}}return {kind:"body"}}function vr(v){if(!S)return {kind:"body"};let Y=v.slice(0,v.indexOf("#"));if(Y.length===0||Y===S.session.part().name)return {kind:"body"};for(let ee of S.session.headerFooterResolutionBySection())for(let ye of [ee.headers,ee.footers])for(let fe of ye.values())if(fe.partName===Y)return {kind:"headerFooter",rId:fe.rId};for(let ee of ["footnote","endnote"])if(Pf(S.session.currentPackage(),ee)?.name===Y)return {kind:"notesPart",noteKind:ee};return ui()}function fi(){if(!S)return new Map;let v=ui();if(v.kind==="body")return new Map;let Y=new Map;for(let[ee,ye]of S.session.paragraphIdsIn(v).entries())Y.set(ye,ee);return Y}function pi(v){if(v.kind==="revision"){let ee=v.ranges;if(ee.length===0)return null;let fe=v.revisionKind==="replace"||v.revisionKind==="insert"||v.revisionKind==="delete"?ee[ee.length-1]:ee[0];return {start:ee[0].start,end:fe.end}}let Y=Ye(v);return Y?{start:Y.start,end:Y.end}:null}function $o(){if(S&&S.activatedReviewKey()!==null)return null;let v=Bo(),Y=S?.publishedLayout();if(!v||!Y)return null;let ee=nn(Y).get(v.from.paragraphId);return ee?{pageIndex:ee.pageIndex,anchorY:ee.contentY+ia(ee,v.from.paragraphId,v.from.offset)}:null}function Yr(){return S?.activeReviewKey()??null}function Xn(v){if(!i)return [];let Y=ou(S?.session.reviewItems()??[],g),ee=v?.excludeRevisionKinds;if(ee&&ee.length>0){let le=new Set(ee);Y=Y.filter(Me=>Me.kind!=="revision"||!le.has(Me.revisionKind));let ke=new Set(Y.filter(Me=>Me.kind==="revision").map(Me=>Me.id));Y=Y.map(Me=>{if(Me.kind!=="comment"||Me.parentRevisionId===void 0||ke.has(Me.parentRevisionId))return Me;let{parentRevisionId:ut,...Vt}=Me;return Vt});}let ye=v?.placement!==false,fe=null;if(ye&&Y.length>0){let le=S?.publishedLayout()??null;le&&(fe=nn(le));}let Ie=Yr(),Fe=le=>{let ke=rn(le);return ke===null?1:ke.kind==="header"?0:2},xe=Y.map((le,ke)=>({item:le,position:ke,pageIndex:fe?ka$1(le,fe)?.pageIndex??null:null,group:Fe(le)}));return xe.sort((le,ke)=>{let Me=le.pageIndex??Number.MAX_SAFE_INTEGER,ut=ke.pageIndex??Number.MAX_SAFE_INTEGER;return Me!==ut?Me-ut:le.group!==ke.group?le.group-ke.group:le.position-ke.position}),xe.map(({item:le})=>{let ke=Fa(le),Me=fe?ka$1(le,fe):null,ut={key:ke,id:le.id,...zu(le)!==void 0?{date:zu(le)}:{},activatable:No(le),anchorY:Me?.y??null,pageIndex:Me?.pageIndex??null,isActive:ke===Ie};return le.kind==="comment"?{...ut,kind:"comment",author:le.comment.author,initials:Da$1(le.comment),text:Ca(le.comment),resolved:le.resolved,...le.parentId!==void 0?{parentId:le.parentId}:{},...le.parentRevisionId!==void 0?{parentRevisionId:le.parentRevisionId}:{},replyIds:le.replyIds,readOnly:false,item:le}:le.kind==="revision"?{...ut,kind:"revision",revisionKind:le.revisionKind,author:le.author,initials:ib(le.author),text:le.text,...le.replacedText?{replacedText:le.replacedText}:{},replyIds:le.replyIds,readOnly:le.readOnly||t0(S),item:le}:{...ut,kind:"custom",author:"",initials:"",text:le.detail??le.text,replyIds:[],readOnly:true,item:le}})}function Qr(){return S?.session.trackingSettings()??yg}function Jr(v=u,Y=x){let ee=Qr();return Oc({...P(),viewOnly:t$1.mode()==="view",hostChoseMode:t$1.mode()!==void 0,readerChoseMode:Y,currentMode:v,trackRevisions:ee.trackRevisions,restrictedToTrackedChanges:ee.restrictedToTrackedChanges,restrictedToForms:ee.restrictedToForms,restrictedToReadOnly:ee.restrictedToReadOnly,restrictedToComments:ee.restrictedToComments,engineAdoptedViewing:b})}function xr(v){R=null,u=v,S?.setEditingMode(v==="suggesting"?"suggest":v==="viewing"?"view":"edit"),S?.setEditable(v!=="viewing");}function Ot(v){return v!==null?v:u==="suggesting"&&n===void 0?mr:F?mr:x?null:t$1.openingModeDecision(P()).rejection}function qo(){let v=Jr();k=Ot(v.rejection),v.mode!==null&&(b=v.mode==="viewing",xr(v.mode));}function Zo(v="editing",Y=true){if(d$1.isScheduled()){R=v;return}R=null;let ee=Yy(t$1.mode(),P(),Qr(),u,v,b);b=ee.mode==="viewing"&&t$1.mode()!=="view",ee.mode!==u&&xr(ee.mode),k=Ot(ee.rejection),H$1.report(ee.configurationRejection),Y&&(se(),$e());}function eo(v){return t$1.mode()==="view"&&v!=="viewing"?{ok:false,code:"locked",reason:"this document was opened for viewing"}:(v==="suggesting"?Fc(P()):null)??Ac(Qr(),v)}let At=Qx({surface:()=>S,enabled:()=>i,destroyed:()=>B,viewing:()=>u==="viewing",placements:()=>Xn(),visible:()=>ou(S?.session.reviewItems()??[],g),scope:mn,activate:(v,Y)=>{f=Y??false;try{return gn.setActiveReviewItem(v)}finally{f=false;}},setDisplayMode:v=>{We=v,S?.setRevisionDisplayMode(v),se(),$e();}}),{resolveReviewItem:Yn}=At,gn={get mountGeneration(){return Xe},get surface(){return S},...X.setters,setHyperlinkChrome:N.push,setEquationChrome:_.push,stateVersion:()=>Q,fontMeasurement:()=>({measurer:G?"shaped":"fixed",resolving:W,...G&&J?{producer:J}:{}}),attach(v){if(B){Be(qt("destroyed","this editor was destroyed; create a new instance to remount"));return}if(S&&r===v)return;if(S){S.flushPendingInput(),s=S.session.save();let ye=r?Qc(r):void 0;ye&&l.set(s,ye),br();}let Y=d$1.cancel();Y&&(s=Y),Lt.detach(),r=v,C$1=null;let ee=s;s=null,ee&&d$1.shouldYield(ee)?d$1.schedule(ee):ee?jn(ee):se();},detach(){if(B)return;Lt.detach();let v=d$1.cancel();if(S){S.flushPendingInput(),s=S.session.save();let Y=r?Qc(r):void 0;Y&&l.set(s,Y),br();}v&&(s=v),r=null,C$1=null,se();},load(v){let Y=Pc(v);if(!Y){Be(qt("unsupported",Rc(v)));return}Lo(Y);},save(){return d$1.flush(),tb(S,r,()=>S)},getDocumentHandle(){return Object.freeze({revision:S?.session.packageRevision()??0})},exec(v,Y){d$1.flush();let ee=ju(v,B,i,eo);if(B&&ee&&!ee.ok)return ee;if(v.type==="setEditingMode"){let Me=eo(v.mode);return Me!==null?(Me.reason===mr&&(F=true,k=Me.reason,H$1.report(Me.reason),se(),$e()),Me):(x=true,F=false,k=null,xr(v.mode),se(),$e(),{ok:true,changed:false})}if(v.type==="toggleParagraphMarks")return ht.toggle(),{ok:true,changed:false};if(v.type==="toggleReviewPane")return i?(Pe=!Pe,se(),$e(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:fn};let ye=Oe.exec(v);if(ye)return ye;let fe=At.exec(v);if(fe)return fe;if(nf(v))return jS(v,S,rf(u),Y);let Ie=Ba(v);if(u==="viewing"&&Ie.supported&&Ie.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let Fe=Xa(v,S,t$1.modeForGate(),Y);if(!Fe.ok)return Fe.refusal;let xe=S,le=xe.session.packageRevision(),ke=IS(xe,v,{...Fe.tablePlan?{admittedTablePlan:Fe.tablePlan}:{},editor:gn});return ke||{ok:true,changed:xe.session.packageRevision()!==le}},can(v,Y){if(v.type==="insertImage"||v.type==="replaceImage"){if(B)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(Y?.scope){let xe=Xa(v,S,t$1.modeForGate(),Y);if(!xe.ok)return xe.refusal}return f0(v,S)}let ee=ju(v,B,i,eo);if(ee)return ee;let ye=Oe.can(v);if(ye)return ye;let fe=At.can(v);if(fe)return fe;if(nf(v))return of(v,S,rf(u),Y);let Ie=Ba(v);if(u==="viewing"&&Ie.supported&&Ie.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let Fe=Xa(v,S,t$1.modeForGate(),Y);if(!Fe.ok)return Fe.refusal;if(v.type==="proposeInsertion"||v.type==="proposeDeletion"||v.type==="proposeReplacement"){if(!(v.author??n??"").trim())return {ok:false,code:"invalidArgs",reason:`${v.type} requires a non-empty author`};let le=v.target===void 0?{ok:true,selection:S.state().selection}:rl(S,v.target);if(!le.ok)return le;let{anchor:ke,head:Me}=le.selection,ut=ke.paragraphId===Me.paragraphId&&ke.offset===Me.offset,Vt=v.type==="proposeReplacement"&&v.target===void 0&&S.state().cellSelection!==null;if(v.type!=="proposeInsertion"&&ut&&!Vt)return {ok:false,code:"invalidArgs",reason:`${v.type} needs a non-collapsed selection`}}if(ja(v)&&_c(v)){let xe=Wa(gn);if(xe){let le=Bc(gn,v,xe);if(le)return le}}return {ok:true}},isActive(v){return v.type==="toggleParagraphMarks"?ht.get():v.type==="toggleDocumentProtection"?Oe.isActive():v.type==="setReviewDisplayMode"?We===v.mode:v.type==="toggleReviewPane"?Pe:v.type==="setEditingMode"?u===v.mode:eS(v,S?ct().formatting:null,Y=>S?.isListActive(Y)??false)},getDocumentStyles:()=>S?.session.documentStyles()??[],getDocumentFonts:()=>S?.session.documentFonts()??[],getAvailableFonts:()=>US(q(),S?.session.documentFonts()??[]),getDocumentThemeColors:()=>S?.session.documentThemeColors()??[],getOutline:()=>S?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>v0(S?ct().formatting:null),findMatches:(v,Y)=>S?.session.findText(v,{...Y?.matchCase!==void 0?{matchCase:Y.matchCase}:{},...Y?.wholeWord!==void 0?{wholeWord:Y.wholeWord}:{},stories:aS(S,u)}).matches??[],selectMatch(v){return d$1.flush(),S?iS(S,v):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>ct().image,getSelectedTable:()=>b0(S),getTableCellSelection:()=>{let v=S?.state().cellSelection;return v?{tableId:v.tableId,rows:v.rows,columns:v.columns,cellIds:v.cellIds}:null},setTableInteractionLabel(v){S?.setTableInteractionLabel(v);},canExecuteImageCommand(v,Y){if(B)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(Y?.scope){let ee=Xa(v,S,t$1.modeForGate(),Y);if(!ee.ok)return ee.refusal}return $c(v,S)},executeImageCommand(v){return B?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):qc(gn,v)},getPageSetup:()=>Kc(S),getWatermark:()=>null,getTrackedChanges:()=>(S?.session.reviewItems()??[]).filter(v=>v.kind==="revision").map(v=>{let Y=rn(v);return {id:v.id,kind:v.kind==="revision"?v.revisionKind:"revision",...v.kind==="revision"&&v.author?{author:v.author}:{},story:Y!==null?Y.kind:ae(v)?.noteKind??"body"}}),getReviewItems:v=>Xn(v),getCustomNodeDefinitions:()=>o.customNodes,reportCustomNodeDiagnostic:a$2,addComment(v,Y){if(!i)return {ok:false,code:"unsupported",reason:fn};S?.flushPendingInput();let ee=Bo();if(!ee||!S)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let ye=(Y??n??"").trim();if(ye.length===0||v.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let fe=null;return S.commitReviewOps(()=>(fe=S.session.replyToComment(null,{paragraphId:ee.from.paragraphId,start:ee.from.offset,end:ee.to.offset,...ee.to.paragraphId===ee.from.paragraphId?{}:{endParagraphId:ee.to.paragraphId}},v,ye,Ho(),vr(ee.from.paragraphId)),{committed:fe!==null}),"comment-add"),fe===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>$o(),isReviewPaneOpen:()=>Pe,getEditingMode:()=>u,getReviewAuthors:()=>y.authorsFor(S?.revisionAuthors()??gw),...pb(g,{enabled:i,surface:()=>S,notify:()=>{se(),$e();}}),setTrackedChangesFilter(v,Y){if(S)return S.setTrackedChangesFilter(v,Y);g.setPredicate(v,Y)&&(se(),$e());},getConfiguredAuthor:()=>n??null,setAuthor(v){let Y=nu(v);if(n!==Y){if(n=Y,S?.setAuthor(n),n!==void 0&&F){F=false;let ee=Xy(eo("suggesting"));if(ee.enter)x=true,xr("suggesting");else {k=ee.rejection,se(),$e();return}}else if(!x){let ee=R??u;Zo(t$1.mode()===void 0?ee:"editing");return}k=Ot(null),H$1.report(k),se(),$e();}},setMode(v){t$1.setMode(v)&&(x=false,F=false,Zo());},...vw(t$1,{surface:()=>S,bump:se,emitSelectionChange:$e}),presenceColorFor:v=>S?.remotePresenceColor(v)??"var(--doc-accent)",collaborationSession:()=>S?.collaborationSession()??null,getReviewAuthorStyle:v=>y.styleFor(v),setRemoteCaretLabelHost(v){T$1=v,S?.setRemoteCaretLabelHost(v);},setRevisionStyles(v){y.set(v),S?.setRevisionStyles(v),se(),$e();},setEditingMode:v=>gn.exec({type:"setEditingMode",mode:v}),getReviewRevision:()=>Fn(),setActiveReviewItem(v,Y){if(v===null)return S?.dismissActiveReview(),se(),$e(),{ok:true,changed:false};if(!S)return {ok:false,code:"notFound",reason:"no document is open"};S.flushPendingInput();let ye=Xn().find(xe=>xe.key===v)?.item;if(!ye)return {ok:false,code:"notFound",reason:"no review item with that key"};let fe=Ye(ye);if(!fe)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!No(ye)&&!(f&&ye.kind==="revision"&&ye.revisionKind==="format"))return {ok:false,code:"unsupported",reason:`review items of kind '${ye.revisionKind}' are excluded from activation`};let Ie=ye?rn(ye):null,Fe=Ie===null&&ye?Un(ye):null;if(Ie!==null||Fe!==null){let xe=Ie!==null?{kind:"headerFooter",rId:Ie.rId,furnitureKind:Ie.kind}:{kind:"note",id:Fe},le=el(S,xe,fe.start);if(!le.ok)return le}else {S.exitNote?.(),S.exitHeaderFooter?.();let xe=pi(ye)??fe,le={paragraphId:xe.start.paragraphId,offset:xe.start.offset};S.activateReview(v,{anchor:le,head:le},{allowExcluded:f});let ke=Y?.reveal??"centerIfNeeded";ke!==false&&S.revealPosition?.(xe.start,{block:ke});}return (Ie!==null||Fe!==null)&&S.activateReview(v,void 0,{allowExcluded:f}),se(),$e(),{ok:true,changed:false}},setReviewActivationExclusions(v){p=v===null?null:[...v],S?.setReviewActivationExclusions(p);},acceptReviewItem:v=>Yn(v,"accept"),rejectReviewItem:v=>Yn(v,"reject"),setCommentResolved(v,Y){return AS({reviewEnabled:i,editingMode:u,placements:Xn,surface:S,proReviewReason:fn,bump:se},v,Y)},deleteReviewItem(v){if(!i)return {ok:false,code:"unsupported",reason:fn};let ee=Xn().find(fe=>fe.key===v)?.item;if(!ee||!S)return {ok:false,code:"notFound",reason:"no review item with that key"};if(ee.kind==="revision")return Yn(v,"reject");if(ee.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};Yr()===v&&S.dismissActiveReview();let ye=false;return S.commitReviewOps(()=>{let fe=Un(ee),Ie=fe===null?null:_c$2(fe);return ye=S.session.deleteComment(ee.id,mn(ee),Ie?.noteId),{committed:ye}},"comment-delete"),ye?(se(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(v,Y,ee){if(!i)return {ok:false,code:"unsupported",reason:fn};S?.flushPendingInput();let fe=Xn().find(Me=>Me.key===v)?.item;if(!fe||!S)return {ok:false,code:"notFound",reason:"no review item with that key"};let Ie=Ye(fe);if(!Ie)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let Fe=(ee??n??"").trim(),xe=MS(fe,Y,Fe);if(xe)return xe;let le=fe.kind==="comment"?fe.id:null,ke=null;return S.commitReviewOps(()=>(ke=S.session.replyToComment(le,{paragraphId:Ie.start.paragraphId,start:Ie.start.offset,end:Ie.end.offset},Y,Fe,Ho(),mn(fe)),{committed:ke!==null}),"comment-reply"),ke===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>S?.headerFooterState()??null,getNotePropertiesState:()=>S?.notePropertiesState?.()??null,getNotePreviewText:v=>S?.notePreviewText?.(v)??null,setActiveScope(v){S?.setActiveScope(v)&&se();},getActiveScope:()=>S?.activeScope()??{kind:"body"},query(v){switch(v.type){case "selectedText":return S?.selectedText()??"";case "selectionFormatting":return S?ct().formatting:null;case "selection":return Vc(S);case "paragraphs":return h0(S,v.container);case "isInsideToc":return x0(S);case "hyperlinkAt":return g0(S);case "contentControls":return qS(S,v.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 tf(S,v.filter);case "tableContext":return Wc(S);default:return null}},snapshot:()=>ct(),getTotalPages:()=>zc(S),getCurrentPage:v=>jc(S,v),scrollToPage:v=>!Number.isInteger(v)||v<1?false:(d$1.flush(),S?.revealPage(v-1)??false),scrollToBlock:v=>typeof v!="string"||v.length===0?false:(d$1.flush(),S&&tl(S,v),S?.revealParagraph(v)??false),...mw(Lt,()=>S),relayout(v){v?.sync,S?.layout();},retainSelection:()=>S?.retainSelection()??null,releaseSelection:v=>S?.releaseSelection(v),focus(v){return d$1.flush(),S?v&&v.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:v&&!S.setActiveScope(v)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(S.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){B=true,H$1.dispose(),d$1.cancel(),Lt.detach(),ue(),ce(),ce=()=>{},br(),r=null,s=null,l=new WeakMap,Xe+=1,se();for(let v of Object.values(nt))v.clear();},on(v,Y){return nt[v].add(Y),()=>{nt[v].delete(Y);}}};return gn}var xw=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function R1(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 C1(e){let t=k$1({port:E1(e),capabilities:xw}),n=false;return {...t,save:()=>{try{return t.save()}catch(r){return {ok:false,error:{code:"transaction-refused",message:r instanceof Error?r.message:"Cannot save the document."}}}},dispose:()=>{n=true,t.dispose();},execute:r=>(n||e.surface?.flushPendingInput(),t.execute(r))}}function E1(e){let t=0,n=0,r=null,o=false,a=false,i=()=>{if(a)return null;let d=e.surface?.session??null;return d!==r&&(o&&(t+=n+1),o=true,r=d,n=0),d&&(n=d.packageRevision()),d},s,l=null;return {localChangeTracking:true,suggesting:()=>e.surface?.editingMode()==="suggest",async prepare(d){if(!d.operations.some(f=>f.op==="updateFieldResult"))return;s=void 0,l=null;let u=e.surface;if(!u)return;let p=u.layout();s=a$4(p),l=i()?.currentPackage()??null;},fieldPageContext(d,u,p){let f=i()?.currentPackage()??null;if(!f||f!==l)return null;let g=e$1(f).story(d);return g?b(s,g.part,u,p):null},revision(){return i(),t+n},currentPackage:()=>i()?.currentPackage()??null,revisionDisplayMode:()=>e.surface?.revisionDisplayMode()??ja$1,replacementLanding:(d,u,p)=>e.surface?.replacementLanding(d,u,p)??null,apply(d,u,p=[]){i();let f=e.surface;if(!f)return {ok:false,reason:"no-document"};let g=f.applyAutomationOps(d,u,p);return g.rejected?{ok:false,reason:String(g.reason??"refused")}:{ok:true,changed:g.committed}},applyLifecycle(d){i();let u=e.surface;if(!u)return {ok:false,reason:"no-document"};let p=u.applyAutomationOps(()=>[d]);return p.rejected?{ok:false,reason:String(p.reason??"refused")}:{ok:true,changed:p.committed}},applyCommentWrites(d,u){let p=e.surface,f=i();if(!p||!f)return {ok:false,reason:"no-document"};if(d.length===0)return {ok:true,changed:false};if(u.kind!=="body")return {ok:false,reason:"unsupported-story"};let g=e.can({type:"toggleReviewPane"});if(!g.ok)return {ok:false,reason:g.reason??"review-module-required"};let y={ok:false,reason:"refused"};return p.commitReviewOps(()=>{if(d.every(b=>b.kind==="delete")){let b=d.find(P=>P.kind==="delete"),k=f.deleteComments(d.map(P=>{if(P.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:P.commentId,...P.parentCommentId===void 0?{}:{parentCommentId:P.parentCommentId}}}),u,b?.kind==="delete"?b.noteId:void 0);return y=k?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:k}}if(d.length!==1)return y={ok:false,reason:"mixed-comment-writes"},{committed:false};let w=d[0];if(w.kind==="resolve"){let b=f.setCommentResolved(w.commentId,w.resolved);return y=b?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:b}}if(w.kind!=="create"&&w.kind!=="reply")return y={ok:false,reason:"unsupported-comment-write"},{committed:false};let x=f.replyToComment(w.kind==="reply"?w.parentCommentId:null,w.anchor,w.text,w.author,w.date);return y=x===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:x},{committed:x!==null}},R1(d)),y},applyCustomNodeWrite(d,u){let p=e.surface,f=i();if(!p||!f)return {ok:false,reason:"no-document"};if(u.kind!=="body")return {ok:false,reason:"unsupported-story"};let g={ok:false,reason:"refused"};return p.commitReviewOps(()=>{let y=f.insertCustomNode(d);return g=y.ok?{ok:true,changed:y.change!==null}:{ok:false,reason:y.detail?`${y.reason}: ${y.detail}`:y.reason},{committed:y.ok}},"package-scoped"),g},save:()=>i()?e.surface?.save()??null:null,select(d,u){if(!e.surface)return;let f=u==="end"?d.end:d.start,g=u==="start"?d.start:d.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:f.paragraphId,offset:f.offset},head:{paragraphId:g.paragraphId,offset:g.offset}}});},subscribe:d=>e.on("change",()=>d()),dispose(){a=true,r=null;}}}function F1(e){return e*(96/72)}function O1(e,t){return e*t}function A1(e,t){return e/t}function M1(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 L1(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function ww(e,t,n){return t?true:e.length===1?false:!n}var Sw=["e","se","s","sw","w","nw","n","ne"];function N1(e,t){let n=Sw.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return Sw[(n-r+8)%8]}function D1(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,d=r*s+o*i;return r=l,o=d,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function Ur(e){return e/Ga}function Iw(e){let t=D1(e.deltaXPt,e.deltaYPt,e.transform),n=Ur(e.startWidthEmu),r=Ur(e.startHeightEmu),o=n/r,a=N1(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 P=Math.max(n/Ur(e.startWidthEmu),r/Ur(e.startHeightEmu));n=Math.max(1,Ur(e.startWidthEmu)*P),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=Ur(e.startWidthEmu),d=Ur(e.startHeightEmu),u=n/l,p=r/d,f=Math.max(1,e.startBounds.width*u),g=Math.max(1,e.startBounds.height*p),y=e.startBounds.x,w=e.startBounds.y,x=e.handle;x.includes("w")&&(y=e.startBounds.x+e.startBounds.width-f),x.includes("n")&&(w=e.startBounds.y+e.startBounds.height-g);let b=null;if(e.kind==="anchored"&&e.startPosition&&(x.includes("w")||x.includes("n")))if(e.startPosition.mode==="simple"){let k=x.includes("w")?Rt(y-e.startBounds.x):0,P=x.includes("n")?Rt(w-e.startBounds.y):0;b=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+k,verticalEmu:(e.startPosition.verticalEmu??0)+P});}else if(e.anchorFrameOrigin)b=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...x.includes("w")?{horizontalEmu:Rt(y-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...x.includes("n")?{verticalEmu:Rt(w-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let k=x.includes("w")?Rt(y-e.startBounds.x):0,P=x.includes("n")?Rt(w-e.startBounds.y):0;b=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+k}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+P}:{},...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{}});}return Object.freeze({widthEmu:Rt(n),heightEmu:Rt(r),previewBounds:Object.freeze({x:y,y:w,width:f,height:g}),position:b})}function H1(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 _1(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&&Zc(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?Iw({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:ww(e.session.handle,e.aspectLocked,e.shiftKey),kind:e.session.kind}):Object.freeze({widthEmu:e.session.startWidthEmu,heightEmu:e.session.startHeightEmu,previewBounds:e.session.startBounds,position:null})}var kw=e=>Math.round(e/1440*100)/100,B1=e=>kw(e).toLocaleString(void 0,{maximumFractionDigits:2}),$1=e=>Math.round(e*1440),q1={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},Tw=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",Pw=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function Z1(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:Tw(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 Rw={contextualSpacing:false,keepNext:false,keepLines:false,widowControl:false,pageBreakBefore:false,tabStops:false,alignment:false,indentLeft:false,indentRight:false,special:false,spaceBefore:false,spaceAfter:false,lineSpacing:false};function K1(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,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 Cw(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 V1(e,t,n=Rw,r=n){let o={},a=false,i=(l,d)=>{o[l]=d,a=true;},s=l=>n[l]&&!r[l];return (e.alignment!==t.alignment||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",Pw(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),(!Cw(e.tabStops,t.tabStops)||s("tabStops")&&t.clearedAllTabStops)&&i("tabStops",t.tabStops),a?o:null}function z1(e,t){return [...e.filter(r=>r.positionTwips!==t.positionTwips),t].sort((r,o)=>r.positionTwips-o.positionTwips)}function j1(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}
20
- export{RP as $,q1 as $a,mc as A,GP as Aa,TT as B,XP as Ba,Mc as C,YP as Ca,nP as D,Vs as Da,Ka as E,Ex as Ea,Va as F,Ku as Fa,Lc as G,li as Ga,rP as H,di as Ha,Nc as I,Ao as Ia,Pn as J,v1 as Ja,Wa as K,dl as Ka,$c as L,cl as La,qc as M,P1 as Ma,yP as N,xw as Na,bP as O,C1 as Oa,Ga as P,F1 as Pa,xP as Q,O1 as Qa,Rt as R,A1 as Ra,xo as S,M1 as Sa,SP as T,L1 as Ta,Zc as U,ww as Ua,wP as V,Iw as Va,ks as W,H1 as Wa,wo as X,_1 as Xa,w0 as Y,kw as Ya,Uc as Z,B1 as Za,Ts as _,$1 as _a,mo as a,I0 as aa,Tw as ab,La as b,k0 as ba,Pw as bb,vI as c,CP as ca,Z1 as cb,kd as d,qr as da,Rw as db,eT as e,Gc as ea,K1 as eb,tT as f,AP as fa,Cw as fb,Ge as g,MP as ga,V1 as gb,sc as h,NP as ha,z1 as hb,cT as i,Ya as ia,j1 as ib,fT as j,R0 as ja,pT as k,Ps as ka,by as l,C0 as la,mT as m,E0 as ma,gT as n,BP as na,hT as o,$P as oa,yT as p,qP as pa,bT as q,ZP as qa,vT as r,KP as ra,xT as s,VP as sa,vy as t,zP as ta,ST as u,jP as ua,uc as v,Yc as va,Ey as w,WP as wa,Fy as x,A0 as xa,xs as y,UP as ya,pc as z,M0 as za};