@docx-editor.dev/core 2.5.0 → 2.6.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/THIRD_PARTY_NOTICES.md +39 -1
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +6 -6
- package/dist/automation.d.ts +6 -6
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +12 -12
- package/dist/binding.d.ts +12 -12
- package/dist/binding.js +1 -1
- package/dist/chunk-4GQXAXTZ.js +5 -0
- package/dist/chunk-DGUHCJPF.cjs +18 -0
- package/dist/{chunk-2GSRLGUI.cjs → chunk-DY3QVCWC.cjs} +6 -6
- package/dist/{chunk-45FL7KH4.js → chunk-E7BXJ4BF.js} +1 -1
- package/dist/chunk-F7Z6PWAZ.cjs +2 -0
- package/dist/chunk-JEMP5YI5.cjs +15 -0
- package/dist/{chunk-3FRSOOND.cjs → chunk-JZXK4DKV.cjs} +1 -1
- package/dist/chunk-NIGGABAA.js +15 -0
- package/dist/chunk-OPKOTVQQ.js +18 -0
- package/dist/{chunk-GOEBQ26R.js → chunk-PSZH2VXP.js} +1 -1
- package/dist/{chunk-LJIX4ZDF.js → chunk-R75OLPL6.js} +6 -6
- package/dist/{chunk-JDHTCMFA.cjs → chunk-SFMAIFEN.cjs} +1 -1
- package/dist/chunk-SKWYEZCO.cjs +5 -0
- package/dist/{chunk-YTZIGUXT.js → chunk-SMRD66T5.js} +1 -1
- package/dist/chunk-WAVN7MAT.js +2 -0
- package/dist/chunk-WU7PUTVA.js +2 -0
- package/dist/{chunk-OHJQ7GPZ.cjs → chunk-YMYCPY5Y.cjs} +1 -1
- package/dist/{content-control-walk-BeAFh6Xi.d.cts → content-control-walk-CbTqHq6O.d.cts} +1 -1
- package/dist/{content-control-walk-CQp8l6eS.d.ts → content-control-walk-D06GijR0.d.ts} +1 -1
- package/dist/contracts/editor.cjs +1 -1
- package/dist/contracts/editor.d.cts +10 -10
- package/dist/contracts/editor.d.ts +10 -10
- package/dist/contracts/editor.js +1 -1
- package/dist/contracts/interaction.d.cts +9 -9
- package/dist/contracts/interaction.d.ts +9 -9
- package/dist/contracts/modules.d.cts +5 -5
- package/dist/contracts/modules.d.ts +5 -5
- package/dist/contracts/types.d.cts +3 -1
- package/dist/contracts/types.d.ts +3 -1
- package/dist/{custom-node-writes-CIC_-wad.d.cts → custom-node-writes-D9G3GKQ7.d.cts} +7 -7
- package/dist/{custom-node-writes-2clI36T9.d.ts → custom-node-writes-tJw8U9MO.d.ts} +7 -7
- package/dist/dist-YFULGVS3.js +2 -0
- package/dist/{editor-CUul9IuY.d.cts → editor-BZEJL3vv.d.cts} +33 -19
- package/dist/{editor-DIwctMcU.d.ts → editor-D2zOJztO.d.ts} +33 -19
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +375 -38
- package/dist/editor.d.cts +42 -26
- package/dist/editor.d.ts +42 -26
- package/dist/editor.js +1 -1
- package/dist/harfbuzz.wasm +0 -0
- package/dist/{hf-references-CAp1xTv6.d.ts → hf-references-BdjsQNE_.d.ts} +2 -2
- package/dist/{hf-references-BPET4tlK.d.cts → hf-references-CgEOSw3i.d.cts} +2 -2
- package/dist/{image-resources-CSlQmPIm.d.cts → image-resources-BaHz4QAd.d.cts} +10 -10
- package/dist/{image-resources-e13t-pgy.d.ts → image-resources-Cl5_cNi9.d.ts} +10 -10
- package/dist/{index-BUsYjxF5.d.ts → index-D8L8WrNF.d.ts} +111 -21
- package/dist/{index-8t44iXTY.d.cts → index-_xF7n_z0.d.cts} +111 -21
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +71 -23
- package/dist/layout.d.ts +71 -23
- package/dist/layout.js +1 -1
- package/dist/node-module-shim-TTKTT66I.js +1 -0
- package/dist/{note-nodes-CZQXU6Fg.d.ts → note-nodes-BPSTVDMr.d.ts} +1 -1
- package/dist/{note-nodes-B2wWES2L.d.cts → note-nodes-C6DLxlvj.d.cts} +1 -1
- package/dist/{ooxml-package-Cmbe_M04.d.cts → ooxml-package-CR5us6ad.d.cts} +115 -115
- package/dist/{ooxml-package-BrxTmTsZ.d.ts → ooxml-package-D_CtywTW.d.ts} +115 -115
- package/dist/{ooxml-tree-CG0odFyi.d.cts → ooxml-tree-BU0e3DVi.d.cts} +1 -1
- package/dist/{ooxml-tree-CG0odFyi.d.ts → ooxml-tree-BU0e3DVi.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +22 -8
- package/dist/output.d.ts +22 -8
- package/dist/output.js +1 -1
- package/dist/{protocol-B5oSt08P.d.cts → protocol-CD7slqvl.d.cts} +2 -2
- package/dist/{protocol-ooK7PAXz.d.ts → protocol-DsbfgBwA.d.ts} +2 -2
- package/dist/{note-properties-Dhqkro--.d.cts → review-reads-Dr0CpW6u.d.cts} +67 -67
- package/dist/{note-properties-BS66XmcC.d.ts → review-reads-HDvoQXK2.d.ts} +67 -67
- package/dist/{review-support-Bl9sN8cv.d.ts → review-support-D4ZBdUXa.d.ts} +2 -2
- package/dist/{review-support-CHuJxHmz.d.cts → review-support-T-riLz4Y.d.cts} +2 -2
- package/dist/{revision-projection-u4nT52xT.d.ts → revision-projection-UKqvPa4-.d.ts} +1 -1
- package/dist/{revision-projection-DRZMzoLD.d.cts → revision-projection-WzlQGBJx.d.cts} +1 -1
- package/dist/{semantic-cell-selection-Dc-_enhm.d.ts → semantic-cell-selection-B5vfPz4Q.d.ts} +4 -4
- package/dist/{semantic-cell-selection-CdNQ-a9-.d.cts → semantic-cell-selection-BTQFpN0S.d.cts} +4 -4
- package/dist/{semantic-interaction-DgaWs-5w.d.cts → semantic-interaction-CDNEU_Tx.d.cts} +1 -1
- package/dist/{semantic-interaction-CCVwyw2A.d.ts → semantic-interaction-lvpzZRpA.d.ts} +1 -1
- package/dist/{semantic-paint-6iIB4fhx.d.cts → semantic-paint-BBPL3u5w.d.ts} +111 -3
- package/dist/{semantic-paint-CKIbFkQ7.d.ts → semantic-paint-IjbL-4CT.d.cts} +111 -3
- package/dist/{semantic-records-B-qbrnp2.d.ts → semantic-records-CdQvpUj1.d.ts} +4 -4
- package/dist/{semantic-records-Dq8SlCY8.d.cts → semantic-records-DEOs3_tE.d.cts} +4 -4
- package/dist/{shaped-measurer-Dx4llNhK.d.cts → shaped-measurer-C2SJAjV0.d.cts} +1 -1
- package/dist/{shaped-measurer-BT4FqYe9.d.ts → shaped-measurer-l4o5ITJ0.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +238 -238
- package/dist/store.d.ts +238 -238
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-DOYNkKqD.d.cts → tree-op-types-CUCwPWjT.d.cts} +219 -219
- package/dist/{tree-op-types-CZw9QhWX.d.ts → tree-op-types-D0fTNBVW.d.ts} +219 -219
- package/dist/{tree-session-CF_EOhTW.d.ts → tree-session-CH1oA75f.d.ts} +61 -45
- package/dist/{tree-session-CtK3KgFU.d.cts → tree-session-b7bggR-S.d.cts} +61 -45
- package/dist/{tree-store-Jg-q7fyf.d.cts → tree-store-BqgeCa1Q.d.cts} +3 -3
- package/dist/{tree-store-9TaX-L0V.d.ts → tree-store-CIKASRHk.d.ts} +3 -3
- package/licenses/HarfBuzz-COPYING.txt +42 -0
- package/package.json +5 -3
- package/dist/chunk-2QIA75K3.js +0 -2
- package/dist/chunk-32NXPFYL.js +0 -5
- package/dist/chunk-3C533HSQ.cjs +0 -18
- package/dist/chunk-7GYF33B5.cjs +0 -2
- package/dist/chunk-H3DZP4LE.cjs +0 -5
- package/dist/chunk-L2GMLEHX.cjs +0 -14
- package/dist/chunk-QUZM6LWQ.js +0 -14
- package/dist/chunk-T252F4US.js +0 -18
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {f,i as i$1,j as j$3,e as e$1,a as a$3,b as b$2,d as d$1,c as c$1,g as g$2}from'./chunk-WAVN7MAT.js';import {j,k as k$1,h,g,m,uc as uc$1,td,ob,md as md$1,Cc as Cc$1,cb,xd as xd$1,od,Ed as Ed$1,Gd as Gd$1,Hd,Ec as Ec$1,Pd as Pd$1,Qd as Qd$1,hc as hc$1,Bd as Bd$1,Id as Id$1,Nd,Ad as Ad$1,W,Wb,Ia,vb,vc as vc$1,Nc as Nc$1,Cb,Mc as Mc$1,fc as fc$1,yd as yd$1,zd as zd$1,R,Xa as Xa$2,Jd as Jd$2,Rd as Rd$1,rb,Sd as Sd$1,Pc as Pc$1,oc as oc$1,lc as lc$1,zc as zc$2,wc as wc$1,xc as xc$1,yc as yc$1,gc as gc$1,jc as jc$1,Lc as Lc$1,wd as wd$1,Dd,vd as vd$1,S,ic as ic$1,qc as qc$1,Od as Od$1,Ld as Ld$1,V as V$1,nc as nc$1,Ob,qd as qd$2,Gc as Gc$1,Md as Md$1,Xb,$b}from'./chunk-OPKOTVQQ.js';import {g as g$1}from'./chunk-E7BXJ4BF.js';import {j as j$2,d as d$2,i as i$2}from'./chunk-4GQXAXTZ.js';import {b as b$1,h as h$1,m as m$1,c as c$2,d as d$3,k as k$2,j as j$4,l as l$1}from'./chunk-UVIUNAQ6.js';import {H,Q,N}from'./chunk-SMRD66T5.js';import {d,a as a$1,b,c,k,e,j as j$1,i,Xa as Xa$1,Ac as Ac$1,Hf as Hf$1,Ic as Ic$1,Fa,Td as Td$1,Ud as Ud$1,fd,cb as cb$1,Ya as Ya$1,Za,$a,V,xf as xf$1,zf as zf$1,uf as uf$1,yf as yf$1,fg as fg$1,eg as eg$1,gg as gg$1,Yd as Yd$1,Gd as Gd$2,Hd as Hd$1,Id as Id$2,Jd as Jd$1,Kd as Kd$1,Ed as Ed$2,Fd as Fd$1,Ua,ed,zc as zc$1,Ad as Ad$2,Ff as Ff$1,sf as sf$1,tf as tf$1,hg as hg$1,Sb,bg as bg$1,Lb,zd as zd$2,qd as qd$1,od as od$1,ug as ug$1,Ga,dg as dg$1,cg as cg$1,ag as ag$1,ig as ig$1,l,s,Rd as Rd$2,kd as kd$1,qf as qf$1,rf as rf$1,le,ma,O}from'./chunk-R75OLPL6.js';import {a}from'./chunk-PSZH2VXP.js';import {a as a$2}from'./chunk-GQQOL4PV.js';import {zipSync,strToU8}from'fflate';import {createT,en,locales,deepMerge}from'@docx-editor.dev/i18n';var Sp=Object.freeze({kern:1,liga:1});function Po(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}var pd=false;function md(e){if(pd)return;pd=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 An(e){if(e instanceof a)return e;if(e instanceof d)return new a(e.code,e.message,{request:Po(e.request),diagnostic:e.diagnostic});if(e instanceof j){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 Co(e,t){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=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)throw new a("overLimit",`Font sources exceed the aggregate byte ceiling of ${c}`);n+=a$2.bytes.byteLength;}let r={epoch:e.epoch,maxFontBytes:e.maxFontBytes,sources:e.sources.map(a=>({request:Po(a.request),id:a.id,bytes:a.bytes,hash:a.hash,faceIndex:a.faceIndex,availability:a.availability})),substitutions:e.substitutions?.map(a=>({from:Po(a.from),to:Po(a.to)})),defaultFont:Object.freeze({family:e.defaultFont.family,sizeHalfPoints:e.defaultFont.sizeHalfPoints}),language:e.language},o=k({epoch:r.epoch,maxFontBytes:r.maxFontBytes,resources:r.sources,substitutions:r.substitutions,validateFont:k$1,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});return await h(),Object.freeze({fonts:o,shaper:m(),defaultFont:Object.freeze({family:r.defaultFont.family,sizeHalfPoints:r.defaultFont.sizeHalfPoints}),environment:Object.freeze({variationAxes:Object.freeze({}),shapingLibrary:g,unicodeDataVersion:"16.0.0",normalization:"none",language:r.language??"en",features:Sp,fixedPointScale:20,roundingMode:"halfAwayFromZero"}),ligatureCaretPolicy:"cluster-edges-only",operation:Object.freeze({resourceEpoch:o.epoch,configEpoch:r.epoch,extensionFingerprint:`fonts:${r.sources.map(a=>`${a.hash}#${a.faceIndex}`).join(",")}`,shapingHash:`hb:${g.version}:kern+liga`,producerVersion:1})})}catch(n){throw An(n)}}function Ln(e){e.shaper.dispose?.();}var kp=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 Xa=64,Ro=Object.freeze({family:"Calibri",sizeHalfPoints:22});function Eo(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=[],i=new Set;for(let l of n)for(let d of l.substitutions??[]){let u=e(d.from);o.has(u)||i.has(u)||(i.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??Ro,...e$1.language!==void 0?{language:e$1.language}:{}})}var gd="http://schemas.openxmlformats.org/wordprocessingml/2006/main",wp="http://schemas.openxmlformats.org/package/2006/content-types",hd="http://schemas.openxmlformats.org/package/2006/relationships",Pp="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",Cp="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Rp=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${wp}"><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>`,Ep=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${hd}"><Relationship Id="rId1" Type="${Pp}" Target="word/document.xml"/></Relationships>`,Fp=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${hd}"><Relationship Id="rId1" Type="${Cp}" Target="styles.xml"/></Relationships>`,Op=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="${gd}"><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></w:styles>`,Mp=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="${gd}"><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 Ya(){return zipSync({"[Content_Types].xml":strToU8(Rp),"_rels/.rels":strToU8(Ep),"word/_rels/document.xml.rels":strToU8(Fp),"word/document.xml":strToU8(Mp),"word/styles.xml":strToU8(Op)})}function yd(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 Ap(e){try{return typeof caches>"u"?Promise.resolve(null):caches.open(e).catch(()=>null)}catch{return Promise.resolve(null)}}async function Lp(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 Hp(e,t,n){if(e)try{await e.put(t,new Response(n.slice(),{headers:{"Content-Length":String(n.byteLength)}}));}catch{}}async function Dp(e,t){if(e)try{await e.delete(t);}catch{}}async function Np(e){let t=e.fetcher??fetch,n=e.maxFontBytes??a$1,r=await Ap(e.cacheName??"docx-editor-fonts");async function o(d){let u=Object.freeze({family:d.family,weight:d.weight,style:d.style}),h=yd(u);if(h)return {failure:{url:d.url,request:u,reason:"invalidRequest",diagnostic:h}};let P=(k,g)=>{if(k.byteLength===0)return {url:d.url,request:u,reason:"emptyResponse"};if(k.byteLength>n)return {url:d.url,request:u,reason:"overLimit"};let D=j$1(k,d.faceIndex??0);if(!D.valid)return {url:d.url,request:u,reason:"malformed",diagnostic:D.diagnostic};let N=i(k);return d.hash!==void 0&&d.hash!==N?{url:d.url,request:u,reason:"hashMismatch",expectedHash:d.hash,actualHash:N,...g?{diagnostic:"cached bytes failed revalidation"}:{}}:{request:u,id:`url:${d.url}`,bytes:k,hash:N,faceIndex:d.faceIndex??0}},S=await Lp(r,d.url);if(S){let k=P(S,true);if(!("reason"in k))return {source:k};await Dp(r,d.url);}let I;try{I=await t(d.url);}catch(k){return {failure:{url:d.url,request:u,reason:"networkError",diagnostic:k instanceof Error?k.message:String(k)}}}if(!I.ok)return {failure:{url:d.url,request:u,reason:"httpError",status:I.status}};let L;try{L=new Uint8Array(await I.arrayBuffer());}catch(k){return {failure:{url:d.url,request:u,reason:"networkError",diagnostic:k instanceof Error?k.message:String(k)}}}let O=P(L,false);return "reason"in O?{failure:O}:(await Hp(r,d.url,L),{source:O})}let a=await Promise.all(e.sources.map(d=>o(d))),i$1=[],l=[];for(let d of a)"source"in d?i$1.push(d.source):l.push(d.failure);return {sources:i$1,failures:l}}function _p(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=yd(r);if(a)return {failure:{url:o,request:r,reason:"invalidRequest",diagnostic:a}};if(e.byteLength===0)return {failure:{url:o,request:r,reason:"emptyResponse"}};if(e.byteLength>(n.maxFontBytes??a$1))return {failure:{url:o,request:r,reason:"overLimit"}};let i$1=t.faceIndex??0,l=j$1(e,i$1);return l.valid?{source:{request:r,id:o,bytes:e,hash:i(e),faceIndex:i$1}}:{failure:{url:o,request:r,reason:"malformed",diagnostic:l.diagnostic}}}var Zp=96,vd=37.79527559055118;function Bp(e,t){if(!Number.isFinite(e)||e<=0)return [];let n=[];if(t==="inch"){let i=Math.floor(e/12);for(let l=0;l<=i;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=vd/10,o=Math.floor(e/r);for(let a=0;a<=o;a+=1){let i=a*r;if(a%10===0){let l=a/10;n.push({position:i,height:10,...l>0?{label:String(l)}:{}});}else a%5===0?n.push({position:i,height:6}):n.push({position:i,height:3});}return n}function qp(e){let t=[...e].sort((n,r)=>n.index-r.index)[0];return t?t.box:null}var zp=1440,Kp=567,Vp=180,jp=56.7,Fo=(e,t,n)=>n<t||e<t?t:e>n?n:e;function Up(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 bd(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 Wp(e,t,n,r,o={}){let a=bd(t,o.unit??"inch",o.precise??false),i=r.pageWidth-r.rightMargin-n.right,l=r.leftMargin+n.left+Math.max(0,n.firstLine);switch(e){case "firstLine":{let d=Fo(a,0,i);return {...n,firstLine:d-r.leftMargin-n.left}}case "left":{let d=-r.leftMargin-Math.min(0,n.firstLine),u=i-r.leftMargin-Math.max(0,n.firstLine);return {...n,left:Fo(a-r.leftMargin,d,u)}}case "hanging":{let d=Fo(a-r.leftMargin,-r.leftMargin,i-r.leftMargin);return {...n,left:d,firstLine:n.firstLine+(n.left-d)}}case "right":{let d=Fo(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 Hn(e){if(typeof e!="object"||e===null)return false;let t=e;return Nt(t.from)&&Nt(t.to)}function xd(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 Or(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=t.nodeByParaId.get(n.paraId.toUpperCase());if(r===void 0)return {ok:false,code:"notFound",reason:`no paragraph with paraId '${n.paraId}'`};let o=Ff$1(e,r)??"";if(n.search===void 0)return {ok:true,span:{nodeId:r,start:0,end:o.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 i=xd(o,n.search,n.occurrence),l=i[n.occurrence-1];return l===void 0?{ok:false,code:"notFound",reason:`'${n.search}' matches ${i.length} time(s) in paragraph '${n.paraId}'; occurrence ${n.occurrence} does not exist`}:{ok:true,span:{nodeId:r,start:l,end:l+n.search.length}}}let a=xd(o,n.search,2);return a.length===0?{ok:false,code:"notFound",reason:`'${n.search}' does not occur in paragraph '${n.paraId}'`}:a.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:r,start:a[0],end:a[0]+n.search.length}}}function Id(e,t,n){if("anchor"in n){let l=Or(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=Or(e,t,r);if(!a.ok)return {ok:false,code:a.code,reason:a.reason,target:r};let i=Or(e,t,o);return i.ok?{ok:true,selection:{anchor:{paragraphId:a.span.nodeId,offset:a.span.start},head:{paragraphId:i.span.nodeId,offset:i.span.end}}}:{ok:false,code:i.code,reason:i.reason,target:o}}var Mr=/^[0-9A-Fa-f]{6}$/,Sd={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"},Gp={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 Qa(e){return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=1}function Oo(e){return Math.max(0,Math.min(1,e))}function kd(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 Td(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 wd(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "FFFFFF";let r=Math.max(0,Math.min(255,Math.round((1-Oo(t))*255)))/255,o=kd(e);return Td(r*255+(1-r)*o.r,r*255+(1-r)*o.g,r*255+(1-r)*o.b)}function Pd(e,t){if(t>=1)return e.toUpperCase();if(t<=0)return "000000";let r=Math.max(0,Math.min(255,Math.round(Oo(t)*255)))/255,o=kd(e);return Td(r*o.r,r*o.g,r*o.b)}function Ja(e){return Sd[e]??Sd[e.toLowerCase()]??null}function $p(e,t){let n=Ja(e);if(!n)return null;let r=t.find(a=>a.slot===n)?.hex;if(r&&Mr.test(r))return r.toUpperCase();let o=Gp[n];return o&&Mr.test(o)?o.toUpperCase():null}function Mo(e,t){let n=$p(e.slot,t);if(!n)return {ok:false,reason:"the theme colour could not be resolved for this document"};if(e.tint!==void 0&&!Qa(e.tint))return {ok:false,reason:"theme tint is out of range"};if(e.shade!==void 0&&!Qa(e.shade))return {ok:false,reason:"theme shade is out of range"};let r=n;return e.tint!==void 0?r=wd(r,Oo(e.tint)):e.shade!==void 0&&(r=Pd(r,Oo(e.shade))),{ok:true,hex:r}}var Xp="000000";function ei(e,t){if(e.kind==="hex"){let o=e.value.toUpperCase();return Mr.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:Xp}};let n=Mo(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Ja(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function ti(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 Mr.test(o)?{ok:true,color:{kind:"hex",value:o}}:{ok:false,reason:"fill colour requires a six-digit hex value"}}let n=Mo(e,t);return n.ok?{ok:true,color:{kind:"theme",slot:Ja(e.slot)??e.slot,resolvedHex:n.hex,...e.tint!==void 0?{tint:e.tint}:{},...e.shade!==void 0?{shade:e.shade}:{}}}:n}function Yp(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex"){let o=e.value.replace(/^#/,"").toUpperCase();return Mr.test(o)?`#${o}`:`#${n}`}let r=Mo(e,t);return `#${r.ok?r.hex:n}`}var tm=new Set(["insertRow","deleteRow","insertColumn","deleteColumn","deleteTable","setCellFill","setTableCellVerticalAlignment","setTableBorders","commitTableColumnDividerResize","commitTableRightEdgeResize","mergeCells","splitCell","toggleHeaderRow","selectTableRegion","setTableProperties"]);function Dn(e){return tm.has(e.type)}function oe(e,t){return {ok:false,code:e,reason:t}}function ni(e,t){switch(e){case "unknown-table":case "unknown-row":case "unknown-grid-column":return oe("invalidArgs","the table target is no longer valid");case "table-has-merge":return oe("unsupported","this table has merged cells");case "vertical-merge-crossing":return oe("unsupported","the row cannot be inserted across a vertical merge");case "block-required":return oe("unsupported","the table must keep at least one row or column");case "resource-limit":return oe("unsupported","the table has reached the supported size limit");case "invalidArgs":case "invalid-property-value":case "unsupported-property":return oe("invalidArgs","the table command arguments are invalid");default:return oe("unsupported",`the table operation was refused (${e})`)}}function Ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rt(e,t){return !Ke(e)||Object.keys(e).length!==t.length?false:t.every(r=>Object.prototype.hasOwnProperty.call(e,r))}function Fd(e){if(!Ke(e))return false;let t=e.kind;if(t==="hex")return rt(e,["kind","value"])&&typeof e.value=="string";if(t==="auto")return rt(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 rt(e,n)}return false}function Od(e){return Ke(e)&&rt(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 Md(e){return Ke(e)&&rt(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 nm(e){return Ke(e)&&rt(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 rm(e){return Ke(e)&&rt(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 om(e){return !Ke(e)||!rt(e,["style","size","color"])?false:typeof e.style=="string"&&typeof e.size=="number"&&Number.isInteger(e.size)&&Fd(e.color)}function Cd(e){return !("target"in e)||e.target===void 0||Od(e.target)}function Rd(e){return !("target"in e)||e.target===void 0||Md(e.target)}function am(e){switch(e.type){case "insertRow":return !Ke(e)||e.type!=="insertRow"?oe("invalidArgs","insertRow command shape is invalid"):e.where!=="above"&&e.where!=="below"?oe("invalidArgs","insertRow where must be above or below"):Cd(e)?null:oe("invalidArgs","insertRow target shape is invalid");case "deleteRow":return !Ke(e)||e.type!=="deleteRow"?oe("invalidArgs","deleteRow command shape is invalid"):Cd(e)?null:oe("invalidArgs","deleteRow target shape is invalid");case "insertColumn":return !Ke(e)||e.type!=="insertColumn"?oe("invalidArgs","insertColumn command shape is invalid"):e.where!=="left"&&e.where!=="right"?oe("invalidArgs","insertColumn where must be left or right"):Rd(e)?null:oe("invalidArgs","insertColumn target shape is invalid");case "deleteColumn":return !Ke(e)||e.type!=="deleteColumn"?oe("invalidArgs","deleteColumn command shape is invalid"):Rd(e)?null:oe("invalidArgs","deleteColumn target shape is invalid");case "deleteTable":return !Ke(e)||!rt(e,["type"])?oe("invalidArgs","deleteTable command shape is invalid"):null;case "setCellFill":return !Ke(e)||!rt(e,["type","color"])?oe("invalidArgs","setCellFill command shape is invalid"):e.color!==null&&!Fd(e.color)?oe("invalidArgs","setCellFill color shape is invalid"):null;case "setTableCellVerticalAlignment":return !Ke(e)||!rt(e,["type","alignment"])||!["top","center","bottom"].includes(e.alignment)?oe("invalidArgs","cell vertical alignment command shape is invalid"):null;case "setTableBorders":return !Ke(e)||e.type!=="setTableBorders"?oe("invalidArgs","setTableBorders command shape is invalid"):e.scope==="none"?typeof e.target!="string"?oe("invalidArgs","border none scope requires a target edge"):null:!("spec"in e)||!om(e.spec)?oe("invalidArgs","concrete border scopes require a complete spec"):null;case "commitTableColumnDividerResize":return !Ke(e)||!rt(e,["type","target","leftWidthTwips","rightWidthTwips"])||!nm(e.target)||typeof e.leftWidthTwips!="number"||typeof e.rightWidthTwips!="number"?oe("invalidArgs","column divider resize command shape is invalid"):null;case "commitTableRightEdgeResize":return !Ke(e)||!rt(e,["type","target","columnWidthTwips","tableWidthTwips"])||!rm(e.target)||typeof e.columnWidthTwips!="number"||typeof e.tableWidthTwips!="number"?oe("invalidArgs","right-edge resize command shape is invalid"):null;default:return null}}function im(e){return !("target"in e)||e.target===void 0?null:Od(e.target)?e.target:null}function sm(e){return !("target"in e)||e.target===void 0?null:Md(e.target)?e.target:null}function Ed(e,t,n){let r=sf$1(e.root,t);return !r.ok||!r.topology.grid?null:r.topology.gridColumns[n]?.id??null}function lm(e){let t=Sd$1(e.layout,e.selection.head.paragraphId,e.cellSelection);return t?{tableId:t.tableId,rowId:t.rowId,cellId:t.cellId,cellIds:[...t.cellIds],gridColumnIndex:t.gridColumnIndex,isHeaderRepeat:t.isHeaderRepeat}:null}function dm(e){let t=qf$1(e,"tcPr"),n=t&&qf$1(t,"gridSpan"),r=n&&rf$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 cm(e,t,n){let r=e.gridColumns.findIndex(o=>o.id===n);if(r===-1)return null;for(let{row:o,cells:a}of e.rows){let i=0;for(let l of a){let d=dm(l);if(r>=i&&r<i+d)return {tableId:t,rowId:o.id,cellId:l.id,cellIds:[l.id],gridColumnIndex:r,isHeaderRepeat:false};i+=d;}}return null}function um(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=sf$1(e.part.root,t.tableId);if(!n.ok)return null;let r=n.topology.rows.findIndex(i=>i.row.id===t.rowId);if(r===-1)return null;let a=n.topology.rows[r].cells[0];return a?{tableId:t.tableId,rowId:t.rowId,cellId:a.id,cellIds:[a.id],gridColumnIndex:0,isHeaderRepeat:false}:null}function fm(e,t){if(t.sourceRevision!==e.storeRevision||t.isHeaderRepeat)return null;let n=sf$1(e.part.root,t.tableId);return n.ok?cm(n.topology,t.tableId,t.gridColumnId):null}function pm(e,t){for(let n of t){let r=Hf$1(e,n);if(r)return ni(r)}return null}function mt(e,t,n){let r=pm(e,t);return r||{ok:true,ops:t,selection:n}}function mm(e,t){if(!tf$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=ei(e.color,t);return n.ok?{ok:true,spec:{style:e.style,size:e.size,color:n.color}}:{ok:false,reason:n.reason}}function Ar(e,t,n){return n!==e.storeRevision?oe("invalidArgs","the table target is stale"):sf$1(e.part.root,t).ok?null:oe("invalidArgs","the table target is no longer valid")}function gm(e){return e?.isHeaderRepeat?oe("unsupported","repeated header rows cannot be edited"):null}function hm(e,t,n,r){let o=Ar(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return oe("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return oe("invalidArgs","column widths must be whole twips");if(n<300||r<300)return oe("invalidArgs","column widths are below the minimum");let a=sf$1(e.part.root,t.tableId);if(!a.ok){let P=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return ni(P)}if(a.topology.hasMerge)return oe("unsupported","this table has merged cells");let i=a.topology.gridColumns.find(P=>P.id===t.leftGridColumnId),l=a.topology.gridColumns.find(P=>P.id===t.rightGridColumnId);if(!i||!l)return oe("invalidArgs","the table target is no longer valid");let d=a.topology.gridColumns.indexOf(i);if(a.topology.gridColumns.indexOf(l)!==d+1)return oe("invalidArgs","the column divider target is not adjacent");let h={op:"setTableColumnWidths",tableId:t.tableId,leftGridColumnId:t.leftGridColumnId,rightGridColumnId:t.rightGridColumnId,leftWidthTwips:n,rightWidthTwips:r};return mt(e.part,[h],{kind:"preserveSelection"})}function ym(e,t,n,r){let o=Ar(e,t.tableId,t.sourceRevision);if(o)return o;if(t.isHeaderRepeat)return oe("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||!Number.isInteger(r))return oe("invalidArgs","column widths must be whole twips");if(n<300)return oe("invalidArgs","column widths are below the minimum");let a=sf$1(e.part.root,t.tableId);if(!a.ok){let d=a.reason==="duplicate-node-id"?"unknown-table":a.reason;return ni(d)}if(a.topology.hasMerge)return oe("unsupported","this table has merged cells");let i=a.topology.gridColumns[a.topology.gridColumns.length-1];if(!i||i.id!==t.gridColumnId)return oe("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 mt(e.part,[l],{kind:"preserveSelection"})}function Ad(e,t,n){if(e.viewing||!e.editable)return oe("locked","the document is open for viewing");let r=Ar(e,t.tableId,t.sourceRevision);if(r)return r;if(t.isHeaderRepeat)return oe("unsupported","repeated header rows cannot be edited");if(!Number.isInteger(n)||n<20||n>31680)return oe("invalidArgs","row height is outside the supported range");let o={op:"setTableRowHeight",tableId:t.tableId,rowId:t.rowId,heightTwips:n};return mt(e.part,[o],{kind:"preserveSelection"})}function Vt(e){let{command:t,part:n,viewing:r,editable:o}=e;if(r||!o)return oe("locked","the document is open for viewing");switch(t.type){case "mergeCells":return oe("unsupported","cell merge is not supported yet");case "splitCell":return oe("unsupported","cell split is not supported yet");case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return oe("unsupported",`command '${t.type}' is not supported by the tree editor`);}let a=am(t);if(a)return a;let i=im(t),l=sm(t),d=gm(i??l);if(d)return d;if(i){let h=Ar(e,i.tableId,i.sourceRevision);if(h)return h}if(l){let h=Ar(e,l.tableId,l.sourceRevision);if(h)return h}let u=i!==null?um(e,i):l!==null?fm(e,l):lm(e);if(t.type!=="commitTableColumnDividerResize"&&t.type!=="commitTableRightEdgeResize"&&!u)return i||l?oe("invalidArgs","the table target is no longer valid"):oe("unsupported","the selection is not inside a table");if(u?.isHeaderRepeat)return oe("unsupported","repeated header rows cannot be edited");switch(t.type){case "insertRow":{if(!u)return oe("unsupported","the selection is not inside a table");let h={op:"insertTableRow",tableId:u.tableId,rowId:u.rowId,where:t.where};return mt(n,[h],{kind:"adoptCommittedCaret"})}case "deleteRow":{if(!u)return oe("unsupported","the selection is not inside a table");let h={op:"deleteTableRow",tableId:u.tableId,rowId:u.rowId,referenceCellId:u.cellId};return mt(n,[h],{kind:"adoptCommittedCaret"})}case "insertColumn":{if(!u)return oe("unsupported","the selection is not inside a table");let h=l?.tableId??u.tableId,P=l?.gridColumnId??Ed(n,h,u.gridColumnIndex),S=P?{op:"insertTableColumn",tableId:h,where:t.where,gridColumnId:P}:{op:"insertTableColumn",tableId:h,where:t.where,referenceCellId:u.cellId};return mt(n,[S],{kind:"adoptCommittedCaret"})}case "deleteColumn":{if(!u)return oe("unsupported","the selection is not inside a table");let h=l?.tableId??u.tableId,P=l?.gridColumnId??Ed(n,h,u.gridColumnIndex);return P?mt(n,[{op:"deleteTableColumn",tableId:h,gridColumnId:P}],{kind:"adoptCommittedCaret"}):oe("invalidArgs","the table has no grid column to delete")}case "deleteTable":{if(!u)return oe("unsupported","the selection is not inside a table");let h={op:"deleteBlock",blockId:u.tableId};return mt(n,[h],{kind:"adoptCommittedCaret"})}case "setCellFill":{if(!u)return oe("unsupported","the selection is not inside a table");let h;if(t.color===null)h=null;else {let S=ti(t.color,e.themeColors);if(!S.ok)return oe("invalidArgs",S.reason);h=S.color;}let P={op:"setTableCellFill",tableId:u.tableId,cellIds:u.cellIds,color:h};return mt(n,[P],{kind:"preserveSelection"})}case "setTableCellVerticalAlignment":{if(!u)return oe("unsupported","the selection is not inside a table");let h={op:"setTableCellVerticalAlignment",tableId:u.tableId,cellIds:u.cellIds,alignment:t.alignment};return mt(n,[h],{kind:"preserveSelection"})}case "setTableBorders":{if(!u)return oe("unsupported","the selection is not inside a table");if(t.scope==="none"){let S={op:"setTableCellBorders",tableId:u.tableId,cellIds:u.cellIds,scope:"none",target:t.target};return mt(n,[S],{kind:"preserveSelection"})}let h=mm(t.spec,e.themeColors);if(!h.ok)return oe("invalidArgs",h.reason);let P={op:"setTableCellBorders",tableId:u.tableId,cellIds:u.cellIds,scope:t.scope,spec:h.spec};return mt(n,[P],{kind:"preserveSelection"})}case "commitTableColumnDividerResize":return hm(e,t.target,t.leftWidthTwips,t.rightWidthTwips);case "commitTableRightEdgeResize":return ym(e,t.target,t.columnWidthTwips,t.tableWidthTwips);default:return oe("unsupported",`command '${t.type}' is not a table command`)}}function Ld(e){if(!Dn(e))return {supported:false,reason:`command '${e.type}' is not a table command`};switch(e.type){case "mergeCells":return {supported:false,reason:"cell merge is not supported yet"};case "splitCell":return {supported:false,reason:"cell split is not supported yet"};case "toggleHeaderRow":case "selectTableRegion":case "setTableProperties":return {supported:false,reason:`command '${e.type}' is not supported by the tree editor`};default:return {supported:true}}}function Ao(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;if(Array.isArray(e)){for(let n of e)Ao(n);return Object.freeze(e)}let t=e;for(let n of Object.keys(t))Ao(t[n]);return Object.freeze(e)}var ri=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"}}]]),vm=new Set(["none","black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","yellow","white"]),bm=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u,xm=/^[0-9A-Fa-f]{6}$/;function oi(e){let{mark:t,value:n}=e;switch(t){case "fontFamily":return typeof n!="string"||!bm.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"&&!xm.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"||!vm.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 _d(e){return typeof e=="object"&&e!==null&&typeof e.paragraphId=="string"&&typeof e.offset=="number"}function ai(e){return typeof e=="object"&&e!==null&&_d(e.anchor)&&_d(e.head)}function Nn(e,t){let n=new Error(t);return n.code=e,n}function ii(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 si(e){return e==="blank"?Ya():e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function li(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 Lr(e){switch(e.type){case "toggleMark":return ri.has(e.mark)?{supported:true,mutating:true}:{supported:false,reason:`mark '${e.mark}' is not supported`};case "setMarkAttr":{let t=oi(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 "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)>rb)return {supported:false,reason:`indent values must be within \xB1${rb} 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 "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=Ld(e);return t.supported?{supported:true,mutating:true}:{supported:false,reason:t.reason??"unsupported table command"}}case "setSelection":return "range"in e&&(ai(e.range)||Hn(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 Bd(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)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 qd(e,t){return e.current===t.current&&e.total===t.total}function zd(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 Zd(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 Kd(e,t){return e===t?true:!e||!t||!Hn(e)||!Hn(t)?false:Zd(e.from,t.from)&&Zd(e.to,t.to)}function Vd(){let e=null;return t=>(t===null?e=null:e?.id!==t&&(e=Object.freeze({id:t})),e)}function jd(e,t){return e.scope===t.scope&&e.isLoading===t.isLoading&&e.isOpening===t.isOpening&&e.parseError===t.parseError&&e.editable===t.editable&&e.zoom===t.zoom&&e.selection===t.selection&&e.selectionCollapsed===t.selectionCollapsed&&e.formatting===t.formatting&&e.table===t.table&&e.tocContext===t.tocContext&&e.image===t.image&&e.fontSubstitutions===t.fontSubstitutions&&e.page===t.page&&e.canUndo===t.canUndo&&e.canRedo===t.canRedo&&e.pageSetup===t.pageSetup&&e.zoomMode===t.zoomMode&&e.reviewPaneOpen===t.reviewPaneOpen&&e.editingMode===t.editingMode&&e.lastRejection===t.lastRejection}function Im(e){return [e.left,e.top,e.right,e.bottom]}function di(e){return Object.freeze({left:e.left*100,top:e.top*100,right:e.right*100,bottom:e.bottom*100})}function Sm(e){return Object.freeze({left:e.left/100,top:e.top/100,right:e.right/100,bottom:e.bottom/100})}function Hr(e){return Math.round(e*1e3)}function Dr(e){return e/1e3}function ci(e){return Object.freeze({left:Hr(e.left),top:Hr(e.top),right:Hr(e.right),bottom:Hr(e.bottom)})}function km(e){return Object.freeze({left:Dr(e.left),top:Dr(e.top),right:Dr(e.right),bottom:Dr(e.bottom)})}function ui(e){return Im(e).some(n=>!Number.isFinite(n)||n<0||n>100)?false:e.left+e.right<100&&e.top+e.bottom<100}var Tm=new Set(["insertImage","replaceImage"]),wm=new Set(["insertImage","replaceImage","deleteImage","setImageWrapType","transformImage","setImagePosition","setImageProperties"]);function Pm(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 Cm(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 i of a.anchoredDrawings??[])if(i.anchorParagraphId===t&&(i.start===n||i.start+1===n))return i}}return null}function Ud(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=W(e.layout(),t.paragraphId,t.offset),o=Pm(r,t.paragraphId,t.offset);return o||Cm(e,t.paragraphId,t.offset)}function Wd(e,t){let n=e.storyScope(),r=e.session.partFor(n)??e.session.part(),o=Fa(r,t.drawingNodeId);return !o||o.kind!=="drawing"?null:cb$1(o,{ownerPartName:t.ownerPartName,supportedMcRequires:Za,limits:Ya$1,resolveRelationship:$a(e.session.currentPackage(),t.ownerPartName)})}function Gd(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 Rm(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 $d(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 Em(e){return e.kind==="inlineDrawing"?"inline":e.wrap}function _t(e){let t=Ud(e);if(!t||t.placeholderGraphicKind!==null)return null;let n=e?Wd(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:di(t.crop),rotationDegrees:r.rotationDegrees,wrap:Em(t),position:Gd(n),name:n.name,title:n.title,description:n.description,hyperlink:n.hyperlinkHref,locks:n.locks,hidden:n.hidden,resourceStatus:t.resource.kind,intrinsic:Rm(t),...$d(n)})}function Xd(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 fi(e){if("drawingNodeId"in e&&typeof e.drawingNodeId=="string")return e.drawingNodeId}function Yd(e){if("expectedPackageRevision"in e&&typeof e.expectedPackageRevision=="number")return e.expectedPackageRevision}function pi(e){return fi(e)!==void 0||Yd(e)!==void 0||e.type==="setImageProperties"&&e.selectionParagraphId!==void 0}function mi(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};let o=Yd(t);if(o!==void 0&&r.session.packageRevision()!==o)return {ok:false,code:"notFound",reason:"stale package revision"};let a=fi(t),i=_t(r);if(a!==void 0&&(!i||i.id!==a))return {ok:false,code:"notFound",reason:"stale drawing selection"};if(t.type==="setImageProperties"&&t.selectionParagraphId!==void 0&&t.selectionOffset!==void 0){let{anchor: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 Zn(e,n,{requireDrawing:a!==void 0||n.drawingNodeId!==null,drawingNodeId:a??n.drawingNodeId??void 0})}function rn(e,t){let n=_t(e),r=fi(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 Fm(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 Lo(e,t){return Fm(e.applyDrawingOps(t))}function Om(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 Mm(e){return e.borderWidthEmu!==void 0||e.borderColor!==void 0}function Am(e){return e.horizontalEmu!==void 0||e.verticalEmu!==void 0||e.relativeToH!==void 0||e.relativeToV!==void 0}function Lm(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||xf$1(e)}function Qd(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 Nr(e){return wm.has(e.type)}function Hm(e){return Tm.has(e.type)}function Jd(e){return {ok:false,code:"unsupported",reason:`${e.type} is asynchronous; use executeImageCommand`}}function ec(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 _r(e){let t=e.surface;if(!t)return null;let{anchor:n}=t.state().selection,r=_t(t);return Object.freeze({mountGeneration:e.mountGeneration,packageRevision:t.session.packageRevision(),drawingNodeId:r?.id??null,selectionParagraphId:n.paragraphId,selectionOffset:n.offset})}function Zn(e,t,n){let r=e.surface;if(!r)return {ok:false,code:"notFound",reason:"no document is loaded"};if(e.mountGeneration!==t.mountGeneration)return {ok:false,code:"notFound",reason:"the editor is no longer attached"};let{anchor:o,head:a}=r.state().selection;if(o.paragraphId!==t.selectionParagraphId||o.offset!==t.selectionOffset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(o.paragraphId!==a.paragraphId||o.offset!==a.offset)return {ok:false,code:"notFound",reason:"stale drawing selection"};if(n?.requireDrawing){let i=_t(r),l=n.drawingNodeId??t.drawingNodeId;if(!i||!l||i.id!==l)return {ok:false,code:"notFound",reason:"stale drawing selection"}}return null}function Zr(e,t){if(!Nr(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=rn(t,e);return "ok"in o?o:null}let n=rn(t,e);if("ok"in n)return n;let r=_t(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(!Am(e))return {ok:false,code:"invalidArgs",reason:"setImagePosition requires at least one field"};let o=r.position?.mode??"frame";return zf$1(e,o)?uf$1(Qd(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(Mm(e))return {ok:false,code:"unsupported",reason:"image border properties are not supported yet"};if(!Lm(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&&!ui(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&&!V(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(xf$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(!zf$1(e,a))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"};if(!uf$1(yf$1(e,r)))return {ok:false,code:"invalidArgs",reason:"setImageProperties carries invalid position values"}}return null}default:return null}}function gi(e,t){let n=ec(t);if(n)return n;let r=Zr(e,t);return r||{ok:true}}function tc(e,t){let n=Zr(e,t);return n||Jd(e)}function nc(e,t,n){if(Hm(t))return Jd(t);let r=n&&pi(t)?_r(n):null;if(r&&n){let o=mi(n,t,r);if(o)return o}switch(t.type){case "deleteImage":{let o=rn(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=rn(e,t);return "ok"in o?o:Lo(e,[{op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.target}])}case "transformImage":{let o=rn(e,t);return "ok"in o?o:Lo(e,[{op:"transformDrawing",drawingNodeId:o.id,action:t.action}])}case "setImagePosition":{let o=rn(e,t);if("ok"in o)return o;let a=_t(e),i=Qd(t,a);return Lo(e,[{op:"positionDrawing",drawingNodeId:o.id,position:i}])}case "setImageProperties":{let o=rn(e,t);if("ok"in o)return o;let a=_t(e);if(!a)return {ok:false,code:"notFound",reason:"no drawing is selected"};let i=[];if(t.resetToNaturalSize){let u=Om(a);if(!u)return {ok:false,code:"invalidArgs",reason:"natural size is unavailable for this image"};i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:u});}else (t.widthEmu!==void 0||t.heightEmu!==void 0)&&i.push({op:"resizeDrawing",drawingNodeId:o.id,extentEmu:{cx:t.widthEmu??a.widthEmu,cy:t.heightEmu??a.heightEmu}});t.crop!==void 0&&i.push({op:"cropDrawing",drawingNodeId:o.id,crop:ci(t.crop)});let l=t.title??t.alt,d=t.description??t.alt;if((l!==void 0||d!==void 0)&&i.push({op:"setDrawingMetadata",drawingNodeId:o.id,title:l??a.title,description:d??a.description}),t.wrap!==void 0&&i.push({op:"setDrawingWrap",drawingNodeId:o.id,wrap:t.wrap}),xf$1(t)){let u=yf$1(t,a);i.push({op:"positionDrawing",drawingNodeId:o.id,position:u});}if(t.hyperlink!==void 0){let u=e.applyImageProperties({drawingNodeId:o.id,ops:i,hyperlink:t.hyperlink});return u.ok?null:{ok:false,code:"invalidArgs",reason:u.detail??u.reason??"setImageProperties was refused"}}return i.length===0?{ok:false,code:"invalidArgs",reason:"setImageProperties requires at least one field"}:Lo(e,i)}default:return null}}async function hi(e,t){let n=e.surface;if(!n)return {ok:false,code:"notFound",reason:"no document is loaded"};let r=ec(n);if(r)return r;let o=Zr(t,n);if(o)return o;let a=_r(e);if(!a)return {ok:false,code:"notFound",reason:"no document is loaded"};if(t.type==="insertImage"){let{anchor:P}=n.state().selection,S=t.expectedPackageRevision??a.packageRevision;if(t.expectedPackageRevision!==void 0&&n.session.packageRevision()!==t.expectedPackageRevision)return {ok:false,code:"notFound",reason:"stale package revision"};let I=await n.insertImage({paragraphId:P.paragraphId,offset:P.offset,bytes:t.data,mime:t.mime,widthPoints:t.widthPoints,heightPoints:t.heightPoints,expectedPackageRevision:S,commitGuard:()=>Zn(e,a)===null,...t.title!==void 0?{title:t.title}:{},...t.description!==void 0?{description:t.description}:{},...t.hyperlink!==void 0?{hyperlink:t.hyperlink}:{}}),L=Zn(e,a);return L||(I.ok?{ok:true,changed:I.change!==null}:{ok:false,code:"invalidArgs",reason:I.detail==="stale-package-epoch"?"stale package revision":I.detail??I.reason??"insertImage was refused"})}let i=rn(n,t);if("ok"in i)return i;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(i.id,t.data,d,{expectedPackageRevision:l,commitGuard:()=>Zn(e,a,{requireDrawing:true,drawingNodeId:i.id})===null}),h=Zn(e,a,{requireDrawing:true,drawingNodeId:i.id});return h||(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 Dm=1,Nm=10,Br=12700;function _m(e,t){if(!t||t.hidden||t.locks.select)return Object.freeze({canResize:false,canMove:false,aspectLocked:true});let n=$d(t);return Object.freeze({canResize:n.canResize,canMove:n.canMove,aspectLocked:t.locks.changeAspect})}function Zm(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=Ud(e);if(!r||r.accessibility.hidden)return null;let o=e.publishedLayout(),a=uc$1(o,r.drawingNodeId);if(!a)return null;let i=Wd(e,r);if(!i||i.locks.select)return null;let l=_m(r,i),u=e.editingMode()==="edit"&&e.session.editable?l:{...l,canResize:false,canMove:false},h=r.kind==="anchoredDrawing"?Object.freeze({x:r.horizontalFrameOrigin,y:r.verticalFrameOrigin}):null;return Object.freeze({id:r.drawingNodeId,pageIndex:a.pageIndex,x:a.x,y:a.y,width:a.width,height:a.height,kind:r.kind==="inlineDrawing"?"inline":"anchored",widthEmu:i.extentEmu.cx,heightEmu:i.extentEmu.cy,position:Gd(i),anchorFrameOrigin:h,transform:r.transform,...u})}function Ue(e){return Math.round(e*Br)}function _n(e){return e/Br}function Bm(e,t,n,r,o,a){let i=_n(e),l=_n(t),d=i/l,u=n.includes("e")?r:n.includes("w")?-r:0,h=n.includes("s")?o:n.includes("n")?-o:0;if(i=Math.max(1,i+u),l=Math.max(1,l+h),a)if(n.length===2){let S=Math.max(i/_n(e),l/_n(t));i=Math.max(1,_n(e)*S),l=Math.max(1,i/d);}else n==="e"||n==="w"?l=Math.max(1,i/d):i=Math.max(1,l*d);return Object.freeze({cx:Ue(i),cy:Ue(l)})}function yi(e,t,n){return e.mode==="simple"?Object.freeze({mode:"simple",horizontalEmu:(e.horizontalEmu??0)+Ue(t),verticalEmu:(e.verticalEmu??0)+Ue(n)}):Object.freeze({mode:"frame",...e.horizontalEmu!==void 0?{horizontalEmu:e.horizontalEmu+Ue(t)}:{},...e.verticalEmu!==void 0?{verticalEmu:e.verticalEmu+Ue(n)}:{},...e.relativeToH!==void 0?{relativeToH:e.relativeToH}:{},...e.relativeToV!==void 0?{relativeToV:e.relativeToV}:{}})}function qm(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"}:Zn(e,t.preconditions,{requireDrawing:true,drawingNodeId:t.drawingNodeId}):{ok:false,code:"notFound",reason:"no document is loaded"}}function rc(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}:{}}}function vi(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 bi(e){if(!e)return null;let{anchor:t,head:n}=e.state().selection,r=e.session.paragraphAnchors(),o=r.paraIdByNode.get(t.paragraphId),a=r.paraIdByNode.get(n.paragraphId);if(o===void 0||a===void 0)return null;let i=r.ordinalByNode.get(t.paragraphId)??0,l=r.ordinalByNode.get(n.paragraphId)??0;return l<i||l===i&&n.offset<t.offset?{from:{paraId:a},to:{paraId:o}}:{from:{paraId:o},to:{paraId:a}}}function oc(e){if(!e)return null;let t=e.hyperlinks.linkAtCaret();if(!t)return null;let n=e.session.paragraphAnchors().paraIdByNode.get(t.paragraphId);return n===void 0?null:{href:t.href??"",range:{from:{paraId:n},to:{paraId:n}},...t.tooltip!==void 0?{tooltip:t.tooltip}:{}}}function ac(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),i=o.kind==="textValue"?void 0:i$2(o);return {...a!==void 0?{paraId:a}:{},text:Ff$1(n,o.id)??"",...i!==void 0?{styleId:i}:{}}})}function xi(e){return e?e.state().pageCount:0}function Ii(e,t="caret"){return e?e.currentPage(t):1}function zm(e,t){if(!Dn(e))return {ok:false,refusal:{ok:false,code:"unsupported",reason:"not a table command"}};let n=Ho(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 Km(e,t){return {command:e,part:t.session.part(),layout:t.layout(),storeRevision:t.session.revision(),selection:t.state().selection,cellSelection:t.state().cellSelection,themeColors:t.session.documentThemeColors(),editable:t.session.editable,viewing:t.editingMode()==="view"}}function Ho(e,t){let n=Vt(Km(e,t));return n.ok?{can:{ok:true},plan:n}:{can:{ok:false,code:n.code,reason:n.reason},plan:n}}function qr(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 i=t?.activeScope?.()??{kind:"body"};if(i.kind!=="headerFooter"||i.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=Lr(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:i,head:l}=t.state().selection;if(i.paragraphId===l.paragraphId&&i.offset===l.offset)return {ok:false,refusal:{ok:false,code:"unsupported",reason:"nothing is selected"}}}if(e.type==="setParagraphStyle"&&!t.session.documentStyles().some(i=>i.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==="linkHeaderFooterToPrevious"){let i=t.headerFooterState?.();if((e.sectionIndex??i?.sectionIndex??0)===0)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:"the first section cannot link to a previous header or footer"}}}if(Dn(e)){let i=zm(e,t);return i.ok?{ok:true,tablePlan:i.tablePlan}:i}let a=Zr(e,t);return a&&!a.ok?{ok:false,refusal:a}:{ok:true}}function ic(e){if(!e)return null;let t=e.state(),n=t.cellSelection,r=Rd$1(e.layout(),t.selection.head.paragraphId);return r?{blockId:r.tableId,rowCount:r.rows,columnCount:r.columns,cell:{row:n?n.rows.from:r.rowIndex,column:n?n.columns.from:r.columnIndex}}:null}function Si(e){if(!e)return null;let t=e.state(),n=t.cellSelection,r=Rd$1(e.layout(),t.selection.head.paragraphId);return r?{rows:r.rows,columns:r.columns,rowIndex:n?n.rows.from:r.rowIndex,columnIndex:n?n.columns.from:r.columnIndex}:null}function sc(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 se={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 Bn={activeTarget:"all",spec:{style:"single",size:8,color:{kind:"hex",value:"000000"}}},dc=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"];function ki(e){return createT(en)(e)}function Do(e){return dc.includes(e)}function Um(e){return e!=null}var cc=[{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"}],uc=[{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"}],Wm=[{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 Gm(e){return e==="all"||e==="outside"||e==="inside"||e==="top"||e==="bottom"||e==="left"||e==="right"}function $m(e){return e==="none"||Gm(e)}function lc(e){if(!e||typeof e!="object")return false;let t=e.kind;return t==="hex"||t==="theme"||t==="auto"}function Xm(e){return uc.some(t=>t.value===e)}function vn(e,t,n){switch(t){case "table.borderTarget":return $m(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(!lc(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(!Xm(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&&!lc(n)?null:{command:{type:"setCellFill",color:n},nextDraft:e};default:return null}}function Ti(e,t=Bn){switch(e){case "table.borderTarget":return {type:"setTableBorders",scope:t.activeTarget,spec:t.spec};case "table.borderColor":return vn(t,e,{kind:"hex",value:"000000"})?.command??null;case "table.borderStyle":return vn(t,e,"single")?.command??null;case "table.borderWidth":return vn(t,e,8)?.command??null;case "table.cellFill":return {type:"setCellFill",color:{kind:"hex",value:"FFFF00"}};default:return null}}function Ym(e){return cc.find(n=>n.value===e)?.labelKey??"table.borders.all"}function Qm(e){return se[e]}function qn(e){return e.surface??null}var Jm={"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 eg(e){return pc[e]??null}var fc=Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e=>e.charCodeAt(0)),pc={"text.link":{type:"insertHyperlink",href:"https://example.com"},"image.insert":{type:"insertImage",data:fc,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"}};function No(e){return Jm[e]??null}var tg={"font.family":{mark:"fontFamily",attr:"family"},"font.size":{mark:"fontSize",attr:"val"},"text.color":{mark:"color",attr:"val"},"text.highlight":{mark:"highlight",attr:"val"}},ng={"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 mc(e,t,n){return vn(n,e,t)?.command??null}function _o(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(Do(e))return mc(e,t,Bn);if(e==="image.wrap")return typeof t!="string"||!Xa$1.includes(t)?null:{type:"setImageWrapType",target:t};if(e==="image.altText")return typeof t!="string"?null:{type:"setImageProperties",description:t};let n=tg[e];return n?{type:"setMarkAttr",mark:n.mark,attr:n.attr,value:t}:null}function gc(e,t,n=Bn){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};let r=Ti(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 hc(e,t){if(!e)return {id:t,enabled:false,disabledReason:"editor is not ready",active:false};if(Do(t))return gc(e,t);if(t==="review.editingMode"){let a=e.getEditingMode?.()??"editing",i=e.can(_o(t,a==="editing"?"suggesting":"editing"));return {id:t,enabled:i.ok,disabledReason:i.ok?null:i.reason,active:false,value:a}}if(t==="contentControl.showAll"||t==="contentControl.formFill"){let a=qn(e),i=a?.state().contentControls,l=t==="contentControl.showAll"?i?.showAll??false:i?.formFill??false;return {id:t,enabled:a!==null,disabledReason:a?null:"editor is not ready",active:l}}if(t==="contentControl.inspector"){let a=qn(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=No(t);if(!n){let a=ng[t];if(a!==void 0){let l=_o(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,h=t==="image.wrap"?u?.wrap:t==="image.altText"?u?.description:void 0;return d.ok?{id:t,enabled:true,disabledReason:null,active:false,...h!==void 0?{value:h}:{}}:{id:t,enabled:false,disabledReason:d.reason,active:false,...h!==void 0?{value:h}:{}}}let i=pc[t];if(i){if(t==="image.insert"&&i.type==="insertImage"){let d=e.canExecuteImageCommand?.({type:"insertImage",data:fc,mime:"image/png",widthPoints:72,heightPoints:72})??e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="image.properties"&&i.type==="setImageProperties"){let d=e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}if(t==="table.insert"&&i.type==="insertTable"){let d=e.can(i);return d.ok?{id:t,enabled:true,disabledReason:null,active:false}:{id:t,enabled:false,disabledReason:d.reason,active:false}}let l=e.can(i);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 rg(e,t){return t.map(n=>hc(e,n))}function og(e,t,n,r){if(!e)return {result:{ok:false,code:"unsupported",reason:"editor is not ready"},nextDraft:null};let o=vn(r,t,n);if(!o)return {result:{ok:false,code:"unsupported",reason:"invalid table chrome value"},nextDraft:null};let a=e.can(o.command);if(!a.ok)return {result:{ok:false,code:a.code,reason:a.reason},nextDraft:null};let i=e.exec(o.command);return i.ok?{result:i,nextDraft:o.nextDraft}:{result:i,nextDraft:null}}function ag(e,t,n){if(!e)return {ok:false,code:"unsupported",reason:"editor is not ready"};if(t==="contentControl.showAll"){let a=qn(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=qn(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=qn(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=qn(e);if(!a)return {ok:false,code:"unsupported",reason:"editor is not ready"};let i=a.state().contentControls.activeControlId;if(!i)return {ok:false,code:"notFound",reason:"no content control at the selection"};let l=a.contentControls.disabledReason(i,"remove");return l?{ok:false,code:l==="bound"?"bound":"locked",reason:l}:a.contentControls.remove(i)?{ok:true,changed:true}:{ok:false,code:a.state().lastRejection??"unsupported",reason:a.state().lastRejection??"removeContentControl was refused"}}let r=n===void 0?No(t):_o(t,n)??No(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 ig(e){return e?e.save():Promise.reject(new Error("editor is not ready"))}function sg(e,t){if(!e)return {enabled:false,disabledReason:"editor is not ready"};let n=Ho(t,e);return n.can.ok?{enabled:true,disabledReason:null}:{enabled:false,disabledReason:n.can.reason}}function lg(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 wi(e){return e instanceof Uint8Array?Array.from(e):Array.isArray(e)?e.map(wi):e===null||typeof e!="object"?e:Object.fromEntries(Object.keys(e).sort().map(t=>[t,wi(e[t])]))}function dg(e){return JSON.stringify(wi(e))}var Pi=[{id:"history",labelKey:"formattingBar.groups.history",controls:[{id:"undo",labelKey:"formattingBar.undoShortcut",paths:se.undo,state:{kind:"command"}},{id:"redo",labelKey:"formattingBar.redoShortcut",paths:se.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:se.format_bold,state:{kind:"command"}},{id:"italic",labelKey:"formattingBar.italicShortcut",paths:se.format_italic,state:{kind:"command"}},{id:"underline",labelKey:"formattingBar.underlineShortcut",paths:se.format_underlined,state:{kind:"command"}},{id:"strike",labelKey:"formattingBar.strikethrough",paths:se.strikethrough_s,state:{kind:"command"}},{id:"color",shape:"colorSplit",swatch:"#ff0000",labelKey:"formattingBar.fontColor",paths:se.format_color_text,state:{kind:"value"}},{id:"highlight",shape:"colorSplit",swatch:"#ffff00",labelKey:"formattingBar.highlightColor",paths:se.ink_highlighter,state:{kind:"value"}},{id:"link",labelKey:"formattingBar.insertLinkShortcut",paths:se.link,state:{kind:"command"}}]},{id:"script",labelKey:"formattingBar.groups.script",controls:[{id:"super",labelKey:"formattingBar.superscript",paths:se.superscript,state:{kind:"command"}},{id:"sub",labelKey:"formattingBar.subscript",paths:se.subscript,state:{kind:"command"}}]},{id:"alignment",labelKey:"formattingBar.groups.alignment",controls:[{id:"left",labelKey:"alignment.alignLeft",paths:se.format_align_left,state:{kind:"command"}},{id:"center",labelKey:"alignment.center",paths:se.format_align_center,state:{kind:"command"}},{id:"right",labelKey:"alignment.alignRight",paths:se.format_align_right,state:{kind:"command"}},{id:"justify",labelKey:"alignment.justify",paths:se.format_align_justify,state:{kind:"command"}}]},{id:"list",labelKey:"formattingBar.groups.listFormatting",controls:[{id:"bullet",labelKey:"lists.bulletList",paths:se.format_list_bulleted,state:{kind:"command"}},{id:"numbered",labelKey:"lists.numberedList",paths:se.format_list_numbered,state:{kind:"command"}},{id:"outdent",labelKey:"lists.decreaseIndent",paths:se.format_indent_decrease,state:{kind:"command"}},{id:"indent",labelKey:"lists.increaseIndent",paths:se.format_indent_increase,state:{kind:"command"}},{id:"lineSpacing",shape:"dropdown",labelKey:"lineSpacing.label",paths:se.format_line_spacing,state:{kind:"command"}}]},{id:"format",labelKey:"formattingBar.clearFormatting",controls:[{id:"clear",labelKey:"formattingBar.clearFormatting",paths:se.format_clear,state:{kind:"command"}}]},{id:"review",labelKey:"formattingBar.commentsAndChanges",controls:[{id:"comments",shape:"icon",labelKey:"formattingBar.commentsAndChanges",paths:se.comment,state:{kind:"command"}},{id:"editingMode",shape:"dropdown",labelKey:"editingMode.label",valueKey:"editingMode.editing",paths:se.edit_note,state:{kind:"command"}}]},{id:"contentControl",labelKey:"contentControl.group",contextual:true,controls:[{id:"showAll",labelKey:"contentControl.showAll",paths:se.visibility,state:{kind:"command"}},{id:"formFill",labelKey:"contentControl.formFill",paths:se.edit_note,state:{kind:"command"}},{id:"inspector",labelKey:"contentControl.inspector",paths:se.tune,state:{kind:"command"}},{id:"remove",labelKey:"contentControl.remove",paths:se.delete,state:{kind:"command"}}]},{id:"image",labelKey:"formattingBar.groups.image",contextual:true,controls:[{id:"insert",labelKey:"toolbar.image",paths:se.image,state:{kind:"command"}},{id:"properties",labelKey:"formattingBar.imagePropertiesShortcut",paths:se.tune,state:{kind:"command"}},{id:"wrap",shape:"dropdown",labelKey:"formattingBar.imageWrap",paths:se.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:se.table,state:{kind:"command"}},{id:"borderTarget",shape:"dropdown",labelKey:"table.borders.tooltip",paths:se.border_all,state:{kind:"value"}},{id:"borderColor",shape:"colorSplit",swatch:"#000000",labelKey:"table.borderColor",paths:se.border_color,state:{kind:"value"}},{id:"borderStyle",shape:"dropdown",labelKey:"table.borders.styleAriaLabel",paths:se.border_horizontal,state:{kind:"value"}},{id:"borderWidth",shape:"dropdown",labelKey:"table.borderWidth",paths:se.line_weight,state:{kind:"value"}},{id:"cellFill",shape:"colorSplit",swatch:"#ffffff",labelKey:"table.cellFillColor",paths:se.format_color_fill,state:{kind:"value"}}]},{id:"file",labelKey:"toolbar.file",contextual:true,controls:[{id:"open",labelKey:"toolbar.open",paths:se.file_upload,state:{kind:"load"}},{id:"save",labelKey:"toolbar.saveShortcut",paths:se.file_download,state:{kind:"save"}},{id:"pageSetup",labelKey:"toolbar.pageSetup",paths:se.settings,state:{kind:"command"}}]},{id:"insert",labelKey:"toolbar.insert",contextual:true,controls:[{id:"footnote",labelKey:"toolbar.insertFootnote",paths:se.superscript,state:{kind:"command"}},{id:"endnote",labelKey:"toolbar.insertEndnote",paths:se.edit_note,state:{kind:"command"}},{id:"pageNumber",labelKey:"headerFooter.insertPageNumber",paths:se.format_list_numbered,state:{kind:"command"}},{id:"totalPages",labelKey:"headerFooter.insertTotalPages",paths:se.format_list_numbered,state:{kind:"command"}},{id:"sectionPages",labelKey:"headerFooter.insertSectionPages",paths:se.format_list_numbered,state:{kind:"command"}},{id:"pageXofY",labelKey:"headerFooter.insertPageXofY",paths:se.format_list_numbered,state:{kind:"command"}},{id:"pageBreak",labelKey:"toolbar.pageBreak",paths:se.page_break,state:{kind:"command"}},{id:"sectionBreakNextPage",labelKey:"toolbar.sectionBreakNextPage",paths:se.horizontal_rule,state:{kind:"command"}},{id:"sectionBreakContinuous",labelKey:"toolbar.sectionBreakContinuous",paths:se.border_horizontal,state:{kind:"command"}},{id:"toc",labelKey:"toolbar.tableOfContents",paths:se.toc,state:{kind:"command"}}]}],yc=Pi;function cg(e,t){return `${e.id}.${t.id}`}function vc(){return yc.filter(e=>!e.contextual)}function ug(e){let t=vc();if(!e)return t;let n=yc.find(r=>r.id==="image");return n?[...t,n]:t}var bc=[{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:"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:se.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 fg(){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 bc)t(n.entries);return e}function pg(){return Pi.reduce((e,t)=>e+t.controls.length,0)}var mg="formattingBar.unavailableInPreview";var Ci="docx-field-atom--active",gg="docx-field-atom";function Ri(e,t){for(let r of e.querySelectorAll(`.${Ci}`))r.classList.remove(Ci);if(!t)return;let n=e.querySelectorAll(`.${gg}`);for(let r of n){if(r.dataset.paragraphId!==t.paragraphId)continue;let o=Number(r.dataset.start),a=Number(r.dataset.end);!Number.isFinite(o)||!Number.isFinite(a)||t.offset<o||t.offset>a||r.classList.add(Ci);}}function zn(e){try{return e.createElement("canvas").getContext("2d")}catch{return null}}function Fe(e){return {anchor:e,head:e}}function Zo(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 Ei(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??fc$1(e);return a.indexOf(r.paragraphId)<=a.indexOf(o.paragraphId)?{from:r,to:o}:{from:o,to:r}}function Bo(e,t,n){let r=t[0],o=a=>{let i=t.includes(a.paragraphId)?a.paragraphId:r??a.paragraphId,l=Id$1(e,i).length;return {paragraphId:i,offset:Math.max(0,Math.min(a.offset,l))}};return {anchor:o(n.anchor),head:o(n.head)}}function Ic(e,t,n,r){if(t.paragraphId===n.paragraphId)return Id$1(e,t.paragraphId).slice(t.offset,n.offset);let o=r??fc$1(e),a=o.indexOf(t.paragraphId),i=o.indexOf(n.paragraphId);if(a===-1||i===-1)return "";let l=o.slice(a,i+1),d=Id$1(e,t.paragraphId).slice(t.offset);for(let u=1;u<l.length;u+=1){let h=l[u],P=Id$1(e,h),S=hc$1(e,h).includes(l[u-1])?"":`
|
|
3
|
+
`;d+=S+(u===l.length-1?P.slice(0,n.offset):P);}return d}function Sc(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 kc(e){return e.kind}function hg(e){return e.kind!=="textValue"&&kc(e)==="contentControl"}function xc(e){return e.kind!=="textValue"&&kc(e)==="contentControlContent"}function yg(e,t){let n=new Map,r=o=>{if(o.kind!=="textValue"){if(o.kind==="table"){let a=Sc(o);if(a.length>0&&a.every(i=>t.has(i))){n.set(o.id,a);return}}for(let a of o.children)r(a);}};return r(e.root),n}function vg(e,t,n){let r=new Set,o=(a,i)=>{if(a.kind!=="textValue"){if(a.kind==="table"&&n.has(a.id)){for(let l of a.children)o(l,true);return}if(hg(a)){let l=Sc(a);!i&&l.length>0&&l.every(d=>t.has(d))&&r.add(a.id);for(let d of a.children)o(d,i);return}for(let l of a.children)o(l,i);}};return o(e.root,false),r}function Tc(e,t,n,r,o){let a=v=>Id$1(e,v);if(n.paragraphId===r.paragraphId)return n.offset===r.offset?{ops:[],collapseTo:n}:{ops:[{op:"deleteText",paragraphId:n.paragraphId,start:n.offset,end:r.offset}],collapseTo:n};let i=o??fc$1(e),l=i.indexOf(n.paragraphId),d=i.indexOf(r.paragraphId);if(l===-1||d===-1)return {ops:[],collapseTo:n};let u=new Set;for(let v=l;v<=d;v+=1){let w=i[v];(v===l?n.offset===0:v!==d||r.offset===a(w).length)&&u.add(w);}let h=yg(t,u),P=new Map;for(let[v,w]of h)for(let q of w)P.set(q,v);let S=vg(t,u,h),I=l;if(P.has(n.paragraphId)){I=-1;for(let v=l+1;v<=d;v+=1)if(!P.has(i[v])){I=v;break}if(I===-1){let v=P.get(n.paragraphId);for(let w of h.get(v)??[])P.delete(w);h.delete(v),I=l;}}let L=i[I],O=I===l?n:{paragraphId:L,offset:0},k=[];for(let v=l;v<=d;v+=1){let w=i[v];if(P.has(w))continue;let q=a(w).length,z=v===l?n.offset:0,X=v===d?r.offset:q;z<X&&k.push({op:"deleteText",paragraphId:w,start:z,end:X});}for(let v of h.keys())k.push({op:"deleteBlock",blockId:v});for(let v of S)k.push({op:"removeContentControl",controlId:v});let g=v=>{let w=Ga(t,v);for(;w&&xc(w);){let q=Ga(t,w.id);if(!q||!S.has(q.id))break;w=Ga(t,q.id);}return w},D=v=>{let w=[],q=z=>{for(let X of z)if(X.kind!=="textValue"&&!h.has(X.id)){if(S.has(X.id)){let Y=X.children.find(xc);Y&&Y.kind!=="textValue"&&q(Y.children);continue}if(X.kind==="paragraph"){w.push(X.id);continue}w.push(`\0barrier:${X.id}`);}};return q(v.children),w},N=(v,w)=>{let q=g(v);if(!q||g(w)!==q)return false;let z=D(q),X=z.indexOf(v),Y=z.indexOf(w);return X!==-1&&Y===X+1},E=L,T=L;for(let v=I+1;v<=d;v+=1){let w=i[v];P.has(w)||(N(T,w)?k.push({op:"joinParagraphs",firstId:E,secondId:w}):E=w,T=w);}return {ops:k,collapseTo:O}}var bg={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function xg(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 bg[n.toLowerCase()]??t})}var Ig=new Set(["script","style"]),Sg=new Set(["p","div","li","tr","h1","h2","h3","h4","h5","h6","blockquote","section","article","pre","table"]),kg=new Set(["td","th"]),wc=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"),Tg=e=>wc(e)||e!==void 0&&e>="0"&&e<="9",Pc=e=>e===" "||e===" "||e===`
|
|
4
|
+
`||e==="\r"||e==="\f";function wg(e,t){let n=t+1,r=e[n]==="/";if(r&&(n+=1),!wc(e[n]))return null;let o=n;for(;n<e.length&&Tg(e[n]);)n+=1;let a=e.slice(o,n).toLowerCase(),i="",l=false;for(;n<e.length;){let d=e[n];if(i!=="")d===i&&(i="");else if(d==="=")l=true;else if(l&&(d==='"'||d==="'"))i=d,l=false;else {if(d===">")return {name:a,closing:r,end:n+1};Pc(d)||(l=false);}n+=1;}return {name:a,closing:r,end:e.length}}function Pg(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 Cg(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&&Pc(e[a]);)a+=1;if(e[a]===">")return a+1}r=o+2;}return e.length}function Rg(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 i=t.indexOf("-->",o+4);r=i===-1?t.length:i+3;continue}if(t[o+1]==="!"||t[o+1]==="?"){let i=t.indexOf(">",o+1);r=i===-1?t.length:i+1;continue}let a=wg(t,o);if(a===null){n+="<",r=o+1;continue}r=a.end,!a.closing&&Ig.has(a.name)?r=Cg(t,a.name,a.end):!a.closing&&a.name==="br"?n+=`
|
|
5
|
+
`:a.closing&&kg.has(a.name)?n+=" ":a.closing&&Sg.has(a.name)&&(n+=`
|
|
6
|
+
`);}return xg(n).replace(/\r\n?/g,`
|
|
7
|
+
`).split(`
|
|
8
|
+
`).map(Pg).join(`
|
|
9
|
+
`).replace(/\n{3,}/g,`
|
|
10
|
+
|
|
11
|
+
`).trim()}function Cc(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 Fi(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?Rg(n):""}var Eg={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Home:"lineStart",End:"lineEnd"},Rc={l:"left",e:"center",r:"right",j:"both"},Ec={1:"240",5:"360",2:"480"},Fc={b:{localName:"b"},i:{localName:"i"},u:{localName:"u",attributes:{val:"single"}}};function Mc(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=Eg[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&&Fc[n.key.toLowerCase()]){let a=Fc[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&&Rc[n.key.toLowerCase()]){if(n.metaKey&&n.key.toLowerCase()==="r")return;e.setParagraphProperty("jc",{val:Rc[n.key.toLowerCase()]}),n.preventDefault();return}if(r&&!n.shiftKey&&Ec[n.key]){e.setParagraphProperty("spacing",{line:Ec[n.key],lineRule:"auto"}),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 Ac(e,t){return {onCopy:a=>{let i=e.selectedText();i&&(a.clipboardData?.setData("text/plain",i),a.preventDefault());},onCut:a=>{let i=e.selectedText();i&&(a.clipboardData?.setData("text/plain",i),e.deleteSelection(),a.preventDefault());},onPaste:a=>{let i=Fi(a.clipboardData);a.preventDefault(),i&&t(i);}}}function Oc(e){let t=Fi(e.dataTransfer);return t.length>0?t:null}function Lc(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??Oc(n);r&&e.type(r);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=Oc(n);r&&t.insertPlainText(r);return}n.inputType==="insertParagraph"&&e.splitParagraph();}}}}function Hc(e,t,n){let r=e.querySelectorAll("[data-paragraph-id][data-start]"),o=[],a=new Set;for(let i of r){let l=i;if(l.dataset.paragraphId!==t)continue;let d=Number(l.dataset.start);if(Number.isInteger(d)){if(l.dataset.docxField!==void 0){if(a.has(d))continue;a.add(d);let u=l.dataset.end,h=u!==void 0&&/^\d{1,9}$/.test(u)&&Number(u)>=d?Number(u):d;o.push({start:d,text:n.slice(d,h)});continue}o.push({start:d,text:l.textContent??""});}}return o.length===0?null:(o.sort((i,l)=>i.start-l.start),o.map(i=>i.text).join(""))}function Dc(e,t,n){if(n===t)return null;let r=0;for(;r<n.length&&r<t.length&&n[r]===t[r];)r+=1;let o=0;for(;o<n.length-r&&o<t.length-r&&n[n.length-1-o]===t[t.length-1-o];)o+=1;let a=n.slice(r,n.length-o),i=[];return t.length-o>r&&i.push({op:"deleteText",paragraphId:e,start:r,end:t.length-o}),a.length>0&&i.push({op:"insertText",paragraphId:e,offset:r,text:a}),i.length===0?null:{ops:i,caret:r+a.length}}function Oi(e){let{session:t,measurer:n,producer:r,cache:o,styleCascade:a,defaultTabStopPt:i,displayMode:l,inlineDrawingLayoutForPart:d,drawingLayoutTokenForPart:u,drawingTokenForParagraphForPart:h}=e,P=new WeakMap,S=null,I=-1;function L(E){let T=t.packageRevision();return (!S||I!==T)&&(S=Mg(t.currentPackage()),I=T),S.get(E)}function O(E,T,v){let w=u?.(E.name)??"",q=v?.height??0,z=v?.margin.top??0,X=v?.margin.bottom??0,Y=v?.margin.left??0,F=v?.margin.right??0,re=P.get(E);if(re&&re.width===T&&re.pageHeight===q&&re.marginTop===z&&re.marginBottom===X&&re.marginLeft===Y&&re.marginRight===F&&re.producer===r&&re.drawingLayoutToken===w)return re.story;let $=d?.(E.name),Te=Gc$1(E,T,n,r,o,a,void 0,void 0,i,l,$,h?be=>h(E.name,be):void 0,void 0,v?{pageNumber:1,pageWidth:v.width,pageHeight:v.height,marginLeft:v.margin.left,marginRight:v.margin.right,marginTop:v.margin.top,marginBottom:v.margin.bottom}:void 0,t.documentProperties()),fe=L(E.name),Pe=fe?Nc(Te,fe):Te;return P.set(E,{width:T,pageHeight:q,marginTop:z,marginBottom:X,marginLeft:Y,marginRight:F,producer:r,drawingLayoutToken:w,story:Pe}),Pe}function k(E,T,v){let w=new Map;for(let[q,z]of E)w.set(q,O(z,T,v));return w}function g(E,T){if(!E||E.headers.size===0&&E.footers.size===0)return;let v=T.width-T.margin.left-T.margin.right;return {titlePage:E.titlePage,evenAndOddHeaders:E.evenAndOddHeaders,headers:k(E.headers,v,T),footers:k(E.footers,v,T)}}function D(){let E=Nc$1(t.part(),l),T=t.headerFooterPartsBySection();return E.map((v,w)=>g(T[w],Pc$1(v.properties)))}function N(){let E=D();return E[E.length-1]}return {furniture:N,sectionFurniture:D}}var Fg="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",Og="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";function Mg(e){let t=new Map,n=e.relationships.get(e.mainDocumentPart)??[];for(let r of n){if(r.type!==Fg&&r.type!==Og)continue;let o=O(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 Nc(e,t){return e.rId===t?e:{...e,rId:t,withPageContext:n=>Nc(e.withPageContext(n),t)}}function _c(e){let t,n;return {styleCascade:vb(e.stylesRoot(),e.documentThemeFonts()),defaultTabStopPt:Ia(e.settingsRoot()),numberingIndex(){let r=e.numberingRoot();return (n===void 0||r!==t)&&(t=r,n=Wb(r)),n}}}function ot(e){return e.closest(".docx-editor__scroll-container")}function Zc(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 Bc(e,t,n){let r=ot(e);if(!r||r.clientHeight<=0||t.pages.length===0||n<=0)return null;let o=Zc(e,r,n),a=o.top+o.height/2;for(let i of t.pages)if(a<i.box.y+i.box.height)return i.index+1;return t.pages.length}function qc(e,t,n,r){let o=ot(e);if(!o||o.clientHeight===0)return;let a=Zc(e,o,r),i=[];for(let l of [n.anchor,n.head]){let d=Ed$1(t,l);d&&i.push(d.pageIndex);}return wd$1({layout:t,viewport:a,overscanPages:1,pinnedPages:i})}function Mi(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 qo(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,i=0;for(let u of a){let h=u.box.x+u.box.width;h>i&&(i=h);}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,(i-u.box.width)/2-u.box.x);return {width:i,height:o,pageOffsetX:d}}function zc(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 Kc(e){let t=e.session.currentPackage(),n=Yd$1(t,"footnote"),r=Yd$1(t,"endnote");if(!n&&!r)return;let o=Gd$2(t),a=Hd$1(o),i=Id$2(o),l=Jd$1(void 0,a),d=Kd$1(void 0,i),u=e.session.part(),h=Nc$1(u),P=Ag(u,h),S=h.map((g,D)=>Jd$1(Ed$2(P[D]),a)),I=h.map((g,D)=>Kd$1(Fd$1(P[D]),i)),L=e.inlineDrawingLayoutForPart,O=e.drawingTokenForParagraphForPart,k=L?g=>{let D=L(g);if(D)return {inlineDrawingLayout:D,...O?{drawingTokenForParagraph:N=>O(g,N)}:{}}}:void 0;return {footnotesPart:n,endnotesPart:r,footnotePropsBySection:S.length>0?S:[l],endnotePropsBySection:I.length>0?I:[d],documentFootnoteProps:l,documentEndnoteProps:d,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade,defaultTabStopPt:e.defaultTabStopPt,...k?{drawingsForPart:k}:{}}}function Ag(e,t){let n=Cb(e),r=[];for(let o=0;o<n.length;o+=1){let a=n[o];if(a.kind!=="paragraph")continue;let i=Lc$1(a);i&&r.push(i);}for(;r.length<t.length;)r.push(void 0);return r}function jc(e){if(typeof e.defaultView?.createImageBitmap!="function")return null;let t=e.defaultView;return Object.freeze({async decode(n,r,o){let a=new Blob([new Uint8Array(n)],{type:r}),i=await t.createImageBitmap(a);try{let l=i.width,d=i.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{i.close();}},convertPreserved(n,r,o){return r==="image/tiff"?Dg(e,n,o):Lg(n,r)}})}async function Lg(e,t,n){let{convertEmfToDataUrl:r,convertWmfToDataUrl:o}=await import('emf-converter'),a=new Uint8Array(e),i=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),l={maxWidth:4096,maxHeight:4096},d=t==="image/x-emf"?await r(i,l):await o(i,l);if(!d)return null;let u="data:image/png;base64,";if(!d.startsWith(u))return null;let h=atob(d.slice(u.length)),P=new Uint8Array(h.length);for(let S=0;S<h.length;S+=1)P[S]=h.charCodeAt(S);return Object.freeze({bytes:P,mime:"image/png"})}function Vc(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 Hg(e,t){let n=await import('utif2'),r=n.default??n,o=e.slice().buffer,a=r.decode(o)[0];if(!a)return null;let i=Vc(a,"t256"),l=Vc(a,"t257");if(i===null||l===null||i>t.maxDimension||l>t.maxDimension||i>t.maxPixels/l)return null;let d=i*l;if(d*4>t.maxDecodedBytes||(r.decodeImage(o,a),a.width!==i||a.height!==l))return null;let u=r.toRGBA8(a);return u.length!==d*4?null:Object.freeze({rgba:u,pixelWidth:i,pixelHeight:l})}async function Dg(e,t,n){let r=await Hg(t,n);if(r===null)return null;let o=await Ng(e,r.rgba,r.pixelWidth,r.pixelHeight);return o===null?null:Object.freeze({bytes:o,mime:"image/png"})}async function Ng(e,t,n,r){let o=e.createElement("canvas");if(o.width=n,o.height=r,o.width!==n||o.height!==r)return null;let a=o.getContext("2d");if(!a)return null;let i=a.createImageData(n,r);i.data.set(t),a.putImageData(i,0,0);let l=await new Promise(d=>{o.toBlob(u=>d(u),"image/png");});return l?new Uint8Array(await l.arrayBuffer()):null}function Uc(){return Object.freeze({async decode(){throw new Error("Image decode unavailable in headless environment")}})}function Wc(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 _g="docx-editor-one-surface__caret",Ai="docx-editor-one-surface__caret--steady",Zg=530;function Gc(e,t,n){let r=e.ownerDocument,o=r.createElement("div");o.className=_g,o.dataset.docxCaret="",o.dataset.docxMarker="",o.setAttribute("contenteditable","false"),o.setAttribute("aria-hidden","true"),o.dataset.noColorInvert="",o.style.position="absolute",o.style.pointerEvents="none",o.style.userSelect="none",o.style.setProperty("-webkit-user-select","none");let a=false,i=null,l=null,d=null;function u(){let D=r.activeElement;return D===e||!!D&&e.contains(D)}function h(D){return D.anchor.paragraphId===D.head.paragraphId&&D.anchor.offset===D.head.offset}function P(){l=null,i!==null&&(clearTimeout(i),i=null),o.classList.remove(Ai),o.remove(),e.style.removeProperty("caret-color"),d?.style.removeProperty("caret-color"),d=null;}function S(){o.classList.add(Ai),i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,o.classList.remove(Ai);},Zg);}function I(){if(a||!u()||n().suppress){P();return}let{layout:D,selection:N,scopedHost:E,scopedHostKind:T,preferredPageIndex:v,measurer:w}=n(),q=t();if(!h(N)){P();return}let z=Ed$1(D,N.head,{...w?{measurer:w}:{},...v!==void 0?{preferredPageIndex:v}:{}});if(!z||!Number.isInteger(z.pageIndex)){P();return}let X=E??e.querySelector(`[data-page-index="${z.pageIndex}"] > .docx-page-content`);if(!X){P();return}o.style.left=`${z.x*q}px`,o.style.top=`${z.y*q}px`,o.style.height=`${z.height*q}px`,o.parentNode!==X&&X.append(o),e.style.caretColor="transparent",d&&d!==E&&d.style.removeProperty("caret-color"),d=E??null,d?.style.setProperty("caret-color","transparent");let Y=X===E?T??"scoped":"body",F=`${z.pageIndex}:${Y}:${z.x}:${z.y}:${z.height}`;F!==l&&(l=F,S());}let L=()=>{a=true,I();},O=()=>{a=false,I();},k=()=>I(),g=D=>{let N=D.relatedTarget;N&&e.contains(N)||P();};return e.addEventListener("compositionstart",L),e.addEventListener("compositionend",O),e.addEventListener("focusin",k),e.addEventListener("focusout",g),{update:I,destroy(){e.removeEventListener("compositionstart",L),e.removeEventListener("compositionend",O),e.removeEventListener("focusin",k),e.removeEventListener("focusout",g),P();}}}function $c(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)$c(o.blocks,t);}}function Bg(e,t){for(let n of e.pages)$c(n.fragments,r=>{for(let o=0;o<r.rows.length;o+=1)t({table:r,row:r.rows[o],rowIndex:o});});}function Li(e,t,n,r){let o=null;return Bg(e,a=>{a.table.tableId===t&&a.row.id===n&&a.row.isHeaderRepeat===r&&(o=a);}),o}function Hi(e,t){return {sourceRevision:e,tableId:t.table.tableId,rowId:t.row.id,isHeaderRepeat:t.row.isHeaderRepeat}}function Xc(e,t,n){let r=n.gridColumnId;return r?{sourceRevision:e,tableId:t.table.tableId,gridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}:null}function Yc(e,t,n,r){return {sourceRevision:e,tableId:t.table.tableId,leftGridColumnId:n,rightGridColumnId:r,isHeaderRepeat:t.row.isHeaderRepeat}}function Qc(e,t,n){return {sourceRevision:e,tableId:t.table.tableId,gridColumnId:n,isHeaderRepeat:t.row.isHeaderRepeat}}var qg=120,Jc=20;function zo(e){let t=rf$1(e,"w"),n=t?Number.parseInt(t,10):Number.NaN;return Number.isFinite(n)?n:0}function zg(e,t,n){let r=e.pagesLayer.getBoundingClientRect(),o=e.scale();return {x:(t-r.left)/o,y:(n-r.top)/o}}function Di(e){let t=e.editingMode==="view";return {editable:!t,viewing:t}}function Ko(e,t,n){let r=o=>{for(let a of o)if(a.kind==="table"){if(a.tableId===t)return a;for(let i of a.rows)for(let l of i.cells){let d=r(l.blocks);if(d)return d}}return null};return r(e.pages[n]?.fragments??[])}function Ni(e,t){return t.kind==="insertColumn"?Li(e,t.tableId,t.rowId,t.isHeaderRepeat):"rowId"in t?Li(e,t.tableId,t.rowId,t.isHeaderRepeat):null}function eu(e){let t=e.furnitureLayer;t.className="docx-table-furniture",t.setAttribute("contenteditable","false"),t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.pointerEvents="none";let n=null,r=null,o=null,a=null,i=null,l=null,d=false,u=0,h=0,P=null,S=null,I=null;function L(y){return y instanceof HTMLButtonElement&&(y.classList.contains("docx-table-insert-row")||y.classList.contains("docx-table-insert-column"))}function O(){let y=document.activeElement;return y!==null&&L(y)&&y.closest(".docx-table-furniture")===t?y:null}function k(y){for(let x of [...t.children])L(x)&&x!==y&&x.remove();}function g(){S=null,I=null;}function D(){n!==null&&(clearTimeout(n),n=null);}function N(){for(let x of [...t.children])L(x)||x.remove();let y=O();if(!y){k(null),g();return}S=y,k(y);}function E(y){let x=S??O(),Z=x!==null&&document.activeElement===x;g(),t.replaceChildren(),y&&Z&&e.pagesLayer.focus({preventScroll:true});}function T(){for(let y of [...t.children])L(y)||y.remove();}function v(y,x,Z){let B=e.read().layout.pages[y];if(!B)return {left:0,top:0};let te=e.scale(),ee=e.pageOffsetX(y);return {left:(B.contentBox.x+x+ee)*te,top:(B.contentBox.y+Z)*te}}function w(y,x){let Z=e.read(),M=Ko(Z.layout,x.tableId,x.pageIndex);if(!M)return;let B=document.createElement("div");B.className="docx-table-resize-preview",B.style.position="absolute",B.style.pointerEvents="none";let te=x.kind!=="rowDivider",ee=v(x.pageIndex,te?M.box.x+y:M.box.x,te?M.box.y:M.box.y+y);B.style.left=`${ee.left}px`,B.style.top=`${ee.top}px`,B.style.width=te?"2px":`${M.box.width*e.scale()}px`,B.style.height=te?`${M.box.height*e.scale()}px`:"2px",t.append(B);}function q(){let y=document.createElement("button");return y.type="button",y.textContent="+",y.style.position="absolute",y.style.pointerEvents="auto",y}function z(y){re(y);let x=I;if(!x)return;let Z=e.read();x.kind==="insertRow"?Te(x,Z):x.kind==="insertColumn"&&fe(x,Z);}function X(){queueMicrotask(()=>{!S||document.activeElement===S||d||r?.kind==="insertRow"||r?.kind==="insertColumn"||(S.remove(),g());});}function Y(){if(S&&t.contains(S))return S;let y=O();if(y)return S=y,y;let x=q();return x.addEventListener("pointerenter",()=>{d=true,D();}),x.addEventListener("pointerleave",()=>{d=false;}),x.addEventListener("pointerdown",re),x.addEventListener("mousedown",re),x.addEventListener("click",z),x.addEventListener("blur",X),S=x,x}function F(y,x){let Z=Ko(x.layout,y.tableId,y.pageIndex);if(!Z)return;let M=Y();if(k(M),I=y,M.dataset.tableId=y.tableId,y.kind==="insertRow"){let B=Z.rows.find(le=>le.id===y.rowId);if(!B)return;M.dataset.rowId=y.rowId,delete M.dataset.gridColumnId,M.className="docx-table-insert-row",M.setAttribute("aria-label",e.label("table.insertRowBelow"));let te=B.box.y+B.box.height/2,ee=v(y.pageIndex,Z.box.x-14,te);M.style.left=`${ee.left}px`,M.style.top=`${ee.top-8}px`;}else {let B=Z.rows[0]?.cells.find(Le=>Le.gridColumnId===y.gridColumnId);if(!B)return;M.dataset.gridColumnId=y.gridColumnId,delete M.dataset.rowId;let te=Z.columnEdges[B.gridColumn]??0,ee=Z.columnEdges[B.gridColumn+1]??Z.box.width;M.className="docx-table-insert-column",M.setAttribute("aria-label",e.label("table.insertColumnRight"));let le=v(y.pageIndex,Z.box.x+(te+ee)/2-8,Z.box.y-14);M.style.left=`${le.left}px`,M.style.top=`${le.top}px`;}t.contains(M)||t.append(M);}function re(y){y.preventDefault(),y.stopPropagation();}function $(y,x){if(T(),k(S??O()),!(l||x.editingMode==="view")){if((y.kind==="columnDivider"||y.kind==="rightEdge")&&!y.isHeaderRepeat){let Z=Ko(x.layout,y.tableId,y.pageIndex);if(!Z)return;let M=document.createElement("div");M.className=y.kind==="rightEdge"?"docx-table-edge-handle-right layout-table-edge-handle-right":"docx-table-divider-handle layout-table-resize-handle",M.style.position="absolute",M.style.pointerEvents="auto",M.style.cursor="col-resize",M.dataset.active="true";let B=v(y.pageIndex,Z.box.x+y.edgeX,Z.box.y);M.style.left=`${B.left-3}px`,M.style.top=`${B.top}px`,M.style.width="6px",M.style.height=`${Z.box.height*e.scale()}px`,M.addEventListener("pointerdown",Pe),t.append(M);}if(y.kind==="rowDivider"&&!y.isHeaderRepeat){let Z=Ko(x.layout,y.tableId,y.pageIndex);if(!Z)return;let M=document.createElement("div");M.className="docx-table-row-divider-handle layout-table-row-resize-handle",M.style.position="absolute",M.style.pointerEvents="auto",M.style.cursor="row-resize",M.dataset.active="true";let B=v(y.pageIndex,Z.box.x,Z.box.y+y.edgeY);M.style.left=`${B.left}px`,M.style.top=`${B.top-3}px`,M.style.width=`${Z.box.width*e.scale()}px`,M.style.height="6px",M.addEventListener("pointerdown",Pe),t.append(M);}y.kind==="insertRow"&&!y.isHeaderRepeat&&F(y,x),y.kind==="insertColumn"&&!y.isHeaderRepeat&&F(y,x);}}function Te(y,x){let Z=Ni(x.layout,y);if(!Z)return;let M=Di(x),B=Vt({command:{type:"insertRow",where:"below",target:Hi(y.sourceRevision,Z)},part:e.session().part(),layout:x.layout,storeRevision:x.storeRevision,selection:x.selection,cellSelection:x.cellSelection,themeColors:x.themeColors,...M});e.applyTableCommandPlan(B);}function fe(y,x){let Z=Ni(x.layout,y);if(!Z)return;let M=Z.row.cells.find(le=>le.gridColumnId===y.gridColumnId);if(!M)return;let B=Xc(y.sourceRevision,Z,M);if(!B)return;let te=Di(x),ee=Vt({command:{type:"insertColumn",where:"right",target:B},part:e.session().part(),layout:x.layout,storeRevision:x.storeRevision,selection:x.selection,cellSelection:x.cellSelection,themeColors:x.themeColors,...te});e.applyTableCommandPlan(ee);}function Pe(y){if(y.button!==0)return;let x=e.read();if(x.editingMode==="view"||!r||r.kind!=="columnDivider"&&r.kind!=="rightEdge"&&r.kind!=="rowDivider")return;y.preventDefault(),y.stopPropagation();let Z=r,M=Ni(x.layout,Z);if(!M)return;let B=sf$1(e.session().part().root,Z.tableId);if(!B.ok||Z.kind!=="rowDivider"&&B.topology.hasMerge)return;let te=0,ee=0,le=0,Le=B.topology.gridColumns.reduce((Ce,ze)=>Ce+zo(ze),0),He;if(Z.kind==="columnDivider"){let Ce=B.topology.gridColumns.find(Re=>Re.id===Z.leftGridColumnId),ze=B.topology.gridColumns.find(Re=>Re.id===Z.rightGridColumnId);if(!Ce||!ze)return;te=zo(Ce),ee=zo(ze),He=Yc(Z.sourceRevision,M,Z.leftGridColumnId,Z.rightGridColumnId);}else if(Z.kind==="rightEdge"){let Ce=B.topology.gridColumns.find(ze=>ze.id===Z.gridColumnId);if(!Ce)return;te=zo(Ce),ee=0,He=Qc(Z.sourceRevision,M,Z.gridColumnId);}else le=Math.max(20,Math.round(M.row.box.height*Jc)),He=Hi(Z.sourceRevision,M);let it=y.currentTarget;it.setPointerCapture(y.pointerId),u=y.clientX,h=y.clientY,l={pointerId:y.pointerId,startClientX:y.clientX,startClientY:y.clientY,startEdgePt:Z.kind==="rowDivider"?Z.edgeY:Z.edgeX,leftTwips:te,rightTwips:ee,tableWidthTwips:Le,rowHeightTwips:le,target:Z,ref:M,resizeTarget:He,captureElement:it,rightEdge:Z.kind==="rightEdge",vertical:Z.kind==="rowDivider",cancelled:false};for(let Ce of [...t.children])Ce!==it&&Ce.remove();w(Z.kind==="rowDivider"?Z.edgeY:Z.edgeX,Z);}function be(){if(l){try{l.captureElement.hasPointerCapture(l.pointerId)&&l.captureElement.releasePointerCapture(l.pointerId);}catch{}l.cancelled=true,l=null,N(),r=null;}}function We(){if(!l||l.cancelled){l=null,N();return}let y=l;l=null;try{y.captureElement.hasPointerCapture(y.pointerId)&&y.captureElement.releasePointerCapture(y.pointerId);}catch{}if(y.vertical?h===y.startClientY:u===y.startClientX){N();return}let x=e.read(),Z=Di(x),M=(y.vertical?h-y.startClientY:u-y.startClientX)/e.scale(),B=Math.round(M*Jc),te;if(y.target.kind==="rowDivider")te=Ad({part:e.session().part(),layout:x.layout,storeRevision:x.storeRevision,selection:x.selection,cellSelection:x.cellSelection,themeColors:x.themeColors,...Z},y.resizeTarget,Math.max(20,y.rowHeightTwips+B));else if(y.rightEdge&&y.target.kind==="rightEdge"){let ee=Math.max(300,y.leftTwips+B),le=Math.max(ee,y.tableWidthTwips+B);te=Vt({command:{type:"commitTableRightEdgeResize",target:y.resizeTarget,columnWidthTwips:ee,tableWidthTwips:le},part:e.session().part(),layout:x.layout,storeRevision:x.storeRevision,selection:x.selection,cellSelection:x.cellSelection,themeColors:x.themeColors,...Z});}else if(y.target.kind==="columnDivider"){let ee=y.leftTwips+B,le=y.rightTwips-B;ee=Math.max(300,ee),le=Math.max(300,le);let Le=y.leftTwips+y.rightTwips;ee+le!==Le&&(ee>Le-300?(ee=Le-300,le=300):le=Le-ee),te=Vt({command:{type:"commitTableColumnDividerResize",target:y.resizeTarget,leftWidthTwips:ee,rightWidthTwips:le},part:e.session().part(),layout:x.layout,storeRevision:x.storeRevision,selection:x.selection,cellSelection:x.cellSelection,themeColors:x.themeColors,...Z});}else {N();return}e.applyTableCommandPlan(te),N();}function at(y){if(!o||!P)return null;let x=e.pageOffsetX(P.pageIndex);return zc$2(o,P.x,P.y,y.layout,x,P.pageIndex)}function Ge(y){if(!r||l||y.editingMode==="view")return;D();let x=at(y);if(!x||x.kind==="tableBody"){r=null,N();return}if(xc$1(x)!==xc$1(r)){r=null,N();return}r=x,$(x,y);}function Se(){let y=S??O(),x=y!==null&&document.activeElement===y;g(),y&&t.contains(y)&&y.remove(),x&&e.pagesLayer.focus({preventScroll:true});}function yt(y){if(l||y.editingMode==="view")return;let x=S??O();if(!x||!t.contains(x)){I&&g();return}if(S=x,!I||I.kind!=="insertRow"&&I.kind!=="insertColumn")return;if(!o){Se();return}let Z=xc$1(I),M=yc$1(o,I);if(!M||xc$1(M)!==Z){Se();return}I=M,F(M,y);}function Me(y){let x=e.read();if(l&&y.pointerId===l.pointerId){u=y.clientX,h=y.clientY;let ee=(l.vertical?y.clientY-l.startClientY:y.clientX-l.startClientX)/e.scale();for(let le of [...t.children])le!==l.captureElement&&le.remove();w(l.startEdgePt+ee,l.target);return}if(x.editingMode==="view"){E(false);return}let Z=zg(e,y.clientX,y.clientY),M=lc$1(x.layout,Z.y);M>=0&&(P={x:Z.x,y:Z.y,pageIndex:M});let B=M>=0?e.pageOffsetX(M):0,te=o?zc$2(o,Z.x,Z.y,x.layout,B,M>=0?M:void 0):null;if(!te||te.kind==="tableBody"){if(d)return;!n&&r&&(n=setTimeout(()=>{n=null,r=null,N();},qg));return}n&&(clearTimeout(n),n=null),!(r&&wc$1(te)===wc$1(r))&&(r=te,$(te,x));}function qe(y){if(!(!l||y.pointerId!==l.pointerId)){if(e.read().editingMode==="view"){be();return}We();}}function A(y){!l||y.pointerId!==l.pointerId||be();}function G(y){y.key!=="Escape"||!l||be();}return e.pagesLayer.addEventListener("pointermove",Me),document.addEventListener("pointermove",Me),document.addEventListener("pointerup",qe),document.addEventListener("pointercancel",A),e.pagesLayer.addEventListener("keydown",G),{update(){let y=e.read(),x=a,Z=i;o=vc$1(y.layout),a=y.layout.revision,i=y.storeRevision,y.editingMode==="view"?(be(),r=null,D(),E(true)):x!==null&&(x!==y.layout.revision||Z!==y.storeRevision)&&(r!==null&&Ge(y),yt(y)),t.style.width=e.pagesLayer.style.width,t.style.height=e.pagesLayer.style.height;},refreshLabels(){let y=e.read();if(y.editingMode==="view")return;let x=S??O();if(x&&t.contains(x)&&I&&(I.kind==="insertRow"||I.kind==="insertColumn")){F(I,y);return}r&&(r.kind==="insertRow"||r.kind==="insertColumn")&&F(r,y);},destroy(){D(),be(),g(),N(),e.pagesLayer.removeEventListener("pointermove",Me),document.removeEventListener("pointermove",Me),document.removeEventListener("pointerup",qe),document.removeEventListener("pointercancel",A),e.pagesLayer.removeEventListener("keydown",G),t.remove();}}}var tu=new WeakMap;function Vo(e,t){let n=tu.get(e);if(!n){n=new Map;for(let r of e.pages)for(let o of R(r)){n.has(o.paragraphId)||n.set(o.paragraphId,o.props);for(let a of o.lines)for(let i of gc$1(a))n.has(i.paragraphId)||n.set(i.paragraphId,o.props);}tu.set(e,n);}return n.get(t)??[]}var nu=new WeakMap;function Kg(e,t){let n=nu.get(e);if(!n){let r=new Map,o=(a,i)=>{for(let l of a){if(l.kind==="paragraph"){r.has(l.paragraphId)||r.set(l.paragraphId,{indent:l.indent,inTable:i});continue}for(let d of l.rows)for(let u of d.cells)o(u.blocks,true);}};for(let a of e.pages)o(a.fragments,false);n=r,nu.set(e,r);}return n.get(t)??null}function jo(e,t,n,r,o){let a=Fa(e,t);if(!a||a.kind!=="paragraph")return [];let i=[],l=hg$1(a),d=ig$1(a);return Sb(a.children,0,u=>{if(u.kind!=="run")return;let h=l.get(u.id);if(!h||h.end<=h.start)return;let P=Math.max(h.start,n),S=Math.min(h.end,r);P>=S||i.push({start:P,end:S,properties:gg$1(dg$1(cg$1(u,"runProperties","rPr"),ag$1),o),...d.has(u.id)?{targetRunIds:[u.id]}:{}});}),i}function ru(e,t,n,r){let o=Fa(e,t);if(!o||o.kind!=="paragraph")return false;let a=hg$1(o),i=false,l=d=>{if(i||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)||dg$1(cg$1(d,"runProperties","rPr"),ag$1).length>0&&(i=true);};return Sb(o.children,0,l),i}function ou(e,t,n){let r=Fa(e,t);if(!r||r.kind!=="paragraph")return [];let o=hg$1(r),a=null,i=null,l=u=>{if(u.kind!=="run")return;let h=o.get(u.id);!h||h.end<=h.start||(h.start<n&&n<=h.end&&(a=u),i===null&&h.start<=n&&n<h.end&&(i=u));};Sb(r.children,0,l);let d=a??i;return d?dg$1(cg$1(d,"runProperties","rPr"),ag$1):fg$1(e,t)}function Kn(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 au(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:Kn(t,"b")===true};break;case "i":n={...n,italic:Kn(t,"i")===true};break;case "u":n={...n,underline:Kn(t,"u")===true};break;case "strike":n={...n,strikethrough:Kn(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 iu(e,t,n){return n&&n.length>0?Od$1(e,n):Ld$1(e,t)}function _i(e,t,n,r,o){let a=iu(e,t,r);if(a.length===0)return false;let i=l=>{switch(n){case "b":return l.style.bold;case "i":return l.style.italic;case "u":return l.style.underline!==null;case "strike":return l.style.strike;case "vertAlign":return l.style.verticalAlign===o;default:return false}};return a.every(i)}function su(e,t,n,r,o){let a=iu(e,t,r),i=a.map(v=>v.style),l=v=>{if(i.length===0)return null;let w=v(i[0]);return i.every(q=>v(q)===w)?w:null},d=v=>v.length>0&&v.every(w=>w===v[0])?v[0]:null,u=(v,w)=>v.props.some(q=>q.localName===w),h=v=>v.style.fontFamily??n?.(v.range.paragraphId,v.props).fontFamily??null,P=v=>u(v,"sz")?Math.round(v.style.fontSizePt*2):n?.(v.range.paragraphId,v.props).fontSizeHalfPoints??Math.round(v.style.fontSizePt*2),S=a.length===0?n?.(t.head.paragraphId,[]):void 0,I=Vg(e,t),L=v=>d(I.map(w=>v(Vo(e,w)))),O=L(v=>{let w=v.find(q=>q.localName==="jc")?.attributes?.val;return w==="center"||w==="right"||w==="both"?w:w==="end"?"right":"left"}),k=L(v=>v.find(w=>w.localName==="pStyle")?.attributes?.val??o??void 0)??null,g=v=>v.find(w=>w.localName==="spacing")?.attributes,D=L(v=>{let w=g(v),q=Number(w?.line);if(!Number.isFinite(q))return "";let z=w?.lineRule??"auto";return z==="auto"?`multiple:${Math.round(q/240*100)/100}`:`${z==="exact"?"exact":"atLeast"}:${Math.round(q/20*100)/100}`}),N=(()=>{if(!D)return null;let[v,w]=D.split(":");return {rule:v,value:Number(w)}})(),E=v=>L(w=>{let q=Number(g(w)?.[v]);return Number.isFinite(q)?Math.round(q/20*100)/100:null}),T=(()=>{let v=I.map($=>Kg(e,$)),w=v[0];if(!w||v.some($=>$===null||$.inTable))return null;let q=$=>Math.round($*20),z=$=>q($.hanging>0?-$.hanging:$.firstLine),X=v,Y=q(w.indent.left),F=q(w.indent.right),re=z(w.indent);return {left:Y,right:F,firstLine:re,mixed:{left:X.some($=>q($.indent.left)!==Y),right:X.some($=>q($.indent.right)!==F),firstLine:X.some($=>z($.indent)!==re)}}})();return {bold:i.length>0&&i.every(v=>v.bold),italic:i.length>0&&i.every(v=>v.italic),underline:i.length>0&&i.every(v=>v.underline!==null),strikethrough:i.length>0&&i.every(v=>v.strike),superscript:i.length>0&&i.every(v=>v.verticalAlign==="superscript"),subscript:i.length>0&&i.every(v=>v.verticalAlign==="subscript"),fontFamily:a.length>0?d(a.map(h)):S?.fontFamily??null,fontSizeHalfPoints:a.length>0?d(a.map(P)):S?.fontSizeHalfPoints??null,color:l(v=>v.color),highlight:l(v=>v.highlight),alignment:O,styleId:k,lineSpacing:N,spaceBeforePt:E("before"),spaceAfterPt:E("after"),indent:T}}function Vg(e,t){if(t.anchor.paragraphId===t.head.paragraphId)return [t.head.paragraphId];let n=fc$1(e),r=n.indexOf(t.anchor.paragraphId),o=n.indexOf(t.head.paragraphId);return r===-1||o===-1?[t.head.paragraphId]:n.slice(Math.min(r,o),Math.max(r,o)+1)}function lu(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 du(e){let{session:t,commit:n,orderedRange:r,selectionMark:o,textOf:a}=e,i=()=>t.partFor(e.storyScope())??t.part(),l=(I,L,O)=>t.applyTreeOps(I,L,O,e.storyScope()),d={get value(){return e.layout()}},u={get value(){return e.selection()}},h=(I,L,O)=>{let k=i();if(I.paragraphId===L.paragraphId){let T=jo(k,I.paragraphId,I.offset,L.offset,O);if(T.length===0)return;let v=gg$1(fg$1(k,I.paragraphId),O);n(()=>l([...T.map(w=>({op:"setRunProperties",paragraphId:I.paragraphId,start:w.start,end:w.end,properties:w.properties,...w.targetRunIds?{targetRunIds:w.targetRunIds}:{}})),...lu(a(I.paragraphId),I,L,v)],o()));return}let g=e.paragraphOrder(),D=g.indexOf(I.paragraphId),N=g.indexOf(L.paragraphId);if(D===-1||N===-1)return;let E=[];for(let T=D;T<=N;T+=1){let v=g[T],w=a(v),q=T===D?I.offset:0,z=T===N?L.offset:w.length,X=q<z?jo(k,v,q,z,O):[];for(let F of X)E.push({op:"setRunProperties",paragraphId:v,start:F.start,end:F.end,properties:F.properties,...F.targetRunIds?{targetRunIds:F.targetRunIds}:{}});(T<N||q===0&&z===w.length&&w.length>0)&&E.push({op:"setParagraphMarkProperties",paragraphId:v,properties:gg$1(fg$1(k,v),O)});}E.length!==0&&n(()=>l(E,o()));},P=(I,L)=>{let O=i(),k=[];for(let g of Nd(d.value,I)){let D=a(g);for(let N of jo(O,g,0,D.length,L))k.push({op:"setRunProperties",paragraphId:g,start:N.start,end:N.end,properties:N.properties,...N.targetRunIds?{targetRunIds:N.targetRunIds}:{}});k.push({op:"setParagraphMarkProperties",paragraphId:g,properties:gg$1(fg$1(O,g),L)});}return k.length===0?false:(n(()=>l(k,o()),void 0,{keepCellSelection:true}),true)},S=I=>{bg$1(I.localName)&&e.setPendingFormats(gg$1(e.pendingFormats()??[],I));};return {setRunProperty(I,L){let O={localName:I,...L?{attributes:L}:{}},k=e.selectedCells?.();if(k&&k.length>0){P(k,O);return}let{from:g,to:D}=r();if(g.paragraphId===D.paragraphId&&g.offset===D.offset){S(O);return}h(g,D,O);},setParagraphProperty(I,L,O){let{from:k,to:g}=r(),D=e.paragraphOrder(),N=D.indexOf(k.paragraphId),E=D.indexOf(g.paragraphId);if(N===-1||E===-1)return;let T=i(),v=D.slice(N,E+1).map(w=>{let q=eg$1(T,w),z=O?.mergeAttributes?{...q.find(Y=>Y.localName===I)?.attributes??{},...L}:L??{},X=Object.fromEntries(Object.entries(z).filter(([,Y])=>Y!=null));return {op:"setParagraphProperties",paragraphId:w,properties:gg$1(q,{localName:I,...Object.keys(X).length>0?{attributes:X}:{}})}});v.length!==0&&n(()=>l(v,o()));},formatting:()=>au(su(d.value,u.value,(I,L)=>{let O=t.effectiveRunDefaults(I,L);if(O.fontFamily!==null)return O;let k=e.defaultFontFamily?.()??null;return k===null?O:{...O,fontFamily:k}},e.selectedCells?.(),e.defaultParagraphStyleId?.()??null),e.pendingFormats()),toggleRunProperty(I,L){let O=e.selectedCells?.(),k=L?.val,g=Kn(e.pendingFormats(),I,k)??_i(d.value,u.value,I,O,k),D=g?{localName:I,attributes:{val:jg[I]??"0"}}:{localName:I,...L?{attributes:L}:{}};if(O&&O.length>0){P(O,D);return}let{from:N,to:E}=r();if(N.paragraphId===E.paragraphId&&N.offset===E.offset){let T=e.pendingFormats()??[],v=_i(d.value,u.value,I,void 0,k);if(!g===v){let w=T.filter(q=>q.localName!==I);e.setPendingFormats(w.length>0?w:null);}else S(D);return}h(N,E,D);},clearFormatting(){e.setPendingFormats(null);let I=d.value,L=e.paragraphOrder(),O=e.selectedCells?.(),k=O&&O.length>0?[...Nd(I,O)]:Ug(L,r());if(k.length===0)return;let{from:g,to:D}=r(),N=O!==void 0&&O.length>0,E=i(),T=[];for(let v of k){let w=a(v),q=N||v!==g.paragraphId?0:g.offset,z=N||v!==D.paragraphId?w.length:D.offset;q<z&&ru(E,v,q,z)&&T.push({op:"setRunProperties",paragraphId:v,start:q,end:z,properties:[]}),fg$1(E,v).length>0&&T.push({op:"setParagraphMarkProperties",paragraphId:v,properties:[]}),eg$1(E,v).length>0&&T.push({op:"setParagraphProperties",paragraphId:v,properties:[]});}T.length!==0&&n(()=>l(T,o()),void 0,{keepCellSelection:N});}}}var jg={u:"none",vertAlign:"baseline"};function Ug(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 Wg=Object.freeze({kind:"body"});function Uo(e,t){if(e)return {kind:"headerFooter",rId:e.scope.rId};if(t){let n=fd(t.id);if(n)return {kind:"notesPart",noteKind:n.noteKind}}return {kind:"body"}}function uu(e,t){return e?e.scope:t||Wg}function Gg(e,t,n){if(n){let o=[];for(let a of [e.footnotes,e.endnotes])if(a)for(let i of a.notes)i.scopeId===n&&o.push(...cu(i.fragments));return o}if(!t)return R(e);let r=Vn(e,t);return r?cu(r.fragments):[]}function Vn(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 fu(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 Zi(e,t){return !!(e.rId&&e.rId===t.scope.rId||!e.rId&&e.partName===t.partName&&e.kind===t.kind)}function Bi(e,t,n){let r=lc$1(e,t.y),o=e.pages[r];if(!o)return false;let a=t.x-n(r),i=t.y,l=o.contentBox;return a>=l.x&&a<l.x+l.width&&i>=l.y&&i<l.y+l.height}function qi(e,t,n,r,o={}){return oc$1(e,t,n.fragments,r,o)}function $g(e,t,n){let r=e.pages[t.pageIndex]??e.pages[0];if(!r)return null;let o=Vn(r,t);return o?Dd(e,t.pageIndex,o.fragments,n):null}function Xg(e,t,n){let r=[];for(let o of e.pages)for(let a of [o.footnotes,o.endnotes]){let i=a?.notes.find(l=>l.scopeId===t);i&&r.push(...Dd(e,o.index,i.fragments,n));}return r.length>0?r:null}function pu(e,t){return e.querySelector(`[data-page-index="${t}"] > [data-docx-hf-active]`)??e.querySelector("[data-docx-hf-active]")}function mu(e,t,n){let r=e.querySelectorAll("[data-docx-note-scope]"),o=null;for(let a of r){if(a.dataset.docxNoteScope!==t||!a.matches("[data-docx-note]"))continue;o??=a;let i=Number(a.closest("[data-page-index]")?.dataset.pageIndex);if(n!==null&&i===n)return a}return o}function gu(e,t,n){if((a=>{let i=e.pages[a];return !!i&&!!Vn(i,t)})(t.pageIndex)&&(n===void 0||n.has(t.pageIndex)))return t.pageIndex;let o=null;for(let a of e.pages)if(Vn(a,t)&&(o===null&&(o=a.index),n===void 0||n.has(a.index)))return a.index;return o??t.pageIndex}function hu(e){return e?{rId:e.scope.rId,pageIndex:e.pageIndex,kind:e.kind,partName:e.partName,variant:e.variant}:null}function yu(e,t,n){e.classList.toggle("docx-paginated-surface--hf-editing",n),t.classList.toggle("docx-pages--hf-editing",n);}function zi(e,t){e.classList.toggle("docx-paginated-surface--viewing",t==="view");}function Ki(e,t,n,r,o,a,i){let l=o?$g(e,o,i):a?Xg(e,a,i):null,d=Jd$2(e,t,n,r,{...i?{measurer:i}:{},...l?{stops:l}:{}});if(!d)return null;if(!l)return d;let u=l.find(h=>h.position.paragraphId===d.position.paragraphId&&h.position.offset===d.position.offset);return u?{...d,pageIndex:u.pageIndex}:d}function Vi(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of [r.footnotes,r.endnotes])if(a)for(let i of a.notes){let l=i.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:i.scopeId,noteKind:i.noteKind,noteId:i.noteId,local:{x:t.x-d,y:t.y-u},fragments:i.fragments}}}return null}function vu(e,t){let n=e[t],r=e.contentBox,o=e.box;if(t==="header"){let u=o.y,h=r.y,P=n?Math.max(h,n.box.y+n.box.height):h,S=n?Math.min(u,n.box.y):u;return P<=S?null:{x:r.x,y:S,width:r.width,height:P-S}}let a=r.y+r.height,i=o.y+o.height,l=n?Math.min(a,n.box.y):a,d=n?Math.max(i,n.box.y+n.box.height):i;return d<=l?null:{x:r.x,y:l,width:r.width,height:d-l}}function ji(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){if(r[a])continue;let i=vu(r,a);if(!i)continue;let l=i.x+o;if(t.x>=l&&t.x<l+i.width&&t.y>=i.y&&t.y<i.y+i.height)return {pageIndex:r.index,kind:a}}}return null}function Ui(e,t,n){for(let r of e.pages){let o=n(r.index);for(let a of ["header","footer"]){let i=r[a];if(!i)continue;let l=i.box,d=vu(r,a)??l,u=d.x+o,h=d.y;if(t.x>=u&&t.x<u+d.width&&t.y>=h&&t.y<h+d.height)return {pageIndex:r.index,kind:a,story:i,local:{x:t.x-(l.x+o),y:t.y-l.y}}}}return null}function jn(e,t,n){if(!t&&!n)return fc$1(e);let r=new Set,o=[];for(let a of e.pages)for(let i of Gg(a,t,n)){for(let l of i.lines)for(let d of gc$1(l))r.has(d.paragraphId)||(r.add(d.paragraphId),o.push(d.paragraphId));i.lines.length===0&&!r.has(i.paragraphId)&&(r.add(i.paragraphId),o.push(i.paragraphId));}return o}function Wo(e,t,n,r){let o=jn(e,n,r);if(o.length===0)return t;let a=new Set(o),i=l=>a.has(l.paragraphId)?l:{paragraphId:o[0],offset:0};return {anchor:i(t.anchor),head:i(t.head)}}function cu(e){let t=[],n=r=>{for(let o of r){if(o.kind==="paragraph"){t.push(o);continue}for(let a of o.rows)if(!a.isHeaderRepeat)for(let i of a.cells)n(i.blocks);}};return n(e),t}var Yg=500,bu=4,Un=40,Go=12;function Qg(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 xu(e,t){return Qg(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 ht(e,t,n){let r=fc$1(e),o=r.indexOf(t.paragraphId),a=r.indexOf(n.paragraphId);return o!==a?o-a:t.offset-n.offset}function ku(e,t,n){if(!(t>Ob))for(let r of e){if(r.kind==="paragraph"){n(r);continue}if(!(t>=Ob)){for(let o of r.rows)if(!o.isHeaderRepeat)for(let a of o.cells)ku(a.blocks,t+1,n);}}}function Wi(e,t){if(!t.placeholder||t.fragments.length===0)return null;let n=null,r=null,o=(i,l)=>{(!n||ht(e,i,n)<0)&&(n=i),(!r||ht(e,l,r)>0)&&(r=l);},a=t.level!=="inline";for(let i of t.fragments){let l=e.pages[i.pageIndex];l&&ku(l.fragments,0,d=>{if(xu(i.box,d.box)){if(a){let u=Id$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 h of u.spans)xu(i.box,h.box)&&o({paragraphId:h.range.paragraphId,offset:h.range.start},{paragraphId:h.range.paragraphId,offset:h.range.end});}});}return !n||!r?null:{from:n,to:r}}function Jg(e,t){return (e.contentControls??[]).find(n=>n.id===t)??null}function Iu(e,t){let n=t.contentControlId;if(!n){let o={x:t.caret.x,y:t.caret.y+t.caret.height/2},a=qc$1(e,t.pageIndex,o);return a?.placeholder?a:null}let r=Jg(e,n);return r?.placeholder?r:null}function Su(e,t){let n=e.contentControls??[];if(n.length===0)return t;let r=ht(e,t.anchor,t.head)<=0?t.anchor:t.head,o=ht(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=Wi(e,l);!d||!(ht(e,r,o)===0?ht(e,r,d.from)>=0&&ht(e,r,d.to)<0:ht(e,r,d.to)<0&&ht(e,o,d.from)>0)||(ht(e,d.from,r)<0&&(r=d.from,a=true),ht(e,d.to,o)>0&&(o=d.to,a=true));}}return ht(e,t.anchor,t.head)<=0?{anchor:r,head:o}:{anchor:o,head:r}}function Tu(e,t={}){if(t.mode==="native")return {dragging:()=>false,destroy:()=>{}};let{pagesLayer:n,container:r}=e,o=n.ownerDocument,a=o.defaultView,i=null,l=null,d=0,u=0,h=0,P=0,S=null;function I(A,G){if(!l){let x=n.getBoundingClientRect();l={left:x.left,top:x.top};}let y=e.scale()||1;return {x:(A-l.left)/y,y:(G-l.top)/y}}function L(A){return {scope:{kind:"headerFooter",rId:A.rId},pageIndex:A.pageIndex,kind:A.kind,partName:A.partName,variant:A.variant}}function O(A,G){let y=e.layout(),x=I(A,G),Z=lc$1(y,x.y),M=y.pages[Z];if(!M)return null;let B=e.measurer();return nc$1(y,Z,{x:x.x-M.contentBox.x-e.pageOffsetX(Z),y:x.y-M.contentBox.y},B?{measurer:B}:{})}function k(A,G){let y=e.activeNote?.()??null;if(y){let te=e.layout(),ee=Vi(te,I(A,G),e.pageOffsetX);if(!ee||ee.scopeId!==y.scopeId)return null;let le=e.measurer();return oc$1(te,ee.pageIndex,ee.fragments,ee.local,{...le?{measurer:le}:{}})}let x=e.activeHeaderFooter?.()??null;if(!x)return O(A,G);let Z=e.layout(),M=I(A,G),B=Ui(Z,M,e.pageOffsetX);if(B&&Zi(B.story,L(x))){let te=e.measurer();return qi(Z,B.pageIndex,B.story,B.local,te?{measurer:te}:{})}return null}function g(A,G){let{story:y,pageIndex:x,kind:Z}=A;return {rId:y.rId,pageIndex:x,kind:Z,partName:y.partName,variant:y.variant,...G?{position:G}:{}}}function D(A){let G=e.measurer();return qi(e.layout(),A.pageIndex,A.story,A.local,G?{measurer:G}:{})?.position??void 0}let N=new WeakMap;function E(A,G){let y=e.activeNote?.();if(y){let B=jn(A,null,y.scopeId).indexOf(G);return B===-1?-1:B}let x=e.activeHeaderFooter?.();if(x){let B=jn(A,L(x)).indexOf(G);return B===-1?-1:B}let Z=N.get(A);return Z||(Z=new Map(fc$1(A).map((M,B)=>[M,B])),N.set(A,Z)),Z.get(G)??-1}function T(A,G,y){let x=E(A,G.paragraphId),Z=E(A,y.paragraphId);return x!==Z?x<Z:G.offset<y.offset}let v=/[\p{L}\p{N}_'’]/u,w=A=>A!==void 0&&v.test(A);function q(A,G,y){if(y==="character")return {from:G,to:G};let x=Id$1(A,G.paragraphId),Z=G.paragraphId;if(y==="paragraph")return {from:{paragraphId:Z,offset:0},to:{paragraphId:Z,offset:x.length}};let M=Math.max(0,Math.min(G.offset,x.length)),B=-1;if(w(x[M])?B=M:M>0&&w(x[M-1])&&(B=M-1),B===-1){let te=M,ee=M;for(;te>0&&/\s/.test(x[te-1]??"");)te-=1;for(;ee<x.length&&/\s/.test(x[ee]??"");)ee+=1;return te===ee&&ee<x.length&&(ee+=1),{from:{paragraphId:Z,offset:te},to:{paragraphId:Z,offset:ee}}}return {from:{paragraphId:Z,offset:Bd$1(x,B+1,-1)},to:{paragraphId:Z,offset:Bd$1(x,B,1)}}}function z(A,G,y,x,Z){let M=Z?Iu(A,Z):null,B=M?Wi(A,M)??q(A,y,x):q(A,y,x),te=T(A,B.from,G.from)?{anchor:G.to,head:B.from}:{anchor:G.from,head:B.to};return Su(A,te)}let X=r.closest(".docx-editor__scroll-container");function Y(){return r.closest(".docx-editor__scroll-container")}function F(A,G,y){if(y<A+Un){let x=Math.max(0,A+Un-y);return -Math.min(Go,x/Un*Go)}if(y>G-Un){let x=Math.max(0,y-(G-Un));return Math.min(Go,x/Un*Go)}return 0}function re(){S!==null&&(a?.cancelAnimationFrame(S),S=null);}function $(){S=null;let A=i,G=Y();if(!A||!G||!a)return;let y=G.getBoundingClientRect(),x=F(y.top,y.bottom,A.clientY);x!==0&&(G.scrollTop+=x,l=null,fe(A.clientX,A.clientY),S=a.requestAnimationFrame($));}function Te(){if(S!==null||!a||!i)return;let A=Y();if(!A)return;let G=A.getBoundingClientRect();F(G.top,G.bottom,i.clientY)!==0&&(S=a.requestAnimationFrame($));}function fe(A,G){let y=i;if(!y)return;let x=k(A,G);x&&(e.isReadOnlyParagraph?.(x.position.paragraphId)||Pe(y,x)||e.setSelection(z(e.layout(),y.anchorRange,x.position,y.granularity,x)));}function Pe(A,G){let y=A.anchorCell;if(!y)return false;if(!G.cell||G.cell.tableId!==y.tableId)return A.cellDragging;if(!A.cellDragging&&G.cell.cellId===y.cellId)return false;let x=Md$1(e.layout(),y,G.cell);return x?(A.cellDragging=true,e.setCellSelection(x),true):A.cellDragging}function be(A){let G=Date.now(),y=G-u;return d=Math.abs(A.clientX-h)<=bu&&Math.abs(A.clientY-P)<=bu&&y>=0&&y<=Yg?d+1:1,u=G,h=A.clientX,P=A.clientY,d}let We=["character","word","paragraph"],at=A=>{if(A.button!==0)return;let G=A.target?.closest?.("[data-docx-cc-widget]");if(G){if(A.preventDefault(),A.stopPropagation(),G.hasAttribute("disabled")||G.dataset.disabledReason)return;let ue=G.dataset.docxCcId,ge=G.dataset.docxCcWidget;ue&&ge&&e.onContentControlWidget?.(ue,ge);return}if(A.pointerType==="touch")return;i&&Me(),l=null;let y=e.layout(),x=I(A.clientX,A.clientY),Z=e.activeHeaderFooter?.()??null,M=e.activeNote?.()??null,B=Ui(y,x,e.pageOffsetX),te=Vi(y,x,e.pageOffsetX),ee=A.target?.closest("[data-docx-hf]"),le=!!(ee||B),Le=A.target,He=Le?.closest("[data-docx-note-ref]"),it=Le?.closest("[data-docx-note-mark-back]"),Ce=null,ze=()=>Ce??=be(A);if(He?.dataset.docxNoteScope){A.preventDefault(),e.focus(),e.enterNote?.(He.dataset.docxNoteScope);return}if(it){A.preventDefault(),e.focus(),e.exitNote?.(true);return}if(te&&!le){let ue=e.measurer?.(),ge=oc$1(y,te.pageIndex,te.fragments,te.local,{...ue?{measurer:ue}:{}});if(!M||M.scopeId!==te.scopeId){A.preventDefault(),e.focus(),e.enterNote?.(te.scopeId,ge?{paragraphId:ge.position.paragraphId,offset:ge.position.offset}:void 0,te.pageIndex);return}if(M.pageIndex!==te.pageIndex){A.preventDefault(),e.focus(),e.enterNote?.(te.scopeId,ge?{paragraphId:ge.position.paragraphId,offset:ge.position.offset}:void 0,te.pageIndex);return}}else if(M){if(!Bi(y,x,e.pageOffsetX))return;e.exitNote?.(false),e.focus();}if(Z)if(B&&Zi(B.story,L(Z)))B.pageIndex!==Z.pageIndex&&e.enterHeaderFooter?.(g(B,D(B)));else if(B&&B.story.rId){A.preventDefault(),e.focus(),e.enterHeaderFooter?.(g(B,D(B)));return}else if(Bi(y,x,e.pageOffsetX)){A.preventDefault(),e.exitHeaderFooter?.(true),e.focus();return}else {let ue=ze()>=2?ji(y,x,e.pageOffsetX):null;ue&&(A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ue.kind,ue.pageIndex));return}else if(le&&ze()>=2){if(B?.story.rId)A.preventDefault(),e.focus(),e.enterHeaderFooter?.(g(B,D(B)));else if(ee instanceof HTMLElement){let ue=ee.dataset.docxRId,ge=ee.dataset.docxHf,Et=ee.closest("[data-page-index]")?.getAttribute("data-page-index"),vt=Et!=null?Number(Et):NaN;if((ge==="header"||ge==="footer")&&Number.isInteger(vt))if(ue){let jt=y.pages[vt]?.[ge];A.preventDefault(),e.focus(),e.enterHeaderFooter?.({rId:ue,pageIndex:vt,kind:ge,partName:jt?.partName??"",variant:jt?.variant??"default"});}else y.pages[vt]?.[ge]||(A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ge,vt));}return}else if(ze()>=2){let ue=ji(y,x,e.pageOffsetX);if(ue){A.preventDefault(),e.focus(),e.enterEmptyHeaderFooter?.(ue.kind,ue.pageIndex);return}}let Re=k(A.clientX,A.clientY);if(!Re)return;if(e.isReadOnlyParagraph?.(Re.position.paragraphId)){A.preventDefault();return}A.preventDefault(),e.focus();try{n.setPointerCapture(A.pointerId);}catch{}o.addEventListener("pointermove",Se),o.addEventListener("pointerup",yt),o.addEventListener("pointercancel",yt);let In=ze(),Rt=A.shiftKey?"character":We[(In-1)%We.length],Ve=Iu(y,Re);if(Ve&&!A.shiftKey){if(e.selectContentControl?.(Ve.id)){let ge=e.selection(),Et=T(y,ge.anchor,ge.head)||ge.anchor.paragraphId===ge.head.paragraphId&&ge.anchor.offset===ge.head.offset?{from:ge.anchor,to:ge.head}:{from:ge.head,to:ge.anchor};i={pointerId:A.pointerId,granularity:"character",anchorRange:Et,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY};return}let ue=Wi(y,Ve);if(ue){i={pointerId:A.pointerId,granularity:"character",anchorRange:ue,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},Ge(()=>e.setSelection({anchor:ue.from,head:ue.to}));return}}if(A.shiftKey){let ue=e.selection();i={pointerId:A.pointerId,granularity:Rt,anchorRange:{from:ue.anchor,to:ue.anchor},anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},Ge(()=>e.setSelection(z(y,{from:ue.anchor,to:ue.anchor},Re.position,Rt,Re)));}else {let ue=q(y,Re.position,Rt);i={pointerId:A.pointerId,granularity:Rt,anchorRange:ue,anchorCell:Re.cell,cellDragging:false,clientX:A.clientX,clientY:A.clientY},Ge(()=>e.setSelection(Su(y,{anchor:ue.from,head:ue.to})));}};function Ge(A){try{A();}catch(G){throw Me(),G}}let Se=A=>{let G=i;!G||A.pointerId!==G.pointerId||(A.preventDefault(),G.clientX=A.clientX,G.clientY=A.clientY,fe(A.clientX,A.clientY),Te());},yt=A=>{let G=i;if(!G||A.pointerId!==G.pointerId)return;Me();try{n.releasePointerCapture(G.pointerId);}catch{}let y=e.cellSelection();y?e.setCellSelection(y):e.setSelection(e.selection());};function Me(){if(i)try{n.releasePointerCapture(i.pointerId);}catch{}i=null,l=null,re(),o.removeEventListener("pointermove",Se),o.removeEventListener("pointerup",yt),o.removeEventListener("pointercancel",yt);}let qe=()=>{l=null;};return n.addEventListener("pointerdown",at),X?.addEventListener("scroll",qe,{passive:true}),a?.addEventListener("scroll",qe,{capture:true,passive:true}),a?.addEventListener("resize",qe,{passive:true}),{dragging:()=>i!==null,destroy(){Me(),n.removeEventListener("pointerdown",at),X?.removeEventListener("scroll",qe),a?.removeEventListener("scroll",qe,{capture:true}),a?.removeEventListener("resize",qe);}}}function eh(e,t){let n=Math.max(0,e.end-e.start);return e.start+Math.max(0,Math.min(t,n))}var Ru=/^[^\s]{1,512}$/,th=/["\\\u0000-\u001f\u007f]/;function $o(e){let t=e.dataset?.paragraphId,n=e.dataset?.start;if(!t||n===void 0||!/^\d{1,9}$/.test(n)||!Ru.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 Eu(e,t,n){return th.test(t)?e.querySelectorAll(`[data-paragraph-id]${n}`):e.querySelectorAll(`[data-paragraph-id="${t}"]${n}`)}function Fu(e){let t=e.nodeType===Node.TEXT_NODE?e.parentNode:e;for(;t&&t.nodeType===Node.ELEMENT_NODE;){let n=$o(t);if(n)return {element:t,identity:n};t=t.parentNode;}return null}function Ou(e){return e.querySelector("[data-docx-hf-active]")}function nh(e){let t=Ou(e);return t?[t,e]:[e]}function wu(e,t){let n=Fu(e);if(n)return n;if(e.nodeType!==Node.ELEMENT_NODE)return null;let r=e.querySelectorAll("[data-paragraph-id][data-start]"),o=t?[...r].reverse():[...r];for(let a of o){let i=$o(a);if(i)return {element:a,identity:i}}return null}function rh(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=wu(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=wu(n[r],true);if(o)return {paragraphId:o.identity.paragraphId,offset:o.identity.end}}return null}function Pu(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")||Ou(n)&&r?.closest(".docx-page-content"))return null;let a=r?.closest("[data-docx-marker]");if(a)return a.parentElement?Au(a.parentElement):null;if(r?.closest("[data-docx-tab-leader]"))return null;if(e.nodeType===Node.ELEMENT_NODE){let l=e,d=$o(l);if(d)return {paragraphId:d.paragraphId,offset:t>0?d.end:d.start};let u=rh(l,t);return u||sh(l)}let i=Fu(e);return i?{paragraphId:i.identity.paragraphId,offset:eh(i.identity,t)}:null}function zr(e,t){if(!t||t.rangeCount===0)return null;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:a}=t;if(!n||!o)return null;let i=Pu(n,r,e),l=Pu(o,a,e);if(!i||!l){let d=i??l;return d?{anchor:d,head:d}:null}return {anchor:i,head:l}}function Mu(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 Cu(e,t){for(let n of nh(e)){let r=oh(n,t);if(r)return r}return null}function oh(e,t){let n=Eu(e,t.paragraphId,"[data-start]"),r=null;for(let a of n){let i=$o(a);if(!i||i.paragraphId!==t.paragraphId)continue;let l=ah(a),d=a.textContent?.length??0,u=i.end;if(l&&t.offset>=i.start&&t.offset<=u){let h={node:l,offset:Math.min(t.offset-i.start,d)};if(t.offset<u)return h;r=h;}}if(r)return r;let o=ih(e,t.paragraphId);return o?{node:o,offset:0}:null}function ah(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 ih(e,t){let n=null;for(let r of Eu(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 Au(e){let t=e.closest("[data-paragraph-id]");if(!t||t.dataset.start!==void 0)return null;let n=t.dataset.paragraphId;return !n||!Ru.test(n)||n==="__proto__"?null:{paragraphId:n,offset:0}}function sh(e){let t=Au(e);return !t||e.closest("[data-paragraph-id]").querySelector("[data-paragraph-id][data-start]")?null:t}function Lu(e,t,n){if(!n)return false;let r=Cu(e,t.anchor),o=Cu(e,t.head);if(!r||!o)return false;let a=zr(e,n);if(a&&Wn(a,t))return true;try{return n.setBaseAndExtent(r.node,r.offset,o.node,o.offset),!0}catch{return false}}function Wn(e,t){return e.anchor.paragraphId===t.anchor.paragraphId&&e.anchor.offset===t.anchor.offset&&e.head.paragraphId===t.head.paragraphId&&e.head.offset===t.head.offset}function Hu(e){let{document:t,pagesLayer:n,session:r}=e,o=false,a=null,i=false,l=false,d=false,u=null;function h(){let k=zr(n,t.getSelection());return !k||Wn(k,e.selection())?false:(e.adoptSelection(k),true)}function P(){let k=t.activeElement;if(k&&n.contains(k))return true;let g=t.getSelection();if(!g||g.rangeCount===0)return true;let D=g.anchorNode;return !D||!D.isConnected?true:n.contains(D)}let S=()=>{let k=t.getSelection(),g=zr(n,k);if(!g){if(!Mu(n,k))return;i=false;let D=Fe(e.selection().head);if(Wn(D,e.selection()))return;e.setSelection(D);return}i=false,!Wn(g,e.selection())&&e.setSelection(g);};function I(k){let g=e.textOf(k),D=Hc(n,k,g);if(D===null)return;let N=Dc(k,g,D);if(!N)return;let E=N.ops.find(w=>w.op==="insertText"),T=E?e.pendingFormatOps?.(k,E.offset,E.text.length)??[]:[],v=e.storyScope();e.commit(()=>{let w=r.applyTreeOps([...N.ops,...T],e.selectionMark(),void 0,v);return T.length===0||!w.rejected?w:r.applyTreeOps(N.ops,e.selectionMark(),void 0,v)}),e.setSelection(Fe({paragraphId:k,offset:N.caret}));}function L(){if(!l||!a||i)return false;let k=zr(n,t.getSelection());return k!==null&&Wn(k,a)}function O(k){k instanceof PointerEvent&&k.button!==0||(i=true);}return n.addEventListener("pointerdown",O,true),n.addEventListener("selectstart",O,true),{adoptBeforePaint(){let k=e.holdsCellSelection?.()===true||e.isGesturing?.()===true,g=l||k?false:h();return l=false,g},noteModelMoved(){l=true;},noteSelectionSettled(){l=false;},mirrorToDom(k=false){if(e.updateCaret(),!k&&!P())return;o=true;let g=e.now(),D=e.domSelection?.()??e.selection();a=D,i=false,Lu(n,D,t.getSelection()),e.recordSelectionMs(e.now()-g),queueMicrotask(()=>{o=false;});},adoptBeforeInput(){o||d||e.isGesturing?.()||e.holdsCellSelection?.()||L()||S();},isComposing:()=>d,onSelectionChange:()=>{o||d||e.isGesturing?.()||e.holdsCellSelection?.()||L()||S();},onCompositionStart:()=>{d=true,u=e.selection().head.paragraphId,r.beginComposition(e.storyScope());},onCompositionEnd:()=>{d=false;let k=u??e.selection().head.paragraphId;u=null,I(k),r.endComposition(),e.flushLayout(),e.render();},destroy(){n.removeEventListener("pointerdown",O,true),n.removeEventListener("selectstart",O,true),i=false;}}}function lh(e,t){let n={...e??{}};return e?.start!==void 0&&(n.start=t),(e?.start===void 0||e.left!==void 0)&&(n.left=t),n}function Du(e,t,n,r){let o={...e};if(r===null)return delete o[t],delete o[n],o;let a=String(r),i=e[n]!==void 0;return i&&(o[n]=a),(!i||e[t]!==void 0)&&(o[t]=a),o}function dh(e,t){let n={...e};return 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 Nu(e){let{session:t,commit:n,orderedStart:r,orderedRange:o,selectionMark:a,collapsedAt:i}=e,l=e.deleteSelectionPlan,d=()=>t.partFor(e.storyScope())??t.part(),u=(T,v,w)=>t.applyTreeOps(T,v,w,e.storyScope()),h=()=>e.paragraphOrder(),P={get value(){return e.layout()}},S=720,I=8;function L(T){return O(T)?.level??null}function O(T){return jc$1(P.value,T)?.marker??null}function k(T){let v=O(T);return v?v.numFmt==="bullet"?"bullet":"ordered":null}function g(T,v){let w=h(),q=w.indexOf(T[0]??""),z=w.indexOf(T[T.length-1]??"");if(q===-1||z===-1)return null;for(let X of [q-1,z+1]){let Y=w[X];if(!Y)continue;let F=O(Y);if(F&&(F.numFmt==="bullet"?"bullet":"ordered")===v)return F.numId}return null}function D(T,v){return v<0||v>I?false:e.numberingLevelExists(T.numId,v)}function N(T,v){return v<0||v>I?false:e.numberingLevelExists(T.numId,v)?true:t.ensureNumberingLevel(T.numId,v,T.numFmt==="bullet"?"bullet":"ordered")&&e.numberingLevelExists(T.numId,v)}function E(T){let v=T.find(q=>q.localName==="ind"),w=v?.attributes?.left??v?.attributes?.start;return !w||!/^-?\d{1,7}$/.test(w)?0:Number(w)}return {insertTab(){let T=l(),v=T.collapseTo;n(()=>u([...T.ops,{op:"insertTab",paragraphId:v.paragraphId,offset:v.offset}],a()),()=>i({...v,offset:v.offset+1}));},insertLineBreak(){let T=l(),v=T.collapseTo;n(()=>u([...T.ops,{op:"insertHardBreak",paragraphId:v.paragraphId,offset:v.offset}],a()),()=>i({...v,offset:v.offset+1}));},insertPageBreak(){let T=l(),v=T.collapseTo;n(()=>u([...T.ops,{op:"insertPageBreak",paragraphId:v.paragraphId,offset:v.offset}],a()),()=>i({...v,offset:v.offset+1}));},exitListOnEmptyItem(){let{from:T,to:v}=o();if(T.paragraphId!==v.paragraphId||T.offset!==v.offset)return false;let w=O(T.paragraphId);if(!w||e.paragraphTextOf(T.paragraphId).length>0)return false;let X=w.level>0&&D(w,w.level-1)?{op:"setListLevel",paragraphId:T.paragraphId,level:w.level-1}:{op:"setListNumbering",paragraphId:T.paragraphId,numId:null},Y=false;return n(()=>{let F=u([X],a());return Y=F.committed,F}),Y},isListParagraph(){let{paragraphId:T}=r();return L(T)!==null},isListActive(T){let{from:v,to:w}=o(),q=h(),z=q.indexOf(v.paragraphId),X=q.indexOf(w.paragraphId);if(z===-1||X===-1)return false;let Y=T==="bullet"?"bullet":"ordered",F=q.slice(z,X+1);return F.length>0&&F.every(re=>k(re)===Y)},toggleList(T){let{from:v,to:w}=o(),q=h(),z=q.indexOf(v.paragraphId),X=q.indexOf(w.paragraphId);if(z===-1||X===-1)return false;let Y=q.slice(z,X+1);if(Y.length===0)return false;let F=Y.every(fe=>k(fe)===T),re=F?null:g(Y,T)??t.ensureListDefinition(T);if(!F&&re===null)return false;let $=Y.map(fe=>({op:"setListNumbering",paragraphId:fe,numId:re})),Te=false;return n(()=>{let fe=u($,a());return Te=fe.committed,fe}),Te},canAdjustIndent(T){let{from:v,to:w}=o(),q=h(),z=q.indexOf(v.paragraphId),X=q.indexOf(w.paragraphId);if(z===-1||X===-1)return false;let Y=T==="increase"?1:-1;return q.slice(z,X+1).some(F=>{let re=O(F);if(re){let Te=re.level+Y;return Te>=0&&Te<=I}let $=E(Vo(P.value,F));return Math.max(0,$+Y*S)!==$})},adjustIndent(T){let{from:v,to:w}=o(),q=h(),z=q.indexOf(v.paragraphId),X=q.indexOf(w.paragraphId);if(z===-1||X===-1)return false;let Y=T==="increase"?1:-1,F=[];for(let $ of q.slice(z,X+1)){let Te=Vo(P.value,$),fe=O($),Pe=fe?.level??null;if(fe&&Pe!==null){let Se=Pe+Y;if(Se<0||Se>I||!N(fe,Se))continue;F.push({op:"setListLevel",paragraphId:$,level:Se});continue}let be=E(Te),We=Math.max(0,be+Y*S);if(We===be)continue;let at=eg$1(d(),$),Ge=at.find(Se=>Se.localName==="ind");F.push({op:"setParagraphProperties",paragraphId:$,properties:gg$1(at,{localName:"ind",attributes:lh(Ge?.attributes,String(We))})});}if(F.length===0)return false;let re=false;return n(()=>{let $=u(F,a());return re=$.committed,$}),re},setIndent(T){if(T.left===void 0&&T.right===void 0&&T.firstLine===void 0)return false;let{from:v,to:w}=o(),q=fc$1(P.value),z=q.indexOf(v.paragraphId),X=q.indexOf(w.paragraphId);if(z===-1||X===-1)return false;let Y=[];for(let re of q.slice(z,X+1)){let $=eg$1(t.part(),re),fe={...$.find(Pe=>Pe.localName==="ind")?.attributes??{}};T.left!==void 0&&(fe=Du(fe,"left","start",T.left)),T.right!==void 0&&(fe=Du(fe,"right","end",T.right)),T.firstLine!==void 0&&(fe=dh(fe,T.firstLine)),Y.push({op:"setParagraphProperties",paragraphId:re,properties:gg$1($,{localName:"ind",...Object.keys(fe).length>0?{attributes:fe}:{}})});}if(Y.length===0)return false;let F=false;return n(()=>{let re=t.applyTreeOps(Y,a());return F=re.committed,re}),F},sectionProperties:()=>Mc$1(t.part()),sectionPropertiesAt(T){let v=Nc$1(t.part());if(v.length===1)return v[0].properties;let w=Cb(t.part()),q=(Y,F)=>{if(Y.id===F)return true;for(let re of Y.children)if(re.kind!=="textValue"&&q(re,F))return true;return false},z=w.findIndex(Y=>Y.id===T||q(Y,T)),X=v[v.length-1];if(z!==-1)for(let Y of v)if(Y.blockStart<=z)X=Y;else break;return X.properties},setSectionProperties(T){let v=false;return n(()=>{let w=t.applyTreeOps([{op:"setSectionProperties",...T}],a(),void 0,{kind:"body"});return v=w.committed,w}),v},insertSectionBreak(){if(e.storyScope().kind!=="body")return false;let T=l(),v=T.collapseTo,w=new Set(t.paragraphIds()),q=false;return n(()=>{let z=t.applyTreeOps([...T.ops,{op:"splitParagraph",paragraphId:v.paragraphId,offset:v.offset},{op:"setSectionMark",paragraphId:v.paragraphId}],a(),void 0,{kind:"body"});return q=z.committed,z},()=>{let z=t.paragraphIds().find(X=>!w.has(X));return z?i({paragraphId:z,offset:0}):null}),q}}}var ch=4096;function uh(e){let t=e.tooltip!==null?{tooltip:l(e.tooltip)}:{};if(e.target!==null){let n=V(e.target);if(n.ok&&n.href.length>0&&s(n.href).ok){let o=e.anchor!==null&&!n.href.includes("#")?V(l(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:l(e.anchor)}:{},...t}}if(e.anchor===null)return null}if(e.anchor!==null){let n=l(e.anchor),r=V(n);return {kind:"internal",href:r.ok&&r.href.length>0?`#${r.href}`:null,authored:e.anchor,anchor:n,...t}}return null}function _u(){let e=new Map,t=new Map,n=0;return {project(r){let o=uh(r);if(!o)return null;let a=`${r.target??""}\0${r.anchor??""}\0${r.tooltip??""}`,i=e.get(a);if(i===void 0){if(e.size>=ch)return null;n+=1,i=`field-hyperlink:${n}`,e.set(a,i),t.set(i,Object.freeze({id:i,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:i,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 Bu=32;function $i(e){return e.kind!=="textValue"&&e.kind==="contentControl"}function Xi(e){return e.kind!=="textValue"&&e.kind==="contentControlContent"}function bn(e){return e.kind==="textValue"?[]:e.children}function Gi(e,t=0){return e.kind==="run"?[e]:e.kind==="hyperlink"?e.children.flatMap(n=>Gi(n,t)):$i(e)?t>=Bu?[]:bn(e).filter(n=>Xi(n)).flatMap(n=>bn(n).flatMap(r=>Gi(r,t+1))):[]}function Xo(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($i(e)){let n=0;for(let r of bn(e))if(Xi(r))for(let o of bn(r))n+=Xo(o);return n}let t=0;for(let n of bn(e))t+=Xo(n);return t}function qu(e,t,n){for(let r of e){if(r.kind==="hyperlink"){n(r);continue}if($i(r)){if(t>=Bu)continue;for(let o of bn(r))Xi(o)&&qu(bn(o),t+1,n);continue}n(r);}}function fh(e,t,n,r){let o=ph(e,t);if(!o||o.kind!=="paragraph")return [];let a=r(t),i=[],l=0;return qu(o.children,0,d=>{if(d.kind==="run"){l+=Xo(d);return}if(d.kind!=="hyperlink")return;let u=l;for(let P of Gi(d))l+=Xo(P);let h=Ua(d,n);i.push({id:d.id,paragraphId:t,start:u,end:l,text:a.slice(u,l),kind:h.kind,href:h.href,authored:h.authored,...h.anchor!==void 0?{anchor:h.anchor}:{},...h.tooltip!==void 0?{tooltip:h.tooltip}:{}});}),i}function ph(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 mh(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 gh(e,t){for(let n of V$1(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 zu(e){let t=()=>e.storyScope(),n=()=>e.session.partFor(t()),r=u=>e.session.relationshipTarget(u,t()),o=(u,h,P)=>e.session.applyTreeOps(u,h,P,t()),a=u=>{let h=n();return h?fh(h,u,r,e.textOf):[]},i=()=>mh(a(e.selection().head.paragraphId),e.selection().head),l=()=>{let u=e.selection().head,h=gh(e.layout(),u);return h===null?null:e.fieldLinkById(h)},d=u=>{let h=e.selection().head.paragraphId,P=a(h).find(S=>S.id===u);if(P)return P;for(let S of e.session.paragraphIdsIn(t())){let I=a(S).find(L=>L.id===u);if(I)return I}return null};return {linksInCaretParagraph:()=>a(e.selection().head.paragraphId),linkAtCaret:i,fieldLinkAtCaret:l,linkById:d,applyHyperlink(u){let h=u.url!==void 0&&u.url.length>0,P=u.anchor!==void 0&&u.anchor.length>0;if(h===P)return false;let S=t();if(!n()||e.refusesWrite())return false;let I;if(h){let z=e.session.ensureHyperlinkRelationship(u.url,S);if(!z)return false;I=z;}let L={...I!==void 0?{relationshipId:I}:{},...P?{anchor:u.anchor}:{},...u.tooltip!==void 0?{tooltip:u.tooltip}:{}},O=i(),k=e.orderedRange(),g=k.from.paragraphId===k.to.paragraphId&&k.from.offset===k.to.offset;if(O&&(g||yh(O,k))){let z=[{op:"setHyperlinkTarget",linkId:O.id,...L}];if(u.text!==void 0&&u.text!==O.text){let Y=Zu(O.paragraphId,O.start,O.end,u.text);if(!Y)return false;z.push(...Y);}let X=false;return e.commit(()=>{let Y=o(z,e.selectionMark());return X=Y.committed,Y},()=>null),X}let D=k.from.paragraphId;if(k.to.paragraphId!==D)return false;let N=[],E=k.from.offset,T=k.to.offset;if(g){let z=u.text??u.url??u.anchor??"";if(z.length===0)return false;N.push({op:"insertText",paragraphId:D,offset:E,text:z}),T=E+z.length;}else if(u.text!==void 0&&u.text!==e.textOf(D).slice(E,T)){let z=Zu(D,E,T,u.text);if(!z)return false;N.push(...z),T=E+u.text.length;}if(T<=E)return false;let v=hh(e.session);N.push({op:"insertHyperlink",paragraphId:D,start:E,end:T,...L,...v?{styleId:v}:{}});let w=false,q={paragraphId:D,offset:T};return e.commit(()=>{let z=o(N,e.selectionMark(),{paragraphId:D,start:T,end:T});return w=z.committed,z},()=>({anchor:q,head:q})),w},removeHyperlink(u){if(!n())return false;let h=u?d(u):i();if(!h)return false;let P=false,S={paragraphId:h.paragraphId,offset:h.end};return e.commit(()=>{let I=o([{op:"removeHyperlink",linkId:h.id}],e.selectionMark());return P=I.committed,I},()=>({anchor:S,head:S})),P}}}function hh(e){for(let t of e.documentStyles())if(t.type==="character"&&t.styleId.toLowerCase()==="hyperlink")return t.styleId;return null}function yh(e,t){return t.from.paragraphId===e.paragraphId&&t.to.paragraphId===e.paragraphId&&t.from.offset>=e.start&&t.to.offset<=e.end}function Zu(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 vh=24;function Ku(e){let{pagesLayer:t}=e,n=t.ownerDocument.defaultView;function r(){return e.container.closest(".docx-editor__scroll-container")}let o=S=>{if(!S||S.length===0||S.startsWith("#"))return false;let I=V(S);return !I.ok||!I.href||!n?false:(n.open(I.href,"_blank","noopener,noreferrer"),true)},a=S=>{let I=e.layout(),L=Ed$1(I,S);if(!L)return false;let O=I.pages[L.pageIndex];if(!O)return false;let k=O.box.y+(O.contentBox.y-O.box.y)+L.y,g=r();return g&&(g.scrollTop=Math.max(0,k*e.scale()-vh),e.onScrolled?.()),e.setSelection(S),true},i=S=>{let I=e.bookmarks().get(S);return I?a(I):false},l=null;function d(S){if(!S||S.closest("[data-docx-hf]"))return null;let I=S.closest("a.docx-hyperlink");if(I){let O=I.dataset.docxLink;return O?{linkId:O,drawing:false}:null}let L=S.closest("[data-docx-drawing-link]");if(L){let O=L.dataset.docxDrawingLink;return O?{linkId:O,drawing:true}:null}return null}let u=S=>{l=null;let I=S.target,L=d(I);if(!L)return;let k=I.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();l={linkId:L.linkId,drawing:L.drawing,rect:{left:k.left,top:k.top,bottom:k.bottom,right:k.right}};},h=S=>{let I=S.target,L=d(I);if(!L){let g=l;if(l=null,!g)return;S.preventDefault(),P(g.linkId,g.rect,S,g.drawing);return}l=null,S.preventDefault();let k=I.closest("[data-docx-drawing-link], a.docx-hyperlink").getBoundingClientRect();P(L.linkId,{left:k.left,top:k.top,bottom:k.bottom,right:k.right},S,L.drawing);};function P(S,I,L,O){let k=O?e.drawingLinkById?.(S)??null:e.linkById(S);if(!k)return;if(L.metaKey||L.ctrlKey){k.kind==="external"?o(k.href):k.anchor&&i(k.anchor);return}if(e.isCollapsedSelection()){if(k.kind==="internal"){k.anchor&&i(k.anchor);return}e.onPopover?.({link:k,rect:I});}}return t.addEventListener("pointerdown",u,true),t.addEventListener("click",h),{goToPosition:a,goToBookmark:i,openExternal:o,destroy(){t.removeEventListener("pointerdown",u,true),t.removeEventListener("click",h);}}}function bh(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 Yi(e,t){return e.drawingNodeId!==t?null:bh(e)}function Vu(e,t){if(!e)return null;for(let n of e.anchoredDrawings??[]){let r=Yi(n,t);if(r)return r}return null}function xh(e,t){for(let r of e.anchoredDrawings??[]){let o=Yi(r,t);if(o)return o}for(let r of e.fragments){if(r.kind==="table"){for(let a of r.rows)for(let i of a.cells)for(let l of i.blocks){let d=Uu(l,t);if(d)return d}continue}let o=ju(r,t);if(o)return o}let n=Vu(e.header,t);return n||Vu(e.footer,t)}function ju(e,t){for(let n of e.lines)for(let r of n.drawings??[]){let o=Yi(r,t);if(o)return o}return null}function Uu(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=Uu(o,t);if(a)return a}return null}return ju(e,t)}function Wu(e,t){for(let n of e.pages){let r=xh(n,t);if(r)return r}return null}function Gu(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.orderedStart();return e.commit(()=>e.applyOps([...e.deleteSelectionOps(),{op:"insertPageField",paragraphId:n.paragraphId,offset:n.offset,field:t}],e.selectionMark()),()=>e.collapsedAt({paragraphId:n.paragraphId,offset:n.offset+(t==="PAGE_X_OF_Y"?6:1)})),e.lastRejection()===null}}}var Kr="the document is open for viewing",Yo="image property edits are not supported in suggesting mode",Ih="trackedDrawingDeletionUnsupported";function $u(e){function t(){return {committed:false,rejected:true,opCount:0,reason:Kr}}function n(){return {committed:false,rejected:true,opCount:0,reason:Yo}}return {applyDrawingOps(r){if(e.editingMode()==="view")return t();if(e.editingMode()==="suggest")return n();let o=e.selectionMark();return e.applyOps(r,o,o)},applyImageProperties(r){if(e.editingMode()==="view")return {ok:false,reason:"invalidArgs",detail:Kr};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Yo};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:Kr};if(e.editingMode()==="suggest")return {ok:false,reason:"invalidArgs",detail:Ih};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:Kr}):e.editingMode()==="suggest"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Yo}):e.session.insertImage(e.storyScope(),{...r,decodePort:e.decodePort()})},replaceImage(r,o,a,i){return e.editingMode()==="view"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Kr}):e.editingMode()==="suggest"?Promise.resolve({ok:false,reason:"invalidArgs",detail:Yo}):e.session.replaceImage(e.storyScope(),r,o,a,e.decodePort(),i)}}}function Xu(e){let t=null,n=null,r="",o=()=>{if(!t)return;let l=gu(e.layout(),t,e.materializedPages?.());l!==t.pageIndex&&(t={...t,pageIndex:l});},a=l=>{if(e.entryRefused?.()===true&&t?.scope.rId!==l.rId||!l.rId||e.session.partFor({kind:"headerFooter",rId:l.rId})===null)return false;let d=e.layout(),u=fu(d,l.rId),h=t,P=h?.scope.rId===l.rId,S=u?null:Sh(e.session,l.rId);if(!u&&!S)return false;let I=l.pageIndex??(P&&h?h.pageIndex:u?.pageIndex??0),L=l.kind??(P&&h?h.kind:u?.kind??S.kind),O=l.variant??(P&&h?h.variant:u?.story.variant??S.variant),k=P&&h?h.partName:u?.story.partName??S.partName,g=d.pages[I]??d.pages[u?.pageIndex??0],D=(g?Vn(g,{scope:{kind:"headerFooter",rId:l.rId},kind:L,partName:k}):null)??u?.story??{scope:{rId:l.rId},variant:O,partName:k},N=e.selection(),E=h?h.savedBodySelection:{anchor:{...N.anchor},head:{...N.head}},T=l.sectionIndex??(P&&h?.sectionIndex!==void 0?h.sectionIndex:S?.sectionIndex);t={scope:{kind:"headerFooter",rId:l.rId},pageIndex:I,...T!==void 0?{sectionIndex:T}:{},kind:L,variant:D.variant,partName:D.partName,savedBodySelection:E};let w=e.session.paragraphIdsIn(Uo(t))[0];if(!w)return t=null,false;let q=l.position?Wo(d,{anchor:l.position,head:l.position},t):P?Wo(d,N,t):{anchor:{paragraphId:w,offset:0},head:{paragraphId:w,offset:0}};return e.setScopeSelection(q),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify(),true},i=()=>{if(!t)return;let l=t.savedBodySelection;t=null,e.setScopeSelection(Wo(e.layout(),l,null)),e.noteModelMoved(),e.render(),e.mirrorToDom(),e.notify();};return {getActive:()=>t,activeScope:()=>uu(t),setActiveScope(l){return l.kind==="body"?(i(),true):l.kind==="headerFooter"?a({rId:l.rId}):false},enterHeaderFooter:a,exitHeaderFooter:i,reconcileOccurrence:o,headerFooterState(){if(!t)return null;let l=e.session.headerFooterResolutionBySection(),d=t.sectionIndex??0,u,h,P,S=g=>{let D=l[g];if(!D)return false;let E=(t.kind==="header"?D.headers:D.footers).get(t.variant);return !E||E.rId!==t.scope.rId?false:(d=g,u=E.inherited,h=D.titlePage,P=D.evenAndOddHeaders,true)};if(!(t.sectionIndex!==void 0&&S(t.sectionIndex))){let g;l.forEach((D,N)=>{let T=(t.kind==="header"?D.headers:D.footers).get(t.variant);!T||T.rId!==t.scope.rId||!(g===void 0||g&&!T.inherited||g===T.inherited&&N<d)||(d=N,u=T.inherited,h=D.titlePage,P=D.evenAndOddHeaders,g=T.inherited);});}let I=Nc$1(e.session.part()),L=I[d]?.properties??I.at(-1)?.properties,O=L?.margins.headerTwips,k=L?.margins.footerTwips;return {editing:t.kind,sectionIndex:d,variant:t.variant,rId:t.scope.rId,partName:t.partName,...u!==void 0?{inherited:u}:{},...h!==void 0?{titlePage:h}:{},...P!==void 0?{evenAndOddHeaders:P}:{},...O!==void 0?{headerDistanceTwips:O}:{},...k!==void 0?{footerDistanceTwips:k}:{}}},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 Sh(e,t){let n=e.headerFooterResolutionBySection();for(let r=0;r<n.length;r+=1){let o=n[r];for(let a of ["header","footer"]){let i=a==="header"?o.headers:o.footers;for(let[l,d]of i)if(d.rId===t)return {sectionIndex:r,kind:a,variant:l,partName:d.partName}}}return null}function Qu(e){let t=null,n=null,r=null,o=i=>(e.setLastRejection(null),e.commit(()=>{let l=e.applyOps([i],e.selectionMark());return l.rejected&&e.setLastRejection(String(l.reason??"rejected")),l}),e.lastRejection()===null),a=(i,l,d)=>{let u=fd(i);if(!u)return e.setLastRejection("invalid note scope id"),false;let h=e.session.currentPackage(),P=Yd$1(h,u.noteKind),S=P?Ad$2(P.root,u.noteId):null;if(!P||!S)return e.setLastRejection("note not found"),false;if(e.activeScope().kind==="body"){let I=e.selection();r={anchor:{paragraphId:I.anchor.paragraphId,offset:I.anchor.offset},head:{paragraphId:I.head.paragraphId,offset:I.head.offset}};}if(t={kind:"note",id:ed(u.noteKind,u.noteId)},n=Number.isInteger(d)?d:null,l)e.setSelection({anchor:l,head:l});else {let I=kh(S),L=new Set(e.session.paragraphIdsIn({kind:"notesPart",noteKind:u.noteKind})),O=I.find(k=>L.has(k.id));if(O){let k=Th(O);e.setSelection({anchor:{paragraphId:O.id,offset:k},head:{paragraphId:O.id,offset:k}});}}return e.noteModelMoved(),e.render(),n??=e.revealNote(t.id),e.notify(),true};return {insertNote(i){if(e.activeScope().kind!=="body")return e.setLastRejection("insertNote requires body scope"),false;let l=e.orderedStart(),d=Yu(e.session.currentPackage(),i);if(!o({op:"insertNote",noteKind:i,paragraphId:l.paragraphId,offset:l.offset}))return false;let P=[...Yu(e.session.currentPackage(),i)].find(S=>!d.has(S));return P===void 0?true:a(ed(i,P))},deleteNote(i,l){return o({op:"deleteNote",noteKind:i,noteId:l})},convertNote(i,l){return o({op:"convertNote",fromKind:i,noteId:l})},convertAllNotes(i){return o({op:"convertAllNotes",fromKind:i})},setNoteProperties(i){return o({op:"setNoteProperties",scope:i.scope,sectionIndex:i.sectionIndex,footnote:i.footnote,endnote:i.endnote})},enterNote:a,exitNote(i=true){if(!t)return;let l=r;t=null,n=null,r=null,e.setActiveScopeBodyOrHf({kind:"body"}),i&&l&&e.setSelection(l),e.noteModelMoved(),e.render(),e.notify();},activeNoteScope(){return t},activeNotePageIndex(){return n},setActiveNotePageIndex(i){!t||!Number.isInteger(i)||n!==i&&(n=i);}}}function kh(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 Th(e){let t=Rd$2(e)[0];return t&&kd$1(t.node)?t.end:0}function Yu(e,t){let n=Yd$1(e,t),r=new Set;if(!n)return r;for(let o of zd$2(n.root)){if(!qd$1(o))continue;let a=od$1(o);a!==null&&r.add(a);}return r}var wh=500;function Ph(e,t){let n=e.part(),r=Nc$1(n),o=Cb(n),a=new Map;for(let i=0;i<r.length;i+=1){let l=r[i];for(let d=l.blockStart;d<l.blockEndExclusive;d+=1){let u=o[d];if(!u)continue;if(u.kind==="paragraph"){a.set(u.id,i);continue}let h=(P,S)=>{if(!(S>32)){if(P.kind==="paragraph"&&typeof P.id=="string"){a.set(P.id,i);return}for(let I of P.children??[])h(I,S+1);}};h(u,0);}}return a.get(t)??0}function Ch(e,t){let n=e.part(),r=Cb(n),o=[];for(let a=0;a<r.length;a+=1){let i=r[a];if(i.kind!=="paragraph")continue;let l=Lc$1(i);l&&o.push(l);}for(;o.length<t.length;)o.push(void 0);return o}function Ju(e){if(!e)return null;let t=e.session,n=e.state().selection.head.paragraphId,r=Ph(t,n),o=t.currentPackage(),a=Gd$2(o),i=Hd$1(a),l=Id$2(a),d=Nc$1(t.part()),u=Ch(t,d),h=Ed$2(u[r]),P=Fd$1(u[r]),S=Jd$1(h,i),I=Kd$1(P,l);return {sectionIndex:r,footnote:{resolved:S,...i?{documentAuthored:i}:{},...h?{sectionAuthored:h}:{}},endnote:{resolved:I,...l?{documentAuthored:l}:{},...P?{sectionAuthored:P}:{}}}}function ef(e,t){let n=fd(t);if(!n)return null;let r=Yd$1(e.currentPackage(),n.noteKind);if(!r)return null;let o=r,a=Ad$2(o.root,n.noteId);if(!a)return null;let i=[],l=wh,d=(h,P)=>{if(!(P>32||l<=0)){if(h.kind==="paragraph"&&typeof h.id=="string"){let S=(Ff$1(o,h.id)??"").replace(/\uFFFC/g,"").trim();if(S){let I=S.slice(0,l);i.push(I),l-=I.length;}return}if(h.kind!=="textValue")for(let S of h.children)d(S,P+1);}};d(a,0);let u=i.filter(Boolean).join(" ").trim();return u.length>0?u:null}function tf(e,t){let n=e.setScale;return typeof n!="function"?false:n.call(e,t)}function Qi(e,t,n={}){let r=n,o=j$2(t,n.reviewModel?{reviewModel:n.reviewModel}:{});if(!o.ok)return {ok:false,reason:o.reason,...o.detail?{detail:o.detail}:{}};let a=o.session,i=n.scale??96/72,l={resolve:n.tableInteractionLabel??(s=>ki(s))},d="the document is open for viewing",u="the document is read-only",h="the table of contents is generated and read-only",P="\0range\0",S=()=>`${new Date().toISOString().slice(0,19)}Z`,I=n.measurer?null:td(i,{context:zn(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),L=n.measurer??I.measurer,O=ob(),k=md$1();function g(){return n.measurer?n.producer??"host-measurer":`${n.producer??I?.producer??"fixed-measurer"}@scale:${i}`}let D=g(),N=e.ownerDocument,E=N.createElement("div");E.className="docx-pages",E.style.position="relative",E.contentEditable="true",E.spellcheck=false,E.setAttribute("role","textbox"),E.setAttribute("aria-multiline","true"),E.style.outline="none";let T=N.createElement("div");T.className="docx-selection-overlay",T.contentEditable="false",T.setAttribute("aria-hidden","true"),T.style.position="absolute",T.style.left="0",T.style.top="0",T.style.pointerEvents="none";let v=N.createElement("div");v.className="docx-comment-overlay",v.contentEditable="false",v.setAttribute("aria-hidden","true"),v.style.position="absolute",v.style.left="0",v.style.top="0",v.style.pointerEvents="none";let w=N.createElement("div");w.className="docx-table-furniture",w.contentEditable="false",w.style.position="absolute",w.style.left="0",w.style.top="0",w.style.pointerEvents="none",e.style.position="relative",e.replaceChildren(E,w,v,T);let q=Gc(E,()=>i,()=>{let s=y?.getActive()??null,c=x?.activeNoteScope()??null,f=x?.activeNotePageIndex()??null,m=s?pu(E,s.pageIndex):c?mu(E,c.id,f):null;return {layout:U,selection:F,measurer:L,...s?{preferredPageIndex:s.pageIndex}:f!==null?{preferredPageIndex:f}:{},scopedHost:m,...s?{scopedHostKind:"headerFooter"}:c?{scopedHostKind:"note"}:{}}}),z=new Set(Ac$1(a.part()).flatMap(s=>[s.beginParagraphId,...s.resultParagraphIds,s.endParagraphId])),X=a.paragraphIds(),Y=X.find(s=>!z.has(s))??X[0]??"",F={anchor:{paragraphId:Y,offset:0},head:{paragraphId:Y,offset:0}},re=null,$=null,Te=false,fe=false,Pe=null,be=new Map;function We(){Pe=null;for(let s of be.values())Pe=s;}function at(s,c){if(s.paragraphId===c.paragraphId)return s.offset-c.offset;let f=ee();return f.indexOf(s.paragraphId)-f.indexOf(c.paragraphId)}function Ge(s){if(!Pe)return;let{from:c,to:f}=Ei(U,Pe),m=s.head;at(m,c)>=0&&at(m,f)<=0||(be.clear(),Pe=null);}let Se=null;function yt(){return Me()?.properties??null}function Me(){if(!Se)return null;let s=Se.position,c=f=>f.paragraphId===s.paragraphId&&f.offset===s.offset;return c(F.anchor)&&c(F.head)?Se:null}function qe(s){if(!Se)return;let c=Se.position;s.anchor.paragraphId===c.paragraphId&&s.anchor.offset===c.offset&&s.head.paragraphId===c.paragraphId&&s.head.offset===c.offset||(Se=null);}function A(s,c,f,m){let b=Ee([...s],f,m);return s.length===c.length||!b.rejected?b:Ee([...c],f,m)}function G(s,c,f){let m=Me();if(!m||f===0)return [];let b=Se.position;return b.paragraphId!==s||b.offset!==c?[]:[{op:"setRunProperties",paragraphId:s,start:c,end:c+f,properties:m.properties.reduce((R,H)=>gg$1(R,H),[...m.base])}]}let y=null,x=null,Z=null,M="",B=()=>Uo(y?.getActive()??null,x?.activeNoteScope()??null),te=()=>x?.activeNoteScope()?.id??null,ee=()=>jn(U,y?.getActive()??null,te()),le=()=>globalThis.performance?.now()??Date.now(),Le=0,He=0,it=0,{styleCascade:Ce,numberingIndex:ze,defaultTabStopPt:Re}=_c(a),In=null,Rt=n.imageDecodePort??jc(N)??Uc(),Ve=Cc$1({session:a,decodePort:Rt,onResourcesChanged:()=>In?.()}),ue=n.drawingStrings??f,ge=()=>F.anchor.paragraphId!==F.head.paragraphId||F.anchor.offset!==F.head.offset?null:{paragraphId:F.head.paragraphId,offset:F.head.offset},Et=-1,vt=true,Xn=()=>{let s=a.packageRevision();return Et!==s&&(Et=s,vt=!Q(a.settingsRoot()).doNotShadeFormData),vt},jt=Wc({mintValidatedBytes:(s,c)=>Ve.mintValidatedBytes(s,c)}),Ut=Oi({session:a,measurer:L,producer:D,cache:O,styleCascade:Ce,defaultTabStopPt:Re,displayMode:n.revisionDisplayMode??cb,inlineDrawingLayoutForPart:s=>Ve.contextForPart(s),drawingLayoutTokenForPart:s=>Ve.cacheTokenForPart(s),drawingTokenForParagraphForPart:(s,c)=>Ve.drawingTokenForParagraph(c,s)}),ia=s=>{let c=Ua(s,f=>a.relationshipTarget(f));return s.kind==="textValue"?null:{id:s.id,kind:c.kind,href:c.href,...c.anchor!==void 0?{anchor:c.anchor}:{},...c.tooltip!==void 0?{tooltip:c.tooltip}:{}}},bt=_u(),Sn={...a,applyTreeOps:(s,c,f)=>Ee(s,c,f),applyPmDoc:s=>Oe==="view"?{committed:false,rejected:true,opCount:0,reason:d}:ga()?{committed:false,rejected:true,opCount:0,reason:h}:a.applyPmDoc(s)},U=It(),xt=n.revisionStyles,Wt=null,kn=du({session:Sn,storyScope:B,paragraphOrder:ee,layout:()=>U,selection:()=>F,commit:(s,c,f)=>ke(s,c,f),orderedRange:()=>dn(),selectionMark:()=>we(),textOf:s=>St(s),selectedCells:()=>re?.cellIds,defaultParagraphStyleId:()=>Ce?.defaultParagraphStyleId??null,defaultFontFamily:()=>n.defaultFontFamily??null,pendingFormats:()=>yt(),setPendingFormats:s=>{if(s===null||s.length===0){if(!Se)return;Se=null;}else {let{anchor:c,head:f}=F;if(c.paragraphId!==f.paragraphId||c.offset!==f.offset)return;let m=Me()?.base??ou(a.partFor(B())??a.part(),f.paragraphId,f.offset);Se={position:f,properties:s,base:m};}n.onChange?.(Be());}}),Yn=Nu({session:Sn,storyScope:B,paragraphOrder:ee,layout:()=>U,commit:(s,c)=>ke(s,c,{rearmPending:Me()??void 0}),orderedStart:()=>to(),orderedRange:()=>dn(),selectionMark:()=>we(),collapsedAt:s=>Fe(s),deleteSelectionPlan:()=>cn(),paragraphTextOf:s=>St(s),numberingLevelExists:(s,c)=>Xb($b(ze(),Ce),s,c)!==null}),Qn=zu({session:Sn,layout:()=>U,fieldLinkById:s=>bt.linkById(s),refusesWrite:()=>rr(true)!==null,storyScope:B,selection:()=>F,orderedRange:()=>dn(),selectionMark:()=>we(),textOf:s=>St(s),commit:(s,c)=>ke(s,c)}),an=Ku({pagesLayer:E,container:e,scale:()=>i,layout:()=>U,bookmarks:()=>a.bookmarks(),linkById:s=>bt.linkById(s)??Qn.linkById(s),drawingLinkById:s=>Wu(U,s),setSelection:s=>dt(Fe(s)),isCollapsedSelection:()=>F.anchor.paragraphId===F.head.paragraphId&&F.anchor.offset===F.head.offset,onScrolled:()=>Qr(),...n.onHyperlinkPopover?{onPopover:n.onHyperlinkPopover}:{}});E.addEventListener("contextmenu",fs),E.addEventListener("click",ps),E.addEventListener("pointermove",C),E.addEventListener("pointerleave",ne);let Ft=null;function Jn(s){Ve.sync(a);let c=Kc({session:a,measurer:L,producer:D,cache:O,styleCascade:Ce,defaultTabStopPt:Re,inlineDrawingLayoutForPart:f=>Ve.contextForPart(f),drawingTokenForParagraphForPart:(f,m)=>Ve.drawingTokenForParagraph(m,f)});return od(a.part(),s,{measurer:L,cache:O,session:k,producer:D,styleCascade:Ce,defaultTabStopPt:Re,numberingIndex:ze(),sectionFurniture:Ut.sectionFurniture(),furniture:Ut.furniture(),projectLink:ia,projectFieldLink:f=>bt.project(f),documentProperties:a.documentProperties(),inlineDrawingLayout:Ve.bodyContext,drawingTokenForParagraph:f=>Ve.drawingTokenForParagraph(f,a.part().name),...c?{notes:c}:{},...n.revisionDisplayMode?{displayMode:n.revisionDisplayMode}:{}})}function It(){let s=le(),c=Jn(a.packageRevision());return Le=le()-s,c}let st=null;function sa(){return e.ownerDocument.defaultView?.navigator?.scheduling?.isInputPending?.({includeContinuous:true})??false}function Wr(){if(!sa()){st!==null&&clearTimeout(st),st=null,tt();return}st===null&&(st=setTimeout(()=>{st=null,tt();},0));}let Ot="",Gt=null,er=false;function ye(){if(er||(Gt!==null&&(clearTimeout(Gt),Gt=null),Ot.length===0))return;let s=Ot;Ot="",er=true;try{_e.type(s);}catch(c){throw Ot=s+Ot,c}finally{er=false;}}function Gr(s){Ot+=s,Gt===null&&(Gt=setTimeout(()=>{Gt=null,ye();},0));}let $e=xd$1({run:s=>{let c=le(),f=Jn(s.revision);return Le=le()-c,f},currentRevision:()=>a.packageRevision(),publish:s=>{Wt!==null&&(Wt={...Wt,layout:null,items:null}),U=s,Wr();}}),Mt=false;In=()=>{$e.invalidateAll(a.packageRevision(),"drawing-resources"),!Mt&&(Mt=true,setTimeout(()=>{Mt=false,Je();},0));};let $r=a.subscribe(s=>{Se=null,$e.notify(s);});function Xr(){let s=qc(e,U,F,i),c=y?.getActive()?.pageIndex;return c===void 0||s===void 0||s.has(c)?s:new Set([...s,c])}function Je(){return $e.pending()?$e.flush():false}let $t=null;function la(s){return s.contentControlId??`toc:${s.id}`}function Tn(s){return Ac$1(a.part()).find(c=>c.beginParagraphId===s||c.endParagraphId===s||c.resultParagraphIds.includes(s))}function Xt(){for(let s of E.querySelectorAll(".docx-content-control-chrome[data-docx-toc]")){if(s.getAttribute("data-docx-content-control")===$t){s.dataset.hover="",s.dataset.boundaryVisible="";continue}delete s.dataset.hover,Te||delete s.dataset.boundaryVisible;}}function p(s){$t!==s&&($t=s,Xt());}function C(s){let f=s.target?.closest("[data-paragraph-id]")?.dataset.paragraphId,m=f?Tn(f):null;p(m?la(m):null);}function _(s){let c=s.target,f=c?.isConnected?c.closest("[data-paragraph-id]"):void 0;if(f)return f.dataset.paragraphId;let m=E.ownerDocument;return typeof m.elementFromPoint!="function"?void 0:m.elementFromPoint(s.clientX,s.clientY)?.closest("[data-paragraph-id]")?.dataset.paragraphId}function ne(){p(null);}function j(){let s=pe(),c=Ec$1(a.part()),m=Ac$1(a.part()).map(Q=>{let de=ae(Q);return de?{...de,empty:c.has(Q.beginParagraphId)}:null}).filter(Q=>Q!==null),b=new Set(m.map(Q=>Q.boundary.id)),R=new Set(m.filter(Q=>Q.empty).map(Q=>Q.boundary.id)),H=s&&!b.has(s.id)?new Set([s.id]):void 0,V=$t?new Set([$t]):void 0,K=new Set(Hd(U).filter(Q=>Q.controlType==="checkbox"&&Ae(Q.id)).map(Q=>Q.id)),ie=m.filter(Q=>Q.additional&&!Q.empty).map(Q=>Q.boundary),W=hs()!==null;if(!(!Te&&!H&&!V&&!W&&K.size===0&&ie.length===0&&b.size===0))return {...W?{readOnly:true}:{},...Te?{showAll:true}:{},...H?{activeIds:H}:{},...V?{hoverIds:V}:{},...K.size>0?{checkedIds:K}:{},...ie.length>0?{additionalBoundaries:ie}:{},...b.size>0?{tocControlIds:b}:{},...R.size>0?{suppressedIds:R}:{}}}function ae(s){let c=s.contentControlId?Hd(U).find(b=>b.id===s.contentControlId):void 0;if(c)return {tocId:s.id,boundary:c,additional:false};let f=new Set([s.beginParagraphId,...s.resultParagraphIds,s.endParagraphId]),m=U.pages.flatMap(b=>{let R$1=R(b).filter(W=>f.has(W.paragraphId)).map(W=>W.box);if(R$1.length===0)return [];let H=Math.min(...R$1.map(W=>W.x)),V=Math.min(...R$1.map(W=>W.y)),K=Math.max(...R$1.map(W=>W.x+W.width)),ie=Math.max(...R$1.map(W=>W.y+W.height));return [{pageIndex:b.index,box:{x:H,y:V,width:K-H,height:ie-V}}]});return m.length===0?null:{tocId:s.id,additional:true,boundary:{id:`toc:${s.id}`,controlType:"richText",lock:"unlocked",effectiveLock:"unlocked",placeholder:false,bound:false,nestingDepth:0,level:"block",fragments:m}}}function pe(){let s=Ed$1(U,F.head,L);return s?Gd$1(U,{x:s.x,y:s.y+s.height/2,pageIndex:s.pageIndex}):null}function xe(s){return s.bound?"bound":s.effectiveLock==="contentLocked"||s.effectiveLock==="sdtContentLocked"?"locked":null}function J(s){return s.effectiveLock==="sdtLocked"||s.effectiveLock==="sdtContentLocked"?"locked":null}function ve(s){return Lb(s)}function ce(s){let c=Fa(a.part(),s);return !c||!ve(c)?null:c}function Ze(s){let c=ce(s);if(!c)return null;for(let f of c.children)if(f.kind!=="textValue"&&(f.kind==="contentControlProperties"||f.localName==="sdtPr"))for(let m of f.children){if(m.kind==="textValue"||m.localName!=="tabIndex")continue;let b=m.attributes.find(H=>H.localName==="val")?.value;if(b===void 0)return null;let R=Number(b);return Number.isFinite(R)?R:null}return null}function sn(){return [...Hd(U)].filter(c=>xe(c)===null).sort((c,f)=>{let m=Ze(c.id),b=Ze(f.id);return m!==null&&b!==null&&m!==b?m-b:m!==null&&b===null?-1:m===null&&b!==null?1:0})}function lt(s){if(s.kind==="textValue")return s.value.length;if(s.kind==="tab"||s.kind==="hardBreak")return 1;if(s.kind==="runProperties"||s.kind==="generic")return 0;if(s.kind==="contentControl"){let m=0;for(let b of s.children)if(b.kind!=="textValue"&&(b.kind==="contentControlContent"||b.localName==="sdtContent"))for(let R of b.children)m+=lt(R);return m}let f=0;for(let m of s.children)f+=lt(m);return f}function Yt(s){for(let c of s.children)if(c.kind!=="textValue"&&(c.kind==="contentControlContent"||c.localName==="sdtContent"))return c.children;return []}function wn(s){let c=ce(s);if(!c)return false;let f=Yt(c),m=[],b=ie=>{for(let W of ie){if(W.kind==="paragraph"){m.push({id:W.id,length:lt(W)});continue}if(W.kind==="textValue")continue;if(W.kind==="contentControl"){b(Yt(W));continue}b(W.children);}};if(b(f),m.length>0){let ie=m[0],W=m[m.length-1];return dt({anchor:{paragraphId:ie.id,offset:0},head:{paragraphId:W.id,offset:W.length}}),true}let R=null,H=0,V=0,K=(ie,W,Q)=>{let de=W;for(let Ie of ie){if(Ie.id===s)return R=Q,H=de,V=de+lt(Ie),true;if(Ie.kind==="textValue"){de+=Ie.value.length;continue}if(Ie.kind==="contentControl"){let un=lt(Ie);if(K(Yt(Ie),de,Q))return true;de+=un;continue}if(Ie.kind==="run"||Ie.kind==="hyperlink"){if(K(Ie.children,de,Q))return true;de+=lt(Ie);continue}if(Ie.kind==="paragraph"){if(K(Ie.children,0,Ie.id))return true;continue}if(Ie.kind==="tab"||Ie.kind==="hardBreak"){de+=1;continue}if(K(Ie.children,de,Q))return true;de+=lt(Ie);}return false};return K(a.part().root.children,0,""),R?(dt({anchor:{paragraphId:R,offset:H},head:{paragraphId:R,offset:V}}),true):false}function me(s){let c=ce(s);if(!c)return [];for(let f of c.children)if(f.kind!=="textValue"&&!(f.kind!=="contentControlProperties"&&f.localName!=="sdtPr"))for(let m of f.children){if(m.kind==="textValue"||m.localName!=="dropDownList"&&m.localName!=="comboBox")continue;let b=[];for(let R of m.children){if(R.kind==="textValue"||R.localName!=="listItem")continue;let H=R.attributes.find(K=>K.localName==="value")?.value??"",V=R.attributes.find(K=>K.localName==="displayText")?.value??H;b.push({displayText:V,value:H});}return b}return []}function Ae(s){let c=ce(s);if(!c)return false;for(let f of c.children)if(f.kind!=="textValue"&&!(f.kind!=="contentControlProperties"&&f.localName!=="sdtPr")){for(let m of f.children)if(m.kind==="contentControlCheckbox")for(let b of m.children){if(b.kind!=="contentControlChecked")continue;let R=b.attributes.find(H=>H.localName==="val")?.value;return !(R==="0"||R==="false"||R==="off")}}return false}function Qt(s){let c=ce(s);if(c){for(let f of c.children)if(f.kind==="contentControlProperties"){for(let m of f.children)if(m.kind==="contentControlDate")return m.attributes.find(b=>b.localName==="fullDate")?.value}}}function At(s,c){for(let f of E.querySelectorAll("[data-docx-content-control]"))f.getAttribute("data-docx-content-control")===s&&(c?f.dataset.open="":delete f.dataset.open);}function et(s){let c=s.dataset.docxCcId;s.remove(),c&&At(c,false);}function Pn(){let s=E.querySelector(".docx-content-control-menu");s&&et(s);}function fs(s){let c=_(s),f=c?Tn(c):void 0;Qf(f&&va(f.id)?f.id:null);}let tr=null;function Qf(s){tr!==s&&(tr=s,n.onChange?.(Be()));}function ps(s){if(s.button!==0||s.target?.closest("a.docx-hyperlink")||F.anchor.paragraphId!==F.head.paragraphId||F.anchor.offset!==F.head.offset)return;let c=_(s);if(!c)return;let f=Ac$1(a.part()).find(R=>R.resultParagraphIds.includes(c));if(!f)return;let b=H(a.part(),f,a.documentOutline(),ha(f))[f.resultParagraphIds.indexOf(c)];b&&(s.preventDefault(),an.goToPosition({paragraphId:b,offset:0}));}function Jf(s,c){let f=Zt.disabledReason(s,"edit");if(f){$=f,n.onChange?.(Be());return}if(c==="checkbox"){Zt.setValue(s,Ae(s)?"false":"true");return}if(c==="dropdown"||c==="comboBox"){let m=me(s);if(m.length===0&&c==="dropdown")return;Pn();let b=N.createElement("div");b.className="docx-content-control-menu",b.dataset.docxMarker="",b.dataset.docxCcId=s,b.setAttribute("contenteditable","false"),b.setAttribute("role","listbox"),b.style.position="absolute",b.style.zIndex="20",b.style.pointerEvents="auto",b.addEventListener("pointerdown",K=>K.stopPropagation());let H=Hd(U).find(K=>K.id===s)?.fragments[0];if(H){let K=U.pages[H.pageIndex],ie=De?.pageOffsetX.get(H.pageIndex)??0;if(K){let W=K.contentBox.x-K.box.x,Q=K.contentBox.y-K.box.y;b.style.left=`${(K.box.x+ie+W+H.box.x+H.box.width)*i}px`,b.style.top=`${(K.box.y+Q+H.box.y+H.box.height)*i}px`,b.style.transform="translateX(-100%)";}}for(let K of m){let ie=N.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=K.displayText,ie.addEventListener("mousedown",W=>{W.preventDefault(),W.stopPropagation(),et(b),Zt.setValue(s,K.value);}),b.append(ie);}if(c==="comboBox"){let K=N.createElement("input");K.type="text",K.className="docx-content-control-menu-input",K.dataset.docxMarker="",K.setAttribute("contenteditable","false"),K.addEventListener("mousedown",ie=>ie.stopPropagation()),K.addEventListener("keydown",ie=>{ie.key==="Enter"&&(ie.preventDefault(),et(b),Zt.setValue(s,K.value));}),b.append(K);}E.append(b),At(s,true);let V=K=>{b.contains(K.target)||(et(b),N.removeEventListener("mousedown",V,true));};N.addEventListener("mousedown",V,true);return}if(c==="date"){Pn();let m=N.createElement("div");m.className="docx-content-control-menu",m.dataset.docxMarker="",m.dataset.docxCcId=s,m.setAttribute("contenteditable","false"),m.style.position="absolute",m.style.zIndex="20",m.style.pointerEvents="auto",m.addEventListener("pointerdown",he=>he.stopPropagation());let b=Hd(U).find(he=>he.id===s),R=b?.fragments[0];if(R){let he=U.pages[R.pageIndex],fn=De?.pageOffsetX.get(R.pageIndex)??0;if(he){let pr=he.contentBox.x-he.box.x,mr=he.contentBox.y-he.box.y;m.style.left=`${(he.box.x+fn+pr+R.box.x+R.box.width)*i}px`,m.style.top=`${(he.box.y+mr+R.box.y+R.box.height)*i}px`,m.style.transform="translateX(-100%)";}}m.classList.add("docx-content-control-calendar");let H=Qt(s),V=H?new Date(H):new Date,K=Number.isNaN(V.getTime())?null:V,ie=K??new Date,W=ie.getFullYear(),Q=ie.getMonth(),de=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),Ie=new Intl.DateTimeFormat(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),Bt=new Intl.DateTimeFormat(void 0,{weekday:"narrow"}),un=he=>`${he.getFullYear().toString().padStart(4,"0")}-${(he.getMonth()+1).toString().padStart(2,"0")}-${he.getDate().toString().padStart(2,"0")}`,fr=(he,fn)=>he.getFullYear()===fn.getFullYear()&&he.getMonth()===fn.getMonth()&&he.getDate()===fn.getDate(),Vs=null,wa=()=>{let he=N.createElement("input");he.type="date",he.className="docx-content-control-calendar-input",he.value=K?un(K):"";let fn=he.value;b?.alias&&he.setAttribute("aria-label",b.alias);let pr=()=>{if(!he.value||he.value===fn)return false;let je=he.value;return et(m),Zt.setValue(s,je),true};Vs=pr,he.addEventListener("keydown",je=>{je.key==="Enter"&&(je.preventDefault(),pr()||et(m));}),he.addEventListener("blur",()=>{queueMicrotask(()=>{!m.isConnected||m.contains(N.activeElement)||pr()||et(m);});});let mr=N.createElement("div");mr.className="docx-content-control-calendar-header";let pn=N.createElement("button");pn.type="button",pn.className="docx-content-control-calendar-nav",pn.textContent="\u2039";let yp=new Date(W,Q-1,1);pn.setAttribute("aria-label",de.format(yp));let Pa=N.createElement("div");Pa.className="docx-content-control-calendar-title",Pa.textContent=de.format(new Date(W,Q,1));let mn=N.createElement("button");mn.type="button",mn.className="docx-content-control-calendar-nav",mn.textContent="\u203A";let vp=new Date(W,Q+1,1);mn.setAttribute("aria-label",de.format(vp)),pn.addEventListener("mousedown",je=>je.stopPropagation()),mn.addEventListener("mousedown",je=>je.stopPropagation()),pn.addEventListener("click",()=>{Q-=1,Q<0&&(Q=11,W-=1),wa();}),mn.addEventListener("click",()=>{Q+=1,Q>11&&(Q=0,W+=1),wa();}),mr.append(pn,Pa,mn);let Ca=N.createElement("div");Ca.className="docx-content-control-calendar-weekdays";for(let je=0;je<7;je+=1){let qt=N.createElement("span");qt.textContent=Bt.format(new Date(2024,0,1+je)),Ca.append(qt);}let no=N.createElement("div");no.className="docx-content-control-calendar-grid",no.setAttribute("role","grid");let bp=(new Date(W,Q,1).getDay()+6)%7,xp=new Date;for(let je=0;je<42;je+=1){let qt=new Date(W,Q,je-bp+1),ct=N.createElement("button");ct.type="button",ct.className="docx-content-control-calendar-day",ct.textContent=String(qt.getDate()),ct.setAttribute("role","gridcell"),ct.setAttribute("aria-label",Ie.format(qt)),qt.getMonth()!==Q&&(ct.dataset.otherMonth=""),K&&fr(qt,K)&&(ct.dataset.selected="",ct.setAttribute("aria-selected","true")),fr(qt,xp)&&(ct.dataset.today=""),ct.addEventListener("mousedown",Ip=>Ip.stopPropagation()),ct.addEventListener("click",()=>{et(m),Zt.setValue(s,un(qt));}),no.append(ct);}m.replaceChildren(he,mr,Ca,no);};wa(),E.append(m),At(s,true);let js=he=>{m.contains(he.target)||(Vs?.()||et(m),N.removeEventListener("mousedown",js,true));};N.addEventListener("mousedown",js,true),m.querySelector("[data-selected], [data-today], .docx-content-control-calendar-day")?.focus({preventScroll:true});}}let Zt={setShowAll(s){Te!==s&&(Te=s,tt());},setFormFill(s){fe!==s&&(fe=s,n.onChange?.(Be()));},showAll:()=>Te,formFill:()=>fe,atCaret:()=>pe(),navigate(s){let c=sn();if(c.length===0)return false;let f=pe(),m=f?c.findIndex(R=>R.id===f.id):-1;s==="next"?m=m<0?0:(m+1)%c.length:m=m<0?c.length-1:(m-1+c.length)%c.length;let b=c[m];return wn(b.id)},setValue(s,c){let f=Zt.disabledReason(s,"edit");if(f)return $=f,n.onChange?.(Be()),false;let m=false;return ke(()=>{let b=Ee([{op:"setContentControlValue",controlId:s,value:c}],we(),void 0,fa,false);return m=b.committed,b}),m},remove(s){let c=s??pe()?.id;if(!c)return $="notFound",n.onChange?.(Be()),false;let f=Zt.disabledReason(c,"remove");if(f)return $=f,n.onChange?.(Be()),false;let m=false;return ke(()=>{let b=Ee([{op:"removeContentControl",controlId:c}],we(),void 0,fa,false);return m=b.committed,b}),m},disabledReason(s,c){let f=hs();if(f!==null)return f;let m=Hd(U).find(R=>R.id===s);if(m)return c==="remove"?J(m):xe(m);let b=ce(s);if(!b)return "notFound";for(let R of b.children)if(R.kind!=="textValue"&&!(R.kind!=="contentControlProperties"&&R.localName!=="sdtPr")){if(R.children.some(H=>H.kind!=="textValue"&&H.localName==="dataBinding")&&c==="edit")return "bound";for(let H of R.children){if(H.kind==="textValue"||H.localName!=="lock")continue;let V=H.attributes.find(K=>K.localName==="val")?.value;if(c==="remove"){if(V==="sdtLocked"||V==="sdtContentLocked")return "locked"}else if(V==="contentLocked"||V==="sdtContentLocked")return "locked"}}return null}};function da(){let s=gs&&Oe!=="view";E.contentEditable=s?"true":"false",E.setAttribute("aria-readonly",s?"false":"true");}function Be(){return {revision:a.packageRevision(),pageCount:U.pages.length,selection:F,cellSelection:re,canUndo:a.canUndo(),canRedo:a.canRedo(),lastRejection:$,pendingFormat:yt(),contentControls:{showAll:Te,formFill:fe,activeControlId:pe()?.id??null},contextTocId:tr,perf:{layoutMs:Le,paintMs:He,selectionMs:it,placed:k.stats.placed,total:k.stats.total,reusedPages:k.stats.reusedPages,fullPasses:k.stats.fullPasses,staleDiscards:$e.staleDiscards,cancelledRuns:$e.cancelledRuns}}}let Lt,De,ca=null,Yr=false,nr=null,ua=null;function ep(s){for(let c of U.pages){let f=E.children.item(c.index);if(f?.dataset.pageIndex!==String(c.index))continue;let m=s.pageOffsetX.get(c.index)??0;f.style.left=`${(c.box.x+m)*i}px`;}}function tt(s=true){let c=Ne.adoptBeforePaint(),f=le();Lt=Xr(),y?.reconcileOccurrence();let m=y?.getActive()??null,b=j(),R=Ec$1(a.part());i$1(E,U,{scale:i,readOnlyParagraphIds:eo(),...R.size>0?{emptyTocPlaceholderIds:R}:{},...n.fontAlias?{fontAlias:n.fontAlias}:{},...n.defaultFontFamily?{defaultFontFamily:n.defaultFontFamily}:{},materialize:Lt,ariaHidden:false,drawingStrings:ue,...n.fieldShading?{fieldShading:n.fieldShading}:{},...xt!==void 0?{revisionStyles:xt}:{},shadeFormFields:Xn(),...jt?{imageUrlPort:jt}:{},...m?{activeHeaderFooterRId:m.scope.rId,activeHeaderFooterPageIndex:m.pageIndex}:{},...b?{contentControlChrome:b}:{}}),Ri(E,ge()),yu(e,E,m!=null),zi(e,Oe),De=qo(U,Lt),ep(De),E.style.width=`${De.width*i}px`,E.style.height=`${De.height*i}px`,e.style.width=`${De.width*i}px`,e.style.height=`${De.height*i}px`,T.style.width=`${De.width*i}px`,T.style.height=`${De.height*i}px`,v.style.width=T.style.width,v.style.height=T.style.height,w.style.width=T.style.width,w.style.height=T.style.height,ur.update(),He=le()-f,lr(),Rn(true),Ks(),Ne.mirrorToDom(),ms(Yr),Yr=false,(s||c)&&n.onChange?.(Be());}function Qr(){ye();let s=Xr(),c=qo(U,s);De&&Mi(s,Lt)&&zc(c,De)||tt(false);}function ms(s=false){if(y?.getActive()||x?.activeNoteScope()||F.anchor.paragraphId!==F.head.paragraphId||F.anchor.offset!==F.head.offset)return;let c=N.activeElement;if(c!==E&&(!c||!E.contains(c)))return;let f=Ed$1(U,F.head,{measurer:L});if(!f)return;let m=ca!==null&&ca!==f.pageIndex;if(ca=f.pageIndex,!s&&!m)return;let b=U.pages[f.pageIndex],R=ot(e);if(!b||!R||R.clientHeight<=0)return;let H=24,V=b.contentBox.y-b.box.y,K=(b.box.y+V+f.y)*i+e.offsetTop,ie=K+f.height*i,W=R.scrollTop,Q=W+R.clientHeight,de=W;if(K<W+H)de=K-H;else if(ie>Q-H)de=ie+H-R.clientHeight;else return;let Ie=Math.max(0,R.scrollHeight-R.clientHeight),Bt=Math.max(0,Math.min(de,Ie));Math.abs(Bt-R.scrollTop)<.5||(R.scrollTop=Bt,Sa());}let Oe=n.editingMode??"edit",gs=true,fa=Object.freeze({kind:"body"});function Ee(s,c,f,m=B(),b=true){ye();let R=rr(s.some(tp),s,b);if(R!==null)return {committed:false,rejected:true,opCount:0,reason:R};let H=rp(s),V=a.applyTreeOps(H,c,f,m);return V.committed&&Oe==="suggest"&&H.some(np)&&r.onTrackedChange?.(),V}function rr(s,c=[],f=true){return Oe==="view"?d:s&&(f&&ga()||c.some(m=>cp(m)))?h:Oe==="suggest"&&!n.author?.trim()&&s?"suggesting needs an author before it can propose a change":null}function hs(){let s=rr(true,[],false);return s!==null?s:a.editable?null:u}function tp(s){return s.op!=="acceptRevision"&&s.op!=="rejectRevision"&&s.op!=="acceptAllRevisions"&&s.op!=="rejectAllRevisions"}function np(s){switch(s.op){case "insertText":case "deleteText":case "insertTableRow":case "deleteTableRow":return s.revision!==void 0;case "setParagraphMarkRevision":case "proposeParagraphMerge":return true;default:return false}}function rp(s){let c=n.author?.trim();if(Oe!=="suggest"||!c)return [...s];let f={author:c,date:S()};return s.flatMap(m=>m.op==="insertText"||m.op==="deleteText"||m.op==="insertTableRow"||m.op==="deleteTableRow"?[{...m,revision:f}]:m.op==="splitParagraph"?[m,{op:"setParagraphMarkRevision",paragraphId:m.paragraphId,kind:"ins",revision:f}]:m.op==="joinParagraphs"?[{op:"proposeParagraphMerge",paragraphId:m.secondId,revision:f}]:[m])}function ke(s,c,f={}){ye(),f?.keepCellSelection||(re=null),Se=null,Ne.noteModelMoved();let m=s();if(typeof m!="boolean"&&m.rejected)$=String(m.reason??"rejected");else {$=null;let b=c?.();b&&(sr(),F=b,Ft=null,Yr=true);let R=f?.rearmPending;if(R&&R.properties.length>0){let{anchor:H,head:V}=F;H.paragraphId===V.paragraphId&&H.offset===V.offset&&(Se={properties:R.properties,base:R.base,position:V});}}Je()||tt();}function op(){if(!Lt)return true;for(let s of [F.anchor,F.head]){let c=Ed$1(U,s);if(c&&!Lt.has(c.pageIndex))return false}return true}function dt(s,c=false){Ot.length>0&&(s.anchor.paragraphId!==F.anchor.paragraphId||s.anchor.offset!==F.anchor.offset||s.head.paragraphId!==F.head.paragraphId||s.head.offset!==F.head.offset)&&ye(),qe(s),Ge(s);let f=pe()?.id??null,m=dr(F.head.paragraphId);sr(),F=s,re=null,c||(Ft=null),op()||(Ne.noteModelMoved(),tt(false)),Ne.noteSelectionSettled(),Ne.mirrorToDom(true),ms(true),lr(),Cn.clear(),Rn();let b=pe()?.id??null,R=dr(F.head.paragraphId);(f!==b||m!==R)&&tt(false),n.onChange?.(Be());}let Ne=Hu({session:a,storyScope:B,document:N,pagesLayer:E,selection:()=>F,setSelection:s=>dt(s),adoptSelection:s=>{qe(s),Ge(s),sr(),F=s,Ft=null,Yr=true;},commit:s=>ke(s),render:()=>tt(),flushLayout:()=>Je(),updateCaret:()=>{q.update(),Ri(E,ge());},textOf:s=>St(s),pendingFormatOps:(s,c,f)=>G(s,c,f),selectionMark:()=>we(),now:le,recordSelectionMs:s=>{it=s;},isGesturing:()=>ba?.dragging()??false,domSelection:()=>re?Fe(re.text.anchor):F,holdsCellSelection:()=>re!==null});y=Xu({session:a,layout:()=>U,selection:()=>F,setScopeSelection:s=>{ye(),sr(),F=s,re=null,Ft=null;},noteModelMoved:()=>Ne.noteModelMoved(),render:()=>tt(),mirrorToDom:()=>Ne.mirrorToDom(),notify:()=>n.onChange?.(Be()),materializedPages:()=>Lt,entryRefused:()=>Oe==="view"}),x=Qu({session:a,applyOps:Ee,commit:ke,selection:()=>F,selectionMark:()=>we(),orderedStart:()=>to(),activeScope:()=>{let s=x?.activeNoteScope();return s||(y?.activeScope()??{kind:"body"})},setActiveScopeBodyOrHf:s=>y.setActiveScope(s),setSelection:s=>dt(s),noteModelMoved:()=>Ne.noteModelMoved(),render:()=>tt(),revealNote:s=>{for(let c of U.pages){let f=[...c.footnotes?.notes??[],...c.endnotes?.notes??[]].find(m=>m.scopeId===s);if(f)return cr(f.box.y,f.box.height,{block:"nearest",offsetPx:48}),c.index}return null},notify:()=>n.onChange?.(Be()),lastRejection:()=>$,setLastRejection:s=>{$=s;}});function ys(s){s&&ye(),re=s,s&&(qe(s.text),sr(),F=s.text),Ft=null,Ne.noteSelectionSettled(),Ne.mirrorToDom(),lr(),Cn.clear(),Rn(),n.onChange?.(Be());}let ln=null;function ap(){let c=Ed$1(U,F.head)?.pageIndex??0,f=new Set;for(let m=c-1;m<=c+1;m+=1)m>=0&&m<U.pages.length&&f.add(m);return f}let vs=new WeakMap;function ip(s){let c=vs.get(s);if(c)return c;let f=new Map;for(let m of s.pages)for(let b of R(m))f.has(b.paragraphId)||f.set(b.paragraphId,m.index);return vs.set(s,f),f}function sp(){let s=a.revision(),c=Lt??ap();if(ln?.layout===U&&ln.revision===s&&Mi(ln.pages,c))return ln.rects;let f=ip(U),m=(V,K)=>{if(!c)return true;let ie=f.get(V),W=f.get(K);if(ie===void 0||W===void 0)return true;for(let Q=Math.min(ie,W);Q<=Math.max(ie,W);Q+=1)if(c.has(Q))return true;return false},b=[];for(let V of a.reviewItems()){if(V.kind==="comment"){if(V.range===null||!m(V.range.start.paragraphId,V.range.end.paragraphId))continue;b.push({key:b$1(V),from:{paragraphId:V.range.start.paragraphId,offset:V.range.start.offset},to:{paragraphId:V.range.end.paragraphId,offset:V.range.end.offset}});continue}let K=b$1(V),ie=V.kind==="revision"?V.ranges:V.range?[V.range]:[];for(let[W,Q]of ie.entries())m(Q.start.paragraphId,Q.end.paragraphId)&&b.push({key:ie.length===1?K:`${K}${P}${W}`,from:{paragraphId:Q.start.paragraphId,offset:Q.start.offset},to:{paragraphId:Q.end.paragraphId,offset:Q.end.offset}});}let R=zd$1(U,b,c),H=[];for(let[V,K]of R)for(let ie of K)H.push({...ie,key:V});return ln={layout:U,revision:s,pages:c,rects:H},H}let or=null;function lp(){let s=a.packageRevision(),c=a.part().root;if(or&&or.packageRevision===s&&or.bodyRoot===c)return or.index;let f=new Map,m=R=>{let H=f.size;for(let[V,K]of R)f.has(V)||f.set(V,H+K);};m(ug$1(a.part()));let b=new Set([a.part()]);for(let R of a.headerFooterPartsBySection())for(let H of [R.headers,R.footers])for(let V of H.values())b.has(V)||(b.add(V),m(ug$1(V)));for(let R of ["footnote","endnote"]){let H=a.partFor({kind:"notesPart",noteKind:R});!H||b.has(H)||(b.add(H),m(ug$1(H)));}return or={packageRevision:s,bodyRoot:c,index:f},f}let Cn=new Set,ar=null,ir=null,pa=false;function sr(){pa||(ir=null);}function bs(){let s=ir;if(!s||!F)return null;let c=(m,b)=>m.paragraphId===b.paragraphId&&m.offset===b.offset;if(!c(F.anchor,s.anchor)||!c(F.head,s.head))return null;let f=a.reviewItems().find(m=>b$1(m)===s.key);return !f||f.kind==="revision"&&ar!==null&&ar.has(f.revisionKind)?null:f}function ma(){let s=bs();if(s)return xs(s);let c=F?.head;if(!c)return null;let m=h$1(a.reviewItems(),c,lp()).filter(b=>!(b.kind==="comment"&&b.resolved)&&!Cn.has(b$1(b))&&!(b.kind==="revision"&&ar!==null&&ar.has(b.revisionKind)))[0];return m?xs(m):null}function xs(s){if(s.kind!=="comment")return s;let c=j$4(a.reviewItems(),s);return Cn.has(b$1(c))?null:c}function Is(s){return s.kind==="comment"?s.comment.author:s.kind==="revision"?s.author:""}function Ss(){let s=a.reviewItems(),c=Wt;if(c!==null&&c.layout===U&&c.items===s&&c.styles===xt)return c;let f=d$1(c$1(U),(function*(){for(let K of s)yield Is(K);})()),m=c?.value,b=m!==void 0&&m.size===f.size&&[...f].every(([V,K])=>m.get(V)===K),R=b?m:f,H=c!==null&&b&&c.styles===xt?c.resolved:new Map(b$2(R,xt).map(V=>[V.author,V]));return Wt={layout:U,items:s,styles:xt,value:R,resolved:H},Wt}function dp(s,c,f){let m=s.split(P),b=m[0],R=c!==null&&b===b$1(c);if(s.startsWith("comment-")){let W=f.get(b),Q=W?.kind==="comment"&&W.resolved;return Q&&!R?null:R?`docx-comment-band docx-comment-band--active${Q?" docx-comment-band--resolved-active":""}`:"docx-comment-band"}if(s.startsWith("custom-"))return R?"docx-comment-band docx-comment-band--active":null;let H=f.get(b);if(!H||H.kind!=="revision")return null;let V=m.length>1?Number(m[1]):0;return `docx-revision-band docx-revision-band--${(W=>W==="delete"||W==="moveFrom"?"delete":W==="insert"||W==="moveTo"?"insert":W==="replace"&&H.replacedRangeCount!==void 0?V<H.replacedRangeCount?"delete":"insert":"other")(H.revisionKind)}${R?" docx-revision-band--active":""}`}let ks=null,Ts,ws=null;function Rn(s=false){let c=ma(),f=c?b$1(c):null,m=Ss();if(!s&&ks===U&&Ts===f&&ws===m.resolved)return;let b=new Map;for(let H of a.reviewItems())b.set(b$1(H),H);let R=[];for(let H of sp()){let V=dp(H.key,c,b);if(!V)continue;let K=b.get(H.key.split(P)[0]),ie=K?Is(K):"",W=ie===""?void 0:m.resolved.get(ie);R.push({...H,className:V,...W?{reviewAuthor:W}:{}});}j$3(v,U,R,{scale:i,...De?{pageOffsetX:De.pageOffsetX}:{}}),ks=U,Ts=f,ws=m.resolved;}function lr(){j$3(T,U,re?Pd$1(U,re.cellIds):Pe?yd$1(U,Pe):[],{scale:i,pageOffsetX:De?.pageOffsetX,...re?{}:{className:"docx-retained-selection-rect"}});}function Jr(s){let c=Ac$1(a.part());if(s)return c.find(b=>b.id===s)??null;let f=tr?c.find(b=>b.id===tr):void 0;if(f)return f;let m=F.head.paragraphId;return c.find(b=>b.beginParagraphId===m||b.endParagraphId===m||b.resultParagraphIds.includes(m))??(c.length===1?c[0]:null)}function dr(s){return Ac$1(a.part()).find(f=>f.beginParagraphId===s||f.endParagraphId===s||f.resultParagraphIds.includes(s))?.id??null}function ga(){return dr(F.anchor.paragraphId)!==null||dr(F.head.paragraphId)!==null}function cp(s){let c=eo(),f=(m,b="")=>typeof m=="string"?/(?:Id|Ids)$/.test(b)&&c.has(m):Array.isArray(m)?m.some(R=>f(R,b)):!m||typeof m!="object"?false:Object.entries(m).some(([R,H])=>f(H,R));return f(s)}function eo(){return new Set(Ac$1(a.part()).flatMap(s=>[s.beginParagraphId,...s.resultParagraphIds,s.endParagraphId]))}function ha(s){return new Set([s.beginParagraphId,s.endParagraphId,...s.resultParagraphIds])}function up(s){let c=0;for(let f of U.pages)for(let m of R(f))s.has(m.paragraphId)&&(c+=m.lines.length);return c}function ya(s,c){let f=new Set(c),m=new Map;for(let b of s.pages)for(let R$1 of R(b)){if(!f.has(R$1.paragraphId)||m.has(R$1.paragraphId))continue;let H=b.pageFieldSource;m.set(R$1.paragraphId,Xa$2(H?.pageNumber??b.index+1,H?.format));}return m}function va(s){if(Oe==="view"||!a.editable)return false;let c=Jr(s);return c?Hf$1(a.part(),{op:"rewriteTocPageNumbers",tocId:c.id,updates:[]})===null:false}function Ps(s,c){if(!Number.isInteger(s)||!Number.isInteger(c)||s<1||c<1)return null;let f=Yn.sectionPropertiesAt(F.head.paragraphId),m=f.pageSize.widthTwips-f.margins.leftTwips-f.margins.rightTwips-f.margins.gutterTwips,b=Math.max(300,Math.floor(m/c));return {op:"insertTable",beforeParagraphId:F.head.paragraphId,rows:s,cols:c,columnWidthTwips:b}}function Cs(s,c){if(Oe==="view"||!a.editable)return false;let f=Ps(s,c);return f!==null&&Hf$1(a.part(),f)===null}function fp(s,c){if(!Cs(s,c))return false;let f=Ps(s,c);if(!f)return false;let m=null,b=a.subscribe(H=>{H.caret&&(m=H.caret);}),R=false;try{ke(()=>{let H=Ee([f],we());return H.committed||($=H.reason??"the table could not be inserted here"),R=H.committed,H},()=>{let H=m;return H?Fe({paragraphId:H.paragraphId,offset:H.start}):null});}finally{b();}return R}let Rs='TOC \\o "1-3" \\h';function Es(){let s=zc$1(Rs);if(!s)return null;let c=a.documentOutline(),f=Ic$1(a.part(),c,s,ya(_e.layout(),c.map(m=>m.blockId)),eo());return {op:"insertToc",beforeParagraphId:F.head.paragraphId,instruction:Rs,alias:n.tocLabels?.title??"TOC",entries:f.entries,bookmarksToCreate:f.bookmarksToCreate}}function Fs(){if(Oe==="view"||!a.editable||ga())return false;let s=Es();return s!==null&&Hf$1(a.part(),s)===null}function pp(){if(!Fs())return false;let s=Es();if(!s)return false;let c=new Set(Ac$1(a.part()).map(b=>b.id)),f=a.applyTreeOps([s]);if(!f.committed)return $=f.reason??"the table of contents could not be inserted",false;let m=Ac$1(a.part()).find(b=>!c.has(b.id));return m?Os(m.id,"pageNumbers"):true}function Os(s,c="entire"){let f=Jr(s);if(!f||!va(f.id))return false;let m=_e.layout(),b=a.documentOutline(),R=b.map(V=>V.blockId);if(c==="entire"){let V=Ic$1(a.part(),b,f.instruction,ya(m,R),ha(f)),K=a.applyTreeOps([{op:"replaceTocResult",tocId:f.id,entries:V.entries,bookmarksToCreate:V.bookmarksToCreate}]);if(!K.committed)return $=K.reason??"the table of contents could not be refreshed",false;if(m=_e.layout(),f=Jr(f.id),!f)return true}let H$1="";for(let V=0;V<3;V+=1){let K=ya(m,R),ie=H(a.part(),f,b,ha(f)),W=f.resultParagraphIds.flatMap((Ie,Bt)=>{let un=ie[Bt],fr=un?K.get(un):void 0;return fr===void 0?[]:[{paragraphId:Ie,pageNumberText:fr}]});if(W.length===0)break;let Q=W.map(Ie=>`${Ie.paragraphId}\0${Ie.pageNumberText}`).join("");if(Q===H$1)break;H$1=Q;let de=a.applyTreeOps([{op:"rewriteTocPageNumbers",tocId:f.id,updates:W}]);if(!de.committed){if(de.rejected)return $=de.reason??"the table of contents page numbers were refused",false;break}m=_e.layout(),f=Jr(f.id)??f;}return true}let _e={session:a,storyScope:B,imageDecodePort:()=>Rt,layout:()=>(ye(),Je(),U),state:Be,currentPage:(s="caret")=>{if(ye(),Je(),s==="viewport"){let f=Bc(e,U,i);if(f!==null)return f}let c=Ed$1(U,F.head);return c?c.pageIndex+1:1},setScale(s){if(!(s>0)||!Number.isFinite(s))return false;if(s===i)return true;let c={scale:i,defaults:I,measurer:L,producer:D,furnitureSource:Ut};try{let f=ot(e),m=f?{x:(f.scrollLeft-e.offsetLeft+f.clientWidth/2)/i,y:(f.scrollTop-e.offsetTop+f.clientHeight/2)/i}:null;if(i=s,n.measurer||(I=td(i,{context:zn(e.ownerDocument),...n.fontAlias?{fontAlias:n.fontAlias}:{}}),L=I.measurer),D=g(),Ut=Oi({session:a,measurer:L,producer:D,cache:O,styleCascade:Ce,defaultTabStopPt:Re,displayMode:n.revisionDisplayMode??cb}),Lt=void 0,De=void 0,ln=null,$e.invalidateAll(a.packageRevision(),"zoom"),$e.flush(),f&&m){let b=Math.max(0,m.x*i+e.offsetLeft-f.clientWidth/2),R=Math.max(0,m.y*i+e.offsetTop-f.clientHeight/2),H=Number.isFinite(f.scrollWidth)?Math.max(0,f.scrollWidth-f.clientWidth):null,V=Number.isFinite(f.scrollHeight)?Math.max(0,f.scrollHeight-f.clientHeight):null;f.scrollLeft=H===null?b:Math.min(b,H),f.scrollTop=V===null?R:Math.min(R,V),Qr();}return !0}catch{(({scale:i,defaults:I,measurer:L,producer:D,furnitureSource:Ut}=c)),Lt=void 0,De=void 0,ln=null;try{$e.invalidateAll(a.packageRevision(),"zoom-rollback"),$e.flush();}catch{}return false}},enqueueType:Gr,flushPendingInput:ye,type(s){let c=cn(),f=c.collapseTo,m=G(f.paragraphId,f.offset,s.length),b=Oe==="suggest"?dn():null,R=b&&b.to.paragraphId===f.paragraphId?b.to.offset:f.offset,H=[...c.ops,{op:"insertText",paragraphId:f.paragraphId,offset:R,text:s}],V={paragraphId:f.paragraphId,start:R+s.length,end:R+s.length};ke(()=>A([...H,...m],H,we(),V),()=>Fe({paragraphId:f.paragraphId,offset:R+s.length}));},insertPlainText:s=>xa(s),deleteBackward(){let s=cn();if(s.ops.length>0){ke(()=>Ee(s.ops,we()),()=>Fe(s.collapseTo));return}let c=Me()??void 0,f=F.head;if(f.offset===0){for(let K of hc$1(U,f.paragraphId)){let ie=St(K);if(ie.length!==0){ke(()=>Ee([{op:"deleteText",paragraphId:K,start:ie.length-1,end:ie.length}],we()),()=>Fe({paragraphId:K,offset:ie.length-1}),{rearmPending:c});return}}let b=ee(),R=b.indexOf(f.paragraphId),H=b[R-1];if(!H)return;let V=St(H).length;ke(()=>Ee([{op:"joinParagraphs",firstId:H,secondId:f.paragraphId}],we()),()=>Fe({paragraphId:H,offset:V}),{rearmPending:c});return}let m=As(f,"before");if(m){ke(()=>Ee([{op:"removeContentControl",controlId:m.controlId,keepContent:false}],we()),()=>Fe({paragraphId:f.paragraphId,offset:m.start}),{rearmPending:c});return}ke(()=>Ee([{op:"deleteText",paragraphId:f.paragraphId,start:f.offset-1,end:f.offset}],we()),()=>Fe({...f,offset:f.offset-1}),{rearmPending:c});},splitParagraph(){let s=cn(),c=s.collapseTo,f=new Set(a.paragraphIdsIn(B())),m=Me()??void 0;ke(()=>Ee([...s.ops,{op:"splitParagraph",paragraphId:c.paragraphId,offset:c.offset}],we()),()=>{let b=a.paragraphIdsIn(B()).find(R=>!f.has(R));return b?Fe({paragraphId:b,offset:0}):null},{rearmPending:m});},navigate(s,c=false){ye();let f=Ki(U,F.head,s,Ft,y?.getActive()??null,te(),L);if(!f)return;let m=eo();if(m.has(f.position.paragraphId)){if(c)return;let R=new Set(["left","wordLeft","lineStart","up","pageUp"]).has(s)?"up":"down",H=up(m)+4;for(let V=0;V<H;V+=1){let K=Ki(U,f.position,R,f.desiredX,y?.getActive()??null,te(),L);if(!K||K.position.paragraphId===f.position.paragraphId&&K.position.offset===f.position.offset)return;if(f=K,!m.has(f.position.paragraphId))break}if(m.has(f.position.paragraphId))return}Ft=f.desiredX,x?.activeNoteScope()&&f.pageIndex!==void 0&&Number.isInteger(f.pageIndex)&&x.setActiveNotePageIndex(f.pageIndex),dt({anchor:c?F.anchor:f.position,head:f.position},true);},deleteWordBackward(){if(_e.deleteSelection())return;let s=F.head,c=Bd$1(St(s.paragraphId),s.offset,-1);if(c===s.offset){_e.deleteBackward();return}ke(()=>Ee([{op:"deleteText",paragraphId:s.paragraphId,start:c,end:s.offset}],we()),()=>Fe({...s,offset:c}),{rearmPending:Me()??void 0});},deleteWordForward(){if(_e.deleteSelection())return;let s=F.head,c=Bd$1(St(s.paragraphId),s.offset,1);if(c===s.offset){_e.deleteForward();return}ke(()=>Ee([{op:"deleteText",paragraphId:s.paragraphId,start:s.offset,end:c}],we()),void 0,{rearmPending:Me()??void 0});},deleteForward(){if(_e.deleteSelection())return;let s=Me()??void 0,c=F.head,f=St(c.paragraphId);if(c.offset<f.length){let R=As(c,"after");if(R){ke(()=>Ee([{op:"removeContentControl",controlId:R.controlId,keepContent:false}],we()),()=>Fe(c),{rearmPending:s});return}ke(()=>Ee([{op:"deleteText",paragraphId:c.paragraphId,start:c.offset,end:c.offset+1}],we()),void 0,{rearmPending:s});return}let m=ee(),b=m[m.indexOf(c.paragraphId)+1];if(b){if(hc$1(U,b).includes(c.paragraphId)){if(St(b).length===0)return;ke(()=>Ee([{op:"deleteText",paragraphId:b,start:0,end:1}],we()),()=>Fe(c),{rearmPending:s});return}ke(()=>Ee([{op:"joinParagraphs",firstId:c.paragraphId,secondId:b}],we()),()=>Fe(c),{rearmPending:s});}},...Yn,...kn,setSelection:s=>dt(s),revealPage(s,c){let f=U.pages.find(m=>m.index===s);return f?cr(f.box.y,f.box.height,c):false},revealParagraph(s,c){Je();let f=Ed$1(U,{paragraphId:s,offset:0});if(!f)return false;let m=U.pages.find(b=>b.index===f.pageIndex);return m?cr(m.contentBox.y+f.y,f.height,c):false},revealPosition(s,c){Je();let f=Ed$1(U,s);if(!f)return false;let m=U.pages.find(b=>b.index===f.pageIndex);return m?cr(m.contentBox.y+f.y,f.height,{block:"nearest",...c}):false},setEditable(s){gs=s,da();},selectAll(){let s=ee(),c=s[0],f=s[s.length-1];!c||!f||dt({anchor:{paragraphId:c,offset:0},head:{paragraphId:f,offset:St(f).length}});},hyperlinks:Qn,contentControls:Zt,canInsertTable:Cs,insertTable:fp,canInsertToc:Fs,insertToc:pp,canRefreshToc:va,refreshToc:Os,isInsideToc:s=>Ac$1(a.part()).some(c=>c.beginParagraphId===s||c.endParagraphId===s||c.resultParagraphIds.includes(s)),retainSelection:()=>{let s=Symbol("selection-pin");return be.set(s,F),Pe=F,lr(),s},releaseSelection:s=>{be.delete(s)&&(We(),lr());},retainedSelection:()=>Pe,publishedLayout:()=>U,overlayCoordinates:()=>Object.freeze({paintScale:i,pageOffsetX:De?.pageOffsetX??new Map}),commitReviewOps:s=>ke(()=>{if(Oe==="view")return {committed:false,rejected:true,opCount:0,reason:d};let c=s();return {committed:c.committed,rejected:!c.committed,opCount:0,...typeof c.reason=="string"?{reason:c.reason}:{}}},()=>{Je(),Ne.noteModelMoved();let c=ee();return c.length===0?null:Bo(U,c,F)}),applyAutomationOps:(s,c)=>{let f={committed:false,rejected:false,opCount:0},m=c??fa;return ke(()=>{let b=rr(false);if(b!==null)return f={committed:false,rejected:true,opCount:0,reason:b};let R=null,H=s(V=>{let K=rr(true,[],false);return K===null?a.ensureHyperlinkRelationship(V,m):(R=K,null)});return H===null?f={committed:false,rejected:true,opCount:0,reason:R??"this engine will not author that hyperlink target"}:f=Ee(H,void 0,void 0,m,false)},()=>{Je(),Ne.noteModelMoved();let b=ee();return b.length===0?null:Bo(U,b,F)}),f},editingMode:()=>Oe,setEditingMode:s=>{ye();let c=Oe!==s;Oe=s,c&&s==="view"&&y?.exitHeaderFooter(),Pn(),da(),zi(e,Oe),c&&tt(false),$=null,n.onChange?.(Be());},revisionAuthors:()=>Ss().value,setRevisionStyles:s=>{s!==xt&&(xt=s,ye(),tt(false));},setReviewActivationExclusions(s){ar=s===null?null:new Set(s),Rn(),n.onChange?.(Be());},activeReviewKey:()=>{let s=ma();return s?b$1(s):null},activateReview:(s,c)=>{if(Cn.clear(),ir=c?{key:s,anchor:c.anchor,head:c.head}:{key:s,anchor:F.anchor,head:F.head},c){pa=true;try{dt(c);}finally{pa=false;}return}Rn(),n.onChange?.(Be());},activatedReviewKey:()=>bs()===null?null:ir?.key??null,dismissActiveReview:()=>{let s=ma();s&&(Cn.add(b$1(s)),ir=null,Rn(),n.onChange?.(Be()));},navigation:an,bookmarks:()=>a.bookmarks(),selectedText(){if(re)return Qd$1(U,re);let{from:s,to:c}=dn();return Ic(U,s,c,ee())},deleteSelection(){let s=cn();return s.ops.length===0?false:(ke(()=>Ee(s.ops,we()),()=>Fe(s.collapseTo)),true)},setCellSelection:ys,layoutSession:()=>k,undo:()=>{if(Oe==="view"){$=d,n.onChange?.(Be());return}ye(),Ms(a.undo());},redo:()=>{if(Oe==="view"){$=d,n.onChange?.(Be());return}ye(),Ms(a.redo());},activeScope:()=>{let s=x?.activeNoteScope();return s||y.activeScope()},setActiveScope:s=>(ye(),s.kind==="note"?x.enterNote(s.id):s.kind!=="body"&&s.kind!=="headerFooter"?false:(x?.exitNote(),y.setActiveScope(s))),insertNote:s=>(ye(),x.insertNote(s)),deleteNote:(s,c)=>x.deleteNote(s,c),convertNote:(s,c)=>x.convertNote(s,c),convertAllNotes:s=>x.convertAllNotes(s),setNoteProperties:s=>x.setNoteProperties(s),enterNote:(s,c)=>(ye(),x.enterNote(s,c)),exitNote:()=>(ye(),x.exitNote()),notePropertiesState:()=>{let s=_e.state().selection.head.paragraphId,c=`${a.packageRevision()}:${s}`;if(c===M)return Z;let f=Ju(_e);return Z=f,M=c,f},notePreviewText:s=>ef(a,s),applyTableCommandPlan(s){if(!s.ok)return {ok:false,code:s.code,reason:s.reason};let c=null,f=a.subscribe(m=>{m.caret&&(c=m.caret);});try{let m=we(),b=s.selection.kind==="adoptCommittedCaret";ke(()=>Ee(s.ops,m),b?()=>{let R=c;return R?Fe({paragraphId:R.paragraphId,offset:R.start}):null}:void 0,s.selection.kind==="preserveSelection"?{keepCellSelection:!0}:void 0);}finally{f();}return $?{ok:false,code:"invalidArgs",reason:$}:{ok:true,changed:true}},enterHeaderFooter:s=>{ye();let c=y.enterHeaderFooter(s);if(!c)return c;let f=y.getActive(),m=f?U.pages[f.pageIndex]:void 0;if(f&&m){let b=f.kind==="header"?m.header:m.footer,R=b?.box.y??(f.kind==="header"?m.box.y:m.box.y+m.box.height-1),H=b?.box.height??1;cr(R,H,{block:"nearest"});}return c},exitHeaderFooter:()=>(ye(),y.exitHeaderFooter()),headerFooterState:()=>y.headerFooterStateStable(a.packageRevision()),...Gu({applyOps:Ee,commit:ke,deleteSelectionOps:mp,orderedStart:to,selectionMark:we,collapsedAt:Fe,isHeaderFooterOpen:()=>y?.getActive()!==null,lastRejection:()=>$}),...$u({session:a,applyOps:Ee,commit:ke,storyScope:B,selectionMark:we,editingMode:()=>Oe,author:()=>n.author,trackedDate:S,decodePort:()=>Rt}),focus:()=>E.focus({preventScroll:true}),setTableInteractionLabel(s){l.resolve=s;},refreshTableInteractionLabels(){ur.refreshLabels();},destroy(){ye(),N.removeEventListener("selectionchange",Ls),E.removeEventListener("keydown",Ns),E.removeEventListener("beforeinput",qs),E.removeEventListener("copy",_s),E.removeEventListener("cut",Zs),E.removeEventListener("paste",Bs),E.removeEventListener("compositionstart",Ds),E.removeEventListener("compositionend",Hs),N.removeEventListener("scroll",zs,{capture:true}),e.ownerDocument.defaultView?.removeEventListener("resize",ka),nr?.disconnect(),ua=null,ba?.destroy(),ur.destroy(),an.destroy(),Ne.destroy(),E.removeEventListener("contextmenu",fs),E.removeEventListener("click",ps),E.removeEventListener("pointermove",C),E.removeEventListener("pointerleave",ne),$e.cancel(),st!==null&&clearTimeout(st),st=null,Ve.dispose(),e$1(E),q.destroy(),$r(),e.replaceChildren();}};function Ms(s){if(Se=null,Ne.noteModelMoved(),Je(),!s){dt(Bo(U,ee(),F));return}dt({anchor:{paragraphId:s.paragraphId,offset:s.start},head:{paragraphId:s.paragraphId,offset:s.end}});}function cr(s,c,f){let m=ot(e);if(!m||m.clientHeight===0)return false;let b=s*i+e.offsetTop,R=c*i,H=f?.offsetPx??24,V=f?.block??"start",K=m.clientHeight;if(V==="nearest"||V==="centerIfNeeded"){let Q=b<m.scrollTop,de=b+R>m.scrollTop+K;if(!Q&&!de)return true}let ie=V==="center"||V==="centerIfNeeded"?b-Math.max(0,(K-R)/2):V==="nearest"&&b>m.scrollTop?b+R+H-K:b-H,W=Math.max(0,m.scrollHeight-K);return m.scrollTo({top:Math.max(0,Math.min(ie,W)),behavior:f?.behavior??"auto"}),Qr(),true}function we(){return Zo(F)}function dn(){return ye(),Ei(U,F,ee())}function to(){return dn().from}function St(s){return Id$1(U,s)}function As(s,c){let f=a.partFor(B())??a.part(),m=Fa(f,s.paragraphId);return !m||m.kind!=="paragraph"?null:c==="before"?Td$1(m,s.offset):Ud$1(m,s.offset)}function cn(){if(ye(),re){let f=[];for(let m of Nd(U,re.cellIds)){let b=Id$1(U,m).length;b>0&&f.push({op:"deleteText",paragraphId:m,start:0,end:b});}return {ops:f,collapseTo:to()}}if(F.anchor.paragraphId===F.head.paragraphId&&F.anchor.offset===F.head.offset)return {ops:[],collapseTo:Ad$1(U,F.head)};let{from:s,to:c}=dn();return Tc(U,a.partFor(B())??a.part(),s,c,ee())}function mp(){return cn().ops}let{onSelectionChange:Ls,onCompositionEnd:Hs}=Ne,Ds=(...s)=>{ye(),Ne.onCompositionStart(...s);},ba=null,gp=Mc(_e,n.onRequestHyperlink?{onRequestHyperlink:n.onRequestHyperlink}:{}),Ns=s=>{s.defaultPrevented||Ne.adoptBeforeInput(),gp(s);},{onCopy:_s,onCut:Zs,onPaste:Bs}=Ac(_e,xa),hp=Lc(_e,{isComposing:()=>Ne.isComposing(),insertPlainText:xa}),qs=s=>{Ne.adoptBeforeInput(),hp(s);};function xa(s){let c=Cc(s).split(`
|
|
14
|
+
`),f=cn(),m=f.collapseTo,b=c.join(""),R=[...f.ops],H=G(m.paragraphId,m.offset,b.length);b.length>0&&(R.push({op:"insertText",paragraphId:m.paragraphId,offset:m.offset,text:b}),R.push(...H));let V=[],K=0;for(let de=0;de<c.length-1;de+=1)K+=c[de].length,V.push(m.offset+K);if(V.length>0&&R.push({op:"splitParagraphMany",paragraphId:m.paragraphId,offsets:V}),R.length===0)return;let ie=new Set(a.paragraphIdsIn(B())),W=c[c.length-1],Q=R.filter(de=>!H.includes(de));ke(()=>A(R,Q,we()),()=>{if(V.length===0)return Fe({paragraphId:m.paragraphId,offset:m.offset+W.length});let de=a.paragraphIdsIn(B()).filter(Bt=>!ie.has(Bt)),Ie=de[de.length-1];return Ie?Fe({paragraphId:Ie,offset:W.length}):null});}N.addEventListener("selectionchange",Ls),E.addEventListener("keydown",Ns),E.addEventListener("beforeinput",qs),E.addEventListener("copy",_s),E.addEventListener("cut",Zs),E.addEventListener("paste",Bs),E.addEventListener("compositionstart",Ds),E.addEventListener("compositionend",Hs);let Ia=false;function Sa(){if(Ia)return;Ia=true;let s=e.ownerDocument.defaultView?.requestAnimationFrame,c=()=>{Ia=false,Qr();};s?s(c):queueMicrotask(c);}let zs=s=>{let c=ot(e);!c||s.target!==c||Sa();};N.addEventListener("scroll",zs,{capture:true,passive:true});let ka=()=>{Sa();},Ta=e.ownerDocument.defaultView;Ta?.addEventListener("resize",ka,{passive:true}),nr=typeof Ta?.ResizeObserver=="function"?new Ta.ResizeObserver(ka):null;function Ks(){if(!nr)return;let s=ot(e);s!==ua&&(nr.disconnect(),ua=s,s&&nr.observe(s));}Ks(),ba=Tu({pagesLayer:E,container:e,scale:()=>i,pageOffsetX:s=>De?.pageOffsetX.get(s)??0,layout:()=>U,measurer:()=>L,selection:()=>F,setSelection:s=>dt(s),cellSelection:()=>re,setCellSelection:s=>ys(s),focus:()=>E.focus({preventScroll:true}),activeHeaderFooter:()=>hu(y?.getActive()??null),activeNote:()=>{let s=x?.activeNoteScope();return s?{scopeId:s.id,pageIndex:x?.activeNotePageIndex()??null}:null},enterHeaderFooter:s=>{ye(),y?.enterHeaderFooter({rId:s.rId,pageIndex:s.pageIndex,kind:s.kind,...s.position?{position:s.position}:{}});},enterNote:(s,c,f)=>{ye(),x?.enterNote(s,c,f);},exitNote:s=>{ye(),x?.exitNote(s);},exitHeaderFooter:()=>(ye(),y?.exitHeaderFooter()),enterEmptyHeaderFooter:(s,c)=>{if(Oe==="view")return;ye();let f=k.multi?.spans,m=0,b=0;if(f&&f.length>0)for(let Q=0;Q<f.length;Q+=1){let de=f[Q];if(m=Q,b=de.startIndex,c<de.startIndex+de.pageCount)break}let R=a.headerFooterResolutionBySection(),H=R[Math.min(m,Math.max(0,R.length-1))],V=U.pages[c]?.pageFieldSource?.pageNumber??c+1,K=H?.evenAndOddHeaders&&V%2===0?"even":H?.titlePage&&c===b?"first":"default",ie=Q=>{let de=Q[Math.min(m,Math.max(0,Q.length-1))];return s==="header"?de?.headers:de?.footers},W=ie(R)?.get(K)?.rId;if(!W){if(!_e.applyHeaderFooterLifecycle?.({op:"createHeaderFooter",sectionIndex:m,kind:s,variant:K,...K==="first"?{titlePage:true}:{},...K==="even"?{evenAndOddHeaders:true}:{}})?.ok)return;W=ie(a.headerFooterResolutionBySection())?.get(K)?.rId;}W&&y?.enterHeaderFooter({rId:W,pageIndex:c,sectionIndex:m,kind:s,variant:K});},onContentControlWidget:(s,c)=>Jf(s,c),isReadOnlyParagraph:s=>dr(s)!==null},n.pointer?{mode:n.pointer}:{});let ur=eu({pagesLayer:E,furnitureLayer:w,scale:()=>i,pageOffsetX:s=>De?.pageOffsetX.get(s)??0,read:()=>({layout:U,storeRevision:a.packageRevision(),selection:F,cellSelection:re,editingMode:Oe,themeColors:a.documentThemeColors()}),session:()=>a,applyTableCommandPlan:s=>_e.applyTableCommandPlan(s),label:s=>l.resolve(s)});return tt(),da(),_e.setTableInteractionLabel=s=>{l.resolve=s,ur.refreshLabels();},_e.refreshTableInteractionLabels=()=>{ur.refreshLabels();},{ok:true,surface:_e}}function rf(){let e=new WeakMap;return t=>{let n=e.get(t);if(n)return n;let r=l$1(t,o=>R(o));for(let o of t.pages){for(let a of [o.header,o.footer])a&&nf(r,a.fragments,o.index,a.box.y);for(let a of [o.footnotes,o.endnotes])if(a)for(let i of a.notes)nf(r,i.fragments,o.index,i.box.y);}return e.set(t,r),r}}function nf(e,t,n,r){for(let o of S(t))for(let a of ic$1(o))e.has(a)||e.set(a,{pageIndex:n,contentY:r,fragmentY:o.box.y,...o.lines?{lines:o.lines}:{}});}function Ji(e){if(e==="")return;let t=globalThis.navigator?.clipboard;if(t?.writeText)try{t.writeText(e).catch(()=>{});}catch{}}function Rh(e){return e.evenPage?"even":e.firstPage?"first":"default"}function of(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'"}:Rh(e)}function es(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?of(t):n?.variant??"default";if(typeof a=="object"&&a.ok===false)return {ok:false,refusal:{ok:false,code:"invalidArgs",reason:a.reason}};let i=a,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:i}}function Eh(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 Vr(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}:Eh(n.reason)}function Qo(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 af(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=of(t);if(typeof o=="object"&&o.ok===false)return {ok:false,code:"invalidArgs",reason:o.reason};let a=o,l=Qo(e,n,r,a)?.rId,d=false;if(!l){let h=Vr(e,{op:"createHeaderFooter",sectionIndex:n,kind:r,variant:a,...a==="first"?{titlePage:true}:{},...a==="even"?{evenAndOddHeaders:true}:{}});if(!h.ok)return h;d=true,l=Qo(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 sf(e,t){let n=es(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=r?.rId,a=Vr(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 lf(e,t){let n=es(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=Vr(e,{op:"linkToPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!a.ok)return a;if(o){let i=Qo(e,n.sectionIndex,n.kind,n.variant);i?e.enterHeaderFooter({rId:i.rId,kind:n.kind,sectionIndex:n.sectionIndex}):e.exitHeaderFooter();}return a}function df(e,t){let n=es(e,t);if(!n.ok)return n.refusal;let r=e.headerFooterState(),o=!!r&&r.editing===n.kind&&r.sectionIndex===n.sectionIndex&&r.variant===n.variant,a=r?.rId,i=Vr(e,{op:"unlinkFromPrevious",sectionIndex:n.sectionIndex,kind:n.kind,variant:n.variant});if(!i.ok)return i;let l=Qo(e,n.sectionIndex,n.kind,n.variant);return o&&l&&l.rId!==a&&e.enterHeaderFooter({rId:l.rId,kind:n.kind,sectionIndex:n.sectionIndex}),i}function cf(e,t){let n=e.headerFooterState(),r=t.sectionIndex??n?.sectionIndex;return Vr(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 uf(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 ff(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 pf(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 mf(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 gf(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 hf(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 yf(e,t,n){switch(t.type){case "toggleMark":{let r=ri.get(t.mark);e.toggleRunProperty(r.localName,r.attributes);break}case "setMarkAttr":{let r=oi(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",t.rule==="multiple"?{line:String(Math.round(t.value*240)),lineRule:"auto"}:{line:String(Math.round(t.value*20)),lineRule:t.rule==="exact"?"exact":"atLeast"},{mergeAttributes:true});break;case "setParagraphSpacing":e.setParagraphProperty("spacing",{...t.beforePt!==void 0?{before:t.beforePt===null?null:String(Math.round(t.beforePt*20))}:{},...t.afterPt!==void 0?{after:t.afterPt===null?null:String(Math.round(t.afterPt*20))}:{}},{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 "setPageSetup":{let r=t.scope==="section"?e.state().selection.head.paragraphId:void 0,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 "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 af(e,t);case "exitHeaderFooter":return typeof e.exitHeaderFooter=="function"&&e.exitHeaderFooter(),{ok:true,changed:false};case "removeHeaderFooter":return sf(e,t);case "linkHeaderFooterToPrevious":return lf(e,t);case "unlinkHeaderFooterFromPrevious":return df(e,t);case "setHeaderFooterOptions":return cf(e,t);case "insertPageField":return uf(e,t);case "insertNote":return ff(e,t);case "deleteNote":return pf(e,t);case "convertNote":return mf(e,t);case "convertAllNotes":return gf(e,t);case "setNoteProperties":return hf(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(!Dn(t))return {ok:false,code:"unsupported",reason:"unsupported command"};let r=n?.admittedTablePlan??Vt({command:t,part:e.session.part(),layout:e.layout(),storeRevision:e.session.revision(),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 Ji(e.selectedText()),{ok:true,changed:false};case "cut":Ji(e.selectedText()),e.deleteSelection();break;case "paste":e.insertPlainText(t.text);break;case "setSelection":{if("range"in t&&ai(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&&Hn(t.range)?{range:t.range}:null;if(r===null)return {ok:false,code:"unsupported",reason:"unsupported selection form"};let o=Id(e.session.part(),e.session.paragraphAnchors(),r);return o.ok?(e.setSelection(o.selection),e.revealPosition(o.selection.head,{block:"centerIfNeeded"}),{ok:true,changed:false}):o}default:return Nr(t)?nc(e,t,n?.editor):{ok:false,code:"unsupported",reason:"unsupported command"}}return null}function Fh(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 i=r.getUint16(a+10,true),l=r.getUint32(a+16,true),d=0;for(let u=0;u<i;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 vf(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||Fh(r,524288)),schedule(r){let o=null,a=null,i=()=>{t=null,e.mount(r);},l=requestAnimationFrame(()=>{a!==null&&clearTimeout(a),a=null,o=setTimeout(i,0);});a=setTimeout(()=>{cancelAnimationFrame(l),i();},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 bf(e){return t=>{for(let n of e.customNodeDiagnostics)try{n(t);}catch{}}}function xf(e,t){t.customNodePayloadNamespaces.length!==0&&e.session.sweepCustomNodePayloads(t.customNodePayloadNamespaces);}function If(e){return e.kind==="comment"}function Oh(e){let t=new Map;for(let n of e){let r=n.item;if(!If(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 Mh(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(If);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 Sf(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=Mh(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=Oh(r);if(a==="ambiguous")return {ok:false,code:"ambiguous",reason:"duplicate comment records share an id"};let i=o,l=new Set;for(;i.parentId!==void 0&&!l.has(i.id);){l.add(i.id);let h=a.get(i.parentId);if(!h)break;i=h;}let d=false,u=false;return e.surface.commitReviewOps(()=>{let h=e.surface.session.packageRevision();return d=e.surface.session.setCommentResolved(i.id,n),u=d&&e.surface.session.packageRevision()!==h,{committed:u}}),d?(u&&e.bump(),{ok:true,changed:u}):{ok:false,code:"notFound",reason:"the comment could not be resolved"}}function kf(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 Ah="http://schemas.microsoft.com/office/word/2010/wordml",Lh="http://schemas.microsoft.com/office/word/2012/wordml",Hh=32;function on(e){return Lb(e)}function Dh(e){return e.kind==="textValue"?[]:e.children}function Jo(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(on(e)){let n=0;for(let r of le(e))n+=Jo(r);return n}let t=0;for(let n of Dh(e))t+=Jo(n);return t}function ts(e){for(let t of e.children)if(t.kind!=="textValue"&&(t.kind==="contentControlProperties"||t.localName==="sdtPr"))return t}function Nh(e){if(e.kind!=="textValue"){for(let t of e.attributes)if(t.localName==="val"&&t.namespaceUri===ma)return t.value}}function ns(e,t){if(e){for(let n of e.children)if(n.kind!=="textValue"&&n.localName===t)return Nh(n)}}function _h(e){if(!e)return "richText";for(let t of e.children){if(t.kind==="textValue")continue;let n=Zh(t);if(n!==void 0)return n}return "richText"}function Zh(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===Ah||t==="contentControlCheckbox"))return "checkbox";if(n==="repeatingSection"&&r===Lh)return "repeatingSection"}function rs(e){let t=ns(e,"lock");return t==="contentLocked"||t==="sdtContentLocked"}function Bh(e,t){if(rs(ts(t)))return true;let n=Ga(e,t.id);for(;n;){if(on(n)&&rs(ts(n)))return true;n=Ga(e,n.id);}return false}function as(e,t){let n=ts(e),r=ns(n,"tag"),o=ns(n,"alias"),a=t?Bh(t,e):rs(n);return {id:e.id,controlType:_h(n),...r!==void 0?{tag:r}:{},...o!==void 0?{alias:o}:{},...a?{locked:true}:{}}}function os(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 qh(e){let t=[],n=(r,o,a,i)=>{let l=o;for(let d of r)if(d.kind!=="paragraphProperties"){if(d.kind==="run"){l+=Jo(d);continue}if(d.kind==="hyperlink"){l=n(d.children,l,a,i);continue}if(on(d)&&i<Hh){let u=l,h=a+1;l=n(le(d),l,h,i+1),t.push({control:d,start:u,end:l,depth:h});continue}l+=Jo(d);}return l};return n(e.children,0,-1,0),t}function is(e,t,n){return qh(e).filter(r=>t>=r.start&&t<r.end).sort((r,o)=>o.depth-r.depth).map(r=>as(r.control,n))}function zh(e){let t=[],n=r=>{if(r.kind!=="textValue"){on(r)&&t.push(as(r,e));for(let o of r.children)n(o);}};return n(e.root),t}function ss(e,t){let n=[],r=Ga(e,t);for(;r;)on(r)&&n.push(as(r,e)),r=Ga(e,r.id);return n.reverse()}function Tf(e,t){return e?zh(e.session.part()).filter(n=>os(n,t)):[]}function ls(e,t){if(!e)return null;let n=e.session.part(),{paragraphId:r,offset:o}=e.state().selection.head,a=Fa(n,r);if(a&&a.kind==="paragraph"){for(let l of is(a,o,n))if(os(l,t))return l}let i=ss(n,r);for(let l=i.length-1;l>=0;l-=1){let d=i[l];if(os(d,t))return d}return null}function ds(e){return e.type==="setContentControlValue"||e.type==="removeContentControl"}function Kh(e){return typeof e=="object"&&e!==null&&"container"in e&&"path"in e}function Vh(e){return typeof e=="object"&&e!==null&&"from"in e&&"to"in e}function jh(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 ea(e){let t=[];for(let n of e)n.kind!=="textValue"&&(n.kind==="paragraph"||n.kind==="table"||on(n))&&t.push(n);return t}function Uh(e){let t=[];for(let n of e.children)if(n.kind==="tableRow")for(let r of n.children)r.kind==="tableCell"&&t.push(...ea(r.children));return t}function Wh(e){return e.kind==="table"?Uh(e):on(e)?ea(le(e)):e.kind==="body"?ea(e.children):[]}function Gh(e,t,n){if(on(t))return {ok:true,controlId:t.id};if(t.kind==="paragraph"){let r=n??0;for(let i of is(t,r,e))return {ok:true,controlId:i.id};let a=ss(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 $h(e,t){if(t.container.part!=="body")return {ok:false,code:"unsupported",reason:"only the body container is supported",target:t};let n=jh(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=ea(n.children),o=null;for(let i=0;i<t.path.length;i+=1){if(o=r[t.path[i]]??null,!o)return {ok:false,code:"notFound",reason:`block index ${t.path[i]} is out of range`,target:t};i<t.path.length-1&&(r=Wh(o));}if(!o)return {ok:false,code:"notFound",reason:"the addressed block was not found",target:t};let a=Gh(e,o,t.offset);return a.ok?a:{...a,target:t}}function Xh(e,t,n){let r=Or(e,t,n);if(!r.ok)return {ok:false,code:r.code,reason:r.reason,target:n};let o=Fa(e,r.span.nodeId);if(!o||o.kind!=="paragraph")return {ok:false,code:"notFound",reason:`paragraph '${n.paraId}' was not found`,target:n};let a=r.span.start;for(let d of is(o,a,e))return {ok:true,controlId:d.id};let l=ss(e,o.id).at(-1);return l?{ok:true,controlId:l.id}:{ok:false,code:"notFound",reason:`no content control encloses paragraph '${n.paraId}'`,target:n}}function wf(e,t){if(t===void 0){let r=ls(e);return r?{ok:true,controlId:r.id}:{ok:false,code:"notFound",reason:"no content control at the current selection"}}if(Vh(t))return {ok:false,code:"unsupported",reason:"DocRange targeting is not supported for content controls",target:t};let n=e.session.part();return Kh(t)?$h(n,t):Nt(t)?Xh(n,e.session.paragraphAnchors(),t):{ok:false,code:"invalidArgs",reason:"unrecognized target shape",target:t}}function Pf(e){switch(e){case "locked":case "bound":case "typeMismatch":case "invalidArgs":case "unsupported":return e;case "unknown-control":return "notFound";default:return "unsupported"}}function Cf(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";default:return `the edit was refused (${e})`}}function Yh(e,t){return {ok:false,code:Pf(e),reason:Cf(e),...t!==void 0?{target:t}:{}}}function Qh(e,t,n,r){return r?.scope&&r.scope.kind!=="body"?{ok:false,refusal:{ok:false,code:"unsupported",reason:"only the body scope is supported"}}: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 cs(e){return e==="viewing"?"view":e==="suggesting"?"suggesting":"edit"}function us(e,t,n,r){let o=Qh(e,t,n,r);if(!o.ok)return o.refusal;let a=wf(t,e.target);if(!a.ok)return {ok:false,code:a.code,reason:a.reason};let i=e.type==="setContentControlValue"?{op:"setContentControlValue",controlId:a.controlId,value:e.value}:{op:"removeContentControl",controlId:a.controlId},l=Hf$1(t.session.part(),i);return l?{ok:false,code:Pf(l),reason:Cf(l)}:{ok:true}}function Rf(e,t){let n=wf(e,t.target);if(!n.ok){let l=n.target??t.target;return {ok:false,code:n.code,reason:n.reason,...l!==void 0?{target:l}:{}}}e.flushPendingInput();let r=e.session.revision(),o=Zo(e.state().selection),a=t.type==="setContentControlValue"?{op:"setContentControlValue",controlId:n.controlId,value:t.value}:{op:"removeContentControl",controlId:n.controlId},i=e.session.applyTreeOps([a],o,o);return i.rejected?Yh(i.reason??"unsupported",t.target):(e.layout(),{ok:true,changed:e.session.revision()!==r})}var Ef=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function ta(e){let t=e?.defaultFont?.family;return t!==void 0&&Ef.test(t)?t:Ro.family}function Ff(e,t){let n=new Map,r=l=>{if(l===void 0||!Ef.test(l))return;let d=l.toLowerCase();n.has(d)||n.set(d,l);};r(ta(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 i=[...n.values()];return i.sort((l,d)=>l<d?-1:l>d?1:0),i}var Jh={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Of(e$1,t){let n=[],r=[],o=t.aggregateBudget,a=new Set;for(let i$1 of e$1){let l=Jh[i$1.style],d=Object.freeze({family:i$1.family,weight:l.weight,style:l.style});if(i$1.family.trim().length===0){r.push({request:d,partName:i$1.partName,reason:"malformed"});continue}let u=e(d);if(!(t.shadowedRequests?.has(u)||a.has(u))){if(a.add(u),i$1.bytes.byteLength>t.maxFontBytes||i$1.bytes.byteLength>o){r.push({request:d,partName:i$1.partName,reason:"overLimit"});continue}o-=i$1.bytes.byteLength,n.push({request:d,id:`embedded:${i$1.partName}#${i$1.style}`,bytes:i$1.bytes,hash:i(i$1.bytes),faceIndex:0});}}return {sources:n,dropped:r}}var e0="The quick brown fox 0123 \u2014 {}#@",t0=["monospace","serif"],n0=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Mf(e){if(!e)return ()=>true;let t=new Map,n=r=>(e.font=r,e.measureText(e0).width);return r=>{let o=t.get(r);if(o!==void 0)return o;if(!n0.test(r))return t.set(r,true),true;let a=false;for(let i of t0){let l=n(`32px ${i}`);if(n(`32px "${r}", ${i}`)!==l){a=true;break}}return t.set(r,a),a}}function Af(e,t,n){let r=[];for(let o of e){if(t(o)||n(o))continue;let a=qd$2.get(o.toLowerCase());a!==void 0&&n(a)||r.push(o);}return r}var Lf=Object.freeze({installed:0,alias:()=>{},dispose(){}});function r0(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 o0(){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 Hf(e,t=o0(),n=[]){let{fontSet:r,createFontFace:o}=t;if(!r||!o||e.length===0)return Lf;let a=new Map;for(let u of e){let h=u.request.family,P=a.get(h);P?P.push(u):a.set(h,[u]);}let i=new Map,l=[];if(await Promise.all([...a].map(async([u,h])=>{let P=r0(h.map(I=>I.hash)),S=false;await Promise.all(h.map(async I=>{try{let L=o(P,I.bytes,{weight:String(I.request.weight),style:I.request.style});await L.load(),r.add(L),l.push(L),S=!0;}catch{}})),S&&i.set(u,P);})),l.length===0)return Lf;for(let u of n){if(i.has(u.from.family))continue;let h=i.get(u.to.family);h!==void 0&&i.set(u.from.family,h);}let d=false;return {installed:l.length,alias:u=>d?void 0:i.get(u),dispose(){if(!d){d=true;for(let u of l)try{r.delete(u);}catch{}}}}}var jr=.1,Ur=5;var Gn={type:"fit",fit:"pageWidth",minZoom:.5,maxZoom:1},a0={type:"fit",fit:"pageWidth"},na={type:"fixed"};function ra(e){return e==="auto"?Gn:!e||typeof e!="object"?null:e.type==="fixed"?na:e.type==="fit"&&e.fit==="pageWidth"?oa(e,Gn)?Gn:e:null}function oa(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 $n(e){return e.type==="fit"}function Nf({availableWidthPx:e,pageWidthPx:t,gutterPx:n=24,minZoom:r=.1,maxZoom:o=5}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return null;let a=Number.isFinite(n)&&n>0?n:0,i=Math.max(e-2*a,e*.5),l=Number.isFinite(r)?Df(r):.1,d=Number.isFinite(o)?Df(o):5,u=Math.floor(i/t*100)/100;return Math.min(Math.max(u,l),Math.max(d,l))}function Df(e){return Math.min(Math.max(e,.1),5)}function i0(e){let t=ot(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 _f(e){let t=null,n=null,r=null,o=null;function a(){if(r===null)return;n?.ownerDocument.defaultView?.cancelAnimationFrame(r),r=null;}function i(){let d=e.mode();if(!$n(d))return;let u=e.container();if(!u)return;let h=i0(u);if(h===null)return;let P=e.pageWidthPx();if(P===null)return;o=e.pageWidthTwips();let S=Nf({availableWidthPx:h,pageWidthPx:P,...d.minZoom!==void 0?{minZoom:d.minZoom}:{},...d.maxZoom!==void 0?{maxZoom:d.maxZoom}:{}});S===null||S===e.zoom()||e.applyZoom(S);}function l(){let d=n?.ownerDocument.defaultView;if(!d?.requestAnimationFrame){i();return}r===null&&(r=d.requestAnimationFrame(()=>{r=null,i();}));}return {refitIfPageResized(){let d=e.pageWidthTwips();d===null||d===o||i();},attach(){this.detach();let d=e.container();if(!d)return;let u=ot(d);u&&(n=u,typeof ResizeObserver<"u"&&(t=new ResizeObserver(l),t.observe(u)),i());},refit:i,detach(){a(),t?.disconnect(),t=null,n=null,o=null;}}}function Bf(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=ra(e.zoomMode??(n!==null?na:"auto"))??Gn;function a(d,u){if(d===r)return u?.(),true;let h=t.surface();return h&&!tf(h,d*(96/72))?false:(r=d,u?.(),t.bump(),t.emitSelectionChange(),true)}function i(){o=na,l.detach();}let l=_f({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:()=>{$n(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=$n(o);return d===r?u?(i(),t.bump(),t.emitSelectionChange(),{ok:true,changed:true}):{ok:true,changed:false}:a(d,u?i:void 0)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:`the mounted surface could not apply zoom ${d}`}},setZoomMode(d){let u=ra(d);return u?oa(u,o)?{ok:true,changed:false}:(o=u,$n(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 Zf(e){let t=1.3333333333333333;return {x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t}}function qf(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:Zf(r.box),contentBox:Zf(r.contentBox)})):[]}}}var Ct="comments and tracked changes require the pro review module (@docx-editor.dev/pro)",aa={mode:null,rejection:null};function zf(e,t){return e===void 0||e==="view"?aa: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:Ct}}function Kf(e){return e.viewOnly||e.currentMode!=="editing"||e.readerChoseMode||!(e.trackRevisions&&!e.hostChoseMode)&&!e.restrictedToTrackedChanges||!e.reviewEnabled?aa:e.hasAuthor?{mode:"suggesting",rejection:null}:{mode:null,rejection:"this document asks for tracked changes, but no author is configured"}}var Vf=new Map;function jf(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$2(o,t);return n={slots:o,colors:t,value:a},a},styleFor:o=>((!r||r.colors!==t)&&(r={colors:t,value:a$3(t)}),r.value.get(o))}}var c0=Object.freeze({kind:"body"}),Wf=Object.freeze([]);function u0(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$3=a$2(e$1.modules),i=bf(a$3),l=a$3.review!==null,d$1=null,u=vf({mount:p=>Ce(p),scheduled:()=>{M(),le();}}),h=e$1.mode==="view"?"viewing":"editing",P=null,S$1=jf(e$1.revisionStyles),I=false,L=null,O=e$1.mode??"edit",k=zf(e$1.mode,{reviewEnabled:l,hasAuthor:!!e$1.author});k.mode!==null&&(h=k.mode),k.rejection!==null&&(L=k.rejection);let g$1=null,D=null,N$1=null,E=null,T=null,v=null,w=[],q=()=>w[w.length-1]??{},z=false,X,Y,F=null;function re(){F?.dispose(),F=null;}let $=0,Te,fe=()=>typeof e$1.fonts=="function"?Te:e$1.fonts,Pe=-1,be=false,We=null,at=p=>(We||(We=Mf(o?zn(o.ownerDocument):null)),We(p)),Ge=null,Se=()=>{let p=fe();return (Ge===null||Ge.configuration!==p)&&(Ge={configuration:p,families:new Set([...(p?.sources??[]).map(C=>C.request.family),...(p?.substitutions??[]).map(C=>C.from.family)].filter(C=>typeof C=="string"&&C.trim().length>0).map(C=>C.toLowerCase()))}),Ge.families},yt=p=>Se().has(p.toLowerCase())||F?.alias(p)!==void 0,Me=()=>!g$1||be||!g$1.session.rendersText()?Wf:Af(g$1.session.documentFonts(),yt,at),qe=0,A=null,G=null,y=-1,x=0,Z=-1;function M(){qe+=1;}let B={change:new Set,selectionChange:new Set,error:new Set};function te(p){for(let C of [...B.error])C(p);}function ee(p){for(let C of [...B.change])C(p);}function le(){if(B.selectionChange.size===0)return;let p=ue();for(let C of [...B.selectionChange])C(p);}function Le(){N$1?.(),N$1=null,g$1?.destroy(),g$1=null,E=null,T=null,v=null,x+=1;}let He=Bf(e$1,{container:()=>o,surface:()=>g$1,bump:M,emitSelectionChange:le}),it=()=>He.scale();function Ce(p){if(!o){d$1=p,D=null,M();return}Le();let C=Qi(o,p,{scale:it(),defaultFontFamily:ta(fe()),...e$1.translate?{drawingStrings:g$2(e$1.translate)}:{},...e$1.author?{author:e$1.author}:{},...S$1.current()!==void 0?{revisionStyles:S$1.current()}:{},editingMode:h==="suggesting"?"suggest":h==="viewing"?"view":"edit",...l?{}:{revisionDisplayMode:"proposed"},...a$3.review?{reviewModel:{...a$3.review,collectReviewItems:_=>a$3.review.collectReviewItems(a$3.customNodes.length>0?{..._,customNodes:a$3.customNodes,...a$3.customNodeDiagnostics.length>0?{reportCustomNodeDiagnostic:i}:{}}:_)}}:{},...X?{measurer:X,...Y?{producer:Y}:{}}:{},...F?{fontAlias:F.alias}:{},...e$1.tableInteractionLabel?{tableInteractionLabel:e$1.tableInteractionLabel}:{},...e$1.imageDecodePort?{imageDecodePort:e$1.imageDecodePort}:{},onHyperlinkPopover:_=>q().onPopover?.(_),onRequestHyperlink:()=>q().onRequest?.(),onTrackedChange:()=>{It||(It=true,M(),le());},tocLabels:r,onChange:_=>{if(!g$1)return;M();let ne=_.pendingFormat!==T;T=_.pendingFormat;let j=g$1.headerFooterState?.(),ae=j?.editing&&j.rId?`${j.editing}:${j.rId}`:null,pe=ae!==v;v=ae,!(ii(_.selection,E)&&!ne&&!pe)&&(E=_.selection,le());}});if(!C.ok){D=C.detail?`${C.reason}: ${C.detail}`:C.reason,M(),te(Nn(C.reason,`failed to open document: ${D}`));return}D=null,g$1=C.surface,Xr(),xf(g$1,a$3),x+=1,g$1.setEditable(h!=="viewing"),P!==null&&g$1.setReviewActivationExclusions(P),E=g$1.state().selection,N$1=g$1.session.subscribe(_=>{let ne={revision:_.toRevision,created:_.created,deleted:_.deleted,dirty:_.dirty};He.refitIfPageResized(),M(),ee(ne);}),He.attach(),M(),ee({revision:g$1.session.revision()}),le(),Pe!==$&&(Pe=$,In($,g$1));}function ze(p){if(u.cancel(),$+=1,X=void 0,Y=void 0,Te=void 0,re(),be=false,o){let C=ot(o);C&&(C.scrollTop=0,C.scrollLeft=0);}o&&u.shouldYield(p)?u.schedule(p):Ce(p);}function Re(p){(p.code==="wasmUnavailable"||p.cause instanceof j&&p.cause.code==="unsupportedRuntime")&&!e$1.onFontError&&B.error.size===0&&md(p);try{e$1.onFontError?.(p);}catch{}te(p);}async function In(p,C){let _=e$1.fonts,ne=C.session.embeddedFonts();if(!(!_&&ne.length===0)){be=true,M();try{let j=typeof _=="function"?await _({families:C.session.documentFonts().slice(0,Xa),defaultFamily:ta(fe())}):_;if(z||p!==$){p===$&&(be=!1);return}if(Te=j,!j&&ne.length===0){be=!1,M();return}let ae=(j&&"maxFontBytes"in j?j.maxFontBytes:void 0)??a$1,pe=(j?.sources??[]).reduce((me,Ae)=>me+Ae.bytes.byteLength,0),xe=new Set((j?.sources??[]).filter(me=>me.request.family.trim().length>0).map(me=>e(me.request))),J=Of(ne,{maxFontBytes:ae,aggregateBudget:Math.max(0,c-pe),shadowedRequests:xe});for(let me of J.dropped)Re(new a(me.reason,me.reason==="overLimit"?`embedded font ${me.request.family} (${me.partName}) exceeds the font byte budget`:`embedded font part ${me.partName} declares an invalid family name`,{request:me.request}));let ve=Eo({epoch:p,...j},J);if(ve.sources.length===0){be=!1,M(),j&&Re(new a("missing","the supplied font configuration contains no usable sources; the fixed measurer stays in effect"));return}let ce=await Co(ve);if(z||p!==$){Ln(ce),p===$&&(be=!1);return}let Ze=new Set;for(let me of J.sources){let Ae=ce.fonts.resolve(me.request);Ae instanceof d&&(Re(An(Ae)),Ze.add(me.id));}if(Ze.size>0&&Ze.size<J.sources.length){let me=J.sources.filter(Qt=>!Ze.has(Qt.id)),Ae=ce;if(ce=await Co(Eo({epoch:p,...j},{sources:me})),Ln(Ae),z||p!==$){Ln(ce),p===$&&(be=!1);return}}else if(Ze.size===J.sources.length&&!j){be=!1,M();return}let sn=[...j?.sources??[],...J.sources].filter(me=>!Ze.has(me.id)).map(me=>{let Ae=ce.fonts.resolve(me.request);return Ae instanceof d||Ae.id!==me.id?null:{request:me.request,id:Ae.id,bytes:Ae.bytes,hash:Ae.hash,faceIndex:Ae.faceIndex}}).filter(me=>me!==null),lt=await Hf(sn,void 0,ve.substitutions??[]);if(z||p!==$){lt.dispose(),Ln(ce),p===$&&(be=!1);return}re(),F=lt;let Yt=td(it(),{context:o?zn(o.ownerDocument):null,...F?{fontAlias:F.alias}:{}}),wn=new Map;if(X=vd$1({shaper:ce.shaper,resolveFont:me=>{let Ae=me.fontFamily??ve.defaultFont.family;if(Ae.trim().length===0)return null;let Qt={family:Ae,weight:me.bold?700:400,style:me.italic?"italic":"normal"},At=e(Qt);if(wn.has(At))return wn.get(At)??null;let et;try{et=ce.fonts.resolve(Qt);}catch{return wn.set(At,null),null}let Pn=et instanceof d?null:et;return wn.set(At,Pn),Pn},fallback:Yt.measurer,shapingLibrary:g,unicodeDataVersion:"16.0.0",...ve.language?{language:ve.language}:{}}),Y=`shaped:${ce.operation.extensionFingerprint}+fallback:${Yt.producer}@scale:${it()}`,be=!1,g$1){g$1.flushPendingInput();let me=g$1.session.save(),Ae=g$1.state().selection,Qt=typeof document<"u"&&document.activeElement!==null&&o!==null&&o.contains(document.activeElement);try{Ce(me);}catch(At){X=void 0,Y=void 0,g$1||(d$1=me,Ce(me)),Re(An(At));}Qt&&g$1?.focus(),g$1?.setSelection(Ae);}else M();}catch(j){if(z||p!==$)return;be=false,M(),Re(An(j));}}}let Rt=Vd();function Ve(){let p=g$1?.state()??null;return {scope:g$1?.activeScope?.()??c0,isLoading:D===null&&g$1===null&&d$1===null&&!u.isScheduled(),isOpening:u.isScheduled(),parseError:D,editable:g$1!==null&&g$1.session.editable&&O!=="view"&&h!=="viewing",zoom:He.zoom(),zoomMode:He.mode(),selection:bi(g$1),selectionCollapsed:p===null||p.selection.anchor.paragraphId===p.selection.head.paragraphId&&p.selection.anchor.offset===p.selection.head.offset,formatting:rc(g$1),table:Si(g$1),tocContext:Rt(p?.contextTocId??null),image:_t(g$1),page:{current:Ii(g$1),total:xi(g$1)},canUndo:p?.canUndo??false,canRedo:p?.canRedo??false,pageSetup:vi(g$1),reviewPaneOpen:It,hasReviewContent:g$1?.session.hasReviewContent()??false,editingMode:h,lastRejection:p?.lastRejection??L,fontSubstitutions:Me()}}function ue(){if(A&&Z===qe)return A;let p=A,C=g$1?.state().selection??null,_=ii(C,G);G=C;let ne=g$1?.session.packageRevision()??-1,j=ne===y;y=ne;let ae=Ve(),pe=ae;if(p){let xe=Bd(ae.formatting,p.formatting)?p.formatting:ae.formatting,J=qd(ae.page,p.page)?p.page:ae.page,ve=zd(ae.pageSetup??null,p.pageSetup??null)?p.pageSetup:ae.pageSetup,ce=Kd(ae.selection,p.selection)?p.selection:ae.selection,Ze=Xd(ae.image,p.image)?p.image:ae.image,sn=p.fontSubstitutions!==void 0&&ae.fontSubstitutions!==void 0&&p.fontSubstitutions.length===ae.fontSubstitutions.length&&ae.fontSubstitutions.every((lt,Yt)=>p.fontSubstitutions[Yt]===lt)?p.fontSubstitutions:ae.fontSubstitutions;pe={...ae,formatting:xe,page:J,pageSetup:ve,selection:ce,image:Ze,fontSubstitutions:sn},jd(pe,p)&&_&&j&&(pe=p);}return A=Ao(pe),Z=qe,A}if(e$1.document){let p=si(e$1.document);p?ze(p):(D=li(e$1.document),te(Nn("unsupported",D)));}let ge=0,Et=null,vt="",Xn=null,jt=true,Ut=null;function ia(){let p=`${g$1?.session.packageRevision()??-1}:${g$1?.session.revision()??-1}`,C=$e(),_=Gr()?.anchorY??null;return (g$1!==Et||p!==vt||C!==Xn||It!==jt||_!==Ut)&&(Et=g$1,vt=p,Xn=C,jt=It,Ut=_,ge+=1),ge}function bt(p){return p.kind==="revision"?p.ranges[0]??null:p.range}function Sn(p){return bt(p)===null?false:!(p.kind==="revision"&&P!==null&&P.includes(p.revisionKind))}let U=rf(),xt=new WeakMap;function Wt(p){let C=xt.get(p);if(C)return C;let _=new Map;for(let ne of p.pages)for(let j of [ne.footnotes,ne.endnotes])if(j)for(let ae of j.notes)for(let pe of S(ae.fragments))for(let xe of ic$1(pe))_.has(xe)||_.set(xe,ae.scopeId);return xt.set(p,_),_}function kn(p){let C=bt(p)?.partName;if(!C||!g$1||C===g$1.session.part().name)return null;for(let _ of g$1.session.headerFooterResolutionBySection())for(let ne of ["header","footer"]){let j=ne==="header"?_.headers:_.footers;for(let ae of j.values())if(ae.partName===C)return {kind:ne,rId:ae.rId}}return null}function Yn(p){let C=bt(p),_=g$1?.publishedLayout();return !C||!_?null:Wt(_).get(C.start.paragraphId)??null}function Qn(p){let C=bt(p)?.partName;if(!C||!g$1)return null;for(let _ of ["footnote","endnote"])if(Yd$1(g$1.session.currentPackage(),_)?.name===C)return {kind:"notesPart",noteKind:_};return null}function an(p){let C=kn(p);return C!==null?{kind:"headerFooter",rId:C.rId}:Qn(p)??{kind:"body"}}function Ft(p){!g$1||g$1.activeScope().kind==="body"||g$1.session.paragraphIds().includes(p)&&(g$1.exitNote?.(),g$1.exitHeaderFooter?.());}let Jn=()=>`${new Date().toISOString().slice(0,19)}Z`,It=true,st=new WeakMap;function sa(p){let C=st.get(p);if(C)return C;let _=new Map;for(let[ne,j]of fc$1(p).entries())_.set(j,ne);return st.set(p,_),_}function Wr(){g$1?.flushPendingInput();let p=g$1?.retainedSelection()??g$1?.state().selection??null;if(!p)return null;let{anchor:C,head:_}=p;if(C.paragraphId===_.paragraphId&&C.offset===_.offset)return null;let ne=g$1?.publishedLayout();if(!ne)return null;let j=sa(ne),ae=j.get(C.paragraphId)??-1,pe=j.get(_.paragraphId)??-1;if(ae===-1||pe===-1){let J=er();ae=J.get(C.paragraphId)??-1,pe=J.get(_.paragraphId)??-1;}return ae===-1||pe===-1?null:ae<pe||ae===pe&&C.offset<=_.offset?{from:C,to:_}:{from:_,to:C}}function Ot(){let p=g$1?.activeScope();if(p?.kind==="headerFooter")return {kind:"headerFooter",rId:p.rId};if(p?.kind==="note"){let C=fd(p.id);if(C)return {kind:"notesPart",noteKind:C.noteKind}}return {kind:"body"}}function Gt(p){if(!g$1)return {kind:"body"};let C=p.slice(0,p.indexOf("#"));if(C.length===0||C===g$1.session.part().name)return {kind:"body"};for(let _ of g$1.session.headerFooterResolutionBySection())for(let ne of [_.headers,_.footers])for(let j of ne.values())if(j.partName===C)return {kind:"headerFooter",rId:j.rId};for(let _ of ["footnote","endnote"])if(Yd$1(g$1.session.currentPackage(),_)?.name===C)return {kind:"notesPart",noteKind:_};return Ot()}function er(){if(!g$1)return new Map;let p=Ot();if(p.kind==="body")return new Map;let C=new Map;for(let[_,ne]of g$1.session.paragraphIdsIn(p).entries())C.set(ne,_);return C}function ye(p){if(p.kind==="revision"){let _=p.ranges;if(_.length===0)return null;let j=p.revisionKind==="replace"||p.revisionKind==="insert"||p.revisionKind==="delete"?_[_.length-1]:_[0];return {start:_[0].start,end:j.end}}let C=bt(p);return C?{start:C.start,end:C.end}:null}function Gr(){if(g$1&&g$1.activatedReviewKey()!==null)return null;let p=Wr(),C=g$1?.publishedLayout();if(!p||!C)return null;let _=U(C).get(p.from.paragraphId);return _?{pageIndex:_.pageIndex,anchorY:_.contentY+k$2(_,p.from.paragraphId,p.from.offset)}:null}function $e(){return g$1?.activeReviewKey()??null}function Mt(p){if(!l)return [];let C=g$1?.session.reviewItems()??[],_=p?.excludeRevisionKinds;if(_&&_.length>0){let J=new Set(_);C=C.filter(ce=>ce.kind!=="revision"||!J.has(ce.revisionKind));let ve=new Set(C.filter(ce=>ce.kind==="revision").map(ce=>ce.id));C=C.map(ce=>{if(ce.kind!=="comment"||ce.parentRevisionId===void 0||ve.has(ce.parentRevisionId))return ce;let{parentRevisionId:Ze,...sn}=ce;return sn});}let ne=p?.placement!==false,j=null;if(ne&&C.length>0){let J=g$1?.publishedLayout()??null;J&&(j=U(J));}let ae=$e(),pe=J=>{let ve=kn(J);return ve===null?1:ve.kind==="header"?0:2},xe=C.map((J,ve)=>({item:J,position:ve,pageIndex:j?m$1(J,j)?.pageIndex??null:null,group:pe(J)}));return xe.sort((J,ve)=>{let ce=J.pageIndex??Number.MAX_SAFE_INTEGER,Ze=ve.pageIndex??Number.MAX_SAFE_INTEGER;return ce!==Ze?ce-Ze:J.group!==ve.group?J.group-ve.group:J.position-ve.position}),xe.map(({item:J})=>{let ve=b$1(J),ce=j?m$1(J,j):null,Ze={key:ve,id:J.id,...$t(J)!==void 0?{date:$t(J)}:{},activatable:Sn(J),anchorY:ce?.y??null,pageIndex:ce?.pageIndex??null,isActive:ve===ae};return J.kind==="comment"?{...Ze,kind:"comment",author:J.comment.author,initials:d$3(J.comment),text:c$2(J.comment),resolved:J.resolved,...J.parentId!==void 0?{parentId:J.parentId}:{},...J.parentRevisionId!==void 0?{parentRevisionId:J.parentRevisionId}:{},replyIds:J.replyIds,readOnly:false,item:J}:J.kind==="revision"?{...Ze,kind:"revision",revisionKind:J.revisionKind,author:J.author,initials:la(J.author),text:J.text,...J.replacedText?{replacedText:J.replacedText}:{},replyIds:J.replyIds,readOnly:J.readOnly,item:J}:{...Ze,kind:"custom",author:"",initials:"",text:J.detail??J.text,replyIds:[],readOnly:true,item:J}})}function $r(){return g$1?.session.trackingSettings()??N}function Xr(){let p=$r(),C=Kf({viewOnly:O==="view",reviewEnabled:l,hasAuthor:!!e$1.author,hostChoseMode:e$1.mode!==void 0,readerChoseMode:I,currentMode:h,trackRevisions:p.trackRevisions,restrictedToTrackedChanges:p.restrictedToTrackedChanges});C.rejection!==null&&(L=C.rejection),C.mode==="suggesting"&&(h="suggesting",g$1?.setEditingMode("suggest"));}function Je(p){return p!=="editing"||!$r().restrictedToTrackedChanges?null:{ok:false,code:"locked",reason:"this document permits editing only as tracked changes"}}function $t(p){return p.kind==="comment"?p.comment.date:p.kind==="revision"?p.date:void 0}function la(p){let C=p.trim().split(/\s+/).filter(Boolean);return C.length===0?"?":C.slice(0,2).map(_=>_[0].toUpperCase()).join("")}function Tn(p,C){if(!l)return {ok:false,code:"unsupported",reason:Ct};let ne=Mt().find(ae=>ae.key===p)?.item;if(!ne||ne.kind!=="revision")return {ok:false,code:"notFound",reason:"no revision with that key"};if(ne.readOnly)return {ok:false,code:"unsupported",reason:"this revision kind has no structural accept/reject yet"};let j;return g$1?.commitReviewOps(()=>(j=g$1.session.applyTreeOps(ne.addresses.map(ae=>C==="accept"?{op:"acceptRevision",revision:ae}:{op:"rejectRevision",revision:ae}),void 0,void 0,an(ne)),j)),j?.committed?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:typeof j?.reason=="string"?j.reason:"the revision was refused"}}let Xt={get mountGeneration(){return x},get surface(){return g$1},setHyperlinkChrome(p){return w.push(p),()=>{let C=w.lastIndexOf(p);C>=0&&w.splice(C,1);}},stateVersion:()=>qe,fontMeasurement:()=>({measurer:X?"shaped":"fixed",resolving:be,...X&&Y?{producer:Y}:{}}),attach(p){if(z){te(Nn("destroyed","this editor was destroyed; create a new instance to remount"));return}if(g$1&&o===p)return;g$1&&(g$1.flushPendingInput(),d$1=g$1.session.save(),Le());let C=u.cancel();C&&(d$1=C),He.detach(),o=p,We=null;let _=d$1;d$1=null,_&&u.shouldYield(_)?u.schedule(_):_?Ce(_):M();},detach(){if(z)return;He.detach();let p=u.cancel();g$1&&(g$1.flushPendingInput(),d$1=g$1.session.save(),Le()),p&&(d$1=p),o=null,We=null,M();},load(p){let C=si(p);if(!C){te(Nn("unsupported",li(p)));return}ze(C);},save(){if(u.flush(),!g$1)return Promise.reject(Nn("notFound","no document is loaded"));g$1.flushPendingInput();let C=g$1.session.save().slice();return Promise.resolve(C.buffer)},getDocumentHandle(){return Object.freeze({revision:g$1?.session.revision()??0})},exec(p,C){if(u.flush(),z&&(p.type==="toggleReviewPane"||p.type==="setEditingMode"))return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(p.type==="setEditingMode"){if(O==="view"&&p.mode!=="viewing")return {ok:false,code:"locked",reason:"this document was opened for viewing"};if(p.mode==="suggesting"&&!l)return {ok:false,code:"unsupported",reason:Ct};let xe=Je(p.mode);return xe||(I=true,L=null,h=p.mode,g$1?.setEditingMode(p.mode==="suggesting"?"suggest":p.mode==="viewing"?"view":"edit"),g$1?.setEditable(p.mode!=="viewing"),M(),le(),{ok:true,changed:false})}if(p.type==="toggleReviewPane")return l?(It=!It,M(),le(),{ok:true,changed:false}):{ok:false,code:"unsupported",reason:Ct};if(ds(p)){let xe=us(p,g$1,cs(h),C);return xe.ok?Rf(g$1,p):xe}let _=Lr(p);if(h==="viewing"&&_.supported&&_.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let ne=qr(p,g$1,O,C);if(!ne.ok)return ne.refusal;let j=g$1,ae=j.session.packageRevision(),pe=yf(j,p,{...ne.tablePlan?{admittedTablePlan:ne.tablePlan}:{},editor:Xt});return pe||{ok:true,changed:j.session.packageRevision()!==ae}},can(p,C){if(p.type==="insertImage"||p.type==="replaceImage"){if(z)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(C?.scope){let j=qr(p,g$1,O,C);if(!j.ok)return j.refusal}return tc(p,g$1)}if(p.type==="toggleReviewPane"||p.type==="setEditingMode"){if(z)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(p.type==="toggleReviewPane"&&!l)return {ok:false,code:"unsupported",reason:Ct};if(p.type==="setEditingMode"&&O==="view"&&p.mode!=="viewing")return {ok:false,code:"locked",reason:"this document was opened for viewing"};if(p.type==="setEditingMode"){if(p.mode==="suggesting"&&!l)return {ok:false,code:"unsupported",reason:Ct};let j=Je(p.mode);if(j)return j}return {ok:true}}if(ds(p))return us(p,g$1,cs(h),C);let _=Lr(p);if(h==="viewing"&&_.supported&&_.mutating)return {ok:false,code:"locked",reason:"the document is open for viewing"};let ne=qr(p,g$1,O,C);if(!ne.ok)return ne.refusal;if(Nr(p)&&pi(p)){let j=_r(Xt);if(j){let ae=mi(Xt,p,j);if(ae)return ae}}return {ok:true}},isActive(p){if(p.type==="toggleReviewPane")return It;if(p.type==="setEditingMode")return h===p.mode;let C=g$1?ue().formatting:null;if(!C)return false;switch(p.type){case "toggleMark":switch(p.mark){case "bold":return C.bold===true;case "italic":return C.italic===true;case "underline":return C.underline===true;case "strike":return C.strike===true;case "superscript":return C.superscript===true;case "subscript":return C.subscript===true;default:return false}case "setAlignment":return C.alignment===(p.align==="justify"?"both":p.align);case "toggleList":return g$1?.isListActive(p.kind)??false;default:return false}},getDocumentStyles:()=>g$1?.session.documentStyles()??[],getDocumentFonts:()=>g$1?.session.documentFonts()??[],getAvailableFonts:()=>Ff(fe(),g$1?.session.documentFonts()??[]),getDocumentThemeColors:()=>g$1?.session.documentThemeColors()??[],getOutline:()=>g$1?.session.documentOutline()??[],getComments:()=>[],getSelectionFormatting:()=>sc(g$1?ue().formatting:null),findMatches:(p,C)=>g$1?.session.findText(p,{...C?.matchCase!==void 0?{matchCase:C.matchCase}:{},...C?.wholeWord!==void 0?{wholeWord:C.wholeWord}:{}}).matches??[],selectMatch(p){return u.flush(),g$1?typeof p?.blockId!="string"||p.blockId.length===0||!Number.isInteger(p.start)||p.start<0||!Number.isInteger(p.length)||p.length<0?{ok:false,code:"invalidArgs",reason:"match must carry a blockId and offsets"}:(Ft(p.blockId),g$1.setSelection({anchor:{paragraphId:p.blockId,offset:p.start},head:{paragraphId:p.blockId,offset:p.start+p.length}}),g$1.revealParagraph(p.blockId),{ok:true,changed:false}):{ok:false,code:"notFound",reason:"no document is loaded"}},getSelectedImage:()=>ue().image,getSelectedTable:()=>ic(g$1),getTableCellSelection:()=>{let p=g$1?.state().cellSelection;return p?{tableId:p.tableId,rows:p.rows,columns:p.columns,cellIds:p.cellIds}:null},setTableInteractionLabel(p){g$1?.setTableInteractionLabel(p);},canExecuteImageCommand(p,C){if(z)return {ok:false,code:"notFound",reason:"the editor was destroyed"};if(C?.scope){let _=qr(p,g$1,O,C);if(!_.ok)return _.refusal}return gi(p,g$1)},executeImageCommand(p){return z?Promise.resolve({ok:false,code:"notFound",reason:"the editor was destroyed"}):hi(Xt,p)},getPageSetup:()=>vi(g$1),getWatermark:()=>null,getTrackedChanges:()=>(g$1?.session.reviewItems()??[]).filter(p=>p.kind==="revision").map(p=>{let C=kn(p);return {id:p.id,kind:p.kind==="revision"?p.revisionKind:"revision",...p.kind==="revision"&&p.author?{author:p.author}:{},story:C!==null?C.kind:Qn(p)?.noteKind??"body"}}),getReviewItems:p=>Mt(p),getCustomNodeDefinitions:()=>a$3.customNodes,reportCustomNodeDiagnostic:i,addComment(p,C){if(!l)return {ok:false,code:"unsupported",reason:Ct};let _=Wr();if(!_||!g$1)return {ok:false,code:"invalidArgs",reason:"a comment needs a selected range"};let ne=(C??e$1.author??"").trim();if(ne.length===0||p.trim().length===0)return {ok:false,code:"invalidArgs",reason:"a comment needs both an author and text"};let j=null;return g$1.commitReviewOps(()=>(j=g$1.session.replyToComment(null,{paragraphId:_.from.paragraphId,start:_.from.offset,end:_.to.offset,..._.to.paragraphId===_.from.paragraphId?{}:{endParagraphId:_.to.paragraphId}},p,ne,Jn(),Gt(_.from.paragraphId)),{committed:j!==null})),j===null?{ok:false,code:"unsupported",reason:"the comment could not be committed"}:{ok:true,changed:true}},getSelectionPlacement:()=>Gr(),isReviewPaneOpen:()=>It,getEditingMode:()=>h,getReviewAuthors:()=>S$1.authorsFor(g$1?.revisionAuthors()??Vf),getConfiguredAuthor:()=>e$1.author?.trim()||null,getReviewAuthorStyle:p=>S$1.styleFor(p),setRevisionStyles(p){S$1.set(p),g$1?.setRevisionStyles(p),M(),le();},setEditingMode:p=>Xt.exec({type:"setEditingMode",mode:p}),getReviewRevision:()=>ia(),setActiveReviewItem(p,C){if(p===null)return g$1?.dismissActiveReview(),M(),le(),{ok:true,changed:false};if(!g$1)return {ok:false,code:"notFound",reason:"no document is open"};g$1.flushPendingInput();let ne=Mt().find(xe=>xe.key===p)?.item;if(!ne)return {ok:false,code:"notFound",reason:"no review item with that key"};let j=bt(ne);if(!j)return {ok:false,code:"unsupported",reason:"this review item has no resolvable range"};if(!Sn(ne))return {ok:false,code:"unsupported",reason:`review items of kind '${ne.revisionKind}' are excluded from activation`};let ae=ne?kn(ne):null,pe=ae===null&&ne?Yn(ne):null;if(ae!==null){if(!g$1.enterHeaderFooter?.({rId:ae.rId,kind:ae.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(pe!==null){if(!g$1.enterNote?.(pe,{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 {g$1.exitNote?.(),g$1.exitHeaderFooter?.();let xe=ye(ne)??j,J={paragraphId:xe.start.paragraphId,offset:xe.start.offset};g$1.activateReview(p,{anchor:J,head:J});let ve=C?.reveal??"centerIfNeeded";ve!==false&&g$1.revealPosition?.(xe.start,{block:ve});}return (ae!==null||pe!==null)&&g$1.activateReview(p),M(),le(),{ok:true,changed:false}},setReviewActivationExclusions(p){P=p===null?null:[...p],g$1?.setReviewActivationExclusions(P);},acceptReviewItem:p=>Tn(p,"accept"),rejectReviewItem:p=>Tn(p,"reject"),setCommentResolved(p,C){return Sf({reviewEnabled:l,editingMode:h,placements:Mt,surface:g$1,proReviewReason:Ct,bump:M},p,C)},deleteReviewItem(p){if(!l)return {ok:false,code:"unsupported",reason:Ct};let _=Mt().find(j=>j.key===p)?.item;if(!_||!g$1)return {ok:false,code:"notFound",reason:"no review item with that key"};if(_.kind==="revision")return Tn(p,"reject");if(_.kind!=="comment")return {ok:false,code:"unsupported",reason:"a custom node card cannot be deleted"};$e()===p&&g$1.dismissActiveReview();let ne=false;return g$1.commitReviewOps(()=>{let j=Yn(_),ae=j===null?null:fd(j);return ne=g$1.session.deleteComment(_.id,an(_),ae?.noteId),{committed:ne}}),ne?(M(),{ok:true,changed:true}):{ok:false,code:"unsupported",reason:"the comment could not be deleted"}},replyToReviewItem(p,C,_){if(!l)return {ok:false,code:"unsupported",reason:Ct};g$1?.flushPendingInput();let j=Mt().find(ce=>ce.key===p)?.item;if(!j||!g$1)return {ok:false,code:"notFound",reason:"no review item with that key"};let ae=bt(j);if(!ae)return {ok:false,code:"invalidArgs",reason:"the item has no anchorable range"};let pe=(_??e$1.author??"").trim(),xe=kf(j,C,pe);if(xe)return xe;let J=j.kind==="comment"?j.id:null,ve=null;return g$1.commitReviewOps(()=>(ve=g$1.session.replyToComment(J,{paragraphId:ae.start.paragraphId,start:ae.start.offset,end:ae.end.offset},C,pe,Jn(),an(j)),{committed:ve!==null})),ve===null?{ok:false,code:"unsupported",reason:"the reply could not be committed"}:{ok:true,changed:true}},getHeaderFooterState:()=>g$1?.headerFooterState()??null,getNotePropertiesState:()=>g$1?.notePropertiesState?.()??null,getNotePreviewText:p=>g$1?.notePreviewText?.(p)??null,setActiveScope(p){g$1?.setActiveScope(p)&&M();},getActiveScope:()=>g$1?.activeScope()??{kind:"body"},query(p){switch(p.type){case "selectedText":return g$1?.selectedText()??"";case "selectionFormatting":return g$1?ue().formatting:null;case "selection":return bi(g$1);case "paragraphs":return ac(g$1,p.container);case "isInsideToc":return g$1?g$1.isInsideToc(g$1.state().selection.head.paragraphId):false;case "hyperlinkAt":return oc(g$1);case "contentControls":return Tf(g$1,p.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 ls(g$1,p.filter);case "tableContext":return Si(g$1);default:return null}},snapshot:()=>ue(),getTotalPages:()=>xi(g$1),getCurrentPage:p=>Ii(g$1,p),scrollToPage:p=>!Number.isInteger(p)||p<1?false:(u.flush(),g$1?.revealPage(p-1)??false),scrollToBlock:p=>typeof p!="string"||p.length===0?false:(u.flush(),Ft(p),g$1?.revealParagraph(p)??false),...qf(He,()=>g$1),relayout(p){p?.sync,g$1?.layout();},retainSelection:()=>g$1?.retainSelection()??null,releaseSelection:p=>g$1?.releaseSelection(p),focus(p){return u.flush(),g$1?p&&p.kind==="all"?{ok:false,code:"invalidTarget",reason:"the all scope cannot take focus"}:p&&!g$1.setActiveScope(p)?{ok:false,code:"invalidTarget",reason:"that scope cannot be opened"}:(g$1.focus(),{ok:true,value:void 0}):{ok:false,code:"invalidTarget",reason:"no document is loaded"}},destroy(){z=true,u.cancel(),He.detach(),re(),Le(),o=null,d$1=null,x+=1,M();for(let p of Object.values(B))p.clear();},on(p,C){return B[p].add(C),()=>{B[p].delete(C);}}};return Xt}var Gf=Object.freeze({document:true,save:true,events:true,selection:true,scrolling:true,layout:true});function f0(e){return g$1({port:p0(e),capabilities:Gf})}function p0(e){let t=0,n=0,r=null,o=false,a=false,i=()=>{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 i(),t+n},currentPackage:()=>i()?.currentPackage()??null,apply(l,d){i();let u=e.surface;if(!u)return {ok:false,reason:"no-document"};let h=u.applyAutomationOps(l,d);return h.rejected?{ok:false,reason:String(h.reason??"refused")}:{ok:true,changed:h.committed}},applyLifecycle(l){i();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,h=i();if(!u||!h)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 P=e.can({type:"toggleReviewPane"});if(!P.ok)return {ok:false,reason:P.reason??"review-module-required"};let S={ok:false,reason:"refused"};return u.commitReviewOps(()=>{if(l.every(O=>O.kind==="delete")){let O=l.find(g=>g.kind==="delete"),k=h.deleteComments(l.map(g=>{if(g.kind!=="delete")throw new Error("unreachable mixed comment write");return {commentId:g.commentId,...g.parentCommentId===void 0?{}:{parentCommentId:g.parentCommentId}}}),d,O?.kind==="delete"?O.noteId:void 0);return S=k?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:k}}if(l.length!==1)return S={ok:false,reason:"mixed-comment-writes"},{committed:false};let I=l[0];if(I.kind==="resolve"){let O=h.setCommentResolved(I.commentId,I.resolved);return S=O?{ok:true,changed:true}:{ok:false,reason:"unknown-comment"},{committed:O}}if(I.kind!=="create"&&I.kind!=="reply")return S={ok:false,reason:"unsupported-comment-write"},{committed:false};let L=h.replyToComment(I.kind==="reply"?I.parentCommentId:null,I.anchor,I.text,I.author,I.date);return S=L===null?{ok:false,reason:"refused"}:{ok:true,changed:true,commentId:L},{committed:L!==null}}),S},applyCustomNodeWrite(l,d){let u=e.surface,h=i();if(!u||!h)return {ok:false,reason:"no-document"};if(d.kind!=="body")return {ok:false,reason:"unsupported-story"};let P={ok:false,reason:"refused"};return u.commitReviewOps(()=>{let S=h.insertCustomNode(l);return P=S.ok?{ok:true,changed:S.change!==null}:{ok:false,reason:S.detail?`${S.reason}: ${S.detail}`:S.reason},{committed:S.ok}}),P},save:()=>i()?.save()??null,select(l,d){if(!e.surface)return;let h=d==="end"?l.end:l.start,P=d==="start"?l.start:l.end;e.exec({type:"setSelection",range:{anchor:{paragraphId:h.paragraphId,offset:h.offset},head:{paragraphId:P.paragraphId,offset:P.offset}}});},subscribe:l=>e.on("change",()=>l()),dispose(){a=true,r=null;}}}function m0(e){return e*(96/72)}function g0(e,t){return e*t}function h0(e,t){return e/t}function y0(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 Xf(e,t,n){return t?true:e.length===1?false:!n}var $f=["e","se","s","sw","w","nw","n","ne"];function v0(e,t){let n=$f.indexOf(e);t.flipHorizontal&&(n=(4-n+8)%8),t.flipVertical&&(n=(8-n)%8);let r=Math.round(t.rotationDegrees/45)%8;return $f[(n-r+8)%8]}function b0(e,t,n){let r=e,o=t,a=-n.rotationDegrees*Math.PI/180,i=Math.cos(a),l=Math.sin(a),d=r*i-o*l,u=r*l+o*i;return r=d,o=u,n.flipHorizontal&&(r=-r),n.flipVertical&&(o=-o),Object.freeze({x:r,y:o})}function xn(e){return e/Br}function Yf(e){let t=b0(e.deltaXPt,e.deltaYPt,e.transform),n=xn(e.startWidthEmu),r=xn(e.startHeightEmu),o=n/r,a=v0(e.handle,e.transform),i=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+i),r=Math.max(1,r+l),e.preserveAspect)if(a.length===2){let N=Math.max(n/xn(e.startWidthEmu),r/xn(e.startHeightEmu));n=Math.max(1,xn(e.startWidthEmu)*N),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=xn(e.startWidthEmu),u=xn(e.startHeightEmu),h=n/d,P=r/u,S=Math.max(1,e.startBounds.width*h),I=Math.max(1,e.startBounds.height*P),L=e.startBounds.x,O=e.startBounds.y,k=e.handle;k.includes("w")&&(L=e.startBounds.x+e.startBounds.width-S),k.includes("n")&&(O=e.startBounds.y+e.startBounds.height-I);let g=null;if(e.kind==="anchored"&&e.startPosition&&(k.includes("w")||k.includes("n")))if(e.startPosition.mode==="simple"){let D=k.includes("w")?Ue(L-e.startBounds.x):0,N=k.includes("n")?Ue(O-e.startBounds.y):0;g=Object.freeze({mode:"simple",horizontalEmu:(e.startPosition.horizontalEmu??0)+D,verticalEmu:(e.startPosition.verticalEmu??0)+N});}else if(e.anchorFrameOrigin)g=Object.freeze({mode:"frame",...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{},...k.includes("w")?{horizontalEmu:Ue(L-e.anchorFrameOrigin.x)}:e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu}:{},...k.includes("n")?{verticalEmu:Ue(O-e.anchorFrameOrigin.y)}:e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu}:{}});else {let D=k.includes("w")?Ue(L-e.startBounds.x):0,N=k.includes("n")?Ue(O-e.startBounds.y):0;g=Object.freeze({mode:"frame",...e.startPosition.horizontalEmu!==void 0?{horizontalEmu:e.startPosition.horizontalEmu+D}:{},...e.startPosition.verticalEmu!==void 0?{verticalEmu:e.startPosition.verticalEmu+N}:{},...e.startPosition.relativeToH!==void 0?{relativeToH:e.startPosition.relativeToH}:{},...e.startPosition.relativeToV!==void 0?{relativeToV:e.startPosition.relativeToV}:{}});}return Object.freeze({widthEmu:Ue(n),heightEmu:Ue(r),previewBounds:Object.freeze({x:L,y:O,width:S,height:I}),position:g})}function x0(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 I0(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&&yi(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?Yf({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:Xf(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{Um as $,ti as A,pg as Aa,Yp as B,mg as Ba,di as C,qo as Ca,Sm as D,Qi as Da,Hr as E,jr as Ea,Dr as F,Ur as Fa,ci as G,Gn as Ga,km as H,a0 as Ha,ui as I,ra as Ia,_t as J,oa as Ja,_r as K,u0 as Ka,gi as L,Gf as La,hi as M,f0 as Ma,Dm as N,m0 as Na,Nm as O,g0 as Oa,Br as P,h0 as Pa,Zm as Q,y0 as Qa,Ue as R,Xf as Ra,_n as S,Yf as Sa,Bm as T,x0 as Ta,yi as U,I0 as Ua,qm as V,Ho as W,Bn as X,dc as Y,ki as Z,Do as _,An as a,cc as aa,Co as b,uc as ba,Ln as c,Wm as ca,kp as d,vn as da,Xa as e,Ti as ea,Ro as f,Ym as fa,Eo as g,Qm as ga,Ya as h,eg as ha,Np as i,No as ia,_p as j,mc as ja,Zp as k,_o as ka,vd as l,gc as la,Bp as m,hc as ma,qp as n,rg as na,zp as o,og as oa,Kp as p,ag as pa,Vp as q,ig as qa,jp as r,sg as ra,Up as s,lg as sa,bd as t,dg as ta,Wp as u,Pi as ua,Qa as v,cg as va,wd as w,vc as wa,Pd as x,ug as xa,Mo as y,bc as ya,ei as z,fg as za};
|