@docx-editor.dev/core 2.21.1 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +11 -5
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +10 -10
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +8 -8
  7. package/dist/binding.js +1 -1
  8. package/dist/{chunk-BF2TOG2V.js → chunk-5RKCJ5DF.js} +1 -1
  9. package/dist/chunk-65GJRSZ5.cjs +18 -0
  10. package/dist/chunk-6TBRG6SA.cjs +20 -0
  11. package/dist/chunk-A72MJGY7.cjs +4 -0
  12. package/dist/chunk-AZ7QSAXH.js +4 -0
  13. package/dist/chunk-BL57VQ7E.js +1 -0
  14. package/dist/chunk-CB6RQ3GD.cjs +11 -0
  15. package/dist/chunk-GG4IAKFI.js +5 -0
  16. package/dist/chunk-HJYLFMLX.js +2 -0
  17. package/dist/chunk-HL6NO7IH.cjs +2 -0
  18. package/dist/chunk-HZQFGB2X.cjs +5 -0
  19. package/dist/{chunk-FPDIJ4RF.js → chunk-IWAUA732.js} +1 -1
  20. package/dist/chunk-OZXBAEWW.js +2 -0
  21. package/dist/{chunk-4TYA4RLP.cjs → chunk-P5PWSRNW.cjs} +1 -1
  22. package/dist/{chunk-DZYKU2HG.js → chunk-PD5XKBJA.js} +1 -1
  23. package/dist/{chunk-7N77EN2Z.cjs → chunk-REMFTPDL.cjs} +1 -1
  24. package/dist/{chunk-T5B4NMKF.cjs → chunk-RLKX7BIP.cjs} +1 -1
  25. package/dist/chunk-UGLO2GA5.cjs +1 -0
  26. package/dist/chunk-UOQONZVQ.js +11 -0
  27. package/dist/chunk-VD2MWTR6.js +20 -0
  28. package/dist/chunk-VIXH2OVP.js +1 -0
  29. package/dist/chunk-W2JIZ5JH.js +18 -0
  30. package/dist/chunk-W5H62AWM.cjs +1 -0
  31. package/dist/{chunk-E5OUYRNM.cjs → chunk-X2LJDR53.cjs} +5 -5
  32. package/dist/chunk-YQXY6TQ3.js +5 -0
  33. package/dist/{chunk-RA2TDTEQ.cjs → chunk-YYFBYVW4.cjs} +1 -1
  34. package/dist/collaboration/replication.cjs +1 -1
  35. package/dist/collaboration/replication.d.ts +4 -4
  36. package/dist/collaboration/replication.js +1 -1
  37. package/dist/collaboration.d.ts +3 -3
  38. package/dist/contracts/document.d.ts +2 -2
  39. package/dist/contracts/editor.d.ts +8 -8
  40. package/dist/contracts/modules.d.ts +6 -6
  41. package/dist/contracts/types.d.ts +1 -1
  42. package/dist/{custom-node-writes-CncR6KfC.d.ts → custom-node-writes-Ck6eOiJ3.d.ts} +2 -2
  43. package/dist/{document-protection-DM6mA8Rf.d.ts → document-protection-CMPEonQc.d.ts} +1 -1
  44. package/dist/{editor-BRh7GuZF.d.ts → editor-BKDVqXyk.d.ts} +70 -49
  45. package/dist/editor.cjs +1 -1
  46. package/dist/editor.css +1 -1
  47. package/dist/editor.d.ts +188 -26
  48. package/dist/editor.js +1 -1
  49. package/dist/export.cjs +2 -2
  50. package/dist/export.d.ts +31 -14
  51. package/dist/export.js +2 -2
  52. package/dist/{font-resolver-DwuQYj3P.d.ts → font-resolver-PBc8Vuxs.d.ts} +1 -1
  53. package/dist/{headless-document-view-C3fc_jV0.d.ts → headless-document-view-9wjJT20Y.d.ts} +2 -2
  54. package/dist/{image-resources-DxF-SN_8.d.ts → image-resources-B0v-XaTM.d.ts} +2 -2
  55. package/dist/{index-3pNnG4z4.d.ts → index-DQA53aR1.d.ts} +134 -16
  56. package/dist/index.cjs +1 -1
  57. package/dist/index.d.ts +17 -17
  58. package/dist/index.js +1 -1
  59. package/dist/{layout-shaping-_GGjhhVc.d.ts → layout-shaping-Dyr0ZSOI.d.ts} +5 -2
  60. package/dist/layout.cjs +1 -1
  61. package/dist/layout.d.ts +376 -33
  62. package/dist/layout.js +1 -1
  63. package/dist/{note-properties-CjT31AuP.d.ts → note-properties-D_lmG9xx.d.ts} +1 -1
  64. package/dist/{omml-equation-Bk3OP1fv.d.ts → omml-equation-CfTm3jOK.d.ts} +1 -1
  65. package/dist/output.cjs +1 -1
  66. package/dist/output.d.ts +7 -7
  67. package/dist/output.js +1 -1
  68. package/dist/{protocol-CrbTIW2Z.d.ts → protocol-CkVDxyQ3.d.ts} +2 -2
  69. package/dist/{review-paragraph-order-D3KZohIL.d.ts → review-paragraph-order-BjUs-tDd.d.ts} +1 -1
  70. package/dist/{revision-projection-kVd7p6Wd.d.ts → revision-projection-DDVBYTIG.d.ts} +1 -1
  71. package/dist/{semantic-cell-selection-CkSsZHDL.d.ts → semantic-cell-selection-DW6qsmoC.d.ts} +4 -4
  72. package/dist/{semantic-interaction-Z2Xa68U5.d.ts → semantic-interaction-BNiYSBcB.d.ts} +1 -1
  73. package/dist/{semantic-paint-BHKprI9P.d.ts → semantic-paint-DE236npp.d.ts} +2 -2
  74. package/dist/{semantic-records-StH-AnHK.d.ts → semantic-records-C5OeXnaL.d.ts} +545 -569
  75. package/dist/store.cjs +1 -1
  76. package/dist/store.d.ts +13 -13
  77. package/dist/store.js +1 -1
  78. package/dist/{tree-package-fragment-CpEV1gl3.d.ts → tree-package-fragment-DBb97w3F.d.ts} +2 -2
  79. package/dist/{tree-session-contract-CTT9nM7Z.d.ts → tree-session-contract-BYat3RKx.d.ts} +5 -5
  80. package/dist/{types-barrel-PwcfEkaX.d.ts → types-barrel-ChGvWjkO.d.ts} +3 -1
  81. package/package.json +2 -2
  82. package/dist/chunk-25OQBAKA.js +0 -2
  83. package/dist/chunk-3B3DQMSL.js +0 -11
  84. package/dist/chunk-3P3DNJYM.js +0 -5
  85. package/dist/chunk-3PA64KPK.js +0 -5
  86. package/dist/chunk-AGWWNVIJ.cjs +0 -1
  87. package/dist/chunk-DFTVN25X.cjs +0 -5
  88. package/dist/chunk-DGONGMAV.js +0 -2
  89. package/dist/chunk-F4H3LC6M.cjs +0 -2
  90. package/dist/chunk-IUTTOBQW.cjs +0 -20
  91. package/dist/chunk-IYCXQAFT.cjs +0 -4
  92. package/dist/chunk-JL3SI5SZ.js +0 -18
  93. package/dist/chunk-OFWUHH52.js +0 -20
  94. package/dist/chunk-OKY6JRJL.js +0 -4
  95. package/dist/chunk-P24FHMQW.cjs +0 -1
  96. package/dist/chunk-QBKAOSVF.cjs +0 -18
  97. package/dist/chunk-U5GUJKTS.js +0 -1
  98. package/dist/chunk-XRYSPKKC.js +0 -1
  99. package/dist/chunk-ZZRCVDQU.cjs +0 -11
