@docx-editor.dev/core 2.9.2 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +14 -5
- package/dist/automation.d.ts +14 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +78 -13
- package/dist/binding.d.ts +78 -13
- package/dist/binding.js +1 -1
- package/dist/chunk-34BNQUD4.js +10 -0
- package/dist/chunk-5AVHO75P.cjs +19 -0
- package/dist/chunk-6HMSC7UV.js +2 -0
- package/dist/chunk-6JIJOZDW.js +1 -0
- package/dist/chunk-76Y3Y45J.cjs +2 -0
- package/dist/chunk-BP7ANXGA.js +1 -0
- package/dist/chunk-BTQKU64Q.cjs +1 -0
- package/dist/chunk-CRZR6K5Z.js +19 -0
- package/dist/chunk-D5EHDHYV.js +1 -0
- package/dist/chunk-EJATEGJZ.cjs +1 -0
- package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
- package/dist/chunk-GRDFEH5Q.cjs +2 -0
- package/dist/chunk-GWV65NQW.cjs +10 -0
- package/dist/chunk-GXLZCXEH.js +2 -0
- package/dist/chunk-JUQOPVSK.cjs +2 -0
- package/dist/chunk-LAETEBHD.js +1 -0
- package/dist/chunk-M6Z3KFXM.cjs +5 -0
- package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
- package/dist/chunk-UQFOYZJO.cjs +18 -0
- package/dist/chunk-WPQMPHNR.cjs +1 -0
- package/dist/chunk-WXQ245MQ.js +18 -0
- package/dist/chunk-WZHIFNSU.js +5 -0
- package/dist/chunk-X7A5XART.js +2 -0
- package/dist/chunk-ZKWRCLT2.cjs +1 -0
- package/dist/collaboration/replication.cjs +1 -0
- package/dist/collaboration/replication.d.cts +216 -0
- package/dist/collaboration/replication.d.ts +216 -0
- package/dist/collaboration/replication.js +1 -0
- package/dist/collaboration.cjs +1 -0
- package/dist/collaboration.d.cts +176 -0
- package/dist/collaboration.d.ts +176 -0
- package/dist/collaboration.js +1 -0
- package/dist/contracts/document.d.cts +6 -1
- package/dist/contracts/document.d.ts +6 -1
- package/dist/contracts/editor.cjs +1 -1
- package/dist/contracts/editor.d.cts +8 -9
- package/dist/contracts/editor.d.ts +8 -9
- package/dist/contracts/editor.js +1 -1
- package/dist/contracts/interaction.d.cts +8 -9
- package/dist/contracts/interaction.d.ts +8 -9
- package/dist/contracts/modules.cjs +1 -1
- package/dist/contracts/modules.d.cts +20 -8
- package/dist/contracts/modules.d.ts +20 -8
- package/dist/contracts/modules.js +1 -1
- package/dist/custom-node-writes-CwkYRw3V.d.cts +310 -0
- package/dist/custom-node-writes-JfTn-Sy6.d.ts +310 -0
- package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
- package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
- package/dist/{editor-Cvd7Geoc.d.ts → editor-BogcVHXk.d.ts} +176 -59
- package/dist/{editor-cAEf1uXW.d.cts → editor-C8edZgy5.d.cts} +176 -59
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -7698
- package/dist/editor.d.cts +26 -25
- package/dist/editor.d.ts +26 -25
- package/dist/editor.js +1 -1
- package/dist/failure-BnGjoXf0.d.cts +64 -0
- package/dist/failure-BnGjoXf0.d.ts +64 -0
- package/dist/{index-DRqY5JVF.d.ts → index-BNv-ZLQP.d.ts} +327 -86
- package/dist/{index-wb-iOxfh.d.cts → index-Dn0lOp9Z.d.cts} +327 -86
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +20 -19
- package/dist/index.d.ts +20 -19
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +92 -55
- package/dist/layout.d.ts +92 -55
- package/dist/layout.js +1 -1
- package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-BmoSdyKS.d.ts} +1 -1
- package/dist/{note-properties-CQlxjic_.d.cts → note-properties-BvGfHk5e.d.cts} +1 -1
- package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-Ciq5rgb7.d.ts} +1 -1
- package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-CqQOt_dD.d.cts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -8
- package/dist/output.d.ts +6 -8
- package/dist/output.js +1 -1
- package/dist/{protocol-UuZOcOp7.d.cts → protocol-BB-WP3zk.d.cts} +2 -2
- package/dist/{protocol-C7ahrdUx.d.ts → protocol-Ckl7hWsv.d.ts} +2 -2
- package/dist/{review-items-bdGxFWNA.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
- package/dist/{review-items-B8tffIXj.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
- package/dist/{review-reads-Bxz03tHG.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
- package/dist/{review-reads-CHODU0LI.d.ts → review-reads-Crf0Xn42.d.ts} +2 -2
- package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-Ae2CWa8E.d.ts} +1 -1
- package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-C2S8PSQm.d.cts} +1 -1
- package/dist/{semantic-cell-selection-BPzx6DdT.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
- package/dist/{semantic-cell-selection-CsHcr-yk.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
- package/dist/{semantic-interaction-D-RZ9Ust.d.ts → semantic-interaction-COyhZ9WH.d.ts} +21 -2
- package/dist/{semantic-interaction-BfWDD_0V.d.cts → semantic-interaction-Cs2jErnt.d.cts} +21 -2
- package/dist/{semantic-paint-WhVtSDJK.d.ts → semantic-paint-UHaj3sBY.d.cts} +2 -2
- package/dist/{semantic-paint-Bd7EqzXV.d.cts → semantic-paint-vA-oLSdV.d.ts} +2 -2
- package/dist/{semantic-records-DadVT_E1.d.cts → semantic-records-5AOQJmLX.d.cts} +20 -5
- package/dist/{semantic-records-DCt-ZwKU.d.ts → semantic-records-9xhwbJ23.d.ts} +20 -5
- package/dist/{shaped-measurer-CninrHr_.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
- package/dist/{shaped-measurer-B9f4A7QA.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +193 -19
- package/dist/store.d.ts +193 -19
- package/dist/store.js +1 -1
- package/dist/tree-op-types-BPyXNxyL.d.cts +3053 -0
- package/dist/tree-op-types-DnzAOnc9.d.ts +3053 -0
- package/dist/{custom-node-writes-D6SGwebL.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +128 -312
- package/dist/{custom-node-writes-Dy3b20PS.d.cts → tree-package-fragment-CDER0G3B.d.ts} +128 -312
- package/dist/{tree-session-ZuBFOhIh.d.ts → tree-session-contract-BF2FVBOM.d.cts} +52 -106
- package/dist/{tree-session-Df02ajqc.d.cts → tree-session-contract-DhdsFT_z.d.ts} +52 -106
- package/dist/{tree-store-B_sJBMIS.d.cts → tree-store-CNZ3O83s.d.ts} +130 -25
- package/dist/{tree-store-DgETo6Mf.d.ts → tree-store-DfZi7FqY.d.cts} +130 -25
- package/package.json +14 -3
- package/dist/chunk-6JWP2H7K.js +0 -2
- package/dist/chunk-6KNLLEUW.cjs +0 -18
- package/dist/chunk-7ADTI533.cjs +0 -10
- package/dist/chunk-7ETDCPF6.cjs +0 -2
- package/dist/chunk-7I3BSGGS.js +0 -1
- package/dist/chunk-7UU5YFCD.cjs +0 -2
- package/dist/chunk-7VQ7YLW3.cjs +0 -1
- package/dist/chunk-CKDAK3MV.js +0 -10
- package/dist/chunk-DIMEYVNS.js +0 -2
- package/dist/chunk-GQQOL4PV.js +0 -1
- package/dist/chunk-H2656QDI.cjs +0 -1
- package/dist/chunk-KQGENNL5.cjs +0 -15
- package/dist/chunk-LIXPSV4T.js +0 -18
- package/dist/chunk-O4UULRAQ.cjs +0 -5
- package/dist/chunk-SIIFNE6U.js +0 -15
- package/dist/chunk-VXYECPKA.js +0 -5
- package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
- package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
- package/dist/image-resources-BgA9EQxY.d.ts +0 -203
- package/dist/image-resources-BiA-IXgo.d.cts +0 -203
- package/dist/note-nodes-BNCANoGN.d.ts +0 -108
- package/dist/note-nodes-DL-Au22P.d.cts +0 -108
- package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
- package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
- package/dist/tree-op-types-CnRb7AYo.d.ts +0 -1589
- package/dist/tree-op-types-D1vNJ7XC.d.cts +0 -1589
package/dist/chunk-SIIFNE6U.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {f as f$1,d as d$1,k,c as c$1,b as b$1,l,e as e$1,i,a as a$4,g as g$2}from'./chunk-6JWP2H7K.js';import {d,q,a as a$1,b,c,g,r,o,n,t,e,f,Ic,Kd,yb as yb$1,Dd,Qc as Qc$1,lb as lb$1,Rd,kc,Fd,_d,ae,Wc as Wc$1,be,Sc,ke,Td,le,vc,Xd,ce as ce$1,ie,Wd as Wd$1,he,Vd as Vd$1,gc,Ra as Ra$2,Gb,Jc as Jc$1,cd,bd,dd,Vc as Vc$1,Sd,Ud,X,eb as eb$1,sc,de as de$1,me,Od,Md as Md$1,Bb as Bb$1,ne,ed,Cc,zc,Nc,Kc as Kc$2,Lc,Mc,Ob as Ob$2,xc as xc$1,ad,Qd,uc,$c as $c$1,Zd,Pd,Y,wc as wc$1,Ec,je,fe as fe$1,tc,ja as ja$1,ua,qa as qa$1,Cb as Cb$1,Lb as Lb$1,aa,Nd,Bc,_b as _b$1,Hd as Hd$1,Uc as Uc$1,ge,hc,mc}from'./chunk-LIXPSV4T.js';import {g as g$1}from'./chunk-7I3BSGGS.js';import {j,d as d$2,i as i$1}from'./chunk-VXYECPKA.js';import {H,Q,N}from'./chunk-DIMEYVNS.js';import {a as a$2,Na as Na$1,xc,Lf as Lf$1,wg as wg$1,Kc as Kc$1,Id,_d as _d$1,va as va$1,Vd,Wd,wa as wa$1,ee,hd,Ua as Ua$1,Oa as Oa$1,Pa as Pa$1,Ra as Ra$1,L,Ef as Ef$1,Gf as Gf$1,Bf as Bf$1,Ff as Ff$1,mg as mg$1,lg as lg$1,zf as zf$1,ng as ng$1,$d,Jd,Kd as Kd$1,Ld,Md,Gd,Hd,Ka as Ka$1,gd,Ag as Ag$1,wc,Cd,rg as rg$1,fe,Mf as Mf$1,Of as Of$1,Dg as Dg$1,Eg as Eg$1,xf as xf$1,yf as yf$1,pg as pg$1,Ob as Ob$1,sg as sg$1,ig as ig$1,Ke,Ne,Ab as Ab$1,Hb as Hb$1,Bd,sd,qd,Cg,Kg as Kg$1,vf as vf$1,wf as wf$1,kg as kg$1,jg as jg$1,hg as hg$1,qg as qg$1,Ud as Ud$1,Td as Td$1,Cb as Cb$2,Eb as Eb$1,q as q$1,x,md,Me,ha as ha$1,se,pe,ca,b as b$2,g as g$3,E,dc,Xb as Xb$1,Zc,Tc,sf as sf$1,Ae}from'./chunk-CKDAK3MV.js';import {a}from'./chunk-PSZH2VXP.js';import {a as a$3}from'./chunk-GQQOL4PV.js';import {zipSync,strToU8}from'fflate';import {createT,en,locales,deepMerge}from'@docx-editor.dev/i18n';var jm=Object.freeze({kern:1,liga:1});function ma(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var Kc=false;function Vc(e){if(Kc)return;Kc=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 dr(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:ma(e.request),diagnostic:e.diagnostic});if(e instanceof q){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 ha(e,t$1){try{if(!Number.isSafeInteger(e.maxFontBytes)||e.maxFontBytes<=0||e.maxFontBytes>a$1)throw new a("overLimit",`Font byte ceiling must not exceed the engine hard maximum of ${a$1}`);if(!Number.isSafeInteger(e.sources.length)||e.sources.length===0||e.sources.length>b)throw new a("overLimit",`Font source count must be between 1 and ${b}`);let n$1=0;for(let a$2 of e.sources){if(!Number.isSafeInteger(a$2.bytes.byteLength)||a$2.bytes.byteLength>e.maxFontBytes||a$2.bytes.byteLength>a$1)throw new a("overLimit",`Font source ${a$2.id} exceeds the per-font byte ceiling`);if(a$2.bytes.byteLength>c-n$1)throw new a("overLimit",`Font sources exceed the aggregate byte ceiling of ${c}`);n$1+=a$2.bytes.byteLength;}let r$1={epoch:e.epoch,maxFontBytes:e.maxFontBytes,sources:e.sources.map(a=>({request:ma(a.request),id:a.id,bytes:a.bytes,hash:a.hash,faceIndex:a.faceIndex,availability:a.availability})),substitutions:e.substitutions?.map(a=>({from:ma(a.from),to:ma(a.to)})),defaultFont:Object.freeze({family:e.defaultFont.family,sizeHalfPoints:e.defaultFont.sizeHalfPoints}),language:e.language},o$1=g({epoch:r$1.epoch,maxFontBytes:r$1.maxFontBytes,resources:r$1.sources,substitutions:r$1.substitutions,validateFont:r,instrumentation:{onOwnedByteCopy:t$1?.onFontByteCopy,onHash:t$1?.onFontHash,onAdmission:t$1?.onFontAdmission}});return await o(),Object.freeze({fonts:o$1,shaper:t(),defaultFont:Object.freeze({family:r$1.defaultFont.family,sizeHalfPoints:r$1.defaultFont.sizeHalfPoints}),environment:Object.freeze({variationAxes:Object.freeze({}),shapingLibrary:n,unicodeDataVersion:"16.0.0",normalization:"none",language:r$1.language??"en",features:jm,fixedPointScale:20,roundingMode:"halfAwayFromZero"}),ligatureCaretPolicy:"cluster-edges-only",operation:Object.freeze({resourceEpoch:o$1.epoch,configEpoch:r$1.epoch,extensionFingerprint:`fonts:${r$1.sources.map(a=>`${a.hash}#${a.faceIndex}`).join(",")}`,shapingHash:`hb:${n.version}:kern+liga`,producerVersion:1})})}catch(n){throw dr(n)}}function cr(e){e.shaper.dispose?.();}var Um=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});var Zi=64,ya=Object.freeze({family:"Calibri",sizeHalfPoints:22});function ba(e$1,...t){let n=[e$1,...t],r=[],o=new Set;for(let l of n)for(let d of l.sources??[]){let u=e(d.request);o.has(u)||(o.add(u),r.push(d));}let a=[],s=new Set;for(let l of n)for(let d of l.substitutions??[]){let u=e(d.from);o.has(u)||s.has(u)||(s.add(u),a.push(d));}return Object.freeze({epoch:e$1.epoch??0,maxFontBytes:e$1.maxFontBytes??a$1,sources:Object.freeze(r),...a.length>0?{substitutions:Object.freeze(a)}:{},defaultFont:e$1.defaultFont??ya,...e$1.language!==void 0?{language:e$1.language}:{}})}var jc="http://schemas.openxmlformats.org/wordprocessingml/2006/main",Gm="http://schemas.openxmlformats.org/package/2006/content-types",Uc="http://schemas.openxmlformats.org/package/2006/relationships",$m="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",Xm="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Ym=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${Gm}"><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>`,Qm=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Uc}"><Relationship Id="rId1" Type="${$m}" Target="word/document.xml"/></Relationships>`,Jm=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${Uc}"><Relationship Id="rId1" Type="${Xm}" Target="styles.xml"/></Relationships>`,eh=[{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}],th=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>",nh=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${jc}"><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>`+eh.map(th).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="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>',rh=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${jc}"><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 zi(){return zipSync({"[Content_Types].xml":strToU8(Ym),"_rels/.rels":strToU8(Qm),"word/_rels/document.xml.rels":strToU8(Jm),"word/document.xml":strToU8(rh),"word/styles.xml":strToU8(nh)})}var oh=Object.freeze({kind:"body"});function Qt(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 dt(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 s of [a.headers,a.footers])for(let l of s.values())if(l.partName===o)return {kind:"headerFooter",rId:l.rId};for(let a of ["footnote","endnote"])if(e.partFor({kind:"notesPart",noteKind:a})?.name===o)return {kind:"notesPart",noteKind:a};return n}function va(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=hd(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function Gc(e,t){return e?e.scope:t||oh}function ah(e,t,n){if(n){let o=[];for(let a of [e.footnotes,e.endnotes])if(a)for(let s of a.notes)s.scopeId===n&&o.push(...Wc(s.fragments));return o}if(!t)return X(e);let r=ur(e,t);return r?Wc(r.fragments):[]}function ur(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 $c(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 Ki(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Vi(e,t,n){let r=zc(e,t.y),o=e.pages[r];if(!o)return false;let a=t.x-n(r),s=t.y,l=o.contentBox;return a>=l.x&&a<l.x+l.width&&s>=l.y&&s<l.y+l.height}function ji(e,t,n,r,o={}){return Cc(e,t,n.fragments,r,o)}function ih(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=ur(r,t);return o?Zd(e,t.pageIndex,o.fragments,n):null}function sh(e,t,n){let r=[];for(let o of e.pages)for(let a of [o.footnotes,o.endnotes]){let s=a?.notes.find(l=>l.scopeId===t);s&&r.push(...Zd(e,o.index,s.fragments,n));}return r.length>0?r:null}function Xc(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function Yc(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 s=Number(a.closest("[data-page-index]")?.dataset.pageIndex);if(n!==null&&s===n)return a}return o}function Qc(e,t,n){if((a=>{let s=e.pages[a];return !!s&&!!ur(s,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(ur(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function Jc(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function eu(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function Ui(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function Wi(e,t,n,r,o,a,s){let l=o?ih(e,o,s):a?sh(e,a,s):null,d=de$1(e,t,n,r,{...s?{measurer:s}:{},...l?{stops:l}:{}});if(!d)return null;if(!l)return d;let u=l.find(m=>m.position.paragraphId===d.position.paragraphId&&m.position.offset===d.position.offset);return u?{...d,pageIndex:u.pageIndex}:d}function Gi(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 s of a.notes){let l=s.box,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,scopeId:s.scopeId,noteKind:s.noteKind,noteId:s.noteId,local:{x:t.x-d,y:t.y-u},fragments:s.fragments}}}return null}function tu(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let u=o.y,m=r.y,I=n?Math.max(m,n.box.y+n.box.height):m,v=n?Math.min(u,n.box.y):u;return I<=v?null:{x:r.x,y:v,width:r.width,height:I-v}}let a=r.y+r.height,s=o.y+o.height,l=n?Math.min(a,n.box.y):a,d=n?Math.max(s,n.box.y+n.box.height):s;return d<=l?null:{x:r.x,y:l,width:r.width,height:d-l}}function $i(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 s=tu(r,a);if(!s)continue;let l=s.x+o;if(t.x>=l&&t.x<l+s.width&&t.y>=s.y&&t.y<s.y+s.height)return {pageIndex:r.index,kind:a}}}return null}function Xi(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){let s=r[a];if(!s)continue;let l=s.box,d=tu(r,a)??l,u=d.x+o,m=d.y;if(t.x>=u&&t.x<u+d.width&&t.y>=m&&t.y<m+d.height)return {pageIndex:r.index,kind:a,story:s,local:{x:t.x-(l.x+o),y:t.y-l.y}}}}return null}function fr(e,t,n){if(!t&&!n)return sc(e);let r=new Set,o=[];for(let a of e.pages)for(let s of ah(a,t,n)){for(let l of s.lines)for(let d of uc(l))r.has(d.paragraphId)||(r.add(d.paragraphId),o.push(d.paragraphId));s.lines.length===0&&!r.has(s.paragraphId)&&(r.add(s.paragraphId),o.push(s.paragraphId));}return o}function Ia(e,t,n,r){let o=fr(e,n,r);if(o.length===0)return t;let a=new Set(o),s=l=>a.has(l.paragraphId)?l:{paragraphId:o[0],offset:0};return {anchor:s(t.anchor),head:s(t.head)}}function Wc(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 s of a.cells)n(s.blocks);}};return n(e),t}function nu(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 lh(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function dh(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 ch(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function uh(e,t){if(e)try{await e.delete(t);}catch{}}async function fh(e){let t=e.fetcher??fetch,n=e.maxFontBytes??a$1,r=await lh(e.cacheName??"docx-editor-fonts");async function o(d){let u=Object.freeze({family:d.family,weight:d.weight,style:d.style}),m=nu(u);if(m)return {failure:{url:d.url,request:u,reason:"invalidRequest",diagnostic:m}};let I=(T,K)=>{if(T.byteLength===0)return {url:d.url,request:u,reason:"emptyResponse"};if(T.byteLength>n)return {url:d.url,request:u,reason:"overLimit"};let h=f(T,d.faceIndex??0);if(!h.valid)return {url:d.url,request:u,reason:"malformed",diagnostic:h.diagnostic};let _=a$2(T);return d.hash!==void 0&&d.hash!==_?{url:d.url,request:u,reason:"hashMismatch",expectedHash:d.hash,actualHash:_,...K?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:u,id:`url:${d.url}`,bytes:T,hash:_,faceIndex:d.faceIndex??0}},v=await dh(r,d.url);if(v){let T=I(v,true);if(!("reason"in T))return {source:T};await uh(r,d.url);}let w;try{w=await t(d.url);}catch(T){return {failure:{url:d.url,request:u,reason:"networkError",diagnostic:T instanceof Error?T.message:String(T)}}}if(!w.ok)return {failure:{url:d.url,request:u,reason:"httpError",status:w.status}};let C;try{C=new Uint8Array(await w.arrayBuffer());}catch(T){return {failure:{url:d.url,request:u,reason:"networkError",diagnostic:T instanceof Error?T.message:String(T)}}}let F=I(C,false);return "reason"in F?{failure:F}:(await ch(r,d.url,C),{source:F})}let a=await Promise.all(e.sources.map(d=>o(d))),s=[],l=[];for(let d of a)"source"in d?s.push(d.source):l.push(d.failure);return {sources:s,failures:l}}function ph(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=nu(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 s=t.faceIndex??0,l=f(e,s);return l.valid?{source:{request:r,id:o,bytes:e,hash:a$2(e),faceIndex:s}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:l.diagnostic}}}var gh=96,ru=37.79527559055118;function mh(e,t){if(!Number.isFinite(e)||e<=0)return [];let n=[];if(t==="inch"){let s=Math.floor(e/12);for(let l=0;l<=s;l+=1){let d=l*12;if(l%8===0){let u=l/8;n.push({position:d,height:10,...u>0?{label:String(u)}:{}});}else l%4===0?n.push({position:d,height:6}):l%2===0?n.push({position:d,height:4}):n.push({position:d,height:2});}return n}let r=ru/10,o=Math.floor(e/r);for(let a=0;a<=o;a+=1){let s=a*r;if(a%10===0){let l=a/10;n.push({position:s,height:10,...l>0?{label:String(l)}:{}});}else a%5===0?n.push({position:s,height:6}):n.push({position:s,height:3});}return n}function hh(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var yh=1440,bh=567,vh=180,Ih=56.7,xa=(e,t,n)=>n<t||e<t?t:e>n?n:e;function xh(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 ou(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 Sh(e,t,n,r,o={}){let a=ou(t,o.unit??"inch",o.precise??false),s=r.pageWidth-r.rightMargin-n.right,l=r.leftMargin+n.left+Math.max(0,n.firstLine);switch(e){case "firstLine":{let d=xa(a,0,s);return {...n,firstLine:d-r.leftMargin-n.left}}case "left":{let d=-r.leftMargin-Math.min(0,n.firstLine),u=s-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:xa(a-r.leftMargin,d,u)}}case "hanging":{let d=xa(a-r.leftMargin,-r.leftMargin,s-r.leftMargin);return {...n,left:d,firstLine:n.firstLine+(n.left-d)}}case "right":{let d=xa(a,l,r.pageWidth);return {...n,right:r.pageWidth-r.rightMargin-d}}}}function nt(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 Bn(e){if(typeof e!="object"||e===null)return false;let t=e;return nt(t.from)&&nt(t.to)}function au(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 zt(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=Of$1(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 l=au(a,n.search,n.occurrence),d=l[n.occurrence-1];return d===void 0?{ok:false,code:"notFound",reason:`'${n.search}' matches ${l.length} time(s) in paragraph '${n.paraId}'; occurrence ${n.occurrence} does not exist`}:{ok:true,span:{nodeId:o,start:d,end:d+n.search.length}}}let s=au(a,n.search,2);return s.length===0?{ok:false,code:"notFound",reason:`'${n.search}' does not occur in paragraph '${n.paraId}'`}:s.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:s[0],end:s[0]+n.search.length}}}function iu(e,t,n){if("anchor"in n){let l=zt(e,t,n.anchor);if(!l.ok)return {ok:false,code:l.code,reason:l.reason,target:n.anchor};let d={paragraphId:l.span.nodeId,offset:l.span.start};return {ok:true,selection:{anchor:d,head:d}}}let{from:r,to:o}=n.range;if(!nt(r)||!nt(o))return {ok:false,code:"unsupported",reason:"DocLocation endpoints are not supported; address paragraphs by paraId",target:n.range};let a=zt(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let s=zt(e,t,o);return s.ok?{ok:true,selection:{anchor:{paragraphId:a.span.nodeId,offset:a.span.start},head:{paragraphId:s.span.nodeId,offset:s.span.end}}}:{ok:false,code:s.code,reason:s.reason,target:o}}var uo=/^[0-9A-Fa-f]{6}$/,su={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"},kh={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 Yi(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function Sa(e){return Math.max(0,Math.min(1,e))}function lu(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 du(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 cu(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-Sa(t))*255)))/255,o=lu(e);return du(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function uu(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(Sa(t)*255)))/255,o=lu(e);return du(r*o.r,r*o.g,r*o.b)}function Qi(e){return su[e]??su[e.toLowerCase()]??null}function wh(e,t){let n=Qi(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&uo.test(r))return r.toUpperCase();let o=kh[n];return o&&uo.test(o)?o.toUpperCase():null}function ka(e,t){let n=wh(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Yi(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Yi(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=cu(r,Sa(e.tint)):e.shade!==void 0&&(r=uu(r,Sa(e.shade))),{ok:true,hex:r}}var Th="000000";function Ji(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return uo.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:Th}};let n=ka(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Qi(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function es(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 uo.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=ka(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Qi(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Ph(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return uo.test(o)?`#${o}`:`#${n}`}let r=ka(e,t);return `#${r.ok?r.hex:n}`}var Oh=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function pr(e){return Oh.has(e.type)}function de(e,t){return {ok:false,code:e,reason:t}}function ts(e,t){switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return de("invalidArgs","the table target is no longer valid");case "table-has-merge":return de("unsupported","this table has merged cells");case "vertical-merge-crossing":return de("unsupported","the row cannot be inserted across a vertical merge");case "block-required":return de("unsupported","the table must keep at least one row or column");case "resource-limit":return de("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return de("invalidArgs","the table command arguments are invalid");default:return de("unsupported",`the table operation was refused (${e})`)}}function Qe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vt(e,t){return !Qe(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function mu(e){if(!Qe(e))return false;let t=e.kind;if(t==="hex")return vt(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return vt(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 vt(e,n)}return false}function hu(e){return Qe(e)&&vt(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 yu(e){return Qe(e)&&vt(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 Fh(e){return Qe(e)&&vt(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 Ah(e){return Qe(e)&&vt(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 Mh(e){return !Qe(e)||!vt(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&mu(e.color)}function fu(e){return !("target"in e)||e.target===void 0||hu(e.target)}function pu(e){return !("target"in e)||e.target===void 0||yu(e.target)}function Lh(e){switch(e.type){case "insertRow":return !Qe(e)||e.type!=="insertRow"?de("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?de("invalidArgs","insertRow where must be above or below"):fu(e)?null:de("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !Qe(e)||e.type!=="deleteRow"?de("invalidArgs","deleteRow command shape is invalid"):fu(e)?null:de("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !Qe(e)||e.type!=="insertColumn"?de("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?de("invalidArgs","insertColumn where must be left or right"):pu(e)?null:de("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !Qe(e)||e.type!=="deleteColumn"?de("invalidArgs","deleteColumn command shape is invalid"):pu(e)?null:de("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !Qe(e)||!vt(e,["type"])?de("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !Qe(e)||!vt(e,["type","color"])?de("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!mu(e.color)?de("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !Qe(e)||!vt(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?de("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !Qe(e)||e.type!=="setTableBorders"?de("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?de("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!Mh(e.spec)?de("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !Qe(e)||!vt(e,["type","target","leftWidthTwips","rightWidthTwips"])||!Fh(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?de("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !Qe(e)||!vt(e,["type","target","columnWidthTwips","tableWidthTwips"])||!Ah(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?de("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function Nh(e){return !("target"in e)||e.target===void 0?null:hu(e.target)?e.target:null}function Dh(e){return !("target"in e)||e.target===void 0?null:yu(e.target)?e.target:null}function Hh(e,t){let n=xf$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(s=>r.has(s.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 _h(e,t){let n=xf$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 s=0;for(let l of a.cells){let d=bu(l);if(r.has(l.id))for(let u=0;u<d;u+=1){let m=n.topology.gridColumns[s+u];m&&o.add(m.id);}s+=d;}}return {gridColumnIds:[...o],wholeTable:o.size>0&&o.size===n.topology.gridColumns.length}}function gu(e,t,n){let r=xf$1(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function Bh(e){let t=ne(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 bu(e){let t=vf$1(e,"tcPr"),n=t&&vf$1(t,"gridSpan"),r=n&&wf$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 qh(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 s=0;for(let l of a){let d=bu(l);if(r>=s&&r<s+d)return {tableId:t,rowId:o.id,cellId:l.id,cellIds:[l.id],gridColumnIndex:r,isHeaderRepeat:false};s+=d;}}return null}function Zh(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=xf$1(e.part.root,t.tableId);if(!n.ok)return null;let r=n.topology.rows.findIndex(s=>s.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 zh(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=xf$1(e.part.root,t.tableId);return n.ok?qh(n.topology,t.tableId,t.gridColumnId):null}function Kh(e,t){for(let n of t){let r=Lf$1(e,n);if(r)return ts(r)}return null}function bt(e,t,n){let r=Kh(e,t);return r||{ok:true,ops:t,selection:n}}function Vh(e,t){if(!yf$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=Ji(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function fo(e,t,n){return n!==e.storeRevision?de("invalidArgs","the table target is stale"):xf$1(e.part.root,t).ok?null:de("invalidArgs","the table target is no longer valid")}function jh(e){return e?.isHeaderRepeat?de("unsupported","repeated header rows cannot be edited"):null}function Uh(e,t,n,r){let o=fo(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return de("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return de("invalidArgs","column widths must be whole twips");if(n<300||r<300)return de("invalidArgs","column widths are below the minimum");let a=xf$1(e.part.root,t.tableId);if(!a.ok){let I=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return ts(I)}if(a.topology.hasMerge)return de("unsupported","this table has merged cells");let s=a.topology.gridColumns.find(I=>I.id===t.leftGridColumnId),l=a.topology.gridColumns.find(I=>I.id===t.rightGridColumnId);if(!s||!l)return de("invalidArgs","the table target is no longer valid");let d=a.topology.gridColumns.indexOf(s);if(a.topology.gridColumns.indexOf(l)!==d+1)return de("invalidArgs","the column divider target is not adjacent");let m={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:t.leftGridColumnId,rightGridColumnId:t.rightGridColumnId,leftWidthTwips:n,rightWidthTwips:r};return bt(e.part,[m],{kind:"preserveSelection"})}function Wh(e,t,n,r){let o=fo(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return de("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return de("invalidArgs","column widths must be whole twips");if(n<300)return de("invalidArgs","column widths are below the minimum");let a=xf$1(e.part.root,t.tableId);if(!a.ok){let d=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return ts(d)}if(a.topology.hasMerge)return de("unsupported","this table has merged cells");let s=a.topology.gridColumns[a.topology.gridColumns.length-1];if(!s||s.id!==t.gridColumnId)return de("invalidArgs","the resize target is not the table right edge");let l={op:"setTableRightEdgeWidth",tableId:t.tableId,gridColumnId:t.gridColumnId,columnWidthTwips:n,tableWidthTwips:r};return bt(e.part,[l],{kind:"preserveSelection"})}function vu(e,t,n){if(e.viewing||!e.editable)return de("locked","the document is open for viewing");let r=fo(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return de("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return de("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 cn(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return de("locked","the document is open for viewing");switch(t.type){case "mergeCells":return de("unsupported","cell merge is not supported yet");case "splitCell":return de("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return de("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=Lh(t);if(a)return a;let s=Nh(t),l=Dh(t),d=jh(s??l);if(d)return d;if(s){let m=fo(e,s.tableId,s.sourceRevision);if(m)return m}if(l){let m=fo(e,l.tableId,l.sourceRevision);if(m)return m}let u=s!==null?Zh(e,s):l!==null?zh(e,l):Bh(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!u)return s||l?de("invalidArgs","the table target is no longer valid"):de("unsupported","the selection is not inside a table");if(u?.isHeaderRepeat)return de("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!u)return de("unsupported","the selection is not inside a table");let m={op:"insertTableRow",tableId:u.tableId,rowId:u.rowId,where:t.where};return bt(n,[m],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!u)return de("unsupported","the selection is not inside a table");let m=Hh(n,u),I=m.wholeTable?[{op:"deleteBlock",blockId:u.tableId}]:m.rowIds.map(v=>({op:"deleteTableRow",tableId:u.tableId,rowId:v,...v===u.rowId?{referenceCellId:u.cellId}:{}}));return bt(n,I,{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!u)return de("unsupported","the selection is not inside a table");let m=l?.tableId??u.tableId,I=l?.gridColumnId??gu(n,m,u.gridColumnIndex),v=I?{op:"insertTableColumn",tableId:m,where:t.where,gridColumnId:I}:{op:"insertTableColumn",tableId:m,where:t.where,referenceCellId:u.cellId};return bt(n,[v],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!u)return de("unsupported","the selection is not inside a table");let m=l?.tableId??u.tableId,I=l?.gridColumnId??gu(n,m,u.gridColumnIndex);if(!I)return de("invalidArgs","the table has no grid column to delete");let v=l?.gridColumnId===void 0?_h(n,u):{gridColumnIds:[I],wholeTable:false};if(v.wholeTable)return bt(n,[{op:"deleteBlock",blockId:m}],{kind:"adoptCommittedCaret"});let C=(v.gridColumnIds.length>0?v.gridColumnIds:[I]).map(F=>({op:"deleteTableColumn",tableId:m,gridColumnId:F}));return bt(n,C,{kind:"adoptCommittedCaret"})}case "deleteTable":{if(!u)return de("unsupported","the selection is not inside a table");let m={op:"deleteBlock",blockId:u.tableId};return bt(n,[m],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!u)return de("unsupported","the selection is not inside a table");let m;if(t.color===null)m=null;else {let v=es(t.color,e.themeColors);if(!v.ok)return de("invalidArgs",v.reason);m=v.color;}let I={op:"setTableCellFill",tableId:u.tableId,cellIds:u.cellIds,color:m};return bt(n,[I],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!u)return de("unsupported","the selection is not inside a table");let m={op:"setTableCellVerticalAlignment",tableId:u.tableId,cellIds:u.cellIds,alignment:t.alignment};return bt(n,[m],{kind:"preserveSelection"})}case "setTableBorders":{if(!u)return de("unsupported","the selection is not inside a table");if(t.scope==="none"){let v={op:"setTableCellBorders",tableId:u.tableId,cellIds:u.cellIds,scope:"none",target:t.target};return bt(n,[v],{kind:"preserveSelection"})}let m=Vh(t.spec,e.themeColors);if(!m.ok)return de("invalidArgs",m.reason);let I={op:"setTableCellBorders",tableId:u.tableId,cellIds:u.cellIds,scope:t.scope,spec:m.spec};return bt(n,[I],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return Uh(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return Wh(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return de("unsupported",`command '${t.type}' is not a table command`)}}function Iu(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}}}var Gh=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops"];function $h(e,t){return e===t?true:!e||!t?false:Gh.every(n=>e[n]===t[n])}function ns(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||!$h(e.disagrees,t.disagrees)||e.tabStops?.length!==t.tabStops?.length||(e.tabStops??[]).some((a,s)=>a.positionTwips!==t.tabStops?.[s]?.positionTwips||a.alignment!==t.tabStops?.[s]?.alignment||(a.leader??"none")!==(t.tabStops?.[s]?.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 rs(e,t){return e.current===t.current&&e.total===t.total}function os(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 xu(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 as(e,t){return e===t?true:!e||!t||!Bn(e)||!Bn(t)?false:xu(e.from,t.from)&&xu(e.to,t.to)}function is(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}var Xh={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",hasReviewContent:"compared",editingMode:"compared",lastRejection:"compared",fontSubstitutions:"compared"},Yh=Object.keys(Xh);function ss(e,t){return Yh.every(n=>e[n]===t[n])}function wa(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)wa(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))wa(t[n]);return Object.freeze(e)}var ls=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"}}]]),Qh=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),Jh=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,e0=/^[0-9A-Fa-f]{6}$/;function ds(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!Jh.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"&&!e0.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"||!Qh.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 Tu(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function cs(e){return typeof e=="object"&&e!==null&&Tu(e.anchor)&&Tu(e.head)}function gr(e,t){let n=new Error(t);return n.code=e,n}function us(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 fs(e){return e==="blank"?zi():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function ps(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 po(e){switch(e.type){case "toggleMark":return ls.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=ds(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 "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)>Bb$1))return {supported:false,code:"invalidArgs",reason:`indent values must be whole twips within \xB1${Bb$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)>Bb$1)return {supported:false,reason:`indent values must be within \xB1${Bb$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"?{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 "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":return typeof e.text!="string"?{supported:false,code:"invalidArgs",reason:"paste requires text"}:e.text===""?{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=Iu(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(cs(e.range)||Bn(e.range))||"anchor"in e&&nt(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`}}}function t0(e){return [e.left,e.top,e.right,e.bottom]}function gs(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function n0(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function go(e){return Math.round(e*1e3)}function mo(e){return e/1e3}function ms(e){return Object.freeze({left:go(e.left),top:go(e.top),right:go(e.right),bottom:go(e.bottom)})}function r0(e){return Object.freeze({left:mo(e.left),top:mo(e.top),right:mo(e.right),bottom:mo(e.bottom)})}function hs(e){return t0(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var o0=new Set(["insertImage","replaceImage"]),a0=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function i0(e,t,n){if(!e)return null;for(let r of e.drawings??[])if(r.paragraphId===t&&(r.start===n||r.start+1===n))return r;return null}function s0(e,t,n){let r=e.layout();for(let o of r.pages){for(let a of o.anchoredDrawings??[])if(a.anchorParagraphId===t&&(a.start===n||a.start+1===n))return a;for(let a of [o.header,o.footer])if(a){for(let s of a.anchoredDrawings??[])if(s.anchorParagraphId===t&&(s.start===n||s.start+1===n))return s}}return null}function ys(e){return e.kind==="pointer"?`pointer:${e.drawingNodeId}`:e.kind}function Pu(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=Vd$1(e.layout(),n.paragraphId,n.offset),a=i0(o,n.paragraphId,n.offset)??s0(e,n.paragraphId,n.offset);return !a||t.kind==="pointer"&&a.drawingNodeId!==t.drawingNodeId?null:a}function Cu(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=va$1(r,t.drawingNodeId);return !o||o.kind!=="drawing"?null:Ua$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:Pa$1,limits:Oa$1,resolveRelationship:Ra$1(e.session.currentPackage(),t.ownerPartName)})}function Ru(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 l0(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 Eu(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 d0(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function Jt(e){let t=Pu(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?Cu(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:gs(t.crop),rotationDegrees:r.rotationDegrees,wrap:d0(t),position:Ru(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:l0(t),...Eu(n)})}function Ou(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 bs(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function Fu(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function vs(e){return bs(e)!==void 0||Fu(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function Is(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=Fu(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=bs(t),s=Jt(r);if(a!==void 0&&(!s||s.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:l,head:d}=r.state().selection;if(l.paragraphId!==t.selectionParagraphId||l.offset!==t.selectionOffset||d.paragraphId!==t.selectionParagraphId||d.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return hr(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function kn(e,t){let n=Jt(e),r=bs(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 c0(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 Ta(e,t){return c0(e.applyDrawingOps(t))}function u0(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 f0(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function p0(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function g0(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||Ef$1(e)}function Au(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 ho(e){return a0.has(e.type)}function m0(e){return o0.has(e.type)}function Mu(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function Lu(e){if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};let t=e.editingMode();return t==="view"?{ok:false,code:"locked",reason:"the document is open for viewing"}:t==="suggest"?{ok:false,code:"invalidArgs",reason:"image property edits are not supported in suggesting mode"}:null}function yo(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=Jt(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function hr(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 s=Jt(r),l=n.drawingNodeId??t.drawingNodeId;if(!s||!l||s.id!==l)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function bo(e,t){if(!ho(e))return null;if(!t)return {ok:false,code:"notFound",reason:"no document is loaded"};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 o=kn(t,e);return "ok"in o?o:null}let n=kn(t,e);if("ok"in n)return n;let r=Jt(t);if(!r)return {ok:false,code:"notFound",reason:"no drawing is selected"};if(t.editingMode()==="suggest")return e.type==="deleteImage"?{ok:false,code:"invalidArgs",reason:"trackedDrawingDeletionUnsupported"}:{ok:false,code:"invalidArgs",reason:"image property edits are not supported in suggesting mode"};switch(e.type){case "deleteImage":return r.locks.select?{ok:false,code:"locked",reason:"the drawing cannot be selected"}:null;case "setImageWrapType":return r.canChangeWrap?null:{ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};case "transformImage":return r.locks.changeAspect||r.locks.resize?{ok:false,code:"locked",reason:"the drawing is locked"}:null;case "setImagePosition":if(!r.canMove||r.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};if(!p0(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let o=r.position?.mode??"frame";return Gf$1(e,o)?Bf$1(Au(e,r))?null:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"}:{ok:false,code:"invalidArgs",reason:"setImagePosition carries invalid position values"};case "setImageProperties":{if(f0(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!g0(e))return {ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"};if(e.resetToNaturalSize&&!r.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&&!r.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.heightEmu!==void 0&&!r.canResize)return {ok:false,code:"locked",reason:"the drawing is locked"};if(e.crop!==void 0&&!hs(e.crop))return {ok:false,code:"invalidArgs",reason:"crop values are out of range"};if(e.crop!==void 0&&!r.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&&!r.canChangeWrap)return {ok:false,code:"locked",reason:"wrap cannot be changed on this drawing"};if(Ef$1(e)){if(!r.canMove||r.kind!=="anchored")return {ok:false,code:"locked",reason:"position cannot be changed on this drawing"};let a=r.position?.mode??"frame";if(!Gf$1(e,a))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!Bf$1(Ff$1(e,r)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function xs(e,t){let n=Lu(t);if(n)return n;let r=bo(e,t);return r||{ok:true}}function Nu(e,t){let n=bo(e,t);return n||Mu(e)}function Du(e,t,n){if(m0(t))return Mu(t);let r=n&&vs(t)?yo(n):null;if(r&&n){let o=Is(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=kn(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=kn(e,t);return "ok"in o?o:Ta(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=kn(e,t);return "ok"in o?o:Ta(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=kn(e,t);if("ok"in o)return o;let a=Jt(e),s=Au(t,a);return Ta(e,[{op:"positionDrawing",drawingNodeId:o.id,position:s}])}case "setImageProperties":{let o=kn(e,t);if("ok"in o)return o;let a=Jt(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let s=[];if(t.resetToNaturalSize){let u=u0(a);if(!u)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};s.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:u});}else (t.widthEmu!==void 0||t.heightEmu!==void 0)&&s.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:{cx:t.widthEmu??a.widthEmu,cy:t.heightEmu??a.heightEmu}});t.crop!==void 0&&s.push({op:"cropDrawing",drawingNodeId:o.id,crop:ms(t.crop)});let l=t.title??t.alt,d=t.description??t.alt;if((l!==void 0||d!==void 0)&&s.push({op:"setDrawingMetadata",drawingNodeId:o.id,title:l??a.title,description:d??a.description}),t.wrap!==void 0&&s.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),Ef$1(t)){let u=Ff$1(t,a);s.push({op:"positionDrawing",drawingNodeId:o.id,position:u});}if(t.hyperlink!==void 0){let u=e.applyImageProperties({drawingNodeId:o.id,ops:s,hyperlink:t.hyperlink});return u.ok?null:{ok:false,code:"invalidArgs",reason:u.detail??u.reason??"setImageProperties was refused"}}return s.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:Ta(e,s)}default:return null}}async function Ss(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=Lu(n);if(r)return r;let o=bo(t,n);if(o)return o;let a=yo(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:I}=n.state().selection,v=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let w=await n.insertImage({paragraphId:I.paragraphId,offset:I.offset,bytes:t.data,mime:t.mime,widthPoints:t.widthPoints,heightPoints:t.heightPoints,expectedPackageRevision:v,commitGuard:()=>hr(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),C=hr(e,a);return C||(w.ok?{ok:true,changed:w.change!==null}:{ok:false,code:"invalidArgs",reason:w.detail==="stale-package-epoch"?"stale package revision":w.detail??w.reason??"insertImage was refused"})}let s=kn(n,t);if("ok"in s)return s;let l=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let d=t.mime??"image/png",u=await n.replaceImage(s.id,t.data,d,{expectedPackageRevision:l,commitGuard:()=>hr(e,a,{requireDrawing:true,drawingNodeId:s.id})===null}),m=hr(e,a,{requireDrawing:true,drawingNodeId:s.id});return m||(u.ok?{ok:true,changed:u.change!==null}:{ok:false,code:"invalidArgs",reason:u.detail==="stale-package-epoch"?"stale package revision":u.detail??u.reason??"replaceImage was refused"})}var h0=1,y0=10,vo=12700;function b0(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=Eu(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function v0(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=Pu(e);if(!r||r.accessibility.hidden)return null;let o=e.layout(),a=Ic(o,r.drawingNodeId);if(!a)return null;let s=Cu(e,r);if(!s||s.locks.select)return null;let l=b0(r,s),u=e.editingMode()==="edit"&&e.session.editable?l:{...l,canResize:false,canMove:false},m=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:s.extentEmu.cx,heightEmu:s.extentEmu.cy,position:Ru(s),anchorFrameOrigin:m,transform:r.transform,...u})}function rt(e){return Math.round(e*vo)}function mr(e){return e/vo}function I0(e,t,n,r,o,a){let s=mr(e),l=mr(t),d=s/l,u=n.includes("e")?r:n.includes("w")?-r:0,m=n.includes("s")?o:n.includes("n")?-o:0;if(s=Math.max(1,s+u),l=Math.max(1,l+m),a)if(n.length===2){let v=Math.max(s/mr(e),l/mr(t));s=Math.max(1,mr(e)*v),l=Math.max(1,s/d);}else n==="e"||n==="w"?l=Math.max(1,s/d):s=Math.max(1,l*d);return Object.freeze({cx:rt(s),cy:rt(l)})}function ks(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 x0(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"}:hr(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function Hu(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 ws(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 Ts(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection;if(t.paragraphId===n.paragraphId){let u=e.session.paraIdOf(t.paragraphId);return u===null?null:{from:{paraId:u},to:{paraId:u}}}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 s=r.ordinalByNode.get(t.paragraphId)??0,l=r.ordinalByNode.get(n.paragraphId)??0;return l<s||l===s&&n.offset<t.offset?{from:{paraId:a},to:{paraId:o}}:{from:{paraId:o},to:{paraId:a}}}function _u(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 Bu(e,t){if(!e)return [];if(t!==void 0&&t.part!=="body")return [];let n=e.session.part(),r=e.session.paragraphAnchors();return d$2(n).map(o=>{let a=r.paraIdByNode.get(o.id),s=o.kind==="textValue"?void 0:i$1(o);return {...a!==void 0?{paraId:a}:{},text:Of$1(n,o.id)??"",...s!==void 0?{styleId:s}:{}}})}function Ps(e){return e?e.state().pageCount:0}function Cs(e,t="caret"){return e?e.currentPage(t):1}function S0(e,t){if(!pr(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=Pa(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 k0(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 Pa(e,t){let n=cn(k0(e,t));return n.ok?{can:{ok:true},plan:n}:{can:{ok:false,code:n.code,reason:n.reason},plan:n}}function Io(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=po(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"}};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==="undo"&&!t.session.canUndo())return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing to undo"}};if(e.type==="redo"&&!t.session.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==="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"&&(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"}};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=S0(e,t);return s.ok?{ok:true,tablePlan:s.tablePlan}:s}let a=bo(e,t);return a&&!a.ok?{ok:false,refusal:a}:{ok:true}}function qu(e,t){let n=e.session.part();if(!t.startsWith(`${n.name}#`)||!va$1(n,t))return true;let r=wa$1(n,t),o=0;for(;r;){if(r.kind==="tableCell"||r.kind==="generic"&&r.localName==="tc"||(o+=1)>64)return true;r=wa$1(n,r.id);}return false}function Zu(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!qu(e,t.selection.head.paragraphId))return null;let r=me(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 Rs(e){if(!e)return null;let t=e.state(),n=t.cellSelection;if(!n&&!qu(e,t.selection.head.paragraphId))return null;let r=me(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 zu(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}var ce={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_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 yr={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},Vu=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function Es(e){return createT(en)(e)}function Ca(e){return Vu.includes(e)}function P0(e){return e!=null}var ju=[{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"}],Uu=[{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"}],C0=[{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 R0(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function E0(e){return e==="none"||R0(e)}function Ku(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function O0(e){return Uu.some(t=>t.value===e)}function qn(e,t,n){switch(t){case "table.borderTarget":return E0(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(!Ku(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(!O0(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&&!Ku(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function Os(e,t=yr){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return qn(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return qn(t,e,"single")?.command??null;case "table.borderWidth":return qn(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function F0(e){return ju.find(n=>n.value===e)?.labelKey??"table.borders.all"}function A0(e){return ce[e]}function br(e){return e.surface??null}var M0={"review.comments":{type:"toggleReviewPane"},"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.toc":{type:"insertToc"},"contentControl.remove":{type:"removeContentControl"}};function L0(e){return Gu[e]??null}var Wu=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),Gu={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:Wu,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 Ra(e){return M0[e]??null}var N0={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},D0={"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 $u(e,t,n){return qn(n,e,t)?.command??null}function Ea(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(Ca(e))return $u(e,t,yr);if(e==="image.wrap")return typeof t!="string"||!Na$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=N0[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function Xu(e,t,n=yr){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=Os(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}}function Yu(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(Ca(t))return Xu(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",s=e.can(Ea(t,a==="editing"?"suggesting":"editing"));return {id:t,enabled:s.ok,disabledReason:s.ok?null:s.reason,active:false,value:a}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let a=br(e),s=a?.state().contentControls,l=t==="contentControl.showAll"?s?.showAll??false:s?.formFill??false;return {id:t,enabled:a!==null,disabledReason:a?null:"editor is not ready",active:l}}if(t==="contentControl.inspector"){let a=br(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}}let n=Ra(t);if(!n){let a=D0[t];if(a!==void 0){let l=Ea(t,a);if(!l)return {id:t,enabled:false,disabledReason:"not wired to an editor command",active:false};let d=e.can(l),u=e.getSelectedImage?.()??null,m=t==="image.wrap"?u?.wrap:t==="image.altText"?u?.description:void 0;return d.ok?{id:t,enabled:true,disabledReason:null,active:false,...m!==void 0?{value:m}:{}}:{id:t,enabled:false,disabledReason:d.reason,active:false,...m!==void 0?{value:m}:{}}}let s=Gu[t];if(s){if(t==="image.insert"&&s.type==="insertImage"){let d=e.canExecuteImageCommand?.({type:"insertImage",data:Wu,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="image.properties"&&s.type==="setImageProperties"){let d=e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="table.insert"&&s.type==="insertTable"){let d=e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="paragraph.dialog"&&s.type==="setParagraphFormat"){let d=e.can(s);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}let l=e.can(s);if(!l.ok)return {id:t,enabled:false,disabledReason:l.reason,active:false}}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 H0(e,t){return t.map(n=>Yu(e,n))}function _0(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=qn(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 s=e.exec(o.command);return s.ok?{result:s,nextDraft:o.nextDraft}:{result:s,nextDraft:null}}function B0(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(t==="contentControl.showAll"){let a=br(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=br(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=br(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=br(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};let s=a.state().contentControls.activeControlId;if(!s)return {ok:false,code:"notFound",reason:"no content control at the selection"};let l=a.contentControls.disabledReason(s,"remove");return l?{ok:false,code:l==="bound"?"bound":"locked",reason:l}:a.contentControls.remove(s)?{ok:true,changed:true}:{ok:false,code:a.state().lastRejection??"unsupported",reason:a.state().lastRejection??"removeContentControl was refused"}}let r=n===void 0?Ra(t):Ea(t,n)??Ra(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 q0(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function Z0(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=Pa(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function z0(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 Fs(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(Fs):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,Fs(e[t])]))}function K0(e){return JSON.stringify(Fs(e))}var As=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:ce.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:ce.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:ce.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:ce.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:ce.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:ce.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:ce.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:ce.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:ce.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:ce.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:ce.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:ce.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:ce.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:ce.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:ce.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:ce.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:ce.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:ce.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:ce.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:ce.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.clearFormatting",controls:[{id:"clear",labelKey:"formattingBar.clearFormatting",paths:ce.format_clear,state:{kind:"command"}}]},{id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:ce.comment,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:ce.edit_note,state:{kind:"command"}}]},{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:ce.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:ce.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:ce.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:ce.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:ce.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:ce.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:ce.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:ce.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:ce.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:ce.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:ce.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:ce.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:ce.format_color_fill,state:{kind:"value"}}]},{id:"paragraph",labelKey:"dialogs.paragraph.title",contextual:true,controls:[{id:"dialog",labelKey:"lineSpacing.options",paths:ce.format_line_spacing,state:{kind:"command"}}]},{id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:ce.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:ce.file_download,state:{kind:"save"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:ce.settings,state:{kind:"command"}}]},{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:ce.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:ce.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:ce.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:ce.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:ce.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:ce.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:ce.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:ce.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:ce.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:ce.toc,state:{kind:"command"}}]}],Qu=As;function V0(e,t){return `${e.id}.${t.id}`}function Ju(){return Qu.filter(e=>!e.contextual)}function j0(e){let t=Ju();if(!e)return t;let n=Qu.find(r=>r.id==="image");return n?[...t,n]:t}var ef=[{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.clear"}]},{id:"insert",labelKey:"toolbar.insert",entries:[{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:ce.page_break,items:[{kind:"item",slot:"insert.pageBreak"},{kind:"item",slot:"insert.sectionBreakNextPage"},{kind:"item",slot:"insert.sectionBreakContinuous"}]},{kind:"item",slot:"insert.toc"}]},{id:"help",labelKey:"toolbar.help",entries:[]}];function U0(){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 ef)t(n.entries);return e}function W0(){return As.reduce((e,t)=>e+t.controls.length,0)}var G0="formattingBar.unavailableInPreview";var tf="docx-field-atom--active",$0="docx-field-atom",nf=new WeakMap;function Ms(e,t,n){let r=nf.get(e);r||(r={caretKey:null,marked:[]},nf.set(e,r));let o=t?`${t.paragraphId}\0${t.offset}`:null;if(!n?.domReplaced&&o===r.caretKey)return;for(let s of r.marked)s.classList.remove(tf);if(r.marked=[],r.caretKey=o,!t)return;let a=e.querySelectorAll(`.${$0}`);for(let s of a){if(s.dataset.paragraphId!==t.paragraphId)continue;let l=Number(s.dataset.start),d=Number(s.dataset.end);!Number.isFinite(l)||!Number.isFinite(d)||t.offset<l||t.offset>d||(s.classList.add(tf),r.marked.push(s));}}function vr(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function Oe(e){return {anchor:e,head:e}}function Zn(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 Ls(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??sc(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function xo(e,t,n){let r=t[0],o=a=>{let s=t.includes(a.paragraphId),l=s?a.paragraphId:r??a.paragraphId,d=s?a.offset:0,u=ce$1(e,l).length;return {paragraphId:l,offset:Math.max(0,Math.min(d,u))}};return {anchor:o(n.anchor),head:o(n.head)}}function of(e,t,n,r){if(t.paragraphId===n.paragraphId)return ce$1(e,t.paragraphId).slice(t.offset,n.offset);let o=r??sc(e),a=o.indexOf(t.paragraphId),s=o.indexOf(n.paragraphId);if(a===-1||s===-1)return "";let l=o.slice(a,s+1),d=ce$1(e,t.paragraphId).slice(t.offset);for(let u=1;u<l.length;u+=1){let m=l[u],I=ce$1(e,m),v=vc(e,m).includes(l[u-1])?"":`
|
|
3
|
-
`;d+=v+(u===l.length-1?I.slice(0,n.offset):I);}return d}function af(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 sf(e){return e.kind}function X0(e){return e.kind!=="textValue"&&sf(e)==="contentControl"}function rf(e){return e.kind!=="textValue"&&sf(e)==="contentControlContent"}function Y0(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=af(o);if(a.length>0&&a.every(s=>t.has(s))){n.set(o.id,a);return}}for(let a of o.children)r(a);}};return r(e.root),n}function Q0(e,t,n){let r=new Set,o=(a,s)=>{if(a.kind!=="textValue"){if(a.kind==="table"&&n.has(a.id)){for(let l of a.children)o(l,true);return}if(X0(a)){let l=af(a);!s&&l.length>0&&l.every(d=>t.has(d))&&r.add(a.id);for(let d of a.children)o(d,s);return}for(let l of a.children)o(l,s);}};return o(e.root,false),r}function lf(e,t,n,r,o){let a=q=>ce$1(e,q);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 s=o??sc(e),l=s.indexOf(n.paragraphId),d=s.indexOf(r.paragraphId);if(l===-1||d===-1)return {ops:[],collapseTo:n};let u=new Set;for(let q=l;q<=d;q+=1){let A=s[q];(q===l?n.offset===0:q!==d||r.offset===a(A).length)&&u.add(A);}let m=Y0(t,u),I=new Map;for(let[q,A]of m)for(let $ of A)I.set($,q);let v=Q0(t,u,m),w=l;if(I.has(n.paragraphId)){w=-1;for(let q=l+1;q<=d;q+=1)if(!I.has(s[q])){w=q;break}if(w===-1){let q=I.get(n.paragraphId);for(let A of m.get(q)??[])I.delete(A);m.delete(q),w=l;}}let C=s[w],F=w===l?n:{paragraphId:C,offset:0},T=[];for(let q=l;q<=d;q+=1){let A=s[q];if(I.has(A))continue;let $=a(A).length,x=q===l?n.offset:0,E=q===d?r.offset:$;x<E&&T.push({op:"deleteText",paragraphId:A,start:x,end:E});}for(let q of m.keys())T.push({op:"deleteBlock",blockId:q});for(let q of v)T.push({op:"removeContentControl",controlId:q});let K=q=>{let A=wa$1(t,q);for(;A&&rf(A);){let $=wa$1(t,A.id);if(!$||!v.has($.id))break;A=wa$1(t,$.id);}return A},h=q=>{let A=[],$=x=>{for(let E of x)if(E.kind!=="textValue"&&!m.has(E.id)){if(v.has(E.id)){let V=E.children.find(rf);V&&V.kind!=="textValue"&&$(V.children);continue}if(E.kind==="paragraph"){A.push(E.id);continue}A.push(`\0barrier:${E.id}`);}};return $(q.children),A},_=(q,A)=>{let $=K(q);if(!$||K(A)!==$)return false;let x=h($),E=x.indexOf(q),V=x.indexOf(A);return E!==-1&&V===E+1},L=C,W=C;for(let q=w+1;q<=d;q+=1){let A=s[q];I.has(A)||(_(W,A)?T.push({op:"joinParagraphs",firstId:L,secondId:A}):L=A,W=A);}return {ops:T,collapseTo:F}}var J0={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 J0[n.toLowerCase()]??t})}var ty=new Set(["script","style"]),ny=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),ry=new Set(["td","th"]),df=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),oy=e=>df(e)||e!==void 0&&e>="0"&&e<="9",cf=e=>e===" "||e===" "||e===`
|
|
4
|
-
`||e==="\r"||e==="\f";function ay(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!df(e[n]))return null;let o=n;for(;n<e.length&&oy(e[n]);)n+=1;let a=e.slice(o,n).toLowerCase(),s="",l=false;for(;n<e.length;){let d=e[n];if(s!=="")d===s&&(s="");else if(d==="=")l=true;else if(l&&(d==='"'||d==="'"))s=d,l=false;else {if(d===">")return {name:a,closing:r,end:n+1};cf(d)||(l=false);}n+=1;}return {name:a,closing:r,end:e.length}}function iy(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 sy(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&&cf(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function ly(e){let t=e.length>2e6?e.slice(0,2e6):e,n="",r=0;for(;r<t.length;){let o=t.indexOf("<",r);if(o===-1){n+=t.slice(r);break}if(n+=t.slice(r,o),t.startsWith("<!--",o)){if(t[o+4]===">"){r=o+5;continue}if(t[o+4]==="-"&&t[o+5]===">"){r=o+6;continue}let s=t.indexOf("-->",o+4);r=s===-1?t.length:s+3;continue}if(t[o+1]==="!"||t[o+1]==="?"){let s=t.indexOf(">",o+1);r=s===-1?t.length:s+1;continue}let a=ay(t,o);if(a===null){n+="<",r=o+1;continue}r=a.end,!a.closing&&ty.has(a.name)?r=sy(t,a.name,a.end):!a.closing&&a.name==="br"?n+=`
|
|
5
|
-
`:a.closing&&ry.has(a.name)?n+=" ":a.closing&&ny.has(a.name)&&(n+=`
|
|
6
|
-
`);}return ey(n).replace(/\r\n?/g,`
|
|
7
|
-
`).split(`
|
|
8
|
-
`).map(iy).join(`
|
|
9
|
-
`).replace(/\n{3,}/g,`
|
|
10
|
-
|
|
11
|
-
`).trim()}function uf(e){let t="";for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r===12){t+=`
|
|
12
|
-
`;continue}if(r===13){t+=`
|
|
13
|
-
`,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}function Ns(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?ly(n):""}function dy(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var mf=/^[^\s]{1,512}$/,cy=/["\\\u0000-\u001f\u007f]/;function Oa(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!mf.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 So(e,t,n){return cy.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function hf(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=Oa(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function yf(e){return e.querySelector("[data-docx-hf-active]")}function zn(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 uy(e,t){return t===void 0||!Number.isInteger(t)||t<0?null:e.querySelector(`[data-page-index="${t}"]`)}function Ds(e,t){let n=yf(e);if(n)return [n,e];let r=uy(e,t);return r&&r!==e?[r,e]:[e]}function ff(e,t){let n=hf(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 s=Oa(a);if(s)return {element:a,identity:s}}return null}function fy(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=ff(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=ff(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function pf(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")||yf(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?bf(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let l=e,d=Oa(l);if(d)return {paragraphId:d.paragraphId,offset:t>0?d.end:d.start};let u=fy(l,t);return u||hy(l)}let s=hf(e);return s?{paragraphId:s.identity.paragraphId,offset:dy(s.identity,t)}:null}function Ir(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 s=pf(n,r,e),l=pf(o,a,e);if(!s||!l){let d=s??l;return d?{anchor:d,head:d}:null}return {anchor:s,head:l}}function Hs(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 gf(e,t,n){for(let r of Ds(e,n)){let o=py(r,t);if(o)return o}return null}function py(e,t){let n=So(e,t.paragraphId,"[data-start]"),r=null,o=false;for(let s of n){let l=Oa(s);if(!l||l.paragraphId!==t.paragraphId)continue;let d=gy(s),u=s.textContent?.length??0,m=l.end;if(d&&!s.closest?.("[data-docx-field]")&&(o=true,t.offset>=l.start&&t.offset<=m)){let I={node:d,offset:Math.min(t.offset-l.start,u)};if(t.offset<m)return I;r=I;}}if(r)return r;if(o)return null;let a=my(e,t.paragraphId);return a?{node:a,offset:0}:null}function gy(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 my(e,t){let n=null;for(let r of So(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 bf(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!mf.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function hy(e){let t=bf(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function vf(e,t,n,r){if(!n)return false;let o=r?.preferredPageIndex??zn(n.anchorNode,e),a=gf(e,t.anchor,o),s=gf(e,t.head,o);if(!a||!s)return false;let l=Ir(e,n);if(l&&Rt(l,t)){let d=zn(n.anchorNode,e);if(o===void 0||d===o)return true}try{return n.setBaseAndExtent(a.node,a.offset,s.node,s.offset),!0}catch{return false}}function Rt(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 yy='[data-docx-marker],[data-docx-tab-leader],[aria-hidden="true"],[contenteditable="false"],[data-drawing-node-id]';function If(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 xf(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 by(e){return e?(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(".docx-page")??null:null}function vy(e,t,n){return t&&e.contains(t)?2:n?.contains(e)?1:0}function Sf(e,t,n,r){if(e.dataset.docxField!==void 0){let a=If(e,t,t);return {start:t,end:a,text:n.slice(t,a),seq:r}}let o=e.textContent??"";return {start:t,end:If(e,t,t+o.length),text:o,seq:r}}function kf(e,t){for(let n of e.childNodes){if(n.nodeType===Node.TEXT_NODE){let l=n.textContent??"";l.length>0&&(t.pieces.push({start:t.end,end:t.end,text:l,seq:t.seq}),t.seq+=1);continue}if(n.nodeType!==Node.ELEMENT_NODE)continue;let r=n,o=xf(r,t.paragraphId);if(o===null){if(r.dataset?.start!==void 0||r.matches?.(yy))continue;kf(r,t);continue}let a=Sf(r,o,t.modelText,t.seq);t.seq+=1,t.end=Math.max(t.end,a.end);let s=`${a.start}:${a.end}`;t.ranges.has(s)||(t.ranges.add(s),t.pieces.push(a));}}function Iy(e,t,n,r){let o=[];for(let s of So(e,t,"")){let l=s;l.dataset.paragraphId===t&&l.dataset.start===void 0&&(o.some(d=>d.contains(l))||o.push(l));}let a=new Map;for(let s of o){let l=s.dataset.fragmentIndex??"",d=vy(s,n,r),u=a.get(l);(!u||d>u.affinity)&&a.set(l,{element:s,affinity:d});}return [...a.values()].map(s=>s.element)}function xy(e,t,n){for(let r of So(e,n.paragraphId,"[data-start]")){let o=r,a=xf(o,n.paragraphId);if(a===null||t.some(d=>d.contains(o)))continue;let s=Sf(o,a,n.modelText,n.seq);n.seq+=1;let l=`${s.start}:${s.end}`;n.ranges.has(l)||(n.ranges.add(l),n.pieces.push(s));}}function Sy(e,t){let n=[...e].sort((a,s)=>a.start-s.start||a.seq-s.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 wf(e,t,n,r){let o=Iy(e,t,r,by(r)),a={paragraphId:t,modelText:n,pieces:[],ranges:new Set,end:0,seq:0};for(let s of o)kf(s,a);return xy(e,o,a),a.pieces.length===0?null:Sy(a.pieces,n)}var ky={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},Tf={l:"left",e:"center",r:"right",j:"both"},Pf={1:"240",5:"360",2:"480"},Cf={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function Ef(e,t={}){return n=>{if(n.defaultPrevented)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}if((n.ctrlKey||n.metaKey)&&n.altKey&&!n.shiftKey){let a=n.key.toLowerCase();if(a==="f"){n.preventDefault(),e.insertNote("footnote");return}if(a==="d"){n.preventDefault(),e.insertNote("endnote");return}}let r=n.metaKey||n.ctrlKey,o=ky[n.key];if(o){let a=o;n.key==="Home"||n.key==="End"?r&&(a=n.key==="Home"?"documentStart":"documentEnd"):(n.key==="ArrowLeft"||n.key==="ArrowRight")&&(n.altKey||n.ctrlKey)?a=n.key==="ArrowLeft"?"wordLeft":"wordRight":n.metaKey&&(n.key==="ArrowLeft"||n.key==="ArrowRight")?a=n.key==="ArrowLeft"?"lineStart":"lineEnd":r&&(n.key==="ArrowUp"||n.key==="ArrowDown")&&(a=n.key==="ArrowUp"?"documentStart":"documentEnd"),e.navigate(a,n.shiftKey),n.preventDefault();return}if(n.key==="PageUp"||n.key==="PageDown"){e.navigate(r?n.key==="PageUp"?"documentStart":"documentEnd":n.key==="PageUp"?"pageUp":"pageDown",n.shiftKey),n.preventDefault();return}if(n.key==="Backspace"){r||n.altKey?e.deleteWordBackward():e.deleteBackward(),n.preventDefault();return}if(n.key==="Delete"){r||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"){r?e.insertPageBreak():n.shiftKey?e.insertLineBreak():e.exitListOnEmptyItem()||e.splitParagraph(),n.preventDefault();return}if(r&&n.key.toLowerCase()==="a"){e.selectAll(),n.preventDefault();return}if(r&&!n.shiftKey&&n.key.toLowerCase()==="k"&&t.onRequestHyperlink){t.onRequestHyperlink(),n.preventDefault();return}if(r&&!n.shiftKey&&Cf[n.key.toLowerCase()]){let a=Cf[n.key.toLowerCase()];e.toggleRunProperty(a.localName,a.attributes),n.preventDefault();return}if(r&&(n.key==="="||n.key==="+"||n.code==="Equal")){e.toggleRunProperty("vertAlign",{val:n.shiftKey?"superscript":"subscript"}),n.preventDefault();return}if(r&&n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("decrease"),n.preventDefault();return}if(r&&!n.shiftKey&&n.key.toLowerCase()==="m"){e.adjustIndent("increase"),n.preventDefault();return}if(r&&!n.shiftKey&&Tf[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:Tf[n.key.toLowerCase()]}),n.preventDefault();return}if(r&&!n.shiftKey&&Pf[n.key]){e.setParagraphProperty("spacing",{line:Pf[n.key],lineRule:"auto"},{mergeAttributes:true}),n.preventDefault();return}if(r&&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 Of(e,t){return {onCopy:a=>{let s=e.selectedText();s&&(a.clipboardData?.setData("text/plain",s),a.preventDefault());},onCut:a=>{let s=e.selectedText();s&&(a.clipboardData?.setData("text/plain",s),e.deleteSelection(),a.preventDefault());},onPaste:a=>{let s=Ns(a.clipboardData);a.preventDefault(),s&&t(s);}}}function Rf(e){let t=Ns(e.dataTransfer);return t.length>0?t:null}function Ff(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??Rf(n);if(!r)return;Cy(e,Ty(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=Rf(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function wy(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 Ty(e){if(typeof e.getTargetRanges!="function")return null;let t=e.getTargetRanges();if(t.length!==1)return null;let n=t[0],r=wy(n);return r?{text:r,paragraphId:Py(n)}:null}function Py(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 Cy(e,t,n){if(t!==null){e.flushPendingInput();let r=e.state(),o=r.selection.head,a=t.text;if(Rt(r.selection,Oe(o))&&o.offset>=a.length&&(t.paragraphId===null||t.paragraphId===o.paragraphId)&&r.pendingFormat===null){let s=Qt(e.session,o.paragraphId)??e.session.part(),l=Of$1(s,o.paragraphId);l!==null&&l.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 Af(e,t,n,r=null){for(let o of Ds(e)){let a=wf(o,t,n,r);if(a!==null)return a}return null}function Mf(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),s=[];return t.length-o>r&&s.push({op:"deleteText",paragraphId:e,start:r,end:t.length-o}),a.length>0&&s.push({op:"insertText",paragraphId:e,offset:r,text:a}),s.length===0?null:{ops:s,caret:r+a.length}}function _s(e){let{session:t,measurer:n,producer:r,cache:o,styleCascade:a,numberingIndex:s,defaultTabStopPt:l,displayMode:d,inlineDrawingLayoutForPart:u,drawingLayoutTokenForPart:m,drawingTokenForParagraphForPart:I}=e,v=new WeakMap,w=null,C=-1;function F(W){let q=t.packageRevision();return (!w||C!==q)&&(w=Oy(t.currentPackage()),C=q),w.get(W)}function T(W,q,A){let $=m?.(W.name)??"",x=A?.height??0,E=A?.margin.top??0,V=A?.margin.bottom??0,k=A?.margin.left??0,R=A?.margin.right??0,G=s?.(),U=a?.(),ee=v.get(W);if(ee&&ee.width===q&&ee.pageHeight===x&&ee.marginTop===E&&ee.marginBottom===V&&ee.marginLeft===k&&ee.marginRight===R&&ee.producer===r&&ee.drawingLayoutToken===$&&ee.numberingIndex===G&&ee.styleCascade===U)return ee.story;let fe=u?.(W.name),ke=Uc$1(W,q,n,r,o,U,void 0,void 0,l,d,fe,I?pe=>I(W.name,pe):void 0,void 0,A?{pageNumber:1,pageWidth:A.width,pageHeight:A.height,marginLeft:A.margin.left,marginRight:A.margin.right,marginTop:A.margin.top,marginBottom:A.margin.bottom}:void 0,t.documentProperties(),G?{numberingIndex:G}:void 0),ye=F(W.name),be=ye?Lf(ke,ye):ke;return v.set(W,{width:q,pageHeight:x,marginTop:E,marginBottom:V,marginLeft:k,marginRight:R,producer:r,drawingLayoutToken:$,numberingIndex:G,styleCascade:U,story:be}),be}function K(W,q,A){let $=new Map;for(let[x,E]of W)$.set(x,T(E,q,A));return $}function h(W,q){if(!W||W.headers.size===0&&W.footers.size===0)return;let A=q.width-q.margin.left-q.margin.right;return {titlePage:W.titlePage,evenAndOddHeaders:W.evenAndOddHeaders,headers:K(W.headers,A,q),footers:K(W.footers,A,q)}}function _(){let W=cd(t.part(),d),q=t.headerFooterPartsBySection();return W.map((A,$)=>h(q[$],ed(A.properties)))}function L(){let W=_();return W[W.length-1]}return {furniture:L,sectionFurniture:_}}var Ry="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",Ey="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function Oy(e){let t=new Map,n=e.relationships.get(e.mainDocumentPart)??[];for(let r of n){if(r.type!==Ry&&r.type!==Ey)continue;let o=E(r);if(o.mode!=="Internal"||!o.target.ok)continue;let a=o.target.partName;t.has(a)||t.set(a,r.id);}return t}function Lf(e,t){return e.rId===t?e:{...e,rId:t,withPageContext:n=>Lf(e.withPageContext(n),t)}}function Nf(e){let t,n,r,o;return {styleCascade(){let a=e.stylesRoot();return (o===void 0||a!==r)&&(r=a,o=Gb(a,e.documentThemeFonts())),o},defaultTabStopPt:Ra$2(e.settingsRoot()),numberingIndex(){let a=e.numberingRoot();return (n===void 0||a!==t)&&(t=a,n=gc(a)),n}}}function It(e){return e.closest(".docx-editor__scroll-container")}function Df(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 Hf(e,t,n){let r=It(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=Df(e,r,n),a=o.top+o.height/2;for(let s of t.pages)if(a<s.box.y+s.box.height)return s.index+1;return t.pages.length}function _f(e,t,n,r){let o=It(e);if(!o||o.clientHeight===0)return;let a=Df(e,o,r),s=[];for(let l of [n.anchor,n.head]){let d=_d(t,l);d&&s.push(d.pageIndex);}return Qd({layout:t,viewport:a,overscanPages:1,pinnedPages:s})}function Bs(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 Fa(e,t){let n=e.pages,r=n[n.length-1],o=r?r.box.y+r.box.height:0,a=t?n.filter(u=>t.has(u.index)):n,s=0;for(let u of a){let m=u.box.x+u.box.width;m>s&&(s=m);}let l=new Set(a.map(u=>u.box.width)),d=new Map;if(a.length>0&&l.size>1)for(let u of n)d.set(u.index,(s-u.box.width)/2-u.box.x);return {width:s,height:o,pageOffsetX:d}}function Bf(e,t){if(e.width!==t.width||e.height!==t.height||e.pageOffsetX.size!==t.pageOffsetX.size)return false;for(let[n,r]of e.pageOffsetX)if(t.pageOffsetX.get(n)!==r)return false;return true}function qf(e){let t=e.session.currentPackage(),n=_d$1(t,"footnote"),r=_d$1(t,"endnote");if(!n&&!r)return;let o=e.session.part();if($d(o).length===0)return;let a=Id(t),s=Jd(a),l=Kd$1(a),d=Ld(void 0,s),u=Md(void 0,l),m=dd(o),I=m.sections,v=Fy(o,I,m.truncated),w=I.map((h,_)=>Ld(Gd(v[_]),s)),C=I.map((h,_)=>Md(Hd(v[_]),l)),F=e.inlineDrawingLayoutForPart,T=e.drawingTokenForParagraphForPart,K=F?h=>{let _=F(h);if(_)return {inlineDrawingLayout:_,...T?{drawingTokenForParagraph:L=>T(h,L)}:{}}}:void 0;return {footnotesPart:n,endnotesPart:r,footnotePropsBySection:w.length>0?w:[d],endnotePropsBySection:C.length>0?C:[u],documentFootnoteProps:d,documentEndnoteProps:u,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade?.(),numberingIndex:e.numberingIndex?.(),defaultTabStopPt:e.defaultTabStopPt,...K?{drawingsForPart:K}:{},...K&&e.drawingLayoutEpochForPart?{drawingLayoutEpoch:[n,r].map(h=>h?e.drawingLayoutEpochForPart(h.name):"").join("\0")}:{}}}function Fy(e,t,n){let r=Ob$2(e);if(!n)return t.map(a=>{if(a.blockStart===a.blockEndExclusive)return;let s=r[a.blockEndExclusive-1];return s?.kind==="paragraph"?ad(s):void 0});let o=[];for(let a=0;a<r.length;a+=1){let s=r[a];if(s.kind!=="paragraph")continue;let l=ad(s);l&&o.push(l);}for(;o.length<t.length;)o.push(void 0);return o}function zf(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}),s=await t.createImageBitmap(a);try{let l=s.width,d=s.height;if(l<=0||d<=0)throw new Error("image dimensions invalid");if(l*d>o.maxPixels)throw new Error("image dimensions exceed limits");return Object.freeze({pixelWidth:l,pixelHeight:d,dpiX:96,dpiY:96})}finally{s.close();}},convertPreserved(n,r,o){return r==="image/tiff"?Ly(e,n,o):Ay(n,r)}})}async function Ay(e,t,n){let{convertEmfToDataUrl:r,convertWmfToDataUrl:o}=await import('emf-converter'),a=new Uint8Array(e),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),l={maxWidth:4096,maxHeight:4096},d=t==="image/x-emf"?await r(s,l):await o(s,l);if(!d)return null;let u="data:image/png;base64,";if(!d.startsWith(u))return null;let m=atob(d.slice(u.length)),I=new Uint8Array(m.length);for(let v=0;v<m.length;v+=1)I[v]=m.charCodeAt(v);return Object.freeze({bytes:I,mime:"image/png"})}function Zf(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 My(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 s=Zf(a,"t256"),l=Zf(a,"t257");if(s===null||l===null||s>t.maxDimension||l>t.maxDimension||s>t.maxPixels/l)return null;let d=s*l;if(d*4>t.maxDecodedBytes||(r.decodeImage(o,a),a.width!==s||a.height!==l))return null;let u=r.toRGBA8(a);return u.length!==d*4?null:Object.freeze({rgba:u,pixelWidth:s,pixelHeight:l})}async function Ly(e,t,n){let r=await My(t,n);if(r===null)return null;let o=await Ny(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function Ny(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 s=a.createImageData(n,r);s.data.set(t),a.putImageData(s,0,0);let l=await new Promise(d=>{o.toBlob(u=>d(u),"image/png");});return l?new Uint8Array(await l.arrayBuffer()):null}function Kf(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function Vf(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 Dy="docx-editor-one-surface__caret",qs="docx-editor-one-surface__caret--steady",Hy=530;function jf(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=Dy,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,s=null,l=null,d=null;function u(){let h=r.activeElement;return h===e||!!h&&e.contains(h)}function m(h){return h.anchor.paragraphId===h.head.paragraphId&&h.anchor.offset===h.head.offset}function I(){l=null,s!==null&&(clearTimeout(s),s=null),o.classList.remove(qs),o.remove(),e.style.removeProperty("caret-color"),d?.style.removeProperty("caret-color"),d=null;}function v(){o.classList.add(qs),s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,o.classList.remove(qs);},Hy);}function w(){if(a||!u()||n().suppress){I();return}let{layout:h,selection:_,scopedHost:L,scopedHostKind:W,preferredPageIndex:q,measurer:A}=n(),$=t();if(!m(_)){I();return}let x=_d(h,_.head,{...A?{measurer:A}:{},...q!==void 0?{preferredPageIndex:q}:{}});if(!x||!Number.isInteger(x.pageIndex)){I();return}let E=L??e.querySelector(`[data-page-index="${x.pageIndex}"] > .docx-page-content`);if(!E){I();return}o.style.left=`${x.x*$}px`,o.style.top=`${x.y*$}px`,o.style.height=`${x.height*$}px`,o.parentNode!==E&&E.append(o),e.style.caretColor="transparent",d&&d!==L&&d.style.removeProperty("caret-color"),d=L??null,d?.style.setProperty("caret-color","transparent");let V=E===L?W??"scoped":"body",k=`${x.pageIndex}:${V}:${x.x}:${x.y}:${x.height}`;k!==l&&(l=k,v());}let C=()=>{a=true,w();},F=()=>{a=false,w();},T=()=>w(),K=h=>{let _=h.relatedTarget;_&&e.contains(_)||I();};return e.addEventListener("compositionstart",C),e.addEventListener("compositionend",F),e.addEventListener("focusin",T),e.addEventListener("focusout",K),{update:w,destroy(){e.removeEventListener("compositionstart",C),e.removeEventListener("compositionend",F),e.removeEventListener("focusin",T),e.removeEventListener("focusout",K),I();}}}function Zs(e){let t=e.indexOf("#");return t===-1?"":e.slice(0,t)}function Kn(e,t){let n=Zs(t);return n.length===0?e.part():e.currentPackage().parts.get(n)??e.part()}function zs(e,t){return !e||e.kind==="tableBody"?null:Zs(e.tableId)===Zs(t)?e:null}function ko(e,t,n){let r=s=>{for(let l of s)if(l.kind==="table"){if(l.tableId===t)return l;for(let d of l.rows)for(let u of d.cells){let m=r(u.blocks);if(m)return m}}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 s of [o.header,o.footer]){if(!s)continue;let l=r(s.fragments);if(l)return {table:l,origin:s.box}}return null}function Ks(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)Ks(o.blocks,t);}}function _y(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});};Ks(n.fragments,r);for(let o of [n.header,n.footer])o&&Ks(o.fragments,r);}}function Vs(e,t,n,r){let o=null;return _y(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function js(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function Uf(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function Wf(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function Gf(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var By=120,$f=20;function Aa(e){let t=wf$1(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function qy(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Us(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function Ws(e,t){return t.kind==="insertColumn"?Vs(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Vs(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function Xf(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,s=null,l=null,d=false,u=0,m=0,I=null,v=null,w=null;function C(b){return b instanceof HTMLButtonElement&&(b.classList.contains("docx-table-insert-row")||b.classList.contains("docx-table-insert-column"))}function F(){let b=document.activeElement;return b!==null&&C(b)&&b.closest(".docx-table-furniture")===t?b:null}function T(b){for(let P of [...t.children])C(P)&&P!==b&&P.remove();}function K(){v=null,w=null;}function h(){n!==null&&(clearTimeout(n),n=null);}function _(){for(let P of [...t.children])C(P)||P.remove();let b=F();if(!b){T(null),K();return}v=b,T(b);}function L(b){let P=v??F(),N=P!==null&&document.activeElement===P;K(),t.replaceChildren(),b&&N&&e.pagesLayer.focus({preventScroll:true});}function W(){for(let b of [...t.children])C(b)||b.remove();}function q(b,P,N,j){let z=e.read().layout.pages[b];if(!z)return {left:0,top:0};let ne=j??z.contentBox,le=e.scale(),ge=e.pageOffsetX(b);return {left:(ne.x+P+ge)*le,top:(ne.y+N)*le}}function A(b,P){let N=e.read(),j=ko(N.layout,P.tableId,P.pageIndex);if(!j)return;let{table:te,origin:z}=j,ne=document.createElement("div");ne.className="docx-table-resize-preview",ne.style.position="absolute",ne.style.pointerEvents="none";let le=P.kind!=="rowDivider",ge=q(P.pageIndex,le?te.box.x+b:te.box.x,le?te.box.y:te.box.y+b,z);ne.style.left=`${ge.left}px`,ne.style.top=`${ge.top}px`,ne.style.width=le?"2px":`${te.box.width*e.scale()}px`,ne.style.height=le?`${te.box.height*e.scale()}px`:"2px",t.append(ne);}function $(){let b=document.createElement("button");return b.type="button",b.textContent="+",b.style.position="absolute",b.style.pointerEvents="auto",b}function x(b){R(b);let P=w;if(!P)return;let N=e.read();P.kind==="insertRow"?U(P,N):P.kind==="insertColumn"&&ee(P,N);}function E(){queueMicrotask(()=>{!v||document.activeElement===v||d||r?.kind==="insertRow"||r?.kind==="insertColumn"||(v.remove(),K());});}function V(){if(v&&t.contains(v))return v;let b=F();if(b)return v=b,b;let P=$();return P.addEventListener("pointerenter",()=>{d=true,h();}),P.addEventListener("pointerleave",()=>{d=false;}),P.addEventListener("pointerdown",R),P.addEventListener("mousedown",R),P.addEventListener("click",x),P.addEventListener("blur",E),v=P,P}function k(b,P){let N=ko(P.layout,b.tableId,b.pageIndex);if(!N)return;let{table:j,origin:te}=N,z=V();if(T(z),w=b,z.dataset.tableId=b.tableId,b.kind==="insertRow"){let ne=j.rows.find(Me=>Me.id===b.rowId);if(!ne)return;z.dataset.rowId=b.rowId,delete z.dataset.gridColumnId,z.className="docx-table-insert-row",z.setAttribute("aria-label",e.label("table.insertRowBelow"));let le=ne.box.y+ne.box.height/2,ge=q(b.pageIndex,j.box.x-14,le,te);z.style.left=`${ge.left}px`,z.style.top=`${ge.top-8}px`;}else {let ne=j.rows[0]?.cells.find(ot=>ot.gridColumnId===b.gridColumnId);if(!ne)return;z.dataset.gridColumnId=b.gridColumnId,delete z.dataset.rowId;let le=j.columnEdges[ne.gridColumn]??0,ge=j.columnEdges[ne.gridColumn+1]??j.box.width;z.className="docx-table-insert-column",z.setAttribute("aria-label",e.label("table.insertColumnRight"));let Me=q(b.pageIndex,j.box.x+(le+ge)/2-8,j.box.y-14,te);z.style.left=`${Me.left}px`,z.style.top=`${Me.top}px`;}t.contains(z)||t.append(z);}function R(b){b.preventDefault(),b.stopPropagation();}function G(b,P){if(W(),T(v??F()),!(l||P.editingMode==="view")){if((b.kind==="columnDivider"||b.kind==="rightEdge")&&!b.isHeaderRepeat){let N=ko(P.layout,b.tableId,b.pageIndex);if(!N)return;let{table:j,origin:te}=N,z=document.createElement("div");z.className=b.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",z.style.position="absolute",z.style.pointerEvents="auto",z.style.cursor="col-resize",z.dataset.active="true";let ne=q(b.pageIndex,j.box.x+b.edgeX,j.box.y,te);z.style.left=`${ne.left-3}px`,z.style.top=`${ne.top}px`,z.style.width="6px",z.style.height=`${j.box.height*e.scale()}px`,z.addEventListener("pointerdown",fe),t.append(z);}if(b.kind==="rowDivider"&&!b.isHeaderRepeat){let N=ko(P.layout,b.tableId,b.pageIndex);if(!N)return;let{table:j,origin:te}=N,z=document.createElement("div");z.className="docx-table-row-divider-handle layout-table-row-resize-handle",z.style.position="absolute",z.style.pointerEvents="auto",z.style.cursor="row-resize",z.dataset.active="true";let ne=q(b.pageIndex,j.box.x,j.box.y+b.edgeY,te);z.style.left=`${ne.left}px`,z.style.top=`${ne.top-3}px`,z.style.width=`${j.box.width*e.scale()}px`,z.style.height="6px",z.addEventListener("pointerdown",fe),t.append(z);}b.kind==="insertRow"&&!b.isHeaderRepeat&&k(b,P),b.kind==="insertColumn"&&!b.isHeaderRepeat&&k(b,P);}}function U(b,P){let N=Ws(P.layout,b);if(!N)return;let j=Us(P),te=cn({command:{type:"insertRow",where:"below",target:js(b.sourceRevision,N)},part:Kn(e.session(),b.tableId),layout:P.layout,storeRevision:P.storeRevision,selection:P.selection,cellSelection:P.cellSelection,themeColors:P.themeColors,...j});e.applyTableCommandPlan(te);}function ee(b,P){let N=Ws(P.layout,b);if(!N)return;let j=N.row.cells.find(le=>le.gridColumnId===b.gridColumnId);if(!j)return;let te=Uf(b.sourceRevision,N,j);if(!te)return;let z=Us(P),ne=cn({command:{type:"insertColumn",where:"right",target:te},part:Kn(e.session(),b.tableId),layout:P.layout,storeRevision:P.storeRevision,selection:P.selection,cellSelection:P.cellSelection,themeColors:P.themeColors,...z});e.applyTableCommandPlan(ne);}function fe(b){if(b.button!==0)return;let P=e.read();if(P.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;b.preventDefault(),b.stopPropagation();let N=r,j=Ws(P.layout,N);if(!j)return;let te=xf$1(Kn(e.session(),N.tableId).root,N.tableId);if(!te.ok||N.kind!=="rowDivider"&&te.topology.hasMerge)return;let z=0,ne=0,le=0,ge=te.topology.gridColumns.reduce((Le,We)=>Le+Aa(We),0),Me;if(N.kind==="columnDivider"){let Le=te.topology.gridColumns.find(Ce=>Ce.id===N.leftGridColumnId),We=te.topology.gridColumns.find(Ce=>Ce.id===N.rightGridColumnId);if(!Le||!We)return;z=Aa(Le),ne=Aa(We),Me=Wf(N.sourceRevision,j,N.leftGridColumnId,N.rightGridColumnId);}else if(N.kind==="rightEdge"){let Le=te.topology.gridColumns.find(We=>We.id===N.gridColumnId);if(!Le)return;z=Aa(Le),ne=0,Me=Gf(N.sourceRevision,j,N.gridColumnId);}else le=Math.max(20,Math.round(j.row.box.height*$f)),Me=js(N.sourceRevision,j);let ot=b.currentTarget;ot.setPointerCapture(b.pointerId),u=b.clientX,m=b.clientY,l={pointerId:b.pointerId,startClientX:b.clientX,startClientY:b.clientY,startEdgePt:N.kind==="rowDivider"?N.edgeY:N.edgeX,leftTwips:z,rightTwips:ne,tableWidthTwips:ge,rowHeightTwips:le,target:N,ref:j,resizeTarget:Me,captureElement:ot,rightEdge:N.kind==="rightEdge",vertical:N.kind==="rowDivider",cancelled:false};for(let Le of [...t.children])Le!==ot&&Le.remove();A(N.kind==="rowDivider"?N.edgeY:N.edgeX,N);}function ke(){if(l){try{l.captureElement.hasPointerCapture(l.pointerId)&&l.captureElement.releasePointerCapture(l.pointerId);}catch{}l.cancelled=true,l=null,_(),r=null;}}function ye(){if(!l||l.cancelled){l=null,_();return}let b=l;l=null;try{b.captureElement.hasPointerCapture(b.pointerId)&&b.captureElement.releasePointerCapture(b.pointerId);}catch{}if(b.vertical?m===b.startClientY:u===b.startClientX){_();return}let P=e.read(),N=Us(P),j=(b.vertical?m-b.startClientY:u-b.startClientX)/e.scale(),te=Math.round(j*$f),z;if(b.target.kind==="rowDivider")z=vu({part:Kn(e.session(),b.target.tableId),layout:P.layout,storeRevision:P.storeRevision,selection:P.selection,cellSelection:P.cellSelection,themeColors:P.themeColors,...N},b.resizeTarget,Math.max(20,b.rowHeightTwips+te));else if(b.rightEdge&&b.target.kind==="rightEdge"){let ne=Math.max(300,b.leftTwips+te),le=Math.max(ne,b.tableWidthTwips+te);z=cn({command:{type:"commitTableRightEdgeResize",target:b.resizeTarget,columnWidthTwips:ne,tableWidthTwips:le},part:Kn(e.session(),b.target.tableId),layout:P.layout,storeRevision:P.storeRevision,selection:P.selection,cellSelection:P.cellSelection,themeColors:P.themeColors,...N});}else if(b.target.kind==="columnDivider"){let ne=b.leftTwips+te,le=b.rightTwips-te;ne=Math.max(300,ne),le=Math.max(300,le);let ge=b.leftTwips+b.rightTwips;ne+le!==ge&&(ne>ge-300?(ne=ge-300,le=300):le=ge-ne),z=cn({command:{type:"commitTableColumnDividerResize",target:b.resizeTarget,leftWidthTwips:ne,rightWidthTwips:le},part:Kn(e.session(),b.target.tableId),layout:P.layout,storeRevision:P.storeRevision,selection:P.selection,cellSelection:P.cellSelection,themeColors:P.themeColors,...N});}else {_();return}e.applyTableCommandPlan(z),_();}function be(b){if(!o||!I)return null;let P=e.pageOffsetX(I.pageIndex);return Nc(o,I.x,I.y,b.layout,P,I.pageIndex)}function pe(b){if(!r||l||b.editingMode==="view")return;h();let P=be(b),N=zs(P,b.selection.head.paragraphId);if(!N){r=null,_();return}if(Lc(N)!==Lc(r)){r=null,_();return}r=N,G(N,b);}function Ue(){let b=v??F(),P=b!==null&&document.activeElement===b;K(),b&&t.contains(b)&&b.remove(),P&&e.pagesLayer.focus({preventScroll:true});}function Ft(b){if(l||b.editingMode==="view")return;let P=v??F();if(!P||!t.contains(P)){w&&K();return}if(v=P,!w||w.kind!=="insertRow"&&w.kind!=="insertColumn")return;if(!o){Ue();return}let N=Lc(w),j=Mc(o,w);if(!j||Lc(j)!==N){Ue();return}w=j,k(j,b);}function Ee(b){let P=e.read();if(l&&b.pointerId===l.pointerId){u=b.clientX,m=b.clientY;let le=(l.vertical?b.clientY-l.startClientY:b.clientX-l.startClientX)/e.scale();for(let ge of [...t.children])ge!==l.captureElement&&ge.remove();A(l.startEdgePt+le,l.target);return}if(P.editingMode==="view"){L(false);return}let N=qy(e,b.clientX,b.clientY),j=zc(P.layout,N.y);j>=0&&(I={x:N.x,y:N.y,pageIndex:j});let te=j>=0?e.pageOffsetX(j):0,z=o?Nc(o,N.x,N.y,P.layout,te,j>=0?j:void 0):null,ne=zs(z,P.selection.head.paragraphId);if(!ne){if(d)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,_();},By));return}n&&(clearTimeout(n),n=null),!(r&&Kc$2(ne)===Kc$2(r))&&(r=ne,G(ne,P));}function ct(b){if(!(!l||b.pointerId!==l.pointerId)){if(e.read().editingMode==="view"){ke();return}ye();}}function D(b){!l||b.pointerId!==l.pointerId||ke();}function re(b){b.key!=="Escape"||!l||ke();}return e.pagesLayer.addEventListener("pointermove",Ee),document.addEventListener("pointermove",Ee),document.addEventListener("pointerup",ct),document.addEventListener("pointercancel",D),e.pagesLayer.addEventListener("keydown",re),{update(){let b=e.read(),P=a,N=s;o=Jc$1(b.layout),a=b.layout.revision,s=b.storeRevision,b.editingMode==="view"?(ke(),r=null,h(),L(true)):P!==null&&(P!==b.layout.revision||N!==b.storeRevision)&&(r!==null&&pe(b),Ft(b)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let b=e.read();if(b.editingMode==="view")return;let P=v??F();if(P&&t.contains(P)&&w&&(w.kind==="insertRow"||w.kind==="insertColumn")){k(w,b);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&k(r,b);},destroy(){h(),ke(),K(),_(),e.pagesLayer.removeEventListener("pointermove",Ee),document.removeEventListener("pointermove",Ee),document.removeEventListener("pointerup",ct),document.removeEventListener("pointercancel",D),e.pagesLayer.removeEventListener("keydown",re),t.remove();}}}function Gs(e,t){let n=(r,o)=>{for(let a of r){if(a.kind==="paragraph"){t(a,o);continue}for(let s of a.rows)if(!s.isHeaderRepeat)for(let l of s.cells)n(l.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 $s(e,t,n){e.has(t.paragraphId)||e.set(t.paragraphId,n);for(let r of t.lines)for(let o of uc(r))e.has(o.paragraphId)||e.set(o.paragraphId,n);}var Yf=new WeakMap,Qf=new WeakMap;function Zy(e){let t=Qf.get(e);if(t)return t;let n=new Map;return Gs(e,r=>$s(n,r,r.props)),Qf.set(e,n),n}function Sr(e,t){let n=Yf.get(e);if(!n){n=new Map;for(let r of e.pages)for(let[o,a]of Zy(r))n.has(o)||n.set(o,a);Yf.set(e,n);}return n.get(t)??[]}var Jf=new WeakMap;function zy(e){let t=Jf.get(e);if(t)return t;let n=new Map;return Gs(e,r=>$s(n,r,r.tabStops)),Jf.set(e,n),n}function wo(e,t){let n=ep.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,s]of zy(o))r.has(a)||r.set(a,s);n=r,ep.set(e,r);}return n.get(t)??null}var ep=new WeakMap,tp=new WeakMap,np=new WeakMap;function Ky(e){let t=np.get(e);if(t)return t;let n=new Map;return Gs(e,(r,o)=>$s(n,r,{indent:r.indent,inTable:o})),np.set(e,n),n}function Vy(e,t){let n=tp.get(e);if(!n){let r=new Map;for(let o of e.pages)for(let[a,s]of Ky(o))r.has(a)||r.set(a,s);n=r,tp.set(e,r);}return n.get(t)??null}function Ma(e,t,n,r,o){let a=va$1(e,t);if(!a||a.kind!=="paragraph")return [];let s=[],l=pg$1(a),d=qg$1(a);return Ob$1(a.children,0,u=>{if(u.kind!=="run")return;let m=l.get(u.id);if(!m||m.end<=m.start)return;let I=Math.max(m.start,n),v=Math.min(m.end,r);if(I>=v)return;let w=kg$1(jg$1(u,"runProperties","rPr"),hg$1);s.push({start:I,end:v,properties:ng$1(w,rg$1(w,o)),...d.has(u.id)?{targetRunIds:[u.id]}:{}});}),s}function rp(e,t,n,r){let o=va$1(e,t);if(!o||o.kind!=="paragraph")return false;let a=pg$1(o),s=false,l=d=>{if(s||d.kind!=="run")return;let u=a.get(d.id);!u||u.end<=u.start||Math.max(u.start,n)>=Math.min(u.end,r)||kg$1(jg$1(d,"runProperties","rPr"),hg$1).length>0&&(s=true);};return Ob$1(o.children,0,l),s}function op(e,t,n){let r=va$1(e,t);if(!r||r.kind!=="paragraph")return [];let o=pg$1(r),a=null,s=null,l=u=>{if(u.kind!=="run")return;let m=o.get(u.id);!m||m.end<=m.start||(m.start<n&&n<=m.end&&(a=u),s===null&&m.start<=n&&n<m.end&&(s=u));};Ob$1(r.children,0,l);let d=a??s;return d?kg$1(jg$1(d,"runProperties","rPr"),hg$1):mg$1(e,t)}function xr(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 ap(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:xr(t,"b")===true};break;case "i":n={...n,italic:xr(t,"i")===true};break;case "u":n={...n,underline:xr(t,"u")===true};break;case "strike":n={...n,strikethrough:xr(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 ip(e,t,n,r){return n&&n.length>0?je(e,n):fe$1(e,t,r??tc(e))}function Xs(e,t,n,r,o,a){let s=ip(e,t,r,a);if(s.length===0)return false;let l=d=>{switch(n){case "b":return d.style.bold;case "i":return d.style.italic;case "u":return d.style.underline!==null;case "strike":return d.style.strike;case "vertAlign":return d.style.verticalAlign===o;default:return false}};return s.every(l)}function sp(e,t,n,r,o,a){let s=ip(e,t,r,a),l=s.map(R=>R.style),d=R=>{if(l.length===0)return null;let G=R(l[0]);return l.every(U=>R(U)===G)?G:null},u=(R,G=(U,ee)=>U===ee)=>R.length>0&&R.every(U=>G(U,R[0]))?R[0]:null,m=(R,G)=>R.props.some(U=>U.localName===G),I=R=>R.style.fontFamily??n?.(R.range.paragraphId,R.props).fontFamily??null,v=R=>m(R,"sz")?Math.round(R.style.fontSizePt*2):n?.(R.range.paragraphId,R.props).fontSizeHalfPoints??Math.round(R.style.fontSizePt*2),w=s.length===0?n?.(t.head.paragraphId,[]):void 0,C=jy(e,t,r,a),F=R=>u(C.map(G=>R(Sr(e,G)))),T=(R,G=(U,ee)=>U===ee)=>{if(C.length<2)return false;let U=R(Sr(e,C[0]));return C.some((ee,fe)=>fe>0&&!G(R(Sr(e,ee)),U))},K=F(R=>Cb$1(R)),h=F(R=>qa$1(R,"pStyle")?.val??o??void 0)??null,_=R=>qa$1(R,"spacing")??void 0,L=R=>{let G=_(R),U=Number(G?.line);if(!Number.isFinite(U))return "";let ee=G?.lineRule??"auto";return ee==="auto"?`multiple:${Math.round(U/240*100)/100}`:`${ee==="exact"?"exact":"atLeast"}:${Math.round(U/20*100)/100}`},W=F(L),q=(()=>{if(!W)return null;let[R,G]=W.split(":");return {rule:R,value:Number(G)}})(),A=(R,G)=>{let U=Number(_(R)?.[G]);return Number.isFinite(U)?Math.round(U/20*100)/100:null},$=R=>F(G=>A(G,R)),x=(()=>{let R=C.map(pe=>Vy(e,pe)),G=R[0];if(!G||R.some(pe=>pe===null||pe.inTable))return null;let U=pe=>Math.round(pe*20),ee=pe=>U(pe.hanging>0?-pe.hanging:pe.firstLine),fe=R,ke=U(G.indent.left),ye=U(G.indent.right),be=ee(G.indent);return {left:ke,right:ye,firstLine:be,mixed:{left:fe.some(pe=>U(pe.indent.left)!==ke),right:fe.some(pe=>U(pe.indent.right)!==ye),firstLine:fe.some(pe=>ee(pe.indent)!==be)}}})(),E=R=>F(G=>R(Lb$1(G))),V=F(ja$1),k=F(ua);return {bold:l.length>0&&l.every(R=>R.bold),italic:l.length>0&&l.every(R=>R.italic),underline:l.length>0&&l.every(R=>R.underline!==null),strikethrough:l.length>0&&l.every(R=>R.strike),superscript:l.length>0&&l.every(R=>R.verticalAlign==="superscript"),subscript:l.length>0&&l.every(R=>R.verticalAlign==="subscript"),fontFamily:s.length>0?u(s.map(I)):w?.fontFamily??null,fontSizeHalfPoints:s.length>0?u(s.map(v)):w?.fontSizeHalfPoints??null,color:d(R=>R.color),highlight:d(R=>R.highlight),alignment:K,styleId:h,lineSpacing:q,spaceBeforePt:$("before"),spaceAfterPt:$("after"),disagrees:{alignment:T(R=>Cb$1(R)),spaceBeforePt:T(R=>A(R,"before")),spaceAfterPt:T(R=>A(R,"after")),lineSpacing:T(L),tabStops:(()=>{if(C.length<2)return false;let R=JSON.stringify(wo(e,C[0])?.stops??null);return C.some((G,U)=>U>0&&JSON.stringify(wo(e,G)?.stops??null)!==R)})()},indent:x,tabStops:u(C.map(R=>wo(e,R)?.stops??null),(R,G)=>R===null||G===null?R===G:R.length===G.length&&R.every((U,ee)=>Math.round(U.positionPt*20)===Math.round(G[ee].positionPt*20)&&U.alignment===G[ee].alignment&&(U.leader??"none")===(G[ee].leader??"none")))?.map(R=>({positionTwips:Math.round(R.positionPt*20),alignment:R.alignment,...R.leader?{leader:R.leader}:{}}))??null,paragraphFlags:{contextualSpacing:k,keepNext:E(R=>R.keepNext),keepLines:E(R=>R.keepLines),widowControl:E(R=>R.widowControl),pageBreakBefore:V}}}function jy(e,t,n,r){if(n&&n.length>0)return [...ie(e,n)];if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let o=r??tc(e),a=o.indexOf(t.anchor.paragraphId),s=o.indexOf(t.head.paragraphId);return a===-1||s===-1?[t.head.paragraphId]:o.slice(Math.min(a,s),Math.max(a,s)+1)}function lp(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 dp(e){let{session:t,commit:n,orderedRange:r,selectionMark:o,textOf:a}=e,s=()=>t.partFor(e.storyScope())??t.part(),l=(C,F,T)=>t.applyTreeOps(C,F,T,e.storyScope()),d={get value(){return e.layout()}},u={get value(){return e.selection()}},m=(C,F,T)=>{let K=s();if(C.paragraphId===F.paragraphId){let q=Ma(K,C.paragraphId,C.offset,F.offset,T);if(q.length===0)return;let A=sg$1(K,C.paragraphId,T);n(()=>l([...q.map($=>({op:"setRunProperties",paragraphId:C.paragraphId,start:$.start,end:$.end,properties:$.properties,...$.targetRunIds?{targetRunIds:$.targetRunIds}:{}})),...lp(a(C.paragraphId),C,F,A)],o()));return}let h=e.paragraphOrder(),_=h.indexOf(C.paragraphId),L=h.indexOf(F.paragraphId);if(_===-1||L===-1)return;let W=[];for(let q=_;q<=L;q+=1){let A=h[q],$=a(A),x=q===_?C.offset:0,E=q===L?F.offset:$.length,V=x<E?Ma(K,A,x,E,T):[];for(let R of V)W.push({op:"setRunProperties",paragraphId:A,start:R.start,end:R.end,properties:R.properties,...R.targetRunIds?{targetRunIds:R.targetRunIds}:{}});(q<L||x===0&&E===$.length&&$.length>0)&&W.push({op:"setParagraphMarkProperties",paragraphId:A,properties:sg$1(K,A,T)});}W.length!==0&&n(()=>l(W,o()));},I=(C,F)=>{let T=s(),K=[];for(let h of ie(d.value,C)){let _=a(h);for(let L of Ma(T,h,0,_.length,F))K.push({op:"setRunProperties",paragraphId:h,start:L.start,end:L.end,properties:L.properties,...L.targetRunIds?{targetRunIds:L.targetRunIds}:{}});K.push({op:"setParagraphMarkProperties",paragraphId:h,properties:sg$1(T,h,F)});}return K.length===0?false:(n(()=>l(K,o()),void 0,{keepCellSelection:true}),true)},v=C=>{ig$1(C.localName)&&e.setPendingFormats(ng$1(e.pendingFormats()??[],C));},w=C=>{if(C.length===0)return;let F=e.selectedCells?.(),T=F&&F.length>0?[...ie(d.value,F)]:null,{from:K,to:h}=r(),_=T??e.paragraphOrder(),L=T?0:_.indexOf(K.paragraphId),W=T?_.length-1:_.indexOf(h.paragraphId);if(L===-1||W===-1)return;let q=s(),A=_.slice(L,W+1).map($=>{let x=lg$1(q,$);for(let E of C){let V=E.mergeAttributes?{...x.find(R=>R.localName===E.localName)?.attributes??{},...E.attributes}:E.attributes??{},k=Object.fromEntries(Object.entries(V).filter(([,R])=>R!=null));x=ng$1(x,{localName:E.localName,...Object.keys(k).length>0?{attributes:k}:{}});}return {op:"setParagraphProperties",paragraphId:$,properties:x}});A.length!==0&&n(()=>l(A,o()),void 0,{keepCellSelection:T!==null});};return {setRunProperty(C,F){let T={localName:C,...F?{attributes:F}:{}},K=e.selectedCells?.();if(K&&K.length>0){I(K,T);return}let{from:h,to:_}=r();if(h.paragraphId===_.paragraphId&&h.offset===_.offset){v(T);return}m(h,_,T);},setParagraphProperty(C,F,T){w([{localName:C,...F?{attributes:F}:{},...T??{}}]);},setParagraphProperties:w,formatting:()=>ap(sp(d.value,u.value,(C,F)=>{let T=t.effectiveRunDefaults(C,F);if(T.fontFamily!==null)return T;let K=e.defaultFontFamily?.()??null;return K===null?T:{...T,fontFamily:K}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null,e.paragraphOrder()),e.pendingFormats()),toggleRunProperty(C,F){let T=e.selectedCells?.(),K=F?.val,h=xr(e.pendingFormats(),C,K)??Xs(d.value,u.value,C,T,K,e.paragraphOrder()),_=h?{localName:C,attributes:{val:Uy[C]??"0"}}:{localName:C,...F?{attributes:F}:{}};if(T&&T.length>0){I(T,_);return}let{from:L,to:W}=r();if(L.paragraphId===W.paragraphId&&L.offset===W.offset){let q=e.pendingFormats()??[],A=Xs(d.value,u.value,C,void 0,K,e.paragraphOrder());if(!h===A){let $=q.filter(x=>x.localName!==C);e.setPendingFormats($.length>0?$:null);}else v(_);return}m(L,W,_);},clearFormatting(){e.setPendingFormats(null);let C=d.value,F=e.paragraphOrder(),T=e.selectedCells?.(),K=T&&T.length>0?[...ie(C,T)]:Wy(F,r());if(K.length===0)return;let{from:h,to:_}=r(),L=T!==void 0&&T.length>0,W=s(),q=[];for(let A of K){let $=a(A),x=L||A!==h.paragraphId?0:h.offset,E=L||A!==_.paragraphId?$.length:_.offset;x<E&&rp(W,A,x,E)&&q.push({op:"setRunProperties",paragraphId:A,start:x,end:E,properties:[]}),mg$1(W,A).length>0&&q.push({op:"setParagraphMarkProperties",paragraphId:A,properties:[]}),lg$1(W,A).length>0&&q.push({op:"setParagraphProperties",paragraphId:A,properties:[]});}q.length!==0&&n(()=>l(q,o()),void 0,{keepCellSelection:L});}}}var Uy={u:"none",vertAlign:"baseline"};function Wy(e,t){let n=e.indexOf(t.from.paragraphId),r=e.indexOf(t.to.paragraphId);return n===-1||r===-1?[]:e.slice(n,r+1)}var Gy=500,cp=4,kr=40,La=12;function $y(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 up(e,t){return $y(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 Et(e,t,n){let r=sc(e),o=r.indexOf(t.paragraphId),a=r.indexOf(n.paragraphId);return o!==a?o-a:t.offset-n.offset}function gp(e,t,n){if(!(t>_b$1))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=_b$1)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)gp(a.blocks,t+1,n);}}}function Ys(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(s,l)=>{(!n||Et(e,s,n)<0)&&(n=s),(!r||Et(e,l,r)>0)&&(r=l);},a=t.level!=="inline";for(let s of t.fragments){let l=e.pages[s.pageIndex];l&&gp(l.fragments,0,d=>{if(up(s.box,d.box)){if(a){let u=ce$1(e,d.paragraphId).length;o({paragraphId:d.paragraphId,offset:0},{paragraphId:d.paragraphId,offset:u});return}for(let u of d.lines)for(let m of u.spans)up(s.box,m.box)&&o({paragraphId:m.range.paragraphId,offset:m.range.start},{paragraphId:m.range.paragraphId,offset:m.range.end});}});}return !n||!r?null:{from:n,to:r}}function Xy(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function fp(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=Ec(e,t.pageIndex,o);return a?.placeholder?a:null}let r=Xy(e,n);return r?.placeholder?r:null}function pp(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=Et(e,t.anchor,t.head)<=0?t.anchor:t.head,o=Et(e,t.anchor,t.head)<=0?t.head:t.anchor,a=true;for(;a;){a=false;for(let l of n){if(!l.placeholder)continue;let d=Ys(e,l);!d||!(Et(e,r,o)===0?Et(e,r,d.from)>=0&&Et(e,r,d.to)<0:Et(e,r,d.to)<0&&Et(e,o,d.from)>0)||(Et(e,d.from,r)<0&&(r=d.from,a=true),Et(e,d.to,o)>0&&(o=d.to,a=true));}}return Et(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}function mp(e,t={}){if(t.mode==="native")return {dragging:()=>false,destroy:()=>{}};let{pagesLayer:n,container:r}=e,o=n.ownerDocument,a=o.defaultView,s=null,l=null,d=0,u=0,m=0,I=0,v=null;function w(D,re){if(!l){let P=n.getBoundingClientRect();l={left:P.left,top:P.top};}let b=e.scale()||1;return {x:(D-l.left)/b,y:(re-l.top)/b}}function C(D){return {scope:{kind:"headerFooter",rId:D.rId},pageIndex:D.pageIndex,kind:D.kind,partName:D.partName,variant:D.variant}}function F(D,re){let b=e.layout(),P=w(D,re),N=zc(b,P.y),j=b.pages[N];if(!j)return null;let te=e.measurer();return Bc(b,N,{x:P.x-j.contentBox.x-e.pageOffsetX(N),y:P.y-j.contentBox.y},te?{measurer:te}:{})}function T(D,re){let b=e.activeNote?.()??null;if(b){let z=e.layout(),ne=Gi(z,w(D,re),e.pageOffsetX);if(!ne||ne.scopeId!==b.scopeId)return null;let le=e.measurer();return Cc(z,ne.pageIndex,ne.fragments,ne.local,{...le?{measurer:le}:{}})}let P=e.activeHeaderFooter?.()??null;if(!P)return F(D,re);let N=e.layout(),j=w(D,re),te=Xi(N,j,e.pageOffsetX);if(te&&Ki(te.story,C(P))){let z=e.measurer();return ji(N,te.pageIndex,te.story,te.local,z?{measurer:z}:{})}return null}function K(D,re){let{story:b,pageIndex:P,kind:N}=D;return {rId:b.rId,pageIndex:P,kind:N,partName:b.partName,variant:b.variant,...re?{position:re}:{}}}function h(D){let re=e.measurer();return ji(e.layout(),D.pageIndex,D.story,D.local,re?{measurer:re}:{})?.position??void 0}let _=new WeakMap;function L(D,re){let b=e.activeNote?.();if(b){let te=fr(D,null,b.scopeId).indexOf(re);return te===-1?-1:te}let P=e.activeHeaderFooter?.();if(P){let te=fr(D,C(P)).indexOf(re);return te===-1?-1:te}let N=_.get(D);return N||(N=new Map(sc(D).map((j,te)=>[j,te])),_.set(D,N)),N.get(re)??-1}function W(D,re,b){let P=L(D,re.paragraphId),N=L(D,b.paragraphId);return P!==N?P<N:re.offset<b.offset}let q=/[\p{L}\p{N}_'’]/u,A=D=>D!==void 0&&q.test(D);function $(D,re,b){if(b==="character")return {from:re,to:re};let P=ce$1(D,re.paragraphId),N=re.paragraphId;if(b==="paragraph")return {from:{paragraphId:N,offset:0},to:{paragraphId:N,offset:P.length}};let j=Math.max(0,Math.min(re.offset,P.length)),te=-1;if(A(P[j])?te=j:j>0&&A(P[j-1])&&(te=j-1),te===-1){let z=j,ne=j;for(;z>0&&/\s/.test(P[z-1]??"");)z-=1;for(;ne<P.length&&/\s/.test(P[ne]??"");)ne+=1;return z===ne&&ne<P.length&&(ne+=1),{from:{paragraphId:N,offset:z},to:{paragraphId:N,offset:ne}}}return {from:{paragraphId:N,offset:Xd(P,te+1,-1)},to:{paragraphId:N,offset:Xd(P,te,1)}}}function x(D,re,b,P,N){let j=N?fp(D,N):null,te=j?Ys(D,j)??$(D,b,P):$(D,b,P),z=W(D,te.from,re.from)?{anchor:re.to,head:te.from}:{anchor:re.from,head:te.to};return pp(D,z)}let E=r.closest(".docx-editor__scroll-container");function V(){return r.closest(".docx-editor__scroll-container")}function k(D,re,b){if(b<D+kr){let P=Math.max(0,D+kr-b);return -Math.min(La,P/kr*La)}if(b>re-kr){let P=Math.max(0,b-(re-kr));return Math.min(La,P/kr*La)}return 0}function R(){v!==null&&(a?.cancelAnimationFrame(v),v=null);}function G(){v=null;let D=s,re=V();if(!D||!re||!a)return;let b=re.getBoundingClientRect(),P=k(b.top,b.bottom,D.clientY);P!==0&&(re.scrollTop+=P,l=null,ee(D.clientX,D.clientY),v=a.requestAnimationFrame(G));}function U(){if(v!==null||!a||!s)return;let D=V();if(!D)return;let re=D.getBoundingClientRect();k(re.top,re.bottom,s.clientY)!==0&&(v=a.requestAnimationFrame(G));}function ee(D,re){let b=s;if(!b)return;let P=T(D,re);P&&(e.isReadOnlyParagraph?.(P.position.paragraphId)||fe(b,P)||e.setSelection(x(e.layout(),b.anchorRange,P.position,b.granularity,P)));}function fe(D,re){let b=D.anchorCell;if(!b)return false;if(!re.cell||re.cell.tableId!==b.tableId)return D.cellDragging;if(!D.cellDragging&&re.cell.cellId===b.cellId)return false;let P=ge(e.layout(),b,re.cell);return P?(D.cellDragging=true,e.setCellSelection(P),true):D.cellDragging}function ke(D){let re=Date.now(),b=re-u;return d=Math.abs(D.clientX-m)<=cp&&Math.abs(D.clientY-I)<=cp&&b>=0&&b<=Gy?d+1:1,u=re,m=D.clientX,I=D.clientY,d}let ye=["character","word","paragraph"],be=D=>{if(D.button!==0)return;let re=D.target?.closest?.("[data-docx-cc-widget]");if(re){if(D.preventDefault(),D.stopPropagation(),re.hasAttribute("disabled")||re.dataset.disabledReason)return;let he=re.dataset.docxCcId,me=re.dataset.docxCcWidget;he&&me&&e.onContentControlWidget?.(he,me);return}if(D.pointerType==="touch")return;s&&Ee(),l=null;let b=e.layout(),P=w(D.clientX,D.clientY),N=e.activeHeaderFooter?.()??null,j=e.activeNote?.()??null,te=Xi(b,P,e.pageOffsetX),z=Gi(b,P,e.pageOffsetX),ne=D.target?.closest("[data-docx-hf]"),le=!!(ne||te),ge=D.target,Me=ge?.closest("[data-docx-note-ref]"),ot=ge?.closest("[data-docx-note-mark-back]"),Le=null,We=()=>Le??=ke(D);if(Me?.dataset.docxNoteScope){D.preventDefault(),e.focus(),e.enterNote?.(Me.dataset.docxNoteScope);return}if(ot){D.preventDefault(),e.focus(),e.exitNote?.(true);return}if(z&&!le){let he=e.measurer?.(),me=Cc(b,z.pageIndex,z.fragments,z.local,{...he?{measurer:he}:{}});if(!j||j.scopeId!==z.scopeId){D.preventDefault(),e.focus(),e.enterNote?.(z.scopeId,me?{paragraphId:me.position.paragraphId,offset:me.position.offset}:void 0,z.pageIndex);return}if(j.pageIndex!==z.pageIndex){D.preventDefault(),e.focus(),e.enterNote?.(z.scopeId,me?{paragraphId:me.position.paragraphId,offset:me.position.offset}:void 0,z.pageIndex);return}}else if(j){if(!Vi(b,P,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(N)if(te&&Ki(te.story,C(N)))te.pageIndex!==N.pageIndex&&e.enterHeaderFooter?.(K(te,h(te)));else if(te&&te.story.rId){D.preventDefault(),e.focus(),e.enterHeaderFooter?.(K(te,h(te)));return}else if(Vi(b,P,e.pageOffsetX)){D.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let he=We()>=2?$i(b,P,e.pageOffsetX):null;he&&(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(he.kind,he.pageIndex));return}else if(le&&We()>=2){if(te?.story.rId)D.preventDefault(),e.focus(),e.enterHeaderFooter?.(K(te,h(te)));else if(ne instanceof HTMLElement){let he=ne.dataset.docxRId,me=ne.dataset.docxHf,un=ne.closest("[data-page-index]")?.getAttribute("data-page-index"),Vt=un!=null?Number(un):NaN;if((me==="header"||me==="footer")&&Number.isInteger(Vt))if(he){let fn=b.pages[Vt]?.[me];D.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:he,pageIndex:Vt,kind:me,partName:fn?.partName??"",variant:fn?.variant??"default"});}else b.pages[Vt]?.[me]||(D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(me,Vt));}return}else if(We()>=2){let he=$i(b,P,e.pageOffsetX);if(he){D.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(he.kind,he.pageIndex);return}}let Ce=T(D.clientX,D.clientY);if(!Ce)return;if(e.isReadOnlyParagraph?.(Ce.position.paragraphId)){D.preventDefault();return}D.preventDefault(),e.focus();try{n.setPointerCapture(D.pointerId);}catch{}o.addEventListener("pointermove",Ue),o.addEventListener("pointerup",Ft),o.addEventListener("pointercancel",Ft);let At=We(),at=D.shiftKey?"character":ye[(At-1)%ye.length],en=fp(b,Ce);if(en&&!D.shiftKey){if(e.selectContentControl?.(en.id)){let me=e.selection(),un=W(b,me.anchor,me.head)||me.anchor.paragraphId===me.head.paragraphId&&me.anchor.offset===me.head.offset?{from:me.anchor,to:me.head}:{from:me.head,to:me.anchor};s={pointerId:D.pointerId,granularity:"character",anchorRange:un,anchorCell:Ce.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY};return}let he=Ys(b,en);if(he){s={pointerId:D.pointerId,granularity:"character",anchorRange:he,anchorCell:Ce.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},pe(()=>e.setSelection({anchor:he.from,head:he.to}));return}}if(D.shiftKey){let he=e.selection();s={pointerId:D.pointerId,granularity:at,anchorRange:{from:he.anchor,to:he.anchor},anchorCell:Ce.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},pe(()=>e.setSelection(x(b,{from:he.anchor,to:he.anchor},Ce.position,at,Ce)));}else {let he=$(b,Ce.position,at);s={pointerId:D.pointerId,granularity:at,anchorRange:he,anchorCell:Ce.cell,cellDragging:false,clientX:D.clientX,clientY:D.clientY},pe(()=>e.setSelection(pp(b,{anchor:he.from,head:he.to})));}};function pe(D){try{D();}catch(re){throw Ee(),re}}let Ue=D=>{let re=s;!re||D.pointerId!==re.pointerId||(D.preventDefault(),re.clientX=D.clientX,re.clientY=D.clientY,ee(D.clientX,D.clientY),U());},Ft=D=>{let re=s;if(!re||D.pointerId!==re.pointerId)return;Ee();try{n.releasePointerCapture(re.pointerId);}catch{}let b=e.cellSelection();b?e.setCellSelection(b):e.setSelection(e.selection());};function Ee(){if(s)try{n.releasePointerCapture(s.pointerId);}catch{}s=null,l=null,R(),o.removeEventListener("pointermove",Ue),o.removeEventListener("pointerup",Ft),o.removeEventListener("pointercancel",Ft);}let ct=()=>{l=null;};return n.addEventListener("pointerdown",be),E?.addEventListener("scroll",ct,{passive:true}),a?.addEventListener("scroll",ct,{capture:true,passive:true}),a?.addEventListener("resize",ct,{passive:true}),{dragging:()=>s!==null,destroy(){Ee(),n.removeEventListener("pointerdown",be),E?.removeEventListener("scroll",ct),a?.removeEventListener("scroll",ct,{capture:true}),a?.removeEventListener("resize",ct);}}}function hp(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,s;function l(A){let $=zn(A?.anchorNode,n)??zn(A?.focusNode,n);$!==void 0&&(s=$);}function d(A){return s??zn(A?.anchorNode,n)??zn(A?.focusNode,n)}let u=false,m=false,I=false,v=null,w=false;function C(){let A=t.getSelection(),$=Ir(n,A);return !$||(l(A),Rt($,e.selection()))?false:(e.adoptSelection($),true)}function F(){let A=t.activeElement;if(A&&n.contains(A))return true;let $=t.getSelection();if(!$||$.rangeCount===0)return true;let x=$.anchorNode;return !x||!x.isConnected?true:n.contains(x)}let T=()=>{let A=t.getSelection(),$=Ir(n,A);if(!$){if(!Hs(n,A))return;u=false;let x=Oe(e.selection().head);if(Rt(x,e.selection()))return;e.setSelection(x);return}u=false,l(A),!Rt($,e.selection())&&e.setSelection($);};function K(A){let $=e.textOf(A),x=Af(n,A,$,t.getSelection()?.anchorNode??null);if(x===null)return;let E=Mf(A,$,x);if(!E)return;let V=E.ops.find(fe=>fe.op==="deleteText"),k=E.ops.find(fe=>fe.op==="insertText"),R=k&&V?e.replacementOffset?.(A,V.start,V.end):void 0,G=k&&R!==void 0&&R!==k.offset?E.ops.map(fe=>fe===k?{...k,offset:R}:fe):E.ops,U=k?e.pendingFormatOps?.(A,R??k.offset,k.text.length,V?{start:V.start,end:V.end}:void 0)??[]:[],ee=e.storyScope();e.commit(()=>{let fe=e.applyOps([...G,...U],e.selectionMark(),ee);return U.length===0||!fe.rejected?fe:e.applyOps(G,e.selectionMark(),ee)}),e.setSelection(Oe({paragraphId:A,offset:k&&R!==void 0?R+k.text.length:E.caret}));}function h(){o||I||e.isGesturing?.()||e.holdsCellSelection?.()||_()||u&&T();}function _(){if(!m||u)return false;if(!a)return true;let A=Ir(n,t.getSelection());return A!==null&&Rt(A,a)}function L(A){A instanceof PointerEvent&&A.button!==0||(u=true);}let W=false;function q(A=false){if(e.updateCaret(),!A&&!F())return;o=true;let $=e.now(),x=e.domSelection?.()??e.selection();u=false;let E=t.getSelection(),V=d(E),k=vf(n,x,E,V!==void 0?{preferredPageIndex:V}:void 0);k&&l(E),a=k?x:null,k||(m=true),e.recordSelectionMs(e.now()-$),queueMicrotask(()=>{o=false;});}return n.addEventListener("pointerdown",L,true),n.addEventListener("selectstart",L,true),{adoptBeforePaint(){let A=e.holdsCellSelection?.()===true||e.isGesturing?.()===true||e.hasPendingInput?.()===true,$=m||A||!u?false:C();return e.hasPendingInput?.()!==true&&(m=false),$},noteModelMoved(){m=true;},noteSelectionSettled(){m=false;},mirrorToDom:q,adoptBeforeInput:h,isComposing:()=>I,noteBrowserSelectionFixup(){W=true;},onSelectionChange:()=>{if(!o&&!I&&!e.isGesturing?.()&&!e.holdsCellSelection?.()){if(W&&Hs(n,t.getSelection())){let A=Ir(n,t.getSelection());if((A===null||!Rt(A,e.selection()))&&(W=false,!u)){q();return}}_()||T();}},onCompositionStart:()=>{h(),I=true;let A=e.selection();w=A.anchor.paragraphId!==A.head.paragraphId,v=A.head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:A=>{I=false;let $=v??e.selection().head.paragraphId;v=null;let x=w;w=false;let E=e.storyScope(),V=r.revisionFor(E);if(x){let k=A?.data??"";k.length>0&&e.replaceSelectionWith?.(k);}else K($);r.endComposition(),r.revisionFor(E)===V&&e.discardPaint?.(),e.flushToPaint()||e.render();},selectionPageIndex:()=>s,destroy(){n.removeEventListener("pointerdown",L,true),n.removeEventListener("selectstart",L,true),u=false;}}}var Yy=32;function bp(e,t,n,r){if(!(e.kind==="textValue"||r>Yy)){if(e.kind==="paragraph"){n.has(e.id)||n.set(e.id,t);return}for(let o of e.children)bp(o,t,n,r+1);}}function eb(e){let t=Ob$2(e),n=cd(e),r=new Map;for(let o=0;o<n.length;o+=1){let a=n[o];for(let s=a.blockStart;s<a.blockEndExclusive;s+=1){let l=t[s];l&&bp(l,o,r,0);}}return r}var yp=new WeakMap;function tb(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$3.section))}function nb(e,t){t.story&&t.story.kind!=="body"||tb(t)||(e.map=null);}function rb(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>nb(t,n)));}function ob(e,t){let n=yp.get(e);return n||(n={map:null,subscribed:false},yp.set(e,n)),rb(e,n),n.map||(n.map=eb(t)),n.map}function vp(e,t,n){return n.startsWith(`${t.name}#`)?ob(e,t).get(n)??null:null}var Ip=32;function To(e,t,n,r){let o=e.part(),a=cd(o);if(a.length<=1)return 0;let s=Qs(e,t);if(s!==null)return s;if(n.kind==="headerFooter"){if(r!==void 0&&a[r]!==void 0)return r;let d=e.headerFooterResolutionBySection().findIndex(u=>[u.headers,u.footers].some(m=>[...m.values()].some(I=>I.rId===n.rId)));return d===-1?0:d}let l=ib(e,t);if(l!==null){let d=Qs(e,l);if(d!==null)return d}return 0}function xp(e,t,n,r){let o=e.part(),a=cd(o);if(a.length<=1)return {kind:"whole-document"};if(Qs(e,t)!==null)return {kind:"anchor",paragraphId:t};let l=To(e,t,n,r),d=a[l];if(!d)return {kind:"unaddressable"};let u=Ob$2(o);for(let m=d.blockStart;m<d.blockEndExclusive;m+=1){let I=ab(u[m]);if(I!==null)return {kind:"anchor",paragraphId:I}}return {kind:"unaddressable"}}function ab(e){if(!e)return null;let t=(n,r)=>{if(n.kind==="textValue"||r>Ip)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 Qs(e,t){return vp(e,e.part(),t)}function ib(e,t){let n=e.currentPackage();for(let r of ["footnote","endnote"]){let o=_d$1(n,r);if(!(!o||!t.startsWith(`${o.name}#`)))for(let a of Bd(o.root)){let s=qd(a);if(s===null||!sb(a,t))continue;return $d(e.part()).find(d=>d.noteKind===r&&d.noteId===s)?.paragraphId??null}}return null}function sb(e,t){let n=(r,o)=>{if(r.kind==="textValue"||o>Ip)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 wr(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 Na(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 Sp(e){return {val:e?"1":"0"}}var lb="list paragraph",db="ListParagraph";function kp(e){return e.find(t=>t.localName==="pStyle")?.attributes?.val}function wp(e){let{session:t}=e;function n(){let a=null;for(let s of t.documentStyles())if(s.type==="paragraph"){if(s.name.trim().toLowerCase()===lb)return s.styleId;a===null&&s.styleId===db&&(a=s.styleId);}return a}let r;function o(){let a=t.stylesRoot();return (r===void 0||r.root!==a)&&(r={root:a,styleId:Gb(a,t.documentThemeFonts()).defaultParagraphStyleId}),r.styleId}return {applyOps(a){let s=n();if(s===null)return [];let l=o(),d=e.storyPart(),u=[];for(let m of a){let I=lg$1(d,m),v=kp(I);v!==void 0&&v!==l||u.push({op:"setParagraphProperties",paragraphId:m,properties:ng$1(I,{localName:"pStyle",attributes:{val:s}})});}return u},clearOp(a){let s=n();if(s===null)return null;let l=lg$1(e.storyPart(),a);return kp(l)!==s?null:{op:"setParagraphProperties",paragraphId:a,properties:l.filter(d=>d.localName!=="pStyle")}}}}var cb=[["contextualSpacing","contextualSpacing"],["keepNext","keepNext"],["keepLines","keepLines"],["widowControl","widowControl"],["pageBreakBefore","pageBreakBefore"]];function ub(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 Da(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),s=e[n]!==void 0;return s&&(o[n]=a),(!s||e[t]!==void 0)&&(o[t]=a),o}function Tp(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 Pp(e){let{session:t,commit:n,orderedStart:r,orderedRange:o,selectionMark:a,collapsedAt:s}=e,l=e.deleteSelectionPlan,d=()=>t.partFor(e.storyScope())??t.part(),u=(x,E,V)=>t.applyTreeOps(x,E,V,e.storyScope()),m=wp({session:t,storyPart:d}),I=()=>e.paragraphOrder(),v={get value(){return e.layout()}};function w(){let x=e.selectedCells?.();return x&&x.length>0?x:null}function C(x){let E=false;return n(()=>{let V=x();return E=V.committed,V},void 0,{keepCellSelection:w()!==null}),E}function F(){if(w()!==null)return [...ie(v.value,w())];let{from:x,to:E}=o(),V=I(),k=V.indexOf(x.paragraphId),R=V.indexOf(E.paragraphId);return k===-1||R===-1?null:V.slice(k,R+1)}let T=720,K=8;function h(x){return _(x)?.level??null}function _(x){return xc$1(v.value,x)?.marker??null}function L(x){let E=_(x);return E?E.numFmt==="bullet"?"bullet":"ordered":null}function W(x,E){let V=I(),k=V.indexOf(x[0]??""),R=V.indexOf(x[x.length-1]??"");if(k===-1||R===-1)return null;for(let G of [k-1,R+1]){let U=V[G];if(!U)continue;let ee=_(U);if(ee&&(ee.numFmt==="bullet"?"bullet":"ordered")===E)return ee.numId}return null}function q(x,E){return E<0||E>K?false:e.numberingLevelExists(x.numId,E)}function A(x,E){return E<0||E>K?false:e.numberingLevelExists(x.numId,E)?true:t.ensureNumberingLevel(x.numId,E,x.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(x.numId,E)}function $(x){let E;for(let V of x){if(V.localName!=="ind")continue;let k=V.attributes?.left??V.attributes?.start;k!==void 0&&(E=k);}return !E||!/^-?\d{1,7}$/.test(E)?0:Number(E)}return {insertTab(){let x=l(),E=x.replaceAt??x.collapseTo;n(()=>u([...x.ops,{op:"insertTab",paragraphId:E.paragraphId,offset:E.offset}],a()),()=>s({...E,offset:E.offset+1}));},insertLineBreak(){let x=l(),E=x.replaceAt??x.collapseTo;n(()=>u([...x.ops,{op:"insertHardBreak",paragraphId:E.paragraphId,offset:E.offset}],a()),()=>s({...E,offset:E.offset+1}));},insertPageBreak(){let x=l(),E=x.replaceAt??x.collapseTo;n(()=>u([...x.ops,{op:"insertPageBreak",paragraphId:E.paragraphId,offset:E.offset}],a()),()=>s({...E,offset:E.offset+1}));},exitListOnEmptyItem(){let{from:x,to:E}=o();if(x.paragraphId!==E.paragraphId||x.offset!==E.offset)return false;let V=_(x.paragraphId);if(!V||e.paragraphTextOf(x.paragraphId).length>0)return false;let R=V.level>0&&q(V,V.level-1),G=[];if(R)G.push({op:"setListLevel",paragraphId:x.paragraphId,level:V.level-1});else {let ee=m.clearOp(x.paragraphId);ee&&G.push(ee),G.push({op:"setListNumbering",paragraphId:x.paragraphId,numId:null});}let U=false;return n(()=>{let ee=u(G,a());return U=ee.committed,ee}),U},isListParagraph(){let{paragraphId:x}=r();return h(x)!==null},isListActive(x){let E=F();if(E===null)return false;let V=x==="bullet"?"bullet":"ordered";return E.length>0&&E.every(k=>L(k)===V)},toggleList(x){let E=F();if(E===null||E.length===0)return false;let V=E.every(G=>L(G)===x),k=V?null:W(E,x)??t.ensureListDefinition(x);if(!V&&k===null)return false;let R=V?[]:m.applyOps(E);for(let G of E){let U=h(G);R.push({op:"setListNumbering",paragraphId:G,numId:k,...U!==null?{level:U}:{}});}return C(()=>u(R,a()))},canAdjustIndent(x){let E=F();if(E===null)return false;let V=x==="increase"?1:-1;return E.some(k=>{let R=_(k);if(R){let U=R.level+V;return U>=0&&U<=K}let G=$(Sr(v.value,k));return Math.max(0,G+V*T)!==G})},adjustIndent(x){let E=F();if(E===null)return false;let V=x==="increase"?1:-1,k=[];for(let R of E){let G=Sr(v.value,R),U=_(R),ee=U?.level??null;if(U&&ee!==null){let pe=ee+V;if(pe<0||pe>K||!A(U,pe))continue;k.push({op:"setListLevel",paragraphId:R,level:pe});continue}let fe=$(G),ke=Math.max(0,fe+V*T);if(ke===fe)continue;let ye=lg$1(d(),R),be=ye.find(pe=>pe.localName==="ind");k.push({op:"setParagraphProperties",paragraphId:R,properties:ng$1(ye,{localName:"ind",attributes:ub(be?.attributes,String(ke))})});}return k.length===0?false:C(()=>u(k,a()))},setIndent(x){if(x.left===void 0&&x.right===void 0&&x.firstLine===void 0)return false;let E=F();if(E===null)return false;let V=[];for(let k of E){let R=lg$1(d(),k),U={...R.find(ee=>ee.localName==="ind")?.attributes??{}};x.left!==void 0&&(U=Da(U,"left","start",x.left)),x.right!==void 0&&(U=Da(U,"right","end",x.right)),x.firstLine!==void 0&&(U=Tp(U,x.firstLine)),V.push({op:"setParagraphProperties",paragraphId:k,properties:ng$1(R,{localName:"ind",...Object.keys(U).length>0?{attributes:U}:{}})});}return V.length===0?false:C(()=>u(V,a()))},setParagraphFormat(x){let E=F();if(E===null||E.length===0)return false;let V=[];x.alignment!==void 0&&V.push({localName:"jc",attributes:{val:x.alignment}});let k={...wr("before",x.spaceBeforePt),...wr("after",x.spaceAfterPt),...Na(x.lineSpacing)};Object.keys(k).length>0&&V.push({localName:"spacing",attributes:k,mergeAttributes:true});for(let[ee,fe]of cb){let ke=x[ee];ke!==void 0&&V.push({localName:fe,attributes:Sp(ke)});}let R=x.tabStops!==void 0,G=x.indentLeftTwips!==void 0||x.indentRightTwips!==void 0||x.indentFirstLineTwips!==void 0;if(V.length===0&&!G&&!R)return false;let U=[];for(let ee of E){let fe=lg$1(d(),ee),ke=fe;if(G){let be={...fe.find(pe=>pe.localName==="ind")?.attributes??{}};x.indentLeftTwips!==void 0&&(be=Da(be,"left","start",x.indentLeftTwips)),x.indentRightTwips!==void 0&&(be=Da(be,"right","end",x.indentRightTwips)),x.indentFirstLineTwips!==void 0&&(be=Tp(be,x.indentFirstLineTwips)),ke=ng$1(ke,{localName:"ind",...Object.keys(be).length>0?{attributes:be}:{}});}for(let ye of V){let be=ye.mergeAttributes?{...ke.find(Ue=>Ue.localName===ye.localName)?.attributes??{},...ye.attributes}:ye.attributes??{},pe=Object.fromEntries(Object.entries(be).filter(([,Ue])=>Ue!=null));ke=ng$1(ke,{localName:ye.localName,...Object.keys(pe).length>0?{attributes:pe}:{}});}if((V.length>0||G)&&U.push({op:"setParagraphProperties",paragraphId:ee,properties:ke}),R){let ye=wo(e.layout(),ee);U.push({op:"setParagraphTabStops",paragraphId:ee,stops:x.tabStops.map(be=>({positionTwips:Math.round(be.positionTwips),alignment:be.alignment,...be.leader&&be.leader!=="none"?{leader:be.leader}:{}})),...ye?{inForcePositionsTwips:ye.stops.map(be=>Math.round(be.positionPt*20))}:{}});}}return U.length===0?false:C(()=>u(U,a()))},sectionProperties:()=>bd(t.part()),sectionPropertiesAt(x){let E=cd(t.part()),V=To(t,x,e.storyScope(),e.headerFooterSectionIndex?.());return (E[V]??E[E.length-1]).properties},sectionAnchorParagraphAt(x){return xp(t,x,e.storyScope(),e.headerFooterSectionIndex?.())},setSectionProperties(x){let E=false;return n(()=>{let V=e.storyScope().kind==="body",k=t.applyTreeOps([{op:"setSectionProperties",...x}],V?a():void 0,void 0,{kind:"body"});return E=k.committed,k}),E},insertSectionBreak(){if(e.storyScope().kind!=="body")return false;let x=l(),E=x.replaceAt??x.collapseTo,V=zf$1(t.part(),E.paragraphId)?x.collapseTo:E,k=new Set(t.paragraphIds()),R=false;return n(()=>{let G=t.applyTreeOps([...x.ops,{op:"splitParagraph",paragraphId:V.paragraphId,offset:V.offset},{op:"setSectionMark",paragraphId:V.paragraphId}],a(),void 0,{kind:"body"});return R=G.committed,G},()=>{let G=t.paragraphIds().find(U=>!k.has(U));return G?s({paragraphId:G,offset:0}):null}),R}}}var fb=4096;function pb(e){let t=e.tooltip!==null?{tooltip:q$1(e.tooltip)}:{};if(e.target!==null){let n=L(e.target);if(n.ok&&n.href.length>0&&x(n.href).ok){let o=e.anchor!==null&&!n.href.includes("#")?L(q$1(e.anchor)):null;return {kind:"external",href:o&&o.ok&&o.href.length>0?`${n.href}#${o.href}`:n.href,authored:e.target,...e.anchor!==null?{anchor:q$1(e.anchor)}:{},...t}}if(e.anchor===null)return null}if(e.anchor!==null){let n=q$1(e.anchor),r=L(n);return {kind:"internal",href:r.ok&&r.href.length>0?`#${r.href}`:null,authored:e.anchor,anchor:n,...t}}return null}function Cp(){let e=new Map,t=new Map,n=0;return {project(r){let o=pb(r);if(!o)return null;let a=`${r.target??""}\0${r.anchor??""}\0${r.tooltip??""}`,s=e.get(a);if(s===void 0){if(e.size>=fb)return null;n+=1,s=`field-hyperlink:${n}`,e.set(a,s),t.set(s,Object.freeze({id:s,paragraphId:"",start:0,end:0,text:"",kind:o.kind,href:o.href,authored:o.authored,...o.anchor!==void 0?{anchor:o.anchor}:{},...o.tooltip!==void 0?{tooltip:o.tooltip}:{}}));}return {id:s,kind:o.kind,href:o.href,...o.anchor!==void 0?{anchor:o.anchor}:{},...o.tooltip!==void 0?{tooltip:o.tooltip}:{}}},linkById(r){return t.get(r)??null}}}var Ap=32;function Mp(e){return e.kind!=="textValue"&&e.kind==="contentControl"}function gb(e){return e.kind!=="textValue"&&e.kind==="contentControlContent"}function Js(e){return e.kind==="textValue"?[]:e.children}function mb(e){return e.kind==="hyperlink"||Mp(e)||ha$1(e.kind)}function Lp(e,t=0){if(e.kind==="textValue")return e.value;if(t>=Ap||e.kind==="deletedText"||hb(e.kind)||dc(e)||e.kind==="runProperties")return "";if(e.kind==="tab")return " ";if(e.kind==="hardBreak")return Xb$1(e);let n=mb(e)?t+1:t,r="";for(let o of e.children)r+=Lp(o,n);return r}function hb(e){return e==="revisionDelete"||e==="revisionMoveFrom"}function el(e,t,n){if(!(t>=Ap))for(let r of e){if(r.kind==="hyperlink"){n(r);continue}if(ha$1(r.kind)){el(Js(r),t+1,n);continue}if(Mp(r)){for(let o of Js(r))gb(o)&&el(Js(o),t+1,n);continue}n(r);}}function Rp(e,t,n){let r=yb(e,t);if(!r||r.kind!=="paragraph")return [];let o=Ud$1(r),a=[],s=0;return el(r.children,0,l=>{let d=o.spanOf(l);if(d&&(s=Math.max(s,d.end)),l.kind!=="hyperlink")return;let u=d?d.start:s,m=d?d.end:s,I=Ka$1(l,n);a.push({id:l.id,paragraphId:t,start:u,end:m,text:Lp(l),kind:I.kind,href:I.href,authored:I.authored,...I.anchor!==void 0?{anchor:I.anchor}:{},...I.tooltip!==void 0?{tooltip:I.tooltip}:{}});}),a}function yb(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 bb(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 vb(e,t){for(let n of aa(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 Np(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=u=>e.session.relationshipTarget(u,t()),o=(u,m,I)=>e.session.applyTreeOps(u,m,I,t()),a=u=>{let m=n();return m?Rp(m,u,r):[]},s=()=>bb(a(e.selection().head.paragraphId),e.selection().head),l=()=>{let u=e.selection().head,m=vb(e.layout(),u);return m===null?null:e.fieldLinkById(m)},d=u=>{let m=e.selection().head.paragraphId,I=a(m).find(v=>v.id===u);if(I)return I;for(let v of e.session.storyParts()){let w=C=>Zc(e.session.currentPackage(),v.name,C);for(let C of Ke(v))for(let F of Ne(C.root)){let T=F.id,K=Rp(v,T,w).find(h=>h.id===u);if(K)return K}}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:s,fieldLinkAtCaret:l,linkById:d,applyHyperlink(u){let m=u.url!==void 0&&u.url.length>0,I=u.anchor!==void 0&&u.anchor.length>0;if(m===I)return false;let v=t();if(!n()||e.refusesWrite())return false;let w;if(m){let x=e.session.ensureHyperlinkRelationship(u.url,v);if(!x)return false;w=x;}let C={...w!==void 0?{relationshipId:w}:{},...I?{anchor:u.anchor}:{},...u.tooltip!==void 0?{tooltip:u.tooltip}:{}},F=s(),T=e.orderedRange(),K=T.from.paragraphId===T.to.paragraphId&&T.from.offset===T.to.offset;if(F&&(K||Ib(F,T))){let x=[];if(u.text!==void 0&&u.text!==F.text){if(u.text.length===0)return false;let V=e.suggestReplacementOffset?.(F.paragraphId,F.start,F.end),k=e.textOf(F.paragraphId).slice(F.start,F.start+2),R=F.start+(k.length===2&&k.charCodeAt(0)>=55296&&k.charCodeAt(0)<=56319&&k.charCodeAt(1)>=56320&&k.charCodeAt(1)<=57343?2:1);if(V!=null&&V>F.start&&R<F.end)x.push({op:"setHyperlinkTarget",linkId:F.id,...C},{op:"deleteText",paragraphId:F.paragraphId,start:F.start,end:F.end},{op:"insertText",paragraphId:F.paragraphId,offset:R,text:u.text});else if(V!=null){let G=Ep(e.session);x.push({op:"setHyperlinkTarget",linkId:F.id,...C},...Op(F,V,u.text),{op:"insertHyperlink",paragraphId:F.paragraphId,start:V,end:V+u.text.length,...C,...G?{styleId:G}:{}});}else {let G=Fp(F.paragraphId,F.start,F.end,u.text);if(!G)return false;x.push({op:"setHyperlinkTarget",linkId:F.id,...C},...G);}}else x.push({op:"setHyperlinkTarget",linkId:F.id,...C});let E=false;return e.commit(()=>{let V=o(x,e.selectionMark());return E=V.committed,V},()=>null),E}let h=T.from.paragraphId;if(T.to.paragraphId!==h)return false;let _=[],L=T.from.offset,W=T.to.offset;if(K){let x=u.text??u.url??u.anchor??"";if(x.length===0)return false;L=e.insertionLanding?.(h,L)??L,_.push({op:"insertText",paragraphId:h,offset:L,text:x}),W=L+x.length;}else {let x=e.suggestReplacementOffset?.(h,L,W);if(x!=null){let E=u.text??e.textOf(h).slice(L,W);if(E.length===0)return false;_.push(...Op({paragraphId:h,start:L,end:W},x,E)),L=x,W=x+E.length;}else if(u.text!==void 0&&u.text!==e.textOf(h).slice(L,W)){let E=Fp(h,L,W,u.text);if(!E)return false;_.push(...E),W=L+u.text.length;}}if(W<=L)return false;let q=Ep(e.session);_.push({op:"insertHyperlink",paragraphId:h,start:L,end:W,...C,...q?{styleId:q}:{}});let A=false,$={paragraphId:h,offset:W};return e.commit(()=>{let x=o(_,e.selectionMark(),{paragraphId:h,start:W,end:W});return A=x.committed,x},()=>({anchor:$,head:$})),A},removeHyperlink(u){if(!n())return false;let m=u?d(u):s();if(!m)return false;let I=false,v={paragraphId:m.paragraphId,offset:m.end};return e.commit(()=>{let w=o([{op:"removeHyperlink",linkId:m.id}],e.selectionMark());return I=w.committed,w},()=>({anchor:v,head:v})),I}}}function Ep(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function Ib(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function Op(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 Fp(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 xb="equation replacement and removal are not supported in suggesting mode",Dp=new WeakMap;function Hp(e,t){let n=va$1(e,t);if(!n||n.kind!=="paragraph")return [];let r=Dp.get(n);if(r)return r;let o=[];for(let s of Td$1(n)){let l=s.node;if(l.kind==="textValue"||l.kind!=="generic"||l.namespaceUri!==Ab$1||l.localName!=="oMath")continue;let d=Cb$2(l);d&&o.push(Object.freeze({id:l.id,paragraphId:t,start:s.start,end:s.end,linear:Eb$1(d.expression),fallbackText:d.fallbackText,supported:Ot(d.expression)}));}let a=Object.freeze(o);return Dp.set(n,a),a}function Ot(e){switch(e.kind){case "fallback":return false;case "text":return true;case "row":return e.items.every(Ot);case "fraction":return Ot(e.numerator)&&Ot(e.denominator);case "radical":return Ot(e.radicand)&&(e.degree===void 0||Ot(e.degree));case "script":return Ot(e.base)&&(e.subscript===void 0||Ot(e.subscript))&&(e.superscript===void 0||Ot(e.superscript));case "nary":return Ot(e.body)&&(e.lowerLimit===void 0||Ot(e.lowerLimit))&&(e.upperLimit===void 0||Ot(e.upperLimit))}}function _p(e,t){return e.find(n=>n.paragraphId===t.paragraphId&&t.offset>=n.start&&t.offset<=n.end)??null}function Bp(e){let t=null,n=s=>{let l=e.pagesLayer.ownerDocument.defaultView;if(!l||!(s instanceof l.Element))return null;let d=s.closest("[data-docx-equation]");return d&&e.pagesLayer.contains(d)?d:null},r=(s,l)=>{let d=e.equationById(s);d&&(e.setSelection({anchor:{paragraphId:d.paragraphId,offset:d.start},head:{paragraphId:d.paragraphId,offset:d.end}}),e.onPopover?.({equation:d,rect:l}));},o=s=>{t=null;let l=n(s.target),d=l?.dataset.docxEquation;if(!l||!d)return;let u=l.getBoundingClientRect();t={equationId:d,rect:{left:u.left,top:u.top,right:u.right,bottom:u.bottom}};},a=s=>{let l=n(s.target),d=l?.dataset.docxEquation,u=t;if(t=null,!l||!d){if(!u)return;s.preventDefault(),r(u.equationId,u.rect);return}let m=l.getBoundingClientRect();s.preventDefault(),r(d,{left:m.left,top:m.top,right:m.right,bottom:m.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 qp(e){let t=()=>e.session.partFor(e.storyScope()),n=d=>{let u=t();return u?Hp(u,d):[]},r=()=>{let d=e.selection().head;return _p(n(d.paragraphId),d)},o=d=>{let u=n(e.selection().head.paragraphId).find(m=>m.id===d);if(u)return u;for(let m of e.session.storyParts()){let I=va$1(m,d);if(!I||I.kind!=="generic"||I.namespaceUri!==Ab$1||I.localName!=="oMath")continue;let v=I;for(;v&&v.kind!=="paragraph";)v=wa$1(m,v.id);return !v||v.kind!=="paragraph"?null:Hp(m,v.id).find(w=>w.id===d)??null}return null},a=(d,u)=>{let m=false,I={paragraphId:d.paragraphId,offset:d.start};return e.commit(()=>{let v=e.session.applyTreeOps([u],e.selectionMark(),{paragraphId:I.paragraphId,start:I.offset,end:I.offset},e.storyScope());return m=v.committed,v},()=>({anchor:I,head:I})),m},s=(d,u)=>{let m=o(d);if(!m)return {ok:false,code:"notFound",reason:"no equation with that id"};if(e.editingMode()==="suggest")return {ok:false,code:"unsupported",reason:xb};let I=u==="replace"?{op:"setMathEquation",equationId:d,linear:m.linear}:{op:"removeMathEquation",equationId:d},v=e.writeRefusal(I);return v===null?{ok:true}:{ok:false,code:"locked",reason:v}},l=d=>(e.commit(()=>({committed:false,rejected:true,opCount:0,reason:d.reason})),false);return {equationsInCaretParagraph:()=>[...n(e.selection().head.paragraphId)],equationAtCaret:r,equationById:o,can:s,applyEquation(d,u){let m=o(d);if(!m)return false;let I=s(d,"replace");return I.ok?m.supported&&m.linear===u?true:a(m,{op:"setMathEquation",equationId:d,linear:u}):l(I)},removeEquation(d){let u=o(d);if(!u)return false;let m=s(d,"remove");return m.ok?a(u,{op:"removeMathEquation",equationId:d}):l(m)}}}var Sb=24;function Zp(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=v=>{if(!v||v.length===0||v.startsWith("#"))return false;let w=L(v);return !w.ok||!w.href||!n?false:(n.open(w.href,"_blank","noopener,noreferrer"),true)},a=v=>{if(e.enterStoryFor&&!e.enterStoryFor(v.paragraphId))return false;let w=e.layout(),C=_d(w,v);if(!C)return false;let F=w.pages[C.pageIndex];if(!F)return false;let T=F.box.y+(F.contentBox.y-F.box.y)+C.y,K=r();return K&&(K.scrollTop=Math.max(0,T*e.scale()-Sb),e.onScrolled?.()),e.setSelection(v),true},s=v=>{let w=e.bookmarks().get(v);return w?a(w):false},l=null;function d(v){if(!v||v.closest("[data-docx-hf]"))return null;let w=v.closest("a.docx-hyperlink");if(w){let F=w.dataset.docxLink;return F?{linkId:F,drawing:false}:null}let C=v.closest("[data-docx-drawing-link]");if(C){let F=C.dataset.docxDrawingLink;return F?{linkId:F,drawing:true}:null}return null}let u=v=>{l=null;let w=v.target,C=d(w);if(!C)return;let T=w.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();l={linkId:C.linkId,drawing:C.drawing,rect:{left:T.left,top:T.top,bottom:T.bottom,right:T.right}};},m=v=>{let w=v.target,C=d(w);if(!C){let K=l;if(l=null,!K)return;v.preventDefault(),I(K.linkId,K.rect,v,K.drawing);return}l=null,v.preventDefault();let T=w.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();I(C.linkId,{left:T.left,top:T.top,bottom:T.bottom,right:T.right},v,C.drawing);};function I(v,w,C,F){let T=F?e.drawingLinkById?.(v)??null:e.linkById(v);if(!T)return;if(C.metaKey||C.ctrlKey){T.kind==="external"?o(T.href):T.anchor&&s(T.anchor);return}if(e.isCollapsedSelection()){if(T.kind==="internal"){T.anchor&&s(T.anchor);return}e.onPopover?.({link:T,rect:w});}}return t.addEventListener("pointerdown",u,true),t.addEventListener("click",m),{goToPosition:a,goToBookmark:s,openExternal:o,destroy(){t.removeEventListener("pointerdown",u,true),t.removeEventListener("click",m);}}}function kb(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 tl(e,t){return e.drawingNodeId!==t?null:kb(e)}function zp(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=tl(n,t);if(r)return r}return null}function wb(e,t){for(let r of e.anchoredDrawings??[]){let o=tl(r,t);if(o)return o}for(let r of e.fragments){if(r.kind==="table"){for(let a of r.rows)for(let s of a.cells)for(let l of s.blocks){let d=Vp(l,t);if(d)return d}continue}let o=Kp(r,t);if(o)return o}let n=zp(e.header,t);return n||zp(e.footer,t)}function Kp(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=tl(r,t);if(o)return o}return null}function Vp(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=Vp(o,t);if(a)return a}return null}return Kp(e,t)}function jp(e,t){for(let n of e.pages){let r=wb(n,t);if(r)return r}return null}function Up(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 Po="the document is open for viewing",Ha="image property edits are not supported in suggesting mode",Tb="trackedDrawingDeletionUnsupported";function Wp(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Po}}function n(){return {committed:false,rejected:true,opCount:0,reason:Ha}}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:Po};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Ha};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:Po};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Tb};let o={ok:false,reason:"invalidArgs"};return e.commit(()=>(o=e.session.deleteImage(e.storyScope(),r),{committed:o.ok,rejected:!o.ok,opCount:o.ok?1:0,...o.ok?{}:{reason:o.detail??o.reason}})),o},insertImage(r){return e.editingMode()==="view"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Po}):e.editingMode()==="suggest"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Ha}):e.session.insertImage(e.storyScope(),{...r,decodePort:e.decodePort()})},replaceImage(r,o,a,s){return e.editingMode()==="view"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Po}):e.editingMode()==="suggest"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Ha}):e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),s)}}}function Gp(e){let t=null,n=null,r="",o=()=>{if(!t)return;let l=Qc(e.layout(),t,e.materializedPages?.());l!==t.pageIndex&&(t={...t,pageIndex:l,sectionIndex:e.sectionAtPage(l).sectionIndex});},a=l=>{if(e.entryRefused?.()===true&&t?.scope.rId!==l.rId||!l.rId||e.session.partFor({kind:"headerFooter",rId:l.rId})===null)return false;t?.scope.rId!==l.rId&&e.leaveOtherStories?.();let d=e.layout(),u=$c(d,l.rId),m=t,I=m?.scope.rId===l.rId,v=u?null:Pb(e.session,l.rId);if(!u&&!v)return false;let w=l.pageIndex??(I&&m?m.pageIndex:u?.pageIndex??0),C=l.kind??(I&&m?m.kind:u?.kind??v.kind),F=l.variant??(I&&m?m.variant:u?.story.variant??v.variant),T=I&&m?m.partName:u?.story.partName??v.partName,K=d.pages[w]??d.pages[u?.pageIndex??0],h=(K?ur(K,{scope:{kind:"headerFooter",rId:l.rId},kind:C,partName:T}):null)??u?.story??{scope:{rId:l.rId},variant:F,partName:T},_=e.selection(),L=m?m.savedBodySelection:{anchor:{..._.anchor},head:{..._.head}},W=I&&m?.sectionIndex!==void 0&&w===m.pageIndex,q=l.sectionIndex??(W?m.sectionIndex:u?e.sectionAtPage(w).sectionIndex:v?.sectionIndex);t={scope:{kind:"headerFooter",rId:l.rId},pageIndex:w,...q!==void 0?{sectionIndex:q}:{},kind:C,variant:h.variant,partName:h.partName,savedBodySelection:L};let $=e.session.paragraphIdsIn(va(t))[0];if(!$)return t=null,false;let x=l.position?Ia(d,{anchor:l.position,head:l.position},t):I?Ia(d,_,t):{anchor:{paragraphId:$,offset:0},head:{paragraphId:$,offset:0}};return e.setScopeSelection(x),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},s=()=>{if(!t)return;let l=t.savedBodySelection;t=null,e.setScopeSelection(Ia(e.layout(),l,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>Gc(t),setActiveScope(l){return l.kind==="body"?(s(),true):l.kind==="headerFooter"?a({rId:l.rId}):false},enterHeaderFooter:a,exitHeaderFooter:s,reconcileOccurrence:o,headerFooterState(){if(!t)return null;let l=e.session.headerFooterResolutionBySection(),d=t.sectionIndex??0,u,m,I,v=K=>{let h=l[K];if(!h)return false;let L=(t.kind==="header"?h.headers:h.footers).get(t.variant);return !L||L.rId!==t.scope.rId?false:(d=K,u=L.inherited,m=h.titlePage,I=h.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&v(t.sectionIndex))){let K;l.forEach((h,_)=>{let W=(t.kind==="header"?h.headers:h.footers).get(t.variant);!W||W.rId!==t.scope.rId||!(K===void 0||K&&!W.inherited||K===W.inherited&&_<d)||(d=_,u=W.inherited,m=h.titlePage,I=h.evenAndOddHeaders,K=W.inherited);});}let w=cd(e.session.part()),C=w[d]?.properties??w.at(-1)?.properties,F=C?.margins.headerTwips,T=C?.margins.footerTwips;return {editing:t.kind,sectionIndex:d,variant:t.variant,rId:t.scope.rId,partName:t.partName,...u!==void 0?{inherited:u}:{},...m!==void 0?{titlePage:m}:{},...I!==void 0?{evenAndOddHeaders:I}:{},...F!==void 0?{headerDistanceTwips:F}:{},...T!==void 0?{footerDistanceTwips:T}:{}}},headerFooterStateStable(l){if(!t)return n=null,r="",null;let d=this.headerFooterState();if(!d)return null;let u=[l,d.editing,d.sectionIndex,d.variant??"",d.rId??"",d.partName??"",String(d.inherited),String(d.titlePage),String(d.evenAndOddHeaders),String(d.headerDistanceTwips??""),String(d.footerDistanceTwips??"")].join("|");return n&&r===u||(n=Object.freeze({...d}),r=u),n}}}function Pb(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 s=a==="header"?o.headers:o.footers;for(let[l,d]of s)if(d.rId===t)return {sectionIndex:r,kind:a,variant:l,partName:d.partName}}}return null}function Xp(e){let t=null,n=null,r=null,o=(s,l)=>(e.setLastRejection(null),e.commit(()=>{let d=e.applyOps(Array.isArray(s)?s:[s],e.selectionMark());return d.rejected&&e.setLastRejection(String(d.reason??"rejected")),d},l),e.lastRejection()===null),a=(s,l,d)=>{let u=hd(s);if(!u)return e.setLastRejection("invalid note scope id"),false;let m=e.session.currentPackage(),I=_d$1(m,u.noteKind),v=I?Cd(I.root,u.noteId):null;if(!I||!v)return e.setLastRejection("note not found"),false;if(e.exitHeaderFooter?.(),e.activeScope().kind==="body"){let w=e.selection();r={anchor:{paragraphId:w.anchor.paragraphId,offset:w.anchor.offset},head:{paragraphId:w.head.paragraphId,offset:w.head.offset}};}if(t={kind:"note",id:gd(u.noteKind,u.noteId)},n=Number.isInteger(d)?d:null,l)e.setSelection({anchor:l,head:l});else {let w=Cb(v),C=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:u.noteKind})),F=w.find(T=>C.has(T.id));if(F){let T=Rb(F);e.setSelection({anchor:{paragraphId:F.id,offset:T},head:{paragraphId:F.id,offset:T}});}}return e.noteModelMoved(),e.render(),n??=e.revealNote(t.id),e.notify(),true};return {insertNote(s){if(e.activeScope().kind!=="body")return e.setLastRejection("insertNote requires body scope"),false;let l=e.deleteSelectionPlan(),d=l.collapseTo;if(!(l.ops.length===0||o(l.ops,()=>({anchor:{...d},head:{...d}}))))return false;let m=$p(e.session.currentPackage(),s);if(!o({op:"insertNote",noteKind:s,paragraphId:d.paragraphId,offset:d.offset},()=>{let C={paragraphId:d.paragraphId,offset:d.offset+1};return {anchor:C,head:C}}))return l.ops.length>0&&e.undo(),false;let w=[...$p(e.session.currentPackage(),s)].find(C=>!m.has(C));return w===void 0?true:a(gd(s,w))},deleteNote(s,l){return o({op:"deleteNote",noteKind:s,noteId:l})},convertNote(s,l){return o({op:"convertNote",fromKind:s,noteId:l})},convertAllNotes(s){return o({op:"convertAllNotes",fromKind:s})},setNoteProperties(s){return o({op:"setNoteProperties",scope:s.scope,sectionIndex:s.sectionIndex,footnote:s.footnote,endnote:s.endnote})},enterNote:a,exitNote(s=true){if(!t)return;let l=r;t=null,n=null,r=null,e.setActiveScopeBodyOrHf({kind:"body"}),s&&l&&e.setSelection(l),e.noteModelMoved(),e.render(),e.notify();},activeNoteScope(){return t},activeNotePageIndex(){return n},setActiveNotePageIndex(s){!t||!Number.isInteger(s)||n!==s&&(n=s);}}}function Cb(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 Rb(e){let t=Td$1(e)[0];return t&&md(t.node)?t.end:0}function $p(e,t){let n=_d$1(e,t),r=new Set;if(!n)return r;for(let o of Bd(n.root)){if(!sd(o))continue;let a=qd(o);a!==null&&r.add(a);}return r}var Eb=500;function Ob(e,t){let n=e.part(),r=Ob$2(n),o=[];for(let a=0;a<r.length;a+=1){let s=r[a];if(s.kind!=="paragraph")continue;let l=ad(s);l&&o.push(l);}if(o.length<t.length){let a=$c$1(e.part());o.push(a&&a.kind!=="textValue"?a:void 0);}for(;o.length<t.length;)o.push(void 0);return o}function Yp(e){if(!e)return null;let t=e.session,n=e.state().selection.head.paragraphId,r=To(t,n,e.activeScope().kind==="headerFooter"?{kind:"headerFooter",rId:e.headerFooterState()?.rId??""}:dt(t,n,{kind:"body"}),e.headerFooterState()?.sectionIndex),o=t.currentPackage(),a=Id(o),s=Jd(a),l=Kd$1(a),d=cd(t.part()),u=Ob(t,d),m=Gd(u[r]),I=Hd(u[r]),v=Ld(m,s),w=Md(I,l);return {sectionIndex:r,footnote:{resolved:v,...s?{documentAuthored:s}:{},...m?{sectionAuthored:m}:{}},endnote:{resolved:w,...l?{documentAuthored:l}:{},...I?{sectionAuthored:I}:{}}}}function Qp(e,t){let n=hd(t);if(!n)return null;let r=_d$1(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=Cd(o.root,n.noteId);if(!a)return null;let s=[],l=Eb,d=(m,I)=>{if(!(I>32||l<=0)){if(m.kind==="paragraph"&&typeof m.id=="string"){let v=(Of$1(o,m.id)??"").replace(/\uFFFC/g,"").trim();if(v){let w=v.slice(0,l);s.push(w),l-=w.length;}return}if(m.kind!=="textValue")for(let v of m.children)d(v,I+1);}};d(a,0);let u=s.filter(Boolean).join(" ").trim();return u.length>0?u:null}function Jp(e){return [()=>{Tc(e().root);},()=>{Kg$1(e());},()=>{sf$1(e());}]}var Fb=50,Ab=16;function eg(e){let t=e.schedule??((l,d)=>{let u=setTimeout(l,d);return ()=>clearTimeout(u)}),n=false,r=null,o=0,a=0,s=l=>{r=t(()=>{if(r=null,!(n||a>=e.steps.length||!e.shouldRun())){if(e.hasPendingInput()){if(o+=1,o>Fb)return;s(Ab);return}try{e.steps[a]();}catch{return}a+=1,a<e.steps.length&&s(0);}},l);};return s(0),()=>{n=true,r&&r(),r=null;}}function tg(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}function nl(e,t,n={}){let r=n,o=j(t,n.reviewModel?{reviewModel:n.reviewModel}:{});if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=o.session,s=n.scale??96/72,l$1={resolve:n.tableInteractionLabel??(i=>Es(i))},d="the document is open for viewing",u="the document is read-only",m="the table of contents is generated and read-only",I="\0range\0",v=()=>`${new Date().toISOString().slice(0,19)}Z`,w=n.measurer?null:Kd(s,{context:vr(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),C=n.measurer??w.measurer,F=yb$1(),T=Dd();function K(){return n.measurer?n.producer??"host-measurer":`${n.producer??w?.producer??"fixed-measurer"}@scale:${s}`}let h=K(),_=e.ownerDocument,L=_.createElement("div");L.className="docx-pages",L.style.position="relative",L.contentEditable="true",L.spellcheck=false,L.setAttribute("role","textbox"),L.setAttribute("aria-multiline","true"),L.style.outline="none";let W=_.createElement("div");W.className="docx-selection-overlay",W.contentEditable="false",W.setAttribute("aria-hidden","true"),W.style.position="absolute",W.style.left="0",W.style.top="0",W.style.pointerEvents="none";let q=_.createElement("div");q.className="docx-comment-overlay",q.contentEditable="false",q.setAttribute("aria-hidden","true"),q.style.position="absolute",q.style.left="0",q.style.top="0",q.style.pointerEvents="none";let A=_.createElement("div");A.className="docx-table-furniture",A.contentEditable="false",A.style.position="absolute",A.style.left="0",A.style.top="0",A.style.pointerEvents="none",e.style.position="relative",e.replaceChildren(L,A,q,W);let $=jf(L,()=>s,()=>{let i=N?.getActive()??null,c=j$1?.activeNoteScope()??null,f=j$1?.activeNotePageIndex()??null,p=i?Xc(L,i.pageIndex):c?Yc(L,c.id,f):null;return {layout:X$1,selection:k$1,measurer:C,...i?{preferredPageIndex:i.pageIndex}:f!==null?{preferredPageIndex:f}:Fe.selectionPageIndex()!==void 0?{preferredPageIndex:Fe.selectionPageIndex()}:{},scopedHost:p,...i?{scopedHostKind:"headerFooter"}:c?{scopedHostKind:"note"}:{}}}),x=new Set(xc(a.part()).flatMap(i=>[i.beginParagraphId,...i.resultParagraphIds,i.endParagraphId])),E=a.paragraphIds(),V=E.find(i=>!x.has(i))??E[0]??"",k$1={anchor:{paragraphId:V,offset:0},head:{paragraphId:V,offset:0}},R=r.initialDrawingSelectionIntent??{kind:"none"};function G(i,c){i.kind===R.kind&&(i.kind!=="pointer"||R.kind==="pointer"&&i.drawingNodeId===R.drawingNodeId)||(R=i,c&&n.onChange?.(Be()));}let U=null,ee$1=null,fe$1=false,ke$1=false,ye=null,be$1=new Map;function pe(){ye=null;for(let i of be$1.values())ye=i;}function Ue(i,c){if(i.paragraphId===c.paragraphId)return i.offset-c.offset;let f=ge();return f.indexOf(i.paragraphId)-f.indexOf(c.paragraphId)}function Ft(i){if(!ye)return;let{from:c,to:f}=Ls(X$1,ye),p=i.head;Ue(p,c)>=0&&Ue(p,f)<=0||(be$1.clear(),ye=null);}let Ee=null;function ct(){return D()?.properties??null}function D(){if(!Ee)return null;let i=Ee.position,c=f=>f.paragraphId===i.paragraphId&&f.offset===i.offset;return c(k$1.anchor)&&c(k$1.head)?Ee:null}function re(i){if(!Ee)return;let c=Ee.position;i.anchor.paragraphId===c.paragraphId&&i.anchor.offset===c.offset&&i.head.paragraphId===c.paragraphId&&i.head.offset===c.offset||(Ee=null);}function b(i,c,f,p){let y=De([...i],f,p);return i.length===c.length||!y.rejected?y:De([...c],f,p)}function P(i,c,f,p){let y=D();if(!y||f===0)return [];let S=Ee.position,M=p&&S.paragraphId===i&&S.offset>=p.start&&S.offset<=p.end?{paragraphId:i,offset:er({paragraphId:i,offset:p.start},{paragraphId:i,offset:p.end})}:Wd$1(X$1,S);return M.paragraphId!==i||M.offset!==c?[]:[{op:"setRunProperties",paragraphId:i,start:c,end:c+f,properties:y.properties.reduce((H,B)=>ng$1(H,rg$1(H,B)),[...y.base])}]}let N=null,j$1=null,te=null,z=()=>va(N?.getActive()??null,j$1?.activeNoteScope()??null),ne=()=>j$1?.activeNoteScope()?.id??null,le$1=i=>{let c=T.multi?.spans,f=0,p=0;if(c&&c.length>0)for(let y=0;y<c.length;y+=1){let S=c[y];if(f=y,p=S.startIndex,i<S.startIndex+S.pageCount)break}return {sectionIndex:f,sectionStart:p}},ge=()=>fr(X$1,N?.getActive()??null,ne()),Me=()=>globalThis.performance?.now()??Date.now(),ot=0,Le=0,We=0,{styleCascade:Ce,numberingIndex:At,defaultTabStopPt:at}=Nf(a),en=null,he$1=n.imageDecodePort??zf(_)??Kf(),me=Qc$1({session:a,decodePort:he$1,onResourcesChanged:()=>en?.()}),un=n.drawingStrings??f$1,Vt=()=>k$1.anchor.paragraphId!==k$1.head.paragraphId||k$1.anchor.offset!==k$1.head.offset?null:{paragraphId:k$1.head.paragraphId,offset:k$1.head.offset},jt=-1,fn=true,Fo=()=>{let i=a.packageRevision();return jt!==i&&(jt=i,fn=!Q(a.settingsRoot()).doNotShadeFormData),fn},Cr=Vf({mintValidatedBytes:(i,c)=>me.mintValidatedBytes(i,c)}),pn=_s({session:a,measurer:C,producer:h,cache:F,styleCascade:Ce,numberingIndex:At,defaultTabStopPt:at,displayMode:n.revisionDisplayMode??lb$1,inlineDrawingLayoutForPart:i=>me.contextForPart(i),drawingLayoutTokenForPart:i=>me.cacheTokenForPart(i),drawingTokenForParagraphForPart:(i,c)=>me.drawingTokenForParagraph(c,i)}),Ao=i=>{let c=Ka$1(i,f=>a.relationshipTarget(f));return i.kind==="textValue"?null:{id:i.id,kind:c.kind,href:c.href,...c.anchor!==void 0?{anchor:c.anchor}:{},...c.tooltip!==void 0?{tooltip:c.tooltip}:{}}},jn=Cp(),Un={...a,applyTreeOps:(i,c,f,p)=>De(i,c,f,p),applyPmDoc:i=>Ne==="view"?{committed:false,rejected:true,opCount:0,reason:d}:ii()?{committed:false,rejected:true,opCount:0,reason:m}:a.applyPmDoc(i)},X$1=Do(),Mt=n.revisionStyles,Mo=r.reviewAuthorSlots??d$1(),tn=null,$a=dp({session:Un,storyScope:z,paragraphOrder:ge,layout:()=>X$1,selection:()=>k$1,commit:(i,c,f)=>Re(i,c,f),orderedRange:()=>an(),selectionMark:()=>Ae(),textOf:i=>$e(i),selectedCells:()=>U?.cellIds,defaultParagraphStyleId:()=>Ce()?.defaultParagraphStyleId??null,defaultFontFamily:()=>n.defaultFontFamily??null,pendingFormats:()=>ct(),setPendingFormats:i=>{if(i===null||i.length===0){if(!Ee)return;Ee=null;}else {let{anchor:c,head:f}=k$1;if(c.paragraphId!==f.paragraphId||c.offset!==f.offset)return;let p=D()?.base??op(a.partFor(z())??a.part(),f.paragraphId,f.offset);Ee={position:f,properties:i,base:p};}n.onChange?.(Be());}}),Tn=Pp({session:Un,storyScope:z,headerFooterSectionIndex:()=>N?.getActive()?.sectionIndex,paragraphOrder:ge,selectedCells:()=>U?.cellIds,layout:()=>X$1,commit:(i,c,f)=>Re(i,c,{rearmPending:D()??void 0,...f?.keepCellSelection?{keepCellSelection:true}:{}}),orderedStart:()=>Ko(),orderedRange:()=>an(),selectionMark:()=>Ae(),collapsedAt:i=>Oe(i),deleteSelectionPlan:()=>Gt(),paragraphTextOf:i=>$e(i),numberingLevelExists:(i,c)=>hc(mc(At(),Ce()),i,c)!==null}),Rr=Np({session:Un,layout:()=>X$1,fieldLinkById:i=>jn.linkById(i),refusesWrite:()=>Qn(true)!==null,storyScope:z,suggestReplacementOffset:(i,c,f)=>Ne==="suggest"?er({paragraphId:i,offset:c},{paragraphId:i,offset:f}):null,insertionLanding:(i,c)=>Wd$1(X$1,{paragraphId:i,offset:c}).offset,selection:()=>k$1,orderedRange:()=>an(),selectionMark:()=>Ae(),textOf:i=>$e(i),commit:(i,c)=>Re(i,c)}),Er=qp({session:Un,storyScope:z,editingMode:()=>Ne,writeRefusal:i=>Qn(true,[i]),selection:()=>k$1,selectionMark:()=>Ae(),commit:(i,c)=>Re(i,c)}),Or=i=>{let c=dt(a,i,{kind:"body"});if(c.kind==="body")return j$1?.exitNote(),N?.exitHeaderFooter(),true;if(c.kind==="headerFooter"){let p=N?.activeScope();return p?.kind==="headerFooter"&&p.rId===c.rId?true:(j$1?.exitNote(),N?.enterHeaderFooter({rId:c.rId})??false)}let f=Lo(i);return f?j$1?.activeNoteScope()?.id===f?true:(N?.exitHeaderFooter(),j$1?.enterNote(f)??false):false},Lo=i=>{for(let c of X$1.pages)for(let f of [c.footnotes,c.endnotes])if(f){for(let p of f.notes)for(let y of Y(p.fragments))if(y.paragraphId===i)return p.scopeId}return null},Wn=Zp({pagesLayer:L,container:e,scale:()=>s,layout:()=>X$1,bookmarks:()=>a.bookmarks(),linkById:i=>jn.linkById(i)??Rr.linkById(i),drawingLinkById:i=>jp(X$1,i),setSelection:i=>it(Oe(i)),enterStoryFor:i=>Or(i),isCollapsedSelection:()=>k$1.anchor.paragraphId===k$1.head.paragraphId&&k$1.anchor.offset===k$1.head.offset,onScrolled:()=>qo(),...n.onHyperlinkPopover?{onPopover:n.onHyperlinkPopover}:{}}),No=Bp({pagesLayer:L,equationById:i=>Er.equationById(i),setSelection:it,...n.onEquationPopover?{onPopover:n.onEquationPopover}:{}});L.addEventListener("contextmenu",vl),L.addEventListener("click",Il),L.addEventListener("pointermove",Cn),L.addEventListener("pointerleave",En);let Ut=null;function Fr(i,c){c&&kc(T,c),me.sync(a);let f=qf({session:a,measurer:C,producer:h,cache:F,styleCascade:Ce,numberingIndex:At,defaultTabStopPt:at,inlineDrawingLayoutForPart:p=>me.contextForPart(p),drawingTokenForParagraphForPart:(p,y)=>me.drawingTokenForParagraph(y,p),drawingLayoutEpochForPart:p=>me.cacheTokenForPart(p)});return Fd(a.part(),i,{measurer:C,cache:F,session:T,producer:h,styleCascade:Ce(),defaultTabStopPt:at,numberingIndex:At(),sectionFurniture:pn.sectionFurniture(),furniture:pn.furniture(),projectLink:Ao,projectFieldLink:p=>jn.project(p),documentProperties:a.documentProperties(),inlineDrawingLayout:me.bodyContext,drawingTokenForParagraph:p=>me.drawingTokenForParagraph(p,a.part().name),drawingLayoutEpoch:me.cacheTokenForPart(a.part().name),...f?{notes:f}:{},...n.revisionDisplayMode?{displayMode:n.revisionDisplayMode}:{}})}function Do(){let i=Me(),c=Fr(a.packageRevision());return ot=Me()-i,c}let xt=null,Gn=null,Ho=false;function $n(){if(Ho)return;Ho=true;let i=a.packageRevision();Gn=eg({steps:Jp(()=>a.part()),shouldRun:()=>Ne!=="view"&&a.editable&&a.packageRevision()===i,hasPendingInput:Pn});}function Pn(i=true){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:i})??false}function gn(){if(!Pn()){pt(),$n();return}xt===null&&(xt=setTimeout(()=>{xt=null,Ke.pending()===null&&(pt(),$n());},0));}let Lt="",mn=null,Xn=false;function ut(){if(Xn||(mn!==null&&(clearTimeout(mn),mn=null),Lt.length===0))return;let i=Lt;Lt="",Xn=true;try{qe.type(i);}catch(c){throw Lt=i+Lt,c}finally{Xn=false;}}function Xa(i){Lt+=i,mn===null&&(mn=setTimeout(()=>{mn=null,ut();},0));}function Ar(i,c,f){ut();let p=f?.trim()||n.author?.trim();if(!p)return ee$1="tracked changes need a non-empty author",n.onChange?.(Be()),false;if(i!=="deletion"&&c.length===0)return ee$1=`${i} requires non-empty text`,n.onChange?.(Be()),false;if(i!=="deletion"&&/[\r\n\v\f\u2028\u2029]/.test(c))return ee$1=`${i} requires text without a paragraph mark`,n.onChange?.(Be()),false;let y={author:p,date:v()},S=an(),M=S.from.paragraphId===S.to.paragraphId&&S.from.offset===S.to.offset;if(i!=="insertion"&&M&&!(i==="replacement"&&U))return ee$1=`${i} needs a non-collapsed selection`,n.onChange?.(Be()),false;let H=i==="insertion"?{ops:[],collapseTo:Wd$1(X$1,S.from)}:Gt(p),B=Tl(H.ops,y),ie=H.collapseTo;if(i==="insertion"||i==="replacement"){let Q=i==="replacement"?H.replaceAt??H.collapseTo:H.collapseTo;B.push({op:"insertText",paragraphId:Q.paragraphId,offset:Q.offset,text:c,revision:y}),ie={paragraphId:Q.paragraphId,offset:Q.offset+c.length};}let Y=false;return Re(()=>{let Q=De(B,Ae(),yn(ie));return Y=Q.committed,Q},()=>Oe(ie)),Y}let Ke=Rd({run:i=>{let c=Me(),f=Fr(i.revision,i);return ot=Me()-c,f},currentRevision:()=>a.packageRevision(),schedule:i=>{let c=setTimeout(i,0);return ()=>clearTimeout(c)},publish:i=>{tn!==null&&(tn={...tn,layout:null,items:null}),X$1=i,gn();}}),g=false;en=()=>{Ke.invalidateAll(a.packageRevision(),"drawing-resources"),!g&&(g=true,setTimeout(()=>{g=false,oe();},0));};let O=a.subscribe(i=>{Em(i),Ee=null,Ke.notify(i);});function Z(){let i=_f(e,X$1,k$1,s),c=N?.getActive()?.pageIndex??Fe.selectionPageIndex();return c===void 0||i===void 0||i.has(c)?i:new Set([...i,c])}function oe(){return Ke.pending()?Ke.flush():false}let J=8;function se(i){!i&&Ke.pending()!==null&&ot>J&&Pn(false)||oe()||pt();}function ue(){ut(),oe();}function Pe(){ut();let i=oe();return xt!==null?(pt(),$n(),true):i}let ae$1=null;function we(i){return i.contentControlId??`toc:${i.id}`}function Ie(i){return xc(a.part()).find(c=>c.beginParagraphId===i||c.endParagraphId===i||c.resultParagraphIds.includes(i))}function Ge(){for(let i of L.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(i.getAttribute("data-docx-content-control")===ae$1){i.dataset.hover="",i.dataset.boundaryVisible="";continue}delete i.dataset.hover,fe$1||delete i.dataset.boundaryVisible;}}function hn(i){ae$1!==i&&(ae$1=i,Ge());}function Cn(i){let f=i.target?.closest("[data-paragraph-id]")?.dataset.paragraphId,p=f?Ie(f):null;hn(p?we(p):null);}function Rn(i){let c=i.target,f=c?.isConnected?c.closest("[data-paragraph-id]"):void 0;if(f)return f.dataset.paragraphId;let p=L.ownerDocument;return typeof p.elementFromPoint!="function"?void 0:p.elementFromPoint(i.clientX,i.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function En(){hn(null);}function Te(){let i=ft(),c=Sc(a.part()),p=xc(a.part()).map(Q=>{let xe=Ve(Q);return xe?{...xe,empty:c.has(Q.beginParagraphId)}:null}).filter(Q=>Q!==null),y=new Set(p.map(Q=>Q.boundary.id)),S=new Set(p.filter(Q=>Q.empty).map(Q=>Q.boundary.id)),M=i&&!y.has(i.id)?new Set([i.id]):void 0,H=ae$1?new Set([ae$1]):void 0,B=new Set(be(X$1).filter(Q=>Q.controlType==="checkbox"&&bl(Q.id)).map(Q=>Q.id)),ie=p.filter(Q=>Q.additional&&!Q.empty).map(Q=>Q.boundary),Y=kl()!==null;if(!(!fe$1&&!M&&!H&&!Y&&B.size===0&&ie.length===0&&y.size===0))return {...Y?{readOnly:true}:{},...fe$1?{showAll:true}:{},...M?{activeIds:M}:{},...H?{hoverIds:H}:{},...B.size>0?{checkedIds:B}:{},...ie.length>0?{additionalBoundaries:ie}:{},...y.size>0?{tocControlIds:y}:{},...S.size>0?{suppressedIds:S}:{}}}function Ve(i){let c=i.contentControlId?be(X$1).find(y=>y.id===i.contentControlId):void 0;if(c)return {tocId:i.id,boundary:c,additional:false};let f=new Set([i.beginParagraphId,...i.resultParagraphIds,i.endParagraphId]),p=X$1.pages.flatMap(y=>{let S=X(y).filter(Y=>f.has(Y.paragraphId)).map(Y=>Y.box);if(S.length===0)return [];let M=Math.min(...S.map(Y=>Y.x)),H=Math.min(...S.map(Y=>Y.y)),B=Math.max(...S.map(Y=>Y.x+Y.width)),ie=Math.max(...S.map(Y=>Y.y+Y.height));return [{pageIndex:y.index,box:{x:M,y:H,width:B-M,height:ie-H}}]});return p.length===0?null:{tocId:i.id,additional:true,boundary:{id:`toc:${i.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:p}}}let St=null;function ft(){let i=z();if(i.kind!=="body")return lm(i);if(St&&St.layout===X$1&&St.selection===k$1)return St.result;let c=Mr();return St={layout:X$1,selection:k$1,result:c},c}function Mr(){let i=_d(X$1,k$1.head,C);if(!i)return null;let c=ae(X$1,{x:i.x,y:i.y+i.height/2,pageIndex:i.pageIndex});return c&&_o(c.id)===a.part().name?c:null}function _o(i){let c=i.indexOf("#");return c===-1?"":i.slice(0,c)}function lm(i){let c=a.partFor(i);return c?Wc$1(c,k$1.head.paragraphId):null}function hl(i){return i.bound?"bound":i.effectiveLock==="contentLocked"||i.effectiveLock==="sdtContentLocked"?"locked":null}function dm(i){return i.effectiveLock==="sdtLocked"||i.effectiveLock==="sdtContentLocked"?"locked":null}function cm(i){return Hb$1(i)}function Yn(i){let c=Qt(a,i),f=va$1(c??a.part(),i);return !f||!cm(f)?null:f}function yl(i){let c=Yn(i);if(!c)return null;for(let f of c.children)if(f.kind!=="textValue"&&(f.kind==="contentControlProperties"||f.localName==="sdtPr"))for(let p of f.children){if(p.kind==="textValue"||p.localName!=="tabIndex")continue;let y=p.attributes.find(M=>M.localName==="val")?.value;if(y===void 0)return null;let S=Number(y);return Number.isFinite(S)?S:null}return null}function um(){let i=z(),c=i.kind==="body"?null:a.partFor(i),f=i.kind==="notesPart"?new Set(ge()):void 0;return (c?[...Vc$1(c,f)]:[...be(X$1)]).filter(y=>hl(y)===null).sort((y,S)=>{let M=yl(y.id),H=yl(S.id);return M!==null&&H!==null&&M!==H?M-H:M!==null&&H===null?-1:M===null&&H!==null?1:0})}function On(i){if(i.kind==="textValue")return i.value.length;if(i.kind==="tab"||i.kind==="hardBreak")return 1;if(i.kind==="runProperties"||i.kind==="generic")return 0;if(i.kind==="contentControl"){let p=0;for(let y of i.children)if(y.kind!=="textValue"&&(y.kind==="contentControlContent"||y.localName==="sdtContent"))for(let S of y.children)p+=On(S);return p}let f=0;for(let p of i.children)f+=On(p);return f}function Ya(i){for(let c of i.children)if(c.kind!=="textValue"&&(c.kind==="contentControlContent"||c.localName==="sdtContent"))return c.children;return []}function fm(i){let c=Yn(i);if(!c)return false;let f=Ya(c),p=[],y=ie=>{for(let Y of ie){if(Y.kind==="paragraph"){p.push({id:Y.id,length:On(Y)});continue}if(Y.kind==="textValue")continue;if(Y.kind==="contentControl"){y(Ya(Y));continue}y(Y.children);}};if(y(f),p.length>0){let ie=p[0],Y=p[p.length-1];return it({anchor:{paragraphId:ie.id,offset:0},head:{paragraphId:Y.id,offset:Y.length}}),true}let S=null,M=0,H=0,B=(ie,Y,Q)=>{let xe=Y;for(let ve of ie){if(ve.id===i)return S=Q,M=xe,H=xe+On(ve),true;if(ve.kind==="textValue"){xe+=ve.value.length;continue}if(ve.kind==="contentControl"){let mt=On(ve);if(B(Ya(ve),xe,Q))return true;xe+=mt;continue}if(ve.kind==="run"||ve.kind==="hyperlink"){if(B(ve.children,xe,Q))return true;xe+=On(ve);continue}if(ve.kind==="paragraph"){if(B(ve.children,0,ve.id))return true;continue}if(ve.kind==="tab"||ve.kind==="hardBreak"){xe+=1;continue}if(B(ve.children,xe,Q))return true;xe+=On(ve);}return false};return B((a.partFor(dt(a,i,z()))??a.part()).root.children,0,""),S?(it({anchor:{paragraphId:S,offset:M},head:{paragraphId:S,offset:H}}),true):false}function pm(i){let c=Yn(i);if(!c)return [];for(let f of c.children)if(f.kind!=="textValue"&&!(f.kind!=="contentControlProperties"&&f.localName!=="sdtPr"))for(let p of f.children){if(p.kind==="textValue"||p.localName!=="dropDownList"&&p.localName!=="comboBox")continue;let y=[];for(let S of p.children){if(S.kind==="textValue"||S.localName!=="listItem")continue;let M=S.attributes.find(B=>B.localName==="value")?.value??"",H=S.attributes.find(B=>B.localName==="displayText")?.value??M;y.push({displayText:H,value:M});}return y}return []}function bl(i){let c=Yn(i);if(!c)return false;for(let f of c.children)if(f.kind!=="textValue"&&!(f.kind!=="contentControlProperties"&&f.localName!=="sdtPr")){for(let p of f.children)if(p.kind==="contentControlCheckbox")for(let y of p.children){if(y.kind!=="contentControlChecked")continue;let S=y.attributes.find(M=>M.localName==="val")?.value;return !(S==="0"||S==="false"||S==="off")}}return false}function gm(i){let c=Yn(i);if(c){for(let f of c.children)if(f.kind==="contentControlProperties"){for(let p of f.children)if(p.kind==="contentControlDate")return p.attributes.find(y=>y.localName==="fullDate")?.value}}}function Qa(i,c){for(let f of L.querySelectorAll("[data-docx-content-control]"))f.getAttribute("data-docx-content-control")===i&&(c?f.dataset.open="":delete f.dataset.open);}function nn(i){let c=i.dataset.docxCcId;i.remove(),c&&Qa(c,false);}function Ja(){let i=L.querySelector(".docx-content-control-menu");i&&nn(i);}function vl(i){let c=Rn(i),f=c?Ie(c):void 0;mm(f&&di(f.id)?f.id:null);}let Lr=null;function mm(i){Lr!==i&&(Lr=i,n.onChange?.(Be()));}function Il(i){if(i.button!==0||i.target?.closest("a.docx-hyperlink")||k$1.anchor.paragraphId!==k$1.head.paragraphId||k$1.anchor.offset!==k$1.head.offset)return;let c=Rn(i);if(!c)return;let f=xc(a.part()).find(S=>S.resultParagraphIds.includes(c));if(!f)return;let y=H(a.part(),f,a.documentOutline(),si(f))[f.resultParagraphIds.indexOf(c)];y&&(i.preventDefault(),Wn.goToPosition({paragraphId:y,offset:0}));}function hm(i,c){let f=rn.disabledReason(i,"edit");if(f){ee$1=f,n.onChange?.(Be());return}if(c==="checkbox"){rn.setValue(i,bl(i)?"false":"true");return}if(c==="dropdown"||c==="comboBox"){let p=pm(i);if(p.length===0&&c==="dropdown")return;Ja();let y=_.createElement("div");y.className="docx-content-control-menu",y.dataset.docxMarker="",y.dataset.docxCcId=i,y.setAttribute("contenteditable","false"),y.setAttribute("role","listbox"),y.style.position="absolute",y.style.zIndex="20",y.style.pointerEvents="auto",y.addEventListener("pointerdown",B=>B.stopPropagation());let M=be(X$1).find(B=>B.id===i)?.fragments[0];if(M){let B=X$1.pages[M.pageIndex],ie=je?.pageOffsetX.get(M.pageIndex)??0;if(B){let Y=B.contentBox.x-B.box.x,Q=B.contentBox.y-B.box.y;y.style.left=`${(B.box.x+ie+Y+M.box.x+M.box.width)*s}px`,y.style.top=`${(B.box.y+Q+M.box.y+M.box.height)*s}px`,y.style.transform="translateX(-100%)";}}for(let B of p){let ie=_.createElement("button");ie.type="button",ie.className="docx-content-control-menu-item",ie.dataset.docxMarker="",ie.setAttribute("contenteditable","false"),ie.setAttribute("role","option"),ie.textContent=B.displayText,ie.addEventListener("mousedown",Y=>{Y.preventDefault(),Y.stopPropagation(),nn(y),rn.setValue(i,B.value);}),y.append(ie);}if(c==="comboBox"){let B=_.createElement("input");B.type="text",B.className="docx-content-control-menu-input",B.dataset.docxMarker="",B.setAttribute("contenteditable","false"),B.addEventListener("mousedown",ie=>ie.stopPropagation()),B.addEventListener("keydown",ie=>{ie.key==="Enter"&&(ie.preventDefault(),nn(y),rn.setValue(i,B.value));}),y.append(B);}L.append(y),Qa(i,true);let H=B=>{y.contains(B.target)||(nn(y),_.removeEventListener("mousedown",H,true));};_.addEventListener("mousedown",H,true);return}if(c==="date"){Ja();let p=_.createElement("div");p.className="docx-content-control-menu",p.dataset.docxMarker="",p.dataset.docxCcId=i,p.setAttribute("contenteditable","false"),p.style.position="absolute",p.style.zIndex="20",p.style.pointerEvents="auto",p.addEventListener("pointerdown",Se=>Se.stopPropagation());let y=be(X$1).find(Se=>Se.id===i),S=y?.fragments[0];if(S){let Se=X$1.pages[S.pageIndex],$t=je?.pageOffsetX.get(S.pageIndex)??0;if(Se){let Mn=Se.contentBox.x-Se.box.x,kt=Se.contentBox.y-Se.box.y;p.style.left=`${(Se.box.x+$t+Mn+S.box.x+S.box.width)*s}px`,p.style.top=`${(Se.box.y+kt+S.box.y+S.box.height)*s}px`,p.style.transform="translateX(-100%)";}}p.classList.add("docx-content-control-calendar");let M=gm(i),H=M?new Date(M):new Date,B=Number.isNaN(H.getTime())?null:H,ie=B??new Date,Y=ie.getFullYear(),Q=ie.getMonth(),xe=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),ve=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),Xe=new Intl.DateTimeFormat(void 0,{weekday:"narrow"}),mt=Se=>`${Se.getFullYear().toString().padStart(4,"0")}-${(Se.getMonth()+1).toString().padStart(2,"0")}-${Se.getDate().toString().padStart(2,"0")}`,He=(Se,$t)=>Se.getFullYear()===$t.getFullYear()&&Se.getMonth()===$t.getMonth()&&Se.getDate()===$t.getDate(),Je=null,st=()=>{let Se=_.createElement("input");Se.type="date",Se.className="docx-content-control-calendar-input",Se.value=B?mt(B):"";let $t=Se.value;y?.alias&&Se.setAttribute("aria-label",y.alias);let Mn=()=>{if(!Se.value||Se.value===$t)return false;let et=Se.value;return nn(p),rn.setValue(i,et),true};Je=Mn,Se.addEventListener("keydown",et=>{et.key==="Enter"&&(et.preventDefault(),Mn()||nn(p));}),Se.addEventListener("blur",()=>{queueMicrotask(()=>{!p.isConnected||p.contains(_.activeElement)||Mn()||nn(p);});});let kt=_.createElement("div");kt.className="docx-content-control-calendar-header";let _e=_.createElement("button");_e.type="button",_e.className="docx-content-control-calendar-nav",_e.textContent="\u2039";let Ye=new Date(Y,Q-1,1);_e.setAttribute("aria-label",xe.format(Ye));let Ln=_.createElement("div");Ln.className="docx-content-control-calendar-title",Ln.textContent=xe.format(new Date(Y,Q,1));let Nt=_.createElement("button");Nt.type="button",Nt.className="docx-content-control-calendar-nav",Nt.textContent="\u203A";let Nn=new Date(Y,Q+1,1);Nt.setAttribute("aria-label",xe.format(Nn)),_e.addEventListener("mousedown",et=>et.stopPropagation()),Nt.addEventListener("mousedown",et=>et.stopPropagation()),_e.addEventListener("click",()=>{Q-=1,Q<0&&(Q=11,Y-=1),st();}),Nt.addEventListener("click",()=>{Q+=1,Q>11&&(Q=0,Y+=1),st();}),kt.append(_e,Ln,Nt);let tr=_.createElement("div");tr.className="docx-content-control-calendar-weekdays";for(let et=0;et<7;et+=1){let sn=_.createElement("span");sn.textContent=Xe.format(new Date(2024,0,1+et)),tr.append(sn);}let jo=_.createElement("div");jo.className="docx-content-control-calendar-grid",jo.setAttribute("role","grid");let zm=(new Date(Y,Q,1).getDay()+6)%7,Km=new Date;for(let et=0;et<42;et+=1){let sn=new Date(Y,Q,et-zm+1),wt=_.createElement("button");wt.type="button",wt.className="docx-content-control-calendar-day",wt.textContent=String(sn.getDate()),wt.setAttribute("role","gridcell"),wt.setAttribute("aria-label",ve.format(sn)),sn.getMonth()!==Q&&(wt.dataset.otherMonth=""),B&&He(sn,B)&&(wt.dataset.selected="",wt.setAttribute("aria-selected","true")),He(sn,Km)&&(wt.dataset.today=""),wt.addEventListener("mousedown",Vm=>Vm.stopPropagation()),wt.addEventListener("click",()=>{nn(p),rn.setValue(i,mt(sn));}),jo.append(wt);}p.replaceChildren(Se,kt,tr,jo);};st(),L.append(p),Qa(i,true);let bn=Se=>{p.contains(Se.target)||(Je?.()||nn(p),_.removeEventListener("mousedown",bn,true));};_.addEventListener("mousedown",bn,true),p.querySelector("[data-selected], [data-today], .docx-content-control-calendar-day")?.focus({preventScroll:true});}}let rn={setShowAll(i){fe$1!==i&&(fe$1=i,pt());},setFormFill(i){ke$1!==i&&(ke$1=i,n.onChange?.(Be()));},showAll:()=>fe$1,formFill:()=>ke$1,atCaret:()=>ft(),navigate(i){let c=um();if(c.length===0)return false;let f=ft(),p=f?c.findIndex(S=>S.id===f.id):-1;i==="next"?p=p<0?0:(p+1)%c.length:p=p<0?c.length-1:(p-1+c.length)%c.length;let y=c[p];return fm(y.id)},setValue(i,c){let f=rn.disabledReason(i,"edit");if(f)return ee$1=f,n.onChange?.(Be()),false;let p=false;return Re(()=>{let y=De([{op:"setContentControlValue",controlId:i,value:c}],Ae(),void 0,dt(a,i,z()),false);return p=y.committed,y}),p},remove(i){let c=i??ft()?.id;if(!c)return ee$1="notFound",n.onChange?.(Be()),false;let f=rn.disabledReason(c,"remove");if(f)return ee$1=f,n.onChange?.(Be()),false;let p=false;return Re(()=>{let y=De([{op:"removeContentControl",controlId:c}],Ae(),void 0,dt(a,c,z()),false);return p=y.committed,y}),p},disabledReason(i,c){let f=kl();if(f!==null)return f;let p=be(X$1).find(S=>S.id===i);if(p)return c==="remove"?dm(p):hl(p);let y=Yn(i);if(!y)return "notFound";for(let S of y.children)if(S.kind!=="textValue"&&!(S.kind!=="contentControlProperties"&&S.localName!=="sdtPr")){if(S.children.some(M=>M.kind!=="textValue"&&M.localName==="dataBinding")&&c==="edit")return "bound";for(let M of S.children){if(M.kind==="textValue"||M.localName!=="lock")continue;let H=M.attributes.find(B=>B.localName==="val")?.value;if(c==="remove"){if(H==="sdtLocked"||H==="sdtContentLocked")return "locked"}else if(H==="contentLocked"||H==="sdtContentLocked")return "locked"}}return null}};function ei(){let i=Sl&&Ne!=="view";L.contentEditable=i?"true":"false",L.setAttribute("aria-readonly",i?"false":"true");}function Be(){return {revision:a.packageRevision(),pageCount:X$1.pages.length,selection:k$1,cellSelection:U,canUndo:a.canUndo(),canRedo:a.canRedo(),lastRejection:ee$1,pendingFormat:ct(),contentControls:{showAll:fe$1,formFill:ke$1,activeControlId:ft()?.id??null},contextTocId:Lr,perf:{layoutMs:ot,paintMs:Le,selectionMs:We,placed:T.stats.placed,total:T.stats.total,reusedPages:T.stats.reusedPages,fullPasses:T.stats.fullPasses,staleDiscards:Ke.staleDiscards,cancelledRuns:Ke.cancelledRuns}}}let Wt,je,ti=null,Bo=false,Nr=null,ni=null;function ym(i){for(let c of X$1.pages){let f=L.children.item(c.index);if(f?.dataset.pageIndex!==String(c.index))continue;let p=i.pageOffsetX.get(c.index)??0;f.style.left=`${(c.box.x+p)*s}px`;}}function pt(i=true){xt!==null&&(clearTimeout(xt),xt=null,i=true);let c=Fe.adoptBeforePaint(),f=Me();Wt=Z(),N?.reconcileOccurrence();let p=N?.getActive()??null,y=Te(),S=Sc(a.part());k(L,X$1,{scale:s,readOnlyParagraphIds:zo(),...S.size>0?{emptyTocPlaceholderIds:S}:{},...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},materialize:Wt,ariaHidden:false,drawingStrings:un,...n.fieldShading?{fieldShading:n.fieldShading}:{},...Mt!==void 0?{revisionStyles:Mt}:{},shadeFormFields:Fo(),...Cr?{imageUrlPort:Cr}:{},...p?{activeHeaderFooterRId:p.scope.rId,activeHeaderFooterPageIndex:p.pageIndex}:{},...y?{contentControlChrome:y}:{}},ai().value),Ms(L,Vt(),{domReplaced:true}),eu(e,L,p!=null),Ui(e,Ne),je=Fa(X$1,Wt),ym(je),L.style.width=`${je.width*s}px`,L.style.height=`${je.height*s}px`,e.style.width=`${je.width*s}px`,e.style.height=`${je.height*s}px`,W.style.width=`${je.width*s}px`,W.style.height=`${je.height*s}px`,q.style.width=W.style.width,q.style.height=W.style.height,A.style.width=W.style.width,A.style.height=W.style.height,zr.update(),Le=Me()-f,Br(),Jn(true),Jl(),Fe.mirrorToDom(),xl(Bo),Bo=false,(i||c)&&n.onChange?.(Be());}function qo(){ue();let i=Z(),c=Fa(X$1,i);je&&Bs(i,Wt)&&Bf(c,je)||pt(false);}function xl(i=false){if(N?.getActive()||j$1?.activeNoteScope()||k$1.anchor.paragraphId!==k$1.head.paragraphId||k$1.anchor.offset!==k$1.head.offset)return;let c=_.activeElement;if(c!==L&&(!c||!L.contains(c)))return;let f=_d(X$1,k$1.head,{measurer:C,...Fe.selectionPageIndex()!==void 0?{preferredPageIndex:Fe.selectionPageIndex()}:{}});if(!f)return;let p=ti!==null&&ti!==f.pageIndex;if(ti=f.pageIndex,!i&&!p)return;let y=X$1.pages[f.pageIndex],S=It(e);if(!y||!S||S.clientHeight<=0)return;let M=24,H=y.contentBox.y-y.box.y,B=(y.box.y+H+f.y)*s+e.offsetTop,ie=B+f.height*s,Y=S.scrollTop,Q=Y+S.clientHeight,xe=Y;if(B<Y+M)xe=B-M;else if(ie>Q-M)xe=ie+M-S.clientHeight;else return;let ve=Math.max(0,S.scrollHeight-S.clientHeight),Xe=Math.max(0,Math.min(xe,ve));Math.abs(Xe-S.scrollTop)<.5||(S.scrollTop=Xe,pi());}let Ne=n.editingMode??"edit",Sl=true,bm=Object.freeze({kind:"body"});function De(i,c,f,p=z(),y=true){ut();let S=Qn(i.some(vm),i,y);if(S!==null)return {committed:false,rejected:true,opCount:0,reason:S};let M=Sm(i),H=a.applyTreeOps(M,c,f,p);return H.committed&&M.some(xm)&&r.onTrackedChange?.(),H}function Qn(i,c=[],f=true){return Ne==="view"?d:i&&(f&&ii()||c.some(p=>Am(p)))?m:Ne==="suggest"&&!n.author?.trim()&&i?"suggesting needs an author before it can propose a change":Ne==="suggest"&&c.some(p=>p.op==="deleteNote")?"suggesting cannot delete a note outright; strike its reference to propose the deletion":null}function kl(){let i=Qn(true,[],false);return i!==null?i:a.editable?null:u}function vm(i){return i.op!=="acceptRevision"&&i.op!=="rejectRevision"&&i.op!=="acceptAllRevisions"&&i.op!=="rejectAllRevisions"}let Im=new Set(["insertText","deleteText","insertTab","insertHardBreak","insertPageBreak","insertPageField","insertNote","insertTableRow","deleteTableRow"]);function wl(i){return Im.has(i.op)}function xm(i){if(wl(i))return i.revision!==void 0;switch(i.op){case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;case "splitParagraphMany":return i.revision!==void 0;default:return false}}function Tl(i,c){return i.flatMap(f=>wl(f)?[f.revision!==void 0?f:{...f,revision:c}]:f.op==="splitParagraphMany"?[{...f,revision:c}]:f.op==="splitParagraph"?[f,{op:"setParagraphMarkRevision",paragraphId:f.paragraphId,kind:"ins",revision:c}]:f.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:f.secondId,revision:c}]:[f])}function Sm(i){let c=n.author?.trim();return Ne!=="suggest"||!c?[...i]:Tl(i,{author:c,date:v()})}function km(i,c,f){let p=$e(c);if(p===f)return i;let y=0;for(;y<f.length&&y<p.length&&f[y]===p[y];)y+=1;let S=0;for(;S<f.length-y&&S<p.length-y&&f[f.length-1-S]===p[p.length-1-S];)S+=1;let M=p.length-f.length,H=B=>B.paragraphId!==c||B.offset<=y?B:B.offset>=f.length-S?{...B,offset:B.offset+M}:{...B,offset:y};return {anchor:H(i.anchor),head:H(i.head)}}function wm(i,c){let f=a.partFor(z())??a.part(),p=wa$1(f,i),y=wa$1(f,c);return p!==null&&y!==null&&p.id===y.id}function yn(i){return {paragraphId:i.paragraphId,start:i.offset,end:i.offset}}function Re(i,c,f={}){ut(),f?.keepCellSelection||(U=null),Ee=null,Fe.noteModelMoved();let p=i(),y=typeof p=="boolean"||!p.rejected?null:p;if(y)ee$1=String(y.reason??"rejected");else {ee$1=null;let S=c?.();S&&(_r(),k$1=S,G({kind:"none"},false),Ut=null,Bo=true);let M=f?.rearmPending;if(M&&M.properties.length>0){let{anchor:H,head:B}=k$1;H.paragraphId===B.paragraphId&&H.offset===B.offset&&(Ee={properties:M.properties,base:M.base,position:B});}}se(y!==null);}function Tm(){if(!Wt)return true;for(let i of [k$1.anchor,k$1.head]){let c=_d(X$1,i);if(c&&!Wt.has(c.pageIndex))return false}return true}function it(i,c=false){let f=!Rt(i,k$1);Lt.length>0&&f&&ut(),re(i),Ft(i);let p=ft()?.id??null,y=qr(k$1.head.paragraphId);_r(),k$1=i,U=null,c||(Ut=null),Tm()||(Fe.noteModelMoved(),pt(false)),Fe.noteSelectionSettled(),Fe.mirrorToDom(true),xl(true),Br(),An.clear(),Jn();let S=ft()?.id??null,M=qr(k$1.head.paragraphId);(p!==S||y!==M)&&pt(false),n.onChange?.(Be());}let Fe=hp({session:a,storyScope:z,document:_,pagesLayer:L,selection:()=>k$1,setSelection:i=>it(i),adoptSelection:i=>{re(i),Ft(i),_r(),k$1=i,Ut=null,Bo=true;},commit:i=>Re(i),applyOps:(i,c,f)=>De(i,c,void 0,f),hasPendingInput:()=>Lt.length>0,replacementOffset:(i,c,f)=>er({paragraphId:i,offset:c},{paragraphId:i,offset:f}),render:()=>pt(),flushLayout:()=>oe(),flushToPaint:()=>Pe(),updateCaret:()=>{$.update(),Ms(L,Vt());},textOf:i=>$e(i),pendingFormatOps:(i,c,f,p)=>P(i,c,f,p),selectionMark:()=>Ae(),now:Me,recordSelectionMs:i=>{We=i;},isGesturing:()=>ci?.dragging()??false,domSelection:()=>U?Oe(U.text.anchor):k$1,holdsCellSelection:()=>U!==null,replaceSelectionWith:i=>qe.type(i),discardPaint:()=>i(L)});N=Gp({session:a,layout:()=>X$1,sectionAtPage:le$1,selection:()=>k$1,setScopeSelection:i=>{ut(),_r(),re(i),An.clear(),k$1=i,U=null,Ut=null;},noteModelMoved:()=>Fe.noteModelMoved(),render:()=>pt(),mirrorToDom:()=>Fe.mirrorToDom(),notify:()=>n.onChange?.(Be()),materializedPages:()=>Wt,entryRefused:()=>Ne==="view",leaveOtherStories:()=>j$1?.exitNote()}),j$1=Xp({session:a,exitHeaderFooter:()=>N?.exitHeaderFooter(),applyOps:De,commit:Re,selection:()=>k$1,selectionMark:()=>Ae(),orderedStart:()=>Ko(),deleteSelectionPlan:()=>Gt(),undo:()=>qe.undo(),activeScope:()=>{let i=j$1?.activeNoteScope();return i||(N?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:i=>N.setActiveScope(i),setSelection:i=>it(i),noteModelMoved:()=>Fe.noteModelMoved(),render:()=>{oe()||pt();},revealNote:i=>{oe();for(let c of X$1.pages){let f=[...c.footnotes?.notes??[],...c.endnotes?.notes??[]].find(p=>p.scopeId===i);if(f)return Zr(f.box.y,f.box.height,{block:"nearest",offsetPx:48}),c.index}return null},notify:()=>n.onChange?.(Be()),lastRejection:()=>ee$1,setLastRejection:i=>{ee$1=i;}});function Pl(i){i&&ut(),U=i,i&&(re(i.text),_r(),k$1=i.text),Ut=null,Fe.noteSelectionSettled(),Fe.mirrorToDom(),Br(),An.clear(),Jn(),n.onChange?.(Be());}let Fn=null;function Pm(){let c=_d(X$1,k$1.head)?.pageIndex??0,f=new Set;for(let p=c-1;p<=c+1;p+=1)p>=0&&p<X$1.pages.length&&f.add(p);return f}let Cl=new WeakMap;function Cm(i){let c=Cl.get(i);if(c)return c;let f=new Map;for(let p of i.pages)for(let y of X(p))f.has(y.paragraphId)||f.set(y.paragraphId,p.index);return Cl.set(i,f),f}function Rm(){let i=a.revision(),c=Wt??Pm();if(Fn?.layout===X$1&&Fn.revision===i&&Bs(Fn.pages,c))return Fn.rects;let f=Cm(X$1),p=(H,B)=>{if(!c)return true;let ie=f.get(H),Y=f.get(B);if(ie===void 0||Y===void 0)return true;for(let Q=Math.min(ie,Y);Q<=Math.max(ie,Y);Q+=1)if(c.has(Q))return true;return false},y=[];for(let H of a.reviewItems()){if(H.kind==="comment"){if(H.range===null||!p(H.range.start.paragraphId,H.range.end.paragraphId))continue;y.push({key:wg$1(H),from:{paragraphId:H.range.start.paragraphId,offset:H.range.start.offset},to:{paragraphId:H.range.end.paragraphId,offset:H.range.end.offset}});continue}let B=wg$1(H),ie=H.kind==="revision"?H.ranges:H.range?[H.range]:[];for(let[Y,Q]of ie.entries())p(Q.start.paragraphId,Q.end.paragraphId)&&y.push({key:ie.length===1?B:`${B}${I}${Y}`,from:{paragraphId:Q.start.paragraphId,offset:Q.start.offset},to:{paragraphId:Q.end.paragraphId,offset:Q.end.offset}});}let S=Ud(X$1,y,c),M=[];for(let[H,B]of S)for(let ie of B)M.push({...ie,key:H});return Fn={layout:X$1,revision:i,pages:c,rects:M},M}let on=null;function Em(i){on&&(i.impact==="text-local"&&i.created.length===0&&i.deleted.length===0&&i.splitJoin.length===0?on={packageRevision:a.packageRevision(),bodyRoot:a.part().root,index:on.index}:on=null);}function Om(){let i=a.packageRevision(),c=a.part().root;if(on&&on.packageRevision===i&&on.bodyRoot===c)return on.index;let f=new Map,p=S=>{let M=f.size;for(let[H,B]of S)f.has(H)||f.set(H,M+B);};p(Kg$1(a.part()));let y=new Set([a.part()]);for(let S of a.headerFooterPartsBySection())for(let M of [S.headers,S.footers])for(let H of M.values())y.has(H)||(y.add(H),p(Kg$1(H)));for(let S of ["footnote","endnote"]){let M=a.partFor({kind:"notesPart",noteKind:S});!M||y.has(M)||(y.add(M),p(Kg$1(M)));}return on={packageRevision:i,bodyRoot:c,index:f},f}let An=new Set,Dr=null,Hr=null,ri=false;function _r(){ri||(Hr=null);}function Rl(){let i=Hr;if(!i||!k$1)return null;let c=(p,y)=>p.paragraphId===y.paragraphId&&p.offset===y.offset;if(!c(k$1.anchor,i.anchor)||!c(k$1.head,i.head))return null;let f=a.reviewItems().find(p=>wg$1(p)===i.key);return !f||f.kind==="revision"&&Dr!==null&&Dr.has(f.revisionKind)?null:f}function oi(){let i=Rl();if(i)return El(i);let c=k$1?.head;if(!c)return null;let p=Ag$1(a.reviewItems(),c,Om()).filter(y=>!(y.kind==="comment"&&y.resolved)&&!An.has(wg$1(y))&&!(y.kind==="revision"&&Dr!==null&&Dr.has(y.revisionKind)))[0];return p?El(p):null}function El(i){if(i.kind!=="comment")return i;let c=Cg(a.reviewItems(),i);return An.has(wg$1(c))?null:c}function Ol(i){return i.kind==="comment"?i.comment.author:i.kind==="revision"?i.author:""}function ai(){let i=a.reviewItems(),c=tn;if(c!==null&&c.layout===X$1&&c.items===i&&c.styles===Mt)return c;let f=Mo.resolve(c$1(X$1),(function*(){for(let B of i)yield Ol(B);})()),p=c?.value,y=p!==void 0&&p.size===f.size&&[...f].every(([H,B])=>p.get(H)===B),S=y?p:f,M=c!==null&&y&&c.styles===Mt?c.resolved:new Map(b$1(S,Mt).map(H=>[H.author,H]));return tn={layout:X$1,items:i,styles:Mt,value:S,resolved:M},tn}function Fm(i,c,f){let p=i.split(I),y=p[0],S=c!==null&&y===wg$1(c);if(i.startsWith("comment-")){let Y=f.get(y),Q=Y?.kind==="comment"&&Y.resolved;return Q&&!S?null:S?`docx-comment-band docx-comment-band--active${Q?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(i.startsWith("custom-"))return S?"docx-comment-band docx-comment-band--active":null;let M=f.get(y);if(!M||M.kind!=="revision")return null;let H=p.length>1?Number(p[1]):0;return `docx-revision-band docx-revision-band--${(Y=>Y==="delete"||Y==="moveFrom"?"delete":Y==="insert"||Y==="moveTo"?"insert":Y==="replace"&&M.replacedRangeCount!==void 0?H<M.replacedRangeCount?"delete":"insert":"other")(M.revisionKind)}${S?" docx-revision-band--active":""}`}let Fl=null,Al,Ml=null;function Jn(i=false){let c=oi(),f=c?wg$1(c):null,p=ai();if(!i&&Fl===X$1&&Al===f&&Ml===p.resolved)return;let y=new Map;for(let M of a.reviewItems())y.set(wg$1(M),M);let S=[];for(let M of Rm()){let H=Fm(M.key,c,y);if(!H)continue;let B=y.get(M.key.split(I)[0]),ie=B?Ol(B):"",Y=ie===""?void 0:p.resolved.get(ie);S.push({...M,className:H,...Y?{reviewAuthor:Y}:{}});}l(q,X$1,S,{scale:s,...je?{pageOffsetX:je.pageOffsetX}:{}}),Fl=X$1,Al=f,Ml=p.resolved;}function Br(){let i=U?ke(X$1,U.cellIds):ye?Sd(X$1,ye,ge()):Td(X$1,k$1,ge());l(W,X$1,i,{scale:s,pageOffsetX:je?.pageOffsetX,...U?{}:{className:ye?"docx-retained-selection-rect":"docx-selection-mark-rect"}});}function Zo(i){let c=xc(a.part());if(i)return c.find(y=>y.id===i)??null;let f=Lr?c.find(y=>y.id===Lr):void 0;if(f)return f;let p=k$1.head.paragraphId;return c.find(y=>y.beginParagraphId===p||y.endParagraphId===p||y.resultParagraphIds.includes(p))??(c.length===1?c[0]:null)}function qr(i){return xc(a.part()).find(f=>f.beginParagraphId===i||f.endParagraphId===i||f.resultParagraphIds.includes(i))?.id??null}function ii(){return qr(k$1.anchor.paragraphId)!==null||qr(k$1.head.paragraphId)!==null}function Am(i){let c=zo(),f=(p,y="")=>typeof p=="string"?/(?:Id|Ids)$/.test(y)&&c.has(p):Array.isArray(p)?p.some(S=>f(S,y)):!p||typeof p!="object"?false:Object.entries(p).some(([S,M])=>f(M,S));return f(i)}function zo(){return new Set(xc(a.part()).flatMap(i=>[i.beginParagraphId,...i.resultParagraphIds,i.endParagraphId]))}function si(i){return new Set([i.beginParagraphId,i.endParagraphId,...i.resultParagraphIds])}function Mm(i){let c=0;for(let f of X$1.pages)for(let p of X(f))i.has(p.paragraphId)&&(c+=p.lines.length);return c}function li(i,c){let f=new Set(c),p=new Map;for(let y of i.pages)for(let S of X(y)){if(!f.has(S.paragraphId)||p.has(S.paragraphId))continue;let M=y.pageFieldSource;p.set(S.paragraphId,eb$1(M?.pageNumber??y.index+1,M?.format));}return p}function di(i){if(Ne==="view"||!a.editable)return false;let c=Zo(i);return c?Lf$1(a.part(),{op:"rewriteTocPageNumbers",tocId:c.id,updates:[]})===null:false}function Ll(i,c){if(!Number.isInteger(i)||!Number.isInteger(c)||i<1||c<1)return null;let f=Tn.sectionPropertiesAt(k$1.head.paragraphId),p=f.pageSize.widthTwips-f.margins.leftTwips-f.margins.rightTwips-f.margins.gutterTwips,y=Math.max(300,Math.floor(p/c));return {op:"insertTable",beforeParagraphId:k$1.head.paragraphId,rows:i,cols:c,columnWidthTwips:y}}function Nl(i,c){if(Ne==="view"||!a.editable)return false;let f=Ll(i,c),p=a.partFor(z())??a.part();return f!==null&&Lf$1(p,f)===null}function Lm(i,c){if(!Nl(i,c))return false;let f=Ll(i,c);if(!f)return false;let p=null,y=a.subscribe(M=>{M.caret&&(p=M.caret);}),S=false;try{Re(()=>{let M=De([f],Ae());return M.committed||(ee$1=M.reason??"the table could not be inserted here"),S=M.committed,M},()=>{let M=p;return M?Oe({paragraphId:M.paragraphId,offset:M.start}):null});}finally{y();}return S}let Dl='TOC \\o "1-3" \\h';function Hl(){let i=wc(Dl);if(!i)return null;let c=a.documentOutline(),f=Kc$1(a.part(),c,i,li(qe.layout(),c.map(p=>p.blockId)),zo());return {op:"insertToc",beforeParagraphId:k$1.head.paragraphId,instruction:Dl,alias:n.tocLabels?.title??"TOC",entries:f.entries,bookmarksToCreate:f.bookmarksToCreate}}function _l(){if(Ne==="view"||!a.editable||ii())return false;let i=Hl();return i!==null&&Lf$1(a.part(),i)===null}function Nm(){if(!_l())return false;let i=Hl();if(!i)return false;let c=new Set(xc(a.part()).map(y=>y.id)),f=a.applyTreeOps([i]);if(!f.committed)return ee$1=f.reason??"the table of contents could not be inserted",false;let p=xc(a.part()).find(y=>!c.has(y.id));return p?Bl(p.id,"pageNumbers"):true}function Bl(i,c="entire"){let f=Zo(i);if(!f||!di(f.id))return false;let p=qe.layout(),y=a.documentOutline(),S=y.map(H=>H.blockId);if(c==="entire"){let H=Kc$1(a.part(),y,f.instruction,li(p,S),si(f)),B=a.applyTreeOps([{op:"replaceTocResult",tocId:f.id,entries:H.entries,bookmarksToCreate:H.bookmarksToCreate}]);if(!B.committed)return ee$1=B.reason??"the table of contents could not be refreshed",false;if(p=qe.layout(),f=Zo(f.id),!f)return true}let M="";for(let H$1=0;H$1<3;H$1+=1){let B=li(p,S),ie=H(a.part(),f,y,si(f)),Y=f.resultParagraphIds.flatMap((ve,Xe)=>{let mt=ie[Xe],He=mt?B.get(mt):void 0;return He===void 0?[]:[{paragraphId:ve,pageNumberText:He}]});if(Y.length===0)break;let Q=Y.map(ve=>`${ve.paragraphId}\0${ve.pageNumberText}`).join("");if(Q===M)break;M=Q;let xe=a.applyTreeOps([{op:"rewriteTocPageNumbers",tocId:f.id,updates:Y}]);if(!xe.committed){if(xe.rejected)return ee$1=xe.reason??"the table of contents page numbers were refused",false;break}p=qe.layout(),f=Zo(f.id)??f;}return true}let qe={session:a,storyScope:z,imageDecodePort:()=>he$1,layout:()=>(ue(),X$1),state:Be,currentPage:(i="caret")=>{if(ue(),i==="viewport"){let f=Hf(e,X$1,s);if(f!==null)return f}let c=_d(X$1,k$1.head);return c?c.pageIndex+1:1},setScale(i){if(!(i>0)||!Number.isFinite(i))return false;if(i===s)return true;let c={scale:s,defaults:w,measurer:C,producer:h,furnitureSource:pn};try{let f=It(e),p=f?{x:(f.scrollLeft-e.offsetLeft+f.clientWidth/2)/s,y:(f.scrollTop-e.offsetTop+f.clientHeight/2)/s}:null;if(s=i,n.measurer||(w=Kd(s,{context:vr(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),C=w.measurer),h=K(),pn=_s({session:a,measurer:C,producer:h,cache:F,styleCascade:Ce,numberingIndex:At,defaultTabStopPt:at,displayMode:n.revisionDisplayMode??lb$1,inlineDrawingLayoutForPart:y=>me.contextForPart(y),drawingLayoutTokenForPart:y=>me.cacheTokenForPart(y),drawingTokenForParagraphForPart:(y,S)=>me.drawingTokenForParagraph(S,y)}),Wt=void 0,je=void 0,Fn=null,Ke.invalidateAll(a.packageRevision(),"zoom"),Ke.flush(),f&&p){let y=Math.max(0,p.x*s+e.offsetLeft-f.clientWidth/2),S=Math.max(0,p.y*s+e.offsetTop-f.clientHeight/2),M=Number.isFinite(f.scrollWidth)?Math.max(0,f.scrollWidth-f.clientWidth):null,H=Number.isFinite(f.scrollHeight)?Math.max(0,f.scrollHeight-f.clientHeight):null;f.scrollLeft=M===null?y:Math.min(y,M),f.scrollTop=H===null?S:Math.min(S,H),qo();}return !0}catch{(({scale:s,defaults:w,measurer:C,producer:h,furnitureSource:pn}=c)),Wt=void 0,je=void 0,Fn=null;try{Ke.invalidateAll(a.packageRevision(),"zoom-rollback"),Ke.flush();}catch{}return false}},enqueueType:Xa,flushPendingInput:ue,type(i){let c=Gt(),f=c.replaceAt??c.collapseTo,p=P(f.paragraphId,f.offset,i.length),y=[...c.ops,{op:"insertText",paragraphId:f.paragraphId,offset:f.offset,text:i}],S={paragraphId:f.paragraphId,start:f.offset+i.length,end:f.offset+i.length};Re(()=>b([...y,...p],y,Ae(),S),()=>Oe({paragraphId:f.paragraphId,offset:f.offset+i.length}));},proposeTextChange:(i,c,f)=>Ar(i,c,f),insertPlainText:i=>ui(i),deleteBackward(){let i=Gt();if(i.ops.length>0){Re(()=>De(i.ops,Ae(),yn(i.collapseTo)),()=>Oe(i.collapseTo));return}let c=D()??void 0,f=k$1.head;if(f.offset===0){for(let B of vc(X$1,f.paragraphId)){let ie=$e(B);if(ie.length!==0){Re(()=>De([{op:"deleteText",paragraphId:B,start:ie.length-1,end:ie.length}],Ae(),yn({paragraphId:B,offset:ie.length-1})),()=>Oe({paragraphId:B,offset:ie.length-1}),{rearmPending:c});return}}let y=ge(),S=y.indexOf(f.paragraphId),M=y[S-1];if(!M)return;if(!wm(M,f.paragraphId)){it(Oe({paragraphId:M,offset:$e(M).length}));return}let H=$e(M).length;Re(()=>De([{op:"joinParagraphs",firstId:M,secondId:f.paragraphId}],Ae(),yn({paragraphId:M,offset:H})),()=>Oe({paragraphId:M,offset:H}),{rearmPending:c});return}let p=Zl(f,"before");if(p){Re(()=>De([{op:"removeContentControl",controlId:p.controlId,keepContent:false}],Ae(),yn({paragraphId:f.paragraphId,offset:p.start})),()=>Oe({paragraphId:f.paragraphId,offset:p.start}),{rearmPending:c});return}Re(()=>De([{op:"deleteText",paragraphId:f.paragraphId,start:f.offset-1,end:f.offset}],Ae(),yn({...f,offset:f.offset-1})),()=>Oe({...f,offset:f.offset-1}),{rearmPending:c});},splitParagraph(){let i=Gt(),c=i.replaceAt??i.collapseTo,f=new Set(a.paragraphIdsIn(z())),p=D()??void 0;Re(()=>De([...i.ops,{op:"splitParagraph",paragraphId:c.paragraphId,offset:c.offset}],Ae()),()=>{let y=a.paragraphIdsIn(z()).find(S=>!f.has(S));return y?Oe({paragraphId:y,offset:0}):null},{rearmPending:p});},navigate(i,c=false){if(ue(),!c&&(i==="left"||i==="right")&&(k$1.anchor.paragraphId!==k$1.head.paragraphId||k$1.anchor.offset!==k$1.head.offset)){let y=an();Ut=null,it(Oe(i==="left"?y.from:y.to),true);return}let f=Wi(X$1,k$1.head,i,Ut,N?.getActive()??null,ne(),C);if(!f)return;let p=zo();if(p.has(f.position.paragraphId)){if(c)return;let S=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(i)?"up":"down",M=Mm(p)+4;for(let H=0;H<M;H+=1){let B=Wi(X$1,f.position,S,f.desiredX,N?.getActive()??null,ne(),C);if(!B||B.position.paragraphId===f.position.paragraphId&&B.position.offset===f.position.offset)return;if(f=B,!p.has(f.position.paragraphId))break}if(p.has(f.position.paragraphId))return}Ut=f.desiredX,j$1?.activeNoteScope()&&f.pageIndex!==void 0&&Number.isInteger(f.pageIndex)&&j$1.setActiveNotePageIndex(f.pageIndex),it({anchor:c?k$1.anchor:f.position,head:f.position},true);},deleteWordBackward(){if(qe.deleteSelection())return;let i=k$1.head,c=Xd($e(i.paragraphId),i.offset,-1);if(c===i.offset){qe.deleteBackward();return}Re(()=>De([{op:"deleteText",paragraphId:i.paragraphId,start:c,end:i.offset}],Ae()),()=>Oe({...i,offset:c}),{rearmPending:D()??void 0});},deleteWordForward(){if(qe.deleteSelection())return;let i=k$1.head,c=Xd($e(i.paragraphId),i.offset,1);if(c===i.offset){qe.deleteForward();return}Re(()=>De([{op:"deleteText",paragraphId:i.paragraphId,start:i.offset,end:c}],Ae()),void 0,{rearmPending:D()??void 0});},deleteForward(){if(qe.deleteSelection())return;let i=D()??void 0,c=k$1.head,f=$e(c.paragraphId);if(c.offset<f.length){let S=Zl(c,"after");if(S){Re(()=>De([{op:"removeContentControl",controlId:S.controlId,keepContent:false}],Ae()),()=>Oe(c),{rearmPending:i});return}Re(()=>De([{op:"deleteText",paragraphId:c.paragraphId,start:c.offset,end:c.offset+1}],Ae()),void 0,{rearmPending:i});return}let p=ge(),y=p[p.indexOf(c.paragraphId)+1];if(y){if(vc(X$1,y).includes(c.paragraphId)){if($e(y).length===0)return;Re(()=>De([{op:"deleteText",paragraphId:y,start:0,end:1}],Ae()),()=>Oe(c),{rearmPending:i});return}Re(()=>De([{op:"joinParagraphs",firstId:c.paragraphId,secondId:y}],Ae()),()=>Oe(c),{rearmPending:i});}},...Tn,...$a,setSelection:i=>{Rt(i,k$1)||G({kind:"programmatic"},false),it(i);},revealPage(i,c){oe();let f=X$1.pages.find(p=>p.index===i);return f?Zr(f.box.y,f.box.height,c):false},revealParagraph(i,c){oe();let f=_d(X$1,{paragraphId:i,offset:0});if(!f)return false;let p=X$1.pages.find(y=>y.index===f.pageIndex);return p?Zr(p.contentBox.y+f.y,f.height,c):false},revealPosition(i,c){oe();let f=_d(X$1,i);if(!f)return false;let p=X$1.pages.find(y=>y.index===f.pageIndex);return p?Zr(p.contentBox.y+f.y,f.height,{block:"nearest",...c}):false},setEditable(i){Sl=i,ei();},selectAll(){let i=ge(),c=i[0],f=i[i.length-1];!c||!f||it({anchor:{paragraphId:c,offset:0},head:{paragraphId:f,offset:$e(f).length}});},hyperlinks:Rr,equations:Er,contentControls:rn,canInsertTable:Nl,insertTable:Lm,canInsertToc:_l,insertToc:Nm,canRefreshToc:di,refreshToc:Bl,isInsideToc:i=>xc(a.part()).some(c=>c.beginParagraphId===i||c.endParagraphId===i||c.resultParagraphIds.includes(i)),retainSelection:()=>{let i=Symbol("selection-pin");return be$1.set(i,k$1),ye=k$1,Br(),i},releaseSelection:i=>{be$1.delete(i)&&(pe(),Br());},retainedSelection:()=>ye,publishedLayout:()=>X$1,drawingSelectionIntent:()=>R,overlayCoordinates:()=>Object.freeze({paintScale:s,pageOffsetX:je?.pageOffsetX??new Map}),commitReviewOps:i=>{ue();let c=k$1.head.paragraphId,f=$e(c);return Re(()=>{if(Ne==="view")return {committed:false,rejected:true,opCount:0,reason:d};let p=i();return {committed:p.committed,rejected:!p.committed,opCount:0,...typeof p.reason=="string"?{reason:p.reason}:{}}},()=>{oe(),Fe.noteModelMoved();let p=ge();if(p.length===0)return null;let y=km(k$1,c,f);return xo(X$1,p,y)})},applyAutomationOps:(i,c)=>{let f={committed:false,rejected:false,opCount:0},p=c??bm;return Re(()=>{let y=Qn(false);if(y!==null)return f={committed:false,rejected:true,opCount:0,reason:y};let S=null,M=i(H=>{let B=Qn(true,[],false);return B===null?a.ensureHyperlinkRelationship(H,p):(S=B,null)});return M===null?f={committed:false,rejected:true,opCount:0,reason:S??"this engine will not author that hyperlink target"}:f=De(M,void 0,void 0,p,false)},()=>{oe(),Fe.noteModelMoved();let y=ge();return y.length===0?null:xo(X$1,y,k$1)}),f},editingMode:()=>Ne,setEditingMode:i=>{ue();let c=Ne!==i;Ne=i,c&&i==="view"&&N?.exitHeaderFooter(),Ja(),ei(),Ui(e,Ne),c&&pt(false),ee$1=null,n.onChange?.(Be());},revisionAuthors:()=>ai().value,setRevisionStyles:i=>{i!==Mt&&(Mt=i,ue(),pt(false));},setReviewActivationExclusions(i){Dr=i===null?null:new Set(i),Jn(),n.onChange?.(Be());},activeReviewKey:()=>{let i=oi();return i?wg$1(i):null},activateReview:(i,c)=>{if(An.clear(),Hr=c?{key:i,anchor:c.anchor,head:c.head}:{key:i,anchor:k$1.anchor,head:k$1.head},c){ri=true;try{it(c);}finally{ri=false;}return}Jn(),n.onChange?.(Be());},activatedReviewKey:()=>Rl()===null?null:Hr?.key??null,dismissActiveReview:()=>{let i=oi();i&&(An.add(wg$1(i)),Hr=null,Jn(),n.onChange?.(Be()));},navigation:Wn,bookmarks:()=>a.bookmarks(),selectedText(){if(U)return le(X$1,U);let{from:i,to:c}=an();return of(X$1,i,c,ge())},deleteSelection(){let i=Gt();return i.ops.length===0?false:(Re(()=>De(i.ops,Ae(),yn(i.collapseTo)),()=>Oe(i.collapseTo)),true)},setCellSelection:Pl,layoutSession:()=>T,undo:()=>{if(Ne==="view"){ee$1=d,n.onChange?.(Be());return}ut(),ql(a.undo());},redo:()=>{if(Ne==="view"){ee$1=d,n.onChange?.(Be());return}ut(),ql(a.redo());},sectionAtPage:le$1,activeScope:()=>{let i=j$1?.activeNoteScope();return i||N.activeScope()},setActiveScope:i=>(ue(),i.kind==="note"?j$1.enterNote(i.id):i.kind!=="body"&&i.kind!=="headerFooter"?false:(j$1?.exitNote(),N.setActiveScope(i))),insertNote:i=>(ue(),j$1.insertNote(i)),deleteNote:(i,c)=>j$1.deleteNote(i,c),convertNote:(i,c)=>j$1.convertNote(i,c),convertAllNotes:i=>j$1.convertAllNotes(i),setNoteProperties:i=>j$1.setNoteProperties(i),enterNote:(i,c)=>(ue(),j$1.enterNote(i,c)),exitNote:()=>(ue(),j$1.exitNote()),notePropertiesState:()=>{let i=qe.state().selection.head.paragraphId,c=a.packageRevision(),f=a.currentPackage(),p=a.part(),y=Id(f),S=_d$1(f,"footnote"),M=_d$1(f,"endnote"),H=qe.activeScope().kind==="headerFooter",B=qe.headerFooterState(),ie=B?.rId??null,Y=B?.sectionIndex??null,Q=te;if(Q&&Q.packageRevision===c&&Q.paragraphId===i&&Q.bodyPart===p&&Q.settingsPart===y&&Q.footnotesPart===S&&Q.endnotesPart===M&&Q.headerFooterOpen===H&&Q.headerFooterRId===ie&&Q.headerFooterSectionIndex===Y)return Q.result;let xe=Yp(qe);return te={packageRevision:c,paragraphId:i,bodyPart:p,settingsPart:y,footnotesPart:S,endnotesPart:M,headerFooterOpen:H,headerFooterRId:ie,headerFooterSectionIndex:Y,result:xe},xe},notePreviewText:i=>Qp(a,i),applyTableCommandPlan(i){if(!i.ok)return {ok:false,code:i.code,reason:i.reason};let c=null,f=a.subscribe(p=>{p.caret&&(c=p.caret);});try{let p=Ae(),y=i.selection.kind==="adoptCommittedCaret";Re(()=>De(i.ops,p),y?()=>{let S=c;return S?Oe({paragraphId:S.paragraphId,offset:S.start}):null}:void 0,i.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{f();}return ee$1?{ok:false,code:"invalidArgs",reason:ee$1}:{ok:true,changed:true}},enterHeaderFooter:i=>{ue();let c=N.enterHeaderFooter(i);if(!c)return c;let f=N.getActive(),p=f?X$1.pages[f.pageIndex]:void 0;if(f&&p){let y=f.kind==="header"?p.header:p.footer,S=y?.box.y??(f.kind==="header"?p.box.y:p.box.y+p.box.height-1),M=y?.box.height??1;Zr(S,M,{block:"nearest"});}return c},exitHeaderFooter:()=>(ue(),N.exitHeaderFooter()),headerFooterState:()=>N.headerFooterStateStable(a.packageRevision()),...Up({applyOps:De,commit:Re,deleteSelectionOps:Hm,deleteSelectionPlan:()=>Gt(),orderedStart:Ko,selectionMark:Ae,collapsedAt:Oe,isHeaderFooterOpen:()=>N?.getActive()!==null,lastRejection:()=>ee$1}),...Wp({session:a,applyOps:De,commit:Re,storyScope:z,selectionMark:Ae,editingMode:()=>Ne,author:()=>n.author,trackedDate:v,decodePort:()=>he$1}),focus:()=>L.focus({preventScroll:true}),setTableInteractionLabel(i){l$1.resolve=i;},refreshTableInteractionLabels(){zr.refreshLabels();},destroy(){Pe(),_.removeEventListener("selectionchange",Kl),L.removeEventListener("pointerdown",Yl,{capture:true}),L.removeEventListener("keydown",Vo,{capture:true}),L.removeEventListener("beforeinput",Vo,{capture:true}),L.removeEventListener("keydown",Ul),L.removeEventListener("beforeinput",Xl),L.removeEventListener("copy",Wl),L.removeEventListener("cut",Gl),L.removeEventListener("paste",$l),L.removeEventListener("compositionstart",jl),L.removeEventListener("compositionend",Vl),_.removeEventListener("scroll",Ql,{capture:true}),e.ownerDocument.defaultView?.removeEventListener("resize",gi),Nr?.disconnect(),ni=null,ci?.destroy(),zr.destroy(),Wn.destroy(),No.destroy(),Fe.destroy(),L.removeEventListener("contextmenu",vl),L.removeEventListener("click",Il),L.removeEventListener("pointermove",Cn),L.removeEventListener("pointerleave",En),Ke.cancel(),xt!==null&&clearTimeout(xt),xt=null,Gn&&Gn(),Gn=null,me.dispose(),e$1(L),$.destroy(),O(),e.replaceChildren();}};function ql(i){if(Ee=null,Fe.noteModelMoved(),oe(),!i){it(xo(X$1,ge(),k$1));return}let c={anchor:{paragraphId:i.paragraphId,offset:i.start},head:{paragraphId:i.paragraphId,offset:i.end}};it(ge().includes(i.paragraphId)?c:xo(X$1,ge(),c));}function Zr(i,c,f){let p=It(e);if(!p||p.clientHeight===0)return false;let y=i*s+e.offsetTop,S=c*s,M=f?.offsetPx??24,H=f?.block??"start",B=p.clientHeight;if(H==="nearest"||H==="centerIfNeeded"){let Q=y<p.scrollTop,xe=y+S>p.scrollTop+B;if(!Q&&!xe)return true}let ie=H==="center"||H==="centerIfNeeded"?y-Math.max(0,(B-S)/2):H==="nearest"&&y>p.scrollTop?y+S+M-B:y-M,Y=Math.max(0,p.scrollHeight-B);return p.scrollTo({top:Math.max(0,Math.min(ie,Y)),behavior:f?.behavior??"auto"}),qo(),true}function Ae(){return Zn(k$1)}function an(){return ue(),Ls(X$1,k$1,ge())}function Ko(){return an().from}function $e(i){return ce$1(X$1,i)}function Zl(i,c){let f=a.partFor(z())??a.part(),p=va$1(f,i.paragraphId);return !p||p.kind!=="paragraph"?null:c==="before"?Vd(p,i.offset):Wd(p,i.offset)}function Gt(i){let c=i?.trim()||void 0,f=Dm(),p=U,y=null;return {...f,get replaceAt(){return y??=_m(f,c,p),y}}}function Dm(){if(ue(),U){let f=[];for(let p of ie(X$1,U.cellIds)){let y=ce$1(X$1,p).length;y>0&&f.push({op:"deleteText",paragraphId:p,start:0,end:y});}return {ops:f,collapseTo:Ko()}}if(k$1.anchor.paragraphId===k$1.head.paragraphId&&k$1.anchor.offset===k$1.head.offset)return {ops:[],collapseTo:Wd$1(X$1,k$1.head)};let{from:i,to:c}=an();return lf(X$1,a.partFor(z())??a.part(),i,c,ge())}function Hm(){return Gt().ops}function er(i,c,f){if(!(f!==void 0||Ne==="suggest")||i.paragraphId!==c.paragraphId)return i.offset;let y=Wd$1(X$1,c);return y.offset-zl(i,y,f??n.author)}function _m(i,c,f){let p=i.collapseTo;if(c===void 0&&Ne!=="suggest")return p;if(f){for(let He of f.cellIds){let Je=he(X$1,[He]),st=Je.length>0?Je:ie(X$1,[He]);if(st.length===0)continue;let bn=new Map,Se=_e=>{let Ye=bn.get(_e);return Ye===void 0&&(Ye=er({paragraphId:_e,offset:0},{paragraphId:_e,offset:$e(_e).length},c),bn.set(_e,Ye)),Ye},$t=(c??n.author)?.trim(),Mn=_e=>{let Ye=$e(_e);if(!$t)return /\S/.test(Ye);let Ln=va$1(Qt(a,_e)??a.part(),_e);if(!Ln||Ln.kind!=="paragraph")return /\S/.test(Ye);let Nt="",Nn=0;for(let tr of fe(Ln,0,Ye.length,$t))Nt+=Ye.slice(Nn,Math.max(Nn,tr.start)),Nn=Math.max(Nn,tr.end);return Nt+=Ye.slice(Nn),/\S/.test(Nt)},kt=null;for(let _e=st.length-1;_e>=0;_e-=1){let Ye=st[_e];if(Mn(Ye)){kt=Ye;break}}if(kt===null)for(let _e=st.length-1;_e>=0;_e-=1){let Ye=st[_e];if(Se(Ye)!==0){kt=Ye;break}}return kt??=st[st.length-1],{paragraphId:kt,offset:Se(kt)}}return p}let{from:y,to:S}=an();if(y.paragraphId===S.paragraphId&&y.offset===S.offset)return p;if(y.paragraphId===S.paragraphId)return {paragraphId:S.paragraphId,offset:er(y,S,c)};let M=new Set(i.ops.flatMap(He=>He.op==="deleteBlock"?[He.blockId]:[])),H=Qt(a,S.paragraphId)??a.part();if(M.size>0)for(let He=wa$1(H,S.paragraphId);He;He=wa$1(H,He.id)){if(!M.has(He.id))continue;let Je={paragraphId:p.paragraphId,offset:$e(p.paragraphId).length};return {paragraphId:p.paragraphId,offset:er(p,Je,c)}}let B=(c??n.author)?.trim();if(!B)return p;let ie$1=new Set(i.ops.flatMap(He=>He.op==="joinParagraphs"?[He.secondId]:[])),Y=ge(),Q=Y.indexOf(y.paragraphId),xe=Y.indexOf(S.paragraphId);if(Q===-1||xe===-1)return p;let ve=He=>{let Je=va$1(H,He);return Je?.kind==="paragraph"&&Mf$1(Je,B)},Xe=xe;for(;Xe>Q&&ie$1.has(Y[Xe])&&ve(Y[Xe-1]);)Xe-=1;let mt=0;for(let He=Xe;He<=xe;He+=1){let Je=Y[He],st={paragraphId:Je,offset:Je===y.paragraphId?y.offset:0},bn=Je===S.paragraphId?Wd$1(X$1,S):{paragraphId:Je,offset:$e(Je).length};He===Xe&&(mt+=st.offset),mt+=bn.offset-st.offset-zl(st,bn,B);}return {paragraphId:Y[Xe],offset:mt}}function zl(i,c,f){let p=f?.trim();if(!p||i.paragraphId!==c.paragraphId)return 0;let y=a.partFor(z())??a.part(),S=va$1(y,c.paragraphId);return !S||S.kind!=="paragraph"?0:ee(S,i.offset,c.offset,p)}let{onSelectionChange:Kl,onCompositionEnd:Vl}=Fe,jl=(...i)=>{Fe.adoptBeforeInput(),Pe(),Fe.onCompositionStart(...i);},ci=null,Bm=Ef(qe,n.onRequestHyperlink?{onRequestHyperlink:n.onRequestHyperlink}:{}),Ul=i=>{i.defaultPrevented||Fe.adoptBeforeInput(),Bm(i);},{onCopy:Wl,onCut:Gl,onPaste:$l}=Of(qe,ui),qm=Ff(qe,{isComposing:()=>Fe.isComposing(),insertPlainText:ui,onBrowserSelectionFixup:()=>{Fe.mirrorToDom(),Fe.noteBrowserSelectionFixup();}}),Xl=i=>{Fe.adoptBeforeInput(),qm(i);};function ui(i){let c=uf(i).split(`
|
|
14
|
-
`),f=Gt(),p=f.replaceAt??f.collapseTo,y=c.join(""),S=[...f.ops],M=P(p.paragraphId,p.offset,y.length);y.length>0&&(S.push({op:"insertText",paragraphId:p.paragraphId,offset:p.offset,text:y}),S.push(...M));let H=[],B=0;for(let ve=0;ve<c.length-1;ve+=1)B+=c[ve].length,H.push(p.offset+B);if(H.length>0&&S.push({op:"splitParagraphMany",paragraphId:p.paragraphId,offsets:H}),S.length===0)return;let ie=new Set(a.paragraphIdsIn(z())),Y=c[c.length-1],Q=H.length===0?yn({paragraphId:p.paragraphId,offset:p.offset+Y.length}):void 0,xe=S.filter(ve=>!M.includes(ve));Re(()=>b(S,xe,Ae(),Q),()=>{if(H.length===0)return Oe({paragraphId:p.paragraphId,offset:p.offset+Y.length});let ve=a.paragraphIdsIn(z()).filter(mt=>!ie.has(mt)),Xe=ve[ve.length-1];return Xe?Oe({paragraphId:Xe,offset:Y.length}):null});}_.addEventListener("selectionchange",Kl);let Zm=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock","ScrollLock","ContextMenu"]),Yl=i=>{if(i instanceof PointerEvent&&i.button!==0)return;let f=(i.target instanceof Element?i.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");G(f?{kind:"pointer",drawingNodeId:f}:{kind:"none"},true);},Vo=i=>{i instanceof KeyboardEvent&&Zm.has(i.key)||G({kind:"none"},true);};L.addEventListener("pointerdown",Yl,{capture:true}),L.addEventListener("keydown",Vo,{capture:true}),L.addEventListener("beforeinput",Vo,{capture:true}),L.addEventListener("keydown",Ul),L.addEventListener("beforeinput",Xl),L.addEventListener("copy",Wl),L.addEventListener("cut",Gl),L.addEventListener("paste",$l),L.addEventListener("compositionstart",jl),L.addEventListener("compositionend",Vl);let fi=false;function pi(){if(fi)return;fi=true;let i=e.ownerDocument.defaultView?.requestAnimationFrame,c=()=>{fi=false,qo();};i?i(c):queueMicrotask(c);}let Ql=i=>{let c=It(e);!c||i.target!==c||pi();};_.addEventListener("scroll",Ql,{capture:true,passive:true});let gi=()=>{pi();},mi=e.ownerDocument.defaultView;mi?.addEventListener("resize",gi,{passive:true}),Nr=typeof mi?.ResizeObserver=="function"?new mi.ResizeObserver(gi):null;function Jl(){if(!Nr)return;let i=It(e);i!==ni&&(Nr.disconnect(),ni=i,i&&Nr.observe(i));}Jl(),ci=mp({pagesLayer:L,container:e,scale:()=>s,pageOffsetX:i=>je?.pageOffsetX.get(i)??0,layout:()=>(oe(),X$1),measurer:()=>C,selection:()=>k$1,setSelection:i=>it(i),cellSelection:()=>U,setCellSelection:i=>Pl(i),focus:()=>L.focus({preventScroll:true}),activeHeaderFooter:()=>Jc(N?.getActive()??null),activeNote:()=>{let i=j$1?.activeNoteScope();return i?{scopeId:i.id,pageIndex:j$1?.activeNotePageIndex()??null}:null},enterHeaderFooter:i=>{ue(),N?.enterHeaderFooter({rId:i.rId,pageIndex:i.pageIndex,sectionIndex:le$1(i.pageIndex).sectionIndex,kind:i.kind,...i.position?{position:i.position}:{}});},enterNote:(i,c,f)=>{ue(),j$1?.enterNote(i,c,f);},exitNote:i=>{ue(),j$1?.exitNote(i);},exitHeaderFooter:()=>(ue(),N?.exitHeaderFooter()),enterEmptyHeaderFooter:(i,c)=>{if(Ne==="view")return;ue();let{sectionIndex:f,sectionStart:p}=le$1(c),y=a.headerFooterResolutionBySection(),S=y[Math.min(f,Math.max(0,y.length-1))],M=X$1.pages[c]?.pageFieldSource?.pageNumber??c+1,H=S?.evenAndOddHeaders&&M%2===0?"even":S?.titlePage&&c===p?"first":"default",B=Y=>{let Q=Y[Math.min(f,Math.max(0,Y.length-1))];return i==="header"?Q?.headers:Q?.footers},ie=B(y)?.get(H)?.rId;if(!ie){if(!qe.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:f,kind:i,variant:H,...H==="first"?{titlePage:true}:{},...H==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;ie=B(a.headerFooterResolutionBySection())?.get(H)?.rId,oe();}ie&&N?.enterHeaderFooter({rId:ie,pageIndex:c,sectionIndex:f,kind:i,variant:H});},onContentControlWidget:(i,c)=>hm(i,c),isReadOnlyParagraph:i=>qr(i)!==null},n.pointer?{mode:n.pointer}:{});let zr=Xf({pagesLayer:L,furnitureLayer:A,scale:()=>s,pageOffsetX:i=>je?.pageOffsetX.get(i)??0,read:()=>({layout:X$1,storeRevision:a.packageRevision(),selection:k$1,cellSelection:U,editingMode:Ne,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:i=>qe.applyTableCommandPlan(i),label:i=>l$1.resolve(i)});return pt(),ei(),qe.setTableInteractionLabel=i=>{l$1.resolve=i,zr.refreshLabels();},qe.refreshTableInteractionLabels=()=>{zr.refreshLabels();},{ok:true,surface:qe}}var Mb=e=>X(e);function rg(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=Nd(t,Mb);for(let o of t.pages){for(let a of [o.header,o.footer])a&&ng(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let s of a.notes)ng(r,s.fragments,o.index,s.box.y);}return e.set(t,r),r}}function ng(e,t,n,r){for(let o of Y(t))for(let a of wc$1(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}function rl(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function Lb(e){return typeof e=="object"&&e!==null&&"container"in e&&Array.isArray(e.path)}function Nb(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function og(e){return ag(e.children)}function ag(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||pe(n))&&t.push(n);return t}function Db(e){if(pe(e))return ag(se(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(...og(r));return t}function Hb(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 s="noteId"in r?r.noteId:null,l=r.part==="body"?Me(a):Ke(a).find(w=>r.part==="header"||r.part==="footer"?w.kind===r.part:w.kind==="note"&&qd(w.root)===s)?.root;if(!l||l.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 d=og(l),u;for(let w=0;w<t.path.length;w+=1){let C=t.path[w];if(!Number.isInteger(C)||C<0)return {ok:false,code:"invalidArgs",reason:"DocLocation indices must be non-negative"};if(u=d[C],!u)return {ok:false,code:"notFound",reason:`block index ${C} is out of range`};w<t.path.length-1&&(d=Db(u));}if(!u||u.kind!=="paragraph"||!va$1(a,u.id))return {ok:false,code:"invalidArgs",reason:"DocLocation must resolve to a paragraph"};let m=(Of$1(a,u.id)??"").length,I=t.offset??(n==="start"?0:m);if(!Number.isInteger(I)||I<0||I>m)return {ok:false,code:"invalidArgs",reason:"DocLocation offset is outside the paragraph"};let v={paragraphId:u.id,offset:I};return {ok:true,selection:{anchor:v,head:v}}}function _a(e,t,n){if(Lb(t))return Hb(e,t,n);if(!nt(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=dt(e.session,o,{kind:"body"}),s=e.session.partFor(a);if(!s)return {ok:false,code:"notFound",reason:"the target story was not found"};let l=zt(s,r,t);if(!l.ok)return l;let d=n==="start"?l.span.start:l.span.end,u={paragraphId:l.span.nodeId,offset:d};return {ok:true,selection:{anchor:u,head:u}}}function Ba(e,t){if(!Nb(t)){let o=_a(e,t,"start");if(!o.ok)return o;let a=_a(e,t,"end");return a.ok?{ok:true,selection:{anchor:o.selection.anchor,head:a.selection.head}}:a}let n=_a(e,t.from,"start");if(!n.ok)return n;let r=_a(e,t.to,"end");return r.ok?{ok:true,selection:{anchor:n.selection.anchor,head:r.selection.head}}:r}function _b(e){return e.evenPage?"even":e.firstPage?"first":"default"}function ig(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'"}:_b(e)}function ol(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?ig(t):n?.variant??"default";if(typeof a=="object"&&a.ok===false)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:a.reason}};let s=a,l=t.sectionIndex??n?.sectionIndex??0;return !Number.isInteger(l)||l<0?{ok:false,refusal:{ok:false,code:"invalidArgs",reason:"sectionIndex must be a non-negative integer"}}:{ok:true,sectionIndex:l,kind:r,variant:s}}function Bb(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 Co(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}:Bb(n.reason)}function qa(e,t,n,r){let a=e.session.headerFooterResolutionBySection()[t];if(!a)return null;let l=(n==="header"?a.headers:a.footers).get(r);return l?{rId:l.rId,partName:l.partName,inherited:l.inherited,titlePage:a.titlePage,evenAndOddHeaders:a.evenAndOddHeaders}:null}function sg(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=ig(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,l=qa(e,n,r,a)?.rId,d=false;if(!l){let m=Co(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:a,...a==="first"?{titlePage:true}:{},...a==="even"?{evenAndOddHeaders:true}:{}});if(!m.ok)return m;d=true,l=qa(e,n,r,a)?.rId;}return l?e.enterHeaderFooter({rId:l,kind:r,sectionIndex:n,variant:a})?{ok:true,changed:d}:{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 lg(e,t){let n=ol(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=Co(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 dg(e,t){let n=ol(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=Co(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let s=qa(e,n.sectionIndex,n.kind,n.variant);s?e.enterHeaderFooter({rId:s.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function cg(e,t){let n=ol(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,s=Co(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!s.ok)return s;let l=qa(e,n.sectionIndex,n.kind,n.variant);return o&&l&&l.rId!==a&&e.enterHeaderFooter({rId:l.rId,kind:n.kind,sectionIndex:n.sectionIndex}),s}function ug(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return Co(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 fg(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 pg(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 gg(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 mg(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 hg(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 yg(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 vg(e,t,n){switch(t.type){case "toggleMark":{let r=ls.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=ds(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 "setLineSpacing":e.setParagraphProperty("spacing",Na({rule:t.rule,value:t.value}),{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...wr("before",t.beforePt),...wr("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 l=e.sectionAnchorParagraphAt(e.state().selection.head.paragraphId);if(l.kind==="unaddressable")return {ok:false,code:"unsupported",reason:"this section holds no paragraph to address it by"};r=l.kind==="anchor"?l.paragraphId:void 0;}let o=t.pageWidth,a=t.pageHeight;if(t.orientation!==void 0&&(o!==void 0||a!==void 0)){let l=r?e.sectionPropertiesAt(r):e.sectionProperties(),d=o??l.pageSize.widthTwips,u=a??l.pageSize.heightTwips;o=t.orientation==="landscape"?Math.max(d,u):Math.min(d,u),a=t.orientation==="landscape"?Math.min(d,u):Math.max(d,u);}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"){if(!e.insertSectionBreak())return {ok:false,code:"invalidArgs",reason: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":e.type(t.text);break;case "deleteText":e.deleteSelection();break;case "proposeInsertion":case "proposeDeletion":case "proposeReplacement":{if(t.target!==void 0){let a=Ba(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 "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 sg(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return lg(e,t);case "linkHeaderFooterToPrevious":return dg(e,t);case "unlinkHeaderFooterFromPrevious":return cg(e,t);case "setHeaderFooterOptions":return ug(e,t);case "insertPageField":return fg(e,t);case "insertNote":return pg(e,t);case "deleteNote":return gg(e,t);case "convertNote":return mg(e,t);case "convertAllNotes":return hg(e,t);case "setNoteProperties":return yg(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??cn({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":return rl(e.selectedText()),{ok:true,changed:false};case "cut":rl(e.selectedText()),e.deleteSelection();break;case "paste":e.insertPlainText(t.text);break;case "setSelection":{if("range"in t&&cs(t.range))return e.setSelection(t.range),e.revealPosition(t.range.head,{block:"centerIfNeeded"}),{ok:true,changed:false};let r="anchor"in t&&nt(t.anchor)?{anchor:t.anchor}:"range"in t&&Bn(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=iu(e.session.part(),e.session.paragraphAnchors(),r);if(!o.ok)return o;let a=zb(e,o.selection);return a.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):a}default:return ho(t)?Du(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function bg(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 Y(o.fragments))if(a.paragraphId===t)return o.scopeId}return null}function qb(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 s of Y(a.fragments))if(s.paragraphId===t)return {pageIndex:r,sectionIndex:e.sectionAtPage(r).sectionIndex}}}return null}function Zb(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 zb(e,t){let n=dt(e.session,t.head.paragraphId,{kind:"body"}),r=dt(e.session,t.anchor.paragraphId,{kind:"body"});if(!Zb(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 d=qb(e,t.head.paragraphId);return e.enterHeaderFooter?.({rId:n.rId,...d?{pageIndex:d.pageIndex,sectionIndex:d.sectionIndex}:{}})?{ok:true,changed:false}:{ok:false,code:"unsupported",reason:"that header or footer could not be opened"}}let a=bg(e,t.head.paragraphId);return a?(t.anchor.paragraphId===t.head.paragraphId?a:bg(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"}}function Kb(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 u=n-22;u>=o;u-=1)if(r.getUint32(u,true)===101010256){a=u;break}if(a<0)return false;let s=r.getUint16(a+10,true),l=r.getUint32(a+16,true),d=0;for(let u=0;u<s;u+=1){if(l+46>n||r.getUint32(l,true)!==33639248)return false;if(d+=r.getUint32(l+24,true),d>=t)return true;l+=46+r.getUint16(l+28,true)+r.getUint16(l+30,true)+r.getUint16(l+32,true);}return false}function Ig(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||Kb(r,524288)),schedule(r){let o=null,a=null,s=()=>{t=null,e.mount(r);},l=requestAnimationFrame(()=>{a!==null&&clearTimeout(a),a=null,o=setTimeout(s,0);});a=setTimeout(()=>{cancelAnimationFrame(l),s();},250),t={bytes:r,cancel:()=>{cancelAnimationFrame(l),o!==null&&clearTimeout(o),a!==null&&clearTimeout(a);}},e.scheduled();},cancel:n,flush(){let r=n();r&&e.mount(r);},isScheduled:()=>t!==null}}function xg(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function Sg(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function kg(e){return e.kind==="comment"}function Vb(e){let t=new Map;for(let n of e){let r=n.item;if(!kg(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 jb(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(kg);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 wg(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=jb(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=Vb(r);if(a==="ambiguous")return {ok:false,code:"ambiguous",reason:"duplicate comment records share an id"};let s=o,l=new Set;for(;s.parentId!==void 0&&!l.has(s.id);){l.add(s.id);let m=a.get(s.parentId);if(!m)break;s=m;}let d=false,u=false;return e.surface.commitReviewOps(()=>{let m=e.surface.session.packageRevision();return d=e.surface.session.setCommentResolved(s.id,n),u=d&&e.surface.session.packageRevision()!==m,{committed:u}}),d?(u&&e.bump(),{ok:true,changed:u}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function Tg(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 Pg=new WeakMap;function $b(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$3.story))}function Xb(e,t){$b(t)||(e.summaries=null);}function Yb(e,t){t.subscribed||(t.subscribed=true,e.subscribe(n=>Xb(t,n)));}function Rg(e){}function Eg(e,t){let n=Pg.get(e);return n||(n={summaries:null,subscribed:false},Pg.set(e,n)),Yb(e,n),n.summaries||(n.summaries=t()),n.summaries}var Qb=new Map([["richText","richText"],["plainText","plainText"],["dropdown","dropDownList"],["dropDownList","dropDownList"],["comboBox","comboBox"],["date","date"]]);function Jb(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function ev(e,t){let n=e.session.part(),r=e.session.paragraphAnchors();if(nt(t)){let o=zt(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(Jb(t)){if(!nt(t.from)||!nt(t.to))return {ok:false,code:"unsupported",reason:"address the span with paraId anchors; DocLocation endpoints are not supported",target:t};let o=zt(n,r,t.from);if(!o.ok)return {ok:false,code:o.code,reason:o.reason,target:t};let a=zt(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 s=Math.min(o.span.start,a.span.start),l=Math.max(o.span.end,a.span.end);return {ok:true,span:{paragraphId:o.span.nodeId,start:s,end:l}}}return {ok:false,code:"unsupported",reason:"address the span with a paraId anchor; DocLocation targeting is not supported",target:t}}function al(e,t){let n=Qb.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=Zn(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=ev(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 tv="http://schemas.microsoft.com/office/word/2010/wordml",nv="http://schemas.microsoft.com/office/word/2012/wordml",rv=32;function wn(e){return Hb$1(e)}function ov(e){return e.kind==="textValue"?[]:e.children}function Za(e){if(e.kind==="textValue")return e.value.length;if(e.kind==="tab"||e.kind==="hardBreak")return 1;if(e.kind==="runProperties"||e.kind==="generic")return 0;if(wn(e)){let n=0;for(let r of se(e))n+=Za(r);return n}let t=0;for(let n of ov(e))t+=Za(n);return t}function Ro(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function av(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===ca)return t.value}}function il(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return av(n)}}function iv(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=sv(t);if(n!==void 0)return n}return "richText"}function sv(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===tv||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===nv)return "repeatingSection"}function za(e){let t=il(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function lv(e,t){if(za(Ro(t)))return true;let n=wa$1(e,t.id);for(;n;){if(wn(n)&&za(Ro(n)))return true;n=wa$1(e,n.id);}return false}function ll(e,t){let n=Ro(e),r=il(n,"tag"),o=il(n,"alias"),a=t?lv(t,e):za(n);return {id:e.id,controlType:iv(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}var Og=new WeakMap;function dv(e,t){let n=[],r=wa$1(e,t.id);for(;r;)wn(r)&&n.push(`${r.id}:${za(Ro(r))?1:0}`),r=wa$1(e,r.id);return n.join("|")}function Ag(e){return Object.freeze({...e,...e.tag!==void 0?{tag:e.tag}:{},...e.alias!==void 0?{alias:e.alias}:{},...e.locked?{locked:true}:{}})}function cv(e){return Object.freeze(e.map(t=>Ag(t)))}function uv(e,t){let n=e.node,r=Ro(n),o=dv(t,n),a=Og.get(n);if(a&&a.properties===r&&a.lockAncestors===o)return a.summary;let s=Ag(ll(n,t));return Og.set(n,{properties:r,lockAncestors:o,summary:s}),s}function fv(e){let t=Ae(e.root);return Rg(t.length),t.map(n=>uv(n,e))}function pv(e){return cv(e.storyParts().flatMap(t=>fv(t)))}function gv(e){return Eg(e,()=>pv(e))}function sl(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 mv(e){let t=[],n=(r,o,a,s)=>{let l=o;for(let d of r)if(d.kind!=="paragraphProperties"){if(d.kind==="run"){l+=Za(d);continue}if(d.kind==="hyperlink"){l=n(d.children,l,a,s);continue}if(wn(d)&&s<rv){let u=l,m=a+1;l=n(se(d),l,m,s+1),t.push({control:d,start:u,end:l,depth:m});continue}l+=Za(d);}return l};return n(e.children,0,-1,0),t}function dl(e,t,n){return mv(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>ll(r.control,n))}function cl(e,t){let n=[],r=wa$1(e,t);for(;r;)wn(r)&&n.push(ll(r,e)),r=wa$1(e,r.id);return n.reverse()}function Mg(e,t){if(!e)return [];let n=gv(e.session);return t?n.filter(r=>sl(r,t)):n}function ul(e,t){if(!e)return null;let{paragraphId:n,offset:r}=e.state().selection.head,o=Qt(e.session,n)??e.session.part(),a=va$1(o,n);if(a&&a.kind==="paragraph"){for(let l of dl(a,r,o))if(sl(l,t))return l}let s=cl(o,n);for(let l=s.length-1;l>=0;l-=1){let d=s[l];if(sl(d,t))return d}return null}function fl(e){return e.type==="insertContentControl"||e.type==="setContentControlValue"||e.type==="removeContentControl"}function hv(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function yv(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function bv(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 Ka(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||wn(n))&&t.push(n);return t}function vv(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...Ka(r.children));return t}function Iv(e){return e.kind==="table"?vv(e):wn(e)?Ka(se(e)):e.kind==="body"?Ka(e.children):[]}function xv(e,t,n){if(wn(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let s of dl(t,r,e))return {ok:true,controlId:s.id};let a=cl(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 Sv(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=bv(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=Ka(n.children),o=null;for(let s=0;s<t.path.length;s+=1){if(o=r[t.path[s]]??null,!o)return {ok:false,code:"notFound",reason:`block index ${t.path[s]} is out of range`,target:t};s<t.path.length-1&&(r=Iv(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=xv(e,o,t.offset);return a.ok?a:{...a,target:t}}function kv(e,t,n){let r=zt(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=va$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 s=r.span.start;for(let u of dl(a,s,o))return {ok:true,controlId:u.id};let d=cl(o,a.id).at(-1);return d?{ok:true,controlId:d.id}:{ok:false,code:"notFound",reason:`no content control encloses paragraph '${n.paraId}'`,target:n}}function Lg(e,t){if(t===void 0){let r=ul(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(yv(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return hv(t)?Sv(n,t):nt(t)?kv(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function Ng(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 Dg(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 Hg(e,t){return {ok:false,code:Ng(e),reason:Dg(e),...t!==void 0?{target:t}:{}}}function wv(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 pl(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function gl(e,t,n,r){let o=wv(e,t,n,r);if(!o.ok)return o.refusal;if(e.type==="insertContentControl"){let l=al(t,e);return l.ok?Fg(t,l.op,l.span.paragraphId):{ok:false,code:l.code,reason:l.reason}}let a=Lg(t,e.target);if(!a.ok)return {ok:false,code:a.code,reason:a.reason};let s=e.type==="setContentControlValue"?{op:"setContentControlValue",controlId:a.controlId,value:e.value}:{op:"removeContentControl",controlId:a.controlId};return Fg(t,s,a.controlId)}function Fg(e,t,n){let r=Lf$1(Qt(e.session,n)??e.session.part(),t);return r?{ok:false,code:Ng(r),reason:Dg(r)}:{ok:true}}function _g(e,t,n,r){t?.flushPendingInput();let o=gl(e,t,n,r);return o.ok?Tv(t,e):o}function Tv(e,t){if(t.type==="insertContentControl")return Pv(e,t);let n=Lg(e,t.target);if(!n.ok){let s=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...s!==void 0?{target:s}:{}}}e.flushPendingInput();let r=Zn(e.state().selection),o=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},a=e.session.applyTreeOps([o],r,r,dt(e.session,n.controlId,{kind:"body"}));return a.rejected?Hg(a.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:a.committed})}function Pv(e,t){e.flushPendingInput();let n=al(e,t);if(!n.ok){let u=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...u!==void 0?{target:u}:{}}}let{paragraphId:r,start:o,end:a}=n.span,s=Zn(e.state().selection),l={paragraphId:r,start:o,end:a},d=e.session.applyTreeOps([n.op],s,l,dt(e.session,r,{kind:"body"}));return d.rejected?Hg(d.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:d.committed})}var Bg=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Va(e){let t=e?.defaultFont?.family;return t!==void 0&&Bg.test(t)?t:ya.family}function qg(e,t){let n=new Map,r=l=>{if(l===void 0||!Bg.test(l))return;let d=l.toLowerCase();n.has(d)||n.set(d,l);};r(Va(e));let o=e?.substitutions??[],a=new Set(o.map(l=>l.to.family.toLowerCase()));for(let l of o)r(l.from.family);for(let l of e?.sources??[])a.has(l.request.family.toLowerCase())||r(l.request.family);for(let l of t)r(l);let s=[...n.values()];return s.sort((l,d)=>l<d?-1:l>d?1:0),s}var Cv={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Zg(e$1,t){let n=[],r=[],o=t.aggregateBudget,a=new Set;for(let s of e$1){let l=Cv[s.style],d=Object.freeze({family:s.family,weight:l.weight,style:l.style});if(s.family.trim().length===0){r.push({request:d,partName:s.partName,reason:"malformed"});continue}let u=e(d);if(!(t.shadowedRequests?.has(u)||a.has(u))){if(a.add(u),s.bytes.byteLength>t.maxFontBytes||s.bytes.byteLength>o){r.push({request:d,partName:s.partName,reason:"overLimit"});continue}o-=s.bytes.byteLength,n.push({request:d,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:a$2(s.bytes),faceIndex:0});}}return {sources:n,dropped:r}}var Rv="The quick brown fox 0123 \u2014 {}#@",Ev=["monospace","serif"],Ov=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function zg(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(Rv).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!Ov.test(r))return t.set(r,true),true;let a=false;for(let s of Ev){let l=n(`32px ${s}`);if(n(`32px "${r}", ${s}`)!==l){a=true;break}}return t.set(r,a),a}}function Kg(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=Hd$1.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}var Vg=Object.freeze({installed:0,alias:()=>{},dispose(){}});function Fv(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)}`}function Av(){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 jg(e,t=Av(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return Vg;let a=new Map;for(let u of e){let m=u.request.family,I=a.get(m);I?I.push(u):a.set(m,[u]);}let s=new Map,l=[];if(await Promise.all([...a].map(async([u,m])=>{let I=Fv(m.map(w=>w.hash)),v=false;await Promise.all(m.map(async w=>{try{let C=o(I,w.bytes,{weight:String(w.request.weight),style:w.request.style});await C.load(),r.add(C),l.push(C),v=!0;}catch{}})),v&&s.set(u,I);})),l.length===0)return Vg;for(let u of n){if(s.has(u.from.family))continue;let m=s.get(u.to.family);m!==void 0&&s.set(u.from.family,m);}let d=false;return {installed:l.length,alias:u=>d?void 0:s.get(u),dispose(){if(!d){d=true;for(let u of l)try{r.delete(u);}catch{}}}}}var Eo=.1,Oo=5;var Tr={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},Mv={type:"fit",fit:"pageWidth"},ja={type:"fixed"};function Ua(e){return e==="auto"?Tr:!e||typeof e!="object"?null:e.type==="fixed"?ja:e.type==="fit"&&e.fit==="pageWidth"?Wa(e,Tr)?Tr:e:null}function Wa(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 Pr(e){return e.type==="fit"}function Wg({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,s=Math.max(e-2*a,e*.5),l=Number.isFinite(r)?Ug(r):.1,d=Number.isFinite(o)?Ug(o):5,u=Math.floor(s/t*100)/100;return Math.min(Math.max(u,l),Math.max(d,l))}function Ug(e){return Math.min(Math.max(e,.1),5)}function Lv(e){let t=It(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 Gg(e){let t=null,n=null,r=null,o=null;function a(){if(r===null)return;n?.ownerDocument.defaultView?.cancelAnimationFrame(r),r=null;}function s(){let d=e.mode();if(!Pr(d))return;let u=e.container();if(!u)return;let m=Lv(u);if(m===null)return;let I=e.pageWidthPx();if(I===null)return;o=e.pageWidthTwips();let v=Wg({availableWidthPx:m,pageWidthPx:I,...d.minZoom!==void 0?{minZoom:d.minZoom}:{},...d.maxZoom!==void 0?{maxZoom:d.maxZoom}:{}});v===null||v===e.zoom()||e.applyZoom(v);}function l(){let d=n?.ownerDocument.defaultView;if(!d?.requestAnimationFrame){s();return}r===null&&(r=d.requestAnimationFrame(()=>{r=null,s();}));}return {refitIfPageResized(){let d=e.pageWidthTwips();d===null||d===o||s();},attach(){this.detach();let d=e.container();if(!d)return;let u=It(d);u&&(n=u,typeof ResizeObserver<"u"&&(t=new ResizeObserver(l),t.observe(u)),s());},refit:s,detach(){a(),t?.disconnect(),t=null,n=null,o=null;}}}function Xg(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=Ua(e.zoomMode??(n!==null?ja:"auto"))??Tr;function a(d,u){if(d===r)return u?.(),true;let m=t.surface();return m&&!tg(m,d*(96/72))?false:(r=d,u?.(),t.bump(),t.emitSelectionChange(),true)}function s(){o=ja,l.detach();}let l=Gg({container:t.container,mode:()=>o,pageWidthPx:()=>{let d=t.surface()?.layout().pages[0]?.box;return d?d.width*(96/72):null},pageWidthTwips:()=>t.surface()?.sectionProperties().pageSize.widthTwips??null,zoom:()=>r,applyZoom:d=>{a(d);}});return {zoom:()=>r,mode:()=>o,scale:()=>r*(96/72),attach:()=>{Pr(o)&&l.attach();},detach:()=>l.detach(),refit:()=>l.refit(),refitIfPageResized:()=>l.refitIfPageResized(),setZoom(d){if(!Number.isFinite(d)||d<.1||d>5)return {ok:false,code:"invalidArgs",reason:`zoom must be between ${.1} and ${5}, got ${d}`};let u=Pr(o);return d===r?u?(s(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(d,u?s:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${d}`}},setZoomMode(d){let u=Ua(d);return u?Wa(u,o)?{ok:true,changed:false}:(o=u,Pr(u)?l.attach():l.detach(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:false,code:"invalidArgs",reason:`unknown zoom mode ${JSON.stringify(d)}`}}}}function $g(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function Yg(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:$g(r.box),contentBox:$g(r.contentBox)})):[]}}}var Kt="comments and tracked changes require the pro review module (@docx-editor.dev/pro)",Ga={mode:null,rejection:null};function Qg(e,t){return e===void 0||e==="view"?Ga:e==="edit"?{mode:"editing",rejection:null}:t.reviewEnabled?t.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:"suggesting mode was requested, but no author is configured"}:{mode:null,rejection:Kt}}function Jg(e){return e.viewOnly||e.currentMode!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?Ga:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:"this document asks for tracked changes, but no author is configured"}}var em=new Map;function tm(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=b$1(o,t);return n={slots:o,colors:t,value:a},a},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:a$4(t)}),r.value.get(o))}}function ml(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);})}}var _v=Object.freeze({kind:"body"}),rm=Object.freeze([]);function Bv(e$1){let t=e$1.locale&&e$1.locale in locales?e$1.locale:"en",r={title:createT(deepMerge(en,t==="en"?void 0:locales[t]),t)("toolbar.tableOfContents")},o=e$1.container??null,a$2=a$3(e$1.modules),s=xg(a$2),l=a$2.review!==null,d$2=null,u=Ig({mount:g=>at(g),scheduled:()=>{le(),Le();}}),m=e$1.mode==="view"?"viewing":"editing",I=null,v=tm(e$1.revisionStyles),w=d$1(),C=false,F=null,T=e$1.mode??"edit",K=Qg(e$1.mode,{reviewEnabled:l,hasAuthor:!!e$1.author});K.mode!==null&&(m=K.mode),K.rejection!==null&&(F=K.rejection);let h=null,_=null,L=null,W=null,q$1="none",A={kind:"none"},$=null,x=null,E=ml({}),V=ml({}),k=false,R,G,U=null;function ee(){U?.dispose(),U=null;}let fe=0,ke,ye=()=>typeof e$1.fonts=="function"?ke:e$1.fonts,be=-1,pe=false,Ue=null,Ft=g=>(Ue||(Ue=zg(o?vr(o.ownerDocument):null)),Ue(g)),Ee=null,ct=()=>{let g=ye();return (Ee===null||Ee.configuration!==g)&&(Ee={configuration:g,families:new Set([...(g?.sources??[]).map(O=>O.request.family),...(g?.substitutions??[]).map(O=>O.from.family)].filter(O=>typeof O=="string"&&O.trim().length>0).map(O=>O.toLowerCase()))}),Ee.families},D=g=>ct().has(g.toLowerCase())||U?.alias(g)!==void 0,re=()=>!h||pe||!h.session.rendersText()?rm:Kg(h.session.documentFonts(),D,Ft),b=0,P=null,N$1=null,j=-1,te=0,z=-1,ne=false;function le(){b+=1;}let ge={change:new Set,selectionChange:new Set,error:new Set};function Me(g){for(let O of [...ge.error])O(g);}function ot(g){for(let O of [...ge.change])O(g);}function Le(){if(ge.selectionChange.size===0)return;let g=jt();for(let O of [...ge.selectionChange])O(g);}function We(){L?.(),L=null,h?.destroy(),h=null,W=null,q$1="none",$=null,x=null,te+=1;}let Ce=Xg(e$1,{container:()=>o,surface:()=>h,bump:le,emitSelectionChange:Le}),At=()=>Ce.scale();function at(g){if(!o){d$2=g,_=null,le();return}We();let O=nl(o,g,{scale:At(),defaultFontFamily:Va(ye()),...e$1.translate?{drawingStrings:g$2(e$1.translate)}:{},...e$1.author?{author:e$1.author}:{},...v.current()!==void 0?{revisionStyles:v.current()}:{},reviewAuthorSlots:w,initialDrawingSelectionIntent:A,editingMode:m==="suggesting"?"suggest":m==="viewing"?"view":"edit",...l?{}:{revisionDisplayMode:"proposed"},...a$2.review?{reviewModel:{...a$2.review,collectReviewItems:Z=>a$2.review.collectReviewItems(a$2.customNodes.length>0?{...Z,customNodes:a$2.customNodes,...a$2.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:s}:{}}:Z)}}:{},...R?{measurer:R,...G?{producer:G}:{}}:{},...U?{fontAlias:U.alias}:{},...e$1.tableInteractionLabel?{tableInteractionLabel:e$1.tableInteractionLabel}:{},...e$1.imageDecodePort?{imageDecodePort:e$1.imageDecodePort}:{},onHyperlinkPopover:Z=>E.current().onPopover?.(Z),onRequestHyperlink:()=>E.current().onRequest?.(),onEquationPopover:Z=>V.current().onPopover?.(Z),onTrackedChange:()=>{ne||(ne=true,le(),Le());},tocLabels:r,onChange:Z=>{if(!h)return;le();let oe=Z.pendingFormat!==$;$=Z.pendingFormat;let J=h.headerFooterState?.(),se=J?.editing&&J.rId?`${J.editing}:${J.rId}`:null,ue=se!==x;x=se;let Pe=ys(h.drawingSelectionIntent()),ae=Pe!==q$1;q$1=Pe,!(us(Z.selection,W)&&!oe&&!ue&&!ae)&&(W=Z.selection,Le());}});if(!O.ok){_=O.detail?`${O.reason}: ${O.detail}`:O.reason,le(),Me(gr(O.reason,`failed to open document: ${_}`));return}_=null,h=O.surface,ne=l&&h.session.reviewItems().length>0,mn(),Sg(h,a$2),te+=1,h.setEditable(m!=="viewing"),I!==null&&h.setReviewActivationExclusions(I),W=h.state().selection,q$1=ys(h.drawingSelectionIntent()),L=O.surface.session.subscribe(Z=>{let oe={revision:O.surface.session.packageRevision(),created:Z.created,deleted:Z.deleted,dirty:Z.dirty};Ce.refitIfPageResized(),le(),ot(oe);}),Ce.attach(),le(),ot({revision:h.session.packageRevision()}),Le(),be!==fe&&(be=fe,me(fe,h));}function en$1(g){if(u.cancel(),ne=false,fe+=1,w=d$1(),R=void 0,G=void 0,ke=void 0,ee(),pe=false,o){let O=It(o);O&&(O.scrollTop=0,O.scrollLeft=0);}o&&u.shouldYield(g)?u.schedule(g):at(g);}function he(g){(g.code==="wasmUnavailable"||g.cause instanceof q&&g.cause.code==="unsupportedRuntime")&&!e$1.onFontError&&ge.error.size===0&&Vc(g);try{e$1.onFontError?.(g);}catch{}Me(g);}async function me(g,O){let Z=e$1.fonts,oe=O.session.embeddedFonts();if(!(!Z&&oe.length===0)){pe=true,le();try{let J=typeof Z=="function"?await Z({families:O.session.documentFonts().slice(0,Zi),defaultFamily:Va(ye())}):Z;if(k||g!==fe){g===fe&&(pe=!1);return}if(ke=J,!J&&oe.length===0){pe=!1,le();return}let se=(J&&"maxFontBytes"in J?J.maxFontBytes:void 0)??a$1,ue=(J?.sources??[]).reduce((Te,Ve)=>Te+Ve.bytes.byteLength,0),Pe=new Set((J?.sources??[]).filter(Te=>Te.request.family.trim().length>0).map(Te=>e(Te.request))),ae=Zg(oe,{maxFontBytes:se,aggregateBudget:Math.max(0,c-ue),shadowedRequests:Pe});for(let Te of ae.dropped)he(new a(Te.reason,Te.reason==="overLimit"?`embedded font ${Te.request.family} (${Te.partName}) exceeds the font byte budget`:`embedded font part ${Te.partName} declares an invalid family name`,{request:Te.request}));let we=ba({epoch:g,...J},ae);if(we.sources.length===0){pe=!1,le(),J&&he(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let Ie=await ha(we);if(k||g!==fe){cr(Ie),g===fe&&(pe=!1);return}let Ge=new Set;for(let Te of ae.sources){let Ve=Ie.fonts.resolve(Te.request);Ve instanceof d&&(he(dr(Ve)),Ge.add(Te.id));}if(Ge.size>0&&Ge.size<ae.sources.length){let Te=ae.sources.filter(St=>!Ge.has(St.id)),Ve=Ie;if(Ie=await ha(ba({epoch:g,...J},{sources:Te})),cr(Ve),k||g!==fe){cr(Ie),g===fe&&(pe=!1);return}}else if(Ge.size===ae.sources.length&&!J){pe=!1,le();return}let hn=[...J?.sources??[],...ae.sources].filter(Te=>!Ge.has(Te.id)).map(Te=>{let Ve=Ie.fonts.resolve(Te.request);return Ve instanceof d||Ve.id!==Te.id?null:{request:Te.request,id:Ve.id,bytes:Ve.bytes,hash:Ve.hash,faceIndex:Ve.faceIndex}}).filter(Te=>Te!==null),Cn=await jg(hn,void 0,we.substitutions??[]);if(k||g!==fe){Cn.dispose(),cr(Ie),g===fe&&(pe=!1);return}ee(),U=Cn;let Rn=Kd(At(),{context:o?vr(o.ownerDocument):null,...U?{fontAlias:U.alias}:{}}),En=new Map;if(R=Pd({shaper:Ie.shaper,resolveFont:Te=>{let Ve=Te.fontFamily??we.defaultFont.family;if(Ve.trim().length===0)return null;let St={family:Ve,weight:Te.bold?700:400,style:Te.italic?"italic":"normal"},ft=e(St);if(En.has(ft))return En.get(ft)??null;let Mr;try{Mr=Ie.fonts.resolve(St);}catch{return En.set(ft,null),null}let _o=Mr instanceof d?null:Mr;return En.set(ft,_o),_o},fallback:Rn.measurer,shapingLibrary:n,unicodeDataVersion:"16.0.0",...we.language?{language:we.language}:{}}),G=`shaped:${Ie.operation.extensionFingerprint}+fallback:${Rn.producer}@scale:${At()}`,pe=!1,h){h.flushPendingInput();let Te=h.session.save(),Ve=h.state().selection;A=h.drawingSelectionIntent();let St=typeof document<"u"&&document.activeElement!==null&&o!==null&&o.contains(document.activeElement);try{at(Te);}catch(ft){R=void 0,G=void 0,h||(d$2=Te,at(Te)),he(dr(ft));}St&&h?.focus(),h?.setSelection(Ve),A={kind:"none"};}else le();}catch(J){if(k||g!==fe)return;pe=false,le(),he(dr(J));}}}let un=is();function Vt(){let g=h?.state()??null;return {scope:h?.activeScope?.()??_v,isLoading:_===null&&h===null&&d$2===null&&!u.isScheduled(),isOpening:u.isScheduled(),parseError:_,editable:h!==null&&h.session.editable&&T!=="view"&&m!=="viewing",zoom:Ce.zoom(),zoomMode:Ce.mode(),selection:Ts(h),selectionCollapsed:g===null||g.selection.anchor.paragraphId===g.selection.head.paragraphId&&g.selection.anchor.offset===g.selection.head.offset,formatting:Hu(h),table:Rs(h),tocContext:un(g?.contextTocId??null),image:Jt(h),page:{current:Cs(h),total:Ps(h)},canUndo:g?.canUndo??false,canRedo:g?.canRedo??false,pageSetup:ws(h),reviewPaneOpen:ne,hasReviewContent:h?.session.hasReviewContent()??false,editingMode:m,lastRejection:g?.lastRejection??F,fontSubstitutions:re()}}function jt(){if(P&&z===b)return P;let g=P,O=h?.state().selection??null,Z=us(O,N$1);N$1=O;let oe=h?.session.packageRevision()??-1,J=oe===j;j=oe;let se=Vt(),ue=se;if(g){let Pe=ns(se.formatting,g.formatting)?g.formatting:se.formatting,ae=rs(se.page,g.page)?g.page:se.page,we=os(se.pageSetup??null,g.pageSetup??null)?g.pageSetup:se.pageSetup,Ie=as(se.selection,g.selection)?g.selection:se.selection,Ge=Ou(se.image,g.image)?g.image:se.image,hn=g.fontSubstitutions!==void 0&&se.fontSubstitutions!==void 0&&g.fontSubstitutions.length===se.fontSubstitutions.length&&se.fontSubstitutions.every((Cn,Rn)=>g.fontSubstitutions[Rn]===Cn)?g.fontSubstitutions:se.fontSubstitutions;ue={...se,formatting:Pe,page:ae,pageSetup:we,selection:Ie,image:Ge,fontSubstitutions:hn},ss(ue,g)&&Z&&J&&(ue=g);}return P=wa(ue),z=b,P}if(e$1.document){let g=fs(e$1.document);g?en$1(g):(_=ps(e$1.document),Me(gr("unsupported",_)));}let fn=0,Fo=null,Cr="",pn=null,Ao=true,jn=null;function Un(){let g=`${h?.session.packageRevision()??-1}:${h?.session.revision()??-1}`,O=Pn(),Z=$n()?.anchorY??null;return (h!==Fo||g!==Cr||O!==pn||ne!==Ao||Z!==jn)&&(Fo=h,Cr=g,pn=O,Ao=ne,jn=Z,fn+=1),fn}function X(g){return g.kind==="revision"?g.ranges[0]??null:g.range}function Mt(g){return X(g)===null?false:!(g.kind==="revision"&&I!==null&&I.includes(g.revisionKind))}let Mo=rg(),tn=new WeakMap;function $a(g){let O=tn.get(g);if(O)return O;let Z=new Map;for(let oe of g.pages)for(let J of [oe.footnotes,oe.endnotes])if(J)for(let se of J.notes)for(let ue of Y(se.fragments))for(let Pe of wc$1(ue))Z.has(Pe)||Z.set(Pe,se.scopeId);return tn.set(g,Z),Z}function Tn(g){let O=X(g)?.partName;if(!O||!h||O===h.session.part().name)return null;for(let Z of h.session.headerFooterResolutionBySection())for(let oe of ["header","footer"]){let J=oe==="header"?Z.headers:Z.footers;for(let se of J.values())if(se.partName===O)return {kind:oe,rId:se.rId}}return null}function Rr(g){let O=X(g),Z=h?.publishedLayout();return !O||!Z?null:$a(Z).get(O.start.paragraphId)??null}function Er(g){let O=X(g)?.partName;if(!O||!h)return null;for(let Z of ["footnote","endnote"])if(_d$1(h.session.currentPackage(),Z)?.name===O)return {kind:"notesPart",noteKind:Z};return null}function Or(g){let O=Tn(g);return O!==null?{kind:"headerFooter",rId:O.rId}:Er(g)??{kind:"body"}}function Lo(g){!h||h.activeScope().kind==="body"||h.session.paragraphIds().includes(g)&&(h.exitNote?.(),h.exitHeaderFooter?.());}let Wn=()=>`${new Date().toISOString().slice(0,19)}Z`,No=new WeakMap;function Ut(g){let O=No.get(g);if(O)return O;let Z=new Map;for(let[oe,J]of sc(g).entries())Z.set(J,oe);return No.set(g,Z),Z}function Fr(){h?.flushPendingInput();let g=h?.retainedSelection()??h?.state().selection??null;if(!g)return null;let{anchor:O,head:Z}=g;if(O.paragraphId===Z.paragraphId&&O.offset===Z.offset)return null;let oe=h?.publishedLayout();if(!oe)return null;let J=Ut(oe),se=J.get(O.paragraphId)??-1,ue=J.get(Z.paragraphId)??-1;if(se===-1||ue===-1){let ae=Gn();se=ae.get(O.paragraphId)??-1,ue=ae.get(Z.paragraphId)??-1;}return se===-1||ue===-1?null:se<ue||se===ue&&O.offset<=Z.offset?{from:O,to:Z}:{from:Z,to:O}}function Do(){let g=h?.activeScope();if(g?.kind==="headerFooter")return {kind:"headerFooter",rId:g.rId};if(g?.kind==="note"){let O=hd(g.id);if(O)return {kind:"notesPart",noteKind:O.noteKind}}return {kind:"body"}}function xt(g){if(!h)return {kind:"body"};let O=g.slice(0,g.indexOf("#"));if(O.length===0||O===h.session.part().name)return {kind:"body"};for(let Z of h.session.headerFooterResolutionBySection())for(let oe of [Z.headers,Z.footers])for(let J of oe.values())if(J.partName===O)return {kind:"headerFooter",rId:J.rId};for(let Z of ["footnote","endnote"])if(_d$1(h.session.currentPackage(),Z)?.name===O)return {kind:"notesPart",noteKind:Z};return Do()}function Gn(){if(!h)return new Map;let g=Do();if(g.kind==="body")return new Map;let O=new Map;for(let[Z,oe]of h.session.paragraphIdsIn(g).entries())O.set(oe,Z);return O}function Ho(g){if(g.kind==="revision"){let Z=g.ranges;if(Z.length===0)return null;let J=g.revisionKind==="replace"||g.revisionKind==="insert"||g.revisionKind==="delete"?Z[Z.length-1]:Z[0];return {start:Z[0].start,end:J.end}}let O=X(g);return O?{start:O.start,end:O.end}:null}function $n(){if(h&&h.activatedReviewKey()!==null)return null;let g=Fr(),O=h?.publishedLayout();if(!g||!O)return null;let Z=Mo(O).get(g.from.paragraphId);return Z?{pageIndex:Z.pageIndex,anchorY:Z.contentY+Md$1(Z,g.from.paragraphId,g.from.offset)}:null}function Pn(){return h?.activeReviewKey()??null}function gn(g){if(!l)return [];let O=h?.session.reviewItems()??[],Z=g?.excludeRevisionKinds;if(Z&&Z.length>0){let ae=new Set(Z);O=O.filter(Ie=>Ie.kind!=="revision"||!ae.has(Ie.revisionKind));let we=new Set(O.filter(Ie=>Ie.kind==="revision").map(Ie=>Ie.id));O=O.map(Ie=>{if(Ie.kind!=="comment"||Ie.parentRevisionId===void 0||we.has(Ie.parentRevisionId))return Ie;let{parentRevisionId:Ge,...hn}=Ie;return hn});}let oe=g?.placement!==false,J=null;if(oe&&O.length>0){let ae=h?.publishedLayout()??null;ae&&(J=Mo(ae));}let se=Pn(),ue=ae=>{let we=Tn(ae);return we===null?1:we.kind==="header"?0:2},Pe=O.map((ae,we)=>({item:ae,position:we,pageIndex:J?Od(ae,J)?.pageIndex??null:null,group:ue(ae)}));return Pe.sort((ae,we)=>{let Ie=ae.pageIndex??Number.MAX_SAFE_INTEGER,Ge=we.pageIndex??Number.MAX_SAFE_INTEGER;return Ie!==Ge?Ie-Ge:ae.group!==we.group?ae.group-we.group:ae.position-we.position}),Pe.map(({item:ae})=>{let we=wg$1(ae),Ie=J?Od(ae,J):null,Ge={key:we,id:ae.id,...ut(ae)!==void 0?{date:ut(ae)}:{},activatable:Mt(ae),anchorY:Ie?.y??null,pageIndex:Ie?.pageIndex??null,isActive:we===se};return ae.kind==="comment"?{...Ge,kind:"comment",author:ae.comment.author,initials:Eg$1(ae.comment),text:Dg$1(ae.comment),resolved:ae.resolved,...ae.parentId!==void 0?{parentId:ae.parentId}:{},...ae.parentRevisionId!==void 0?{parentRevisionId:ae.parentRevisionId}:{},replyIds:ae.replyIds,readOnly:false,item:ae}:ae.kind==="revision"?{...Ge,kind:"revision",revisionKind:ae.revisionKind,author:ae.author,initials:Xa(ae.author),text:ae.text,...ae.replacedText?{replacedText:ae.replacedText}:{},replyIds:ae.replyIds,readOnly:ae.readOnly,item:ae}:{...Ge,kind:"custom",author:"",initials:"",text:ae.detail??ae.text,replyIds:[],readOnly:true,item:ae}})}function Lt(){return h?.session.trackingSettings()??N}function mn(){let g=Lt(),O=Jg({viewOnly:T==="view",reviewEnabled:l,hasAuthor:!!e$1.author,hostChoseMode:e$1.mode!==void 0,readerChoseMode:C,currentMode:m,trackRevisions:g.trackRevisions,restrictedToTrackedChanges:g.restrictedToTrackedChanges});O.rejection!==null&&(F=O.rejection),O.mode==="suggesting"&&(m="suggesting",h?.setEditingMode("suggest"));}function Xn(g){return g!=="editing"||!Lt().restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function ut(g){return g.kind==="comment"?g.comment.date:g.kind==="revision"?g.date:void 0}function Xa(g){let O=g.trim().split(/\s+/).filter(Boolean);return O.length===0?"?":O.slice(0,2).map(Z=>Z[0].toUpperCase()).join("")}function Ar(g,O){if(!l)return {ok:false,code:"unsupported",reason:Kt};let oe=gn().find(se=>se.key===g)?.item;if(!oe||oe.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(oe.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let J;return h?.commitReviewOps(()=>(J=h.session.applyTreeOps(oe.addresses.map(se=>O==="accept"?{op:"acceptRevision",revision:se}:{op:"rejectRevision",revision:se}),void 0,void 0,Or(oe)),J)),J?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof J?.reason=="string"?J.reason:"the revision was refused"}}let Ke={get mountGeneration(){return te},get surface(){return h},setHyperlinkChrome:E.push,setEquationChrome:V.push,stateVersion:()=>b,fontMeasurement:()=>({measurer:R?"shaped":"fixed",resolving:pe,...R&&G?{producer:G}:{}}),attach(g){if(k){Me(gr("destroyed","this editor was destroyed; create a new instance to remount"));return}if(h&&o===g)return;h&&(h.flushPendingInput(),d$2=h.session.save(),We());let O=u.cancel();O&&(d$2=O),Ce.detach(),o=g,Ue=null;let Z=d$2;d$2=null,Z&&u.shouldYield(Z)?u.schedule(Z):Z?at(Z):le();},detach(){if(k)return;Ce.detach();let g=u.cancel();h&&(h.flushPendingInput(),d$2=h.session.save(),We()),g&&(d$2=g),o=null,Ue=null,le();},load(g){let O=fs(g);if(!O){Me(gr("unsupported",ps(g)));return}en$1(O);},save(){if(u.flush(),!h)return Promise.reject(gr("notFound","no document is loaded"));h.flushPendingInput();let O=h.session.save().slice();return Promise.resolve(O.buffer)},getDocumentHandle(){return Object.freeze({revision:h?.session.packageRevision()??0})},exec(g,O){if(u.flush(),k&&(g.type==="toggleReviewPane"||g.type==="setEditingMode"))return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(g.type==="setEditingMode"){if(T==="view"&&g.mode!=="viewing")return {ok:false,code:"locked",reason:"this document was opened for viewing"};if(g.mode==="suggesting"&&!l)return {ok:false,code:"unsupported",reason:Kt};let Pe=Xn(g.mode);return Pe||(C=true,F=null,m=g.mode,h?.setEditingMode(g.mode==="suggesting"?"suggest":g.mode==="viewing"?"view":"edit"),h?.setEditable(g.mode!=="viewing"),le(),Le(),{ok:true,changed:false})}if(g.type==="toggleReviewPane")return l?(ne=!ne,le(),Le(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Kt};if(fl(g))return _g(g,h,pl(m),O);let Z=po(g);if(m==="viewing"&&Z.supported&&Z.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let oe=Io(g,h,T,O);if(!oe.ok)return oe.refusal;let J=h,se=J.session.packageRevision(),ue=vg(J,g,{...oe.tablePlan?{admittedTablePlan:oe.tablePlan}:{},editor:Ke});return ue||{ok:true,changed:J.session.packageRevision()!==se}},can(g,O){if(g.type==="insertImage"||g.type==="replaceImage"){if(k)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(O?.scope){let J=Io(g,h,T,O);if(!J.ok)return J.refusal}return Nu(g,h)}if(g.type==="toggleReviewPane"||g.type==="setEditingMode"){if(k)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(g.type==="toggleReviewPane"&&!l)return {ok:false,code:"unsupported",reason:Kt};if(g.type==="setEditingMode"&&T==="view"&&g.mode!=="viewing")return {ok:false,code:"locked",reason:"this document was opened for viewing"};if(g.type==="setEditingMode"){if(g.mode==="suggesting"&&!l)return {ok:false,code:"unsupported",reason:Kt};let J=Xn(g.mode);if(J)return J}return {ok:true}}if(fl(g))return gl(g,h,pl(m),O);let Z=po(g);if(m==="viewing"&&Z.supported&&Z.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let oe=Io(g,h,T,O);if(!oe.ok)return oe.refusal;if(g.type==="proposeInsertion"||g.type==="proposeDeletion"||g.type==="proposeReplacement"){if(!(g.author??e$1.author??"").trim())return {ok:false,code:"invalidArgs",reason:`${g.type} requires a non-empty author`};let se=g.target===void 0?{ok:true,selection:h.state().selection}:Ba(h,g.target);if(!se.ok)return se;let{anchor:ue,head:Pe}=se.selection,ae=ue.paragraphId===Pe.paragraphId&&ue.offset===Pe.offset,we=g.type==="proposeReplacement"&&g.target===void 0&&h.state().cellSelection!==null;if(g.type!=="proposeInsertion"&&ae&&!we)return {ok:false,code:"invalidArgs",reason:`${g.type} needs a non-collapsed selection`}}if(ho(g)&&vs(g)){let J=yo(Ke);if(J){let se=Is(Ke,g,J);if(se)return se}}return {ok:true}},isActive(g){if(g.type==="toggleReviewPane")return ne;if(g.type==="setEditingMode")return m===g.mode;let O=h?jt().formatting:null;if(!O)return false;switch(g.type){case "toggleMark":switch(g.mark){case "bold":return O.bold===true;case "italic":return O.italic===true;case "underline":return O.underline===true;case "strike":return O.strike===true;case "superscript":return O.superscript===true;case "subscript":return O.subscript===true;default:return false}case "setAlignment":return O.alignment===(g.align==="justify"?"both":g.align);case "toggleList":return h?.isListActive(g.kind)??false;default:return false}},getDocumentStyles:()=>h?.session.documentStyles()??[],getDocumentFonts:()=>h?.session.documentFonts()??[],getAvailableFonts:()=>qg(ye(),h?.session.documentFonts()??[]),getDocumentThemeColors:()=>h?.session.documentThemeColors()??[],getOutline:()=>h?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>zu(h?jt().formatting:null),findMatches:(g,O)=>h?.session.findText(g,{...O?.matchCase!==void 0?{matchCase:O.matchCase}:{},...O?.wholeWord!==void 0?{wholeWord:O.wholeWord}:{}}).matches??[],selectMatch(g){return u.flush(),h?typeof g?.blockId!="string"||g.blockId.length===0||!Number.isInteger(g.start)||g.start<0||!Number.isInteger(g.length)||g.length<0?{ok:false,code:"invalidArgs",reason:"match must carry a blockId and offsets"}:(Lo(g.blockId),h.setSelection({anchor:{paragraphId:g.blockId,offset:g.start},head:{paragraphId:g.blockId,offset:g.start+g.length}}),h.revealParagraph(g.blockId),{ok:true,changed:false}):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>jt().image,getSelectedTable:()=>Zu(h),getTableCellSelection:()=>{let g=h?.state().cellSelection;return g?{tableId:g.tableId,rows:g.rows,columns:g.columns,cellIds:g.cellIds}:null},setTableInteractionLabel(g){h?.setTableInteractionLabel(g);},canExecuteImageCommand(g,O){if(k)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(O?.scope){let Z=Io(g,h,T,O);if(!Z.ok)return Z.refusal}return xs(g,h)},executeImageCommand(g){return k?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):Ss(Ke,g)},getPageSetup:()=>ws(h),getWatermark:()=>null,getTrackedChanges:()=>(h?.session.reviewItems()??[]).filter(g=>g.kind==="revision").map(g=>{let O=Tn(g);return {id:g.id,kind:g.kind==="revision"?g.revisionKind:"revision",...g.kind==="revision"&&g.author?{author:g.author}:{},story:O!==null?O.kind:Er(g)?.noteKind??"body"}}),getReviewItems:g=>gn(g),getCustomNodeDefinitions:()=>a$2.customNodes,reportCustomNodeDiagnostic:s,addComment(g,O){if(!l)return {ok:false,code:"unsupported",reason:Kt};let Z=Fr();if(!Z||!h)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let oe=(O??e$1.author??"").trim();if(oe.length===0||g.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let J=null;return h.commitReviewOps(()=>(J=h.session.replyToComment(null,{paragraphId:Z.from.paragraphId,start:Z.from.offset,end:Z.to.offset,...Z.to.paragraphId===Z.from.paragraphId?{}:{endParagraphId:Z.to.paragraphId}},g,oe,Wn(),xt(Z.from.paragraphId)),{committed:J!==null})),J===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>$n(),isReviewPaneOpen:()=>ne,getEditingMode:()=>m,getReviewAuthors:()=>v.authorsFor(h?.revisionAuthors()??em),getConfiguredAuthor:()=>e$1.author?.trim()||null,getReviewAuthorStyle:g=>v.styleFor(g),setRevisionStyles(g){v.set(g),h?.setRevisionStyles(g),le(),Le();},setEditingMode:g=>Ke.exec({type:"setEditingMode",mode:g}),getReviewRevision:()=>Un(),setActiveReviewItem(g,O){if(g===null)return h?.dismissActiveReview(),le(),Le(),{ok:true,changed:false};if(!h)return {ok:false,code:"notFound",reason:"no document is open"};h.flushPendingInput();let oe=gn().find(Pe=>Pe.key===g)?.item;if(!oe)return {ok:false,code:"notFound",reason:"no review item with that key"};let J=X(oe);if(!J)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!Mt(oe))return {ok:false,code:"unsupported",reason:`review items of kind '${oe.revisionKind}' are excluded from activation`};let se=oe?Tn(oe):null,ue=se===null&&oe?Rr(oe):null;if(se!==null){if(!h.enterHeaderFooter?.({rId:se.rId,kind:se.kind,position:{paragraphId:J.start.paragraphId,offset:J.start.offset}}))return {ok:false,code:"unsupported",reason:"the header or footer this change lives in could not be opened"}}else if(ue!==null){if(!h.enterNote?.(ue,{paragraphId:J.start.paragraphId,offset:J.start.offset}))return {ok:false,code:"unsupported",reason:"the note this change lives in could not be opened"}}else {h.exitNote?.(),h.exitHeaderFooter?.();let Pe=Ho(oe)??J,ae={paragraphId:Pe.start.paragraphId,offset:Pe.start.offset};h.activateReview(g,{anchor:ae,head:ae});let we=O?.reveal??"centerIfNeeded";we!==false&&h.revealPosition?.(Pe.start,{block:we});}return (se!==null||ue!==null)&&h.activateReview(g),le(),Le(),{ok:true,changed:false}},setReviewActivationExclusions(g){I=g===null?null:[...g],h?.setReviewActivationExclusions(I);},acceptReviewItem:g=>Ar(g,"accept"),rejectReviewItem:g=>Ar(g,"reject"),setCommentResolved(g,O){return wg({reviewEnabled:l,editingMode:m,placements:gn,surface:h,proReviewReason:Kt,bump:le},g,O)},deleteReviewItem(g){if(!l)return {ok:false,code:"unsupported",reason:Kt};let Z=gn().find(J=>J.key===g)?.item;if(!Z||!h)return {ok:false,code:"notFound",reason:"no review item with that key"};if(Z.kind==="revision")return Ar(g,"reject");if(Z.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};Pn()===g&&h.dismissActiveReview();let oe=false;return h.commitReviewOps(()=>{let J=Rr(Z),se=J===null?null:hd(J);return oe=h.session.deleteComment(Z.id,Or(Z),se?.noteId),{committed:oe}}),oe?(le(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(g,O,Z){if(!l)return {ok:false,code:"unsupported",reason:Kt};h?.flushPendingInput();let J=gn().find(Ie=>Ie.key===g)?.item;if(!J||!h)return {ok:false,code:"notFound",reason:"no review item with that key"};let se=X(J);if(!se)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let ue=(Z??e$1.author??"").trim(),Pe=Tg(J,O,ue);if(Pe)return Pe;let ae=J.kind==="comment"?J.id:null,we=null;return h.commitReviewOps(()=>(we=h.session.replyToComment(ae,{paragraphId:se.start.paragraphId,start:se.start.offset,end:se.end.offset},O,ue,Wn(),Or(J)),{committed:we!==null})),we===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>h?.headerFooterState()??null,getNotePropertiesState:()=>h?.notePropertiesState?.()??null,getNotePreviewText:g=>h?.notePreviewText?.(g)??null,setActiveScope(g){h?.setActiveScope(g)&&le();},getActiveScope:()=>h?.activeScope()??{kind:"body"},query(g){switch(g.type){case "selectedText":return h?.selectedText()??"";case "selectionFormatting":return h?jt().formatting:null;case "selection":return Ts(h);case "paragraphs":return Bu(h,g.container);case "isInsideToc":return h?h.isInsideToc(h.state().selection.head.paragraphId):false;case "hyperlinkAt":return _u(h);case "contentControls":return Mg(h,g.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 ul(h,g.filter);case "tableContext":return Rs(h);default:return null}},snapshot:()=>jt(),getTotalPages:()=>Ps(h),getCurrentPage:g=>Cs(h,g),scrollToPage:g=>!Number.isInteger(g)||g<1?false:(u.flush(),h?.revealPage(g-1)??false),scrollToBlock:g=>typeof g!="string"||g.length===0?false:(u.flush(),Lo(g),h?.revealParagraph(g)??false),...Yg(Ce,()=>h),relayout(g){g?.sync,h?.layout();},retainSelection:()=>h?.retainSelection()??null,releaseSelection:g=>h?.releaseSelection(g),focus(g){return u.flush(),h?g&&g.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:g&&!h.setActiveScope(g)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(h.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){k=true,u.cancel(),Ce.detach(),ee(),We(),o=null,d$2=null,te+=1,le();for(let g of Object.values(ge))g.clear();},on(g,O){return ge[g].add(O),()=>{ge[g].delete(O);}}};return Ke}var om=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function qv(e){return g$1({port:Zv(e),capabilities:om})}function Zv(e){let t=0,n=0,r=null,o=false,a=false,s=()=>{if(a)return null;let l=e.surface?.session??null;return l!==r&&(o&&(t+=n+1),o=true,r=l,n=0),l&&(n=l.packageRevision()),l};return {revision(){return s(),t+n},currentPackage:()=>s()?.currentPackage()??null,apply(l,d){s();let u=e.surface;if(!u)return {ok:false,reason:"no-document"};let m=u.applyAutomationOps(l,d);return m.rejected?{ok:false,reason:String(m.reason??"refused")}:{ok:true,changed:m.committed}},applyLifecycle(l){s();let d=e.surface;if(!d)return {ok:false,reason:"no-document"};let u=d.applyAutomationOps(()=>[l]);return u.rejected?{ok:false,reason:String(u.reason??"refused")}:{ok:true,changed:u.committed}},applyCommentWrites(l,d){let u=e.surface,m=s();if(!u||!m)return {ok:false,reason:"no-document"};if(l.length===0)return {ok:true,changed:false};if(d.kind!=="body")return {ok:false,reason:"unsupported-story"};let I=e.can({type:"toggleReviewPane"});if(!I.ok)return {ok:false,reason:I.reason??"review-module-required"};let v={ok:false,reason:"refused"};return u.commitReviewOps(()=>{if(l.every(F=>F.kind==="delete")){let F=l.find(K=>K.kind==="delete"),T=m.deleteComments(l.map(K=>{if(K.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:K.commentId,...K.parentCommentId===void 0?{}:{parentCommentId:K.parentCommentId}}}),d,F?.kind==="delete"?F.noteId:void 0);return v=T?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:T}}if(l.length!==1)return v={ok:false,reason:"mixed-comment-writes"},{committed:false};let w=l[0];if(w.kind==="resolve"){let F=m.setCommentResolved(w.commentId,w.resolved);return v=F?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:F}}if(w.kind!=="create"&&w.kind!=="reply")return v={ok:false,reason:"unsupported-comment-write"},{committed:false};let C=m.replyToComment(w.kind==="reply"?w.parentCommentId:null,w.anchor,w.text,w.author,w.date);return v=C===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:C},{committed:C!==null}}),v},applyCustomNodeWrite(l,d){let u=e.surface,m=s();if(!u||!m)return {ok:false,reason:"no-document"};if(d.kind!=="body")return {ok:false,reason:"unsupported-story"};let I={ok:false,reason:"refused"};return u.commitReviewOps(()=>{let v=m.insertCustomNode(l);return I=v.ok?{ok:true,changed:v.change!==null}:{ok:false,reason:v.detail?`${v.reason}: ${v.detail}`:v.reason},{committed:v.ok}}),I},save:()=>s()?.save()??null,select(l,d){if(!e.surface)return;let m=d==="end"?l.end:l.start,I=d==="start"?l.start:l.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:m.paragraphId,offset:m.offset},head:{paragraphId:I.paragraphId,offset:I.offset}}});},subscribe:l=>e.on("change",()=>l()),dispose(){a=true,r=null;}}}function zv(e){return e*(96/72)}function Kv(e,t){return e*t}function Vv(e,t){return e/t}function jv(e,t,n){let r=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 Uv(e){return Object.freeze(e?{left:e.offsetLeft,top:e.offsetTop}:{left:0,top:0})}function im(e,t,n){return t?true:e.length===1?false:!n}var am=["e","se","s","sw","w","nw","n","ne"];function Wv(e,t){let n=am.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return am[(n-r+8)%8]}function Gv(e,t,n){let r=e,o=t,a=-n.rotationDegrees*Math.PI/180,s=Math.cos(a),l=Math.sin(a),d=r*s-o*l,u=r*l+o*s;return r=d,o=u,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function Vn(e){return e/vo}function sm(e){let t=Gv(e.deltaXPt,e.deltaYPt,e.transform),n=Vn(e.startWidthEmu),r=Vn(e.startHeightEmu),o=n/r,a=Wv(e.handle,e.transform),s=a.includes("e")?t.x:a.includes("w")?-t.x:0,l=a.includes("s")?t.y:a.includes("n")?-t.y:0;if(n=Math.max(1,n+s),r=Math.max(1,r+l),e.preserveAspect)if(a.length===2){let _=Math.max(n/Vn(e.startWidthEmu),r/Vn(e.startHeightEmu));n=Math.max(1,Vn(e.startWidthEmu)*_),r=Math.max(1,n/o);}else a==="e"||a==="w"?r=Math.max(1,n/o):n=Math.max(1,r*o);let d=Vn(e.startWidthEmu),u=Vn(e.startHeightEmu),m=n/d,I=r/u,v=Math.max(1,e.startBounds.width*m),w=Math.max(1,e.startBounds.height*I),C=e.startBounds.x,F=e.startBounds.y,T=e.handle;T.includes("w")&&(C=e.startBounds.x+e.startBounds.width-v),T.includes("n")&&(F=e.startBounds.y+e.startBounds.height-w);let K=null;if(e.kind==="anchored"&&e.startPosition&&(T.includes("w")||T.includes("n")))if(e.startPosition.mode==="simple"){let h=T.includes("w")?rt(C-e.startBounds.x):0,_=T.includes("n")?rt(F-e.startBounds.y):0;K=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+h,verticalEmu:(e.startPosition.verticalEmu??0)+_});}else if(e.anchorFrameOrigin)K=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...T.includes("w")?{horizontalEmu:rt(C-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...T.includes("n")?{verticalEmu:rt(F-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let h=T.includes("w")?rt(C-e.startBounds.x):0,_=T.includes("n")?rt(F-e.startBounds.y):0;K=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+h}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+_}:{},...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:C,y:F,width:v,height:w}),position:K})}function $v(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 Xv(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&&ks(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?sm({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:im(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})}
|
|
15
|
-
export{Ca as $,Ji as A,U0 as Aa,es as B,W0 as Ba,Ph as C,G0 as Ca,gs as D,Fa as Da,n0 as E,_p as Ea,go as F,nl as Fa,mo as G,Eo as Ga,ms as H,Oo as Ha,r0 as I,Tr as Ia,hs as J,Mv as Ja,Jt as K,Ua as Ka,yo as L,Wa as La,xs as M,Bv as Ma,Ss as N,om as Na,h0 as O,qv as Oa,y0 as P,zv as Pa,vo as Q,Kv as Qa,v0 as R,Vv as Ra,rt as S,jv as Sa,mr as T,Uv as Ta,I0 as U,im as Ua,ks as V,sm as Va,x0 as W,$v as Wa,Pa as X,Xv as Xa,yr as Y,Vu as Z,Es as _,dr as a,P0 as aa,ha as b,ju as ba,cr as c,Uu as ca,Um as d,C0 as da,Zi as e,qn as ea,ya as f,Os as fa,ba as g,F0 as ga,zi as h,A0 as ha,Qt as i,L0 as ia,fh as j,Ra as ja,ph as k,$u as ka,gh as l,Ea as la,ru as m,Xu as ma,mh as n,Yu as na,hh as o,H0 as oa,yh as p,_0 as pa,bh as q,B0 as qa,vh as r,q0 as ra,Ih as s,Z0 as sa,xh as t,z0 as ta,ou as u,K0 as ua,Sh as v,As as va,Yi as w,V0 as wa,cu as x,Ju as xa,uu as y,j0 as ya,ka as z,ef as za};
|