ai_co_discuss 0.4.13 → 0.4.16

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 (44) hide show
  1. package/.agents/skills/discuss-host/SKILL.md +42 -42
  2. package/.agents/skills/workflow-creator/SKILL.md +155 -155
  3. package/.agents/skills/workflow-creator/references/model-selection.md +24 -23
  4. package/backend/free_room.py +15 -8
  5. package/backend/schema.sql +3 -1
  6. package/backend/server.py +146 -17
  7. package/docs/THIRD_PARTY_NOTICES.md +721 -1
  8. package/docs/runner.md +4 -2
  9. package/docs/workflow.md +1 -1
  10. package/package.json +10 -3
  11. package/runner/adapters/api.mjs +33 -7
  12. package/runner/adapters/api_files.mjs +21 -0
  13. package/runner/adapters/api_images.mjs +245 -0
  14. package/runner/adapters/index.mjs +186 -186
  15. package/runner/adapters/profiles.mjs +152 -139
  16. package/runner/discussion_launch.mjs +49 -11
  17. package/runner/free_runner.mjs +1286 -1281
  18. package/runner/project_files.mjs +390 -330
  19. package/runner/relay_channel.mjs +326 -325
  20. package/runner/remote_launch.mjs +2 -2
  21. package/runner/stt.mjs +135 -111
  22. package/runner/tts.mjs +180 -172
  23. package/runner/tts_providers.mjs +479 -435
  24. package/runner/workflows.mjs +606 -606
  25. package/web/app.js +82 -12
  26. package/web/backup.js +1 -1
  27. package/web/markdown.css +1 -1
  28. package/web/modern.css +1 -1
  29. package/web/modern.js +663 -40
  30. package/web/office/assets/pptx-source-worker-559Vl2R3.mjs +446 -0
  31. package/web/office/assets/pptx_parser_bg-DON650C_.wasm +0 -0
  32. package/web/office/assets/render-worker-Ck21oePL-D_L2C4am.js +16 -0
  33. package/web/office/chunks/comment-ui-runtime-Bp37ytDC-CEDIeFBy.js +125 -0
  34. package/web/office/chunks/emf--QWY-UlT-D7lCNost.js +1 -0
  35. package/web/office/chunks/font-preload-demand-NqcVKIpX-_QhVEaPJ.js +1 -0
  36. package/web/office/chunks/plot-area-frame-DNYMd9Pf-B0ScWz_J.js +2 -0
  37. package/web/office/chunks/pptx-DbjWegUB-CU8ZIJEP.js +4 -0
  38. package/web/office/chunks/presentation-model-source-DLNioq7T-Demo5cCW.js +1 -0
  39. package/web/office/chunks/render-worker-host-CVr53kg0-DUcW76F6.js +1 -0
  40. package/web/office/chunks/slide-pull-client-3g6TxaKa-BohMnKOC.js +12 -0
  41. package/web/office/chunks/worker-source-ZQE9C1j6-B31UTbq3.js +1 -0
  42. package/web/office/docx.js +21 -0
  43. package/web/office/pptx.js +1 -0
  44. package/web/office/xlsx.js +64 -0