@@ -0,0 +1,4 @@
1
+ 'use strict';var chunk65GJRSZ5_cjs=require('./chunk-65GJRSZ5.cjs'),chunkHZQFGB2X_cjs=require('./chunk-HZQFGB2X.cjs'),chunkCB6RQ3GD_cjs=require('./chunk-CB6RQ3GD.cjs');var pr=Symbol("validated-resolved-font"),fr=4,oe=64*1024*1024,U=256,X=128*1024*1024,K=class extends Error{name="FontResolutionError";request;code;limit;actual;diagnostic;expectedHash;actualHash;constructor(t,n,r={}){super(`Font resolution failed (${t}) for ${Y(n)}`),this.code=t,this.request=$(n),this.limit=r.limit,this.actual=r.actual,this.diagnostic=r.diagnostic,this.expectedHash=r.expectedHash,this.actualHash=r.actualHash;}},Wt=e=>{if(e.family.trim().length===0)throw new TypeError("Font family must not be empty");if(!Number.isInteger(e.weight)||e.weight<1||e.weight>1e3)throw new RangeError("Font weight must be an integer from 1 through 1000");if(e.style!=="normal"&&e.style!=="italic")throw new TypeError("Font style must be normal or italic")},$=e=>(Wt(e),Object.freeze({family:e.family,weight:e.weight,style:e.style})),Qe=e=>{let t={family:e.family,weight:e.weight,style:e.style};return $(t)},Gt=Symbol("prepared-font-resource"),et=new WeakMap,yr=new Uint8Array(0),Vt=Object.getPrototypeOf(Uint8Array.prototype),hr=Object.getOwnPropertyDescriptor(Vt,"length").get,mr=Object.getOwnPropertyDescriptor(Vt,"byteLength").get;function ae(e){if(!ArrayBuffer.isView(e))throw new TypeError("Font bytes must be a genuine byte array");let t,n;try{t=hr.call(e),n=mr.call(e);}catch{throw new TypeError("Font bytes must be a genuine byte array")}if(t!==n)throw new TypeError("Font bytes must use one-byte elements");return n}function Kt(e){let t=new Uint8Array(ae(e));return Uint8Array.prototype.set.call(t,e),t}function Xt(e,t){let n=$(e.request);if(e.availability==="forbidden"){let i=Object.freeze({...e,request:n,actualHash:null,[Gt]:true});return et.set(i,null),i}let r=Kt(e.bytes);t?.onOwnedByteCopy?.(),t?.onHash?.();let o=chunkCB6RQ3GD_cjs.a(r),a=Object.freeze({...e,request:n,bytes:r,actualHash:o,[Gt]:true});return et.set(a,o),a}function ie(e){return et.get(e)}var Yt=e=>{if(!Number.isFinite(e.heightEm)||!Number.isFinite(e.baselineEm)||e.heightEm<=0||e.heightEm>fr||e.baselineEm<0||e.baselineEm>e.heightEm)throw new RangeError("Font substitution line metrics must fit within a bounded em box");return Object.freeze({heightEm:e.heightEm,baselineEm:e.baselineEm})},Y=e=>(Wt(e),JSON.stringify([e.family.trim().toLowerCase(),e.weight,e.style])),tt=class{[pr]=true;id;identity;request;family;byteLength;hash;faceIndex;substitution;constructor(t,n){if(t.id.length===0)throw new TypeError("Resolved font id must not be empty");if(!Number.isInteger(t.faceIndex)||t.faceIndex<0)throw new RangeError("Font face index must be a non-negative integer");this.id=t.id,this.request=$(t.request),this.family=this.request.family,this.hash=t.hash,this.faceIndex=t.faceIndex,this.identity=`${this.hash}#${this.faceIndex}`,this.byteLength=t.byteLength,this.substitution=null,n&&(this.substitution=Object.freeze({requested:$(n.requested),resolved:$(n.resolved),...n.lineMetrics?{lineMetrics:Yt(n.lineMetrics)}:{}})),Object.freeze(this);}get bytes(){return se(this).slice()}},$t=new WeakSet,qt=new WeakMap,Zt=new WeakMap,Jt=(e,t,n,r)=>{let o=new tt(e,r);return qt.set(o,t),Zt.set(o,n),$t.add(o),o},se=e=>{le(e);let t=qt.get(e);if(!t)throw new TypeError("Resolved font has no owned byte capability");return t},Be=e=>{le(e);let t=Zt.get(e);if(!t)throw new TypeError("Resolved font has no admitted table metadata");return t},le=e=>{if(typeof e!="object"||e===null||!$t.has(e))throw new TypeError("Shaping requires a validated resolved font")},Qt=(e,t)=>e[t]<<8|e[t+1],re=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,jt=(e,t)=>{if(t>e.byteLength-12)return {valid:false,diagnostic:"truncated sfnt header"};let n=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if(!(e[t]===0&&e[t+1]===1&&e[t+2]===0&&e[t+3]===0)&&n!=="OTTO"&&n!=="true"&&n!=="typ1")return {valid:false,diagnostic:"unsupported sfnt signature"};let o=Qt(e,t+4),a=t+12+o*16;if(!Number.isSafeInteger(a)||a>e.byteLength)return {valid:false,diagnostic:"truncated sfnt table directory"};for(let i=0;i<o;i+=1){let s=t+12+i*16,l=re(e,s+8),d=re(e,s+12);if(l>e.byteLength||d>e.byteLength-l)return {valid:false,diagnostic:"sfnt table range exceeds font bytes"}}return {valid:true}},gr=(e,t)=>{let r=String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?re(e,12+t*4):0,o=Qt(e,r+4),a=new Set;for(let i=0;i<o;i+=1){let s=r+12+i*16;a.add(String.fromCharCode(e[s],e[s+1],e[s+2],e[s+3]));}return Object.freeze(a)},Ae=(e,t)=>{if(!Number.isSafeInteger(t)||t<0)return {valid:false,diagnostic:"invalid font face index"};if(e.byteLength<12)return {valid:false,diagnostic:"truncated sfnt header"};if(String.fromCharCode(e[0],e[1],e[2],e[3])!=="ttcf")return t!==0?{valid:false,diagnostic:"standalone sfnt has only face index zero"}:jt(e,0);let r=re(e,4);if(r!==65536&&r!==131072)return {valid:false,diagnostic:"unsupported TTC version"};let o=re(e,8),a=12+o*4;if(o===0||!Number.isSafeInteger(a)||a>e.byteLength||t>=o)return {valid:false,diagnostic:"invalid TTC face directory"};let i=re(e,12+t*4);return i<a?{valid:false,diagnostic:"invalid TTC face offset"}:jt(e,i)},br=(e,t,n,r)=>{if(e.availability==="forbidden")return {kind:"forbidden"};let o=ae(e.bytes);if(o>t)return {kind:"overLimit",actual:o};let a=ie(e),i=a===void 0?Kt(e.bytes):e.bytes;a===void 0&&r?.onOwnedByteCopy?.(),a===void 0&&r?.onHash?.();let s=a??chunkCB6RQ3GD_cjs.a(i);if(e.hash!==s)return {kind:"hashMismatch",expectedHash:e.hash,actualHash:s};let l=Ae(i,e.faceIndex);if(!l.valid)return {kind:"malformed",diagnostic:l.diagnostic};r?.onTableScan?.();let d=gr(i,e.faceIndex);try{let f=n(i,e.faceIndex);if(!f.valid)return {kind:"malformed",diagnostic:f.diagnostic}}catch(f){return {kind:"malformed",diagnostic:f instanceof Error?f.message:"font validator threw"}}let c={kind:"resolved",font:Jt({...e,byteLength:i.byteLength},i,d)};return r?.onAdmission?.(),c},nt=e=>{let t=e.epoch,n=e.maxFontBytes,r=e.validateFont,o=e.instrumentation,a=e.resources,i=e.substitutions;if(!Number.isSafeInteger(t)||t<0)throw new RangeError("Font resource epoch must be a non-negative safe integer");if(!Number.isSafeInteger(n)||n<=0||n>oe)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${oe}`);if(typeof r!="function")throw new TypeError("Font snapshot requires a validator");let s=a.length,l=i?.length??0;if(s>U)throw new RangeError(`Font source count must not exceed ${U}`);if(l>U)throw new RangeError(`Font substitution count must not exceed ${U}`);let d=0,c=[];for(let h=0;h<s;h+=1){let u=a[h];if(ie(u)!==void 0){let p=u.availability==="forbidden"?0:ae(u.bytes);if(p>X-d)throw new RangeError(`Aggregate font bytes must not exceed ${X}`);d+=p,c.push(u);continue}let b=Qe(u.request),m=u.id,R=u.hash,v=u.faceIndex,L=u.availability,T=L==="forbidden"?yr:u.bytes,y=L==="forbidden"?0:ae(T);if(y>X-d)throw new RangeError(`Aggregate font bytes must not exceed ${X}`);d+=y,c.push(Object.freeze({request:b,id:m,bytes:T,hash:R,faceIndex:v,...L?{availability:L}:{}}));}let f=[];if(i)for(let h=0;h<l;h+=1){let u=i[h],b=Qe(u.from),m=Qe(u.to),R=u.lineMetrics;f.push(Object.freeze({from:b,to:m,...R?{lineMetrics:Object.freeze({heightEm:R.heightEm,baselineEm:R.baselineEm})}:{}}));}let g=new Map;for(let h of c){let u=Y(h.request);g.has(u)||g.set(u,br(h,n,r,o));}let S=new Map;for(let h of f){let u=Y(h.from);S.has(u)||S.set(u,Object.freeze({to:$(h.to),...h.lineMetrics?{lineMetrics:Yt(h.lineMetrics)}:{}}));}return Object.freeze({epoch:t,resolve:h=>{let u=$(h),b=Y(u),m=S.get(b),R=m?.to??u,v=g.get(Y(R));return v?v.kind==="forbidden"?new K("forbidden",u):v.kind==="overLimit"?new K("overLimit",u,{limit:n,actual:v.actual}):v.kind==="malformed"?new K("malformed",u,{diagnostic:v.diagnostic}):v.kind==="hashMismatch"?new K("hashMismatch",u,{expectedHash:v.expectedHash,actualHash:v.actualHash}):m?Jt({request:v.font.request,id:v.font.id,hash:v.font.hash,faceIndex:v.font.faceIndex,byteLength:v.font.byteLength},se(v.font),Be(v.font),{requested:u,resolved:m.to,...m.lineMetrics?{lineMetrics:m.lineMetrics}:{}}):v.font:new K("missing",u)}})};var k=e=>{if(!Number.isSafeInteger(e))throw new RangeError("Fixed-point value must be a safe integer");return e},Pe=(e,t)=>{if(e.trim().length===0||/[\u0000-\u001f\u007f]/.test(e))throw new TypeError(`${t} must be non-blank and contain no control characters`)},Sr=(e,t)=>{if(!/^[\x20-\x7e]{4}$/.test(e))throw new TypeError(`${t} must be a four-byte ASCII tag`)},en=(e,t,n)=>{let r=Object.entries(e).sort(([a],[i])=>a<i?-1:a>i?1:0),o=Object.create(null);for(let[a,i]of r){if(Sr(a,`${t} key`),!Number.isFinite(i)||n&&(!Number.isSafeInteger(i)||i<0))throw new RangeError(`${t} value must be ${n?"a non-negative safe integer":"finite"}`);if(n&&i>4294967295)throw new RangeError(`${t} value must fit an unsigned 32-bit integer`);o[a]=i;}return Object.freeze(o)},rt=e=>Object.freeze({family:e.family,weight:e.weight,style:e.style}),xr=e=>e?Object.freeze({requested:rt(e.requested),resolved:rt(e.resolved),...e.lineMetrics?{lineMetrics:Object.freeze({...e.lineMetrics})}:{}}):void 0,tn=new WeakSet,ot=new WeakSet,nn=new WeakMap,it=e=>{if(le(e),!tn.has(e)){if(e.identity!==`${e.hash}#${e.faceIndex}`)throw new TypeError("Resolved font identity does not match hash and face index");if(!Number.isSafeInteger(e.byteLength)||e.byteLength<0)throw new TypeError("Resolved font byte length is invalid");tn.add(e);}},at=e=>(it(e),e),Me=e=>(it(e),Object.freeze({identity:e.identity,id:e.id,family:e.family,request:rt(e.request),hash:e.hash,faceIndex:e.faceIndex,byteLength:e.byteLength,substitution:xr(e.substitution)??null})),Q=e=>{if(ot.has(e))return e;if(Pe(e.shapingLibrary.name,"shaping library name"),Pe(e.shapingLibrary.version,"shaping library version"),Pe(e.unicodeDataVersion,"Unicode data version"),!/^\d+(?:\.\d+){0,3}(?:[-+][0-9A-Za-z.-]+)?$/.test(e.shapingLibrary.version))throw new TypeError("shaping library version must be a numeric version");if(!/^\d+(?:\.\d+){1,2}$/.test(e.unicodeDataVersion))throw new TypeError("Unicode data version must be a dotted numeric version");if(!/^[A-Z][a-z]{3}$/.test(e.script))throw new TypeError("script must be a four-letter ISO 15924 code");if(Pe(e.language,"language"),!/^(?:und|[A-Za-z]{2,8})(?:-[A-Za-z0-9]{1,8})*$/.test(e.language))throw new TypeError("language must be a BCP 47 language tag");if(e.direction!=="ltr"&&e.direction!=="rtl")throw new TypeError("direction must be ltr or rtl");if(!["none","NFC","NFD","NFKC","NFKD"].includes(e.normalization))throw new TypeError("invalid normalization policy");if(!["halfAwayFromZero","halfToEven","towardZero"].includes(e.roundingMode))throw new TypeError("invalid fixed-point rounding mode");if(!Number.isSafeInteger(e.fixedPointScale)||e.fixedPointScale<=0)throw new RangeError("fixed-point scale must be a positive safe integer");let t=at(e.font),n=e.fallbackOrder.map(at),r=new Set;for(let a of n){let i=JSON.stringify(Me(a));if(r.has(i))throw new TypeError("fallback order contains a duplicate font");r.add(i);}let o=Object.freeze({font:t,variationAxes:en(e.variationAxes,"variation axis",false),shapingLibrary:Object.freeze({name:e.shapingLibrary.name,version:e.shapingLibrary.version}),unicodeDataVersion:e.unicodeDataVersion,normalization:e.normalization,script:e.script,language:e.language,direction:e.direction,features:en(e.features,"OpenType feature",true),fallbackOrder:Object.freeze([...n]),fixedPointScale:e.fixedPointScale,roundingMode:e.roundingMode});return ot.add(o),o},on=e=>{let t=Q(e);return Object.freeze({font:Me(t.font),variationAxes:Object.freeze(Object.entries(t.variationAxes).map(n=>Object.freeze(n))),shapingLibrary:Object.freeze({name:t.shapingLibrary.name,version:t.shapingLibrary.version}),unicodeDataVersion:t.unicodeDataVersion,normalization:t.normalization,script:t.script,language:t.language,direction:t.direction,features:Object.freeze(Object.entries(t.features).map(n=>Object.freeze(n))),fallbackOrder:Object.freeze(t.fallbackOrder.map(Me)),fixedPointScale:t.fixedPointScale,roundingMode:t.roundingMode})},st=e=>{let t=nn.get(e);if(t!==void 0)return t;let n=JSON.stringify(on(e));return ot.has(e)&&nn.set(e,n),n},J=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},A=e=>{try{return k(e)}catch{throw new RangeError("Shaped run contains a non-integer fixed-point value")}},rn=new WeakMap,_e=e=>{let t=rn.get(e);if(t)return t;it(e);let n=JSON.stringify({identity:e.identity,id:e.id,family:e.family,request:e.request,hash:e.hash,faceIndex:e.faceIndex,byteLength:e.byteLength,substitution:e.substitution??null});return rn.set(e,n),n},ze=(e,t)=>{let n=Q(t);if(e.direction!=="ltr"&&e.direction!=="rtl")throw new TypeError("Shaped run direction must be ltr or rtl");if(e.direction!==n.direction)throw new TypeError("Shaped run direction does not match shaping environment");if(J(e.bidiLevel,"bidi level"),(e.bidiLevel&1)===1!=(e.direction==="rtl"))throw new TypeError("Shaped run direction does not match bidi level parity");let r=new Map,o=e.glyphs.map(d=>{J(d.id,"glyph id"),J(d.cluster,"glyph cluster");let c=r.get(d.outline);if(!c){if(!Number.isSafeInteger(d.outline.unitsPerEm)||d.outline.unitsPerEm<=0)throw new RangeError("Glyph outline units per em must be a positive safe integer");c=Object.isFrozen(d.outline)?d.outline:Object.freeze({path:d.outline.path,unitsPerEm:d.outline.unitsPerEm}),r.set(d.outline,c);}return Object.freeze({id:d.id,cluster:d.cluster,originX:A(d.originX),originY:A(d.originY),advanceX:A(d.advanceX),advanceY:A(d.advanceY),offsetX:A(d.offsetX),offsetY:A(d.offsetY),outline:c,...d.drawScale!==void 0?{drawScale:d.drawScale}:{}})}),a=e.fontSpans.map(d=>{if(J(d.glyphStart,"font span start"),J(d.glyphEnd,"font span end"),d.glyphEnd<=d.glyphStart||d.glyphEnd>o.length)throw new RangeError("Font span glyph range is invalid");d.fallbackIndex!==null&&J(d.fallbackIndex,"fallback index");let c=at(d.font);if(d.fallbackIndex===null){if(_e(c)!==_e(n.font))throw new TypeError("Shaped primary font does not match shaping environment")}else {let f=n.fallbackOrder[d.fallbackIndex];if(!f)throw new RangeError("Shaped fallback index is outside fallback order");if(_e(c)!==_e(f))throw new TypeError("Shaped fallback font does not match shaping environment provenance")}return Object.freeze({...d,font:c})});for(let d=0;d<a.length;d+=1){let c=d===0?0:a[d-1].glyphEnd;if(a[d].glyphStart!==c)throw new RangeError("Font spans must cover glyphs contiguously")}if(o.length===0&&a.length!==0||o.length>0&&a.at(-1)?.glyphEnd!==o.length)throw new RangeError("Font spans must cover every glyph exactly once");let i=e.clusters.map(d=>{for(let[f,g]of [["cluster text start",d.textStart],["cluster text end",d.textEnd],["cluster glyph start",d.glyphStart],["cluster glyph end",d.glyphEnd],["cluster font span",d.fontSpan]])J(g,f);if(d.textEnd<=d.textStart||d.textEnd>e.text.length||d.glyphEnd<=d.glyphStart||d.glyphEnd>o.length)throw new RangeError("Shaped cluster range is invalid");let c=a[d.fontSpan];if(!c||d.glyphStart<c.glyphStart||d.glyphEnd>c.glyphEnd)throw new RangeError("Shaped cluster does not belong to its declared font span");return Object.freeze({...d,advance:A(d.advance),caretEdges:Object.freeze(d.caretEdges.map(A))})}),s=Object.freeze({ascent:A(e.metrics.ascent),descent:A(e.metrics.descent),lineGap:A(e.metrics.lineGap)}),l=e.exactAdvancesX;if(l!==void 0){if(l.length!==o.length)throw new RangeError("Exact advances must be parallel to the shaped glyphs");if(l.some(d=>!Number.isFinite(d)))throw new RangeError("Exact advance must be a finite number")}return Object.freeze({text:e.text,direction:e.direction,bidiLevel:e.bidiLevel,glyphs:Object.freeze(o),clusters:Object.freeze(i),fontSpans:Object.freeze(a),metrics:s,...l===void 0?{}:{exactAdvancesX:Object.freeze([...l])}})},Rr=(e,t)=>{let n=ze(e,t);return Object.freeze({text:n.text,direction:n.direction,script:t.script,language:t.language,bidiLevel:n.bidiLevel,glyphs:n.glyphs,clusters:n.clusters,fontSpans:Object.freeze(n.fontSpans.map(r=>Object.freeze({glyphStart:r.glyphStart,glyphEnd:r.glyphEnd,fallbackIndex:r.fallbackIndex,font:Me(r.font)}))),metrics:n.metrics})};var Fr=4096,an=e=>typeof e=="number"?String(e):JSON.stringify(e)??typeof e,ke=class{constructor(t){this.onRestart=t;}onRestart;#e=new Map;keyOf(t,n){let r=st(n),o=this.#e.get(r);return o===void 0&&(this.#e.size>=Fr&&(this.#e.clear(),this.onRestart()),o=this.#e.size,this.#e.set(r,o)),`${o}\0${an(t.fontSizeHalfPoints)}\0${an(t.bidiLevel)}\0${t.text}`}clear(){this.#e.clear();}};function ce(e){try{let t=new URL(e);return t.username!==""||t.password!==""||t.search!==""||t.hash!==""?`${t.protocol}//${t.host}${t.pathname}\u2026`:e}catch{let t=e.search(/[?#]/);return t===-1?e:`${e.slice(0,t)}\u2026`}}function sn(e){return e.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s"')]+/gi,t=>ce(t))}function Cr(e){if(typeof e!="string"&&!(e instanceof URL))throw new TypeError(`setHarfBuzzWasmUrl: expected a string or URL, received ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new TypeError("setHarfBuzzWasmUrl: expected a non-empty URL");throw new Error("setHarfBuzzWasmUrl is not supported by the CommonJS build, which loads the shaper from node_modules and finds its binary on disk. Import the ESM build instead.");}function ln(e){return e instanceof Error&&/process\.getBuiltinModule/.test(e.message)}function dn(e){return `the text shaper cannot start on this Node version: the ESM build reaches Node builtins through \`process.getBuiltinModule\`, added in Node 20.16.0 and 22.3.0. Upgrade Node; \`setHarfBuzzWasmUrl\` does not apply here. (${sn(e instanceof Error?e.message:String(e))})`}function cn(e){let t=sn(e instanceof Error?e.message:String(e));return `the HarfBuzz WASM binary could not be loaded from ${"its bundled location"}. If this bundler does not emit \`new URL(..., import.meta.url)\` assets (esbuild, Bun, and library builds that inline dynamic imports), serve \`@docx-editor.dev/core/harfbuzz.wasm\` yourself, point \`setHarfBuzzWasmUrl\` from '@docx-editor.dev/core/layout' at it before creating an editor, and reload the page. (${t})`}function un(e,t){let n=`expected HarfBuzz ${e}, loaded ${t}`;return `${n}. The bundled binary does not match this build of the engine.`}var ee=Object.freeze({name:"HarfBuzz",version:"14.4.0"}),be=null,me=null;function dt(){return be?Promise.resolve():me||(me=import('harfbuzzjs').then(e=>{let t=e.versionString();if(t!==ee.version)throw new O("shapingLibraryMismatch",{diagnostic:un(ee.version,t)});be=e;}).catch(e=>{throw me=null,e instanceof O?e:ln(e)?new O("unsupportedRuntime",{diagnostic:dn(e),cause:e}):new O("wasmUnavailable",{diagnostic:cn(e),cause:e})}),me)}function wr(){return be!==null}function Or(){if(!be)throw new O("notInitialized",{diagnostic:"Call initializeHarfBuzz() before creating a text shaper"});return be}var O=class extends Error{name="HarfBuzzShapingError";code;limit;actual;diagnostic;constructor(t,n={}){super(`HarfBuzz shaping failed (${t})`,{cause:n.cause}),this.code=t,this.limit=n.limit,this.actual=n.actual,this.diagnostic=n.diagnostic;}},Lr=16*1024*1024,Tr=1e6,Ir=1e6,Br=1e6,Ar=4,Pr=512,_r=1024*1024,Mr=16*1024*1024,zr=32*1024*1024,kr=64*1024*1024,Nr=64*1024*1024,Dr=1e6,Hr=1e6,Ur=1e6,Gr=64,jr=4096,Wr=4*1024*1024,Vr=64*1024*1024,Kr=64*1024*1024,Xr=256*1024*1024,Yr=new Set(["COLR","CPAL","CBDT","CBLC","sbix","SVG "]),pn=["cmap","head","hhea","hmtx","maxp"],$r=(e,t)=>e[t]<<8|e[t+1],qr=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Zr=(e,t)=>String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?qr(e,12+t*4):0,Jr=(e,t)=>{let n=Zr(e,t),r=$r(e,n+4),o=new Set;for(let a=0;a<r;a+=1){let i=n+12+a*16;o.add(String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]));}return o},Qr=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),eo=(e,t)=>{let n=Ae(e,t);if(!n.valid)return n;let r=Jr(e,t);for(let o of pn)if(!r.has(o))return {valid:false,diagnostic:`missing required ${o} table`};return {valid:true}},ct=eo,P=(e,t,n)=>{if(!Number.isSafeInteger(e)||e<=0||e>n)throw new RangeError(`${t} must be a positive safe integer no greater than ${n}`);return e},to=(e,t,n)=>{let r=e<0n,o=r?-e:e,a=o/t,i=o%t;if(n!=="towardZero"){let d=i*2n;(d>t||d===t&&(n==="halfAwayFromZero"||n==="halfToEven"&&a%2n!==0n))&&(a+=1n);}let s=r?-a:a,l=Number(s);if(!Number.isSafeInteger(l))throw new RangeError("Shaped fixed-point value exceeds the safe integer range");return l},fn=(e,t,n,r)=>{if(!Number.isSafeInteger(e))throw new RangeError("font units must be a safe integer");if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("fixed-point denominator must be a positive safe integer");if(!Number.isSafeInteger(n)||n<0)throw new RangeError("fixed-point numerator must be a non-negative safe integer");return k(to(BigInt(e)*BigInt(n),BigInt(t),r))},no=(e,t,n,r)=>{if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("font size must be a positive integer number of half points");if(t>Math.floor(Number.MAX_SAFE_INTEGER/n))throw new RangeError("font size and fixed-point scale product exceeds the safe integer range");let o=t*n,a=e*2;return i=>fn(i,a,o,r)},ro=(e,t,n)=>{let r=t*n,o=e*2;return a=>a*r/o},oo=(e,t)=>{if(t.length===0)return [];let n=[...new Set(t.map(i=>i.cluster))].sort((i,s)=>i-s),r=new Map;for(let i=0;i<n.length;i+=1)r.set(n[i],n[i+1]??e.length);let o=[],a=0;for(;a<t.length;){let i=t[a].cluster,s=a+1;for(;s<t.length&&t[s].cluster===i;)s+=1;let l=t.slice(a,s).reduce((c,f)=>c+f.advanceX,0),d=k(l);o.push({textStart:i,textEnd:r.get(i),glyphStart:a,glyphEnd:s,advance:d,caretEdges:Object.freeze([k(0),d]),fontSpan:0}),a=s;}return o},N=64,G=8,q=8,yn=32,hn=N+2*G,ao=N+G+q,io=N+G+2*q,so=N+G+q,mn=N+8*G,gn=N+8*q+G,lo=N+6*q+G,co=N+3*q+2*G,uo=N+3*q,Se=e=>N+e.length*Uint16Array.BYTES_PER_ELEMENT,ut=e=>so+Se(e),ge=e=>yn+e*G,po=(e,t)=>hn+Se(e)+ao+ut(t),fo=e=>mn+Se(e)+ge(e.length)+e.length*gn,yo=e=>{let t=new Set(e.glyphs.map(n=>n.outline));return mn+Se(e.text)+ge(e.glyphs.length)+e.glyphs.length*gn+ge(e.clusters.length)+e.clusters.length*lo+e.clusters.reduce((n,r)=>n+ge(r.caretEdges.length),0)+ge(e.fontSpans.length)+e.fontSpans.length*co+(e.exactAdvancesX===void 0?0:yn+e.exactAdvancesX.length*q)+uo+[...t].reduce((n,r)=>n+ut(r.path),0)},ho=(e,t)=>hn+Se(e)+io+t,lt=class{#e;#u;#p;#f;#y;#x;#h;#l=0;#R;#m;#g;#s;#b;#d;#t;#o=new Map;#a=new Map;#n=new Map;#F=new ke(()=>{this.#n.clear(),this.#r=0,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0}));});#i=0;#r=0;#S=0;#c;constructor(t,n){this.#e=t,this.#u=P(n.maxFontBytes??Lr,"maximum font bytes",Nr),this.#p=P(n.maxInputUtf16??Tr,"maximum input UTF-16 code units",Dr),this.#f=P(n.maxCodepoints??Ir,"maximum input code points",Hr),this.#y=P(n.maxGlyphs??Br,"maximum shaped glyphs",Ur),this.#h=P(n.maxCachedFontBytes??64*1024*1024,"maximum cached font bytes",64*1024*1024),this.#x=P(n.maxCachedFaces??Ar,"maximum cached faces",Gr),this.#R=P(n.maxCachedShapes??Pr,"maximum cached shape results",jr),this.#m=P(n.maxOutlineBytes??_r,"maximum outline bytes",Wr),this.#g=P(n.maxCachedOutlineBytes??Mr,"maximum cached outline bytes",Vr),this.#s=P(n.maxShapedRunBytes??zr,"maximum shaped run bytes",Kr),this.#b=P(n.maxCachedShapeBytes??kr,"maximum cached shape bytes",Xr),this.#d=n.instrumentation?.onFaceCacheEvent,this.#t=n.instrumentation,this.#c=new this.#e.Buffer;}dispose(){this.#o.clear(),this.#l=0,this.#a.clear(),this.#n.clear(),this.#F.clear(),this.#i=0,this.#r=0,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#c=void 0;}#E(t,n){let r=this.#o.get(t.identity);if(r)return this.#o.delete(t.identity),this.#o.set(t.identity,r),this.#d?.(Object.freeze({kind:"hit",identity:t.identity})),r;let o=Be(t);for(let c of pn)if(!o.has(c))throw new O("malformedFont",{diagnostic:`missing required ${c} table`});this.#t?.onByteCopy?.();let a=new this.#e.Blob(Qr(n)),i=new this.#e.Face(a,t.faceIndex),s=new this.#e.Font(i),l=s.hExtents();if(!Number.isSafeInteger(i.upem)||i.upem<=0||!Number.isSafeInteger(l.ascender)||!Number.isSafeInteger(l.descender)||!Number.isSafeInteger(l.lineGap))throw new O("malformedFont",{diagnostic:"invalid font units or horizontal metrics"});s.setScale(i.upem,i.upem);let d={identity:t.identity,blob:a,face:i,font:s,unitsPerEm:i.upem,byteLength:n.byteLength};if(n.byteLength<=this.#h){for(;this.#o.size>=this.#x||this.#l+n.byteLength>this.#h;){let c=this.#o.keys().next().value;if(c===void 0)break;this.#l-=this.#o.get(c).byteLength,this.#o.delete(c),this.#d?.(Object.freeze({kind:"evicted",identity:c}));}this.#o.set(t.identity,d),this.#l+=n.byteLength;}return this.#d?.(Object.freeze({kind:"created",identity:t.identity})),d}#C(t,n,r){let o=JSON.stringify([t.identity,t.unitsPerEm,r,n]),a=this.#a.get(o);if(a)return this.#a.delete(o),this.#a.set(o,a),this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#i})),a.outline;this.#t?.onOutlinePathCall?.();let i=t.font.glyphToPath(n),s=ut(i);if(s>this.#m)throw new O("outlineOverLimit",{limit:this.#m,actual:s});let l=Object.freeze({path:i,unitsPerEm:t.unitsPerEm}),d=po(o,i);if(d>this.#g)return this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#i})),l;for(;this.#i+d>this.#g;){let c=this.#a.keys().next().value;if(c===void 0)break;let f=this.#a.get(c);this.#a.delete(c),this.#i-=f.bytes,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#i}));}return this.#a.set(o,{outline:l,bytes:d}),this.#i+=d,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"created",retainedBytes:this.#i})),l}#v(t){if(t.length>this.#p)throw new O("textOverLimit",{limit:this.#p,actual:t.length});let n=0;for(let r=0;r<t.length;){let o=t.codePointAt(r);if(r+=o>65535?2:1,n+=1,n>this.#f)throw new O("codepointsOverLimit",{limit:this.#f,actual:n})}}shape(t){if(!this.#c)throw new O("disposed");if(le(t.environment.font),t.environment.font.byteLength>this.#u)throw new O("fontOverLimit",{limit:this.#u,actual:t.environment.font.byteLength});this.#v(t.text);let n=fo(t.text);if(n>this.#s)throw new O("shapedRunOverLimit",{limit:this.#s,actual:n});let r=Q(t.environment),o=this.#F.keyOf(t,r),a=this.#n.get(o);if(a)return this.#S-a.stamp>=Math.max(1,this.#n.size>>1)&&(this.#n.delete(o),this.#n.set(o,a),a.stamp=++this.#S),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#r})),a.run;if(this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"miss",retainedBytes:this.#r})),r.shapingLibrary.name!==ee.name||r.shapingLibrary.version!==ee.version)throw new O("shapingLibraryMismatch");if(r.normalization!=="none")throw new O("unsupportedNormalization");if(!Number.isSafeInteger(t.bidiLevel)||t.bidiLevel<0||(t.bidiLevel&1)===1!=(r.direction==="rtl"))throw new O("invalidBidiLevel");if(Object.keys(r.variationAxes).length>0)throw new O("unsupportedVariationAxes");if(r.fallbackOrder.length>0)throw new O("unsupportedFallback");let i=se(r.font),s=Be(r.font);if([...Yr].some(d=>s.has(d))&&!s.has("glyf")&&!s.has("CFF "))throw new O("unsupportedColorFont");let l=t.text;this.#v(l);try{let d=this.#E(r.font,i),{face:c,font:f}=d,g=this.#c;g.reset(),g.addText(l),g.setDirection(r.direction==="rtl"?this.#e.Direction.RTL:this.#e.Direction.LTR),g.setScript(r.script),g.setLanguage(r.language),g.setClusterLevel(this.#e.ClusterLevel.MONOTONE_CHARACTERS);let S=Object.entries(r.features).map(([F,w])=>new this.#e.Feature(F,w));this.#t?.onShapeCall?.(),this.#e.shape(f,g,S);let x=g.getGlyphInfosAndPositions();if(x.length>this.#y)throw new O("glyphOverLimit",{limit:this.#y,actual:x.length});let h=no(c.upem,t.fontSizeHalfPoints,r.fixedPointScale,r.roundingMode),u=ro(c.upem,t.fontSizeHalfPoints,r.fixedPointScale),b=[],m=k(0),R=k(0),v=new Map,L=JSON.stringify(Object.entries(r.variationAxes).sort(([F],[w])=>F.localeCompare(w))),T=x.map(F=>{b.push(u(F.xAdvance??0));let w=h(F.xAdvance??0),I=h(F.yAdvance??0),_={id:F.codepoint,cluster:F.cluster,originX:m,originY:R,advanceX:w,advanceY:I,offsetX:h(F.xOffset??0),offsetY:h(F.yOffset??0),outline:v.get(F.codepoint)??(()=>{let H=this.#C(d,F.codepoint,L);return v.set(F.codepoint,H),H})()};return m=k(m+w),R=k(R+I),_}),y=f.hExtents(),p=ze({text:l,direction:r.direction,bidiLevel:t.bidiLevel,glyphs:T,exactAdvancesX:b,clusters:oo(l,T),fontSpans:T.length===0?[]:[{glyphStart:0,glyphEnd:T.length,font:r.font,fallbackIndex:null}],metrics:{ascent:h(y.ascender),descent:h(-y.descender),lineGap:h(y.lineGap)}},r),E=yo(p);if(E>this.#s)throw new O("shapedRunOverLimit",{limit:this.#s,actual:E});let C=ho(o,E);if(C>this.#b)return this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#r})),p;for(;this.#n.size>=this.#R||this.#r+C>this.#b;){let F=this.#n.keys().next().value;if(F===void 0)break;let w=this.#n.get(F);this.#n.delete(F),this.#r-=w.bytes,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#r}));}return this.#n.set(o,{run:p,bytes:C,stamp:++this.#S}),this.#r+=C,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"stored",retainedBytes:this.#r})),p}catch(d){throw d instanceof O?d:new O("malformedFont",{diagnostic:d instanceof Error?d.message:"HarfBuzz shaping failed"})}}},pt=(e={})=>new lt(Or(),e);var ft=Object.freeze({maxFontBytes:16*1024*1024,maxInputUtf16:1e6,maxCodepoints:1e6,maxGlyphs:1e6,maxCachedFaces:32,maxCachedFontBytes:64*1024*1024,maxCachedShapes:512,maxOutlineBytes:1024*1024,maxCachedOutlineBytes:16*1024*1024,maxShapedRunBytes:32*1024*1024,maxCachedShapeBytes:64*1024*1024}),Qa=Object.freeze({...ft,maxCachedShapes:4096});function bn(e){let t={maxFontBytes:e.maxFontBytes,maxInputUtf16:e.maxInputUtf16,maxCodepoints:e.maxCodepoints,maxGlyphs:e.maxGlyphs,maxOutlineBytes:e.maxOutlineBytes,maxShapedRunBytes:e.maxShapedRunBytes},n=["docx-editor-layout-harfbuzz-execution-policy",1,Object.entries(t).sort(([r],[o])=>r<o?-1:r>o?1:0).map(([r,o])=>Object.freeze([r,o]))];return `layout-shaper-policy:sha256:${chunkCB6RQ3GD_cjs.a(new TextEncoder().encode(JSON.stringify(n)))}`}var mo=Object.freeze({}),Sn=U,go="16.0.0",bo="none",So=1e3,xo="halfToEven",Fn="cluster-edges-only",Ro="Latn",Fo=new Uint8Array(0);var j=class extends Error{code="overLimit";constructor(t){super(t),this.name="LayoutShapingConfigurationError";}};function vo(e,t){let n=e.epoch,r=e.maxFontBytes,o=e.sources,a=e.substitutions,i=e.defaultFont,s=e.language;if(!Number.isSafeInteger(r)||r<=0||r>oe)throw new j(`Font byte ceiling must not exceed the engine hard maximum of ${oe}`);let l=o.length,d=a?.length??0;if(l===0||l>U)throw new j(`Font source count must be between 1 and ${U}`);if(d>Sn)throw new j(`Font substitution count must not exceed ${Sn}`);let c=0,f=[];for(let x=0;x<l;x+=1){let h=o[x],u=h.request,b=h.availability,m=h.id,R=h.hash,v=h.faceIndex,L=b==="forbidden",T=L?Fo:h.bytes;if(!L){if(typeof m!="string"||m.length===0)throw new TypeError("Resolved font id must not be empty");let y;try{y=ae(T);}catch{throw new j(`Font source ${m} must provide genuine bytes`)}if(y>r)throw new j(`Font source ${m} exceeds the per-font byte ceiling`);if(c+=y,c>X)throw new j(`Font sources exceed the aggregate byte ceiling of ${X}`)}f.push(t&&ie(h)!==void 0?h:Object.freeze({request:Object.freeze({family:u.family,weight:u.weight,style:u.style}),id:m,bytes:T,hash:R,faceIndex:v,...b?{availability:b}:{}}));}let g;if(a){g=[];for(let x=0;x<d;x+=1){let h=a[x],u=h.from,b=h.to,m=h.lineMetrics;g.push(Object.freeze({from:Object.freeze({family:u.family,weight:u.weight,style:u.style}),to:Object.freeze({family:b.family,weight:b.weight,style:b.style}),...m?{lineMetrics:Object.freeze({heightEm:m.heightEm,baselineEm:m.baselineEm})}:{}}));}}let S={epoch:n,maxFontBytes:r,sources:Object.freeze(f),substitutions:g?Object.freeze(g):void 0,defaultFont:Object.freeze({family:i.family,sizeHalfPoints:i.sizeHalfPoints}),language:s};return Object.freeze(S)}function xn(e,t){let n=e.map((o,a)=>({value:o,index:a,key:Y(t(o))})),r=new Set;for(let o of n){if(r.has(o.key))return e;r.add(o.key);}return n.sort((o,a)=>o.key<a.key?-1:o.key>a.key?1:o.index-a.index).map(({value:o})=>o)}function Eo(e,t){let n={family:e.family},r={sizeHalfPoints:e.sizeHalfPoints};return {...n,...t?r:{}}}function Rn(e,t){let n=l=>({family:l.family,weight:l.weight,style:l.style}),r=t?e.sources:xn(e.sources,l=>l.request),o=e.substitutions??[],a=t?o:xn(o,l=>l.from),i={sources:r.map(l=>{let d=l.availability??"available",c={request:n(l.request),availability:d};if(d==="forbidden")return {...c,...t?{id:l.id,faceIndex:l.faceIndex,declaredHash:l.hash}:{}};let f=ie(l);if(f==null)throw new TypeError("Font configuration identity requires prepared source bytes");return {...c,...t?{id:l.id}:{},faceIndex:l.faceIndex,declaredHash:l.hash,actualHash:f,byteLength:l.bytes.byteLength}}),substitutions:a.map(l=>({from:n(l.from),to:n(l.to),lineMetrics:l.lineMetrics?{heightEm:l.lineMetrics.heightEm,baselineEm:l.lineMetrics.baselineEm}:null})),defaultFont:Eo(e.defaultFont,t),language:e.language||"en"},s={epoch:e.epoch,maxFontBytes:e.maxFontBytes};return {version:1,...t?s:{},...i}}var Co=Symbol("prepared-layout-font-configuration"),Ne=new WeakMap;function wo(e){return Ne.has(e)}function Oo(e){let t=Ne.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.configuration}function ai(e){let t=Ne.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.sharedShapingFingerprint}function yt(e,t){return vn(e,t,false)}function ii(e,t){return vn(e,t,true)}function vn(e,t,n){let r=vo(e,n),o=Object.freeze({epoch:r.epoch,maxFontBytes:r.maxFontBytes,sources:Object.freeze(r.sources.map(f=>n&&ie(f)!==void 0?f:Xt(f,{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash}))),substitutions:r.substitutions,defaultFont:r.defaultFont,language:r.language}),a=new TextEncoder,i=Rn(o,true),s=a.encode(JSON.stringify(i)),l=Rn(o,false),d=a.encode(JSON.stringify(l)),c=Object.freeze({[Co]:true,fingerprint:`font-config:${chunkCB6RQ3GD_cjs.a(s)}`});return Ne.set(c,{configuration:o,sharedShapingFingerprint:`shared-font-config:${chunkCB6RQ3GD_cjs.a(d)}`}),c}function Lo(e){return yt(e).fingerprint}function To(e,t){let n=new TextEncoder().encode(JSON.stringify({version:1,environment:e,executionPolicy:bn(t),ligatureCaretPolicy:Fn,fallback:chunk65GJRSZ5_cjs.M}));return `shaping:${chunkCB6RQ3GD_cjs.a(n)}`}async function En(e,t,n,r,o=false){let i=wo(e)?e:yt(e,t),s=Oo(i),{epoch:l,maxFontBytes:d,sources:c,substitutions:f,defaultFont:g}=s,S=s.language||"en",x=i.fingerprint,h=nt({epoch:l,maxFontBytes:d,resources:c,substitutions:f,validateFont:ct,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});await dt();let u=Object.freeze({script:Ro,variationAxes:Object.freeze({}),shapingLibrary:ee,unicodeDataVersion:go,normalization:bo,language:S,features:mo,...o?{documentLigatures:true}:{},fixedPointScale:So,roundingMode:xo});return Object.freeze({fonts:h,shaper:n??pt(r),defaultFont:g,environment:u,ligatureCaretPolicy:Fn,operation:Object.freeze({resourceEpoch:h.epoch,configEpoch:l,extensionFingerprint:x,shapingHash:To(u,r),producerVersion:1})})}async function Io(e,t){return En(e,t,void 0,ft)}async function si(e,t,n,r,o=false){return En(e,r,t,n,o)}function Bo(e){e.shaper.dispose?.();}function ht(e){let t=new Set([0,e.text.length]);for(let r of chunk65GJRSZ5_cjs.S(e.text))t.add(r.utf16From),t.add(r.utf16To);let n=new Set([0,e.text.length]);for(let r of e.clusters)n.add(r.textStart),n.add(r.textEnd);return [...t].filter(r=>n.has(r)).sort((r,o)=>r-o)}function De(e,t){return ht(e).includes(t)}function Ao(e,t){return De(e,t)}function Po(e,t,n){return n>=t&&De(e,t)&&De(e,n)}function _o(e){let t=chunk65GJRSZ5_cjs.S(e.text);return ht(e).map(n=>n===e.text.length?t.length:t.findIndex(r=>r.utf16From===n))}var gt="und";function Ln(){return typeof Intl.Segmenter=="function"}function Mo(){let e=Intl.Segmenter;if(typeof e!="function")throw new Error(`Intl.Segmenter is required for word segmentation (locale: ${gt})`);return e}function Tn(){let e=new(Mo())(gt,{granularity:"word"});return {segment(t){let n=[];for(let r of e.segment(t)){let o=r.index,a=o+r.segment.length;n.push({utf16From:o,utf16To:a,wordLike:r.isWordLike===true});}return n}}}var zo=/^[\p{L}\p{N}']$/u,ko=/^\s$/u;function Cn(e){return zo.test(e)}function wn(e){return ko.test(e)}function mt(e,t,n,r){let o=e[t],a=e[n-1];return {utf16From:o.utf16From,utf16To:a.utf16To,wordLike:r}}function In(e){let t=chunk65GJRSZ5_cjs.S(e);if(t.length===0)return [];let n=[],r=0;for(;r<t.length;){let o=t[r];if(wn(o.text)){let a=r+1;for(;a<t.length&&wn(t[a].text);)a+=1;n.push(mt(t,r,a,false)),r=a;continue}if(Cn(o.text)){let a=r+1;for(;a<t.length&&Cn(t[a].text);)a+=1;n.push(mt(t,r,a,true)),r=a;continue}n.push(mt(t,r,r+1,false)),r+=1;}return n}function Bn(){return {segment:In}}function An(e={}){let t=e.isIntlAvailable??Ln,n=e.createIntlBoundary??Tn,r=e.createFallbackBoundary??Bn;if(!t())return r();try{return n()}catch{return r()}}var On;function Pn(){return On??=An(),On}function No(e,t=Pn()){return t.segment(e)}function Do(e,t){return t.map(n=>({graphemeFrom:chunk65GJRSZ5_cjs.W(e,n.utf16From),graphemeTo:chunk65GJRSZ5_cjs.W(e,n.utf16To),wordLike:n.wordLike}))}var _n={resourceEpoch:"resource-scoped",configEpoch:"coarse-gate",extensionFingerprint:"coarse-gate",shapingHash:"coarse-gate",producerVersion:"coarse-gate"},xt=Object.keys(_n),Mn=xt.filter(e=>_n[e]==="coarse-gate"),He=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},ue=(e,t)=>{if(e.trim().length===0)throw new TypeError(`${t} must not be blank`)},Ho={resourceEpoch:He,configEpoch:He,extensionFingerprint:ue,shapingHash:ue,producerVersion:He},Uo=(e,t)=>{Ho[t](e[t],t);},pe=e=>{for(let t of xt)Uo(e,t);return Object.freeze({resourceEpoch:e.resourceEpoch,configEpoch:e.configEpoch,extensionFingerprint:e.extensionFingerprint,shapingHash:e.shapingHash,producerVersion:e.producerVersion})},Go=(e,t)=>{let n=pe(e),r=pe(t),o=xt.filter(a=>n[a]!==r[a]);return o.length===0?Object.freeze({status:"current"}):Object.freeze({status:"restart",changed:Object.freeze(o)})},bt=e=>{let t=e.map(({key:n,fingerprint:r})=>(ue(n,"resource dependency key"),ue(r,"resource dependency fingerprint"),Object.freeze({key:n,fingerprint:r}))).sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:0);for(let n=1;n<t.length;n+=1)if(t[n-1].key===t[n].key)throw new TypeError(`Duplicate resource dependency: ${t[n].key}`);return Object.freeze(t)},jo=e=>(He(e.revision,"revision"),ue(e.dependencyFingerprint,"dependencyFingerprint"),ue(e.inputFingerprint,"inputFingerprint"),Object.freeze({revision:e.revision,dependencyFingerprint:e.dependencyFingerprint,inputFingerprint:e.inputFingerprint,resourceDependencies:bt(e.resourceDependencies),...pe(e)})),Wo=(e,t)=>{let n=bt(e),r=bt(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){let i=n[a],s=r[a];if(i?.key!==s?.key||i?.fingerprint!==s?.fingerprint)return {hit:false,reason:"resource-changed",resourceKey:i?.key??s.key}}return null};function Vo(e,t){if(e.dependencyFingerprint!==t.dependencyFingerprint)return {hit:false,reason:"dependency-changed"};if(e.inputFingerprint!==t.inputFingerprint)return {hit:false,reason:"input-changed"};let n=Wo(e.resourceDependencies,t.resourceDependencies);if(n)return n;for(let r of Mn)if(e[r]!==t[r])return {hit:false,reason:"epoch-changed",epoch:r};return null}var St=class{entries=new Map;get(t,n){let r=this.entries.get(t);if(!r)return {hit:false,reason:"absent"};let o=Vo(r.provenance,n);return o||{hit:true,value:r.value,provenance:r.provenance}}set(t,n,r){this.entries.set(t,{value:n,provenance:jo(r)});}evictEpoch(t){let n=pe(t),r=0;for(let[o,a]of this.entries){let i=a.provenance;Mn.some(s=>i[s]!==n[s])&&(this.entries.delete(o),r+=1);}return r}evictResources(t,n){let r=pe(t),o=this.evictEpoch(r);for(let[a,i]of this.entries)i.provenance.resourceDependencies.some(l=>n.get(l.key)!==l.fingerprint)&&(this.entries.delete(a),o+=1);return o}get size(){return this.entries.size}};function zn(e){return e.projected===true?null:e.range}function Xo(e,t,n){let{page:r,story:o,host:a,noteScopeId:i,noteAreaKind:s}=e,l=o==="header"||o==="footer"?d=>chunk65GJRSZ5_cjs.$(d,e.origin,{x:r.box.x,y:r.box.y}):void 0;chunk65GJRSZ5_cjs.ia(a,(d,c)=>{let{textboxDepth:f,textboxOwner:g,textboxPath:S,storyOrigin:x}=c,h=f===0?o:"textbox";for(let u of d.lines){let b=[...chunk65GJRSZ5_cjs.pa(u)].sort((m,R)=>(t.get(m.paragraphId)??Number.MAX_SAFE_INTEGER)-(t.get(R.paragraphId)??Number.MAX_SAFE_INTEGER));for(let m of b)for(let R of m.spans)n({page:r,story:h,rootStory:o,root:e,storyOrigin:x,absoluteBox:Object.freeze({x:x.x+R.box.x,y:x.y+R.box.y,width:R.box.width,height:R.box.height}),noteScopeId:i,noteAreaKind:s,textboxDepth:f,textboxOwner:g,textboxPath:S,paragraph:d,paragraphId:m.paragraphId,line:u,span:R,sourceRange:zn(R)});}},e.origin,l);}function Yo(e,t){let n=new Map(chunk65GJRSZ5_cjs.va(e).map((r,o)=>[r,o]));chunk65GJRSZ5_cjs.fa(e,r=>Xo(r,n,t));}function D(e){return (e.kerningEnabled??e.kerningMinPt>0)&&e.kerningMinPt>0&&e.fontSizePt>=e.kerningMinPt}var Hn="Calibri, Carlito, Helvetica, Arial, sans-serif",Ci=new Map([["calibri","Carlito"]]),$o=65536,qo=256;function kn(e,t){return e===void 0?Math.max(1,Math.floor(t)):Number.isFinite(e)&&e>0?Math.max(1,Math.floor(e)):1}function Nn(e){let t=new Map,n=0;return {get(r){let o=t.get(r);if(o!==void 0)return t.delete(r),t.set(r,o),o},set(r,o){for(t.has(r)&&t.delete(r),t.set(r,o);t.size>e;){let a=t.keys().next();if(a.done)break;t.delete(a.value),n+=1;}},get size(){return t.size},get evictions(){return n}}}var Dn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Un(e=null){return e!=null&&typeof e.measureText=="function"}function Gn(e={}){let t=e.scale??1;if(!(t>0)||!Number.isFinite(t))return null;let n=e.fallbackFamily??Hn,r=e.context??null;if(!Un(r))return null;let o=r,a=Nn(kn(e.maxWidthEntries,$o)),i=Nn(kn(e.maxMetricsEntries,qo)),s=e.fontAlias,l=c=>{let f=c.fontFamily&&Dn.test(c.fontFamily)?c.fontFamily:null,g=f?s?.(f):void 0,S=g&&Dn.test(g)?g:null,x=f?S?`"${S}", "${f}", ${n}`:`"${f}", ${n}`:n,h=c.bold?"bold":"normal",u=c.italic?"italic":"normal",b=c.smallCaps?"small-caps":"normal",m=c.fontSizePt*chunk65GJRSZ5_cjs.L(c)*t;return `${u} ${b} ${h} ${m}px ${x}`},d=(c,f,g)=>c/t*(g.horizontalScalePercent/100)+f.length*g.characterSpacingPt;return {measure(c,f){if(c.length===0)return 0;let g=l(f),S=`${g}\0${D(f)}\0${c}`,x=a.get(S);if(x!==void 0)return d(x,c,f);o.font=g,"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let h=o.measureText(c).width;return a.set(S,h),d(h,c,f)},inkBounds(c,f){if(!c||c.length>2||f.shaping?.direction==="rtl"||chunk65GJRSZ5_cjs.S(c).length!==1)return;o.font=l(f),"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let g=o.textAlign,S=o.direction,x;try{g!==void 0&&(o.textAlign="left"),S!==void 0&&(o.direction="ltr"),x=o.measureText(c);}finally{g!==void 0&&(o.textAlign=g),S!==void 0&&(o.direction=S);}let h=x.actualBoundingBoxLeft,u=x.actualBoundingBoxRight;if(h===void 0||u===void 0||!Number.isFinite(h)||!Number.isFinite(u))return;let b=f.horizontalScalePercent/(100*t);return {left:-h*b,right:u*b}},lineMetrics(c){let f=c.fontSizePt*chunk65GJRSZ5_cjs.L(c),g=l(c),S=i.get(g);if(S)return S;let x=f*1.15,h=f*.8;o.font=g,"fontKerning"in o&&(o.fontKerning=D(c)?"normal":"none");let u=o.measureText("Hxg"),b=u.fontBoundingBoxAscent,m=u.fontBoundingBoxDescent;if(typeof b=="number"&&Number.isFinite(b)&&b>0&&(h=b/t,typeof m=="number"&&Number.isFinite(m)&&m>=0)){let v=(b+m)/t;v>0&&(x=Math.max(v,x));}x>0||(x=f*1.15);let R={height:x,baseline:h};return i.set(g,R),R}}}function Zo(e=1,t={}){let n=Gn({...t,scale:t.scale??e});return n?{measurer:n,producer:t.fontAlias?"canvas-measurer+embedded":"canvas-measurer"}:{measurer:chunk65GJRSZ5_cjs.N(),producer:"fixed-measurer"}}function Jo(e){let t;return n=>{t===void 0&&(t=chunk65GJRSZ5_cjs.tc(e.pages)?.hosts??null);let r=t?.get(n);return r?chunk65GJRSZ5_cjs.rc(r.pageNumber,r.format):null}}function jn(e,t){let n=chunk65GJRSZ5_cjs.jb(e,t.displayMode??chunk65GJRSZ5_cjs.xa),r=chunk65GJRSZ5_cjs.Wb({numberingIndex:t.numberingIndex,styleCascade:t.styleCascade},n).listItems,o=t.package?{footnotesPart:chunkCB6RQ3GD_cjs.$f(t.package,"footnote"),endnotesPart:chunkCB6RQ3GD_cjs.$f(t.package,"endnote")}:void 0,a=chunk65GJRSZ5_cjs.pc(n,r,o,t.package?chunk65GJRSZ5_cjs.mc(t.package,e,n):void 0,t.displayMode??chunk65GJRSZ5_cjs.xa);return {blocks:n,notes:o,context:a}}function Wn(e,t,n,r,o){for(let a of t){if(r.length>=chunkCB6RQ3GD_cjs.wh)return;if(n.tokenForParagraph(a.id)!==""&&chunkCB6RQ3GD_cjs.zh(e,a.id)===null)for(let i of chunkCB6RQ3GD_cjs.yh(a)){if(r.length>=chunkCB6RQ3GD_cjs.wh)return;if(!i.rewritable)continue;let s=chunk65GJRSZ5_cjs.Ta(i.instruction);if(s===null)continue;let l=n.liveValueOf(i.fieldNodeId,s);if(l===null&&o&&n.pageRefProjectionOf){let d=n.pageRefProjectionOf(i.fieldNodeId,s);if(d){let c=o(d.targetParagraphId);c!==null&&c.length>0&&chunk65GJRSZ5_cjs.sc(d.calibration,d.cached,c,Number.NaN)&&(l=c);}}l===null||l===i.cachedText||l.length>chunkCB6RQ3GD_cjs.xh||l.includes(`
2
+ `)||l.includes("\r")||r.push({paragraphId:a.id,fieldNodeId:i.fieldNodeId,text:l});}}}function Qo(e,t){let{blocks:n,context:r}=jn(e,t);if(r===null)return null;let o=[];return Wn(e,chunk65GJRSZ5_cjs.Ub(chunk65GJRSZ5_cjs.hb(n)),r,o,t.pageRefPageNumberOf),o.length===0?null:{op:"refreshFieldResults",updates:o}}function zi(e,t){let{notes:n,context:r}=jn(e,t);if(r===null||n===void 0)return [];let o=[],a=[{noteKind:"footnote",notesPart:n.footnotesPart},{noteKind:"endnote",notesPart:n.endnotesPart}];for(let{noteKind:i,notesPart:s}of a){if(!s)continue;let l=[];for(let d of chunk65GJRSZ5_cjs.nc(s,t.displayMode??chunk65GJRSZ5_cjs.xa)){if(l.length>=chunkCB6RQ3GD_cjs.wh)break;Wn(s,chunk65GJRSZ5_cjs.Ub(chunk65GJRSZ5_cjs.hb(d)),r,l);}l.length>0&&o.push({noteKind:i,op:{op:"refreshFieldResults",updates:l}});}return o}function ea(e){return e.box}function Vn(e,t){if(e.kind==="paragraph"){t.add(e.paragraphId);return}for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks)Vn(o,t);}function ta(e){let t=new Map,n=(o,a,i)=>{if(!(o.kind==="textValue"||i>chunkCB6RQ3GD_cjs.Cc*4)){for(let s of o.children)if(s.kind!=="textValue"){if(s.kind==="paragraph"){for(let l of r)t.get(l)?.push(s.id);n(s,s.id,i+1);continue}if(s.kind==="contentControl"){t.set(s.id,[]),r.push(s.id);let l=chunkCB6RQ3GD_cjs.Mc(s);l&&n(l,a,i+1),r.pop();let d=t.get(s.id);d&&d.length===0&&a!==null&&d.push(a);continue}n(s,a,i+1);}}},r=[];return n(e,null,0),t}function na(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return {x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function ra(e,t){let n=chunkCB6RQ3GD_cjs.Qc(e.root);if(n.length===0)return oa;let r=new Map;t.pages.forEach((i,s)=>{(d=>{for(let c of d){let f=new Set;Vn(c,f);for(let g of f){let S=r.get(g)??[];S.push({pageIndex:s,box:ea(c)}),r.set(g,S);}}})(i.fragments);});let o=ta(e.root),a=[];for(let i of n){let s=chunkCB6RQ3GD_cjs.Oc(i.node),l=[...i.ancestors.map(g=>chunkCB6RQ3GD_cjs.Oc(g).lock),s.lock],d=o.get(i.node.id)??[],c=new Map;for(let g of d)for(let S of r.get(g)??[]){let x=c.get(S.pageIndex);c.set(S.pageIndex,x?na(x,S.box):S.box);}let f=[...c.entries()].sort((g,S)=>g[0]-S[0]).map(([g,S])=>({pageIndex:g,...S}));a.push({controlId:i.node.id,type:s.type,level:chunkCB6RQ3GD_cjs.Pc(i.node),depth:i.depth,lock:s.lock,effectiveLock:chunkCB6RQ3GD_cjs.Tc(l),showingPlaceholder:s.showingPlaceholder,temporary:s.temporary,...s.tag===void 0?{}:{tag:s.tag},...s.alias===void 0?{}:{alias:s.alias},...s.id===void 0?{}:{id:s.id},...s.dataBinding===void 0?{}:{dataBinding:s.dataBinding},paragraphIds:d,fragments:f});}return a}var oa=Object.freeze([]);function Xn(e,t,n){let r=e.lines?.find(o=>{let a=o.spans;if(!a)return n<o.range.end;let i=a.filter(s=>s.range.paragraphId===t);return i.length===a.length?n<o.range.end:i.length>0&&n<i[i.length-1].range.end});return r?r.box.y:e.fragmentY}function ha(e,t){let n=new Map;for(let r of e.pages)for(let[o,a]of ma(r,t))n.has(o)||n.set(o,a);return n}var Kn=new WeakMap;function ma(e,t){let n=Kn.get(t);n||(n=new WeakMap,Kn.set(t,n));let r=n.get(e);if(r)return r;let o=new Map;for(let a of t(e)){let i=new Set([a.paragraphId]);for(let s of a.lines??[])for(let l of s.spans??[])i.add(l.range.paragraphId);for(let s of i)o.has(s)||o.set(s,{pageIndex:e.index,contentY:e.contentBox.y,fragmentY:a.box.y,...a.lines?{lines:a.lines}:{}});}return n.set(e,o),o}function ga(e,t){let n=chunkHZQFGB2X_cjs.Ga(e);if(!n)return null;let r=t.get(n.start.paragraphId);return r?{pageIndex:r.pageIndex,y:r.contentY+Xn(r,n.start.paragraphId,n.start.offset)}:null}var Yn=new WeakMap;function ba(e){let t=Yn.get(e);if(t!==void 0)return t;let n=se(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=false,a=r.getUint32(0)===1953784678?r.getUint32(12+e.faceIndex*4):0,i=r.getUint16(a+4);for(let s=0;s<i;s++){let l=a+12+s*16;if(r.getUint32(l)!==1330851634)continue;let d=r.getUint32(l+8),c=r.getUint32(l+12);c>=86&&d<=n.byteLength-c&&r.getUint16(d)>=1&&(o=(r.getUint32(d+78)&1966080)!==0);break}return Yn.set(e,o),o}function $n(e,t,n,r,o){if(r>o||Math.abs(n.height-t)>o||!ba(e))return n;let a=t*.3;return {height:n.height+a,baseline:n.baseline+a/2}}var Sa="abcdefghijklmnopqrstuvwxyz";function te(e){let t=Math.round(e.fontSizePt*2);return Math.max(1,t)}function W(e,t,n,r,o){return e.shape({text:o,fontSizeHalfPoints:te(r),bidiLevel:r.shaping?.direction==="rtl"?1:0,environment:xa(t,n,r)})}var qn=new WeakMap;function xa(e,t,n){if(!Object.isFrozen(e)||!Object.isFrozen(e.features)||!Object.isFrozen(e.variationAxes)||!Object.isFrozen(e.shapingLibrary))return Zn(e,t,n);let r=n.shaping?.direction??"ltr",o=n.shaping?.script,a=`${r}|${o??""}|${D(n)?1:0}|${e.documentLigatures?chunk65GJRSZ5_cjs.h(n):""}|${n.smallCaps?1:0}`,i=qn.get(e);i||qn.set(e,i=new WeakMap);let s=i.get(t);s||i.set(t,s=new Map);let l=s.get(a);return l||s.set(a,l=Zn(e,t,n)),l}function Zn(e,t,n){return Q({...e,font:t,direction:n.shaping?.direction??"ltr",script:n.shaping?.script==="Zyyy"?e.script:n.shaping?.script??e.script,features:{...e.features,kern:D(n)?1:0,...e.documentLigatures?chunk65GJRSZ5_cjs.g(n):{},...n.smallCaps?{smcp:1}:{}},fallbackOrder:[]})}function Ue(e,t,n,r,o){let a=o.get(n);if(a!==void 0)return a;let i=true;try{for(let s of Sa){let l=W(e,t,n,{...r,smallCaps:!0},s),d=W(e,t,n,{...r,smallCaps:!1},s);if(!(l.glyphs.length!==d.glyphs.length||l.glyphs.some((f,g)=>f.id!==d.glyphs[g]?.id))){i=!1;break}}}catch{i=false;}return o.set(n,i),i}function Jn(e,t,n,r,o){let a=new WeakMap;return (i,s)=>{let l=chunk65GJRSZ5_cjs.L(s),d=a.get(i);d||(d=new Map,a.set(i,d));let c=te(s),f=d.get(c);if(f)return l===1?f:{height:f.height*l,baseline:f.baseline*l};let g,S=true,x=i.substitution?.lineMetrics;if(x){let h=c/2;g={height:x.heightEm*h,baseline:x.baselineEm*h};}else try{let h=W(e,t,i,s,""),u=h.metrics.ascent/t.fixedPointScale,b=h.metrics.descent/t.fixedPointScale,m=c/2,R=u+b,v=m*r,L=R>v?v/R:1,T=R*L,y=Math.min(Math.max(0,h.metrics.lineGap/t.fixedPointScale),T*o),p=T+y;p>0?g=$n(i,m,{height:p,baseline:u*L+y},y,2/t.fixedPointScale):(g=n.lineMetrics(s),S=!1);}catch{g=n.lineMetrics(s),S=false;}return S?(d.set(c,g),l===1?g:{height:g.height*l,baseline:g.baseline*l}):g}}var Rt=new WeakMap;function Ra(e){let t=Rt.get(e);if(t!==void 0)return t??void 0;let n=e.path;if(!n.startsWith("M")||n.length>1e6||/[^MLQCZ0-9eE+.,\s-]/u.test(n))return;let r=1/0,o=-1/0,a=n.matchAll(/([MLQCZ])([^MLQCZ]*)/gu);for(let s of a){let l=s[1]==="Z"?0:s[1]==="C"?6:s[1]==="Q"?4:2,d=s[2].trim().split(/[\s,]+/u).filter(Boolean).map(Number);if(d.length!==l||d.some(c=>!Number.isFinite(c))){Rt.set(e,null);return}for(let c=0;c<d.length;c+=2)r=Math.min(r,d[c]),o=Math.max(o,d[c]);}let i=Number.isFinite(r)&&Number.isFinite(o)?{left:r,right:o}:void 0;return Rt.set(e,i??null),i}function Qn(e,t,n,r){if(e.clusters.length!==1||e.glyphs.length===0)return;let o=1/0,a=-1/0;for(let s of e.glyphs){if(s.id===0)return;let l=Ra(s.outline),d=s.outline.unitsPerEm;if(!l||!(d>0))return;let c=(s.originX+s.offsetX)/n;o=Math.min(o,c+l.left*t*(s.drawScale??1)/d),a=Math.max(a,c+l.right*t*(s.drawScale??1)/d);}let i={left:o*r,right:a*r};return Number.isFinite(i.left)&&Number.isFinite(i.right)?i:void 0}function Fa(e,t,n){if(t<12)return null;if(e.getUint32(0)!==1953784678)return 0;let o=12+(Number.isSafeInteger(n)&&n>0?n:0)*4;if(o+4>t)return null;let a=e.getUint32(o);return a+12<=t?a:null}function er(e,t,n,r,o){let a=e.getUint16(n+4);if(a>4096||n+12+a*16>t)return null;for(let i=0;i<a;i+=1){let s=n+12+i*16;if(e.getUint32(s)!==r)continue;let l=e.getUint32(s+8),d=e.getUint32(s+12);return d<o||l+d>t?null:l}return null}function tr(e,t){let n=e.byteLength,r=new DataView(e.buffer,e.byteOffset,n),o=Fa(r,n,t);if(o===null)return null;let a=er(r,n,o,1751474532,54);if(a===null)return null;let i=r.getUint16(a+18);if(i<=0)return null;let s=er(r,n,o,1330851634,30);if(s===null)return null;let l=r.getInt16(s+26)/i,d=r.getInt16(s+28)/i;return !(l>0)||l>1||!(Math.abs(d)<=1)?null:{offsetEm:d,thicknessEm:l}}var va=.5,Ea=4,nr=4096;function rr(e){let t="environment"in e?e.environment:void 0,n="environment"in e?void 0:e,{shaper:r,resolveFont:o,fallback:a}=e,i=t??{shapingLibrary:n.shapingLibrary,unicodeDataVersion:n.unicodeDataVersion,script:n?.script??"Latn",fixedPointScale:n?.fixedPointScale??1e3,normalization:n?.normalization??"none",features:n?.features??{},roundingMode:n?.roundingMode??"halfToEven",language:n?.language??"en",variationAxes:{}},s=new WeakMap,l=new WeakMap,d=Jn(r,i,a,Ea,va),c=new WeakMap,f=new WeakMap,g=new Array(nr),S=0,x=(y,p,E)=>{let C=g[S];C&&C.cache.delete(C.text),y.set(p,E),g[S]={cache:y,text:p},S=(S+1)%nr;},h=y=>{let p=c.get(y);if(p!==void 0)return p;let E=o(y);return c.set(y,E),E},u=(y,p,E)=>{let C=E?l:s,F=C.get(y);F||(F=new Map,C.set(y,F));let w=F.get(p);return w||(w=new Map,F.set(p,w)),w},b=new WeakMap,m=y=>{if(!y.shaping?.wordSpacingPt)return y;let p=b.get(y);return p||(p={...y,shaping:{...y.shaping,wordSpacingPt:void 0}},b.set(y,p)),p},R=(y,p)=>p.shaping?.wordSpacingPt?chunk65GJRSZ5_cjs.$c(y)*p.shaping.wordSpacingPt:0,v=(y,p)=>a.measure(y,m(p))+R(y,p),L=(y,p)=>{let E=Math.max(0,a.measure(y,m(p))),C=a.caretAdvances?.(y,m(p))??chunk65GJRSZ5_cjs.Zc(y,E);if(!C||C.length!==y.length+1)return chunk65GJRSZ5_cjs.Zc(y,v(y,p));let F=Math.max(0,v(y,p)),w=0,I=0;return C.map((_,H)=>{if(H===0)return 0;y[H-1]===" "&&I++;let ne=_+I*(p.shaping?.wordSpacingPt??0);return w=Math.max(w,Math.min(F,Number.isFinite(ne)?ne:w)),H===y.length?F:w})},T=new WeakMap;return {hasResolvedFont(y){return h(y)!==null},strikeoutMetrics(y){let p=h(y);if(!p)return;let E=T.get(p);if(E===void 0&&(E=tr(p.bytes,p.faceIndex),T.set(p,E)),!E)return;let C=te(y)/2*chunk65GJRSZ5_cjs.L(y);return {offsetPt:E.offsetEm*C,thicknessPt:E.thicknessEm*C}},measure(y,p){if(y.length===0)return 0;let E=h(p);if(!E)return v(y,p);let C=u(E,te(p),p.smallCaps),F=p.shaping?`1:${JSON.stringify([p.shaping.script,p.shaping.direction,y])}`:`0:${y}`,w=`${D(p)?1:0}:${chunk65GJRSZ5_cjs.h(p)}:${F}`,I=C.get(w);if(I===void 0){let _=0;try{if(p.smallCaps&&!Ue(r,i,E,p,f))return v(y,p);let H=W(r,i,E,p,y);if(H.glyphs.some(ne=>ne.id===0))return v(y,p);for(let ne of H.glyphs)_+=ne.advanceX;}catch{return v(y,p)}I=_/i.fixedPointScale,x(C,w,I);}return I*chunk65GJRSZ5_cjs.L(p)*(p.horizontalScalePercent/100)+y.length*p.characterSpacingPt+R(y,p)},inkBounds(y,p){if(!y||y.length>2||p.shaping?.direction==="rtl"||chunk65GJRSZ5_cjs.S(y).length!==1)return;let E=h(p);if(!E)return a.inkBounds?.(y,p);try{if(p.smallCaps&&!Ue(r,i,E,p,f))return a.inkBounds?.(y,p);let C=W(r,i,E,p,y);return Qn(C,te(p)/2,i.fixedPointScale,chunk65GJRSZ5_cjs.L(p)*p.horizontalScalePercent/100)}catch{return}},caretAdvances(y,p){let E=h(p);if(!E)return L(y,p);try{if(p.smallCaps&&!Ue(r,i,E,p,f))return L(y,p);let C=W(r,i,E,p,y);return C.glyphs.some(F=>F.id===0)?L(y,p):chunk65GJRSZ5_cjs._c(y,C,chunk65GJRSZ5_cjs.L(p)*(p.horizontalScalePercent/100)/i.fixedPointScale,p.characterSpacingPt,p.shaping?.wordSpacingPt??0)??chunk65GJRSZ5_cjs.Zc(y,C.glyphs.reduce((F,w)=>F+w.advanceX,0)*chunk65GJRSZ5_cjs.L(p)*(p.horizontalScalePercent/100)/i.fixedPointScale+y.length*p.characterSpacingPt+R(y,p))}catch{return L(y,p)}},lineMetrics(y,p){let E=h(y);if(!E)return a.lineMetrics(y,p);if(!p||/^[\t\n\r\f ]*$/.test(p))return d(E,y);try{let C=W(r,i,E,y,p),F=0,w=0;for(let I of C.fontSpans){let _=d(I.font,y);F=Math.max(F,_.baseline),w=Math.max(w,_.height-_.baseline);}if(F+w>0)return {height:F+w,baseline:F}}catch{}return d(E,y)}}}function Ca(e,t){return rr({...t,shaper:e.shaper,environment:e.environment})}function wa(e){let{layout:t,viewport:n}=e,r=new Set;if(!n){for(let l of t.pages)r.add(l.index);return r}let o=Math.max(0,Math.trunc(e.overscanPages??1)),a=n.top+n.height,i=-1,s=-1;for(let l of t.pages){let d=l.box.y;d+l.box.height>=n.top&&d<=a&&(i===-1&&(i=l.index),s=l.index);}if(i===-1){let l=Oa(t,n.top);l!==null&&(i=l,s=l);}if(i!==-1){let l=Math.max(0,i-o),d=Math.min(t.pages.length-1,s+o);for(let c=l;c<=d;c+=1)r.add(c);}for(let l of e.pinnedPages??[])l>=0&&l<t.pages.length&&r.add(l);return r}function Oa(e,t){let n=null,r=Number.POSITIVE_INFINITY;for(let o of e.pages){let a=t<o.box.y?o.box.y-t:t>o.box.y+o.box.height?t-(o.box.y+o.box.height):0;a<r&&(r=a,n=o.index);}return n}var or=["text-local","paragraph-local","flow-structural","global"];function ar(e,t){return or.indexOf(t)>or.indexOf(e)?t:e}function La(e){return {impact:"text-local",paragraphIds:new Set,created:new Set,deleted:new Set,dependencyKeys:new Set,structural:false,revision:e}}function Ta(e){let{run:t,currentRevision:n,publish:r,schedule:o}=e,a=null,i=null,s=null,l=0,d=0;function c(u){let b=e.runCooperatively;if(!b)return t(u);let m=b(u);s=m;try{for(;;){let R=m.step();if(R)return R;if(n()!==u.revision)return m.cancel(),d+=1,null;if(s!==m)return null}}finally{s===m&&(s=null);}}function f(u){let b=S(n());b.impact=ar(b.impact,u.impact),b.structural=b.structural||u.structural;for(let m of u.paragraphIds)b.paragraphIds.add(m);for(let m of u.created)b.created.add(m);for(let m of u.deleted)b.deleted.add(m);for(let m of u.dependencyKeys)b.dependencyKeys.add(m);}let g=u=>({impact:u.impact,paragraphIds:u.paragraphIds,created:u.created,deleted:u.deleted,dependencyKeys:u.dependencyKeys,structural:u.structural,revision:u.revision});function S(u){return a||(a=La(u)),a.revision=Math.max(a.revision,u),a}function x(){!o||i||(i=o(()=>{i=null,h();}));}function h(){i&&(i(),i=null),s&&(s.cancel(),s=null,d+=1);let u=a;if(!u)return false;a=null;let b=g(u),m=c(b);return !m||m.revision!==n()?(l+=1,f(b),x(),false):(r(m,b),true)}return {notify(u){let b=S(n());b.impact=ar(b.impact,u.impact);for(let m of u.dirty)b.paragraphIds.add(m);for(let m of u.created)b.created.add(m),b.paragraphIds.add(m);for(let m of u.deleted)b.deleted.add(m),b.paragraphIds.add(m);for(let m of u.dependencyKeys)b.dependencyKeys.add(m);for(let m of u.splitJoin)b.structural=true,"split"in m?(b.paragraphIds.add(m.split.from),b.paragraphIds.add(m.split.tail)):(b.paragraphIds.add(m.join.kept),b.paragraphIds.add(m.join.removed));(u.impact==="flow-structural"||u.impact==="global")&&(b.structural=true),x();},invalidateAll(u,b){let m=S(u);m.impact="flow-structural",m.structural=true,b&&m.dependencyKeys.add(b),x();},flush:h,pending:()=>a?g(a):null,cancel(){i?.(),i=null,s?.cancel(),s=null,a=null;},get staleDiscards(){return l},get cancelledRuns(){return d}}}var ir=new WeakMap;function V(e){let t=ir.get(e);if(t)return t;let n=new Map,r=new Map,o=new Map,a=new Map,i=(l,d,c,f)=>{for(let g of l){if(g.kind==="paragraph")continue;let S=g.tableId;a.set(S,Math.max(a.get(S)??0,(g.columnEdges?.length??1)-1));let x=o.get(S);x||(x=new Map,o.set(S,x),n.set(S,[]),r.set(S,new Map));for(let h of g.rows){let u=x.get(h.id);u===void 0&&(u=x.size,x.set(h.id,u),r.get(S).set(u,h.cells));for(let b of h.cells)n.get(S).push({pageIndex:d,tableId:S,row:h,cell:b,rowIndex:u,isHeaderRepeat:h.isHeaderRepeat,offsetX:c,offsetY:f}),i(b.blocks,d,c,f);}}};for(let l of e.pages){i(l.fragments,l.index,0,0);for(let d of [l.header,l.footer])d&&i(d.fragments,l.index,d.box.x-l.contentBox.x,d.box.y-l.contentBox.y);for(let d of [l.footnotes,l.endnotes])if(d)for(let c of d.notes)i(c.fragments,l.index,c.box.x-l.contentBox.x,c.box.y-l.contentBox.y);}let s=new Map;for(let[l,d]of n)s.set(l,{placed:d,rows:r.get(l)??new Map,columnCount:a.get(l)??0});return ir.set(e,s),s}function cr(e){let t=e.columnCount;for(let n of e.rows.values())for(let r of n)t=Math.max(t,Z(r).to+1);return t}var Z=e=>({from:e.gridColumn,to:e.gridColumn+Math.max(1,e.gridSpan)-1});function Ia(e,t,n){if(t.tableId!==n.tableId)return null;let r=V(e).get(t.tableId);if(!r)return null;let o=Math.min(t.rowIndex,n.rowIndex),a=Math.max(t.rowIndex,n.rowIndex),i=Math.min(Z(t).from,Z(n).from),s=Math.max(Z(t).to,Z(n).to),l=S=>{let{from:x,to:h}=Z(S);return h>=i&&x<=s},d=S=>(r.rows.get(S)??[]).some(x=>x.vMergeContinue&&l(x)),c=r.rows.size+cr(r)+2;for(let S=0;!(S>c);S+=1){let x=false;for(let[h,u]of r.rows)if(!(h<o||h>a))for(let b of u){if(!l(b))continue;let{from:m,to:R}=Z(b);m<i&&(i=m,x=true),R>s&&(s=R,x=true);}for(;o>0&&d(o);)o-=1,x=true;for(;d(a+1);)a+=1,x=true;if(!x)break}let f=[],g=new Set;for(let S of r.placed){if(S.isHeaderRepeat||S.rowIndex<o||S.rowIndex>a)continue;let{from:x,to:h}=Z(S.cell);h<i||x>s||g.has(S.cell.id)||(g.add(S.cell.id),f.push(S.cell.id));}return f.length===0?null:{kind:"cells",tableId:t.tableId,cellIds:f,rows:{from:o,to:a},columns:{from:i,to:s},text:Ba(e,t.tableId,f)}}function Ss(e,t){return ur(e,t,true)}function Ge(e,t){return ur(e,t,false)}function ur(e,t,n){let r=new Set(t),o=[],a=new Set;for(let i of V(e).values())for(let s of i.placed)if(!(s.isHeaderRepeat||!r.has(s.cell.id)))for(let l of s.cell.blocks)n&&l.kind!=="paragraph"||fe(l,o,a);return o}function fe(e,t,n){if(e.kind==="paragraph"){for(let r of chunk65GJRSZ5_cjs.sa(e))n.has(r)||(n.add(r),t.push(r));return}for(let r of e.rows)if(!r.isHeaderRepeat)for(let o of r.cells)for(let a of o.blocks)fe(a,t,n);}function Ba(e,t,n){let r=Ge(e,n),o=r[0],a=r[r.length-1];return !o||!a?Aa(e,t):{anchor:{paragraphId:o,offset:0},head:{paragraphId:a,offset:chunk65GJRSZ5_cjs.ye(e,a).length}}}function Aa(e,t){let n=V(e).get(t);for(let o of n?.placed??[]){if(o.isHeaderRepeat)continue;let a=[];for(let s of o.cell.blocks)fe(s,a,new Set);let i=a[0];if(i){let s={paragraphId:i,offset:0};return {anchor:s,head:s}}}for(let o of e.pages)for(let a of chunk65GJRSZ5_cjs.aa(o)){let i={paragraphId:a.paragraphId,offset:0};return {anchor:i,head:i}}let r={paragraphId:"",offset:0};return {anchor:r,head:r}}function Pa(e){let t=[...chunk65GJRSZ5_cjs.aa(e)];for(let n of [e.header,e.footer])n&&t.push(...chunk65GJRSZ5_cjs.ba(n.fragments));for(let n of [e.footnotes,e.endnotes])if(n)for(let r of n.notes)t.push(...chunk65GJRSZ5_cjs.ba(r.fragments));return t}function _a(e,t){let n=new Set(Ge(e,t)),r=[],o=new Set;for(let a of e.pages)for(let i of Pa(a))if(n.has(i.paragraphId))for(let s of i.lines)for(let l of s.spans){let d=`${l.range.paragraphId}:${l.range.start}:${l.range.end}`;o.has(d)||(o.add(d),r.push(l));}return r}function Ma(e,t){let n=new Set(t),r=[];for(let o of V(e).values())for(let a of o.placed)n.has(a.cell.id)&&r.push({pageIndex:a.pageIndex,x:a.cell.box.x+a.offsetX,y:a.cell.box.y+a.offsetY,width:a.cell.box.width,height:a.cell.box.height});return r}function za(e,t){let n=V(e).get(t.tableId);if(!n)return "";let r=new Set(t.cellIds),o=n.placed.some(s=>s.cell.logicalGridColumn!==void 0),a=new Map,i=new Set;for(let s of n.placed){if(s.isHeaderRepeat||!r.has(s.cell.id)||i.has(s.cell.id))continue;i.add(s.cell.id);let l=Ge(e,[s.cell.id]).map(f=>chunk65GJRSZ5_cjs.ye(e,f)).join(`
3
+ `),d=a.get(s.rowIndex),c=s.cell.gridColumn+(o?Math.max(1,s.cell.gridSpan)-1:0);d?d.set(c,l):a.set(s.rowIndex,new Map([[c,l]]));}return [...a.keys()].sort((s,l)=>s-l).map(s=>{let l=a.get(s),d=[];for(let c=0;c<=t.columns.to-t.columns.from;c+=1){let f=o?t.columns.to-c:t.columns.from+c;d.push(l.get(f)??"");}return d.join(" ")}).join(`
4
+ `)}function Ft(e,t){return Na(e).get(t)??null}var sr=new WeakMap;function ka(e){let t=sr.get(e);if(t)return t;let n=[];for(let r of e.blocks)fe(r,n,new Set);return sr.set(e,n),n}var lr=new WeakMap;function Na(e){let t=lr.get(e);if(t)return t;let n=new Map;for(let[r,o]of V(e)){let a;for(let i of o.placed)if(!i.isHeaderRepeat)for(let s of ka(i.cell)){let l=n.get(s);l&&l.tableId.length>=r.length||(a??=cr(o),n.set(s,{tableId:r,rows:o.rows.size,columns:a,rowIndex:i.rowIndex,columnIndex:i.cell.logicalGridColumn??i.cell.gridColumn}));}}return lr.set(e,n),n}function xs(e,t,n){if(n){let a=Ft(e,t);if(!a||a.tableId!==n.tableId)return null;let i=n.cellIds[0];if(!i)return null;let s=V(e).get(n.tableId);if(!s)return null;for(let l of s.placed)if(l.cell.id===i)return {tableId:n.tableId,rowId:l.row.id,cellId:i,cellIds:n.cellIds,gridColumnIndex:l.cell.logicalGridColumn??l.cell.gridColumn,isHeaderRepeat:l.isHeaderRepeat};return null}let r=Ft(e,t);if(!r)return null;let o=V(e).get(r.tableId);if(!o)return null;for(let a of o.placed){if(a.isHeaderRepeat)continue;let i=[];for(let s of a.cell.blocks)fe(s,i,new Set);if(i.includes(t))return {tableId:r.tableId,rowId:a.row.id,cellId:a.cell.id,cellIds:[a.cell.id],gridColumnIndex:a.cell.logicalGridColumn??a.cell.gridColumn,isHeaderRepeat:a.row.isHeaderRepeat}}return null}var dr=new WeakMap;function Rs(e,t){let n=dr.get(e);if(n)return n.get(t)??null;let r=new Map;for(let[o,a]of V(e))for(let i of a.placed){if(i.isHeaderRepeat)continue;let s=[];for(let d of i.cell.blocks)fe(d,s,new Set);let l={tableId:o,rowId:i.row.id,cellId:i.cell.id,rowIndex:i.rowIndex,gridColumn:i.cell.gridColumn,gridSpan:i.cell.gridSpan};for(let d of s){let c=r.get(d);c&&c.tableId.length>=o.length||r.set(d,l);}}return dr.set(e,r),r.get(t)??null}function Da(e,t,n){if(![e,t,n].every(Number.isFinite)||t<=0||n<=0)return {offsetPt:0,count:0};let r=Math.ceil(e/n-1e-9)*n;if(!Number.isFinite(r))return {offsetPt:0,count:0};let o=Math.max(0,r-e);return {offsetPt:o,count:Math.min(8192,Math.max(0,Math.floor((t-o)/n+1e-9)))}}exports.$=Yo;exports.A=wo;exports.Aa=xs;exports.B=Oo;exports.Ba=Rs;exports.C=ai;exports.Ca=Da;exports.D=yt;exports.E=ii;exports.F=Lo;exports.G=Io;exports.H=si;exports.I=Bo;exports.J=ht;exports.K=De;exports.L=Ao;exports.M=Po;exports.N=_o;exports.O=gt;exports.P=Ln;exports.Q=Tn;exports.R=In;exports.S=Bn;exports.T=An;exports.U=Pn;exports.V=No;exports.W=Do;exports.X=pe;exports.Y=Go;exports.Z=St;exports._=zn;exports.a=oe;exports.aa=D;exports.b=U;exports.ba=Hn;exports.c=X;exports.ca=Ci;exports.d=K;exports.da=Un;exports.e=ae;exports.ea=Gn;exports.f=Xt;exports.fa=Zo;exports.g=Y;exports.ga=Jo;exports.h=se;exports.ha=Qo;exports.i=Ae;exports.ia=zi;exports.j=nt;exports.ja=ra;exports.k=k;exports.ka=Xn;exports.l=Q;exports.la=ha;exports.m=on;exports.ma=ga;exports.n=st;exports.na=W;exports.o=ze;exports.oa=Ue;exports.p=Rr;exports.pa=rr;exports.q=Cr;exports.qa=Ca;exports.r=ee;exports.ra=wa;exports.s=dt;exports.sa=Ta;exports.t=wr;exports.ta=Ia;exports.u=O;exports.ua=Ss;exports.v=ct;exports.va=Ge;exports.w=fn;exports.wa=_a;exports.x=pt;exports.xa=Ma;exports.y=Qa;exports.ya=za;exports.z=j;exports.za=Ft;
@@ -0,0 +1,4 @@
1
+ import {f,c,d,e}from'./chunk-RIYSCEFQ.js';import {S,W as W$1,va as va$1,fa as fa$1,L,N as N$1,tc,rc,Ub,hb,nc,xa as xa$1,h,g,_c,Zc,sa,ye as ye$1,aa,$c,ia,pa as pa$1,jb,Wb,pc,mc,Ta as Ta$1,sc,ba as ba$1,M,$ as $$1}from'./chunk-W2JIZ5JH.js';import {Ga}from'./chunk-GG4IAKFI.js';import {a,wh,Qc,Oc,Tc,Pc,$f,zh,yh,xh,Cc,Mc}from'./chunk-UOQONZVQ.js';var lr=Symbol("validated-resolved-font"),dr=4,oe=64*1024*1024,U=256,X=128*1024*1024,K=class extends Error{name="FontResolutionError";request;code;limit;actual;diagnostic;expectedHash;actualHash;constructor(t,n,r={}){super(`Font resolution failed (${t}) for ${Y(n)}`),this.code=t,this.request=q(n),this.limit=r.limit,this.actual=r.actual,this.diagnostic=r.diagnostic,this.expectedHash=r.expectedHash,this.actualHash=r.actualHash;}},Vt=e=>{if(e.family.trim().length===0)throw new TypeError("Font family must not be empty");if(!Number.isInteger(e.weight)||e.weight<1||e.weight>1e3)throw new RangeError("Font weight must be an integer from 1 through 1000");if(e.style!=="normal"&&e.style!=="italic")throw new TypeError("Font style must be normal or italic")},q=e=>(Vt(e),Object.freeze({family:e.family,weight:e.weight,style:e.style})),$e=e=>{let t={family:e.family,weight:e.weight,style:e.style};return q(t)},jt=Symbol("prepared-font-resource"),Ze=new WeakMap,cr=new Uint8Array(0),Kt=Object.getPrototypeOf(Uint8Array.prototype),ur=Object.getOwnPropertyDescriptor(Kt,"length").get,pr=Object.getOwnPropertyDescriptor(Kt,"byteLength").get;function ae(e){if(!ArrayBuffer.isView(e))throw new TypeError("Font bytes must be a genuine byte array");let t,n;try{t=ur.call(e),n=pr.call(e);}catch{throw new TypeError("Font bytes must be a genuine byte array")}if(t!==n)throw new TypeError("Font bytes must use one-byte elements");return n}function Xt(e){let t=new Uint8Array(ae(e));return Uint8Array.prototype.set.call(t,e),t}function Yt(e,t){let n=q(e.request);if(e.availability==="forbidden"){let i=Object.freeze({...e,request:n,actualHash:null,[jt]:true});return Ze.set(i,null),i}let r=Xt(e.bytes);t?.onOwnedByteCopy?.(),t?.onHash?.();let o=a(r),a$1=Object.freeze({...e,request:n,bytes:r,actualHash:o,[jt]:true});return Ze.set(a$1,o),a$1}function ie(e){return Ze.get(e)}var qt=e=>{if(!Number.isFinite(e.heightEm)||!Number.isFinite(e.baselineEm)||e.heightEm<=0||e.heightEm>dr||e.baselineEm<0||e.baselineEm>e.heightEm)throw new RangeError("Font substitution line metrics must fit within a bounded em box");return Object.freeze({heightEm:e.heightEm,baselineEm:e.baselineEm})},Y=e=>(Vt(e),JSON.stringify([e.family.trim().toLowerCase(),e.weight,e.style])),Je=class{[lr]=true;id;identity;request;family;byteLength;hash;faceIndex;substitution;constructor(t,n){if(t.id.length===0)throw new TypeError("Resolved font id must not be empty");if(!Number.isInteger(t.faceIndex)||t.faceIndex<0)throw new RangeError("Font face index must be a non-negative integer");this.id=t.id,this.request=q(t.request),this.family=this.request.family,this.hash=t.hash,this.faceIndex=t.faceIndex,this.identity=`${this.hash}#${this.faceIndex}`,this.byteLength=t.byteLength,this.substitution=null,n&&(this.substitution=Object.freeze({requested:q(n.requested),resolved:q(n.resolved),...n.lineMetrics?{lineMetrics:qt(n.lineMetrics)}:{}})),Object.freeze(this);}get bytes(){return se(this).slice()}},$t=new WeakSet,Zt=new WeakMap,Jt=new WeakMap,Qt=(e,t,n,r)=>{let o=new Je(e,r);return Zt.set(o,t),Jt.set(o,n),$t.add(o),o},se=e=>{le(e);let t=Zt.get(e);if(!t)throw new TypeError("Resolved font has no owned byte capability");return t},Ie=e=>{le(e);let t=Jt.get(e);if(!t)throw new TypeError("Resolved font has no admitted table metadata");return t},le=e=>{if(typeof e!="object"||e===null||!$t.has(e))throw new TypeError("Shaping requires a validated resolved font")},en=(e,t)=>e[t]<<8|e[t+1],re=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Wt=(e,t)=>{if(t>e.byteLength-12)return {valid:false,diagnostic:"truncated sfnt header"};let n=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if(!(e[t]===0&&e[t+1]===1&&e[t+2]===0&&e[t+3]===0)&&n!=="OTTO"&&n!=="true"&&n!=="typ1")return {valid:false,diagnostic:"unsupported sfnt signature"};let o=en(e,t+4),a=t+12+o*16;if(!Number.isSafeInteger(a)||a>e.byteLength)return {valid:false,diagnostic:"truncated sfnt table directory"};for(let i=0;i<o;i+=1){let s=t+12+i*16,l=re(e,s+8),d=re(e,s+12);if(l>e.byteLength||d>e.byteLength-l)return {valid:false,diagnostic:"sfnt table range exceeds font bytes"}}return {valid:true}},fr=(e,t)=>{let r=String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?re(e,12+t*4):0,o=en(e,r+4),a=new Set;for(let i=0;i<o;i+=1){let s=r+12+i*16;a.add(String.fromCharCode(e[s],e[s+1],e[s+2],e[s+3]));}return Object.freeze(a)},Te=(e,t)=>{if(!Number.isSafeInteger(t)||t<0)return {valid:false,diagnostic:"invalid font face index"};if(e.byteLength<12)return {valid:false,diagnostic:"truncated sfnt header"};if(String.fromCharCode(e[0],e[1],e[2],e[3])!=="ttcf")return t!==0?{valid:false,diagnostic:"standalone sfnt has only face index zero"}:Wt(e,0);let r=re(e,4);if(r!==65536&&r!==131072)return {valid:false,diagnostic:"unsupported TTC version"};let o=re(e,8),a=12+o*4;if(o===0||!Number.isSafeInteger(a)||a>e.byteLength||t>=o)return {valid:false,diagnostic:"invalid TTC face directory"};let i=re(e,12+t*4);return i<a?{valid:false,diagnostic:"invalid TTC face offset"}:Wt(e,i)},yr=(e,t,n,r)=>{if(e.availability==="forbidden")return {kind:"forbidden"};let o=ae(e.bytes);if(o>t)return {kind:"overLimit",actual:o};let a$1=ie(e),i=a$1===void 0?Xt(e.bytes):e.bytes;a$1===void 0&&r?.onOwnedByteCopy?.(),a$1===void 0&&r?.onHash?.();let s=a$1??a(i);if(e.hash!==s)return {kind:"hashMismatch",expectedHash:e.hash,actualHash:s};let l=Te(i,e.faceIndex);if(!l.valid)return {kind:"malformed",diagnostic:l.diagnostic};r?.onTableScan?.();let d=fr(i,e.faceIndex);try{let f=n(i,e.faceIndex);if(!f.valid)return {kind:"malformed",diagnostic:f.diagnostic}}catch(f){return {kind:"malformed",diagnostic:f instanceof Error?f.message:"font validator threw"}}let c={kind:"resolved",font:Qt({...e,byteLength:i.byteLength},i,d)};return r?.onAdmission?.(),c},Qe=e=>{let t=e.epoch,n=e.maxFontBytes,r=e.validateFont,o=e.instrumentation,a=e.resources,i=e.substitutions;if(!Number.isSafeInteger(t)||t<0)throw new RangeError("Font resource epoch must be a non-negative safe integer");if(!Number.isSafeInteger(n)||n<=0||n>oe)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${oe}`);if(typeof r!="function")throw new TypeError("Font snapshot requires a validator");let s=a.length,l=i?.length??0;if(s>U)throw new RangeError(`Font source count must not exceed ${U}`);if(l>U)throw new RangeError(`Font substitution count must not exceed ${U}`);let d=0,c=[];for(let m=0;m<s;m+=1){let u=a[m];if(ie(u)!==void 0){let p=u.availability==="forbidden"?0:ae(u.bytes);if(p>X-d)throw new RangeError(`Aggregate font bytes must not exceed ${X}`);d+=p,c.push(u);continue}let b=$e(u.request),h=u.id,R=u.hash,v=u.faceIndex,I=u.availability,T=I==="forbidden"?cr:u.bytes,y=I==="forbidden"?0:ae(T);if(y>X-d)throw new RangeError(`Aggregate font bytes must not exceed ${X}`);d+=y,c.push(Object.freeze({request:b,id:h,bytes:T,hash:R,faceIndex:v,...I?{availability:I}:{}}));}let f=[];if(i)for(let m=0;m<l;m+=1){let u=i[m],b=$e(u.from),h=$e(u.to),R=u.lineMetrics;f.push(Object.freeze({from:b,to:h,...R?{lineMetrics:Object.freeze({heightEm:R.heightEm,baselineEm:R.baselineEm})}:{}}));}let g=new Map;for(let m of c){let u=Y(m.request);g.has(u)||g.set(u,yr(m,n,r,o));}let S=new Map;for(let m of f){let u=Y(m.from);S.has(u)||S.set(u,Object.freeze({to:q(m.to),...m.lineMetrics?{lineMetrics:qt(m.lineMetrics)}:{}}));}return Object.freeze({epoch:t,resolve:m=>{let u=q(m),b=Y(u),h=S.get(b),R=h?.to??u,v=g.get(Y(R));return v?v.kind==="forbidden"?new K("forbidden",u):v.kind==="overLimit"?new K("overLimit",u,{limit:n,actual:v.actual}):v.kind==="malformed"?new K("malformed",u,{diagnostic:v.diagnostic}):v.kind==="hashMismatch"?new K("hashMismatch",u,{expectedHash:v.expectedHash,actualHash:v.actualHash}):h?Qt({request:v.font.request,id:v.font.id,hash:v.font.hash,faceIndex:v.font.faceIndex,byteLength:v.font.byteLength},se(v.font),Ie(v.font),{requested:u,resolved:h.to,...h.lineMetrics?{lineMetrics:h.lineMetrics}:{}}):v.font:new K("missing",u)}})};var z=e=>{if(!Number.isSafeInteger(e))throw new RangeError("Fixed-point value must be a safe integer");return e},Le=(e,t)=>{if(e.trim().length===0||/[\u0000-\u001f\u007f]/.test(e))throw new TypeError(`${t} must be non-blank and contain no control characters`)},mr=(e,t)=>{if(!/^[\x20-\x7e]{4}$/.test(e))throw new TypeError(`${t} must be a four-byte ASCII tag`)},tn=(e,t,n)=>{let r=Object.entries(e).sort(([a],[i])=>a<i?-1:a>i?1:0),o=Object.create(null);for(let[a,i]of r){if(mr(a,`${t} key`),!Number.isFinite(i)||n&&(!Number.isSafeInteger(i)||i<0))throw new RangeError(`${t} value must be ${n?"a non-negative safe integer":"finite"}`);if(n&&i>4294967295)throw new RangeError(`${t} value must fit an unsigned 32-bit integer`);o[a]=i;}return Object.freeze(o)},et=e=>Object.freeze({family:e.family,weight:e.weight,style:e.style}),hr=e=>e?Object.freeze({requested:et(e.requested),resolved:et(e.resolved),...e.lineMetrics?{lineMetrics:Object.freeze({...e.lineMetrics})}:{}}):void 0,nn=new WeakSet,tt=new WeakSet,rn=new WeakMap,rt=e=>{if(le(e),!nn.has(e)){if(e.identity!==`${e.hash}#${e.faceIndex}`)throw new TypeError("Resolved font identity does not match hash and face index");if(!Number.isSafeInteger(e.byteLength)||e.byteLength<0)throw new TypeError("Resolved font byte length is invalid");nn.add(e);}},nt=e=>(rt(e),e),Be=e=>(rt(e),Object.freeze({identity:e.identity,id:e.id,family:e.family,request:et(e.request),hash:e.hash,faceIndex:e.faceIndex,byteLength:e.byteLength,substitution:hr(e.substitution)??null})),Q=e=>{if(tt.has(e))return e;if(Le(e.shapingLibrary.name,"shaping library name"),Le(e.shapingLibrary.version,"shaping library version"),Le(e.unicodeDataVersion,"Unicode data version"),!/^\d+(?:\.\d+){0,3}(?:[-+][0-9A-Za-z.-]+)?$/.test(e.shapingLibrary.version))throw new TypeError("shaping library version must be a numeric version");if(!/^\d+(?:\.\d+){1,2}$/.test(e.unicodeDataVersion))throw new TypeError("Unicode data version must be a dotted numeric version");if(!/^[A-Z][a-z]{3}$/.test(e.script))throw new TypeError("script must be a four-letter ISO 15924 code");if(Le(e.language,"language"),!/^(?:und|[A-Za-z]{2,8})(?:-[A-Za-z0-9]{1,8})*$/.test(e.language))throw new TypeError("language must be a BCP 47 language tag");if(e.direction!=="ltr"&&e.direction!=="rtl")throw new TypeError("direction must be ltr or rtl");if(!["none","NFC","NFD","NFKC","NFKD"].includes(e.normalization))throw new TypeError("invalid normalization policy");if(!["halfAwayFromZero","halfToEven","towardZero"].includes(e.roundingMode))throw new TypeError("invalid fixed-point rounding mode");if(!Number.isSafeInteger(e.fixedPointScale)||e.fixedPointScale<=0)throw new RangeError("fixed-point scale must be a positive safe integer");let t=nt(e.font),n=e.fallbackOrder.map(nt),r=new Set;for(let a of n){let i=JSON.stringify(Be(a));if(r.has(i))throw new TypeError("fallback order contains a duplicate font");r.add(i);}let o=Object.freeze({font:t,variationAxes:tn(e.variationAxes,"variation axis",false),shapingLibrary:Object.freeze({name:e.shapingLibrary.name,version:e.shapingLibrary.version}),unicodeDataVersion:e.unicodeDataVersion,normalization:e.normalization,script:e.script,language:e.language,direction:e.direction,features:tn(e.features,"OpenType feature",true),fallbackOrder:Object.freeze([...n]),fixedPointScale:e.fixedPointScale,roundingMode:e.roundingMode});return tt.add(o),o},an=e=>{let t=Q(e);return Object.freeze({font:Be(t.font),variationAxes:Object.freeze(Object.entries(t.variationAxes).map(n=>Object.freeze(n))),shapingLibrary:Object.freeze({name:t.shapingLibrary.name,version:t.shapingLibrary.version}),unicodeDataVersion:t.unicodeDataVersion,normalization:t.normalization,script:t.script,language:t.language,direction:t.direction,features:Object.freeze(Object.entries(t.features).map(n=>Object.freeze(n))),fallbackOrder:Object.freeze(t.fallbackOrder.map(Be)),fixedPointScale:t.fixedPointScale,roundingMode:t.roundingMode})},ot=e=>{let t=rn.get(e);if(t!==void 0)return t;let n=JSON.stringify(an(e));return tt.has(e)&&rn.set(e,n),n},J=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},B=e=>{try{return z(e)}catch{throw new RangeError("Shaped run contains a non-integer fixed-point value")}},on=new WeakMap,Ae=e=>{let t=on.get(e);if(t)return t;rt(e);let n=JSON.stringify({identity:e.identity,id:e.id,family:e.family,request:e.request,hash:e.hash,faceIndex:e.faceIndex,byteLength:e.byteLength,substitution:e.substitution??null});return on.set(e,n),n},Pe=(e,t)=>{let n=Q(t);if(e.direction!=="ltr"&&e.direction!=="rtl")throw new TypeError("Shaped run direction must be ltr or rtl");if(e.direction!==n.direction)throw new TypeError("Shaped run direction does not match shaping environment");if(J(e.bidiLevel,"bidi level"),(e.bidiLevel&1)===1!=(e.direction==="rtl"))throw new TypeError("Shaped run direction does not match bidi level parity");let r=new Map,o=e.glyphs.map(d=>{J(d.id,"glyph id"),J(d.cluster,"glyph cluster");let c=r.get(d.outline);if(!c){if(!Number.isSafeInteger(d.outline.unitsPerEm)||d.outline.unitsPerEm<=0)throw new RangeError("Glyph outline units per em must be a positive safe integer");c=Object.isFrozen(d.outline)?d.outline:Object.freeze({path:d.outline.path,unitsPerEm:d.outline.unitsPerEm}),r.set(d.outline,c);}return Object.freeze({id:d.id,cluster:d.cluster,originX:B(d.originX),originY:B(d.originY),advanceX:B(d.advanceX),advanceY:B(d.advanceY),offsetX:B(d.offsetX),offsetY:B(d.offsetY),outline:c,...d.drawScale!==void 0?{drawScale:d.drawScale}:{}})}),a=e.fontSpans.map(d=>{if(J(d.glyphStart,"font span start"),J(d.glyphEnd,"font span end"),d.glyphEnd<=d.glyphStart||d.glyphEnd>o.length)throw new RangeError("Font span glyph range is invalid");d.fallbackIndex!==null&&J(d.fallbackIndex,"fallback index");let c=nt(d.font);if(d.fallbackIndex===null){if(Ae(c)!==Ae(n.font))throw new TypeError("Shaped primary font does not match shaping environment")}else {let f=n.fallbackOrder[d.fallbackIndex];if(!f)throw new RangeError("Shaped fallback index is outside fallback order");if(Ae(c)!==Ae(f))throw new TypeError("Shaped fallback font does not match shaping environment provenance")}return Object.freeze({...d,font:c})});for(let d=0;d<a.length;d+=1){let c=d===0?0:a[d-1].glyphEnd;if(a[d].glyphStart!==c)throw new RangeError("Font spans must cover glyphs contiguously")}if(o.length===0&&a.length!==0||o.length>0&&a.at(-1)?.glyphEnd!==o.length)throw new RangeError("Font spans must cover every glyph exactly once");let i=e.clusters.map(d=>{for(let[f,g]of [["cluster text start",d.textStart],["cluster text end",d.textEnd],["cluster glyph start",d.glyphStart],["cluster glyph end",d.glyphEnd],["cluster font span",d.fontSpan]])J(g,f);if(d.textEnd<=d.textStart||d.textEnd>e.text.length||d.glyphEnd<=d.glyphStart||d.glyphEnd>o.length)throw new RangeError("Shaped cluster range is invalid");let c=a[d.fontSpan];if(!c||d.glyphStart<c.glyphStart||d.glyphEnd>c.glyphEnd)throw new RangeError("Shaped cluster does not belong to its declared font span");return Object.freeze({...d,advance:B(d.advance),caretEdges:Object.freeze(d.caretEdges.map(B))})}),s=Object.freeze({ascent:B(e.metrics.ascent),descent:B(e.metrics.descent),lineGap:B(e.metrics.lineGap)}),l=e.exactAdvancesX;if(l!==void 0){if(l.length!==o.length)throw new RangeError("Exact advances must be parallel to the shaped glyphs");if(l.some(d=>!Number.isFinite(d)))throw new RangeError("Exact advance must be a finite number")}return Object.freeze({text:e.text,direction:e.direction,bidiLevel:e.bidiLevel,glyphs:Object.freeze(o),clusters:Object.freeze(i),fontSpans:Object.freeze(a),metrics:s,...l===void 0?{}:{exactAdvancesX:Object.freeze([...l])}})},gr=(e,t)=>{let n=Pe(e,t);return Object.freeze({text:n.text,direction:n.direction,script:t.script,language:t.language,bidiLevel:n.bidiLevel,glyphs:n.glyphs,clusters:n.clusters,fontSpans:Object.freeze(n.fontSpans.map(r=>Object.freeze({glyphStart:r.glyphStart,glyphEnd:r.glyphEnd,fallbackIndex:r.fallbackIndex,font:Be(r.font)}))),metrics:n.metrics})};var br=4096,sn=e=>typeof e=="number"?String(e):JSON.stringify(e)??typeof e,_e=class{constructor(t){this.onRestart=t;}onRestart;#e=new Map;keyOf(t,n){let r=ot(n),o=this.#e.get(r);return o===void 0&&(this.#e.size>=br&&(this.#e.clear(),this.onRestart()),o=this.#e.size,this.#e.set(r,o)),`${o}\0${sn(t.fontSizeHalfPoints)}\0${sn(t.bidiLevel)}\0${t.text}`}clear(){this.#e.clear();}};var ee=Object.freeze({name:"HarfBuzz",version:"14.4.0"}),me=null,fe=null;function it(){return me?Promise.resolve():fe||(fe=import('./dist-PKZR6RSH.js').then(e=>{let t=e.versionString();if(t!==ee.version)throw new O("shapingLibraryMismatch",{diagnostic:f(ee.version,t)});me=e;}).catch(e$1=>{throw fe=null,e$1 instanceof O?e$1:c(e$1)?new O("unsupportedRuntime",{diagnostic:d(e$1),cause:e$1}):new O("wasmUnavailable",{diagnostic:e(e$1),cause:e$1})}),fe)}function Sr(){return me!==null}function xr(){if(!me)throw new O("notInitialized",{diagnostic:"Call initializeHarfBuzz() before creating a text shaper"});return me}var O=class extends Error{name="HarfBuzzShapingError";code;limit;actual;diagnostic;constructor(t,n={}){super(`HarfBuzz shaping failed (${t})`,{cause:n.cause}),this.code=t,this.limit=n.limit,this.actual=n.actual,this.diagnostic=n.diagnostic;}},Rr=16*1024*1024,Fr=1e6,vr=1e6,Er=1e6,Cr=4,wr=512,Or=1024*1024,Ir=16*1024*1024,Tr=32*1024*1024,Lr=64*1024*1024,Ar=64*1024*1024,Br=1e6,Pr=1e6,_r=1e6,Mr=64,kr=4096,zr=4*1024*1024,Nr=64*1024*1024,Dr=64*1024*1024,Hr=256*1024*1024,Ur=new Set(["COLR","CPAL","CBDT","CBLC","sbix","SVG "]),ln=["cmap","head","hhea","hmtx","maxp"],Gr=(e,t)=>e[t]<<8|e[t+1],jr=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Wr=(e,t)=>String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?jr(e,12+t*4):0,Vr=(e,t)=>{let n=Wr(e,t),r=Gr(e,n+4),o=new Set;for(let a=0;a<r;a+=1){let i=n+12+a*16;o.add(String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]));}return o},Kr=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),Xr=(e,t)=>{let n=Te(e,t);if(!n.valid)return n;let r=Vr(e,t);for(let o of ln)if(!r.has(o))return {valid:false,diagnostic:`missing required ${o} table`};return {valid:true}},st=Xr,P=(e,t,n)=>{if(!Number.isSafeInteger(e)||e<=0||e>n)throw new RangeError(`${t} must be a positive safe integer no greater than ${n}`);return e},Yr=(e,t,n)=>{let r=e<0n,o=r?-e:e,a=o/t,i=o%t;if(n!=="towardZero"){let d=i*2n;(d>t||d===t&&(n==="halfAwayFromZero"||n==="halfToEven"&&a%2n!==0n))&&(a+=1n);}let s=r?-a:a,l=Number(s);if(!Number.isSafeInteger(l))throw new RangeError("Shaped fixed-point value exceeds the safe integer range");return l},dn=(e,t,n,r)=>{if(!Number.isSafeInteger(e))throw new RangeError("font units must be a safe integer");if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("fixed-point denominator must be a positive safe integer");if(!Number.isSafeInteger(n)||n<0)throw new RangeError("fixed-point numerator must be a non-negative safe integer");return z(Yr(BigInt(e)*BigInt(n),BigInt(t),r))},qr=(e,t,n,r)=>{if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("font size must be a positive integer number of half points");if(t>Math.floor(Number.MAX_SAFE_INTEGER/n))throw new RangeError("font size and fixed-point scale product exceeds the safe integer range");let o=t*n,a=e*2;return i=>dn(i,a,o,r)},$r=(e,t,n)=>{let r=t*n,o=e*2;return a=>a*r/o},Zr=(e,t)=>{if(t.length===0)return [];let n=[...new Set(t.map(i=>i.cluster))].sort((i,s)=>i-s),r=new Map;for(let i=0;i<n.length;i+=1)r.set(n[i],n[i+1]??e.length);let o=[],a=0;for(;a<t.length;){let i=t[a].cluster,s=a+1;for(;s<t.length&&t[s].cluster===i;)s+=1;let l=t.slice(a,s).reduce((c,f)=>c+f.advanceX,0),d=z(l);o.push({textStart:i,textEnd:r.get(i),glyphStart:a,glyphEnd:s,advance:d,caretEdges:Object.freeze([z(0),d]),fontSpan:0}),a=s;}return o},N=64,G=8,$=8,cn=32,un=N+2*G,Jr=N+G+$,Qr=N+G+2*$,eo=N+G+$,pn=N+8*G,fn=N+8*$+G,to=N+6*$+G,no=N+3*$+2*G,ro=N+3*$,he=e=>N+e.length*Uint16Array.BYTES_PER_ELEMENT,lt=e=>eo+he(e),ye=e=>cn+e*G,oo=(e,t)=>un+he(e)+Jr+lt(t),ao=e=>pn+he(e)+ye(e.length)+e.length*fn,io=e=>{let t=new Set(e.glyphs.map(n=>n.outline));return pn+he(e.text)+ye(e.glyphs.length)+e.glyphs.length*fn+ye(e.clusters.length)+e.clusters.length*to+e.clusters.reduce((n,r)=>n+ye(r.caretEdges.length),0)+ye(e.fontSpans.length)+e.fontSpans.length*no+(e.exactAdvancesX===void 0?0:cn+e.exactAdvancesX.length*$)+ro+[...t].reduce((n,r)=>n+lt(r.path),0)},so=(e,t)=>un+he(e)+Qr+t,at=class{#e;#u;#p;#f;#y;#x;#m;#l=0;#R;#h;#g;#s;#b;#d;#t;#o=new Map;#a=new Map;#n=new Map;#F=new _e(()=>{this.#n.clear(),this.#r=0,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0}));});#i=0;#r=0;#S=0;#c;constructor(t,n){this.#e=t,this.#u=P(n.maxFontBytes??Rr,"maximum font bytes",Ar),this.#p=P(n.maxInputUtf16??Fr,"maximum input UTF-16 code units",Br),this.#f=P(n.maxCodepoints??vr,"maximum input code points",Pr),this.#y=P(n.maxGlyphs??Er,"maximum shaped glyphs",_r),this.#m=P(n.maxCachedFontBytes??64*1024*1024,"maximum cached font bytes",64*1024*1024),this.#x=P(n.maxCachedFaces??Cr,"maximum cached faces",Mr),this.#R=P(n.maxCachedShapes??wr,"maximum cached shape results",kr),this.#h=P(n.maxOutlineBytes??Or,"maximum outline bytes",zr),this.#g=P(n.maxCachedOutlineBytes??Ir,"maximum cached outline bytes",Nr),this.#s=P(n.maxShapedRunBytes??Tr,"maximum shaped run bytes",Dr),this.#b=P(n.maxCachedShapeBytes??Lr,"maximum cached shape bytes",Hr),this.#d=n.instrumentation?.onFaceCacheEvent,this.#t=n.instrumentation,this.#c=new this.#e.Buffer;}dispose(){this.#o.clear(),this.#l=0,this.#a.clear(),this.#n.clear(),this.#F.clear(),this.#i=0,this.#r=0,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#c=void 0;}#E(t,n){let r=this.#o.get(t.identity);if(r)return this.#o.delete(t.identity),this.#o.set(t.identity,r),this.#d?.(Object.freeze({kind:"hit",identity:t.identity})),r;let o=Ie(t);for(let c of ln)if(!o.has(c))throw new O("malformedFont",{diagnostic:`missing required ${c} table`});this.#t?.onByteCopy?.();let a=new this.#e.Blob(Kr(n)),i=new this.#e.Face(a,t.faceIndex),s=new this.#e.Font(i),l=s.hExtents();if(!Number.isSafeInteger(i.upem)||i.upem<=0||!Number.isSafeInteger(l.ascender)||!Number.isSafeInteger(l.descender)||!Number.isSafeInteger(l.lineGap))throw new O("malformedFont",{diagnostic:"invalid font units or horizontal metrics"});s.setScale(i.upem,i.upem);let d={identity:t.identity,blob:a,face:i,font:s,unitsPerEm:i.upem,byteLength:n.byteLength};if(n.byteLength<=this.#m){for(;this.#o.size>=this.#x||this.#l+n.byteLength>this.#m;){let c=this.#o.keys().next().value;if(c===void 0)break;this.#l-=this.#o.get(c).byteLength,this.#o.delete(c),this.#d?.(Object.freeze({kind:"evicted",identity:c}));}this.#o.set(t.identity,d),this.#l+=n.byteLength;}return this.#d?.(Object.freeze({kind:"created",identity:t.identity})),d}#C(t,n,r){let o=JSON.stringify([t.identity,t.unitsPerEm,r,n]),a=this.#a.get(o);if(a)return this.#a.delete(o),this.#a.set(o,a),this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#i})),a.outline;this.#t?.onOutlinePathCall?.();let i=t.font.glyphToPath(n),s=lt(i);if(s>this.#h)throw new O("outlineOverLimit",{limit:this.#h,actual:s});let l=Object.freeze({path:i,unitsPerEm:t.unitsPerEm}),d=oo(o,i);if(d>this.#g)return this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#i})),l;for(;this.#i+d>this.#g;){let c=this.#a.keys().next().value;if(c===void 0)break;let f=this.#a.get(c);this.#a.delete(c),this.#i-=f.bytes,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#i}));}return this.#a.set(o,{outline:l,bytes:d}),this.#i+=d,this.#t?.onOutlineCacheEvent?.(Object.freeze({kind:"created",retainedBytes:this.#i})),l}#v(t){if(t.length>this.#p)throw new O("textOverLimit",{limit:this.#p,actual:t.length});let n=0;for(let r=0;r<t.length;){let o=t.codePointAt(r);if(r+=o>65535?2:1,n+=1,n>this.#f)throw new O("codepointsOverLimit",{limit:this.#f,actual:n})}}shape(t){if(!this.#c)throw new O("disposed");if(le(t.environment.font),t.environment.font.byteLength>this.#u)throw new O("fontOverLimit",{limit:this.#u,actual:t.environment.font.byteLength});this.#v(t.text);let n=ao(t.text);if(n>this.#s)throw new O("shapedRunOverLimit",{limit:this.#s,actual:n});let r=Q(t.environment),o=this.#F.keyOf(t,r),a=this.#n.get(o);if(a)return this.#S-a.stamp>=Math.max(1,this.#n.size>>1)&&(this.#n.delete(o),this.#n.set(o,a),a.stamp=++this.#S),this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#r})),a.run;if(this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"miss",retainedBytes:this.#r})),r.shapingLibrary.name!==ee.name||r.shapingLibrary.version!==ee.version)throw new O("shapingLibraryMismatch");if(r.normalization!=="none")throw new O("unsupportedNormalization");if(!Number.isSafeInteger(t.bidiLevel)||t.bidiLevel<0||(t.bidiLevel&1)===1!=(r.direction==="rtl"))throw new O("invalidBidiLevel");if(Object.keys(r.variationAxes).length>0)throw new O("unsupportedVariationAxes");if(r.fallbackOrder.length>0)throw new O("unsupportedFallback");let i=se(r.font),s=Ie(r.font);if([...Ur].some(d=>s.has(d))&&!s.has("glyf")&&!s.has("CFF "))throw new O("unsupportedColorFont");let l=t.text;this.#v(l);try{let d=this.#E(r.font,i),{face:c,font:f}=d,g=this.#c;g.reset(),g.addText(l),g.setDirection(r.direction==="rtl"?this.#e.Direction.RTL:this.#e.Direction.LTR),g.setScript(r.script),g.setLanguage(r.language),g.setClusterLevel(this.#e.ClusterLevel.MONOTONE_CHARACTERS);let S=Object.entries(r.features).map(([F,w])=>new this.#e.Feature(F,w));this.#t?.onShapeCall?.(),this.#e.shape(f,g,S);let x=g.getGlyphInfosAndPositions();if(x.length>this.#y)throw new O("glyphOverLimit",{limit:this.#y,actual:x.length});let m=qr(c.upem,t.fontSizeHalfPoints,r.fixedPointScale,r.roundingMode),u=$r(c.upem,t.fontSizeHalfPoints,r.fixedPointScale),b=[],h=z(0),R=z(0),v=new Map,I=JSON.stringify(Object.entries(r.variationAxes).sort(([F],[w])=>F.localeCompare(w))),T=x.map(F=>{b.push(u(F.xAdvance??0));let w=m(F.xAdvance??0),L=m(F.yAdvance??0),_={id:F.codepoint,cluster:F.cluster,originX:h,originY:R,advanceX:w,advanceY:L,offsetX:m(F.xOffset??0),offsetY:m(F.yOffset??0),outline:v.get(F.codepoint)??(()=>{let H=this.#C(d,F.codepoint,I);return v.set(F.codepoint,H),H})()};return h=z(h+w),R=z(R+L),_}),y=f.hExtents(),p=Pe({text:l,direction:r.direction,bidiLevel:t.bidiLevel,glyphs:T,exactAdvancesX:b,clusters:Zr(l,T),fontSpans:T.length===0?[]:[{glyphStart:0,glyphEnd:T.length,font:r.font,fallbackIndex:null}],metrics:{ascent:m(y.ascender),descent:m(-y.descender),lineGap:m(y.lineGap)}},r),E=io(p);if(E>this.#s)throw new O("shapedRunOverLimit",{limit:this.#s,actual:E});let C=so(o,E);if(C>this.#b)return this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#r})),p;for(;this.#n.size>=this.#R||this.#r+C>this.#b;){let F=this.#n.keys().next().value;if(F===void 0)break;let w=this.#n.get(F);this.#n.delete(F),this.#r-=w.bytes,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#r}));}return this.#n.set(o,{run:p,bytes:C,stamp:++this.#S}),this.#r+=C,this.#t?.onShapeCacheEvent?.(Object.freeze({kind:"stored",retainedBytes:this.#r})),p}catch(d){throw d instanceof O?d:new O("malformedFont",{diagnostic:d instanceof Error?d.message:"HarfBuzz shaping failed"})}}},dt=(e={})=>new at(xr(),e);var ct=Object.freeze({maxFontBytes:16*1024*1024,maxInputUtf16:1e6,maxCodepoints:1e6,maxGlyphs:1e6,maxCachedFaces:32,maxCachedFontBytes:64*1024*1024,maxCachedShapes:512,maxOutlineBytes:1024*1024,maxCachedOutlineBytes:16*1024*1024,maxShapedRunBytes:32*1024*1024,maxCachedShapeBytes:64*1024*1024}),Va=Object.freeze({...ct,maxCachedShapes:4096});function yn(e){let t={maxFontBytes:e.maxFontBytes,maxInputUtf16:e.maxInputUtf16,maxCodepoints:e.maxCodepoints,maxGlyphs:e.maxGlyphs,maxOutlineBytes:e.maxOutlineBytes,maxShapedRunBytes:e.maxShapedRunBytes},n=["docx-editor-layout-harfbuzz-execution-policy",1,Object.entries(t).sort(([r],[o])=>r<o?-1:r>o?1:0).map(([r,o])=>Object.freeze([r,o]))];return `layout-shaper-policy:sha256:${a(new TextEncoder().encode(JSON.stringify(n)))}`}var lo=Object.freeze({}),mn=U,co="16.0.0",uo="none",po=1e3,fo="halfToEven",bn="cluster-edges-only",yo="Latn",mo=new Uint8Array(0);var j=class extends Error{code="overLimit";constructor(t){super(t),this.name="LayoutShapingConfigurationError";}};function ho(e,t){let n=e.epoch,r=e.maxFontBytes,o=e.sources,a=e.substitutions,i=e.defaultFont,s=e.language;if(!Number.isSafeInteger(r)||r<=0||r>oe)throw new j(`Font byte ceiling must not exceed the engine hard maximum of ${oe}`);let l=o.length,d=a?.length??0;if(l===0||l>U)throw new j(`Font source count must be between 1 and ${U}`);if(d>mn)throw new j(`Font substitution count must not exceed ${mn}`);let c=0,f=[];for(let x=0;x<l;x+=1){let m=o[x],u=m.request,b=m.availability,h=m.id,R=m.hash,v=m.faceIndex,I=b==="forbidden",T=I?mo:m.bytes;if(!I){if(typeof h!="string"||h.length===0)throw new TypeError("Resolved font id must not be empty");let y;try{y=ae(T);}catch{throw new j(`Font source ${h} must provide genuine bytes`)}if(y>r)throw new j(`Font source ${h} exceeds the per-font byte ceiling`);if(c+=y,c>X)throw new j(`Font sources exceed the aggregate byte ceiling of ${X}`)}f.push(t&&ie(m)!==void 0?m:Object.freeze({request:Object.freeze({family:u.family,weight:u.weight,style:u.style}),id:h,bytes:T,hash:R,faceIndex:v,...b?{availability:b}:{}}));}let g;if(a){g=[];for(let x=0;x<d;x+=1){let m=a[x],u=m.from,b=m.to,h=m.lineMetrics;g.push(Object.freeze({from:Object.freeze({family:u.family,weight:u.weight,style:u.style}),to:Object.freeze({family:b.family,weight:b.weight,style:b.style}),...h?{lineMetrics:Object.freeze({heightEm:h.heightEm,baselineEm:h.baselineEm})}:{}}));}}let S={epoch:n,maxFontBytes:r,sources:Object.freeze(f),substitutions:g?Object.freeze(g):void 0,defaultFont:Object.freeze({family:i.family,sizeHalfPoints:i.sizeHalfPoints}),language:s};return Object.freeze(S)}function hn(e,t){let n=e.map((o,a)=>({value:o,index:a,key:Y(t(o))})),r=new Set;for(let o of n){if(r.has(o.key))return e;r.add(o.key);}return n.sort((o,a)=>o.key<a.key?-1:o.key>a.key?1:o.index-a.index).map(({value:o})=>o)}function go(e,t){let n={family:e.family},r={sizeHalfPoints:e.sizeHalfPoints};return {...n,...t?r:{}}}function gn(e,t){let n=l=>({family:l.family,weight:l.weight,style:l.style}),r=t?e.sources:hn(e.sources,l=>l.request),o=e.substitutions??[],a=t?o:hn(o,l=>l.from),i={sources:r.map(l=>{let d=l.availability??"available",c={request:n(l.request),availability:d};if(d==="forbidden")return {...c,...t?{id:l.id,faceIndex:l.faceIndex,declaredHash:l.hash}:{}};let f=ie(l);if(f==null)throw new TypeError("Font configuration identity requires prepared source bytes");return {...c,...t?{id:l.id}:{},faceIndex:l.faceIndex,declaredHash:l.hash,actualHash:f,byteLength:l.bytes.byteLength}}),substitutions:a.map(l=>({from:n(l.from),to:n(l.to),lineMetrics:l.lineMetrics?{heightEm:l.lineMetrics.heightEm,baselineEm:l.lineMetrics.baselineEm}:null})),defaultFont:go(e.defaultFont,t),language:e.language||"en"},s={epoch:e.epoch,maxFontBytes:e.maxFontBytes};return {version:1,...t?s:{},...i}}var bo=Symbol("prepared-layout-font-configuration"),Me=new WeakMap;function So(e){return Me.has(e)}function xo(e){let t=Me.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.configuration}function Za(e){let t=Me.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.sharedShapingFingerprint}function ut(e,t){return Sn(e,t,false)}function Ja(e,t){return Sn(e,t,true)}function Sn(e,t,n){let r=ho(e,n),o=Object.freeze({epoch:r.epoch,maxFontBytes:r.maxFontBytes,sources:Object.freeze(r.sources.map(f=>n&&ie(f)!==void 0?f:Yt(f,{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash}))),substitutions:r.substitutions,defaultFont:r.defaultFont,language:r.language}),a$1=new TextEncoder,i=gn(o,true),s=a$1.encode(JSON.stringify(i)),l=gn(o,false),d=a$1.encode(JSON.stringify(l)),c=Object.freeze({[bo]:true,fingerprint:`font-config:${a(s)}`});return Me.set(c,{configuration:o,sharedShapingFingerprint:`shared-font-config:${a(d)}`}),c}function Ro(e){return ut(e).fingerprint}function Fo(e,t){let n=new TextEncoder().encode(JSON.stringify({version:1,environment:e,executionPolicy:yn(t),ligatureCaretPolicy:bn,fallback:M}));return `shaping:${a(n)}`}async function xn(e,t,n,r,o=false){let i=So(e)?e:ut(e,t),s=xo(i),{epoch:l,maxFontBytes:d,sources:c,substitutions:f,defaultFont:g}=s,S=s.language||"en",x=i.fingerprint,m=Qe({epoch:l,maxFontBytes:d,resources:c,substitutions:f,validateFont:st,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});await it();let u=Object.freeze({script:yo,variationAxes:Object.freeze({}),shapingLibrary:ee,unicodeDataVersion:co,normalization:uo,language:S,features:lo,...o?{documentLigatures:true}:{},fixedPointScale:po,roundingMode:fo});return Object.freeze({fonts:m,shaper:n??dt(r),defaultFont:g,environment:u,ligatureCaretPolicy:bn,operation:Object.freeze({resourceEpoch:m.epoch,configEpoch:l,extensionFingerprint:x,shapingHash:Fo(u,r),producerVersion:1})})}async function vo(e,t){return xn(e,t,void 0,ct)}async function Qa(e,t,n,r,o=false){return xn(e,r,t,n,o)}function Eo(e){e.shaper.dispose?.();}function pt(e){let t=new Set([0,e.text.length]);for(let r of S(e.text))t.add(r.utf16From),t.add(r.utf16To);let n=new Set([0,e.text.length]);for(let r of e.clusters)n.add(r.textStart),n.add(r.textEnd);return [...t].filter(r=>n.has(r)).sort((r,o)=>r-o)}function ke(e,t){return pt(e).includes(t)}function Co(e,t){return ke(e,t)}function wo(e,t,n){return n>=t&&ke(e,t)&&ke(e,n)}function Oo(e){let t=S(e.text);return pt(e).map(n=>n===e.text.length?t.length:t.findIndex(r=>r.utf16From===n))}var yt="und";function En(){return typeof Intl.Segmenter=="function"}function Io(){let e=Intl.Segmenter;if(typeof e!="function")throw new Error(`Intl.Segmenter is required for word segmentation (locale: ${yt})`);return e}function Cn(){let e=new(Io())(yt,{granularity:"word"});return {segment(t){let n=[];for(let r of e.segment(t)){let o=r.index,a=o+r.segment.length;n.push({utf16From:o,utf16To:a,wordLike:r.isWordLike===true});}return n}}}var To=/^[\p{L}\p{N}']$/u,Lo=/^\s$/u;function Rn(e){return To.test(e)}function Fn(e){return Lo.test(e)}function ft(e,t,n,r){let o=e[t],a=e[n-1];return {utf16From:o.utf16From,utf16To:a.utf16To,wordLike:r}}function wn(e){let t=S(e);if(t.length===0)return [];let n=[],r=0;for(;r<t.length;){let o=t[r];if(Fn(o.text)){let a=r+1;for(;a<t.length&&Fn(t[a].text);)a+=1;n.push(ft(t,r,a,false)),r=a;continue}if(Rn(o.text)){let a=r+1;for(;a<t.length&&Rn(t[a].text);)a+=1;n.push(ft(t,r,a,true)),r=a;continue}n.push(ft(t,r,r+1,false)),r+=1;}return n}function On(){return {segment:wn}}function In(e={}){let t=e.isIntlAvailable??En,n=e.createIntlBoundary??Cn,r=e.createFallbackBoundary??On;if(!t())return r();try{return n()}catch{return r()}}var vn;function Tn(){return vn??=In(),vn}function Ao(e,t=Tn()){return t.segment(e)}function Bo(e,t){return t.map(n=>({graphemeFrom:W$1(e,n.utf16From),graphemeTo:W$1(e,n.utf16To),wordLike:n.wordLike}))}var Ln={resourceEpoch:"resource-scoped",configEpoch:"coarse-gate",extensionFingerprint:"coarse-gate",shapingHash:"coarse-gate",producerVersion:"coarse-gate"},gt=Object.keys(Ln),An=gt.filter(e=>Ln[e]==="coarse-gate"),ze=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},de=(e,t)=>{if(e.trim().length===0)throw new TypeError(`${t} must not be blank`)},Po={resourceEpoch:ze,configEpoch:ze,extensionFingerprint:de,shapingHash:de,producerVersion:ze},_o=(e,t)=>{Po[t](e[t],t);},ce=e=>{for(let t of gt)_o(e,t);return Object.freeze({resourceEpoch:e.resourceEpoch,configEpoch:e.configEpoch,extensionFingerprint:e.extensionFingerprint,shapingHash:e.shapingHash,producerVersion:e.producerVersion})},Mo=(e,t)=>{let n=ce(e),r=ce(t),o=gt.filter(a=>n[a]!==r[a]);return o.length===0?Object.freeze({status:"current"}):Object.freeze({status:"restart",changed:Object.freeze(o)})},mt=e=>{let t=e.map(({key:n,fingerprint:r})=>(de(n,"resource dependency key"),de(r,"resource dependency fingerprint"),Object.freeze({key:n,fingerprint:r}))).sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:0);for(let n=1;n<t.length;n+=1)if(t[n-1].key===t[n].key)throw new TypeError(`Duplicate resource dependency: ${t[n].key}`);return Object.freeze(t)},ko=e=>(ze(e.revision,"revision"),de(e.dependencyFingerprint,"dependencyFingerprint"),de(e.inputFingerprint,"inputFingerprint"),Object.freeze({revision:e.revision,dependencyFingerprint:e.dependencyFingerprint,inputFingerprint:e.inputFingerprint,resourceDependencies:mt(e.resourceDependencies),...ce(e)})),zo=(e,t)=>{let n=mt(e),r=mt(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){let i=n[a],s=r[a];if(i?.key!==s?.key||i?.fingerprint!==s?.fingerprint)return {hit:false,reason:"resource-changed",resourceKey:i?.key??s.key}}return null};function No(e,t){if(e.dependencyFingerprint!==t.dependencyFingerprint)return {hit:false,reason:"dependency-changed"};if(e.inputFingerprint!==t.inputFingerprint)return {hit:false,reason:"input-changed"};let n=zo(e.resourceDependencies,t.resourceDependencies);if(n)return n;for(let r of An)if(e[r]!==t[r])return {hit:false,reason:"epoch-changed",epoch:r};return null}var ht=class{entries=new Map;get(t,n){let r=this.entries.get(t);if(!r)return {hit:false,reason:"absent"};let o=No(r.provenance,n);return o||{hit:true,value:r.value,provenance:r.provenance}}set(t,n,r){this.entries.set(t,{value:n,provenance:ko(r)});}evictEpoch(t){let n=ce(t),r=0;for(let[o,a]of this.entries){let i=a.provenance;An.some(s=>i[s]!==n[s])&&(this.entries.delete(o),r+=1);}return r}evictResources(t,n){let r=ce(t),o=this.evictEpoch(r);for(let[a,i]of this.entries)i.provenance.resourceDependencies.some(l=>n.get(l.key)!==l.fingerprint)&&(this.entries.delete(a),o+=1);return o}get size(){return this.entries.size}};function Bn(e){return e.projected===true?null:e.range}function Ho(e,t,n){let{page:r,story:o,host:a,noteScopeId:i,noteAreaKind:s}=e,l=o==="header"||o==="footer"?d=>$$1(d,e.origin,{x:r.box.x,y:r.box.y}):void 0;ia(a,(d,c)=>{let{textboxDepth:f,textboxOwner:g,textboxPath:S,storyOrigin:x}=c,m=f===0?o:"textbox";for(let u of d.lines){let b=[...pa$1(u)].sort((h,R)=>(t.get(h.paragraphId)??Number.MAX_SAFE_INTEGER)-(t.get(R.paragraphId)??Number.MAX_SAFE_INTEGER));for(let h of b)for(let R of h.spans)n({page:r,story:m,rootStory:o,root:e,storyOrigin:x,absoluteBox:Object.freeze({x:x.x+R.box.x,y:x.y+R.box.y,width:R.box.width,height:R.box.height}),noteScopeId:i,noteAreaKind:s,textboxDepth:f,textboxOwner:g,textboxPath:S,paragraph:d,paragraphId:h.paragraphId,line:u,span:R,sourceRange:Bn(R)});}},e.origin,l);}function Uo(e,t){let n=new Map(va$1(e).map((r,o)=>[r,o]));fa$1(e,r=>Ho(r,n,t));}function D(e){return (e.kerningEnabled??e.kerningMinPt>0)&&e.kerningMinPt>0&&e.fontSizePt>=e.kerningMinPt}var kn="Calibri, Carlito, Helvetica, Arial, sans-serif",gi=new Map([["calibri","Carlito"]]),Go=65536,jo=256;function Pn(e,t){return e===void 0?Math.max(1,Math.floor(t)):Number.isFinite(e)&&e>0?Math.max(1,Math.floor(e)):1}function _n(e){let t=new Map,n=0;return {get(r){let o=t.get(r);if(o!==void 0)return t.delete(r),t.set(r,o),o},set(r,o){for(t.has(r)&&t.delete(r),t.set(r,o);t.size>e;){let a=t.keys().next();if(a.done)break;t.delete(a.value),n+=1;}},get size(){return t.size},get evictions(){return n}}}var Mn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function zn(e=null){return e!=null&&typeof e.measureText=="function"}function Nn(e={}){let t=e.scale??1;if(!(t>0)||!Number.isFinite(t))return null;let n=e.fallbackFamily??kn,r=e.context??null;if(!zn(r))return null;let o=r,a=_n(Pn(e.maxWidthEntries,Go)),i=_n(Pn(e.maxMetricsEntries,jo)),s=e.fontAlias,l=c=>{let f=c.fontFamily&&Mn.test(c.fontFamily)?c.fontFamily:null,g=f?s?.(f):void 0,S=g&&Mn.test(g)?g:null,x=f?S?`"${S}", "${f}", ${n}`:`"${f}", ${n}`:n,m=c.bold?"bold":"normal",u=c.italic?"italic":"normal",b=c.smallCaps?"small-caps":"normal",h=c.fontSizePt*L(c)*t;return `${u} ${b} ${m} ${h}px ${x}`},d=(c,f,g)=>c/t*(g.horizontalScalePercent/100)+f.length*g.characterSpacingPt;return {measure(c,f){if(c.length===0)return 0;let g=l(f),S=`${g}\0${D(f)}\0${c}`,x=a.get(S);if(x!==void 0)return d(x,c,f);o.font=g,"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let m=o.measureText(c).width;return a.set(S,m),d(m,c,f)},inkBounds(c,f){if(!c||c.length>2||f.shaping?.direction==="rtl"||S(c).length!==1)return;o.font=l(f),"fontKerning"in o&&(o.fontKerning=D(f)?"normal":"none");let g=o.textAlign,S$1=o.direction,x;try{g!==void 0&&(o.textAlign="left"),S$1!==void 0&&(o.direction="ltr"),x=o.measureText(c);}finally{g!==void 0&&(o.textAlign=g),S$1!==void 0&&(o.direction=S$1);}let m=x.actualBoundingBoxLeft,u=x.actualBoundingBoxRight;if(m===void 0||u===void 0||!Number.isFinite(m)||!Number.isFinite(u))return;let b=f.horizontalScalePercent/(100*t);return {left:-m*b,right:u*b}},lineMetrics(c){let f=c.fontSizePt*L(c),g=l(c),S=i.get(g);if(S)return S;let x=f*1.15,m=f*.8;o.font=g,"fontKerning"in o&&(o.fontKerning=D(c)?"normal":"none");let u=o.measureText("Hxg"),b=u.fontBoundingBoxAscent,h=u.fontBoundingBoxDescent;if(typeof b=="number"&&Number.isFinite(b)&&b>0&&(m=b/t,typeof h=="number"&&Number.isFinite(h)&&h>=0)){let v=(b+h)/t;v>0&&(x=Math.max(v,x));}x>0||(x=f*1.15);let R={height:x,baseline:m};return i.set(g,R),R}}}function Wo(e=1,t={}){let n=Nn({...t,scale:t.scale??e});return n?{measurer:n,producer:t.fontAlias?"canvas-measurer+embedded":"canvas-measurer"}:{measurer:N$1(),producer:"fixed-measurer"}}function Vo(e){let t;return n=>{t===void 0&&(t=tc(e.pages)?.hosts??null);let r=t?.get(n);return r?rc(r.pageNumber,r.format):null}}function Dn(e,t){let n=jb(e,t.displayMode??xa$1),r=Wb({numberingIndex:t.numberingIndex,styleCascade:t.styleCascade},n).listItems,o=t.package?{footnotesPart:$f(t.package,"footnote"),endnotesPart:$f(t.package,"endnote")}:void 0,a=pc(n,r,o,t.package?mc(t.package,e,n):void 0,t.displayMode??xa$1);return {blocks:n,notes:o,context:a}}function Hn(e,t,n,r,o){for(let a of t){if(r.length>=wh)return;if(n.tokenForParagraph(a.id)!==""&&zh(e,a.id)===null)for(let i of yh(a)){if(r.length>=wh)return;if(!i.rewritable)continue;let s=Ta$1(i.instruction);if(s===null)continue;let l=n.liveValueOf(i.fieldNodeId,s);if(l===null&&o&&n.pageRefProjectionOf){let d=n.pageRefProjectionOf(i.fieldNodeId,s);if(d){let c=o(d.targetParagraphId);c!==null&&c.length>0&&sc(d.calibration,d.cached,c,Number.NaN)&&(l=c);}}l===null||l===i.cachedText||l.length>xh||l.includes(`
2
+ `)||l.includes("\r")||r.push({paragraphId:a.id,fieldNodeId:i.fieldNodeId,text:l});}}}function Ko(e,t){let{blocks:n,context:r}=Dn(e,t);if(r===null)return null;let o=[];return Hn(e,Ub(hb(n)),r,o,t.pageRefPageNumberOf),o.length===0?null:{op:"refreshFieldResults",updates:o}}function Ii(e,t){let{notes:n,context:r}=Dn(e,t);if(r===null||n===void 0)return [];let o=[],a=[{noteKind:"footnote",notesPart:n.footnotesPart},{noteKind:"endnote",notesPart:n.endnotesPart}];for(let{noteKind:i,notesPart:s}of a){if(!s)continue;let l=[];for(let d of nc(s,t.displayMode??xa$1)){if(l.length>=wh)break;Hn(s,Ub(hb(d)),r,l);}l.length>0&&o.push({noteKind:i,op:{op:"refreshFieldResults",updates:l}});}return o}function Xo(e){return e.box}function Un(e,t){if(e.kind==="paragraph"){t.add(e.paragraphId);return}for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks)Un(o,t);}function Yo(e){let t=new Map,n=(o,a,i)=>{if(!(o.kind==="textValue"||i>Cc*4)){for(let s of o.children)if(s.kind!=="textValue"){if(s.kind==="paragraph"){for(let l of r)t.get(l)?.push(s.id);n(s,s.id,i+1);continue}if(s.kind==="contentControl"){t.set(s.id,[]),r.push(s.id);let l=Mc(s);l&&n(l,a,i+1),r.pop();let d=t.get(s.id);d&&d.length===0&&a!==null&&d.push(a);continue}n(s,a,i+1);}}},r=[];return n(e,null,0),t}function qo(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return {x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function $o(e,t){let n=Qc(e.root);if(n.length===0)return Zo;let r=new Map;t.pages.forEach((i,s)=>{(d=>{for(let c of d){let f=new Set;Un(c,f);for(let g of f){let S=r.get(g)??[];S.push({pageIndex:s,box:Xo(c)}),r.set(g,S);}}})(i.fragments);});let o=Yo(e.root),a=[];for(let i of n){let s=Oc(i.node),l=[...i.ancestors.map(g=>Oc(g).lock),s.lock],d=o.get(i.node.id)??[],c=new Map;for(let g of d)for(let S of r.get(g)??[]){let x=c.get(S.pageIndex);c.set(S.pageIndex,x?qo(x,S.box):S.box);}let f=[...c.entries()].sort((g,S)=>g[0]-S[0]).map(([g,S])=>({pageIndex:g,...S}));a.push({controlId:i.node.id,type:s.type,level:Pc(i.node),depth:i.depth,lock:s.lock,effectiveLock:Tc(l),showingPlaceholder:s.showingPlaceholder,temporary:s.temporary,...s.tag===void 0?{}:{tag:s.tag},...s.alias===void 0?{}:{alias:s.alias},...s.id===void 0?{}:{id:s.id},...s.dataBinding===void 0?{}:{dataBinding:s.dataBinding},paragraphIds:d,fragments:f});}return a}var Zo=Object.freeze([]);function jn(e,t,n){let r=e.lines?.find(o=>{let a=o.spans;if(!a)return n<o.range.end;let i=a.filter(s=>s.range.paragraphId===t);return i.length===a.length?n<o.range.end:i.length>0&&n<i[i.length-1].range.end});return r?r.box.y:e.fragmentY}function la(e,t){let n=new Map;for(let r of e.pages)for(let[o,a]of da(r,t))n.has(o)||n.set(o,a);return n}var Gn=new WeakMap;function da(e,t){let n=Gn.get(t);n||(n=new WeakMap,Gn.set(t,n));let r=n.get(e);if(r)return r;let o=new Map;for(let a of t(e)){let i=new Set([a.paragraphId]);for(let s of a.lines??[])for(let l of s.spans??[])i.add(l.range.paragraphId);for(let s of i)o.has(s)||o.set(s,{pageIndex:e.index,contentY:e.contentBox.y,fragmentY:a.box.y,...a.lines?{lines:a.lines}:{}});}return n.set(e,o),o}function ca(e,t){let n=Ga(e);if(!n)return null;let r=t.get(n.start.paragraphId);return r?{pageIndex:r.pageIndex,y:r.contentY+jn(r,n.start.paragraphId,n.start.offset)}:null}var Wn=new WeakMap;function ua(e){let t=Wn.get(e);if(t!==void 0)return t;let n=se(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=false,a=r.getUint32(0)===1953784678?r.getUint32(12+e.faceIndex*4):0,i=r.getUint16(a+4);for(let s=0;s<i;s++){let l=a+12+s*16;if(r.getUint32(l)!==1330851634)continue;let d=r.getUint32(l+8),c=r.getUint32(l+12);c>=86&&d<=n.byteLength-c&&r.getUint16(d)>=1&&(o=(r.getUint32(d+78)&1966080)!==0);break}return Wn.set(e,o),o}function Vn(e,t,n,r,o){if(r>o||Math.abs(n.height-t)>o||!ua(e))return n;let a=t*.3;return {height:n.height+a,baseline:n.baseline+a/2}}var pa="abcdefghijklmnopqrstuvwxyz";function te(e){let t=Math.round(e.fontSizePt*2);return Math.max(1,t)}function W(e,t,n,r,o){return e.shape({text:o,fontSizeHalfPoints:te(r),bidiLevel:r.shaping?.direction==="rtl"?1:0,environment:fa(t,n,r)})}var Kn=new WeakMap;function fa(e,t,n){if(!Object.isFrozen(e)||!Object.isFrozen(e.features)||!Object.isFrozen(e.variationAxes)||!Object.isFrozen(e.shapingLibrary))return Xn(e,t,n);let r=n.shaping?.direction??"ltr",o=n.shaping?.script,a=`${r}|${o??""}|${D(n)?1:0}|${e.documentLigatures?h(n):""}|${n.smallCaps?1:0}`,i=Kn.get(e);i||Kn.set(e,i=new WeakMap);let s=i.get(t);s||i.set(t,s=new Map);let l=s.get(a);return l||s.set(a,l=Xn(e,t,n)),l}function Xn(e,t,n){return Q({...e,font:t,direction:n.shaping?.direction??"ltr",script:n.shaping?.script==="Zyyy"?e.script:n.shaping?.script??e.script,features:{...e.features,kern:D(n)?1:0,...e.documentLigatures?g(n):{},...n.smallCaps?{smcp:1}:{}},fallbackOrder:[]})}function Ne(e,t,n,r,o){let a=o.get(n);if(a!==void 0)return a;let i=true;try{for(let s of pa){let l=W(e,t,n,{...r,smallCaps:!0},s),d=W(e,t,n,{...r,smallCaps:!1},s);if(!(l.glyphs.length!==d.glyphs.length||l.glyphs.some((f,g)=>f.id!==d.glyphs[g]?.id))){i=!1;break}}}catch{i=false;}return o.set(n,i),i}function Yn(e,t,n,r,o){let a=new WeakMap;return (i,s)=>{let l=L(s),d=a.get(i);d||(d=new Map,a.set(i,d));let c=te(s),f=d.get(c);if(f)return l===1?f:{height:f.height*l,baseline:f.baseline*l};let g,S=true,x=i.substitution?.lineMetrics;if(x){let m=c/2;g={height:x.heightEm*m,baseline:x.baselineEm*m};}else try{let m=W(e,t,i,s,""),u=m.metrics.ascent/t.fixedPointScale,b=m.metrics.descent/t.fixedPointScale,h=c/2,R=u+b,v=h*r,I=R>v?v/R:1,T=R*I,y=Math.min(Math.max(0,m.metrics.lineGap/t.fixedPointScale),T*o),p=T+y;p>0?g=Vn(i,h,{height:p,baseline:u*I+y},y,2/t.fixedPointScale):(g=n.lineMetrics(s),S=!1);}catch{g=n.lineMetrics(s),S=false;}return S?(d.set(c,g),l===1?g:{height:g.height*l,baseline:g.baseline*l}):g}}var bt=new WeakMap;function ya(e){let t=bt.get(e);if(t!==void 0)return t??void 0;let n=e.path;if(!n.startsWith("M")||n.length>1e6||/[^MLQCZ0-9eE+.,\s-]/u.test(n))return;let r=1/0,o=-1/0,a=n.matchAll(/([MLQCZ])([^MLQCZ]*)/gu);for(let s of a){let l=s[1]==="Z"?0:s[1]==="C"?6:s[1]==="Q"?4:2,d=s[2].trim().split(/[\s,]+/u).filter(Boolean).map(Number);if(d.length!==l||d.some(c=>!Number.isFinite(c))){bt.set(e,null);return}for(let c=0;c<d.length;c+=2)r=Math.min(r,d[c]),o=Math.max(o,d[c]);}let i=Number.isFinite(r)&&Number.isFinite(o)?{left:r,right:o}:void 0;return bt.set(e,i??null),i}function qn(e,t,n,r){if(e.clusters.length!==1||e.glyphs.length===0)return;let o=1/0,a=-1/0;for(let s of e.glyphs){if(s.id===0)return;let l=ya(s.outline),d=s.outline.unitsPerEm;if(!l||!(d>0))return;let c=(s.originX+s.offsetX)/n;o=Math.min(o,c+l.left*t*(s.drawScale??1)/d),a=Math.max(a,c+l.right*t*(s.drawScale??1)/d);}let i={left:o*r,right:a*r};return Number.isFinite(i.left)&&Number.isFinite(i.right)?i:void 0}function ma(e,t,n){if(t<12)return null;if(e.getUint32(0)!==1953784678)return 0;let o=12+(Number.isSafeInteger(n)&&n>0?n:0)*4;if(o+4>t)return null;let a=e.getUint32(o);return a+12<=t?a:null}function $n(e,t,n,r,o){let a=e.getUint16(n+4);if(a>4096||n+12+a*16>t)return null;for(let i=0;i<a;i+=1){let s=n+12+i*16;if(e.getUint32(s)!==r)continue;let l=e.getUint32(s+8),d=e.getUint32(s+12);return d<o||l+d>t?null:l}return null}function Zn(e,t){let n=e.byteLength,r=new DataView(e.buffer,e.byteOffset,n),o=ma(r,n,t);if(o===null)return null;let a=$n(r,n,o,1751474532,54);if(a===null)return null;let i=r.getUint16(a+18);if(i<=0)return null;let s=$n(r,n,o,1330851634,30);if(s===null)return null;let l=r.getInt16(s+26)/i,d=r.getInt16(s+28)/i;return !(l>0)||l>1||!(Math.abs(d)<=1)?null:{offsetEm:d,thicknessEm:l}}var ha=.5,ga=4,Jn=4096;function Qn(e){let t="environment"in e?e.environment:void 0,n="environment"in e?void 0:e,{shaper:r,resolveFont:o,fallback:a}=e,i=t??{shapingLibrary:n.shapingLibrary,unicodeDataVersion:n.unicodeDataVersion,script:n?.script??"Latn",fixedPointScale:n?.fixedPointScale??1e3,normalization:n?.normalization??"none",features:n?.features??{},roundingMode:n?.roundingMode??"halfToEven",language:n?.language??"en",variationAxes:{}},s=new WeakMap,l=new WeakMap,d=Yn(r,i,a,ga,ha),c=new WeakMap,f=new WeakMap,g=new Array(Jn),S$1=0,x=(y,p,E)=>{let C=g[S$1];C&&C.cache.delete(C.text),y.set(p,E),g[S$1]={cache:y,text:p},S$1=(S$1+1)%Jn;},m=y=>{let p=c.get(y);if(p!==void 0)return p;let E=o(y);return c.set(y,E),E},u=(y,p,E)=>{let C=E?l:s,F=C.get(y);F||(F=new Map,C.set(y,F));let w=F.get(p);return w||(w=new Map,F.set(p,w)),w},b=new WeakMap,h$1=y=>{if(!y.shaping?.wordSpacingPt)return y;let p=b.get(y);return p||(p={...y,shaping:{...y.shaping,wordSpacingPt:void 0}},b.set(y,p)),p},R=(y,p)=>p.shaping?.wordSpacingPt?$c(y)*p.shaping.wordSpacingPt:0,v=(y,p)=>a.measure(y,h$1(p))+R(y,p),I=(y,p)=>{let E=Math.max(0,a.measure(y,h$1(p))),C=a.caretAdvances?.(y,h$1(p))??Zc(y,E);if(!C||C.length!==y.length+1)return Zc(y,v(y,p));let F=Math.max(0,v(y,p)),w=0,L=0;return C.map((_,H)=>{if(H===0)return 0;y[H-1]===" "&&L++;let ne=_+L*(p.shaping?.wordSpacingPt??0);return w=Math.max(w,Math.min(F,Number.isFinite(ne)?ne:w)),H===y.length?F:w})},T=new WeakMap;return {hasResolvedFont(y){return m(y)!==null},strikeoutMetrics(y){let p=m(y);if(!p)return;let E=T.get(p);if(E===void 0&&(E=Zn(p.bytes,p.faceIndex),T.set(p,E)),!E)return;let C=te(y)/2*L(y);return {offsetPt:E.offsetEm*C,thicknessPt:E.thicknessEm*C}},measure(y,p){if(y.length===0)return 0;let E=m(p);if(!E)return v(y,p);let C=u(E,te(p),p.smallCaps),F=p.shaping?`1:${JSON.stringify([p.shaping.script,p.shaping.direction,y])}`:`0:${y}`,w=`${D(p)?1:0}:${h(p)}:${F}`,L$1=C.get(w);if(L$1===void 0){let _=0;try{if(p.smallCaps&&!Ne(r,i,E,p,f))return v(y,p);let H=W(r,i,E,p,y);if(H.glyphs.some(ne=>ne.id===0))return v(y,p);for(let ne of H.glyphs)_+=ne.advanceX;}catch{return v(y,p)}L$1=_/i.fixedPointScale,x(C,w,L$1);}return L$1*L(p)*(p.horizontalScalePercent/100)+y.length*p.characterSpacingPt+R(y,p)},inkBounds(y,p){if(!y||y.length>2||p.shaping?.direction==="rtl"||S(y).length!==1)return;let E=m(p);if(!E)return a.inkBounds?.(y,p);try{if(p.smallCaps&&!Ne(r,i,E,p,f))return a.inkBounds?.(y,p);let C=W(r,i,E,p,y);return qn(C,te(p)/2,i.fixedPointScale,L(p)*p.horizontalScalePercent/100)}catch{return}},caretAdvances(y,p){let E=m(p);if(!E)return I(y,p);try{if(p.smallCaps&&!Ne(r,i,E,p,f))return I(y,p);let C=W(r,i,E,p,y);return C.glyphs.some(F=>F.id===0)?I(y,p):_c(y,C,L(p)*(p.horizontalScalePercent/100)/i.fixedPointScale,p.characterSpacingPt,p.shaping?.wordSpacingPt??0)??Zc(y,C.glyphs.reduce((F,w)=>F+w.advanceX,0)*L(p)*(p.horizontalScalePercent/100)/i.fixedPointScale+y.length*p.characterSpacingPt+R(y,p))}catch{return I(y,p)}},lineMetrics(y,p){let E=m(y);if(!E)return a.lineMetrics(y,p);if(!p||/^[\t\n\r\f ]*$/.test(p))return d(E,y);try{let C=W(r,i,E,y,p),F=0,w=0;for(let L of C.fontSpans){let _=d(L.font,y);F=Math.max(F,_.baseline),w=Math.max(w,_.height-_.baseline);}if(F+w>0)return {height:F+w,baseline:F}}catch{}return d(E,y)}}}function ba(e,t){return Qn({...t,shaper:e.shaper,environment:e.environment})}function Sa(e){let{layout:t,viewport:n}=e,r=new Set;if(!n){for(let l of t.pages)r.add(l.index);return r}let o=Math.max(0,Math.trunc(e.overscanPages??1)),a=n.top+n.height,i=-1,s=-1;for(let l of t.pages){let d=l.box.y;d+l.box.height>=n.top&&d<=a&&(i===-1&&(i=l.index),s=l.index);}if(i===-1){let l=xa(t,n.top);l!==null&&(i=l,s=l);}if(i!==-1){let l=Math.max(0,i-o),d=Math.min(t.pages.length-1,s+o);for(let c=l;c<=d;c+=1)r.add(c);}for(let l of e.pinnedPages??[])l>=0&&l<t.pages.length&&r.add(l);return r}function xa(e,t){let n=null,r=Number.POSITIVE_INFINITY;for(let o of e.pages){let a=t<o.box.y?o.box.y-t:t>o.box.y+o.box.height?t-(o.box.y+o.box.height):0;a<r&&(r=a,n=o.index);}return n}var er=["text-local","paragraph-local","flow-structural","global"];function tr(e,t){return er.indexOf(t)>er.indexOf(e)?t:e}function Ra(e){return {impact:"text-local",paragraphIds:new Set,created:new Set,deleted:new Set,dependencyKeys:new Set,structural:false,revision:e}}function Fa(e){let{run:t,currentRevision:n,publish:r,schedule:o}=e,a=null,i=null,s=null,l=0,d=0;function c(u){let b=e.runCooperatively;if(!b)return t(u);let h=b(u);s=h;try{for(;;){let R=h.step();if(R)return R;if(n()!==u.revision)return h.cancel(),d+=1,null;if(s!==h)return null}}finally{s===h&&(s=null);}}function f(u){let b=S(n());b.impact=tr(b.impact,u.impact),b.structural=b.structural||u.structural;for(let h of u.paragraphIds)b.paragraphIds.add(h);for(let h of u.created)b.created.add(h);for(let h of u.deleted)b.deleted.add(h);for(let h of u.dependencyKeys)b.dependencyKeys.add(h);}let g=u=>({impact:u.impact,paragraphIds:u.paragraphIds,created:u.created,deleted:u.deleted,dependencyKeys:u.dependencyKeys,structural:u.structural,revision:u.revision});function S(u){return a||(a=Ra(u)),a.revision=Math.max(a.revision,u),a}function x(){!o||i||(i=o(()=>{i=null,m();}));}function m(){i&&(i(),i=null),s&&(s.cancel(),s=null,d+=1);let u=a;if(!u)return false;a=null;let b=g(u),h=c(b);return !h||h.revision!==n()?(l+=1,f(b),x(),false):(r(h,b),true)}return {notify(u){let b=S(n());b.impact=tr(b.impact,u.impact);for(let h of u.dirty)b.paragraphIds.add(h);for(let h of u.created)b.created.add(h),b.paragraphIds.add(h);for(let h of u.deleted)b.deleted.add(h),b.paragraphIds.add(h);for(let h of u.dependencyKeys)b.dependencyKeys.add(h);for(let h of u.splitJoin)b.structural=true,"split"in h?(b.paragraphIds.add(h.split.from),b.paragraphIds.add(h.split.tail)):(b.paragraphIds.add(h.join.kept),b.paragraphIds.add(h.join.removed));(u.impact==="flow-structural"||u.impact==="global")&&(b.structural=true),x();},invalidateAll(u,b){let h=S(u);h.impact="flow-structural",h.structural=true,b&&h.dependencyKeys.add(b),x();},flush:m,pending:()=>a?g(a):null,cancel(){i?.(),i=null,s?.cancel(),s=null,a=null;},get staleDiscards(){return l},get cancelledRuns(){return d}}}var nr=new WeakMap;function V(e){let t=nr.get(e);if(t)return t;let n=new Map,r=new Map,o=new Map,a=new Map,i=(l,d,c,f)=>{for(let g of l){if(g.kind==="paragraph")continue;let S=g.tableId;a.set(S,Math.max(a.get(S)??0,(g.columnEdges?.length??1)-1));let x=o.get(S);x||(x=new Map,o.set(S,x),n.set(S,[]),r.set(S,new Map));for(let m of g.rows){let u=x.get(m.id);u===void 0&&(u=x.size,x.set(m.id,u),r.get(S).set(u,m.cells));for(let b of m.cells)n.get(S).push({pageIndex:d,tableId:S,row:m,cell:b,rowIndex:u,isHeaderRepeat:m.isHeaderRepeat,offsetX:c,offsetY:f}),i(b.blocks,d,c,f);}}};for(let l of e.pages){i(l.fragments,l.index,0,0);for(let d of [l.header,l.footer])d&&i(d.fragments,l.index,d.box.x-l.contentBox.x,d.box.y-l.contentBox.y);for(let d of [l.footnotes,l.endnotes])if(d)for(let c of d.notes)i(c.fragments,l.index,c.box.x-l.contentBox.x,c.box.y-l.contentBox.y);}let s=new Map;for(let[l,d]of n)s.set(l,{placed:d,rows:r.get(l)??new Map,columnCount:a.get(l)??0});return nr.set(e,s),s}function ir(e){let t=e.columnCount;for(let n of e.rows.values())for(let r of n)t=Math.max(t,Z(r).to+1);return t}var Z=e=>({from:e.gridColumn,to:e.gridColumn+Math.max(1,e.gridSpan)-1});function va(e,t,n){if(t.tableId!==n.tableId)return null;let r=V(e).get(t.tableId);if(!r)return null;let o=Math.min(t.rowIndex,n.rowIndex),a=Math.max(t.rowIndex,n.rowIndex),i=Math.min(Z(t).from,Z(n).from),s=Math.max(Z(t).to,Z(n).to),l=S=>{let{from:x,to:m}=Z(S);return m>=i&&x<=s},d=S=>(r.rows.get(S)??[]).some(x=>x.vMergeContinue&&l(x)),c=r.rows.size+ir(r)+2;for(let S=0;!(S>c);S+=1){let x=false;for(let[m,u]of r.rows)if(!(m<o||m>a))for(let b of u){if(!l(b))continue;let{from:h,to:R}=Z(b);h<i&&(i=h,x=true),R>s&&(s=R,x=true);}for(;o>0&&d(o);)o-=1,x=true;for(;d(a+1);)a+=1,x=true;if(!x)break}let f=[],g=new Set;for(let S of r.placed){if(S.isHeaderRepeat||S.rowIndex<o||S.rowIndex>a)continue;let{from:x,to:m}=Z(S.cell);m<i||x>s||g.has(S.cell.id)||(g.add(S.cell.id),f.push(S.cell.id));}return f.length===0?null:{kind:"cells",tableId:t.tableId,cellIds:f,rows:{from:o,to:a},columns:{from:i,to:s},text:Ea(e,t.tableId,f)}}function us(e,t){return sr(e,t,true)}function De(e,t){return sr(e,t,false)}function sr(e,t,n){let r=new Set(t),o=[],a=new Set;for(let i of V(e).values())for(let s of i.placed)if(!(s.isHeaderRepeat||!r.has(s.cell.id)))for(let l of s.cell.blocks)n&&l.kind!=="paragraph"||ue(l,o,a);return o}function ue(e,t,n){if(e.kind==="paragraph"){for(let r of sa(e))n.has(r)||(n.add(r),t.push(r));return}for(let r of e.rows)if(!r.isHeaderRepeat)for(let o of r.cells)for(let a of o.blocks)ue(a,t,n);}function Ea(e,t,n){let r=De(e,n),o=r[0],a=r[r.length-1];return !o||!a?Ca(e,t):{anchor:{paragraphId:o,offset:0},head:{paragraphId:a,offset:ye$1(e,a).length}}}function Ca(e,t){let n=V(e).get(t);for(let o of n?.placed??[]){if(o.isHeaderRepeat)continue;let a=[];for(let s of o.cell.blocks)ue(s,a,new Set);let i=a[0];if(i){let s={paragraphId:i,offset:0};return {anchor:s,head:s}}}for(let o of e.pages)for(let a of aa(o)){let i={paragraphId:a.paragraphId,offset:0};return {anchor:i,head:i}}let r={paragraphId:"",offset:0};return {anchor:r,head:r}}function wa(e){let t=[...aa(e)];for(let n of [e.header,e.footer])n&&t.push(...ba$1(n.fragments));for(let n of [e.footnotes,e.endnotes])if(n)for(let r of n.notes)t.push(...ba$1(r.fragments));return t}function Oa(e,t){let n=new Set(De(e,t)),r=[],o=new Set;for(let a of e.pages)for(let i of wa(a))if(n.has(i.paragraphId))for(let s of i.lines)for(let l of s.spans){let d=`${l.range.paragraphId}:${l.range.start}:${l.range.end}`;o.has(d)||(o.add(d),r.push(l));}return r}function Ia(e,t){let n=new Set(t),r=[];for(let o of V(e).values())for(let a of o.placed)n.has(a.cell.id)&&r.push({pageIndex:a.pageIndex,x:a.cell.box.x+a.offsetX,y:a.cell.box.y+a.offsetY,width:a.cell.box.width,height:a.cell.box.height});return r}function Ta(e,t){let n=V(e).get(t.tableId);if(!n)return "";let r=new Set(t.cellIds),o=n.placed.some(s=>s.cell.logicalGridColumn!==void 0),a=new Map,i=new Set;for(let s of n.placed){if(s.isHeaderRepeat||!r.has(s.cell.id)||i.has(s.cell.id))continue;i.add(s.cell.id);let l=De(e,[s.cell.id]).map(f=>ye$1(e,f)).join(`
3
+ `),d=a.get(s.rowIndex),c=s.cell.gridColumn+(o?Math.max(1,s.cell.gridSpan)-1:0);d?d.set(c,l):a.set(s.rowIndex,new Map([[c,l]]));}return [...a.keys()].sort((s,l)=>s-l).map(s=>{let l=a.get(s),d=[];for(let c=0;c<=t.columns.to-t.columns.from;c+=1){let f=o?t.columns.to-c:t.columns.from+c;d.push(l.get(f)??"");}return d.join(" ")}).join(`
4
+ `)}function St(e,t){return Aa(e).get(t)??null}var rr=new WeakMap;function La(e){let t=rr.get(e);if(t)return t;let n=[];for(let r of e.blocks)ue(r,n,new Set);return rr.set(e,n),n}var or=new WeakMap;function Aa(e){let t=or.get(e);if(t)return t;let n=new Map;for(let[r,o]of V(e)){let a;for(let i of o.placed)if(!i.isHeaderRepeat)for(let s of La(i.cell)){let l=n.get(s);l&&l.tableId.length>=r.length||(a??=ir(o),n.set(s,{tableId:r,rows:o.rows.size,columns:a,rowIndex:i.rowIndex,columnIndex:i.cell.logicalGridColumn??i.cell.gridColumn}));}}return or.set(e,n),n}function ps(e,t,n){if(n){let a=St(e,t);if(!a||a.tableId!==n.tableId)return null;let i=n.cellIds[0];if(!i)return null;let s=V(e).get(n.tableId);if(!s)return null;for(let l of s.placed)if(l.cell.id===i)return {tableId:n.tableId,rowId:l.row.id,cellId:i,cellIds:n.cellIds,gridColumnIndex:l.cell.logicalGridColumn??l.cell.gridColumn,isHeaderRepeat:l.isHeaderRepeat};return null}let r=St(e,t);if(!r)return null;let o=V(e).get(r.tableId);if(!o)return null;for(let a of o.placed){if(a.isHeaderRepeat)continue;let i=[];for(let s of a.cell.blocks)ue(s,i,new Set);if(i.includes(t))return {tableId:r.tableId,rowId:a.row.id,cellId:a.cell.id,cellIds:[a.cell.id],gridColumnIndex:a.cell.logicalGridColumn??a.cell.gridColumn,isHeaderRepeat:a.row.isHeaderRepeat}}return null}var ar=new WeakMap;function fs(e,t){let n=ar.get(e);if(n)return n.get(t)??null;let r=new Map;for(let[o,a]of V(e))for(let i of a.placed){if(i.isHeaderRepeat)continue;let s=[];for(let d of i.cell.blocks)ue(d,s,new Set);let l={tableId:o,rowId:i.row.id,cellId:i.cell.id,rowIndex:i.rowIndex,gridColumn:i.cell.gridColumn,gridSpan:i.cell.gridSpan};for(let d of s){let c=r.get(d);c&&c.tableId.length>=o.length||r.set(d,l);}}return ar.set(e,r),r.get(t)??null}function Ba(e,t,n){if(![e,t,n].every(Number.isFinite)||t<=0||n<=0)return {offsetPt:0,count:0};let r=Math.ceil(e/n-1e-9)*n;if(!Number.isFinite(r))return {offsetPt:0,count:0};let o=Math.max(0,r-e);return {offsetPt:o,count:Math.min(8192,Math.max(0,Math.floor((t-o)/n+1e-9)))}}export{D as $,xo as A,fs as Aa,Za as B,Ba,ut as C,Ja as D,Ro as E,vo as F,Qa as G,Eo as H,pt as I,ke as J,Co as K,wo as L,Oo as M,yt as N,En as O,Cn as P,wn as Q,On as R,In as S,Tn as T,Ao as U,Bo as V,ce as W,Mo as X,ht as Y,Bn as Z,Uo as _,oe as a,kn as aa,U as b,gi as ba,X as c,zn as ca,K as d,Nn as da,ae as e,Wo as ea,Yt as f,Vo as fa,Y as g,Ko as ga,se as h,Ii as ha,Te as i,$o as ia,Qe as j,jn as ja,z as k,la as ka,Q as l,ca as la,an as m,W as ma,ot as n,Ne as na,Pe as o,Qn as oa,gr as p,ba as pa,ee as q,Sa as qa,it as r,Fa as ra,Sr as s,va as sa,O as t,us as ta,st as u,De as ua,dn as v,Oa as va,dt as w,Ia as wa,Va as x,Ta as xa,j as y,St as ya,So as z,ps as za};
@@ -0,0 +1 @@
1
+ import {xd,ee,xa,N,Ka,Gc,zd,Fc,uc,Ed,Ad,de,wd,ha,sd,fa,ia,ea,$,pa,ke,ue,oe,qe as qe$1,pe}from'./chunk-W2JIZ5JH.js';import {ab,Y,Z,Fa,La,Ma,Sa,Oa}from'./chunk-GG4IAKFI.js';import {Eb,$f,Vd,Xh,df,$a,lb,W,_a,Za,pb,ob,Ya,Cg,Zh}from'./chunk-UOQONZVQ.js';var wt=Object.freeze({}),xt=Object.freeze([]);function bt(e){let t=Object.keys(e);if(t.length===0)return wt;let r={};for(let n of t){let o=e[n];o!==void 0&&(r[n]=o);}return Object.freeze(r)}function Pt(e){let t=new Map(df(e.part())),r=new Set([e.part()]);for(let o of e.headerFooterPartsBySection())for(let a of [o.headers,o.footers])for(let i of a.values())if(!r.has(i)){r.add(i);for(let[s,p]of df(i))t.has(s)||t.set(s,p);}let n=e.currentPackage();for(let o of ["footnote","endnote"]){let a=$f(n,o);if(!(!a||r.has(a))){r.add(a);for(let[i,s]of df(a))t.has(i)||t.set(i,s);}}return t}function vt(e,t){let r=ue(e,t);if(!r)return null;let n=e.pages[r.pageIndex];if(!n)return null;let o=oe(n),a=qe$1(e,t.paragraphId,r.pageIndex),i=Object.freeze({x:r.x+a.x,y:r.y+a.y,height:r.height});return Object.freeze({anchor:Object.freeze({...t}),pageIndex:r.pageIndex,pageContent:i,pageStack:Object.freeze({x:o.x+i.x,y:o.y+i.y})})}function St(e,t){let r=[];for(let n of t.values()){let o=vt(e,n);o&&r.push(o);}return r.length===0?xt:Object.freeze(r)}function Ue(e,t){return {documentMetadata:bt(e.documentProperties()),destinations:St(t,Pt(e))}}function ar(e,t){let r=e.destinations;if(r){for(let n of r)if(n.anchor.name===t)return n}}function Ye(e={}){return Object.freeze({async decode(t,r,n){let o=Eb(t,r);if(!o)throw new Error(`Unsupported or malformed ${r} image`);if(o.pixelWidth>n.maxDimension||o.pixelHeight>n.maxDimension||o.pixelWidth>n.maxPixels/o.pixelHeight)throw new Error("Image dimensions exceed resource limits");return Object.freeze({pixelWidth:o.pixelWidth,pixelHeight:o.pixelHeight,dpiX:o.dpiX??96,dpiY:o.dpiY??96})},...e.convertPreserved?{convertPreserved:e.convertPreserved}:{}})}var Xe=new WeakMap,It=new Set(["shape","rect","roundrect","oval","line","group","arc","curve","polyline","image"]);function Rt(e){let t=Xe.get(e.root);if(t)return t;let r=new Set,n=[{node:e.root,scope:$a(),depth:0,mcSelected:false}],o=0;for(;n.length;){let{node:i,scope:s,depth:p,mcSelected:h}=n.pop();if(++o>lb||p>W){r.add("scan-limit");break}if(i.kind==="textValue")continue;if(o+n.length+i.children.length>lb){r.add("scan-limit");break}let y=_a(s,i),c=Za(i)?i:void 0;if(c){if(pb(c,y).drawing)continue;let l=ob(c,y);l.refused&&r.add("scan-limit"),l.branch&&n.push({node:l.branch,scope:y,depth:p+1,mcSelected:true});continue}if(!(!h&&Ya(i))){if(i.namespaceUri==="urn:schemas-microsoft-com:vml"&&i.localName==="textbox"){r.add("legacy-textbox");continue}i.namespaceUri==="urn:schemas-microsoft-com:vml"&&It.has(i.localName)&&!i.children.some(l=>l.kind!=="textValue"&&l.namespaceUri==="urn:schemas-microsoft-com:vml"&&l.localName==="textbox")&&r.add("legacy-drawing");for(let l of i.children)n.push({node:l,scope:y,depth:p+1,mcSelected:h});}}let a=Object.freeze([...r]);return Xe.set(e.root,a),a}function qe(e){let t=new Set([e.part()]);for(let r of e.headerFooterPartsBySection())for(let n of [r.headers,r.footers])for(let o of n.values())t.add(o);for(let r of ["footnote","endnote"]){let n=$f(e.currentPackage(),r);n&&t.add(n);}return Object.freeze([...t].flatMap(r=>Rt(r).map(n=>Object.freeze({code:n,partName:r.name}))))}function Je(e){let t=e.defaultTabStopPt?.(),r=e.view.part().name,n={view:e.view,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:t,compatibilityMode:e.compatibilityMode?.(),inlineDrawingLayoutForPart:e.inlineDrawingLayoutForPart,drawingTokenForParagraphForPart:e.drawingTokenForParagraphForPart,drawingLayoutEpochForPart:e.drawingLayoutEpochForPart,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,showFieldCodes:e.showFieldCodes,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},o=xd(n),a={view:e.view,revision:e.revision,measurer:e.measurer,cache:e.cache,session:e.session,producer:e.producer,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:t,furniture:e.furniture,compatibilityMode:e.compatibilityMode,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,showFieldCodes:e.showFieldCodes,inlineDrawingLayout:e.inlineDrawingLayout,drawingTokenForParagraph:e.drawingTokenForParagraph,drawingLayoutEpoch:e.drawingLayoutEpoch,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},i={measurer:a.measurer,cache:a.cache,session:a.session,producer:a.producer,styleCascade:a.styleCascade?.(),defaultTabStopPt:a.defaultTabStopPt,compatibilityMode:a.compatibilityMode?.(),numberingIndex:a.numberingIndex?.(),sectionFurniture:a.furniture.sectionFurniture(),furniture:a.furniture.furniture(),projectLink:a.linkProjectors.projectLink,projectFieldLink:a.projectFieldLink,showFieldCodes:a.showFieldCodes,documentProperties:a.view.documentProperties(),inlineDrawingLayout:a.inlineDrawingLayout,drawingTokenForParagraph:a.drawingTokenForParagraph,drawingLayoutEpoch:a.drawingLayoutEpoch,projectionTokenForParagraph:s=>a.linkProjectors.tokenForParagraphForPart(r,s),projectionTokenForTable:s=>a.linkProjectors.tokenForTableForPart(r,s),projectionEpoch:a.linkProjectors.epochForPart(r),notes:o,displayMode:a.displayMode,revisionAuthorFilter:a.revisionAuthorFilter};return ee(a.view.part(),a.revision,i)}var Ot=65536;function et(e,t){return {x:t.x-e.contentBox.x,y:t.y-e.contentBox.y}}function kt(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function Dt(e,t,r){return e.rootStory!==t?false:t==="footnote"||t==="endnote"?e.noteScopeId===r:true}function Mt(e,t){if(t.story!=="textbox"||t.textboxPath.length===0)return null;let r=null;return ea(e,n=>{if(r||!Dt(t,n.story,n.noteScopeId))return;let o=n.story==="header"||n.story==="footer"?a=>$(a,n.origin,{x:e.box.x,y:e.box.y}):void 0;ia(n.host,(a,i)=>{if(r||i.textboxDepth===0)return;let s=i.textboxPath.map(p=>p.drawingNodeId);kt(s,t.textboxPath)&&(r=et(e,i.storyOrigin));},n.origin,o);}),r}function Et(e,t){if(t.story==="textbox")return Mt(e,t)??{x:0,y:0};switch(t.rootStory){case "body":return {x:0,y:0};case "header":return e.header?pe(e,e.header.box):{x:0,y:0};case "footer":return e.footer?pe(e,e.footer.box):{x:0,y:0};case "footnote":case "endnote":{let n=(t.rootStory==="footnote"?e.footnotes:e.endnotes)?.notes.find(o=>o.scopeId===t.noteScopeId);return n?pe(e,n.box):{x:0,y:0}}case "note-separator":{let r=t.noteAreaKind==="endnotes"?e.endnotes:e.footnotes;return r?.separator?pe(e,r.separator.box):{x:0,y:0}}default:return {x:0,y:0}}}function tt(e){return Object.freeze({x:e.x,y:e.y,width:e.width,height:e.height})}function rt(e,t){let r=oe(e);return Object.freeze({x:r.x+t.x,y:r.y+t.y,width:t.width,height:t.height})}function Lt(e,t){let r=ue(e,{paragraphId:t.source.start.paragraphId,offset:t.source.start.offset},{preferredPageIndex:t.pageIndex});if(!r||r.pageIndex!==t.pageIndex)return;let n=e.pages[r.pageIndex];if(!n)return;let o=Et(n,t),a=Object.freeze([tt({x:r.x+o.x,y:r.y+o.y,width:0,height:r.height})]);return Object.freeze({pageContent:a,pageStack:Object.freeze(a.map(i=>rt(n,i)))})}function At(e,t,r){let n=r.filter(i=>i.pageIndex===t.pageIndex);if(n.length===0)return nt(t)?Lt(e,t):void 0;let o=e.pages[t.pageIndex];if(!o)return;let a=Object.freeze(n.map(i=>tt(i)));return Object.freeze({pageContent:a,pageStack:Object.freeze(a.map(i=>rt(o,i)))})}function nt(e){return e.source.start.paragraphId===e.source.end.paragraphId&&e.source.start.offset===e.source.end.offset}function Ze(e,t){return `${e}\0${t}`}function Ft(e,t,r){let n=Math.max(e.start,t.offset),o=Math.min(e.end,r.offset);return o>n?{start:n,end:o}:null}function Tt(e,t){let r=new Map,n=new Map,o=new Set,a=0;let i=(s,p)=>{if(a>=Ot)return false;a+=1;let h=Ze(s.pageIndex,p),y=n.get(h);return y?y.push(s):n.set(h,[s]),true};for(let[s,p]of t.entries())for(let[h,y]of p.occurrences.entries()){if(nt(y)||y.source.start.paragraphId!==y.source.end.paragraphId)continue;o.add(y.pageIndex);let c=`${s}\0${h}`,l={paragraphId:y.source.start.paragraphId,offset:y.source.start.offset},f={paragraphId:y.source.end.paragraphId,offset:y.source.end.offset},w=l.offset<=f.offset?{from:l,to:f}:{from:f,to:l};i({key:c,from:w.from,to:w.to,pageIndex:y.pageIndex},w.from.paragraphId);}if(n.size===0)return r;for(let s of e.pages)o.has(s.index)&&ea(s,p=>{let h=p.story==="header"||p.story==="footer"?y=>$(y,p.origin,{x:s.box.x,y:s.box.y}):void 0;ia(p.host,(y,c)=>{let l=et(s,c.storyOrigin);for(let f of y.lines)for(let w of pa(f)){let u=n.get(Ze(s.index,w.paragraphId));if(u)for(let g of u){let x=Ft(w,g.from,g.to);if(!x)continue;let b=ke(f,x.start,void 0,w),v=ke(f,x.end,void 0,w),R=r.get(g.key)??[];R.push({pageIndex:s.index,x:Math.min(b,v)+l.x,y:f.box.y+l.y,width:Math.abs(v-b),height:f.box.height}),r.set(g.key,R);}}},p.origin,h);});return r}function ot(e,t){let r=false;for(let o of t)if(o.occurrences.length!==0){r=true;break}if(!r)return t;let n=Tt(e,t);return t.map((o,a)=>{if(o.occurrences.length===0)return o;let i=o.occurrences.map((s,p)=>{let h=`${a}\0${p}`,y=At(e,s,n.get(h)??[]);return y?{...s,geometry:y}:s});return {...o,occurrences:Object.freeze(i)}})}function Ct(e){let t=new Map,r=[{node:e.root,depth:0}];for(;r.length>0;){let{node:n,depth:o}=r.pop();if(!(n.kind==="textValue"||o>64)){n.kind==="paragraph"&&!t.has(n.id)&&t.set(n.id,t.size);for(let a=n.children.length-1;a>=0;a-=1)r.push({node:n.children[a],depth:o+1});}}return t}function at(){let e=new Map,t=n=>{let o=e.get(n.root);if(o)return o;let a=Ct(n);return e.set(n.root,a),a},r={retainRevisionItems:false,revisionSites:Zh,locations:Oa,commentAnchors:Cg,deepOrder:t};return Object.freeze({collectReviewItems:n=>Sa(n,r),deepParagraphOrderOfPart:t})}function jt(e,t){if(t)return true;let r=e.map(n=>n.root);for(;r.length>0;){let n=r.pop();if(Xh(n))return true;if(n.kind!=="textValue")for(let o of n.children)r.push(o);}return false}function Nt(e,t){let r=[],n=new Set([t.name]),o=a=>{!a||n.has(a.name)||(n.add(a.name),r.push(a));};for(let a of Vd(e)){for(let i of a.headers.values())o(i);for(let i of a.footers.values())o(i);}return o($f(e,"footnote")),o($f(e,"endnote")),r}function _t(e,t){switch(t.story){case "body":return e.mainDocumentPart;case "header":case "footer":return t.host.partName;case "footnote":return $f(e,"footnote")?.name??null;case "endnote":return $f(e,"endnote")?.name??null;case "note-separator":return $f(e,t.noteAreaKind==="footnotes"?"footnote":"endnote")?.name??null;default:return t}}function Bt(e,t){let r=new Map;for(let n of e){let o=t.get(n.partName),a=o?.get(n.start.paragraphId),i=o?.get(n.end.paragraphId);if(a===void 0||i===void 0)continue;let s=Math.min(a,i),p=Math.max(a,i),h=r.get(n.partName);r.set(n.partName,{lower:Math.min(h?.lower??s,s),upper:Math.max(h?.upper??p,p)});}return r}function Vt(e,t,r,n,o){let a=new Map(r.map(c=>[c.name,o(c)])),i=Bt(n,a),s=new Map,p=new Map,h=(c,l,f,w,u,g,x)=>{let b=a.get(c)?.get(u),v=i.get(c);if(b===void 0||!v||b<v.lower||b>v.upper)return;let R=s.get(c)??new Map;s.set(c,R);let V=p.get(c)??new Map;p.set(c,V);let N=JSON.stringify([l.story,l.noteScopeId,l.noteAreaKind]),Y=f==="textbox"?JSON.stringify([N,"textbox",w]):N,K=R.get(u)??[],z=`${u}\0${l.page.index}\0${Y}`,T=V.get(z);T||(T={pageIndex:l.page.index,story:f,rootStory:l.story,textboxPath:w,noteScopeId:l.noteScopeId,noteAreaKind:l.noteAreaKind,laneKey:Y,intervals:[],intervalKeys:new Set},V.set(z,T),K.push(T),R.set(u,K));let m=`${g}\0${x}`;T.intervalKeys?.has(m)||(T.intervalKeys?.add(m),T.intervals.push({start:g,end:x}));};fa(e,c=>{let l=_t(t,c);!l||!i.has(l)||ia(c.host,(f,w)=>{let u=w.textboxDepth>0?"textbox":c.story,g=w.textboxPath.map(b=>b.drawingNodeId),x=[];for(let b of f.lines){for(let v of b.spans)x.push(v.range);for(let v of b.drawings??[])x.push({paragraphId:v.paragraphId,start:v.start,end:v.start+1});}x.length===0&&x.push({paragraphId:f.range.paragraphId,start:f.range.start,end:f.range.end});for(let{paragraphId:b,start:v,end:R}of x)h(l,c,u,g,b,v,R);});}),ha(e,c=>{let l=c.drawing.ownerPartName;i.has(l)&&h(l,c.root,c.story,c.textboxPath.map(f=>f.drawingNodeId),c.drawing.paragraphId,c.drawing.start,c.drawing.start+1);});for(let c of s.values())for(let l of c.values())for(let f of l){f.intervals.sort((u,g)=>u.start-g.start||u.end-g.end);let w=[];for(let u of f.intervals){let g=w.at(-1);g&&u.start<=g.end?g.end=Math.max(g.end,u.end):w.push({...u});}f.intervals.splice(0,f.intervals.length,...w),f.intervalKeys=void 0;}let y=new Map;for(let[c,l]of s){let f=a.get(c);if(!f)continue;let w=[];for(let[u,g]of l){let x=f.get(u);x!==void 0&&w.push({paragraphId:u,position:x,laneKeys:new Set(g.map(({laneKey:b})=>b))});}w.sort((u,g)=>u.position-g.position),y.set(c,w);}return {byPart:s,orderByPart:a,visibleByPart:y}}function it(e,t){let r=0,n=e.length;for(;r<n;){let o=r+n>>>1;e[o].position<t?r=o+1:n=o;}return r}function Kt(e,t){if(e.start.paragraphId===e.end.paragraphId)return [e.start.paragraphId];let r=t.orderByPart.get(e.partName),n=t.visibleByPart.get(e.partName),o=r?.get(e.start.paragraphId),a=r?.get(e.end.paragraphId);if(!r||!n||o===void 0||a===void 0)return [e.start.paragraphId,e.end.paragraphId];let i=Math.min(o,a),s=Math.max(o,a),p=new Set(t.byPart.get(e.partName)?.get(e.start.paragraphId)?.map(({laneKey:c})=>c)??[]),h=new Set(t.byPart.get(e.partName)?.get(e.end.paragraphId)?.map(({laneKey:c})=>c)??[]),y=new Set([...p].filter(c=>h.has(c)));return y.size===0?[e.start.paragraphId,e.end.paragraphId]:n.slice(it(n,i),it(n,s+1)).filter(c=>[...c.laneKeys].some(l=>y.has(l))).map(c=>c.paragraphId)}function zt(e,t,r,n){return n?e.intervals.filter(a=>a.start<=t&&t<a.end).length>0?[{start:t,end:t}]:[]:e.intervals.flatMap(o=>{if(o.start===o.end)return [];let a={start:Math.max(o.start,t),end:Math.min(o.end,r)};return a.end>a.start?[a]:[]})}function Wt(e,t){let r=Number.NEGATIVE_INFINITY;for(let n of e)for(let o of n.intervals)r=Math.max(r,o.end);return t!==r?new Set:new Set(e.filter(n=>n.intervals.some(o=>o.end===r)))}function st(e,t,r){let n=[],o=new Set;for(let[a,i]of e.entries()){let s=r===void 0?void 0:r===null?"neutral":a<r?"replaced":"replacement";for(let p of Kt(i,t)){let h=t.byPart.get(i.partName)?.get(p)??[],c=i.start.paragraphId===i.end.paragraphId&&i.start.offset===i.end.offset,l=p===i.start.paragraphId?i.start.offset:0,f=p===i.end.paragraphId?i.end.offset:Number.POSITIVE_INFINITY,w=c?Wt(h,l):new Set;for(let u of h){let g=zt(u,l,f,c);c&&g.length===0&&w.has(u)&&(g=[{start:l,end:l}]);for(let x of g){let b=`${u.pageIndex}\0${u.story}\0${u.noteScopeId??""}\0${u.noteAreaKind??""}\0${u.textboxPath.join("\0")}\0${i.partName}\0${p}\0${x.start}\0${x.end}\0${s??""}`;o.has(b)||(o.add(b),n.push({pageIndex:u.pageIndex,physicalPageNumber:u.pageIndex+1,story:u.story,rootStory:u.rootStory,textboxPath:u.textboxPath,noteScopeId:u.noteScopeId,noteAreaKind:u.noteAreaKind,...s?{revisionRole:s}:{},source:{partName:i.partName,start:{paragraphId:p,offset:x.start},end:{paragraphId:p,offset:x.end}}}));}}}}return n}function dt(e,t){let r=2166136261,n=2654435769;for(let o=0;o<t.length;o+=1){let a=t.charCodeAt(o);r=Math.imul(r^a,16777619)>>>0,n=Math.imul(n^a+o,2246822507)>>>0,n^=n>>>13;}return `${e}_${t.length.toString(36)}_${r.toString(36)}_${n.toString(36)}`}function ct(e,t,r=dt){let n=new Map;for(let a of t){let i=r(e,a),s=n.get(i)??new Set;s.add(a),n.set(i,s);}let o=new Map;for(let[a,i]of n){let s=[...i].sort();for(let[p,h]of s.entries())o.set(h,s.length===1?a:`${a}_${p.toString(36)}`);}return o}function $t(e){let t=new Set,r=new Set;for(let n of e){if(n.kind==="comment"){t.add(n.id),n.parentId!==void 0&&t.add(n.parentId),n.parentRevisionId!==void 0&&r.add(n.parentRevisionId);for(let o of n.replyIds)t.add(o);}if(n.kind==="revision"){r.add(n.id),n.pairedWith!==void 0&&r.add(n.pairedWith);for(let o of n.replyIds)t.add(o);}}return {comment:ct("comment",t),revision:ct("change",r)}}function B(e,t,r){return e.get(r)??dt(t,r)}function Ht(e,t,r){return e.kind==="revision"?{kind:"tracked-change",id:B(r.revision,"change",e.id),change:e.revisionKind,...e.markDirection?{markDirection:e.markDirection}:{},author:e.author,...e.date!==void 0?{date:e.date}:{},text:e.text,replacedText:e.replacedText,nesting:e.nesting,...e.replacedRangeCount!==void 0?{replacedRangeCount:e.replacedRangeCount}:{},readOnly:e.readOnly,...e.pairedWith!==void 0?{pairedWith:B(r.revision,"change",e.pairedWith)}:{},replyIds:e.replyIds.map(n=>B(r.comment,"comment",n)),occurrences:t?st(e.ranges,t,e.revisionKind==="replace"?e.replacedRangeCount??null:void 0):[]}:e.kind!=="comment"?null:{kind:"comment",id:B(r.comment,"comment",e.id),author:e.comment.author,initials:Ma(e.comment),...e.comment.date!==void 0?{date:e.comment.date}:{},text:La(e.comment),resolved:e.resolved,...e.parentId!==void 0?{parentId:B(r.comment,"comment",e.parentId)}:{},...e.parentRevisionId!==void 0?{parentRevisionId:B(r.revision,"change",e.parentRevisionId)}:{},replyIds:e.replyIds.map(n=>B(r.comment,"comment",n)),orphaned:e.orphaned,occurrences:t&&e.range?st([e.range],t):[]}}function ut(e,t){let r=t.parts.get(t.mainDocumentPart);if(!r)return [];let n=Nt(t,r),o=[r,...n],a=t.parts.get(Y(t,r.name));if(!jt(o,a))return [];let i=at(),s=i.collectReviewItems({storyPart:r,furnitureParts:n,commentsPart:a,commentsExtendedPart:t.parts.get(Z(t,r.name))});if(s.length===0)return [];let p=s.flatMap(c=>Fa(c)),h=p.length>0?Vt(e,t,o,p,i.deepParagraphOrderOfPart):null,y=$t(s);return s.map(c=>Ht(c,h,y)).filter(c=>c!==null)}var Gt=new Set(["part","validatedHandle"]);function lt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function U(e,t,r,n,o){if(!(n!==void 0&&Gt.has(n))){if(typeof e=="function")throw new TypeError("Semantic layout publication encountered a function value");if(!(e===null||typeof e!="object")&&!o?.has(e)){if(r.has(e))throw new TypeError("Semantic layout publication encountered a cyclic record graph");if(!t.has(e)){t.add(e),r.add(e);try{if(Array.isArray(e)){for(let a of e)U(a,t,r,void 0,o);Object.freeze(e);return}if(!lt(e))throw new TypeError("Semantic layout publication encountered a non-record value");for(let a of Reflect.ownKeys(e)){let i=Object.getOwnPropertyDescriptor(e,a);if(i){if(!("value"in i))throw new TypeError("Semantic layout publication encountered an accessor property");U(i.value,t,r,a,o);}}Object.freeze(e);}finally{r.delete(e);}}}}}function pt(e){if(!lt(e))throw new TypeError("Semantic layout publication encountered a non-record value");let t=new Set;for(let n of e.pages)if(!(n===null||typeof n!="object"))for(let o of ["header","footer"]){let a=Object.getOwnPropertyDescriptor(n,o);if(!a||!("value"in a))continue;let i=a.value;if(i===null||typeof i!="object"||t.has(i))continue;let s=new Set;s.add(e),U(i,new Set,s,o),t.add(i);}let r=(n,o)=>{let a=new Set;for(let i of n){let s=new Set;s.add(e),U(i,a,s,void 0,o);}Object.freeze(n);};for(let n of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,n);if(!o)continue;if(!("value"in o))throw new TypeError("Semantic layout publication encountered an accessor property");if(n==="pages"&&Array.isArray(o.value)){r(o.value,t);continue}if(n==="reviewArtifacts"&&Array.isArray(o.value)){r(o.value);continue}let a=new Set;a.add(e),U(o.value,new Set,a,n);}return Object.freeze(e),e}var Ut=Object.freeze([]),k=class extends Error{constructor(r,n,o){super(n,o);this.code=r;this.name="ExportResourceError";}code};function Yt(e){try{return e instanceof k}catch{return false}}function Xt(e){try{return e instanceof sd}catch{return false}}function qt(e){try{return e instanceof Error&&typeof e.message=="string"&&e.message.length>0?e.message:null}catch{return null}}function Jt(e){if(Yt(e))return e;let t=Xt(e),r=qt(e),n=r?`: ${r}`:"",o=new k(t?"layoutInvariant":"layoutFailed",t?`Authored geometry could not be represented within the bounded page model${n}`:`Export layout failed${n}`);return Object.defineProperty(o,"cause",{configurable:true,value:e}),o}function Qt(e){if(e===void 0)return 6e4;if(!Number.isFinite(e)||e<=0)throw new RangeError("resourceTimeoutMs must be a positive finite number");return Math.max(1,e)}function mt(e){if(e==="all-markup"||e==="proposed"||e==="original")return e;throw new RangeError("displayMode must be all-markup, proposed, or original")}var Zt=50,se=64;function er(e){switch(e.kind){case "pending":return true;case "ready":case "unrenderable":case "external":case "missing":return false;default:return e}}function tr(e){let t=false;return ha(e,({drawing:r})=>{er(r.resource)&&(t=true);}),t}function yt(e){return !ArrayBuffer.isView(e)}function nn(e,t={}){if(t.signal?.aborted)return {ok:false,reason:"aborted"};let r=mt(t.displayMode??xa),n=yt(e),o=yt(e)?{ok:true,view:e}:ab(e);if(!o.ok)return o;let a=o.view,i=t.reuseAcrossRevisions??n,s=Qt(t.resourceTimeoutMs),p=t.measurer??N(),h=t.producer??(t.measurer?"host-export-measurer":"export-fixed-measurer"),y=Ka({retainAcrossPasses:i}),c=0,l=new Set,f=()=>{c+=1;for(let m of l)m();l.clear();},w=Gc({session:a,decodePort:t.imageDecodePort??Ye(t.convertPreservedImage?{convertPreserved:t.convertPreservedImage}:void 0),onResourcesChanged:f}),u={view:a,measurer:p,paragraphCache:y,sessions:new Map,completed:new Map,inFlight:new Map,styles:Fc(a),fieldLinks:new Map,links:zd(a),drawingBundle:w,furniture:new Map},g=new AbortController,x=t.signal,b=false,v=()=>b?new k("aborted","Export resource settlement was aborted"):new k("disposed","Export session has been disposed"),R=()=>{b=true,V();};function V(){let m=u;if(m){u=null,x?.removeEventListener("abort",R),g.abort(x?.reason),m.drawingBundle.dispose(),m.paragraphCache.clear();for(let P of m.completed.values())uc(P.internal),Ed(P.internal);for(let P of m.fieldLinks.values())P.registry.clear();m.fieldLinks.clear(),m.completed.clear(),m.inFlight.clear(),m.furniture.clear(),m.sessions.clear(),f();}}x?.addEventListener("abort",R,{once:true}),x?.aborted&&R();let N$1=()=>{if(!u)throw v();if(g.signal.aborted)throw new k("aborted","Export resource settlement was aborted")},Y=(m,P,D,d)=>c!==m||u?.view.packageRevision()!==P||u?.view.currentPackage()!==D?Promise.resolve():(N$1(),new Promise((_,O)=>{let M=false,C,E=A=>{M||(M=true,C!==void 0&&clearTimeout(C),l.delete(L),g.signal.removeEventListener("abort",W),A?O(A):_());},L=()=>E(),W=()=>E(new k("aborted","Export resource settlement was aborted")),$=()=>{if(u?.view.packageRevision()!==P||u?.view.currentPackage()!==D){E();return}let A=d-Date.now();if(A<=0){E(new k("timedOut",`Image resources did not settle within ${s}ms`));return}C=setTimeout($,Math.min(Zt,A));};if(l.add(L),g.signal.addEventListener("abort",W,{once:true}),c!==m||u?.view.packageRevision()!==P||u?.view.currentPackage()!==D){E();return}$();})),K=async(m,P=0,D=Date.now()+s)=>{if(N$1(),Date.now()>=D)throw new k("timedOut",`Export layout did not stabilize within ${s}ms`);let d=u,_=D,O=d.view.packageRevision(),M=d.view.currentPackage(),C=d.completed.get(m);if(C&&C.revision===O&&C.pkg===M)return C.published;let E=()=>{if(d.view.packageRevision()===O&&d.view.currentPackage()===M)return null;if(P>=se-1)throw new k("nonConvergent","Document revision did not stabilize during export layout");return K(m,P+1,_)},L=d.fieldLinks.get(m);if(!L||L.revision!==O||L.pkg!==M){let I=L?.registry??Ad();I.clear(),L={revision:O,pkg:M,registry:I},d.fieldLinks.set(m,L),d.furniture.delete(m);}let W=L.registry,$=d.sessions.get(m)??de();d.sessions.set(m,$);let A=d.furniture.get(m);A||(A=wd({view:d.view,measurer:d.measurer,producer:h,cache:d.paragraphCache,styleCascade:d.styles.styleCascade,numberingIndex:d.styles.numberingIndex,defaultTabStopPt:d.styles.defaultTabStopPt,compatibilityMode:d.styles.compatibilityMode,displayMode:m,revisionAuthorFilter:void 0,showFieldCodes:false,inlineDrawingLayoutForPart:I=>d.drawingBundle.contextForPart(I),drawingLayoutTokenForPart:I=>d.drawingBundle.cacheTokenForPart(I),drawingTokenForParagraphForPart:(I,ee)=>d.drawingBundle.drawingTokenForParagraph(ee,I),linkProjectors:d.links,projectFieldLink:I=>W.project(I)}),d.furniture.set(m,A));for(let I=0;I<se;I+=1){let ee=c;d.drawingBundle.sync(d.view);let ce=E();if(ce)return ce;let j=Je({view:d.view,revision:d.view.packageRevision(),measurer:d.measurer,cache:d.paragraphCache,session:$,producer:h,styleCascade:d.styles.styleCascade,defaultTabStopPt:d.styles.defaultTabStopPt,numberingIndex:d.styles.numberingIndex,furniture:A,compatibilityMode:d.styles.compatibilityMode,linkProjectors:d.links,projectFieldLink:S=>W.project(S),inlineDrawingLayout:d.drawingBundle.bodyContext,inlineDrawingLayoutForPart:S=>d.drawingBundle.contextForPart(S),drawingTokenForParagraph:S=>d.drawingBundle.drawingTokenForParagraph(S,d.view.part().name),drawingTokenForParagraphForPart:(S,X)=>d.drawingBundle.drawingTokenForParagraph(X,S),drawingLayoutEpoch:d.drawingBundle.cacheTokenForPart(d.view.part().name),drawingLayoutEpochForPart:S=>d.drawingBundle.cacheTokenForPart(S),displayMode:m,revisionAuthorFilter:void 0,showFieldCodes:false});if(!tr(j)){let S=E();if(S)return S;i||(uc(j),Ed(j),d.paragraphCache.clear(),d.sessions.delete(m),d.furniture.delete(m));let X=ut(j,M),ft=X.length===0?Ut:Object.freeze(ot(j,X)),gt=Ue(d.view,j),ht={...j,...gt,contentWarnings:qe(d.view),reviewArtifacts:ft},le=pt(ht);return d.completed.set(m,{revision:O,pkg:M,internal:j,published:le}),le}let de=ee;for(;d.drawingBundle.pendingResourceCount()>0;){await Y(de,O,M,_),de=c,N$1();let S=E();if(S)return S}N$1();let ue=E();if(ue)return ue}throw new k("nonConvergent",`Image resources did not reach quiescence after ${se} layout passes`)},z=m=>{let P;try{P=mt(m);}catch(O){return Promise.reject(O)}if(!u)return Promise.reject(v());let D=u,d=D.inFlight.get(P);if(d)return d;let _=K(P).catch(O=>{throw Jt(O)}).finally(()=>D.inFlight.delete(P));return D.inFlight.set(P,_),_};return {ok:true,session:{layout:()=>z(r),layoutFor:z,validatedImageBytes(m){let P=u;return !P||m.resource.kind!=="ready"?null:P.drawingBundle.mintValidatedBytes(m.resource.validatedHandle,m.resource.contentId)?.slice()??null},dispose:V}}}export{Je as a,ar as b,Ye as c,k as d,nn as e};