@betteroffice/pptx 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSES/MIT-ruzstd.txt +21 -0
- package/LICENSES/MIT-twox-hash.txt +21 -0
- package/LICENSES/MIT-wuff.txt +20 -0
- package/README.md +24 -5
- package/dist/chunk-2XA2UH2O.js +1 -0
- package/dist/chunk-4WP5ZWYV.js +1 -0
- package/dist/chunk-65A2TX24.js +1 -0
- package/dist/chunk-663FARNX.js +1 -0
- package/dist/chunk-AYLLA7XR.js +1 -0
- package/dist/chunk-AZDGFDN2.js +1 -0
- package/dist/chunk-CCVGR3MS.js +1 -0
- package/dist/chunk-COS6CTH7.js +2 -0
- package/dist/chunk-G54T5CXF.js +1 -0
- package/dist/chunk-GAM2OAAP.js +2 -0
- package/dist/chunk-GHET7GIK.js +1 -0
- package/dist/chunk-GR7EGQ2Z.js +1 -0
- package/dist/chunk-HZODDD5T.js +1 -0
- package/dist/chunk-J54GRQWZ.js +1 -0
- package/dist/chunk-JJV35WHH.js +2 -0
- package/dist/chunk-KGEED2XY.js +1 -0
- package/dist/chunk-OUNTNO7R.js +1 -0
- package/dist/chunk-QRAGGQDN.js +1 -0
- package/dist/chunk-QWRXUT7T.js +1 -0
- package/dist/chunk-RNJM2LKC.js +3 -0
- package/dist/chunk-S6HKAO2F.js +1 -0
- package/dist/chunk-S6UYP4BX.js +1 -0
- package/dist/chunk-T6VUFMNC.js +1 -0
- package/dist/chunk-TRT2B252.js +10 -0
- package/dist/collaboration.js +1 -1
- package/dist/{editorSession-Cl_EWgAi.d.ts → editorSession-qQaVvMVR.d.ts} +346 -6
- package/dist/generated/metafile_svg_wasm_bg.wasm +0 -0
- package/dist/generated/pptx_wasm_bg.wasm +0 -0
- package/dist/generated/pptx_wasm_lean_bg.wasm +0 -0
- package/dist/generated/preflight/pptx_preflight_bg.wasm +0 -0
- package/dist/index.d.ts +21 -18
- package/dist/index.js +1 -1
- package/dist/pptxSessionWorker.mjs +13 -9
- package/dist/pptxSessionWorker.node.mjs +1 -0
- package/dist/pptxWorkerStart.d.ts +5 -0
- package/dist/pptxWorkerStart.js +1 -0
- package/dist/sessionWorker.missing.d.ts +3 -0
- package/dist/sessionWorker.missing.js +1 -0
- package/dist/sessionWorker.node.d.ts +3 -0
- package/dist/sessionWorker.node.js +1 -0
- package/dist/transport-BcduBS8X.d.ts +16 -0
- package/dist/wasm-preflight.d.ts +26 -0
- package/dist/wasm-preflight.js +1 -0
- package/dist/worker.d.ts +122 -22
- package/dist/worker.js +1 -1
- package/package.json +18 -5
- package/dist/chunk-2CPM3HRW.js +0 -1
- package/dist/chunk-3TTZUGDD.js +0 -1
- package/dist/chunk-B6OFSXHM.js +0 -1
- package/dist/chunk-DDNX2Z7E.js +0 -1
- package/dist/chunk-JZOLK2OC.js +0 -1
- package/dist/chunk-NWXUJY6L.js +0 -3
- /package/dist/{pptxSessionWorker.d.ts → pptxSessionWorker.node.d.ts} +0 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {i,f,m,t,l as l$1,x,q as q$1,o,p,u,y,a as a$1,v,e as e$1}from'./chunk-NWXUJY6L.js';import {P,b,T,X,K,s,N,J,H,z,A,G,B,m as m$1,Y,f as f$1,h,j,l,q,Q,a,o as o$1,p as p$1,I,k,n,M,L}from'./chunk-DDNX2Z7E.js';import {c,e as e$2,d,f as f$2}from'./chunk-JZOLK2OC.js';import {w,h as h$1,e,v as v$1,x as x$1}from'./chunk-2CPM3HRW.js';import {a as a$2}from'./chunk-O2XFH626.js';async function gt(i){let p=await fetch(i);if(typeof WebAssembly.compileStreaming=="function")try{return await WebAssembly.compileStreaming(p.clone())}catch(f){if(!p.ok||!["basic","cors","default"].includes(p.type)||p.headers.get("Content-Type")==="application/wasm")throw f}return WebAssembly.compile(await p.arrayBuffer())}function yn(i,p,f,g=gt){let F,A=false;function L(){return F||(F=g(p),F.catch(()=>{})),F}return i.listen($=>{K($)&&$.kind==="wasm-compile"&&L();}),async $=>{if($!==void 0)return f($);let q=L(),_;try{_=await q;}catch(c){throw F===q&&(F=void 0),c}if(await f(_),!A){A=true;let c={protocol:1,kind:"wasm-module",url:p.href,module:_};try{i.post(c);}catch{}}}}var mn=["input","collab","interactive"],gn={input:0,collab:1,interactive:2,background:3},jn=8,Nn=24,Hn=1e3;function bn(i){let p={input:[],collab:[],interactive:[]},f=[],g=0,F=0,A=0,L=Number.NEGATIVE_INFINITY,$=Number.NEGATIVE_INFINITY,q=false,_=false,c=null,T=()=>i.now()-L<Hn?jn:Nn;function M(E=false){q||_||(_=true,(E?queueMicrotask:i.turn)(()=>{_=false,G();}));}function V(E){for(let v of mn)if(v!==E.lane)for(let r of p[v]){if(r.seq>E.seq)break;if(!(r.reorderable&&gn[E.lane]<gn[r.lane]))return true}return false}function x(){for(let E of mn){let v=p[E][0];if(v&&!V(v))return v}return null}function y(){let E=x();if(!E)return null;let v=[p[E.lane].shift()];if(E.lane==="collab")for(;p.collab[0]&&!V(p.collab[0]);)v.push(p.collab.shift());return v}function l(E){return E.idleAfterInputMs===void 0?Number.NEGATIVE_INFINITY:$+E.idleAfterInputMs}async function b(E){for(let v of E){v.mutates&&(F+=1),(v.mutates||v.reframes)&&(A+=1);try{await v.run();}catch(r){i.failed?.(r);}}}async function J(){let E=i.now(),v=f.findIndex(I=>l(I)<=E);if(v<0)return false;let[r]=f.splice(v,1);try{if(r.version!==F||r.generation!==A){if((r.onStale?.()??"cancel")==="cancel")return r.cancel?.(),!0;r.version=F,r.generation=A;}await r.run(T())==="yield"&&f.push(r);}catch(I){r.fail?r.fail(I):i.failed?.(I);}return true}function re(){if(c?.(),c=null,f.length===0)return;let E=Math.min(...f.map(l));c=i.timer(()=>{c=null,M();},Math.max(1,E-i.now()));}async function G(){if(q)return;q=true;let E=false;try{let r=y();r?(E=!0,await b(r)):f.length>0&&(E=await J());}catch(r){E=true,i.failed?.(r);}finally{q=false;}let v=E?x():null;v?M(!v.reorderable):E&&f.length>0?M():re();}function H(E,v){ie({kind:`${E.kind}:install`,version:E.version,generation:E.generation,onStale:()=>"cancel",cancel:()=>E.cancel?.(),fail:r=>E.cancel?.(r),run:async()=>(await E.install(v),"done")});}function ie(E){f.push(E),q||(c?.(),c=null),M();}return {submit(E){if(E.userInput&&(L=i.now()),E.holdsIdleTasks&&($=i.now()),E.key!==void 0){let v=p[E.lane];for(let r=v.length-1;r>=0;r-=1)if(v[r].replaceableBy===E.key)try{v.splice(r,1)[0].supersede?.();}catch(I){i.failed?.(I);}}p[E.lane].push({...E,seq:g++}),c?.(),c=null,M(true);},schedule:ie,dispatch(E){let v=E,r=()=>ie({kind:v.kind,version:v.version,generation:v.generation,onStale:()=>"cancel",cancel:()=>v.cancel?.(),fail:u=>v.cancel?.(u),run:async()=>(await v.install(v.compute(v.input)),"done")});if(!i.executor){r();return}let I=(v.transfer?.length??0)>0;i.executor.run({kind:v.kind,input:v.input,transfer:v.transfer}).then(u=>H(v,u),u=>I?v.cancel?.(u):r());},budget:T,get version(){return F},get generation(){return A},bump(E){E.version&&(F+=1),(E.version||E.generation)&&(A+=1);},pending(){return {foreground:p.input.length+p.collab.length+p.interactive.length,background:f.length}}}}var Bn=1e3;function bt(i){let p={name:i instanceof Error?i.name:"Error",message:i instanceof Error?i.message:String(i)};return i!==null&&typeof i=="object"&&"refusal"in i&&(p.refusal=i.refusal),p}function He(i){return i instanceof N||typeof WebAssembly<"u"&&i instanceof WebAssembly.RuntimeError}function _n(i){return i instanceof N?i:new N(He(i)?"trap":"crash",bt(i).message)}function Sn(i,p){let f,g=r=>{let I=_n(r);return I.code==="trap"?p.trapFailure?.(I)??I:I},F=false,A=()=>{},L=()=>{},$,q=0,_=new Set,c=new Set,T=()=>F||f!==void 0;function M$1(){A(),L();for(let r of _)clearTimeout(r);_.clear();for(let r of c)try{r.cancel();}catch{}c.clear();try{p.onDispose?.();}catch{}}function V(r){if(!T()){f=r;try{i.post({protocol:1,kind:"failure",code:r.code,message:r.message,...r.diagnostics===void 0?{}:{diagnostics:r.diagnostics}});}catch{}M$1();}}function x(r,I){if(!T())try{i.post(r,I);}catch(u){V(new N("message",`Session could not post a message: ${bt(u).message}`));}}function y(r,I){if(T())return ()=>{};let u=setTimeout(()=>{_.delete(u),T()||r();},I);return _.add(u),()=>{clearTimeout(u),_.delete(u);}}function l(r){let I={end(){c.delete(I);},cancel(){I.end(),r?.();}};return r&&c.add(I),I}function b(r,I){if(T())return I;let u=m=>{if(T())return I;if(!He(m))throw m;return V(g(m)),I};try{let m=r();return m instanceof Promise?m.catch(u):m}catch(m){return u(m)}}function J$1(r){let I=r.then(),u=m=>B=>{if(!T())try{return m(B)}catch(X){V(g(X));return}};return I.then=((m,B)=>Promise.prototype.then.call(I,m&&u(m),B&&u(B))),I}let re=p.executor,G$1=bn({now:Date.now,turn:r=>{y(r,0);},timer:y,executor:re&&{run(r){return J$1(re.run(r))}},failed:r=>V(g(r))}),H={schedule(r){if(T()){try{r.cancel?.();}catch{}return}let I=l(r.cancel&&(()=>r.cancel()));G$1.schedule({kind:r.kind,idleAfterInputMs:r.idleAfterInputMs,get version(){return r.version},set version(u){r.version=u;},get generation(){return r.generation},set generation(u){r.generation=u;},...r.onStale?{onStale:()=>b(()=>r.onStale(),"cancel")}:{},...r.cancel?{cancel(){return I.end(),b(()=>r.cancel(),void 0)}}:{},...r.fail?{fail(u){return I.end(),b(()=>r.fail(u),void 0)}}:{},async run(u){if(T())return "done";try{let m=await r.run(u);return m==="done"&&I.end(),T()?"done":m}catch(m){if(I.end(),T())return "done";if(He(m))return V(g(m)),"done";throw m}}});},dispatch(r){if(T()){try{r.cancel?.();}catch{}return}let I=l(r.cancel&&(()=>r.cancel()));G$1.dispatch({kind:r.kind,input:r.input,transfer:r.transfer,get version(){return r.version},set version(u){r.version=u;},get generation(){return r.generation},set generation(u){r.generation=u;},...r.cancel?{cancel(u){return I.end(),b(()=>r.cancel(u),void 0)}}:{},compute(u){return b(()=>r.compute(u),void 0)},async install(u){if(!T())try{await r.install(u);}catch(m){if(I.end(),T())return;if(He(m)){V(g(m));return}throw m}finally{I.end();}}});},bump:r=>G$1.bump(r),budget:()=>G$1.budget(),pending:()=>G$1.pending(),get version(){return G$1.version},get generation(){return G$1.generation}};function ie(r,I$1){I(I$1)?x({protocol:1,kind:"reply",id:r,ok:true,value:I$1.value},I$1.transfer):x({protocol:1,kind:"reply",id:r,ok:true,value:I$1});}function E(r,I){He(I)?V(g(I)):x({protocol:1,kind:"reply",id:r,ok:false,error:bt(I)});}async function v(r){if(!T()){$=r.id,q=Date.now();try{let I=p.handlers[r.method],u=await I(p.context,...r.args);G(u)?u.promise.then(m=>ie(r.id,m),m=>E(r.id,m)):ie(r.id,u);}catch(I){E(r.id,I);}finally{$===r.id&&($=void 0);}}}return A=i.listen(r=>{if(!T()){if(!K(r))V(new N("message","Session received a malformed client message"));else if(r.kind==="dispose")F=true,M$1(),i.close();else if(r.kind==="call"&&!f){let I=J(p.policies,r.method)?p.policies[r.method]:void 0;if(!J(p.handlers,r.method)||!I){x({protocol:1,kind:"reply",id:r.id,ok:false,error:{name:"Error",message:`Unknown session method: ${r.method}`}});return}let u;try{u=typeof I=="function"?I(...r.args):I;}catch(m){E(r.id,m);return}G$1.submit({...u,run:()=>v(r),supersede:()=>x({protocol:1,kind:"reply",id:r.id,ok:false,error:{name:M,message:"Superseded by a newer request"}})});}}}),L=i.onError(r=>V(g(r))),{scheduler:H,emit:(r,I,u)=>x({protocol:1,kind:"event",name:r,payload:I},u),progress(){let r=Date.now();$===void 0||r-q<Bn||(q=r,x({protocol:1,kind:"progress",id:$}));}}}var St=class{constructor(p){a$2(this,"emit",p);a$2(this,"listener",null);}connect(){}disconnect(){this.emit("disconnect");}send(p){return this.emit(p),true}onEvent(p){return this.listener=p,()=>{this.listener===p&&(this.listener=null,this.emit("unsubscribe"));}}deliver(p){this.listener?.(p);}};function vn(i){let p=new Map,f=[],g=false,F=false,A=null,L=(x,y)=>{if(F)return;let l=!g&&f.length===0,b=f[f.length-1];b?.provider===x?b.out.push(y):f.push({provider:x,out:[y]}),l&&i.onOutput?.();},$=()=>{let x=A;if(!x||x.updates.length===0)return;A={updates:[],arrivals:[],single:true};let y=i.merge(x.updates,x.single&&x.updates.length===1);if("failed"in y){for(let l of x.arrivals)l.fail(y.failed);return}x.arrivals.forEach((l,b)=>l.settle(b===x.arrivals.length-1?y.applied:null));},q=(x,y,l)=>{if(!A)throw new Error("Collaboration updates merge only within a pipe burst");return A.updates.push(...y),A.arrivals.push(i.arrive(x)),A.single&&(A.single=l),null},_=x=>({clientId:i.clientId,encodeStateVector:()=>($(),i.read.encodeStateVector()),encodeStateAsUpdate:y=>($(),i.read.encodeStateAsUpdate(y)),...i.read.encodeStateAsUpdateChunks&&{encodeStateAsUpdateChunks:(y,l)=>($(),i.read.encodeStateAsUpdateChunks(y,l))},applyUpdate:y=>q(x(),[y],true),applyUpdateChunks:y=>q(x(),y,false),onUpdate:i.onUpdate}),c=(x,y)=>{let l,b=new St(G=>{l.echo||L(x,typeof G=="string"?{do:G,through:l.through}:{do:"send",data:v$1(G),through:l.through});}),J=i.createProvider(_(()=>l.provider),b,y);l={id:x,provider:J,transport:b,through:0,echo:false,leaveClock:null,stop:[]};let re=false;return l.stop.push(J.onStatus(({status:G,synced:H})=>L(x,{do:"status",status:G,synced:H,through:l.through})),J.onError(G=>{l.echo||L(x,{do:"error",error:{code:G.code,message:G.message},through:l.through});}),J.onPeers(G=>{re&&L(x,{do:"peers",peers:[...G],timeOrigin:x$1(),through:l.through});})),re=true,p.set(x,l),l},T=(x,y)=>{x.echo=true;try{y();}finally{x.echo=false;}},M=x=>{let y=p.get(x.provider);for(let l of x.ops){if(l.op==="create"){y??(y=c(x.provider,l.options)),y.through=l.seq;continue}if(!y){L(x.provider,{do:"lost"});return}let b=y;switch(b.through=l.seq,l.op){case "connect":T(b,()=>b.provider.connect());break;case "disconnect":T(b,()=>b.provider.disconnect());break;case "fail":T(b,()=>b.transport.deliver({type:"error",error:i.transportError(l.error)}));break;case "destroy":T(b,()=>b.provider.destroy());for(let J of b.stop)J();p.delete(b.id),y=void 0;break;case "cursor":b.provider.setCursor(l.cursor,l.broadcast);break;case "event":{let{event:J}=l;b.transport.deliver(J.type==="message"?{type:"message",data:new Uint8Array(J.data)}:J);break}}}},V=()=>{for(let x of p.values()){let y=i.leave(x.provider),l=y?.clock??null;l!==x.leaveClock&&(x.leaveClock=l,L(x.id,{do:"leave",data:y?v$1(y.frame):null,through:x.through}));}};return {run(x){if(!F){g=true,A={updates:[],arrivals:[],single:true};try{M(x),$();}finally{A=null,g=false;}}},drain(){g=true;try{V();}finally{g=false;}if(f.length===0)return;let x=f;f=[];let y=[];for(let l of x)for(let b of l.out)(b.do==="send"||b.do==="leave"&&b.data)&&y.push(b.data);return {batches:x,transfer:y}},dispose(){if(!F){F=true;for(let x of p.values()){for(let y of x.stop)y();x.echo=true;try{x.provider.destroy();}catch{}}p.clear(),f=[];}}}}function Pn(i,p){return i.setCollaborative?.(),vn({clientId:i.clientId,read:{encodeStateVector:()=>i.encodeStateVector(),encodeStateAsUpdate:f=>i.encodeStateAsUpdate(f)},onUpdate:f=>i.onUpdate(f),merge(f){for(let g of f){let F=i.version();try{i.applyUpdate(g);}catch(A){if(!(A instanceof Error)||A instanceof WebAssembly.RuntimeError||i.version()!==F)throw A;return {failed:A}}}return {applied:null}},createProvider(f,g,F){let A=new f$2(f,g,F);return Object.assign(A,{onPeers:L=>A.onPresence(L)})},arrive:d,leave:e$2,transportError:f=>new c(f.code,f.message),onOutput:p})}function Ze(i,p){for(let f of i){if(f.id===p)return f;let g=Ze(f.children,p);if(g)return g}return null}function et(i,p){for(let f of i.shapes)if(f.id===p||Ze(f.children,p))return f;return null}function vt(i){if(i.width>0&&i.height>0)return {x:i.x,y:i.y,width:i.width,height:i.height};let p=i.inherited;return !p||p.width<=0||p.height<=0?null:{x:p.x,y:p.y,width:p.width,height:p.height}}function Pt(i){return vt(i)!==null}function kn(i){let f=((i.inherited?.rotationDeg??i.rotationDeg)%360+360)%360,g=i.inherited?.flipH??i.flipH,F=i.inherited?.flipV??i.flipV;return Pt(i)&&f===0&&!g&&!F}function xn(i,p,f,g,F){let A=F??JSON.parse(q(i,p.slideIndex));function L(_){for(let c of _)if(c.kind==="textBox"){let T=c.paragraphs.map(x=>x.runs.map(y=>y.text).join("")).join(`
|
|
2
|
-
`),M=[...q$1(T)],V=0;for(let x of c.lines){let y=[...x.caretStops].sort((J,re)=>J.position-re.position);for(;V<M.length&&M[V]<x.start;)V++;let l=[],b=0;for(let J=V;J<M.length&&M[J]<=x.end;J++){let re=M[J];for(;b<y.length&&y[b].position<re;)b++;let G=y[b],H=y[b-1];G?.position===re?l.push(G):H&&G&&l.push({position:re,x:H.x+(G.x-H.x)*(re-H.position)/(G.position-H.position)});}x.caretStops=l;}}else (c.kind==="table"||c.kind==="chart")&&L(c.primitives);}F||L(A.primitives),g?.(A);let $=new TextEncoder().encode(JSON.stringify(A)).buffer,q$2=[];for(let _ of Q(A)){if(f.has(_))continue;let c;try{c=i.mediaBytes(_);}catch{continue}if(a(c)&&c.byteLength<=33554432)try{c=z(c);}catch{}q$2.push({assetId:_,bytes:new Uint8Array(c).buffer});}return H({...p,displayList:$,media:q$2},[$,...q$2.map(({bytes:_})=>_)])}function wn(i,p){if(!p||!Array.isArray(p.args)||p.args.length>(p.method==="insertTableColumn"?6:5))return null;let{method:f,args:g}=p,F=i.snapshot(),A=(c,T=1e6)=>typeof c=="string"&&c.length<=T&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u.test(c),L=c=>!!(c&&typeof c=="object"&&["xEmu","yEmu"].every(T=>Number.isSafeInteger(c[T]))),$=c=>!!(c&&typeof c=="object"&&A(c.author,1024)&&A(c.text)&&c.text.length>0&&A(c.created,128)&&Number.isFinite(Date.parse(c.created))&&(c.initials===void 0||A(c.initials,128)));if(f==="insertTableRow"||f==="deleteTableRow"||f==="insertTableColumn"||f==="deleteTableColumn"){let c=f==="insertTableRow"||f==="insertTableColumn";if(g.length<(c?4:3)||g.length>(f==="insertTableColumn"?6:c?5:3))return null;let[T,M,V]=g;if(!A(T,1024)||!A(M,1024)||!Number.isSafeInteger(V)||V<0)return null;let x=(y,l,b)=>{try{return i.checkTableEdit(f,T,M,V,y,l,b),!0}catch{return false}};if(f==="insertTableRow"||f==="insertTableColumn"){let y=g[3],l=g[4];if(y!=="before"&&y!=="after"||l!==void 0&&(!Array.isArray(l)||l.length>1e3||l.some(J=>!A(J,16e3))))return null;let b=g[5];return b!==void 0&&b!=="split"&&b!=="copy"?null:f==="insertTableColumn"?x(y,l,b)?()=>i.insertTableColumn(T,M,V,y,l,b):null:x(y,l)?()=>i.insertTableRow(T,M,V,y,l):null}return x()?()=>i[f](T,M,V):null}if(f==="setCommentFlavor")return ["legacy","modern"].includes(g[0])&&!F.comments?.length?()=>i.setCommentFlavor(g[0]):null;if(f==="replyToComment"||f==="setCommentStatus"||f==="setCommentPosition"||f==="removeComment"){let c=F.comments?.find(T=>T.id===g[0]);if(!c)return null;switch(f){case "replyToComment":return F.commentFlavor==="modern"&&!c.parentId&&$(g[1])?()=>i.replyToComment(c.id,g[1]):null;case "setCommentStatus":return F.commentFlavor==="modern"&&typeof g[1]=="boolean"?()=>i.setCommentStatus(c.id,g[1]):null;case "setCommentPosition":return !c.parentId&&L(g[1])?()=>i.setCommentPosition(c.id,g[1]):null;case "removeComment":return ()=>i.removeComment(c.id)}}if(f==="propose"){let[c,T,M]=g;if(!A(c,1024)||!c.trim()||T!==null&&!A(T)||!Array.isArray(M)||!M.length||M.length>256)return null;try{if(JSON.stringify(M).length>1e6)return null}catch{return null}if(i.listProposals().length>=64)return null;let V=new Map([["replaceText",["storyId","start","end","text","style"]],["formatText",["storyId","start","end","patch"]],["setParagraphAlignment",["storyId","start","end","alignment"]],["setShapeRect",["slideId","shapeId","rect"]],["setShapeFill",["slideId","shapeId","color"]],["setShapeStroke",["slideId","shapeId","stroke"]],["setShapeAdjust",["slideId","shapeId","adjustments"]],["setSlideNotes",["slideId","text"]]]),x=(H,ie)=>!!(H&&typeof H=="object"&&!Array.isArray(H)&&Object.keys(H).every(E=>ie.includes(E))),y=(H,ie=0)=>typeof H=="string"?A(H):typeof H=="number"?Number.isFinite(H):!H||typeof H!="object"||ie<16&&Object.entries(H).every(([E,v])=>A(E)&&y(v,ie+1)),l=(H,ie=false)=>{let E=["bold","italic","fontFamily","underline","color","fontSizePt","spacingPt","baselinePct"];return ie&&E.push("kernPt","caps"),x(H,E)?Object.entries(H).every(([v,r])=>{if(r==null)return true;switch(v){case "bold":case "italic":return typeof r=="boolean";case "fontFamily":return A(r);case "underline":return typeof r=="string"&&["none","words","sng","dbl","heavy","dotted","dottedHeavy","dash","dashHeavy","dashLong","dashLongHeavy","dotDash","dotDashHeavy","dotDotDash","dotDotDashHeavy","wavy","wavyHeavy","wavyDbl"].includes(r);case "color":return typeof r=="string"&&/^#?[0-9a-f]{6}$/i.test(r);case "fontSizePt":return typeof r=="number"&&Number.isFinite(r)&&r>=1&&r<=4e3;case "spacingPt":return typeof r=="number"&&Number.isFinite(r)&&Math.abs(r)<=4e3;case "baselinePct":return typeof r=="number"&&Number.isFinite(r)&&r*1e3>=-2147483648&&r*1e3<=2147483647;case "kernPt":return typeof r=="number"&&Number.isFinite(r)&&r>=0&&r<=4e3;case "caps":return typeof r=="string"&&["none","small","all"].includes(r);default:return false}}):false},b=i.readContent();if(!b.ok)return null;let J=[],re=[];for(let H of M){if(!H||typeof H!="object")return null;let ie=V.get(H.type);if(!ie||!x(H,["type",...ie]))return null;let E=H,v=Object.fromEntries(["type",...ie].map(r=>[r,E[r]]));if(!y(v)||v.type==="replaceText"&&v.style!=null&&!l(v.style,true)||v.type==="formatText"&&!l(v.patch)||v.type==="setShapeRect"&&!x(v.rect,["x","y","width","height"])||v.type==="setShapeStroke"&&!x(v.stroke,["color","widthPt"]))return null;if(re.push(v),"storyId"in v){let r=b.stories.find(u=>u.storyId===v.storyId);if(!r)return null;let I={kind:"range",slideId:r.slideId,shapeId:r.shapeId,storyId:r.storyId,start:v.start,end:v.end};if(v.type==="replaceText")J.push({op:"replaceText",target:I,text:v.text});else if(v.type==="formatText"){let u=Object.fromEntries(Object.entries(v.patch).filter(([,m])=>m!=null));v.patch=u,J.push({op:"formatText",target:I,patch:u});}else if(v.type==="setParagraphAlignment")J.push({op:"setParagraphAlignment",target:I,alignment:v.alignment});else return null}else {if(!["setShapeRect","setShapeFill","setShapeStroke","setShapeAdjust","setSlideNotes"].includes(v.type))return null;let{type:r,...I}=v,{slideId:u,...m}=I,B="shapeId"in m?m.shapeId:void 0;"shapeId"in m&&delete m.shapeId,J.push({op:r,target:B===void 0?{slideId:u}:{slideId:u,shapeId:B},...m});}}let G=i.version();try{if(!i.validateEdits({expectVersion:G,steps:J}).ok)return null}catch(H){if(H&&typeof H=="object"&&"name"in H&&H.name==="PptxEditDecodeError")return null;throw H}return ()=>i.propose(c,T,re)}if(f==="acceptProposal"||f==="rejectProposal"){let c=i.listProposals().find(T=>T.id===g[0]);return c?f==="rejectProposal"?()=>i.rejectProposal(c.id):g[1]?.force!==void 0&&typeof g[1].force!="boolean"||c.staleTargets.length&&!g[1]?.force?null:()=>i.acceptProposal(c.id,g[1]):null}if(f==="insertSlide"){let[c,T]=g;return !Number.isSafeInteger(c)||c<0||c>F.slides.length||T!==void 0&&(typeof T!="string"||!F.slides.some(M=>M.layoutPartPath===T))?null:()=>i.insertSlide(c,T)}let q=F.slides.find(c=>c.id===g[0]);if(!q)return null;if(f==="setSlideNotes")return A(g[1])?()=>i.setSlideNotes(q.id,g[1]):null;if(f==="addComment"){let c=g[1];return $(c)&&(c.xEmu===void 0&&c.yEmu===void 0||L(c))?()=>i.addComment(q.id,c):null}if(f==="deleteSlide")return ()=>i.deleteSlide(q.id);if(f==="moveSlide"){let c=g[1];return Number.isSafeInteger(c)&&c>=0&&c<F.slides.length?()=>i.moveSlide(q.id,c):null}let _=et(q,g[1]);if(!_||_.id!==g[1])return null;switch(f){case "setShapeFill":{let c=g[2];return _.kind==="shape"&&(c===null||/^#[0-9a-f]{6}$/i.test(c))?()=>i.setShapeFill(q.id,_.id,c):null}case "setShapeStroke":{let c=g[2];return _.kind==="shape"&&c&&(c.color===void 0||typeof c.color=="string"&&/^#[0-9a-f]{6}$/i.test(c.color))&&(c.widthPt===void 0||Number.isFinite(c.widthPt)&&c.widthPt>=0&&c.widthPt<=1584)?()=>i.setShapeStroke(q.id,_.id,c):null}case "setShapeAdjust":{let c=g[2];return _.kind==="shape"&&c&&typeof c=="object"&&!Array.isArray(c)&&Object.keys(c).length<=64&&Object.entries(c).every(([T,M])=>/^[a-zA-Z][a-zA-Z0-9]*$/.test(T)&&Number.isFinite(M)&&Math.abs(M)<=1e6)?()=>i.setShapeAdjust(q.id,_.id,c):null}case "removeShape":return ()=>i.removeShape(q.id,_.id);case "bringShapeToFront":return ()=>i.bringShapeToFront(q.id,_.id);case "sendShapeToBack":return ()=>i.sendShapeToBack(q.id,_.id);case "bringShapeForward":return ()=>i.bringShapeForward(q.id,_.id);case "sendShapeBackward":return ()=>i.sendShapeBackward(q.id,_.id);default:return null}}var It=1,Tt=4e3,Dn=new Set(["maxFrameBytes","maxMessagesPerFrame","user"]);function tt(i){return Math.round(i*100)/100}function Tn(i$1={}){let p$2,f$1,g=[],F,A$1,L,$="",q=new Map,_=false,c=false,T=0,M="",V=1,x$1=0,y$1=null,l=null,b=null,J=0,re=new Map,G,H$1=false,ie=false,E,v$1={},r=new Map,I,u$1,m$1,B=false,X=0,Y=new Map,ue=i(),he,ae=new Map,ce=new Map,fe=new Map,Pe=new Map,ye=new Map,Et=new Map,Ue=new Map,me=new Map,oe=new Map,_e=new Set,de=new Map,Ie=new Map;function be(){for(let e of Object.keys(v$1))delete v$1[e];}function rt(){m$1&&Q().addUndoBoundary(),m$1=void 0;}function it(e){for(let a of e.slides)Et.set(a.id,a.notes??"");let t=new Map(e.sources.map(a=>[a.storyId,a.paragraphs]));for(let a of e.stories){let n=te(a),h=Ue.get(a.slideId)??new Set;h.add(n),Ue.set(a.slideId,h),ye.set(n,{text:a,snapshot:Q().story(a.storyId),echoRanges:[],source:new Map((t.get(a.storyId)??[]).map(P=>{let O=a.paragraphs.find(U=>U.paragraphId===P.paragraphId),C=a.text.slice(O.start,O.end),[d,s]=xt(P.text,C),k=P.fields.filter(U=>{let R=U.end<=d?0:U.start>=P.text.length-s?C.length-P.text.length:void 0;return R!==void 0&&O.fields.some(z=>z.start===O.start+U.start+R&&z.end===O.start+U.end+R&&z.fieldType===U.fieldType)});return [P.paragraphId,{text:P.text,fields:k,editable:P.editable&&O.editable&&!B}]}))});}}function De(e,t,a=false){let n=Q(),h=new Set(t.changedSlideIds);if(t.deckSizeChanged||t.slideOrderChanged){let O=L.slides.findIndex(k=>k.id===y$1),C=new Map(L.slides.map(k=>[k.id,k.index]));L=p$1(n),$=n.version(),q.clear();let d=new Set(L.slides.map(k=>k.id));for(let k of L.slides)q.set(k.id,k.index),(t.deckSizeChanged||C.get(k.id)!==k.index)&&h.add(k.id),oe.has(k.id)||oe.set(k.id,0);for(let k of C.keys())d.has(k)||h.add(k);for(let k of oe.keys())d.has(k)||(oe.delete(k),Ie.delete(k));(y$1===null||!d.has(y$1))&&(y$1=L.slides[Math.max(0,Math.min(O,L.slides.length-1))]?.id??null);let s=a?L.slides.find(k=>!C.has(k.id)):void 0;s&&(y$1=s.id);}let P=n.readCommandContent({slideIds:[...h].filter(O=>oe.has(O))});if(!P.ok)throw new Error(`Presentation history read refused: ${P.failure.message}`);for(let O of h){for(let C of Ue.get(O)??[])ye.delete(C);Ue.delete(O);}it(P),Y.clear(),he=void 0,fe.clear(),Pe.clear(),me.clear();for(let[O,C]of de)h.has(C.tag.slideId)&&de.delete(O);return X=e,re.clear(),[...h]}function An(e,t){let a=JSON.stringify([e,t.id]),n=JSON.stringify([t.sourceId,t.kind,t.textStories.map(P=>P.id)]),h=re.get(a);return (!h||h.signature!==n)&&(h={signature:n,token:`${A$1.incarnation}:${++J}`},re.set(a,h)),h.token}function Ee(e,t){let a=Q().snapshot(),n=a.slides.find(j=>j.id===e),h=n&&Ze(n.shapes,t),P=Ve(e);if(!h||h.id!==t||!P)return null;let O=new Set;function C(j){O.add(j.id);for(let K of j.children)C(K);}C(h);let d=P.hits.filter(j=>j.primitive.shapeId&&O.has(j.primitive.shapeId)).map(j=>v(j.transforms,{x:j.primitive.x,y:j.primitive.y,width:j.primitive.w,height:j.primitive.h})),s=vt(h),k=P.size;if(!k)return null;let U={x:a.widthEmu/k.width,y:a.heightEmu/k.height};if(![U.x,U.y].every(j=>Number.isFinite(j)&&j>0))return null;let R=null;if(d.length){let j=Math.min(...d.map(ne=>ne.x)),K=Math.min(...d.map(ne=>ne.y));R={x:j,y:K,width:Math.max(...d.map(ne=>ne.x+ne.width))-j,height:Math.max(...d.map(ne=>ne.y+ne.height))-K};}else s&&(R={x:s.x/U.x,y:s.y/U.y,width:s.width/U.x,height:s.height/U.y});if(!R)return null;let z=h.textStories[0];return {kind:"object",slideId:e,shapeId:t,storyId:z?.id??"",anchor:0,focus:0,affinity:"downstream",token:An(e,h),bounds:R,rect:s,canMove:n.shapes.includes(h)&&Pt(h),canResize:n.shapes.includes(h)&&kn(h),aspectRatioLocked:h.aspectRatioLocked??false,units:U}}function ot(e){let t=ye.get(te(e))?.text;return t?{slideId:e.slideId,shapeId:e.shapeId,storyId:e.storyId,kind:"shape",anchor:0,focus:t.text.length,affinity:"downstream"}:null}function At(e){return !!(e&&e.slideId===y$1&&e.incarnation===A$1.incarnation&&e.documentEpoch===V&&e.slideRevision===oe.get(e.slideId)&&e.coversThroughSeq<=T&&e.coversThroughSeq>=X&&de.has(ze(e)))}function Mt(e){if(!e||typeof e.slideId!="string"||typeof e.shapeId!="string"||typeof e.token!="string")return null;let t=Ee(e.slideId,e.shapeId);return t?.token===e.token&&b?.token===e.token&&b.slideId===e.slideId&&b.shapeId===e.shapeId?t:null}function Ae(e){return l&&te(l)===te(e)&&l.anchor===e.anchor&&l.focus===e.focus&&l.affinity===e.affinity&&l.kind===e.kind?v$1:{}}function Mn(){ue.retain([...Y.keys(),...[...de.values()].map(e=>e.version),...he?[he.version]:[],M]);for(let e of ce.keys())ae.has(e)||ce.delete(e);}function st(e){let t=ue.ack(e.value,he?.version);return t.outcomes=t.outcomes.map(a=>a.reason==="stale-basis"&&ce.has(a.seq)?{...a,reason:ce.get(a.seq)}:a),H(t,e.transfer)}function ze(e){return JSON.stringify([e.slideId,e.slideRevision,e.coversThroughSeq,e.documentEpoch,e.incarnation])}function Q(){if(E!==void 0)throw new m(E,"Presentation command session has failed");if(_)throw new Error("Presentation command session is disposed");if(!F||!A$1||!L)throw new Error("Presentation command session is not open");return F}function at(e){return e?.session===A$1?.session&&e?.incarnation===A$1?.incarnation}function Me(e){if(Q(),!at(e)||!Number.isSafeInteger(e.seq)||e.seq<0||e.seq>T)throw new Error("Presentation command fence differs")}function Re(e){let t=Q();return {selection:{...e},anchor:t.anchorCaret(e.storyId,e.anchor),focus:t.anchorCaret(e.storyId,e.focus)}}function Te(e){let t=Q(),a=t.resolveCaretAnchor(e.anchor),n=t.resolveCaretAnchor(e.focus);if(a===null||n===null)return null;let h={...e.selection,anchor:a,focus:n};return (a!==e.selection.anchor||n!==e.selection.focus)&&delete h.goalX,h}function Fe(e){if(!(!e||typeof e.slideId!="string"||typeof e.shapeId!="string"||typeof e.storyId!="string"))return ye.get(te(e))?.text}function Rn(e,t,a){let n=ye.get(te(e));for(let d of n.text.paragraphs){let s=n.source.get(d.paragraphId);s&&(s.fields=s.fields.filter((k,U)=>{let R=d.fields[U];return R.end<=t||R.start>=a}));}let h=Q().story(e.storyId),P="",O=h.paragraphs.map((d,s)=>{s>0&&(P+=`
|
|
3
|
-
|
|
4
|
-
`&&K.push(ne);return {paragraphId:d.id,start:k,end:P.length,lineBreaks:K,fields:z,editable:j}});if(P.length+1!==h.length)throw new Error("Story text projection differs");let C=P.length-n.text.text.length+a-t;t!==a?n.echoRanges=[]:n.echoRanges=n.echoRanges.map(d=>({start:d.start>=t?d.start+C:d.start,end:d.end>=t?d.end+C:d.end})),C>0&&(n.echoRanges.push({start:t,end:t+C}),n.echoRanges.sort((d,s)=>d.start-s.start),n.echoRanges=n.echoRanges.reduce((d,s)=>{let k=d[d.length-1];return k&&k.end>=s.start?k.end=Math.max(k.end,s.end):d.push({...s}),d},[])),n.snapshot=h,n.formatting=void 0,n.text={...n.text,text:P,paragraphs:O};}function Le(e){let t=ye.get(te(e)),a=t.formatting??(t.formatting=n(Q(),e)),n$1=Ae(e),h=r.get(te(e)),P=t.toolbar;if(P?.story===a&&P.selection.anchor===e.anchor&&P.selection.focus===e.focus&&P.selection.affinity===e.affinity&&P.selection.kind===e.kind&&Object.keys(P.marks).length===Object.keys(n$1).length&&Object.keys(n$1).every(o=>P.marks[o]===n$1[o]))return P.result;let O=e.kind==="shape"?0:Math.min(e.anchor,e.focus),C=e.kind==="shape"?a.length:Math.max(e.anchor,e.focus),d=0,s,k,U,R=[],z=[],j=new Set;for(let o of a.paragraphs){let S=d;for(let D of o.runs){if(h&&D.text.length===0)continue;let w=d+D.text.length,W={...D.style,bold:D.style.bold??a$1.bold,italic:D.style.italic??a$1.italic,underline:D.style.underline??"none",fontFamily:D.style.fontFamily??a$1.fontFamily,fontSizePt:tt(D.style.fontSizePt??a$1.fontSizePt),color:D.style.color??a$1.color};U??(U=W),(O>=d&&O<w||O===d&&w===d)&&(s??(s=W)),w<=O&&w>d&&(k=W),w>d&&O<w&&C>d&&R.push(W),w===d&&O<=d&&C>d&&z.push(W),d=w;}(O===C?O>=S&&O<=d:O<=d&&C>S)&&j.add(o.alignment??"l"),d+=1;}R.push(...z),h&&R.length===0&&R.push(h);let K={...a$1};if(O===C&&e.kind!=="shape")K={...K,...s??k??(h?U??h:a.paragraphs[0]?.runs[0]?.style),...n$1},K.fontSizePt!==null&&K.fontSizePt!==void 0&&(K.fontSizePt=tt(K.fontSizePt));else if(R.length>0){K={...R[0]};let o=new Set(R.flatMap(S=>Object.keys(S)));for(let S of o)R.some(D=>D[S]!==R[0][S])&&(K[S]=null);}let ne=j.size===1?[...j][0]:null,Oe={formatting:K,alignment:ne==="l"||ne==="ctr"||ne==="r"||ne==="just"?ne:null};return t.toolbar={story:a,selection:{...e},marks:{...n$1},result:Oe},Oe}function Fn(){let e=Q(),{formatting:t,alignment:a}=l?Le(l):{formatting:null,alignment:null},n=null;if(l&&l.kind!=="shape"){let C=ye.get(te(l)),d=e$1(C.snapshot,l.anchor,l.focus,v$1);!H$1&&d&&C.echoRanges.some(s=>s.start<=d.start&&s.end>=d.end)&&C.text.paragraphs.some(s=>s.paragraphId===d.paragraphId&&s.editable&&s.fields.length===0)&&(n=d.neighbour);}let h=b?e.snapshot().slides.find(C=>C.id===b.slideId):null,P=h&&h.shapes.find(C=>C.id===b.shapeId),O=C=>C&&/^[#]?[0-9a-f]{6}$/i.test(C)?`#${C.replace(/^#/,"")}`:null;return I={readOnly:H$1,...e.isProposalsAvailable()?{proposals:e.listProposals()}:{},notes:y$1?{slideId:y$1,text:Et.get(y$1)??""}:null,object:P&&h?{formattable:P.kind==="shape",geometry:P.geometry??null,fill:P.fill?.type==="none"?null:O(P.resolvedFillColor),stroke:O(P.resolvedOutlineColor),strokeWidth:P.resolvedOutlineColor?(P.outline?.width??12700)/12700:null,adjustments:P.adjustValues,order:{index:h.shapes.findIndex(C=>C.id===P.id),count:h.shapes.length}}:null,canUndo:e.canUndo(),canRedo:e.canRedo(),toolbar:{target:l?{slideId:l.slideId,shapeId:l.shapeId,storyId:l.storyId}:null,textContext:l?l.kind==="shape"?"shape":l.anchor===l.focus?"caret":"range":null,storedMarks:{...v$1},formatting:t,alignment:a,hyperlink:null,table:null,canEditText:l!==null&&!H$1,echoRun:n}},I}function We(){L=p$1(F),$=F.version(),q.clear();for(let[e,t]of L.slides.entries())q.set(t.id,e);return L}function je(){Q().version()!==$&&We();}function dt(e,t$1=true){let a=Q();je();let n=q.get(e);if(n===void 0)throw new RangeError("Slide is not in the command session");let h=oe.get(e),P=Ie.get(e),O=P?.revision===h&&P.slideIndex===n?P:void 0,C=O?.geometry,d=xn(a,{slideId:e,slideIndex:n,slideRevision:h,coversThroughSeq:T,documentEpoch:V,incarnation:A$1.incarnation,version:M,epoch:++x$1},_e,O?void 0:K=>{C=t(K),Ie.set(e,{slideIndex:n,revision:h,list:K,geometry:C});},O?.list);if(!C||!t$1)return d;let{slideId:s,slideRevision:k,coversThroughSeq:U,documentEpoch:R,incarnation:z}=d.value,j=ze(d.value);for(de.delete(j),de.set(j,{tag:{slideId:s,slideRevision:k,coversThroughSeq:U,documentEpoch:R,incarnation:z},geometry:C,version:M});de.size>257;)de.delete(de.keys().next().value);return d}function Ve(e){let t=[...de.values()].find(a=>a.tag.slideId===e&&a.tag.coversThroughSeq===T&&a.tag.slideRevision===oe.get(e))?.geometry;if(!t){if(je(),q.get(e)===void 0)return;dt(e),t=Ie.get(e)?.geometry;}return t}function Se(e=[],t=[],a=false,n,h,P){if(b){let k=Ee(b.slideId,b.shapeId);b=k?.token===b.token?k:null,l=b?ot(b):null;}let O=Fn();je();let C=y$1===null||!q.has(y$1)?null:dt(y$1);Mn();let d=g.splice(0),s=H({...A$1,epoch:V,throughSeq:T,version:M,...d.length?{updates:d}:{},...ie&&e.some(k=>k.committed)?{change:{...A$1,throughSeq:T,version:M,snapshot:Q().snapshot()}}:{},selection:b??(l?{...l}:null),editState:O,outcomes:e,dirtySlideIds:t,activeSlideId:y$1,historyThroughSeq:X,...n?{creation:n}:{},...h?{editResult:h}:{},...P!==void 0?{fontId:P}:{},...a?{slides:L.slides,size:L.size}:{},frame:C?.value??null},[...C?.transfer??[],...d.map(k=>k.bytes)]);for(let{assetId:k}of s.value.frame?.media??[])_e.add(k);return s}function On(e$1){if(!e$1.basis||e$1.basis.epoch!==V||typeof e$1.basis.version!="string"||e$1.basis.version.length===0)return "stale-basis";let t=e$1.payload;if(!t||typeof t!="object"||Array.isArray(t)||e$1.kind!=="activateSlide"&&(!Number.isFinite(e$1.payload.inputTime)||typeof e$1.payload.undoGroup!="string"||e$1.payload.undoGroup.length===0))return "invalid-payload";let a=l$1[e$1.kind];if(!a||e$1.afterSeq!==void 0&&(!Number.isSafeInteger(e$1.afterSeq)||e$1.afterSeq<1||e$1.afterSeq>=e$1.seq))return "invalid-payload";if(e$1.kind==="selectAtPoint"){let{frame:o,x:S,y:D,extend:w,granularity:W,drag:Z}=e$1.payload;if(!o||typeof o!="object"||Array.isArray(o)||typeof o.slideId!="string"||o.slideId.length===0||typeof o.incarnation!="string"||o.incarnation.length===0||!Number.isSafeInteger(o.slideRevision)||o.slideRevision<0||!Number.isSafeInteger(o.coversThroughSeq)||o.coversThroughSeq<0||!Number.isSafeInteger(o.documentEpoch)||o.documentEpoch<1||!Number.isFinite(S)||!Number.isFinite(D)||typeof w!="boolean"||W!==void 0&&!["character","word","paragraph"].includes(W)||Z!==void 0&&typeof Z!="boolean")return "invalid-payload"}let n="at"in t?t.at:void 0;if("at"in t&&(!n||typeof n!="object"||Array.isArray(n)||n.source!=="confirmed"&&n.source!=="afterSeq"))return "invalid-payload";if(n?.source==="confirmed"){let o=n.selection;if(!o||typeof o!="object"||Array.isArray(o)||typeof o.slideId!="string"||typeof o.shapeId!="string"||typeof o.storyId!="string"||typeof o.anchor!="number"||typeof o.focus!="number"||o.affinity!=="upstream"&&o.affinity!=="downstream")return "invalid-payload";if(!Number.isSafeInteger(o.anchor)||!Number.isSafeInteger(o.focus)||o.anchor<0||o.focus<0)return "invalid-offset"}if(n?.source==="afterSeq"&&(!Number.isSafeInteger(n.seq)||n.seq<1)||(n?.source==="afterSeq"?e$1.afterSeq!==n.seq:e$1.afterSeq!==void 0))return "invalid-payload";if(e$1.afterSeq!==void 0){if(!ae.has(e$1.afterSeq))return "stale-basis";let o=ae.get(e$1.afterSeq);if(o.status==="refused"||o.status==="cancelled")return "dependency-refused"}if(H$1&&a==="local-write")return "read-only";let h=he&&e$1.basis.version===he.version?he.seq:Y.get(e$1.basis.version),P=n?.source==="afterSeq"&&(e$1.kind!=="setSelection"||e$1.payload.selection===null),O=h??(P?T:void 0);if(O===void 0)return "stale-basis";if(e$1.kind==="activateSlide"){We();let{slideId:o}=e$1.payload;return typeof o=="string"&&oe.has(o)&&q.has(o)?{kind:"activation",slideId:o}:"bad-target"}if(e$1.kind==="setChangeObserver")return typeof e$1.payload.enabled=="boolean"?{kind:"observer",enabled:e$1.payload.enabled}:"invalid-payload";if(e$1.kind==="invoke"){if(u$1)return "invalid-composition";if(e$1.basis.version!==M)return "stale-basis";let o=wn(Q(),e$1.payload);return o?{kind:"invoke",run:o,method:e$1.payload.method}:"invalid-payload"}if(e$1.kind==="collabPipe")return p$2&&w(e$1.payload,h$1,{validCursor:e,optionKeys:Dn})?{kind:"remote",pipe:e$1.payload}:"invalid-payload";if(e$1.kind==="applyRemoteUpdate"){let o=Array.isArray(e$1.payload.bytes)?e$1.payload.bytes:[e$1.payload.bytes],S=0;for(let D of o){if(!(D instanceof ArrayBuffer)||D.byteLength===0)return "invalid-payload";S+=D.byteLength;}return o.length>0&&S<=16*1024*1024?{kind:"remote",bytes:o}:"invalid-payload"}if(e$1.kind==="applyEdits"){if(u$1)return "invalid-composition";try{Q().validateEdits(e$1.payload.request);}catch{return "invalid-payload"}return {kind:"batch",request:e$1.payload.request}}if(e$1.kind==="registerFont"){let{font:o,fallback:S}=e$1.payload;return !o||!Be(o.family)||!o.family||!(o.bytes instanceof ArrayBuffer)||o.bytes.byteLength===0||o.bytes.byteLength>32*1024*1024||o.bold!==void 0&&typeof o.bold!="boolean"||o.italic!==void 0&&typeof o.italic!="boolean"||S!==void 0&&typeof S!="boolean"?"invalid-payload":{kind:"font",font:o,fallback:S??false}}if(e$1.kind==="insertTextBox"||e$1.kind==="insertShape"||e$1.kind==="insertPicture"){if(u$1)return "invalid-composition";let{slideId:o}=e$1.payload;if(typeof o!="string"||!q.has(o)||o!==y$1)return "bad-target";if(e$1.basis.version!==M||Q().version()!==M)return "stale-basis";let S=e$1.kind==="insertPicture"?e$1.payload:e$1.payload.draft;if(!S||!Be(S.name)||!S.rect||![S.rect.x,S.rect.y,S.rect.width,S.rect.height].every(Number.isSafeInteger)||S.rect.width<=0||S.rect.height<=0)return "invalid-payload";if(e$1.kind==="insertTextBox"){let N=e$1.payload.draft;return !Be(N.text)||!wt(N.style)?"invalid-payload":{kind:"insertion",slideId:o,draft:N}}if(e$1.kind==="insertShape"){let N=e$1.payload.draft;return !["rect","roundRect","ellipse","triangle","rtTriangle","diamond","parallelogram","trapezoid","pentagon","hexagon","octagon","star5","rightArrow","leftArrow","upArrow","downArrow","chevron"].includes(N.geometry)||N.fill!==void 0&&N.fill!==null&&!/^#[0-9a-f]{6}$/i.test(N.fill)?"invalid-payload":{kind:"insertion",slideId:o,draft:N}}let{bytes:D,contentType:w}=e$1.payload;if(!(D instanceof ArrayBuffer)||D.byteLength===0||D.byteLength>8*1024*1024||!["image/png","image/jpeg","image/gif","image/bmp","image/tiff","image/webp","image/svg+xml"].includes(w))return "invalid-payload";let W="",Z=new Uint8Array(D);for(let N=0;N<Z.length;N+=8192)W+=String.fromCharCode(...Z.subarray(N,N+8192));return {kind:"insertion",slideId:o,draft:{name:S.name,rect:S.rect,contentType:w,mediaBase64:btoa(W)}}}if(n?.source==="confirmed"){let o=n.selection,S=Fe(o);if(!S)return "bad-target";let D=S.text;for(let w of Pe.get(te(o))?.values()??[])if(w.seq>O){D=w.beforeText;break}if(!ge(D,o.anchor)||!ge(D,o.focus))return "invalid-offset"}if(h!==void 0&<(O,e$1.basis.version,e$1.afterSeq),e$1.kind==="undo"||e$1.kind==="redo")return {kind:"history",direction:e$1.kind};if(e$1.kind==="selectObject"){let{frame:o}=e$1.payload;if(!At(o)||e$1.basis.version!==M||Q().version()!==M)return "stale-basis";if(u$1)return "invalid-composition";if("shapeId"in e$1.payload){if(typeof e$1.payload.shapeId!="string")return "invalid-payload";let pe=Ee(o.slideId,e$1.payload.shapeId);return pe?{kind:"object",object:pe}:"bad-target"}let{x:S,y:D,scale:w}=e$1.payload;if(!Number.isFinite(S)||!Number.isFinite(D)||!Number.isFinite(w)||w<=0)return "invalid-payload";let W=de.get(ze(o)).geometry,Z=x(W,{x:S,y:D},void 0,w);if(Z?.kind!=="shape")return "bad-target";let N=Q().snapshot().slides.find(pe=>pe.id===o.slideId),ee=N&&et(N,Z.shapeId),se=ee?Ee(o.slideId,ee.id):null;return se?{kind:"object",object:se}:"bad-target"}if(e$1.kind==="moveShape"||e$1.kind==="setShapeRect"){let o=e$1.kind==="moveShape"&&"delta"in e$1.payload?e$1.payload:null;if(o&&(o.at.source!=="afterSeq"||o.at.seq!==T||!o.delta||!Number.isFinite(o.delta.x)||!Number.isFinite(o.delta.y)))return "invalid-payload";let S=o?b?.shapeId===o.shapeId?Mt(b):null:"target"in e$1.payload?Mt(e$1.payload.target):null;if(!S)return "bad-target";if(!At(e$1.payload.frame)||e$1.payload.frame.slideId!==S.slideId||e$1.basis.version!==M||Q().version()!==M)return "stale-basis";if(u$1)return "invalid-composition";let D=e$1.kind==="moveShape";if(!S.rect||!S.canMove||!D&&!S.canResize)return "unsupported";let w=e$1.kind==="moveShape"?o?{...S.rect,x:S.rect.x+Math.round(o.delta.x*S.units.x),y:S.rect.y+Math.round(o.delta.y*S.units.y)}:"x"in e$1.payload?{...S.rect,x:e$1.payload.x,y:e$1.payload.y}:null:e$1.payload.rect;return !w||![w.x,w.y,w.width,w.height].every(Number.isSafeInteger)||w.width<=0||w.height<=0||!D&&(w.width!==S.rect.width&&w.width<76200||w.height!==S.rect.height&&w.height<76200)?"invalid-payload":{kind:"transform",object:S,rect:{...w},move:D}}let C,d;if(e$1.kind==="selectAtPoint"){if(!n&&e$1.payload.extend)return "invalid-payload";let{frame:o,x:S,y:D}=e$1.payload;if(o.slideId!==y$1||o.incarnation!==A$1.incarnation||o.documentEpoch!==V||!oe.has(o.slideId)||o.slideRevision>oe.get(o.slideId)||o.coversThroughSeq>T||o.coversThroughSeq<X)return "stale-basis";let w=de.get(ze(o)),W=w?.geometry??Ve(o.slideId);if(!W)return "stale-basis";let Z=n?.source==="afterSeq"?me.get(n.seq):void 0,N=e$1.payload.drag?n?.source==="confirmed"?n.selection:Z?Te(Z):null:void 0,ee=x(W,{x:S,y:D},N);if(ee?.kind!=="text")return {kind:"noop"};d={slideId:o.slideId,shapeId:ee.shapeId,storyId:ee.storyId,anchor:ee.position,focus:ee.position,affinity:ee.affinity??"downstream"},C=w?o.coversThroughSeq:T;}if(e$1.kind==="setReadOnly")return typeof e$1.payload.readOnly=="boolean"?{kind:"mode",readOnly:e$1.payload.readOnly}:"invalid-payload";if(e$1.kind==="compositionEnd"){let{compositionId:o,cancelled:S}=e$1.payload;return typeof o!="string"||S!==void 0&&typeof S!="boolean"?"invalid-payload":u$1?.id===o?{kind:"compositionEnd"}:"invalid-composition"}let s;if(e$1.kind==="setSelection"){if(s=e$1.payload.selection,s===null)return {kind:"selection",selection:null}}else if(d&&!n)s=null;else {if(!("at"in t)||!t.at)return "invalid-payload";let o=t.at;if(o.source==="confirmed")s=o.selection;else if(o.source==="afterSeq"){if(o.seq!==e$1.afterSeq)return "invalid-payload";if(!me.has(o.seq))return "stale-basis";let S=me.get(o.seq);s=S?Te(S):null;}else return "invalid-payload"}let k=s;if(d&&(s=d),!s)return "bad-target";let U=Fe(s);if(!U)return "bad-target";if(!Number.isSafeInteger(s.anchor)||!Number.isSafeInteger(s.focus)||s.anchor<0||s.focus<0)return "invalid-offset";if(d||e$1.kind==="setSelection"||n?.source==="confirmed"){let o=C??O,S=Pe.get(te(s)),D=U.text;for(let w of S?.values()??[])if(w.seq>o){D=w.beforeText;break}if(!ge(D,s.anchor)||!ge(D,s.focus))return "invalid-offset";s={...s};for(let w of S?.values()??[]){if(w.seq<=o)continue;delete s.goalX;let W=Math.min(s.anchor,s.focus),Z=Math.max(s.anchor,s.focus);if(W!==Z&&w.deleted>0&&W<w.start+w.deleted&&Z>w.start)return "stale-basis";let N=ee=>ee<w.start?ee:w.deleted===0&&ee===w.start?ee+(W===Z||ee===W?w.inserted:0):ee>=w.start+w.deleted?ee-w.deleted+w.inserted:w.start+(W===Z?w.inserted:0);s.anchor=N(s.anchor),s.focus=N(s.focus);}}if(!ge(U.text,s.anchor)||!ge(U.text,s.focus))return "invalid-offset";if(s.kind!==void 0&&s.kind!=="shape"||(s.kind==="shape"&&(s={...s,anchor:0,focus:U.text.length}),s.affinity!=="upstream"&&s.affinity!=="downstream")||s.goalX!==void 0&&!Number.isFinite(s.goalX))return "invalid-payload";if(e$1.kind==="setSelection")return {kind:"selection",selection:{...s}};if(e$1.kind==="selectAtPoint"){let o$1=[...q$1(U.text)],S=s.focus;s.focus=o$1.reduce((w,W)=>Math.abs(W-S)<Math.abs(w-S)?W:w,0),s.anchor=s.focus;let D=e$1.payload.granularity??"character";if(D!=="character"){let w=o(U.text,s.focus,D);if(e$1.payload.drag){let N=G?.group===e$1.payload.undoGroup?Te(G.selection):null;if(!N||te(N)!==te(s))return "bad-target";s={...s,...p({start:Math.min(N.anchor,N.focus),end:Math.max(N.anchor,N.focus)},w)};}else s={...s,anchor:w.start,focus:w.end};let W=Ve(s.slideId),Z=W&&u(W,{...s,affinity:s.focus>s.anchor?"upstream":"downstream"});Z&&(s.affinity=s.focus===Z.line.end?"upstream":"downstream");}else if(e$1.payload.extend&&k&&k.kind!=="shape"&&te(k)===te(s)){let w=U.text;if(n?.source==="confirmed"){for(let Z of Pe.get(te(k))?.values()??[])if(Z.seq>O){w=Z.beforeText;break}}if(!Number.isSafeInteger(k.anchor)||!ge(w,k.anchor))return "invalid-offset";let W=n?.source==="confirmed"?qn(k,O):k;s.anchor=W.anchor;}return {kind:"selection",selection:s}}if(e$1.kind==="moveSelection"){if(!["left","right","wordLeft","wordRight","lineStart","lineEnd","storyStart","storyEnd","up","down","nextCell","previousCell"].includes(e$1.payload.motion)||typeof e$1.payload.extend!="boolean")return "invalid-payload";let o=Ve(s.slideId);if(!o)return "bad-target";let S=y(o,s,e$1.payload.motion,e$1.payload.extend,U.text);return S?{kind:"selection",selection:S}:"bad-target"}if(e$1.kind==="formatText"||e$1.kind==="setParagraphAlignment"){let o=Math.min(s.anchor,s.focus),S=Math.max(s.anchor,s.focus);if(U.paragraphs.some(N=>o<=N.end&&S>=N.start&&(!N.editable||N.fields.some(ee=>o>ee.start&&o<ee.end||S>ee.start&&S<ee.end))))return "unsupported";if(u$1)return "invalid-composition";if(e$1.kind==="setParagraphAlignment"){let N=e$1.payload.alignment;return N===null||["l","ctr","r","just"].includes(N)?{kind:"alignment",selection:{...s},alignment:N}:"invalid-payload"}let{patch:D,toggle:w,fontSizeStep:W}=e$1.payload;if(D===void 0||!wt(D)||w!==void 0&&!["bold","italic","underline"].includes(w))return "invalid-payload";let Z=Object.fromEntries(Object.entries(D).filter(([,N])=>N!==void 0));if(W!==void 0){if(!W||typeof W!="object"||Array.isArray(W)||w!==void 0||!["increase","decrease"].includes(W.direction)||!Array.isArray(W.sizes)||W.sizes.length>256||W.sizes.some((se,pe,ke)=>typeof se!="number"||!Number.isFinite(se)||se<It||se>Tt||pe>0&&se<=ke[pe-1]))return "invalid-payload";let N=Le(s).formatting.fontSizePt??a$1.fontSizePt,ee=W.sizes.map(tt);Z.fontSizePt=W.direction==="increase"?ee.find(se=>se>N)??Math.max(N,Math.min(Tt,N+1)):ee.reverse().find(se=>se<N)??Math.min(N,Math.max(It,N-1));}if(w){let N=Le(s).formatting;w==="underline"?Z.underline=N.underline!==null&&N.underline!=="none"?"none":"sng":Z[w]=N[w]!==true;}return {kind:"format",selection:{...s},patch:Z}}if(s.kind==="shape")return "unsupported";if(e$1.kind==="compositionStart"||e$1.kind==="compositionCommit"){if(typeof e$1.payload.compositionId!="string"||e$1.payload.compositionId.length===0)return "invalid-payload";if(e$1.kind==="compositionStart")return u$1?"invalid-composition":{kind:"compositionStart",id:e$1.payload.compositionId,selection:{...s}};if(u$1?.id!==e$1.payload.compositionId||u$1.committed)return "invalid-composition";let o=u$1.selection;if(s.storyId!==o.storyId||s.slideId!==o.slideId||s.shapeId!==o.shapeId)return "bad-target"}let R=Math.min(s.anchor,s.focus),z=Math.max(s.anchor,s.focus),j="",K;switch(e$1.kind){case "insertText":case "replaceText":case "compositionCommit":if(j=e$1.payload.text,K=e$1.payload.style,!wt(K))return "invalid-payload";break;case "paragraphBreak":j=`
|
|
5
|
-
`;break;case "deleteBackward":case "deleteForward":{let o=e$1.payload.count??1;if(e$1.payload.unit!=="codePoint"||!Number.isSafeInteger(o)||o<1)return "invalid-payload";if(R===z)for(let S=0;S<o;S+=1)if(e$1.kind==="deleteBackward"){if(R===0)break;R-=1,ge(U.text,R)||(R-=1);}else {if(z===U.text.length)break;z+=1,ge(U.text,z)||(z+=1);}break}default:return "invalid-payload"}if(!Be(j)||U.text.length-(z-R)+j.length>4294967294)return "invalid-payload";if(e$1.kind==="compositionCommit"&&j==="")return {kind:"text",selection:{...s},start:R,end:z,text:j};let ne=ye.get(te(s)),Oe=U.paragraphs.some(o=>R<=o.end&&o.end<z);for(let o of U.paragraphs){if(R<=o.end&&z>=o.start&&(!o.editable||Oe&&o.fields.length>0)||o.fields.some(se=>R>se.start&&R<se.end||z>se.start&&z<se.end)||j.includes(`
|
|
6
|
-
`)&&
|
|
7
|
-
`),
|
|
8
|
-
`))return "unsupported"}}return K===void 0&&(e$1.kind==="insertText"||e$1.kind==="replaceText"||e$1.kind==="compositionCommit")&&(K={...a$1,...Object.fromEntries(Object.entries(Le(s).formatting).filter(([o,S])=>o!=="caps"&&S!==null&&S!==void 0)),...Ae(s)}),{kind:"text",selection:{...s},start:R,end:z,text:j,style:K}}function qn(e,t){let a=e.anchor;for(let n of Pe.get(te(e))?.values()??[])n.seq<=t||a<n.start||(a=a>=n.start+n.deleted?a-n.deleted+n.inserted:n.start+n.inserted);return {...e,anchor:a,focus:a}}function lt(e,t,a){he={seq:e,version:t};for(let[h,P]of Y){if(P>e)break;Y.delete(h);}for(let h of ae.keys()){if(h>e)break;h!==a&&ae.delete(h);}for(let h of me.keys()){if(h>e)break;h!==a&&me.delete(h);}let n=Math.min(e,...[...de.values()].map(h=>h.tag.coversThroughSeq));for(let[h,P]of fe){if(h>n)break;fe.delete(h);let O=Pe.get(P.story);O.delete(h),O.size===0&&Pe.delete(P.story);}}function Rt(){for(;Y.size>256;){let[e,t]=Y.entries().next().value;lt(t,e);}for(;fe.size>512;){let e=fe.values().next().value;for(let[t,a]of de)a.tag.coversThroughSeq<e.seq&&de.delete(t);lt(e.seq,e.version);}for(;ae.size>256;)ae.delete(ae.keys().next().value);for(;me.size>256;)me.delete(me.keys().next().value);}function Un(e,t){let a=Q();if(t.kind==="noop")return false;if(t.kind==="remote"){let d=l?Re(l):null,s=u$1?Re(u$1.selection):null,k=new Map(me);t.pipe||(G=void 0,rt());let U=a.version();if(t.pipe)p$2.run(t.pipe);else for(let R of t.bytes)a.applyUpdate(new Uint8Array(R));if(U===a.version())return false;t.pipe&&(G=void 0,rt()),t.receipt={applied:true,changedSlideIds:[...oe.keys()],deckSizeChanged:true,slideOrderChanged:true},De(e.seq,t.receipt);for(let[R,z]of k)me.set(R,z);if(l=d?Te(d):null,l&&(!Fe(l)||l.slideId!==y$1)&&(l=null),u$1&&s){let R=Te(s);R&&Fe(R)?u$1={...u$1,selection:R}:u$1=void 0;}return b=null,be(),true}if(e.kind!=="selectAtPoint"&&(G=void 0),t.kind==="history"){if(!(t.direction==="undo"?a.canUndo():a.canRedo()))return false;a.addUndoBoundary();let d=a.historyStep(t.direction);return d.applied?(t.receipt=d,m$1=void 0,u$1=void 0,l=null,b=null,be(),true):false}if(t.kind!=="text"&&rt(),t.kind==="activation")return be(),y$1=t.slideId,l=null,b=null,u$1=void 0,false;if(t.kind==="mode")return H$1=t.readOnly,false;if(t.kind==="observer")return ie=t.enabled,false;if(t.kind==="invoke"){let d=l?Re(l):null,s=b,k=a.version();return a.addUndoBoundary(),t.result=t.run(),a.addUndoBoundary(),k===a.version()?false:(t.receipt={applied:true,changedSlideIds:[...oe.keys()],deckSizeChanged:false,slideOrderChanged:["insertSlide","deleteSlide","moveSlide"].includes(t.method)},De(e.seq,t.receipt),t.method==="insertSlide"&&(y$1=t.result.slideId),l=d?Te(d):null,l&&(!Fe(l)||l.slideId!==y$1)&&(l=null),b=s&&s.slideId===y$1?Ee(s.slideId,s.shapeId):null,be(),true)}if(t.kind==="batch"){let d=l?Re(l):null;return t.result=a.applyEdits(t.request),!t.result.ok||!t.result.applied?false:(t.receipt={applied:true,changedSlideIds:t.result.changedSlides,deckSizeChanged:false,slideOrderChanged:false},De(e.seq,t.receipt),l=d?Te(d):null,b=null,be(),true)}if(t.kind==="font"){let d={...t.font,bytes:new Uint8Array(t.font.bytes)};t.fontId=t.fallback?a.registerFallbackFont(d):a.registerFont(d),Ie.clear();for(let s of ye.values())s.formatting=void 0,s.toolbar=void 0;return false}if(t.kind==="insertion"){a.addUndoBoundary(),t.receipt=e.kind==="insertTextBox"?a.addTextBox(t.slideId,t.draft):e.kind==="insertShape"?a.addShape(t.slideId,t.draft):a.addPicture(t.slideId,t.draft),a.addUndoBoundary(),We();let d=a.readCommandContent();if(!d.ok)throw new Error(d.failure.message);it(d),Ie.delete(t.slideId),y$1=t.slideId;let s=Ee(t.slideId,t.receipt.shapeId);if(b=e.kind==="insertTextBox"?null:s,l=e.kind==="insertTextBox"&&s?.storyId?{slideId:s.slideId,shapeId:s.shapeId,storyId:s.storyId,anchor:0,focus:0,affinity:"downstream"}:s?ot(s):null,e.kind==="insertTextBox"&&l){let k=t.draft.style;r.set(te(l),{...a$1,...Object.fromEntries(Object.entries(k).filter(([,U])=>U!=null)),fontSizePt:tt(k.fontSizePt??a$1.fontSizePt)});}return be(),true}if(t.kind==="compositionEnd")return u$1=void 0,false;if(t.kind==="selection")return b=null,(!t.selection||Ae(t.selection)!==v$1)&&be(),l=t.selection,e.kind==="selectAtPoint"&&!e.payload.drag&&l&&(G={group:e.payload.undoGroup,selection:Re(l)}),l&&(y$1=l.slideId),false;if(t.kind==="object"||t.kind==="transform"){let d=t.object;return be(),l=ot(d),b=d,y$1=d.slideId,t.kind==="object"||d.rect&&Object.keys(t.rect).every(s=>t.rect[s]===d.rect[s])?false:(a.addUndoBoundary(),t.move?a.moveShape(d.slideId,d.shapeId,t.rect.x,t.rect.y):a.setShapeRect(d.slideId,d.shapeId,t.rect),a.addUndoBoundary(),true)}if(t.kind==="compositionStart")return b=null,Ae(t.selection)!==v$1&&be(),l=t.selection,y$1=l.slideId,u$1={id:t.id,selection:{...l},committed:false},false;if(t.kind==="format"||t.kind==="alignment"){let d=t.selection;(d.kind!=="shape"||!b||te(d)!==te(b))&&(b=null),Ae(d)!==v$1&&be(),l=d,y$1=d.slideId;let s=Math.min(d.anchor,d.focus),k=d.kind==="shape"?ye.get(te(d)).snapshot.length:Math.max(d.anchor,d.focus);return t.kind==="format"&&s===k&&d.kind!=="shape"?(Object.assign(v$1,t.patch),false):(a.addUndoBoundary(),t.kind==="format"?a.formatText(d.storyId,s,k,t.patch):a.setParagraphAlignment(d.storyId,s,k,t.alignment),a.addUndoBoundary(),true)}let{start:n,end:h,text:P,style:O}=t,C=t.selection;if(b=null,Ae(C)!==v$1&&be(),e.kind==="compositionCommit"&&P==="")return u$1.committed=true,false;if(n!==h||P.length>0){let d=ye.get(te(C)).text.paragraphs.some(j=>n<=j.end&&j.end<h),s=!d&&(e.kind==="insertText"||e.kind==="deleteBackward"||e.kind==="deleteForward"),k=e.payload.inputTime,U=e.payload.undoGroup;(!s||!m$1||m$1.target!==te(C)||m$1.group!==U||m$1.kind!==e.kind||k<m$1.time||k-m$1.time>=500||C.anchor!==m$1.position||C.focus!==m$1.position)&&a.addUndoBoundary(),h>n&&(d?o$1(a,C.storyId,n,h):a.deleteText(C.storyId,n,h));let R=n,z=P.split(`
|
|
9
|
-
`);for(let[j,K]of z.entries())j>0&&(a.insertParagraphBreak(C.storyId,R),R+=1),K.length>0&&(a.insertText(C.storyId,R,K,O),R+=K.length);s?m$1={target:te(C),group:U,time:k,kind:e.kind,position:n+P.length}:(a.addUndoBoundary(),m$1=void 0);}return l={...C,anchor:n+P.length,focus:n+P.length,affinity:"downstream"},delete l.goalX,y$1=C.slideId,e.kind==="compositionCommit"&&(u$1.committed=true),n!==h||P.length>0}let Ft={async openCommandEditor(e,t,a){if(_)throw new Error("Presentation command session is disposed");if(F||c)throw new Error("Presentation command session is already open");if(!a||typeof a.session!="string"||!a.session||typeof a.incarnation!="string"||!a.incarnation||a.readOnly!==void 0&&typeof a.readOnly!="boolean")throw new TypeError("Invalid presentation command open options");c=true;try{if(await(i$1.initWasm??s)(a.wasm),_)throw new Error("Presentation command session is disposed");F=A(new Uint8Array(t),{clientId:a.clientId,fonts:a.fonts?.map(d=>({...d,bytes:new Uint8Array(d.bytes)})),fallbackFonts:a.fallbackFonts?.map(d=>({...d,bytes:new Uint8Array(d.bytes)})),initialUpdate:a.initialUpdate}),f$1=F.onUpdate((d,s)=>{g.push({bytes:d.slice().buffer,origin:s});}),a.collaboration&&(p$2=Pn(F,i$1.onPipeOutput));let n=We(),h=a.activeSlideIndex??0;if(!Number.isSafeInteger(h))throw new RangeError("Active slide index is out of range");A$1={session:a.session,incarnation:a.incarnation},H$1=a.readOnly??!1,ie=a.observeChanges??!1,B=a.initialUpdate!==void 0,y$1=n.slides[Math.max(0,Math.min(h,n.slides.length-1))]?.id??null,F.setUndoCaptureMode("manual"),M=F.version(),ue.initialize(M),Y.set(M,0);let P=F.readCommandContent();if(!P.ok)throw new N("message",`Presentation command open refused: ${P.failure.message}`,P.failure.code);it(P);for(let d of n.slides)oe.set(d.id,0);let O=Se(),C=F.encodeStateAsUpdate().slice().buffer;return H({...O.value,shared:ue.ack(O.value),slides:n.slides,size:n.size,activeSlideId:y$1,frame:O.value.frame??null,recoveryUpdate:C},[...O.transfer,C])}catch(n){throw Ot(),n}finally{c=false;}},command(e,t){if(Q(),t.kind!=="activateSlide"&&je(),!at(t)||!Number.isSafeInteger(t.seq)||t.seq<1)return Se();let a=ae.get(t.seq);if(a)return Se([{...a}]);if(t.seq<=T)return Se([{seq:t.seq,status:"refused",reason:"stale-basis",committed:false}]);if(t.seq!==T+1)return Se();let n=On(t);if(typeof n=="string"){t.kind==="compositionCommit"&&u$1&&u$1.id===t.payload?.compositionId&&(u$1=void 0);let C={seq:t.seq,status:n==="dependency-refused"?"cancelled":"refused",reason:n,committed:false};return T=t.seq,ae.set(t.seq,C),Rt(),Se([C])}let h={version:M,selection:l,objectSelection:b,activeSlideId:y$1,editState:I},P="selection"in n?n.selection?.slideId:"object"in n?n.object.slideId:void 0,O=P===void 0?void 0:oe.get(P);try{let C=n.kind==="text"?Fe(n.selection).text:"",d=Un(t,n),s=d&&n.kind==="history"?De(t.seq,n.receipt,!0):n.kind==="remote"||n.kind==="invoke"?n.receipt?.changedSlideIds:void 0;if(d&&n.kind==="text"&&Rn(n.selection,n.start,n.end),d&&(n.kind==="format"||n.kind==="alignment")){let z=ye.get(te(n.selection));z.snapshot=Q().story(n.selection.storyId),z.formatting=void 0,z.echoRanges=[];}T=t.seq,M=Q().version(),$=M,d&&ue.commit(M),!Y.has(M)&&M!==he?.version&&Y.set(M,T);let k={seq:t.seq,status:t.kind==="compositionCommit"&&t.payload.text===""?"cancelled":d||n.kind==="invoke"&&n.method==="propose"||n.kind==="format"||n.kind==="alignment"||n.kind==="font"||n.kind==="activation"||n.kind==="selection"||n.kind==="object"||t.kind==="setReadOnly"||t.kind==="compositionStart"||t.kind==="compositionEnd"?"applied":"noop",committed:d};if(ae.set(t.seq,k),d&&n.kind==="text"){let z=te(n.selection),j={seq:t.seq,story:z,start:n.start,deleted:n.end-n.start,inserted:n.text.length,version:M,beforeText:C};fe.set(t.seq,j);let K=Pe.get(z)??new Map;K.set(t.seq,j),Pe.set(z,K);}me.set(t.seq,l?Re(l):null),Rt();let U=n.kind==="font"?[...oe.keys()]:n.kind==="batch"&&n.result?.ok?n.result.changedSlides:s??(d&&y$1!==null?[y$1]:[]);for(let z of U){let j=oe.get(z);j!==void 0&&oe.set(z,j+1);}let R=Se([k],U,n.kind==="history"||n.kind==="remote"||n.kind==="invoke",n.kind==="insertion"?n.receipt:void 0,n.kind==="batch"?n.result:void 0,n.kind==="font"?n.fontId:void 0);return n.kind==="invoke"&&(R.value.mutationResult=n.result),R}catch(C){throw M!==h.version&&Y.delete(M),M=h.version,l=h.selection,b=h.objectSelection,y$1=h.activeSlideId,I=h.editState,P!==void 0&&O!==void 0&&oe.set(P,O),E=t.seq,T=t.seq,H$1=true,ae.set(t.seq,{seq:t.seq,status:"refused",reason:"unknown-outcome",committed:false}),new m(t.seq,`Command ${t.seq} has an unknown outcome: ${C instanceof Error?C.message:String(C)}`)}},edit(e,t){if(Q(),!f(t)){if(!Number.isSafeInteger(t?.seq)||t.seq<1)throw new TypeError("Invalid presentation edit envelope");return st(Se([{seq:t.seq,status:"refused",reason:"invalid-payload",committed:false}]))}if(t.session!==A$1.session||t.incarnation!==0){let n=st(Se());return n.value.outcomes=[{seq:t.seq,status:"refused",committed:false,reason:t.session!==A$1.session?"wrong-session":"stale-incarnation"}],n}let a=ue.envelope(t,A$1);return t.seq===T+1&&(t.basis.epoch!==V?ce.set(t.seq,"stale-epoch"):t.expectVersion===true&&t.basis.version!==ue.version&&(ce.set(t.seq,"stale-version"),a.basis.version="")),st(Ft.command(null,a))},checkpoint(){throw new Error("Presentation command checkpoints are unavailable")},thumbnailFrame(e,t){if(Q(),!at(t))throw new Error("Presentation command thumbnail identity differs");je();let a=oe.get(t.slideId),n={...A$1,epoch:V,slideId:t.slideId,slideRevision:a??0};if(a===void 0||!q.has(t.slideId))return {...n,status:"refused",reason:"bad-target"};if(t.knownRevision===a)return {...n,status:"unchanged"};let h=dt(t.slideId,false);for(let{assetId:P}of h.value.media)_e.add(P);return H({...n,status:"frame",frame:h.value},h.transfer)},flushCommandEditor(e,t){return Me(t),Se()},saveCommandEditor(e,t){Me(t);let a=new Uint8Array(Q().save()).buffer,n=g.splice(0);return H({...A$1,epoch:V,throughSeq:T,version:M,...n.length?{updates:n}:{},bytes:a},[a])},accessCommandEditor(e,t,a,n){if(Me(t),!Array.isArray(n))throw new TypeError("Invalid access arguments");let h=Q();switch(a){case "encodeStateVector":return h.encodeStateVector();case "encodeStateAsUpdate":return h.encodeStateAsUpdate(n[0]);case "snapshot":return h.snapshot();case "comments":return h.comments();case "story":return h.story(n[0]);case "findText":return h.findText(n[0]);case "validateEdits":return H$1?{ok:false,version:M,failure:{code:"read-only",message:"The editor is read-only"}}:h.validateEdits(n[0]);case "exportStructured":return h.exportStructured(n[0]);case "exportMarkdown":return h.exportMarkdown(n[0]);case "searchText":return h.searchText(n[0],n[1]);case "listProposals":return h.listProposals();case "previewProposal":return h.previewProposal(n[0]);case "layoutSlide":return h.layoutSlide(n[0]);case "layoutProposalSlide":return h.layoutProposalSlide(n[0],n[1]);case "layoutProposalDiffSlide":return h.layoutProposalDiffSlide(n[0],n[1]);default:throw new TypeError("Unsupported access method")}},checkpointCommandEditor(e,t){Me(t);let a=Q().save().slice().buffer,n=Q().encodeStateAsUpdate().slice().buffer;return H({...A$1,epoch:V,throughSeq:T,version:M,bytes:a,recoveryUpdate:n},[a,n])},prepareCommandPicture(e,t,a){if(Me(t),!(a instanceof ArrayBuffer)||a.byteLength===0||a.byteLength>8*1024*1024)throw new Error("Invalid picture bytes");let n=z(new Uint8Array(a)).slice().buffer;return H(n,[n])},readEditor(e,t,a){Me(t);let n=Q().readContent(a),h=Se();return H({...h.value,result:n},h.transfer)}};function Ot(){if(_)return;_=true;let e=F;p$2?.dispose(),p$2=void 0,f$1?.(),f$1=void 0,g.length=0,F=void 0,L=void 0,q.clear(),u$1=void 0,m$1=void 0,I=void 0,Y.clear(),ue.dispose(),ae.clear(),ce.clear(),he=void 0,fe.clear(),Pe.clear(),ye.clear(),r.clear(),Ue.clear(),re.clear(),me.clear(),oe.clear(),_e.clear(),de.clear(),Ie.clear(),e?.dispose();}return {handlers:Ft,policies:{openCommandEditor:{lane:"interactive"},command:e=>({lane:e.kind==="collabPipe"?"collab":"input",mutates:true,userInput:e.kind!=="collabPipe"}),edit:e=>({lane:e.kind==="collabPipe"?"collab":"input",mutates:true,userInput:e.kind!=="collabPipe"}),checkpoint:{lane:"interactive"},thumbnailFrame:{lane:"interactive"},flushCommandEditor:{lane:"interactive"},saveCommandEditor:{lane:"interactive"},readEditor:{lane:"interactive"},prepareCommandPicture:{lane:"interactive"},accessCommandEditor:{lane:"interactive"},checkpointCommandEditor:{lane:"interactive"}},drainPipe:()=>p$2?.drain(),dispose:Ot}}function te(i){return JSON.stringify([i.slideId,i.shapeId,i.storyId])}function xt(i,p){let f=0,g=Math.min(i.length,p.length);for(;f<g&&i[f]===p[f];)f+=1;(!ge(i,f)||!ge(p,f))&&(f-=1);let F=0;for(;F<g-f&&i[i.length-F-1]===p[p.length-F-1];)F+=1;return (!ge(i,i.length-F)||!ge(p,p.length-F))&&(F-=1),[f,F]}function ge(i,p){return Number.isSafeInteger(p)&&p>=0&&p<=i.length&&!(p>0&&p<i.length&&i.charCodeAt(p-1)>=55296&&i.charCodeAt(p-1)<=56319&&i.charCodeAt(p)>=56320&&i.charCodeAt(p)<=57343)}function Be(i){if(typeof i!="string")return false;for(let p of i){let f=p.codePointAt(0);if(!(f===9||f===10||f===13||f>=32&&f<=55295||f>=57344&&f<=65533||f>=65536))return false}return true}function wt(i){if(i===void 0)return true;if(!i||typeof i!="object"||Array.isArray(i))return false;let p=["none","words","sng","dbl","heavy","dotted","dottedHeavy","dash","dashHeavy","dashLong","dashLongHeavy","dotDash","dotDashHeavy","dotDotDash","dotDotDashHeavy","wavy","wavyHeavy","wavyDbl"];return Object.entries(i).every(([f,g])=>{if(!["bold","italic","fontFamily","underline","color","fontSizePt","spacingPt","baselinePct"].includes(f))return false;if(g===void 0)return true;switch(f){case "bold":case "italic":return typeof g=="boolean";case "fontFamily":return Be(g);case "underline":return typeof g=="string"&&p.includes(g);case "color":return typeof g=="string"&&/^#?[0-9a-f]{6}$/i.test(g);case "fontSizePt":return typeof g=="number"&&Number.isFinite(g)&&g>=It&&g<=Tt;case "spacingPt":return typeof g=="number"&&Number.isFinite(g)&&Math.abs(g)<=4e3;case "baselinePct":return typeof g=="number"&&Number.isFinite(g)&&g*1e3>=-2147483648&&g*1e3<=2147483647;default:return false}})}function nt(i){return i?.map(p=>({...p,bytes:new Uint8Array(p.bytes)}))}async function Ct(i){let p=i instanceof WebAssembly.Module?i:i===void 0?await gt(b()):await WebAssembly.compile(i);return await s(p),p}function Cn(i,p={}){let f,g=false,F=false,A$1=false,L$1=false,$=0,q$1=false,_=0,c=false,T$1=0,M,V=new TextEncoder,x=new Set;function y(){if(q$1)throw new Error("Presentation session is disposed");if(!f)throw new Error("Presentation session is not open");return f}function l$1(u=y(),m=u.version()){return M?.version!==m&&(M={version:m,value:g?k(u):p$1(u)}),M.value}function b(u=true){let m=y();if(!g||L$1||u&&!F)throw new B("stage","Presentation editor is not attached");return m}function J(u,m){let B$1=b();if($!==u||B$1.version()!==m)throw L$1=true,new B("position-mismatch","Presentation editor fence differs");return {sequence:$,version:B$1.version()}}function re(){let u=l$1();return {format:"pptx",stage:"ready",version:_,dirty:c,slides:u.slides,size:u.size}}function G(){q$1=true;let u=f;f=void 0,x.clear(),M=void 0,u?.dispose();}let H$1={async open(u,m,B={}){if(q$1)throw new Error("Presentation session is disposed");if(f||g)throw new Error("Presentation session is already open");if(await(p.initWasm??s)(B.wasm),q$1)throw new Error("Presentation session is disposed");let X=A(new Uint8Array(m),{clientId:B.clientId,fonts:nt(B.fonts),fallbackFonts:nt(B.fallbackFonts),initialUpdate:B.initialUpdate});try{let Y=l$1(X);return f=X,{format:"pptx",stage:"ready",version:_,dirty:c,slides:Y.slides,size:Y.size}}catch(Y){throw X.dispose(),Y}},version:()=>y().version(),readContent:(u,m)=>y().readContent(m),findText:(u,m)=>y().findText(m),validateEdits:(u,m)=>y().validateEdits(m),applyEdits(u,m){if(g)throw new B("stage","Editor mutations require ordered replay");let B$1=y().applyEdits(m);return B$1.ok&&B$1.applied&&(_+=1,c=true,I.emit("changed",{version:_,dirty:c})),B$1},frame(u,m){let B=y(),X=B.version(),Y=l$1(B,X).slides.length;if(!Number.isInteger(m)||m<0||m>=Y)throw new RangeError("Slide index is out of range");let ue=g?l(B,m):q(B,m),he=V.encode(ue).buffer,ae=[];for(let ce of Q(JSON.parse(ue))){if(x.has(ce))continue;let fe;try{fe=B.mediaBytes(ce);}catch{continue}if(a(fe)&&fe.byteLength<=33554432)try{fe=z(fe);}catch{}ae.push({assetId:ce,bytes:new Uint8Array(fe).buffer});}T$1+=1;for(let{assetId:ce}of ae)x.add(ce);return H({displayList:he,version:X,epoch:T$1,slideIndex:m,media:ae},[he,...ae.map(({bytes:ce})=>ce)])},slides:()=>l$1().slides,slideSize:()=>l$1().size,save(){if(g)throw new B("stage","Editor saves require a fence");let u=y().save(),m=u.buffer instanceof ArrayBuffer&&u.byteOffset===0&&u.byteLength===u.buffer.byteLength?u.buffer:new Uint8Array(u).buffer;return H(m,[m])},dispose(){y(),G();}},ie={async beginEditor(u,m,B){if(q$1)throw new Error("Presentation session is disposed");if(f||g)throw new Error("Presentation session is already open");g=true;let X=await(p.initEditorWasm??Ct)(B.wasm);if(q$1)throw new Error("Presentation session is disposed");let Y$1;try{if(Y$1=f$1(new Uint8Array(m),{clientId:B.clientId,fonts:nt(B.fonts),fallbackFonts:nt(B.fallbackFonts),initialUpdate:B.initialUpdate}),await h(Y$1),q$1)throw new Error("Presentation session is disposed");let ue=j(Y$1);return f=Y$1,{state:re(),hydration:ue,module:X,sequence:$,version:Y$1.version()}}catch(ue){throw f===Y$1&&(f=void 0),Y$1?.dispose(),L$1=true,Y(ue)}},attachPeer(u,m,B$1){let X=A$1;A$1=true,F=false;let Y=b(false);if(X||m!==Y.version()||B$1!==$)throw L$1=true,new B(X?"attachment":"position-mismatch","Presentation peer attachment differs or was already attempted");return F=true,{version:Y.version(),sequence:$}},replay(u,m){let B$1=b();try{if(m.expectedOutcome==null)throw new B("outcome","Editor replay requires an expected outcome");let X=m$1(B$1,m);if(!X.consumed)throw new B("refusal","Worker refused accepted input");return $=X.sequence,_=X.revision,c||(c=X.outcome.applied),{...X,projection:re()}}catch(X){throw L$1=true,Y(X)}},flush:(u,m,B)=>J(m,B),editorFrame(u,m){b(false);let B=l$1().slides.findIndex(Y=>Y.id===m),X=H$1.frame(null,B);return H({...X.value,slideId:m,sequence:$},X.transfer)},editorSave(u,m,B){J(m,B);let X=new Uint8Array(b().save()).buffer;return H(X,[X])}},E,v=Tn({initWasm:p.initWasm,onPipeOutput(){q$1||E!==void 0||(E=setTimeout(()=>{E=void 0;let u=v.drainPipe();u&&I.emit("collaborationPipe",u.batches,u.transfer);},0));}}),r={...i,post(u,m){let B=L(u)&&(u.kind==="reply"||u.kind==="event"&&u.name==="ack")?v.drainPipe():void 0;i.post(B?{...u,collabPipe:B.batches}:u,B?[...m??[],...B.transfer]:m);}},I=Sn(r,{handlers:{...H$1,...ie,...v.handlers},policies:{...X,...T,...v.policies},context:null,onDispose(){E!==void 0&&clearTimeout(E);try{G();}finally{v.dispose();}}});return I}var En=P(self),zn=Cn(En,{initWasm:yn(En,b(),s),initEditorWasm:Ct});Object.assign(globalThis,{__betterofficeEngineProgress:()=>zn.progress()});
|
|
1
|
+
var op=Object.defineProperty;var X=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var St=(t,e)=>{for(var n in e)op(t,n,{get:e[n],enumerable:!0})};var Ua,We,On=X(()=>{"use strict";Ua="SessionSuperseded",We=class extends Error{constructor(n,r,o){super(r);this.code=n;this.diagnostics=o;this.name="SessionFailure"}code;diagnostics}});function hi(t){Ba=t}function mi(t){try{return typeof t=="string"&&new URL(t).href===t}catch{return!1}}function Oa(t,e){let n=sp(o=>t.postMessage(o)),r=o=>{n.receive(o.data)&&o.stopImmediatePropagation()};return t.addEventListener("message",r),e(n.source),()=>{t.removeEventListener("message",r),n.dispose()}}function sp(t,e=15e3){let n=++ip,r=0,o=!1,i,s,d=new Map,a=new Map;function c(){if(s!==void 0)return;let m=setTimeout(()=>{if(s===m){i=new Set(a.keys()),d.clear();for(let b of a.values())b.finish()}},e);s=m}return{source:(m,{fresh:b=!1}={})=>{if(o)return Promise.reject(new We("disposed","Font pack channel is closed"));if(i)return Promise.resolve(void 0);let R=b?void 0:d.get(m);if(!R){let v=`font-pack:${n}:${++r}`;if(R=new Promise((P,C)=>{let T=(j,q)=>{a.delete(v),a.size===0&&(clearTimeout(s),s=void 0),q?C(q):P(j)};a.set(v,{finish:T}),c();try{t({protocol:1,kind:"font-pack-request",id:v,pack:m})}catch(j){T(void 0,new We("message",String(j)))}}),!b){d.set(m,R);let P=()=>{d.get(m)===R&&d.delete(m)};R.then(P,P)}}return R},receive(m){let b=m;if(b?.protocol!==1||b.kind!=="font-pack-reply")return!1;if(typeof b.id!="string")return!0;i?.has(b.id)&&(i=void 0);let R=a.get(b.id);if(R)if(!(b.urls===void 0||b.urls!==null&&typeof b.urls=="object"&&!Array.isArray(b.urls)&&Object.values(b.urls).every(mi))||b.error!==void 0)R.finish(void 0,new We("message",b.error??"Invalid font asset URLs"));else{let P=b.cdn,C=P&&Number.isInteger(P.timeoutMs)&&P.timeoutMs>0&&P.timeoutMs<=4294967295&&(P.baseUrl===!1||mi(P.baseUrl)&&/^https?:\/\//.test(P.baseUrl)),T=mi(b.pageUrl)?b.pageUrl:void 0;R.finish({urls:b.urls,...C?{cdn:P}:{},...T?{pageUrl:T}:{}})}return!0},dispose(){o=!0,i=void 0;for(let m of a.values())m.finish(void 0,new We("disposed","Font pack channel is closed"));d.clear()}}}var Ba,Ft,yn,ip,Nt=X(()=>{"use strict";On();Ba=async()=>{};Ft=(...t)=>Ba(...t),yn=class extends TypeError{constructor(e){super(`Failed to resolve module specifier '${e}'`)}};ip=0});function bn(){return nt[ap]??=new Map}function bi(t){return t.process?.versions?.node!==void 0||t.Deno!==void 0||t.Bun!==void 0}function wi(t){return t.window?.document!=null&&!bi(t)}function za(t){if(t&&!(t.implicit&&bi(nt[yi]??nt)))return{...t}}function Nn(){let t=nt[Ur];if(t)return za(t);if(wi(nt[yi]??nt))return{baseUrl:gi,timeoutMs:Or,implicit:!0}}function Nr(t,e){t===void 0?delete nt[Ur]:nt[Ur]={...t},e?nt[Br]=e:delete nt[Br]}function Dr(t){return za(nt[Br]||t===void 0?nt[Ur]:t.cdn)}function Dt(t=Nn()??null){return t?JSON.stringify([t.baseUrl,t.timeoutMs,t.implicit]):""}async function Si(){let t=nt[yi]??nt;if(nt[Br]||bi(t)||wi(t))return Dt();let e=await Ft("base").catch(()=>{});return Dt(Dr(e)??null)}var gi,Or,Ur,Br,ap,yi,nt,Qt=X(()=>{"use strict";Nt();gi="https://cdn.jsdelivr.net/npm/",Or=1e4,Ur=Symbol.for("betteroffice.fonts.cdn"),Br=Symbol.for("betteroffice.fonts.cdn.configured-here"),ap=Symbol.for("betteroffice.fonts.cdn.cooldown"),yi=Symbol.for("betteroffice.fonts.cdn.test-globals"),nt=globalThis});var qa=X(()=>{"use strict";Qt();Nt()});function dp(t,e){let n=new Set,r=!1;function o(i,s){if(r)return()=>{};t.addEventListener(i,s);let d=()=>{t.removeEventListener(i,s),n.delete(d)};return n.add(d),t.start?.(),d}return{post(i,s=[]){if(r)throw new We("disposed","Session transport is closed");t.postMessage(i,s)},listen(i){return o("message",s=>i(s.data))},onError(i){let s=o("error",a=>i(new We("crash",a.message||"Session worker crashed"))),d=o("messageerror",()=>i(new We("message","Session transport received an unreadable message")));return()=>{s(),d()}},close(){if(!r){r=!0;for(let i of[...n])i();e()}}}}function ja(t){return dp(t,()=>t.close?.())}var Ja=X(()=>{"use strict";qa();On()});function zn(t){return{[Ha]:!0,promise:t}}function $a(t){return Dn(t)&&t[Ha]===!0}function Le(t,e){return{[Wa]:!0,value:t,transfer:e}}function Ga(t){return Dn(t)&&t[Wa]===!0}function Zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Dn(t){return t!==null&&typeof t=="object"}function Pi(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>0}function zr(t){if(!Dn(t)||t.protocol!==1)return!1;if(t.kind==="wasm-compile"){if(t.pending!==void 0&&t.pending!==!0||t.bytes!==void 0&&!(t.bytes instanceof ArrayBuffer))return!1;if(t.stream===void 0)return!0;try{return Object.prototype.toString.call(t.stream)==="[object ReadableStream]"}catch{return!1}}return t.kind==="dispose"||t.kind==="call"&&Pi(t.id)&&typeof t.method=="string"&&Array.isArray(t.args)}function Va(t){if(!Dn(t)||t.protocol!==1)return!1;switch(t.kind){case"wasm-accept":return!0;case"wasm-module":try{return typeof t.url=="string"&&(t.hydration===void 0||typeof t.hydration=="string")&&Object.prototype.toString.call(t.module)==="[object WebAssembly.Module]"}catch{return!1}case"reply":return Pi(t.id)&&(t.ok===!0&&Zt(t,"value")||t.ok===!1&&Dn(t.error)&&typeof t.error.name=="string"&&typeof t.error.message=="string");case"event":return typeof t.name=="string"&&Zt(t,"payload");case"progress":return Pi(t.id);case"failure":return["crash","trap","out-of-memory","message","silence","disposed"].includes(t.code)&&typeof t.message=="string"&&(t.diagnostics===void 0||typeof t.diagnostics=="string");default:return!1}}var Wa,Ha,zt=X(()=>{"use strict";Wa=Symbol("session-transfer"),Ha=Symbol("session-deferred")});function Xa(t){let e=globalThis.process;if(typeof e?.getBuiltinModule=="function")try{return e.getBuiltinModule(t)}catch{return}}function qn(t,e=!1){if(t.protocol!=="file:")return;let n=Xa("node:fs"),r=Xa("node:url");if(!(!n||!r))try{return n.readFileSync(r.fileURLToPath(t.href))}catch(o){if(e)throw o;return}}function Ka(t){return qn(t)??t}function Ya(t,e){let n=e instanceof Error?e.message:String(e);return Object.assign(new Error(`Could not load the packaged WASM asset ${t.href} (${n}); pass its bytes or a compiled WebAssembly.Module to initWasm(input)`),{cause:e})}var qr=X(()=>{"use strict"});async function xi(t){let e=await fetch(t);if(typeof WebAssembly.compileStreaming=="function")try{return await WebAssembly.compileStreaming(e.clone())}catch(n){if(!e.ok||!["basic","cors","default"].includes(e.type)||e.headers.get("Content-Type")==="application/wasm")throw n}return WebAssembly.compile(await e.arrayBuffer())}async function lp(t){let e=qn(t);return e?WebAssembly.compile(e):xi(t)}function wn(t){return typeof Worker=="function"?xi(t):lp(t)}async function Qa(t){let e=new Response(t,{headers:{"Content-Type":"application/wasm"}});return typeof WebAssembly.compileStreaming=="function"?WebAssembly.compileStreaming(e):WebAssembly.compile(await e.arrayBuffer())}function Za(t,e,n,r=xi){let o,i,s=!1;function d(){return o||(o=r(e),o.catch(()=>{})),o}return t.listen(a=>{if(!zr(a)||a.kind!=="wasm-compile")return;if(a.pending){if(!o){o=new Promise(l=>{i=l}),o.catch(()=>{});try{t.post({protocol:1,kind:"wasm-accept"})}catch{}}return}let c=i;if(i=void 0,c){let l=a.stream?Qa(a.stream):a.bytes?WebAssembly.compile(a.bytes):r(e);l.catch(()=>{}),c(l)}else a.stream||a.bytes?o?a.stream?.cancel().catch(()=>{}):(o=a.stream?Qa(a.stream):WebAssembly.compile(a.bytes),o.catch(()=>{})):d()}),async a=>{if(a!==void 0)return n(a);let c=d(),l;try{l=await c}catch(m){throw o===c&&(o=void 0),m}if(await n(l),!s){s=!0;let m={protocol:1,kind:"wasm-module",url:e.href,module:l};try{t.post(m)}catch{}}}}var jr=X(()=>{"use strict";zt();qr()});function Jr(){return new URL("./generated/pptx_wasm_bg.wasm",import.meta.url)}function ed(){return new URL("./generated/pptx_wasm_lean_bg.wasm",import.meta.url)}function td(){return new URL("./generated/metafile_svg_wasm_bg.wasm",import.meta.url)}var jn=X(()=>{"use strict"});var rd,nd=X(()=>{rd="0.5.0"});var id,od=X(()=>{id="0.5.0"});var ad,sd=X(()=>{ad="0.5.0"});function dd(t){return{check:hp,load:(e,n,r,o)=>_i(e,n,t,r,o)}}function mp(t,e){return e||t instanceof Wr&&(t.status===404||t.status===410)?"url":"base"}function Hr(t){return t.origin+t.pathname.split("/assets/",1)[0]}function Jn(t,e){let n=Date.now();if(t.unavailable&&n<t.unavailable.until)return t.unavailable.error;let r=t.invalid.get(e);if(r&&n<r.until)return r.error;r&&t.invalid.delete(e)}function hp(t){let e=bn().get(Hr(t)),n=e&&Jn(e,t.href);if(n)throw n}function $r(t){let e=bn().get(Hr(t));if(!e)return;let n=Jn(e,t.href);if(n)throw n;let r=new URL("./",t).href;for(let o of e.invalid.keys()){if(!o.startsWith(r))continue;let i=Jn(e,o);if(i)throw i}}function ld(t,e){let n=bn().get(Hr(t));if(!n)return;let r=Math.max(n.unavailable?.until??0,n.invalid.get(t.href)?.until??0);if(e){let o=new URL("./",e).href;for(let[i,s]of n.invalid)i.startsWith(o)&&(r=Math.max(r,s.until))}return r>Date.now()?r:void 0}async function _i(t,e,n,r,o){o?.();let i=bn(),s=Hr(e),d=i.get(s);d||(d={transfer:Promise.resolve(),invalid:new Map,warnedUntil:0},i.set(s,d));let a=d,c=Jn(a,e.href);if(c)throw c;let l=(P,C=!1)=>{let T=Date.now(),j=T+pp,q=new vi(n,P);return i.get(s)!==a||(mp(P,C)==="base"?a.unavailable={error:q,until:j}:a.invalid.set(e.href,{error:q,until:j}),a.warnedUntil<=T&&(a.warnedUntil=j,console.warn(q.diagnostic.detail))),q},m=a.transfer.then(async()=>{let P=Jn(a,e.href);if(P)throw P;o?.();try{return{bytes:await gp(t,e),unavailable:a.unavailable}}catch(C){throw l(C)}});a.transfer=m.then(()=>{},()=>{});let{bytes:b,unavailable:R}=await m,v=await r(b,async P=>{try{return await P()}catch(C){throw l(C,!0)}});if(a.unavailable===R){a.unavailable=void 0;let P=Date.now();[...a.invalid.values()].every(({until:C})=>C<=P)&&(a.warnedUntil=0)}return v}async function gp(t,e){let n=new AbortController,{signal:r}=n,o,i,s,d=new Promise((l,m)=>{s=m}),a=()=>{clearTimeout(o),o=setTimeout(()=>{let l=new DOMException(`No font data received for ${Or} ms`,"TimeoutError");n.abort(l),s(l),i&&i.cancel(l).catch(()=>{})},Or)},c=async()=>{let l=await fetch(e,{signal:r,credentials:"omit",referrerPolicy:"no-referrer"});try{if(r.aborted)throw r.reason;if(l.type==="opaque"||l.type==="error")throw new Error(`No readable response for bundled font ${t}`);if(!l.ok)throw new Wr(t,l.status)}catch(T){throw l.body?.cancel().catch(()=>{}),T}a();let m=l.body;if(typeof m?.getReader!="function")return l.arrayBuffer();let b=m.getReader();i=b;let R=[],v=0;try{for(;;){let{done:T,value:j}=await b.read();if(r.aborted)throw r.reason;if(T)break;j.byteLength!==0&&(R.push(j),v+=j.byteLength,a())}}finally{b.releaseLock(),i=void 0}let P=new Uint8Array(v),C=0;for(let T of R)P.set(T,C),C+=T.byteLength;return P.buffer};a();try{return await Promise.race([c(),d])}finally{clearTimeout(o)}}function cd(t,e,n){if(n!==void 0)return new URL(`${t.pack}/${t.version}/${e}`,n);let r=yp[t.pack];if(r===void 0)throw new Error(`Unknown font pack: ${t.pack}`);return new URL(`${gi}@betteroffice/fonts-${t.pack}@${r}/assets/${e}`)}function fd(t){let e=t.timeoutMs??3e4;if(!Number.isInteger(e)||e<=0||e>4294967295)throw new RangeError("Font CDN timeoutMs must be a positive 32-bit integer");let n=!1;if(t.baseUrl!==!1){let r=String(t.baseUrl),o=new URL(r.endsWith("/")?r:`${r}/`,typeof location>"u"?void 0:location.href);if(o.protocol!=="https:"&&o.protocol!=="http:")throw new TypeError("Font CDN baseUrl must use HTTP or HTTPS");n=o.href}bn().clear(),Nr({baseUrl:n,timeoutMs:e},!0)}function ud(){return Nn()??{baseUrl:!1,timeoutMs:3e4}}var vi,pp,Wr,yp,Wn=X(()=>{"use strict";nd();od();sd();Qt();Qt();vi=class extends Error{constructor(e,n){let r=n instanceof Error?n.message:String(n),o=`Cannot load @betteroffice/fonts-${e} from cdn.jsdelivr.net: ${r}. To opt out, install @betteroffice/fonts-${e} or call configureFontCdn({ baseUrl: false }).`;super(o),this.name="ImplicitFontCdnError",this.diagnostic={pack:e,reason:"cdn-unavailable",detail:o}}},pp=6e4,Wr=class extends Error{constructor(n,r){super(`Failed to fetch bundled font ${n}: HTTP ${r}`);this.status=r}};yp={latin:rd,intl:id,cjk:ad}});var Sn,Gr=X(()=>{Sn={format:1,pack:"intl",version:"0.4.2",faces:[{file:"NotoSansArmenian-Bold.ttf.zst",source:"NotoSansArmenian-Bold.ttf",family:"NotoSansArmenian",codec:"zstd",encodedLength:8822,byteLength:30784,sha256:"58e4529f7f44d1fcfbd5d81d446b656f1230267ebfa96f8006956f18fbe4bbe2",dict:"NotoSansArmenian-Regular.ttf.zst"},{file:"NotoSansArmenian-Regular.ttf.zst",source:"NotoSansArmenian-Regular.ttf",family:"NotoSansArmenian",codec:"zstd",encodedLength:15648,byteLength:30752,sha256:"720df88c332417a235b4d6209d14ec2e2bf4bfe2a954b7453d869ea593bfce1e",dict:null},{file:"NotoSansBengali-Bold.ttf.zst",source:"NotoSansBengali-Bold.ttf",family:"NotoSansBengali",codec:"zstd",encodedLength:44599,byteLength:144828,sha256:"923c6a4c2eb618a57ed83f4bca855b4f5287b87906a4d9df40a2ffa8ebd8c2e8",dict:"NotoSansBengali-Regular.ttf.zst"},{file:"NotoSansBengali-Regular.ttf.zst",source:"NotoSansBengali-Regular.ttf",family:"NotoSansBengali",codec:"zstd",encodedLength:66348,byteLength:143072,sha256:"b55c62ee531e3214da6c0701daecea89a52ba42db7d8206b92e6b51f397a3193",dict:null},{file:"NotoSansCherokee-Bold.ttf.zst",source:"NotoSansCherokee-Bold.ttf",family:"NotoSansCherokee",codec:"zstd",encodedLength:41795,byteLength:108548,sha256:"5d60c5479b6e9af2f9fa6ede6ebeba471dd8c391333bcca91c2f9d0903279c6c",dict:"NotoSansCherokee-Regular.ttf.zst"},{file:"NotoSansCherokee-Regular.ttf.zst",source:"NotoSansCherokee-Regular.ttf",family:"NotoSansCherokee",codec:"zstd",encodedLength:44913,byteLength:94732,sha256:"c052352137ae8d283840a0e2991a675d47859d8fdbae5726d373d4f0d97a8c87",dict:null},{file:"NotoSansDevanagari-Bold.ttf.zst",source:"NotoSansDevanagari-Bold.ttf",family:"NotoSansDevanagari",codec:"zstd",encodedLength:56006,byteLength:250176,sha256:"6a09c8d797cfc803d32cdc731e809424d74cbaff59f503de34ade421a08e5bc2",dict:"NotoSansDevanagari-Regular.ttf.zst"},{file:"NotoSansDevanagari-Regular.ttf.zst",source:"NotoSansDevanagari-Regular.ttf",family:"NotoSansDevanagari",codec:"zstd",encodedLength:89070,byteLength:243520,sha256:"4e3c66638958c3e2ab5d37f47a8deb89fffeb7be9985c665a519bbc7ba762313",dict:null},{file:"NotoSansEthiopic-Bold.ttf.zst",source:"NotoSansEthiopic-Bold.ttf",family:"NotoSansEthiopic",codec:"zstd",encodedLength:61195,byteLength:375172,sha256:"b45f16db963a94ccb6590b65d3b0e48f55cde011f7c0d4f3c00531e6b8500d6f",dict:"NotoSansEthiopic-Regular.ttf.zst"},{file:"NotoSansEthiopic-Regular.ttf.zst",source:"NotoSansEthiopic-Regular.ttf",family:"NotoSansEthiopic",codec:"zstd",encodedLength:119123,byteLength:376804,sha256:"f6f7fc379db9438959a2b0527e7a2cf36ea9c84626d56ec444fff37fc24c3c10",dict:null},{file:"NotoSansGeorgian-Bold.ttf.zst",source:"NotoSansGeorgian-Bold.ttf",family:"NotoSansGeorgian",codec:"zstd",encodedLength:18204,byteLength:54748,sha256:"a7f6bc365b7c33372e9ff0b0422f35dad52df501a8fcd4e8766cefa430508693",dict:"NotoSansGeorgian-Regular.ttf.zst"},{file:"NotoSansGeorgian-Regular.ttf.zst",source:"NotoSansGeorgian-Regular.ttf",family:"NotoSansGeorgian",codec:"zstd",encodedLength:27389,byteLength:52888,sha256:"d3e33254b09e7bb2c5cf0f17e554b80462056c5a107097f258d495168c3a9346",dict:null},{file:"NotoSansGujarati-Bold.ttf.zst",source:"NotoSansGujarati-Bold.ttf",family:"NotoSansGujarati",codec:"zstd",encodedLength:44632,byteLength:201032,sha256:"7c1da9cad53f83804a330bad413b015987f4b6520da54263b0e39b7b8736525b",dict:"NotoSansGujarati-Regular.ttf.zst"},{file:"NotoSansGujarati-Regular.ttf.zst",source:"NotoSansGujarati-Regular.ttf",family:"NotoSansGujarati",codec:"zstd",encodedLength:69158,byteLength:200704,sha256:"9b5a7aaeeb649a2e75a49d8b006a1f87db1b61c0df3b001609f4e0725d88dbf6",dict:null},{file:"NotoSansGurmukhi-Bold.ttf.zst",source:"NotoSansGurmukhi-Bold.ttf",family:"NotoSansGurmukhi",codec:"zstd",encodedLength:15855,byteLength:55088,sha256:"4f1bb4b1a05a0ebe1520678132a9448fce8f1741552c5292d7df7a7786d2c956",dict:"NotoSansGurmukhi-Regular.ttf.zst"},{file:"NotoSansGurmukhi-Regular.ttf.zst",source:"NotoSansGurmukhi-Regular.ttf",family:"NotoSansGurmukhi",codec:"zstd",encodedLength:27099,byteLength:55172,sha256:"658d0207da305a1411c539a8b0bbeda64d4146e54fb4827facddb890b6b90d74",dict:null},{file:"NotoSansKannada-Bold.ttf.zst",source:"NotoSansKannada-Bold.ttf",family:"NotoSansKannada",codec:"zstd",encodedLength:42864,byteLength:187208,sha256:"3db1507b3f856185fc7c00dc0addfd4797a8ea6955b86d1d21fa659cc9d5e849",dict:"NotoSansKannada-Regular.ttf.zst"},{file:"NotoSansKannada-Regular.ttf.zst",source:"NotoSansKannada-Regular.ttf",family:"NotoSansKannada",codec:"zstd",encodedLength:64931,byteLength:182416,sha256:"9ad74dc64838c6855b96f671fc08e425a58921b9d0c71712ea79c328a27e6e38",dict:null},{file:"NotoSansKhmer-Bold.ttf.zst",source:"NotoSansKhmer-Bold.ttf",family:"NotoSansKhmer",codec:"zstd",encodedLength:27171,byteLength:113740,sha256:"17e5bb518c0ea3d998d42bf920d0771a79dc6f3c12c5d9f3c122c7e6c8ce3076",dict:"NotoSansKhmer-Regular.ttf.zst"},{file:"NotoSansKhmer-Regular.ttf.zst",source:"NotoSansKhmer-Regular.ttf",family:"NotoSansKhmer",codec:"zstd",encodedLength:42214,byteLength:114576,sha256:"e66675f2082788f0511a714bef5a1748928294b38c8e286a96ea73a864b5e605",dict:null},{file:"NotoSansLao-Bold.ttf.zst",source:"NotoSansLao-Bold.ttf",family:"NotoSansLao",codec:"zstd",encodedLength:10216,byteLength:37252,sha256:"18e3bf1443320fa807f9b85a9971d2bc3efe28b41bb96f75fde2096acb316709",dict:"NotoSansLao-Regular.ttf.zst"},{file:"NotoSansLao-Regular.ttf.zst",source:"NotoSansLao-Regular.ttf",family:"NotoSansLao",codec:"zstd",encodedLength:17035,byteLength:35884,sha256:"0a86e5e1ccfe34ca78c43fac6829dc751b42bcc469272a9a55325aae587bfbe7",dict:null},{file:"NotoSansLaoLooped-Bold.ttf.zst",source:"NotoSansLaoLooped-Bold.ttf",family:"NotoSansLaoLooped",codec:"zstd",encodedLength:17272,byteLength:56240,sha256:"b686a828bb3eac6cf426c4673666d79447142fb7841d870ed37c68a7608965d6",dict:"NotoSansLaoLooped-Regular.ttf.zst"},{file:"NotoSansLaoLooped-Regular.ttf.zst",source:"NotoSansLaoLooped-Regular.ttf",family:"NotoSansLaoLooped",codec:"zstd",encodedLength:26737,byteLength:56300,sha256:"fb41283aee26c91b93f3df6c11229054bf64407c494c4ee874b536b1330a06c8",dict:null},{file:"NotoSansMalayalam-Bold.ttf.zst",source:"NotoSansMalayalam-Bold.ttf",family:"NotoSansMalayalam",codec:"zstd",encodedLength:34189,byteLength:118480,sha256:"d5c52d4fdf019feb21cdb748573308fa5fdd94a81d5bc71c603c076207039590",dict:"NotoSansMalayalam-Regular.ttf.zst"},{file:"NotoSansMalayalam-Regular.ttf.zst",source:"NotoSansMalayalam-Regular.ttf",family:"NotoSansMalayalam",codec:"zstd",encodedLength:50562,byteLength:112936,sha256:"c08de7fa8d032a5d6a4d120fb82c78cec60b362a4e73fa26360d89759ff2a7f9",dict:null},{file:"NotoSansMongolian-Regular.ttf.zst",source:"NotoSansMongolian-Regular.ttf",family:"NotoSansMongolian",codec:"zstd",encodedLength:99547,byteLength:360756,sha256:"10f9066fe5cedcaa41c17d471bcadc7fb22880ce81ff2c06578671768ff44fbb",dict:null},{file:"NotoSansMyanmar-Bold.ttf.zst",source:"NotoSansMyanmar-Bold.ttf",family:"NotoSansMyanmar",codec:"zstd",encodedLength:52073,byteLength:208760,sha256:"99a8c6768416747653232ded39292e789ca579f4272adfb2886f6aa219d20302",dict:"NotoSansMyanmar-Regular.ttf.zst"},{file:"NotoSansMyanmar-Regular.ttf.zst",source:"NotoSansMyanmar-Regular.ttf",family:"NotoSansMyanmar",codec:"zstd",encodedLength:81274,byteLength:195088,sha256:"fafce4db400bc0b214907ccdbfb0ad2f18a57bfefd08c8a571830b84088cf2fc",dict:null},{file:"NotoSansOriya-Bold.ttf.zst",source:"NotoSansOriya-Bold.ttf",family:"NotoSansOriya",codec:"zstd",encodedLength:36105,byteLength:130104,sha256:"1c575e8aba40d6baf200e8abac534e9517f431d38cc8131715643037eec149da",dict:"NotoSansOriya-Regular.ttf.zst"},{file:"NotoSansOriya-Regular.ttf.zst",source:"NotoSansOriya-Regular.ttf",family:"NotoSansOriya",codec:"zstd",encodedLength:49661,byteLength:131216,sha256:"a16645d056017927406546aa78e4ce15e782fd8783467267b75450453d007415",dict:null},{file:"NotoSansSinhala-Bold.ttf.zst",source:"NotoSansSinhala-Bold.ttf",family:"NotoSansSinhala",codec:"zstd",encodedLength:51450,byteLength:192976,sha256:"e1f8867effb18940b02173a120641e526e5aaa8efc176870e62b2d49b1e6fd3f",dict:"NotoSansSinhala-Regular.ttf.zst"},{file:"NotoSansSinhala-Regular.ttf.zst",source:"NotoSansSinhala-Regular.ttf",family:"NotoSansSinhala",codec:"zstd",encodedLength:61235,byteLength:154912,sha256:"9e32612d47004552f3125e78648a9e2e7899a216ccd3cefbb93a9b5f4c809feb",dict:null},{file:"NotoSansSyriac-Regular.ttf.zst",source:"NotoSansSyriac-Regular.ttf",family:"NotoSansSyriac",codec:"zstd",encodedLength:29056,byteLength:73796,sha256:"4440929bf1a47bb50179e8d8495641d208c63d607355e451f29ea2d3e5343290",dict:null},{file:"NotoSansTamil-Bold.ttf.zst",source:"NotoSansTamil-Bold.ttf",family:"NotoSansTamil",codec:"zstd",encodedLength:22566,byteLength:77176,sha256:"683682d585698b8b44da066d4903762d8aaa471bdffb919ac869753689ba3950",dict:"NotoSansTamil-Regular.ttf.zst"},{file:"NotoSansTamil-Regular.ttf.zst",source:"NotoSansTamil-Regular.ttf",family:"NotoSansTamil",codec:"zstd",encodedLength:34612,byteLength:73992,sha256:"3c0a186feb3c63c7f6d63e1511dcdc144e745ae09b98e217c83f3e317974f6f9",dict:null},{file:"NotoSansTelugu-Bold.ttf.zst",source:"NotoSansTelugu-Bold.ttf",family:"NotoSansTelugu",codec:"zstd",encodedLength:63586,byteLength:243412,sha256:"ec98c4f82abfe52ebe00be298d39c469deb86cf027929987759ba1eab361fbb4",dict:"NotoSansTelugu-Regular.ttf.zst"},{file:"NotoSansTelugu-Regular.ttf.zst",source:"NotoSansTelugu-Regular.ttf",family:"NotoSansTelugu",codec:"zstd",encodedLength:80967,byteLength:235176,sha256:"b274780b69d1d23fe84b55e809a152cb2ac5306d33864b1f87622f6971871aae",dict:null},{file:"NotoSansThaana-Bold.ttf.zst",source:"NotoSansThaana-Bold.ttf",family:"NotoSansThaana",codec:"zstd",encodedLength:8975,byteLength:27e3,sha256:"476597290f449013cb07477b1089219db333c6af9ec0e436a74139ea9b2c8536",dict:"NotoSansThaana-Regular.ttf.zst"},{file:"NotoSansThaana-Regular.ttf.zst",source:"NotoSansThaana-Regular.ttf",family:"NotoSansThaana",codec:"zstd",encodedLength:14841,byteLength:27308,sha256:"7543935bdcef770c9d3dd54222651b29040e5ec82f3bc58542392b2c7a9cbd3c",dict:null},{file:"NotoSansThai-Bold.ttf.zst",source:"NotoSansThai-Bold.ttf",family:"NotoSansThai",codec:"zstd",encodedLength:10184,byteLength:37824,sha256:"2ac6c6e8a478e23b15f76e4894af1fa2210f8f350e4e6e54aad530bec03efbfb",dict:"NotoSansThai-Regular.ttf.zst"},{file:"NotoSansThai-Regular.ttf.zst",source:"NotoSansThai-Regular.ttf",family:"NotoSansThai",codec:"zstd",encodedLength:18343,byteLength:37780,sha256:"61cf814eec46b294d6ea4401ac295d0cecd5207bd2331dcc5a15e7301d30ee44",dict:null},{file:"NotoSansTifinagh-Regular.ttf.zst",source:"NotoSansTifinagh-Regular.ttf",family:"NotoSansTifinagh",codec:"zstd",encodedLength:32867,byteLength:79376,sha256:"8058054786bc572007193988654d1ded342bc2538c2d91c50d1a7238ea1a99cc",dict:null},{file:"NotoSerifTibetan-Bold.ttf.zst",source:"NotoSerifTibetan-Bold.ttf",family:"NotoSerifTibetan",codec:"zstd",encodedLength:180961,byteLength:602368,sha256:"1e8ca12dff8bf6adee21f5b0a6ba827fc2f9b3c515655983438371d1275e1d53",dict:"NotoSerifTibetan-Regular.ttf.zst"},{file:"NotoSerifTibetan-Regular.ttf.zst",source:"NotoSerifTibetan-Regular.ttf",family:"NotoSerifTibetan",codec:"zstd",encodedLength:196887,byteLength:609688,sha256:"ee97bf3dc56e813651db734c9f35f8f1d41e7e31acf5f7d893e64ad22b292446",dict:null}]}});var en,Vr=X(()=>{en={format:1,schema:1,pack:"latin",version:"0.4.2",faces:[{file:"Caladea-Bold.ttf.zst",source:"Caladea-Bold.ttf",family:"Caladea",codec:"woff2t+zstd",encodedLength:21905,byteLength:84468,sha256:"2232eb978a52d6cf5bc68bf47f8f3cd1e25dbd97269ced65f42f5cfb7636e556",dict:"Caladea-Regular.ttf.zst"},{file:"Caladea-BoldItalic.ttf.zst",source:"Caladea-BoldItalic.ttf",family:"Caladea",codec:"woff2t+zstd",encodedLength:28887,byteLength:83332,sha256:"2f7b738168c95adb66b9a16675e004ab91da23f92439baadcbe0188a5aa57e3d",dict:"Caladea-Regular.ttf.zst"},{file:"Caladea-Italic.ttf.zst",source:"Caladea-Italic.ttf",family:"Caladea",codec:"woff2t+zstd",encodedLength:28027,byteLength:83748,sha256:"609d28fb3c53bcc14d9996e51590cc422bf4ffd96e3cbd613605ccf75cda2b6e",dict:"Caladea-Regular.ttf.zst"},{file:"Caladea-Regular.ttf.zst",source:"Caladea-Regular.ttf",family:"Caladea",codec:"woff2t+zstd",encodedLength:33985,byteLength:81576,sha256:"da44b1e107daf242afbd765b8d4b5de5d52bc369f71b3666bff7e8dd0c45a8c7",dict:null},{file:"Carlito-Bold.ttf.zst",source:"Carlito-Bold.ttf",family:"Carlito",codec:"woff2t+zstd",encodedLength:159534,byteLength:686544,sha256:"708f167f7c3215cdbd270d40f89217530c37cb4281aa16b27791e2ce61e2de40",dict:"Carlito-Regular.ttf.zst"},{file:"Carlito-BoldItalic.ttf.zst",source:"Carlito-BoldItalic.ttf",family:"Carlito",codec:"woff2t+zstd",encodedLength:192091,byteLength:812632,sha256:"7aa387d2a7bb4c29b6613ebfed2ee5b203379715b32325d060cc2256ffcf0434",dict:"Carlito-Regular.ttf.zst"},{file:"Carlito-Italic.ttf.zst",source:"Carlito-Italic.ttf",family:"Carlito",codec:"woff2t+zstd",encodedLength:169386,byteLength:619352,sha256:"251f8a2efce3f042a9e8d72d167aef42d009c965725b23b4b766fde42d623e58",dict:"Carlito-Regular.ttf.zst"},{file:"Carlito-Regular.ttf.zst",source:"Carlito-Regular.ttf",family:"Carlito",codec:"woff2t+zstd",encodedLength:201493,byteLength:632084,sha256:"4cd4f010f14990501a59c127bf6b489ffddebf9563196c933c02ff80f6069d56",dict:null},{file:"ComicRelief-Bold.ttf.zst",source:"ComicRelief-Bold.ttf",family:"ComicRelief",codec:"woff2t+zstd",encodedLength:40330,byteLength:94684,sha256:"111224e5cd44fb9e704f09f669919688b4fe77b7bcc5ddb0851cb5902e13156b",dict:"ComicRelief-Regular.ttf.zst"},{file:"ComicRelief-Regular.ttf.zst",source:"ComicRelief-Regular.ttf",family:"ComicRelief",codec:"woff2t+zstd",encodedLength:39050,byteLength:80324,sha256:"b53344de83f058df9b3415b0eab23dfb0a9753a3891c6c7748ff6a7529f6cca2",dict:null},{file:"DMSans-Bold.ttf.zst",source:"DMSans-Bold.ttf",family:"DMSans",codec:"woff2t+zstd",encodedLength:12993,byteLength:57104,sha256:"97fb8612dc026b4e9311d7fc07f97d16000d6c715e8c3b02dd414699b94cbb58",dict:"DMSans-Regular.ttf.zst"},{file:"DMSans-BoldItalic.ttf.zst",source:"DMSans-BoldItalic.ttf",family:"DMSans",codec:"woff2t+zstd",encodedLength:20842,byteLength:61664,sha256:"9fe83e925d8e54d12badf24d4c692b474a66bacac87b367a49fc8b8367dbf8d7",dict:"DMSans-Regular.ttf.zst"},{file:"DMSans-Italic.ttf.zst",source:"DMSans-Italic.ttf",family:"DMSans",codec:"woff2t+zstd",encodedLength:19858,byteLength:61796,sha256:"508b80473a75336ef2409d6e9e91db99dceac0bde5ecbedff20c04baf4fc15f4",dict:"DMSans-Regular.ttf.zst"},{file:"DMSans-Regular.ttf.zst",source:"DMSans-Regular.ttf",family:"DMSans",codec:"woff2t+zstd",encodedLength:24149,byteLength:57184,sha256:"2b937658a9738fd7e6c5c58272304b18909d1d77367eeff5e45c30349c634fe3",dict:null},{file:"DMSerifDisplay-Italic.ttf.zst",source:"DMSerifDisplay-Italic.ttf",family:"DMSerifDisplay",codec:"woff2t+zstd",encodedLength:24017,byteLength:68828,sha256:"b0f60b2bb27387e5a5adee9ae82d9892d913899fd8779243f01710919ce7378e",dict:"DMSerifDisplay-Regular.ttf.zst"},{file:"DMSerifDisplay-Regular.ttf.zst",source:"DMSerifDisplay-Regular.ttf",family:"DMSerifDisplay",codec:"woff2t+zstd",encodedLength:32202,byteLength:70680,sha256:"554fd2457ac34a78429fe507c57fdc7a165c0e397839d23469593b4482d57cc4",dict:null},{file:"Gelasio-Bold.ttf.zst",source:"Gelasio-Bold.ttf",family:"Gelasio",codec:"woff2t+zstd",encodedLength:28791,byteLength:108424,sha256:"41ba5cfbf13a39fc632ef6a3bcc17266263051772a7a0f672402f677a1f3ff1a",dict:"Gelasio-Regular.ttf.zst"},{file:"Gelasio-BoldItalic.ttf.zst",source:"Gelasio-BoldItalic.ttf",family:"Gelasio",codec:"woff2t+zstd",encodedLength:39212,byteLength:108444,sha256:"7fcfbd0b37d52274fc5c1f614d550d4cc1130e7847f5bdcda8349abe8f321fff",dict:"Gelasio-Regular.ttf.zst"},{file:"Gelasio-Italic.ttf.zst",source:"Gelasio-Italic.ttf",family:"Gelasio",codec:"woff2t+zstd",encodedLength:38046,byteLength:108428,sha256:"f509ba5f3758c52c1499f6a1e7f33434bae22763a39e12b21220b31e7b694127",dict:"Gelasio-Regular.ttf.zst"},{file:"Gelasio-Regular.ttf.zst",source:"Gelasio-Regular.ttf",family:"Gelasio",codec:"woff2t+zstd",encodedLength:44536,byteLength:108244,sha256:"39b7530d21ee6974fd976b8b7b3344388c26b0d6a10e4588e28725c00821b1d9",dict:null},{file:"Heebo-Bold.ttf.zst",source:"Heebo-Bold.ttf",family:"Heebo",codec:"woff2t+zstd",encodedLength:15367,byteLength:43076,sha256:"332bdc93d6793764328ad645d6c916ceeccbab8bee57014d74bb1d67a9aa3f0b",dict:"Heebo-Regular.ttf.zst"},{file:"Heebo-Regular.ttf.zst",source:"Heebo-Regular.ttf",family:"Heebo",codec:"woff2t+zstd",encodedLength:20855,byteLength:42700,sha256:"f77d0f8bf7f50913ae04cef33cdd5f89e0bb413c0b0c8aac528a9fc47b751f19",dict:null},{file:"Inter-Bold.ttf.zst",source:"Inter-Bold.ttf",family:"Inter",codec:"woff2t+zstd",encodedLength:62864,byteLength:345568,sha256:"4517d0eee11ae5d4a0c3dd15ffe7836daa241b1d3531fe005995f3da91350c84",dict:"Inter-Regular.ttf.zst"},{file:"Inter-BoldItalic.ttf.zst",source:"Inter-BoldItalic.ttf",family:"Inter",codec:"woff2t+zstd",encodedLength:105501,byteLength:349012,sha256:"1ec39173a03a5b37e53a8e1b47b31cda544f9b27e5ecce02f7d139aec664e57a",dict:"Inter-Regular.ttf.zst"},{file:"Inter-Italic.ttf.zst",source:"Inter-Italic.ttf",family:"Inter",codec:"woff2t+zstd",encodedLength:98252,byteLength:347140,sha256:"acdbe0bdb8315cbbe45018c80c1c320cb997c89c09f5b3583e30ccb724c7be09",dict:"Inter-Regular.ttf.zst"},{file:"Inter-Regular.ttf.zst",source:"Inter-Regular.ttf",family:"Inter",codec:"woff2t+zstd",encodedLength:123512,byteLength:343792,sha256:"b622889ba11c7ce42298e6c161a63e83e88674f04f53fd1823eb1805116c35d3",dict:null},{file:"LiberationMono-Bold.ttf.zst",source:"LiberationMono-Bold.ttf",family:"LiberationMono",codec:"woff2t+zstd",encodedLength:98360,byteLength:307964,sha256:"0afd655a6cdd339c1d242045a63af2d0009b1b66af4fc36da89da900abf4abe8",dict:"LiberationMono-Regular.ttf.zst"},{file:"LiberationMono-BoldItalic.ttf.zst",source:"LiberationMono-BoldItalic.ttf",family:"LiberationMono",codec:"woff2t+zstd",encodedLength:99395,byteLength:284012,sha256:"7f4f09b69a4d781c6de982153a10aeb1d7b2a56749756fc38c87c8dcc930216c",dict:"LiberationMono-Regular.ttf.zst"},{file:"LiberationMono-Italic.ttf.zst",source:"LiberationMono-Italic.ttf",family:"LiberationMono",codec:"woff2t+zstd",encodedLength:91094,byteLength:281492,sha256:"e77cde86fd02a11aa01a479c397317b314214f175429e760f1afdbac16f7bcb9",dict:"LiberationMono-Regular.ttf.zst"},{file:"LiberationMono-Regular.ttf.zst",source:"LiberationMono-Regular.ttf",family:"LiberationMono",codec:"woff2t+zstd",encodedLength:133511,byteLength:319464,sha256:"918e5910b9226ffc2c154bfcd16c54af2430ff82e4cb11ad826213b84cfbf9f3",dict:null},{file:"LiberationSans-Bold.ttf.zst",source:"LiberationSans-Bold.ttf",family:"LiberationSans",codec:"woff2t+zstd",encodedLength:118901,byteLength:414428,sha256:"246d4db41e2f51a64ed99e372dbee7ce67ef31b10d9122dd675c365a826f2c3a",dict:"LiberationSans-Regular.ttf.zst"},{file:"LiberationSans-BoldItalic.ttf.zst",source:"LiberationSans-BoldItalic.ttf",family:"LiberationSans",codec:"woff2t+zstd",encodedLength:125494,byteLength:408960,sha256:"688c23f57881a9f504742bfed5e6d84b8b679973d0b4ed364fe18c41745c7a7a",dict:"LiberationSans-Regular.ttf.zst"},{file:"LiberationSans-Italic.ttf.zst",source:"LiberationSans-Italic.ttf",family:"LiberationSans",codec:"woff2t+zstd",encodedLength:121743,byteLength:415768,sha256:"89c48340314ca981b6c15e1ea87346248eeb63b44f10bf2f8aa2b5a9bb910091",dict:"LiberationSans-Regular.ttf.zst"},{file:"LiberationSans-Regular.ttf.zst",source:"LiberationSans-Regular.ttf",family:"LiberationSans",codec:"woff2t+zstd",encodedLength:160582,byteLength:410684,sha256:"988219c3d1d8d929b1b67599864a9f94f209dd3f1124a7ebb625b26e215d1543",dict:null},{file:"LiberationSerif-Bold.ttf.zst",source:"LiberationSerif-Bold.ttf",family:"LiberationSerif",codec:"woff2t+zstd",encodedLength:113267,byteLength:370084,sha256:"abbc8f40b5f46100a3b9a2497b8fd084ad18376851efdecf8dd509ccb58f2c38",dict:"LiberationSerif-Regular.ttf.zst"},{file:"LiberationSerif-BoldItalic.ttf.zst",source:"LiberationSerif-BoldItalic.ttf",family:"LiberationSerif",codec:"woff2t+zstd",encodedLength:127059,byteLength:376752,sha256:"e2881162ee8df048564f71b9a0cee11eb44fb10b58218a76a2021f5300af638f",dict:"LiberationSerif-Regular.ttf.zst"},{file:"LiberationSerif-Italic.ttf.zst",source:"LiberationSerif-Italic.ttf",family:"LiberationSerif",codec:"woff2t+zstd",encodedLength:123578,byteLength:375624,sha256:"6435e5bc7d756c790d1b696ca69ffa7fe87b1bcea93c55b1724697d1f6fd2fbe",dict:"LiberationSerif-Regular.ttf.zst"},{file:"LiberationSerif-Regular.ttf.zst",source:"LiberationSerif-Regular.ttf",family:"LiberationSerif",codec:"woff2t+zstd",encodedLength:156988,byteLength:393560,sha256:"e1c83ee51195cf5877a30100141741b6527d2cb70d97030a3e297dd79cd90af9",dict:null},{file:"Montserrat-Bold.ttf.zst",source:"Montserrat-Bold.ttf",family:"Montserrat",codec:"woff2t+zstd",encodedLength:67001,byteLength:382660,sha256:"ea6848a18ec0c29c676713548624e062bb423759823ed12a718cc6c0ae868edc",dict:"Montserrat-Regular.ttf.zst"},{file:"Montserrat-BoldItalic.ttf.zst",source:"Montserrat-BoldItalic.ttf",family:"Montserrat",codec:"woff2t+zstd",encodedLength:100368,byteLength:387916,sha256:"501313b93e7cff4b54c4cffaada1802de6f30d56fb33a4765909f3e9dd7c98ff",dict:"Montserrat-Regular.ttf.zst"},{file:"Montserrat-Italic.ttf.zst",source:"Montserrat-Italic.ttf",family:"Montserrat",codec:"woff2t+zstd",encodedLength:88097,byteLength:387668,sha256:"28f70408cc5823af7b38a80fb6b75feb4b9e48a3a786798aa43ed66c94bba4e8",dict:"Montserrat-Regular.ttf.zst"},{file:"Montserrat-Regular.ttf.zst",source:"Montserrat-Regular.ttf",family:"Montserrat",codec:"woff2t+zstd",encodedLength:116235,byteLength:382512,sha256:"1847e0c96868041ac80f348625fadf2126b823e693b1b99836921220f8c789e8",dict:null},{file:"NotoNaskhArabic-Regular.ttf.zst",source:"NotoNaskhArabic-Regular.ttf",family:"NotoNaskhArabic",codec:"woff2t+zstd",encodedLength:87473,byteLength:247336,sha256:"16485107fe2151208892e7007d6393c6b07c35a2bd15aeab76ffa74e90200fe0",dict:null},{file:"NotoSansArabic-Bold.ttf.zst",source:"NotoSansArabic-Bold.ttf",family:"NotoSansArabic",codec:"woff2t+zstd",encodedLength:59452,byteLength:261460,sha256:"9eed45f76952c9f557a9d17464dcda8e28fa9eeedb0a7c673ae4ab6959d4f21f",dict:"NotoSansArabic-Regular.ttf.zst"},{file:"NotoSansArabic-Regular.ttf.zst",source:"NotoSansArabic-Regular.ttf",family:"NotoSansArabic",codec:"woff2t+zstd",encodedLength:80208,byteLength:234892,sha256:"e199135893cf81284289849d27bb90c85127565b045f5020fbf378420a357a23",dict:null},{file:"NotoSansHebrew-Bold.ttf.zst",source:"NotoSansHebrew-Bold.ttf",family:"NotoSansHebrew",codec:"woff2t+zstd",encodedLength:4768,byteLength:26860,sha256:"e27d1e835526a42abe895271be0e7ebc84cfcd3905591e3eb233a67d54feaac1",dict:"NotoSansHebrew-Regular.ttf.zst"},{file:"NotoSansHebrew-Regular.ttf.zst",source:"NotoSansHebrew-Regular.ttf",family:"NotoSansHebrew",codec:"woff2t+zstd",encodedLength:11741,byteLength:26860,sha256:"ceab815ea653db4b433adf5b1e5d4bf0cf6e770eba2d1e007a3733af5bc0ca4c",dict:null},{file:"OpenSans-Bold.ttf.zst",source:"OpenSans-Bold.ttf",family:"OpenSans",codec:"woff2t+zstd",encodedLength:35237,byteLength:131376,sha256:"a5e58d48453979fe3bbf23741685a38eafa5844213478518eeba49b04ffd724a",dict:"OpenSans-Regular.ttf.zst"},{file:"OpenSans-BoldItalic.ttf.zst",source:"OpenSans-BoldItalic.ttf",family:"OpenSans",codec:"woff2t+zstd",encodedLength:53635,byteLength:136572,sha256:"253b170672a6ef00759c13f0d9e6d722cc6ca3250a6755137036efa0dbb42f26",dict:"OpenSans-Regular.ttf.zst"},{file:"OpenSans-Italic.ttf.zst",source:"OpenSans-Italic.ttf",family:"OpenSans",codec:"woff2t+zstd",encodedLength:55398,byteLength:136904,sha256:"9219305ac95ecc0a6b24edf1c51ccd642be4c12c72a00cb23501e2bc8fd7ec4e",dict:"OpenSans-Regular.ttf.zst"},{file:"OpenSans-Regular.ttf.zst",source:"OpenSans-Regular.ttf",family:"OpenSans",codec:"woff2t+zstd",encodedLength:63052,byteLength:131348,sha256:"321402fc191778afd1e4c5c6582d8ba776f1a4fde5fa36727915196d3ee5b250",dict:null},{file:"Oswald-Bold.ttf.zst",source:"Oswald-Bold.ttf",family:"Oswald",codec:"woff2t+zstd",encodedLength:21980,byteLength:79124,sha256:"9ca59ad293d09b4aca68767e6d5035879e5abe62622375bfee14be5056740cac",dict:"Oswald-Regular.ttf.zst"},{file:"Oswald-Regular.ttf.zst",source:"Oswald-Regular.ttf",family:"Oswald",codec:"woff2t+zstd",encodedLength:30980,byteLength:78864,sha256:"666626e668f6a733640ce821133444b4de3106ae9d63c1384d2cb81e5387a058",dict:null},{file:"Poppins-Bold.ttf.zst",source:"Poppins-Bold.ttf",family:"Poppins",codec:"woff2t+zstd",encodedLength:9889,byteLength:28380,sha256:"ae4fe8bf5b0d0952734cb319b2e4be3bb07f392b054d45ff227008cba41f723d",dict:"Poppins-Regular.ttf.zst"},{file:"Poppins-BoldItalic.ttf.zst",source:"Poppins-BoldItalic.ttf",family:"Poppins",codec:"woff2t+zstd",encodedLength:11833,byteLength:30644,sha256:"a46a88258dd9db50d31014ae337bab75f10df50582ec41a87cebabb863cb3262",dict:"Poppins-Regular.ttf.zst"},{file:"Poppins-Italic.ttf.zst",source:"Poppins-Italic.ttf",family:"Poppins",codec:"woff2t+zstd",encodedLength:11275,byteLength:31028,sha256:"59dacd6fc164e4609e59f4aba9159fd4380134fdc3819a78df80e1cfd2ab3f3f",dict:"Poppins-Regular.ttf.zst"},{file:"Poppins-Regular.ttf.zst",source:"Poppins-Regular.ttf",family:"Poppins",codec:"woff2t+zstd",encodedLength:12849,byteLength:28744,sha256:"08301da3d6d5b96e10ab21ecd44805061516495f3b5e991d4abe4086b51f516d",dict:null},{file:"Roboto-Bold.ttf.zst",source:"Roboto-Bold.ttf",family:"Roboto",codec:"woff2t+zstd",encodedLength:40499,byteLength:159516,sha256:"22daa6ad3481345ba565236d92ba6ee20ba3f0d3955316aa9adfe98342e9fcdf",dict:"Roboto-Regular.ttf.zst"},{file:"Roboto-BoldItalic.ttf.zst",source:"Roboto-BoldItalic.ttf",family:"Roboto",codec:"woff2t+zstd",encodedLength:50838,byteLength:165300,sha256:"6bcd40c6c30d71d34cbb409868bf471ceb8fd3518419a1526de555c8b26482fe",dict:"Roboto-Regular.ttf.zst"},{file:"Roboto-Italic.ttf.zst",source:"Roboto-Italic.ttf",family:"Roboto",codec:"woff2t+zstd",encodedLength:45173,byteLength:164436,sha256:"35453ffbd70a5ff93e7071bcad710382861138071ff3e360db50904132832c4b",dict:"Roboto-Regular.ttf.zst"},{file:"Roboto-Regular.ttf.zst",source:"Roboto-Regular.ttf",family:"Roboto",codec:"woff2t+zstd",encodedLength:73157,byteLength:158800,sha256:"ec8cb7b5fe7a4fee22fbf83ff1d9182b816d3720841f5c81465613b0eefe51a1",dict:null},{file:"Selawik-Bold.ttf.zst",source:"Selawik-Bold.ttf",family:"Selawik",codec:"woff2t+zstd",encodedLength:11215,byteLength:37160,sha256:"91fbcbb62d2f81b353d79983e1581a09d6aa29284feb4c7a61bf74b11643beee",dict:"Selawik-Regular.ttf.zst"},{file:"Selawik-Light.ttf.zst",source:"Selawik-Light.ttf",family:"Selawik",codec:"woff2t+zstd",encodedLength:10825,byteLength:37336,sha256:"0453552666983f7f1223fd465408614633a87e55e51ba2d7caec23984756f201",dict:"Selawik-Regular.ttf.zst"},{file:"Selawik-Regular.ttf.zst",source:"Selawik-Regular.ttf",family:"Selawik",codec:"woff2t+zstd",encodedLength:15274,byteLength:37332,sha256:"d21efc27f5faa09d6c97dfc9d8e04e1485b7b541f673f8370776aa0f6a15de41",dict:null},{file:"Selawik-Semibold.ttf.zst",source:"Selawik-Semibold.ttf",family:"Selawik",codec:"woff2t+zstd",encodedLength:11167,byteLength:37296,sha256:"49bdfb67bf85474297499685acf27ddcf341e2b44574d73e5a3a1f14db918216",dict:"Selawik-Regular.ttf.zst"},{file:"Selawik-Semilight.ttf.zst",source:"Selawik-Semilight.ttf",family:"Selawik",codec:"woff2t+zstd",encodedLength:10626,byteLength:37356,sha256:"7f7e6dc7fbf1a958237bb2458b7ad4dcb6a5b4653e0080d5ff22e68b27dda23b",dict:"Selawik-Regular.ttf.zst"},{file:"SourceSans3-Bold.ttf.zst",source:"SourceSans3-Bold.ttf",family:"SourceSans3",codec:"woff2t+zstd",encodedLength:59669,byteLength:381448,sha256:"0dc147bb4ef75eba8f7e850d9d7b171bc415fbd34ff9e2507093064e4d40ef0c",dict:"SourceSans3-Regular.ttf.zst"},{file:"SourceSans3-BoldItalic.ttf.zst",source:"SourceSans3-BoldItalic.ttf",family:"SourceSans3",codec:"woff2t+zstd",encodedLength:64432,byteLength:241716,sha256:"882bed09dd50d5b640d2bfb3a7949a176fbe6edf00c6337eeadbc91dab87e49e",dict:"SourceSans3-Regular.ttf.zst"},{file:"SourceSans3-Italic.ttf.zst",source:"SourceSans3-Italic.ttf",family:"SourceSans3",codec:"woff2t+zstd",encodedLength:63358,byteLength:241888,sha256:"485b89001477742fff8f2c79161c663e7e71fbecc15acfd4c242fae8e226c10a",dict:"SourceSans3-Regular.ttf.zst"},{file:"SourceSans3-Regular.ttf.zst",source:"SourceSans3-Regular.ttf",family:"SourceSans3",codec:"woff2t+zstd",encodedLength:113140,byteLength:381684,sha256:"5ebbfd4b12455f56d84839d4c389c46f8c7ff930bb4ce2acb80bf76a624b1ce2",dict:null}]}});var Xr,ki=X(()=>{Xr={format:1,schema:1,pack:"base-latin",version:"1",faces:[{file:"BetterOfficeBaseLatin-Regular.ttf.zst",source:"BetterOfficeBaseLatin-Regular.ttf",family:"BetterOffice Base Latin",codec:"zstd",dict:null,encodedLength:48737,byteLength:85920,sha256:"51d1dcec287000a2043782a69b9ee7f035ae834e465951499176c3355407da43"},{file:"BetterOfficeBaseLatin-Bold.ttf.zst",source:"BetterOfficeBaseLatin-Bold.ttf",family:"BetterOffice Base Latin",codec:"zstd",dict:null,encodedLength:18848,byteLength:34548,sha256:"9bf0b21fed98275570a190200a97896689558ba7693bc85832aa482eb29c80b7"},{file:"BetterOfficeBaseLatin-Italic.ttf.zst",source:"BetterOfficeBaseLatin-Italic.ttf",family:"BetterOffice Base Latin",codec:"zstd",dict:null,encodedLength:19853,byteLength:35704,sha256:"b17266b332d081245d500e9a1f136725f2741e98e34d93e30309ba803ce96d60"},{file:"BetterOfficeBaseLatin-BoldItalic.ttf.zst",source:"BetterOfficeBaseLatin-BoldItalic.ttf",family:"BetterOffice Base Latin",codec:"zstd",dict:null,encodedLength:19803,byteLength:35616,sha256:"ae4d6b157e91f89673009bf2a3d8748eaba978b1daeb81323cc6c4c88589861a"}]}});function ut(t,e,n,r){return[{family:t,metricCompatWith:e,weight:400,style:"normal",file:`${n}-Regular.ttf`,byteLength:r[0]},{family:t,metricCompatWith:e,weight:700,style:"normal",file:`${n}-Bold.ttf`,byteLength:r[1]},{family:t,metricCompatWith:e,weight:400,style:"italic",file:`${n}-Italic.ttf`,byteLength:r[2]},{family:t,metricCompatWith:e,weight:700,style:"italic",file:`${n}-BoldItalic.ttf`,byteLength:r[3]}]}function Ue(t,e,n){return["Regular","Bold"].flatMap(r=>{let o=`${n}-${r}.ttf.zst`,i=Pp.get(o);return i===void 0?[]:[{family:t,weight:r==="Bold"?700:400,style:"normal",file:o,byteLength:i,script:e}]})}function Hn(t){let e=t.trim().toLowerCase();return md.get(pd[e]??e)}function Ye(t,e,n){let r=Hn(t);if(!r)return;if(r==="Selawik"){if(n)return;let d=t.trim().toLowerCase(),a=e&&d==="segoe ui semibold"?"segoe ui":d,c=e&&a==="segoe ui"?700:400;return at.find(l=>l.metricCompatWith?.toLowerCase()===a&&l.weight===c)}let o=at.filter(d=>d.family===r),i=e?700:400,s=n?"italic":"normal";return o.find(d=>d.weight===i&&d.style===s)??o.find(d=>d.weight===400&&d.style==="normal")}function Ri(t,e,n){if(t.trim().toLowerCase()===Fi.toLowerCase())return qt.find(d=>d.weight===(e?700:400)&&d.style===(n?"italic":"normal"));if(Hn(t)==="Selawik")return n?void 0:Ye(t,e,!1);let r=t.trim().toLowerCase(),o=_p.get(r)??kp[r]??Hn(t),i=e?700:400,s=n?"italic":"normal";return at.find(d=>d.family===o&&d.weight===i&&d.style===s)}function Ti(t,e,n,r){let o=r===void 0?void 0:Cp[r.trim().toLowerCase()]?.[t],i=at.filter(a=>a.script===t);if(o!==void 0){let a=i.find(c=>c.family===o&&c.weight===400&&c.style==="normal");if(a!==void 0)return a}if(i.length===0)return;let s=e?700:400,d=n?"italic":"normal";return i.find(a=>a.weight===s&&a.style===d)??i.find(a=>a.weight===s&&a.style==="normal")??i.find(a=>a.weight===400&&a.style==="normal")??i[0]}function Fp(t){let e=t.toLowerCase();return/sans[ -]?serif/.test(e)?!1:e.includes("antiqua")||e.includes("bookman")||e.includes("calisto")||e.includes("schoolbook")||e.includes("goudy")||e.includes("perpetua")||e.includes("rockwell")||e.includes("caslon")||e.includes("constantia")||e.includes("didot")||e.includes("baskerville")||e.includes("times")||e.includes("georgia")||e.includes("garamond")||e.includes("palatino")||e.includes("baskerville")||e.includes("bodoni")||e.includes("cambria")||e.includes("minion")||e.includes("mincho")||e.includes("\u660E\u671D")||e.includes("\u660E\u9AD4")||e.includes("\u5B8B")||e.includes("ming")||e.includes("song")||e.includes("serif")}function hd(t){return Rp.get(t.trim().toLowerCase())}function gd(t,e,n){let r=t.trim().split(/[\s-]+/);if(r.length<2||!Tp.has(r[r.length-1].toLowerCase()))return;let o=r.slice(0,-1).join(" "),i=e&&Hn(o)!=="Selawik",s=Ye(o,i,n);return s&&(!i||s.weight===700)?s:Ye(o,!1,n)}function Ei(t,e,n){return gd(t,e,n)}function Ep(t){let e=t.toLowerCase();return e.includes("consolas")||e.includes("monaco")||e.includes("menlo")||e.includes("console")||e.includes("andale")||e.includes("inconsolata")||e.includes("cascadia")||e.includes("typewriter")||/(^|[\s-])mono([\s-]|$)/.test(e)}function Ap(t,e){let n=t.trim().split(/[\s-]+/);if(!(n.length<2||!Ip.has(n[n.length-1].toLowerCase())))return Ye(n.slice(0,-1).join(" "),!0,e)}function yd(t,e,n,r="powerpoint"){return Kr(t,e,n,r).face}function Kr(t,e,n,r="powerpoint"){let o=Ye(t,e,n),i=Ci(t,e,n,r,o!==void 0);if(i.file!==o?.file)return{face:i,onlyIfPrimaryFails:!1};let s=i.family==="Liberation Sans"?"Calibri":"Arial";return{face:Ye(s,e,n),onlyIfPrimaryFails:!0}}function Ii(t,e,n,r="powerpoint"){let o=Ye(t,e,n);if((o??Ci(t,e,n,r)).family==="Selawik")return o?yd(t,e,n,r):Ci(t,e,n,r,!0)}function Ci(t,e,n,r,o=!1){let i=gd(t,e,n);if(i&&(!o||i.family!=="Selawik"))return i;i&&(e=!1);let s=Ap(t,n);if(s&&(!o||s.family!=="Selawik"))return s;if(Lp.has(t.trim().toLowerCase()))return Ye("Arial",e,n);if(Ep(t))return Ye("Courier New",e,n);let d=hd(t);if(d){let l=Ye(d.family,e,n);if(l)return l}let a=r==="word"?"Arial":"Calibri",c=Fp(t)?"Times New Roman":a;return Ye(c,e,n)}function bd(t,e=!1,n=!1){let r=e?n?"boldItalic":"bold":n?"italic":"regular";return hd(t)?.digitAdvances[r]}function Mp(t,e,n,r=!1,o=!1){let i=bd(t,r,o);return i!==void 0?Math.round(i*e):Math.max(...[..."0123456789"].map(s=>Math.round(n(s))))}var Fi,qt,Pp,xp,vp,at,pd,md,_p,kp,Cp,Rp,Tp,Ip,Lp,Pn=X(()=>{"use strict";Gr();Vr();ki();Fi="BetterOffice Base Latin",qt=Xr.faces.map(t=>({family:Fi,weight:t.source.includes("-Bold")?700:400,style:t.source.includes("Italic")?"italic":"normal",file:t.file,byteLength:t.byteLength}));Pp=new Map(Sn.faces.map(({file:t,byteLength:e})=>[t,e]));xp=[...ut("Carlito","Calibri","Carlito",[628032,682468,615236,808508]),{family:"Selawik",metricCompatWith:"Segoe UI",weight:400,style:"normal",file:"Selawik-Regular.ttf",byteLength:44224},{family:"Selawik",metricCompatWith:"Segoe UI",weight:700,style:"normal",file:"Selawik-Bold.ttf",byteLength:44068},{family:"Selawik",metricCompatWith:"Segoe UI Light",weight:400,style:"normal",file:"Selawik-Light.ttf",byteLength:44232},{family:"Selawik",metricCompatWith:"Segoe UI Semilight",weight:400,style:"normal",file:"Selawik-Semilight.ttf",byteLength:44260},{family:"Selawik",metricCompatWith:"Segoe UI Semibold",weight:400,style:"normal",file:"Selawik-Semibold.ttf",byteLength:44192},...ut("Caladea","Cambria","Caladea",[81600,84492,83780,83356]),...ut("Liberation Sans","Arial","LiberationSans",[410712,414456,415816,408996]),...ut("Liberation Serif","Times New Roman","LiberationSerif",[393576,370096,375632,376772]),...ut("Liberation Mono","Courier New","LiberationMono",[319508,307996,281536,284068]),...ut("Gelasio","Georgia","Gelasio",[107588,107864,107904,107932]),...ut("Inter","Inter","Inter",[341396,343104,344784,346628]),...ut("Roboto","Roboto","Roboto",[157584,158316,163212,164100]),...ut("Source Sans 3","Source Sans Pro","SourceSans3",[379576,379468,240444,240384]),...ut("DM Sans","DM Sans","DMSans",[56856,56784,61472,61324]),...ut("Open Sans","Open Sans","OpenSans",[130484,130504,136020,135700]),...ut("Montserrat","Montserrat","Montserrat",[374500,374640,384612,384792]),...ut("Poppins","Poppins","Poppins",[28468,28108,30772,30388]),{family:"Oswald",metricCompatWith:"Oswald",weight:400,style:"normal",file:"Oswald-Regular.ttf",byteLength:78404},{family:"Oswald",metricCompatWith:"Oswald",weight:700,style:"normal",file:"Oswald-Bold.ttf",byteLength:78736},{family:"Heebo",metricCompatWith:"Heebo",weight:400,style:"normal",file:"Heebo-Regular.ttf",byteLength:42368},{family:"Heebo",metricCompatWith:"Heebo",weight:700,style:"normal",file:"Heebo-Bold.ttf",byteLength:42732},{family:"DM Serif Display",metricCompatWith:"DM Serif Display",weight:400,style:"normal",file:"DMSerifDisplay-Regular.ttf",byteLength:70440},{family:"DM Serif Display",metricCompatWith:"DM Serif Display",weight:400,style:"italic",file:"DMSerifDisplay-Italic.ttf",byteLength:68560},{family:"Comic Relief",metricCompatWith:"Comic Sans MS",weight:400,style:"normal",file:"ComicRelief-Regular.ttf",byteLength:80324},{family:"Comic Relief",metricCompatWith:"Comic Sans MS",weight:700,style:"normal",file:"ComicRelief-Bold.ttf",byteLength:94684},{family:"Noto Sans Hebrew",weight:400,style:"normal",file:"NotoSansHebrew-Regular.ttf",byteLength:26860,script:"hebrew"},{family:"Noto Sans Hebrew",weight:700,style:"normal",file:"NotoSansHebrew-Bold.ttf",byteLength:26860,script:"hebrew"},{family:"Noto Sans Arabic",weight:400,style:"normal",file:"NotoSansArabic-Regular.ttf",byteLength:234892,script:"arabic"},{family:"Noto Sans Arabic",weight:700,style:"normal",file:"NotoSansArabic-Bold.ttf",byteLength:261460,script:"arabic"},{family:"Noto Naskh Arabic",weight:400,style:"normal",file:"NotoNaskhArabic-Regular.ttf",byteLength:247336,script:"arabic"},...Ue("Noto Sans Thai","thai","NotoSansThai"),...Ue("Noto Sans Lao","lao","NotoSansLao"),...Ue("Noto Sans Khmer","khmer","NotoSansKhmer"),...Ue("Noto Sans Myanmar","myanmar","NotoSansMyanmar"),...Ue("Noto Sans Devanagari","devanagari","NotoSansDevanagari"),...Ue("Noto Sans Bengali","bengali","NotoSansBengali"),...Ue("Noto Sans Gurmukhi","gurmukhi","NotoSansGurmukhi"),...Ue("Noto Sans Gujarati","gujarati","NotoSansGujarati"),...Ue("Noto Sans Oriya","oriya","NotoSansOriya"),...Ue("Noto Sans Tamil","tamil","NotoSansTamil"),...Ue("Noto Sans Telugu","telugu","NotoSansTelugu"),...Ue("Noto Sans Kannada","kannada","NotoSansKannada"),...Ue("Noto Sans Malayalam","malayalam","NotoSansMalayalam"),...Ue("Noto Sans Sinhala","sinhala","NotoSansSinhala"),...Ue("Noto Sans Armenian","armenian","NotoSansArmenian"),...Ue("Noto Sans Georgian","georgian","NotoSansGeorgian"),...Ue("Noto Sans Ethiopic","ethiopic","NotoSansEthiopic"),...Ue("Noto Serif Tibetan","tibetan","NotoSerifTibetan"),...Ue("Noto Sans Mongolian","mongolian","NotoSansMongolian"),...Ue("Noto Sans Syriac","syriac","NotoSansSyriac"),...Ue("Noto Sans Thaana","thaana","NotoSansThaana"),...Ue("Noto Sans Cherokee","cherokee","NotoSansCherokee"),...Ue("Noto Sans Lao Looped","lao","NotoSansLaoLooped"),...Ue("Noto Sans Tifinagh","tifinagh","NotoSansTifinagh"),{family:"Noto Sans SC",metricCompatWith:"Microsoft YaHei",weight:400,style:"normal",file:"NotoSansSC-Regular.otf.zst",byteLength:8331336,script:"cjk-sc"},{family:"Noto Serif SC",metricCompatWith:"SimSun",weight:400,style:"normal",file:"NotoSerifSC-Regular.otf.zst",byteLength:11625800,script:"cjk-sc"},{family:"Noto Sans TC",metricCompatWith:"Microsoft JhengHei",weight:400,style:"normal",file:"NotoSansTC-Regular.otf.zst",byteLength:5683368,script:"cjk-tc"},{family:"Noto Sans JP",metricCompatWith:"MS Gothic",weight:400,style:"normal",file:"NotoSansJP-Regular.otf.zst",byteLength:4533028,script:"cjk-jp"},{family:"Noto Sans KR",metricCompatWith:"Malgun Gothic",weight:400,style:"normal",file:"NotoSansKR-Regular.otf.zst",byteLength:4644748,script:"cjk-kr"}],vp=new Map(en.faces.map(t=>[t.source,t])),at=xp.map(t=>{let e=vp.get(t.file);return e===void 0?t:{...t,file:e.file,byteLength:e.byteLength}}),pd={helvetica:"arial",times:"times new roman",courier:"courier new",helv:"arial","arial mt":"arial",arialmt:"arial","tms rmn":"times new roman","times roman":"times new roman",timesnewroman:"times new roman",timesnewromanps:"times new roman",timesnewromanpsmt:"times new roman",arimo:"arial","liberation sans":"arial","nimbus sans":"arial","helvetica neue":"arial",carlito:"calibri",tinos:"times new roman","liberation serif":"times new roman","nimbus roman":"times new roman",cousine:"courier new","liberation mono":"courier new","nimbus mono ps":"courier new",caladea:"cambria",simhei:"microsoft yahei",dengxian:"microsoft yahei",\u5FAE\u8F6F\u96C5\u9ED1:"microsoft yahei",\u9ED1\u4F53:"microsoft yahei",\u7B49\u7EBF:"microsoft yahei",nsimsun:"simsun",fangsong:"simsun",kaiti:"simsun",\u5B8B\u4F53:"simsun",\u4EFF\u5B8B:"simsun",\u6977\u4F53:"simsun",\u5FAE\u8EDF\u6B63\u9ED1\u9AD4:"microsoft jhenghei",pmingliu:"microsoft jhenghei",mingliu:"microsoft jhenghei","dfkai-sb":"microsoft jhenghei",\u65B0\u7D30\u660E\u9AD4:"microsoft jhenghei",\u7D30\u660E\u9AD4:"microsoft jhenghei",\u6A19\u6977\u9AD4:"microsoft jhenghei","ms pgothic":"ms gothic","ms ui gothic":"ms gothic",meiryo:"ms gothic","yu gothic":"ms gothic","\uFF4D\uFF53 \u30B4\u30B7\u30C3\u30AF":"ms gothic","\uFF4D\uFF53 \uFF50\u30B4\u30B7\u30C3\u30AF":"ms gothic",\u30E1\u30A4\u30EA\u30AA:"ms gothic",\u6E38\u30B4\u30B7\u30C3\u30AF:"ms gothic","ms mincho":"ms gothic","ms pmincho":"ms gothic","yu mincho":"ms gothic","\uFF4D\uFF53 \u660E\u671D":"ms gothic","\uFF4D\uFF53 \uFF50\u660E\u671D":"ms gothic",\u6E38\u660E\u671D:"ms gothic","\uB9D1\uC740 \uACE0\uB515":"malgun gothic",gulim:"malgun gothic",dotum:"malgun gothic",batang:"malgun gothic",gungsuh:"malgun gothic",\uAD74\uB9BC:"malgun gothic",\uB3CB\uC6C0:"malgun gothic",\uBC14\uD0D5:"malgun gothic",\uAD81\uC11C:"malgun gothic"},md=new Map;for(let t of at)t.metricCompatWith!==void 0&&md.set(t.metricCompatWith.toLowerCase(),t.family);_p=new Map(at.map(t=>[t.family.toLowerCase(),t.family])),kp={"noto serif tc":"Noto Sans TC","noto serif jp":"Noto Sans JP","noto serif kr":"Noto Sans KR"};Cp={"simplified arabic":{arabic:"Noto Naskh Arabic"},"traditional arabic":{arabic:"Noto Naskh Arabic"}};Rp=new Map([["verdana",{family:"Montserrat",digitAdvances:{regular:.636,bold:.711,italic:.636,boldItalic:.711}}]]);Tp=new Set(["thin","hairline","extralight","ultralight","semilight","light","medium"]);Ip=new Set(["black","heavy","extrabold","ultrabold","extrablack","ultra"]);Lp=new Set(["wingdings","wingdings 2","wingdings 3","webdings"])});var Ai,wd=X(()=>{Ai={thresholds:[1e3,800,600,400,250,150],tiers:["ffffffffffffffff7fffffff00000000ffffdffffffffffffffffffffffffffffffffffffffffdffffffffffffffffffffffffffffffffefffffffffffffffffff7fffff7c30ffffffffd7f0fffffffb30ff7ffff67f0000ffffffffffffffffffffffff03bfffff3fffff7fffffffffffffffffffffffffffbe00805619004700000010ffff00000000003e0000003f00000000000000008044000008004406010000000031000000000000000000000000000000000000040200008c00000000400000000000000000000000001000","ffffffffffffffff7fffffff00000000ffffdffffffffffffffffffffffffffffffffffffffffdffffffffff4cddc443008380033fffe00fff31ccfcff0033337c0000cd0000033e08100000180002800000008100000000ffffffffffffffffffffffff003c000c0fcf00000ccfcc0f03f3819f00ccc3cc773e008006090047000000105ada0000000000360000003f000000000000000080440000080044060100000000310000000000000000000000000000000000000002000004000000","ffffffffffffffff7fffffff00000000ffffdfffffffffffffffffff0c0f000f00000f00000cf19800003f000004000000018003000000000000000000000000000000000000000000000000000000000000000100000000ffff0002ffffffff0002ffff0000000000000000000000000000000000000000771a00000609004700000000180000000000000000000000000000000000000080040000080044060100000000310000000000000000000000000000000000000000000004000000","ffffffffffffffff7fffffff00000000ffffdfffffffffffffffffff0c0f000f00000f00000cf19800003f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000771a0000060900470000000010000000","ffffffffffffffff7fffffff00000000fbffdbfeffffffffffffffff0c0f000f00000c00000c319800000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000771a0000060000440000000010000000","ffffffffffffffff7fffffff00000000fbffdbfeffffffffffffffff0c0f000f00000c00000c319800000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000771a0000060000440000000010000000"],levels:"1111555554444111111111111444411113333222255553333222255553355554400000000000000000000000000000000000000000000000000333331444"}});function Bp(){return[...new Set([...at,...qt].map(t=>t.file))]}function Pd(t){Sd??=new Map(Bp().map((n,r)=>[n,Number(Ai.levels[r]??0)]));let e=Sd.get(t)??0;return e>0?Ai.tiers[e-1]:void 0}var Sd,xd=X(()=>{"use strict";wd();Pn()});function vd(t,e,n){let r=new Map,o=(i,s)=>{let d=`${i.file}|${s?.measureAs??""}|${s?.onlyIfPrimaryFails??!1}`,a=r.get(d);if(a===void 0){let c=n?.(i),l=Pd(i.file);a=Object.assign(()=>t(i),s,{...c&&{slices:c},...l===void 0?void 0:{coverage:l},...e&&{readOnlyBytes:()=>e(i)}}),r.set(d,a)}return a};return{resolveBaseLatin(i,s){let d=qt.find(a=>a.weight===(i?700:400)&&a.style===(s?"italic":"normal"));return d?o(d):void 0},resolve(i,s,d){let a=Ye(i,s,d);return a?o(a,{measureAs:a.family==="Selawik"?a.metricCompatWith:void 0}):void 0},resolveFamily(i,s,d){let a=Ri(i,s,d);return a?o(a):void 0},resolveScriptFallback(i,s,d,a){let c=Ti(i,s,d,a);return c?o(c):void 0},resolveGlyphFallback(i,s,d,a="powerpoint"){let c=Ii(i,s,d,a);return c?o(c):void 0},resolveLightVariant(i,s,d){let a=Ei(i,s,d);return a?o(a):void 0},resolveLastResort(i,s,d,a){let{face:c,onlyIfPrimaryFails:l}=Kr(i,s,d,a);return o(c,l?{onlyIfPrimaryFails:l}:void 0)}}}var _d=X(()=>{"use strict";Pn();xd()});function kd(t){let e=globalThis.process;if(typeof e?.getBuiltinModule=="function")try{return e.getBuiltinModule(t)}catch{return}}function Op(t){if(t.protocol!=="file:")return;let e=globalThis;if(e.process?.versions?.node!==void 0&&e.Deno===void 0&&typeof e.process.getBuiltinModule!="function")throw Fd||(Fd=!0,console.warn(`[@betteroffice/fonts] ${Cd}`)),new Error(Cd);let n=kd("node:fs"),r=kd("node:url");if(!(!n||!r))try{let o=n.readFileSync(r.fileURLToPath(t.href));return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}catch{return}}function Np(t,e){if(e.byteLength!==t.byteLength)throw new Error(`Bundled font ${t.file} has ${e.byteLength} bytes; expected ${t.byteLength}`);return e}async function $n(t,e,n){let r=Op(e);if(r)return r;let o=await fetch(e,n===void 0?void 0:{signal:AbortSignal.timeout(n),credentials:"omit",referrerPolicy:"no-referrer"});if(!o.ok)throw new Error(`Failed to fetch bundled font ${t}: HTTP ${o.status}`);return o.arrayBuffer()}function Rd(t,e,n){let r=`${e.href}|${t.byteLength}|${n??""}`,o=Yr.get(r);if(o)return o;let i=(async()=>Np(t,await $n(t.file,e,n)))();return i.catch(()=>{Yr.get(r)===i&&Yr.delete(r)}),Yr.set(r,i),i}var Cd,Fd,Yr,Qr=X(()=>{"use strict";Cd="Reading bundled fonts from installed packages needs Node.js 20.16+ or 22.3+ (process.getBuiltinModule); upgrade Node.js or pass a font baseUrl.",Fd=!1;Yr=new Map});var Ed,Td=X(()=>{Ed={format:1,schema:1,pack:"cjk",version:"0.4.2",faces:[{file:"NotoSansJP-Regular.otf.zst",source:"NotoSansJP-Regular.otf",family:"NotoSansJP",codec:"zstd",encodedLength:3595531,byteLength:4533028,sha256:"dff723ba59d57d136764a04b9b2d03205544f7cd785a711442d6d2d085ac5073",dict:null,slices:{format:1,index:"NotoSansJP-Regular/slices.json",indexSha256:"9fd53a1857302a7d9b3dc2b9f3e8039b6d13c64e0a79d416ddbca8a692bc415d"}},{file:"NotoSansKR-Regular.otf.zst",source:"NotoSansKR-Regular.otf",family:"NotoSansKR",codec:"zstd",encodedLength:3420953,byteLength:4644748,sha256:"69975a0ac8472717870aefeab0a4d52739308d90856b9955313b2ad5e0148d68",dict:null,slices:{format:1,index:"NotoSansKR-Regular/slices.json",indexSha256:"309e142311ef7c1b73b6052ba4ddb09f77a06d2ebc20243fbbed55cb872ce47d"}},{file:"NotoSansSC-Regular.otf.zst",source:"NotoSansSC-Regular.otf",family:"NotoSansSC",codec:"zstd",encodedLength:6444964,byteLength:8331336,sha256:"faa6c9df652116dde789d351359f3d7e5d2285a2b2a1f04a2d7244df706d5ea9",dict:null,slices:{format:1,index:"NotoSansSC-Regular/slices.json",indexSha256:"73a0d2d52944be3db939ec12c1331521429d7ad2f7bff5b9342f6942fc671d90"}},{file:"NotoSansTC-Regular.otf.zst",source:"NotoSansTC-Regular.otf",family:"NotoSansTC",codec:"zstd",encodedLength:4456580,byteLength:5683368,sha256:"5bab0cb3c1cf89dde07c4a95a4054b195afbcfe784d69d75c340780712237537",dict:null,slices:{format:1,index:"NotoSansTC-Regular/slices.json",indexSha256:"e246aab5dbca74d596959ca46a6693733b137bacc0bda47e8dd6f3d02aeeb857"}},{file:"NotoSerifSC-Regular.otf.zst",source:"NotoSerifSC-Regular.otf",family:"NotoSerifSC",codec:"zstd",encodedLength:8743526,byteLength:11625800,sha256:"e8f396decc1f0963a016a989c3d8852e863d1350996f573860a80767c83a1cd3",dict:null,slices:{format:1,index:"NotoSerifSC-Regular/slices.json",indexSha256:"7e1cf89eaa36520084c6b74bb3fd6bcbe595bc674fed4d834db967abde54b675"}}]}});function Rt(t,e){return t>>>e|t<<32-e}function qp(t){let e=new Uint8Array(t),n=new Uint8Array(Math.ceil((e.length+9)/64)*64);n.set(e),n[e.length]=128;let r=new DataView(n.buffer);r.setUint32(n.length-8,Math.floor(e.length/536870912)),r.setUint32(n.length-4,e.length*8);let o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint32Array(64);for(let s=0;s<n.length;s+=64){for(let P=0;P<16;P++)i[P]=r.getUint32(s+P*4);for(let P=16;P<64;P++){let C=i[P-15],T=i[P-2];i[P]=i[P-16]+(Rt(C,7)^Rt(C,18)^C>>>3)+i[P-7]+(Rt(T,17)^Rt(T,19)^T>>>10)}let[d,a,c,l,m,b,R,v]=o;for(let P=0;P<64;P++){let C=v+(Rt(m,6)^Rt(m,11)^Rt(m,25))+(m&b^~m&R)+zp[P]+i[P],T=(Rt(d,2)^Rt(d,13)^Rt(d,22))+(d&a^d&c^a&c);v=R,R=b,b=m,m=l+C>>>0,l=c,c=a,a=d,d=C+T>>>0}for(let[P,C]of[d,a,c,l,m,b,R,v].entries())o[P]+=C}return Array.from(o,s=>s.toString(16).padStart(8,"0")).join("")}async function Gn(t){if(globalThis.crypto?.subtle===void 0)return qp(t);let e=new Uint8Array(await crypto.subtle.digest("SHA-256",t));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}var zp,Li=X(()=>{"use strict";zp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298])});async function Mi(){let t=(await Ft("decoder"))?.urls?.["fontpack.wasm"];return t===void 0?void 0:new URL(t)}async function Id(t){if(t.protocol==="file:"){let{Deno:n,Bun:r}=globalThis;try{let o=qn(t,!0);if(o)return o;if(n)return await n.readFile(t);if(r)return new Uint8Array(await r.file(t).arrayBuffer())}catch(o){throw o instanceof Error&&o.name==="NotFound"&&Object.assign(o,{code:"ENOENT"}),o}}let e=await fetch(t,{signal:AbortSignal.timeout(3e4)});if(!e.ok)throw Object.assign(new Error(`Cannot load font decoder wasm: HTTP ${e.status}`),{decoderStatus:e.status});return new Uint8Array(await e.arrayBuffer())}function Ad(t){return new URL(t).href}var Vn=X(()=>{"use strict";Nt();qr();Nt()});var Bi={};St(Bi,{decodeFontBytes:()=>Xp,decodeFontFace:()=>Od,releaseFontDecoder:()=>Wp});function Wp(){tn.clear()}function Ui(t){let e=globalThis.process;if(typeof e?.getBuiltinModule=="function")try{return e.getBuiltinModule(t)}catch{return}}function Ld(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Xn(t){return new Uint8Array(t).buffer}function Tt(){return new Error("Font face is corrupt or truncated, or uses a wrong dictionary")}function Hp(t,e){if(t.length<5)throw Tt();let n=t[4];if(n&8)throw Tt();let r=(n&32)!==0,o=n>>>6,i=o===0?r?1:0:1<<o,s=5+(r?0:1),d=[0,1,2,4][n&3];if(s+=d,t.length<s+i)throw Tt();if(i===0)throw new Error("Font face has no decoded content size");let a=0n;for(let l=0;l<i;l++)a|=BigInt(t[s+l])<<BigInt(8*l);if(o===1&&(a+=256n),a>BigInt(e))throw new Error(`Font face is too large: ${a} decoded bytes exceed ${e}`);if((n&4)===0)throw new Error("Font face has no content checksum");s+=i;let c=!1;for(;!c;){if(s+3>t.length)throw Tt();let l=t[s]|t[s+1]<<8|t[s+2]<<16;c=(l&1)!==0;let m=l>>>1&3;if(m===3||(s+=3+(m===1?1:l>>>3),s>t.length))throw Tt()}if(s+4!==t.length)throw new Error("Font face is corrupt or must contain exactly one zstd frame");return Number(a)}async function $p(t){let e;if(t.protocol==="file:")e=(await WebAssembly.instantiate(Xn(await Id(t,Ui)),{})).instance;else{if(typeof fetch!="function")throw new Error("Cannot fetch font decoder wasm");let r=await fetch(t,{signal:AbortSignal.timeout(3e4),credentials:"omit",referrerPolicy:"no-referrer"});if(!r.ok)throw Object.assign(new Error(`Cannot load font decoder wasm: HTTP ${r.status}`),{decoderStatus:r.status});if(/^https?:$/.test(t.protocol)&&typeof Response<"u"&&typeof WebAssembly.instantiateStreaming=="function")try{e=(await WebAssembly.instantiateStreaming(r.clone(),{})).instance}catch{e=(await WebAssembly.instantiate(await r.arrayBuffer(),{})).instance}else e=(await WebAssembly.instantiate(await r.arrayBuffer(),{})).instance}let n=e.exports;if(!(n.memory instanceof WebAssembly.Memory)||["fp_alloc","fp_free","fp_decode","fp_decode_face","fp_out_ptr","fp_out_len","fp_out_free","fp_payload_ptr","fp_payload_len","fp_payload_free"].some(r=>typeof n[r]!="function"))throw new Error("Font decoder wasm has incompatible exports");return n}function Gp(t){let{decoderStatus:e,code:n}=t??{};return e===403||e===404||e===410?`HTTP ${e}`:n==="ENOENT"?"no such file":void 0}async function Ud(t){let e=[],n;for(let r of[()=>t,Mi]){let o=await r();if(o===void 0||r===Mi&&o.href===t?.href)continue;let i=Md.get(o.href);if(i!==void 0){e.push(`${o.href} (${i})`);continue}try{let s=await Bd(o);for(;s.failed;)s=await Bd(o);return s}catch(s){let d=Gp(s);if(d===void 0)throw s;Md.set(o.href,d),e.push(`${o.href} (${d})`),n=s}}throw Object.assign(new Error(`Font decoder wasm not found: ${e.join(", ")||"no decoder URL"}. Serve @betteroffice/fonts/dist/decoder/fontpack.wasm at the first location, or let the bundler emit the package decoder.`),{cause:n})}function Bd(t){let e=t.href,n=tn.get(e);if(n)return n;let r=$p(t).then(o=>{let i={wasm:o,failed:!1,invalidate(){i.failed=!0,tn.get(e)===r&&tn.delete(e)}};return i});return tn.set(e,r),r.catch(()=>{tn.get(e)===r&&tn.delete(e)}),r}function Zr(t){switch(t){case-2:return new Error("Font face has no decoded content size");case-3:return new Error("Font face is too large for maxOutput");case-4:return new Error("Font face checksum failed: corrupt face or wrong dictionary");case-5:return new Error("Font face dictionary is missing or wrong");case-7:return new Error("Cannot allocate memory for font face");case-9:return new Error("Font face has no content checksum");case-10:return new Error("Font face WOFF2 reconstruction failed");default:return Tt()}}function Vp(t,e,n,r,o,i){let{wasm:s}=t;function d(l){try{return l()}catch{throw t.invalidate(),new Error("Font face could not be decoded")}}let a=0,c=0;try{if(a=d(()=>s.fp_alloc(e.length))>>>0,!a)throw Zr(-7);if(new Uint8Array(s.memory.buffer,a,e.length).set(e),n?.length){if(c=d(()=>s.fp_alloc(n.length))>>>0,!c)throw Zr(-7);new Uint8Array(s.memory.buffer,c,n.length).set(n)}let l=d(()=>i==="zstd"?s.fp_decode(a,e.length,c,n?.length??0,r):s.fp_decode_face(a,e.length,c,n?.length??0,r,1));if(l!==0)throw Zr(l);let m=d(()=>s.fp_out_len())>>>0;if(m>r)throw Zr(-3);let b=Xn(new Uint8Array(s.memory.buffer,d(()=>s.fp_out_ptr())>>>0,m));if(i==="zstd"){if(m!==o)throw Tt();return{font:b}}let R=d(()=>s.fp_payload_len())>>>0;if(R!==o)throw Tt();let v=Xn(new Uint8Array(s.memory.buffer,d(()=>s.fp_payload_ptr())>>>0,R));return{font:b,payload:v}}finally{t.failed||(d(()=>s.fp_out_free()),d(()=>s.fp_payload_free()),c&&d(()=>s.fp_free(c,n?.length??0)),a&&d(()=>s.fp_free(a,e.length)))}}async function Xp(t,e,n){return(await Od(t,e,n)).font}async function Od(t,e,n){let r=n?.codec??"zstd";if(r!=="zstd"&&r!=="woff2t+zstd")throw new Error(`Unsupported font face codec: ${r}`);let o=Ld(t);if(o.length<4||o[0]!==40||o[1]!==181||o[2]!==47||o[3]!==253)return{font:Xn(o)};let i=n?.maxOutput??jp;if(!Number.isSafeInteger(i)||i<0||i>2147483647)throw new Error("Font face maxOutput must be an integer from 0 to 2147483647");let s=r==="woff2t+zstd"?Math.min(i,Jp):i,d=Hp(o,s),a=e===void 0?void 0:Ld(e);if(r==="woff2t+zstd"&&(o.length>s||(a?.length??0)>s))throw new Error("Font face is too large for maxOutput");let c=r==="woff2t+zstd"?void 0:Ui("node:zlib");if(typeof c?.zstdDecompressSync=="function")try{let m=Ui("node:buffer"),b=c.zstdDecompressSync(o,{dictionary:a===void 0?void 0:m?.Buffer.from(a)??a,maxOutputLength:Math.max(1,s)});if(b.byteLength!==d)throw Tt();return{font:Xn(b)}}catch(m){let b=m instanceof Error?m.message:String(m);throw new Error(`Font face is corrupt or uses a wrong dictionary: ${b}`)}let l=await Ud(n?.wasmUrl);for(;l.failed;)l=await Ud(n?.wasmUrl);return Vp(l,o,a,s,d,r)}var jp,Jp,tn,Md,Oi=X(()=>{"use strict";Vn();jp=64*1024*1024,Jp=64*1024*1024,tn=new Map;Md=new Map});function to(t){let e=t;if(e?.format!==1||e.schema!==void 0&&e.schema!==1||!Array.isArray(e.faces))throw new Error("Unsupported font pack manifest");for(let n of e.faces)if(n.codec!=="zstd"&&n.codec!=="woff2t+zstd")throw new Error(`Unsupported font face codec: ${n.codec}`);return e}function Kn(t){return Qp.has(t)}function no(t){return Yp.has(t)}function em(t){return Zp.has(t)}async function eo(t,e,n,r,o,i,s){let d=i?.decoder,a=tm;d!==void 0&&(a=Nd.get(d)??new Map,Nd.set(d,a));let c=s??await n(t),l=typeof r=="function"?r(c):r,m=e.faces.find(C=>C.file===t.file);if(m===void 0)throw new Error(`Unknown bundled font asset: ${t.file}`);let b=typeof l=="object"?"implicit":l??"",R=`${e.pack}|${e.version}|${c.href}|${m.codec}|${m.dict}|${m.encodedLength}|${t.byteLength}|${m.sha256}|${b}|${o?.href??""}`,v=a.get(R);if(v===void 0){v=(async()=>{let j=m.dict===null?void 0:e.faces.find(f=>f.file===m.dict);if(m.dict!==null&&(j===void 0||j.dict!==null||j.codec!==m.codec||j.family!==m.family))throw new Error(`Missing bundled font dictionary for ${t.file}`);let q=j&&{...t,file:j.file,byteLength:j.byteLength},D=q&&await n(q),A=D&&(typeof r=="function"?r(D):r),U=D&&typeof A=="object"?()=>A.check(D):void 0,L=()=>q&&eo(q,e,n,r,o,i,D),x=f=>{if(f.byteLength!==m.encodedLength)throw new Error(`Bundled font ${t.file} has ${f.byteLength} encoded bytes; expected ${m.encodedLength}`);return f},k=async(f,h)=>{let _=h===void 0?void 0:(h.payload??h.font).slice(0),J=await qd(o,d)(f,{codec:m.codec,dict:_,maxOutput:64*1024*1024});if(J.font.byteLength!==t.byteLength)throw new Error(`Bundled font ${t.file} has ${J.font.byteLength} bytes; expected ${t.byteLength}`);if(await Gn(J.font)!==m.sha256)throw new Error(`Bundled font ${t.file} SHA-256 mismatch`);if(m.codec==="woff2t+zstd"&&J.payload===void 0)throw new Error(`Missing bundled font dictionary payload for ${t.file}`);return J};if(typeof l=="object")return l.load(t.file,c,async(f,h)=>{await h(()=>x(f));let _=await L();return h(()=>k(f,_))},U);U?.();let[g,y]=await Promise.all([$n(t.file,c,l).then(x),L()]);return k(g,y)})(),a.set(R,v);let C=v,T=()=>{a.get(R)===C&&a.delete(R)};v.then(i?.retain===!1?T:void 0,T)}let P=v;return P.then(C=>nm(C,t)?C:(a.get(R)===P&&a.delete(R),eo(t,e,n,r,o,i)))}function nm(t,e){return t.font.byteLength===e.byteLength&&t.payload?.byteLength!==0}function Yn(t){return no(t.file)?zd:Kn(t.file)?Dd:em(t.file)?Ni:Kp}function qd(t,e){return e??(async(n,r)=>(await Promise.resolve().then(()=>(Oi(),Bi))).decodeFontFace(n,r.dict,{...r,wasmUrl:t}))}function ro(t,e){let n=qd(t,e);return async(r,o)=>(await n(r,{codec:"zstd",maxOutput:o})).font}function oo(t){return Ni.faces.find(e=>e.file===t)?.slices}async function Qn(t,e,n,r,o=Yn(t),i){return(await eo(t,o,e,n,r,i)).font.slice(0)}async function jd(...t){let[e,n,r,o,i=Yn(e),s]=t;return(await eo(e,i,n,r,o,s)).font}var Dd,Kp,Ni,zd,Yp,Qp,Zp,tm,Nd,Jd=X(()=>{"use strict";Vr();Gr();Td();ki();Qr();Li();Dd=to(en),Kp=to(Sn),Ni=to(Ed),zd=to(Xr),Yp=new Set(zd.faces.map(t=>t.file)),Qp=new Set(Dd.faces.map(t=>t.file)),Zp=new Set(Ni.faces.map(t=>t.file));tm=new Map,Nd=new WeakMap});function Wd(t){let e=globalThis.process;if(typeof e?.getBuiltinModule=="function")try{return e.getBuiltinModule(t)}catch{return}}function xn(t,e,n){return{pack:t,reason:e,detail:`@betteroffice/fonts-${t} ${n}; its faces are substituted`}}function Hd(t,e){let n=[...e].sort();if(!n.length)return;let r=n.length>1?` and ${n.length-1} more files`:"";return xn(t,"missing-file",`is missing ${n[0]}${r}`)}function rm(t,e){let n=Wd("node:fs"),r=Wd("node:url");if(e.protocol!=="file:"||!n||!r)return;let o=a=>r.fileURLToPath(new URL(a,e).href),i=a=>a.filter(c=>!n.statSync(o(c),{throwIfNoEntry:!1})?.isFile()),s;try{s=n.readFileSync(o("manifest.json"),"utf8")}catch(a){return a.code==="ENOENT"?Hd(t,[...i(io[t]),"manifest.json"])??null:xn(t,"invalid-manifest","has an unreadable manifest")}let d;try{d=JSON.parse(s)?.version}catch{return xn(t,"invalid-manifest","has an unreadable manifest")}return d!==Di?xn(t,"version-mismatch",`${typeof d=="string"?d:"of unknown version"} does not match the ${Di} release the engine needs`):Hd(t,i(io[t]))??null}async function $d(t,e=!0){let n=[];for(let r of["latin","intl","cjk"]){let o;try{o=await t[r]()}catch{n.push(xn(r,"invalid-manifest","has an unreadable manifest"));continue}if(!o)continue;let i=io[r].filter(a=>a in o),s=i[0]??Object.keys(o)[0],d=!e||s===void 0?void 0:rm(r,o[s]());if(d!==void 0){d&&n.push(d);continue}i.length<io[r].length&&n.push(xn(r,"version-mismatch",`of unknown version does not match the ${Di} release the engine needs`))}return n}var io,Di,Gd=X(()=>{"use strict";Gr();Vr();Pn();io={latin:en.faces.map(t=>t.file),intl:Sn.faces.map(({file:t})=>t),cjk:at.filter(t=>t.script?.startsWith("cjk-")).map(t=>t.file)},Di=en.version});function Qe(t){return t instanceof Error&&t.diagnostic?.reason==="cdn-unavailable"}function Pt({diagnostic:t}){typeof globalThis.dispatchEvent=="function"&&typeof CustomEvent=="function"&&globalThis.dispatchEvent(new CustomEvent("betteroffice:font-pack-diagnostic",{detail:{...t}}))}var vn=X(()=>{});function zi(t,e){let n=typeof t=="string"?t:t.href,r=n.endsWith("/")?n:`${n}/`;try{return new URL(r,e)}catch{throw new TypeError(`Font baseUrl must be absolute when no browser location exists: ${r}`)}}function Yd(t,{inspectDisk:e=!0,pageLocation:n,localCdn:r}={}){let o=new Set(at.filter(y=>y.script?.startsWith("cjk-")).map(y=>y.file)),i=new Set(at.filter(y=>y.file.endsWith(".ttf.zst")&&!Kn(y.file)).map(y=>y.file)),s=new WeakMap,d=new Set;function a(y,f,h,_){if(!_?.baseUrl||h==="base")return;let J=Yn(y);if(!J.faces.some(F=>F.file===y.file))return;let E=cd(J,f,_.implicit?void 0:_.baseUrl);return s.set(E,_.implicit?dd(h):_.timeoutMs),E}function c(y){return s.get(y)}function l(y){let f=c(y);return typeof f=="number"?f:void 0}function m(y){if(y!==void 0){if(!n)return zi(y,globalThis.location?.href);try{return zi(y,void 0)}catch{let f=n().then(h=>zi(y,h));return f.catch(()=>{}),f}}}async function b(y,f,h=!1){let{file:_,script:J}=y;if(f!==void 0)return new URL(_,f);let E=no(_)?"base":Kn(_)?"latin":i.has(_)?"intl":J?.startsWith("cjk-")||o.has(_)?"cjk":void 0;if(E){let{urls:F,cdn:z}=await t(E),H=F?.[_];if(H)return H();let ne=a(y,_,E,h&&z?.implicit?void 0:z);if(ne)return ne;if(E==="latin"&&!F)throw new nn(`Bundled font ${_} needs @betteroffice/fonts-latin - install @betteroffice/fonts-latin`);if(E==="intl"&&!F)throw new so(`Bundled font ${_} needs the optional intl add-on - install @betteroffice/fonts-intl`);if(E==="cjk")throw new Zn(F?`Bundled font ${_} needs a compressed @betteroffice/fonts-cjk release matching @betteroffice/fonts`:`Bundled font ${_} needs the optional CJK add-on \u2014 install @betteroffice/fonts-cjk`)}throw new Error(`Unknown bundled font asset: ${_}`)}function R(y,f,{urls:h,cdn:_}){let J=h?.[f];if(J)return J();let E=a(y,f,"cjk",_);if(E)return E;throw new Zn(h?`Font slice ${f} needs a @betteroffice/fonts-cjk release matching @betteroffice/fonts`:`Font slice ${f} needs the optional CJK add-on \u2014 install @betteroffice/fonts-cjk`)}function v(y,f,h){let _=oo(y.file);if(!_)return;let J=f instanceof URL?f:void 0,E=F=>F&&new URL("decoder/fontpack.wasm",F);return{ref:_,base:J?.href??"",url:async F=>{let z=f instanceof Promise?await f:f;return z?new URL(F,z):R(y,F,await t("cjk"))},prepareUrls:J?void 0:async()=>{if(f instanceof Promise){let ne=await f;return{base:ne.href,url:async se=>new URL(se,ne),decode:ro(E(ne),h?.decoder)}}let F=await t("cjk"),z=r?{urls:F.urls,cdn:r()}:F,H=R(y,_.index,z);return{base:typeof c(H)=="object"?`${H.href}#implicit`:H.href,url:Object.assign(async ne=>ne===_.index?H:R(y,ne,z),{implicitCdn:ne=>z.cdn?.implicit===!0&&!z.urls?.[ne]}),timeoutMs:l(H)}},loadWholeForExport:()=>q(y,Qn,f,{...h,strict:!0}),requestTimeoutMs:l,decode:f instanceof Promise?async(F,z)=>ro(E(await f),h?.decoder)(F,z):ro(E(J),h?.decoder),decoder:h?.decoder,retain:h?.retain}}async function P(y){try{let f=await b(y,void 0);return typeof c(f)!="object"||!d.has(f.href)}catch(f){if(f instanceof nn)return!1;throw f}}function C(y){return y?.[Kd]===!0}async function T(y,f){let h=async _=>{let J=await b(_,void 0);if(typeof c(J)!="object")return;let E=f&&oo(_.file);return ld(J,E?new URL(E.index,J):void 0)};try{let _=Yn(y).faces.find(({file:F})=>F===y.file)?.dict,J=await h(y),E=_?await h({...y,file:_}):void 0;return Math.max(J??0,E??0)||void 0}catch(_){if(C(_))return 1/0;throw _}}function j(y,f,h){return q(y,Qn,m(f?.baseUrl),h)}async function q(y,f,h,_,J=!1,E){let F=h instanceof Promise?await h:h,z=_?.strict==="except-optional-cdn-failure",H,ne=async se=>{let ce=await b(se,F,J),me=typeof c(ce)=="object";z&&me&&se===y&&(H=ce.href);let ee=_?.strict&&me&&oo(se.file);return ee&&$r(new URL(ee.index,ce)),ce};try{let se=await(no(y.file)||Kn(y.file)||i.has(y.file)||o.has(y.file)?f(y,ne,c,F===void 0?void 0:new URL("decoder/fontpack.wasm",F),void 0,_):ne(y).then(ce=>Rd(y,ce,l(ce))));return H&&d.delete(H),se}catch(se){if(F!==void 0)throw se;if(Qe(se)){let ce=se.diagnostic.pack!=="latin";if(_?.strict&&!(z&&ce))throw se;Pt(se),E?.();let me=await D(y,f,_,ce);return H&&ce&&d.add(H),me}if(_?.strict===!0)throw se;if(se instanceof Zn||se instanceof so)return D(y,f,_,!0);throw se}}async function D(y,f,h,_){let J=y.weight>=600;if(_){let F=Ye(y.family.includes("Serif")?"Times New Roman":"Arial",J,y.style==="italic");try{return await q(F,f,void 0,h,!0)}catch(z){if(!(z instanceof nn))throw z}}let E=qt.find(({weight:F,style:z})=>F===700===J&&z===y.style);return q(E,f,void 0,h)}let A=new Map,U=new WeakMap;function L(y,f,h,_){if(typeof document>"u"||typeof FontFace>"u"||document.fonts===void 0)return Promise.resolve();let J=f??y.family,E=A;_?.decoder!==void 0&&(E=U.get(_.decoder)??new Map,U.set(_.decoder,E));let F=`${J}|${y.weight}|${y.style}|${Dt()}`,z=E.get(F);if(z)return z;let H=!1,ne=()=>{E.get(F)===se&&E.delete(F)},se=(async()=>{let ce=await q(y,Qn,m(h?.baseUrl),_,!1,()=>{H=!0}),me=new FontFace(J,ce,{weight:String(y.weight),style:y.style});await me.load(),document.fonts.add(me)})();return se.then(()=>{H&&ne()},ne),E.set(F,se),se}function x(y,f){let h=m(y?.baseUrl),_=vd(J=>q(J,Qn,h,f),J=>q(J,jd,h,f),J=>v(J,h,f));return h===void 0&&(_.faceUnavailableUntil=J=>T(J,!!f?.strict)),_}let k=async(y,{codec:f,dict:h,maxOutput:_})=>{let J=await Promise.resolve().then(()=>(Oi(),Bi));try{return await J.decodeFontFace(y,h,{codec:f,maxOutput:_})}finally{J.releaseFontDecoder()}};async function g(){let y=async f=>(await t(f)).urls;return $d({latin:()=>y("latin"),intl:()=>y("intl"),cjk:()=>y("cjk")},e)}return{bundledFaceInstalled:P,isMissingFontAddon:C,loadBundledFontBytes:j,registerBundledFontFace:L,createFontProvider:x,decodeFontFaceOutsideEngine:k,checkFontPacks:g}}var Kd,Vd,Xd,nn,Zn,so,Qd=X(()=>{"use strict";Pn();_d();Qr();Jd();Gd();vn();Wn();Kd=Symbol.for("@betteroffice/fonts/missing-addon"),nn=class extends(Xd=Error,Vd=Kd,Xd){constructor(n){super(n);this[Vd]=!0;this.name="MissingFontAddonError"}},Zn=class extends nn{},so=class extends nn{}});var qi={};St(qi,{BASE_LATIN_FAMILY:()=>Fi,BASE_LATIN_FONTS:()=>qt,BUNDLED_FONTS:()=>at,WORD_FAMILY_ALIASES:()=>pd,bundledFaceInstalled:()=>im,checkFontPacks:()=>fm,configureFontCdn:()=>fd,createFontProvider:()=>lm,decodeFontFaceOutsideEngine:()=>cm,fontCdnConfiguration:()=>ud,isMissingFontAddon:()=>sm,loadBundledFontBytes:()=>am,maxDigitWidth:()=>Mp,registerBundledFontFace:()=>dm,resolveBundledFamilyFace:()=>Ri,resolveDigitAdvance:()=>bd,resolveGlyphFallbackFace:()=>Ii,resolveLastResortChoice:()=>Kr,resolveLastResortFace:()=>yd,resolveLightVariantFace:()=>Ei,resolveMetricCompatFace:()=>Ye,resolveMetricCompatFamily:()=>Hn,resolveScriptFallbackFace:()=>Ti});var om,im,sm,am,dm,lm,cm,fm,Zd=X(()=>{Wn();Qd();Vn();Wn();Pn();om=async t=>{let e=await Ft(t);return{urls:e?.urls&&Object.setPrototypeOf(Object.fromEntries(Object.entries(e.urls).map(([n,r])=>[n,()=>new URL(r)])),null),cdn:Dr(e)}},{bundledFaceInstalled:im,isMissingFontAddon:sm,loadBundledFontBytes:am,registerBundledFontFace:dm,createFontProvider:lm,decodeFontFaceOutsideEngine:cm,checkFontPacks:fm}=Yd(om,{inspectDisk:!1,pageLocation:async()=>(await Ft("base",{fresh:!0}))?.pageUrl})});async function ao(t,e,n){if(e.protocol!=="data:")return $n(t,e,n);let r=e.href.indexOf(",");if(r<0)throw new Error(`Malformed data: URL for bundled font ${t}`);let o=decodeURIComponent(e.href.slice(r+1));if(!/;base64$/i.test(e.href.slice(0,r)))return new TextEncoder().encode(o).buffer;let i=atob(o),s=new Uint8Array(i.length);for(let d=0;d<i.length;d+=1)s[d]=i.charCodeAt(d);return s.buffer}var ji=X(()=>{"use strict";Qr()});function Hi(t,e,n){return t+e<=n}function nl(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.byteLength<32||e.getUint32(0)!==1112494923||e.getUint16(4)!==1)throw new Error(el);let n=e.getUint32(8),r=e.getUint32(12),o=e.getUint32(16),i=e.getUint32(20),s=e.getUint32(24),d=e.getUint32(28),a=32+n*2,c=a+d*12;if(s>t.byteLength||c!==t.byteLength-s||n>65535||!Hi(r,16,s)||!Hi(o,0,s)||!Hi(i,12,s))throw new Error(el);let l=t.subarray(c);return{numGlyphs:n,chunkOfGlyph(m){if(!Number.isInteger(m)||m<0||m>=n)return;let b=e.getUint16(32+m*2);return b===um?void 0:b},chunkOfCodepoint(m){let b=0,R=d;for(;b<R;){let v=b+R>>>1,P=a+v*12,C=e.getUint32(P);if(m<C)R=v;else if(m-C>=e.getUint32(P+4))b=v+1;else return e.getUint16(P+8)}},reassemble(m){let b=0;for(let q=0;q<n;q+=1)b+=(m.get(q)??Ji).byteLength;let R=3+(n+1)*4+b,v=l.byteLength+R,P=new Uint8Array(v+(4-v%4)%4);P.set(l);let C=new DataView(P.buffer),T=l.byteLength;C.setUint16(T,n),C.setUint8(T+2,4),T+=3;let j=1;C.setUint32(T,j),T+=4;for(let q=0;q<n;q+=1)j+=(m.get(q)??Ji).byteLength,C.setUint32(T,j),T+=4;for(let q=0;q<n;q+=1){let D=m.get(q)??Ji;P.set(D,T),T+=D.byteLength}return C.setUint32(r+4,tl(P,o,v)),C.setUint32(r+12,v-o),C.setUint32(i+8,0),C.setUint32(i+8,2981146554-tl(P,0,P.byteLength)>>>0),P.buffer}}}function rl(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.byteLength<4)throw new Error(Wi);let n=e.getUint32(0),r=[],o=4;for(let i=0;i<n;i+=1){if(o+8>t.byteLength)throw new Error(Wi);let s=e.getUint32(o),d=e.getUint32(o+4),a=o+8+d;if(a>t.byteLength)throw new Error(Wi);r.push([s,t.subarray(o+8,a)]),o=a}if(o!==t.byteLength)throw new Error("Malformed font slice chunk");return r}function tl(t,e,n){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),o=0,i=e;for(;i+4<=n;i+=4)o=o+r.getUint32(i)>>>0;if(i<n){let s=0;for(let d=24;i<n;i+=1,d-=8)s|=t[i]<<d;o=o+(s>>>0)>>>0}return o}function gm(){if(lo===void 0){lo="";for(let t=32;t<131072;t+=1){let e=String.fromCodePoint(t);ol.test(e)&&(lo+=e)}}return lo}function ym(t){let e=t.normalize("NFC");for(let n of t.normalize("NFD").match(pm)??[]){let[r,...o]=[...n];for(let i=1;i<1<<Math.min(o.length,mm);i+=1)e+=`${r}${o.filter((s,d)=>i&1<<d).join("")}`.normalize("NFC")}return e}function co(t,e){let n=[],r=hm.test(t)&&ol.test(t)?gm():"";for(let o of`${t}${ym(t)}${r}`){let i=e(o.codePointAt(0));if(i!==void 0){n.push(i);continue}for(let s of o.normalize("NFD")){let d=e(s.codePointAt(0));d!==void 0&&n.push(d)}}return n}var Ji,el,Wi,um,pm,mm,hm,ol,lo,il=X(()=>{"use strict";Ji=new Uint8Array([14]),el="Not a supported font slice skeleton",Wi="Truncated font slice chunk",um=65535;pm=/\P{M}\p{M}+/gu,mm=8,hm=/[\u0590-\u08ff\u200f\u202b\u202e\u2067\ufb1d-\ufdff\ufe70-\ufeff\u{10800}-\u{10fff}\u{1e800}-\u{1efff}]/u,ol=/\p{Bidi_Mirrored}/u});function ll(t){let e=dl.get(t),n=e?.[2].url;if(!e||!n)return;let[r,o,{timeoutMs:i}]=e,s=sl.get(t);return s===void 0&&(s=(async()=>{let d={},a=[];for(let{file:c}of[{file:r.index},o.skeleton,o.core,...o.chunks])d[c]=Ad((await n(c)).href),n.implicitCdn?.(c)&&a.push(c);return{ref:r,urls:d,...i===void 0?{}:{timeoutMs:i},...a.length===0?{}:{implicitCdnFiles:a}}})(),sl.set(t,s)),s}async function cl(t,e,n,r){if(!t.url?.implicitCdn?.(e))return n(await t.read(e));let o=await t.url(e);return _i(e,o,"cjk",(i,s)=>s(()=>n(i)),r&&(()=>r(o)))}async function al(t){try{return await t}catch(e){throw Qe(e)&&Pt(e),e}}function fo(t,e){return cl(t,e.file,async n=>{if(n.byteLength!==e.encodedLength)throw new Error(`Font slice ${e.file} has ${n.byteLength} encoded bytes; expected ${e.encodedLength}`);let r=await t.decode(n,e.byteLength);if(r.byteLength!==e.byteLength)throw new Error(`Font slice ${e.file} has ${r.byteLength} bytes; expected ${e.byteLength}`);if(await Gn(r)!==e.sha256)throw new Error(`Font slice ${e.file} SHA-256 mismatch`);return new Uint8Array(r)})}async function uo(t,e){if(t.format!==1)throw new Error(`Unsupported font slice format ${t.format}`);let n=await al(cl(e,t.index,async D=>{if(await Gn(D)!==t.indexSha256)throw new Error(`Font slice index ${t.index} SHA-256 mismatch`);let A=JSON.parse(new TextDecoder().decode(D));if(A.format!==1)throw new Error(`Unsupported font slice index format in ${t.index}`);return A},$r)),r=fo(e,n.skeleton),o=e.url?.implicitCdn?.(n.skeleton.file)||e.url?.implicitCdn?.(n.core.file),[i,s]=await al(Promise.all([r,o?r.then(()=>fo(e,n.core)):fo(e,n.core)])),d=nl(i),a=new Map(n.chunks.map(D=>[D.id,D])),c=new Map,l=new Set([0]),m=new Map,b=new Set,R=1,v=!1,P=D=>{for(let[A,U]of rl(D))c.set(A,U)};P(s);let C=D=>{if(l.has(D))return Promise.resolve();let A=m.get(D);if(A===void 0){let U=a.get(D);if(U===void 0)return Promise.reject(new Error(`Unknown font slice chunk ${D}`));A=fo(e,U).then(L=>{P(L),l.add(D),m.delete(D),v=!0},L=>{throw m.delete(D),L}),m.set(D,A)}return A},T=()=>{if(!v)return R;v=!1,R+=1;for(let D of[...b])try{D(R)}catch{}return R},j=async D=>{let A=[...new Set(D)].filter(k=>!l.has(k));if(A.length===0)return T();let L=(await Promise.allSettled(A.map(C))).find(k=>k.status==="rejected"),x=T();if(L?.status==="rejected")throw Qe(L.reason)&&Pt(L.reason),L.reason;return x},q={get revision(){return R},bytes(){return d.reassemble(c)},ensureGlyphs(D){let A=[];for(let U of D){let L=d.chunkOfGlyph(U);L!==void 0&&A.push(L)}return j(A)},prefetch(D){j(co(D,d.chunkOfCodepoint)).catch(()=>{})},ensureText(D){return j(co(D,d.chunkOfCodepoint))},chunksOf:D=>co(D,d.chunkOfCodepoint),loadedChunks:()=>l,onUpdate(D){return b.add(D),()=>{b.delete(D)}},complete(){return l.size===a.size+1}};return dl.set(q,[t,n,e]),q}var dl,sl,$i=X(()=>{"use strict";Vn();il();Li();Wn();vn();dl=new WeakMap,sl=new WeakMap});var Gi={};St(Gi,{openProgressiveFace:()=>uo,openSlicedFace:()=>wm,readFontAsset:()=>ao,sliceSourceOf:()=>ll});function wm(t){return t.prepareUrls?t.prepareUrls().then(e=>ul({...t,...e})):ul(t)}function ul(t){let{ref:e,base:n,url:r,timeoutMs:o,requestTimeoutMs:i,decode:s,decoder:d,retain:a}=t,c=bm;d!==void 0&&(c=fl.get(d)??new Map,fl.set(d,c));let l=`${e.indexSha256}|${n}|${o??""}`,m=c.get(l);if(m===void 0){m=(async()=>{let v=await r(e.index),P=i?i(v):o;return uo(e,{read:async C=>{let T=C===e.index?v:await r(C);return ao(C,T,i?i(T):o)},url:r,timeoutMs:P,decode:s})})(),c.set(l,m);let b=m,R=()=>{c.get(l)===b&&c.delete(l)};m.then(a===!1?R:void 0,R)}return m}var bm,fl,pl=X(()=>{"use strict";ji();$i();ji();$i();bm=new Map,fl=new WeakMap});async function ml(t){if(!(await Ft("base"))?.urls)throw new yn(t)}async function Lt(){return await ml("@betteroffice/fonts"),qi}async function Vi(){return await ml("@betteroffice/fonts/progressive"),Gi}var _n=X(()=>{Nt();Zd();pl();Vn()});function Ki(t,e,n,r){let o=Ze(t,p.__wbindgen_malloc),i=Y,s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y;var a=et(n)?0:Ze(n,p.__wbindgen_malloc),c=Y;let l=p.decodeFontFace(o,i,s,d,a,c,!et(r),et(r)?0:r);if(l[2])throw V(l[1]);return V(l[0])}function Yi(t){let e=Ze(t,p.__wbindgen_malloc),n=Y,r=p.decodeTiffPng(e,n);if(r[3])throw V(r[2]);var o=xt(r[0],r[1]).slice();return p.__wbindgen_free(r[0],r[1]*1,1),o}function Qi(t){let e,n;try{let i=Ze(t,p.__wbindgen_malloc),s=Y,d=p.parsePptxJson(i,s);var r=d[0],o=d[1];if(d[3])throw r=0,o=0,V(d[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}function Zi(t){let e,n;try{let i=Ze(t,p.__wbindgen_malloc),s=Y,d=p.parsePptxJsonWithoutMedia(i,s);var r=d[0],o=d[1];if(d[3])throw r=0,o=0,V(d[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}function Sm(){return{__proto__:null,"./pptx_wasm_bg.js":{__proto__:null,__wbg_Error_30c8987f7c2ed4e2:function(e,n){return Error(Q(e,n))},__wbg___wbindgen_is_function_1f9d30630b8b1d3d:function(e){return typeof e=="function"},__wbg___wbindgen_is_undefined_8865fb403f8fe9d8:function(e){return e===void 0},__wbg___wbindgen_number_get_2e0e7dee9f701a71:function(e,n){let r=n,o=typeof r=="number"?r:void 0;po().setFloat64(e+8,et(o)?0:o,!0),po().setInt32(e+0,!et(o),!0)},__wbg___wbindgen_string_get_0380ccaa2f57f0d9:function(e,n){let r=n,o=typeof r=="string"?r:void 0;var i=et(o)?0:re(o,p.__wbindgen_malloc,p.__wbindgen_realloc),s=Y;po().setInt32(e+4,s,!0),po().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,n){throw new Error(Q(e,n))},__wbg_call_6137034ef55c9d0f:function(){return mo(function(e,n){return e.call(n)},arguments)},__wbg_getRandomValues_a608c4436c19407a:function(){return mo(function(e,n){globalThis.crypto.getRandomValues(xt(e,n))},arguments)},__wbg_get_31af05bd4842a84f:function(){return mo(function(e,n){return Reflect.get(e,n)},arguments)},__wbg_new_343a093a3c2ffb4e:function(e,n){return new Error(Q(e,n))},__wbg_new_617a8cdb8bb1130e:function(){return new Object},__wbg_new_from_slice_9a868026ffa4208a:function(e,n){return new Uint8Array(xt(e,n))},__wbg_now_68a0bbb746d42d4e:function(){return performance.now()},__wbg_now_a11c1f81480929eb:function(){return performance.now()},__wbg_now_aa4ccb83129e9e55:function(){return Date.now()},__wbg_random_5a4cafd2f02395ff:function(){return Math.random()},__wbg_set_145a351398b48c65:function(){return mo(function(e,n,r){return Reflect.set(e,n,r)},arguments)},__wbg_set_name_2c630595dc90a7aa:function(e,n,r){e.name=Q(n,r)},__wbg_static_accessor_GLOBAL_266715b9d96ba635:function(){let e=typeof global>"u"?null:global;return et(e)?0:er(e)},__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179:function(){let e=typeof globalThis>"u"?null:globalThis;return et(e)?0:er(e)},__wbg_static_accessor_SELF_0b583911f537483a:function(){let e=typeof self>"u"?null:self;return et(e)?0:er(e)},__wbg_static_accessor_WINDOW_d7f903d1508cbdc4:function(){let e=typeof window>"u"?null:window;return et(e)?0:er(e)},__wbindgen_generic_0000000000000001:function(e,n){return Q(e,n)},__wbindgen_init_externref_table:function(){let e=p.__wbindgen_externrefs,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)}}}}function er(t){let e=p.__externref_table_alloc();return p.__wbindgen_externrefs.set(e,t),e}function pt(t,e){if(!(t instanceof e))throw new Error(`expected instance of ${e.name}`)}function xt(t,e){return t=t>>>0,kn().subarray(t/1,t/1+e)}function po(){return(rn===null||rn.buffer.detached===!0||rn.buffer.detached===void 0&&rn.buffer!==p.memory.buffer)&&(rn=new DataView(p.memory.buffer)),rn}function Q(t,e){return xm(t>>>0,e)}function kn(){return(tr===null||tr.byteLength===0)&&(tr=new Uint8Array(p.memory.buffer)),tr}function mo(t,e){try{return t.apply(this,e)}catch(n){let r=er(n);p.__wbindgen_exn_store(r)}}function et(t){return t==null}function Ze(t,e){let n=e(t.length*1,1)>>>0;return kn().set(t,n/1),Y=t.length,n}function re(t,e,n){if(n===void 0){let d=nr.encode(t),a=e(d.length,1)>>>0;return kn().subarray(a,a+d.length).set(d),Y=d.length,a}let r=t.length,o=e(r,1)>>>0,i=kn(),s=0;for(;s<r;s++){let d=t.charCodeAt(s);if(d>127)break;i[o+s]=d}if(s!==r){s!==0&&(t=t.slice(s)),o=n(o,r,r=s+t.length*3,1)>>>0;let d=kn().subarray(o+s,o+r),a=nr.encodeInto(t,d);s+=a.written,o=n(o,r,s,1)>>>0}return Y=s,o}function V(t){let e=p.__wbindgen_externrefs.get(t);return p.__externref_table_dealloc(t),e}function xm(t,e){return Xi+=e,Xi>=Pm&&(ho=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),ho.decode(),Xi=e),ho.decode(kn().subarray(t,t+e))}function km(t,e){return _m=t,p=t.exports,vm=e,rn=null,tr=null,p.__wbindgen_start(),p}async function Cm(t,e){if(typeof Response=="function"&&t instanceof Response){if(!t.ok)throw new Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(o){if(n(t.type)&&t.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",o);else throw o}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function es(t){if(p!==void 0)return p;if(t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0)throw new Error("pptx-wasm requires an explicit module or URL");let e=Sm();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await Cm(await t,e);return km(n,r)}var Me,vt,hl,gl,rn,tr,ho,Pm,Xi,nr,Y,vm,_m,p,yl=X(()=>{"use strict";Me=class t{static __wrap(e){let n=Object.create(t.prototype);return n.__wbg_ptr=e,hl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,hl.unregister(this),e}free(){let e=this.__destroy_into_raw();p.__wbg_pptxdocument_free(e,0)}acceptProposalJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_acceptProposalJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}addCommentJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_addCommentJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}addPictureJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_addPictureJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}addShapeJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_addShapeJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}addTextBoxJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_addTextBoxJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}addTextBoxProfiledJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_addTextBoxProfiledJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}addUndoBoundary(){p.pptxdocument_addUndoBoundary(this.__wbg_ptr)}adoptPeerIdentity(){let e=p.pptxdocument_adoptPeerIdentity(this.__wbg_ptr);if(e[1])throw V(e[0])}anchorCaretJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_anchorCaretJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}applyEditsJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_applyEditsJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}applyUpdateJson(e){let n,r;try{let s=Ze(e,p.__wbindgen_malloc),d=Y,a=p.pptxdocument_applyUpdateJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}bringShapeForwardJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_bringShapeForwardJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}bringShapeToFrontJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_bringShapeToFrontJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}canRedo(){return p.pptxdocument_canRedo(this.__wbg_ptr)!==0}canUndo(){return p.pptxdocument_canUndo(this.__wbg_ptr)!==0}checkTableEditJson(e){let n=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),r=Y,o=p.pptxdocument_checkTableEditJson(this.__wbg_ptr,n,r);if(o[1])throw V(o[0])}clearUpdateObservation(){p.pptxdocument_clearUpdateObservation(this.__wbg_ptr)}get clientId(){return p.pptxdocument_clientId(this.__wbg_ptr)}commentsJson(){let e,n;try{let i=p.pptxdocument_commentsJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}deleteSlideJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_deleteSlideJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}deleteTableColumnJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_deleteTableColumnJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}deleteTableRowJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_deleteTableRowJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}deleteTextJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_deleteTextJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}deleteTextProfiledJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_deleteTextProfiledJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}documentVersion(){let e,n;try{let r=p.pptxdocument_documentVersion(this.__wbg_ptr);return e=r[0],n=r[1],Q(r[0],r[1])}finally{p.__wbindgen_free(e,n,1)}}drainUpdateEvent(){let e=p.pptxdocument_drainUpdateEvent(this.__wbg_ptr);var n=xt(e[0],e[1]).slice();return p.__wbindgen_free(e[0],e[1]*1,1),n}duplicateSlideJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_duplicateSlideJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}encodeDiff(e){let n=Ze(e,p.__wbindgen_malloc),r=Y,o=p.pptxdocument_encodeDiff(this.__wbg_ptr,n,r);if(o[3])throw V(o[2]);var i=xt(o[0],o[1]).slice();return p.__wbindgen_free(o[0],o[1]*1,1),i}encodeStateAsUpdate(){let e=p.pptxdocument_encodeStateAsUpdate(this.__wbg_ptr);var n=xt(e[0],e[1]).slice();return p.__wbindgen_free(e[0],e[1]*1,1),n}encodeStateVector(){let e=p.pptxdocument_encodeStateVector(this.__wbg_ptr);var n=xt(e[0],e[1]).slice();return p.__wbindgen_free(e[0],e[1]*1,1),n}exportMarkdownJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_exportMarkdownJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}exportStructuredJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_exportStructuredJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}findTextJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_findTextJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}formatTextJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_formatTextJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertParagraphBreakJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertParagraphBreakJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertSlideJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertSlideJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertSlideProfiledJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertSlideProfiledJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertTableColumnJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertTableColumnJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertTableRowJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertTableRowJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertTextJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertTextJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}insertTextProfiledJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_insertTextProfiledJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}listProposalsJson(){let e,n;try{let i=p.pptxdocument_listProposalsJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}mediaBytes(e){let n=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),r=Y,o=p.pptxdocument_mediaBytes(this.__wbg_ptr,n,r);if(o[3])throw V(o[2]);var i=xt(o[0],o[1]).slice();return p.__wbindgen_free(o[0],o[1]*1,1),i}metafileSvg(e){let n=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),r=Y,o=p.pptxdocument_metafileSvg(this.__wbg_ptr,n,r),i;return o[0]!==0&&(i=xt(o[0],o[1]).slice(),p.__wbindgen_free(o[0],o[1]*1,1)),i}moveShapeJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_moveShapeJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}moveShapeProfiledJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_moveShapeProfiledJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}moveSlideJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_moveSlideJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}static openCollaborativeFromUpdate(e,n,r){let o=Ze(e,p.__wbindgen_malloc),i=Y;var s=et(r)?0:Ze(r,p.__wbindgen_malloc),d=Y;let a=p.pptxdocument_openCollaborativeFromUpdate(o,i,n,s,d);if(a[2])throw V(a[1]);return t.__wrap(a[0])}static openCollaborative(e,n){let r=Ze(e,p.__wbindgen_malloc),o=Y,i=p.pptxdocument_openCollaborative(r,o,n);if(i[2])throw V(i[1]);return t.__wrap(i[0])}static openPeerDeckJson(e,n,r){let o=Ze(e,p.__wbindgen_malloc),i=Y,s=re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y;var a=et(r)?0:Ze(r,p.__wbindgen_malloc),c=Y;let l=p.pptxdocument_openPeerDeckJson(o,i,s,d,a,c);if(l[2])throw V(l[1]);return t.__wrap(l[0])}static openReplayBaseline(e,n,r){let o=Ze(e,p.__wbindgen_malloc),i=Y;var s=et(r)?0:Ze(r,p.__wbindgen_malloc),d=Y;let a=p.pptxdocument_openReplayBaseline(o,i,!et(n),et(n)?0:n,s,d);if(a[2])throw V(a[1]);return t.__wrap(a[0])}peerHydrationJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_peerHydrationJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}previewProposalJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_previewProposalJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}proposalSlideStripJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_proposalSlideStripJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}proposeJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_proposeJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}readCommandContentJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_readCommandContentJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}readContentJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_readContentJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}redoJson(){let e,n;try{let i=p.pptxdocument_redoJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}redoReceiptJson(){let e,n;try{let i=p.pptxdocument_redoReceiptJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}registerPeerFontsJson(e){let n=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),r=Y,o=p.pptxdocument_registerPeerFontsJson(this.__wbg_ptr,n,r);if(o[1])throw V(o[0])}rejectProposalJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_rejectProposalJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}removeCommentJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_removeCommentJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}removeShapeJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_removeShapeJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}replayJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_replayJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}replyToCommentJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_replyToCommentJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}resizeShapeJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_resizeShapeJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}resolveCaretAnchorJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_resolveCaretAnchorJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}saveBytes(){let e=p.pptxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw V(e[2]);var n=xt(e[0],e[1]).slice();return p.__wbindgen_free(e[0],e[1]*1,1),n}searchTextJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_searchTextJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}sendShapeBackwardJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_sendShapeBackwardJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}sendShapeToBackJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_sendShapeToBackJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}sessionMetadataJson(){let e,n;try{let i=p.pptxdocument_sessionMetadataJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}setCollaborative(){let e=p.pptxdocument_setCollaborative(this.__wbg_ptr);if(e[1])throw V(e[0])}setCommentFlavorJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setCommentFlavorJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setCommentPositionJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setCommentPositionJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setCommentStatusJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setCommentStatusJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setParagraphAlignmentJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setParagraphAlignmentJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setShapeAdjustJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setShapeAdjustJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setShapeFillJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setShapeFillJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setShapeRectJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setShapeRectJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setShapeStrokeJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setShapeStrokeJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setSlideLayoutJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setSlideLayoutJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setSlideNotesJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setSlideNotesJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setStoryParagraphsJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_setStoryParagraphsJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}setUndoCaptureMode(e){let n=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),r=Y,o=p.pptxdocument_setUndoCaptureMode(this.__wbg_ptr,n,r);if(o[1])throw V(o[0])}snapshotJson(){let e,n;try{let i=p.pptxdocument_snapshotJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}startUpdateObservation(){let e=p.pptxdocument_startUpdateObservation(this.__wbg_ptr);if(e[1])throw V(e[0])}storyFormattingJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_storyFormattingJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}storyJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_storyJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}undoCaptureMode(){let e,n;try{let r=p.pptxdocument_undoCaptureMode(this.__wbg_ptr);return e=r[0],n=r[1],Q(r[0],r[1])}finally{p.__wbindgen_free(e,n,1)}}undoJson(){let e,n;try{let i=p.pptxdocument_undoJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}undoProfiledJson(){let e,n;try{let i=p.pptxdocument_undoProfiledJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}undoReceiptJson(){let e,n;try{let i=p.pptxdocument_undoReceiptJson(this.__wbg_ptr);var r=i[0],o=i[1];if(i[3])throw r=0,o=0,V(i[2]);return e=r,n=o,Q(r,o)}finally{p.__wbindgen_free(e,n,1)}}validateEditsJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_validateEditsJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}validateProposalJson(e){let n,r;try{let s=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y,a=p.pptxdocument_validateProposalJson(this.__wbg_ptr,s,d);var o=a[0],i=a[1];if(a[3])throw o=0,i=0,V(a[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}static version(){let e,n;try{let r=p.pptxdocument_version();return e=r[0],n=r[1],Q(r[0],r[1])}finally{p.__wbindgen_free(e,n,1)}}};Symbol.dispose&&(Me.prototype[Symbol.dispose]=Me.prototype.free);vt=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,gl.unregister(this),e}free(){let e=this.__destroy_into_raw();p.__wbg_pptxrenderer_free(e,0)}exportSlideJson(e,n){let r,o;try{pt(e,Me);let d=p.pptxrenderer_exportSlideJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=d[0],s=d[1];if(d[3])throw i=0,s=0,V(d[2]);return r=i,o=s,Q(i,s)}finally{p.__wbindgen_free(r,o,1)}}hitTestJson(e,n){let r,o;try{let d=p.pptxrenderer_hitTestJson(this.__wbg_ptr,e,n);var i=d[0],s=d[1];if(d[3])throw i=0,s=0,V(d[2]);return r=i,o=s,Q(i,s)}finally{p.__wbindgen_free(r,o,1)}}hitTestSlideJson(e,n,r,o){let i,s;try{pt(e,Me);let c=re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),l=Y,m=p.pptxrenderer_hitTestSlideJson(this.__wbg_ptr,e.__wbg_ptr,c,l,r,o);var d=m[0],a=m[1];if(m[3])throw d=0,a=0,V(m[2]);return i=d,s=a,Q(d,a)}finally{p.__wbindgen_free(i,s,1)}}layoutProposalDiffSlideByIdJson(e,n,r){let o,i;try{pt(e,Me);let a=re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),c=Y,l=re(r,p.__wbindgen_malloc,p.__wbindgen_realloc),m=Y,b=p.pptxrenderer_layoutProposalDiffSlideByIdJson(this.__wbg_ptr,e.__wbg_ptr,a,c,l,m);var s=b[0],d=b[1];if(b[3])throw s=0,d=0,V(b[2]);return o=s,i=d,Q(s,d)}finally{p.__wbindgen_free(o,i,1)}}layoutProposalDiffSlideJson(e,n,r){let o,i;try{pt(e,Me);let a=re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),c=Y,l=p.pptxrenderer_layoutProposalDiffSlideJson(this.__wbg_ptr,e.__wbg_ptr,a,c,r);var s=l[0],d=l[1];if(l[3])throw s=0,d=0,V(l[2]);return o=s,i=d,Q(s,d)}finally{p.__wbindgen_free(o,i,1)}}layoutProposalSlideJson(e,n,r){let o,i;try{pt(e,Me);let a=re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),c=Y,l=p.pptxrenderer_layoutProposalSlideJson(this.__wbg_ptr,e.__wbg_ptr,a,c,r);var s=l[0],d=l[1];if(l[3])throw s=0,d=0,V(l[2]);return o=s,i=d,Q(s,d)}finally{p.__wbindgen_free(o,i,1)}}layoutSlideJson(e,n){let r,o;try{pt(e,Me);let d=p.pptxrenderer_layoutSlideJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=d[0],s=d[1];if(d[3])throw i=0,s=0,V(d[2]);return r=i,o=s,Q(i,s)}finally{p.__wbindgen_free(r,o,1)}}layoutSlideProfiledJson(e,n){let r,o;try{pt(e,Me);let d=p.pptxrenderer_layoutSlideProfiledJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=d[0],s=d[1];if(d[3])throw i=0,s=0,V(d[2]);return r=i,o=s,Q(i,s)}finally{p.__wbindgen_free(r,o,1)}}constructor(){let e=p.pptxrenderer_new();return this.__wbg_ptr=e,gl.register(this,this.__wbg_ptr,this),this}previewShapeRectJson(e,n){let r,o;try{pt(e,Me);let d=p.pptxrenderer_previewShapeRectJson(this.__wbg_ptr,e.__wbg_ptr,n);var i=d[0],s=d[1];if(d[3])throw i=0,s=0,V(d[2]);return r=i,o=s,Q(i,s)}finally{p.__wbindgen_free(r,o,1)}}registerFallbackFont(e,n,r,o){let i=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),s=Y,d=Ze(o,p.__wbindgen_malloc),a=Y,c=p.pptxrenderer_registerFallbackFont(this.__wbg_ptr,i,s,n,r,d,a);if(c[2])throw V(c[1]);return c[0]>>>0}registerFont(e,n,r,o){let i=re(e,p.__wbindgen_malloc,p.__wbindgen_realloc),s=Y,d=Ze(o,p.__wbindgen_malloc),a=Y,c=p.pptxrenderer_registerFont(this.__wbg_ptr,i,s,n,r,d,a);if(c[2])throw V(c[1]);return c[0]>>>0}requestedFontFacesJson(e,n){let r,o;try{pt(e,Me);var i=et(n)?0:re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),s=Y;let c=p.pptxrenderer_requestedFontFacesJson(this.__wbg_ptr,e.__wbg_ptr,i,s);var d=c[0],a=c[1];if(c[3])throw d=0,a=0,V(c[2]);return r=d,o=a,Q(d,a)}finally{p.__wbindgen_free(r,o,1)}}saveBytes(e){pt(e,Me);let n=p.pptxrenderer_saveBytes(this.__wbg_ptr,e.__wbg_ptr);if(n[3])throw V(n[2]);var r=xt(n[0],n[1]).slice();return p.__wbindgen_free(n[0],n[1]*1,1),r}setActiveSlide(e,n,r){pt(e,Me);let o=re(n,p.__wbindgen_malloc,p.__wbindgen_realloc),i=Y,s=re(r,p.__wbindgen_malloc,p.__wbindgen_realloc),d=Y;return p.pptxrenderer_setActiveSlide(this.__wbg_ptr,e.__wbg_ptr,o,i,s,d)!==0}setBrowserCoverageFallback(e){p.pptxrenderer_setBrowserCoverageFallback(this.__wbg_ptr,e)}slideLayoutKey(e,n){let r,o;try{pt(e,Me);let d=p.pptxrenderer_slideLayoutKey(this.__wbg_ptr,e.__wbg_ptr,n);var i=d[0],s=d[1];if(d[3])throw i=0,s=0,V(d[2]);return r=i,o=s,Q(i,s)}finally{p.__wbindgen_free(r,o,1)}}snapshotWithLayoutKeysJson(e){let n,r;try{pt(e,Me);let s=p.pptxrenderer_snapshotWithLayoutKeysJson(this.__wbg_ptr,e.__wbg_ptr);var o=s[0],i=s[1];if(s[3])throw o=0,i=0,V(s[2]);return n=o,r=i,Q(o,i)}finally{p.__wbindgen_free(n,r,1)}}};Symbol.dispose&&(vt.prototype[Symbol.dispose]=vt.prototype.free);hl=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>p.__wbg_pptxdocument_free(t,1)),gl=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>p.__wbg_pptxrenderer_free(t,1));rn=null;tr=null;ho=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ho.decode();Pm=2146435072,Xi=0;nr=new TextEncoder;"encodeInto"in nr||(nr.encodeInto=function(t,e){let n=nr.encode(t);return e.set(n),{read:t.length,written:n.length}});Y=0});var xl={};St(xl,{MetafileConverter:()=>or,default:()=>Bm,initSync:()=>Um});function wl(){return{__proto__:null,"./metafile_svg_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,n){throw new Error(Rm(e,n))},__wbindgen_init_externref_table:function(){let e=rt.__wbindgen_externrefs,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)}}}}function Fm(t,e){return t=t>>>0,ns().subarray(t/1,t/1+e)}function Rm(t,e){return Im(t>>>0,e)}function ns(){return(rr===null||rr.byteLength===0)&&(rr=new Uint8Array(rt.memory.buffer)),rr}function Tm(t,e){let n=e(t.length*1,1)>>>0;return ns().set(t,n/1),Sl=t.length,n}function Im(t,e){return ts+=e,ts>=Em&&(go=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),go.decode(),ts=e),go.decode(ns().subarray(t,t+e))}function Pl(t,e){return Lm=t,rt=t.exports,Am=e,rr=null,rt.__wbindgen_start(),rt}async function Mm(t,e){if(typeof Response=="function"&&t instanceof Response){if(!t.ok)throw new Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(o){if(n(t.type)&&t.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",o);else throw o}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function Um(t){if(rt!==void 0)return rt;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=wl();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return Pl(n,t)}async function Bm(t){if(rt!==void 0)return rt;if(t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0)throw new Error("metafile-svg-wasm requires an explicit module or URL");let e=wl();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await Mm(await t,e);return Pl(n,r)}var or,bl,rr,go,Em,ts,Sl,Am,Lm,rt,vl=X(()=>{"use strict";or=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,bl.unregister(this),e}free(){let e=this.__destroy_into_raw();rt.__wbg_metafileconverter_free(e,0)}constructor(){let e=rt.metafileconverter_new();return this.__wbg_ptr=e,bl.register(this,this.__wbg_ptr,this),this}toSvg(e){let n=Tm(e,rt.__wbindgen_malloc),r=Sl,o=rt.metafileconverter_toSvg(this.__wbg_ptr,n,r),i;return o[0]!==0&&(i=Fm(o[0],o[1]).slice(),rt.__wbindgen_free(o[0],o[1]*1,1)),i}};Symbol.dispose&&(or.prototype[Symbol.dispose]=or.prototype.free);bl=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>rt.__wbg_metafileconverter_free(t,1));rr=null;go=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});go.decode();Em=2146435072,ts=0;Sl=0});function _l(){return Promise.resolve().then(()=>(vl(),xl))}var _t,jt=X(()=>{"use strict";_n();yl();_t="wasm"});function kl(t,e,n,r=()=>!1){let o=e.trim().toLowerCase();for(let i of t)i.family.trim().toLowerCase()===o&&!r(i)&&(i.bytes=n)}var Cl=X(()=>{"use strict"});function ir(t){return(t instanceof Uint8Array?t:new Uint8Array(t)).slice()}function Fl(t){return{font:ir(t.font).buffer,...t.payload===void 0?{}:{payload:ir(t.payload).buffer}}}var Rl=X(()=>{"use strict"});function kt(t){return t.length>=4&&(t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42)}var Cn=X(()=>{});function Tl(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.length<10)return;let n=0,r=0;if(t.length>=24&&e.getUint32(0)===2303741511&&e.getUint32(4)===218765834&&e.getUint32(12)===1229472850)n=e.getUint32(16),r=e.getUint32(20);else if(e.getUint32(0)===1195984440&&[55,57].includes(t[4])&&t[5]===97)n=e.getUint16(6,!0),r=e.getUint16(8,!0);else if(t.length>=26&&e.getUint16(0,!0)===19778)e.getUint32(14,!0)===12?(n=e.getUint16(18,!0),r=e.getUint16(20,!0)):(n=e.getInt32(18,!0),r=Math.abs(e.getInt32(22,!0)));else if(t.length>=20&&e.getUint32(0)===1380533830&&e.getUint32(8)===1464156752){let o=e.getUint32(12);if(o===1448097880&&t.length>=30)n=1+t[24]+(t[25]<<8)+(t[26]<<16),r=1+t[27]+(t[28]<<8)+(t[29]<<16);else if(o===1448097868&&t.length>=25&&t[20]===47){let i=e.getUint32(21,!0);n=1+(i&16383),r=1+(i>>>14&16383)}else o===1448097824&&t.length>=30&&t[23]===157&&t[24]===1&&t[25]===42&&(n=e.getUint16(26,!0)&16383,r=e.getUint16(28,!0)&16383)}else if(e.getUint16(0)===65496){let o=!1;for(let i=2;i+4<=t.length;){if(t[i++]!==255)return;for(;t[i]===255;)i+=1;let s=t[i++];if(s===217||s===218)break;if(s===1||s>=208&&s<=216)continue;if(i+2>t.length)return;let d=e.getUint16(i);if(d<2||i+d>t.length)return;s===225&&(o=o||qm(t.subarray(i+2,i+d))),s>=192&&s<=207&&![196,200,204].includes(s)&&d>=7&&(r=e.getUint16(i+3),n=e.getUint16(i+5)),i+=d}o&&([n,r]=[r,n])}return n>0&&r>0?{width:n,height:r}:void 0}function qm(t){if(t.length<14||![69,120,105,102,0,0].every((i,s)=>t[s]===i))return!1;let e=new DataView(t.buffer,t.byteOffset+6,t.byteLength-6),n=e.getUint16(0)===18761;if(!n&&e.getUint16(0)!==19789||e.getUint16(2,n)!==42)return!1;let r=e.getUint32(4,n);if(r>e.byteLength-2)return!1;let o=e.getUint16(r,n);for(let i=0;i<o;i+=1){let s=r+2+i*12;if(s>e.byteLength-12)return!1;if(e.getUint16(s,n)===274&&e.getUint16(s+2,n)===3&&e.getUint32(s+4,n)===1)return[5,6,7,8].includes(e.getUint16(s+8,n))}return!1}var El=X(()=>{"use strict"});function ar(t){return Ll.get(t)??{x:1,y:1}}function yo(t,e){Ll.set(t,e)}function dr(t){if(kt(t))throw new Error("TIFF images require worker conversion");let e=Nl(t)??Ol(t);return e?new Blob([e],{type:"image/bmp"}):Hm(t)??new Blob([t.slice()])}function lr(t){return t.type===Al}async function Ml(t,e,n={}){let r=dr(t);return os(r,e,n)}async function os(t,e,n={}){let r=n.maxDimension??Wm;if(!Number.isSafeInteger(r)||r<1)throw new Error("invalid image dimension limit");if(typeof createImageBitmap=="function"&&!lr(t)){let i=Tl(new Uint8Array(await t.arrayBuffer()));if(i&&Math.max(i.width,i.height)>r){let d=r/Math.max(i.width,i.height),a=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(i.width*d)),resizeHeight:Math.max(1,Math.floor(i.height*d))});return rs(a,i,r)}let s=await createImageBitmap(t);return rs(s,{width:s.width,height:s.height},r)}let o=URL.createObjectURL(t);try{let i=await new Promise((s,d)=>{let a=new Image;a.onload=()=>s(a),a.onerror=()=>d(new Error(e)),a.src=o});return await rs(i,{width:i.naturalWidth,height:i.naturalHeight},r)}finally{URL.revokeObjectURL(o)}}async function rs(t,e,n){let r="naturalWidth"in t?t.naturalWidth:t.width,o="naturalHeight"in t?t.naturalHeight:t.height,i=t;if(Math.max(r,o)>n){let a=n/Math.max(r,o),c={width:Math.max(1,Math.floor(r*a)),height:Math.max(1,Math.floor(o*a))},l,m;try{typeof OffscreenCanvas=="function"&&(l=new OffscreenCanvas(c.width,c.height),m=l.getContext("2d"))}catch{l=void 0}if(!m&&typeof document<"u")try{l=document.createElement("canvas"),l.width=c.width,l.height=c.height,m=l.getContext("2d")}catch{l=void 0}if(l&&m){m.drawImage(t,0,0,c.width,c.height),"close"in t&&typeof t.close=="function"&&t.close();try{i=typeof createImageBitmap=="function"?await createImageBitmap(l):l}catch{i=l}}}let s="naturalWidth"in i?i.naturalWidth:i.width,d="naturalHeight"in i?i.naturalHeight:i.height;return(e.width!==s||e.height!==d)&&yo(i,{x:e.width/s,y:e.height/d}),i}function Hm(t){if(t.byteLength>Jm)return;let e;try{e=new TextDecoder("utf-8",{fatal:!0}).decode(t).replace(/^\ufeff/,"")}catch{return}if(!(!/^\s*</.test(e)||!e.slice(0,1024).includes("<svg")))return new Blob([$m(e)],{type:Al})}function $m(t){let e=Gm(t);if(!e||/\s(?:width|height)\s*=/.test(t.slice(e.start,e.end)))return t;let n=t.slice(e.start,e.end).match(/\sviewBox\s*=\s*(["'])\s*[-+.\deE]+[\s,]+[-+.\deE]+[\s,]+([-+.\deE]+)[\s,]+([-+.\deE]+)\s*\1/),[r,o]=[Number(n?.[2]),Number(n?.[3])];if(!(r>0)||!(o>0))return t;let i=e.start+4;return`${t.slice(0,i)} width="${r}" height="${o}"${t.slice(i)}`}function Gm(t){let e=0;for(;e<t.length;){if(/\s/.test(t[e]))e+=1;else if(t.startsWith("<!--",e))e=sr(t.indexOf("-->",e+4),3);else if(t.startsWith("<?",e))e=sr(t.indexOf("?>",e+2),2);else if(t.startsWith("<!",e))e=sr(Il(t,e+2),1);else break;if(e<0)return}if(!/^<svg[\s/>]/.test(t.slice(e,e+5)))return;let n=Il(t,e+4);return n<0?void 0:{start:e,end:n}}function sr(t,e){return t<0?-1:t+e}function Il(t,e){let n="",r=!1;for(let o=e;o<t.length;o+=1){let i=t[o];if(n)i===n&&(n="");else if(r&&t.startsWith("<!--",o)){if(o=sr(t.indexOf("-->",o+4),2),o<0)return-1}else if(r&&t.startsWith("<?",o)){if(o=sr(t.indexOf("?>",o+2),1),o<0)return-1}else if(i==='"'||i==="'")n=i;else if(i==="[")r=!0;else if(i==="]")r=!1;else if(i===">"&&!r)return o}return-1}function Mt(t,e){return!e||!Ul(t)&&Bl(t)<0||Nl(t,!0)||Ol(t,!0)?t:e()??new Uint8Array}function Ul(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength);return e.byteLength>=44&&e.getUint32(0,!0)===1&&e.getUint32(40,!0)===1179469088?e:void 0}function Bl(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=e.byteLength>=4&&e.getUint32(0,!0)===2596720087?22:0;return e.byteLength>=n+18&&[1,2].includes(e.getUint16(n,!0))&&e.getUint16(n+2,!0)===9&&e.getUint16(n+4,!0)===768?n:-1}function Ol(t,e){let n=Ul(t);if(!n||n.byteLength<108)return;let r=n.getUint32(4,!0);if(r<88||r%4||r>n.byteLength-8)return;let o=n.getInt32(16,!0)-n.getInt32(8,!0)+1,i=n.getInt32(20,!0)-n.getInt32(12,!0)+1,s=n.getUint32(r+4,!0);if(n.getUint32(r,!0)!==81||s<80||s>n.byteLength-r-8)return;let d=b=>n.getInt32(r+b,!0),a=n.getUint32(r+48,!0),c=n.getUint32(r+56,!0),l=n.getUint32(r+60,!0);if(d(24)!==n.getInt32(8,!0)||d(28)!==n.getInt32(12,!0)||d(72)!==o||d(76)!==i||d(32)!==0||d(36)!==0||d(40)!==o||d(44)!==i||n.getUint32(r+64,!0)!==0||n.getUint32(r+68,!0)!==13369376||a<80||a+n.getUint32(r+52,!0)!==c||c+l!==s)return;let m=r+s;if(!(n.getUint32(m,!0)!==14||n.getUint32(m+4,!0)!==n.byteLength-m))return Dl(t.subarray(r+a,m),o,i,e)}function Nl(t,e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=Bl(t);if(r<0||n.getUint32(r+6,!0)*2!==n.byteLength-r)return;let o=0,i=0,s=0,d=0,a=!1,c;for(let l=r+18;l+6<=n.byteLength;){let m=n.getUint32(l,!0)*2,b=n.getUint16(l+4,!0);if(m<6||m>n.byteLength-l)return;if(b===0)return m===6&&l+m===n.byteLength?c:void 0;if(c)return;if(b===259){if(m<8||n.getUint16(l+6,!0)!==8)return;a=!0}else if(b===263){if(m<8||![1,2,3,4].includes(n.getUint16(l+6,!0)))return}else if(b===523||b===524){if(m!==10)return;let R=n.getInt16(l+6,!0),v=n.getInt16(l+8,!0);if(b===523)o=v,i=R;else{if(!a)return;s=v,d=R}}else if(b===2881){if(m<66||n.getUint32(l+6,!0)!==13369376||n.getInt16(l+14,!0)!==0||n.getInt16(l+16,!0)!==0||n.getInt16(l+18,!0)!==d||n.getInt16(l+20,!0)!==s||n.getInt16(l+22,!0)!==i||n.getInt16(l+24,!0)!==o||!s||!d||(c=Dl(t.subarray(l+26,l+m),n.getInt16(l+12,!0),n.getInt16(l+10,!0),e),!c))return}else return;l+=m}}function Dl(t,e,n,r){if(t.length<40)return;let o=new DataView(t.buffer,t.byteOffset,t.byteLength),i=o.getInt32(4,!0),s=o.getInt32(8,!0),d=o.getUint16(14,!0);if(o.getUint32(0,!0)!==40||i<1||!s||i*Math.abs(s)>jm||e!==i||n!==Math.abs(s)||o.getUint16(12,!0)!==1||![24,32].includes(d)||o.getUint32(16,!0)!==0||o.getUint32(32,!0)!==0)return;let a=Math.ceil(i*d/32)*4*Math.abs(s);if(40+a!==t.length||![0,a].includes(o.getUint32(20,!0)))return;if(r)return t;let c=new Uint8Array(14+t.length),l=new DataView(c.buffer);return l.setUint16(0,19778,!0),l.setUint32(2,c.length,!0),l.setUint32(10,54,!0),c.set(t,14),c}var jm,Al,Jm,Wm,Ll,Jt=X(()=>{"use strict";Cn();El();jm=33554432,Al="image/svg+xml",Jm=4194304,Wm=4096,Ll=new WeakMap});var $e,Fn=X(()=>{"use strict";$e=class extends Error{code;constructor(e,n){super(n),this.name="PngExportError",this.code=e}}});function Vm(){return typeof document<"u"?document.fonts:globalThis.fonts}function wo(t,e){return new $e("font-unavailable",`The font "${t}" could not load, so the ${e} was not exported with a substitute.`)}async function ql(t){let e=new Map;for(let l of t.fonts)e.set(bo(l),l);let n=Vm(),r=new Map,o=new Map,i=new Map,s=[],d=()=>{for(let l of s)n?.delete(l)},a=(zl.get(t.prefix)??0)+1;zl.set(t.prefix,a);let c=async l=>{let m=r.get(l);if(!m){if(!n||typeof FontFace>"u")throw wo(l.family,t.subject);m=`${t.prefix}-${a}-${r.size}`;let b=await new FontFace(m,l.bytes.slice().buffer,{weight:l.face?.bold??l.bold?"700":"400",style:l.face?.italic??l.italic?"italic":"normal"}).load().catch(()=>{throw wo(l.family,t.subject)});n.add(b),s.push(b),r.set(l,m)}return m};try{for(let[l,m]of e){let b=t.choose(t.faces,m);if(!b)continue;let R=await c(b);o.set(l,{family:R,face:b});let v=[R];for(let P of t.fallbacks?.(m)??[]){let C=await c(P);v.includes(C)||v.push(C)}i.set(l,v)}if(n&&typeof n.load=="function")for(let[l,m]of e){let b=o.get(l),R=await n.load(t.canvasFont(m,b?.family??m.family)).catch(()=>{throw wo(m.family,t.subject)});if(b&&!R?.length)throw wo(m.family,t.subject)}return{family:l=>o.get(bo(l))?.family,face:l=>o.get(bo(l))?.face,families:l=>[...i.get(bo(l))??[]],release:d}}catch(l){throw d(),l}}var zl,bo,jl=X(()=>{"use strict";Fn();zl=new Map,bo=t=>JSON.stringify([t.family,t.bold,t.italic,t.id??null])});var $l={};St($l,{fittedPieceDecisions:()=>Ym,paintTextChunks:()=>Xm});function Xm(t,e,n,r){let{chunks:o,fitted:i}=Hl(e);for(let s of o){let d=Wl(s,r,a=>t.measureText(a)?.width,i?Jl:Km);d===1?t.fillText(s.text,s.x,n):(t.save(),t.translate(s.x,n),t.scale(d,1),t.fillText(s.text,0,0),t.restore())}}function Wl(t,e,n,r){let i=Array.from(t.text).some(d=>is(d.codePointAt(0)))||t.width===void 0||e!==0?0:n(t.fitText??t.text),s=i&&i>0?(t.width??0)/i:1;return(Math.abs(s-1)<.001||s<.75||s>r)&&(s=1),s}function Ym(t,e){let{chunks:n,fitted:r}=Hl(t);return r?n.map(o=>({start:o.start,scale:Wl(o,t.letterSpacingPx??0,e,Jl)})):null}function Qm(t){let e=Math.fround;return{...t,x:e(t.x),width:e(t.width),glyphs:t.glyphs.map(n=>({...n,x:e(n.x),advance:e(n.advance),xOffset:e(n.xOffset)}))}}function Hl(t){let e=Qm(t);if(e.glyphs.length===0)return{chunks:[{text:e.text,x:t.x,start:0}],fitted:!1};let n=new Map;for(let U of e.glyphs)n.set(U.cluster,Math.min(n.get(U.cluster)??1/0,U.x));let[r,...o]=n.values(),i=o.find(U=>Math.abs(U-r)>.01);if(i!==void 0&&i<r){let U=e.text.split(" "),L=[],x=-1;for(let y of U)x+=y.length+1,L.push(x);let k=U.map(()=>1/0);for(let[y,f]of e.glyphs.entries()){let h=f.cluster-e.start,_=0,J=L.length-1;for(;_<J;){let E=_+J>>1;L[E]<h?_=E+1:J=E}h>=0&&h<L[_]&&(k[_]=Math.min(k[_],t.glyphs[y].x))}let g=U.map((y,f)=>f?L[f-1]+1:0);return{chunks:U.flatMap((y,f)=>y.length>0&&k[f]<1/0?[{text:y,x:k[f],start:g[f]}]:[]),fitted:!1}}let s=[],d=U=>/^[\p{M}\u200c\u200d]/u.test(e.text.slice(U))||e.text[U-1]==="\u200D",a=(U,L)=>/\s/u.test(e.text[U-1])||is(e.text.codePointAt(U))||is(eh(e.text,U))||L&&/\s/u.test(e.text[U]),c=U=>{let L=e.glyphs[U-1];return L?Math.fround(L.x+L.advance):e.x},l=U=>Math.abs(e.glyphs[U].x-c(U))>1e-4,m=U=>{if(U>0&&e.glyphs[U-1].cluster===e.glyphs[U].cluster)return!1;let L=c(U),x=Math.max(Math.fround(1e-4),Math.fround(Math.abs(L)*2**-21));return Math.abs(Math.fround(e.glyphs[U].x-L))>x},b=!e.letterSpacingPx&&e.glyphs.some((U,L)=>{let x=U.cluster-e.start;return x>0&&x<e.text.length&&l(L)&&!d(x)&&!a(x,!0)}),R=e.glyphs.every((U,L)=>L===0||U.cluster>=e.glyphs[L-1].cluster),v=b&&R&&e.glyphs.some((U,L)=>{let x=U.cluster-e.start;return L>0&&e.glyphs[L-1].advance>0&&x>0&&x<e.text.length&&m(L)&&!d(x)&&!a(x,!0)}),P=!b&&!Zm.test(e.text)&&R,C=0,T=P&&e.glyphs[0].cluster===e.start,j=T?e.glyphs[0].x:e.x,q=T?t.glyphs[0].x:t.x,D=0,A=(U,L,x)=>{let k=e.text.slice(C,U),g={text:k,x:q,start:C};if(P&&!k.includes(" ")){let y=k.trimEnd(),f=x-j,h=0,_=j;for(let J=D;J<L;J++){let E=e.glyphs[J];if(E.cluster-e.start>=C+y.length){f=E.x-j,g.fitText=y;break}h+=E.advance,_=Math.max(_,E.x)}g.width=Number.isFinite(f)&&f>0&&f>=_-j?f:h}else v&&!k.includes(" ")&&x>j&&(g.width=x-j);s.push(g)};for(let[U,L]of e.glyphs.entries()){let x=L.cluster-e.start;x>C&&x<e.text.length&&(P?!d(x)&&a(x,l(U)):v?m(U):l(U))&&(A(x,U,L.x),C=x,D=U,j=L.x,q=t.glyphs[U].x)}return A(e.text.length,e.glyphs.length,e.x+e.width),{chunks:s,fitted:v}}function eh(t,e){return t.codePointAt(e-(/[\ud800-\udbff][\udc00-\udfff]$/.test(t.slice(0,e))?2:1))}function is(t){return/[\u3000-\u3098\u309b-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef\u{20000}-\u{2ffff}]/u.test(String.fromCodePoint(t??0))}var Km,Jl,Zm,Gl=X(()=>{"use strict";Km=1.33,Jl=1.45;Zm=/[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/u});var So={};St(So,{prepareTextFamilies:()=>th});async function th(t,e){let n=new Map,r=(s,d,a)=>e.covers?.(s,d===!0,a===!0)??!0,o=s=>{for(let d of s)if(d.kind==="textBox")for(let a of d.lines)for(let c of a.runs){if(!r(c.fontFamily,c.bold,c.italic))continue;let l=n.get(c.fontFamily)??[];l.push(c.text),n.set(c.fontFamily,l)}else(d.kind==="chart"||d.kind==="table")&&o(d.primitives)};o(t.primitives);let i=new Map;return await Promise.all([...n].map(async([s,d])=>{i.set(s,await e.prepare(s,d.join(`
|
|
2
|
+
`)))})),(s,d,a)=>{if(!r(s,d,a))return s;let c=i.get(s);if(c===void 0)throw new Error(`Text in ${s} was painted without preparing its font`);return c===s?s:e.latest?.(s)??c}}var Po=X(()=>{"use strict"});function cs(t,e,n=1){return{width:Math.ceil(t.width*n*e),height:Math.ceil(t.height*n*e)}}function Yl(t,e,n,r=1){let o=cs(e,n,r);t.width=o.width,t.height=o.height,t.style.width=`${e.width*r}px`,t.style.height=`${e.height*r}px`}async function on(t,e,n=1,r=1,o={}){let i=await nh,s=o.fontCoverage?await(await Promise.resolve().then(()=>(Po(),So))).prepareTextFamilies(e,o.fontCoverage):rh,d={remaining:o.maxShadowPixels??oh};if(!Number.isSafeInteger(d.remaining)||d.remaining<0)throw new Error("invalid shadow pixel budget");let a=o.resolveImage?.acquire?.()??o.resolveImage,c={...o,resolveImage:a};try{t.save(),t.setTransform(n*r,0,0,n*r,0,0),t.clearRect(0,0,e.width,e.height),e.background&&(t.fillStyle=vo(t,e.background,0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height));for(let l of e.primitives)await Ql(t,l,c,n*r,d,i,s)}finally{try{t.restore()}finally{a?.release?.()}}}async function Ql(t,e,n,r,o,i,s){t.save();try{let d="shapeId"in e&&n.shapeChanges?.some(a=>a.shapeId===e.shapeId&&a.kind==="deleted");switch(d&&(t.globalAlpha*=.4),sh(t,e),e.kind){case"shape":Zl(t,e,r,o);break;case"image":await hh(t,e,n.resolveImage,r,o);break;case"textBox":Ch(t,e,i,s,n.textChanges,n.fontFamily);break;case"placeholder":Th(t,e);break;case"chart":case"table":await ih(t,e,d?{...n,shapeChanges:n.shapeChanges?.filter(a=>a.shapeId!==e.shapeId)}:n,r,o,i,s);break}}finally{t.restore()}}async function ih(t,e,n,r,o,i,s){t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip();for(let d of e.primitives)await Ql(t,d,n,r,o,i,s)}function sh(t,e){let n=e.transform;if(!n)return;let r=e.x+e.w/2,o=e.y+e.h/2;t.translate(r,o),t.rotate((n.rotationDeg??0)*Math.PI/180),t.scale(n.flipH?-1:1,n.flipV?-1:1),t.translate(-r,-o)}function Zl(t,e,n,r){e.clip&&(ds(t,e.clip,e.x,e.y,e.w,e.h),t.clip()),e.shadow&&(e.fill||e.stroke||e.shadow.paths?.some(o=>o.stroke))&&ah(t,e,n,r),ds(t,e.path,e.x,e.y,e.w,e.h),e.fill&&(t.fillStyle=vo(t,e.fill,e.x,e.y,e.w,e.h),t.fill(e.evenOdd?"evenodd":"nonzero")),e.stroke&&(rc(t,e.stroke,e.x,e.y,e.w,e.h),ch(t,e))}function ah(t,e,n,r){let o=e.shadow?.paths?.length?e.shadow.paths.map(i=>({...e,path:i.path,fill:i.fill?e.fill:void 0,stroke:i.stroke,shadow:void 0})):[{...e,shadow:void 0}];ec(t,e.shadow,o.flatMap(i=>fs(i.path,i)),o.reduce((i,s)=>Math.max(i,s.stroke?.width??0),0),n,r,i=>{for(let s of o)Zl(i,s,n,r)})}function ec(t,e,n,r,o,i,s){let d=e.scaleX??1,a=e.scaleY??1,c=t.getTransform(),l={a:c.a*d,b:c.b*a,c:c.c*d,d:c.d*a,e:c.e*d,f:c.f*a};if(!n.length)return;let m=1/0,b=1/0,R=-1/0,v=-1/0;for(let[y,f]of n){let h=l.a*y+l.c*f+l.e,_=l.b*y+l.d*f+l.f;m=Math.min(m,h),b=Math.min(b,_),R=Math.max(R,h),v=Math.max(v,_)}let P=Math.min(Math.max(e.blur??0,0)*o/2,128),C=P*3+1,T=r*o*Math.max(Math.abs(d),Math.abs(a))*2,j=(e.dx??0)*o,q=(e.dy??0)*o,D=Math.floor(Math.max(m-T,-C-j)),A=Math.floor(Math.max(b-T,-C-q)),U=Math.ceil(Math.min(R+T,t.canvas.width+C-j)),L=Math.ceil(Math.min(v+T,t.canvas.height+C-q));if(U<=D||L<=A)return;let x=(U-D)*(L-A);if(!Number.isSafeInteger(x)||x>i.remaining)return;i.remaining-=x;let k=typeof OffscreenCanvas<"u"?new OffscreenCanvas(U-D,L-A):Object.assign(document.createElement("canvas"),{width:U-D,height:L-A}),g=k.getContext("2d");if(g){g.setTransform(l.a,l.b,l.c,l.d,l.e-D,l.f-A),s(g),t.save();try{if(t.resetTransform(),typeof t.filter=="string")g.setTransform(1,0,0,1,0,0),g.globalCompositeOperation="source-in",g.fillStyle=e.color,g.fillRect(0,0,k.width,k.height),t.filter=`blur(${P}px)`,t.drawImage(k,D+j,A+q);else{let y=t.canvas.width+1;t.shadowColor=e.color,t.shadowBlur=P*2,t.shadowOffsetX=D+j-y,t.shadowOffsetY=q,t.drawImage(k,y,A)}}finally{t.restore()}}}function fs(t,e){let n=[];for(let r of t)r.type!=="close"&&(r.type==="quad"?n.push([e.x+r.cpx*e.w,e.y+r.cpy*e.h]):r.type==="cubic"&&(n.push([e.x+r.cp1x*e.w,e.y+r.cp1y*e.h]),n.push([e.x+r.cp2x*e.w,e.y+r.cp2y*e.h])),n.push([e.x+r.x*e.w,e.y+r.y*e.h]));return n.filter((r,o)=>o===0||r[0]!==n[o-1][0]||r[1]!==n[o-1][1])}function dh(t){return t.path?fs(t.path,t):[[t.x,t.y],[t.x+t.w,t.y],[t.x+t.w,t.y+t.h],[t.x,t.y+t.h]]}function ch(t,e){let n=e.stroke;if(!n||!n.headEnd&&!n.tailEnd)return;let r=fs(e.path,e);if(r.length<2)return;let o=[[n.headEnd,r[1],r[0]],[n.tailEnd,r[r.length-2],r[r.length-1]]];t.save(),t.setLineDash([]);let i=n.paint?vo(t,n.paint,e.x,e.y,e.w,e.h):n.color;t.fillStyle=i,t.strokeStyle=i,t.lineWidth=n.width,t.lineJoin="miter";for(let[s,d,a]of o){if(!s||!lh.has(s.kind))continue;let[c,l]=[a[0]-d[0],a[1]-d[1]],m=Math.hypot(c,l);m<1e-6||fh(t,s,a,c/m,l/m)}t.restore()}function fh(t,e,[n,r],o,i){let s=e.width/2,[d,a]=[-i*s,o*s],[c,l]=[n-o*e.length,r-i*e.length];switch(t.beginPath(),e.kind){case"triangle":t.moveTo(n,r),t.lineTo(c+d,l+a),t.lineTo(c-d,l-a),t.closePath(),t.fill();break;case"stealth":t.moveTo(n,r),t.lineTo(c+d,l+a),t.lineTo(n-o*e.length*.6,r-i*e.length*.6),t.lineTo(c-d,l-a),t.closePath(),t.fill();break;case"arrow":t.moveTo(c+d,l+a),t.lineTo(n,r),t.lineTo(c-d,l-a),t.stroke();break;case"diamond":{let[m,b]=[o*e.length/2,i*e.length/2];t.moveTo(n+m,r+b),t.lineTo(n+d,r+a),t.lineTo(n-m,r-b),t.lineTo(n-d,r-a),t.closePath(),t.fill();break}case"oval":t.ellipse(n,r,e.length/2,s,Math.atan2(i,o),0,Math.PI*2),t.fill();break}}function uh(t,e,n){if(n.tile){ph(t,e,n,n.tile);return}let r=n.crop,o=Wt(r?.left),i=Wt(r?.top),s=1-o-Wt(r?.right),d=1-i-Wt(r?.bottom),a=n.path!==void 0||s!==1||d!==1;if(s<=0||d<=0)return;a&&(t.save(),us(t,n),t.clip());let c=tc(e),l=nc(e),m=n.destination??n;c>0&&l>0?t.drawImage(e,o*c,i*l,s*c,d*l,m.x,m.y,m.w,m.h):t.drawImage(e,m.x,m.y,m.w,m.h),a&&t.restore()}function ph(t,e,n,r){let o=tc(e),i=nc(e);if(o<=0||i<=0)return;let s=ar(e),d=o*s.x,a=i*s.y,c=Math.round(Wt(n.crop?.left)*d)/s.x,l=Math.round(Wt(n.crop?.top)*a)/s.y,m=(d-Math.round(Wt(n.crop?.right)*d))/s.x,b=(a-Math.round(Wt(n.crop?.bottom)*a))/s.y;if(m<=c||b<=l)return;let v=c>0||l>0||m<o||b<i?mh(e,c,l,m-c,b-l):e,P=t.createPattern(v,"repeat");if(!P)return;t.save(),us(t,n),t.clip();let C=ar(v),T=n.destination??n;P.setTransform(new DOMMatrix().translateSelf(T.x,T.y).scaleSelf(r.scaleX*C.x,r.scaleY*C.y)),t.fillStyle=P,t.fillRect(T.x,T.y,T.w,T.h),t.restore()}function mh(t,e,n,r,o){try{let i=oc(Math.max(1,Math.ceil(r)),Math.max(1,Math.ceil(o))),s=i?.getContext("2d");if(!i||!s)return t;s.drawImage(t,e,n,r,o,0,0,i.width,i.height);let d=ar(t);return yo(i,{x:d.x*r/i.width,y:d.y*o/i.height}),i}catch{return t}}function us(t,e){e.path?ds(t,e.path,e.x,e.y,e.w,e.h):(t.beginPath(),t.rect(e.x,e.y,e.w,e.h))}function Wt(t){return t===void 0||!Number.isFinite(t)?0:Math.min(Math.max(t,0),1)}function tc(t){return"naturalWidth"in t&&typeof t.naturalWidth=="number"?t.naturalWidth:"width"in t&&typeof t.width=="number"?t.width:0}function nc(t){return"naturalHeight"in t&&typeof t.naturalHeight=="number"?t.naturalHeight:"height"in t&&typeof t.height=="number"?t.height:0}function ds(t,e,n,r,o,i){t.beginPath();for(let s of e)switch(s.type){case"move":t.moveTo(n+s.x*o,r+s.y*i);break;case"line":t.lineTo(n+s.x*o,r+s.y*i);break;case"quad":t.quadraticCurveTo(n+s.cpx*o,r+s.cpy*i,n+s.x*o,r+s.y*i);break;case"cubic":t.bezierCurveTo(n+s.cp1x*o,r+s.cp1y*i,n+s.cp2x*o,r+s.cp2y*i,n+s.x*o,r+s.y*i);break;case"close":t.closePath();break}}function rc(t,e,n,r,o,i){t.strokeStyle=e.paint?vo(t,e.paint,n,r,o,i):e.color,t.lineWidth=e.width,t.setLineDash(e.dashed?[Math.max(3,e.width*2),Math.max(2,e.width)]:[]),t.lineJoin=e.join??"miter",t.stroke()}function vo(t,e,n,r,o,i){if(e.kind==="solid")return e.color;let s=(e.angleDeg??0)*Math.PI/180,d=n+o/2,a=r+i/2,c=Math.hypot(o,i)/2,l=e.gradientType==="linear"?t.createLinearGradient(d-Math.cos(s)*c,a-Math.sin(s)*c,d+Math.cos(s)*c,a+Math.sin(s)*c):t.createRadialGradient(d,a,0,d,a,c);for(let m of e.stops)l.addColorStop(Math.max(0,Math.min(1,m.position)),m.color);return l}async function hh(t,e,n,r,o){let i;if(e.assetId&&n){let s=await gh(n,e.assetId);s&&(i=e.effects?.length?vh(s,e.effects):s)}if(e.shadow&&(i||e.stroke||e.shadow.paths?.some(s=>s.stroke))){let s=e.shadow.paths?.length?e.shadow.paths.map(d=>({image:{...e,path:d.path,stroke:d.stroke},source:d.fill?i:void 0})):[{image:e,source:i}];ec(t,e.shadow,s.flatMap(d=>dh(d.image)),s.reduce((d,a)=>Math.max(d,a.image.stroke?.width??0),0),r,o,d=>{for(let a of s)Vl(d,a.image,a.source)})}Vl(t,e,i)}async function gh(t,e){try{return await t(e)}catch{return null}}function Vl(t,e,n){n&&uh(t,n,e),e.stroke&&(us(t,e),rc(t,e.stroke,e.x,e.y,e.w,e.h))}function bh(t){let e=t,n=e.naturalWidth??e.videoWidth??e.displayWidth??(typeof e.width=="number"?e.width:0),r=e.naturalHeight??e.videoHeight??e.displayHeight??(typeof e.height=="number"?e.height:0);return n>0&&r>0?{width:n,height:r}:null}function wh(t){let e=t.width*t.height;if(e<=Xl)return t;let n=Math.sqrt(Xl/e);return{width:Math.max(1,Math.floor(t.width*n)),height:Math.max(1,Math.floor(t.height*n))}}function Sh(t){let e=t;return"videoWidth"in e||"displayWidth"in e||typeof e.getContext=="function"}function Ph(t,e){let n=ls.get(t),r=n?.get(e);if(!n||!r)return;let o=Rn.findIndex(i=>i.entries===n&&i.key===e);return o>=0&&Rn.push(...Rn.splice(o,1)),r}function xh(t,e,n,r){let o=ls.get(t);for(o||(o=new Map,ls.set(t,o)),o.set(e,n),Rn.push({entries:o,key:e,pixels:r}),ss+=r;ss>yh&&Rn.length>1;){let i=Rn.shift();if(!i)break;i.entries.delete(i.key),ss-=i.pixels}}function oc(t,e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(t,e);if(typeof document>"u")return null;let n=document.createElement("canvas");return n.width=t,n.height=e,n}function vh(t,e){let n=bh(t);if(!n)return t;let r=JSON.stringify(e),o=!Sh(t);if(o){let s=Ph(t,r);if(s)return s}let i=wh(n);try{let s=oc(i.width,i.height),d=s?.getContext("2d");if(!s||!d)return t;d.drawImage(t,0,0,i.width,i.height);let a=d.getImageData(0,0,i.width,i.height);kh(a.data,e),d.putImageData(a,0,0);let c=s,l=ar(t);return yo(c,{x:l.x*n.width/i.width,y:l.y*n.height/i.height}),o&&xh(t,r,c,i.width*i.height),c}catch{return t}}function as(t,e){return .299*t[e]+.587*t[e+1]+.114*t[e+2]}function _h(t,e){let n=Math.min(Math.max(e,-1),1),r=n>=0?128/(128-127*n):(128+127*n)/128,o=128-128*r+255*Math.min(Math.max(t,-1),1)*(1+r)/2,i=new Uint8ClampedArray(256);for(let s=0;s<256;s+=1)i[s]=Math.round(r*s+o);return i}function xo(t){let e=t.startsWith("#")?t.slice(1):t,n=e.length===3||e.length===4?[...e].map(i=>i+i).join(""):e;if(n.length!==6&&n.length!==8)return null;let r=i=>Number.parseInt(n.slice(i,i+2),16),o=[r(0),r(2),r(4),n.length===8?r(6):255];return o.some(Number.isNaN)?null:o}function kh(t,e){for(let n of e)switch(n.kind){case"biLevel":{let r=Math.min(Math.max(n.threshold,0),1)*255;for(let o=0;o<t.length;o+=4){let i=as(t,o)<r?0:255;t[o]=i,t[o+1]=i,t[o+2]=i}break}case"alpha":{let r=Math.min(Math.max(n.amount,0),1);for(let o=3;o<t.length;o+=4)t[o]=Math.round(t[o]*r);break}case"grayscale":{for(let r=0;r<t.length;r+=4){let o=Math.round(as(t,r));t[r]=o,t[r+1]=o,t[r+2]=o}break}case"luminance":{let r=_h(n.brightness,n.contrast);for(let o=0;o<t.length;o+=4)t[o]=r[t[o]],t[o+1]=r[t[o+1]],t[o+2]=r[t[o+2]];break}case"duotone":{let r=xo(n.shadow),o=xo(n.highlight);if(!r||!o)break;for(let i=0;i<t.length;i+=4){let s=as(t,i)/255;for(let a=0;a<3;a+=1)t[i+a]=Math.round(r[a]*(1-s)+o[a]*s);let d=r[3]*(1-s)+o[3]*s;t[i+3]=Math.round(t[i+3]*d/255)}break}case"colorChange":{let r=xo(n.from),o=xo(n.to);if(!r||!o)break;for(let i=0;i<t.length;i+=4)t[i]!==r[0]||t[i+1]!==r[1]||t[i+2]!==r[2]||n.useAlpha!==!1&&t[i+3]!==r[3]||(t[i]=o[0],t[i+1]=o[1],t[i+2]=o[2],n.useAlpha!==!1&&(t[i+3]=o[3]));break}}}function Ch(t,e,n,r,o=[],i){e.overflow||(t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip()),t.textAlign="left",t.textBaseline="alphabetic";let s=o.filter(a=>a.storyId===e.storyId);Kl(t,e,s,!1);let d=e.textShadow;d&&(t.save(),t.shadowColor=d.color,t.shadowBlur=Math.max(d.blur??0,0),t.shadowOffsetX=d.dx??0,t.shadowOffsetY=d.dy??0);for(let a of e.lines)for(let c of a.runs)Fh(t,c,a.baseline,n,r,i);d&&t.restore(),Kl(t,e,s,!0)}function Kl(t,e,n,r){if(n.length!==0)for(let o of e.lines)for(let i of o.runs)for(let s of n){let d=Math.max(i.start,s.start),a=Math.min(i.end,s.end);if(d>=a)continue;let c=o.caretStops.filter(R=>R.position>=d&&R.position<=a),l=c.length>1?Math.max(i.x,Math.min(...c.map(R=>R.x))):i.x,m=c.length>1?Math.min(i.x+i.width,Math.max(...c.map(R=>R.x))):i.x+i.width;if(m<=l)continue;let b=s.kind==="insertion";if(r){t.fillStyle=b?"#166534":"#b91c1c";let v=o.baseline-(i.baselineOffsetPx??0)+i.fontSizePx*(b?.08:-.3);t.fillRect(l,v,m-l,Math.max(1,i.fontSizePx*.05))}else t.fillStyle=b?"#dcfce7cc":"#fee2e2cc",t.fillRect(l,o.y,m-l,o.height)}}function Fh(t,e,n,r,o,i){let s=e.italic?"italic ":"",d=e.bold?"bold ":"",a=i?.({family:e.fontFamily,bold:e.bold===!0,italic:e.italic===!0,id:e.fontId})??o(e.fontFamily,e.bold,e.italic);t.font=`${s}${d}${e.fontSizePx}px ${Rh(a)}`,t.fillStyle=e.color;let c=e.letterSpacingPx??0;t.letterSpacing=c===0?"0px":`${c}px`;let l="fontKerning"in t?t.fontKerning:void 0;l!==void 0&&(t.fontKerning=e.kerning===!1?"none":"auto");let m="textRendering"in t?t.textRendering:void 0;m!==void 0&&(t.textRendering="geometricPrecision");let b=n-(e.baselineOffsetPx??0);r.paintTextChunks(t,e,b,c),t.letterSpacing="0px",l!==void 0&&(t.fontKerning=l),m!==void 0&&(t.textRendering=m),e.underline&&t.fillRect(e.x,b+e.fontSizePx*.08,e.width,Math.max(1,e.fontSizePx*.05));let R=Math.max(1,e.fontSizePx*.05),v=b-e.fontSizePx*.3,P=e.strike==="sngStrike"?[0]:e.strike==="dblStrike"?[-R,R]:[];for(let C of P)t.fillRect(e.x,v+C,e.width,R)}function Rh(t){return t.includes(" ")?JSON.stringify(t):t}function Th(t,e){t.strokeStyle="#8a94a6",t.lineWidth=1,t.setLineDash([5,4]),t.strokeRect(e.x,e.y,e.w,e.h),e.label&&(t.setLineDash([]),t.fillStyle="#5d6675",t.font="12px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(e.label,e.x+e.w/2,e.y+e.h/2,Math.max(0,e.w-12)))}var nh,rh,oh,lh,Xl,yh,ls,Rn,ss,ps=X(()=>{"use strict";Jt();nh=Promise.resolve().then(()=>(Gl(),$l)),rh=t=>t,oh=134217728;lh=new Set(["triangle","stealth","arrow","diamond","oval"]);Xl=33554432,yh=67108864;ls=new WeakMap,Rn=[],ss=0});function dc(){if(typeof OffscreenCanvas=="function")return!0;if(typeof document>"u")return!1;try{return document.createElement("canvas").getContext("2d")!==null}catch{return!1}}function hs(){return new $e("canvas-unavailable","PNG export needs a canvas, and this environment has none. Use @betteroffice/pptx-native.")}function gs(t){return new $e("canvas-unavailable",t==="svg"?"This slide has SVG pictures, which decode only with a document. Export from the page, or use @betteroffice/pptx-native.":"This slide has EMF or WMF pictures this engine cannot convert. Use @betteroffice/pptx-native.")}function lc(t,e){let n=Mt(t,e);if(n.byteLength)return n;if(t.byteLength&&typeof Image>"u")throw gs("metafile")}function Ih(t){if(t===void 0)return"slide";if(t==="slide"||t==="transparent"||typeof t=="string"&&/^#[0-9a-fA-F]{6}$/.test(t))return t;throw new TypeError(`background must be "slide", "transparent", or a #rrggbb color, not ${JSON.stringify(t)}`)}function Ah(t,e){let n=e.scale??1;if(typeof n!="number"||!Number.isFinite(n)||n<=0)throw new RangeError("scale must be finite and positive");let r=Ih(e.background);if(e.maxShadowPixels!==void 0&&(!Number.isSafeInteger(e.maxShadowPixels)||e.maxShadowPixels<0))throw new RangeError("invalid shadow pixel budget");let{width:o,height:i}=cs(t,1,n);if(o>ms||i>ms||o*i>ic)throw new $e("canvas-too-large",`A ${o}x${i}px slide is over the ${ms}px side or ${ic} pixel limit; lower the scale.`);return{width:o,height:i,scale:n,background:r}}async function cc(t,e={}){let{width:n,height:r,scale:o,background:i}=Ah(t,e);e.signal?.throwIfAborted();let s=Lh(t),d=s.find(c=>c.id!==void 0&&c.id!==Eh&&!ac(e.fonts??[],c));if(d)throw new $e("font-unavailable",`The slide's text was laid out with a ${JSON.stringify(d.family)} face this export does not have.`);let a=await ql({prefix:"bo-pptx-png",fonts:s,faces:e.fonts??[],choose:ac,subject:"slide",canvasFont:(c,l)=>`${c.italic?"italic ":""}${c.bold?"bold ":""}16px ${JSON.stringify(l)}`});try{e.signal?.throwIfAborted();let c=Mh(n,r),l=c.getContext("2d");if(!l)throw new $e("canvas-unavailable","PNG export needs a 2d canvas context.");return await on(l,t,1,o,{resolveImage:e.resolveImage,maxShadowPixels:e.maxShadowPixels,fontFamily:a.family}),i!=="transparent"&&(l.save(),l.setTransform(1,0,0,1,0,0),l.globalCompositeOperation="destination-over",l.fillStyle=i==="slide"?"#ffffff":i,l.fillRect(0,0,n,r),l.restore()),e.signal?.throwIfAborted(),new Uint8Array(await(await Uh(c)).arrayBuffer())}finally{a.release()}}function fc(t,e){for(let n of t)if((n.kind==="chart"||n.kind==="table")&&fc(n.primitives,e),n.kind==="textBox")for(let r of n.lines)for(let o of r.runs){let i={family:o.fontFamily,bold:o.bold===!0,italic:o.italic===!0,id:o.fontId};e.set(JSON.stringify(i),i)}}function Lh(t){let e=new Map;return fc(t.primitives,e),[...e.values()]}function ac(t,e){let n=e.id===void 0?void 0:t.find(r=>r.id===e.id);if(n)return n;for(let[r,o]of[[e.bold,e.italic],[e.bold,!1],[!1,e.italic],[!1,!1]]){let i;for(let s of t)s.id===void 0&&sc(s.family)===sc(e.family)&&(s.bold??!1)===r&&(s.italic??!1)===o&&(i=s);if(i)return i}}function Mh(t,e){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(t,e);if(typeof document>"u")throw hs();let n=document.createElement("canvas");return n.width=t,n.height=e,n}function Uh(t){return"convertToBlob"in t?t.convertToBlob({type:"image/png"}):new Promise((e,n)=>{t.toBlob(r=>{r?e(r):n(new $e("canvas-too-large","The canvas produced no PNG."))},"image/png")})}var Eh,ms,ic,sc,ys=X(()=>{"use strict";Fn();jl();Jt();ps();Eh=4294967295,ms=16384,ic=16777216;sc=t=>t.trim().toLowerCase()});var yc={};St(yc,{defaultFontLayout:()=>Hh,releaseDefaultFontLayout:()=>gc});function ws(t,e,n){let r=e.bold??!1,o=e.italic??!1,i=n?t.renderer.registerFallbackFont(e.family,r,o,e.bytes):t.renderer.registerFont(e.family,r,o,e.bytes);t.faces.push({id:i,family:e.family,bold:r,italic:o,bytes:e.bytes,fallback:n}),(n?t.fallback:t.primary).add(sn(e.family,r,o))}function pc(t,e,n){let r={renderer:new vt,fontCdn:n,measured:t,sources:t.map(o=>o.bytes),faces:[],owned:new Set,primary:new Set,fallback:new Set,requested:new Set,queue:Promise.resolve(),users:0,released:!1};try{let o=new Set(e.map(i=>ur(i.family)));for(let i of[...t,...e]){let s="fallback"in i&&i.fallback===!0;ws(r,i,s);let d=ur(i.family);!s&&!o.has(d)&&r.owned.add(d)}}catch(o){throw r.renderer.free(),o}return r}async function Nh(t,e,n,r){let o=[],i=d=>{d&&!o.some(a=>a.family===d.family&&cr(a)===cr(d)&&fr(a)===fr(d))&&o.push(d)},s=r?void 0:await e(t.resolveBundledFamilyFace(n.family,n.bold,n.italic));i(s);for(let d of n.scripts??[])i(await e(t.resolveScriptFallbackFace(d,n.bold,n.italic,n.family)));if(i(await e(t.resolveGlyphFallbackFace(n.family,n.bold,n.italic,"powerpoint"))),!r){let d=t.resolveLastResortChoice(n.family,n.bold,n.italic,"powerpoint");(!d.onlyIfPrimaryFails||!s)&&i(await e(d.face)),o.length||i(t.BASE_LATIN_FONTS.find(a=>cr(a)===n.bold&&fr(a)===n.italic))}return o}function Dh(t,e,n){let{faces:r}=JSON.parse(t.renderer.requestedFontFacesJson(e,n));return r.filter(o=>!t.requested.has(Ss(o)))}async function zh(t,e,n,r,o,i){let s=await Bh(),d=async m=>m&&!r.has(m.file)&&await s.bundledFaceInstalled(m).catch(()=>!0)?m:void 0,a=async(m,b)=>{try{return new Uint8Array(await s.loadBundledFontBytes(m,void 0,{decoder:Tn,strict:!0}))}catch(R){if(Qe(R)&&(R.diagnostic.pack==="cjk"||R.diagnostic.pack==="intl")){r.add(m.file),o.has(R)||(o.add(R),Pt(R));return}let v=R instanceof Error?R.message:String(R);throw new $e("font-unavailable",`${m.family} for ${b} could not load: ${v}`)}},c=new Map,l=(m,b)=>{let R=c.get(m.file);return R||(R=a(m,b),c.set(m.file,R)),R};for(;;){let m=await Promise.all(e.map(async v=>({request:v,faces:await Nh(s,d,v,n.has(sn(v.family,v.bold,v.italic)))}))),b=r.size,R=await Promise.all(m.map(async({request:v,faces:P})=>{let C=mc(t,v),T=await Promise.all(P.map((j,q)=>q===0&&!C||!hc(t,j)?l(j,v.family):void 0));return{request:v,faces:P,bytes:T}}));if(i?.throwIfAborted(),r.size===b)return R}}function qh(t,e){for(let{request:n,faces:r,bytes:o}of e){if(t.requested.has(Ss(n)))continue;let i=mc(t,n);for(let[s,d]of r.entries()){let a=o[s];s===0&&!i?a&&ws(t,{family:n.family,bold:n.bold,italic:n.italic,bytes:a},!1):hc(t,d)||a&&ws(t,{family:d.family,bold:cr(d),italic:fr(d),bytes:a},!0)}t.requested.add(Ss(n))}}function bs(t,e){let{slides:n}=JSON.parse(t.snapshotJson()),r=n.findIndex(o=>o.id===e);if(r<0)throw new RangeError(`no slide with ID ${JSON.stringify(e)}`);return r}function Jh(t){t.released=!0,t.users===0&&t.renderer.free()}function Wh(t){if(!t)return Si();t.throwIfAborted();let e,n=new Promise((r,o)=>{e=()=>o(t.reason)});return t.addEventListener("abort",e,{once:!0}),Promise.race([Si(),n]).finally(()=>t.removeEventListener("abort",e))}async function Hh(t,e,n,r,o){bs(t,e);let i=new Set(n.map(b=>sn(b.family,b.bold,b.italic))),s=r?.filter(b=>!i.has(sn(b.family,b.bold,b.italic)))??[],d=new Set(s.map(b=>sn(b.family,b.bold,b.italic))),a=await Wh(o);o?.throwIfAborted();let c=s.length?void 0:_o.get(t);c&&(c.fontCdn!==a||!jh(c,n))&&(gc(t),c=void 0),c||(c=pc(n,s,a),s.length?c.released=!0:_o.set(t,c));let l=c;l.users+=1;let m=l.queue.then(async()=>{let b=new Set,R=new Set,v=l;try{for(let C=0;;C+=1){let T=t.documentVersion();bs(t,e);let j=Dh(v,t,e);if(!j.length)break;if(C===Oh)throw new $e("font-unavailable","the faces this slide needs kept changing while they loaded; export again");let q=await zh(v,j,d,b,R,o);if(b.size&&!s.length&&v===l&&(v=pc([],l.faces,a),v.owned=new Set(l.owned),v.requested=new Set(l.requested)),qh(v,q),t.documentVersion()===T)break}return o?.throwIfAborted(),{list:JSON.parse(v.renderer.exportSlideJson(t,bs(t,e))),fonts:[...v.faces]}}finally{v!==l&&v.renderer.free()}});l.queue=m.catch(()=>{});try{return await m}finally{l.users-=1,l.released&&l.users===0&&l.renderer.free()}}function gc(t){let e=_o.get(t);_o.delete(t),e&&Jh(e)}var uc,Bh,_o,Oh,ur,sn,cr,fr,Ss,mc,hc,jh,bc=X(()=>{"use strict";vn();Qt();_n();Fn();jt();Ht();Bh=()=>uc??=Lt().catch(t=>{throw uc=void 0,t}),_o=new WeakMap,Oh=4,ur=t=>t.trim().toLowerCase(),sn=(t,e=!1,n=!1)=>JSON.stringify([ur(t),e,n]),cr=t=>t.weight===700,fr=t=>t.style==="italic";Ss=t=>JSON.stringify([ur(t.family),t.bold,t.italic,t.scripts??[]]),mc=(t,e)=>t.owned.has(ur(e.family))||t.primary.has(sn(e.family,e.bold,e.italic)),hc=(t,e)=>t.fallback.has(sn(e.family,cr(e),fr(e)));jh=(t,e)=>t.measured.length===e.length&&e.every((n,r)=>t.measured[r]===n&&t.sources[r]===n.bytes)});function xs(t){Ps?.releaseDefaultFontLayout(t)}function $h(t){try{return lr(dr(t))}catch{return!1}}function wc(t,e){for(let n of t)n.kind==="image"&&n.assetId&&e.add(n.assetId),(n.kind==="chart"||n.kind==="table")&&wc(n.primitives,e);return e}async function Sc(t,e,n){if(!dc())throw hs();let r,o;if(t.doc&&e.id!==void 0){let s=t.fonts();Ps??=await Promise.resolve().then(()=>(bc(),yc));let d=await Ps.defaultFontLayout(t.doc,e.id,s,n.fonts,n.signal);r=d.list,o=[...d.fonts,...n.fonts??[]]}else r=t.displayList(e.slide),o=[...t.fonts(),...n.fonts??[]];let i=new Map;try{for(let s of wc(r.primitives,new Set)){n.signal?.throwIfAborted();let d=t.media(s);if(d?.byteLength&&typeof Image>"u"&&$h(d))throw gs("svg");i.set(s,d?.byteLength?await Ml(d,"image could not decode").catch(()=>null):null)}return await cc(r,{...n,fonts:o,resolveImage:s=>i.get(s)??null})}finally{for(let s of i.values())s?.close?.()}}var Ps,Pc=X(()=>{"use strict";ys();Jt()});function Et(t){let e=new Set,n=r=>{for(let o of r)o.kind==="image"&&o.assetId?e.add(o.assetId):(o.kind==="chart"||o.kind==="table")&&n(o.primitives)};return n(t.primitives),e}var pr=X(()=>{"use strict"});var yt,ko=X(()=>{"use strict";yt=new WeakMap});var xc=X(()=>{});function Vh(t){return vc[Math.abs(t)%vc.length]}function vs(t,e){return typeof e=="string"&&(e.length===4||e.length===7)&&Gh.test(e)?e:Vh(t)}function _c(t,e){if(e&&(typeof e.name!="string"||e.name.trim().length===0))throw new TypeError("Collaboration user name must be a non-empty string");if(e?.color!==void 0&&typeof e.color!="string")throw new TypeError("Collaboration user color must be a string");let n=e?.name.trim().slice(0,1024)||`Guest ${t.toString(36).toUpperCase()}`,r=vs(t,e?.color);return{name:n,color:r}}function _s(t){return t.slideId.length<=1024&&(t.shapeId===void 0||t.shapeId.length<=1024)}function kc(t,e){if(typeof t!="object"||t===null)return!1;let n=t;return typeof n.slideId=="string"&&n.slideId.length>0&&(n.shapeId===void 0||typeof n.shapeId=="string"&&n.shapeId.length>0)&&_s(n)&&new TextEncoder().encode(n.slideId+(n.shapeId??"")).byteLength<=e}function ks(t,e){return t?.slideId===e?.slideId&&t?.shapeId===e?.shapeId}function Cc(t){return{clientId:t.clientId,clock:t.clock,user:{...t.user},cursor:t.cursor?{...t.cursor}:null}}function Xh(t){return{state:Cc(t.state),lastSeen:t.lastSeen,cursorMovedAt:t.cursorMovedAt}}var vc,Gh,Co,Fo=X(()=>{"use strict";vc=["#B3261E","#7B1FA2","#3949AB","#00796B","#2E7D32","#A84400","#C2185B","#00695C"],Gh=/^#[0-9a-fA-F]+$/;Co=class{constructor(e,n={}){this.localClientId=e;if(this.maxTrackedIds=n.maxTrackedIds??4096,!Number.isSafeInteger(this.maxTrackedIds)||this.maxTrackedIds<1)throw new RangeError("Presence tracked id limit must be a positive integer")}localClientId;states=new Map;clocks=new Map;maxTrackedIds;get peers(){return[...this.states.values()].sort((e,n)=>e.state.clientId-n.state.clientId).map(Xh)}get trackedIdCount(){return this.clocks.size}get nextExpiryAt(){let e;for(let n of this.states.values()){let r=n.lastSeen+45e3;e=e===void 0?r:Math.min(e,r)}for(let n of this.clocks.values()){let r=n.updatedAt+3e5;e=e===void 0?r:Math.min(e,r)}return e}apply(e,n){let r=this.expire(n);for(let o of e){if(o.clientId===this.localClientId)continue;let i=this.clocks.get(o.clientId);if(i&&o.clock<=i.clock)continue;if(!i&&this.clocks.size>=this.maxTrackedIds&&(r=this.evictOldest()||r),this.clocks.delete(o.clientId),this.clocks.set(o.clientId,{clock:o.clock,updatedAt:n}),!o.state){r=this.states.delete(o.clientId)||r;continue}let s=this.states.get(o.clientId),d=s&&ks(s.state.cursor,o.state.cursor)?s.cursorMovedAt:n;this.states.set(o.clientId,{state:Cc(o.state),lastSeen:n,cursorMovedAt:d}),r=!0}return r}expire(e,n=45e3){let r=!1;for(let[o,i]of this.states)e-i.lastSeen<n||(this.states.delete(o),r=!0);for(let[o,i]of this.clocks)e-i.updatedAt<3e5||(this.clocks.delete(o),r=this.states.delete(o)||r);return r}clear(){let e=this.states.size>0;return this.states.clear(),this.clocks.clear(),e}evictOldest(){let e=this.clocks.keys().next();return e.done?!1:(this.clocks.delete(e.value),this.states.delete(e.value))}}});function dt(t){if(!Number.isSafeInteger(t)||t<0)throw new Fe("varUint value must be a non-negative safe integer");let e=[],n=t;for(;n>=128;)e.push(n%128|128),n=Math.floor(n/128);return e.push(n),Uint8Array.from(e)}function tg(t){let e=new TextEncoder().encode(t);return an([dt(e.byteLength),e],Ct)}function an(t,e){let n=0;for(let i of t)if(n+=i.byteLength,n>e)throw new Fe(`Frame exceeds ${e} bytes`);let r=new Uint8Array(n),o=0;for(let i of t)r.set(i,o),o+=i.byteLength;return r}function Ts(t,e,n){return an([dt(Rc),dt(t),dt(e.byteLength),e],n)}function Es(t,e=Ct){return Ts(Ic,t,e)}function Mc(t,e=Ct){return Ts(Ac,t,e)}function Is(t,e=Ct){return Ts(Lc,t,e)}function As(t,e=Ct){if(t.length>En)throw new Fe(`Awareness update exceeds ${En} entries`);let n=[dt(t.length)];for(let o of t){jc(o);let i=JSON.stringify(o.state);if(i===void 0)throw new Fe("Awareness state is not JSON serializable");n.push(dt(o.clientId),dt(o.clock),tg(i))}let r=an(n,e);return an([dt(Tc),dt(r.byteLength),r],e)}function Uc(t=Ct){return an([dt(Ec)],t)}function Bc(t,e=En){if(!(t instanceof Uint8Array))throw new Fe("Awareness update must be a Uint8Array");if(!Number.isSafeInteger(e)||e<1)throw new Fe("Awareness entry limit must be a positive integer");let n=new To(t),r=n.readVarUint();if(r>e)throw new Fe(`Awareness update exceeds ${e} entries`);let o=[];for(let i=0;i<r;i+=1){let s=n.readVarUint(),d=n.readVarUint(),a;try{a=JSON.parse(n.readVarString())}catch(l){throw l instanceof Fe?l:new Fe(`Invalid awareness JSON${l instanceof Error?`: ${l.message}`:""}`)}let c={clientId:s,clock:d,state:qc(a,s,d)};jc(c),o.push(c)}if(!n.done)throw new Fe("Awareness update has trailing bytes");return o}function In(t){let e=Cs.byteLength+32,n=t.byteLength-e;if(n<0)return t;for(let r=0;r<Cs.byteLength;r+=1)if(t[n+r]!==Cs[r])return t;return t.subarray(0,n)}function Nc(t){let e=0,n=()=>{let s=0n;for(let d=0;d<eg&&e<t.byteLength;d+=1){let a=t[e++];if(s|=BigInt(a&127)<<BigInt(7*d),a<128)return s}},r=n();if(r===void 0)return;let o=e,i=[];for(let s=r;s>0n;s-=1n){let d=e,a=n(),c=n();if(a===void 0||c===void 0)return;i.push({client:a,clock:c,start:d,end:e})}return e===t.byteLength?{header:o,entries:i}:void 0}function Dc(t){let e=In(t),n=Nc(e);if(!n)return t;let{header:r,entries:o}=n;if(!(o.length>=ng||o.some(({client:i})=>i===Oc)))return an([dt(o.length+1),e.subarray(r),dt(mr),dt(0),t.subarray(e.byteLength)],Number.MAX_SAFE_INTEGER)}function zc(t){let e=In(t),n=Nc(e);if(!n)return{stateVector:t,open:!1};let r=n.entries.filter(({client:o,clock:i})=>o!==Oc||i!==0n);return r.length===n.entries.length?{stateVector:t,open:!1}:{stateVector:an([dt(r.length),...r.map(({start:o,end:i})=>e.subarray(o,i)),t.subarray(e.byteLength)],Number.MAX_SAFE_INTEGER),open:!0}}function Ls(t,e=Ct,n=En){if(!(t instanceof Uint8Array))throw new Fe("Frame must be a Uint8Array");if(t.byteLength===0)throw new Fe("Frame is empty");if(t.byteLength>e)throw new Fe(`Frame exceeds ${e} bytes`);if(!Number.isSafeInteger(n)||n<1)throw new Fe("Message limit must be a positive integer");let r=new To(t),o=[];for(;!r.done;){if(o.length>=n)throw new Fe(`Frame exceeds ${n} messages`);let i=r.readVarUint();switch(i){case Rc:{let s=r.readVarUint(),d=r.readVarUint8Array();if(s===Ic)o.push({type:"sync-step-1",stateVector:d});else if(s===Ac)o.push({type:"sync-step-2",update:d});else if(s===Lc)o.push({type:"update",update:d});else throw new Fe(`Unknown sync message type ${s}`);break}case Tc:o.push({type:"awareness",update:r.readVarUint8Array()});break;case Yh:{let s=r.readVarUint();if(s!==Qh)throw new Fe(`Unknown auth message type ${s}`);o.push({type:"auth",reason:r.readVarString()});break}case Ec:o.push({type:"query-awareness"});break;default:throw new Fe(`Unknown top-level message type ${i}`)}}return o}function qc(t,e,n){if(t===null)return null;if(!Rs(t))throw new Fe("Awareness state must be an object or null");if(t.clientId!==e||t.clock!==n)throw new Fe("Awareness state identity does not match its entry");if(!Rs(t.user))throw new Fe("Awareness user must be an object");let r=Fs(t.user.name,"Awareness user name"),o=vs(e,t.user.color);return{clientId:e,clock:n,user:{name:r,color:o},cursor:rg(t.cursor)}}function rg(t){if(t==null)return null;if(!Rs(t))throw new Fe("Awareness cursor must be an object or null");let e=Fs(t.slideId,"Awareness slideId"),n=t.shapeId===void 0?void 0:Fs(t.shapeId,"Awareness shapeId");return n?{slideId:e,shapeId:n}:{slideId:e}}function jc(t){Fc(t.clientId,"Awareness clientId"),Fc(t.clock,"Awareness clock"),t.state!==null&&qc(t.state,t.clientId,t.clock)}function Fc(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Fe(`${e} must be a non-negative safe integer`)}function Fs(t,e){if(typeof t!="string"||t.length===0||t.length>1024)throw new Fe(`${e} must be between 1 and ${1024} characters`);return t}function Rs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ct,En,Rc,Tc,Yh,Ec,Ic,Ac,Lc,Qh,Zh,eg,Cs,Fe,To,mr,Oc,ng,Eo=X(()=>{"use strict";xc();Fo();Ct=16777216,En=4096,Rc=0,Tc=1,Yh=2,Ec=3,Ic=0,Ac=1,Lc=2,Qh=0,Zh=Number.MAX_SAFE_INTEGER,eg=10,Cs=new TextEncoder().encode("\0betteroffice-document-fingerprint-v1\0"),Fe=class extends Error{constructor(e){super(e),this.name="ProtocolError"}},To=class{constructor(e){this.bytes=e}bytes;offset=0;get done(){return this.offset===this.bytes.byteLength}readVarUint(){let e=0,n=1,r=0;for(;;){if(this.offset>=this.bytes.byteLength)throw new Fe("Truncated varUint");let o=this.bytes[this.offset++],i=o&127;if(i>Math.floor((Zh-e)/n))throw new Fe("varUint exceeds Number.MAX_SAFE_INTEGER");if(e+=i*n,r+=1,(o&128)===0){if(r>1&&i===0)throw new Fe("Non-canonical varUint");return e}if(r>=8)throw new Fe("varUint exceeds Number.MAX_SAFE_INTEGER");n*=128}}readVarUint8Array(){let e=this.readVarUint(),n=this.bytes.byteLength-this.offset;if(e>n)throw new Fe("Truncated varUint8Array");let r=this.bytes.slice(this.offset,this.offset+e);return this.offset+=e,r}readVarString(){let e=this.readVarUint8Array();try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch(n){throw new Fe(`Invalid UTF-8 string${n instanceof Error?`: ${n.message}`:""}`)}}};mr=Number.MAX_SAFE_INTEGER-1,Oc=BigInt(mr),ng=65536});var Io,Ao,Jc=X(()=>{"use strict";Io=class extends Error{targets;constructor(e){super(`Proposal targets changed: ${e.join(", ")}`),this.name="StaleProposalError",this.targets=e}},Ao=class extends Error{constructor(n,r=8*1024*1024){super(`Proposal picture media exceeds ${r} decoded bytes (${n} bytes)`);this.totalBytes=n;this.limitBytes=r;this.name="ProposalPictureMediaTooLargeError"}totalBytes;limitBytes;code="proposalPictureMediaTooLarge"}});function gr(t){let e=Wc.get(t);if(!e)throw new ot("stage","Presentation is not a retained replay handle");return e}function Hc(t,e={}){try{return Zc(t,e,{kind:"baseline"})}catch(n){throw Us(n)}}function $c(t){return gr(t).registerFonts()}function Gc(t){return gr(t).hydration()}function Vc(t){return gr(t).metadata()}function Xc(t,e){return gr(t).displayListJson(e)}function Kc(t,e,n){return gr(t).replay(e,n)}function Bs(t,e){let n=yt.get(t);if(!n)throw new Error("Presentation story formatting is unavailable");return n.jsonWasmCall(()=>n.doc.storyFormattingJson(JSON.stringify({slideId:e.slideId,shapeId:e.shapeId,storyId:e.storyId})))}function Yc(t,e,n,r){let o=yt.get(t);if(!o||o.peer)throw new Error("Presentation paragraph joining is unavailable");return o.jsonWasmCall(()=>o.doc.deleteTextJson(JSON.stringify({storyId:e,start:n,end:r,allowParagraphJoin:!0})),!0)}function yr(t){let e=yt.get(t);if(!e)throw new Error("Presentation metadata is unavailable");return e.jsonWasmCall(()=>e.doc.sessionMetadataJson())}function Uo(t,e){let n=yt.get(t);if(!n)throw new Error("Presentation display list is unavailable");return n.wasmCall(()=>n.renderer.layoutSlideJson(n.doc,e))}function Qc(t,e,n,r){let o=yt.get(t);if(!o)throw new Error("Presentation shape preview is unavailable");return o.jsonWasmCall(()=>o.renderer.previewShapeRectJson(o.doc,{slideId:e,shapeId:n,...r}))}function Lo(){return typeof Me.prototype.proposeJson=="function"&&typeof vt.prototype.layoutProposalSlideJson=="function"}function bt(t){if(Ms)return Promise.resolve();if(hr)return hr;let e;return hr=es({module_or_path:t??Ka(e=Jr())}).then(()=>{Ms=!0},n=>{throw hr=void 0,e&&_t!=="native"?Ya(e,n):ln(n)}),hr}function ig(t,e={}){return Os(),dg(()=>e.includeMedia===!1?Zi(t):Qi(t))}function Gt(t){return Os(),Mo(()=>Yi(t))}function br(t,e={}){return Zc(t,e)}function Zc(t,e,n){if(Os(),e.clientId!==void 0&&e.clientId>=mr){let f="client id must be a positive safe integer below Number.MAX_SAFE_INTEGER - 1";throw n?new ot("clientId",f):new Error(f)}let r=n?[...(e.fonts??[]).map(f=>({...f,bytes:new Uint8Array(f.bytes),fallback:!1})),...(e.fallbackFonts??[]).map(f=>({...f,bytes:new Uint8Array(f.bytes),fallback:!0}))]:[],o=n&&e.initialUpdate!==void 0?e.initialUpdate:void 0,i=n?e.clientId:e.clientId??sg(),s=Mo(()=>n?n.kind==="baseline"?Me.openReplayBaseline(t,i,o):Me.openPeerDeckJson(t,n.identity,o):e.initialUpdate===void 0?Me.openCollaborative(t,i):Me.openCollaborativeFromUpdate(e.initialUpdate,i,t)),d;try{d=Mo(()=>new vt)}catch(f){try{s.free()}catch{}throw n?Us(f):f}let a=new Map,c=(f,h,_=!1)=>(a.set(f,{id:f,family:h.family,bold:h.bold??!1,italic:h.italic??!1,bytes:h.bytes.slice(),fallback:_}),f);if(!n)try{for(let f of e.fonts??[])c(dn(d,f),f);for(let f of e.fallbackFonts??[])c(dn(d,f,!0),f,!0)}catch(f){try{d.free()}catch{}try{s.free()}catch{}throw f}let l=new Map,m=[],b=0,R=!1,v=!1,P=0,C=!1,T=()=>{if(R)throw new Error("presentation handle is disposed")},j=()=>{if(!(R||C||P!==0)){C=!0;try{for(;!R&&m.length>0;){let f=m.shift();if(!f)break;for(let[h,_]of[...l]){if(R)return;if(l.get(h)===_)try{_(f.update.slice(),f.origin)}catch{}}}}finally{C=!1,R&&(m.length=0)}}},q=()=>{if(!(!v||R))for(;;){let f=s.drainUpdateEvent();if(f.byteLength===0)return;let h=f[0];if(h!==0&&h!==1)throw new Error(`pptx wasm returned unknown update origin ${h}`);m.push({update:f.subarray(1),origin:h===0?"local":"remote"})}},D=(f,h=!1)=>{T(),P+=1;try{let _,J,E=!1;try{_=f()}catch(F){J=F,E=!0}if(h)try{q()}catch(F){E||(J=F,E=!0)}if(E)throw ln(J);return _}finally{P-=1,P===0&&j()}},A=(f,h=!1)=>D(()=>JSON.parse(f()),h),U=f=>{let h=[];for(let _ of Et(f.frame))if(!_.startsWith("pending-media:"))try{let J=D(()=>s.mediaBytes(_));kt(J)&&J.byteLength<=33554432&&(J=Gt(J));let E=Mt(J,()=>D(()=>s.metafileSvg(_)));if(!E.byteLength)continue;h.push({assetId:_,bytes:new Uint8Array(E).buffer})}catch{}return{...f,media:h}},L=()=>{v||(D(()=>s.startUpdateObservation()),v=!0)},x=()=>{!v||l.size>0||R||(m.length=0,D(()=>s.clearUpdateObservation()),v=!1)},k=n||e.retainSource===!1?void 0:new Uint8Array(t),g=!1,y={fork(){if(T(),!k)throw new Error("Presentation source is unavailable for fork");let f=br(k,{initialUpdate:y.encodeStateAsUpdate()});return g&&f.setCollaborative(),f},setCollaborative(){g=!0,D(()=>s.setCollaborative())},isCollaborative(){return g},layouts(){if(T(),!k)throw new Error("Presentation source is unavailable for layouts");let f=_=>_.flatMap(J=>[...J.placeholder?[{id:String(J.id),name:J.name,type:J.placeholder.placeholderType,idx:J.placeholder.index}]:[],...f(J.children??[])]),h=ig(k,{includeMedia:!1});return h.layouts.map(_=>({id:_.partPath,name:_.name,type:_.layoutType,masterId:_.masterPartPath??h.masters.find(J=>J.layoutPartPaths.includes(_.partPath))?.partPath??null,placeholders:f(_.shapes)}))},isProposalsAvailable:Lo,propose(f,h,_){return A(()=>s.proposeJson(JSON.stringify({agentId:f,note:h,edits:_})))},listProposals(){return Lo()?A(()=>s.listProposalsJson()):[]},previewProposal(f){return A(()=>s.previewProposalJson(JSON.stringify({id:f})))},proposalSlideStrip(f){return!Lo()||typeof s.proposalSlideStripJson!="function"?[]:A(()=>s.proposalSlideStripJson(f))},layoutProposalDiffSlideById(f,h){if(!Lo()||typeof d.layoutProposalDiffSlideByIdJson!="function")throw new Error("Proposal slide previews are unavailable");return U(A(()=>d.layoutProposalDiffSlideByIdJson(s,f,h)))},layoutProposalDiffSlide(f,h){return U(A(()=>d.layoutProposalDiffSlideJson(s,f,h)))},layoutProposalSlide(f,h){return A(()=>d.layoutProposalSlideJson(s,f,h))},acceptProposal(f,h){return A(()=>s.acceptProposalJson(JSON.stringify({id:f,force:h?.force??!1})),!0)},rejectProposal(f){return A(()=>s.rejectProposalJson(JSON.stringify({id:f})))},get clientId(){return D(()=>s.clientId)},snapshot(){return A(()=>s.snapshotJson())},story(f){return A(()=>s.storyJson(JSON.stringify({storyId:f})))},anchorCaret(f,h){return A(()=>s.anchorCaretJson(JSON.stringify({storyId:f,index:h})))},resolveCaretAnchor(f){return A(()=>s.resolveCaretAnchorJson(JSON.stringify({storyId:f.storyId,position:f.position})))},version(){return D(()=>s.documentVersion())},readContent(f={}){let h=$t(f);return A(()=>s.readContentJson(h))},readCommandContent(f={}){let h=$t(f);return A(()=>s.readCommandContentJson(h))},historyStep(f){return A(()=>f==="undo"?s.undoReceiptJson():s.redoReceiptJson(),!0)},findText(f){let h=$t(f);return A(()=>s.findTextJson(h))},exportStructured(f={}){let h=$t(f);return A(()=>s.exportStructuredJson(h))},exportMarkdown(f={}){let h=$t(f);return A(()=>s.exportMarkdownJson(h))},validateEdits(f){let h=$t(f);return A(()=>s.validateEditsJson(h))},applyEdits(f){let h=$t(f);return A(()=>s.applyEditsJson(h),!0)},searchText(f,h={}){if(!f)return[];let _=h.limit??Number.POSITIVE_INFINITY;if(!Number.isSafeInteger(_)&&_!==Number.POSITIVE_INFINITY||_<0)throw new RangeError("search limit must be a non-negative safe integer");return A(()=>s.searchTextJson(JSON.stringify({query:f,caseSensitive:h.caseSensitive??!1,limit:Number.isFinite(_)?Math.min(_,4294967295):void 0})))},registerFont(f){return c(D(()=>dn(d,f)),f)},registerFallbackFont(f){return c(D(()=>dn(d,f,!0)),f,!0)},replaceExportFace(f,h,_){kl(a.values(),f,h,_),xs(s)},renderPng(f,h={}){let _,J;try{if(T(),typeof f!="object"||f===null||Object.keys(f).length!==1||!("slide"in f))throw new TypeError("target must be { slide } with a slide index or ID");let E=A(()=>s.snapshotJson()).slides,F=f.slide;if(typeof F=="string"){if(_=E.findIndex(z=>z.id===F),_<0)throw new RangeError(`no slide with ID ${JSON.stringify(F)}`)}else if(typeof F=="number"&&Number.isInteger(F)){if(F<0||F>=E.length)throw new RangeError(`slide index ${F} out of range for ${E.length} slide(s)`);_=F}else throw new TypeError("slide must be an ID (string) or an index (number)");J=E[_].id}catch(E){return Promise.reject(E)}return Sc({doc:s,renderer:d,displayList:E=>A(()=>d.exportSlideJson(s,E)),media:E=>{T();let F;try{F=D(()=>s.mediaBytes(E)),kt(F)&&F.byteLength<=33554432&&(F=Gt(F))}catch{return}return lc(F,()=>{try{return D(()=>s.metafileSvg(E))}catch{return}})},fonts:()=>[...a.values()]},{slide:_,id:J},h).then(E=>(T(),E),E=>{throw T(),E})},layoutSlide(f){return A(()=>d.layoutSlideJson(s,f))},layoutSlideProfiled(f){return A(()=>d.layoutSlideProfiledJson(s,f))},hitTest(f,h){return A(()=>d.hitTestJson(f,h))},mediaBytes(f){return D(()=>s.mediaBytes(f))},metafileSvg(f){return D(()=>s.metafileSvg(f))},save(f){if(!f)return D(()=>d.saveBytes(s));let h=Mo(()=>new vt);try{for(let _ of f.fonts)D(()=>dn(h,_));for(let _ of f.fallbackFonts??[])D(()=>dn(h,_,!0));return D(()=>h.saveBytes(s))}finally{h.free()}},insertText(f,h,_,J={}){return A(()=>s.insertTextJson(JSON.stringify({storyId:f,index:h,text:_,style:J})),!0)},insertTextProfiled(f,h,_,J={}){return A(()=>s.insertTextProfiledJson(JSON.stringify({storyId:f,index:h,text:_,style:J})),!0)},deleteText(f,h,_){return A(()=>s.deleteTextJson(JSON.stringify({storyId:f,start:h,end:_})),!0)},deleteTextProfiled(f,h,_){return A(()=>s.deleteTextProfiledJson(JSON.stringify({storyId:f,start:h,end:_})),!0)},formatText(f,h,_,J){return A(()=>s.formatTextJson(JSON.stringify({storyId:f,start:h,end:_,patch:J})),!0)},insertParagraphBreak(f,h){return A(()=>s.insertParagraphBreakJson(JSON.stringify({storyId:f,index:h})),!0)},setParagraphAlignment(f,h,_,J){return A(()=>s.setParagraphAlignmentJson(JSON.stringify({storyId:f,start:h,end:_,alignment:J})),!0)},insertTableRow(f,h,_,J,E){return A(()=>s.insertTableRowJson(JSON.stringify({slideId:f,shapeId:h,index:_,position:J,cells:E})),!0)},checkTableEdit(f,h,_,J,E,F,z){let H={insertTableRow:"insertRow",deleteTableRow:"deleteRow",insertTableColumn:"insertColumn",deleteTableColumn:"deleteColumn"}[f];D(()=>s.checkTableEditJson(JSON.stringify({edit:H,slideId:h,shapeId:_,index:J,position:E,cells:F,width:z})))},deleteTableRow(f,h,_){return A(()=>s.deleteTableRowJson(JSON.stringify({slideId:f,shapeId:h,index:_})),!0)},insertTableColumn(f,h,_,J,E,F){return A(()=>s.insertTableColumnJson(JSON.stringify({slideId:f,shapeId:h,index:_,position:J,cells:E,width:F})),!0)},deleteTableColumn(f,h,_){return A(()=>s.deleteTableColumnJson(JSON.stringify({slideId:f,shapeId:h,index:_})),!0)},insertSlide(f,h){return A(()=>s.insertSlideJson(JSON.stringify({index:f,layoutPartPath:h??null})),!0)},setStoryParagraphs(f,h){return A(()=>s.setStoryParagraphsJson(JSON.stringify({storyId:f,paragraphs:h})),!0)},duplicateSlide(f,h){return A(()=>s.duplicateSlideJson(JSON.stringify({slideId:f,toIndex:h})),!0)},insertSlideProfiled(f,h){return A(()=>s.insertSlideProfiledJson(JSON.stringify({index:f,layoutPartPath:h??null})),!0)},deleteSlide(f){return A(()=>s.deleteSlideJson(JSON.stringify({slideId:f})),!0)},moveSlide(f,h){return A(()=>s.moveSlideJson(JSON.stringify({slideId:f,toIndex:h})),!0)},setSlideLayout(f,h,_=[]){let J=_.map(([E,F])=>{if(!/^\d+$/u.test(F)||!Number.isSafeInteger(Number(F))||Number(F)>4294967295)throw new Error("Invalid layout placeholder ID");return[E,Number(F)]});A(()=>s.setSlideLayoutJson(JSON.stringify({slideId:f,layoutPartPath:h,mapping:J})),!0)},setSlideNotes(f,h){A(()=>s.setSlideNotesJson(JSON.stringify({slideId:f,text:h})),!0)},addComment(f,h){return A(()=>s.addCommentJson(JSON.stringify({slideId:f,author:h.author,initials:h.initials??"",text:h.text,created:h.created,xEmu:h.xEmu??0,yEmu:h.yEmu??0})),!0)},replyToComment(f,h){return A(()=>s.replyToCommentJson(JSON.stringify({commentId:f,author:h.author,initials:h.initials??"",text:h.text,created:h.created})),!0)},setCommentPosition(f,h){if(!Number.isSafeInteger(h.xEmu)||!Number.isSafeInteger(h.yEmu))throw new Error("Comment coordinates must be safe integer EMU");return A(()=>s.setCommentPositionJson(JSON.stringify({commentId:f,...h})),!0)},setCommentStatus(f,h){return A(()=>s.setCommentStatusJson(JSON.stringify({commentId:f,resolved:h})),!0)},removeComment(f){return A(()=>s.removeCommentJson(JSON.stringify({commentId:f})),!0)},setCommentFlavor(f){return A(()=>s.setCommentFlavorJson(JSON.stringify({flavor:f})),!0)},comments(){return A(()=>s.commentsJson())},addTextBox(f,h){return A(()=>s.addTextBoxJson(JSON.stringify({slideId:f,draft:h})),!0)},addTextBoxProfiled(f,h){return A(()=>s.addTextBoxProfiledJson(JSON.stringify({slideId:f,draft:h})),!0)},addShape(f,h){return A(()=>s.addShapeJson(JSON.stringify({slideId:f,draft:h})),!0)},addPicture(f,h){return A(()=>s.addPictureJson(JSON.stringify({slideId:f,...h})),!0)},setShapeFill(f,h,_){return A(()=>s.setShapeFillJson(JSON.stringify({slideId:f,shapeId:h,color:_})),!0)},setShapeStroke(f,h,_){return A(()=>s.setShapeStrokeJson(JSON.stringify({slideId:f,shapeId:h,stroke:_})),!0)},setShapeAdjust(f,h,_){return A(()=>s.setShapeAdjustJson(JSON.stringify({slideId:f,shapeId:h,adjustments:_})),!0)},removeShape(f,h){return A(()=>s.removeShapeJson(JSON.stringify({slideId:f,shapeId:h})),!0)},bringShapeToFront(f,h){return A(()=>s.bringShapeToFrontJson(JSON.stringify({slideId:f,shapeId:h})),!0)},sendShapeToBack(f,h){return A(()=>s.sendShapeToBackJson(JSON.stringify({slideId:f,shapeId:h})),!0)},bringShapeForward(f,h){return A(()=>s.bringShapeForwardJson(JSON.stringify({slideId:f,shapeId:h})),!0)},sendShapeBackward(f,h){return A(()=>s.sendShapeBackwardJson(JSON.stringify({slideId:f,shapeId:h})),!0)},moveShape(f,h,_,J){return A(()=>s.moveShapeJson(JSON.stringify({slideId:f,shapeId:h,x:_,y:J})),!0)},moveShapeProfiled(f,h,_,J){return A(()=>s.moveShapeProfiledJson(JSON.stringify({slideId:f,shapeId:h,x:_,y:J})),!0)},resizeShape(f,h,_,J){return A(()=>s.resizeShapeJson(JSON.stringify({slideId:f,shapeId:h,width:_,height:J})),!0)},setShapeRect(f,h,_){return A(()=>s.setShapeRectJson(JSON.stringify({slideId:f,shapeId:h,rect:_})),!0)},canUndo(){return D(()=>s.canUndo())},canRedo(){return D(()=>s.canRedo())},undoCaptureMode(){return D(()=>s.undoCaptureMode())},setUndoCaptureMode(f){D(()=>s.setUndoCaptureMode(f))},addUndoBoundary(){D(()=>s.addUndoBoundary())},undo(){return A(()=>s.undoJson(),!0)},undoProfiled(){return A(()=>s.undoProfiledJson(),!0)},redo(){return A(()=>s.redoJson(),!0)},encodeStateVector(){return D(()=>s.encodeStateVector())},encodeStateAsUpdate(f){return D(()=>f===void 0?s.encodeStateAsUpdate():s.encodeDiff(f))},encodeDiff(f){return D(()=>s.encodeDiff(f))},applyUpdate(f){return A(()=>s.applyUpdateJson(f),!0)},onUpdate(f){if(T(),typeof f!="function")throw new TypeError("update listener must be a function");let h=b++;l.set(h,f);try{L()}catch(J){throw l.delete(h),J}let _=!0;return()=>{_&&(_=!1,l.delete(h),x())}},dispose(){if(R)return;R=!0,r.length=0,l.clear(),m.length=0;let f;if(v){try{s.clearUpdateObservation()}catch(h){f=h}v=!1}try{xs(s)}catch(h){f??=h}try{d.free()}catch(h){f??=h}try{s.free()}catch(h){f??=h}if(f!==void 0)throw ln(f)}};if(yt.set(y,{doc:s,renderer:d,wasmCall:D,jsonWasmCall:A,peer:!!n}),Object.defineProperty(y,Symbol.for("@betteroffice/pptx/slide-layout-cache"),{value:{snapshot:()=>A(()=>d.snapshotWithLayoutKeysJson(s)),key:f=>D(()=>d.slideLayoutKey(s,f)),activate:(f,h)=>D(()=>d.setActiveSlide(s,f,h)),hitTest:(f,h,_)=>A(()=>d.hitTestSlideJson(s,f,h,_))}}),n){let f="deck",h="",_,J=!1,E=z=>{f="failed",r.length=0;try{y.dispose()}catch{}throw Us(z)},F=z=>{if(R||f!==z)throw new ot("stage",`Presentation peer requires ${z} stage`)};Wc.set(y,{metadata(){return F("ready"),A(()=>s.sessionMetadataJson())},displayListJson(z){return F("ready"),D(()=>d.layoutSlideJson(s,z))},async registerFonts(){try{F("deck"),f="registering";let z=[];for(let H of r){let ne=await globalThis.crypto.subtle.digest("SHA-256",H.bytes);F("registering"),z.push({family:H.family,bold:H.bold??!1,italic:H.italic??!1,fallback:H.fallback,fingerprint:Array.from(new Uint8Array(ne),se=>se.toString(16).padStart(2,"0")).join("")})}h=JSON.stringify(z),D(()=>{for(let H of r)c(dn(d,H,H.fallback),H,H.fallback);n.kind==="peer"&&s.registerPeerFontsJson(h)}),r.length=0,f="fonts"}catch(z){return E(z)}},adopt(){try{if(F("fonts"),n.kind!=="peer")throw new ot("stage","Only a peer can adopt identity");D(()=>s.adoptPeerIdentity()),f="ready"}catch(z){return E(z)}},hydration(){if(n.kind!=="baseline")throw new ot("stage","Only the worker baseline can capture hydration");if(_!==void 0)return F("ready"),_;try{return F("fonts"),_=D(()=>s.peerHydrationJson(h)),f="ready",_}catch(z){return E(z)}},replay(z,H){if(F("ready"),J||C)throw new ot("stage","Presentation replay cannot reenter");J=!0;try{let ne=$t(z);return D(()=>{let se=JSON.parse(s.replayJson(ne));return ef(se),H?.(se),se},!0)}finally{J=!1}}});for(let z of[...og,"insertTextProfiled","deleteTextProfiled","insertSlideProfiled","addTextBoxProfiled","moveShapeProfiled","undoProfiled","applyUpdate","setUndoCaptureMode","registerFont","registerFallbackFont","historyStep","readCommandContent"])Object.defineProperty(y,z,{value:()=>{throw new ot("stage","Retained presentations require ordered replay")}})}return y}function ef(t){if(!(t===null||typeof t!="object")){for(let e of Object.values(t))ef(e);Object.freeze(t)}}function Us(t){let e=ln(t);return e instanceof ot?e:new ot("engine",e.message)}function $t(t){return JSON.stringify(t,(e,n)=>{if(typeof n=="number"&&!Number.isFinite(n))throw new RangeError("host requests must not contain NaN or infinite numbers");return n})}function dn(t,e,n=!1){try{return(n?t.registerFallbackFont:t.registerFont).call(t,e.family,e.bold??!1,e.italic??!1,e.bytes)}catch(r){throw ln(r)}}function Os(){if(!Ms)throw new Error("pptx wasm is not initialized; call initWasm() first")}function sg(){let t=globalThis.crypto;if(!t||typeof t.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate a collaboration client ID");let e=new Uint32Array(2),n;do t.getRandomValues(e),n=(e[0]&2097151)*4294967296+e[1];while(n===0||n>=mr);return n}function Mo(t){try{return t()}catch(e){throw ln(e)}}function ag(t){try{return JSON.parse(t())}catch(e){throw ln(e)}}function dg(t){return ag(t)}function ln(t){if(t instanceof ot)return t;if(t!==null&&typeof t=="object"&&"name"in t&&t.name==="PresentationPeerError"&&"code"in t&&typeof t.code=="string"&&"message"in t&&typeof t.message=="string")return new ot(t.code,t.message);if(t instanceof Error)return t;if(typeof t=="string")try{let e=JSON.parse(t);if(e.code==="proposalPictureMediaTooLarge"&&typeof e.totalBytes=="number")return new Ao(e.totalBytes,e.limitBytes);if(e.code==="staleProposal"&&Array.isArray(e.targets)&&e.targets.every(n=>typeof n=="string"))return new Io(e.targets)}catch{}return Object.assign(new Error(typeof t=="string"?t:String(t)),{cause:t})}var Tn,Ms,ot,og,Wc,hr,Ht=X(()=>{"use strict";Cl();jt();jn();qr();Rl();Jt();Cn();Pc();ys();pr();ko();Eo();Jc();Tn=async(t,{codec:e,dict:n,maxOutput:r})=>(await bt(),Fl(Ki(ir(t),e,n===void 0?void 0:ir(n),r))),Ms=!1,ot=class extends Error{constructor(n,r){super(r);this.code=n;this.name="PresentationPeerError"}code},og=["insertText","deleteText","formatText","setStoryParagraphs","insertParagraphBreak","setParagraphAlignment","insertTableRow","deleteTableRow","insertTableColumn","deleteTableColumn","insertSlide","duplicateSlide","deleteSlide","moveSlide","setSlideNotes","setSlideLayout","addTextBox","addShape","addPicture","removeShape","moveShape","resizeShape","setShapeRect","setShapeFill","setShapeStroke","setShapeAdjust","bringShapeToFront","sendShapeToBack","bringShapeForward","sendShapeBackward","addComment","replyToComment","setCommentStatus","setCommentPosition","removeComment","setCommentFlavor","propose","acceptProposal","rejectProposal","applyEdits","addUndoBoundary","undo","redo"],Wc=new WeakMap});function rf(t){let e={input:[],collab:[],interactive:[]},n=[],r=0,o=0,i=0,s=Number.NEGATIVE_INFINITY,d=Number.NEGATIVE_INFINITY,a=!1,c=!1,l=null,m=()=>t.now()-s<fg?lg:cg;function b(L=!1){a||c||(c=!0,(L?queueMicrotask:t.turn)(()=>{c=!1,D()}))}function R(L){for(let x of tf)if(x!==L.lane)for(let k of e[x]){if(k.seq>L.seq)break;if(!(k.reorderable&&nf[L.lane]<nf[k.lane]))return!0}return!1}function v(){for(let L of tf){let x=e[L][0];if(x&&!R(x))return x}return null}function P(){let L=v();if(!L)return null;let x=[e[L.lane].shift()];if(L.lane==="collab")for(;e.collab[0]&&!R(e.collab[0]);)x.push(e.collab.shift());return x}function C(L){return L.idleAfterInputMs===void 0?Number.NEGATIVE_INFINITY:d+L.idleAfterInputMs}async function T(L){for(let x of L){x.mutates&&(o+=1),(x.mutates||x.reframes)&&(i+=1);try{await x.run()}catch(k){t.failed?.(k)}}}async function j(){let L=t.now(),x=n.findIndex(g=>C(g)<=L);if(x<0)return!1;let[k]=n.splice(x,1);try{if(k.version!==o||k.generation!==i){if((k.onStale?.()??"cancel")==="cancel")return k.cancel?.(),!0;k.version=o,k.generation=i}await k.run(m())==="yield"&&n.push(k)}catch(g){k.fail?k.fail(g):t.failed?.(g)}return!0}function q(){if(l?.(),l=null,n.length===0)return;let L=Math.min(...n.map(C));l=t.timer(()=>{l=null,b()},Math.max(1,L-t.now()))}async function D(){if(a)return;a=!0;let L=!1;try{let k=P();k?(L=!0,await T(k)):n.length>0&&(L=await j())}catch(k){L=!0,t.failed?.(k)}finally{a=!1}let x=L?v():null;x?b(!x.reorderable):L&&n.length>0?b():q()}function A(L,x){U({kind:`${L.kind}:install`,version:L.version,generation:L.generation,onStale:()=>"cancel",cancel:()=>L.cancel?.(),fail:k=>L.cancel?.(k),run:async()=>(await L.install(x),"done")})}function U(L){n.push(L),a||(l?.(),l=null),b()}return{submit(L){if(L.userInput&&(s=t.now()),L.holdsIdleTasks&&(d=t.now()),L.key!==void 0){let x=e[L.lane];for(let k=x.length-1;k>=0;k-=1)if(x[k].replaceableBy===L.key)try{x.splice(k,1)[0].supersede?.()}catch(g){t.failed?.(g)}}e[L.lane].push({...L,seq:r++}),l?.(),l=null,b(!0)},schedule:U,dispatch(L){let x=L,k=()=>U({kind:x.kind,version:x.version,generation:x.generation,onStale:()=>"cancel",cancel:()=>x.cancel?.(),fail:y=>x.cancel?.(y),run:async()=>(await x.install(x.compute(x.input)),"done")});if(!t.executor){k();return}let g=(x.transfer?.length??0)>0;t.executor.run({kind:x.kind,input:x.input,transfer:x.transfer}).then(y=>A(x,y),y=>g?x.cancel?.(y):k())},budget:m,get version(){return o},get generation(){return i},bump(L){L.version&&(o+=1),(L.version||L.generation)&&(i+=1)},pending(){return{foreground:e.input.length+e.collab.length+e.interactive.length,background:n.length}}}}var tf,nf,lg,cg,fg,of=X(()=>{"use strict";tf=["input","collab","interactive"],nf={input:0,collab:1,interactive:2,background:3},lg=8,cg=24,fg=1e3});function Ln(t){return typeof WebAssembly<"u"&&t instanceof WebAssembly.RuntimeError||t instanceof Error&&("code"in t&&t.code===ug||t.message.startsWith(pg)||t.message===mg)}var ug,pg,mg,Bo=X(()=>{"use strict";ug="GenericFailure",pg="BetterOffice engine memory budget exceeded",mg="This engine object failed in an earlier call and can only be freed"});function Ns(t){let e={name:t instanceof Error?t.name:"Error",message:t instanceof Error?t.message:String(t)};return t!==null&&typeof t=="object"&&"code"in t&&typeof t.code=="string"&&(e.code=t.code),t!==null&&typeof t=="object"&&"refusal"in t&&(e.refusal=t.refusal),e}function wr(t){return t instanceof We||Ln(t)}function gg(t){return t instanceof We?t:new We(wr(t)?"trap":"crash",Ns(t).message)}function sf(t,e){let n,r=g=>{let y=gg(g);return y.code==="trap"?e.trapFailure?.(y)??y:y},o=!1,i=()=>{},s=()=>{},d,a=new Set,c=0,l=new Set,m=new Set,b=()=>o||n!==void 0;function R(){i(),s();for(let g of l)clearTimeout(g);l.clear();for(let g of m)try{g.cancel()}catch{}m.clear();try{e.onDispose?.()}catch{}}function v(g){if(!b()){n=g;try{t.post({protocol:1,kind:"failure",code:g.code,message:g.message,...g.diagnostics===void 0?{}:{diagnostics:g.diagnostics}})}catch{}R()}}function P(g,y){if(!b())try{t.post(g,y)}catch(f){v(new We("message",`Session could not post a message: ${Ns(f).message}`))}}function C(g,y){if(b())return()=>{};let f=setTimeout(()=>{l.delete(f),b()||g()},y);return l.add(f),()=>{clearTimeout(f),l.delete(f)}}function T(g){let y={end(){m.delete(y)},cancel(){y.end(),g?.()}};return g&&m.add(y),y}function j(g,y){if(b())return y;let f=h=>{if(b())return y;if(!wr(h))throw h;return v(r(h)),y};try{let h=g();return h instanceof Promise?h.catch(f):h}catch(h){return f(h)}}function q(g){let y=g.then(),f=h=>_=>{if(!b())try{return h(_)}catch(J){v(r(J));return}};return y.then=((h,_)=>Promise.prototype.then.call(y,h&&f(h),_&&f(_))),y}let D=e.executor,A=rf({now:Date.now,turn:g=>{C(g,0)},timer:C,executor:D&&{run(g){return q(D.run(g))}},failed:g=>v(r(g))}),U={schedule(g){if(b()){try{g.cancel?.()}catch{}return}let y=T(g.cancel&&(()=>g.cancel()));A.schedule({kind:g.kind,idleAfterInputMs:g.idleAfterInputMs,get version(){return g.version},set version(f){g.version=f},get generation(){return g.generation},set generation(f){g.generation=f},...g.onStale?{onStale:()=>j(()=>g.onStale(),"cancel")}:{},...g.cancel?{cancel(){return y.end(),j(()=>g.cancel(),void 0)}}:{},...g.fail?{fail(f){return y.end(),j(()=>g.fail(f),void 0)}}:{},async run(f){if(b())return"done";try{let h=await g.run(f);return h==="done"&&y.end(),b()?"done":h}catch(h){if(y.end(),b())return"done";if(wr(h))return v(r(h)),"done";throw h}}})},dispatch(g){if(b()){try{g.cancel?.()}catch{}return}let y=T(g.cancel&&(()=>g.cancel()));A.dispatch({kind:g.kind,input:g.input,transfer:g.transfer,get version(){return g.version},set version(f){g.version=f},get generation(){return g.generation},set generation(f){g.generation=f},...g.cancel?{cancel(f){return y.end(),j(()=>g.cancel(f),void 0)}}:{},compute(f){return j(()=>g.compute(f),void 0)},async install(f){if(!b())try{await g.install(f)}catch(h){if(y.end(),b())return;if(wr(h)){v(r(h));return}throw h}finally{y.end()}}})},bump:g=>A.bump(g),budget:()=>A.budget(),pending:()=>A.pending(),get version(){return A.version},get generation(){return A.generation}};function L(g,y){Ga(y)?P({protocol:1,kind:"reply",id:g,ok:!0,value:y.value},y.transfer):P({protocol:1,kind:"reply",id:g,ok:!0,value:y})}function x(g,y){wr(y)?v(r(y)):P({protocol:1,kind:"reply",id:g,ok:!1,error:Ns(y)})}async function k(g){if(!b()){d=g.id,c=Date.now();try{let y=e.handlers[g.method],f=await y(e.context,...g.args);$a(f)?(a.add(g.id),f.promise.then(h=>L(g.id,h),h=>x(g.id,h)).finally(()=>a.delete(g.id))):L(g.id,f)}catch(y){x(g.id,y)}finally{d===g.id&&(d=void 0)}}}return i=t.listen(g=>{if(!b()){if(!zr(g))v(new We("message","Session received a malformed client message"));else if(g.kind==="dispose")o=!0,R(),t.close();else if(g.kind==="call"&&!n){let y=Zt(e.policies,g.method)?e.policies[g.method]:void 0;if(!Zt(e.handlers,g.method)||!y){P({protocol:1,kind:"reply",id:g.id,ok:!1,error:{name:"Error",message:`Unknown session method: ${g.method}`}});return}let f;try{f=typeof y=="function"?y(...g.args):y}catch(h){x(g.id,h);return}A.submit({...f,run:()=>k(g),supersede:()=>P({protocol:1,kind:"reply",id:g.id,ok:!1,error:{name:Ua,message:"Superseded by a newer request"}})})}}}),s=t.onError(g=>v(r(g))),{scheduler:U,emit:(g,y,f)=>P({protocol:1,kind:"event",name:g,payload:y},f),progress(){let g=Date.now(),y=d??a.values().next().value;y===void 0||g-c<hg||(c=g,P({protocol:1,kind:"progress",id:y}))}}}var hg,af=X(()=>{"use strict";zt();of();On();Bo();hg=1e3});function cn(t){Nr(t)}var Oo=X(()=>{"use strict";Qt()});function df(t){let e=0,n=new Map;return{install(r){return new Promise(o=>{let i=++e,s=setTimeout(()=>d([]),5e3),d=c=>{n.delete(i)&&(clearTimeout(s),o(r.filter((l,m)=>c.includes(m))))};n.set(i,d);let a=r.map(c=>({...c,bytes:c.bytes.slice(0)}));try{t({id:i,faces:a},a.map(c=>c.bytes))}catch{d([])}})},receive(r){return!r||typeof r!="object"||!("kind"in r)||r.kind!=="pptx-default-fonts-installed"?!1:("id"in r&&typeof r.id=="number"&&"installed"in r&&Array.isArray(r.installed)&&n.get(r.id)?.(r.installed.filter(o=>Number.isSafeInteger(o)&&o>=0)),!0)},dispose(){for(let r of n.values())r([])}}}var lf=X(()=>{"use strict"});function Sg(t,e){let n=2166136261;for(let r of e)n=Math.imul(n^r,16777619)>>>0;return JSON.stringify([t,e.byteLength,n])}function No(t=()=>wg.load(),e=Date.now){let n,r,o=0,i,s=new Map;return{start(){if(r&&(i===void 0||e()<i))return r;let d=bg[o++];return i=void 0,r=Promise.resolve().then(t).then(a=>{n=new a.MetafileConverter}).catch(a=>{throw d!==void 0&&(i=e()+d),a}),r},retryIn(){return i!==void 0?Math.max(0,i-e()):r?void 0:0},ready(){return n!==void 0},convert(d,a){if(!n||a.byteLength>yg)return;let c=Sg(d,a);if(s.has(c))return s.get(c);let l;try{let m=n.toSvg(a);m&&(l=new Uint8Array(m))}catch{}return s.set(c,l),l}}}var yg,bg,wg,Ds=X(()=>{"use strict";jr();jn();jt();yg=16*1024*1024,bg=[5e3,3e4,12e4],wg={async load(){let t=await _l(),e=td();return await t.default({module_or_path:e.protocol==="file:"?await wn(e):e}),t}}});function Do(t){return zn(t.then(e=>{let n=e.buffer instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;return Le(n,[n])},e=>{throw e instanceof yn?new $e("font-unavailable",e.message):e}))}var zs=X(()=>{"use strict";Nt();Fn();zt()});function cf(t){let e=[];for(let n of t)n.op==="event"&&n.event.type==="message"&&e.push(n.event.data);return e}function qs(t){return t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.slice().buffer}function vg(t){let e=t;return typeof e=="object"&&e!==null&&Pg.has(e.code)&&typeof e.message=="string"}function _g(t,e){if(typeof t!="object"||t===null)return!1;let n=t;switch(n.type){case"open":return!0;case"message":return n.data instanceof ArrayBuffer&&n.data.byteLength<=e;case"close":return n.reason===void 0||typeof n.reason=="string";default:return!1}}function ff(t,e,n){if(typeof t!="object"||t===null)return!1;let{provider:r,ops:o}=t;return!Number.isSafeInteger(r)||r<0||!Array.isArray(o)||o.length===0?!1:o.every(i=>{if(typeof i!="object"||i===null)return!1;let s=i;if(!xg(s.seq))return!1;switch(s.op){case"create":return typeof s.options=="object"&&s.options!==null&&Object.keys(s.options).every(d=>n.optionKeys.has(d));case"connect":case"disconnect":case"destroy":return!0;case"fail":return vg(s.error);case"cursor":return typeof s.broadcast=="boolean"&&(s.cursor===null||n.validCursor(s.cursor,e));case"event":return _g(s.event,e);default:return!1}})}function zo(){let t=globalThis.performance;return typeof t?.now!="function"?0:typeof t.timeOrigin=="number"?t.timeOrigin:Date.now()-t.now()}var Pg,xg,qo=X(()=>{Pg=new Set(["backpressure","protocol","replica","transport"]),xg=t=>Number.isSafeInteger(t)&&t>=0});function Cg(t,e){return async(n,r)=>{if(n.byteLength>=kg)try{return await(await e())(n,r)}catch{}return t(n,r)}}function jo(t){return _t==="wasm"?Cg(t,()=>Lt().then(e=>e.decodeFontFaceOutsideEngine)):t}var kg,js=X(()=>{"use strict";_n();jt();kg=512*1024});function uf(t){let e=new Map,n=[],r=!1,o=!1,i=null,s=(v,P)=>{if(o)return;let C=!r&&n.length===0,T=n[n.length-1];T?.provider===v?T.out.push(P):n.push({provider:v,out:[P]}),C&&t.onOutput?.()},d=()=>{let v=i;if(!v||v.updates.length===0)return;i={updates:[],arrivals:[],single:!0};let P=t.merge(v.updates,v.single&&v.updates.length===1);if("failed"in P){for(let C of v.arrivals)C.fail(P.failed);return}v.arrivals.forEach((C,T)=>C.settle(T===v.arrivals.length-1?P.applied:null))},a=(v,P,C)=>{if(!i)throw new Error("Collaboration updates merge only within a pipe burst");return i.updates.push(...P),i.arrivals.push(t.arrive(v)),i.single&&=C,null},c=v=>({clientId:t.clientId,encodeStateVector:()=>(d(),t.read.encodeStateVector()),encodeStateAsUpdate:P=>(d(),t.read.encodeStateAsUpdate(P)),...t.read.encodeStateAsUpdateChunks&&{encodeStateAsUpdateChunks:(P,C)=>(d(),t.read.encodeStateAsUpdateChunks(P,C))},applyUpdate:P=>a(v(),[P],!0),applyUpdateChunks:P=>a(v(),P,!1),onUpdate:t.onUpdate}),l=(v,P)=>{let C,T=new Js(D=>{C.echo||s(v,typeof D=="string"?{do:D,through:C.through}:{do:"send",data:qs(D),through:C.through})}),j=t.createProvider(c(()=>C.provider),T,P);C={id:v,provider:j,transport:T,through:0,echo:!1,leaveClock:null,stop:[]};let q=!1;return C.stop.push(j.onStatus(({status:D,synced:A})=>s(v,{do:"status",status:D,synced:A,through:C.through})),j.onError(D=>{C.echo||s(v,{do:"error",error:{code:D.code,message:D.message},through:C.through})}),j.onPeers(D=>{q&&s(v,{do:"peers",peers:[...D],timeOrigin:zo(),through:C.through})})),q=!0,e.set(v,C),C},m=(v,P)=>{v.echo=!0;try{P()}finally{v.echo=!1}},b=v=>{let P=e.get(v.provider);for(let C of v.ops){if(C.op==="create"){P??=l(v.provider,C.options),P.through=C.seq;continue}if(!P){s(v.provider,{do:"lost"});return}let T=P;switch(T.through=C.seq,C.op){case"connect":m(T,()=>T.provider.connect());break;case"disconnect":m(T,()=>T.provider.disconnect());break;case"fail":m(T,()=>T.transport.deliver({type:"error",error:t.transportError(C.error)}));break;case"destroy":m(T,()=>T.provider.destroy());for(let j of T.stop)j();e.delete(T.id),P=void 0;break;case"cursor":T.provider.setCursor(C.cursor,C.broadcast);break;case"event":{let{event:j}=C;T.transport.deliver(j.type==="message"?{type:"message",data:new Uint8Array(j.data)}:j);break}}}},R=()=>{for(let v of e.values()){let P=t.leave(v.provider),C=P?.clock??null;C!==v.leaveClock&&(v.leaveClock=C,s(v.id,{do:"leave",data:P?qs(P.frame):null,through:v.through}))}};return{run(v){if(!o){r=!0,i={updates:[],arrivals:[],single:!0};try{b(v),d()}finally{i=null,r=!1}}},drain(){r=!0;try{R()}finally{r=!1}if(n.length===0)return;let v=n;n=[];let P=[];for(let C of v)for(let T of C.out)(T.do==="send"||T.do==="leave"&&T.data)&&P.push(T.data);return{batches:v,transfer:P}},dispose(){if(!o){o=!0;for(let v of e.values()){for(let P of v.stop)P();v.echo=!0;try{v.provider.destroy()}catch{}}e.clear(),n=[]}}}}var Js,pf=X(()=>{qo();Js=class{constructor(e){this.emit=e}emit;listener=null;connect(){}disconnect(){this.emit("disconnect")}send(e){return this.emit(e),!0}onEvent(e){return this.listener=e,()=>{this.listener===e&&(this.listener=null,this.emit("unsubscribe"))}}deliver(e){this.listener?.(e)}}});function Fg(t){return t instanceof Error&&t.message?t.message:typeof t=="string"&&t?t:"Unknown error"}function Eg(t){if(t[0]!==0||t[1]!==2)return!1;let e=0;for(let n=2,r=0;n<Math.min(t.byteLength,7);n++,r+=7)if(e+=(t[n]&127)*2**r,t[n]<128)return n+1+e===t.byteLength;return!1}var Rg,Ws,Tg,Jo,mf=X(()=>{qo();Rg=["backpressure","protocol","replica","transport"],Ws=64,Tg=250;Jo=class{constructor(e,n,r){this.transport=n;this.options=r;this.endpoint=e.open(o=>this.receive(o),o=>this.lose(o)),this.enqueue({op:"create",seq:++this.seq,options:r.worker})}transport;options;endpoint;statusListeners=new Map;errorListeners=new Map;peerListeners=new Map;nextListenerId=0;connectionStatus="disconnected";isSynced=!1;peerList=[];seq=0;floor=0;sendFloor=0;inboundBytes=0;flushingFrames=!1;queue=[];posting=!1;flushQueued=!1;heldTimer=null;urgent=!1;unsubscribeTransport=null;subscription=0;wantsConnection=!1;connectAttempt=0;leaveFrame=null;pendingFrames=[];queuedBytes=0;isDestroyed=!1;closed=!1;get status(){return this.connectionStatus}get synced(){return this.isSynced}get pendingBytes(){return this.queuedBytes}get peers(){return this.peerList}setCursor(e,n){this.isDestroyed||this.enqueue({op:"cursor",seq:++this.seq,cursor:e,broadcast:n})}onPeers(e){if(this.isDestroyed)return()=>{};let n=this.nextListenerId++;return this.peerListeners.set(n,e),e(this.peers),()=>this.peerListeners.delete(n)}onStatus(e){if(this.isDestroyed)return()=>{};let n=this.nextListenerId++;return this.statusListeners.set(n,e),()=>this.statusListeners.delete(n)}onError(e){if(this.isDestroyed)return()=>{};let n=this.nextListenerId++;return this.errorListeners.set(n,e),()=>this.errorListeners.delete(n)}connect(){if(this.isDestroyed||this.connectionStatus==="connected"||this.connectionStatus==="connecting")return;if(this.closed){this.report(this.options.makeError("replica","Collaboration replica is retired"));return}this.wantsConnection=!0,this.floor=++this.seq,this.enqueue({op:"connect",seq:this.floor});let e=++this.connectAttempt;if(this.setStatus("connecting",!1),!(!this.wantsConnection||this.isDestroyed||e!==this.connectAttempt)){if(!this.unsubscribeTransport){let n=++this.subscription,r;try{if(r=this.transport.onEvent(o=>this.forward(n,o)),typeof r!="function")throw new TypeError("Transport event subscription must return a function")}catch(o){this.subscription+=1,this.fail(this.transportError("Failed to subscribe to transport events",o));return}if(!this.wantsConnection||this.isDestroyed||e!==this.connectAttempt||n!==this.subscription){try{r()}catch(o){this.isDestroyed||this.report(this.transportError("Failed to unsubscribe from stale transport events",o))}return}this.unsubscribeTransport=r}try{let n=this.transport.connect();n&&n.catch(r=>{!this.isDestroyed&&this.wantsConnection&&this.connectAttempt===e&&this.fail(this.transportError("Transport connect failed",r))})}catch(n){this.fail(this.transportError("Transport connect failed",n))}}}disconnect(){if(this.isDestroyed)return;if(this.closed){this.setStatus("disconnected",!1);return}if(!(this.wantsConnection||this.unsubscribeTransport!==null||this.connectionStatus!=="disconnected"))return;this.sendLeave(),this.floor=++this.seq,this.enqueue({op:"disconnect",seq:this.floor});let n=this.release(!0);this.setStatus("disconnected",!1);for(let r of n)this.report(r)}destroy(){if(this.isDestroyed)return;let e=!this.closed&&(this.wantsConnection||this.unsubscribeTransport!==null||this.connectionStatus==="connecting"||this.connectionStatus==="connected");e&&this.sendLeave(),this.floor=++this.seq,this.enqueue({op:"destroy",seq:this.floor});let n=this.closed?[]:this.release(e);this.isDestroyed=!0,this.setStatus("destroyed",!1);for(let r of n)this.report(r);this.statusListeners.clear(),this.errorListeners.clear(),this.peerListeners.clear()}transportError(e,n){return this.options.normalize("transport",e,n)}release(e){this.wantsConnection=!1,this.connectAttempt+=1,this.leaveFrame=null,this.clearQueue(),this.clearPeers();let n=[],r=this.unsubscribeTransport;if(this.unsubscribeTransport=null,this.subscription+=1,r)try{r()}catch(o){n.push(this.transportError("Failed to unsubscribe from transport events",o))}if(!e)return n;try{let o=this.transport.disconnect();o&&o.catch(i=>{this.isDestroyed||this.report(this.transportError("Transport disconnect failed",i))})}catch(o){n.push(this.transportError("Transport disconnect failed",o))}return n}fail(e){if(this.isDestroyed||!this.wantsConnection)return;let n=e.code;this.floor=++this.seq,this.enqueue({op:"fail",seq:this.floor,error:{code:typeof n=="string"&&Rg.includes(n)?n:"transport",message:e.message}});let r=this.release(!0);this.setStatus("disconnected",!1),this.report(e);for(let o of r)this.report(o)}sendLeave(){let e=this.leaveFrame;if(this.leaveFrame=null,!(!e||!this.options.hasUser||!this.unsubscribeTransport||this.connectionStatus!=="connected"))try{this.transport.send(e)}catch(n){this.report(this.transportError("Failed to send awareness leave",n))}}enqueue(e,n=!1){this.closed||(this.queue.push(e),this.schedule(n))}schedule(e){if(e||(this.urgent=!0),!(this.posting||this.flushQueued)){if(e){this.heldTimer??=setTimeout(()=>{this.heldTimer=null,this.flush()},Tg);return}this.flushQueued=!0,queueMicrotask(()=>{this.flushQueued=!1,this.flush()})}}flush(){if(this.posting||this.closed||this.queue.length===0)return;this.heldTimer!==null&&(clearTimeout(this.heldTimer),this.heldTimer=null);let e=this.queue;this.queue=[],this.urgent=!1,this.posting=!0;let n=e.some(i=>i.op==="destroy"),r=e.reduce((i,s)=>s.op==="event"&&s.event.type==="message"?i+s.event.data.byteLength+Ws:i,0),o;try{o=this.endpoint.post(e,cf(e))}catch(i){o=Promise.reject(i)}o.then(()=>{this.posting=!1,this.inboundBytes-=r,n?this.close():this.urgent?this.flush():this.queue.length>0&&this.schedule(!0)},i=>{this.posting=!1,this.inboundBytes-=r,this.lose(Fg(i))})}forward(e,n){if(!(this.closed||this.isDestroyed||e!==this.subscription))switch(n.type){case"message":if(this.inboundBytes===0?n.data.byteLength>this.options.maxPendingBytes:n.data.byteLength+Ws>this.options.maxPendingBytes-this.inboundBytes){this.fail(this.options.makeError("backpressure","Pending replica data exceeds the byte limit"));return}this.inboundBytes+=n.data.byteLength+Ws,this.enqueue({op:"event",seq:++this.seq,event:{type:"message",data:n.data.slice().buffer}},!this.isSynced&&Eg(n.data)&&this.inboundBytes<=this.options.maxPendingBytes/2);return;case"open":case"close":this.clearQueue(),n.type==="close"&&(this.connectAttempt+=1,this.leaveFrame=null),this.sendFloor=++this.seq,this.enqueue({op:"event",seq:this.sendFloor,event:n.type==="open"?{type:"open"}:{type:"close",...n.reason!==void 0&&{reason:n.reason}}}),n.type==="close"&&(this.clearPeers(),this.setStatus("disconnected",!1));return;case"drain":this.flushPending();return;case"error":this.fail(this.transportError("Transport error",n.error));return;default:this.fail(this.options.makeError("transport","Unknown transport event"))}}receive(e){for(let n of e){if(this.closed||this.isDestroyed)return;if(n.do==="lost"){this.lose("Collaboration replica is retired");return}if(!(n.through<this.floor))switch(n.do){case"unsubscribe":{let r=this.release(!1);for(let o of r)this.report(o);break}case"disconnect":{this.wantsConnection=!1;let r=this.release(!0);for(let o of r)this.report(o);break}case"send":n.through>=this.sendFloor&&this.send(new Uint8Array(n.data));break;case"leave":n.through>=this.sendFloor&&(this.leaveFrame=n.data?new Uint8Array(n.data):null);break;case"status":n.through>=this.sendFloor&&this.setStatus(n.status,n.synced);break;case"peers":{if(n.through<this.sendFloor||n.peers.length===0&&this.peerList.length===0)break;let r=this.options.rebasePeer,o=n.timeOrigin-zo();this.peerList=r?n.peers.map(i=>r(i,o)):n.peers,this.emitPeers();break}case"error":this.report(this.options.makeError(n.error.code,n.error.message));break}}}send(e){if(!this.unsubscribeTransport)return;if(this.pendingFrames.length>0){this.queueFrame(e);return}let n=this.sendFloor,r;try{r=this.transport.send(e.slice())}catch(o){this.fail(this.transportError("Transport send failed",o));return}if(typeof r!="boolean"){this.fail(this.options.makeError("transport","Transport send must return a boolean"));return}!r&&this.unsubscribeTransport!==null&&n===this.sendFloor&&this.queueFrame(e)}queueFrame(e){if(e.byteLength>this.options.maxPendingBytes-this.queuedBytes){this.fail(this.options.makeError("backpressure",`Pending collaboration data exceeds ${this.options.maxPendingBytes} bytes`));return}this.pendingFrames.push(e),this.queuedBytes+=e.byteLength}flushPending(){if(!this.flushingFrames){this.flushingFrames=!0;try{for(;this.unsubscribeTransport&&this.pendingFrames.length>0;){let e=this.pendingFrames[0],n;try{n=this.transport.send(e.slice())}catch(r){this.fail(this.transportError("Transport send failed",r));return}if(typeof n!="boolean"){this.fail(this.options.makeError("transport","Transport send must return a boolean"));return}if(!n||this.pendingFrames[0]!==e)return;this.pendingFrames.shift(),this.queuedBytes-=e.byteLength}}finally{this.flushingFrames=!1}}}clearQueue(){this.pendingFrames.length=0,this.queuedBytes=0}lose(e){if(this.closed||(this.close(),this.isDestroyed))return;this.sendLeave();let n=this.release(this.wantsConnection||this.connectionStatus!=="disconnected");setTimeout(()=>{if(!this.isDestroyed){this.setStatus("disconnected",!1),this.report(this.options.makeError("replica",e));for(let r of n)this.report(r)}},0)}close(){this.closed||(this.closed=!0,this.queue=[],this.heldTimer!==null&&(clearTimeout(this.heldTimer),this.heldTimer=null),this.endpoint.close())}clearPeers(){this.peerList.length!==0&&(this.peerList=[],this.emitPeers())}setStatus(e,n){if(!(this.connectionStatus===e&&this.isSynced===n)){this.connectionStatus=e,n&&!this.isSynced&&this.queue.length>0&&this.schedule(!1),this.isSynced=n;for(let[r,o]of[...this.statusListeners])if(this.statusListeners.get(r)===o)try{o({status:e,synced:n})}catch{}}}emitPeers(){let e=this.peers;for(let[n,r]of[...this.peerListeners])if(this.peerListeners.get(n)===r)try{r(e)}catch{}}report(e){for(let[n,r]of[...this.errorListeners])if(this.errorListeners.get(n)===r)try{r(e)}catch{}}}});function hf(t){return Ig.get(t)}var Ig,gf=X(()=>{"use strict";Ig=new WeakMap});var tt,Hs=X(()=>{"use strict";tt=class extends Error{code;cause;constructor(e,n,r){super(n),this.name="CollaborationError",this.code=e,this.cause=r}}});function $s(t,e,n){if(!Number.isSafeInteger(e)||e<(n?0:1))throw new RangeError(`${t} must be ${n?"a non-negative":"a positive"} integer`);return e}function Bg(t){return t instanceof Error&&t.message?t.message:typeof t=="string"&&t?t:"Unknown error"}function Be(t,e,n){return n instanceof tt?n:new tt(t,`${e}: ${Bg(n)}`,n)}function Sr(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`${e} must return a Uint8Array`);return t.slice()}function Gs(t){typeof t=="object"&&t&&"unref"in t&&t.unref()}function Og(t){if(!Number.isSafeInteger(t)||t<0)throw new RangeError("Replica clientId must be a non-negative safe integer");return t}function Ng(t){if(t===null)return null;if(!t||typeof t.slideId!="string"||t.slideId.length===0)throw new TypeError("Presence cursor slideId must be a non-empty string");if(t.shapeId!==void 0&&(typeof t.shapeId!="string"||t.shapeId.length===0))throw new TypeError("Presence cursor shapeId must be a non-empty string");return t.shapeId?{slideId:t.slideId,shapeId:t.shapeId}:{slideId:t.slideId}}function wf(t){return yf.get(t)()}function Sf(t){return bf.get(t)()}var Mg,Ug,yf,bf,Wo,Pf=X(()=>{"use strict";mf();gf();Eo();Fo();Hs();Mg=16*1024*1024,Ug=16*1024*1024;yf=new WeakMap,bf=new WeakMap;Wo=class{piped;openEpoch=0;replica;transport;maxFrameBytes;maxMessagesPerFrame;maxPendingBytes;localClientId;localUser;remotePresence;statusListeners=new Map;errorListeners=new Map;presenceListeners=new Map;pendingFrames=[];unsubscribeReplica;unsubscribeTransport=()=>{};hasTransportSubscription=!1;connectionStatus="disconnected";isSynced=!1;wantsConnection=!1;isOpen=!1;isDestroyed=!1;epoch=0;connectAttempt=0;nextListenerId=0;queuedBytes=0;incoming=[];incomingBytes=0;incomingBusy=!1;asyncReplica=!1;incomingGeneration=0;isFlushing=!1;localClock=0;reportedClockExhaustion=!1;localCursor=null;applyingArrival;lastAwarenessSentAt=0;cursorTimer=null;heartbeatTimer=null;expiryTimer=null;constructor(e,n,r={}){this.replica=e,"setCollaborative"in e&&e.setCollaborative?.(),this.transport=n,this.localClientId=Og(e.clientId),this.localUser=_c(this.localClientId,r.user),this.remotePresence=new Co(this.localClientId),this.maxFrameBytes=$s("maxFrameBytes",r.maxFrameBytes??Ct,!1),this.maxMessagesPerFrame=$s("maxMessagesPerFrame",r.maxMessagesPerFrame??En,!1),this.maxPendingBytes=$s("maxPendingBytes",r.maxPendingBytes??Mg,!0),yf.set(this,()=>this.beginArrival()),bf.set(this,()=>this.leaveFrame());let o=hf(e);if(o){this.unsubscribeReplica=()=>{},this.piped=new Jo(o,n,{worker:{maxFrameBytes:this.maxFrameBytes,maxMessagesPerFrame:this.maxMessagesPerFrame,user:{...this.localUser}},maxPendingBytes:this.maxPendingBytes,hasUser:!0,makeError:(i,s,d)=>new tt(i,s,d),normalize:Be});return}try{this.unsubscribeReplica=e.onUpdate((i,s)=>{s==="local"&&this.forwardLocalUpdate(i)})}catch(i){throw Be("replica","Failed to observe replica updates",i)}}get status(){return this.piped?this.piped.status:this.connectionStatus}get synced(){return this.piped?this.piped.synced:this.isSynced}get pendingBytes(){return this.piped?this.piped.pendingBytes:this.queuedBytes}get peers(){return this.piped?this.piped.peers:this.remotePresence.peers}setCursor(e){if(this.isDestroyed||this.piped?.status==="destroyed")return;let n=Ng(e),r=!n||_s(n)?n:null;if(n&&!r){let o=new tt("protocol",`Presence cursor identifiers exceed ${1024} characters; cursor dropped`);this.report(o)}if(!ks(this.localCursor,r)){if(this.localCursor=r,this.piped)return this.piped.setCursor(r,!0);this.isOpen&&this.wantsConnection&&this.scheduleCursorBroadcast()}}connect(){if(this.piped)return this.piped.connect();if(this.isDestroyed||this.isOpen||this.connectionStatus==="connecting")return;this.wantsConnection=!0;let e=this.hasTransportSubscription?this.epoch:++this.epoch,n=++this.connectAttempt;if(this.setStatus("connecting",!1),!!this.isCurrent(e)){if(!this.hasTransportSubscription){let r;try{if(r=this.transport.onEvent(o=>this.handleTransportEvent(e,o)),typeof r!="function")throw new TypeError("Transport event subscription must return a function")}catch(o){this.failConnection(e,Be("transport","Failed to subscribe to transport events",o));return}if(!this.isCurrent(e)){try{r()}catch(o){this.isDestroyed||this.report(Be("transport","Failed to unsubscribe from stale transport events",o))}return}this.unsubscribeTransport=r,this.hasTransportSubscription=!0}try{let r=this.transport.connect();r&&r.catch(o=>{this.isCurrent(e)&&this.connectAttempt===n&&this.failConnection(e,Be("transport","Transport connect failed",o))})}catch(r){this.failConnection(e,Be("transport","Transport connect failed",r))}}}disconnect(){if(this.piped)return this.piped.disconnect();if(this.isDestroyed||!(this.wantsConnection||this.isOpen||this.hasTransportSubscription||this.connectionStatus!=="disconnected"))return;if(this.isOpen&&this.wantsConnection){let o=this.epoch;if(this.broadcastLocalPresence(!0),!this.isCurrent(o))return}this.stopPresenceTimers(),this.wantsConnection=!1,this.isOpen=!1,this.epoch+=1,this.connectAttempt+=1;let n=this.takeTransportSubscription();this.clearPending(),this.clearRemotePresence();let r=this.cleanupTransport(n,!0);this.setStatus("disconnected",!1);for(let o of r)this.report(o)}destroy(){if(this.piped){this.piped.destroy(),this.isDestroyed=!0,this.errorListeners.clear();return}if(this.isDestroyed||(this.isOpen&&this.wantsConnection&&this.broadcastLocalPresence(!0),this.isDestroyed))return;let e=this.wantsConnection||this.isOpen||this.hasTransportSubscription||this.connectionStatus==="connecting"||this.connectionStatus==="connected";this.stopPresenceTimers(),this.isDestroyed=!0,this.wantsConnection=!1,this.isOpen=!1,this.epoch+=1,this.connectAttempt+=1;let n=this.takeTransportSubscription();this.clearPending(),this.clearRemotePresence();let r=this.cleanupTransport(n,e);this.setStatus("destroyed",!1);for(let o of r)this.report(o);try{this.unsubscribeReplica()}catch(o){this.report(Be("replica","Failed to unsubscribe from replica updates",o))}this.unsubscribeReplica=()=>{},this.statusListeners.clear(),this.errorListeners.clear(),this.presenceListeners.clear()}onStatus(e){if(this.isDestroyed)return()=>{};if(typeof e!="function")throw new TypeError("status listener must be a function");if(this.piped)return this.piped.onStatus(e);let n=this.nextListenerId++;return this.statusListeners.set(n,e),()=>this.statusListeners.delete(n)}onError(e){if(this.isDestroyed)return()=>{};if(typeof e!="function")throw new TypeError("error listener must be a function");if(this.piped){let r=this.piped.onError(e),o=this.nextListenerId++;return this.errorListeners.set(o,e),()=>{r(),this.errorListeners.delete(o)}}let n=this.nextListenerId++;return this.errorListeners.set(n,e),()=>this.errorListeners.delete(n)}onPresence(e){if(this.isDestroyed)return()=>{};if(typeof e!="function")throw new TypeError("presence listener must be a function");if(this.piped)return this.piped.onPeers(r=>{try{e(r)}catch{}});let n=this.nextListenerId++;this.presenceListeners.set(n,e);try{e(this.peers)}catch{}return()=>this.presenceListeners.delete(n)}beginArrival(){let e=this.epoch,n=this.openEpoch,r=this.applyingArrival;r&&(r.deferred=!0);let o=!1,i=s=>{o||(o=!0,this.isCurrent(e)&&this.isOpen&&this.openEpoch===n&&s())};return{settle:()=>i(()=>{r?.synced&&this.setStatus("connected",!0)}),fail:s=>i(()=>this.failConnection(e,Be("replica","Failed to apply remote update",s)))}}leaveFrame(){if(!this.isOpen||this.isDestroyed||!this.wantsConnection||this.localClock>=Number.MAX_SAFE_INTEGER)return null;try{let e=this.localClock+1;return{clock:e,frame:As([{clientId:this.localClientId,clock:e,state:null}],this.maxFrameBytes)}}catch{return null}}isCurrent(e){return!this.isDestroyed&&this.wantsConnection&&e===this.epoch}failConnection(e,n){if(!this.isCurrent(e))return;this.wantsConnection=!1,this.isOpen=!1,this.epoch+=1,this.connectAttempt+=1,this.stopPresenceTimers();let r=this.takeTransportSubscription();this.clearPending(),this.clearRemotePresence();let o=this.cleanupTransport(r,!0);this.setStatus("disconnected",!1),this.report(n);for(let i of o)this.report(i)}takeTransportSubscription(){let e=this.unsubscribeTransport;return this.unsubscribeTransport=()=>{},this.hasTransportSubscription=!1,e}cleanupTransport(e,n){let r=[];try{e()}catch(o){r.push(Be("transport","Failed to unsubscribe from transport events",o))}if(!n)return r;try{let o=this.transport.disconnect();o&&o.catch(i=>{this.isDestroyed||this.report(Be("transport","Transport disconnect failed",i))})}catch(o){r.push(Be("transport","Transport disconnect failed",o))}return r}handleTransportEvent(e,n){if(this.isCurrent(e))switch(n.type){case"open":this.handleOpen(e);break;case"message":this.isOpen&&this.enqueueMessage(e,n.data);break;case"close":this.isOpen=!1,this.connectAttempt+=1,this.stopPresenceTimers(),this.clearPending(),this.clearRemotePresence(),this.setStatus("disconnected",!1);break;case"error":this.failConnection(e,Be("transport","Transport error",n.error));break;case"drain":this.isOpen&&this.flushPending();break;default:this.failConnection(e,new tt("transport","Unknown transport event"))}}handleOpen(e){if(this.isOpen||(this.isOpen=!0,this.openEpoch+=1,this.clearPending(),this.setStatus("connected",!1),!this.isCurrent(e)||!this.isOpen))return;let n=this.connectAttempt;this.replicaResult(e,n,()=>this.replica.encodeStateVector(),r=>{try{let o=Sr(r,"encodeStateVector"),i=Dc(o);if(this.sendFrame(Es(i??o,this.maxFrameBytes)),!this.isCurrent(e)||!this.isOpen||(i||this.sendFullUpdate(e,n),!this.isCurrent(e)||!this.isOpen)||(this.startPresenceTimers(),this.broadcastLocalPresence(!1),!this.isCurrent(e)||!this.isOpen))return;this.sendFrame(Uc(this.maxFrameBytes))}catch(o){this.failConnection(e,Be("protocol","Failed to encode handshake",o))}})}sendFullUpdate(e,n){this.replicaResult(e,n,()=>this.replica.encodeStateAsUpdate(),r=>{try{this.sendFrame(Is(Sr(r,"encodeStateAsUpdate"),this.maxFrameBytes))}catch(o){this.failConnection(e,Be("protocol","Failed to encode handshake",o))}})}replicaResult(e,n,r,o){let i=d=>{this.isCurrent(e)&&this.isOpen&&this.connectAttempt===n&&o(d)},s=d=>{this.isCurrent(e)&&this.isOpen&&this.connectAttempt===n&&this.failConnection(e,Be("replica","Collaboration replica operation failed",d))};try{let d=r();if(d instanceof Promise)return this.asyncReplica=!0,d.then(i,s).catch(s);i(d)}catch(d){s(d)}}handleMessage(e,n){let r;try{r=Ls(n.slice(),this.maxFrameBytes,this.maxMessagesPerFrame)}catch(s){this.failConnection(e,Be("protocol","Invalid collaboration frame",s));return}let o=this.connectAttempt,i=s=>{for(;s<r.length;s++){if(!this.isCurrent(e)||!this.isOpen||this.connectAttempt!==o)return;let d=r[s],a;switch(d.type){case"sync-step-1":a=this.answerSyncStep1(e,o,d.stateVector);break;case"sync-step-2":case"update":{let c={deferred:!1,synced:d.type==="sync-step-2"};a=this.replicaResult(e,o,()=>{let l=this.applyingArrival;this.applyingArrival=c;try{return this.replica.applyUpdate(In(d.update).slice())}finally{this.applyingArrival=l}},()=>{c.synced&&!c.deferred&&this.setStatus("connected",!0)});break}case"awareness":try{let c=Bc(d.update,this.maxMessagesPerFrame);this.remotePresence.apply(c,Date.now())&&this.emitPresence(),this.schedulePresenceExpiry()}catch(c){this.report(Be("protocol","Invalid awareness update",c))}break;case"auth":this.failConnection(e,new tt("protocol",d.reason?`Authentication denied: ${d.reason}`:"Authentication denied"));return;case"query-awareness":this.broadcastLocalPresence(!1);break}if(a instanceof Promise)return a.then(()=>i(s+1))}};return i(0)}answerSyncStep1(e,n,r){let o=zc(r),i=this.replicaResult(e,n,()=>this.replica.encodeStateAsUpdate(In(o.stateVector).slice()),d=>{try{this.sendFrame(Mc(Sr(d,"encodeStateAsUpdate"),this.maxFrameBytes))}catch(a){this.failConnection(e,Be("protocol","Failed to encode SyncStep2",a))}});if(!o.open)return i;let s=()=>{if(!(!this.isCurrent(e)||!this.isOpen||this.connectAttempt!==n))return this.replicaResult(e,n,()=>this.replica.encodeStateVector(),d=>{try{this.sendFrame(Es(Sr(d,"encodeStateVector"),this.maxFrameBytes))}catch(a){this.failConnection(e,Be("protocol","Failed to encode handshake",a))}})};return i instanceof Promise?i.then(s):s()}enqueueMessage(e,n){if(this.asyncReplica&&this.incomingBytes+n.byteLength>this.maxPendingBytes){this.failConnection(e,new tt("backpressure","Incoming collaboration queue is full"));return}this.incoming.push({token:e,data:n.slice()}),this.incomingBytes+=n.byteLength,this.drainIncoming()}drainIncoming(){if(this.incomingBusy)return;let e=this.incomingGeneration;for(;this.incoming.length;){let n=this.takeUpdateBatch(),r=n?.items??[this.incoming.shift()],o=r.reduce((s,d)=>s+d.data.byteLength,0);this.incomingBusy=!0;let i=n?this.applyUpdateBatch(r[0].token,n.updates):this.handleMessage(r[0].token,r[0].data);if(e!==this.incomingGeneration)return;if(i instanceof Promise){i.finally(()=>{e===this.incomingGeneration&&(this.incomingBusy=!1,this.incomingBytes-=o,this.drainIncoming())}).catch(()=>{});return}this.incomingBusy=!1,this.incomingBytes-=o}}takeUpdateBatch(){if(!this.asyncReplica||typeof this.replica.applyUpdateChunks!="function")return null;let e=[],n=[],r=Math.min(this.maxFrameBytes,Ug),o=0;for(let i of this.incoming){if(i.token!==this.incoming[0].token)break;let s=this.remoteUpdates(i.data),d=s?.reduce((a,c)=>a+c.byteLength,0)??0;if(!s?.length||e.length&&o+d>r)break;e.push(i),n.push(...s),o+=d}return e.length<2?null:(this.incoming.splice(0,e.length),{items:e,updates:n})}remoteUpdates(e){try{let n=Ls(e.slice(),this.maxFrameBytes,this.maxMessagesPerFrame);return n.every(r=>r.type==="update")?n.map(r=>In(r.update).slice()):null}catch{return null}}applyUpdateBatch(e,n){if(!this.isCurrent(e)||!this.isOpen)return;let r=this.replica;return this.replicaResult(e,this.connectAttempt,()=>r.applyUpdateChunks(n),()=>{})}forwardLocalUpdate(e){if(this.isDestroyed||!this.isOpen||!this.wantsConnection)return;let n=this.epoch,r;try{r=Sr(e,"Replica update")}catch(o){this.failConnection(n,Be("replica","Invalid replica update",o));return}try{this.sendFrame(Is(r,this.maxFrameBytes))}catch(o){this.failConnection(n,Be("protocol","Failed to encode update",o))}}scheduleCursorBroadcast(){if(this.cursorTimer)return;let e=Math.max(0,80-(Date.now()-this.lastAwarenessSentAt));if(e===0){this.broadcastLocalPresence(!1);return}this.cursorTimer=setTimeout(()=>{this.cursorTimer=null,this.broadcastLocalPresence(!1)},e),Gs(this.cursorTimer)}broadcastLocalPresence(e){if(!this.isOpen||this.isDestroyed||!this.wantsConnection)return;if(this.localClock>=Number.MAX_SAFE_INTEGER){this.reportedClockExhaustion||(this.reportedClockExhaustion=!0,this.report(new tt("protocol","Awareness clock exceeds Number.MAX_SAFE_INTEGER")));return}this.localClock+=1;let n=this.localClock,r=e?null:{clientId:this.localClientId,clock:n,user:{...this.localUser},cursor:this.localCursor?{...this.localCursor}:null};this.cursorTimer&&clearTimeout(this.cursorTimer),this.cursorTimer=null,this.lastAwarenessSentAt=Date.now();try{let o=As([{clientId:this.localClientId,clock:n,state:r}],this.maxFrameBytes);e?this.sendLeaveFrameBestEffort(o):this.sendFrame(o)}catch(o){this.report(Be("protocol","Failed to encode awareness update",o))}}sendLeaveFrameBestEffort(e){try{this.transport.send(e.slice())}catch{}}startPresenceTimers(){this.stopPresenceTimers(),this.heartbeatTimer=setInterval(()=>{this.broadcastLocalPresence(!1)},2e4),Gs(this.heartbeatTimer),this.schedulePresenceExpiry()}stopPresenceTimers(){this.cursorTimer&&clearTimeout(this.cursorTimer),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.expiryTimer&&clearTimeout(this.expiryTimer),this.cursorTimer=null,this.heartbeatTimer=null,this.expiryTimer=null}schedulePresenceExpiry(){if(this.expiryTimer&&clearTimeout(this.expiryTimer),this.expiryTimer=null,!this.isOpen||this.isDestroyed)return;let e=this.remotePresence.nextExpiryAt;e!==void 0&&(this.expiryTimer=setTimeout(()=>{this.expiryTimer=null,this.remotePresence.expire(Date.now())&&this.emitPresence(),this.schedulePresenceExpiry()},Math.max(0,e-Date.now())),Gs(this.expiryTimer))}clearRemotePresence(){this.remotePresence.clear()&&this.emitPresence()}emitPresence(){let e=this.peers;for(let[n,r]of[...this.presenceListeners])if(this.presenceListeners.get(n)===r)try{r(e)}catch{}}sendFrame(e){if(!this.isOpen||this.isDestroyed||!this.wantsConnection)return;let n=this.epoch;if(this.pendingFrames.length>0){this.queueFrame(n,e);return}let r;try{r=this.transport.send(e.slice())}catch(o){this.failConnection(n,Be("transport","Transport send failed",o));return}if(typeof r!="boolean"){this.failConnection(n,new tt("transport","Transport send must return a boolean"));return}!r&&this.isCurrent(n)&&this.isOpen&&this.queueFrame(n,e)}queueFrame(e,n){if(n.byteLength>this.maxPendingBytes-this.queuedBytes){this.failConnection(e,new tt("backpressure",`Pending collaboration data exceeds ${this.maxPendingBytes} bytes`));return}let r=n.slice();this.pendingFrames.push(r),this.queuedBytes+=r.byteLength}flushPending(){if(!this.isFlushing){this.isFlushing=!0;try{for(;this.isOpen&&!this.isDestroyed&&this.pendingFrames.length>0;){let e=this.epoch,n=this.pendingFrames[0],r;try{r=this.transport.send(n.slice())}catch(o){this.failConnection(e,Be("transport","Transport send failed",o));return}if(typeof r!="boolean"){this.failConnection(e,new tt("transport","Transport send must return a boolean"));return}if(!r||!this.isOpen||this.pendingFrames[0]!==n)return;this.pendingFrames.shift(),this.queuedBytes-=n.byteLength}}finally{this.isFlushing=!1}}}clearPending(){this.incoming.length=0,this.incomingBytes=0,this.incomingBusy=!1,this.incomingGeneration+=1,this.pendingFrames.length=0,this.queuedBytes=0}setStatus(e,n){if(this.connectionStatus===e&&this.isSynced===n)return;this.connectionStatus=e,this.isSynced=n;let r={status:e,synced:n};for(let[o,i]of[...this.statusListeners])if(this.statusListeners.get(o)===i)try{i(r)}catch{}}report(e){for(let[n,r]of[...this.errorListeners])if(this.errorListeners.get(n)===r)try{r(e)}catch{}}}});function xf(t,e){return t.setCollaborative?.(),uf({clientId:t.clientId,read:{encodeStateVector:()=>t.encodeStateVector(),encodeStateAsUpdate:n=>t.encodeStateAsUpdate(n)},onUpdate:n=>t.onUpdate(n),merge(n){for(let r of n){let o=t.version();try{t.applyUpdate(r)}catch(i){if(!(i instanceof Error)||Ln(i)||t.version()!==o)throw i;return{failed:i}}}return{applied:null}},createProvider(n,r,o){let i=new Wo(n,r,o);return Object.assign(i,{onPeers:s=>i.onPresence(s)})},arrive:wf,leave:Sf,transportError:n=>new tt(n.code,n.message),onOutput:e})}var vf=X(()=>{"use strict";Bo();pf();Pf();Hs()});function Cf(t){return _f(t)&&typeof t.session=="string"&&Xs(t.incarnation)&&kf(t.seq)&&_f(t.basis)&&Xs(t.basis.epoch)&&Vs(t.basis.version)&&(t.afterSeq===void 0||kf(t.afterSeq))&&(t.expectVersion===void 0||typeof t.expectVersion=="boolean")&&typeof t.kind=="string"&&Zt(t,"payload")&&(t.inputTime===void 0||Vs(t.inputTime))&&(t.lastInputTime===void 0||Vs(t.lastInputTime))&&(t.group===void 0||typeof t.group=="string")&&(t.replay===void 0||t.replay===!0)}function _f(t){return t!==null&&typeof t=="object"}function Vs(t){return typeof t=="number"&&Number.isFinite(t)}function Xs(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function kf(t){return Xs(t)&&t>0}var Ff=X(()=>{"use strict";zt()});function Rf(t,e,n,r,o=!1){if(o&&e.length===2&&t.width>0&&t.height>0){let c=e.includes("w")?-n.x:n.x,l=e.startsWith("n")?-n.y:n.y,m=Math.max(1+(c*t.width+l*t.height)/(t.width**2+t.height**2),r/t.width,r/t.height),b=Math.round(t.width*m),R=Math.round(t.height*m);return{x:e.includes("w")?t.x+t.width-b:t.x,y:e.startsWith("n")?t.y+t.height-R:t.y,width:b,height:R}}let{x:i,y:s,width:d,height:a}=t;if(e.includes("w")){let c=Math.min(n.x,d-r);i+=c,d-=c}else e.includes("e")&&(d=Math.max(r,d+n.x));if(e.startsWith("n")){let c=Math.min(n.y,a-r);s+=c,a-=c}else e.startsWith("s")&&(a=Math.max(r,a+n.y));return{x:i,y:s,width:d,height:a}}var Tf=X(()=>{"use strict"});function Pr(t,e){return(t[e]?.columnOffset??0)-(t[0]?.columnOffset??0)}var Ef=X(()=>{});function Ys(t){let{Segmenter:e}=Intl;return new e(void 0,{granularity:t})}function Af(t,e,n){return n==="word"?Dg(t,e):zg(t,e)}function Dg(t,e){let n=Qs(t,e);Ho??=Ys("word");let r=[...Ho.segment(t)],o=r.find(i=>n>=i.index&&n<i.index+i.segment.length)??r[r.length-1];return o?{start:o.index,end:o.index+o.segment.length}:{start:n,end:n}}function zg(t,e){let n=Qs(t,e),r=t.lastIndexOf(`
|
|
3
|
+
`,Math.max(0,n-1))+1,o=t.indexOf(`
|
|
4
|
+
`,n);return{start:r,end:o===-1?t.length:o}}function Lf(t,e){return e.start<t.start?{anchor:t.end,focus:e.start}:e.end>t.end?{anchor:t.start,focus:e.end}:{anchor:t.start,focus:t.end}}function Qs(t,e){return Number.isFinite(e)?Math.max(0,Math.min(t.length,Math.trunc(e))):0}function qg(t,e){let r=t[Ks(t,e)]?.caretStops.find(o=>o.position===e.position)?.x;return r===void 0?void 0:r-Pr(t,Ks(t,e))}function Mf(t,e,n,r){if(t.length===0)return{position:e.position,lineIndex:0};let o=Ks(t,e),i=o+(n==="up"?-1:1),s=t[i];if(!s)return{position:e.position,lineIndex:o};let d=r??qg(t,e),a=d===void 0?void 0:d+Pr(t,i);return a===void 0?{position:s.start,lineIndex:i}:{position:s.caretStops.reduce((l,m)=>l===null||Math.abs(m.x-a)<Math.abs(l.x-a)?m:l,null)?.position??s.start,lineIndex:i}}function Uf(t,e,n){let r=Qs(t,e);Ho??=Ys("word");let o=[...Ho.segment(t)].filter(s=>s.isWordLike).flatMap(s=>[s.index,s.index+s.segment.length]),i=n<0?o.filter(s=>s<r):o.filter(s=>s>r);return i.length===0?n<0?0:t.length:n<0?Math.max(...i):Math.min(...i)}function Ks(t,e){let n=e.lineIndex;if(n!==void 0&&n>=0&&n<t.length&&e.position>=t[n].start&&e.position<=t[n].end)return n;let r=-1;for(let o=0;o<t.length;o+=1){let i=t[o];e.position>=i.start&&e.position<=i.end&&(r=o)}return r===-1?Math.max(0,t.length-1):r}function Mn(t){return If??=Ys("grapheme"),new Set([...[...If.segment(t)].map(e=>e.index),t.length])}var Ho,If,$o=X(()=>{Ef()});function jg(t,e,n,r){let o=Of(t,e,n,r),i=fn(o,"underline"),s=o.map(a=>a.strike==="sngStrike"||a.strike==="dblStrike"),d=s.every(a=>a===s[0])?s[0]:void 0;return{bold:fn(o,"bold"),italic:fn(o,"italic"),underline:i===void 0?void 0:i!=="none",strikethrough:d,fontSize:fn(o,"fontSizePt"),textColor:fn(o,"color"),fontFamily:fn(o,"fontFamily")}}function Jg(t,e,n,r){let o=jg(t,e,n,r),s=fn(Of(t,e,n,r),"strike")??(o.strikethrough===void 0?r.strike:o.strikethrough?"sngStrike":void 0);return{bold:o.bold??r.bold,italic:o.italic??r.italic,underline:o.underline===void 0?r.underline:o.underline?"sng":"none",...s===void 0?{}:{strike:s},fontSizePt:o.fontSize??r.fontSizePt,color:o.textColor??r.color,fontFamily:o.fontFamily??r.fontFamily}}function Zs(t){return t.strike==="noStrike"?{...t,strike:void 0}:t}function ea(t){return Object.prototype.hasOwnProperty.call(t,"strike")&&t.strike===void 0?{...t,strike:"noStrike"}:t}function Wg(t,e,n,r){return ea({...Jg(t,e,n,lt),...r})}function Bf(t,e,n,r){if(e!==n)return null;let o={...Wg(t,e,n,r),caps:null},i=d=>[...new Set([...Object.keys(d),...Object.keys(o)])].every(c=>c==="strike"?(d.strike??"noStrike")===(o.strike??"noStrike"):(d[c]??null)===(o[c]??null)),s=0;for(let d of t.paragraphs){let a;for(let c of d.runs){let l=s;if(s+=c.text.length,s!==l){if(e>=l&&e<s)return!i(c.style)||e===l&&a&&!i(a.style)?null:{neighbour:"after",start:l,end:s,paragraphId:d.id};a={style:c.style,start:l,end:s}}}if(e===s&&a&&i(a.style))return{neighbour:"before",start:a.start,end:a.end,paragraphId:d.id};s+=1}return null}function Of(t,e,n,r){let o=Hg(t,r);if(o.length===0)return[r];let i=Math.min(e,n),s=Math.max(e,n);if(i===s){let c=o.find(m=>i>=m.start&&i<m.end);return c?[c.style]:[[...o].reverse().find(m=>m.end<=i)?.style??o[0].style]}let d=o.filter(c=>c.end>i&&c.start<s).map(c=>c.style);return d.length>0?d:[[...o].reverse().find(c=>c.end<=i)?.style??o[0].style]}function Hg(t,e){let n=[],r=0;return t.paragraphs.forEach((o,i)=>{for(let s of o.runs){let d=r;r+=s.text.length,r>d&&n.push({start:d,end:r,style:$g(s.style,e)})}i<t.paragraphs.length-1&&(r+=1)}),n}function $g(t,e){let n=t.strike??e.strike;return{bold:t.bold??e.bold,italic:t.italic??e.italic,underline:t.underline??e.underline,...n===void 0?{}:{strike:n},fontSizePt:t.fontSizePt??e.fontSizePt,color:t.color??e.color,fontFamily:t.fontFamily??e.fontFamily}}function fn(t,e){let n=t[0]?.[e];return t.every(r=>r[e]===n)?n:void 0}var lt,Nf=X(()=>{"use strict";lt={bold:!1,italic:!1,underline:"none",fontSizePt:24,color:"#111827",fontFamily:"Arial"}});function Go(t,e){for(let n of t){if(n.id===e)return n;let r=Go(n.children,e);if(r)return r}return null}function Vo(t,e){for(let n of t.shapes)if(n.id===e||Go(n.children,e))return n;return null}function ta(t){if(t.width>0&&t.height>0)return{x:t.x,y:t.y,width:t.width,height:t.height};let e=t.inherited;return!e||e.width<=0||e.height<=0?null:{x:e.x,y:e.y,width:e.width,height:e.height}}function na(t){return ta(t)!==null}function ra(t){let n=((t.inherited?.rotationDeg??t.rotationDeg)%360+360)%360,r=t.inherited?.flipH??t.flipH,o=t.inherited?.flipV??t.flipV;return na(t)&&n===0&&!r&&!o}var oa=X(()=>{"use strict"});function ia(t,e){let n=JSON.parse(Uo(t,e));return sa(n.primitives),n}function Df(t,e,n,r){let o=Qc(t,e,n,r);return sa(o.primitives),o}function sa(t){for(let e of t)if(e.kind==="textBox"){let n=e.paragraphs.map(i=>i.runs.map(s=>s.text).join("")).join(`
|
|
5
|
+
`),r=[...Mn(n)],o=0;for(let i of e.lines){let s=[...i.caretStops].sort((c,l)=>c.position-l.position);for(;o<r.length&&r[o]<i.start;)o++;let d=[],a=0;for(let c=o;c<r.length&&r[c]<=i.end;c++){let l=r[c];for(;a<s.length&&s[a].position<l;)a++;let m=s[a],b=s[a-1];m?.position===l?d.push(m):b&&m&&d.push({position:l,x:b.x+(m.x-b.x)*(l-b.position)/(m.position-b.position)})}i.caretStops=d}}else(e.kind==="table"||e.kind==="chart")&&sa(e.primitives)}function zf(t,e,n,r,o,i,s,d){let a=o??ia(t,e.slideIndex);r?.(a);let c=new TextEncoder().encode(JSON.stringify(a)).buffer,l=Xo(t,a,n,i,s,d);return Le({...e,displayList:c,media:l},[c,...l.map(({bytes:m})=>m)])}function Xo(t,e,n,r,o,i){let s=[];for(let d of Et(e)){if(n.has(d))continue;let a;try{a=Ko(t,d,r,o)}catch{continue}i?.set(d,a),s.push({assetId:d,bytes:new Uint8Array(a).buffer})}return s}function Ko(t,e,n,r){let o=t.mediaBytes(e);if(kt(o)&&o.byteLength<=33554432)try{o=Gt(o)}catch{}let i=o;return Mt(i,()=>{if(n?.ready())return n.convert(e,i);r?.add(e)})}var qf=X(()=>{"use strict";Jt();zt();Cn();$o();Ht();pr()});function jf(t,e){if(!e||!Array.isArray(e.args)||e.args.length>(e.method==="insertTableColumn"?6:5))return null;let{method:n,args:r}=e,o=t.snapshot(),i=(l,m=1e6)=>typeof l=="string"&&l.length<=m&&!/[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u.test(l),s=l=>!!(l&&typeof l=="object"&&["xEmu","yEmu"].every(m=>Number.isSafeInteger(l[m]))),d=l=>!!(l&&typeof l=="object"&&i(l.author,1024)&&i(l.text)&&l.text.length>0&&i(l.created,128)&&Number.isFinite(Date.parse(l.created))&&(l.initials===void 0||i(l.initials,128)));if(n==="insertTableRow"||n==="deleteTableRow"||n==="insertTableColumn"||n==="deleteTableColumn"){let l=n==="insertTableRow"||n==="insertTableColumn";if(r.length<(l?4:3)||r.length>(n==="insertTableColumn"?6:l?5:3))return null;let[m,b,R]=r;if(!i(m,1024)||!i(b,1024)||!Number.isSafeInteger(R)||R<0)return null;let v=(P,C,T)=>{try{return t.checkTableEdit(n,m,b,R,P,C,T),!0}catch{return!1}};if(n==="insertTableRow"||n==="insertTableColumn"){let P=r[3],C=r[4];if(P!=="before"&&P!=="after"||C!==void 0&&(!Array.isArray(C)||C.length>1e3||C.some(j=>!i(j,16e3))))return null;let T=r[5];return T!==void 0&&T!=="split"&&T!=="copy"?null:n==="insertTableColumn"?v(P,C,T)?()=>t.insertTableColumn(m,b,R,P,C,T):null:v(P,C)?()=>t.insertTableRow(m,b,R,P,C):null}return v()?()=>t[n](m,b,R):null}if(n==="setCommentFlavor")return["legacy","modern"].includes(r[0])&&!o.comments?.length?()=>t.setCommentFlavor(r[0]):null;if(n==="replyToComment"||n==="setCommentStatus"||n==="setCommentPosition"||n==="removeComment"){let l=o.comments?.find(m=>m.id===r[0]);if(!l)return null;switch(n){case"replyToComment":return o.commentFlavor==="modern"&&!l.parentId&&d(r[1])?()=>t.replyToComment(l.id,r[1]):null;case"setCommentStatus":return o.commentFlavor==="modern"&&typeof r[1]=="boolean"?()=>t.setCommentStatus(l.id,r[1]):null;case"setCommentPosition":return!l.parentId&&s(r[1])?()=>t.setCommentPosition(l.id,r[1]):null;case"removeComment":return()=>t.removeComment(l.id)}}if(n==="propose"){let[l,m,b]=r;if(!i(l,1024)||!l.trim()||m!==null&&!i(m)||!Array.isArray(b)||!b.length||b.length>256)return null;try{if(JSON.stringify(b).length>1e6+4*Math.ceil(8*1024*1024/3))return null}catch{return null}if(t.listProposals().length>=64)return null;let R=new Map([["addTextBox",["ref","slideId","draft"]],["addShape",["ref","slideId","draft"]],["addPicture",["ref","slideId","draft"]],["removeShape",["slideId","shapeId"]],["reorderShape",["slideId","shapeId","to"]],["insertTableRow",["slideId","shapeId","index","position","cells"]],["deleteTableRow",["slideId","shapeId","index"]],["insertTableColumn",["slideId","shapeId","index","position","cells","width"]],["deleteTableColumn",["slideId","shapeId","index"]],["insertSlide",["ref","afterSlideId","layoutPartPath"]],["duplicateSlide",["ref","slideId","afterSlideId"]],["deleteSlide",["slideId"]],["moveSlide",["slideId","afterSlideId"]],["replaceText",["storyId","start","end","text","style"]],["formatText",["storyId","start","end","patch"]],["setParagraphAlignment",["storyId","start","end","alignment"]],["setStoryParagraphs",["storyId","paragraphs"]],["setShapeRect",["slideId","shapeId","rect"]],["setShapeFill",["slideId","shapeId","color"]],["setShapeStroke",["slideId","shapeId","stroke"]],["setShapeAdjust",["slideId","shapeId","adjustments"]],["setSlideLayout",["slideId","layoutPartPath","mapping"]],["setSlideBackground",["slideId","background"]],["setSlideNotes",["slideId","text"]]]),v=(U,L)=>!!(U&&typeof U=="object"&&!Array.isArray(U)&&Object.keys(U).every(x=>L.includes(x))),P=(U,L=0)=>typeof U=="string"?i(U):typeof U=="number"?Number.isFinite(U):!U||typeof U!="object"||L<16&&Object.entries(U).every(([x,k])=>i(x)&&P(k,L+1)),C=(U,L=!1)=>{let x=["bold","italic","fontFamily","underline","strike","color","fontSizePt","spacingPt","baselinePct"];return L&&x.push("kernPt","caps"),v(U,x)?Object.entries(U).every(([k,g])=>{if(g==null)return!0;switch(k){case"bold":case"italic":return typeof g=="boolean";case"fontFamily":return i(g);case"strike":return typeof g=="string"&&["noStrike","sngStrike","dblStrike"].includes(g);case"underline":return typeof g=="string"&&["none","words","sng","dbl","heavy","dotted","dottedHeavy","dash","dashHeavy","dashLong","dashLongHeavy","dotDash","dotDashHeavy","dotDotDash","dotDotDashHeavy","wavy","wavyHeavy","wavyDbl"].includes(g);case"color":return typeof g=="string"&&/^#?[0-9a-f]{6}$/i.test(g);case"fontSizePt":return typeof g=="number"&&Number.isFinite(g)&&g>=1&&g<=4e3;case"spacingPt":return typeof g=="number"&&Number.isFinite(g)&&Math.abs(g)<=4e3;case"baselinePct":return typeof g=="number"&&Number.isFinite(g)&&g*1e3>=-2147483648&&g*1e3<=2147483647;case"kernPt":return typeof g=="number"&&Number.isFinite(g)&&g>=0&&g<=4e3;case"caps":return typeof g=="string"&&["none","small","all"].includes(g);default:return!1}}):!1},T=t.readContent();if(!T.ok)return null;let j=[],q=[],D=b.some(U=>["insertSlide","duplicateSlide","deleteSlide","moveSlide","addTextBox","addShape","addPicture","removeShape","reorderShape","setStoryParagraphs","setSlideLayout","setSlideBackground","insertTableRow","deleteTableRow","insertTableColumn","deleteTableColumn"].includes(U?.type));for(let U of b){if(!U||typeof U!="object")return null;let L=R.get(U.type);if(!L||!v(U,["type",...L]))return null;let x=U,k=Object.fromEntries(["type",...L].map(y=>[y,x[y]])),g=k.type==="addPicture"?{...k,draft:{...k.draft,mediaBase64:void 0}}:k;if(k.type==="addPicture"&&!i(k.draft?.mediaBase64,4*Math.ceil(8*1024*1024/3))||!P(g)||k.type==="replaceText"&&k.style!=null&&!C(k.style,!0)||k.type==="formatText"&&!C(k.patch)||k.type==="setShapeRect"&&!v(k.rect,["x","y","width","height"])||k.type==="setShapeStroke"&&!v(k.stroke,["color","widthPt"]))return null;if(q.push(k),!D)if("storyId"in k){let y=T.stories.find(h=>h.storyId===k.storyId);if(!y||k.type==="setStoryParagraphs")return null;let f={kind:"range",slideId:y.slideId,shapeId:y.shapeId,storyId:y.storyId,start:k.start,end:k.end};if(k.type==="replaceText")j.push({op:"replaceText",target:f,text:k.text});else if(k.type==="formatText"){let h=Object.fromEntries(Object.entries(k.patch).filter(([,_])=>_!=null));k.patch=h,j.push({op:"formatText",target:f,patch:h})}else if(k.type==="setParagraphAlignment")j.push({op:"setParagraphAlignment",target:f,alignment:k.alignment});else return null}else{if(!["setShapeRect","setShapeFill","setShapeStroke","setShapeAdjust","setSlideNotes"].includes(k.type)||k.type==="addTextBox"||k.type==="addShape"||k.type==="addPicture"||k.type==="removeShape"||k.type==="reorderShape"||k.type==="setSlideLayout"||k.type==="setSlideBackground"||k.type==="insertTableRow"||k.type==="deleteTableRow"||k.type==="insertTableColumn"||k.type==="deleteTableColumn"||k.type==="insertSlide"||k.type==="duplicateSlide"||k.type==="deleteSlide"||k.type==="moveSlide")return null;let{type:y,...f}=k,{slideId:h,..._}=f,J="shapeId"in _?_.shapeId:void 0;"shapeId"in _&&delete _.shapeId,j.push({op:y,target:J===void 0?{slideId:h}:{slideId:h,shapeId:J},..._})}}if(JSON.stringify(q.map(U=>U.type==="addPicture"?{...U,draft:{...U.draft,mediaBase64:void 0}}:U)).length>1e6)return null;if(D){let U=yt.get(t);if(!U||typeof U.doc.validateProposalJson!="function")return null;try{U.jsonWasmCall(()=>U.doc.validateProposalJson(JSON.stringify({agentId:l,note:m,edits:q})))}catch{return null}return()=>t.propose(l,m,q)}let A=t.version();try{if(!t.validateEdits({expectVersion:A,steps:j}).ok)return null}catch(U){if(U&&typeof U=="object"&&"name"in U&&U.name==="PptxEditDecodeError")return null;throw U}return()=>t.propose(l,m,q)}if(n==="acceptProposal"||n==="rejectProposal"){let l=t.listProposals().find(m=>m.id===r[0]);if(!l)return null;if(n==="rejectProposal")return()=>t.rejectProposal(l.id);if(r[1]?.force!==void 0&&typeof r[1].force!="boolean"||l.staleTargets.length&&!r[1]?.force)return null;try{t.previewProposal(l.id)}catch{return null}return()=>t.acceptProposal(l.id,r[1])}if(n==="insertSlide"){let[l,m]=r;return!Number.isSafeInteger(l)||l<0||l>o.slides.length||m!==void 0&&(typeof m!="string"||!o.slides.some(b=>b.layoutPartPath===m))?null:()=>t.insertSlide(l,m)}let a=o.slides.find(l=>l.id===r[0]);if(!a)return null;if(n==="setSlideNotes")return i(r[1])?()=>t.setSlideNotes(a.id,r[1]):null;if(n==="addComment"){let l=r[1];return d(l)&&(l.xEmu===void 0&&l.yEmu===void 0||s(l))?()=>t.addComment(a.id,l):null}if(n==="deleteSlide")return()=>t.deleteSlide(a.id);if(n==="moveSlide"){let l=r[1];return Number.isSafeInteger(l)&&l>=0&&l<o.slides.length?()=>t.moveSlide(a.id,l):null}if(n==="duplicateSlide"){let l=r[1];return r.length===2&&Number.isSafeInteger(l)&&l>=0&&l<=o.slides.length?()=>t.duplicateSlide(a.id,l):null}let c=Vo(a,r[1]);if(!c||c.id!==r[1])return null;switch(n){case"setShapeFill":{let l=r[2];return c.kind==="shape"&&(l===null||/^#[0-9a-f]{6}$/i.test(l))?()=>t.setShapeFill(a.id,c.id,l):null}case"setShapeStroke":{let l=r[2];return c.kind==="shape"&&l&&(l.color===void 0||typeof l.color=="string"&&/^#[0-9a-f]{6}$/i.test(l.color))&&(l.widthPt===void 0||Number.isFinite(l.widthPt)&&l.widthPt>=0&&l.widthPt<=1584)?()=>t.setShapeStroke(a.id,c.id,l):null}case"setShapeAdjust":{let l=r[2];return c.kind==="shape"&&l&&typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length<=64&&Object.entries(l).every(([m,b])=>/^[a-zA-Z][a-zA-Z0-9]*$/.test(m)&&Number.isFinite(b)&&Math.abs(b)<=1e6)?()=>t.setShapeAdjust(a.id,c.id,l):null}case"removeShape":return()=>t.removeShape(a.id,c.id);case"bringShapeToFront":return()=>t.bringShapeToFront(a.id,c.id);case"sendShapeToBack":return()=>t.sendShapeToBack(a.id,c.id);case"bringShapeForward":return()=>t.bringShapeForward(a.id,c.id);case"sendShapeBackward":return()=>t.sendShapeBackward(a.id,c.id);default:return null}}var Jf=X(()=>{"use strict";ko();oa()});function Wf(t){let e=yt.get(t);if(!e)throw new Error("Presentation browser coverage fallback is unavailable");e.wasmCall(()=>e.renderer.setBrowserCoverageFallback(!0))}function Hf(t,e){let n=yt.get(t);if(!n)throw new Error("Presentation font requests are unavailable");return n.jsonWasmCall(()=>n.renderer.requestedFontFacesJson(n.doc,e)).faces}var $f=X(()=>{"use strict";ko()});function Gf(){let t=0,e=new Map;function n(r){for(let[o,i]of e)if(i===r)return{version:r,clock:o}}return{get version(){return t},initialize(r){e.set(t,r)},commit(r){e.set(++t,r)},retain(r){let o=new Set(r);for(let[i,s]of e)i!==t&&!o.has(s)&&e.delete(i)},envelope(r,o){let i=e.get(r.basis.version);if(i===void 0)for(i="unretained";n(i);)i+="\0";return{...o,seq:r.seq,basis:{epoch:r.basis.epoch,version:i},...r.afterSeq===void 0?{}:{afterSeq:r.afterSeq},kind:r.kind,payload:r.payload}},ack(r,o){let i=r.frame?{coversThroughSeq:r.frame.coversThroughSeq,revision:r.frame.epoch,payload:r.frame}:void 0;return{session:r.session,incarnation:0,epoch:r.epoch,throughSeq:r.throughSeq,version:t,selection:r.selection,editState:r.editState,outcomes:r.outcomes.map(({committed:s,...d})=>s?d:{...d,committed:!1}),...i?{frame:i}:{},pptx:{incarnation:r.incarnation,version:r.version,outcomes:r.outcomes,dirtySlideIds:r.dirtySlideIds,activeSlideId:r.activeSlideId,historyThroughSeq:r.historyThroughSeq,...r.creation?{creation:r.creation}:{},...r.change?{change:r.change}:{},..."mutationResult"in r?{mutationResult:r.mutationResult}:{},...r.updates?{updates:r.updates}:{},...r.editResult?{editResult:r.editResult}:{},...r.fontId!==void 0?{fontId:r.fontId}:{},...r.slicedFamilies?{slicedFamilies:r.slicedFamilies}:{},...r.slicedPlainStyles?{slicedPlainStyles:r.slicedPlainStyles}:{},...r.slides?{slides:r.slides,size:r.size}:{},...o===void 0?{}:{retainedBasis:n(o)}}}},dispose(){e.clear()}}}var Vf=X(()=>{"use strict"});function aa(t,e){return JSON.stringify([t,e])}function Gg(t){return t.paragraphs.reduce((e,n)=>e+n.runs.reduce((r,o)=>r+o.text.length,0),Math.max(0,t.paragraphs.length-1))}function da(t){let e={hits:[],lines:new Map,size:{width:t.width,height:t.height}};function n(r,o,i){for(let s of r){let d={kind:s.kind,shapeId:s.shapeId,x:s.x,y:s.y,w:s.w,h:s.h,...s.transform?{transform:{...s.transform}}:{}},a=[...o,d];if(s.shapeId&&e.hits.push({primitive:d,transforms:a,clips:i,...s.kind==="textBox"?{textLength:Gg(s)}:{}}),s.kind==="textBox"&&s.shapeId&&s.storyId){d.storyId=s.storyId,d.lines=s.lines.map(m=>({columnOffset:m.columnOffset,x:m.x,y:m.y,height:m.height,start:m.start,end:m.end,caretStops:m.caretStops.map(b=>({position:b.position,x:b.x}))}));let c=aa(s.shapeId,s.storyId),l=e.lines.get(c)??[];for(let m of d.lines)l.push({line:m});e.lines.set(c,l)}else(s.kind==="chart"||s.kind==="table")&&n(s.primitives,a,[...i,d])}}return n(t.primitives,[],[]),e}function Yo(t,e){if(!e||e.kind==="object")return null;let n=t.lines.get(aa(e.shapeId,e.storyId))??[];return n.find(({line:r})=>e.focus>=r.start&&(e.focus<r.end||e.focus===r.end&&e.affinity==="upstream"))??n.find(({line:r})=>e.focus>=r.start&&e.focus<=r.end)??n[n.length-1]??null}function Kf(t,e,n=!1){let r=t.x+t.w/2,o=t.y+t.h/2,i=(t.transform?.rotationDeg??0)*Math.PI/180,s=Math.cos(i),d=Math.sin(i),a=e.x-r,c=e.y-o;if(n){let l=a*s+c*d;c=c*s-a*d,a=l}return t.transform?.flipH&&(a=-a),t.transform?.flipV&&(c=-c),n?{x:r+a,y:o+c}:{x:r+a*s-c*d,y:o+a*d+c*s}}function Yf(t,e){let n=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x,y:e.y+e.height},{x:e.x+e.width,y:e.y+e.height}];for(let i=t.length-1;i>=0;i-=1)for(let s=0;s<n.length;s+=1)n[s]=Kf(t[i],n[s]);let r=Math.min(...n.map(i=>i.x)),o=Math.min(...n.map(i=>i.y));return{x:r,y:o,width:Math.max(...n.map(i=>i.x))-r,height:Math.max(...n.map(i=>i.y))-o}}function Vg(t,e){let n=t.caretStops[0];return n?t.caretStops.reduce((r,o)=>Math.abs(o.position-e)<Math.abs(r.position-e)?o:r,n).x:t.x}function la(t,e,n,r){for(let o=t.hits.length-1;o>=0;o-=1){let i=t.hits[o],s=e,d=!1;for(let c of i.transforms)if(s=Kf(c,s,!0),i.clips.includes(c)&&!Xf(c,s)&&(d=!0,!n))break;let a=i.primitive;if(!(n&&(a.shapeId!==n.shapeId||a.storyId!==n.storyId))&&!(!n&&(d||!Xf(a,s))||!a.shapeId)){if(!n&&r!==void 0){let c=Math.min(6/r,a.w/3,a.h/3);if(s.x-a.x<=c||a.x+a.w-s.x<=c||s.y-a.y<=c||a.y+a.h-s.y<=c)return{kind:"shape",shapeId:a.shapeId}}if(a.kind==="textBox"&&a.storyId){let c=n||i.clips.some(v=>"kind"in v&&v.kind==="table"),l=a.lines?.some((v,P,C)=>P>0&&(v.columnOffset??0)!==(C[P-1].columnOffset??0)),m=Number.POSITIVE_INFINITY,b=a.lines?.reduce((v,P)=>{if(!c&&(s.y<P.y||s.y>P.y+P.height))return v;let T=(j=>{let q=j.x,D=j.x;for(let L of j.caretStops)q=Math.min(q,L.x),D=Math.max(D,L.x);let A=Math.max(q-s.x,s.x-D,0),U=Math.max(j.y-s.y,s.y-j.y-j.height,0);return l?A*A+U*U:U})(P);return!v||T<m?(m=T,P):v},void 0),R=b?.caretStops[0];if(b&&R){let v=b.caretStops.reduce((P,C)=>Math.abs(C.x-s.x)<Math.abs(P.x-s.x)?C:P,R);return{kind:"text",shapeId:a.shapeId,storyId:a.storyId,position:v.position,affinity:v.position===b.end?"upstream":"downstream"}}}return{kind:"shape",shapeId:a.shapeId}}}return null}function Xf(t,e){return e.x>=t.x&&e.x<=t.x+t.w&&e.y>=t.y&&e.y<=t.y+t.h}function Xg(t,e,n){if(!e||e.kind==="object")return null;let r=d=>"kind"in d&&d.kind==="table",o=t.find(({primitive:d})=>d.kind==="textBox"&&d.shapeId===e.shapeId&&d.storyId===e.storyId)?.clips.filter(r).pop();if(!o)return null;let i=[];for(let{primitive:d,clips:a,textLength:c}of t){let l=d.storyId;d.kind!=="textBox"||!l||d.shapeId!==e.shapeId||a.filter(r).pop()!==o||i.some(m=>m.storyId===l)||i.push({storyId:l,end:c??0})}let s=i[i.findIndex(d=>d.storyId===e.storyId)+(n?-1:1)];return s?{slideId:e.slideId,shapeId:e.shapeId,storyId:s.storyId,anchor:0,focus:s.end,affinity:s.end>0?"upstream":"downstream"}:{...e}}function Qf(t,e,n,r,o){if(n==="nextCell"||n==="previousCell")return t.hits?Xg(t.hits,e,n==="previousCell"):null;let i=Yo(t,e);if(!i||!e||e.kind==="object")return null;let s=t.lines.get(aa(e.shapeId,e.storyId))??[],d=e.focus,a=i,c;if(!r&&e.anchor!==e.focus&&(n==="left"||n==="right"))d=n==="left"?Math.min(e.anchor,e.focus):Math.max(e.anchor,e.focus);else if(n==="wordLeft"||n==="wordRight"){if(o===void 0)return null;d=Uf(o,d,n==="wordLeft"?-1:1)}else if(n==="storyStart")a=s[0],d=0;else if(n==="storyEnd")a=s[s.length-1],d=o?.length??a.line.end;else if(n==="lineStart"||n==="lineEnd"){let m=i.line.caretStops;if(!m.length)return null;d=n==="lineStart"?m[0].position:m[m.length-1].position}else if(n==="left"||n==="right"){let b=(o===void 0?s.flatMap(({line:R})=>R.caretStops.map(v=>v.position)):[...Mn(o)]).filter(R=>n==="left"?R<d:R>d);b.length&&(d=n==="left"?Math.max(...b):Math.min(...b))}else if(n==="up"||n==="down"){let m=s.map(({line:R})=>R);c=e.goalX??Vg(i.line,d)-Pr(m,s.indexOf(i));let b=Mf(m,{position:d,lineIndex:s.indexOf(i)},n,c);a=s[b.lineIndex],d=b.position}(n==="left"||n==="right"||n==="wordLeft"||n==="wordRight")&&(a=Yo(t,{...e,focus:d,affinity:n==="left"||n==="wordLeft"?"upstream":"downstream"})??i);let l={...e,anchor:r?e.anchor:d,focus:d,affinity:d===a.line.end?"upstream":"downstream"};return c===void 0?delete l.goalX:l.goalX=c,l}var Zf=X(()=>{"use strict";$o()});var eu,xr,tu=X(()=>{"use strict";eu=Object.freeze({setChangeObserver:"mode",invoke:"local-write",applyRemoteUpdate:"remote-update",collabPipe:"remote-update",applyEdits:"local-write",registerFont:"local-write",insertTextBox:"local-write",insertShape:"local-write",insertPicture:"local-write",moveShape:"local-write",setShapeRect:"local-write",undo:"local-write",redo:"local-write",insertText:"local-write",replaceText:"local-write",formatText:"local-write",setParagraphAlignment:"local-write",deleteBackward:"local-write",deleteForward:"local-write",paragraphBreak:"local-write",compositionStart:"local-write",compositionCommit:"local-write",activateSlide:"view",selectObject:"view",moveSelection:"view",selectAtPoint:"view",setSelection:"view",compositionEnd:"view",setReadOnly:"mode"}),xr=class extends Error{constructor(n,r){super(r);this.seq=n;this.name="CommandOutcomeUnknown",this.refusal={seq:n,reason:"unknown-outcome"}}seq;refusal}});function Kg(t,e){let n=new DataView(t);if(n.byteLength<12)return!1;let r=n.getUint16(4);if(12+r*16>n.byteLength)return!1;for(let o=12;o<12+r*16;o+=16){if(n.getUint32(o)!==1851878757)continue;let i=n.getUint32(o+8),s=n.getUint32(o+12);if(s<6||i+s>n.byteLength)return!1;let d=n.getUint16(i+2),a=i+n.getUint16(i+4);if(6+d*12>s)return!1;for(let c=i+6;c<i+6+d*12;c+=12){let l=n.getUint16(c+6);if(l!==1&&l!==16)continue;let m=n.getUint16(c),b=n.getUint16(c+8),R=a+n.getUint16(c+10);if(R<i||R+b>i+s)continue;let v="";if(m===0||m===3){if(b%2)continue;for(let P=R;P<R+b;P+=2)v+=String.fromCharCode(n.getUint16(P))}else if(m===1)for(let P=R;P<R+b;P++)v+=String.fromCharCode(n.getUint8(P));if(v.trim().toLowerCase()===e.trim().toLowerCase())return!0}}return!1}async function ca(t,e,n,r){let{resolveScriptFallbackFace:o}=await Lt(),i=o(t,e,n)??o(t,!1,!1);if(!(!i||i.script!==t||!Kg(r,i.family)))return{family:i.family,bold:i.weight===700,italic:i.style==="italic",bytes:r,kind:"coverage"}}var nu=X(()=>{"use strict";_n()});function Qo(t){try{let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(e.byteLength<12)return;let n=0;if(e.getUint32(0)===1953784678){let d=e.getUint32(4),a=e.getUint32(8);if(d!==65536&&d!==131072||a===0||12+a*4+(d===131072?12:0)>e.byteLength)return;n=e.getUint32(12)}if(n+12>e.byteLength)return;let r=e.getUint32(n);if(r!==65536&&r!==1953658213&&r!==1330926671)return;let o=e.getUint16(n+4);if(n+12+o*16>e.byteLength)return;let i,s;for(let d=0;d<o;d++){let a=n+12+d*16,c=e.getUint32(a),l=e.getUint32(a+8),m=e.getUint32(a+12);if(l+m>e.byteLength)return;if(c===1330851634){if(i)return;i={offset:l,length:m}}else if(c===1751474532){if(s)return;s={offset:l,length:m}}}if(i){if(i.length<64)return;let d=e.getUint16(i.offset+62);return{weight:Math.max(1,Math.min(1e3,e.getUint16(i.offset+4))),bold:(d&32)!==0,italic:(d&1)!==0,oblique:(d&512)!==0}}if(s){if(s.length<46)return;let d=e.getUint16(s.offset+44);return{weight:d&1?700:400,bold:(d&1)!==0,italic:(d&2)!==0,oblique:!1}}}catch{return}}var fa=X(()=>{});var pa={};St(pa,{createSlicedFontFaces:()=>ey,slicedFacesSupported:()=>ou});function ou(t=globalThis.navigator?.userAgent??""){return/(?:Chrome|Chromium|Firefox)\//.test(t)&&!/\b(?:iPhone|iPad|iPod|CriOS|FxiOS)\b/.test(t)}function ey(t=Qg){let e=new Map,n=new Map,r=new Map,o=!1,i=-1/0,s,d=()=>globalThis.performance?.now()??Date.now(),a=async()=>{for(;!o&&d()-i<t;)await new Promise(x=>setTimeout(x,t))},c=x=>{let k=Qo(new Uint8Array(x));return k?{weight:String(k.weight),style:k.italic?"italic":k.oblique?"oblique":"normal"}:{}};async function l(x,k,g,y){let f=globalThis.fonts;if(!f)return x.family;let h=k===un?`${x.family} whole`:`${x.family} r${k}`,_=await new FontFace(h,g,c(g)).load();if(o||!e.has(je(x.family)))return x.family;let J=R(x);if(J&&J.revision>=k)return J.family;for(f.add(_),x.installed.push({revision:k,family:h,face:_,chunks:y});x.installed.length>Yg;)f.delete(x.installed.shift().face);return h}let m=x=>x.wholeLoad??=(x.whole.slices?.loadWholeForExport?.()??x.whole()).then(k=>(x.wholeBytes=k,k),k=>{throw x.wholeLoad=void 0,k}),b=x=>m(x).catch(k=>{throw Qe(k)&&Pt(k),k}),R=x=>x.installed[x.installed.length-1];function v(x){let k=R(x);if(k?.revision===un)return Promise.resolve(k.family);let g=x.face.revision;if(k?.revision===g)return Promise.resolve(k.family);if(x.installing?.revision===g)return x.installing.done;let y=new Set(x.face.loadedChunks()),f={revision:g,done:l(x,g,x.face.bytes(),y)};return x.installing=f,f.done.catch(()=>{}).finally(()=>{x.installing===f&&(x.installing=void 0)}),f.done}async function P(x,k){try{await x.face.ensureText(k)}catch(g){if(Qe(g))return R(x)?.family??x.family;let y;try{y=await b(x)}catch{return x.family}let f=R(x);if(f?.revision===un)return f.family;try{return await l(x,un,y,null)}catch{return x.family}}return v(x)}let C={async prepare(x,k){let g=e.get(je(x));if(!g||o)return x;i=d();let y=R(g);if(y&&(y.chunks===null||g.face.chunksOf(k).every(h=>y.chunks.has(h))))return y.family;let f=await P(g,k);return f===g.family?x:f},latest(x){let k=e.get(je(x));return k&&R(k)?.family},covers:(x,k,g)=>!r.get(je(x))?.has(ua(k,g))};async function T(x){let k=[...new Set(`${x}${x.normalize("NFC")}`)];for(let g of[...e.values()]){let y=g.face.loadedChunks(),f=k.filter(h=>g.face.chunksOf(h).some(_=>!y.has(_)));for(let h=0;h<f.length;h+=ru){if(await a(),o||g.wholeBytes)return;let _=f.slice(h,h+ru);await g.face.ensureText(_.join(""))}if(await a(),o||g.wholeBytes)return;await v(g)}}function j(x){return(e.get(je(x))??n.get(je(x))?.entry)?.wholeBytes}function q(x){return Promise.all(x.flatMap(k=>{let g=e.get(je(k))??n.get(je(k))?.entry;return g?[m(g).then(y=>({family:g.family,bytes:y.slice(0)}),y=>{let f=y instanceof Error?y.message:String(y);throw new $e("font-unavailable",`${g.family} could not load: ${f}`)})]:[]}))}function D(x,k){return n.get(je(x))?.hostFaces.includes(k.id)===!0||r.get(je(x))?.has(ua(k.bold===!0,k.italic===!0))===!0}let A=()=>[...e.values()].map(x=>x.family),U=()=>[...e.values(),...[...n.values()].map(({entry:x})=>x)].map(x=>x.family),L=()=>[...e.keys()].flatMap(x=>[...r.get(x)??[]].map(k=>`${x}|${k}`));return{coverage:C,fill:T,loadedWhole:j,wholeFaces:q,keepsExportFace:D,families:A,exportFamilies:U,plainStyles:L,supported:()=>ou(),ack:()=>({slicedFamilies:A(),slicedPlainStyles:L()}),scheduleFill(x){s!==void 0||o||!e.size||(s=setTimeout(()=>{if(s=void 0,!o)try{let k=x();k!==void 0&&T(k).catch(()=>{})}catch{}},Zg))},upgradeRegistered(x,k){let g=j(k);g&&x.replaceExportFace(k,new Uint8Array(g),y=>D(k,y))},async completeExport(x){let k=new Set,g=[];for(;;){let y=U().filter(f=>!k.has(f));if(!y.length)return g;for(let{family:f,bytes:h}of await q(y)){let _=new Uint8Array(h);x.replaceExportFace(f,_,J=>D(f,J)),e.has(je(f))&&g.push({family:f,bold:!1,italic:!1,bytes:_})}for(let f of y)k.add(f)}},async wholeFonts(x){let k=new Set(Array.isArray(x)?x:[]);return(await Promise.all(A().filter(y=>!k.has(y)).map(async y=>{let f=e.get(je(y)),h=await(f?b(f).then(_=>_.slice(0)):void 0)?.catch(()=>{});return h?{family:y,bold:!1,italic:!1,bytes:h,kind:"coverage"}:void 0}))).filter(y=>y!==void 0)},add(x,k,g){!o&&!e.has(je(x))&&e.set(je(x),{family:x,face:k,whole:g,installed:[]})},has:x=>e.has(je(x)),prefetch(x){for(let k of e.values())k.face.prefetch(x)},read(x,k,g){let y=e.get(je(x));return!y||o?Promise.resolve(void 0):(i=d(),(async()=>{if(!y.wholeBytes)try{let h=await y.face.ensureText(k);return h===g?{revision:h}:{revision:h,bytes:y.face.bytes()}}catch(h){if(Qe(h))return}let f=await b(y).catch(h=>{if(!Qe(h))throw h});if(f)return g===un?{revision:un}:{revision:un,bytes:f.slice(0)}})())},whole(x){let k=e.get(je(x));return k&&b(k).then(g=>g.slice(0))},plain(x,k,g){let y=r.get(je(x))??new Set;y.add(ua(k,g)),r.set(je(x),y)},forget(x,k){let g=je(x),y=n.get(g);if(y){y.hostFaces.push(k);return}let f=e.get(g);if(!f)return;e.delete(g),n.set(g,{entry:f,hostFaces:[k]});let h=globalThis.fonts;for(let{face:_}of f.installed)h?.delete(_)},dispose(){o=!0,s!==void 0&&clearTimeout(s);let x=globalThis.fonts;for(let k of e.values())for(let{face:g}of k.installed)x?.delete(g);e.clear(),n.clear(),r.clear()}}}var un,Yg,ru,Qg,Zg,je,ua,ma=X(()=>{"use strict";Fn();fa();vn();un=Number.MAX_SAFE_INTEGER,Yg=2,ru=48,Qg=300,Zg=1e3;je=t=>t.trim().toLowerCase(),ua=(t,e)=>`${t?1:0}|${e?1:0}`});var au={};St(au,{commandFontProvider:()=>su,createCommandDefaultFonts:()=>iy,prefetchCoverageFaces:()=>oy});function oy(t,e,n,r=!1){iu=e,t.length&&n().then(async o=>{for(let i of t){let s=o.resolveScriptFallback(i,!1,!1);if(s?.slices&&r&&(await Promise.resolve().then(()=>(ma(),pa))).slicedFacesSupported()){let{openSlicedFace:d}=await Vi();d(s.slices).catch(()=>{})}else s?.().catch(()=>{})}}).catch(()=>{})}function iy(t,e,n,r,o,i,s,d){let a=new Set(t.map(g=>g.family.trim().toLowerCase())),c=new Set,l=new Map,m=new Map,b=new Map,R=new Map,v=new Set,P,C=!1,T=!1,j=new Set,q=g=>JSON.stringify([g.kind,g.kind==="coverage"?g.script:g.family.trim().toLowerCase(),g.bold,g.italic]),D=g=>g.kind==="primary"&&a.has(g.family.trim().toLowerCase()),A=g=>!c.has(g)||(l.get(g)??0)<ty&&Date.now()>=(m.get(g)??1/0),U=g=>m.set(g,Date.now()+(ny[(l.get(g)??1)-1]??1/0));function L(g,y){if(C)return[];let f=[];for(let[h,_]of y.entries()){if(!_||D(g[h]))continue;let J=JSON.stringify([_.kind??"primary",_.family.trim().toLowerCase(),_.bold,_.italic]);if(!v.has(J))try{T||(i?.(),T=!0),n(_),v.add(J),f.push({family:_.family,bold:_.bold,italic:_.italic,..._.kind?{kind:_.kind}:{},..._.ownWeight?{ownWeight:!0}:{}})}catch{U(q(g[h]))}}return f.length&&r(f),f}function x(g){let y=q(g),f=b.get(y);if(f)return f;if(!A(y)||D(g))return Promise.resolve(void 0);let h=l.get(y),_=m.get(y);c.add(y),l.set(y,(h??0)+1),m.delete(y);let J=new Promise(E=>{let F=!1,z=ce=>{F||(F=!0,clearTimeout(ne),j.delete(H),E(ce))},H=()=>z(),ne=setTimeout(H,5e3);j.add(H);let se=!1;P??=Promise.resolve().then(()=>s?s():su.load()).catch(ce=>{throw P=void 0,ce}),P.then(async ce=>{if(C)return;let me=g.bold,ee=g.italic,G,fe;if(g.kind==="coverage")G=ce.resolveScriptFallback(g.script,me,ee),!G&&(me||ee)&&(me=!1,ee=!1,G=ce.resolveScriptFallback(g.script,me,ee));else{let ve=ce.resolve(g.family,me,ee)??ce.resolveFamily(g.family,me,ee);fe=ve?void 0:ce.resolveLightVariant?.(g.family,me,ee),G=ve??fe??ce.resolveLastResort(g.family,me,ee,"powerpoint")}if(!G)return;if(se=!0,G.slices&&d?.supported())try{let{openSlicedFace:ve}=await Vi(),Ce=await ve(G.slices);if(C||D(g))return;let Ee=g.kind==="coverage"?await ca(g.script,me,ee,Ce.bytes()):{family:g.family,bold:g.bold,italic:g.italic,bytes:Ce.bytes()};if(Ee&&!a.has(Ee.family.trim().toLowerCase()))return d.add(Ee.family,{get revision(){return Ce.revision},bytes:()=>Ce.bytes(),ensureText:_e=>Ce.ensureText(_e),prefetch:_e=>Ce.prefetch(_e),chunksOf:_e=>Ce.chunksOf(_e),loadedChunks:()=>Ce.loadedChunks()},G),C?void 0:Ee}catch(ve){if(Qe(ve)&&ve.diagnostic.pack==="latin")throw ve}let ye=await G().catch(ve=>{throw Qe(ve)&&Pt(ve),ve});if(C||D(g))return;let ae=g.kind==="coverage"?await ca(g.script,me,ee,ye):{family:g.family,bold:g.bold,italic:g.italic,bytes:ye,...fe?{ownWeight:!0}:{}};if(!ae||C||D(g))return;d?.plain(ae.family,ae.bold,ae.italic);let he=JSON.stringify([ae.family.trim().toLowerCase(),ae.bold,ae.italic]),Re=R.get(he);if(!Re){Re=Promise.resolve().then(async()=>!C&&(!o||(await o([ae])).length>0)),R.set(he,Re);let ve=Re,Ce=()=>{R.get(he)===ve&&R.delete(he)};Re.then(Ee=>{Ee||Ce()},Ce)}return await Re&&!C?ae:void 0}).then(ce=>{b.delete(y),!ce&&se&&!C&&!D(g)&&U(y),F&&ce?L([g],[ce]):z(ce)},ce=>{b.delete(y),Qe(ce)?h===void 0?(c.delete(y),l.delete(y)):(l.set(y,h),_!==void 0&&m.set(y,_)):!C&&!D(g)&&U(y),z()})});return b.set(y,J),J}function k(g){if(C)return[];try{let y=new Map;for(let f of e(g)){let h={kind:"primary",family:f.family,bold:f.bold,italic:f.italic};y.set(q(h),h);for(let _ of f.scripts??[]){let J={kind:"coverage",script:_,bold:f.bold,italic:f.italic};y.set(q(J),J)}}return[...y.values()].filter(f=>!D(f)&&(A(q(f))||b.has(q(f))))}catch{return[]}}return{isLoading(){return b.size>0},hasPending(g){return k(g).length>0},load(g){let y=k(g);return y.length?Promise.all(y.map(x)).then(f=>L(y,f)):[]},supply(g){a.add(g.trim().toLowerCase())},dispose(){C=!0;for(let g of j)g();b.clear(),R.clear()}}}var ty,ny,iu,ry,su,du=X(()=>{"use strict";_n();Oo();vn();nu();Ht();js();ty=3,ny=[2e3,8e3],iu=Promise.resolve(),ry=jo(async(t,e)=>(await iu.catch(()=>{}),Tn(t,e))),su={async load(...t){return t.length&&cn(t[0]),(await Lt()).createFontProvider(void 0,{decoder:ry,strict:"except-optional-cdn-failure"})}}});var uu={};St(uu,{activeSlideCoverageScripts:()=>my,activeSlideMetafileFlags:()=>py,scanOpeningSlide:()=>ga,slideCoverageScripts:()=>cu});function sy(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=Math.max(0,t.byteLength-22-65535),r=-1;for(let a=t.byteLength-22;a>=n;a--)if(e.getUint32(a,!0)===101010256){r=a;break}if(r<0)return;let o=e.getUint16(r+10,!0),i=e.getUint32(r+16,!0);if(o>5e3||i===4294967295)return;let s=new TextDecoder,d=new Map;for(let a=0;a<o;a++){if(i+46>t.byteLength||e.getUint32(i,!0)!==33639248)return;let c=e.getUint16(i+28,!0),l=c+e.getUint16(i+30,!0)+e.getUint16(i+32,!0);if(i+46+l>t.byteLength)return;let m=s.decode(t.subarray(i+46,i+46+c));d.set(m,{method:e.getUint16(i+10,!0),compressedSize:e.getUint32(i+20,!0),size:e.getUint32(i+24,!0),offset:e.getUint32(i+42,!0)}),i+=46+l}return d}async function ay(t,e){let n=new DecompressionStream("deflate-raw"),r=n.writable.getWriter(),o=n.readable.getReader(),i=!1;(async()=>{for(let l=0;l<t.byteLength&&!i;l+=1024)await r.ready,i||await r.write(t.subarray(l,l+1024));i||await r.close()})().catch(()=>{});let s=[],d=0;try{for(;;){let{done:l,value:m}=await o.read();if(l)break;if(d+=m.byteLength,d>e){i=!0,o.cancel().catch(()=>{}),r.abort().catch(()=>{});return}s.push(m)}}catch{i=!0,r.abort().catch(()=>{});return}let a=new Uint8Array(d),c=0;for(let l of s)a.set(l,c),c+=l.byteLength;return a}async function Zo(t,e,n,r){let o=e.get(n),i=Math.min(4194304,r.left);if(!o||o.size>i||o.compressedSize>i)return;let s=new DataView(t.buffer,t.byteOffset,t.byteLength);if(o.offset+30>t.byteLength||s.getUint32(o.offset,!0)!==67324752)return;let d=o.offset+30+s.getUint16(o.offset+26,!0)+s.getUint16(o.offset+28,!0);if(d+o.compressedSize>t.byteLength)return;let a=t.slice(d,d+o.compressedSize),c;if(o.method===0?c=o.compressedSize===o.size?a:void 0:o.method===8&&typeof DecompressionStream<"u"&&(c=await ay(a,i)),!!c)return r.left-=c.byteLength,new TextDecoder().decode(c)}function ei(t,e,n,r){let o=e;for(;o<n;){let i=t.indexOf("<",o);if(i<0||i>=n)return;let s=t.indexOf(">",i+1);if(s<0)return;let d=r(t.slice(i+1,s),s+1);o=typeof d=="number"?d:s+1}}function Un(t,e){if(!t.startsWith(e))return!1;let n=t.charCodeAt(e.length);return Number.isNaN(n)||n===47||lu(n)}function Bn(t,e){for(let n=t.indexOf(`${e}=`);n>=0;n=t.indexOf(`${e}=`,n+1)){let r=t[n+e.length+1];if(!lu(t.charCodeAt(n-1))||r!=='"'&&r!=="'")continue;let o=n+e.length+2,i=t.indexOf(r,o);return i<0?void 0:t.slice(o,i)}}function dy(t){if(!t)return;let[e,...n]=t.toLowerCase().split(/[-_]/);if(e==="ja")return"cjk-jp";if(e==="ko")return"cjk-kr";if(e==="zh")return n.includes("hans")?"cjk-sc":n.some(r=>r==="hant"||r==="tw"||r==="hk"||r==="mo")?"cjk-tc":"cjk-sc"}function ly(t,e,n){for(let r of t){let o=r.codePointAt(0);o>=12352&&o<=12543||o>=12784&&o<=12799||o>=65382&&o<=65439?n.add("cjk-jp"):o>=44032&&o<=55295||o>=4352&&o<=4607||o>=12592&&o<=12687?n.add("cjk-kr"):(o>=19968&&o<=40959||o>=13312&&o<=19903||o>=63744&&o<=64255||o>=131072)&&e&&n.add(e)}}function cu(t){let e=new Set,n;return ei(t,0,t.length,(r,o)=>{if(Un(r,"a:rPr")||Un(r,"a:endParaRPr"))n=dy(Bn(r,"lang"));else if(r==="/a:r")n=void 0;else if(Un(r,"a:t")&&!r.endsWith("/")){let i=t.indexOf("<",o),s=i<0?t.length:i;return ly(t.slice(o,s),n,e),s}}),[...e]}function cy(t){let e=[],n=t.indexOf("<p:sldIdLst");if(n<0)return e;let r=t.indexOf("</p:sldIdLst>",n);return ei(t,n,r<0?t.length:r,o=>{if(!Un(o,"p:sldId"))return;let i=Bn(o,"r:id");i!==void 0&&e.push(i)}),e}function fy(t,e){let n;return ei(t,0,t.length,r=>{if(!(!Un(r,"Relationship")||Bn(r,"Id")!==e))return n=Bn(r,"Target"),t.length}),n}function fu(t){let e=t.toLowerCase();return e.endsWith(".emf")||e.endsWith(".wmf")}function uy(t,e){if(e.startsWith("/"))return e.slice(1);let n=t.split("/");n.pop();for(let r of e.split("/"))r===".."?n.pop():r&&r!=="."&&n.push(r);return n.join("/")}async function ha(t,e,n,r,o){let i=n.lastIndexOf("/"),s=await Zo(t,e,`${n.slice(0,i)}/_rels/${n.slice(i+1)}.rels`,o),d={metafile:!1};return s&&ei(s,0,s.length,a=>{if(!Un(a,"Relationship"))return;let c=Bn(a,"Target")??"";fu(c)&&(d.metafile=!0),d.next===void 0&&(Bn(a,"Type")??"").endsWith(`/${r}`)&&(d.next=uy(n,c))}),d}async function ga(t,e=0){let n={scripts:[],openingSlideMetafile:!1,packageMetafile:!1};try{let r=t instanceof Uint8Array?t:new Uint8Array(t),o=sy(r);if(!o)return n;n.packageMetafile=[...o.keys()].some(T=>T.startsWith("ppt/media/")&&fu(T));let i={left:8388608},s=await Zo(r,o,"ppt/presentation.xml",i),d=await Zo(r,o,"ppt/_rels/presentation.xml.rels",i);if(!s||!d)return n;let a=cy(s),c=a[Math.max(0,Math.min(e,a.length-1))],l=c===void 0?void 0:fy(d,c);if(!l)return n;let m=l.startsWith("./")?l.slice(2):l,b=l.startsWith("/")?l.slice(1):`ppt/${m}`,R=await ha(r,o,b,"slideLayout",i),v=R.next?await ha(r,o,R.next,"slideMaster",i):void 0,P=v?.next?await ha(r,o,v.next,"",i):void 0;n.openingSlideMetafile=R.metafile||!!v?.metafile||!!P?.metafile;let C=await Zo(r,o,b,i);return C&&(n.scripts=cu(C)),n}catch{return{scripts:[],openingSlideMetafile:!1,packageMetafile:!1}}}async function py(t,e=0){let{openingSlideMetafile:n,packageMetafile:r}=await ga(t,e);return{openingSlideMetafile:n,packageMetafile:r}}async function my(t,e=0){return(await ga(t,e)).scripts}var lu,pu=X(()=>{"use strict";lu=t=>t===32||t===9||t===10||t===13});function wa(t){return t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.slice().buffer}function ti(t){return Math.round(t*100)/100}function Sy(){try{return Me.version()}catch{return}}function mu(t={}){let e,n,r=[],o,i,s,d="",a=new Map,c=!1,l=!1,m,b,R,v,P=0,C=0,T=!1,j=[],q,D;function A(u){Dt(D??null)!==Dt(u??null)&&(q=void 0),D=u,cn(u)}let U=u=>()=>{if(!q){let w=u.commandFontProvider.load(D);q=w,w.catch(()=>{q===w&&(q=void 0)})}return q},L,x=[],k,g=new Set,y=!1,f=0,h="",_=1,J=0,E=null,F=null,z=null,H=0,ne=new Map,se,ce=!1,me=!1,ee,G={},fe=new Map,ye,ae,he,Re=!1,ve=0,Ce=new Map,Ee=Gf(),_e,ze=new Map,ht=new Map,Ge=new Map,Je=new Map,Ne=new Map,Vt=new Map,It=new Map,He=new Map,ke=new Map,Ut=new Set,Ae=new Set,Ve=_t==="native"?{start:async()=>{},ready:()=>!0,retryIn:()=>{},convert:(u,w)=>xe().metafileSvg(u)}:No(),Xt,At;function kr(){if(c||l||!Ve.ready()||!Ae.size)return!1;for(let u of Ae)Ut.delete(u);Ae.clear();for(let[u,w]of ke)ke.set(u,w+1);return gt.clear(),t.onResetMedia?.(),!0}function Ea(){if(!(T||!kr())&&t.onDefaultFonts){let u=ft([],[...ke.keys()]);t.onDefaultFonts(Le({...u.value,defaultFonts:[]},u.transfer))}}function ri(){return Xt||(Xt=Ve.start().then(()=>{Ea()}).finally(()=>{Xt=void 0,l||Cr()}),Xt)}function Cr(){if(c||At!==void 0)return;let u=Ve.retryIn();u!==void 0&&(At=setTimeout(()=>{At=void 0,c||ri().catch(()=>{})},u))}let Xe=new Map,gt=new Map;function Fr(u){if(c||!L)return!1;if(b)return b.hasPending(u);if(!R&&(P>=hy||Date.now()<C))return!1;try{return L(u).some(w=>w.scripts?.length||!x.some(S=>S.family.trim().toLowerCase()===w.family.trim().toLowerCase()))}catch{return!1}}function oi(u){return Fr(u)?b?b.load(u):(R??=new Promise(w=>{P++;let S=!1,M=W=>{S||(S=!0,clearTimeout(I),v=void 0,w(W))},I=setTimeout(()=>M(),5e3);v=()=>M(),Promise.resolve().then(()=>ba.load()).then(W=>{if(c||!L){M();return}let ie=S;b=W.createCommandDefaultFonts(x,L,$=>{let O={...$,bytes:new Uint8Array($.bytes)},K=xe();$.kind==="coverage"?K.registerFallbackFont(O):K.registerFont(O),m?.upgradeRegistered(K,O.family)},$=>{if(!(!$.length||c)){m&&t.onSlicedFaces?.(),m?.scheduleFill(()=>{let O=o?.readCommandContent();return O?.ok?O.stories.map(K=>K.text).join(`
|
|
6
|
+
`):void 0}),gt.clear();for(let O of Ne.values())O.formatting=void 0,O.toolbar=void 0;for(let[O,K]of ke)ke.set(O,K+1);if(T){j.push(...$);return}if(!l&&t.onDefaultFonts){let O=ft([],[...ke.keys()]);t.onDefaultFonts(Le({...O.value,defaultFonts:$},O.transfer))}}},t.installDefaultFonts,()=>Wf(xe()),U(W),m),M(b),R=void 0,ie&&ii()}).catch(()=>{C=Date.now()+(gy[P-1]??1/0),R=void 0,M()})}),R.then(w=>w?.load(u)??[])):[]}function ii(u){if(!(!L||c)){if(u)for(let w of u)Fr(w)&&g.add(w);else Fr()&&(y=!0);!y&&!g.size||k===void 0&&(k=setTimeout(()=>{k=void 0;let w=y?[void 0]:[...g];y=!1,g.clear();for(let S of w){let M=oi(S);M instanceof Promise&&M.catch(()=>{})}},0))}}function wt(){for(let u of Object.keys(G))delete G[u]}function si(){he&&xe().addUndoBoundary(),he=void 0}function ai(u){for(let W of u.slides)Vt.set(W.id,W.notes??"");let w=new Map,S=new Map,M=(W,ie)=>{for(let $ of W){let O=$.graphic;for(let K of $.textStories)S.set(K.id,O?.type!=="table"&&ie&&ra($));if(O?.type==="table"&&Array.isArray(O.grid)&&O.grid.length){let K=O.grid.length;($.textStories??[]).forEach((B,ue)=>w.set(B.id,{shapeId:$.id,row:Math.floor(ue/K),column:ue%K}))}M($.children??[],!1)}};for(let W of u.slides)M(W.shapes??[],!0);let I=new Map(u.sources.map(W=>[W.storyId,W.paragraphs]));for(let W of u.stories){let ie=Te(W),$=It.get(W.slideId)??new Set;$.add(ie),It.set(W.slideId,$),Ne.set(ie,{text:W,snapshot:xe().story(W.storyId),echoRanges:[],canResize:S.get(W.storyId)??!1,table:w.get(W.storyId)??null,source:new Map((I.get(W.storyId)??[]).map(O=>{let K=W.paragraphs.find(de=>de.paragraphId===O.paragraphId),B=W.text.slice(K.start,K.end),[ue,Z]=Sa(O.text,B),ge=O.fields.filter(de=>{let we=de.end<=ue?0:de.start>=O.text.length-Z?B.length-O.text.length:void 0;return we!==void 0&&K.fields.some(le=>le.start===K.start+de.start+we&&le.end===K.start+de.end+we&&le.fieldType===de.fieldType)});return[O.paragraphId,{text:O.text,fields:ge,editable:O.editable&&K.editable&&!Re}]}))})}}function Rr(u,w,S=!1){let M=xe(),I=new Set(w.changedSlideIds);if(w.deckSizeChanged||w.slideOrderChanged){let ie=s.slides.findIndex(B=>B.id===E),$=new Map(s.slides.map(B=>[B.id,B.index]));s=yr(M),d=M.version(),a.clear();let O=new Set(s.slides.map(B=>B.id));for(let B of s.slides)a.set(B.id,B.index),(w.deckSizeChanged||$.get(B.id)!==B.index)&&I.add(B.id),ke.has(B.id)||ke.set(B.id,0);for(let B of $.keys())O.has(B)||I.add(B);for(let B of ke.keys())O.has(B)||(ke.delete(B),gt.delete(B));(E===null||!O.has(E))&&(E=s.slides[Math.max(0,Math.min(ie,s.slides.length-1))]?.id??null);let K=S?s.slides.find(B=>!$.has(B.id)):void 0;K&&(E=K.id)}let W=M.readCommandContent({slideIds:[...I].filter(ie=>ke.has(ie))});if(!W.ok)throw new Error(`Presentation history read refused: ${W.failure.message}`);for(let ie of I){for(let $ of It.get(ie)??[])Ne.delete($);It.delete(ie)}ai(W),Ce.clear(),_e=void 0,Ge.clear(),Je.clear(),He.clear();for(let[ie,$]of Xe)I.has($.tag.slideId)&&Xe.delete(ie);return ve=u,ne.clear(),[...I]}function Gu(u,w){let S=JSON.stringify([u,w.id]),M=JSON.stringify([w.sourceId,w.kind,w.textStories.map(W=>W.id)]),I=ne.get(S);return(!I||I.signature!==M)&&(I={signature:M,token:`${i.incarnation}:${++H}`},ne.set(S,I)),I.token}function pn(u,w){let S=xe().snapshot(),M=S.slides.find(de=>de.id===u),I=M&&Go(M.shapes,w),W=Mr(u);if(!I||I.id!==w||!W)return null;let ie=new Set;function $(de){ie.add(de.id);for(let we of de.children)$(we)}$(I);let O=W.hits.filter(de=>de.primitive.shapeId&&ie.has(de.primitive.shapeId)).map(de=>Yf(de.transforms,{x:de.primitive.x,y:de.primitive.y,width:de.primitive.w,height:de.primitive.h})),K=ta(I),B=W.size;if(!B)return null;let ue={x:S.widthEmu/B.width,y:S.heightEmu/B.height};if(![ue.x,ue.y].every(de=>Number.isFinite(de)&&de>0))return null;let Z=null;if(O.length){let de=Math.min(...O.map(le=>le.x)),we=Math.min(...O.map(le=>le.y));Z={x:de,y:we,width:Math.max(...O.map(le=>le.x+le.width))-de,height:Math.max(...O.map(le=>le.y+le.height))-we}}else K&&(Z={x:K.x/ue.x,y:K.y/ue.y,width:K.width/ue.x,height:K.height/ue.y});if(!Z)return null;let ge=I.textStories[0];return{kind:"object",slideId:u,shapeId:w,storyId:ge?.id??"",anchor:0,focus:0,affinity:"downstream",token:Gu(u,I),bounds:Z,rect:K,canMove:M.shapes.includes(I)&&na(I),canResize:M.shapes.includes(I)&&ra(I),aspectRatioLocked:I.aspectRatioLocked??!1,units:ue}}function di(u){let w=Ne.get(Te(u))?.text;return w?{slideId:u.slideId,shapeId:u.shapeId,storyId:u.storyId,kind:"shape",anchor:0,focus:w.text.length,affinity:"downstream"}:null}function li(u){return!!(u&&u.slideId===E&&u.incarnation===i.incarnation&&u.documentEpoch===_&&u.slideRevision===ke.get(u.slideId)&&u.coversThroughSeq<=f&&u.coversThroughSeq>=ve&&Xe.has(Er(u)))}function ci(u){if(!u||typeof u.slideId!="string"||typeof u.shapeId!="string"||typeof u.token!="string")return null;let w=pn(u.slideId,u.shapeId);return w?.token===u.token&&z?.token===u.token&&z.slideId===u.slideId&&z.shapeId===u.shapeId?w:null}function Bt(u){return F&&Te(F)===Te(u)&&F.anchor===u.anchor&&F.focus===u.focus&&F.affinity===u.affinity&&F.kind===u.kind?G:{}}function Vu(){Ee.retain([...Ce.keys(),...[...Xe.values()].map(u=>u.version),..._e?[_e.version]:[],h]);for(let u of ht.keys())ze.has(u)||ht.delete(u)}function Tr(u){let w=Ee.ack(u.value,_e?.version),S=u.value.defaultFonts;return S?.length&&Object.assign(w,{defaultFonts:S}),w.outcomes=w.outcomes.map(M=>M.reason==="stale-basis"&&ht.has(M.seq)?{...M,reason:ht.get(M.seq)}:M),Le(w,u.transfer)}function Er(u){return JSON.stringify([u.slideId,u.slideRevision,u.coversThroughSeq,u.documentEpoch,u.incarnation])}function xe(){if(ee!==void 0)throw new xr(ee,"Presentation command session has failed");if(c)throw new Error("Presentation command session is disposed");if(!o||!i||!s)throw new Error("Presentation command session is not open");return o}function Ir(u){return u?.session===i?.session&&u?.incarnation===i?.incarnation}function Kt(u){if(xe(),!Ir(u)||!Number.isSafeInteger(u.seq)||u.seq<0||u.seq>f)throw new Error("Presentation command fence differs")}function mn(u){let w=xe();return{selection:{...u},anchor:w.anchorCaret(u.storyId,u.anchor),focus:w.anchorCaret(u.storyId,u.focus)}}function Yt(u){let w=xe(),S=w.resolveCaretAnchor(u.anchor),M=w.resolveCaretAnchor(u.focus);if(S===null||M===null)return null;let I={...u.selection,anchor:S,focus:M};return(S!==u.selection.anchor||M!==u.selection.focus)&&delete I.goalX,I}function hn(u){if(!u||typeof u.slideId!="string"||typeof u.shapeId!="string"||typeof u.storyId!="string")return;let w=Ne.get(Te(u))?.text;return w&&Xu(u.storyId)?w:void 0}function Xu(u){let w=xe();try{return w.resolveCaretAnchor(w.anchorCaret(u,0))!==null}catch(S){if(Ln(S))throw S;return!1}}function Ku(u,w,S){let M=Ne.get(Te(u));for(let O of M.text.paragraphs){let K=M.source.get(O.paragraphId);K&&(K.fields=K.fields.filter((B,ue)=>{let Z=O.fields[ue];return Z.end<=w||Z.start>=S}))}let I=xe().story(u.storyId),W="",ie=I.paragraphs.map((O,K)=>{K>0&&(W+=`
|
|
7
|
+
`);let B=W.length,ue=O.runs.map(le=>le.text).join("");W+=ue;let Z=M.source.get(O.id),ge=[],de=Z?.editable??!0;if(Z&&Z.fields.length>0){let[le,Oe]=Sa(Z.text,ue);for(let qe of Z.fields){let Ke=qe.end<=le?0:qe.start>=Z.text.length-Oe?ue.length-Z.text.length:void 0;if(Ke===void 0){de=!1,ge.length=0;break}ge.push({...qe,start:B+qe.start+Ke,end:B+qe.end+Ke})}}let we=[];for(let le=B;le<W.length;le+=1)W[le]===`
|
|
8
|
+
`&&we.push(le);return{paragraphId:O.id,start:B,end:W.length,lineBreaks:we,fields:ge,editable:de}});if(W.length+1!==I.length)throw new Error("Story text projection differs");let $=W.length-M.text.text.length+S-w;w!==S?M.echoRanges=[]:M.echoRanges=M.echoRanges.map(O=>({start:O.start>=w?O.start+$:O.start,end:O.end>=w?O.end+$:O.end})),$>0&&(M.echoRanges.push({start:w,end:w+$}),M.echoRanges.sort((O,K)=>O.start-K.start),M.echoRanges=M.echoRanges.reduce((O,K)=>{let B=O[O.length-1];return B&&B.end>=K.start?B.end=Math.max(B.end,K.end):O.push({...K}),O},[])),M.snapshot=I,M.formatting=void 0,M.text={...M.text,text:W,paragraphs:ie}}function Ar(u){let w=Ne.get(Te(u)),S=w.formatting??=Bs(xe(),u),M=Bt(u),I=fe.get(Te(u)),W=w.toolbar;if(W?.story===S&&W.selection.anchor===u.anchor&&W.selection.focus===u.focus&&W.selection.affinity===u.affinity&&W.selection.kind===u.kind&&Object.keys(W.marks).length===Object.keys(M).length&&Object.keys(M).every(qe=>W.marks[qe]===M[qe]))return W.result;let ie=u.kind==="shape"?0:Math.min(u.anchor,u.focus),$=u.kind==="shape"?S.length:Math.max(u.anchor,u.focus),O=0,K,B,ue,Z=[],ge=[],de=new Set;for(let qe of S.paragraphs){let Ke=O;for(let N of qe.runs){if(I&&N.text.length===0)continue;let te=O+N.text.length,be={...N.style,bold:N.style.bold??lt.bold,italic:N.style.italic??lt.italic,underline:N.style.underline??"none",...(N.style.strike??lt.strike)===void 0?{}:{strike:N.style.strike??lt.strike},fontFamily:N.style.fontFamily??lt.fontFamily,fontSizePt:ti(N.style.fontSizePt??lt.fontSizePt),color:N.style.color??lt.color};ue??=be,(ie>=O&&ie<te||ie===O&&te===O)&&(K??=be),te<=ie&&te>O&&(B=be),te>O&&ie<te&&$>O&&Z.push(be),te===O&&ie<=O&&$>O&&ge.push(be),O=te}(ie===$?ie>=Ke&&ie<=O:ie<=O&&$>Ke)&&de.add(qe.alignment??"l"),O+=1}Z.push(...ge),I&&Z.length===0&&Z.push(I);let we={...lt};if(ie===$&&u.kind!=="shape")we={...we,...K??B??(I?ue??I:S.paragraphs[0]?.runs[0]?.style),...M},we.fontSizePt!==null&&we.fontSizePt!==void 0&&(we.fontSizePt=ti(we.fontSizePt));else if(Z.length>0){we={...Z[0]};let qe=new Set(Z.flatMap(Ke=>Object.keys(Ke)));for(let Ke of qe)Z.some(N=>Ke==="strike"?(N.strike??"noStrike")!==(Z[0].strike??"noStrike"):N[Ke]!==Z[0][Ke])&&(we[Ke]=null)}let le=de.size===1?[...de][0]:null,Oe={formatting:we,alignment:le==="l"||le==="ctr"||le==="r"||le==="just"?le:null};return w.toolbar={story:S,selection:{...u},marks:{...M},result:Oe},Oe}function Yu(){let u=xe(),{formatting:w,alignment:S}=F?Ar(F):{formatting:null,alignment:null},M=null;if(F&&F.kind!=="shape"){let $=Ne.get(Te(F)),O=Bf($.formatting??=Bs(u,F),F.anchor,F.focus,G);!ce&&O&&$.echoRanges.some(K=>K.start<=O.start&&K.end>=O.end)&&$.text.paragraphs.some(K=>K.paragraphId===O.paragraphId&&K.editable&&K.fields.length===0)&&(M=O.neighbour)}let I=z?u.snapshot().slides.find($=>$.id===z.slideId):null,W=I&&I.shapes.find($=>$.id===z.shapeId),ie=$=>$&&/^[#]?[0-9a-f]{6}$/i.test($)?`#${$.replace(/^#/,"")}`:null;return ye={readOnly:ce,...u.isProposalsAvailable()?{proposals:u.listProposals()}:{},notes:E?{slideId:E,text:Vt.get(E)??""}:null,object:W&&I?{formattable:W.kind==="shape",geometry:W.geometry??null,fill:W.fill?.type==="none"?null:ie(W.resolvedFillColor),stroke:ie(W.resolvedOutlineColor),strokeWidth:W.resolvedOutlineColor?(W.outline?.width??12700)/12700:null,adjustments:W.adjustValues,order:{index:I.shapes.findIndex($=>$.id===W.id),count:I.shapes.length}}:null,canUndo:u.canUndo(),canRedo:u.canRedo(),toolbar:{target:F?{slideId:F.slideId,shapeId:F.shapeId,storyId:F.storyId}:null,textContext:F?F.kind==="shape"?"shape":F.anchor===F.focus?"caret":"range":null,storedMarks:Object.fromEntries(Object.entries(G).filter(([,$])=>$!==void 0)),formatting:w,alignment:S,hyperlink:null,table:F&&F.kind!=="shape"?Ne.get(Te(F))?.table??null:null,canEditText:F!==null&&!ce,echoRun:M}},ye}function Lr(){s=yr(o),d=o.version(),a.clear();for(let[u,w]of s.slides.entries())a.set(w.id,u);return s}function gn(){xe().version()!==d&&Lr()}function fi(u,w=!0,S){let M=xe();gn();let I=a.get(u);if(I===void 0)throw new RangeError("Slide is not in the command session");let W=ke.get(u),ie=gt.get(u),$=ie?.revision===W&&ie.slideIndex===I?ie:void 0,O=$?.geometry,K=zf(M,{slideId:u,slideIndex:I,slideRevision:W,coversThroughSeq:f,documentEpoch:_,incarnation:i.incarnation,version:h,epoch:++J},Ut,$?void 0:le=>{O=da(le),gt.set(u,{slideIndex:I,revision:W,list:le,geometry:O})},$?.list,Ve,Ae,S);if(Ae.size&&!Ve.ready()&&Cr(),!O||!w)return K;let{slideId:B,slideRevision:ue,coversThroughSeq:Z,documentEpoch:ge,incarnation:de}=K.value,we=Er(K.value);for(Xe.delete(we),Xe.set(we,{tag:{slideId:B,slideRevision:ue,coversThroughSeq:Z,documentEpoch:ge,incarnation:de},geometry:O,version:h});Xe.size>257;)Xe.delete(Xe.keys().next().value);return K}function Qu(u){if(!i)return;let w;try{w=xe(),gn()}catch{return}let S=a.get(u),M=ke.get(u);if(S===void 0||M===void 0)return;let I=gt.get(u),W=I?.revision===M&&I.slideIndex===S?I.list:void 0;return W||(W=ia(w,S),gt.set(u,{slideIndex:S,revision:M,list:W,geometry:da(W)})),{slideId:u,version:h,displayList:W,mediaBytes(ie){let $=new Set,O=Ko(w,ie,Ve,$);if($.size)throw new Error("Slide media is not converted yet");return O}}}async function Zu(u){let w=new Set,S=new Set,M=Xo(xe(),u.frame,S,Ve,w);return w.size&&(await ri().catch(()=>{}),M=Xo(xe(),u.frame,S,Ve)),Le({...u,media:M},M.map(({bytes:I})=>I))}function Mr(u){let w=[...Xe.values()].find(S=>S.tag.slideId===u&&S.tag.coversThroughSeq===f&&S.tag.slideRevision===ke.get(u))?.geometry;if(!w){if(gn(),a.get(u)===void 0)return;fi(u),w=gt.get(u)?.geometry}return w}function ft(u=[],w=[],S=!1,M,I,W){if(z){let ue=pn(z.slideId,z.shapeId);z=ue?.token===z.token?ue:null,F=z?di(z):null}let ie=Yu();gn();let $=t.onActiveFrame&&(t.activeFrameWanted?.()??!0)?new Map:void 0,O=E===null||!a.has(E)?null:fi(E,!0,$);if(O&&$){let ue=xe();t.onActiveFrame({slideId:O.value.slideId,frameEpoch:O.value.epoch,displayList:gt.get(O.value.slideId).list,mediaBytes(Z){let ge=$.get(Z);return $.delete(Z),ge??Ko(ue,Z,Ve)}})}Vu();let K=r.splice(0),B=Le({...i,epoch:_,throughSeq:f,version:h,...K.length?{updates:K}:{},...me&&u.some(ue=>ue.committed)?{change:{...i,throughSeq:f,version:h,snapshot:xe().snapshot()}}:{},selection:z??(F?{...F,canResize:Ne.get(Te(F))?.canResize??!1}:null),editState:ie,outcomes:u,dirtySlideIds:w,activeSlideId:E,historyThroughSeq:ve,...m?.ack(),...M?{creation:M}:{},...I?{editResult:I}:{},...W!==void 0?{fontId:W}:{},...S?{slides:s.slides,size:s.size}:{},frame:O?.value??null},[...O?.transfer??[],...K.map(ue=>ue.bytes)]);for(let{assetId:ue}of B.value.frame?.media??[])Ut.add(ue);return B}function ep(u){let w=u.kind==="collabPipe"||u.kind==="applyRemoteUpdate";if(!u.basis||u.basis.epoch!==_||!w&&(typeof u.basis.version!="string"||u.basis.version.length===0))return"stale-basis";let S=u.payload;if(!S||typeof S!="object"||Array.isArray(S)||u.kind!=="activateSlide"&&(!Number.isFinite(u.payload.inputTime)||typeof u.payload.undoGroup!="string"||u.payload.undoGroup.length===0))return"invalid-payload";let M=eu[u.kind];if(!M||u.afterSeq!==void 0&&(!Number.isSafeInteger(u.afterSeq)||u.afterSeq<1||u.afterSeq>=u.seq))return"invalid-payload";if(u.kind==="selectAtPoint"){let{frame:N,x:te,y:be,extend:oe,granularity:Pe,drag:Se}=u.payload;if(!N||typeof N!="object"||Array.isArray(N)||typeof N.slideId!="string"||N.slideId.length===0||typeof N.incarnation!="string"||N.incarnation.length===0||!Number.isSafeInteger(N.slideRevision)||N.slideRevision<0||!Number.isSafeInteger(N.coversThroughSeq)||N.coversThroughSeq<0||!Number.isSafeInteger(N.documentEpoch)||N.documentEpoch<1||!Number.isFinite(te)||!Number.isFinite(be)||typeof oe!="boolean"||Pe!==void 0&&!["character","word","paragraph"].includes(Pe)||Se!==void 0&&typeof Se!="boolean")return"invalid-payload"}let I="at"in S?S.at:void 0;if("at"in S&&(!I||typeof I!="object"||Array.isArray(I)||I.source!=="confirmed"&&I.source!=="afterSeq"))return"invalid-payload";if(I?.source==="confirmed"){let N=I.selection;if(!N||typeof N!="object"||Array.isArray(N)||typeof N.slideId!="string"||typeof N.shapeId!="string"||typeof N.storyId!="string"||typeof N.anchor!="number"||typeof N.focus!="number"||N.affinity!=="upstream"&&N.affinity!=="downstream")return"invalid-payload";if(!Number.isSafeInteger(N.anchor)||!Number.isSafeInteger(N.focus)||N.anchor<0||N.focus<0)return"invalid-offset"}if(I?.source==="afterSeq"&&(!Number.isSafeInteger(I.seq)||I.seq<1)||(I?.source==="afterSeq"?u.afterSeq!==I.seq:u.afterSeq!==void 0))return"invalid-payload";if(u.kind==="collabPipe")return e&&ff(u.payload,Ct,{validCursor:kc,optionKeys:yy})?{kind:"remote",pipe:u.payload}:"invalid-payload";if(u.kind==="applyRemoteUpdate"){let N=Array.isArray(u.payload.bytes)?u.payload.bytes:[u.payload.bytes],te=0;for(let be of N){if(!(be instanceof ArrayBuffer)||be.byteLength===0)return"invalid-payload";te+=be.byteLength}return N.length>0&&te<=16*1024*1024?{kind:"remote",bytes:N}:"invalid-payload"}if(u.afterSeq!==void 0){if(!ze.has(u.afterSeq))return"stale-basis";let N=ze.get(u.afterSeq);if(N.status==="refused"||N.status==="cancelled")return"dependency-refused"}if(ce&&M==="local-write")return"read-only";let W=_e&&u.basis.version===_e.version?_e.seq:Ce.get(u.basis.version),ie=I?.source==="afterSeq"&&(u.kind!=="setSelection"||u.payload.selection===null),$=W??(ie?f:void 0);if($===void 0)return"stale-basis";if(u.kind==="activateSlide"){Lr();let{slideId:N}=u.payload;return typeof N=="string"&&ke.has(N)&&a.has(N)?{kind:"activation",slideId:N}:"bad-target"}if(u.kind==="setChangeObserver")return typeof u.payload.enabled=="boolean"?{kind:"observer",enabled:u.payload.enabled}:"invalid-payload";if(u.kind==="invoke"){if(ae)return"invalid-composition";if(u.basis.version!==h)return"stale-basis";let N=jf(xe(),u.payload);return N?{kind:"invoke",run:N,method:u.payload.method}:"invalid-payload"}if(u.kind==="applyEdits"){if(ae)return"invalid-composition";try{xe().validateEdits(u.payload.request)}catch{return"invalid-payload"}return{kind:"batch",request:u.payload.request}}if(u.kind==="registerFont"){let{font:N,fallback:te}=u.payload;return!N||!vr(N.family)||!N.family||!(N.bytes instanceof ArrayBuffer)||N.bytes.byteLength===0||N.bytes.byteLength>32*1024*1024||N.bold!==void 0&&typeof N.bold!="boolean"||N.italic!==void 0&&typeof N.italic!="boolean"||te!==void 0&&typeof te!="boolean"?"invalid-payload":{kind:"font",font:N,fallback:te??!1}}if(u.kind==="insertTextBox"||u.kind==="insertShape"||u.kind==="insertPicture"){if(ae)return"invalid-composition";let{slideId:N}=u.payload;if(typeof N!="string"||!a.has(N)||N!==E)return"bad-target";if(u.basis.version!==h||xe().version()!==h)return"stale-basis";let te=u.kind==="insertPicture"?u.payload:u.payload.draft;if(!te||!vr(te.name)||!te.rect||![te.rect.x,te.rect.y,te.rect.width,te.rect.height].every(Number.isSafeInteger)||te.rect.width<=0||te.rect.height<=0)return"invalid-payload";if(u.kind==="insertTextBox"){let pe=u.payload.draft;return!vr(pe.text)||!Pa(pe.style)?"invalid-payload":{kind:"insertion",slideId:N,draft:pe}}if(u.kind==="insertShape"){let pe=u.payload.draft;return!["rect","roundRect","ellipse","triangle","rtTriangle","diamond","parallelogram","trapezoid","pentagon","hexagon","octagon","star5","rightArrow","leftArrow","upArrow","downArrow","chevron"].includes(pe.geometry)||pe.fill!==void 0&&pe.fill!==null&&!/^#[0-9a-f]{6}$/i.test(pe.fill)?"invalid-payload":{kind:"insertion",slideId:N,draft:pe}}let{bytes:be,contentType:oe}=u.payload;if(!(be instanceof ArrayBuffer)||be.byteLength===0||be.byteLength>8*1024*1024||!["image/png","image/jpeg","image/gif","image/bmp","image/tiff","image/webp","image/svg+xml"].includes(oe))return"invalid-payload";let Pe="",Se=new Uint8Array(be);for(let pe=0;pe<Se.length;pe+=8192)Pe+=String.fromCharCode(...Se.subarray(pe,pe+8192));return{kind:"insertion",slideId:N,draft:{name:te.name,rect:te.rect,contentType:oe,mediaBase64:btoa(Pe)}}}if(I?.source==="confirmed"){let N=I.selection,te=hn(N);if(!te)return"bad-target";let be=te.text;for(let oe of Je.get(Te(N))?.values()??[])if(oe.seq>$){be=oe.beforeText;break}if(!mt(be,N.anchor)||!mt(be,N.focus))return"invalid-offset"}if(W!==void 0&&ui($,u.basis.version,u.afterSeq),u.kind==="undo"||u.kind==="redo")return{kind:"history",direction:u.kind};if(u.kind==="selectObject"){let{frame:N}=u.payload;if(!li(N)||u.basis.version!==h||xe().version()!==h)return"stale-basis";if(ae)return"invalid-composition";if("shapeId"in u.payload){if(typeof u.payload.shapeId!="string")return"invalid-payload";let st=pn(N.slideId,u.payload.shapeId);return st?{kind:"object",object:st}:"bad-target"}let{x:te,y:be,scale:oe}=u.payload;if(!Number.isFinite(te)||!Number.isFinite(be)||!Number.isFinite(oe)||oe<=0)return"invalid-payload";let Pe=Xe.get(Er(N)).geometry,Se=la(Pe,{x:te,y:be},void 0,oe);if(Se?.kind!=="shape")return"bad-target";let pe=xe().snapshot().slides.find(st=>st.id===N.slideId),Ie=pe&&Vo(pe,Se.shapeId),De=Ie?pn(N.slideId,Ie.id):null;return De?{kind:"object",object:De}:"bad-target"}if(u.kind==="moveShape"||u.kind==="setShapeRect"){let N=u.kind==="moveShape"&&"delta"in u.payload?u.payload:null,te=u.kind==="setShapeRect"&&"delta"in u.payload?u.payload:null,be=N??te;if(be&&(be.at.source!=="afterSeq"||be.at.seq!==f&&!(te?.frame&&te.frame.coversThroughSeq<=be.at.seq)||!be.delta||!Number.isFinite(be.delta.x)||!Number.isFinite(be.delta.y)||te&&!["nw","n","ne","e","se","s","sw","w"].includes(te.handle)))return"invalid-payload";let oe=be?z?.shapeId===be.shapeId?ci(z):null:"target"in u.payload?ci(u.payload.target):null;if(!oe)return"bad-target";if(!li(u.payload.frame)||u.payload.frame.slideId!==oe.slideId||u.basis.version!==h||xe().version()!==h)return"stale-basis";if(ae)return"invalid-composition";let Pe=u.kind==="moveShape";if(!oe.rect||!oe.canMove||!Pe&&!oe.canResize)return"unsupported";let Se=u.kind==="moveShape"?be?{...oe.rect,x:oe.rect.x+Math.round(be.delta.x*oe.units.x),y:oe.rect.y+Math.round(be.delta.y*oe.units.y)}:"x"in u.payload?{...oe.rect,x:u.payload.x,y:u.payload.y}:null:te?Rf(oe.rect,te.handle,{x:Math.round(te.delta.x*oe.units.x),y:Math.round(te.delta.y*oe.units.y)},76200,oe.aspectRatioLocked):"rect"in u.payload?u.payload.rect:null;return!Se||![Se.x,Se.y,Se.width,Se.height].every(Number.isSafeInteger)||Se.width<=0||Se.height<=0||!Pe&&(Se.width!==oe.rect.width&&Se.width<76200||Se.height!==oe.rect.height&&Se.height<76200)?"invalid-payload":{kind:"transform",object:oe,rect:{...Se},move:Pe}}let O,K;if(u.kind==="selectAtPoint"){if(!I&&u.payload.extend)return"invalid-payload";let{frame:N,x:te,y:be}=u.payload;if(N.slideId!==E||N.incarnation!==i.incarnation||N.documentEpoch!==_||!ke.has(N.slideId)||N.slideRevision>ke.get(N.slideId)||N.coversThroughSeq>f||N.coversThroughSeq<ve)return"stale-basis";let oe=Xe.get(Er(N)),Pe=oe?.geometry??Mr(N.slideId);if(!Pe)return"stale-basis";let Se=I?.source==="afterSeq"?He.get(I.seq):void 0,pe=u.payload.drag?I?.source==="confirmed"?I.selection:Se?Yt(Se):null:void 0,Ie=la(Pe,{x:te,y:be},pe);if(Ie?.kind!=="text")return{kind:"noop"};K={slideId:N.slideId,shapeId:Ie.shapeId,storyId:Ie.storyId,anchor:Ie.position,focus:Ie.position,affinity:Ie.affinity??"downstream"},O=oe?N.coversThroughSeq:f}if(u.kind==="setReadOnly")return typeof u.payload.readOnly=="boolean"?{kind:"mode",readOnly:u.payload.readOnly}:"invalid-payload";if(u.kind==="compositionEnd"){let{compositionId:N,cancelled:te}=u.payload;return typeof N!="string"||te!==void 0&&typeof te!="boolean"?"invalid-payload":ae?.id===N?{kind:"compositionEnd"}:"invalid-composition"}let B;if(u.kind==="setSelection"){if(B=u.payload.selection,B===null)return{kind:"selection",selection:null}}else if(K&&!I)B=null;else{if(!("at"in S)||!S.at)return"invalid-payload";let N=S.at;if(N.source==="confirmed")B=N.selection;else if(N.source==="afterSeq"){if(N.seq!==u.afterSeq)return"invalid-payload";if(!He.has(N.seq))return"stale-basis";let te=He.get(N.seq);B=te?Yt(te):null}else return"invalid-payload"}let ue=B;if(K&&(B=K),!B)return"bad-target";let Z=hn(B);if(!Z)return"bad-target";if(!Number.isSafeInteger(B.anchor)||!Number.isSafeInteger(B.focus)||B.anchor<0||B.focus<0)return"invalid-offset";if(K||u.kind==="setSelection"||I?.source==="confirmed"){let N=O??$,te=Je.get(Te(B)),be=Z.text;for(let oe of te?.values()??[])if(oe.seq>N){be=oe.beforeText;break}if(!mt(be,B.anchor)||!mt(be,B.focus))return"invalid-offset";B={...B};for(let oe of te?.values()??[]){if(oe.seq<=N)continue;delete B.goalX;let Pe=Math.min(B.anchor,B.focus),Se=Math.max(B.anchor,B.focus);if(Pe!==Se&&oe.deleted>0&&Pe<oe.start+oe.deleted&&Se>oe.start)return"stale-basis";let pe=Ie=>Ie<oe.start?Ie:oe.deleted===0&&Ie===oe.start?Ie+(Pe===Se||Ie===Pe?oe.inserted:0):Ie>=oe.start+oe.deleted?Ie-oe.deleted+oe.inserted:oe.start+(Pe===Se?oe.inserted:0);B.anchor=pe(B.anchor),B.focus=pe(B.focus)}}if(!mt(Z.text,B.anchor)||!mt(Z.text,B.focus))return"invalid-offset";if(B.kind!==void 0&&B.kind!=="shape"||(B.kind==="shape"&&(B={...B,anchor:0,focus:Z.text.length}),B.affinity!=="upstream"&&B.affinity!=="downstream")||B.goalX!==void 0&&!Number.isFinite(B.goalX))return"invalid-payload";if(u.kind==="setSelection")return{kind:"selection",selection:{...B}};if(u.kind==="selectAtPoint"){let N=[...Mn(Z.text)],te=B.focus;B.focus=N.reduce((oe,Pe)=>Math.abs(Pe-te)<Math.abs(oe-te)?Pe:oe,0),B.anchor=B.focus;let be=u.payload.granularity??"character";if(be!=="character"){let oe=Af(Z.text,B.focus,be);if(u.payload.drag){let pe=se?.group===u.payload.undoGroup?Yt(se.selection):null;if(!pe||Te(pe)!==Te(B))return"bad-target";B={...B,...Lf({start:Math.min(pe.anchor,pe.focus),end:Math.max(pe.anchor,pe.focus)},oe)}}else B={...B,anchor:oe.start,focus:oe.end};let Pe=Mr(B.slideId),Se=Pe&&Yo(Pe,{...B,affinity:B.focus>B.anchor?"upstream":"downstream"});Se&&(B.affinity=B.focus===Se.line.end?"upstream":"downstream")}else if(u.payload.extend&&ue&&ue.kind!=="shape"&&Te(ue)===Te(B)){let oe=Z.text;if(I?.source==="confirmed"){for(let Se of Je.get(Te(ue))?.values()??[])if(Se.seq>$){oe=Se.beforeText;break}}if(!Number.isSafeInteger(ue.anchor)||!mt(oe,ue.anchor))return"invalid-offset";let Pe=I?.source==="confirmed"?tp(ue,$):ue;B.anchor=Pe.anchor}return{kind:"selection",selection:B}}if(u.kind==="moveSelection"){if(!["left","right","wordLeft","wordRight","lineStart","lineEnd","storyStart","storyEnd","up","down","nextCell","previousCell"].includes(u.payload.motion)||typeof u.payload.extend!="boolean")return"invalid-payload";let N=Mr(B.slideId);if(!N)return"bad-target";let te=Qf(N,B,u.payload.motion,u.payload.extend,Z.text);return te?{kind:"selection",selection:te}:"bad-target"}if(u.kind==="formatText"||u.kind==="setParagraphAlignment"){let N=Math.min(B.anchor,B.focus),te=Math.max(B.anchor,B.focus);if(Z.paragraphs.some(pe=>N<=pe.end&&te>=pe.start&&(!pe.editable||pe.fields.some(Ie=>N>Ie.start&&N<Ie.end||te>Ie.start&&te<Ie.end))))return"unsupported";if(ae)return"invalid-composition";if(u.kind==="setParagraphAlignment"){let pe=u.payload.alignment;return pe===null||["l","ctr","r","just"].includes(pe)?{kind:"alignment",selection:{...B},alignment:pe}:"invalid-payload"}let{patch:be,toggle:oe,fontSizeStep:Pe}=u.payload;if(be===void 0||!Pa(be)||oe!==void 0&&!["bold","italic","underline","strikethrough"].includes(oe))return"invalid-payload";let Se=Object.fromEntries(Object.entries(be).filter(([,pe])=>pe!==void 0));if(Pe!==void 0){if(!Pe||typeof Pe!="object"||Array.isArray(Pe)||oe!==void 0||!["increase","decrease"].includes(Pe.direction)||!Array.isArray(Pe.sizes)||Pe.sizes.length>256||Pe.sizes.some((De,st,Ot)=>typeof De!="number"||!Number.isFinite(De)||De<xa||De>va||st>0&&De<=Ot[st-1]))return"invalid-payload";let pe=Ar(B).formatting.fontSizePt??lt.fontSizePt,Ie=Pe.sizes.map(ti);Se.fontSizePt=Pe.direction==="increase"?Ie.find(De=>De>pe)??Math.max(pe,Math.min(va,pe+1)):Ie.reverse().find(De=>De<pe)??Math.min(pe,Math.max(xa,pe-1))}if(oe){let pe=Ar(B).formatting;oe==="underline"?Se.underline=pe.underline!==null&&pe.underline!=="none"?"none":"sng":oe==="strikethrough"?Se.strike=pe.strike==="sngStrike"||pe.strike==="dblStrike"?"noStrike":"sngStrike":Se[oe]=pe[oe]!==!0}return{kind:"format",selection:{...B},patch:Se}}if(B.kind==="shape")return"unsupported";if(u.kind==="compositionStart"||u.kind==="compositionCommit"){if(typeof u.payload.compositionId!="string"||u.payload.compositionId.length===0)return"invalid-payload";if(u.kind==="compositionStart")return ae?"invalid-composition":{kind:"compositionStart",id:u.payload.compositionId,selection:{...B}};if(ae?.id!==u.payload.compositionId||ae.committed)return"invalid-composition";let N=ae.selection;if(B.storyId!==N.storyId||B.slideId!==N.slideId||B.shapeId!==N.shapeId)return"bad-target"}let ge=Math.min(B.anchor,B.focus),de=Math.max(B.anchor,B.focus),we="",le;switch(u.kind){case"insertText":case"replaceText":case"compositionCommit":if(we=u.payload.text,le=u.payload.style,!Pa(le))return"invalid-payload";le&&(le=Object.fromEntries(Object.entries(le).filter(([,N])=>N!==void 0)));break;case"paragraphBreak":we=`
|
|
9
|
+
`;break;case"deleteBackward":case"deleteForward":{let N=u.payload.count??1;if(u.payload.unit!=="codePoint"||!Number.isSafeInteger(N)||N<1)return"invalid-payload";if(ge===de)for(let te=0;te<N;te+=1)if(u.kind==="deleteBackward"){if(ge===0)break;ge-=1,mt(Z.text,ge)||(ge-=1)}else{if(de===Z.text.length)break;de+=1,mt(Z.text,de)||(de+=1)}break}default:return"invalid-payload"}if(!vr(we)||Z.text.length-(de-ge)+we.length>4294967294)return"invalid-payload";if(u.kind==="compositionCommit"&&we==="")return{kind:"text",selection:{...B},start:ge,end:de,text:we};let Oe=Ne.get(Te(B)),qe=Z.paragraphs.some(N=>ge<=N.end&&N.end<de);for(let N of Z.paragraphs){if(ge<=N.end&&de>=N.start&&(!N.editable||qe&&N.fields.length>0)||N.fields.some(De=>ge>De.start&&ge<De.end||de>De.start&&de<De.end)||we.includes(`
|
|
10
|
+
`)&&N.start<=ge&&ge<=N.end&&N.fields.some(De=>De.end<=ge))return"unsupported";let te=Oe.source.get(N.paragraphId);if(ge>N.end||de<N.start||!te||te.fields.length===0)continue;if(!te.editable)return"unsupported";let be=Z.text.slice(N.start,N.end),oe=we.lastIndexOf(`
|
|
11
|
+
`),Pe=(oe<0?be.slice(0,ge-N.start)+we:we.slice(oe+1))+be.slice(de-N.start),Se=oe<0?N.start:ge+oe+1,[pe,Ie]=Sa(te.text,Pe);for(let[De,st]of te.fields.entries()){let Ot=N.fields[De];if(!Ot)return"unsupported";if(ge<=Ot.start&&Ot.end<=de)continue;let pi=st.end<=pe?0:st.start>=te.text.length-Ie?Pe.length-te.text.length:void 0,Ma=(Ot.start>=de?we.length-(de-ge):0)-Se;if(pi===void 0||st.start+pi!==Ot.start+Ma||st.end+pi!==Ot.end+Ma||te.text.slice(st.start,st.end).includes(`
|
|
12
|
+
`))return"unsupported"}}let Ke=!1;return le===void 0&&(u.kind==="insertText"||u.kind==="replaceText"||u.kind==="compositionCommit")&&(Ke=!0,le={...lt,...Object.fromEntries(Object.entries(Ar(B).formatting).filter(([N,te])=>N!=="caps"&&te!==null&&te!==void 0)),...Bt(B)}),le&&(le=Zs(le),Ke&&Object.prototype.hasOwnProperty.call(Bt(B),"strike")&&Bt(B).strike===void 0&&(le={...le,strike:void 0})),{kind:"text",selection:{...B},start:ge,end:de,text:we,style:le}}function tp(u,w){let S=u.anchor;for(let M of Je.get(Te(u))?.values()??[])M.seq<=w||S<M.start||(S=S>=M.start+M.deleted?S-M.deleted+M.inserted:M.start+M.inserted);return{...u,anchor:S,focus:S}}function ui(u,w,S){_e={seq:u,version:w};for(let[I,W]of Ce){if(W>u)break;Ce.delete(I)}for(let I of ze.keys()){if(I>u)break;I!==S&&ze.delete(I)}for(let I of He.keys()){if(I>u)break;I!==S&&He.delete(I)}let M=Math.min(u,...[...Xe.values()].map(I=>I.tag.coversThroughSeq));for(let[I,W]of Ge){if(I>M)break;Ge.delete(I);let ie=Je.get(W.story);ie.delete(I),ie.size===0&&Je.delete(W.story)}}function Ia(){for(;Ce.size>256;){let[u,w]=Ce.entries().next().value;ui(w,u)}for(;Ge.size>512;){let u=Ge.values().next().value;for(let[w,S]of Xe)S.tag.coversThroughSeq<u.seq&&Xe.delete(w);ui(u.seq,u.version)}for(;ze.size>256;)ze.delete(ze.keys().next().value);for(;He.size>256;)He.delete(He.keys().next().value)}function np(u,w){let S=xe();if(w.kind==="noop")return!1;if(w.kind==="remote"){let O=F?mn(F):null,K=ae?mn(ae.selection):null,B=new Map(He);w.pipe||(se=void 0,si());let ue=S.version();if(w.pipe)e.run(w.pipe);else for(let Z of w.bytes)S.applyUpdate(new Uint8Array(Z));if(ue===S.version())return!1;w.pipe&&(se=void 0,si()),w.receipt={applied:!0,changedSlideIds:[...ke.keys()],deckSizeChanged:!0,slideOrderChanged:!0},Rr(u.seq,w.receipt);for(let[Z,ge]of B)He.set(Z,ge);if(F=O?Yt(O):null,F&&(!hn(F)||F.slideId!==E)&&(F=null),ae&&K){let Z=Yt(K);Z&&hn(Z)?ae={...ae,selection:Z}:ae=void 0}return z=null,wt(),!0}if(u.kind!=="selectAtPoint"&&(se=void 0),w.kind==="history"){if(!(w.direction==="undo"?S.canUndo():S.canRedo()))return!1;S.addUndoBoundary();let O=S.historyStep(w.direction);return O.applied?(w.receipt=O,he=void 0,ae=void 0,F=null,z=null,wt(),!0):!1}if(w.kind!=="text"&&si(),w.kind==="activation")return wt(),E=w.slideId,F=null,z=null,ae=void 0,!1;if(w.kind==="mode")return ce=w.readOnly,!1;if(w.kind==="observer")return me=w.enabled,!1;if(w.kind==="invoke"){let O=F?mn(F):null,K=z,B=S.version();return S.addUndoBoundary(),w.result=w.run(),S.addUndoBoundary(),B===S.version()?!1:(w.receipt={applied:!0,changedSlideIds:[...ke.keys()],deckSizeChanged:!1,slideOrderChanged:["insertSlide","duplicateSlide","deleteSlide","moveSlide","acceptProposal"].includes(w.method)},Rr(u.seq,w.receipt),(w.method==="insertSlide"||w.method==="duplicateSlide")&&(E=w.result.slideId),F=O?Yt(O):null,F&&(!hn(F)||F.slideId!==E)&&(F=null),z=K&&K.slideId===E?pn(K.slideId,K.shapeId):null,wt(),!0)}if(w.kind==="batch"){let O=F?mn(F):null;return w.result=S.applyEdits(w.request),!w.result.ok||!w.result.applied?!1:(w.receipt={applied:!0,changedSlideIds:w.result.changedSlides,deckSizeChanged:!1,slideOrderChanged:!1},Rr(u.seq,w.receipt),F=O?Yt(O):null,z=null,wt(),!0)}if(w.kind==="font"){let O={...w.font,bytes:new Uint8Array(w.font.bytes)};w.fontId=w.fallback?S.registerFallbackFont(O):S.registerFont(O),m?.forget(O.family,w.fontId),L&&x.push({family:O.family}),b?.supply(O.family),gt.clear();for(let K of Ne.values())K.formatting=void 0,K.toolbar=void 0;return!1}if(w.kind==="insertion"){S.addUndoBoundary(),w.receipt=u.kind==="insertTextBox"?S.addTextBox(w.slideId,w.draft):u.kind==="insertShape"?S.addShape(w.slideId,w.draft):S.addPicture(w.slideId,w.draft),S.addUndoBoundary(),Lr();let O=S.readCommandContent();if(!O.ok)throw new Error(O.failure.message);ai(O),gt.delete(w.slideId),E=w.slideId;let K=pn(w.slideId,w.receipt.shapeId);if(z=u.kind==="insertTextBox"?null:K,F=u.kind==="insertTextBox"&&K?.storyId?{slideId:K.slideId,shapeId:K.shapeId,storyId:K.storyId,anchor:0,focus:0,affinity:"downstream"}:K?di(K):null,u.kind==="insertTextBox"&&F){let B=w.draft.style;fe.set(Te(F),{...lt,...Object.fromEntries(Object.entries(B).filter(([,ue])=>ue!=null)),fontSizePt:ti(B.fontSizePt??lt.fontSizePt)})}return wt(),!0}if(w.kind==="compositionEnd")return ae=void 0,!1;if(w.kind==="selection")return z=null,(!w.selection||Bt(w.selection)!==G)&&wt(),F=w.selection,u.kind==="selectAtPoint"&&!u.payload.drag&&F&&(se={group:u.payload.undoGroup,selection:mn(F)}),F&&(E=F.slideId),!1;if(w.kind==="object"||w.kind==="transform"){let O=w.object;return wt(),F=di(O),z=O,E=O.slideId,w.kind==="object"||O.rect&&Object.keys(w.rect).every(K=>w.rect[K]===O.rect[K])?!1:(S.addUndoBoundary(),w.move?S.moveShape(O.slideId,O.shapeId,w.rect.x,w.rect.y):S.setShapeRect(O.slideId,O.shapeId,w.rect),S.addUndoBoundary(),!0)}if(w.kind==="compositionStart")return z=null,Bt(w.selection)!==G&&wt(),F=w.selection,E=F.slideId,ae={id:w.id,selection:{...F},committed:!1},!1;if(w.kind==="format"||w.kind==="alignment"){let O=w.selection;(O.kind!=="shape"||!z||Te(O)!==Te(z))&&(z=null),Bt(O)!==G&&wt(),F=O,E=O.slideId;let K=Math.min(O.anchor,O.focus),B=O.kind==="shape"?Ne.get(Te(O)).snapshot.length:Math.max(O.anchor,O.focus);return w.kind==="format"&&K===B&&O.kind!=="shape"?(Object.assign(G,Zs(w.patch)),!1):(S.addUndoBoundary(),w.kind==="format"?S.formatText(O.storyId,K,B,w.patch):S.setParagraphAlignment(O.storyId,K,B,w.alignment),S.addUndoBoundary(),!0)}let{start:M,end:I,text:W,style:ie}=w,$=w.selection;if(z=null,Bt($)!==G&&wt(),u.kind==="compositionCommit"&&W==="")return ae.committed=!0,!1;if(M!==I||W.length>0){let O=Ne.get(Te($)).text.paragraphs.some(de=>M<=de.end&&de.end<I),K=!O&&(u.kind==="insertText"||u.kind==="deleteBackward"||u.kind==="deleteForward"),B=u.payload.inputTime,ue=u.payload.undoGroup;(!K||!he||he.target!==Te($)||he.group!==ue||he.kind!==u.kind||B<he.time||B-he.time>=500||$.anchor!==he.position||$.focus!==he.position)&&S.addUndoBoundary(),I>M&&(O?Yc(S,$.storyId,M,I):S.deleteText($.storyId,M,I));let Z=M,ge=W.split(`
|
|
13
|
+
`);for(let[de,we]of ge.entries())de>0&&(S.insertParagraphBreak($.storyId,Z),Z+=1),we.length>0&&(S.insertText($.storyId,Z,we,ie&&ea(ie)),Z+=we.length);K?he={target:Te($),group:ue,time:B,kind:u.kind,position:M+W.length}:(S.addUndoBoundary(),he=void 0)}return F={...$,anchor:M+W.length,focus:M+W.length,affinity:"downstream"},delete F.goalX,E=$.slideId,u.kind==="compositionCommit"&&(ae.committed=!0),M!==I||W.length>0}function rp(u){if(xe(),u.kind!=="activateSlide"&&gn(),!Ir(u)||!Number.isSafeInteger(u.seq)||u.seq<1)return ft();let w=ze.get(u.seq);if(w)return ft([{...w}]);if(u.seq<=f)return ft([{seq:u.seq,status:"refused",reason:"stale-basis",committed:!1}]);if(u.seq!==f+1)return ft();let S=ep(u);if(typeof S=="string"){u.kind==="compositionCommit"&&ae&&ae.id===u.payload?.compositionId&&(ae=void 0);let ie={seq:u.seq,status:S==="dependency-refused"?"cancelled":"refused",reason:S,committed:!1};return f=u.seq,ze.set(u.seq,ie),Ia(),ft([ie])}let M={version:h,selection:F,objectSelection:z,activeSlideId:E,editState:ye},I="selection"in S?S.selection?.slideId:"object"in S?S.object.slideId:void 0,W=I===void 0?void 0:ke.get(I);try{let ie=S.kind==="text"?hn(S.selection).text:"",$=np(u,S),O=$&&S.kind==="history"?Rr(u.seq,S.receipt,!0):S.kind==="remote"||S.kind==="invoke"?S.receipt?.changedSlideIds:void 0;if($&&S.kind==="text"&&Ku(S.selection,S.start,S.end),$&&(S.kind==="format"||S.kind==="alignment")){let Z=Ne.get(Te(S.selection));Z.snapshot=xe().story(S.selection.storyId),Z.formatting=void 0,Z.echoRanges=[]}f=u.seq,h=xe().version(),d=h,$&&Ee.commit(h),!Ce.has(h)&&h!==_e?.version&&Ce.set(h,f);let K={seq:u.seq,status:u.kind==="compositionCommit"&&u.payload.text===""?"cancelled":$||S.kind==="invoke"&&S.method==="propose"||S.kind==="format"||S.kind==="alignment"||S.kind==="font"||S.kind==="activation"||S.kind==="selection"||S.kind==="object"||u.kind==="setReadOnly"||u.kind==="compositionStart"||u.kind==="compositionEnd"?"applied":"noop",committed:$};if(ze.set(u.seq,K),$&&S.kind==="text"){let Z=Te(S.selection),ge={seq:u.seq,story:Z,start:S.start,deleted:S.end-S.start,inserted:S.text.length,version:h,beforeText:ie};Ge.set(u.seq,ge);let de=Je.get(Z)??new Map;de.set(u.seq,ge),Je.set(Z,de)}He.set(u.seq,F?mn(F):null),Ia();let B=S.kind==="font"?[...ke.keys()]:S.kind==="batch"&&S.result?.ok?S.result.changedSlides:O??($&&E!==null?[E]:[]);for(let Z of B){let ge=ke.get(Z);ge!==void 0&&ke.set(Z,ge+1)}$&&L&&ii(S.kind==="remote"||S.kind==="history"||S.kind==="invoke"?void 0:B);let ue=()=>{T=!1;let Z=j.splice(0),ge=kr(),de=ft([K],Z.length||ge?[...new Set([...B,...ke.keys()])]:B,S.kind==="history"||S.kind==="remote"||S.kind==="invoke",S.kind==="insertion"?S.receipt:void 0,S.kind==="batch"?S.result:void 0,S.kind==="font"?S.fontId:void 0);return S.kind==="invoke"&&(de.value.mutationResult=S.result),Z.length?Le({...de.value,defaultFonts:Z},de.transfer):de};if(E!==M.activeSlideId&&E!==null&&Fr(E)){T=!0;let Z=oi(E);if(Z instanceof Promise)return Z.then(ue)}return ue()}catch(ie){throw h!==M.version&&Ce.delete(h),h=M.version,F=M.selection,z=M.objectSelection,E=M.activeSlideId,ye=M.editState,I!==void 0&&W!==void 0&&ke.set(I,W),ee=u.seq,f=u.seq,ce=!0,ze.set(u.seq,{seq:u.seq,status:"refused",reason:"unknown-outcome",committed:!1}),new xr(u.seq,`Command ${u.seq} has an unknown outcome: ${ie instanceof Error?ie.message:String(ie)}`)}}let Aa={async decodeFontFace(u,w,S,M){if(c)throw new Error("Presentation command session is disposed");if(await(t.initWasm??bt)(M),c)throw new Error("Presentation command session is disposed");let I=await by(w,S);return Le(I,I.payload===void 0?[I.font]:[I.font,I.payload])},prefetchCoverageFonts(u,w,S,M){if(c||o||l||!Array.isArray(w))return;let I=w.filter(W=>wy.has(W));I.length&&(A(M),ba.load().then(W=>{c||W.prefetchCoverageFaces(I,(t.initWasm??bt)(),U(W),S===!0)}).catch(()=>{}))},readCoverageFont(u,w,S,M){return!m||c||typeof w!="string"||typeof S!="string"?null:zn(m.read(w,S,typeof M=="number"?M:null).then(I=>Le(I??null,I?.bytes?[I.bytes]:[])))},wholeCoverageFonts(u,w){return m?zn(m.wholeFonts(w).then(S=>Le(S,S.map(M=>M.bytes)))):[]},async openCommandEditor(u,w,S){if(c)throw new Error("Presentation command session is disposed");if(o||l)throw new Error("Presentation command session is already open");if(!S||typeof S.session!="string"||!S.session||typeof S.incarnation!="string"||!S.incarnation||S.readOnly!==void 0&&typeof S.readOnly!="boolean"||S.defaultFonts!==void 0&&typeof S.defaultFonts!="boolean"||S.slicedFonts!==void 0&&typeof S.slicedFonts!="boolean")throw new TypeError("Invalid presentation command open options");A(S.fontCdn),l=!0;let M=S.slicedFonts===!0?Promise.resolve().then(()=>(ma(),pa)).then(I=>I.createSlicedFontFaces(),()=>{}):void 0;try{let I=(t.initWasm??bt)(S.wasm),W,ie,$=Promise.resolve().then(()=>(pu(),uu)).then(async le=>{let Oe=await le.scanOpeningSlide(w,S.activeSlideIndex??0);c||(ie=Oe,Oe.openingSlideMetafile?W=ri().catch(()=>{}):Oe.packageMetafile&&!l&&!Ve.ready()&&Cr(),S.defaultFonts!==!1&&Oe.scripts.length&&ba.load().then(qe=>{c||qe.prefetchCoverageFaces(Oe.scripts,I,U(qe),S.slicedFonts===!0)}).catch(()=>{}))}).catch(()=>{});if(await I,M&&(m=await M),c)throw new Error("Presentation command session is disposed");if(o=br(new Uint8Array(w),{clientId:S.clientId,fonts:S.fonts?.map(le=>({...le,bytes:new Uint8Array(le.bytes)})),fallbackFonts:S.fallbackFonts?.map(le=>({...le,bytes:new Uint8Array(le.bytes)})),initialUpdate:S.initialUpdate,retainSource:!1}),S.defaultFonts!==!1){for(let le of S.fonts??[])x.push({family:le.family});L=le=>Hf(o,le).map(Oe=>Oe.scripts?{...Oe,scripts:Oe.scripts.filter(qe=>qe.startsWith("cjk-"))}:Oe)}n=o.onUpdate((le,Oe)=>{r.push({bytes:le.slice().buffer,origin:Oe})}),S.collaboration&&(e=xf(o,t.onPipeOutput));let O=Lr(),K=S.activeSlideIndex??0;if(!Number.isSafeInteger(K))throw new RangeError("Active slide index is out of range");i={session:S.session,incarnation:S.incarnation},ce=S.readOnly??!1,me=S.observeChanges??!1,Re=S.initialUpdate!==void 0,E=O.slides[Math.max(0,Math.min(K,O.slides.length-1))]?.id??null,o.setUndoCaptureMode("manual"),h=o.version(),Ee.initialize(h),Ce.set(h,0);let B=o.readCommandContent();if(!B.ok)throw new We("message",`Presentation command open refused: ${B.failure.message}`,B.failure.code);ai(B);for(let le of O.slides)ke.set(le.id,0);let ue=!L||E===null?[]:oi(E),Z=ue instanceof Promise?await ue:void 0;if(c)throw new Error("Presentation command session is disposed");if(!ie&&(await new Promise(le=>{let Oe=setTimeout(le,300);$.finally(()=>{clearTimeout(Oe),le()})}),c))throw new Error("Presentation command session is disposed");if(W&&!Ve.ready()&&await new Promise(le=>{let Oe=setTimeout(le,3e3);(W??Promise.resolve()).finally(()=>{clearTimeout(Oe),le()})}),c)throw new Error("Presentation command session is disposed");let ge=ft();(ie?.packageMetafile&&!Ve.ready()||Ae.size)&&Cr();let de=S.initialUpdate===void 0&&!S.collaboration&&!ge.value.updates?.length,we=de?void 0:wa(o.encodeStateAsUpdate());return L&&ii(),Le({...ge.value,shared:Ee.ack(ge.value),slides:O.slides,size:O.size,activeSlideId:E,frame:ge.value.frame??null,recoveryBaseline:de?"source":"update",recoveryEngine:Sy(),...we?{recoveryUpdate:we}:{},...Z?{defaultFonts:Z}:{}},[...ge.transfer,...we?[we]:[]])}catch(I){throw La(),I}finally{l=!1,!c&&Ve.ready()&&Ae.size&&(At=setTimeout(()=>{At=void 0,Ea()},0))}},command(u,w){return rp(w)},previewShapeRect(u,w){let S=xe();if(!Ir(w))throw new Error("Presentation shape preview identity differs");let{basis:M,frame:I,target:W,rect:ie}=w;if(!M||M.epoch!==_||M.version!==h||S.version()!==h||!li(I)||I.slideId!==W?.slideId)throw new Error("stale-basis");let $=ci(W);if(!$||$.slideId!==I.slideId||$.shapeId!==W.shapeId)throw new Error("bad-target");if(!ie||![ie.x,ie.y,ie.width,ie.height].every(Number.isSafeInteger)||ie.width<=0||ie.height<=0)throw new Error("invalid-payload");if(!$.rect||!$.canResize)throw new Error("unsupported");let O=new TextEncoder().encode(JSON.stringify(Df(S,W.slideId,W.shapeId,ie))).buffer;return Le(O,[O])},edit(u,w){if(xe(),!Cf(w)){if(!Number.isSafeInteger(w?.seq)||w.seq<1)throw new TypeError("Invalid presentation edit envelope");return Tr(ft([{seq:w.seq,status:"refused",reason:"invalid-payload",committed:!1}]))}if(w.session!==i.session||w.incarnation!==0){let I=Tr(ft());return I.value.outcomes=[{seq:w.seq,status:"refused",committed:!1,reason:w.session!==i.session?"wrong-session":"stale-incarnation"}],I}let S=Ee.envelope(w,i);w.seq===f+1&&(w.basis.epoch!==_?ht.set(w.seq,"stale-epoch"):w.expectVersion===!0&&w.basis.version!==Ee.version&&(ht.set(w.seq,"stale-version"),S.basis.version=""));let M=Aa.command(null,S);return M instanceof Promise?M.then(Tr):Tr(M)},checkpoint(){throw new Error("Presentation command checkpoints are unavailable")},thumbnailFrame(u,w){if(xe(),!Ir(w))throw new Error("Presentation command thumbnail identity differs");gn();let S=ke.get(w.slideId),M={...i,epoch:_,slideId:w.slideId,slideRevision:S??0};if(S===void 0||!a.has(w.slideId))return{...M,status:"refused",reason:"bad-target"};if(w.knownRevision===S)return{...M,status:"unchanged"};let I=fi(w.slideId,!1);for(let{assetId:W}of I.value.media)Ut.add(W);return Le({...M,status:"frame",frame:I.value},I.transfer)},flushCommandEditor(u,w){return Kt(w),ft()},saveCommandEditor(u,w){Kt(w);let S=new Uint8Array(xe().save()).buffer,M=r.splice(0);return Le({...i,epoch:_,throughSeq:f,version:h,...M.length?{updates:M}:{},bytes:S},[S])},renderCommandPng(u,w,S,M){Kt(w);let I=xe(),W=m?m.completeExport(I).then(ie=>I.renderPng(S,{...M,fonts:[...M?.fonts??[],...ie]})):I.renderPng(S,M??{});return Do(W)},accessCommandEditor(u,w,S,M){if(Kt(w),!Array.isArray(M))throw new TypeError("Invalid access arguments");let I=xe();switch(S){case"encodeStateVector":return I.encodeStateVector();case"encodeStateAsUpdate":return I.encodeStateAsUpdate(M[0]);case"snapshot":return I.snapshot();case"comments":return I.comments();case"story":return I.story(M[0]);case"findText":return I.findText(M[0]);case"validateEdits":return ce?{ok:!1,version:h,failure:{code:"read-only",message:"The editor is read-only"}}:I.validateEdits(M[0]);case"exportStructured":return I.exportStructured(M[0]);case"exportMarkdown":return I.exportMarkdown(M[0]);case"searchText":return I.searchText(M[0],M[1]);case"listProposals":return I.listProposals();case"previewProposal":return I.previewProposal(M[0]);case"layoutSlide":return I.layoutSlide(M[0]);case"layoutProposalSlide":return I.layoutProposalSlide(M[0],M[1]);case"proposalSlideStrip":return I.proposalSlideStrip(M[0]);case"layoutProposalDiffSlideById":case"layoutProposalDiffSlide":{let W=S==="layoutProposalDiffSlideById"?I.layoutProposalDiffSlideById(M[0],M[1]):I.layoutProposalDiffSlide(M[0],M[1]);return Zu(W)}default:throw new TypeError("Unsupported access method")}},checkpointCommandEditor(u,w,S){Kt(w);let M=wa(xe().save()),I=S?.rebase?wa(xe().encodeStateAsUpdate()):void 0;return Le({...i,epoch:_,throughSeq:f,version:h,bytes:M,...I?{recoveryUpdate:I}:{}},I?[M,I]:[M])},prepareCommandPicture(u,w,S){if(Kt(w),!(S instanceof ArrayBuffer)||S.byteLength===0||S.byteLength>8*1024*1024)throw new Error("Invalid picture bytes");let M=Gt(new Uint8Array(S)).slice().buffer;return Le(M,[M])},readEditor(u,w,S){Kt(w);let M=xe().readContent(S),I=ft();return Le({...I.value,result:M},I.transfer)}};function La(){if(m?.dispose(),c)return;c=!0,k!==void 0&&clearTimeout(k),At!==void 0&&clearTimeout(At),Ae.clear(),v?.(),b?.dispose(),b=void 0,L=void 0,x.length=0,g.clear();let u=o;e?.dispose(),e=void 0,n?.(),n=void 0,r.length=0,o=void 0,s=void 0,a.clear(),ae=void 0,he=void 0,ye=void 0,Ce.clear(),Ee.dispose(),ze.clear(),ht.clear(),_e=void 0,Ge.clear(),Je.clear(),Ne.clear(),fe.clear(),It.clear(),ne.clear(),He.clear(),ke.clear(),Ut.clear(),t.onResetMedia?.(),Xe.clear(),gt.clear(),u?.dispose()}return{handlers:Aa,policies:{decodeFontFace:{lane:"interactive"},prefetchCoverageFonts:{lane:"interactive"},readCoverageFont:{lane:"interactive"},wholeCoverageFonts:{lane:"interactive"},openCommandEditor:{lane:"interactive"},command:u=>({lane:u.kind==="collabPipe"?"collab":"input",mutates:!0,userInput:u.kind!=="collabPipe"}),previewShapeRect:{lane:"interactive"},edit:u=>({lane:u.kind==="collabPipe"?"collab":"input",mutates:!0,userInput:u.kind!=="collabPipe"}),checkpoint:{lane:"interactive"},thumbnailFrame:{lane:"interactive"},flushCommandEditor:{lane:"interactive"},saveCommandEditor:{lane:"interactive"},renderCommandPng:{lane:"interactive"},readEditor:{lane:"interactive"},prepareCommandPicture:{lane:"interactive"},accessCommandEditor:{lane:"interactive"},checkpointCommandEditor:{lane:"interactive"}},drainPipe:()=>e?.drain(),renderSlide:Qu,fontCoverage:()=>m?.coverage,dispose:La}}function Te(t){return JSON.stringify([t.slideId,t.shapeId,t.storyId])}function Sa(t,e){let n=0,r=Math.min(t.length,e.length);for(;n<r&&t[n]===e[n];)n+=1;(!mt(t,n)||!mt(e,n))&&(n-=1);let o=0;for(;o<r-n&&t[t.length-o-1]===e[e.length-o-1];)o+=1;return(!mt(t,t.length-o)||!mt(e,e.length-o))&&(o-=1),[n,o]}function mt(t,e){return Number.isSafeInteger(e)&&e>=0&&e<=t.length&&!(e>0&&e<t.length&&t.charCodeAt(e-1)>=55296&&t.charCodeAt(e-1)<=56319&&t.charCodeAt(e)>=56320&&t.charCodeAt(e)<=57343)}function vr(t){if(typeof t!="string")return!1;for(let e of t){let n=e.codePointAt(0);if(!(n===9||n===10||n===13||n>=32&&n<=55295||n>=57344&&n<=65533||n>=65536))return!1}return!0}function Pa(t){if(t===void 0)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=["none","words","sng","dbl","heavy","dotted","dottedHeavy","dash","dashHeavy","dashLong","dashLongHeavy","dotDash","dotDashHeavy","dotDotDash","dotDotDashHeavy","wavy","wavyHeavy","wavyDbl"];return Object.entries(t).every(([n,r])=>{if(!["bold","italic","fontFamily","underline","strike","color","fontSizePt","spacingPt","baselinePct"].includes(n))return!1;if(r===void 0)return!0;switch(n){case"bold":case"italic":return typeof r=="boolean";case"fontFamily":return vr(r);case"strike":return typeof r=="string"&&["noStrike","sngStrike","dblStrike"].includes(r);case"underline":return typeof r=="string"&&e.includes(r);case"color":return typeof r=="string"&&/^#?[0-9a-f]{6}$/i.test(r);case"fontSizePt":return typeof r=="number"&&Number.isFinite(r)&&r>=xa&&r<=va;case"spacingPt":return typeof r=="number"&&Number.isFinite(r)&&Math.abs(r)<=4e3;case"baselinePct":return typeof r=="number"&&Number.isFinite(r)&&r*1e3>=-2147483648&&r*1e3<=2147483647;default:return!1}})}var hy,gy,xa,va,yy,ba,by,wy,hu=X(()=>{"use strict";qo();js();Eo();Fo();vf();Ds();zs();jt();zt();Ff();Bo();Oo();Qt();Tf();$o();On();Nf();oa();Ht();qf();Jf();$f();Vf();Zf();tu();hy=3,gy=[2e3,8e3],xa=1,va=4e3,yy=new Set(["maxFrameBytes","maxMessagesPerFrame","user"]),ba={load:()=>Promise.resolve().then(()=>(du(),au))},by=jo((t,e)=>Tn(t,e)),wy=new Set(["cjk-jp","cjk-kr","cjk-sc","cjk-tc"])});function gu(t=e=>e.close()){let e=new WeakMap,n=0;return{retain(r,o){let i=e.get(r);i?i.size>0&&i.add(o):(e.set(r,new Set([o])),n+=1)},release(r,o){let i=e.get(r);i?.delete(o)&&i.size===0&&(n-=1,t(r))},get openCount(){return n}}}var yu=X(()=>{"use strict"});var bu,iP,sP,wu,Su,_a=X(()=>{"use strict";yu();bu=globalThis,iP=bu.__betterofficePptxWorkerRenders??=new WeakMap,sP=bu.__betterofficePptxRasterOwnership??=gu(),wu="pptx-render-environment",Su="pptxRender"});var it,ka=X(()=>{"use strict";it=class extends Error{constructor(n,r,o){super(r);this.code=n;this.cause=o;this.name="PptxPeerHydrationError",this.refusal={code:n}}code;cause;refusal}});function Ca(t){if(t instanceof it)return t;if(t instanceof ot)return new it(t.code,t.message,t);if(t instanceof Error&&"refusal"in t){let e=t.refusal;if(e!==null&&typeof e=="object"&&"code"in e&&typeof e.code=="string")return new it(e.code,t.message,t)}return t}var Pu=X(()=>{"use strict";Ht();ka()});var xu,vu=X(()=>{"use strict";xu={beginEditor:{lane:"interactive"},attachPeer:{lane:"interactive"},replay:{lane:"input",mutates:!0,userInput:!0},flush:{lane:"interactive"},editorFrame:{lane:"interactive",reframes:!0},editorSave:{lane:"interactive"}}});var _u,ku=X(()=>{"use strict";_u={open:{lane:"interactive"},version:{lane:"interactive"},readContent:{lane:"interactive"},findText:{lane:"interactive"},validateEdits:{lane:"interactive"},applyEdits:{lane:"input",mutates:!0,userInput:!0},frame:{lane:"interactive",reframes:!0,key:"frame",replaceableBy:"frame"},slides:{lane:"interactive"},slideSize:{lane:"interactive"},save:{lane:"interactive"},renderPng:{lane:"interactive",reorderable:!1},dispose:{lane:"interactive"}}});function ni(t){return t?.map(e=>({...e,bytes:new Uint8Array(e.bytes)}))}async function Fa(t){if(_t==="native"){await bt(t);return}let e=t instanceof WebAssembly.Module?t:t===void 0?await wn(Jr()):await WebAssembly.compile(t);return await bt(e),e}function Cu(t,e={}){let n,r=!1,o=!1,i=!1,s=!1,d=0,a=!1,c=0,l=!1,m=0,b,R=new TextEncoder,v=new Set,P=_t==="native"?{start:async()=>{},ready:()=>!0,convert:(E,F)=>T().metafileSvg(E)}:No();async function C(){try{await P.start()}catch{}}function T(){if(a)throw new Error("Presentation session is disposed");if(!n)throw new Error("Presentation session is not open");return n}function j(E=T(),F=E.version()){return b?.version!==F&&(b={version:F,value:r?Vc(E):yr(E)}),b.value}function q(E=!0){let F=T();if(!r||s||E&&!o)throw new it("stage","Presentation editor is not attached");return F}function D(E,F){let z=q();if(d!==E||z.version()!==F)throw s=!0,new it("position-mismatch","Presentation editor fence differs");return{sequence:d,version:z.version()}}function A(){let E=j();return{format:"pptx",stage:"ready",version:c,dirty:l,slides:E.slides,size:E.size}}function U(){a=!0;let E=n;n=void 0,v.clear(),b=void 0,E?.dispose()}let L={async open(E,F,z={}){if(a)throw new Error("Presentation session is disposed");if(n||r)throw new Error("Presentation session is already open");if(cn(z.fontCdn),await(e.initWasm??bt)(z.wasm),a)throw new Error("Presentation session is disposed");let H=br(new Uint8Array(F),{clientId:z.clientId,fonts:ni(z.fonts),fallbackFonts:ni(z.fallbackFonts),initialUpdate:z.initialUpdate,retainSource:!1});try{let ne=j(H);return n=H,{format:"pptx",stage:"ready",version:c,dirty:l,slides:ne.slides,size:ne.size}}catch(ne){throw H.dispose(),ne}},version:()=>T().version(),readContent:(E,F)=>T().readContent(F),findText:(E,F)=>T().findText(F),validateEdits:(E,F)=>T().validateEdits(F),applyEdits(E,F){if(r)throw new it("stage","Editor mutations require ordered replay");let z=T().applyEdits(F);return z.ok&&z.applied&&(c+=1,l=!0,J.emit("changed",{version:c,dirty:l})),z},async frame(E,F){let z=T(),H=z.version(),ne=j(z,H).slides.length;if(!Number.isInteger(F)||F<0||F>=ne)throw new RangeError("Slide index is out of range");let se=r?Xc(z,F):Uo(z,F),ce=R.encode(se).buffer,me=[],ee=new Map,G=!1;for(let ye of Et(JSON.parse(se))){if(v.has(ye))continue;let ae;try{ae=z.mediaBytes(ye)}catch{continue}if(kt(ae)&&ae.byteLength<=33554432)try{ae=Gt(ae)}catch{}ee.set(ye,ae),!P.ready()&&!G&&Mt(ae,()=>{G=!0})}G&&(await C(),T());let fe=new Set;for(let[ye,ae]of ee){let he=Mt(ae,()=>{if(P.ready())return P.convert(ye,ae);fe.add(ye)});me.push({assetId:ye,bytes:new Uint8Array(he).buffer})}m+=1;for(let{assetId:ye}of me)fe.has(ye)||v.add(ye);return Le({displayList:ce,version:H,epoch:m,slideIndex:F,media:me},[ce,...me.map(({bytes:ye})=>ye)])},slides:()=>j().slides,slideSize:()=>j().size,save(){if(r)throw new it("stage","Editor saves require a fence");let E=T().save(),F=E.buffer instanceof ArrayBuffer&&E.byteOffset===0&&E.byteLength===E.buffer.byteLength?E.buffer:new Uint8Array(E).buffer;return Le(F,[F])},renderPng(E,F,z={}){if(r)throw new it("stage","Editor exports go through the command session");return Do(T().renderPng(F,z))},dispose(){T(),U()}},x={async beginEditor(E,F,z){if(a)throw new Error("Presentation session is disposed");if(n||r)throw new Error("Presentation session is already open");cn(z.fontCdn),r=!0;let H=await(e.initEditorWasm??Fa)(z.wasm);if(a)throw new Error("Presentation session is disposed");let ne;try{if(ne=Hc(new Uint8Array(F),{clientId:z.clientId,fonts:ni(z.fonts),fallbackFonts:ni(z.fallbackFonts),initialUpdate:z.initialUpdate}),await $c(ne),a)throw new Error("Presentation session is disposed");let se=Gc(ne);return n=ne,{state:A(),hydration:se,module:H,sequence:d,version:ne.version()}}catch(se){throw n===ne&&(n=void 0),ne?.dispose(),s=!0,Ca(se)}},attachPeer(E,F,z){let H=i;i=!0,o=!1;let ne=q(!1);if(H||F!==ne.version()||z!==d)throw s=!0,new it(H?"attachment":"position-mismatch","Presentation peer attachment differs or was already attempted");return o=!0,{version:ne.version(),sequence:d}},replay(E,F){let z=q();try{if(F.expectedOutcome==null)throw new it("outcome","Editor replay requires an expected outcome");let H=Kc(z,F);if(!H.consumed)throw new it("refusal","Worker refused accepted input");return d=H.sequence,c=H.revision,l||=H.outcome.applied,{...H,projection:A()}}catch(H){throw s=!0,Ca(H)}},flush:(E,F,z)=>D(F,z),async editorFrame(E,F){q(!1);let z=j().slides.findIndex(se=>se.id===F),H=d,ne=await L.frame(null,z);return Le({...ne.value,slideId:F,sequence:H},ne.transfer)},editorSave(E,F,z){D(F,z);let H=new Uint8Array(q().save()).buffer;return Le(H,[H])}},k,g=df((E,F)=>J.emit("defaultFontInstall",E,F)),y=mu({initWasm:e.initWasm,onActiveFrame:e.workerRender?.frame,activeFrameWanted:e.workerRender?.active,onResetMedia:e.workerRender?.resetMedia,installDefaultFonts:async E=>{let F=await g.install(E);return e.workerRender?.defaultFonts(F),F},onDefaultFonts:E=>J.emit("defaultFonts",E.value,E.transfer),onSlicedFaces:()=>e.workerRender?.invalidateFonts?.(),onPipeOutput(){a||k!==void 0||(k=setTimeout(()=>{k=void 0;let E=y.drainPipe();E&&J.emit("collaborationPipe",E.batches,E.transfer)},0))}});e.workerRender?.slides?.(y.renderSlide),e.workerRender?.fontCoverage?.(y.fontCoverage);let f,h=(E,F,z)=>{if(z&&!a)try{t.post({...E,[Su]:z},z.kind==="raster"?[...F??[],z.bitmap]:F);return}catch{}z?.kind==="raster"&&z.bitmap.close(),t.post(E,F)},_={...t,listen:E=>t.listen(F=>{g.receive(F)||E(F)}),post(E,F){let z=Va(E)&&(E.kind==="reply"||E.kind==="event"&&E.name==="ack")?y.drainPipe():void 0,H=z?{...E,collabPipe:z.batches}:E,ne=z?[...F??[],...z.transfer]:F,se=e.workerRender;if(!f&&!se?.pending()){t.post(H,ne),se?.afterReply();return}let ce=se?.pending()?se.paintNow():void 0,me=Promise.all([f,ce]).then(([,ee])=>{try{h(H,ne,ee)}catch(G){try{t.post({protocol:1,kind:"failure",code:"message",message:`Session could not post a message: ${G instanceof Error?G.message:String(G)}`})}catch{}}se?.afterReply()});f=me,me.then(()=>{f===me&&(f=void 0)})}},J=sf(_,{handlers:{...L,...x,...y.handlers},policies:{..._u,...xu,...y.policies},context:null,onDispose(){k!==void 0&&clearTimeout(k);try{U()}finally{g.dispose(),y.dispose(),e.workerRender?.dispose()}}});return J}var Fu=X(()=>{"use strict";Jt();af();Oo();lf();zt();jr();Cn();jn();jt();Ht();pr();Ds();zs();hu();_a();Pu();ka();vu();ku()});function Ru(t,e,n){let r=Math.max(0,Math.min(e,t.x)),o=Math.max(0,Math.min(n,t.y));return{x:r,y:o,width:Math.max(0,Math.min(e,t.x+t.width)-r),height:Math.max(0,Math.min(n,t.y+t.height)-o)}}var Tu=X(()=>{"use strict"});function Au(t){let e=t.images(),n=t.reuse?Eu.get(t.reuse):void 0,r={canvases:[],disposed:!1},o=new Map,i=new Map,s=new Map,d=!1,a=0,c=()=>{d&&!s.size&&o.clear()},l=(v,P)=>{--P.references===0&&(i.delete(v),P.resolve.release())},m=(v,P)=>{if(!n||n.disposed())return;let C=n.media.get(v);if(!C)return;let T=JSON.stringify([v,C.version]),j=n.assets.get(T);if(!(!j||!(C.bytes.buffer===P.buffer||C.bytes.length===P.length&&C.bytes.every((q,D)=>q===P[D]))))return{asset:j,release:()=>n.releaseAsset(T,j)}},b=v=>{for(let P of v){let C=o.get(P.assetId);if(C?.bytes.buffer===P.bytes)continue;let T=new Uint8Array(P.bytes);!C||C.bytes.length!==T.length||!C.bytes.every((j,q)=>j===T[q])?o.set(P.assetId,{bytes:T,version:++a}):C.bytes=T}},R={ingest:b,pin(v,P=[]){if(d)throw new Error("Slide images are disposed");let C=s.get(v);if(b(C?P:[...P,...v.frame.media]),!C){let q=new Map,D=new Map;for(let A of t.frameAssetIds(v.displayList)){let U=o.get(A);if(!U)continue;let L=JSON.stringify([A,U.version]),x=i.get(L),k=x?void 0:m(A,U.bytes);if(k)x=k.asset;else if(!x){let y=e.resolve({media:new Map([[L,U.bytes]])});x={resolve:y,source:Promise.resolve(y(L)),references:0},i.set(L,x)}let g=x;g.references+=1,q.set(A,{asset:g,release:k?.release??(()=>l(L,g))}),D.set(A,U.version)}C={resolve:A=>q.get(A)?.asset.source??null,versions:D,ready:Promise.all([...q.values()].map(({asset:A})=>A.source)).then(()=>{}),retainAsset(A){let U=q.get(A);U&&(U.asset.references+=1);let L=!1;return{resolve:x=>!L&&x===A?U?.asset.source??null:null,ready:(U?.asset.source??Promise.resolve(null)).then(()=>{}),release(){L||(L=!0,U?.release())}}},release(){for(let{release:A}of q.values())A();q.clear()},references:0},s.set(v,C)}let T=C,j=()=>{T.references+=1;let q=!1;return{resolve:T.resolve,ready:T.ready,version:D=>T.versions.get(D),retain:j,retainAsset:T.retainAsset,release(){q||(q=!0,--T.references===0&&(s.delete(v),T.release(),c()))}}};return j()},trim(){for(let v of r.canvases)ct(v.canvas);r.canvases.length=0,e.trim?.()},dispose(){if(!d){d=r.disposed=!0;for(let v of r.canvases)ct(v.canvas);r.canvases.length=0,e.dispose(),c()}}};return Lu.set(R,r),Eu.set(R,{media:o,assets:i,disposed:()=>d,releaseAsset:l}),R}function Ra(t){let e=Iu.get(t);return e||(e=new Map,Iu.set(t,e)),{byKey:e,pool:Lu.get(t)}}function ct(t){t.width=0,t.height=0}function _r(t,e,n){let r=new Map;return new Proxy(t,{get(o,i){let s=r.get(i);if(s)return s;let d=Reflect.get(o,i,o);if(typeof d!="function")return d;let a=n&&i==="clearRect"?()=>{}:n&&i==="setTransform"?()=>{e()&&n()}:(...c)=>e()?d.apply(o,c):void 0;return r.set(i,a),a},set:(o,i,s)=>!e()||Reflect.set(o,i,s,o)})}function Ta(t,e=[],n=[]){let r=JSON.stringify(e.map(o=>({x:o.x,y:o.y,w:o.w,h:o.h,transform:o.transform})));for(let o of t)if(o.kind==="chart"||o.kind==="table")Ta(o.primitives,[...e,o],n);else if(o.kind==="textBox")for(let i of o.lines)n.push({primitive:{...o,lines:[i]},parents:e,parentsKey:r,box:o});else n.push({primitive:o,parents:e,parentsKey:r});return n}async function Mu(t,e,n,r,o,i,s){let d=n*r;if(await o.ready,!!s()){t.save();try{t.setTransform(1,0,0,1,0,0),await i(_r(t,s),{...e,primitives:[]},n,r);for(let{primitive:a,parents:c}of Ta(e.primitives)){if(!s())return;let l=Ou(a,c,d,e);if(!l)continue;let m=Math.round(l.x*d),b=Math.round(l.y*d),R=Math.ceil(l.width*d),v=Math.ceil(l.height*d);t.save();try{let P=_r(t,s,()=>{t.setTransform(1,0,0,1,0,0),t.beginPath(),t.rect(m,b,R,v),t.clip(),t.setTransform(d,0,0,d,0,0);for(let C of c)Bu(t,C),t.beginPath(),t.rect(C.x,C.y,C.w,C.h),t.clip()});await i(P,{...e,background:void 0,primitives:[a]},n,r,{resolveImage:o.resolve})}finally{t.restore()}}}finally{t.restore()}}}function Uu(t,e,n,r,o,i,s,d,a,c){let l=c.paintSlide,m=n*r,b=Math.ceil(e.width*r*n),R=Math.ceil(e.height*r*n),v=s.canvases.findIndex(({canvas:H})=>H.width===b&&H.height===R),P=s.canvases.splice(v<0?s.canvases.length-1:v,1)[0],C=P?.canvas??t(b,R),T=C.width===b&&C.height===R;(!P||!T)&&("style"in C?c.sizeCanvasForSlide(C,e,n,r):(C.width=b,C.height=R));let j=JSON.stringify([e.width,e.height,m,e.background]),q=C.getContext("2d");if(!q)throw ct(C),new Error("Slide canvas is unavailable");let D=[],A=new Map,U=new Set,L=!1,x=!1,k,g=!1,y=()=>{g||(g=!0,o.release())},f=()=>!L,h=!1,_=()=>{h||!x||L||(h=!0,!s.disposed&&s.canvases.length<2?s.canvases.push({canvas:C,background:j,layers:D.map(({tile:H,bounds:ne})=>({id:H.id,bounds:ne}))}):ct(C))},J=()=>{if(!L){L=!0,a(),U.clear(),!h&&x&&!s.disposed&&s.canvases.length<2?s.canvases.push({canvas:C,background:j,layers:D.map(({tile:H,bounds:ne})=>({id:H.id,bounds:ne}))}):h||ct(C);for(let[H,ne]of A)--H.references===0&&(H.cancelled=!0,H.releaseMedia?.(),i.get(ne)===H&&i.delete(ne),ct(H.canvas));A.clear(),y()}};function E(H,ne,se,ce){let me=Ou(H,ne,m,e);if(!me)return;let ee=H.kind==="textBox"?{...H,paragraphs:[]}:H,G=`[${JSON.stringify(ee)},${se},${JSON.stringify(m)},${JSON.stringify(me)},${JSON.stringify(H.kind==="image"&&H.assetId?o.version(H.assetId)??null:null)}]`,fe=i.get(G);if(!fe){let ye=t(Math.ceil(me.width*m),Math.ceil(me.height*m));ye.width=Math.ceil(me.width*m),ye.height=Math.ceil(me.height*m);let ae=ye.getContext("2d");if(!ae)throw ct(ye),new Error("Slide canvas is unavailable");let he=H.kind==="image"&&H.assetId?o.retainAsset(H.assetId):void 0,Re=!1,ve={id:++Py,canvas:ye,references:0,cancelled:!1,ready:Promise.resolve(),releaseMedia(){Re||he?.release()}},Ce=_r(ae,()=>!ve.cancelled,()=>{ae.setTransform(m,0,0,m,-me.x*m,-me.y*m);for(let _e of ne)Bu(ae,_e),ae.beginPath(),ae.rect(_e.x,_e.y,_e.w,_e.h),ae.clip()}),Ee=()=>{if(!ve.cancelled)return Re=!0,l(Ce,{...e,background:void 0,primitives:[H]},n,r,{resolveImage:_e=>(he??o).resolve(_e)})};try{ve.ready=he?he.ready.then(Ee).finally(()=>he.release()):Promise.resolve(Ee())}catch(_e){he?.release(),ve.ready=Promise.reject(_e)}ve.ready.catch(()=>{}),fe=ve,i.set(G,fe)}A.has(fe)||(A.set(fe,G),fe.references+=1),d.push(fe.ready),D.push({tile:fe,bounds:me,box:ce,line:H.kind==="textBox"?H.lines[0]:void 0})}let F={canvas:C,factor:m,get damage(){return k},get ready(){return x&&f()},subscribe(H){return L||U.add(H),()=>{U.delete(H)}},plate(H,ne){let se=t(Math.ceil(ne.width*m),Math.ceil(ne.height*m)),ce=t(Math.ceil(ne.width*m),Math.ceil(ne.height*m));se.width=ce.width=Math.ceil(ne.width*m),se.height=ce.height=Math.ceil(ne.height*m);try{let me=se.getContext("2d"),ee=ce.getContext("2d");if(x&&f()&&me&&ee){let G=_r(me,f,()=>{me.setTransform(m,0,0,m,-ne.x*m,-ne.y*m)});l(G,{...e,primitives:[]},n,r).catch(()=>{});let fe=!1;for(let ye of D){if(ye.box?.objectId===H.box.objectId&&ye.line?.start===H.line.start&&ye.line.end===H.line.end){fe=!0;continue}(fe?ee:me).drawImage(ye.tile.canvas,(ye.bounds.x-ne.x)*m,(ye.bounds.y-ne.y)*m)}}return{background:se,foreground:ce}}catch(me){throw ct(se),ct(ce),me}}};try{for(let H of Ta(e.primitives))E(H.primitive,H.parents,H.parentsKey,H.box)}catch(H){throw J(),H}let z=Promise.allSettled(d).then(async H=>{for(let ce of H)if(ce.status==="rejected")throw ce.reason;if(!f())return;let ne=P&&T&&P.background===j,se=ne?xy(P.layers,D,m):void 0;if(k=ne?se:{x:0,y:0,width:b,height:R},!ne||se){q.save();try{if(q.setTransform(1,0,0,1,0,0),se&&(q.beginPath(),q.rect(se.x,se.y,se.width,se.height),q.clip()),P&&q.clearRect(0,0,C.width,C.height),await l(_r(q,f),{...e,primitives:[]},n,r),!f())return;for(let ce of D)(!se||vy(ce.bounds,se,m))&&q.drawImage(ce.tile.canvas,ce.bounds.x*m,ce.bounds.y*m)}finally{q.restore()}}x=!0;for(let ce of U)ce()}).finally(y);return{raster:F,ready:z,references:0,cancelled:!1,recycle:_,release(){this.cancelled=!0,J()}}}function xy(t,e,n){let r=1/0,o=1/0,i=-1/0,s=-1/0,d=a=>{if(!a)return;let c=a.bounds;r=Math.min(r,c.x),o=Math.min(o,c.y),i=Math.max(i,c.x+c.width),s=Math.max(s,c.y+c.height)};for(let a=0;a<Math.max(t.length,e.length);a+=1){let c=t[a],l=e[a];c?.id===l?.tile.id&&c?.bounds.x===l?.bounds.x&&c?.bounds.y===l?.bounds.y&&c?.bounds.width===l?.bounds.width&&c?.bounds.height===l?.bounds.height||(d(c),d(l))}if(r!==1/0)return r=Math.floor(r*n),o=Math.floor(o*n),{x:r,y:o,width:Math.ceil(i*n)-r,height:Math.ceil(s*n)-o}}function vy(t,e,n){return t.x*n<e.x+e.width&&(t.x+t.width)*n>e.x&&t.y*n<e.y+e.height&&(t.y+t.height)*n>e.y}function Bu(t,e){if(!e.transform)return;let n=e.x+e.w/2,r=e.y+e.h/2;t.translate(n,r),t.rotate((e.transform.rotationDeg??0)*Math.PI/180),t.scale(e.transform.flipH?-1:1,e.transform.flipV?-1:1),t.translate(-n,-r)}function Ou(t,e,n,r){let o=t.kind==="textBox"?t.lines[0]:void 0,i=t.kind==="textBox"?t.textShadow:t.kind==="shape"||t.kind==="image"?t.shadow:void 0,s=t.kind==="shape"||t.kind==="image"?t.stroke:void 0,d=[s?.headEnd,s?.tailEnd],c=(s?.width??0)*((s?.join??"miter")==="miter"?5:.5)+Math.max(0,...d.map(T=>T&&T.kind!=="none"?Math.hypot(T.length,T.width/2):0))+Math.abs(i?.dx??0)+Math.abs(i?.dy??0)+(i?.blur??0)*3+2,l=o?{x:Math.min(t.x,o.x),y:o.y,w:Math.max(t.x+t.w,o.x+o.width)-Math.min(t.x,o.x),h:o.height}:t,m=[{x:l.x-c,y:l.y-c},{x:l.x+l.w+c,y:l.y-c},{x:l.x-c,y:l.y+l.h+c},{x:l.x+l.w+c,y:l.y+l.h+c}],b=[...e,t];for(let T=b.length-1;T>=0;T-=1){let j=b[T],q=j.x+j.w/2,D=j.y+j.h/2,A=(j.transform?.rotationDeg??0)*Math.PI/180,U=Math.cos(A),L=Math.sin(A);for(let x of m){let k=(x.x-q)*(j.transform?.flipH?-1:1),g=(x.y-D)*(j.transform?.flipV?-1:1);x.x=q+k*U-g*L,x.y=D+k*L+g*U}}let R=Math.max(0,Math.floor(Math.min(...m.map(T=>T.x))*n)/n),v=Math.max(0,Math.floor(Math.min(...m.map(T=>T.y))*n)/n),P=Math.min(r.width,Math.ceil(Math.max(...m.map(T=>T.x))*n)/n),C=Math.min(r.height,Math.ceil(Math.max(...m.map(T=>T.y))*n)/n);return P>R&&C>v?{x:R,y:v,width:P-R,height:C-v}:null}var Eu,Iu,Lu,Py,Nu=X(()=>{"use strict";Eu=new WeakMap;Iu=new WeakMap,Lu=new WeakMap,Py=0});function Du(t){let e=new Map,n=!1,r=o=>{o.retained||o.references||o.closed||!o.source||(o.closed=!0,"close"in o.source&&typeof o.source.close=="function"&&o.source.close(),o.source=null)};return{resolve(o){let i=new Map,s=!1;return Object.assign(a=>{if(n||s)return Promise.resolve(null);let c=o.media.get(a);if(!c||kt(c))return Promise.resolve(null);let l=i.get(a)??e.get(a);if(l)e.get(a)===l&&(e.delete(a),e.set(a,l));else{let m={promise:Promise.resolve(null),source:null,references:0,retained:!0,closed:!1};m.promise=t(c,"Unable to decode slide image").catch(()=>null).then(b=>(m.source=b,r(m),b)),l=m,e.set(a,l)}for(i.has(a)||(i.set(a,l),l.references+=1);e.size>25;){let m=e.entries().next().value;if(!m)break;e.delete(m[0]),m[1].retained=!1,r(m[1])}return l.promise},{release(){if(!s){s=!0;for(let a of i.values())a.references-=1,r(a);i.clear()}}})},trim(){for(let o of e.values())o.retained=!1,r(o);e.clear()},dispose(){n=!0;for(let o of e.values())o.retained=!1,r(o);e.clear()}}}var zu=X(()=>{"use strict";Cn()});function _y(t,e=()=>{},n=()=>{}){let r=globalThis.fonts,o=[],i=new Map,s=new WeakMap,d=()=>Au({images:()=>Du((ee,G)=>{let fe=s.get(ee.buffer);return fe?os(fe,G):Promise.reject(new Error("Slide image is unavailable"))}),frameAssetIds:Et}),a=d(),c,l,m=0,b=0,R=Promise.resolve(),v,P=!1,C=!1,T,j,q,D=0,A,U=!0,L=!1,x=!1,k,g=[],y=(ee,G=[])=>{if(k){k.resolve(ee);return}try{t.postMessage(ee,G)}catch{ee.kind==="raster"&&ee.bitmap.close(),me()}},f=(ee,G)=>{if(typeof ee.transferToImageBitmap=="function"){let fe=new OffscreenCanvas(G.width,G.height);try{let ye=fe.getContext("2d");if(ye)return ye.drawImage(ee,G.x,G.y,G.width,G.height,0,0,G.width,G.height),fe.transferToImageBitmap()}finally{ct(fe)}}return createImageBitmap(ee,G.x,G.y,G.width,G.height)};try{if(typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof FontFace=="function"&&r&&typeof r.add=="function"&&typeof r.delete=="function"){let ee=new OffscreenCanvas(1,1);try{x=!!ee.getContext("2d")}finally{ct(ee)}}}catch{}x||y({kind:"unsupported"});function h(ee,G=!1){return[...Et(ee.displayList)].flatMap(fe=>{if(!i.has(fe)){let ae;try{ae=ee.mediaBytes(fe)}catch(Re){if(G)throw Re;return[]}let he={assetId:fe,bytes:new ArrayBuffer(1),mainOnly:!1};try{let Re=dr(ae);he.mainOnly=lr(Re),he.mainOnly||s.set(he.bytes,Re)}catch(Re){he.error={cause:Re}}i.set(fe,he)}let ye=i.get(fe);if(ye?.error)throw ye.error.cause;return ye?[ye]:[]})}let _=0;async function J(ee,G){_=G;let fe=l,ye=b;if(P||!fe)return;let ae=()=>!P&&_===G&&b===ye&&l===fe,he,Re;try{if(await R,!ae()||v)return;let ve=e()?.(ee);if(!ve)return;let Ce=h(ve,!0);if(Ce.some(Ne=>Ne.mainOnly))return;let Ee=fe.scale*fe.dpr,_e=Math.ceil(ve.displayList.width*Ee),ze=Math.ceil(ve.displayList.height*Ee);Re=a.pin({displayList:ve.displayList,frame:{media:Ce}}),he=new OffscreenCanvas(_e,ze);let ht=he.getContext("2d");if(!ht)return;let Ge=n();if(Ge&&(await(await Promise.resolve().then(()=>(Po(),So))).prepareTextFamilies(ve.displayList,Ge),!ae())||(await Mu(ht,ve.displayList,fe.dpr,fe.scale,Re,Ge?(Ne,Vt,It,He,ke)=>on(Ne,Vt,It,He,{...ke,fontCoverage:Ge}):on,ae),!ae()))return;let Je=typeof he.transferToImageBitmap=="function"?he.transferToImageBitmap():await createImageBitmap(he);if(!ae()){Je.close();return}try{t.postMessage({kind:"prerender",slideId:ee,token:G,version:ve.version,fonts:ye,factor:Ee,width:_e,height:ze,bitmap:Je},[Je])}catch{Je.close()}}catch{}finally{Re?.release(),he&&ct(he)}}function E(){m+=1,T?.()}function F(){P||!x||C||j!==void 0||!c||!l||L||(j=setTimeout(()=>{j=void 0,z()},0))}async function z(){if(P||!c||!l||L)return;C=!0;let ee=c,G=l,fe=m,ye=b,ae=()=>!P&&m===fe&&b===ye,he;try{if(await R,!ae())return;if(v)throw v;if(!U&&q&&q.slideId===ee.slideId&&q.list===ee.displayList&&q.factor===G.scale*G.dpr){y({kind:"unchanged",slideId:ee.slideId,frameEpoch:ee.frameEpoch,baseEpoch:q.epoch,baseContent:q.content});return}if(k&&(U||!q||q.slideId!==ee.slideId||[...Et(ee.displayList)].some(Ae=>!i.has(Ae)))&&(k.resolve(),await new Promise(Ae=>setTimeout(Ae,0)),!ae()))return;let Re=h(ee),ve=Re.filter(Ae=>Ae.mainOnly).map(({assetId:Ae})=>Ae);if(ve.length){U=!0,y({kind:"main-only",slideId:ee.slideId,frameEpoch:ee.frameEpoch,assetIds:ve});return}let Ce=G.scale*G.dpr,Ee=Math.ceil(ee.displayList.width*G.scale*G.dpr),_e=Math.ceil(ee.displayList.height*G.scale*G.dpr),ze=U||!q||q.slideId!==ee.slideId||q.factor!==Ce||q.width!==Ee||q.height!==_e,ht=ze?null:q.epoch,Ge=n();if(Ge&&(await Promise.race([Promise.resolve().then(()=>(Po(),So)).then(Ae=>Ae.prepareTextFamilies(ee.displayList,Ge)),new Promise(Ae=>{T=Ae})]),!ae()))return;let Je=a.pin({displayList:ee.displayList,frame:{media:Re}}),Ne=[Je.ready],Vt=Ra(a);try{he=Uu((Ae,Ve)=>new OffscreenCanvas(Ae,Ve),ee.displayList,G.dpr,G.scale,Je,Vt.byKey,Vt.pool,Ne,()=>{},{sizeCanvasForSlide:Yl,paintSlide:Ge?(Ae,Ve,Xt,At,kr)=>on(Ae,Ve,Xt,At,{...kr,fontCoverage:Ge}):on})}catch(Ae){throw Je.release(),Ae}if(A?.release(),A=he,await he.ready,!ae()){U=!0;return}let It=ze?{x:0,y:0,width:Ee,height:_e}:he.raster.damage,He=Ru(It??{x:0,y:0,width:1,height:1},Ee,_e),ke=await f(he.raster.canvas,He);if(!ae()){ke.close(),U=!0;return}let Ut=++D;y({kind:"raster",slideId:ee.slideId,frameEpoch:ee.frameEpoch,factor:Ce,baseEpoch:ht,content:Ut,baseContent:ze?null:q.content,rect:He,bitmap:ke,width:Ee,height:_e},[ke]),q={slideId:ee.slideId,epoch:ee.frameEpoch,content:Ut,factor:Ce,width:Ee,height:_e,list:ee.displayList},U=!1}catch(Re){U=!0,ae()&&y({kind:"error",frameEpoch:ee.frameEpoch,message:Re instanceof Error?Re.message:String(Re)})}finally{he&&(!P&&he.raster.ready?he.recycle?.():(he.release(),A===he&&(A=void 0))),C=!1,T=void 0,k?.resolve(),!P&&(m!==fe||b!==ye)&&F()}}function H(ee){ee.length&&ne(ee)}function ne(ee){if(!(P||!x)){if(g){g.push(ee);return}b+=1,R=R.then(async()=>{for(let G of ee){if(P)return;let fe=await new FontFace(G.family,G.source,G.descriptors).load();if(P)return;r.add(fe),o.push(fe)}}).catch(G=>{v=G}).then(()=>{if(P)return;U=!0,A?.release(),A=void 0;let G=Ra(a);for(let fe of G.pool.canvases)ct(fe.canvas);G.pool.canvases.length=0,E(),F()}),E(),F(),se()}}function se(){if(!P)try{t.postMessage({kind:"font-generation",fonts:b})}catch{}}function ce(){P||(E(),j!==void 0&&clearTimeout(j),j=void 0,c=void 0,L=!1,U=!0,q=void 0,A?.release(),A=void 0,a.dispose(),a=d(),i.clear(),s=new WeakMap)}function me(){if(!P){P=!0,T?.(),j!==void 0&&clearTimeout(j),A?.release(),A=void 0,a.dispose(),i.clear(),s=new WeakMap;for(let ee of o)r?.delete(ee);o.length=0,c=void 0,t.close()}}return t.onmessage=ee=>{let G=ee.data;if(G.kind==="dispose"){me();return}if(!(P||!x)){if(G.kind==="fonts"){H(G.faces);return}if(G.kind==="prerender"){J(G.slideId,G.token);return}if(G.kind==="view"){if(!(Number.isFinite(G.scale)&&Number.isFinite(G.dpr)&&G.scale>0&&G.dpr>0)||l?.scale===G.scale&&l.dpr===G.dpr)return;if(l={scale:G.scale,dpr:G.dpr},g){let fe=g;g=void 0;for(let ye of fe)H(ye)}}U=!0,E(),F()}},t.onmessageerror=me,t.start(),{frame(ee){P||!x||(c=ee,L=!0,E())},afterReply(){L=!1,F()},pending:()=>!P&&x&&L&&!!c&&!!l,paintNow(){return P||!x||!L||!c||!l||C||k?Promise.resolve(void 0):(L=!1,j!==void 0&&(clearTimeout(j),j=void 0),new Promise(ee=>{let G={resolve(ye){k===G&&(k=void 0,clearTimeout(fe),ee(ye))}},fe=setTimeout(()=>G.resolve(),0);k=G,z()}))},fonts:H,invalidateFonts:()=>ne([]),resetMedia:ce,defaultFonts(ee){H(ee.map(G=>{let fe=G.ownWeight?void 0:Qo(new Uint8Array(G.bytes));return{family:G.family,source:G.bytes.slice(0),descriptors:{weight:fe?String(fe.weight):G.bold?"700":"400",style:fe?fe.italic?"italic":fe.oblique?"oblique":"normal":G.italic?"italic":"normal"}}}))},dispose:me}}function qu(t){return!!t&&typeof t=="object"&&"kind"in t&&t.kind===wu&&"port"in t}function ju(t){let e,n,r,o=t.listen(i=>{qu(i)&&(e?.dispose(),e=_y(i.port,()=>n,()=>r?.()))});return{transport:{...t,listen:i=>t.listen(s=>{qu(s)||i(s)})},frame:i=>e?.frame(i),active:()=>!!e,afterReply:()=>e?.afterReply(),pending:()=>e?.pending()??!1,paintNow:()=>e?.paintNow()??Promise.resolve(void 0),resetMedia:()=>e?.resetMedia(),defaultFonts:i=>e?.defaultFonts(i),slides(i){n=i},fontCoverage(i){r=i},invalidateFonts:()=>e?.invalidateFonts(),dispose(){o(),e?.dispose(),e=void 0,n=void 0}}}var Ju=X(()=>{"use strict";_a();Tu();fa();Jt();Nu();ps();zu();pr()});var Hu={};St(Hu,{startSessionWorker:()=>ky});function ky(t){let e=t;if(e[Wu])return;e[Wu]=!0;let n=ju(ja(t)),r=n.transport,o=Cu(r,{workerRender:n,initWasm:_t==="native"?bt:Za(r,ed(),bt,wn),initEditorWasm:Fa});Object.assign(globalThis,{__betterofficeEngineProgress:()=>o.progress()})}var Wu,$u=X(()=>{"use strict";Ja();jr();jn();jt();Ht();Fu();Ju();Wu=Symbol.for("betteroffice.pptx.worker.started")});Nt();Oa(self,hi);var Na=["message","messageerror"];function Da(t,e,n,r){let o=t,i=Symbol.for(r);if(o[i])return;o[i]=!0;let s=[],d=new WeakSet,a=c=>{d.has(c)||(c.stopImmediatePropagation(),s?.push(c))};for(let c of Na)t.addEventListener(c,a);e().then(c=>{c(t);for(let l=s?.shift();l;l=s?.shift()){let m=new MessageEvent(l.type,{data:l.data,ports:[...l.ports],origin:l.origin,lastEventId:l.lastEventId});d.add(m),t.dispatchEvent(m)}s=null;for(let l of Na)t.removeEventListener(l,a)}).catch(c=>{s=null,t.postMessage(n(c instanceof Error?c.message:String(c))),setTimeout(()=>{throw c})})}Da(self,()=>Promise.resolve().then(()=>($u(),Hu)).then(t=>t.startSessionWorker),t=>({protocol:1,kind:"failure",code:"crash",message:t}),"betteroffice.pptx.worker");
|