@@ -0,0 +1,4 @@
1
+ import{Ji as e,Sa as t,Vr as n,Wa as r,Yt as i,yi as a}from"./plot-area-frame-DNYMd9Pf-B0ScWz_J.js";import{A as o,B as s,C as c,D as l,E as u,F as d,I as f,L as p,M as m,N as h,O as g,P as _,R as v,S as ee,T as y,V as b,_ as x,b as te,c as S,d as ne,f as re,g as C,h as ie,i as ae,j as w,k as oe,l as se,m as ce,n as le,o as ue,p as de,r as fe,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye,z as be}from"./slide-pull-client-3g6TxaKa-BohMnKOC.js";function xe(e){let t=Error(e);return t.name=`AbortError`,t}function Se(){return xe(`worker request aborted`)}var Ce=class{_worker;_opts;_pending=new Map;_orphaned=new Map;_nextId=1;_terminated=!1;_failure;constructor(e,t){this._worker=e,this._opts=t,this._worker.addEventListener(`message`,this._handle),this._worker.addEventListener(`messageerror`,this._handleWorkerError),this._worker.addEventListener(`error`,this._handleWorkerError)}_handle=e=>{let t=e.data,n=this._opts.correlate(t);if(n===void 0){this._opts.onUnsolicited?.(t);return}let r=this._pending.get(n);if(!r){try{let e=this._orphaned.get(n);e?(this._orphaned.delete(n),e(t)):this._opts.onOrphanedResponse?.(t)}catch{}return}this._pending.delete(n),r.cleanup();let i=this._opts.toError?.(t);i===void 0?r.resolve(t):r.reject(i instanceof Error?i:Error(i))};_handleWorkerError=e=>{let t=`message`in e&&e.message?`: ${e.message}`:``,n=e.type===`error`&&!t&&globalThis.origin===`null`?`: this page has an opaque origin; a sandboxed iframe without allow-same-origin can block Worker loading`:``;this._failure??=Error(`Worker error${t}${n}`),this._rejectAll(this._failure)};_rejectAll(e){let t=[...this._pending.values()];this._pending.clear();for(let n of t)n.cleanup(),n.reject(e)}nextId(){return this._nextId++}request(e,t,n){let r=this._nextId++,i=n?.timeoutMs===!1?void 0:n?.timeoutMs??this._opts.timeoutMs,a=n?.signal,o=e=>{try{n?.onCancel?.(r,e)}catch{}};return new Promise((s,c)=>{if(this._terminated){c(Error(`Worker terminated`));return}if(this._failure){c(this._failure);return}if(a?.aborted){o(`abort`),c(Se());return}let l,u;this._pending.set(r,{resolve:s,reject:c,cleanup:()=>{l!==void 0&&(clearTimeout(l),l=void 0),u&&a&&(a.removeEventListener(`abort`,u),u=void 0)},onOrphanedResponse:n?.onOrphanedResponse}),i!==void 0&&(l=setTimeout(()=>{let e=this._pending.get(r);e&&(this._pending.delete(r),e.onOrphanedResponse&&this._orphaned.set(r,e.onOrphanedResponse),e.cleanup(),o(`timeout`),e.reject(Error(`worker request timed out after ${i}ms`)))},i)),a&&(u=()=>{let e=this._pending.get(r);e&&(this._pending.delete(r),e.onOrphanedResponse&&this._orphaned.set(r,e.onOrphanedResponse),e.cleanup(),o(`abort`),e.reject(Se()))},a.addEventListener(`abort`,u));try{this._worker.postMessage(e(r),t)}catch(e){let t=this._pending.get(r);if(!t)return;this._pending.delete(r),t.cleanup(),t.reject(e instanceof Error?e:Error(String(e)))}})}transport(e){return{request:(t,n,r)=>this.request(t,n,{...r,onOrphanedResponse:r?.onOrphanedResponse?t=>{e(t)&&r.onOrphanedResponse?.(t)}:void 0}).then(t=>{if(!e(t))throw Error(`worker response does not match the selected transport`);return t}),forgetOrphaned:e=>this.forgetOrphaned(e),terminate:()=>this.terminate()}}post(e,t){this._worker.postMessage(e,t)}forgetOrphaned(e){for(let t of e)this._orphaned.delete(t)}get orphanedRequestCount(){return this._orphaned.size}terminate(){this._terminated||(this._terminated=!0,this._worker.removeEventListener(`message`,this._handle),this._worker.removeEventListener(`messageerror`,this._handleWorkerError),this._worker.removeEventListener(`error`,this._handleWorkerError),this._worker.terminate(),this._rejectAll(Error(`Worker terminated`)),this._orphaned.clear())}};function we(e,t){if(t)try{t();return}catch{}try{e.terminate()}catch{}}function Te(e){return!!e&&typeof e==`object`&&e.kind===`ooxmlDecodeSvg`}function Ee(e,t){return Te(t)?(g(new Blob([t.bytes],{type:`image/svg+xml`}),t).then(n=>{try{e({kind:`ooxmlSvgDecoded`,decodeId:t.decodeId,bitmap:n},[n])}catch{s(n)}}).catch(n=>{try{e({kind:`ooxmlSvgDecodeFailed`,decodeId:t.decodeId,message:n instanceof Error?n.message:String(n)})}catch{}}),!0):!1}var De=1.1,Oe=10,ke=3,Ae=1;function je(e,t){let n;switch(t){case 1:n=e/ke;break;case 2:n=e/Ae;break;default:n=e/Oe}return Math.max(-1,Math.min(1,n))}function Me(e,t,n=0){return e*De**+-je(t,n)}function Ne(e,t,n,r,i){let a=n>0?r/n:1,o=(e+t)*a-t,s=i.maxScroll>0?i.maxScroll:0;return o<0?0:o>s?s:o}var T=Object.freeze([.25,.33,.5,.67,.75,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4]),Pe=.005;function Fe(e){for(let t of T)if(t>e+Pe)return t;return T[T.length-1]}function Ie(e,t=T[0]){for(let t=T.length-1;t>=0;t--){let n=T[t];if(n<e-Pe)return n}return Math.min(t,T[0])}function Le(e,t){let{contentWidth:n,contentHeight:r,containerWidth:i,containerHeight:a}=e;if(n<=0||i<=0)return 0;let o=i/n;if(t===`width`)return o;if(r<=0||a<=0)return 0;let s=a/r;return Math.min(o,s)}function Re(e){let t=e.toLowerCase();if(t.length===e.length)return t;let n=``;for(let t of e){let e=t.toLowerCase();n+=e.length===t.length?e:t}return n}function ze(e){let t=Array(e.length),n=0,r=``;for(let i=0;i<e.length;i++)t[i]=n,r+=e[i].text,n+=e[i].text.length;return{text:r,folded:Re(r),runStart:t,runCount:e.length}}function Be(e,t){let{runStart:n}=e,r=0,i=n.length-1;for(;r<i;){let e=r+i+1>>1;n[e]<=t?r=e:i=e-1}return r}function Ve(e,t,n){let{runStart:r,runCount:i,text:a}=e,o=[],s=Be(e,t),c=t;for(;c<n&&s<i;){let e=s+1<i?r[s+1]:a.length,t=Math.min(n,e),l=c-r[s],u=t-r[s];u>l&&o.push({runIndex:s,start:l,end:u}),c=t,s++}return o}function He(e,t,n={}){if(t.length===0)return[];let r=n.caseSensitive??!1,i=r?e.text:e.folded,a=r?t:Re(t),o=[],s=0,c=0;for(;;){let t=i.indexOf(a,s);if(t===-1)break;o.push({matchIndex:c,slices:Ve(e,t,t+a.length)}),c++,s=t+a.length}return o}function Ue(e,t){return t<=0?-1:e<0?0:(e+1)%t}function We(e,t){return t<=0?-1:e<0?t-1:(e-1+t)%t}function E(e,t){let n=Math.min(e.length,t);if(n>0&&n<e.length){let t=e.charCodeAt(n-1),r=e.charCodeAt(n);t>=55296&&t<=56319&&r>=56320&&r<=57343&&n--}return e.slice(0,n)}var Ge=65536;function Ke(e){let t=e??16384;if(!Number.isFinite(t)||t<0)throw RangeError(`maxTextCharacters must be a finite non-negative number.`);return Math.min(Ge,Math.floor(t))}function qe(e,t){let n=Ke(t),r=[],i=0,a=!1,o=!1,s=(e,t)=>{if(t&&o){if(i>=n)return a=!0,!1;r.push(`
2
+ `),i++}o=!0;let s=E(e,Math.max(0,n-i));return r.push(s),i+=s.length,s.length<e.length?(a=!0,!1):!0};if(!s(`Chart type: ${e.chartType}`,!0)||e.title!==null&&!s(`Title: ${e.title}`,!0))return{text:r.join(``),truncated:a,textCharacters:i,maxTextCharacters:n};if(e.categories.length>0){if(!s(`Categories: `,!0))return{text:r.join(``),truncated:a,textCharacters:i,maxTextCharacters:n};for(let[t,o]of e.categories.entries())if(!s(`${t===0?``:`, `}${o}`,!1))return{text:r.join(``),truncated:a,textCharacters:i,maxTextCharacters:n}}for(let t of e.series){if(!s(`Series ${t.name||`(unnamed)`}: `,!0))break;for(let[e,o]of t.values.entries())if(!s(`${e===0?``:`, `}${o===null?``:o}`,!1))return{text:r.join(``),truncated:a,textCharacters:i,maxTextCharacters:n};if(a)break}return{text:r.join(``),truncated:a,textCharacters:i,maxTextCharacters:n}}var Je=65536,Ye=1024;function Xe(e,t,n){let r=e??t;if(!Number.isFinite(r)||r<0)throw RangeError(`${n} must be a finite non-negative number.`);return Math.min(t,Math.floor(r))}function*Ze(e){let t=e.firstChild??e.childNodes[0]??null;for(;t;)if(t.nodeType===3&&(yield t),t.firstChild)t=t.firstChild;else{for(;t&&t!==e&&!t.nextSibling;)t=t.parentNode;if(!t||t===e)break;t=t.nextSibling}}function Qe(e,t,n,r,i){for(let a of r){let r=!1;try{r=a.intersectsNode(n)}catch{}if(r)for(let r of Ze(n)){let n=r.data,o,s;if(a.startContainer===r)o=a.startOffset;else try{o=a.comparePoint(r,0)===0?0:null}catch{o=null}if(a.endContainer===r)s=a.endOffset;else try{s=a.comparePoint(r,n.length)===0?n.length:null}catch{s=null}if(o===null||s===null||s<=o)continue;let c=i-t;if(c<=0)return t;let l=n.slice(Math.max(0,o),Math.min(n.length,s,Math.max(0,o)+c));if(e.push(l),t+=l.length,t>=i)return t}}return t}function $e(e,t,n,r={}){if(!t||t.isCollapsed||t.rangeCount===0)return null;let i=[...e.matches?.(`[data-ooxml-selection-surface]`)?[e]:[],...e.querySelectorAll(`[data-ooxml-selection-surface]`)];if(i.length===0)return null;let a=e=>i.some(t=>t.contains(e)),o=[];for(let n=0;n<t.rangeCount;n++){let r=t.getRangeAt(n);if(!e.contains(r.startContainer)||!e.contains(r.endContainer)||!a(r.startContainer)||!a(r.endContainer))return null;o.push(r)}let s=Xe(r.maxChars,Je,`maxTextCharacters`),c=Xe(r.maxLocators,Ye,`maxRunLocators`),l=[],u=!1,d=s+2,f=[],p=0;for(let t of e.querySelectorAll(`[data-ooxml-selection-run]`)){if(!o.some(e=>{try{return e.intersectsNode(t)}catch{return!1}}))continue;let e=n(t);if(e!==null&&(l.length>=c?u=!0:l.push(structuredClone(e)),p<d&&(p=Qe(f,p,t,o,d)),u&&p>=d))break}if(l.length===0&&!u)return null;let m=f.join(``);if(m.length===0)return null;let h=E(m,s),g=m.length>s;return{text:h,locators:l,truncated:g||u,truncationReasons:[...g?[`text`]:[],...u?[`runs`]:[]],textCharacters:h.length,maxTextCharacters:s,maxLocators:c}}var et=`position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;user-select:text;-webkit-user-select:text;`,tt=`position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;`,nt=`position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;`;function rt(e,t){if(!t)return null;let n=(e.ownerDocument??document).createElement(`div`);return n.setAttribute(`data-overlay`,`element`),n.style.cssText=nt,e.appendChild(n),n}function it(e,t){if(!e||(e.innerHTML=``,!t||!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(t.width)||!Number.isFinite(t.height)||t.width<=0||t.height<=0))return;let n=(e.ownerDocument??document).createElement(`div`),r=Number.isFinite(t.rotation)?t.rotation??0:0;n.style.cssText=`position:absolute;left:${t.x*100}%;top:${t.y*100}%;width:${t.width*100}%;height:${t.height*100}%;box-sizing:border-box;border:2px solid #1a73e8;background:color-mix(in srgb, #1a73e8 6%, transparent);transform:rotate(${r}deg);transform-origin:center;pointer-events:none;`,e.appendChild(n)}var at=class{textLayer;highlightLayer;elementLayer;constructor(e,t,n=!1){let r=e.ownerDocument??document;this.textLayer=t?r.createElement(`div`):null,this.textLayer&&(this.textLayer.setAttribute(`data-overlay`,`text`),this.textLayer.style.cssText=et,e.appendChild(this.textLayer)),this.highlightLayer=r.createElement(`div`),this.highlightLayer.setAttribute(`data-overlay`,`highlight`),this.highlightLayer.style.cssText=tt,e.appendChild(this.highlightLayer),this.elementLayer=rt(e,n)}},ot=class{message;layer;status;constructor(e,t){this.message=t;let n=e.ownerDocument??document;this.layer=n.createElement(`div`),this.layer.style.cssText=`position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(255,255,255,0.72);pointer-events:none;z-index:4;`,this.layer.setAttribute(`aria-hidden`,`true`),e.appendChild(this.layer),this.status=n.createElement(`div`),this.status.setAttribute(`role`,`status`),this.status.setAttribute(`aria-live`,`polite`),this.status.setAttribute(`aria-atomic`,`true`),this.status.style.cssText=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;pointer-events:none;user-select:none;-webkit-user-select:none;`,e.appendChild(this.status)}setLoading(e){this.layer.style.display=e?`flex`:`none`;let t=e?this.message:``;this.status.textContent!==t&&(this.status.textContent=t)}};function st(e,t,n){if(n&&t!==void 0&&t!==n.mode)throw Error(`${e}: opts.mode='${t}' conflicts with the borrowed engine's mode='${n.mode}'. Omit opts.mode when borrowing an engine — the engine owns its render mode.`);return n?.mode??t??`main`}var ct=class{ownerName;generation=0;resource;ownsResource;closed=!1;constructor(e,t=null,n=!1){this.ownerName=e,this.resource=t,this.ownsResource=t!==null&&n}get current(){return this.resource}async replace(e,t){this.assertOpen();let n=++this.generation,r;try{r=await e()}catch(e){if(this.closed)throw this.closedError();if(n!==this.generation)return null;throw e}if(this.closed)throw this.dispose(r),this.closedError();if(n!==this.generation)return this.dispose(r),null;try{t?.(this.resource)}catch(e){throw this.dispose(r),e}return this.install(r,!0),r}install(e,t=!0){this.assertOpen(),this.generation++;let n=this.resource,r=this.ownsResource;this.resource=e,this.ownsResource=t,r&&n&&this.dispose(n)}close(){if(this.closed)return;this.closed=!0,this.generation++;let e=this.resource,t=this.ownsResource;this.resource=null,this.ownsResource=!1,t&&e&&this.dispose(e)}assertOpen(){if(this.closed)throw this.closedError()}closedError(){return Error(`${this.ownerName} is closed`)}dispose(e){try{e.destroy()}catch{}}},D=class{canvas;generation=0;destroyed=!1;bitmapContext;constructor(e,t){this.canvas=e,this.bitmapContext=t?e.getContext(`bitmaprenderer`):null}begin(){return++this.generation}isCurrent(e){return!this.destroyed&&e===this.generation}commitBitmap(e,t,n={}){if(!this.isCurrent(e))return t.close(),!1;if(!this.bitmapContext)throw t.close(),Error(`bitmaprenderer context not available`);this.canvas.width!==t.width&&(this.canvas.width=t.width),this.canvas.height!==t.height&&(this.canvas.height=t.height),n.cssWidth!==void 0&&(this.canvas.style.width=`${n.cssWidth}px`),n.cssHeight!==void 0&&(this.canvas.style.height=`${n.cssHeight}px`);try{this.bitmapContext.transferFromImageBitmap(t)}catch(e){throw t.close(),e}return!0}commitBitmapTo2d(e,t,n={}){if(!this.isCurrent(e))return t.close(),!1;this.canvas.width!==t.width&&(this.canvas.width=t.width),this.canvas.height!==t.height&&(this.canvas.height=t.height),n.cssWidth!==void 0&&(this.canvas.style.width=`${n.cssWidth}px`),n.cssHeight!==void 0&&(this.canvas.style.height=`${n.cssHeight}px`);let r=this.canvas.getContext(`2d`);if(!r)throw t.close(),Error(`2D context not available`);try{r.drawImage(t,0,0)}finally{t.close()}return!0}destroy(){this.destroyed||(this.destroyed=!0,this.generation++)}},lt=class{viewerName;onError;closed=!1;handled=new WeakSet;backgroundLifecycleOwners=0;constructor(e,t){this.viewerName=e,this.onError=t}report(e){if(this.closed)return;let t=e instanceof Error?e:Error(String(e));this.handled.has(t)||(this.handled.add(t),this.onError?this.onError(t):console.error(`[ooxml] ${this.viewerName} render failed:`,t))}markHandled(e){this.closed||!(e instanceof Error)||this.handled.add(e)}async ownAwaitable(e){try{return await e()}catch(e){throw this.markHandled(e),e}}async ownBackgroundLifecycle(e){this.backgroundLifecycleOwners++;try{return await this.ownAwaitable(e)}finally{this.backgroundLifecycleOwners--}}reportBackground(e,t=!1){let n=e instanceof Error?e:Error(String(e));t||this.backgroundLifecycleOwners>0?this.markHandled(n):this.report(n)}close(){this.closed=!0}},ut=[208,207,17,224,161,177,26,225],dt=4294967290,ft=4294967294,pt=512,mt=128,ht=4e6,gt=8e6,_t=65536,vt=1e6;function yt(e,t){if(e.length<pt)return null;for(let t=0;t<ut.length;t++)if(e[t]!==ut[t])return null;let n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=bt(n);if(r===null)return null;let i=xt(n,e.length,r);if(i===null)return null;let a=St(n,e.length,r,i,t);if(a===null||a.target===null)return null;let{target:o,root:s}=a;return o.size===0?new Uint8Array:o.size<r.miniStreamCutoff?s===null?null:Tt(n,e.length,r,i,s,o):wt(n,e.length,r,i,o.startSector,o.size)}function bt(e){let t=e.getUint16(30,!0);if(t!==9&&t!==12)return null;let n=e.getUint16(32,!0);if(n!==6)return null;let r=1<<t,i=1<<n,a=e.getUint32(56,!0);return{sectorSize:r,numFatSectors:e.getUint32(44,!0),miniSectorSize:i,miniStreamCutoff:a,firstDirSector:e.getUint32(48,!0),firstMiniFatSector:e.getUint32(60,!0),firstDifatSector:e.getUint32(68,!0),numDifatSectors:e.getUint32(72,!0)}}function O(e,t){return(e+1)*t}function k(e){return e>=0&&e<=dt}function xt(e,t,n){let{sectorSize:r}=n,i=[],a=new Set,o=Math.max(0,Math.floor(t/r)-1);if(n.numFatSectors>o||n.numDifatSectors>o||n.numDifatSectors>vt)return null;let s=0,c=e=>s++>=n.numFatSectors?!k(e):!k(e)||e>=o||a.has(e)?!1:(a.add(e),i.push(e),!0);for(let t=0;t<109;t++)if(!c(e.getUint32(76+t*4,!0)))return null;let l=r/4-1,u=n.firstDifatSector,d=new Set,f=0;for(;k(u)&&f<n.numDifatSectors&&(f++,!d.has(u));){d.add(u);let n=O(u,r);if(n<0||n+r>t)return null;for(let t=0;t<l;t++)if(!c(e.getUint32(n+t*4,!0)))return null;u=e.getUint32(n+l*4,!0)}return f!==n.numDifatSectors||k(u)||i.length!==n.numFatSectors?null:i}function A(e,t,n,r,i){let a=n/4,o=Math.floor(i/a),s=i%a;if(o>=r.length)return null;let c=r[o];if(!k(c))return null;let l=O(c,n)+s*4;return l<0||l+4>t?null:e.getUint32(l,!0)}function St(e,t,n,r,i){let{sectorSize:a}=n,o=Math.floor(a/mt);if(o<1)return null;let s=null,c=null,l=new Set,u=n.firstDirSector,d=0,f=0;for(;k(u);){if(d++>ht)return null;if(l.has(u))break;l.add(u);let n=O(u,a);if(n<0||n+a>t)return null;for(let t=0;t<o;t++){if(f++>_t)return{target:s,root:c};let r=n+t*mt,a=e.getUint8(r+66);if(a===0)continue;let o=e.getUint32(r+116,!0),l=e.getUint32(r+120,!0);a===5?c={startSector:o,size:l}:Ct(e,r)===i&&(s={startSector:o,size:l})}let p=A(e,t,a,r,u);if(p===null)break;u=p}return{target:s,root:c}}function Ct(e,t){let n=e.getUint16(t+64,!0);if(n<2||n>64)return``;let r=n/2-1,i=``;for(let n=0;n<r;n++){let r=e.getUint16(t+n*2,!0);if(r===0)break;i+=String.fromCharCode(r)}return i}function wt(e,t,n,r,i,a){let{sectorSize:o}=n,s=new Uint8Array(a),c=0,l=i,u=new Set,d=0;for(;k(l)&&c<a;){if(d++>ht||u.has(l))return null;u.add(l);let n=O(l,o);if(n<0||n+o>t)return null;let i=Math.min(o,a-c);s.set(new Uint8Array(e.buffer,e.byteOffset+n,i),c),c+=i;let f=A(e,t,o,r,l);if(f===null)return null;l=f}return c===a?s:null}function Tt(e,t,n,r,i,a){let{sectorSize:o,miniSectorSize:s}=n,c=wt(e,t,n,r,i.startSector,i.size);if(c===null)return null;let l=new Uint8Array(a.size),u=0,d=a.startSector,f=new Set,p=0,m=o/4;for(;k(d)&&u<a.size;){if(p++>gt||f.has(d))return null;f.add(d);let i=d*s;if(i<0||i+s>c.length)return null;let o=Math.min(s,a.size-u);l.set(c.subarray(i,i+o),u),u+=o;let h=Et(e,t,n,r,m,d);if(h===null)return null;d=h}return u===a.size?l:null}function Et(e,t,n,r,i,a){let{sectorSize:o}=n,s=Math.floor(a/i),c=a%i,l=n.firstMiniFatSector,u=new Set;for(let n=0;n<s;n++){if(!k(l)||u.has(l))return null;u.add(l);let n=A(e,t,o,r,l);if(n===null)return null;l=n}if(!k(l))return null;let d=O(l,o)+c*4;if(d<0||d+4>t)return null;let f=e.getUint32(d,!0);return f===ft?ft:f}var Dt=[208,207,17,224,161,177,26,225],Ot=4294967290,kt=512,At=128,jt=4096,Mt=8192,Nt=new Set([`WordDocument`,`Workbook`,`Book`,`PowerPoint Document`]),Pt=`EncryptionInfo`;function Ft(e){if(e.length<kt)return null;for(let t=0;t<Dt.length;t++)if(e[t]!==Dt[t])return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint16(30,!0);if(n!==9&&n!==12)return`cfb-unknown`;let r=1<<n,i=t.getUint32(48,!0),a={sectorSize:r,numFatSectors:t.getUint32(44,!0),firstDifatSector:t.getUint32(68,!0),numDifatSectors:t.getUint32(72,!0)},o=xt(t,e.length,a);if(o===null)return`cfb-unknown`;let s=It(t,e.length,r,i,o);if(s===null)return`cfb-unknown`;if(s.has(Pt))return`encrypted`;for(let e of s)if(Nt.has(e))return`legacy-binary-format`;return`cfb-unknown`}function It(e,t,n,r,i){if(!zt(r))return null;let a=new Set,o=Math.floor(n/At);if(o<1)return null;let s=new Set,c=r,l=0,u=0;for(;zt(c)&&!(l++>Mt||s.has(c));){s.add(c);let r=Rt(c,n);if(r<0||r+n>t)return null;for(let t=0;t<o;t++){if(u++>jt)return a;let n=Lt(e,r+t*At);n&&a.add(n)}let l=A(e,t,n,i,c);if(l===null)break;c=l}return a}function Lt(e,t){let n=e.getUint16(t+64,!0);if(n<2||n>64)return``;let r=n/2-1,i=``;for(let n=0;n<r;n++){let r=e.getUint16(t+n*2,!0);if(r===0)break;i+=String.fromCharCode(r)}return i}function Rt(e,t){return(e+1)*t}function zt(e){return e>=0&&e<=Ot}function j(e){if(typeof atob==`function`){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}let t=globalThis.Buffer;if(t)return new Uint8Array(t.from(e,`base64`));throw Error(`no base64 decoder available`)}function M(e,t,n){let r=RegExp(`<(?:[\\w]+:)?${t}\\b[^>]*>`).exec(e);if(!r)return null;let i=r[0],a=RegExp(`\\b${n}\\s*=\\s*"([^"]*)"`).exec(i);return a?a[1]:null}function N(e){if(e===null)return null;let t=Number(e);return Number.isFinite(t)?t:null}function Bt(e,t){let n=N(M(e,t,`saltSize`)),r=N(M(e,t,`blockSize`)),i=N(M(e,t,`keyBits`)),a=N(M(e,t,`hashSize`)),o=M(e,t,`cipherAlgorithm`),s=M(e,t,`cipherChaining`),c=M(e,t,`hashAlgorithm`),l=M(e,t,`saltValue`);return n===null||r===null||i===null||a===null||!o||!s||!c||l===null?null:{saltSize:n,blockSize:r,keyBits:i,hashSize:a,cipherAlgorithm:o,cipherChaining:s,hashAlgorithm:c,saltValue:j(l)}}function Vt(e){if(e.length<8)return{kind:`unknown`};let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint16(0,!0),r=t.getUint16(2,!0);if(n===4&&r===4){let t=Ht(e.subarray(8));return t?{kind:`agile`,descriptor:t}:{kind:`unknown`}}return r===16&&(n===3||n===4)?{kind:`extensible`}:r===2&&(n===2||n===3||n===4)?{kind:`standard`}:{kind:`unknown`}}function Ht(e){let t=new TextDecoder(`utf-8`).decode(e),n=Bt(t,`keyData`),r=Bt(t,`encryptedKey`);if(!n||!r)return null;let i=N(M(t,`encryptedKey`,`spinCount`)),a=M(t,`encryptedKey`,`encryptedVerifierHashInput`),o=M(t,`encryptedKey`,`encryptedVerifierHashValue`),s=M(t,`encryptedKey`,`encryptedKeyValue`);if(i===null||a===null||o===null||s===null)return null;let c={...r,spinCount:i,encryptedVerifierHashInput:j(a),encryptedVerifierHashValue:j(o),encryptedKeyValue:j(s)},l=null,u=M(t,`dataIntegrity`,`encryptedHmacKey`),d=M(t,`dataIntegrity`,`encryptedHmacValue`);return u!==null&&d!==null&&(l={encryptedHmacKey:j(u),encryptedHmacValue:j(d)}),{keyData:n,passwordKeyEncryptor:c,dataIntegrity:l}}var Ut={verifierHashInput:new Uint8Array([254,167,210,118,59,75,158,121]),verifierHashValue:new Uint8Array([215,170,15,109,48,97,52,78]),keyValue:new Uint8Array([20,110,11,231,171,172,208,214]),hmacKey:new Uint8Array([95,178,173,1,12,185,225,246]),hmacValue:new Uint8Array([160,103,127,2,178,44,132,51])},Wt=54,Gt=4096,P=class extends Error{reason;constructor(e,t){super(t),this.name=`AgileDecryptError`,this.reason=e}};function F(){let e=globalThis.crypto;if(!e||!e.subtle)throw new P(`unsupported-encryption`,`WebCrypto (globalThis.crypto.subtle) is unavailable; cannot decrypt.`);return e.subtle}function Kt(e){switch(e.toUpperCase().replace(/[-_]/g,``)){case`SHA512`:return`SHA-512`;case`SHA384`:return`SHA-384`;case`SHA256`:return`SHA-256`;case`SHA1`:return`SHA-1`;default:throw new P(`unsupported-encryption`,`Unsupported hashAlgorithm "${e}" (only SHA-1/256/384/512).`)}}function I(e){if(e.cipherAlgorithm.toUpperCase()!==`AES`)throw new P(`unsupported-encryption`,`Unsupported cipherAlgorithm "${e.cipherAlgorithm}" (only AES).`);if(e.cipherChaining.toLowerCase()!==`chainingmodecbc`)throw new P(`unsupported-encryption`,`Unsupported cipherChaining "${e.cipherChaining}" (only ChainingModeCBC).`);if(e.keyBits!==128&&e.keyBits!==192&&e.keyBits!==256)throw new P(`unsupported-encryption`,`Unsupported keyBits ${e.keyBits} (only 128/192/256).`)}function L(...e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function qt(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}function Jt(e){let t=new Uint8Array(e.length*2),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setUint16(t*2,e.charCodeAt(t),!0);return t}async function R(e,t){return new Uint8Array(await F().digest(e,t))}function Yt(e,t){if(e.length>t)return e.slice(0,t);let n=new Uint8Array(t);return n.set(e),e.length<t&&n.fill(Wt,e.length),n}async function Xt(e,t,n,r){let i=Kt(t.hashAlgorithm),a=await R(i,L(t.saltValue,Jt(e)));for(let e=0;e<n;e++)a=await R(i,L(qt(e),a));return Yt(await R(i,L(a,r)),t.keyBits/8)}async function z(e,t,n){return Yt(n?await R(Kt(e.hashAlgorithm),L(t,n)):t,e.blockSize)}async function B(e,t,n){let r=t.length;if(n.length===0)return new Uint8Array;if(n.length%r!==0)throw new P(`corrupt`,`ciphertext length is not a multiple of the block size`);let i=await F().importKey(`raw`,e,{name:`AES-CBC`},!1,[`decrypt`]),a=await F().importKey(`raw`,e,{name:`AES-CBC`},!1,[`encrypt`]),o=n.subarray(n.length-r),s=Zt(new Uint8Array(r).fill(r),o),c=L(n,new Uint8Array(await F().encrypt({name:`AES-CBC`,iv:new Uint8Array(r)},a,s)).subarray(0,r)),l=new Uint8Array(await F().decrypt({name:`AES-CBC`,iv:t},i,c));return l.length>=n.length?l.subarray(0,n.length):l}function Zt(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}async function Qt(e,t){I(t);let n=Kt(t.hashAlgorithm),r=await B(await Xt(e,t,t.spinCount,Ut.verifierHashInput),await z(t,t.saltValue,null),t.encryptedVerifierHashInput),i=await B(await Xt(e,t,t.spinCount,Ut.verifierHashValue),await z(t,t.saltValue,null),t.encryptedVerifierHashValue);return $t((await R(n,r)).subarray(0,t.hashSize),i.subarray(0,t.hashSize))}function $t(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}async function en(e,t){return await B(await Xt(e,t,t.spinCount,Ut.keyValue),await z(t,t.saltValue,null),t.encryptedKeyValue)}async function tn(e,t,n){if(I(t),e.length<8)throw new P(`corrupt`,`EncryptedPackage is shorter than its size prefix`);let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=Number(r.getBigUint64(0,!0)),a=e.subarray(8);if(i>a.length)throw new P(`corrupt`,`EncryptedPackage size prefix exceeds the ciphertext`);let o=n.slice(0,t.keyBits/8),s=new Uint8Array(i),c=0,l=0;for(let e=0;e<a.length;e+=Gt){let n=a.subarray(e,e+Gt),r=await B(o,await z(t,t.saltValue,qt(l)),n),u=Math.min(r.length,i-c);if(s.set(r.subarray(0,u),c),c+=u,l++,c>=i)break}if(c!==i)throw new P(`corrupt`,`decrypted output is shorter than the declared size`);return s}async function nn(e,t,n){let{keyData:r,passwordKeyEncryptor:i}=e;if(I(r),I(i),!await Qt(n,i))throw new P(`invalid-password`,`The supplied password is incorrect.`);return tn(t,r,await en(n,i))}var rn=`EncryptionInfo`,an=`EncryptedPackage`;async function on(e,t){let n=yt(e,rn),r=yt(e,an);if(n===null||r===null)return{ok:!1,reason:`corrupt`};let i=Vt(n);if(i.kind!==`agile`)return{ok:!1,reason:`unsupported-encryption`};try{return{ok:!0,data:await nn(i.descriptor,r,t)}}catch(e){return e instanceof P?{ok:!1,reason:e.reason}:{ok:!1,reason:`corrupt`}}}function sn(e){let n=Ft(e instanceof Uint8Array?e:new Uint8Array(e));if(n!==null)switch(n){case`encrypted`:throw new t(`encrypted`,`This file is password-protected (MS-OFFCRYPTO). Pass LoadOptions.password to decrypt it.`);case`legacy-binary-format`:throw new t(`legacy-binary-format`,`This is a legacy binary Office file (.doc/.xls/.ppt), not OOXML.`);case`cfb-unknown`:throw new t(`not-ooxml`,`This file is an OLE2/Compound File container, not an OOXML (ZIP) document.`);default:throw new t(`not-ooxml`,`This file is an OLE2/Compound File container of an unrecognised kind, not an OOXML (ZIP) document.`)}}async function cn(e,n){let r=e instanceof Uint8Array?e:new Uint8Array(e),i=Ft(r);if(i===null)return r;if(i===`encrypted`){if(n===void 0)throw new t(`encrypted`,`This file is password-protected (MS-OFFCRYPTO). Pass LoadOptions.password to decrypt it.`);let e=await on(r,n);if(e.ok)return e.data;switch(e.reason){case`invalid-password`:throw new t(`invalid-password`,`The supplied password is incorrect.`);case`unsupported-encryption`:throw new t(`unsupported-encryption`,`This file uses an encryption scheme other than Agile ([MS-OFFCRYPTO]) that is not supported (Standard / Extensible / legacy binary encryption).`);case`corrupt`:throw new t(`not-ooxml`,`This file is an encrypted OLE2/Compound File container but its structure could not be read.`);default:throw e.reason,new t(`not-ooxml`,`This encrypted file could not be decrypted.`)}}return sn(r),r}function ln(e){if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer)return e.buffer;let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function un(e,t=p){return e.byteLength>0&&e.byteLength<=t}function dn(e,t){let n=fn(t),r=e.slice(),i=Math.min(32,r.length);for(let e=0;e<i;e++)r[e]^=n[e%16];return r}function fn(e){let t=e.replace(/[{}\-\s]/g,``);if(t.length!==32||/[^0-9a-fA-F]/.test(t))throw Error(`invalid fontKey GUID: ${e}`);let n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n.reverse()}function pn(e,t,n,r){let i=2166136261;for(let e=0;e<r.length;e++)i^=r[e],i=Math.imul(i,16777619);return`${e}|${t}|${n}|${r.length}|${(i>>>0).toString(16)}`}async function mn(e,t=p){let n=h();if(!n||typeof FontFace>`u`)return[];let r=[],i=new Set,a=[];for(let o of e)try{if(!un(o.bytes,t)){a.push(o.family);continue}let e=o.odttf?dn(o.bytes,o.fontKey??``):o.bytes,s=`embedded:${pn(o.family,o.weight,o.style,e)}`;if(i.has(s))continue;i.add(s);let{face:c}=C(s,n,()=>{let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),r=new FontFace(o.family,t,{weight:o.weight,style:o.style});return n.add(r),r});r.push(c)}catch{a.push(o.family)}let o=r;if(r.length>0){let e=await x(Promise.allSettled(r.map(e=>Promise.resolve().then(()=>e.load()))));Array.isArray(e)?(o=[],e.forEach((e,t)=>{let n=r[t];e.status===`fulfilled`?o.push(n):(a.push(n.family),v([n]))})):(a.push(...r.map(e=>e.family)),v(r),o=[])}return a.length>0&&console.warn(`[ooxml] failed to register embedded font(s): ${[...new Set(a)].join(`, `)}; falling back to substitute fonts (text may shift or differ).`),o}function V(e){v(e)}function H(e,t,n){return e<t?t:e>n?n:e}function hn(e,t){return Math.min(Math.max(0,t),Math.ceil(Math.max(0,e)))}function gn(e,t,n,r,i,a,o){if(e===0)return{start:0,end:-1,topIndex:0,totalHeight:0};let s=o?.leading??0,c=o?.trailing??0,l=t+n,u=H(r<s?0:l>0?Math.floor((r-s)/l):e-1,0,e-1),d=r+i,f=H(d<=s?0:l>0?Math.ceil((d-s)/l)-1:e-1,0,e-1);return{start:H(u-a,0,e-1),end:H(f+a,0,e-1),topIndex:u,totalHeight:s+e*t+(e-1)*n+c}}function _n(e,t,n,r){let i=t<=0?0:r(e.slice(0,t)),a=n>=e.length?r(e):r(e.slice(0,n));return{x:i,width:Math.max(0,a-i)}}function U(e,t){return t>0?`${e/t*100}%`:`0%`}function W(e,t,n){e.dataset?n===void 0?delete e.dataset[t]:e.dataset[t]=n:n!==void 0&&e.setAttribute?.(`data-${t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`,n)}function vn(e){if(e===void 0||!/^\d+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null}var yn=class{_count;_collectRuns;_location;_acceptMatch;_includeUnit;_runs=new Map;_matches=[];_active=-1;_generation=0;_runsRevision=0;constructor(e,t,n,r=()=>!0,i=()=>!0){this._count=e,this._collectRuns=t,this._location=n,this._acceptMatch=r,this._includeUnit=i}invalidate(){this._generation++,this._runsRevision++,this._runs.clear(),this._matches=[],this._active=-1}unitRuns(e){return this._runs.get(e)}setUnitRuns(e,t){this._runsRevision++,this._runs.set(e,t)}unitHighlights(e){let t=[];for(let n=0;n<this._matches.length;n++){let r=this._matches[n];r.unit===e&&t.push({slices:r.slices,active:n===this._active})}return t}activeUnit(){return this._matches[this._active]?.unit??null}matches(){return this._matches.map((e,t)=>({matchIndex:t,text:e.text,location:this._location(e.unit)}))}async find(e,t={}){let n=++this._generation;if(e.length===0)return this._runsRevision++,this._runs.clear(),this._matches=[],this._active=-1,[];let r=this._runsRevision,i=new Map(this._runs),a=this._count(),o=[];for(let e=0;e<a;e++)o.push(this._includeUnit(e));for(let e=0;e<a;e++){if(!o[e])continue;let t=i.get(e);if(!t){try{t=await this._collectRuns(e)}catch(e){if(n!==this._generation)return[];throw e}if(n!==this._generation)return[];i.set(e,t)}}if(n!==this._generation)return[];let s=r===this._runsRevision?i:new Map([...i,...this._runs]),c=[];for(let n=0;n<a;n++){if(!o[n])continue;let r=s.get(n)??[];for(let i of He(ze(r),e,t)){if(!this._acceptMatch(r,i.slices))continue;let e=i.slices.map(e=>r[e.runIndex].text.slice(e.start,e.end)).join(``);c.push({unit:n,text:e,slices:i.slices})}}return this._runsRevision++,this._runs=s,this._matches=c,this._active=-1,this.matches()}next(){return this._active=Ue(this._active,this._matches.length),this._activePublic()}prev(){return this._active=We(this._active,this._matches.length),this._activePublic()}_activePublic(){let e=this._matches[this._active];return e?{matchIndex:this._active,text:e.text,location:this._location(e.unit)}:null}},bn=class{state=Object.freeze({status:`complete`});get complete(){return this.state.status===`complete`}get settled(){return this.state.status!==`pending`}begin(){this.state=Object.freeze({status:`pending`})}succeed(){this.state=Object.freeze({status:`complete`})}fail(e){let t=e instanceof Error?e:Error(String(e));return this.state=Object.freeze({status:`failed`,error:t}),t}throwIfFailed(){if(this.state.status===`failed`)throw this.state.error}},xn=class{failed=new WeakMap;notify(e,t,...n){if(t&&!this.failed.get(t)?.has(e))try{let r=t(...n);r&&typeof r.then==`function`&&Promise.resolve(r).catch(n=>this.reportOnce(e,t,n))}catch(n){this.reportOnce(e,t,n)}}reportOnce(e,t,n){let r=this.failed.get(t)??new Set;if(r.has(e))return;r.add(e),this.failed.has(t)||this.failed.set(t,r);let i=n instanceof Error?n:Error(String(n));console.error(`[ooxml] ${e} callback failed and was disabled:`,i)}};function Sn(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var Cn=65536;function wn(e){if(e!==void 0&&(!Number.isFinite(e)||e<0))throw RangeError(`maxTextCharacters must be a finite non-negative number.`);return Math.min(Cn,Math.floor(e??65536))}function Tn(e,t,n){let r=wn(n),i=0,a=!1,o=e=>{let t=E(e.text,Math.max(0,r-i));return i+=t.length,t.length<e.text.length&&(a=!0),{...e,text:t}},s=Object.freeze({root:Object.freeze(o(e)),replies:Object.freeze(t.map(e=>Object.freeze(o(e))))});return Object.freeze({thread:s,truncated:a,textCharacters:i,maxTextCharacters:r})}function En(e,t){return e.dataset?.[t]!==void 0}function Dn(e,t,n){let r=typeof e.composedPath==`function`?e.composedPath():[];if(r.length>0){let e=!1;for(let i of r){if(i===t)return e;En(i,n)&&(e=!0)}}let i=e.target;if(!i||!t.contains(i))return!1;let a=i;for(;a;){if(En(a,n))return!0;if(a===t)break;a=a.parentElement}return!1}var On=class{wrapper;scrollHost;spacer;onScroll;onPointerDown;constructor(e,t){let n=e.ownerDocument??document;this.wrapper=n.createElement(`div`),this.wrapper.style.cssText=`position:relative;width:100%;height:100%;overflow:hidden;`,this.scrollHost=n.createElement(`div`),this.scrollHost.style.cssText=`position:absolute;inset:0;overflow:auto;`,this.scrollHost.style.scrollbarGutter=`stable`,t.background&&(this.scrollHost.style.background=t.background),this.spacer=n.createElement(`div`),this.spacer.style.cssText=`position:absolute;top:0;left:0;width:1px;height:0;pointer-events:none;`,this.scrollHost.appendChild(this.spacer),this.wrapper.appendChild(this.scrollHost),e.appendChild(this.wrapper),this.onScroll=t.onScroll,this.scrollHost.addEventListener(`scroll`,this.onScroll),this.onPointerDown=t.comments?e=>{Dn(e,this.wrapper,`ooxmlCommentId`)||t.onOutsideComment()}:null,this.onPointerDown&&n.addEventListener(`pointerdown`,this.onPointerDown)}destroy(){this.scrollHost.removeEventListener(`scroll`,this.onScroll),this.onPointerDown&&this.wrapper.ownerDocument.removeEventListener(`pointerdown`,this.onPointerDown),this.wrapper.remove()}},kn=class{hooks;measureContext;constructor(e){this.hooks=e}redrawAll(){for(let[e,t]of this.hooks.slots())this.redrawSlot(e,t)}redrawSlot(e,t){let n=this.hooks.active()?this.hooks.runs(e):void 0;n?this.hooks.paint(e,t,n,e=>this.measure(e)):t.highlightLayer.innerHTML=``}refreshRuns(e,t){this.hooks.active()&&this.hooks.setRuns(e,t)}async activate(e){return e&&this.hooks.reveal(this.hooks.unitOf(e.location)),this.redrawAll(),e}measure(e){if(this.measureContext===void 0){let e=document.createElement(`canvas`);this.measureContext=e.getContext(`2d`)}let t=this.measureContext;return!t||typeof t.measureText!=`function`?e=>e.length:(t.font=e,e=>t.measureText(e).width)}destroy(){this.measureContext=void 0}},An=class{hooks;constructor(e){this.hooks=e}async render(e,t,n,r,i,a=this.hooks.nextToken(t),o=t.dispatcher,s=o.begin(),c=!0){let l=this.hooks.inFlight();if(l.has(e)||this.hooks.slots().get(e)!==t)return;let u=this.hooks.epoch(),d=t.canvas;l.add(e);let f=!1,p=[],m=this.hooks.wantRuns(t);try{let c=await this.hooks.render(e,d,n,r,m?e=>p.push(e):void 0);if(!this.isCurrent(e,t,a,o,s,d,u)){c.close();return}if(!this.hooks.commitBitmap(e,t,o,s,c,n))return;t.renderedScale=i,this.hooks.commitRuns(e,t,p,n,m),f=!0}catch(n){if(this.isCurrent(e,t,a,o,s,d,u)){if(c)this.hooks.reportError(n);else throw n}}finally{l.delete(e);let n=this.hooks.slots().get(e);if(!f&&n&&this.hooks.canRetry(n)&&(n!==t||u!==this.hooks.epoch()||a!==this.hooks.token(n)||!o.isCurrent(s))&&!l.has(e)&&!this.hooks.destroyed()){let t=n.dispatcher;await this.render(e,n,this.hooks.width(e),this.hooks.dpr(),this.hooks.scale(),this.hooks.nextToken(n),t,t.begin(),c)}}}isCurrent(e,t,n,r,i,a,o){return n===this.hooks.token(t)&&r.isCurrent(i)&&a===t.canvas&&o===this.hooks.epoch()&&this.hooks.slots().get(e)===t&&this.hooks.slotIndex(t)===e}},jn=class{hooks;constructor(e){this.hooks=e}render(e,t,n,r,i,a,o,s){let c=this.hooks.epoch(),l=this.hooks.scale(),u=t.canvas,d=[],f=this.hooks.wantRuns(t),p;try{p=this.hooks.render(e,u,n,r,f?e=>d.push(e):void 0,!1)}catch(e){return s?(this.hooks.reportError(e),Promise.resolve()):Promise.reject(e)}return p.then(()=>{this.isCurrent(e,t,i,a,o,u,c)&&(t.renderedScale=l,this.hooks.commitRuns(e,t,d,u,n,f,!1))}).catch(n=>{if(this.isCurrent(e,t,i,a,o,u,c)){if(s)this.hooks.reportError(n);else throw n}})}settle(e,t,n,r){let i=this.hooks.scale(),a=this.hooks.epoch(),o=document.createElement(`canvas`);o.style.cssText=`display:block;background:#fff;`;let s=this.hooks.shadow();s!==!1&&(o.style.boxShadow=s);let c=this.hooks.nextToken(t),l=new D(o,!1),u=l.begin(),d=[],f=this.hooks.wantRuns(t),p;try{p=this.hooks.render(e,o,n,r,f?e=>d.push(e):void 0,!0)}catch(n){this.isCurrent(e,t,c,l,u,o,a,!0)&&this.hooks.reportError(n),l.destroy();return}p.then(()=>{if(!this.isCurrent(e,t,c,l,u,o,a,!0)){l.destroy();return}let r=t.canvas;t.dispatcher.destroy(),t.wrapper.insertBefore(o,r),r.remove(),t.canvas=o,t.dispatcher=l,t.renderedScale=i,this.hooks.commitRuns(e,t,d,o,n,f,!0)}).catch(n=>{this.isCurrent(e,t,c,l,u,o,a,!0)&&this.hooks.reportError(n),l.destroy()})}isCurrent(e,t,n,r,i,a,o,s=!1){return n===this.hooks.token(t)&&r.isCurrent(i)&&(s||a===t.canvas)&&o===this.hooks.epoch()&&this.hooks.slots().get(e)===t&&this.hooks.slotIndex(t)===e}},Mn=class{hooks;slots=new Map;free=[];inFlight=new Set;lastRange=null;renderEpoch=0;_settleTimer=null;_destroyed=!1;constructor(e){this.hooks=e}syncSpacer(){let e=this.hooks.range();this.lastRange=e,this.hooks.spacer().style.height=`${e.totalHeight}px`,this.hooks.syncSpacerWidth()}acquireSlot(){let e=this.free.pop();return e?(this.hooks.attachSlot(e),e):this.hooks.createSlot()}recycleSlot(e,t){this.slots.delete(e),this.hooks.resetSlot(e,t),this.free.push(t)}mount(e,t=!0){if(this._destroyed||this.hooks.count()===0)return;let n=this.hooks.range();this.lastRange=n;for(let[e,t]of[...this.slots])(e<n.start||e>n.end)&&this.recycleSlot(e,t);for(let r=n.start;r<=n.end;r++){let i=this.slots.get(r);if(i){if(!t)continue;this.hooks.positionSlot(r,i,n);let a=this.hooks.onExistingSlot?.(r,i,e===void 0);e&&a&&e.push(a);continue}let a=this.acquireSlot();this.hooks.positionSlot(r,a,n),this.slots.set(r,a),this.hooks.onNewSlot?.(r,a);let o=this.hooks.renderSlot(r,a,e===void 0);e&&o&&(this.hooks.awaitInitialRender?.(r)??!0)&&e.push(o)}this.hooks.afterMount?.(n),this.hooks.onRange(n)}preview(){if(this._destroyed||this.hooks.count()===0)return;let e=this.hooks.range();this.lastRange=e;for(let[t,n]of[...this.slots])(t<e.start||t>e.end)&&this.recycleSlot(t,n);for(let t=e.start;t<=e.end;t++){let n=this.slots.get(t);if(n){this.hooks.previewSlot(t,n,e);continue}let r=this.acquireSlot();this.hooks.positionSlot(t,r,e),this.slots.set(t,r),this.hooks.onNewSlot?.(t,r),this.hooks.renderSlot(t,r,!0)}this.hooks.afterMount?.(e),this.hooks.onRange(e)}scheduleSettle(e){this._settleTimer!==null&&clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>{this._settleTimer=null,this.settle()},e)}settle(){if(!(this._destroyed||this.hooks.count()===0))for(let[e,t]of[...this.slots])this.hooks.renderedScale(t)!==this.hooks.scale()&&(this.hooks.shouldSettle&&!this.hooks.shouldSettle(e,t)||this.hooks.settleSlot(e,t))}destroy(){if(!this._destroyed){this._destroyed=!0,this._settleTimer!==null&&clearTimeout(this._settleTimer),this._settleTimer=null;for(let[e,t]of[...this.slots])this.recycleSlot(e,t);this.inFlight.clear(),this.free.length=0}}};function Nn(e){e.style.transform=``,e.style.transformOrigin=``,e.style.width=`100%`,e.style.height=`100%`}function Pn(e,t,n){let r=e.ownerDocument,i=r.createElement(`div`);i.style.cssText=`position:absolute;`;let a=r.createElement(`canvas`);a.style.cssText=`display:block;background:#fff;`,n!==!1&&(a.style.boxShadow=n),i.appendChild(a);let{textLayer:o,highlightLayer:s}=new at(i,t);return{wrapper:i,canvas:a,textLayer:o,highlightLayer:s}}function Fn(e,t,n,r){if(e.canvas.style.width=`${t}px`,e.canvas.style.height=`${n}px`,e.renderedScale<=0)return null;let i=r/e.renderedScale;return e.textLayer&&(e.textLayer.style.transformOrigin=`0 0`,e.textLayer.style.width=`${t/i}px`,e.textLayer.style.height=`${n/i}px`,e.textLayer.style.transform=`scale(${i})`),i}function In(e){e.textLayer&&(e.textLayer.innerHTML=``,Nn(e.textLayer)),e.highlightLayer.innerHTML=``,e.highlightLayer.style.transform=``,e.highlightLayer.style.transformOrigin=``}function Ln(e,t,n,r,i){if(!t)return{markerLayer:null,margin:null,decorationLayer:null};let a=e.ownerDocument,o=a.createElement(`div`);if(o.setAttribute(`data-overlay`,`comment-marker`),o.style.cssText=`position:absolute;inset:0;overflow:hidden;pointer-events:none;`,e.appendChild(o),!n)return{markerLayer:o,margin:null,decorationLayer:null};let s=a.createElement(`div`);s.style.cssText=`position:absolute;top:0;height:100%;box-sizing:border-box;overflow-x:hidden;overflow-y:auto;pointer-events:auto;`,i(s);let c=null;return r&&(c=a.createElement(`div`),c.style.cssText=`position:absolute;top:0;left:0;overflow:visible;pointer-events:none;`,e.appendChild(c)),e.appendChild(s),{markerLayer:o,margin:s,decorationLayer:c}}var Rn=class{hooks;constructor(e){this.hooks=e}position(e,t,n,r,i,a,o){if(t.wrapper.style.top=`${n}px`,t.wrapper.style.width=`${r}px`,t.wrapper.style.height=`${i}px`,this.hooks.syncMargin(t.commentMargin),t.commentDecorationLayer){let e=this.hooks.marginExtent();t.commentDecorationLayer.style.left=this.hooks.marginSide()===`left`?`${-e}px`:`0px`,t.commentDecorationLayer.style.width=`${r+e}px`,t.commentDecorationLayer.style.height=`${i}px`}this.hooks.redrawOutline(e,t);let s=Math.max(o,(a-r)/2);t.wrapper.style.left=this.hooks.marginSide()===`left`&&this.hooks.commentsEnabled()?`calc(${s}px + var(--ooxml-review-origin-x, 0px))`:`${s}px`}preview(e,t,n,r){let i=Fn(e,t,n,r),a=this.hooks.markerLayer(e);if(i!==null){e.commentMargin&&this.hooks.previewMargin(e.commentMargin,i);for(let e of a?.children??[])e.dataset.ooxmlCommentMarker!==void 0&&(e.style.transform=`translate(-50%,-50%) scale(${this.hooks.markerRatio(i)})`)}let o=i===null?`hidden`:``;a&&(a.style.visibility=o),e.commentMargin&&(e.commentMargin.style.visibility=o),e.commentDecorationLayer&&(e.commentDecorationLayer.style.visibility=o)}reset(e){In(e);let t=this.hooks.markerLayer(e);t&&(t.replaceChildren(),this.hooks.resetMarkerTransform()&&(t.style.transform=``,t.style.transformOrigin=``),t.style.visibility=``),e.commentMargin&&(this.hooks.disposeMargin(e.commentMargin),e.commentMargin.style.visibility=``),e.commentDecorationLayer&&(this.hooks.disposeDecoration(e.commentDecorationLayer),this.hooks.resetDecorationVisibility()&&(e.commentDecorationLayer.style.visibility=``)),it(e.elementLayer,null)}},zn=class{hooks;constructor(e){this.hooks=e}scrollToUnit(e,t){if(this.hooks.count()===0||!this.hooks.established())return;let n=Math.max(0,Math.min(e,this.hooks.count()-1)),r=this.hooks.host(),i=Math.max(0,this.hooks.totalHeight()-r.clientHeight),a=hn(this.hooks.offset(n),i);typeof r.scrollTo==`function`?r.scrollTo({top:a,behavior:t?.behavior??`auto`}):r.scrollTop=a,this.hooks.mount()}scrollToPoint(e,t,n,r){let i=this.hooks.host(),a=Math.max(this.hooks.padLeft(),(i.clientWidth-this.hooks.width(e))/2)+this.hooks.marginOrigin(),o=Math.max(0,this.hooks.totalHeight()-i.clientHeight),s=this.hooks.spacer(),c=s.offsetWidth||Number.parseFloat(s.style.width)||0,l=Math.max(0,c-i.clientWidth),u=Math.min(o,Math.max(0,this.hooks.offset(e)+n-i.clientHeight/2)),d=Math.min(l,Math.max(0,a+t-i.clientWidth/2));typeof i.scrollTo==`function`?i.scrollTo({top:u,left:d,behavior:r?.behavior??`auto`}):(i.scrollTop=u,i.scrollLeft=d),this.hooks.mount()}contentAtViewportY(e){let t=this.hooks.host().scrollTop+e,n=this.hooks.indexAt(t),r=this.hooks.height(n);return{unit:n,frac:r>0?Math.min(1,Math.max(0,(t-this.hooks.offset(n))/r)):0}}viewportYOf(e,t){return this.hooks.offset(e)+t*this.hooks.height(e)-this.hooks.host().scrollTop}},Bn=class{hooks;constructor(e){this.hooks=e}gap(){return this.hooks.options().gap??16}overscan(){return this.hooks.options().overscan??1}verticalPadding(){let e=this.hooks.options(),t=this.gap();return{leading:e.paddingTop??t,trailing:e.paddingBottom??t}}horizontalPadding(){let e=this.hooks.options(),t=this.gap();return{left:e.paddingLeft??t,right:e.paddingRight??t}}fitWidth(){let e=this.hooks.options().width;if(e&&e>0)return e;let t=this.hooks.scrollHost().clientWidth||this.hooks.container().clientWidth;if(t<=0)return 0;let{left:n,right:r}=this.horizontalPadding();return Math.max(0,t-n-r)}dpr(){return this.hooks.options().dpr??u()}},Vn=class{notify;lastIndex=-1;lastTotal=-1;lastComplete=null;constructor(e){this.notify=e}publish(e,t,n){e.topIndex===this.lastIndex&&t===this.lastTotal&&n===this.lastComplete||(this.lastIndex=e.topIndex,this.lastTotal=t,this.lastComplete=n,this.notify(e.topIndex,t,n))}reset(){this.lastIndex=-1,this.lastTotal=-1,this.lastComplete=null}resetIndex(){this.lastIndex=-1}},Hn=class{hooks;constructor(e){this.hooks=e}async load(e){let t=this.hooks.name();if(this.hooks.destroyed())throw Error(`${t} is destroyed`);if(this.hooks.borrowed())throw Error(this.hooks.borrowedMessage());let n=this.hooks.beginLoad?.(),r=!1;try{let i=await this.hooks.owner().replace(()=>this.hooks.acquire(e,n),e=>{this.hooks.beforeReplace(e),r=!0});if(!i)return;if(this.hooks.destroyed())throw Error(`${t} is destroyed`);if(this.hooks.isCurrentLoad&&!this.hooks.isCurrentLoad(n)||(this.hooks.afterReplace(i,n),await this.hooks.mountOpeningWindow(),this.hooks.isCurrentLoad&&!this.hooks.isCurrentLoad(n)))return}catch(e){if(this.hooks.destroyed())throw Error(`${t} is destroyed`);if(this.hooks.isCurrentLoad&&!this.hooks.isCurrentLoad(n))return;throw e instanceof Error?e:Error(String(e))}finally{this.hooks.finishLoad?.(n)}r&&!this.hooks.destroyed()&&this.hooks.selectionChanged()}},Un=class{hooks;_originPx=0;constructor(e){this.hooks=e}enabled(){return this.hooks.enabled()}zoom(){return this.hooks.zoom()}get originPx(){return this._originPx}hasMargin(){return this.hooks.enabled()&&this.hooks.cards()&&this.hooks.hasDisplayableComments()}side(){let e=this.hooks.requestedSide();if(e===`left`||e===`right`)return e;let t=this.hooks.container();return(t.ownerDocument.defaultView?.getComputedStyle?.(t).direction||t.dir||t.style.direction)===`rtl`?`left`:`right`}extent(){return this.hasMargin()?(this.hooks.gapPx+this.hooks.widthPx)*this.hooks.zoom():0}syncMargin(e){if(!e)return;e.style.display=this.hasMargin()?``:`none`;let t=this.hooks.zoom(),n=`calc(100% + ${this.hooks.gapPx*t}px)`;e.style.left=this.side()===`right`?n:``,e.style.right=this.side()===`left`?n:``,e.style.width=`${this.hooks.widthPx*t}px`,e.style.fontSize=`${this.hooks.fontSizePx}px`,e.dataset.ooxmlCommentZoom=String(t)}syncSpacerWidth(e,t,n){let r=this.extent(),i=this.side()===`left`?r:0,a=i-this._originPx,o=this.hooks.scrollHost(),s=Math.max(0,o.scrollLeft+a);this.hooks.spacer().style.width=`${e+r+t+n}px`,a!==0&&(this._originPx=i,o.style[`--ooxml-review-origin-x`]=`${i}px`,o.scrollLeft=s)}destroy(){this._originPx=0}},Wn=class{hooks;scale=1;established=!1;pendingScale=null;pendingAnchor=null;prevBase=0;lastFitWidth=0;_wheelListener=null;_resizeObserver=null;constructor(e){this.hooks=e}bind(e,t,n){n&&(this._wheelListener=e=>{if(!(e.ctrlKey||e.metaKey)||(e.preventDefault(),e.deltaY===0))return;let n=t.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;this.pendingAnchor=Number.isFinite(r)&&Number.isFinite(i)?{x:r,y:i}:null,this.setScale(Me(this.scale,e.deltaY,e.deltaMode))},t.addEventListener(`wheel`,this._wheelListener,{passive:!1})),typeof ResizeObserver<`u`&&(this._resizeObserver=new ResizeObserver(()=>this.onResize()),this._resizeObserver.observe(e))}establishBase(){let e=this.hooks.baseScale();if(e<=0)return!1;if(this.scale=e,this.prevBase=e,this.lastFitWidth=this.hooks.fitWidthPx(),this.established=!0,this.pendingScale!==null){let e=this.pendingScale;this.pendingScale=null,e!==this.scale&&(this.scale=e,this.hooks.onScaleChange(e))}return!0}setScale(e){let t=Math.min(this.hooks.zoomMax(),Math.max(this.effectiveMin(),e)),n=this.pendingAnchor;if(this.pendingAnchor=null,this.hooks.count()===0||!this.established){this.pendingScale=t;return}if(t===this.scale)return;let r=this.scale,i=n?.y??0,a=this.hooks.scrollHost(),o=a.scrollTop,s=o+i,c=this.hooks.indexAt(s),l=this.hooks.height(c),u=this.hooks.offset(c),d=Math.min(1,Math.max(0,l>0?(s-u)/l:0)),f=this.hooks.padLeft(),p=a.scrollLeft||0;this.hooks.invalidateRender(),this.scale=t,this.hooks.recomputeHeights();let m=this.hooks.totalHeight();this.hooks.spacer().style.height=`${m}px`,this.hooks.syncSpacerWidth();let h=Math.max(0,m-a.clientHeight),g=this.hooks.offset(c)+d*this.hooks.height(c),_=s<u&&c===0?o:g-i;if(a.scrollTop=Math.min(h,Math.max(0,_)),n){let e=Math.max(0,(this.hooks.spacer().offsetWidth||0)-a.clientWidth);a.scrollLeft=Ne(p,n.x-f,r,t,{maxScroll:e})}this.hooks.preview(),this.hooks.scheduleSettle(),this.hooks.onScaleChange(t)}getScale(){return this.established?this.scale:this.pendingScale??1}zoomIn(){this.setScale(Fe(this.getScale()))}zoomOut(){this.setScale(Ie(this.getScale(),this.effectiveMin()))}effectiveMin(){let e=this.hooks.zoomMin();return this.established&&this.prevBase>0?Math.min(e,this.prevBase):e}fit(e){if(this.hooks.count()===0)return;let t=this.hooks.fitContentSize(e);if(!t)return;let n=Le({contentWidth:t.width,contentHeight:t.height,containerWidth:this.hooks.fitWidthPx(),containerHeight:this.hooks.scrollHost().clientHeight},e);n>0&&this.setScale(n)}onResize(){if(this.hooks.count()===0)return;if(!this.established){this.hooks.relayout();return}if(!this.hooks.refitOnResize()){this.lastFitWidth=this.hooks.fitWidthPx(),this.hooks.mountVisible();return}let e=this.hooks.baseScale();if(e<=0)return;let t=this.hooks.fitWidthPx();if(t===this.lastFitWidth){this.hooks.mountVisible();return}this.lastFitWidth=t;let n=this.prevBase>0?this.scale/this.prevBase:1;this.prevBase=e,this.setScale(e*n),this.hooks.mountVisible()}destroy(){this.pendingAnchor=null,this._wheelListener&&=(this.hooks.scrollHost().removeEventListener(`wheel`,this._wheelListener),null),this._resizeObserver?.disconnect(),this._resizeObserver=null}},Gn=class{hooks;elementContext=null;_generation=0;_contextKey=`null`;_selectionChangeListener=null;_elementClickListener=null;_contextMenuListener=null;constructor(e){this.hooks=e}bind(e,t){let n=this.hooks.wrapper(),r=this.hooks.scrollHost();this.hooks.textSelectionEnabled()&&(e||this.hooks.elementSelectionEnabled())&&(this._selectionChangeListener=()=>this.emitChange(),n.ownerDocument.addEventListener(`selectionchange`,this._selectionChangeListener)),this.hooks.elementSelectionEnabled()&&(this._elementClickListener=e=>{this.onElementClick(e).catch(e=>this.hooks.reportError(e))},r.addEventListener(`click`,this._elementClickListener)),t&&this.hooks.onContextMenu&&(this._contextMenuListener=e=>{let t;this.hooks.onContextMenu?.(e,()=>t??=this.resolveContextAt(e))},r.addEventListener(`contextmenu`,this._contextMenuListener))}emitChange(){let e=this.hooks.getContext();e?.kind===`text`&&(this._generation++,this.elementContext=null,this.redrawOutlines());let t=JSON.stringify(e);t!==this._contextKey&&(this._contextKey=t,this.hooks.onChange(e?structuredClone(e):null))}setElementContext(e){this.elementContext=e?structuredClone(e):null,this.redrawOutlines(),this.emitChange()}invalidateElementContext(e=!0){this._generation++,this.elementContext=null,this.redrawOutlines(),e&&this.emitChange()}clearElementContext(){this.elementContext=null}redrawOutlines(){for(let[e,t]of this.hooks.slots())this.redrawOutlineForSlot(e,t)}redrawOutlineForSlot(e,t){let n=this.elementContext,r=this.hooks.resource();it(t.elementLayer,n&&r?this.hooks.outline(r,e,n):null)}async onElementClick(e){this.hooks.destroyed()||e.defaultPrevented||e.button!==0||await this.resolveContextAt(e)}async resolveContextAt(e){let t=this.hooks.resource();if(this.hooks.destroyed()||!t)return null;if(this.hooks.textSelectionEnabled()&&this.hooks.textSelected())return this.emitChange(),this.hooks.destroyed()?null:this.hooks.getContext();if(!this.hooks.elementSelectionEnabled())return this.hooks.getContext();let n=e.target,r=[...this.hooks.slots()].find(([,e])=>n!==null&&e.wrapper.contains(n));if(!r)return this.invalidateElementContext(),null;let[i,a]=r,o=a.canvas.getBoundingClientRect();if(o.width<=0||o.height<=0)return this.invalidateElementContext(),null;let s=e.clientX-o.left,c=e.clientY-o.top;if(s<0||c<0||s>o.width||c>o.height)return this.invalidateElementContext(),null;let l=++this._generation,u;try{u=await this.hooks.hitTest(t,i,s/o.width,c/o.height,o.width)}catch(e){if(this.hooks.destroyed()||l!==this._generation||t!==this.hooks.resource())return null;throw e}return this.hooks.destroyed()||l!==this._generation||t!==this.hooks.resource()?null:(this.setElementContext(u),this.hooks.destroyed()?null:this.hooks.getContext())}destroy(){this._generation++;let e=this.hooks.wrapper(),t=this.hooks.scrollHost();this._selectionChangeListener&&=(e.ownerDocument.removeEventListener(`selectionchange`,this._selectionChangeListener),null),this._elementClickListener&&=(t.removeEventListener(`click`,this._elementClickListener),null),this._contextMenuListener&&=(t.removeEventListener(`contextmenu`,this._contextMenuListener),null),this.elementContext=null}},Kn=class{hooks;_scheduled=!1;_frame=null;_pending=new Map;constructor(e){this.hooks=e}drawConnectors(e,t){let n=t.commentDecorationLayer,r=t.commentMargin,i=t.commentGeometry,a=this.hooks.connectorOptions(),o=this.hooks.runtime();if(!n||!r||!i||!a||!o)return;let s=this.hooks.width(e),c=this.hooks.height(e),l=this.hooks.side(),u=this.hooks.marginExtent();o.buildReadOnlyCommentDecoration(n,Object.freeze({surfaceBounds:Object.freeze({x:l===`left`?-u:0,y:0,width:s+u,height:c}),contentBounds:Object.freeze({x:0,y:0,width:s,height:c}),side:l,threads:o.projectReadOnlyCommentMarginScroll(i,r.scrollTop)}),{route:a.route??`bezier`,stroke:a.stroke??`solid`,color:a.color,activeColor:a.activeColor})}schedule(e,t,n=!1){let r=this._pending.get(e);if(this._pending.set(e,{slot:t,connectorsOnly:r?.slot===t?r.connectorsOnly&&n:n}),this._scheduled)return;this._scheduled=!0;let i=()=>{this._scheduled=!1,this._frame=null;let e=[...this._pending];if(this._pending.clear(),!this.hooks.destroyed())for(let[t,n]of e)this.hooks.slots().get(t)!==n.slot||n.slot.renderedScale!==this.hooks.scale()||(n.connectorsOnly?this.drawConnectors(t,n.slot):this.hooks.redrawComments(t,n.slot))},a=this.hooks.ownerWindow();a?.requestAnimationFrame?this._frame=a.requestAnimationFrame(i):queueMicrotask(i)}destroy(){this._frame!==null&&this.hooks.ownerWindow()?.cancelAnimationFrame?.(this._frame),this._frame=null,this._scheduled=!1,this._pending.clear()}},G=new WeakMap;function qn(e){let t=e.math?G.get(e.math):void 0,n=e.threeD?G.get(e.threeD):void 0,r=e.regionMap?G.get(e.regionMap):void 0,i=e.chartEx?G.get(e.chartEx):void 0,a=e.tiff?G.get(e.tiff):void 0,o={...t?{math:t}:{},...n?{threeD:n}:{},...r?{regionMap:r}:{},...i?{chartEx:i}:{},...a?{tiff:a}:{}};return Object.keys(o).length>0?Object.freeze(o):void 0}function Jn(e,t){let n=t.startsWith(`/`)?[]:e.split(`/`).filter(e=>e!==``);for(let e of t.split(`/`))if(e===`..`)n.pop();else if(e===`.`||e===``)continue;else n.push(e);return n.join(`/`)}function Yn(e){let t=/[?&]jump=([a-zA-Z]+)/.exec(e);if(!t)return null;let n=t[1].toLowerCase();return n===`firstslide`||n===`lastslide`||n===`nextslide`||n===`previousslide`?n:null}function Xn(e,t,n){if(!(n<=0))switch(e){case`firstslide`:return 0;case`lastslide`:return n-1;case`nextslide`:return Math.min(t+1,n-1);case`previousslide`:return Math.max(t-1,0)}}function Zn(e){let t=e.textBodyRotation??0,n=e.shapeFlipH===!0,r=e.shapeFlipV===!0;if(n||r)return`rotate(${e.rotation}deg) scale(${n?-1:1}, ${r?-1:1})`+(t===0?``:` rotate(${t}deg)`);let i=e.rotation+t;return i===0?``:`rotate(${i}deg)`}function Qn(e,t){return`${e.shapeX},${e.shapeY},${e.shapeW},${e.shapeH},${e.cellHorzOverflow??`shape`},${t}`}function $n(e,t,n,r,i,a){let o=e.createElement(`div`),s=t.cellHorzOverflow!==void 0;o.style.cssText=`position:absolute;left:${U(t.shapeX,n)};top:${U(t.shapeY,r)};width:${U(t.shapeW,n)};height:${U(t.shapeH,r)};pointer-events:${i};overflow:${s?`visible`:a};`,t.cellHorzOverflow===`clip`&&(o.style.overflowX=`clip`,o.style.overflowY=`visible`);let c=Zn(t);return c&&(o.style.transformOrigin=`center center`,o.style.transform=c),{div:o,w:t.shapeW,h:t.shapeH}}function er(e,t,n,r,i,a){e.innerHTML=``,W(e,`ooxmlSelectionSurface`,`pptx`),W(e,`slideIndex`,a===void 0?void 0:String(a));let o=new Map,s=e.ownerDocument??document;for(let[a,c]of t.entries()){let t=Qn(c,Zn(c)),l=o.get(t);if(!l){let i=$n(s,c,n,r,`all`,`visible`);l=i,o.set(t,l),e.appendChild(i.div)}let u=s.createElement(`span`);W(u,`ooxmlSelectionRun`,`pptx`),W(u,`runIndex`,String(a)),c.shapeId!==void 0&&W(u,`shapeId`,c.shapeId),c.elementIndex!==void 0&&W(u,`elementIndex`,String(c.elementIndex)),c.origin!==void 0&&W(u,`elementOrigin`,c.origin),u.textContent=c.text;let d=i?c.hyperlink:void 0;u.style.cssText=`position:absolute;left:${U(c.inShapeX,l.w)};top:${U(c.inShapeY,l.h)};font:${c.font};line-height:${c.h}px;letter-spacing:0;white-space:pre;color:transparent;cursor:${d?`pointer`:`text`};`,d&&i&&(u.title=d.kind===`external`?d.url:d.ref,u.addEventListener(`click`,e=>{e.preventDefault(),i(d)})),l.div.appendChild(u)}}function tr(e,t,n,r,i,a,o={}){e.innerHTML=``;let s=o.match??`rgba(255, 214, 0, 0.42)`,c=o.active??`rgba(255, 140, 0, 0.55)`,l=e.ownerDocument??document,u=new Map,d=t=>{let n=Qn(t,Zn(t)),a=u.get(n);if(!a){let o=$n(l,t,r,i,`none`,`hidden`);a=o,u.set(n,a),e.appendChild(o.div)}return a};for(let e of n){let n=e.active?c:s;for(let r of e.slices){let e=t[r.runIndex];if(!e)continue;let i=a(e.font),{x:o,width:s}=_n(e.text,r.start,r.end,i);if(s<=0)continue;let c=d(e),u=l.createElement(`div`);u.style.cssText=`position:absolute;left:${U(e.inShapeX+o,c.w)};top:${U(e.inShapeY,c.h)};width:${U(s,c.w)};height:${U(e.h,c.h)};background:${n};pointer-events:none;`,c.div.appendChild(u)}}}function nr(e,t){let n=e.tableCell,r=t.tableCell;return!n&&!r?!0:!n||!r?!1:(e.renderElementIndex??e.elementIndex)===(t.renderElementIndex??t.elementIndex)&&e.origin===t.origin&&e.shapeId===t.shapeId&&n.row===r.row&&n.column===r.column}function rr(e,t){for(let n=1;n<t.length;n++){let r=e[t[n-1].runIndex],i=e[t[n].runIndex];if(!r||!i||!nr(r,i))return!1}return!0}var ir=class extends yn{constructor(e,t,n){super(e,t,e=>({slide:e}),rr,n)}slideRuns(e){return this.unitRuns(e)}setSlideRuns(e,t){this.setUnitRuns(e,t)}slideHighlights(e){return this.unitHighlights(e)}activeSlide(){return this.activeUnit()}};async function ar(e){return e?(await b(async()=>{let{collectSlideFontDemand:e}=await import(`./font-preload-demand-NqcVKIpX-_QhVEaPJ.js`);return{collectSlideFontDemand:e}},[])).collectSlideFontDemand:void 0}var or=e=>e>=`0`&&e<=`9`;function sr(e){let t=0;for(let n=0;n<10;n++)t=Math.max(t,e.measureText(String(n)).width);return t}function cr(e,t,n){let r=0;for(let i of t)r+=or(i)?n:e.measureText(i).width;return r}function lr(e,t,n,r,i){let a=e.textAlign;e.textAlign=`left`;let o=n;for(let n of t)if(or(n)){let t=e.measureText(n).width;e.fillText(n,o+(i-t)/2,r),o+=i}else e.fillText(n,o,r),o+=e.measureText(n).width;e.textAlign=a}var K=(t,n)=>t/e*n;async function ur(t,n,a){let o=t.getContext(`2d`);if(!o)throw Error(`2D context not available`);let s=a.width/(a.slideWidthEmu/e);await a.drawBase();let c=document.createElement(`canvas`);c.width=t.width,c.height=t.height;let l=c.getContext(`2d`);if(!l)throw Error(`base 2D context not available`);l.drawImage(t,0,0);let u=[],d=!1,f=()=>{for(let e of u){e.detachListeners(),e.media.pause(),e.media.removeAttribute(`src`);try{e.media.load()}catch{}URL.revokeObjectURL(e.objectUrl)}u.length=0},p=e=>{d||(a.onError?a.onError(e):console.error(`[ooxml] PPTX embedded media failed:`,e))};for(let e of n){let t;try{t=await a.fetchMedia(e.mediaPath)}catch(t){throw f(),t instanceof i||r(t)?t:pr(e,t)}let n=e.mimeType||t.type,o=t.type===n?t:new Blob([t],{type:n}),c=URL.createObjectURL(o),l=e.mediaKind===`video`?document.createElement(`video`):document.createElement(`audio`);l.src=c,l.preload=`metadata`,e.mediaKind===`video`&&(l.playsInline=!0);let m=dr(e,s),h={el:e,rect:e.mediaKind===`audio`?{x:m.x+m.w/2-Math.max(m.w,260)/2,y:m.y,w:Math.max(m.w,260),h:m.h+36}:m,posterRect:m,media:l,objectUrl:c,loadState:`loading`,detachListeners:()=>{}},g=()=>{d||(h.loadState=`metadata`)},_=()=>{d||(h.loadState=`ready`)},v=()=>{d||(h.loadState=`error`,p(q(e,l,`decode`)))};l.addEventListener(`loadedmetadata`,g),l.addEventListener(`canplay`,_),l.addEventListener(`error`,v),h.detachListeners=()=>{l.removeEventListener(`loadedmetadata`,g),l.removeEventListener(`canplay`,_),l.removeEventListener(`error`,v)},u.push(h);try{l.load()}catch(t){let n=q(e,l,`load`,t);throw f(),n}}let m=null,h=null,g=()=>{o.setTransform(t.width/a.width,0,0,t.height/a.height,0,0),o.drawImage(c,0,0,t.width,t.height,0,0,a.width,a.height);for(let e of u){let t=e.media;if(e.loadState!==`loading`){if(e.loadState===`error`){fr(o,e.posterRect,`Media unavailable`);continue}if(e.el.mediaKind===`video`&&t.readyState>=2){let{x:n,y:r,w:i,h:a}=e.posterRect;o.drawImage(t,n,r,i,a)}if(e===h||y?.state===e)yr(o,e,t);else if(t.paused){let{x:t,y:n,w:r,h:i}=e.posterRect;re(o,t+r/2,n+i/2,r,i,`paused`)}}}},_=()=>{d||(g(),m=requestAnimationFrame(_))},v=(e,n)=>{let r=t.getBoundingClientRect();return{x:(e-r.left)/r.width*a.width,y:(n-r.top)/r.height*a.height}},ee=(e,t)=>{for(let n of u){let{x:r,y:i,w:a,h:o}=n.rect;if(e<r||e>r+a||t<i||t>i+o)continue;let s=Y(n),c=s.y-12,l=s.y+s.h+8;return(Number.isFinite(n.media.duration)?n.media.duration:0)>0&&e>=s.x&&e<=s.x+s.w&&t>=c&&t<=l?{kind:`seek`,state:n,fraction:Math.max(0,Math.min(1,(e-s.x)/s.w))}:{kind:`toggle`,state:n}}return null},y=null,b=(e,t)=>{let n=Number.isFinite(e.media.duration)?e.media.duration:0;n<=0||(e.media.currentTime=n*t)},x=e=>{try{e.media.play().catch(t=>{p(q(e.el,e.media,`play`,t))})}catch(t){p(q(e.el,e.media,`play`,t))}},te=e=>{let{x:n,y:r}=v(e.clientX,e.clientY),i=ee(n,r);i&&(i.kind===`seek`?(y={state:i.state,wasPlaying:!i.state.media.paused},i.state.media.pause(),b(i.state,i.fraction),t.setPointerCapture(e.pointerId),e.preventDefault()):i.state.media.paused?x(i.state):i.state.media.pause())},S=e=>{let{x:t,y:n}=v(e.clientX,e.clientY);h=null;for(let e of u){let{x:r,y:i,w:a,h:o}=e.rect;if(t>=r&&t<=r+a&&n>=i&&n<=i+o){h=e;break}}if(y){let e=Y(y.state),n=Math.max(0,Math.min(1,(t-e.x)/e.w));b(y.state,n)}},ne=()=>{h=null},C=e=>{if(!y)return;let{wasPlaying:n,state:r}=y;y=null,t.releasePointerCapture(e.pointerId),n&&x(r)};return u.length>0&&(t.addEventListener(`pointerdown`,te),t.addEventListener(`pointermove`,S),t.addEventListener(`pointerleave`,ne),t.addEventListener(`pointerup`,C),t.addEventListener(`pointercancel`,C),t.style.cursor=`pointer`,_()),{play(e){for(let t of u)(!e||t.el.mediaPath===e)&&x(t)},pause(e){for(let t of u)(!e||t.el.mediaPath===e)&&t.media.pause()},destroy(){d||(d=!0,m!==null&&cancelAnimationFrame(m),t.removeEventListener(`pointerdown`,te),t.removeEventListener(`pointermove`,S),t.removeEventListener(`pointerleave`,ne),t.removeEventListener(`pointerup`,C),t.removeEventListener(`pointercancel`,C),t.style.cursor=``,f())}}}function dr(e,t){return{x:K(e.x,t),y:K(e.y,t),w:K(e.width,t),h:K(e.height,t)}}function fr(e,t,n){let r=Math.max(10,Math.min(14,t.h*.12));e.save(),e.font=`500 ${r}px system-ui, -apple-system, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`;let i=r+12,a=Math.min(t.w,Math.max(100,e.measureText(n).width+24));X(e,t.x+(t.w-a)/2,t.y+(t.h-i)/2,a,i,i/2),e.fillStyle=`rgba(20, 20, 20, 0.72)`,e.fill(),e.fillStyle=`rgba(255, 255, 255, 0.95)`,e.fillText(n,t.x+t.w/2,t.y+t.h/2),e.restore()}function pr(e,t){return Error(`Embedded ${e.mediaKind} fetch failed for "${e.mediaPath}" (mime=${e.mimeType||`unknown`}): ${mr(t)}`)}function q(e,t,n,r){let i=``;try{i=e.mimeType?t.canPlayType(e.mimeType):``}catch{}let a=t.error,o=[`mime=${e.mimeType||`unknown`}`,`canPlayType=${i||`no`}`,`readyState=${t.readyState}`,`networkState=${t.networkState}`];a&&o.push(`mediaError=${a.code}${a.message?` ${a.message}`:``}`);let s=r===void 0?``:`: ${mr(r)}`;return Error(`Embedded ${e.mediaKind} ${n} failed for "${e.mediaPath}" (${o.join(`; `)})${s}`)}function mr(e){return e instanceof Error?`${e.name||`Error`}${e.message?`: ${e.message}`:``}`:String(e)}var hr=28,gr=14,_r=72,vr=10,J=3;function yr(e,t,n){let r=Number.isFinite(n.duration)?n.duration:0,i=r>0?Math.min(1,n.currentTime/r):0,a=t.posterRect;re(e,a.x+a.w/2,a.y+a.h/2,a.w,a.h,n.paused?`paused`:`playing`),t.el.mediaKind===`audio`?xr(e,t,n,r,i):br(e,t,n,r,i)}function br(e,t,n,r,i){let{x:a,y:o,w:s,h:c}=t.rect,l=Math.max(28,Math.min(56,c*.22)),u=o+c-l;e.save();let d=e.createLinearGradient(0,u,0,o+c);d.addColorStop(0,`rgba(0, 0, 0, 0)`),d.addColorStop(1,`rgba(0, 0, 0, 0.55)`),e.fillStyle=d,e.fillRect(a,u,s,l),e.restore();let f=Y(t);Cr(e,f,i,r>0),e.save(),e.font=`500 11px system-ui, -apple-system, sans-serif`,e.textBaseline=`middle`,e.shadowColor=`rgba(0, 0, 0, 0.75)`,e.shadowBlur=3,e.fillStyle=`rgba(255, 255, 255, 0.95)`,Sr(e,n.currentTime,r,f.x,f.y-10,`bottom`),e.restore()}function xr(e,t,n,r,i){let a=wr(t.rect);e.save(),X(e,a.x,a.y,a.w,a.h,a.h/2),e.fillStyle=`rgba(20, 20, 20, 0.72)`,e.fill(),e.font=`500 11px system-ui, -apple-system, sans-serif`,e.textBaseline=`middle`,e.fillStyle=`rgba(255, 255, 255, 0.95)`,Sr(e,n.currentTime,r,a.x+gr,a.y+a.h/2,`middle`),e.restore(),Cr(e,Y(t),i,r>0)}function Sr(e,t,n,r,i,a){let o=Tr(t),s=Tr(n),c=sr(e),l=cr(e,o,c),u=cr(e,s,c),d=e.measureText(` / `).width,f=Math.max(l,u);lr(e,o,r+f-l,i,c);let p=e.textAlign;e.textAlign=`left`,e.fillText(` / `,r+f,i),e.textAlign=p,lr(e,s,r+f+d,i,c)}function Cr(e,t,n,r){let i=t.h/2;if(e.save(),X(e,t.x,t.y,t.w,t.h,i),e.fillStyle=`rgba(255, 255, 255, 0.35)`,e.fill(),n>0&&(X(e,t.x,t.y,t.w*n,t.h,i),e.fillStyle=`#fff`,e.fill()),r){let r=Math.max(t.x+5,Math.min(t.x+t.w-5,t.x+t.w*n));e.shadowColor=`rgba(0, 0, 0, 0.3)`,e.shadowBlur=3,e.fillStyle=`#fff`,e.beginPath(),e.arc(r,t.y+t.h/2,5,0,Math.PI*2),e.fill()}e.restore()}function wr(e){let t=Math.max(220,e.w-24);return{x:e.x+e.w/2-t/2,y:e.y+e.h-hr-4,w:t,h:hr}}function Y(e){if(e.el.mediaKind===`audio`){let t=wr(e.rect),n=t.x+gr+_r+vr,r=Math.max(40,t.x+t.w-gr-n);return{x:n,y:t.y+(t.h-J)/2,w:r,h:J}}let t=e.rect,n=Math.max(12,t.w*.025),r=Math.max(12,Math.min(18,t.h*.05));return{x:t.x+n,y:t.y+t.h-J-r,w:t.w-n*2,h:J}}function X(e,t,n,r,i,a){let o=Math.min(a,i/2,r/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}function Tr(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e);return`${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)}`}function Er(e){let t=new Map;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&r!==``&&!t.has(r)&&t.set(r,n)}return t}function Dr(e,t){if(e===``)return;if(e.startsWith(`ppt/`))return t.get(e);let n=Jn(`ppt/slides`,e);return t.get(n)}function Or(e,t,n){let r=Yn(e);return r===null?Dr(e,t):Xn(r,n,t.size)}function kr(e){let t=w(e.family);return e.presenceOnly?`presence:${t}`:`${t}:${e.weight??400}:${e.style??`normal`}`}async function Ar(e,t,r,i=null){let o=new Map;for(let n of t){let t=kr(n);!e.has(t)&&!o.has(t)&&o.set(t,n)}if(o.size>0){let t=r([...o.values()]);for(let n of o.keys())e.set(n,t)}let s=new Set(t.map(t=>e.get(kr(t)))),c=await Promise.all(s),l=Object.assign(a(),...c.map(e=>e.routes)),u=new Set(c.flatMap(e=>e.installed??[])),d=a(),f=new Set;for(let e of t){let t=w(e.family);if(e.presenceOnly){u.has(t)&&f.add(t);continue}let r=Mr(e),i=n(l,r);i&&(d[r]=i,f.add(t))}for(let e of jr(i))f.delete(e);return{routes:d,installed:[...f].sort()}}function jr(e){return!e||typeof e[Symbol.iterator]!=`function`?new Set:new Set([...e].map(e=>w(e.family.replace(/^(['"])(.*)\1$/u,`$2`))))}function Mr(e){let t=w(e.family),n=e.weight??400,r=e.style??`normal`;return n===400&&r===`normal`?t:`${t}:${n}:${r}`}function Nr(e){return[...new Set(e.values())]}var Pr=class{#e;#t;#n;#r=0;#i=Promise.resolve();#a;#o;constructor(e){if(!Number.isSafeInteger(e.slideCount)||e.slideCount<0)throw TypeError(`slideCount must be a non-negative safe integer`);this.#e=e.slideCount,this.#t=e.loadSlide,this.#n=new m({maxEntries:e.maxCachedSlides,maxWeight:e.maxCachedStructuralBytes,measure:e=>de(e).jsonBytes})}get slideCount(){return this.#e}get usage(){return this.#n.usage}withSlide(e,t){this.#c(e);let n=this.#r,r=this.#i.then(async()=>{if(n!==this.#r)throw this.#a?this.#a:Error(`PPTX slide repository generation is stale`);if(this.#a)throw this.#a;let r=await this.#s(e,n);try{return await t(r)}catch(e){let t=Fr(e);throw t?(this.#l(t,n),this.#o===n?this.#a??t:t):e}});return this.#i=r.then(()=>void 0,()=>void 0),r}async#s(e,t){return this.#n.getOrLoad(e,async()=>{let n;try{n=await this.#t(e)}catch(e){let n=Fr(e);throw n?(this.#l(n,t),this.#o===t?this.#a??n:n):e}if(this.#o===t&&this.#a)throw this.#a;return n})}clear(){this.#r+=1,this.#a=void 0,this.#o=void 0,this.#n.clear()}#c(e){if(!Number.isSafeInteger(e)||e<0||e>=this.#e)throw RangeError(`Slide index ${e} out of range (count: ${this.#e})`)}#l(e,t){t!==this.#r||this.#a||(this.#a=e,this.#o=t,this.#r+=1,this.#n.clear())}};function Fr(e){return e instanceof i?e:be(e)}function Ir(e,t){return e.filter(e=>!t.has(`${e.family.toLowerCase()}:${e.weight}:${e.style}`))}var Lr=1;function Z(e){return e.trim().toLowerCase()}async function Rr(e,t){if(e.length===0)return{faces:[],aliases:new Map,authoredFamilies:new Map,tuples:new Set};let n=Lr++,a=new Map;for(let t of e){let e=Z(t.fontName);a.has(e)||a.set(e,`__ooxml_pptx_${n}_${a.size+1}`)}let o=[],s=new Set;try{for(let n=0;n<e.length;n+=2){let c=(await Promise.all(e.slice(n,n+2).map(async e=>{try{return{family:a.get(Z(e.fontName)),bytes:await t(e.partPath),odttf:!1,weight:e.style===`bold`||e.style===`boldItalic`?`bold`:`normal`,style:e.style===`italic`||e.style===`boldItalic`?`italic`:`normal`}}catch(e){if(e instanceof i||r(e))throw e;let t=be(e);if(t)throw t;return null}}))).filter(e=>e!==null);if(c.length!==0)for(let e of await mn(c))s.has(e)?V([e]):(s.add(e),o.push(e))}}catch(e){throw V(o),e}let c=new Set(o.map(e=>Z(e.family))),l=new Map([...a].filter(([,e])=>c.has(Z(e)))),u=new Map([...l].map(([e,t])=>[t,e]));return{faces:o,aliases:l,authoredFamilies:u,tuples:new Set(o.map(e=>`${u.get(e.family)}:${e.weight===`bold`||e.weight===`700`?700:400}:${e.style===`italic`?`italic`:`normal`}`))}}function zr(e,t){return e.filter(e=>e===null||!t.has(e.trim().toLowerCase()))}var Br='var e=Object.defineProperty,t=(e,t)=>()=>(e&&(t=e(e=0)),t),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r,i,a=t((()=>{r=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},i=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function o(e,t){return t!=null&&Object.hasOwn(e,t)?e[t]:void 0}var s=t((()=>{})),c,l,u,d,f,p=t((()=>{c=134217728,l=268435456,u=4096,d=67108864,f=67108864})),m,h,g,_,v=t((()=>{m=`https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;700&display=swap`,h=`https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;700&display=swap`,g=`https://fonts.googleapis.com/css2?family=Libre+Franklin:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap`,_={calibri:{url:`https://fonts.googleapis.com/css2?family=Carlito:ital,wght@0,400;0,700;1,400;1,700&display=swap`,loadFamily:`Carlito`},cambria:{url:`https://fonts.googleapis.com/css2?family=Caladea:ital,wght@0,400;0,700;1,400;1,700&display=swap`,loadFamily:`Caladea`},"franklin gothic book":{url:g,loadFamily:`Libre Franklin`},"franklin gothic medium":{url:g,loadFamily:`Libre Franklin`},"nunito sans":{url:`https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap`},nunito:{url:`https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,700;1,400;1,700&display=swap`},"open sans":{url:`https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap`},roboto:{url:`https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap`},lato:{url:`https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap`},montserrat:{url:`https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,700;1,400;1,700&display=swap`},poppins:{url:`https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,700;1,400;1,700&display=swap`},raleway:{url:`https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,400;0,700;1,400;1,700&display=swap`},"playfair display":{url:`https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap`},ubuntu:{url:`https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,400;0,700;1,400;1,700&display=swap`},"sakkal majalla":{url:m,loadFamily:`Noto Naskh Arabic`,script:`arabic`},"traditional arabic":{url:m,loadFamily:`Noto Naskh Arabic`,script:`arabic`},"simplified arabic":{url:m,loadFamily:`Noto Naskh Arabic`,script:`arabic`},"arabic typesetting":{url:m,loadFamily:`Noto Naskh Arabic`,script:`arabic`},"univers next arabic":{url:h,loadFamily:`Noto Sans Arabic`,script:`arabic`},"noto naskh arabic":{url:m,loadFamily:`Noto Naskh Arabic`},"noto sans arabic":{url:h,loadFamily:`Noto Sans Arabic`}}}));function ee(e){return e?o(re,e.trim().toLowerCase())??null:null}function y(e){if(!e)return null;let t=ee(e)??e.trim(),n=t.toLowerCase(),r=n.match(/^noto\\s+(?:sans|serif)\\s+(?:cjk\\s+)?(sc|tc|hk|jp|kr)$/);return r?r[1]:/[ᄀ-ᇿ㄰-㆏가-힯]/.test(t)?`kr`:/[぀-ヿ]/.test(t)?`jp`:/jhenghei|微軟正黑|新細明|細明|pmingliu|mingliu|dfkai|標楷|華康|cns11643|kaiti tc|ming\\s*liu/.test(n)||/新細明體|細明體|標楷體|微軟正黑體|華康/.test(t)?`tc`:/simsun|nsimsun|simhei|simkai|simfang|yahei|dengxian|fangsong|kaiti|youyuan|lisu|stsong|stkaiti|stfangsong|stheiti|stxihei|stzhongsong|songti sc|heiti sc|微软雅黑/.test(n)||/宋体|黑体|楷体|仿宋|等线|微软雅黑|隶书|幼圆/.test(t)?`sc`:/malgun|batang|gulim|dotum|gungsuh|nanum|new gulim|hancom|hy(gothic|graphic|namu)?/.test(n)?`kr`:/\\bmeiryo\\b|\\byu\\s*(gothic|mincho)\\b|yugothic|yumincho|hiragino|\\bms\\s*(gothic|mincho|pgothic|pmincho|ui\\s*gothic)\\b|\\bms[pg]?(gothic|mincho)\\b|ipa(ex)?(gothic|mincho)|noto\\s+(sans|serif)\\s+jp|游ゴシック|游明朝|MS|メイリオ|ヒラギノ/.test(n)||/游ゴシック|游明朝|MS ゴシック|MS 明朝|MS Pゴシック|メイリオ|ヒラギノ/.test(t)?`jp`:null}function te(e){return/\\p{Script=Han}/u.test(e)}function ne(e,t,n=!1){let r=new se(t);return r.addText(e),r.names(n)}var re,b,ie,ae,oe,se,ce=t((()=>{s(),re={"noto sans cjk sc":`Noto Sans SC`,"noto serif cjk sc":`Noto Serif SC`,"noto sans cjk tc":`Noto Sans TC`,"noto serif cjk tc":`Noto Serif TC`,"noto sans cjk jp":`Noto Sans JP`,"noto serif cjk jp":`Noto Serif JP`,"noto sans cjk kr":`Noto Sans KR`,"noto serif cjk kr":`Noto Serif KR`,"noto sans cjk hk":`Noto Sans HK`},b=e=>`https://fonts.googleapis.com/css2?family=${e}:wght@400;700&display=swap`,ie={"noto sans kr":{url:b(`Noto+Sans+KR`)},"noto sans sc":{url:b(`Noto+Sans+SC`)},"noto sans tc":{url:b(`Noto+Sans+TC`)},"noto sans hk":{url:b(`Noto+Sans+HK`)},"noto sans jp":{url:b(`Noto+Sans+JP`)},"noto serif kr":{url:b(`Noto+Serif+KR`)},"noto serif sc":{url:b(`Noto+Serif+SC`)},"noto serif tc":{url:b(`Noto+Serif+TC`)},"noto serif jp":{url:b(`Noto+Serif+JP`)}},ae=Object.fromEntries(Object.entries(re).map(([e,t])=>[e,{...ie[t.toLowerCase()],loadFamily:t}])),oe={...ie,...ae,"noto sans":{url:b(`Noto+Sans`)},"noto serif":{url:b(`Noto+Serif`)},"noto sans devanagari":{url:b(`Noto+Sans+Devanagari`)},"noto sans thai":{url:b(`Noto+Sans+Thai`)},"noto sans hebrew":{url:b(`Noto+Sans+Hebrew`)},"noto serif hebrew":{url:b(`Noto+Serif+Hebrew`)}},se=class e{cjkLang;hasHan=!1;hasHangul=!1;hasKana=!1;hasArabic=!1;hasThai=!1;hasHebrew=!1;hasDevanagari=!1;hasCyrGreek=!1;constructor(e){this.cjkLang=e}scriptCjkLanguage(){return this.hasHangul?`kr`:this.hasKana?`jp`:null}preferredCjkLanguage(){return this.scriptCjkLanguage()??this.cjkLang??`jp`}clone(){let t=new e(this.cjkLang);return t.hasHan=this.hasHan,t.hasHangul=this.hasHangul,t.hasKana=this.hasKana,t.hasArabic=this.hasArabic,t.hasThai=this.hasThai,t.hasHebrew=this.hasHebrew,t.hasDevanagari=this.hasDevanagari,t.hasCyrGreek=this.hasCyrGreek,t}addText(e){let t=()=>this.hasHan&&this.hasHangul&&this.hasKana&&this.hasArabic&&this.hasThai&&this.hasHebrew&&this.hasDevanagari&&this.hasCyrGreek;outer:for(let n of e)if(n)for(let e of n){let n=e.codePointAt(0);if(n!==void 0&&!(n<=591)&&(n>=4352&&n<=4607||n>=12592&&n<=12687||n>=44032&&n<=55215?this.hasHangul=!0:n>=12352&&n<=12543?this.hasKana=!0:te(e)?this.hasHan=!0:n>=1536&&n<=1791||n>=1872&&n<=1919||n>=2208&&n<=2303||n>=64336&&n<=65023||n>=65136&&n<=65279?this.hasArabic=!0:n>=3584&&n<=3711?this.hasThai=!0:n>=1424&&n<=1535||n>=64285&&n<=64335?this.hasHebrew=!0:n>=2304&&n<=2431?this.hasDevanagari=!0:(n>=1024&&n<=1279||n>=880&&n<=1023)&&(this.hasCyrGreek=!0),t()))break outer}}names(e=!1){let t=[],n=new Set;this.hasHangul&&n.add(`kr`),this.hasKana&&n.add(`jp`),this.hasHan&&(n.size===0||e)&&n.add(this.cjkLang??`jp`);for(let e of[`kr`,`sc`,`tc`,`hk`,`jp`])if(n.has(e)){let n={kr:`KR`,sc:`SC`,tc:`TC`,hk:`HK`,jp:`JP`}[e];t.push(`Noto Sans ${n}`),e!==`hk`&&t.push(`Noto Serif ${n}`)}return this.hasCyrGreek&&t.push(`Noto Sans`,`Noto Serif`),this.hasArabic&&t.push(`Noto Naskh Arabic`,`Noto Sans Arabic`),this.hasThai&&t.push(`Noto Sans Thai`),this.hasHebrew&&t.push(`Noto Sans Hebrew`,`Noto Serif Hebrew`),this.hasDevanagari&&t.push(`Noto Sans Devanagari`),t}}}));function le(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function ue(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function de(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,a=t.observed;return n!==`ooxml-decoded-image-limit`||!le(r)||!ue(i)||!ue(a)||a<=i?void 0:{metric:r,limit:i,observed:a}}catch{return}}var fe,pe,me,he,ge,_e=t((()=>{fe=1<<25,pe=1<<27,fe*4,pe*4,me=Math.floor(fe/4),he=pe,he/me,ge=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function ve(e){return ye.test(e)}var ye,be=t((()=>{ye=/[\\u0590-\\u08FF\\uFB1D-\\uFDFF\\uFE70-\\uFEFF\\u200F\\u202B\\u202E\\u2067]|[\\u{10800}-\\u{10FFF}\\u{1E800}-\\u{1EFFF}]/u}));function xe(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var Se,Ce=t((()=>{Se=class e extends Error{code=`ooxml-tiff-decode`;constructor(t,n){super(t,n),this.name=`TiffDecodeError`,Object.setPrototypeOf(this,e.prototype)}}}));function we(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var Te=t((()=>{}));function Ee(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function De(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Ee(t.requiredBytes)&&Ee(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}function Oe(e){if(e instanceof x)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(je))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!De(r)))return new x(r)}function ke(e,t,n){let r=Oe(e);if(!(!r||r.offeredBytes!==t||r.requiredBytes>n))return r}var Ae,je,x,Me=t((()=>{Ae=`ooxml-insufficient-credit`,je=`OOXML_INSUFFICIENT_CREDIT:`,x=class e extends RangeError{code=Ae;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}}}));function S(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Ne(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return S(t.archiveEntryCount)&&S(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||S(t.largestInflatedEntryBytes))&&S(t.distinctInflatedBytes)&&S(t.operationInflatedBytes)}function Pe(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!Ne(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function Fe(e){return e===`docx`||e===`xlsx`||e===`pptx`}function Ie(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function C(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function w(e){return C(e,D)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function Le(e){return!C(e,rt)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}function Re(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!Fe(t.format)||!C(t.operation,nt)||!w(t.resource)||!w(t.metric)||!S(t.limit)||!S(t.observed)||typeof t.configurable!=`boolean`||!Ne(t.usage)?!1:!(`part`in t)||Le(t.part)}function T(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!Ie(t.stage)||!Re(t.violation))return!1;let n=t.violation,r=it.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(at.has(n.resource)&&ot.has(n.metric))}function ze(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function Be(e){if(!T(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:ze(t.usage)}};return T(n)?n:void 0}function Ve(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function He(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(et))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let r=n;if(!(r.code!==`ooxml-resource-limit`||!T(r.details)))return new i(Ve(r.details),r.details)}function Ue(e){try{return e()}catch(e){throw e instanceof i||typeof e!=`string`&&!(e instanceof Error)?e:He(e)??e}}function We(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(tt))return new r(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function Ge(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!w(n)||r!==`source-subset`))return{format:n,reason:r}}function Ke(e){return new r(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function qe(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=Ge(JSON.parse(t.slice(25)));return e?Ke(e):void 0}catch{return}}function Je(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new r(`unsupported-encryption`,`The configured source cannot decrypt this input.`):qe(e)??He(e)??We(e)}function Ye(e){let t=de(e);if(t){let e=new ge(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let n=xe(e);if(n)return{message:n.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=Oe(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof r||e instanceof i?e:Je(e),s=o??e;if(o instanceof i||s&&typeof s==`object`&&s.code===`ooxml-resource-limit`){let e=s,t=Be(e.details);return t?{message:typeof e.message==`string`?e.message:Ve(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(s&&typeof s==`object`&&s.code===`unsupported-content`){let e=Ge(s.details);return e?{message:Ke(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof r)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:C(o.name,D)?o.name:`OoxmlError`,...w(o.code)?{code:o.code}:{}};let c=e instanceof Error?e.message:String(e);if(typeof c==`string`&&c.startsWith(et))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let l=e instanceof Error?e:Error(c),u=l;return{message:typeof l.message==`string`?l.message:String(l.message),errorName:C(l.name,D)?l.name:`Error`,...typeof u.code==`string`?{code:u.code}:{}}}function E(e){try{return Ye(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}function Xe(e){return typeof e==`string`&&Object.prototype.hasOwnProperty.call(ct,e)}function Ze(e,t){if(e!==`ooxml-decoded-image-limit`||!t||typeof t!=`object`)return;let n=t,r=n.metric,i=n.limit,a=n.observed;if(!(!Xe(r)||!S(i)||!S(a)||a<=i))return{metric:r,limit:i,observed:a}}function Qe(e){let t=e.message,n=e.errorName,a=e.code,o=e.decodedImage,s=e.insufficientCredit,c=e.resourceLimit,l=e.unsupportedContent,u=typeof t==`string`?t:`Worker operation failed with an invalid error payload`,d=C(n,D)?n:void 0,f=typeof a==`string`?a:void 0;if(f===`unsupported-content`){let e=Ge(l);return e?Ke(e):Error(`Invalid unsupported-content error payload`)}let p=Ze(f,o);if(p)return new ge(p.metric,p.limit,p.observed);if(f===`ooxml-tiff-decode`)return new Se(u);if(f===`ooxml-insufficient-credit`&&De(s))return new x(s);if(f===`ooxml-resource-limit`&&T(c))return new i(u,c);if(f&&st.has(f))return new r(f,u);let m=d===`TypeError`?TypeError(u):d===`RangeError`?RangeError(u):Error(u);return d&&(m.name=d),f!==void 0&&Object.assign(m,{code:f}),m}function $e(e){try{return Qe(e)}catch{return Error(`Worker operation failed with an unreadable error payload`)}}var et,tt,D,nt,rt,it,at,ot,st,ct,lt=t((()=>{a(),_e(),Ce(),Me(),et=`OOXML_RESOURCE_LIMIT:`,tt=`OOXML_NOT_OOXML:`,D=128,nt=256,rt=4096,it=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),at=new Set([...it.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),ot=new Set([...it.keys()].map(e=>e.slice(e.indexOf(`:`)+1))),st=new Set([`encrypted`,`invalid-password`,`unsupported-encryption`,`legacy-binary-format`,`not-ooxml`,`invalid-numbering`,`unsupported-image-effect`]),ct={"image-dimension":!0,"image-pixels":!0,"active-decoded-bytes":!0,"image-effect-count":!0,"image-effect-work":!0,"tiff-lzw-work":!0,"metafile-path-commands":!0,"metafile-record-points":!0,"metafile-record-polygons":!0,"metafile-record-rectangles":!0,"metafile-record-text-units":!0}})),ut,dt=t((()=>{ut=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}}}));function ft(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function pt(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function mt(e,t){return e({module_or_path:t})}function ht(e){return ft(e)?new gt(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}var gt,_t,vt=t((()=>{lt(),dt(),gt=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}},_t=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new ut(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),ht),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return Ue(()=>this.runtime.run(e))}poison(){this.runtime.poison(new gt(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):mt(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,pt(e)}}}));function yt(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}var bt=t((()=>{}));function xt(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}var St=t((()=>{p(),Object.freeze({maxArchiveEntryBytes:c,maxTotalInflatedBytes:l,maxArchiveEntries:u})}));function O(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function Ct(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var k,wt,Tt,Et=t((()=>{lt(),Me(),k=`ooxml-pull-v1`,wt=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,O(this.maxRetainedBytes,`max retained lease bytes`),O(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},Tt=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){Ct(e.sessionId),O(e.operationId,`operation id`),O(e.generation,`generation`),O(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&O(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=E(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(O(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:k,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){O(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(O(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:k,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:k,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}}})),A=t((()=>{Te(),a(),vt(),lt(),Me(),bt(),_e(),Ce(),s(),v(),ce(),be(),St(),p(),Et()})),Dt=t((()=>{be()})),j=t((()=>{a(),s(),p(),v(),ce(),_e(),be(),Ce(),A(),Dt()})),Ot=t((()=>{}));function kt(){return At??=[0,191,198,198,208,208,215,216,222,223,230,230,240,240,247,248,254,254,272,273,294,295,305,307,312,312,319,322,329,331,338,339,358,359,383,415,418,430,433,460,477,477,484,485,497,499,502,503,540,541,544,549,564,767,847,847,880,883,885,887,890,893,895,895,900,900,913,929,931,937,945,969,975,978,981,1023,1026,1026,1028,1030,1032,1035,1039,1048,1050,1080,1082,1103,1106,1106,1108,1110,1112,1115,1119,1141,1144,1154,1160,1216,1219,1231,1236,1237,1240,1241,1248,1249,1256,1257,1270,1271,1274,1327,1329,1366,1369,1418,1421,1423,1470,1470,1472,1472,1475,1475,1478,1478,1488,1514,1519,1524,1536,1551,1563,1569,1575,1610,1632,1647,1649,1727,1729,1729,1731,1746,1748,1749,1757,1758,1765,1766,1769,1769,1774,1805,1807,1808,1810,1839,1869,1969,1984,2026,2036,2042,2046,2069,2074,2074,2084,2084,2088,2088,2096,2110,2112,2136,2142,2142,2144,2154,2160,2193,2208,2249,2274,2274,2304,2344,2346,2352,2354,2355,2357,2363,2365,2380,2382,2384,2389,2391,2400,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2495,2500,2503,2504,2510,2510,2528,2531,2534,2557,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2610,2613,2613,2616,2617,2622,2626,2631,2632,2635,2636,2641,2641,2652,2652,2662,2678,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2757,2759,2761,2763,2764,2768,2768,2784,2787,2790,2801,2809,2815,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2879,2884,2887,2887,2901,2901,2911,2915,2918,2935,2946,2947,2949,2954,2958,2960,2962,2963,2965,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3007,3010,3014,3016,3024,3024,3046,3066,3072,3084,3086,3088,3090,3112,3114,3129,3133,3140,3142,3143,3146,3148,3160,3162,3164,3165,3168,3171,3174,3183,3191,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3263,3265,3265,3267,3268,3270,3270,3276,3276,3292,3294,3296,3299,3302,3311,3313,3315,3328,3340,3342,3344,3346,3386,3389,3389,3391,3396,3398,3400,3406,3407,3412,3414,3416,3427,3430,3455,3457,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3536,3540,3542,3542,3544,3545,3547,3547,3558,3567,3570,3572,3585,3639,3647,3655,3660,3675,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3767,3771,3773,3776,3780,3782,3782,3788,3790,3792,3801,3804,3807,3840,3863,3866,3892,3894,3894,3896,3896,3898,3906,3908,3911,3913,3916,3918,3921,3923,3926,3928,3931,3933,3944,3946,3948,3959,3959,3961,3961,3966,3967,3973,3973,3976,3986,3988,3991,3993,3996,3998,4001,4003,4006,4008,4011,4013,4020,4022,4022,4024,4024,4026,4028,4030,4037,4039,4044,4046,4058,4096,4133,4135,4141,4143,4150,4152,4152,4155,4236,4238,4293,4295,4295,4301,4301,4304,4351,4371,4448,4470,4519,4547,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4960,4988,4992,5017,5024,5109,5112,5117,5120,5788,5792,5880,5888,5907,5919,5939,5941,5942,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6097,6099,6108,6112,6121,6128,6137,6144,6169,6176,6264,6272,6312,6314,6314,6320,6389,6400,6430,6432,6443,6448,6456,6464,6464,6468,6509,6512,6516,6528,6571,6576,6601,6608,6618,6622,6678,6681,6683,6686,6750,6753,6772,6784,6793,6800,6809,6816,6829,6846,6846,6912,6917,6919,6919,6921,6921,6923,6923,6925,6925,6927,6929,6931,6963,6966,6970,6972,6972,6974,6975,6978,6978,6981,6988,6990,7018,7028,7081,7084,7141,7143,7153,7164,7222,7227,7241,7245,7306,7312,7354,7357,7367,7379,7379,7393,7393,7401,7404,7406,7411,7413,7415,7418,7418,7424,7615,7834,7834,7836,7839,7930,7935,8125,8125,8127,8128,8190,8190,8194,8292,8294,8305,8308,8334,8336,8348,8352,8385,8413,8416,8418,8420,8448,8485,8487,8489,8492,8587,8592,8601,8604,8621,8623,8652,8656,8707,8709,8712,8714,8715,8717,8739,8741,8741,8743,8768,8770,8771,8773,8774,8776,8776,8778,8799,8801,8801,8803,8812,8818,8819,8822,8823,8826,8831,8834,8835,8838,8839,8842,8875,8880,8927,8932,8937,8942,9e3,9003,9257,9280,9290,9312,10971,10973,11123,11126,11502,11506,11507,11513,11557,11559,11559,11565,11565,11568,11623,11631,11632,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11776,11869,11904,11929,11931,12019,12032,12245,12272,12329,12336,12351,12353,12363,12365,12365,12367,12367,12369,12369,12371,12371,12373,12373,12375,12375,12377,12377,12379,12379,12381,12381,12383,12383,12385,12385,12387,12388,12390,12390,12392,12392,12394,12399,12402,12402,12405,12405,12408,12408,12411,12411,12414,12435,12437,12438,12443,12445,12447,12459,12461,12461,12463,12463,12465,12465,12467,12467,12469,12469,12471,12471,12473,12473,12475,12475,12477,12477,12479,12479,12481,12481,12483,12484,12486,12486,12488,12488,12490,12495,12498,12498,12501,12501,12504,12504,12507,12507,12510,12531,12533,12534,12539,12541,12543,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,42124,42128,42182,42192,42539,42560,42606,42608,42611,42622,42653,42656,42735,42738,42743,42752,42972,42993,43013,43015,43051,43056,43065,43072,43127,43136,43203,43205,43205,43214,43225,43250,43306,43310,43346,43359,43388,43392,43442,43444,43455,43457,43469,43471,43481,43486,43518,43520,43574,43584,43597,43600,43609,43612,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43765,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43883,43888,44012,44016,44025,55216,55238,55243,55291,57344,63743,64014,64015,64017,64017,64019,64020,64031,64031,64033,64033,64035,64036,64039,64041,64256,64262,64275,64279,64288,64297,64335,64975,65008,65049,65072,65106,65108,65126,65128,65131,65136,65140,65142,65276,65279,65279,65281,65470,65474,65479,65482,65487,65490,65495,65498,65500,65504,65510,65512,65518,65529,65533,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65792,65794,65799,65843,65847,65934,65936,65948,65952,65952,66e3,66044,66176,66204,66208,66256,66273,66299,66304,66339,66349,66378,66384,66421,66432,66461,66463,66499,66504,66517,66560,66717,66720,66729,66736,66771,66776,66811,66816,66855,66864,66915,66927,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67008,67016,67018,67043,67045,67059,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67671,67742,67751,67759,67808,67826,67828,67829,67835,67867,67871,67897,67903,67929,67968,68023,68028,68047,68050,68099,68101,68102,68108,68108,68110,68110,68112,68115,68117,68119,68121,68149,68160,68168,68176,68184,68192,68255,68288,68324,68331,68342,68352,68405,68409,68437,68440,68466,68472,68497,68505,68508,68521,68527,68608,68680,68736,68786,68800,68850,68858,68899,68912,68921,68928,68965,68974,68997,69006,69007,69216,69246,69248,69289,69293,69293,69296,69297,69314,69319,69328,69336,69372,69372,69376,69415,69424,69445,69457,69465,69488,69505,69510,69513,69552,69579,69600,69622,69632,69701,69703,69709,69714,69743,69745,69749,69760,69785,69787,69787,69789,69802,69804,69816,69819,69826,69837,69837,69840,69864,69872,69881,69891,69926,69928,69933,69936,69938,69942,69959,69968,70002,70004,70006,70016,70079,70081,70089,70091,70111,70113,70132,70144,70161,70163,70196,70199,70209,70272,70278,70280,70280,70282,70285,70287,70301,70303,70313,70320,70376,70384,70393,70400,70403,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70463,70468,70471,70472,70480,70480,70493,70499,70528,70530,70532,70532,70534,70537,70539,70539,70544,70544,70546,70581,70583,70583,70585,70586,70588,70592,70602,70602,70604,70605,70609,70613,70615,70616,70625,70626,70656,70721,70723,70725,70727,70747,70749,70749,70751,70753,70784,70831,70833,70841,70847,70849,70852,70855,70864,70873,71040,71086,71088,71093,71096,71097,71100,71102,71105,71133,71168,71230,71232,71236,71248,71257,71264,71276,71296,71349,71352,71353,71360,71369,71376,71395,71424,71450,71453,71466,71472,71494,71680,71736,71739,71739,71840,71922,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,71985,71989,71991,71991,71995,71996,71999,72002,72004,72006,72016,72025,72096,72103,72106,72151,72154,72159,72161,72164,72192,72243,72245,72262,72272,72344,72346,72354,72368,72440,72448,72457,72544,72551,72640,72673,72688,72697,72704,72712,72714,72758,72760,72766,72768,72773,72784,72812,72816,72847,72850,72871,72873,72886,72960,72966,72968,72969,72971,73014,73018,73018,73020,73021,73023,73025,73027,73027,73030,73031,73040,73049,73056,73061,73063,73064,73066,73102,73104,73105,73107,73110,73112,73112,73120,73129,73136,73179,73184,73193,73440,73464,73472,73488,73490,73530,73534,73536,73539,73562,73648,73648,73664,73713,73727,74649,74752,74862,74864,74868,74880,75075,77712,77810,77824,78933,78944,82938,82944,83526,90368,90397,90410,90414,90416,90425,92160,92728,92736,92766,92768,92777,92782,92862,92864,92873,92880,92909,92917,92917,92928,92975,92983,92997,93008,93017,93019,93025,93027,93047,93053,93071,93504,93542,93547,93561,93760,93850,93856,93880,93883,93907,93952,94026,94031,94087,94095,94111,94176,94180,94194,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,113820,113821,113823,113827,117760,118012,118016,118451,118458,118480,118496,118512,118528,118573,118576,118598,118608,118723,118784,119029,119040,119078,119081,119133,119146,119148,119155,119162,119171,119172,119180,119209,119214,119226,119233,119274,119296,119361,119365,119365,119488,119507,119520,119539,119552,119638,119648,119672,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120779,120782,121483,121499,121503,121505,121519,122624,122654,122661,122666,122928,122989,123136,123180,123191,123197,123200,123209,123214,123215,123536,123565,123584,123627,123632,123641,123647,123647,124112,124139,124144,124153,124368,124397,124400,124410,124415,124415,124608,124638,124640,124642,124644,124645,124647,124653,124656,124660,124670,124671,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125127,125135,125184,125251,125259,125259,125264,125273,125278,125279,126065,126132,126209,126269,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,126704,126705,126976,127019,127024,127123,127136,127150,127153,127167,127169,127183,127185,127221,127232,127405,127462,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,128728,128732,128748,128752,128764,128768,128985,128992,129003,129008,129008,129024,129035,129040,129095,129104,129113,129120,129159,129168,129197,129200,129211,129216,129217,129232,129240,129280,129623,129632,129645,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,129792,129938,129940,130042,131072,173791,173824,178205,178208,183981,183984,191456,191472,192093,196608,201546,201552,210041,917505,917505,917536,917631,917760,917999,983040,1048573,1048576,1114109]}var At,jt=t((()=>{}));function Mt(e){if(!Number.isInteger(e))return!1;let t=kt(),n=0,r=t.length/2-1;for(;n<=r;){let i=n+r>>>1;if(e<t[i*2])r=i-1;else if(e>t[i*2+1])n=i+1;else return!0}return!1}var Nt=t((()=>{jt()}));function Pt(e,t){let n=e.fieldType===`slidenum`&&t!==void 0?String(t):e.text;return e.caps===`all`||e.caps===`small`?n.toUpperCase():n}var Ft=t((()=>{})),It=n({collectSlideFontDemand:()=>Lt});function Lt(e,t,n){let r=new Set,i=2;if(i>n)return`all`;let a=e=>{if(ve(e))return!1;for(let a of e){let e=a.codePointAt(0);if(!Mt(e)||e>=61472&&e<=61695)return!1;if(!t.has(e)&&!r.has(e)){if(i+=String(e).length+1,i>n)return!1;r.add(e)}}return!0},o=t=>{if(!t)return!0;if(t.vert&&t.vert!==`horz`||`textWarp`in t)return!1;for(let n of t.paragraphs){if(n.rtl||n.bullet?.type!==`none`&&n.bullet?.type!==`inherit`)return!1;for(let t of n.runs)if(t.type!==`break`&&(t.type!==`text`||t.fontFamilySym||t.fieldType&&t.fieldType!==`slidenum`||!a(t.text)||!a(Pt(t,e.slideNumber))))return!1}return!0};if(e.parseError||!a(`Mii `))return`all`;for(let t of e.elements)if(t.type===`shape`){if(!o(t.textBody))return`all`}else if(t.type===`table`){for(let e of t.rows)for(let t of e.cells)if(!o(t.textBody))return`all`}else return`all`;return[...r]}var Rt=t((()=>{j(),Ot(),Nt(),Ft()}));async function zt(e){return e?(await Promise.resolve().then(()=>(Rt(),It))).collectSlideFontDemand:void 0}function M(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer`)}function N(e,t,n){return M(e,`resource measurement`),M(t,`resource measurement`),M(n,`resource measurement limit`),e>n||t>n||t>n-e?n===2**53-1?n:n+1:e+t}function Bt(e,t=2**53-1){M(t,`resource measurement limit`);let n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=3}else a=3;if(n=N(n,a,t),n>t)return n}return n}function Vt(e,t=2**53-1){M(t,`resource measurement limit`);let n=N(0,2,t);if(n>t)return n;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i===34||i===92||i===8||i===9||i===10||i===12||i===13)a=2;else if(i<=31)a=6;else if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=6}else a=i>=55296&&i<=57343?6:3;if(n=N(n,a,t),n>t)return n}return n}function P(e,t){return N(0,e,t)}function F(e,t=2**53-1,n=!1){if(M(t,`resource measurement limit`),e===null)return{jsonBytes:P(4,t),stringValueUtf8Bytes:0};if(typeof e==`string`)return{jsonBytes:Vt(e,t),stringValueUtf8Bytes:Bt(e,t)};if(typeof e==`boolean`)return{jsonBytes:P(e?4:5,t),stringValueUtf8Bytes:0};if(typeof e==`number`)return{jsonBytes:P((Number.isFinite(e)?String(Object.is(e,-0)?0:e):`null`).length,t),stringValueUtf8Bytes:0};if(typeof e==`bigint`)throw TypeError(`BigInt values cannot be serialized to JSON`);if(Array.isArray(e)){let n=P(2,t),r=0;for(let i=0;i<e.length;i+=1){i!==0&&(n=N(n,1,t));let a=F(e[i],t,!0);n=N(n,a.jsonBytes,t),r=N(r,a.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}if(typeof e==`object`){let n=P(2,t),r=0,i=0;for(let[a,o]of Object.entries(e)){if(o===void 0||typeof o==`function`||typeof o==`symbol`)continue;i++!==0&&(n=N(n,1,t)),n=N(n,Vt(a,t),t),n=N(n,1,t);let e=F(o,t);n=N(n,e.jsonBytes,t),r=N(r,e.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}return{jsonBytes:n?P(4,t):0,stringValueUtf8Bytes:0}}j(),ce(),{..._,...oe};function*Ht(e){let t=[e[Symbol.iterator]()];for(;t.length;){let e=t[t.length-1].next();if(e.done){t.pop();continue}let n=e.value;yield n,(n.type===`shape`||n.type===`table`)&&n.mathFallback&&t.push(n.mathFallback.elements[Symbol.iterator]())}}function*Ut(e){for(let t of e?.paragraphs??[]){for(let e of t.mathFallbacks??[])yield e.text;for(let e of t.runs)e.type===`text`&&(yield e.text),e.type===`math`&&e.fallbackText&&(yield e.fallbackText)}}function*Wt(e){for(let t of e?.paragraphs??[]){t.defFontFamily&&(yield t.defFontFamily);for(let e of t.runs)e.type===`text`&&(e.fontFamily&&(yield e.fontFamily),e.fontFamilyEa&&(yield e.fontFamilyEa),e.fontFamilyCs&&(yield e.fontFamilyCs),e.fontFamilySym&&(yield e.fontFamilySym))}}function*Gt(e){for(let t of Ht(e.elements))if(t.type===`shape`)yield*Ut(t.textBody);else if(t.type===`table`)for(let e of t.rows)for(let t of e.cells)yield*Ut(t.textBody);else if(t.type===`chart`){t.chart.title&&(yield t.chart.title);for(let e of t.chart.categories)yield e;for(let e of t.chart.series)e.name&&(yield e.name)}}var Kt=class e{majorFont;minorFont;fallback;scriptNames;scripts;families;constructor(e,t,n,r,i,a=new Set){this.majorFont=e,this.minorFont=t,this.fallback=i,this.scriptNames=a;let o=y(e)??y(t)??i??null;this.scripts=n??new se(o),this.families=r??new Set,e&&this.families.add(e),t&&this.families.add(t)}addSlide(e){e.theme?.majorFont&&this.families.add(e.theme.majorFont),e.theme?.minorFont&&this.families.add(e.theme.minorFont),this.scripts.addText(Gt(e));for(let t of ne(Gt(e),y(e.theme?e.theme.majorFont:this.majorFont)??y(e.theme?e.theme.minorFont:this.minorFont)??this.fallback??null))this.scriptNames.add(t);for(let t of Ht(e.elements))if(t.type===`shape`)for(let e of Wt(t.textBody))this.families.add(e);else if(t.type===`table`)for(let e of t.rows)for(let t of e.cells)for(let e of Wt(t.textBody))this.families.add(e)}names(){return[...new Set([...this.families,...this.scripts.names(),...this.scriptNames])]}withSlide(t){let n=new e(this.majorFont,this.minorFont,this.scripts.clone(),new Set(this.families),this.fallback,new Set(this.scriptNames));return n.addSlide(t),n}};j(),A();const qt=Object.freeze({archiveEntryCount:0,declaredInflatedBytes:0,distinctInflatedBytes:0,operationInflatedBytes:0}),Jt=f;function I(e,t){if(e!==null&&typeof e!=`string`)throw Error(`invalid PPTX presentation bootstrap ${t}`)}function Yt(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);let n=e;if(n.index!==t)throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);if(n.partName!==void 0&&typeof n.partName!=`string`)throw Error(`invalid PPTX presentation bootstrap slide partName at ${t}`);return Object.freeze({index:n.index,...n.partName===void 0?{}:{partName:n.partName}})}function Xt(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`invalid PPTX presentation bootstrap embedded font at ${t}`);let n=e;if(typeof n.fontName!=`string`||n.fontName.length===0||![`regular`,`bold`,`italic`,`boldItalic`].includes(n.style??``)||typeof n.partPath!=`string`||n.partPath.length===0||n.partPath.startsWith(`/`)||n.partPath.split(`/`).includes(`..`)||![`application/x-font-ttf`,`application/x-fontdata`].includes(n.contentType??``))throw Error(`invalid PPTX presentation bootstrap embedded font fields at ${t}`);return Object.freeze({fontName:n.fontName,style:n.style,partPath:n.partPath,contentType:n.contentType})}function Zt(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`invalid PPTX presentation bootstrap payload`);let t=e;if(!Number.isSafeInteger(t.slideCount)||(t.slideCount??-1)<0||!Number.isSafeInteger(t.slideWidth)||(t.slideWidth??0)<=0||!Number.isSafeInteger(t.slideHeight)||(t.slideHeight??0)<=0||!Array.isArray(t.embeddedFonts)||!Array.isArray(t.slides)||t.slides.length!==t.slideCount)throw Error(`invalid PPTX presentation bootstrap dimensions or slide count`);return I(t.defaultTextColor,`defaultTextColor`),I(t.majorFont,`majorFont`),I(t.minorFont,`minorFont`),I(t.hlinkColor,`hlinkColor`),I(t.folHlinkColor,`folHlinkColor`),Object.freeze({slideCount:t.slideCount,slideWidth:t.slideWidth,slideHeight:t.slideHeight,defaultTextColor:t.defaultTextColor,majorFont:t.majorFont,minorFont:t.minorFont,hlinkColor:t.hlinkColor,folHlinkColor:t.folHlinkColor,embeddedFonts:Object.freeze(t.embeddedFonts.map(Xt)),slides:Object.freeze(t.slides.map(Yt))})}function Qt(e){return Object.freeze({type:`media`,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,flipH:e.flipH,flipV:e.flipV,mediaKind:e.mediaKind,posterPath:e.posterPath,posterMimeType:e.posterMimeType,mediaPath:e.mediaPath,mimeType:e.mimeType})}function $t(e){return Object.freeze({...e.id===void 0?{}:{id:e.id},...e.authorId===void 0?{}:{authorId:e.authorId},...e.author===void 0?{}:{author:e.author},...e.date===void 0?{}:{date:e.date},...e.status===void 0?{}:{status:e.status},text:e.text})}function en(e){return Object.freeze({...e})}function tn(e){return Object.freeze({...e.authorId===void 0?{}:{authorId:e.authorId},...e.modernAuthorId===void 0?{}:{modernAuthorId:e.modernAuthorId},...e.id===void 0?{}:{id:e.id},...e.index===void 0?{}:{index:e.index},...e.author===void 0?{}:{author:e.author},...e.date===void 0?{}:{date:e.date},...e.x===void 0?{}:{x:e.x},...e.y===void 0?{}:{y:e.y},...e.anchors?.length?{anchors:Object.freeze(e.anchors.map(en))}:{},...e.status===void 0?{}:{status:e.status},text:e.text,...e.replies?.length?{replies:Object.freeze(e.replies.map($t))}:{}})}function nn(e,t){if(e.index!==t.index||e.partName!==t.partName)throw Error(`PPTX pulled slide identity does not match bootstrap index ${t.index}`);return Object.freeze({index:t.index,...t.partName===void 0?{}:{partName:t.partName},notes:e.notes??null,hidden:e.hidden??!1,mediaElements:Object.freeze(e.elements.filter(e=>e.type===`media`).map(Qt)),...e.comments?.length?{comments:Object.freeze(e.comments.map(tn))}:{}})}function rn(e,t,n){if(!(e<=t))throw new i(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`,{stage:`parsing`,violation:{format:`pptx`,operation:`presentation-preflight`,resource:`presentation-preflight`,metric:`projected-bytes`,limit:t,observed:Math.min(e,t+1),configurable:!1,usage:n}})}var an=class{slideCountValue;slideWidthValue;slideHeightValue;defaultTextColorValue;majorFontValue;minorFontValue;hlinkColorValue;folHlinkColorValue;embeddedFontsValue;descriptors;slides=[];fonts;fontPreloadNames;fontProjectionBytes;projectionBytesValue;limit;pending=null;finished=null;demandPoints;demandAll=!1;demandBytes=0;demandMembershipBytes=0;demandDeltaBytes=0;collectFontDemand;demandDelta;constructor(e,t={}){let n=Zt(e),r=t.maxProjectionBytes??Jt;if(!Number.isSafeInteger(r)||r<=0||r>Jt)throw Error(`invalid PPTX presentation preflight limit`);this.limit=r,this.collectFontDemand=t.collectFontDemand,this.demandPoints=this.collectFontDemand?new Set:void 0,this.demandBytes=this.collectFontDemand?F({fontPreloadDemand:[]},this.limit).jsonBytes-1:0,this.demandMembershipBytes=this.demandBytes,this.slideCountValue=n.slideCount,this.slideWidthValue=n.slideWidth,this.slideHeightValue=n.slideHeight,this.defaultTextColorValue=n.defaultTextColor,this.majorFontValue=n.majorFont,this.minorFontValue=n.minorFont,this.hlinkColorValue=n.hlinkColor,this.folHlinkColorValue=n.folHlinkColor,this.embeddedFontsValue=n.embeddedFonts,this.descriptors=[...n.slides],this.fonts=new Kt(this.majorFontValue,this.minorFontValue,void 0,void 0,t.cjkFallback),this.fontPreloadNames=Object.freeze(this.fonts.names()),this.fontProjectionBytes=F(this.fontPreloadNames,this.limit).jsonBytes,this.projectionBytesValue=F({slideCount:this.slideCountValue,slideWidth:this.slideWidthValue,slideHeight:this.slideHeightValue,defaultTextColor:this.defaultTextColorValue,majorFont:this.majorFontValue,minorFont:this.minorFontValue,hlinkColor:this.hlinkColorValue,folHlinkColor:this.folHlinkColorValue,embeddedFonts:this.embeddedFontsValue,remainingSlides:this.descriptors,slides:[],fontPreloadNames:this.fontPreloadNames},this.limit).jsonBytes,this.projectionBytesValue+this.demandBytes>this.limit&&(this.demandAll=!0,this.demandBytes=0,this.demandMembershipBytes=0),this.projectionBytesValue=N(this.projectionBytesValue,this.demandBytes,this.limit),rn(this.projectionBytesValue,this.limit,qt)}get acceptedSlideCount(){return this.finished?.slideCount??this.slides.length}get projectedBytes(){return this.projectionBytesValue}get remainingDescriptorCount(){return this.descriptors.reduce((e,t)=>e+Number(t!==void 0),0)}get latestSlide(){return this.slides[this.slides.length-1]}get currentFontPreloadNames(){return this.fontPreloadNames}get currentFontPreloadDemandDelta(){return this.demandDelta}snapshot(){if(this.finished)return this.finished;if(this.pending)throw Error(`PPTX presentation preflight has an uncommitted slide`);return Object.freeze({slideCount:this.slideCountValue,slideWidth:this.slideWidthValue,slideHeight:this.slideHeightValue,defaultTextColor:this.defaultTextColorValue,majorFont:this.majorFontValue,minorFont:this.minorFontValue,hlinkColor:this.hlinkColorValue,folHlinkColor:this.folHlinkColorValue,embeddedFonts:this.embeddedFontsValue,slides:Object.freeze([...this.slides]),fontPreloadNames:this.fontPreloadNames})}addSlide(e,t=qt){this.prepareSlide(e,t).commit()}prepareSlide(e,t=qt){if(this.finished)throw Error(`PPTX presentation preflight is already finished`);if(this.pending)throw Error(`PPTX presentation preflight already has a prepared slide`);let n=this.slides.length,r=this.descriptors[n];if(!r)throw Error(`PPTX presentation preflight received an extra slide`);let i=nn(e,r),a=this.fonts.withSlide(e),o=Object.freeze(a.names()),s=F(o,this.limit).jsonBytes,c=F(i,this.limit).jsonBytes,l=this.projectionBytesValue-this.demandBytes-this.fontProjectionBytes-F(r,this.limit).jsonBytes+4;l=N(l,s,this.limit),l=N(l,c,this.limit),this.slides.length!==0&&(l=N(l,1,this.limit));let u=F({slide:i,fontPreloadNames:o},this.limit).jsonBytes,d=N(this.projectionBytesValue-this.demandBytes,u,this.limit),f=l;rn(Math.max(d,f),this.limit,t);let p=d+this.demandBytes;l+=this.demandBytes,Math.max(p,l)>this.limit&&this.demandBytes&&(this.projectionBytesValue-=this.demandBytes,this.demandBytes=0,this.demandMembershipBytes=0,this.demandDeltaBytes=0,this.demandPoints?.clear(),this.demandAll=!0,this.demandDelta=`all`,p=d,l=f);let m,h=this.demandBytes,g=this.demandMembershipBytes,_=this.demandDeltaBytes;if(this.collectFontDemand){let t=F([],this.limit).jsonBytes,n=this.limit-p,r=this.limit-f-this.demandMembershipBytes,i=Math.min(n,Math.floor((r+t-Number((this.demandPoints?.size??0)>0))/2));if(m=this.demandAll?`all`:this.collectFontDemand(e,this.demandPoints,Math.max(0,i)),m===`all`)h=0,g=0,_=0;else{_=F(m,this.limit).jsonBytes;let e=m.length===0?0:_-t+Number((this.demandPoints?.size??0)>0);g+=e,h=g+_,p+=_}l=f+h}rn(Math.max(p,l),this.limit,t);let v={state:`prepared`,fact:i,fonts:a,fontNames:o,fontBytes:s,committedBytes:l,demandDelta:m,demandBytes:h,demandMembershipBytes:g,demandDeltaBytes:_};return this.pending=v,{projectedBytes:p,commit:()=>{if(v.state!==`committed`){if(v.state===`rolled-back`)throw Error(`PPTX presentation preflight cannot commit a rolled-back slide`);if(this.pending!==v)throw Error(`PPTX presentation preflight prepared slide is stale`);if(this.descriptors[n]=void 0,this.slides.push(v.fact),this.fonts=v.fonts,this.fontPreloadNames=v.fontNames,this.fontProjectionBytes=v.fontBytes,this.projectionBytesValue=v.committedBytes,this.demandDelta=v.demandDelta,v.demandDelta===`all`)this.demandAll=!0,this.demandPoints?.clear();else for(let e of v.demandDelta??[])this.demandPoints?.add(e);this.demandBytes=v.demandBytes,this.demandMembershipBytes=v.demandMembershipBytes,this.demandDeltaBytes=v.demandDeltaBytes,v.state=`committed`,this.pending=null}},rollback:()=>{if(v.state!==`rolled-back`){if(v.state===`committed`)throw Error(`PPTX presentation preflight cannot roll back a committed slide`);if(this.pending!==v)throw Error(`PPTX presentation preflight prepared slide is stale`);v.state=`rolled-back`,this.pending=null}}}}finish(){if(this.finished)return this.finished;if(this.pending)throw Error(`PPTX presentation preflight has an uncommitted slide`);if(this.slides.length!==this.slideCountValue)throw Error(`PPTX presentation preflight is incomplete: ${this.slides.length}/${this.slideCountValue} slides`);return this.finished=Object.freeze({slideCount:this.slideCountValue,slideWidth:this.slideWidthValue,slideHeight:this.slideHeightValue,defaultTextColor:this.defaultTextColorValue,majorFont:this.majorFontValue,minorFont:this.minorFontValue,hlinkColor:this.hlinkColorValue,folHlinkColor:this.folHlinkColorValue,embeddedFonts:this.embeddedFontsValue,slides:Object.freeze([...this.slides]),fontPreloadNames:this.fontPreloadNames,...this.collectFontDemand&&!this.demandAll&&this.demandBytes?{fontPreloadDemand:Object.freeze([...this.demandPoints??[]])}:{}}),this.demandPoints?.clear(),this.demandDelta=void 0,this.descriptors=[],this.slides=[],this.projectionBytesValue=F(this.finished,this.limit).jsonBytes,this.finished}};A();function on(e){try{return Pe(e(e=>e.slide_cursor_resource_usage()))}catch(e){if(String(e).includes(`slide cursor usage is unavailable`))return;throw e}}function sn(e,t,n,r,i){let a,o;try{if(i){if(!r)throw Error(`slide payload is missing before acknowledgement`);let t=i(n,r,on(e));typeof t==`function`?a=t:t&&({rollback:a,commit:o}=t)}e(e=>e.acknowledge_slide(t.operationId,t.generation)),o?.()}catch(e){try{a?.()}catch{}throw e}}j(),A();var cn=class{archive;acceptSlide;executeArchive;coordinatorGeneration=new wt;sessions=new Map;pendingOpens=new Map;operationTail=Promise.resolve();resourceFailure;lifecycleState=`ready`;resetBarrier;resetIdentities=new Map;constructor(e,t,n=e=>e(this.requireArchive())){this.archive=e,this.acceptSlide=t,this.executeArchive=n}get coordinator(){return this.coordinatorGeneration}reserveOpen(e){if(this.assertReady(),un(e),this.pendingOpens.has(e.sessionId)||this.sessions.has(e.sessionId))throw Error(`slide pull session id is already reserved`);this.pendingOpens.set(e.sessionId,{identity:e,canceled:!1})}abandonOpen(e){this.pendingOpens.delete(e)}get pendingOpenCount(){return this.pendingOpens.size}async open(e,t){if(this.assertReady(),this.resourceFailure)throw this.resourceFailure;if(!Number.isSafeInteger(e)||e<0)throw RangeError(`slide index must be a non-negative safe integer`);let n=this.pendingOpens.get(t.sessionId);if(!n||!L(n.identity,t))throw Error(`slide pull session open reservation is stale or missing`);let r,i=new Promise(e=>{r=e}),a=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(n.canceled)throw Error(`slide pull session open was canceled`);let i,a=!1,o=new Tt({...t,maxByteCredit:d,coordinator:this.coordinator,driver:{pull:n=>{let r;try{r=this.executeArchive(r=>r.pull_slide(e,t.operationId,t.generation,n))}catch(e){throw ke(e,n,d)||(this.latchResourceFailure(e),e)}let o=yt(r);return this.acceptSlide&&(i=JSON.parse(new TextDecoder().decode(new Uint8Array(o)))),a=!0,{payload:o,byteLength:o.byteLength,done:!0,transfer:[o]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:()=>{if(!a)throw Error(`slide unit is not awaiting acknowledgement`);try{sn(this.executeArchive,t,e,i,this.acceptSlide)}catch(e){throw this.latchResourceFailure(e),e}a=!1,i=void 0,this.sessions.delete(t.sessionId),r()},cancel:async()=>{try{this.archive()&&await this.executeArchive(e=>e.cancel_slide())}finally{i=void 0,a=!1,this.sessions.delete(t.sessionId),r()}},close:async()=>{try{this.archive()&&await this.executeArchive(e=>e.cancel_slide())}finally{i=void 0,a=!1,this.sessions.delete(t.sessionId),r()}},resourceUsage:()=>{try{return this.readResourceUsage()}catch(e){throw this.latchResourceFailure(e),e}}}});this.sessions.set(t.sessionId,{host:o,identity:t}),this.pendingOpens.delete(t.sessionId)}));this.operationTail=a.then(()=>i,()=>void 0);try{await a}catch(e){throw this.pendingOpens.delete(t.sessionId),r(),e}}async postOpenedSafely(e,t,n){if(this.lifecycleState!==`ready`){try{n(this.lifecycleError())}catch{}return}try{t()}catch(t){await this.closeIdentity(e);try{n(t)}catch{}}}dispatch(e,t){if(this.lifecycleState!==`ready`)return t(this.responseDuringReset(e)),Promise.resolve();let n=this.sessions.get(e.sessionId);if(n)return n.host.dispatch(e,t);let r=this.pendingOpens.get(e.sessionId);if(r&&(e.kind===`cancel`||e.kind===`close`)){let n=L(r.identity,e);return n&&(r.canceled=!0),t(n?{protocol:k,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}:this.staleLifecycleResponse(e)),Promise.resolve()}return e.kind===`cancel`||e.kind===`close`?(t({protocol:k,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}),Promise.resolve()):(t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:E(Error(`slide pull session is not open`))}),Promise.resolve())}async dispatchSafely(e,t){try{await this.dispatch(e,t)}catch(n){try{t({protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:E(n)})}catch{}}}run(e){if(this.lifecycleState!==`ready`)return Promise.reject(this.lifecycleError());let t=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;return e()})).catch(e=>{throw this.latchResourceFailure(e),e});return this.operationTail=t.then(()=>void 0,()=>void 0),t}reset(){if(this.resetBarrier)return this.resetBarrier;this.lifecycleState=`resetting`,this.captureResetIdentities();let e=this.performReset().then(()=>{this.resetIdentities.clear(),this.lifecycleState=`ready`},e=>{throw this.lifecycleState=`reset-failed`,e}).finally(()=>{this.resetBarrier===e&&(this.resetBarrier=void 0)});return this.resetBarrier=e,e}async performReset(){for(let e of this.pendingOpens.values())e.canceled=!0;let e=1;for(let{host:t,identity:n}of[...this.sessions.values()]){let r;if(await t.dispatch({protocol:k,kind:`close`,...n,requestId:e++},e=>{e.kind===`error`&&(r=$e(e.error))}),r)throw r}this.sessions.clear(),await this.operationTail,this.pendingOpens.clear(),this.archive()&&await this.executeArchive(e=>e.close_presentation_session()),this.coordinatorGeneration=new wt,this.resourceFailure=void 0}assertReady(){if(this.lifecycleState!==`ready`)throw this.lifecycleError()}lifecycleError(){let e=this.lifecycleState===`reset-failed`,t=Error(e?`slide pull worker reset failed; retry reset before new work`:`slide pull worker reset is in progress`);return t.name=`PullSessionLifecycleError`,Object.assign(t,{code:e?`ooxml-pull-reset-failed`:`ooxml-pull-resetting`})}captureResetIdentities(){for(let{identity:e}of this.sessions.values())this.resetIdentities.set(e.sessionId,e);for(let{identity:e}of this.pendingOpens.values())this.resetIdentities.set(e.sessionId,e)}responseDuringReset(e){if(e.kind===`cancel`||e.kind===`close`){let t=this.resetIdentities.get(e.sessionId);return t&&!L(t,e)?this.staleLifecycleResponse(e):{protocol:k,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}}return{protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:E(this.lifecycleError())}}requireArchive(){let e=this.archive();if(!e)throw Error(`Presentation not loaded`);return e}async closeIdentity(e){if(this.lifecycleState!==`ready`)return;let t=this.sessions.get(e.sessionId);if(t){await t.host.dispatch({protocol:k,kind:`close`,...e,requestId:1},()=>void 0);return}let n=this.pendingOpens.get(e.sessionId);n&&L(n.identity,e)&&(n.canceled=!0)}readResourceUsage(){return on(this.executeArchive)}latchResourceFailure(e){let t=e instanceof i?e:He(e);t&&(this.resourceFailure??=t)}staleLifecycleResponse(e){return{protocol:k,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:{message:`stale lifecycle targets another slide operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`}}}};function ln(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}function un(e){if(!Number.isSafeInteger(e.sessionId)||e.sessionId<=0)throw RangeError(`session id must be a positive safe integer`);if(!Number.isSafeInteger(e.operationId)||e.operationId<=0)throw RangeError(`operation id must be a positive safe integer`);if(!Number.isSafeInteger(e.generation)||e.generation<=0)throw RangeError(`generation must be a positive safe integer`)}function L(e,t){return e.sessionId===t.sessionId&&e.operationId===t.operationId&&e.generation===t.generation}var dn=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,pn.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_pptxarchive_free(e,0)}acknowledge_slide(e,t){let n=Y.pptxarchive_acknowledge_slide(this.__wbg_ptr,e,t);if(n[1])throw G(n[0])}assert_healthy(){let e=Y.pptxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw G(e[0])}cancel_slide(){Y.pptxarchive_cancel_slide(this.__wbg_ptr)}close_presentation_session(){Y.pptxarchive_close_presentation_session(this.__wbg_ptr)}extract_font(e){let t=W(e,Y.__wbindgen_malloc,Y.__wbindgen_realloc),n=J,r=Y.pptxarchive_extract_font(this.__wbg_ptr,t,n);if(r[3])throw G(r[2]);var i=R(r[0],r[1]).slice();return Y.__wbindgen_free(r[0],r[1]*1,1),i}extract_image(e){let t=W(e,Y.__wbindgen_malloc,Y.__wbindgen_realloc),n=J,r=Y.pptxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw G(r[2]);var i=R(r[0],r[1]).slice();return Y.__wbindgen_free(r[0],r[1]*1,1),i}extract_media(e){let t=W(e,Y.__wbindgen_malloc,Y.__wbindgen_realloc),n=J,r=Y.pptxarchive_extract_media(this.__wbg_ptr,t,n);if(r[3])throw G(r[2]);var i=R(r[0],r[1]).slice();return Y.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=hn(e,Y.__wbindgen_malloc),a=J,o=Y.pptxarchive_new(i,a,!U(t),U(t)?BigInt(0):t,!U(n),U(n)?BigInt(0):n,!U(r),U(r)?BigInt(0):r);if(o[2])throw G(o[1]);return this.__wbg_ptr=o[0]>>>0,pn.register(this,this.__wbg_ptr,this),this}parse(){let e=Y.pptxarchive_parse(this.__wbg_ptr);if(e[3])throw G(e[2]);var t=R(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*1,1),t}presentation_bootstrap(){let e=Y.pptxarchive_presentation_bootstrap(this.__wbg_ptr);if(e[3])throw G(e[2]);var t=R(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*1,1),t}pull_slide(e,t,n,r){let i=Y.pptxarchive_pull_slide(this.__wbg_ptr,e,t,n,r);if(i[3])throw G(i[2]);var a=R(i[0],i[1]).slice();return Y.__wbindgen_free(i[0],i[1]*1,1),a}resource_usage(){let e=Y.pptxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw G(e[2]);var t=R(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*1,1),t}slide_cursor_resource_usage(){let e=Y.pptxarchive_slide_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw G(e[2]);var t=R(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=Y.pptxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,G(i[2]);return e=n,t=r,B(n,r)}finally{Y.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(dn.prototype[Symbol.dispose]=dn.prototype.free);function fn(){return{__proto__:null,"./pptx_parser_bg.js":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(B(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(B(e,t))}finally{Y.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=W(n,Y.__wbindgen_malloc,Y.__wbindgen_realloc),i=J;mn().setInt32(e+4,i,!0),mn().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return B(e,t)},__wbindgen_init_externref_table:function(){let e=Y.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const pn=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_pptxarchive_free(e>>>0,1));function R(e,t){return e>>>=0,H().subarray(e/1,e/1+t)}let z=null;function mn(){return(z===null||z.buffer.detached===!0||z.buffer.detached===void 0&&z.buffer!==Y.memory.buffer)&&(z=new DataView(Y.memory.buffer)),z}function B(e,t){return e>>>=0,_n(e,t)}let V=null;function H(){return(V===null||V.byteLength===0)&&(V=new Uint8Array(Y.memory.buffer)),V}function U(e){return e==null}function hn(e,t){let n=t(e.length*1,1)>>>0;return H().set(e,n/1),J=e.length,n}function W(e,t,n){if(n===void 0){let n=q.encode(e),r=t(n.length,1)>>>0;return H().subarray(r,r+n.length).set(n),J=n.length,r}let r=e.length,i=t(r,1)>>>0,a=H(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=H().subarray(i+o,i+r),a=q.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return J=o,i}function G(e){let t=Y.__wbindgen_externrefs.get(e);return Y.__externref_table_dealloc(e),t}let K=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});K.decode();let gn=0;function _n(e,t){return gn+=t,gn>=2146435072&&(K=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),K.decode(),gn=t),K.decode(H().subarray(e,e+t))}const q=new TextEncoder;`encodeInto`in q||(q.encodeInto=function(e,t){let n=q.encode(e);return t.set(n),{read:e.length,written:n.length}});let J=0,Y;function vn(e,t){return Y=e.exports,z=null,V=null,Y.__wbindgen_start(),Y}async function yn(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function bn(e){if(Y!==void 0)return Y;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=fn();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await yn(await e,t);return vn(n,r)}async function xn(e){return Y=void 0,z=null,V=null,bn(e)}j(),A();const X=new _t(bn,{freeArchive:e=>e.free(),reinit:xn});let Z=null,Sn=`empty`;function Cn(){if(Sn!==`empty`){let e=Error(`this PPTX worker already owns a presentation parse`);throw e.name=`PptxWorkerStateError`,Object.assign(e,{code:`ooxml-pptx-parse-already-started`})}Sn=`opening`}const Q=new cn(()=>X.archive,(e,t,n)=>{if(Z){if(e!==Z.acceptedSlideCount)throw Error(`PPTX preflight expected slide ${Z.acceptedSlideCount}, received ${e}`);return Z.prepareSlide(t,n)}},e=>{let t=X.archive;if(!t)throw Error(`Presentation not loaded`);return X.run(()=>e(t))}),$=(e,t)=>self.postMessage(e,t);self.onmessage=async e=>{let t=e.data;if(ln(t)){await Q.dispatchSafely(t,$);return}if(t.kind===`init`){X.setWasmInput(we(t.wasmUrl)??t.wasmUrl);return}let n=t.id,r=!1;try{if(t.kind===`openSlideSession`&&Q.reserveOpen(t),t.kind===`parse`&&(Cn(),r=!0),t.kind===`openSlideSession`){await X.ensureReady(),await Q.open(t.slideIndex,t),await Q.postOpenedSafely(t,()=>$({kind:`slideSessionOpened`,id:n,sessionId:t.sessionId,operationId:t.operationId,generation:t.generation}),e=>$({kind:`error`,id:n,...E(e)}));return}t.kind===`parse`&&await Q.reset(),await Q.run(async()=>{if(await X.ensureReady(),t.kind!==`parse`&&X.archive){let e=X.archive;X.run(()=>e.assert_healthy())}if(t.kind===`parse`){Z=null;let[e,r,i]=xt(t.resourcePolicy),a=X.run(()=>{let n=new dn(new Uint8Array(t.buffer),e,r,i);return X.setArchive(n),JSON.parse(new TextDecoder().decode(n.presentation_bootstrap()))});Z=t.progressiveLayout?null:new an(a,{cjkFallback:t.cjkFallback,collectFontDemand:t.collectFontDemand===!0?await zt(!0):void 0}),$({kind:`presentationOpened`,id:n,bootstrap:a}),Sn=`ready`;return}let e=X.archive;if(!e)throw Error(`No pptx loaded`);if(t.kind===`finishPresentationPreflight`){if(!Z)throw Error(`PPTX presentation preflight is not active`);let e=Z.finish();Z=null,$({kind:`presentationPreflightReady`,id:n,preflight:e});return}if(t.kind===`extractMedia`){let r=X.run(()=>e.extract_media(t.path).buffer);$({kind:`mediaExtracted`,id:n,bytes:r},[r]);return}if(t.kind===`extractImage`){let r=X.run(()=>e.extract_image(t.path).buffer);$({kind:`imageExtracted`,id:n,bytes:r},[r]);return}if(t.kind===`extractFont`){let r=X.run(()=>e.extract_font(t.path).buffer);$({kind:`fontExtracted`,id:n,bytes:r},[r]);return}if(t.kind===`resourceUsage`){$({kind:`resourceUsage`,id:n,usage:Pe(X.run(()=>e.resource_usage()))});return}t.kind===`toMarkdown`&&$({kind:`markdownRendered`,id:n,markdown:X.run(()=>e.to_markdown())})})}catch(e){r&&(Sn=`failed`),t.kind===`openSlideSession`&&Q.abandonOpen(t.sessionId);try{$({kind:`error`,id:n,...E(e)})}catch{}}};',Vr=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,Br],{type:`text/javascript;charset=utf-8`});function Hr(e){let t;try{if(t=Vr&&(self.URL||self.webkitURL).createObjectURL(Vr),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Br),{type:`module`,name:e?.name})}}var Ur=new URL(`/office/assets/pptx_parser_bg-DON650C_.wasm`,``+import.meta.url).href,Wr=65536,Gr=16384,Kr=new Set([`line`,`straightconnector1`]);function qr(e,t){let n=e.x+e.width/2,r=e.y+e.height/2,i=-e.rotation*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=t.x-n,c=t.y-r,l=n+a*s-o*c,u=r+o*s+a*c;return e.flipH&&(l=2*n-l),e.flipV&&(u=2*r-u),{x:l,y:u}}function Jr(e,t,n){let r=n.x-t.x,i=n.y-t.y,a=r*r+i*i;if(a===0)return Math.hypot(e.x-t.x,e.y-t.y);let o=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/a));return Math.hypot(e.x-(t.x+o*r),e.y-(t.y+o*i))}function Yr(e,t,n=0){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let r=qr(e,t),i=Number.isFinite(n)&&n>0?n:0;if(e.type===`shape`&&(Kr.has(e.geometry.toLowerCase())||e.width===0||e.height===0))return Jr(r,{x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height})<=i;let a=Math.min(e.x,e.x+e.width),o=Math.max(e.x,e.x+e.width),s=Math.min(e.y,e.y+e.height),c=Math.max(e.y,e.y+e.height);return r.x>=a&&r.x<=o&&r.y>=s&&r.y<=c}function*Xr(e){if(e)for(let t of e.paragraphs){let e=!0;for(let n of t.runs){let t=n.type===`text`?n.text:n.type===`break`?`
3
+ `:`[equation]`;t&&(yield{text:t,beginsPart:e},e=!1)}}}function*Zr(e){if(e.type===`shape`)yield*Xr(e.textBody);else if(e.type===`table`)for(let t of e.rows)for(let e of t.cells)yield*Xr(e.textBody)}function Qr(e,t=Gr){if(!Number.isFinite(t)||t<0)throw RangeError(`maxTextCharacters must be a finite non-negative number.`);let n=Math.min(Wr,Math.floor(t)),r=e.text,i=r===void 0?void 0:E(r,n),a=r!==void 0&&i.length<r.length;return{...structuredClone(e),...i===void 0?{}:{text:i},truncated:e.truncated||a,truncationReasons:e.truncated||a?[`text`]:[],textCharacters:i?.length??0,maxTextCharacters:n}}function $r(e,t){let n=[],r=0,i=!1,a=!1;for(let o of e){if(a=!0,o.beginsPart&&n.length>0){if(r>=t){i=!0;break}n.push(`
4
+ `),r++}let e=Math.max(0,t-r),s=E(o.text,e);if(n.push(s),r+=s.length,s.length<o.text.length){i=!0;break}}return a?{text:n.join(``),truncated:i,textCharacters:r}:{truncated:!1,textCharacters:0}}function ei(e,t,n,r={}){if(!Number.isFinite(n.x)||!Number.isFinite(n.y))throw RangeError(`PPTX hit-test point must contain finite coordinates.`);let i=r.maxTextCharacters??Gr;if(!Number.isFinite(i)||i<0)throw RangeError(`maxTextCharacters must be a finite non-negative number.`);let a=Math.min(Wr,Math.floor(i)),o=r.tolerance??0;if(!Number.isFinite(o)||o<0)throw RangeError(`tolerance must be a finite non-negative number.`);for(let r=t.elements.length-1;r>=0;r--){let i=t.elements[r];if(!Yr(i,n,o))continue;let s=i.type===`chart`?qe(i.chart,a):$r(Zr(i),a);return{format:`pptx`,kind:`element`,slideIndex:e,elementIndex:r,origin:t.elementSources?.[r]?.origin??`unknown`,elementType:i.type,point:{...n},bounds:{x:i.x,y:i.y,width:i.width,height:i.height,rotation:i.rotation,flipH:i.flipH,flipV:i.flipV},...i.type===`shape`?{...i.id===void 0?{}:{shapeId:i.id},...i.name===void 0?{}:{name:i.name},geometry:i.geometry}:{},...s.text===void 0?{}:{text:s.text},...i.type===`picture`?{mimeType:i.mimeType}:{},...i.type===`media`?{mimeType:i.mimeType,mediaKind:i.mediaKind}:{},...i.type===`table`?{rowCount:i.rows.length,columnCount:i.cols.length}:{},...i.type===`chart`?{seriesCount:i.chart.series.length}:{},truncated:s.truncated,truncationReasons:s.truncated?[`text`]:[],textCharacters:s.textCharacters,maxTextCharacters:a}}return null}function ti(e,t){let n=new Set(t.filter(e=>e.length>0));if(n.size===0)return Object.freeze([]);let r=new Map;for(let[t,i]of e.elements.entries()){let a=i.id;if(!a||!n.has(a))continue;let o=e.elementSources?.[t]?.origin??`unknown`,s=o===`slide`?3:o===`layout`?2:+(o===`master`),c=r.get(a),l=c?.origin===`slide`?3:c?.origin===`layout`?2:+(c?.origin===`master`);c&&l>s||r.set(a,Object.freeze({elementId:a,elementIndex:t,origin:o,elementType:i.type,bounds:Object.freeze({x:i.x,y:i.y,width:i.width,height:i.height,rotation:i.rotation,flipH:i.flipH,flipV:i.flipV})}))}return Object.freeze(t.flatMap(e=>{let t=r.get(e);return t?[t]:[]}))}var Q=new WeakMap;function ni(e,t){let n=Object.freeze({...t});for(let t of[...Q.get(e)??[]])try{t.notify(n)}catch(e){try{t.report(e)}catch{}}}function ri(e,t,n,r){let i=Q.get(e);i||(i=new Set,Q.set(e,i));let a=Object.freeze({notify:n,report:r});i.add(a);try{n(Object.freeze({...t()}))}catch(e){try{r(e)}catch{}}return()=>{i?.delete(a),i?.size===0&&Q.delete(e)}}function ii(){return new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),t.port2.close(),e()},t.port2.postMessage(void 0)})}var ai=class e{_cjkFallback=`jp`;_googleSubstitutes=!1;_parsedTextChain=!0;_metrics=null;_worker;_bridge;_mode=`main`;_bootstrap=null;_preflight=null;_availableSlideCount=0;_layoutLifecycle=new bn;_layoutObservers=new xn;_layoutCompletion=null;_parseRequestId=null;_progressive=null;_progressiveWatchdog;_progressiveWatchdogMs;_layoutWaiters=new Set;_slides=null;_slidePullClient=null;_resourceFailure=null;_slidePartIndex=null;_rawParts=new ce({maxEntries:64,maxBytes:ge});_googleFonts=null;_officeFontLoads=new Map;_embeddedFontFaces=[];_embeddedFontAliases=new Map;_embeddedFontAuthoredFamilies=new Map;_embeddedFontTuples=new Set;_destroyed=!1;_fetchImage=(e,t)=>this.getImage(e,t);_fetchMedia=e=>this.getMedia(e);_math;_threeD;_regionMap;_chartEx;_tiff;constructor(e,t,n){this._worker=e,this._mode=t,this._bridge=new Ce(this._worker,{correlate:e=>`protocol`in e&&e.protocol===`ooxml-pull-v1`?e.requestId:`id`in e?e.id:void 0,toError:e=>!(`protocol`in e)&&e.kind===`error`?c(e):void 0,onUnsolicited:e=>this._onWorkerLayoutPush(e)});let r=new URL(n??Ur,location.href).href;this._bridge.post({kind:`init`,wasmUrl:r})}_assertResourceHealthy(){if(this._resourceFailure)throw this._resourceFailure}_rethrowWithResourceFailure(e){let t=e instanceof i?e:be(e);throw t?(this._resourceFailure??=t,this._resourceFailure):e}static async load(t,n={}){if(n.legacyPpt!==void 0){let{loadPptxModelSource:e}=await b(async()=>{let{loadPptxModelSource:e}=await import(`./presentation-model-source-DLNioq7T-Demo5cCW.js`);return{loadPptxModelSource:e}},[]);return e(t,n)}let r=ye(n.cjkFallback),i=y(n),a=n.mode??`main`,s=new o({enabled:!0,format:`pptx`,mode:a,policy:i.policy,onMetrics:i.onResourceMetrics,emitToConsole:i.debug});try{if(a===`worker`&&(typeof Worker>`u`||typeof OffscreenCanvas>`u`))throw Error(`mode: 'worker' requires Worker and OffscreenCanvas support`);let o;if(typeof t==`string`){let e=await fetch(t);if(!e.ok)throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);o=await e.arrayBuffer()}else o=t;o=ln(await cn(o,n.password)),s.setSourceBytes(o.byteLength),s.checkpoint(`container ready`);let c=a===`worker`?(await b(async()=>{let{createRenderWorker:e}=await import(`./render-worker-host-CVr53kg0-DUcW76F6.js`);return{createRenderWorker:e}},[])).createRenderWorker():new Hr,l=a===`worker`?qn(n):void 0,u;try{u=new e(c,a,n.wasmUrl),u._metrics=s,n.math&&a===`worker`&&!l?.math&&console.warn(`[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math.`),n.threeD&&a===`worker`&&!l?.threeD&&console.warn(`[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d.`),u._cjkFallback=r,u._math=a===`worker`?void 0:n.math,u._threeD=a===`worker`?void 0:n.threeD,n.regionMap&&a===`worker`&&!l?.regionMap&&console.warn(`[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map.`),u._regionMap=a===`worker`?void 0:n.regionMap,n.chartEx&&a===`worker`&&!l?.chartEx&&console.warn(`[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex.`),u._chartEx=a===`worker`?void 0:n.chartEx,n.tiff&&a===`worker`&&!l?.tiff&&console.warn(`[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them.`),u._tiff=a===`worker`?void 0:n.tiff;let t=n.progressiveLayout?{onProgress:n.onLayoutProgress,onPartial:n.onLayoutPartial,onComplete:n.onLayoutComplete,firstPublication:Sn(),published:!1,deferred:!1,settled:!1}:void 0;return u._googleSubstitutes=!!n.useGoogleFonts,await u._parse(o,i.policy,!!n.useGoogleFonts,n.workerTimeoutMs,e=>s.observeUsage(e),l,t),s.checkpoint(`presentation preflight ready`),a===`main`&&n.useGoogleFonts&&u._preflight&&!t&&await u._ensureGoogleFonts(zr(u._preflight.fontPreloadNames,u._embeddedFontAliases),u._preflight.fontPreloadDemand),s.succeed({slides:u.slideCount}),u}catch(e){let t=u;throw we(c,t?()=>t.destroy():void 0),e}}catch(e){throw s.fail(e),e}}async _ensureGoogleFonts(e,t){this._destroyed||(this._googleFonts??=new ee(le),await this._googleFonts.ensure(e,t))}async _parse(e,t,n=!1,r,i,a,o){if(o){this._progressive=o,this._mode===`worker`?await this._parseWorkerProgressively(e,t,n,r,i,a,o):await this._parseMainProgressively(e,t,n,r,i,o,n&&!a);return}let s=await this._bridge.request(r=>this._mode===`worker`?{kind:`parse`,id:r,buffer:e,resourcePolicy:t,useGoogleFonts:n,cjkFallback:this._cjkFallback,renderers:a}:{kind:`parse`,id:r,buffer:e,resourcePolicy:t,cjkFallback:this._cjkFallback,...n&&!a?{collectFontDemand:!0}:{}},[e],{timeoutMs:r});if(this._mode===`worker`){let e=s;e.usage&&i?.(e.usage),this._preflight=se(s.preflight),this._bootstrap=this._preflight,this._availableSlideCount=this._preflight.slideCount;return}let c=S(s.bootstrap);this._bootstrap=c;let u=Rr(c.embeddedFonts,e=>this.getFontBytes(e)).then(e=>{this._destroyed?V(e.faces):(this._embeddedFontFaces=e.faces,this._embeddedFontAliases=e.aliases,this._embeddedFontAuthoredFamilies=e.authoredFamilies,this._embeddedFontTuples=e.tuples)});u.catch(()=>void 0),this._slidePullClient=new ae({slideCount:c.slideCount,transport:this._bridge.transport(ne),open:async(e,t,n)=>{await this._bridge.request(n=>({kind:`openSlideSession`,id:n,slideIndex:e,...t}),void 0,{timeoutMs:n})},onUsage:i});let d;try{for(let e=0;e<c.slideCount;e+=1)await this._slidePullClient.load(e,!1,r);d=await this._bridge.request(e=>({kind:`finishPresentationPreflight`,id:e}),void 0,{timeoutMs:r}),await u}catch(e){throw u.catch(()=>void 0),e}this._preflight=se(d.preflight),this._availableSlideCount=this._preflight.slideCount,this._slides=new Pr({slideCount:this._preflight.slideCount,maxCachedSlides:8,maxCachedStructuralBytes:l,loadSlide:async e=>{let t=await this._slidePullClient?.load(e,!0,r);if(!t)throw Error(`PPTX slide pull client is unavailable`);return t}})}async _parseMainProgressively(e,t,n,r,i,a,o=n){let s=S((await this._bridge.request(n=>({kind:`parse`,id:n,buffer:e,resourcePolicy:t,cjkFallback:this._cjkFallback,progressiveLayout:!0}),[e],{timeoutMs:r})).bootstrap);this._bootstrap=s;let c=Rr(s.embeddedFonts,e=>this.getFontBytes(e)).then(e=>{this._destroyed?V(e.faces):(this._embeddedFontFaces=e.faces,this._embeddedFontAliases=e.aliases,this._embeddedFontAuthoredFamilies=e.authoredFamilies,this._embeddedFontTuples=e.tuples)});c.catch(()=>void 0),this._slidePullClient=this._createSlidePullClient(s.slideCount,r,i),this._slides=new Pr({slideCount:s.slideCount,maxCachedSlides:8,maxCachedStructuralBytes:l,loadSlide:async e=>{let t=await this._slidePullClient?.load(e,!0,r);if(!t)throw Error(`PPTX slide pull client is unavailable`);return t}});let u=new he(s,{cjkFallback:this._cjkFallback,collectFontDemand:o?await ar(!0):void 0}),d=async()=>{await c,n&&await this._ensureGoogleFonts(zr(u.currentFontPreloadNames,this._embeddedFontAliases),u.currentFontPreloadDemandDelta)},f=(async()=>{for(let e=0;e<s.slideCount;e+=1)await this._slides.withSlide(e,e=>{u.addSlide(e)}),await d(),this._applyProgressivePrefix(u.snapshot(),a),e===0&&a.deferred&&await ii();await c,this._finishProgressiveLayout(u.finish(),a)})();this._layoutCompletion=f.then(()=>void 0,e=>this._failProgressiveLayout(e,a)),await a.firstPublication.promise}async _parseWorkerProgressively(e,t,n,r,i,a,o){this._progressiveWatchdogMs=r;let s=this._bridge.request(r=>(this._parseRequestId=r,{kind:`parse`,id:r,buffer:e,resourcePolicy:t,useGoogleFonts:n,cjkFallback:this._cjkFallback,renderers:a,progressiveLayout:!0}),[e],{timeoutMs:!1});this._rearmProgressiveWatchdog(),this._layoutCompletion=s.then(e=>{this._parseRequestId=null;let t=e;t.usage&&i?.(t.usage),this._finishProgressiveLayout(se(t.preflight),o)},e=>{this._parseRequestId=null,this._failProgressiveLayout(e,o)}),await o.firstPublication.promise}_createSlidePullClient(e,t,n){return new ae({slideCount:e,transport:this._bridge.transport(ne),open:async(e,n,r)=>{await this._bridge.request(t=>({kind:`openSlideSession`,id:t,slideIndex:e,...n}),void 0,{timeoutMs:r??t})},onUsage:n})}_onWorkerLayoutPush(e){if(!Ee((e,t)=>this._worker.postMessage(e,t),e)&&`kind`in e&&e.kind===`presentationLayoutPartial`&&e.forId===this._parseRequestId&&this._progressive)try{this._rearmProgressiveWatchdog(),e.usage&&this._metrics?.observeUsage(e.usage),e.bootstrap&&(this._bootstrap=S(e.bootstrap));let t=this._bootstrap;if(!t)throw Error(`PPTX progressive worker published before bootstrap`);let n=this._preflight?.slides??[];if(e.availableSlides!==n.length+1||e.slide.index!==n.length)throw Error(`PPTX progressive worker published a non-sequential slide`);this._applyProgressivePrefix(pe({...t,slides:[...n,e.slide],fontPreloadNames:e.fontPreloadNames}),this._progressive),ii().then(()=>{this._destroyed||this._parseRequestId!==e.forId||this._bridge.post({kind:`continuePresentationPreflight`,forId:e.forId,availableSlides:e.availableSlides})}).catch(t=>{this._destroyed||this._parseRequestId!==e.forId||!this._progressive||(this._failProgressiveLayout(t,this._progressive),this._bridge.terminate())})}catch(e){this._failProgressiveLayout(e,this._progressive),this._bridge.terminate()}}_applyProgressivePrefix(e,t){if(!(t.settled||this._destroyed)){if(this._preflight=e,this._availableSlideCount=e.slides.length,!t.published&&e.slides.length===e.slideCount){t.published=!0,t.deferred=!1;return}if(this._layoutLifecycle.begin(),this._wakeLayoutWaiters(),this._layoutObservers.notify(`onLayoutProgress`,t.onProgress,{committedUnits:this._availableSlideCount}),ni(this,{availableSlides:this._availableSlideCount,slideCount:this.slideCount,exact:!1,complete:!1}),!t.published){t.published=!0,t.deferred=e.slides.length<e.slideCount,t.firstPublication.resolve();return}this._layoutObservers.notify(`onLayoutPartial`,t.onPartial,{availableUnits:this._availableSlideCount,totalUnits:this.slideCount,exact:!1})}}_finishProgressiveLayout(e,t){t.settled||this._destroyed||(t.settled=!0,this._clearProgressiveWatchdog(),this._preflight=e,this._bootstrap??=e,this._availableSlideCount=e.slideCount,this._layoutLifecycle.succeed(),this._wakeLayoutWaiters(),t.firstPublication.resolve(),ni(this,{availableSlides:this._availableSlideCount,slideCount:this.slideCount,exact:!0,complete:!0}),this._layoutObservers.notify(`onLayoutComplete`,t.onComplete))}_failProgressiveLayout(e,t){if(t.settled||(t.settled=!0,this._clearProgressiveWatchdog(),this._destroyed))return;if(!t.deferred){t.firstPublication.reject(e);return}let n=this._layoutLifecycle.fail(e);this._wakeLayoutWaiters(),ni(this,{availableSlides:this._availableSlideCount,slideCount:this.slideCount,exact:!1,complete:!1,error:n}),this._layoutObservers.notify(`onLayoutComplete`,t.onComplete,n)}_wakeLayoutWaiters(){for(let e of this._layoutWaiters)e();this._layoutWaiters.clear()}_rearmProgressiveWatchdog(){this._progressiveWatchdogMs!==void 0&&(clearTimeout(this._progressiveWatchdog),this._progressiveWatchdog=setTimeout(()=>{let e=this._progressive,t=this._progressiveWatchdogMs;if(!e||e.settled||t===void 0||this._destroyed)return;let n=Error(`worker layout produced no progress for ${t}ms`);this._failProgressiveLayout(n,e),this._bridge.terminate()},this._progressiveWatchdogMs))}_clearProgressiveWatchdog(){clearTimeout(this._progressiveWatchdog),this._progressiveWatchdog=void 0,this._progressiveWatchdogMs=void 0}async _waitForSlide(e){for(;!this._destroyed&&e>=this._availableSlideCount&&!this._layoutLifecycle.settled;)await new Promise(e=>this._layoutWaiters.add(e));e>=this._availableSlideCount&&await this.waitUntilLayoutComplete()}_assertSlideIndex(e){if(!Number.isInteger(e)||e<0||e>=this.slideCount)throw Error(`Slide index ${e} out of range (count: ${this.slideCount})`)}get slideCount(){return this._bootstrap?.slideCount??this._preflight?.slideCount??0}get availableSlideCount(){return this._availableSlideCount}get layoutComplete(){return this._layoutLifecycle.complete}async waitUntilLayoutComplete(){this._layoutCompletion&&await this._layoutCompletion,this._layoutLifecycle.throwIfFailed()}get slideWidth(){return this._bootstrap?.slideWidth??this._preflight?.slideWidth??0}get slideHeight(){return this._bootstrap?.slideHeight??this._preflight?.slideHeight??0}get mode(){return this._mode}getNotes(e){return Number.isInteger(e)?this._preflight?.slides[e]?.notes??null:null}getComments(e){return Number.isInteger(e)?this._preflight?.slides[e]?.comments??[]:[]}isHidden(e){return Number.isInteger(e)?this._preflight?.slides[e]?.hidden??!1:!1}_partNames(){return(this._bootstrap?.slides??this._preflight?.slides??[]).map(e=>e.partName)}_partIndex(){return this._slidePartIndex||=Er(this._partNames()),this._slidePartIndex}getSlideIndexByPartName(e){return this._partIndex().get(e)}resolveInternalTarget(e,t=0){return Or(e,this._partIndex(),t)}async _officeRoutesForRequests(e,t){if(this._destroyed)throw Error(`Presentation destroyed`);if(!t)return{routes:{},installed:[]};let n=Ir(e,this._embeddedFontTuples),r=this._officeFontLoads.get(t);r||(r=new Map,this._officeFontLoads.set(t,r));let i=await Ar(r,n,e=>te(e,t),t);if(this._destroyed)throw Error(`Presentation destroyed`);return i}async renderSlide(e,t,n={}){this._assertResourceHealthy();try{if(this._mode===`worker`)throw Error(`renderSlide(canvas) is unavailable in mode: 'worker'; use renderSlideToBitmap() and paint it via an ImageBitmapRenderingContext`);if(this._assertSlideIndex(t),await this._waitForSlide(t),this._destroyed)throw Error(`Presentation destroyed`);let r=this._preflight,i=this._slides;if(!r||!i)throw Error(`Presentation not loaded`);let a=n.dpr??u(),o=n.width??((ie(e)?e.offsetWidth:0)||960),s=await i.withSlide(t,e=>me(e,r.majorFont,r.minorFont));if(this._destroyed)throw Error(`Presentation destroyed`);let c=ie(e)?e.ownerDocument.fonts:typeof document<`u`?document.fonts:null,{routes:l,installed:d}=await this._officeRoutesForRequests(s,c);await i.withSlide(t,t=>{if(this._destroyed)throw Error(`Presentation destroyed`);return this._assertResourceHealthy(),fe(e,t,r.slideWidth,r.slideHeight,{width:o,dpr:a,defaultTextColor:r.defaultTextColor,parsedTextChain:this._parsedTextChain,cjkFallback:this._cjkFallback,majorFont:r.majorFont,minorFont:r.minorFont,hlinkColor:r.hlinkColor,embeddedFontAliases:this._embeddedFontAliases,embeddedFontAuthoredFamilies:this._embeddedFontAuthoredFamilies,embeddedFontTuples:this._embeddedFontTuples,officeFontRoutes:l,officeInstalledFamilies:d,googleSubstitutes:this._googleSubstitutes,fetchMedia:this._fetchMedia,fetchImage:this._fetchImage,skipMediaControls:n.skipMediaControls,dim:n.dim,math:this._math,threeD:this._threeD,regionMap:this._regionMap,chartEx:this._chartEx,tiff:this._tiff,imageResources:n.imageResources},n.onTextRun)})}catch(e){this._rethrowWithResourceFailure(e)}}async renderSlideToBitmap(e,t={}){this._assertResourceHealthy();try{this._assertSlideIndex(e),await this._waitForSlide(e);let n=t.width??960,r=t.dpr??u();if(this._mode===`worker`){let i=new OffscreenCanvas(1,1),a=await this._bridge.request(a=>({kind:`renderSlide`,id:a,slideIndex:e,width:n,dpr:r,imageResources:t.imageResources,skipMediaControls:t.skipMediaControls,dim:t.dim,canvas:i}),[i]);try{if(t.onTextRun)for(let e of a.runs)t.onTextRun(e)}catch(e){throw ve(a.bitmap),e}return a.bitmap}let i=new OffscreenCanvas(1,1);return await this.renderSlide(i,e,{width:n,dpr:r,imageResources:t.imageResources,skipMediaControls:t.skipMediaControls,dim:t.dim,onTextRun:t.onTextRun}),i.transferToImageBitmap()}catch(e){this._rethrowWithResourceFailure(e)}}async collectSlideRuns(e,t=960){this._assertResourceHealthy();try{if(this._assertSlideIndex(e),await this._waitForSlide(e),this._mode===`worker`){let n=new OffscreenCanvas(1,1);return(await this._bridge.request(r=>({kind:`collectRuns`,id:r,slideIndex:e,width:t,canvas:n}),[n])).runs}let n=[],r=new OffscreenCanvas(1,1);return await this.renderSlide(r,e,{width:t,onTextRun:e=>n.push(e)}),n}catch(e){this._rethrowWithResourceFailure(e)}}async getElementContextAt(e,t,n={}){this._assertResourceHealthy(),this._assertSlideIndex(e);try{if(await this._waitForSlide(e),this._mode===`worker`)return(await this._bridge.request(r=>({kind:`hitTestElement`,id:r,slideIndex:e,point:t,options:n}))).context;if(!this._slides)throw Error(`Presentation not loaded`);return await this._slides.withSlide(e,r=>ei(e,r,t,n))}catch(e){this._rethrowWithResourceFailure(e)}}async getElementBoundsByIds(e,t){this._assertResourceHealthy(),this._assertSlideIndex(e);let n=Object.freeze(t.filter(e=>typeof e==`string`&&e.length>0));if(n.length===0)return Object.freeze([]);try{if(await this._waitForSlide(e),this._mode===`worker`)return(await this._bridge.request(t=>({kind:`resolveElementBounds`,id:t,slideIndex:e,elementIds:n}))).bounds;if(!this._slides)throw Error(`Presentation not loaded`);return await this._slides.withSlide(e,e=>ti(e,n))}catch(e){this._rethrowWithResourceFailure(e)}}async getMedia(e){this._assertResourceHealthy();try{let t=this._findMimeTypeForPath(e);return await this._rawParts.get(e,t,async()=>{let n=(await this._bridge.request(t=>({kind:`extractMedia`,id:t,path:e}))).bytes;return new Blob([n],{type:t})})}catch(e){this._rethrowWithResourceFailure(e)}}_findMimeTypeForPath(e){return this._preflight?ue(this._preflight,e):``}async getImage(e,t){this._assertResourceHealthy();try{return await this._rawParts.get(e,t,async()=>{let n=(await this._bridge.request(t=>({kind:`extractImage`,id:t,path:e}))).bytes;return new Blob([n],{type:t})})}catch(e){this._rethrowWithResourceFailure(e)}}async getFontBytes(e){this._assertResourceHealthy();try{let t=await this._bridge.request(t=>({kind:`extractFont`,id:t,path:e}));return new Uint8Array(t.bytes)}catch(e){this._rethrowWithResourceFailure(e)}}async getResourceMetrics(){let e=this._metrics;if(!e)throw Error(`Presentation not loaded`);return f(e,async e=>(await this._bridge.request(e=>({kind:`resourceUsage`,id:e}),void 0,{timeoutMs:e})).usage)}async toMarkdown(){this._assertResourceHealthy();try{return(await this._bridge.request(e=>({kind:`toMarkdown`,id:e}))).markdown}catch(e){this._rethrowWithResourceFailure(e)}}async presentSlide(e,t,n={}){this._assertResourceHealthy();try{if(this._assertSlideIndex(t),await this._waitForSlide(t),!this._preflight)throw Error(`Presentation not loaded`);let r=n.dpr??u(),i=n.width??(e.offsetWidth||960),a=this.slideWidth>0?i*this.slideHeight/this.slideWidth:0;e.style.width=`${Math.round(i)}px`,e.style.height=`${Math.round(a)}px`,e.style.display||(e.style.display=`block`);let o=this._mode===`worker`?async()=>{let a=await this.renderSlideToBitmap(t,{width:i,dpr:r,imageResources:n.imageResources,skipMediaControls:!0,dim:n.dim,onTextRun:n.onTextRun});try{e.width=a.width,e.height=a.height;let t=e.getContext(`2d`);if(!t)throw Error(`2D context not available`);t.drawImage(a,0,0)}finally{ve(a)}}:()=>this.renderSlide(e,t,{width:i,dpr:r,imageResources:n.imageResources,skipMediaControls:!0,dim:n.dim,onTextRun:n.onTextRun});return await ur(e,this._preflight.slides[t]?.mediaElements??[],{width:i,height:a,slideWidthEmu:this.slideWidth,fetchMedia:this._fetchMedia,fetchImage:this._fetchImage,drawBase:o,onError:n.onError})}catch(e){this._rethrowWithResourceFailure(e)}}destroy(){this._destroyed=!0,this._clearProgressiveWatchdog(),this._slidePullClient?.cancelAll(),this._bridge.terminate(),this._slides?.clear(),this._slides=null,this._slidePullClient=null,this._bootstrap=null,this._preflight=null,this._availableSlideCount=0,this._layoutLifecycle.succeed(),this._layoutCompletion=null,this._progressive=null,this._parseRequestId=null,this._wakeLayoutWaiters(),this._resourceFailure=null,this._slidePartIndex=null,this._rawParts.clear(),this._googleFonts?.release(),this._googleFonts=null;for(let e of this._officeFontLoads.values())for(let t of Nr(e))t.then(e=>_e(e.faces));this._officeFontLoads.clear(),this._embeddedFontFaces.length>0&&(V(this._embeddedFontFaces),this._embeddedFontFaces=[]),this._embeddedFontAliases=new Map,this._embeddedFontAuthoredFamilies=new Map,this._embeddedFontTuples=new Set,oe(this._fetchImage),_(this._fetchImage)}};function oi(e,t,n,r,i={}){let a=Tn({id:e.id,author:e.author,date:e.date,text:e.text,status:e.status??`active`},(e.replies??[]).map(e=>({id:e.id,author:e.author,date:e.date,text:e.text,status:e.status??`active`})),i.maxTextCharacters);return Object.freeze({format:`pptx`,kind:`comment`,slideIndex:t,commentIndex:n,occurrenceId:r,...e.id?{commentId:e.id}:{},...Number.isFinite(e.x)&&Number.isFinite(e.y)?{point:Object.freeze({x:e.x,y:e.y})}:{},thread:a.thread,truncated:a.truncated,truncationReasons:a.truncated?[`text`]:[],textCharacters:a.textCharacters,maxTextCharacters:a.maxTextCharacters})}function si(e){for(let t=e;t;t=t.parentElement){let e=vn(t.dataset.slideIndex);if(e!==null)return e}return null}function ci(e,t,n={}){let r=$e(e,t,e=>{let t=si(e),n=vn(e.dataset.runIndex);if(t===null||n===null)return null;let r=vn(e.dataset.elementIndex),i=e.dataset.elementOrigin,a=r!==null&&(i===`master`||i===`layout`||i===`slide`);return{slideIndex:t,runIndex:n,...e.dataset.shapeId===void 0?{}:{shapeId:e.dataset.shapeId},...a?{elementIndex:r,origin:i}:{}}},{maxChars:n.maxTextCharacters,maxLocators:n.maxRunLocators});if(!r)return null;let i=[...r.locators].sort((e,t)=>e.slideIndex-t.slideIndex||e.runIndex-t.runIndex);return{format:`pptx`,kind:`text`,text:r.text,slideIndexes:[...new Set(i.map(e=>e.slideIndex))],shapeIds:[...new Set(i.flatMap(e=>e.shapeId?[e.shapeId]:[]))],runs:i,truncated:r.truncated,truncationReasons:r.truncationReasons,textCharacters:r.textCharacters,maxTextCharacters:r.maxTextCharacters,maxRunLocators:r.maxLocators}}function li(e,t,n,r,i){return r===`worker`?e.renderSlideToBitmap(n,i):e.renderSlide(t,n,i)}function ui(e){let t=e.ownerDocument??document,n=new ot(e,`Loading slide`),r=n.layer;r.style.backdropFilter=`blur(2px)`;let i=t.createElement(`span`);return i.className=`ooxml-pptx-progress-circle`,i.style.cssText=[`width:34px`,`height:34px`,`box-sizing:border-box`,`border-radius:50%`,`border:3px solid var(--border-bright, rgba(100,116,139,0.28))`,`border-top-color:var(--signal, #12bfd8)`,`box-shadow:0 2px 10px rgba(15,23,42,0.08)`].join(`;`),i.setAttribute(`aria-hidden`,`true`),r.appendChild(i),!(t.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1)&&typeof i.animate==`function`&&i.animate([{transform:`rotate(0deg)`},{transform:`rotate(360deg)`}],{duration:800,iterations:1/0,easing:`linear`}),n}function $(e,t,n){return`slide:${n}:${e.id??`classic:${e.authorId??`unknown`}:${e.index??t}`}`}var di=class{hooks;unsubscribe=null;constructor(e){this.hooks=e}bind(e){this.unbind();let t=!0;this.unsubscribe=ri(e,()=>({availableSlides:e.availableSlideCount,slideCount:e.slideCount,exact:e.layoutComplete,complete:e.layoutComplete}),n=>{t?t=!1:this.onPublication(e,n)},this.hooks.report)}unbind(){this.unsubscribe?.(),this.unsubscribe=null,this.hooks.resetComments(),this.hooks.wakeComments()}onPublication(e,t){if(!(this.hooks.destroyed()||e!==this.hooks.current())){if(this.hooks.wakeComments(),t.error!==void 0){this.hooks.failComments(),this.hooks.reportBackground(t.error);return}this.hooks.scanComments(e),this.hooks.renderAvailable(e),this.hooks.emitVisible()}}destroy(){this.unbind()}},fi=class{hooks;constructor(e){this.hooks=e}renderInteractive(e,t,n,r,i,a,o=!0){let s=this.hooks.presentation();if(!s)return Promise.resolve();let c=++t.presentationGeneration;t.presentationHandle?.destroy(),t.presentationHandle=null;let l=[],u=this.hooks.textSelection()&&!!t.textLayer,d=u||this.hooks.findActive();return s.presentSlide(t.canvas,e,{width:n,dpr:r,imageResources:this.hooks.imageResources(),onTextRun:d?e=>l.push(e):void 0,onError:e=>{c===t.presentationGeneration&&this.hooks.reportError(e)}}).then(r=>{this.isCurrent(e,t,c,a)?(t.presentationHandle=r,t.renderedScale=i,u&&t.textLayer&&er(t.textLayer,l,Math.round(n),Math.round(this.hooks.height()),this.hooks.hyperlinkHandler(),e),d&&this.hooks.refreshFindRuns(e,l),this.hooks.commitComments(e,t),this.hooks.redrawHighlights(e,t)):r.destroy()}).catch(e=>{if(c===t.presentationGeneration){if(o)this.hooks.reportError(e);else throw e}})}sync(e=this.hooks.mediaRange()){if(this.hooks.mediaEnabled())for(let[t,n]of this.hooks.slots()){let r=this.hooks.rangeContains(e,t);r!==n.mediaInteractive&&(r?(n.mediaInteractive=!0,this.settleInteractive(t,n,this.hooks.width(),this.hooks.dpr(),this.hooks.scale(),this.hooks.epoch())):(n.mediaInteractive=!1,n.presentationGeneration++,n.presentationHandle?.destroy(),n.presentationHandle=null))}}settleInteractive(e,t,n,r,i,a){let o=this.hooks.presentation();if(!o)return;let s=++t.presentationGeneration,c=document.createElement(`canvas`);c.style.cssText=`display:block;background:#fff;`;let l=this.hooks.shadow();l!==!1&&(c.style.boxShadow=l);let u=[],d=this.hooks.textSelection()&&!!t.textLayer,f=d||this.hooks.findActive();o.presentSlide(c,e,{width:n,dpr:r,onTextRun:f?e=>u.push(e):void 0,onError:e=>{s===t.presentationGeneration&&this.hooks.reportError(e)}}).then(r=>{if(!this.isCurrent(e,t,s,a)){r.destroy();return}let o=t.canvas,l=t.presentationHandle;t.dispatcher.destroy(),t.wrapper.insertBefore(c,o),o.remove(),t.canvas=c,t.dispatcher=new D(c,!1),t.presentationHandle=r,t.renderedScale=i,l?.destroy(),t.textLayer&&(this.hooks.clearTextPreview(t.textLayer),d&&er(t.textLayer,u,Math.round(n),Math.round(this.hooks.height()),this.hooks.hyperlinkHandler(),e)),f&&this.hooks.refreshFindRuns(e,u),this.hooks.commitComments(e,t),this.hooks.redrawHighlights(e,t)}).catch(e=>{s===t.presentationGeneration&&this.hooks.reportError(e)})}isCurrent(e,t,n,r){return n===t.presentationGeneration&&t.mediaInteractive&&r===this.hooks.epoch()&&this.hooks.slots().get(e)===t&&t.renderedSlide===e}destroy(){for(let e of this.hooks.slots().values())e.presentationGeneration++,e.presentationHandle?.destroy(),e.presentationHandle=null,e.mediaInteractive=!1}},pi=class{hooks;generation=0;layoutWaiters=new Set;layoutFailed=!1;constructor(e){this.hooks=e}resetLayout(){this.layoutFailed=!1,this.wake()}failLayout(){this.layoutFailed=!0,this.wake()}wake(){for(let e of this.layoutWaiters)e();this.layoutWaiters.clear()}begin(){let e=++this.generation;return this.wake(),e}async waitForSlideMetadata(e,t,n){return await this.hooks.ownBackground(async()=>{for(;!this.hooks.destroyed()&&n===this.generation&&e===this.hooks.presentation()&&t>=e.availableSlideCount&&!e.layoutComplete&&!this.layoutFailed;)await new Promise(e=>this.layoutWaiters.add(e));return this.hooks.destroyed()||e!==this.hooks.presentation()||((e.layoutComplete||this.layoutFailed)&&await e.waitUntilLayoutComplete?.(),n!==this.generation)?!1:t<e.availableSlideCount})}async resolveBounds(e,t){let n=this.hooks.presentation();if(!n)return;let r=(t.anchors??[]).flatMap(e=>(e.type===`drawingElement`||e.type===`textRange`)&&e.elementId?[e.elementId]:[]);if(r.length===0)return;let i=new Map((this.hooks.slots().get(e)?.commentElementBounds??[]).map(e=>[e.elementId,e.bounds])),a=r.flatMap(e=>{let t=i.get(e);return t?[t]:[]})[0];if(a)return a;let o=await n.getElementBoundsByIds(e,r);return r.flatMap(e=>{let t=o.find(t=>t.elementId===e);return t?[t.bounds]:[]})[0]}scrollToTarget(t,n,r,i){if(!this.hooks.presentation())return!1;let a=this.hooks.slots().get(t),o=new Map((a?.commentElementBounds??[]).map(e=>[e.elementId,e.bounds])),s=i??(n.anchors??[]).flatMap(e=>{if(e.type!==`drawingElement`&&e.type!==`textRange`||!e.elementId)return[];let t=o.get(e.elementId);return t?[t]:[]})[0],c=n.anchors??[],l=Number.isFinite(n.x)&&Number.isFinite(n.y)&&(c.length===0||c.some(e=>e.type===`slide`));if(!s&&!l)return!1;let u=s?s.x+(l?n.x:s.width):n.x,d=s?s.y+(l?n.y:0):n.y,f=u/e*this.hooks.scale(),p=d/e*this.hooks.scale();return this.hooks.scrollPoint(t,f,p,r),!0}async goToComment(e,t,n){if(this.hooks.destroyed())throw Error(`PptxScrollViewer is destroyed`);let r=this.hooks.presentation();if(!r||!Number.isInteger(e)||!Number.isInteger(t)||e<0||e>=r.slideCount||t<0)return!1;let i=this.begin();if(e>=r.availableSlideCount&&!r.layoutComplete&&!await this.waitForSlideMetadata(r,e,i))return!1;if(this.hooks.destroyed())throw Error(`PptxScrollViewer is destroyed`);if(i!==this.generation||r!==this.hooks.presentation())return!1;let a=r.getComments(e)[t];if(!a)return!1;let o=await this.resolveBounds(e,a);if(this.hooks.destroyed())throw Error(`PptxScrollViewer is destroyed`);if(i!==this.generation||r!==this.hooks.presentation())return!1;let s=a.anchors??[],c=Number.isFinite(a.x)&&Number.isFinite(a.y)&&(s.length===0||s.some(e=>e.type===`slide`));return!o&&!c||(this.hooks.scrollToSlide(e,n),!this.scrollToTarget(e,a,n,o))?!1:(this.hooks.select($(a,t,e),e),!0)}destroy(){this.begin()}},mi=12,hi;function gi(){return hi??=b(()=>import(`./comment-ui-runtime-Bp37ytDC-CEDIeFBy.js`),[])}var _i=440,vi=20,yi=Symbol(`PptxScrollViewer.borrowedPresentation`),bi=class t{_presentationOwner;get _pres(){return this._presentationOwner.current}_borrowed;_opts;_errorRouter;_container;_shell;get _wrapper(){return this._shell.wrapper}get _scrollHost(){return this._shell.scrollHost}get _spacer(){return this._shell.spacer}_mode;_viewport=new Bn({options:()=>this._opts,container:()=>this._container,scrollHost:()=>this._scrollHost});_zoom=new Wn({scrollHost:()=>this._scrollHost,spacer:()=>this._spacer,count:()=>this._pres?.slideCount??0,zoomMin:()=>this._opts.zoomMin??.1,zoomMax:()=>this._opts.zoomMax??4,baseScale:()=>this._baseScale(),fitWidthPx:()=>this._viewport.fitWidth(),fitContentSize:()=>this._pres?{width:this._pres.slideWidth/e,height:this._pres.slideHeight/e}:null,indexAt:e=>this._slideIndexAtOffset(e),offset:e=>this._slideOffset(e),height:()=>this._uniformSlideHeight,totalHeight:()=>this._rangeAt(0,this._viewport.overscan()).totalHeight,recomputeHeights:()=>this._recomputeHeights(),syncSpacerWidth:()=>this._syncSpacerWidth(),padLeft:()=>this._viewport.horizontalPadding().left,invalidateRender:()=>{this._renderEpoch++},preview:()=>this._previewVisible(),scheduleSettle:()=>this._scheduleSettle(),onScaleChange:e=>this._opts.onScaleChange?.(e),relayout:()=>this.relayout(),mountVisible:()=>this._mountVisible(),refitOnResize:()=>this._opts.refitOnResize!==!1});get _scale(){return this._zoom.scale}get _scaleEstablished(){return this._zoom.established}_scroller=new Mn({spacer:()=>this._spacer,count:()=>this._pres?.slideCount??0,range:()=>this._range(),createSlot:()=>this._createSlot(),attachSlot:e=>this._scrollHost.appendChild(e.wrapper),resetSlot:(e,t)=>this._resetSlot(e,t),positionSlot:(e,t,n)=>this._positionSlot(t,e,n),renderSlot:(e,t,n)=>this._renderSlot(e,t,this._opts.enableMediaPlayback===!0&&this._rangeContains(this._mediaRange(),e),n),previewSlot:(e,t,n)=>this._previewSlot(t,e,n),settleSlot:(e,t)=>this._settleSlot(e,t),renderedScale:e=>e.renderedScale,scale:()=>this._scale,syncSpacerWidth:()=>this._syncSpacerWidth(),onRange:e=>this._emitVisibleSlideChange(e),onNewSlot:(e,t)=>this._redrawSlotComments(e,t),afterMount:()=>{this._opts.enableMediaPlayback&&this._media.sync()},awaitInitialRender:e=>e<this.availableSlideCount,shouldSettle:e=>!this._opts.enableMediaPlayback||this._rangeContains(this._mediaRange(),e)});_slots=this._scroller.slots;_layout=new di({current:()=>this._pres,destroyed:()=>this._destroyed,report:e=>this._reportRenderError(e),reportBackground:e=>this._errorRouter.reportBackground(e,this._opts.onLayoutComplete!==void 0),wakeComments:()=>this._commentNavigation.wake(),resetComments:()=>this._commentNavigation.resetLayout(),failComments:()=>this._commentNavigation.failLayout(),scanComments:e=>this._scanAvailableComments(e,!0),renderAvailable:e=>{let t=this._opts.enableMediaPlayback?this._mediaRange():null;for(let[n,r]of this._slots)n>=e.availableSlideCount||r.renderedSlide===n||this._renderSlot(n,r,!!t&&this._rangeContains(t,n))},emitVisible:()=>{this._scroller.lastRange&&this._emitVisibleSlideChange(this._scroller.lastRange)}});_renderHooks={slots:()=>this._slots,epoch:()=>this._renderEpoch,scale:()=>this._scale,slotIndex:e=>e.renderedSlide,token:e=>e.renderGeneration,nextToken:e=>++e.renderGeneration,wantRuns:e=>!!(this._opts.enableTextSelection&&e.textLayer)||this._findActive,reportError:e=>this._reportRenderError(e)};_bitmap=new An({...this._renderHooks,inFlight:()=>this._scroller.inFlight,destroyed:()=>this._destroyed,width:()=>this._slideWidthPx(),dpr:()=>this._viewport.dpr(),canRetry:e=>!(this._opts.enableMediaPlayback&&e.mediaInteractive),render:(e,t,n,r,i)=>li(this._pres,t,e,`worker`,{width:n,dpr:r,imageResources:this._opts.imageResources,onTextRun:i}),commitBitmap:(e,t,n,r,i,a)=>{let o={cssWidth:Math.round(a),cssHeight:Math.round(this._slideHeightPx())};return this._opts.enableMediaPlayback?n.commitBitmapTo2d(r,i,o):n.commitBitmap(r,i,o)},commitRuns:(e,t,n,r,i)=>this._commitRenderedRuns(e,t,n,r,i,!0)});_main=new jn({...this._renderHooks,render:(e,t,n,r,i,a)=>li(this._pres,t,e,`main`,{width:n,dpr:r,...a?{}:{imageResources:this._opts.imageResources},onTextRun:i}),commitRuns:(e,t,n,r,i,a,o)=>this._commitRenderedRuns(e,t,n,i,a,o),shadow:()=>this._pageShadow});_media=new fi({presentation:()=>this._pres,slots:()=>this._slots,epoch:()=>this._renderEpoch,scale:()=>this._scale,dpr:()=>this._viewport.dpr(),width:()=>this._slideWidthPx(),height:()=>this._slideHeightPx(),imageResources:()=>this._opts.imageResources,textSelection:()=>this._opts.enableTextSelection===!0,findActive:()=>this._findActive,mediaEnabled:()=>this._opts.enableMediaPlayback===!0,mediaRange:()=>this._mediaRange(),rangeContains:(e,t)=>this._rangeContains(e,t),shadow:()=>this._pageShadow,hyperlinkHandler:()=>this._hyperlinkHandler(),refreshFindRuns:(e,t)=>this._highlights.refreshRuns(e,t),redrawHighlights:(e,t)=>this._highlights.redrawSlot(e,t),commitComments:(e,t)=>this._commitSlotComments(e,t),clearTextPreview:e=>this._clearTextLayerPreview(e),reportError:e=>this._reportRenderError(e)});_commentNavigation=new pi({presentation:()=>this._pres,destroyed:()=>this._destroyed,slots:()=>this._slots,scale:()=>this._scale,scrollPoint:(e,t,n,r)=>this._navigation.scrollToPoint(e,t,n,r),scrollToSlide:(e,t)=>this.scrollToSlide(e,t),select:(e,t)=>{this._activeCommentId=e,this._activeCommentSlide=t,this._selection.clearElementContext();for(let[e,t]of this._slots)this._redrawSlotComments(e,t);this._selection.emitChange()},ownBackground:e=>this._errorRouter.ownBackgroundLifecycle(e)});_navigation=new zn({host:()=>this._scrollHost,spacer:()=>this._spacer,count:()=>this.slideCount,established:()=>this._scaleEstablished,offset:e=>this._slideOffset(e),height:()=>this._uniformSlideHeight,indexAt:e=>this._slideIndexAtOffset(e),totalHeight:()=>this._rangeAt(0,this._viewport.overscan()).totalHeight,width:()=>this._slideWidthPx(),padLeft:()=>this._viewport.horizontalPadding().left,marginOrigin:()=>this._commentMargin.originPx,mount:()=>this._mountVisible()});_selection=new Gn({wrapper:()=>this._wrapper,scrollHost:()=>this._scrollHost,slots:()=>this._slots,resource:()=>this._pres,destroyed:()=>this._destroyed,textSelectionEnabled:()=>this._opts.enableTextSelection===!0,elementSelectionEnabled:()=>this._opts.enableElementSelection===!0,textSelected:()=>ci(this._wrapper,this._wrapper.ownerDocument?.getSelection?.()??null)!==null,getContext:()=>this.getSelectionContext(),hitTest:(e,t,n,r,i)=>e.getElementContextAt(t,{x:n*e.slideWidth,y:r*e.slideHeight},{tolerance:this._elementHitTolerance/i*e.slideWidth,maxTextCharacters:Wr}),outline:(e,t,n)=>n.slideIndex===t?{x:n.bounds.x/e.slideWidth,y:n.bounds.y/e.slideHeight,width:n.bounds.width/e.slideWidth,height:n.bounds.height/e.slideHeight,rotation:n.bounds.rotation}:null,onChange:e=>this._opts.onSelectionContextChange?.(e),onContextMenu:(e,t)=>this._opts.onContextMenu?.({originalEvent:e,getContext:t}),reportError:e=>this._reportRenderError(e)});_uniformSlideHeight=0;_visibleEvents=new Vn((e,t,n)=>this._opts.onVisibleSlideChange?.(e,t,n));_loader=new Hn({name:()=>`PptxScrollViewer`,borrowed:()=>this._borrowed,borrowedMessage:()=>`PptxScrollViewer.load() is unsupported on a Viewer created by fromPresentation(); the borrowed presentation is already loaded.`,destroyed:()=>this._destroyed,owner:()=>this._presentationOwner,acquire:e=>ai.load(e,{password:this._opts.password,useGoogleFonts:this._opts.useGoogleFonts,cjkFallback:this._opts.cjkFallback,maxZipEntryBytes:this._opts.maxZipEntryBytes,resourceLimits:this._opts.resourceLimits,debug:this._opts.debug,onResourceMetrics:this._opts.onResourceMetrics,workerTimeoutMs:this._opts.workerTimeoutMs,wasmUrl:this._opts.wasmUrl,math:this._opts.math,threeD:this._opts.threeD,regionMap:this._opts.regionMap,chartEx:this._opts.chartEx,tiff:this._opts.tiff,mode:this._mode,...this._opts.legacyPpt===void 0?void 0:{legacyPpt:this._opts.legacyPpt},progressiveLayout:this._opts.progressiveLayout,onLayoutProgress:this._opts.onLayoutProgress,onLayoutPartial:this._opts.onLayoutPartial,onLayoutComplete:this._opts.onLayoutComplete}),beforeReplace:e=>{if(this._selection.invalidateElementContext(!1),this._invalidateFind(),this._findActive=!1,this._activeCommentId=null,this._activeCommentSlide=null,this._hasComments=!1,this._commentScanFrontier=0,this._commentNavigation.begin(),this._layout.unbind(),e){for(let[e,t]of[...this._slots])this._recycleSlot(e,t);this._visibleEvents.resetIndex()}},afterReplace:e=>{this._invalidateFind(),this._findActive=!1,this._activeCommentId=null,this._activeCommentSlide=null,this._hasComments=!1,this._commentScanFrontier=0,this._scanAvailableComments(e,!1),this._layout.bind(e)},mountOpeningWindow:async()=>{let e=[];this._relayout(e),await Promise.all(e)},selectionChanged:()=>this._selection.emitChange()});_activeCommentId=null;_activeCommentSlide=null;_commentUi=null;_hasComments=!1;_commentMargin=new Un({container:()=>this._container,scrollHost:()=>this._scrollHost,spacer:()=>this._spacer,enabled:()=>this._commentsEnabled(),cards:()=>this._commentsOptions()?.cards!==!1,hasDisplayableComments:()=>this._hasComments,requestedSide:()=>this._commentsOptions()?.side,zoom:()=>this._scaleEstablished?this._scale:1,gapPx:mi,widthPx:_i,fontSizePx:vi});_layers=new Rn({markerLayer:e=>e.commentMarkerLayer,syncMargin:e=>this._commentMargin.syncMargin(e),marginSide:()=>this._commentMargin.side(),marginExtent:()=>this._commentMargin.extent(),commentsEnabled:()=>this._commentsEnabled(),previewMargin:(e,t)=>this._commentUi?.previewReadOnlyCommentMargin(e,t),disposeMargin:e=>{this._commentUi?.disposeReadOnlyCommentMargin(e),this._commentUi||e.replaceChildren()},disposeDecoration:e=>{this._commentUi?.disposeReadOnlyCommentDecoration(e),this._commentUi||e.replaceChildren()},redrawOutline:(e,t)=>this._selection.redrawOutlineForSlot(e,t),markerRatio:e=>Math.round(e*1e6)/1e6,resetMarkerTransform:()=>!1,resetDecorationVisibility:()=>!0});_commentOverlay=new Kn({slots:()=>this._slots,scale:()=>this._scale,destroyed:()=>this._destroyed,ownerWindow:()=>this._wrapper.ownerDocument.defaultView,width:()=>this._slideWidthPx(),height:()=>this._slideHeightPx(),side:()=>this._commentMargin.side(),marginExtent:()=>this._commentMargin.extent(),connectorOptions:()=>this._commentsOptions()?.connectors,runtime:()=>this._commentUi,redrawComments:(e,t)=>this._redrawSlotComments(e,t)});_commentScanFrontier=0;_elementHitTolerance;_destroyed=!1;get _renderEpoch(){return this._scroller.renderEpoch}set _renderEpoch(e){this._scroller.renderEpoch=e}_pageShadow;_find=new ir(()=>this.slideCount,e=>this._collectSlideRuns(e));_findGeneration=0;_findActive=!1;_highlights=new kn({slots:()=>this._slots,active:()=>this._findActive,runs:e=>this._find.slideRuns(e),setRuns:(e,t)=>this._find.setSlideRuns(e,t),paint:(e,t,n,r)=>tr(t.highlightLayer,n,this._find.slideHighlights(e),this._slideWidthPx(),this._slideHeightPx(),r,this._opts.findHighlightColors),reveal:e=>this.scrollToSlide(e),unitOf:e=>e.slide});static fromPresentation(e,n,r={}){return new t(e,{...r,[yi]:n})}constructor(e,t={}){if(e.tagName===`CANVAS`)throw Error(`PptxScrollViewer takes a container element (e.g. a <div>), not a <canvas> — the viewer creates and manages its own canvases. Pass a block container; for the single-slide canvas API use PptxViewer.`);this._container=e,this._opts=t,this._errorRouter=new lt(`PptxScrollViewer`,t.onError);let n=t.elementHitTolerance??6;if(!Number.isFinite(n)||n<0)throw RangeError(`elementHitTolerance must be a finite non-negative number.`);this._elementHitTolerance=n,this._pageShadow=t.pageShadow??`0 1px 3px rgba(0,0,0,0.2)`;let r=t[yi];this._borrowed=r!==void 0,r?(this._presentationOwner=new ct(`PptxScrollViewer`,r,!1),this._mode=st(`PptxScrollViewer`,t.mode,r),this._scanAvailableComments(r,!1)):(this._presentationOwner=new ct(`PptxScrollViewer`),this._mode=st(`PptxScrollViewer`,t.mode,void 0)),this._shell=new On(e,{background:t.background,comments:!!t.comments,onScroll:()=>this._onScroll(),onOutsideComment:()=>{if(this._activeCommentId!==null){this._activeCommentId=null,this._activeCommentSlide=null;for(let[e,t]of this._slots)this._redrawSlotComments(e,t);this._selection.emitChange()}}}),this._commentsEnabled()&&gi().then(e=>{if(!this._destroyed){this._commentUi=e;for(let[e,t]of this._slots)this._redrawSlotComments(e,t)}}).catch(e=>this._reportRenderError(e)),this._selection.bind(!!t.onSelectionContextChange,!!t.onContextMenu),this._zoom.bind(this._container,this._scrollHost,this._opts.enableZoom!==!1),this._borrowed&&(this._layout.bind(r),this.relayout())}async load(e){await this._loader.load(e)}get slideCount(){return this._pres?.slideCount??0}get availableSlideCount(){return this._pres?.availableSlideCount??this.slideCount}get layoutComplete(){return this._pres?.layoutComplete??!0}async waitUntilLayoutComplete(){await this._errorRouter.ownBackgroundLifecycle(async()=>{await this._pres?.waitUntilLayoutComplete?.()})}_slideWidthPx(){return this._pres.slideWidth/e*this._scale}_slideHeightPx(){return this._pres.slideHeight/e*this._scale}_commentsEnabled(){return this._opts.comments===!0||typeof this._opts.comments==`object`}_commentsOptions(){return typeof this._opts.comments==`object`?this._opts.comments:void 0}_scanAvailableComments(e,t){if(!this._commentsEnabled()||this._hasComments)return;let n=this._commentsOptions()?.includeResolved===!0,r=Math.min(e.availableSlideCount,e.slideCount);for(let i=this._commentScanFrontier;i<r;i++)if(e.getComments(i).some(e=>n||e.status!==`resolved`&&e.status!==`closed`)){this._commentScanFrontier=r,this._hasComments=!0,t&&this._refreshDiscoveredComments();return}this._commentScanFrontier=Math.max(this._commentScanFrontier,r)}_refreshDiscoveredComments(){this._syncSpacerWidth();for(let[e,t]of this._slots)this._redrawSlotComments(e,t)}_baseScale(){if(!this._pres||this._pres.slideCount===0)return 0;let t=this._viewport.fitWidth(),n=this._pres.slideWidth/e;return t<=0||n<=0?0:t/n}relayout(){this._relayout()}_relayout(e){this._pres&&(!this._scaleEstablished&&!this._zoom.establishBase()||(this._recomputeHeights(),this._syncSpacer(),this._mountVisible(e)))}_recomputeHeights(){this._uniformSlideHeight=this._slideHeightPx()}_mediaOverscan(){return this._opts.mediaOverscan??1}_slideOffset(e){return this._viewport.verticalPadding().leading+e*(this._uniformSlideHeight+this._viewport.gap())}_slideIndexAtOffset(e){return gn(this._pres?.slideCount??0,this._uniformSlideHeight,this._viewport.gap(),e,0,0,this._viewport.verticalPadding()).topIndex}_rangeAt(e,t){return gn(this._pres?.slideCount??0,this._uniformSlideHeight,this._viewport.gap(),e,this._scrollHost.clientHeight,t,this._viewport.verticalPadding())}_range(){return this._rangeAt(this._scrollHost.scrollTop,this._viewport.overscan())}_mediaRange(){return this._rangeAt(this._scrollHost.scrollTop,this._mediaOverscan())}_rangeContains(e,t){return t>=e.start&&t<=e.end}_syncSpacer(){this._scroller.syncSpacer()}_syncSpacerWidth(){let{left:e,right:t}=this._viewport.horizontalPadding();this._commentMargin.syncSpacerWidth(this._slideWidthPx(),e,t)}_onScroll(){!this._pres||!this._scaleEstablished||this._mountVisible(void 0,!1)}_mountVisible(e,t=!0){this._scroller.mount(e,t)}_createSlot(){let{wrapper:e,canvas:t,textLayer:n,highlightLayer:r}=Pn(this._scrollHost,this._opts.enableTextSelection===!0,this._pageShadow),i=ui(e),{markerLayer:a,margin:o,decorationLayer:s}=Ln(e,this._commentsEnabled(),this._commentsOptions()?.cards!==!1,this._commentsOptions()?.connectors!==void 0,e=>this._commentMargin.syncMargin(e)),c=rt(e,this._opts.enableElementSelection===!0);return this._scrollHost.appendChild(e),{wrapper:e,canvas:t,textLayer:n,highlightLayer:r,elementLayer:c,loadingIndicator:i,commentMarkerLayer:a,commentMargin:o,commentDecorationLayer:s,commentElementBounds:Object.freeze([]),commentGeometry:null,commentAnchorSlide:-1,commentAnchorGeneration:0,renderedSlide:-1,renderedScale:-1,dispatcher:new D(t,this._mode===`worker`&&!this._opts.enableMediaPlayback),presentationHandle:null,mediaInteractive:!1,renderGeneration:0,presentationGeneration:0}}_recycleSlot(e,t){this._scroller.recycleSlot(e,t)}_resetSlot(e,t){t.renderGeneration++,t.presentationGeneration++,t.presentationHandle?.destroy(),t.presentationHandle=null,t.mediaInteractive=!1,t.dispatcher.destroy(),this._destroyed||(t.dispatcher=new D(t.canvas,this._mode===`worker`&&!this._opts.enableMediaPlayback)),this._layers.reset(t),t.loadingIndicator.setLoading(!1),t.commentElementBounds=Object.freeze([]),t.commentGeometry=null,t.commentAnchorSlide=-1,t.commentAnchorGeneration++,t.canvas.style.height=``,t.renderedSlide=-1,t.renderedScale=-1,t.wrapper.remove()}_positionSlot(e,t,n){e.wrapper.dataset.slideIndex=String(t),this._layers.position(t,e,this._slideOffset(t),this._slideWidthPx(),this._slideHeightPx(),this._scrollHost.clientWidth,this._viewport.horizontalPadding().left)}_renderSlot(e,t,n=!1,r=!0){if(!this._pres||t.renderedSlide===e)return null;if(e>=this.availableSlideCount&&!this.layoutComplete)return t.renderedSlide=-1,t.mediaInteractive=!1,t.loadingIndicator.setLoading(!0),null;t.renderedSlide=e;let i=++t.renderGeneration;t.loadingIndicator.setLoading(e>=this.availableSlideCount&&!this.layoutComplete);let a=this._viewport.dpr(),o=this._slideWidthPx(),s=this._renderEpoch,c=this._scale,l=t.dispatcher,u=l.begin();return this._opts.enableMediaPlayback&&n?(t.mediaInteractive=!0,this._trackSlotLoading(e,t,i,this._media.renderInteractive(e,t,o,a,c,s,r))):(t.mediaInteractive=!1,this._mode===`worker`?this._trackSlotLoading(e,t,i,this._renderSlotBitmap(e,t,o,a,c,i,l,u,r)):this._trackSlotLoading(e,t,i,this._main.render(e,t,o,a,i,l,u,r)))}async _trackSlotLoading(e,t,n,r){try{await r}finally{n===t.renderGeneration&&this._slots.get(e)===t&&t.renderedSlide===e&&t.loadingIndicator.setLoading(!1)}}_emitVisibleSlideChange(e){this._pres&&this._visibleEvents.publish(e,this._pres.slideCount,this.layoutComplete)}_reportRenderError(e){this._errorRouter.report(e)}_commitRenderedRuns(e,t,n,r,i,a){t.textLayer&&(a&&this._clearTextLayerPreview(t.textLayer),this._opts.enableTextSelection&&er(t.textLayer,n,Math.round(r),Math.round(this._slideHeightPx()),this._hyperlinkHandler(),e)),i&&this._highlights.refreshRuns(e,n),this._commitSlotComments(e,t),this._highlights.redrawSlot(e,t)}_renderSlotBitmap(e,t,n,r,i,a=++t.renderGeneration,o=t.dispatcher,s=o.begin(),c=!0){return this._bitmap.render(e,t,n,r,i,a,o,s,c)}setScale(e){this._zoom.setScale(e)}getScale(){return this._zoom.getScale()}zoomIn(){this._zoom.zoomIn()}zoomOut(){this._zoom.zoomOut()}fitWidth(){this._zoom.fit(`width`)}fitPage(){this._zoom.fit(`page`)}_previewVisible(){this._scroller.preview()}_previewSlot(e,t,n){this._positionSlot(e,t,n),this._layers.preview(e,this._slideWidthPx(),this._slideHeightPx(),this._scale)}_clearTextLayerPreview(e){Nn(e)}_scheduleSettle(){this._scroller.scheduleSettle(150)}_settleSlot(e,t){if(!this._pres)return;let n=this._viewport.dpr(),r=this._slideWidthPx(),i=this._scale,a=this._renderEpoch;if(this._opts.enableMediaPlayback&&t.mediaInteractive)this._media.settleInteractive(e,t,r,n,i,a);else if(!this._opts.enableMediaPlayback){if(this._mode===`worker`){this._renderSlotBitmap(e,t,r,n,i);return}this._main.settle(e,t,r,n)}}scrollToSlide(e,t){this._navigation.scrollToUnit(e,t)}async goToComment(e,t,n){return this._commentNavigation.goToComment(e,t,n)}async findText(e,t={}){let n=this._pres;if(!n)return[];let r=++this._findGeneration;if(this._findActive=e.length>0,e.length===0)return this._find.invalidate(),this._highlights.redrawAll(),[];if(n.layoutComplete||await this._errorRouter.ownBackgroundLifecycle(()=>n.waitUntilLayoutComplete()),this._destroyed||r!==this._findGeneration||n!==this._pres)return[];let i=await this._errorRouter.ownAwaitable(()=>this._find.find(e,t));return this._destroyed||r!==this._findGeneration||n!==this._pres?[]:(this._highlights.redrawAll(),i)}async findNext(){return this._highlights.activate(this._find.next())}async findPrev(){return this._highlights.activate(this._find.prev())}clearFind(){this._findActive=!1,this._invalidateFind(),this._highlights.redrawAll()}_invalidateFind(){this._findGeneration++,this._find.invalidate()}async _collectSlideRuns(e){return this._pres?this._pres.collectSlideRuns(e,this._slideWidthPx()):[]}_redrawSlotComments(e,t){if(!this._pres||!t.commentMarkerLayer)return;this._commentMargin.syncMargin(t.commentMargin);let n=this._commentUi;n?(t.commentGeometry=n.buildPptxCommentMargin(t.commentMarkerLayer,t.commentMargin,this._pres.getComments(e),t.commentElementBounds,e,this._pres.slideWidth,this._pres.slideHeight,this._activeCommentId,(t,n)=>{let r=n?t:this._activeCommentId===t?null:this._activeCommentId;if(r!==this._activeCommentId){this._activeCommentId=r,this._activeCommentSlide=r?e:null,this._selection.clearElementContext();for(let[e,t]of this._slots)this._redrawSlotComments(e,t);this._selection.emitChange()}},this._commentMargin.zoom(),_i,this._commentsOptions()?.markers!==!1,this._commentsOptions()?.includeResolved===!0,t.commentDecorationLayer?()=>this._commentOverlay.schedule(e,t,!1):void 0,t.commentDecorationLayer?()=>this._commentOverlay.schedule(e,t,!0):void 0),this._commentOverlay.drawConnectors(e,t)):(t.commentMarkerLayer.replaceChildren(),t.commentMargin?.replaceChildren(),t.commentDecorationLayer?.replaceChildren(),t.commentGeometry=null)}_commitSlotComments(e,t){this._ensureSlotCommentAnchors(e,t),this._redrawSlotComments(e,t),t.commentMarkerLayer&&(t.commentMarkerLayer.style.visibility=``),t.commentMargin&&(t.commentMargin.style.visibility=``),t.commentDecorationLayer&&(t.commentDecorationLayer.style.visibility=``)}_ensureSlotCommentAnchors(e,t){let n=this._pres;if(!n||t.commentAnchorSlide===e)return;t.commentAnchorSlide=e,t.commentElementBounds=Object.freeze([]);let r=[...new Set(n.getComments(e).flatMap(e=>(e.anchors??[]).flatMap(e=>(e.type===`drawingElement`||e.type===`textRange`)&&e.elementId?[e.elementId]:[])))];if(r.length===0)return;let i=++t.commentAnchorGeneration;n.getElementBoundsByIds(e,r).then(r=>{if(this._destroyed||i!==t.commentAnchorGeneration||n!==this._pres||this._slots.get(e)!==t||t.commentAnchorSlide!==e)return;t.commentElementBounds=r,this._redrawSlotComments(e,t);let a=n.getComments(e).find((t,n)=>$(t,n,e)===this._activeCommentId);a&&this._commentNavigation.scrollToTarget(e,a)}).catch(e=>{!this._destroyed&&i===t.commentAnchorGeneration&&this._reportRenderError(e)})}_hyperlinkHandler(){if(this._opts.enableHyperlinks!==!1)return e=>this._onHyperlinkClick(e)}_onHyperlinkClick(e){let t=this._resolveInternalSlideIndex(e);this._opts.onHyperlinkClick?this._opts.onHyperlinkClick(t):t.kind===`external`?d(t.url):t.slideIndex!==void 0&&this.scrollToSlide(t.slideIndex)}_resolveInternalSlideIndex(e){if(e.kind!==`internal`||e.slideIndex!==void 0)return e;let t=this._pres?.resolveInternalTarget(e.ref,this._range().topIndex);return t===void 0?e:{...e,slideIndex:t}}get topVisibleSlide(){return this._scroller.lastRange?.topIndex??0}async getResourceMetrics(){if(!this._pres)throw Error(`Presentation not loaded`);return await this._pres.getResourceMetrics()}getSelectionContext(e={}){if(this._destroyed)throw Error(`PptxScrollViewer is destroyed`);if(this._pres&&this._activeCommentId!==null&&this._activeCommentSlide!==null){let t=this._pres.getComments(this._activeCommentSlide),n=t.findIndex((e,t)=>$(e,t,this._activeCommentSlide)===this._activeCommentId),r=t[n];if(r&&n>=0)return oi(r,this._activeCommentSlide,n,this._activeCommentId,e)}return(this._opts.enableTextSelection?ci(this._wrapper,this._wrapper.ownerDocument?.getSelection?.()??null,e):null)??(this._selection.elementContext?Qr(this._selection.elementContext,e.maxTextCharacters):null)}destroy(){this._destroyed||(this._destroyed=!0,this._commentNavigation.begin(),this._errorRouter.close(),this._invalidateFind(),this._findActive=!1,this._layout.unbind(),this._selection.destroy(),this._media.destroy(),this._commentNavigation.destroy(),this._highlights.destroy(),this._commentOverlay.destroy(),this._selection.clearElementContext(),this._scroller.destroy(),this._zoom.destroy(),this._commentMargin.destroy(),this._presentationOwner.close(),this._shell.destroy())}};export{qn as a,we as c,ai as i,bi as n,U as o,zr as r,Sn as s,$ as t};
@@ -0,0 +1 @@
1
+ import{A as e,T as t,V as n,y as r}from"./slide-pull-client-3g6TxaKa-BohMnKOC.js";import{a as i,c as a,i as o,r as s,s as c}from"./pptx-DbjWegUB-CU8ZIJEP.js";var l=`ooxml-model-source-module/v2`,u=new Set([`docx`,`xlsx`,`pptx`]),d=new Set([`http:`,`https:`,`file:`,`blob:`]),f=[`protocol`,`target`,`moduleUrl`,`config`],p=16,m=8192,h=32,g=8192,_=32,v=/^[A-Za-z][A-Za-z0-9_]{0,63}$/;function y(e,t,n){if(e!==void 0){if(!Array.isArray(e))throw TypeError(`model sources must be an array`);if(e.length>p)throw RangeError(`model source selection accepts at most ${p} sources`);for(let r of e){if(typeof r!=`object`||!r)throw TypeError(`each model source must be an object`);let e=r;if(e.target!==t)throw TypeError(`a ${String(e.target)} model source cannot load ${t} input`);if(typeof e.claim!=`function`||typeof e.beginLoad!=`function`)throw TypeError(`a model source must implement claim() and beginLoad()`);let i=e.claim(n);if(typeof i!=`boolean`)throw TypeError(`model source claim() must return a boolean`);if(i)return e}}}function b(e,t){let n=e.beginLoad();if(typeof n!=`object`||!n)throw TypeError(`model source beginLoad() must return an object`);let r=n,i=r.release;if(typeof i!=`function`)throw TypeError(`model source load must provide release()`);let a=!1,o=()=>{a||(a=!0,i.call(n))};try{let e=S(r.module,t),n=r.transfer===void 0?[]:r.transfer;if(!Array.isArray(n))throw TypeError(`model source load transfer must be an array`);if(n.length>_)throw RangeError(`model source load transfer accepts at most ${_} items`);let i=new Set;for(let e of n){if(!(e instanceof ArrayBuffer)&&!(typeof MessagePort<`u`&&e instanceof MessagePort)&&!(typeof ImageBitmap<`u`&&e instanceof ImageBitmap)&&!(typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas))throw TypeError(`model source load transfer contains an unsupported item`);if(i.has(e))throw TypeError(`model source load transfer contains a duplicate item`);i.add(e)}return Object.freeze({module:e,transfer:Object.freeze([...n]),release:o})}catch(e){try{o()}catch{}throw e}}function x(e,t){return new Proxy(e,{get(e,n){if(n===`postMessage`)return(n,r)=>{if(typeof n==`object`&&n){let i=n,a=i[t.discriminator];if(a===`init`)return;if(a===`parse`){e.postMessage(t.parseMessage(i),[...r??[],...t.load.transfer]);return}}e.postMessage(n,r??[])};let r=t.member?.(e,n);if(r!==void 0)return r;let i=Reflect.get(e,n,e);return typeof i==`function`?i.bind(e):i}})}function S(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`model source module descriptor must be an object`);let n=Reflect.ownKeys(e);if(n.length!==f.length||f.some(e=>!n.includes(e)))throw TypeError(`model source module descriptor has unknown or missing fields`);let r=Object.getOwnPropertyDescriptors(e);if(f.some(e=>!r[e]?.enumerable||!(`value`in r[e])))throw TypeError(`model source module descriptor fields must be data properties`);let i=r.protocol.value,a=r.target.value,o=r.moduleUrl.value;if(i!==`ooxml-model-source-module/v2`)throw TypeError(`unsupported model source module protocol`);if(typeof a!=`string`||!u.has(a))throw TypeError(`unsupported model source target`);if(t!==void 0&&a!==t)throw TypeError(`a ${a} model source module cannot load ${t} input`);if(typeof o!=`string`||o.length===0||o.length>m||o.trim()!==o)throw TypeError(`model source moduleUrl must be a nonempty absolute URL`);let s;try{s=new URL(o)}catch{throw TypeError(`model source moduleUrl must be a nonempty absolute URL`)}if(!d.has(s.protocol))throw TypeError(`model source moduleUrl protocol is unsupported`);return Object.freeze({protocol:l,target:a,moduleUrl:o,config:C(r.config.value)})}function C(e){if(!w(e))throw TypeError(`model source config must be a plain object`);let t=Reflect.ownKeys(e);if(t.length>h)throw RangeError(`model source config accepts at most ${h} entries`);let n={};for(let r of t){if(typeof r!=`string`||!v.test(r))throw TypeError(`model source config keys must be short identifiers`);let t=Object.getOwnPropertyDescriptor(e,r);if(!t?.enumerable||!(`value`in t))throw TypeError(`model source config entries must be data properties`);let i=t.value;if(typeof i==`string`){if(i.length>g)throw RangeError(`model source config string is too long`)}else if(typeof i==`number`){if(!Number.isFinite(i))throw TypeError(`model source config numbers must be finite`)}else if(typeof i!=`boolean`&&i!==null)throw TypeError(`model source config values must be strings, numbers, booleans or null`);n[r]=i}return Object.freeze(n)}function w(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function T(e,t){if(e.startsWith(`/`)&&globalThis.location?.href){let n;try{n=new URL(`/`,t)}catch{}if(!n||n.protocol===`file:`)try{return new URL(e,globalThis.location.href).href}catch{}}return new URL(e,t).href}async function E(l,u){let d=u.mode??`main`,f=t(u),p=new e({enabled:!0,format:`pptx`,mode:d,policy:f.policy,onMetrics:f.onResourceMetrics,emitToConsole:f.debug});try{if(d===`worker`&&(typeof Worker>`u`||typeof OffscreenCanvas>`u`))throw Error(`mode: 'worker' requires Worker and OffscreenCanvas support`);let e;if(typeof l==`string`){let t=await fetch(l);if(!t.ok)throw Error(`Failed to fetch: ${t.status} ${t.statusText}`);e=await t.arrayBuffer()}else e=l;let t=y(u.legacyPpt===void 0?void 0:[u.legacyPpt],`pptx`,new Uint8Array(e));if(!t)return o.load(e,{...u,legacyPpt:void 0});let m=b(t,`pptx`);try{p.setSourceBytes(e.byteLength),p.checkpoint(`container ready`);let t=d===`worker`?(await n(async()=>{let{createRenderWorker:e}=await import(`./render-worker-host-CVr53kg0-DUcW76F6.js`);return{createRenderWorker:e}},[])).createRenderWorker():new(await(n(async()=>{let{default:e}=await import(`./worker-source-ZQE9C1j6-B31UTbq3.js`);return{default:e}},[]))).default,l=D(t,m),h=d===`worker`?i(u):void 0,g;try{g=new o(l,d,u.wasmUrl);let t=g;t._metrics=p,t._cjkFallback=r(u.cjkFallback),t._math=d===`worker`?void 0:u.math,t._threeD=d===`worker`?void 0:u.threeD,t._regionMap=d===`worker`?void 0:u.regionMap,t._chartEx=d===`worker`?void 0:u.chartEx,t._tiff=d===`worker`?void 0:u.tiff,t._googleSubstitutes=!!u.useGoogleFonts,t._parsedTextChain=!1,O(u,d,h);let n=u.progressiveLayout?{onProgress:u.onLayoutProgress,onPartial:u.onLayoutPartial,onComplete:u.onLayoutComplete,firstPublication:c(),published:!1,deferred:!1,settled:!1}:void 0;return await t._parse(e,f.policy,!!u.useGoogleFonts,u.workerTimeoutMs,e=>p.observeUsage(e),h,n),p.checkpoint(`presentation preflight ready`),d===`main`&&u.useGoogleFonts&&t._preflight&&!n&&await t._ensureGoogleFonts(s(t._preflight.fontPreloadNames,t._embeddedFontAliases),t._preflight.fontPreloadDemand),p.succeed({slides:g.slideCount}),m.release(),g}catch(e){let n=g;throw a(t,n?()=>n.destroy():void 0),e}}finally{m.release()}}catch(e){throw p.fail(e),e}}function D(e,t){let n=T(new URL(`/office/assets/pptx-source-worker-559Vl2R3.mjs`,``+import.meta.url).href,import.meta.url);return x(e,{discriminator:`kind`,load:t,parseMessage:e=>({...e,source:t.module,sourceOwnerUrl:n,...t.transfer.length?{sourceTransfer:t.transfer}:{}})})}function O(e,t,n){t===`worker`&&(e.math&&!n?.math&&console.warn(`[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math.`),e.threeD&&!n?.threeD&&console.warn(`[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d.`),e.regionMap&&!n?.regionMap&&console.warn(`[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map.`),e.chartEx&&!n?.chartEx&&console.warn(`[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex.`),e.tiff&&!n?.tiff&&console.warn(`[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them.`))}export{E as loadPptxModelSource};
@@ -0,0 +1 @@
1
+ var e=``+new URL(`/office/assets/render-worker-Ck21oePL-D_L2C4am.js`,``+import.meta.url).href;function t(){return new Worker(e,{type:`module`})}export{t as createRenderWorker};