@motionscript/browser 0.1.0-alpha.9 → 0.1.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/asset-bytes.d.ts +12 -50
  3. package/dist/asset-bytes.d.ts.map +1 -1
  4. package/dist/asset-bytes.js +20 -52
  5. package/dist/asset-bytes.js.map +1 -1
  6. package/dist/audio/bus-graph.d.ts +4 -39
  7. package/dist/audio/bus-graph.d.ts.map +1 -1
  8. package/dist/audio/bus-graph.js +4 -38
  9. package/dist/audio/bus-graph.js.map +1 -1
  10. package/dist/audio/effect-graph.d.ts +4 -29
  11. package/dist/audio/effect-graph.d.ts.map +1 -1
  12. package/dist/audio/effect-graph.js +4 -31
  13. package/dist/audio/effect-graph.js.map +1 -1
  14. package/dist/audio/loop-region.d.ts +3 -21
  15. package/dist/audio/loop-region.d.ts.map +1 -1
  16. package/dist/audio/loop-region.js +3 -21
  17. package/dist/audio/loop-region.js.map +1 -1
  18. package/dist/audio/mixer.d.ts +9 -41
  19. package/dist/audio/mixer.d.ts.map +1 -1
  20. package/dist/audio/mixer.js +11 -44
  21. package/dist/audio/mixer.js.map +1 -1
  22. package/dist/audio/player.d.ts +3 -17
  23. package/dist/audio/player.d.ts.map +1 -1
  24. package/dist/audio/player.js +4 -23
  25. package/dist/audio/player.js.map +1 -1
  26. package/dist/browser/audio.js +1 -1
  27. package/dist/browser/chunks/chunk-NDJYMKIV.js +2 -0
  28. package/dist/browser/chunks/chunk-NDJYMKIV.js.map +7 -0
  29. package/dist/browser/index.js +20 -20
  30. package/dist/browser/index.js.map +4 -4
  31. package/dist/browser/manifest.json +1 -1
  32. package/dist/browser/ms_renderer_bg.wasm +0 -0
  33. package/dist/concat.d.ts +25 -84
  34. package/dist/concat.d.ts.map +1 -1
  35. package/dist/concat.js +19 -69
  36. package/dist/concat.js.map +1 -1
  37. package/dist/dynamic-nodes.d.ts +1 -6
  38. package/dist/dynamic-nodes.d.ts.map +1 -1
  39. package/dist/dynamic-nodes.js +3 -24
  40. package/dist/dynamic-nodes.js.map +1 -1
  41. package/dist/engine.d.ts +9 -42
  42. package/dist/engine.d.ts.map +1 -1
  43. package/dist/engine.js +10 -44
  44. package/dist/engine.js.map +1 -1
  45. package/dist/export-audio.d.ts +1 -6
  46. package/dist/export-audio.d.ts.map +1 -1
  47. package/dist/export-audio.js +1 -6
  48. package/dist/export-audio.js.map +1 -1
  49. package/dist/exporter.d.ts +28 -141
  50. package/dist/exporter.d.ts.map +1 -1
  51. package/dist/exporter.js +15 -90
  52. package/dist/exporter.js.map +1 -1
  53. package/dist/frame-loop.d.ts +19 -105
  54. package/dist/frame-loop.d.ts.map +1 -1
  55. package/dist/frame-loop.js +20 -82
  56. package/dist/frame-loop.js.map +1 -1
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +7 -15
  60. package/dist/index.js.map +1 -1
  61. package/dist/mix-timeline-audio.d.ts +7 -24
  62. package/dist/mix-timeline-audio.d.ts.map +1 -1
  63. package/dist/mix-timeline-audio.js +7 -23
  64. package/dist/mix-timeline-audio.js.map +1 -1
  65. package/dist/native-export.d.ts +29 -0
  66. package/dist/native-export.d.ts.map +1 -0
  67. package/dist/native-export.js +99 -0
  68. package/dist/native-export.js.map +1 -0
  69. package/dist/parallel/export-parallel.d.ts +2 -16
  70. package/dist/parallel/export-parallel.d.ts.map +1 -1
  71. package/dist/parallel/export-parallel.js +1 -11
  72. package/dist/parallel/export-parallel.js.map +1 -1
  73. package/dist/parallel/governor.d.ts +2 -15
  74. package/dist/parallel/governor.d.ts.map +1 -1
  75. package/dist/parallel/governor.js +1 -5
  76. package/dist/parallel/governor.js.map +1 -1
  77. package/dist/parallel/lane.d.ts +1 -5
  78. package/dist/parallel/lane.d.ts.map +1 -1
  79. package/dist/parallel/lane.js.map +1 -1
  80. package/dist/parallel/plan.d.ts +3 -7
  81. package/dist/parallel/plan.d.ts.map +1 -1
  82. package/dist/parallel/plan.js +1 -6
  83. package/dist/parallel/plan.js.map +1 -1
  84. package/dist/parallel/run-lanes.d.ts +4 -18
  85. package/dist/parallel/run-lanes.d.ts.map +1 -1
  86. package/dist/parallel/run-lanes.js +1 -12
  87. package/dist/parallel/run-lanes.js.map +1 -1
  88. package/dist/screenshot.d.ts +1 -12
  89. package/dist/screenshot.d.ts.map +1 -1
  90. package/dist/screenshot.js +1 -12
  91. package/dist/screenshot.js.map +1 -1
  92. package/dist/still.d.ts +17 -74
  93. package/dist/still.d.ts.map +1 -1
  94. package/dist/still.js +13 -50
  95. package/dist/still.js.map +1 -1
  96. package/dist/ticker.d.ts +10 -39
  97. package/dist/ticker.d.ts.map +1 -1
  98. package/dist/ticker.js +13 -45
  99. package/dist/ticker.js.map +1 -1
  100. package/package.json +4 -4
  101. package/dist/browser/chunks/chunk-F3AZKPHU.js +0 -2
  102. package/dist/browser/chunks/chunk-F3AZKPHU.js.map +0 -7
@@ -1,17 +1,17 @@
1
- import{a as Xa,b as qn,e as Zn,f as vs,g as ro,h as Qn}from"./chunks/chunk-F3AZKPHU.js";import{A as ws,B as ys,C as Tt,c as os,d as ls,e as cs,f as Jn,g as us,h as Za,i as Qa,j as eo,k as to,l as no,m as fs,n as Yn,q as ds,r as hs,s as xn,t as Et,u as _s,v as ps,w as ms,x as gs,y as Xn,z as bs}from"./chunks/chunk-L5UFQACH.js";import{b as Ja,c as Ya}from"./chunks/chunk-KLXMRKTL.js";var xa=Ja((mp,es)=>{(e=>{"use strict";var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(h,m)=>{for(var b in m)t(h,b,{get:m[b],enumerable:!0})},a=(h,m,b,S)=>{if(m&&typeof m=="object"||typeof m=="function")for(let O of r(m))!s.call(h,O)&&O!==b&&t(h,O,{get:()=>m[O],enumerable:!(S=n(m,O))||S.enumerable});return h},o=h=>a(t({},"__esModule",{value:!0}),h),l=(h,m,b)=>new Promise((S,O)=>{var $=x=>{try{V(b.next(x))}catch(N){O(N)}},P=x=>{try{V(b.throw(x))}catch(N){O(N)}},V=x=>x.done?S(x.value):Promise.resolve(x.value).then($,P);V((b=b.apply(h,m)).next())}),c={};i(c,{analyzeMetafile:()=>Ba,analyzeMetafileSync:()=>Wa,build:()=>$a,buildSync:()=>Ua,context:()=>Da,default:()=>Ha,formatMessages:()=>Fa,formatMessagesSync:()=>Na,initialize:()=>Ga,stop:()=>Va,transform:()=>La,transformSync:()=>ja,version:()=>Oa}),e.exports=o(c);function u(h){let m=S=>{if(S===null)b.write8(0);else if(typeof S=="boolean")b.write8(1),b.write8(+S);else if(typeof S=="number")b.write8(2),b.write32(S|0);else if(typeof S=="string")b.write8(3),b.write(_(S));else if(S instanceof Uint8Array)b.write8(4),b.write(S);else if(S instanceof Array){b.write8(5),b.write32(S.length);for(let O of S)m(O)}else{let O=Object.keys(S);b.write8(6),b.write32(O.length);for(let $ of O)b.write(_($)),m(S[$])}},b=new d;return b.write32(0),b.write32(h.id<<1|+!h.isRequest),m(h.value),L(b.buf,b.len-4,0),b.buf.subarray(0,b.len)}function f(h){let m=()=>{switch(b.read8()){case 0:return null;case 1:return!!b.read8();case 2:return b.read32();case 3:return p(b.read());case 4:return b.read();case 5:{let P=b.read32(),V=[];for(let x=0;x<P;x++)V.push(m());return V}case 6:{let P=b.read32(),V={};for(let x=0;x<P;x++)V[p(b.read())]=m();return V}default:throw new Error("Invalid packet")}},b=new d(h),S=b.read32(),O=(S&1)===0;S>>>=1;let $=m();if(b.ptr!==h.length)throw new Error("Invalid packet");return{id:S,isRequest:O,value:$}}var d=class{constructor(h=new Uint8Array(1024)){this.buf=h,this.len=0,this.ptr=0}_write(h){if(this.len+h>this.buf.length){let m=new Uint8Array((this.len+h)*2);m.set(this.buf),this.buf=m}return this.len+=h,this.len-h}write8(h){let m=this._write(1);this.buf[m]=h}write32(h){let m=this._write(4);L(this.buf,h,m)}write(h){let m=this._write(4+h.length);L(this.buf,h.length,m),this.buf.set(h,m+4)}_read(h){if(this.ptr+h>this.buf.length)throw new Error("Invalid packet");return this.ptr+=h,this.ptr-h}read8(){return this.buf[this._read(1)]}read32(){return R(this.buf,this._read(4))}read(){let h=this.read32(),m=new Uint8Array(h),b=this._read(m.length);return m.set(this.buf.subarray(b,b+h)),m}},_,p,w;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let h=new TextEncoder,m=new TextDecoder;_=b=>h.encode(b),p=b=>m.decode(b),w='new TextEncoder().encode("")'}else if(typeof Buffer<"u")_=h=>Buffer.from(h),p=h=>{let{buffer:m,byteOffset:b,byteLength:S}=h;return Buffer.from(m,b,S).toString()},w='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(_("")instanceof Uint8Array))throw new Error(`Invariant violation: "${w} instanceof Uint8Array" is incorrectly false
1
+ import{a as Mo,b as ir,e as lr,f as On,g as Io,h as ur}from"./chunks/chunk-NDJYMKIV.js";import{A as Ds,B as Ls,C as Ct,c as xs,d as ks,e as Ms,f as ar,g as Ss,h as So,i as Eo,j as Ao,k as To,l as Po,m as Es,n as or,q as As,r as Ts,s as Cn,t as Rt,u as Ps,v as Is,w as Rs,x as Cs,y as cr,z as Os}from"./chunks/chunk-L5UFQACH.js";import{b as xo,c as ko}from"./chunks/chunk-KLXMRKTL.js";var qa=xo((um,_s)=>{(e=>{"use strict";var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(h,m)=>{for(var b in m)t(h,b,{get:m[b],enumerable:!0})},a=(h,m,b,S)=>{if(m&&typeof m=="object"||typeof m=="function")for(let O of r(m))!s.call(h,O)&&O!==b&&t(h,O,{get:()=>m[O],enumerable:!(S=n(m,O))||S.enumerable});return h},o=h=>a(t({},"__esModule",{value:!0}),h),l=(h,m,b)=>new Promise((S,O)=>{var D=x=>{try{z(b.next(x))}catch(j){O(j)}},I=x=>{try{z(b.throw(x))}catch(j){O(j)}},z=x=>x.done?S(x.value):Promise.resolve(x.value).then(D,I);z((b=b.apply(h,m)).next())}),c={};i(c,{analyzeMetafile:()=>uo,analyzeMetafileSync:()=>_o,build:()=>ao,buildSync:()=>fo,context:()=>oo,default:()=>wo,formatMessages:()=>lo,formatMessagesSync:()=>po,initialize:()=>go,stop:()=>mo,transform:()=>co,transformSync:()=>ho,version:()=>io}),e.exports=o(c);function u(h){let m=S=>{if(S===null)b.write8(0);else if(typeof S=="boolean")b.write8(1),b.write8(+S);else if(typeof S=="number")b.write8(2),b.write32(S|0);else if(typeof S=="string")b.write8(3),b.write(p(S));else if(S instanceof Uint8Array)b.write8(4),b.write(S);else if(S instanceof Array){b.write8(5),b.write32(S.length);for(let O of S)m(O)}else{let O=Object.keys(S);b.write8(6),b.write32(O.length);for(let D of O)b.write(p(D)),m(S[D])}},b=new d;return b.write32(0),b.write32(h.id<<1|+!h.isRequest),m(h.value),B(b.buf,b.len-4,0),b.buf.subarray(0,b.len)}function f(h){let m=()=>{switch(b.read8()){case 0:return null;case 1:return!!b.read8();case 2:return b.read32();case 3:return _(b.read());case 4:return b.read();case 5:{let I=b.read32(),z=[];for(let x=0;x<I;x++)z.push(m());return z}case 6:{let I=b.read32(),z={};for(let x=0;x<I;x++)z[_(b.read())]=m();return z}default:throw new Error("Invalid packet")}},b=new d(h),S=b.read32(),O=(S&1)===0;S>>>=1;let D=m();if(b.ptr!==h.length)throw new Error("Invalid packet");return{id:S,isRequest:O,value:D}}var d=class{constructor(h=new Uint8Array(1024)){this.buf=h,this.len=0,this.ptr=0}_write(h){if(this.len+h>this.buf.length){let m=new Uint8Array((this.len+h)*2);m.set(this.buf),this.buf=m}return this.len+=h,this.len-h}write8(h){let m=this._write(1);this.buf[m]=h}write32(h){let m=this._write(4);B(this.buf,h,m)}write(h){let m=this._write(4+h.length);B(this.buf,h.length,m),this.buf.set(h,m+4)}_read(h){if(this.ptr+h>this.buf.length)throw new Error("Invalid packet");return this.ptr+=h,this.ptr-h}read8(){return this.buf[this._read(1)]}read32(){return A(this.buf,this._read(4))}read(){let h=this.read32(),m=new Uint8Array(h),b=this._read(m.length);return m.set(this.buf.subarray(b,b+h)),m}},p,_,w;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let h=new TextEncoder,m=new TextDecoder;p=b=>h.encode(b),_=b=>m.decode(b),w='new TextEncoder().encode("")'}else if(typeof Buffer<"u")p=h=>Buffer.from(h),_=h=>{let{buffer:m,byteOffset:b,byteLength:S}=h;return Buffer.from(m,b,S).toString()},w='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(p("")instanceof Uint8Array))throw new Error(`Invariant violation: "${w} instanceof Uint8Array" is incorrectly false
2
2
 
3
3
  This indicates that your JavaScript environment is broken. You cannot use
4
4
  esbuild in this environment because esbuild relies on this invariant. This
5
5
  is not a problem with esbuild. You need to fix your environment instead.
6
- `);function R(h,m){return(h[m++]|h[m++]<<8|h[m++]<<16|h[m++]<<24)>>>0}function L(h,m,b){h[b++]=m,h[b++]=m>>8,h[b++]=m>>16,h[b++]=m>>24}var F=String.fromCharCode;function H(h,m,b){let S=h[m],O=1,$=0;for(let P=0;P<m;P++)h[P]===10?(O++,$=0):$++;throw new SyntaxError(b||(m===h.length?"Unexpected end of input while parsing JSON":S>=32&&S<=126?`Unexpected character ${F(S)} in JSON at position ${m} (line ${O}, column ${$})`:`Unexpected byte 0x${S.toString(16)} in JSON at position ${m} (line ${O}, column ${$})`))}function se(h){if(!(h instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let m=[],b=[],S=[],O=h.length,$=null,P=0,V,x=0;for(;x<O;){let N=h[x++];if(N<=32)continue;let G;switch(P===2&&$===null&&N!==34&&N!==125&&H(h,--x),N){case 116:{(h[x++]!==114||h[x++]!==117||h[x++]!==101)&&H(h,--x),G=!0;break}case 102:{(h[x++]!==97||h[x++]!==108||h[x++]!==115||h[x++]!==101)&&H(h,--x),G=!1;break}case 110:{(h[x++]!==117||h[x++]!==108||h[x++]!==108)&&H(h,--x),G=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let Z=x;for(G=F(N),N=h[x];;){switch(N){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{G+=F(N),N=h[++x];continue}}break}G=+G,isNaN(G)&&H(h,--Z,"Invalid number");break}case 34:{for(G="";x>=O&&H(h,O),N=h[x++],N!==34;)if(N===92)switch(h[x++]){case 34:G+='"';break;case 47:G+="/";break;case 92:G+="\\";break;case 98:G+="\b";break;case 102:G+="\f";break;case 110:G+=`
7
- `;break;case 114:G+="\r";break;case 116:G+=" ";break;case 117:{let Z=0;for(let he=0;he<4;he++)N=h[x++],Z<<=4,N>=48&&N<=57?Z|=N-48:N>=97&&N<=102?Z|=N+-87:N>=65&&N<=70?Z|=N+-55:H(h,--x);G+=F(Z);break}default:H(h,--x);break}else if(N<=127)G+=F(N);else if((N&224)===192)G+=F((N&31)<<6|h[x++]&63);else if((N&240)===224)G+=F((N&15)<<12|(h[x++]&63)<<6|h[x++]&63);else if((N&248)==240){let Z=(N&7)<<18|(h[x++]&63)<<12|(h[x++]&63)<<6|h[x++]&63;Z>65535&&(Z-=65536,G+=F(Z>>10&1023|55296),Z=56320|Z&1023),G+=F(Z)}G[0];break}case 91:{G=[],m.push($),b.push(V),S.push(P),$=null,V=G,P=1;continue}case 123:{G={},m.push($),b.push(V),S.push(P),$=null,V=G,P=2;continue}case 93:{P!==1&&H(h,--x),G=V,$=m.pop(),V=b.pop(),P=S.pop();break}case 125:{P!==2&&H(h,--x),G=V,$=m.pop(),V=b.pop(),P=S.pop();break}default:H(h,--x)}for(N=h[x];N<=32;)N=h[++x];switch(P){case 0:{if(x===O)return G;break}case 1:{if(V.push(G),N===44){x++;continue}if(N===93)continue;break}case 2:{if($===null){if($=G,N===58){x++;continue}}else{if(V[$]=G,$=null,N===44){x++;continue}if(N===125)continue}break}}break}H(h,x)}var X=JSON.stringify,ye="warning",ve="silent";function q(h,m){let b=[];for(let S of h){if(Le(S,m),S.indexOf(",")>=0)throw new Error(`Invalid ${m}: ${S}`);b.push(S)}return b.join(",")}var oe=()=>null,K=h=>typeof h=="boolean"?null:"a boolean",B=h=>typeof h=="string"?null:"a string",xe=h=>h instanceof RegExp?null:"a RegExp object",we=h=>typeof h=="number"&&h===(h|0)?null:"an integer",Te=h=>typeof h=="number"&&h===(h|0)&&h>=0&&h<=65535?null:"a valid port number",Ue=h=>typeof h=="function"?null:"a function",ae=h=>Array.isArray(h)?null:"an array",Ae=h=>Array.isArray(h)&&h.every(m=>typeof m=="string")?null:"an array of strings",$e=h=>typeof h=="object"&&h!==null&&!Array.isArray(h)?null:"an object",Mt=h=>typeof h=="object"&&h!==null?null:"an array or an object",zn=h=>h instanceof WebAssembly.Module?null:"a WebAssembly.Module",Nt=h=>typeof h=="object"&&!Array.isArray(h)?null:"an object or null",Wt=h=>typeof h=="string"||typeof h=="boolean"?null:"a string or a boolean",Hn=h=>typeof h=="string"||typeof h=="object"&&h!==null&&!Array.isArray(h)?null:"a string or an object",_n=h=>typeof h=="string"||Array.isArray(h)&&h.every(m=>typeof m=="string")?null:"a string or an array of strings",pn=h=>typeof h=="string"||h instanceof Uint8Array?null:"a string or a Uint8Array",Kn=h=>typeof h=="string"||h instanceof URL?null:"a string or a URL";function v(h,m,b,S){let O=h[b];if(m[b+""]=!0,O===void 0)return;let $=S(O);if($!==null)throw new Error(`${X(b)} must be ${$}`);return O}function Pe(h,m,b){for(let S in h)if(!(S in m))throw new Error(`Invalid option ${b}: ${X(S)}`)}function Ma(h){let m=Object.create(null),b=v(h,m,"wasmURL",Kn),S=v(h,m,"wasmModule",zn),O=v(h,m,"worker",K);return Pe(h,m,"in initialize() call"),{wasmURL:b,wasmModule:S,worker:O}}function ns(h){let m;if(h!==void 0){m=Object.create(null);for(let b in h){let S=h[b];if(typeof S=="string"||S===!1)m[b]=S;else throw new Error(`Expected ${X(b)} in mangle cache to map to either a string or false`)}}return m}function mn(h,m,b,S,O){let $=v(m,b,"color",K),P=v(m,b,"logLevel",B),V=v(m,b,"logLimit",we),x=v(m,b,"logStyle",B);$!==void 0?h.push(`--color=${$}`):S&&h.push("--color=true"),h.push(`--log-level=${P||O}`),h.push(`--log-limit=${V||0}`),x&&h.push(`--log-style=${x}`)}function Le(h,m,b){if(typeof h!="string")throw new Error(`Expected value for ${m}${b!==void 0?" "+X(b):""} to be a string, got ${typeof h} instead`);return h}function rs(h,m,b){let S=v(m,b,"legalComments",B),O=v(m,b,"sourceRoot",B),$=v(m,b,"sourcesContent",K),P=v(m,b,"target",_n),V=v(m,b,"format",B),x=v(m,b,"globalName",B),N=v(m,b,"mangleProps",xe),G=v(m,b,"reserveProps",xe),Z=v(m,b,"mangleQuoted",K),he=v(m,b,"minify",K),ue=v(m,b,"minifySyntax",K),pe=v(m,b,"minifyWhitespace",K),me=v(m,b,"minifyIdentifiers",K),ne=v(m,b,"lineLimit",we),Ee=v(m,b,"drop",Ae),te=v(m,b,"dropLabels",Ae),ee=v(m,b,"charset",B),U=v(m,b,"treeShaking",K),C=v(m,b,"ignoreAnnotations",K),k=v(m,b,"jsx",B),T=v(m,b,"jsxFactory",B),I=v(m,b,"jsxFragment",B),j=v(m,b,"jsxImportSource",B),J=v(m,b,"jsxDev",K),E=v(m,b,"jsxSideEffects",K),D=v(m,b,"define",$e),z=v(m,b,"logOverride",$e),ie=v(m,b,"supported",$e),g=v(m,b,"pure",Ae),M=v(m,b,"keepNames",K),W=v(m,b,"platform",B),Q=v(m,b,"tsconfigRaw",Hn),fe=v(m,b,"absPaths",Ae);if(S&&h.push(`--legal-comments=${S}`),O!==void 0&&h.push(`--source-root=${O}`),$!==void 0&&h.push(`--sources-content=${$}`),P&&h.push(`--target=${q(Array.isArray(P)?P:[P],"target")}`),V&&h.push(`--format=${V}`),x&&h.push(`--global-name=${x}`),W&&h.push(`--platform=${W}`),Q&&h.push(`--tsconfig-raw=${typeof Q=="string"?Q:JSON.stringify(Q)}`),he&&h.push("--minify"),ue&&h.push("--minify-syntax"),pe&&h.push("--minify-whitespace"),me&&h.push("--minify-identifiers"),ne&&h.push(`--line-limit=${ne}`),ee&&h.push(`--charset=${ee}`),U!==void 0&&h.push(`--tree-shaking=${U}`),C&&h.push("--ignore-annotations"),Ee)for(let Y of Ee)h.push(`--drop:${Le(Y,"drop")}`);if(te&&h.push(`--drop-labels=${q(te,"drop label")}`),fe&&h.push(`--abs-paths=${q(fe,"abs paths")}`),N&&h.push(`--mangle-props=${wn(N)}`),G&&h.push(`--reserve-props=${wn(G)}`),Z!==void 0&&h.push(`--mangle-quoted=${Z}`),k&&h.push(`--jsx=${k}`),T&&h.push(`--jsx-factory=${T}`),I&&h.push(`--jsx-fragment=${I}`),j&&h.push(`--jsx-import-source=${j}`),J&&h.push("--jsx-dev"),E&&h.push("--jsx-side-effects"),D)for(let Y in D){if(Y.indexOf("=")>=0)throw new Error(`Invalid define: ${Y}`);h.push(`--define:${Y}=${Le(D[Y],"define",Y)}`)}if(z)for(let Y in z){if(Y.indexOf("=")>=0)throw new Error(`Invalid log override: ${Y}`);h.push(`--log-override:${Y}=${Le(z[Y],"log override",Y)}`)}if(ie)for(let Y in ie){if(Y.indexOf("=")>=0)throw new Error(`Invalid supported: ${Y}`);let ge=ie[Y];if(typeof ge!="boolean")throw new Error(`Expected value for supported ${X(Y)} to be a boolean, got ${typeof ge} instead`);h.push(`--supported:${Y}=${ge}`)}if(g)for(let Y of g)h.push(`--pure:${Le(Y,"pure")}`);M&&h.push("--keep-names")}function Sa(h,m,b,S,O){var $;let P=[],V=[],x=Object.create(null),N=null,G=null;mn(P,m,x,b,S),rs(P,m,x);let Z=v(m,x,"sourcemap",Wt),he=v(m,x,"bundle",K),ue=v(m,x,"splitting",K),pe=v(m,x,"preserveSymlinks",K),me=v(m,x,"metafile",K),ne=v(m,x,"outfile",B),Ee=v(m,x,"outdir",B),te=v(m,x,"outbase",B),ee=v(m,x,"tsconfig",B),U=v(m,x,"resolveExtensions",Ae),C=v(m,x,"nodePaths",Ae),k=v(m,x,"mainFields",Ae),T=v(m,x,"conditions",Ae),I=v(m,x,"external",Ae),j=v(m,x,"packages",B),J=v(m,x,"alias",$e),E=v(m,x,"loader",$e),D=v(m,x,"outExtension",$e),z=v(m,x,"publicPath",B),ie=v(m,x,"entryNames",B),g=v(m,x,"chunkNames",B),M=v(m,x,"assetNames",B),W=v(m,x,"inject",Ae),Q=v(m,x,"banner",$e),fe=v(m,x,"footer",$e),Y=v(m,x,"entryPoints",Mt),ge=v(m,x,"absWorkingDir",B),_e=v(m,x,"stdin",$e),de=($=v(m,x,"write",K))!=null?$:O,Fe=v(m,x,"allowOverwrite",K),Ie=v(m,x,"mangleCache",$e);if(x.plugins=!0,Pe(m,x,`in ${h}() call`),Z&&P.push(`--sourcemap${Z===!0?"":`=${Z}`}`),he&&P.push("--bundle"),Fe&&P.push("--allow-overwrite"),ue&&P.push("--splitting"),pe&&P.push("--preserve-symlinks"),me&&P.push("--metafile"),ne&&P.push(`--outfile=${ne}`),Ee&&P.push(`--outdir=${Ee}`),te&&P.push(`--outbase=${te}`),ee&&P.push(`--tsconfig=${ee}`),j&&P.push(`--packages=${j}`),U&&P.push(`--resolve-extensions=${q(U,"resolve extension")}`),z&&P.push(`--public-path=${z}`),ie&&P.push(`--entry-names=${ie}`),g&&P.push(`--chunk-names=${g}`),M&&P.push(`--asset-names=${M}`),k&&P.push(`--main-fields=${q(k,"main field")}`),T&&P.push(`--conditions=${q(T,"condition")}`),I)for(let re of I)P.push(`--external:${Le(re,"external")}`);if(J)for(let re in J){if(re.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${re}`);P.push(`--alias:${re}=${Le(J[re],"alias",re)}`)}if(Q)for(let re in Q){if(re.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${re}`);P.push(`--banner:${re}=${Le(Q[re],"banner",re)}`)}if(fe)for(let re in fe){if(re.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${re}`);P.push(`--footer:${re}=${Le(fe[re],"footer",re)}`)}if(W)for(let re of W)P.push(`--inject:${Le(re,"inject")}`);if(E)for(let re in E){if(re.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${re}`);P.push(`--loader:${re}=${Le(E[re],"loader",re)}`)}if(D)for(let re in D){if(re.indexOf("=")>=0)throw new Error(`Invalid out extension: ${re}`);P.push(`--out-extension:${re}=${Le(D[re],"out extension",re)}`)}if(Y)if(Array.isArray(Y))for(let re=0,Je=Y.length;re<Je;re++){let je=Y[re];if(typeof je=="object"&&je!==null){let Ge=Object.create(null),Ye=v(je,Ge,"in",B),Ne=v(je,Ge,"out",B);if(Pe(je,Ge,"in entry point at index "+re),Ye===void 0)throw new Error('Missing property "in" for entry point at index '+re);if(Ne===void 0)throw new Error('Missing property "out" for entry point at index '+re);V.push([Ne,Ye])}else V.push(["",Le(je,"entry point at index "+re)])}else for(let re in Y)V.push([re,Le(Y[re],"entry point",re)]);if(_e){let re=Object.create(null),Je=v(_e,re,"contents",pn),je=v(_e,re,"resolveDir",B),Ge=v(_e,re,"sourcefile",B),Ye=v(_e,re,"loader",B);Pe(_e,re,'in "stdin" object'),Ge&&P.push(`--sourcefile=${Ge}`),Ye&&P.push(`--loader=${Ye}`),je&&(G=je),typeof Je=="string"?N=_(Je):Je instanceof Uint8Array&&(N=Je)}let qe=[];if(C)for(let re of C)re+="",qe.push(re);return{entries:V,flags:P,write:de,stdinContents:N,stdinResolveDir:G,absWorkingDir:ge,nodePaths:qe,mangleCache:ns(Ie)}}function Aa(h,m,b,S){let O=[],$=Object.create(null);mn(O,m,$,b,S),rs(O,m,$);let P=v(m,$,"sourcemap",Wt),V=v(m,$,"sourcefile",B),x=v(m,$,"loader",B),N=v(m,$,"banner",B),G=v(m,$,"footer",B),Z=v(m,$,"mangleCache",$e);return Pe(m,$,`in ${h}() call`),P&&O.push(`--sourcemap=${P===!0?"external":P}`),V&&O.push(`--sourcefile=${V}`),x&&O.push(`--loader=${x}`),N&&O.push(`--banner=${N}`),G&&O.push(`--footer=${G}`),{flags:O,mangleCache:ns(Z)}}function Ea(h){let m={},b={didClose:!1,reason:""},S={},O=0,$=0,P=new Uint8Array(16*1024),V=0,x=ee=>{let U=V+ee.length;if(U>P.length){let k=new Uint8Array(U*2);k.set(P),P=k}P.set(ee,V),V+=ee.length;let C=0;for(;C+4<=V;){let k=R(P,C);if(C+4+k>V)break;C+=4,pe(P.subarray(C,C+k)),C+=k}C>0&&(P.copyWithin(0,C,V),V-=C)},N=ee=>{b.didClose=!0,ee&&(b.reason=": "+(ee.message||ee));let U="The service was stopped"+b.reason;for(let C in S)S[C](U,null);S={}},G=(ee,U,C)=>{if(b.didClose)return C("The service is no longer running"+b.reason,null);let k=O++;S[k]=(T,I)=>{try{C(T,I)}finally{ee&&ee.unref()}},ee&&ee.ref(),h.writeToStdin(u({id:k,isRequest:!0,value:U}))},Z=(ee,U)=>{if(b.didClose)throw new Error("The service is no longer running"+b.reason);h.writeToStdin(u({id:ee,isRequest:!1,value:U}))},he=(ee,U)=>l(null,null,function*(){try{if(U.command==="ping"){Z(ee,{});return}if(typeof U.key=="number"){let C=m[U.key];if(!C)return;let k=C[U.command];if(k){yield k(ee,U);return}}throw new Error("Invalid command: "+U.command)}catch(C){let k=[lt(C,h,null,void 0,"")];try{Z(ee,{errors:k})}catch{}}}),ue=!0,pe=ee=>{if(ue){ue=!1;let C=String.fromCharCode(...ee);if(C!=="0.28.2")throw new Error(`Cannot start service: Host version "0.28.2" does not match binary version ${X(C)}`);return}let U=f(ee);if(U.isRequest)he(U.id,U.value);else{let C=S[U.id];delete S[U.id],U.value.error?C(U.value.error,{}):C(null,U.value)}};return{readFromStdout:x,afterClose:N,service:{buildOrContext:({callName:ee,refs:U,options:C,isTTY:k,defaultWD:T,callback:I})=>{let j=0,J=$++,E={},D={ref(){++j===1&&U&&U.ref()},unref(){--j===0&&(delete m[J],U&&U.unref())}};m[J]=E,D.ref(),Ta(ee,J,G,Z,D,h,E,C,k,T,(z,ie)=>{try{I(z,ie)}finally{D.unref()}})},transform:({callName:ee,refs:U,input:C,options:k,isTTY:T,fs:I,callback:j})=>{let J=ss(),E=D=>{try{if(typeof C!="string"&&!(C instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:z,mangleCache:ie}=Aa(ee,k,T,ve),g={command:"transform",flags:z,inputFS:D!==null,input:D!==null?_(D):typeof C=="string"?_(C):C};ie&&(g.mangleCache=ie),G(U,g,(M,W)=>{if(M)return j(new Error(M),null);let Q=St(W.errors,J),fe=St(W.warnings,J),Y=1,ge=()=>{if(--Y===0){let _e={warnings:fe,code:W.code,map:W.map,mangleCache:void 0,legalComments:void 0};"legalComments"in W&&(_e.legalComments=W?.legalComments),W.mangleCache&&(_e.mangleCache=W?.mangleCache),j(null,_e)}};if(Q.length>0)return j(Vt("Transform failed",Q,fe),null);W.codeFS&&(Y++,I.readFile(W.code,(_e,de)=>{_e!==null?j(_e,null):(W.code=de,ge())})),W.mapFS&&(Y++,I.readFile(W.map,(_e,de)=>{_e!==null?j(_e,null):(W.map=de,ge())})),ge()})}catch(z){let ie=[];try{mn(ie,k,{},T,ve)}catch{}let g=lt(z,h,J,void 0,"");G(U,{command:"error",flags:ie,error:g},()=>{g.detail=J.load(g.detail),j(Vt("Transform failed",[g],[]),null)})}};if((typeof C=="string"||C instanceof Uint8Array)&&C.length>1024*1024){let D=E;E=()=>I.writeFile(C,D)}E(null)},formatMessages:({callName:ee,refs:U,messages:C,options:k,callback:T})=>{if(!k)throw new Error(`Missing second argument in ${ee}() call`);let I={},j=v(k,I,"kind",B),J=v(k,I,"color",K),E=v(k,I,"terminalWidth",we),D=v(k,I,"logStyle",B);if(Pe(k,I,`in ${ee}() call`),j===void 0)throw new Error(`Missing "kind" in ${ee}() call`);if(j!=="error"&&j!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${ee}() call`);let z={command:"format-msgs",messages:Ke(C,"messages",null,"",E),isWarning:j==="warning"};J!==void 0&&(z.color=J),E!==void 0&&(z.terminalWidth=E),D!==void 0&&(z.logStyle=D),G(U,z,(ie,g)=>{if(ie)return T(new Error(ie),null);T(null,g.messages)})},analyzeMetafile:({callName:ee,refs:U,metafile:C,options:k,callback:T})=>{k===void 0&&(k={});let I={},j=v(k,I,"color",K),J=v(k,I,"verbose",K);Pe(k,I,`in ${ee}() call`);let E={command:"analyze-metafile",metafile:C};j!==void 0&&(E.color=j),J!==void 0&&(E.verbose=J),G(U,E,(D,z)=>{if(D)return T(new Error(D),null);T(null,z.result)})}}}}function Ta(h,m,b,S,O,$,P,V,x,N,G){let Z=ss(),he=h==="context",ue=(ne,Ee)=>{let te=[];try{mn(te,V,{},x,ye)}catch{}let ee=lt(ne,$,Z,void 0,Ee);b(O,{command:"error",flags:te,error:ee},()=>{ee.detail=Z.load(ee.detail),G(Vt(he?"Context failed":"Build failed",[ee],[]),null)})},pe;if(typeof V=="object"){let ne=V.plugins;if(ne!==void 0){if(!Array.isArray(ne))return ue(new Error('"plugins" must be an array'),"");pe=ne}}if(pe&&pe.length>0){if($.isSync)return ue(new Error("Cannot use plugins in synchronous API calls"),"");Pa(m,b,S,O,$,P,V,pe,Z).then(ne=>{if(!ne.ok)return ue(ne.error,ne.pluginName);try{me(ne.requestPlugins,ne.runOnEndCallbacks,ne.scheduleOnDisposeCallbacks)}catch(Ee){ue(Ee,"")}},ne=>ue(ne,""));return}try{me(null,(ne,Ee)=>Ee([],[]),()=>{})}catch(ne){ue(ne,"")}function me(ne,Ee,te){let ee=$.hasFS,{entries:U,flags:C,write:k,stdinContents:T,stdinResolveDir:I,absWorkingDir:j,nodePaths:J,mangleCache:E}=Sa(h,V,x,ye,ee);if(k&&!$.hasFS)throw new Error('The "write" option is unavailable in this environment');let D={command:"build",key:m,entries:U,flags:C,write:k,stdinContents:T,stdinResolveDir:I,absWorkingDir:j||N,nodePaths:J,context:he};ne&&(D.plugins=ne),E&&(D.mangleCache=E);let z=(M,W)=>{let Q={errors:St(M.errors,Z),warnings:St(M.warnings,Z),outputFiles:void 0,metafile:void 0,mangleCache:void 0},fe=Q.errors.slice(),Y=Q.warnings.slice();M.outputFiles&&(Q.outputFiles=M.outputFiles.map(Ra)),M.metafile&&M.metafile.length&&(Q.metafile=Ca(M.metafile)),M.mangleCache&&(Q.mangleCache=M.mangleCache),M.writeToStdout!==void 0&&console.log(p(M.writeToStdout).replace(/\n$/,"")),Ee(Q,(ge,_e)=>{if(fe.length>0||ge.length>0){let de=Vt("Build failed",fe.concat(ge),Y.concat(_e));return W(de,null,ge,_e)}W(null,Q,ge,_e)})},ie,g;he&&(P["on-end"]=(M,W)=>new Promise(Q=>{z(W,(fe,Y,ge,_e)=>{let de={errors:ge,warnings:_e};g&&g(fe,Y),ie=void 0,g=void 0,S(M,de),Q()})})),b(O,D,(M,W)=>{if(M)return G(new Error(M),null);if(!he)return z(W,(Y,ge)=>(te(),G(Y,ge)));if(W.errors.length>0)return G(Vt("Context failed",W.errors,W.warnings),null);let Q=!1,fe={rebuild:()=>(ie||(ie=new Promise((Y,ge)=>{let _e;g=(Fe,Ie)=>{_e||(_e=()=>Fe?ge(Fe):Y(Ie))};let de=()=>{b(O,{command:"rebuild",key:m},(Ie,qe)=>{Ie?ge(new Error(Ie)):_e?_e():de()})};de()})),ie),watch:(Y={})=>new Promise((ge,_e)=>{if(!$.hasFS)throw new Error('Cannot use the "watch" API in this environment');let de={},Fe=v(Y,de,"delay",we);Pe(Y,de,"in watch() call");let Ie={command:"watch",key:m};Fe&&(Ie.delay=Fe),b(O,Ie,qe=>{qe?_e(new Error(qe)):ge(void 0)})}),serve:(Y={})=>new Promise((ge,_e)=>{if(!$.hasFS)throw new Error('Cannot use the "serve" API in this environment');let de={},Fe=v(Y,de,"port",Te),Ie=v(Y,de,"host",B),qe=v(Y,de,"servedir",B),re=v(Y,de,"keyfile",B),Je=v(Y,de,"certfile",B),je=v(Y,de,"fallback",B),Ge=v(Y,de,"cors",$e),Ye=v(Y,de,"onRequest",Ue);Pe(Y,de,"in serve() call");let Ne={command:"serve",key:m,onRequest:!!Ye};if(Fe!==void 0&&(Ne.port=Fe),Ie!==void 0&&(Ne.host=Ie),qe!==void 0&&(Ne.servedir=qe),re!==void 0&&(Ne.keyfile=re),Je!==void 0&&(Ne.certfile=Je),je!==void 0&&(Ne.fallback=je),Ge){let zt={},At=v(Ge,zt,"origin",_n);Pe(Ge,zt,'on "cors" object'),Array.isArray(At)?Ne.corsOrigin=At:At!==void 0&&(Ne.corsOrigin=[At])}b(O,Ne,(zt,At)=>{if(zt)return _e(new Error(zt));Ye&&(P["serve-request"]=(Ka,qa)=>{Ye(qa.args),S(Ka,{})}),ge(At)})}),cancel:()=>new Promise(Y=>{if(Q)return Y();b(O,{command:"cancel",key:m},()=>{Y()})}),dispose:()=>new Promise(Y=>{if(Q)return Y();Q=!0,b(O,{command:"dispose",key:m},()=>{Y(),te(),O.unref()})})};O.ref(),G(null,fe)})}}var Pa=(h,m,b,S,O,$,P,V,x)=>l(null,null,function*(){let N=[],G=[],Z={},he={},ue=[],pe=0,me=0,ne=[],Ee=!1;V=[...V];for(let U of V){let C={};if(typeof U!="object")throw new Error(`Plugin at index ${me} must be an object`);let k=v(U,C,"name",B);if(typeof k!="string"||k==="")throw new Error(`Plugin at index ${me} is missing a name`);try{let T=v(U,C,"setup",Ue);if(typeof T!="function")throw new Error("Plugin is missing a setup function");Pe(U,C,`on plugin ${X(k)}`);let I={name:k,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};me++;let J=T({initialOptions:P,resolve:(E,D={})=>{if(!Ee)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof E!="string")throw new Error("The path to resolve must be a string");let z=Object.create(null),ie=v(D,z,"pluginName",B),g=v(D,z,"importer",B),M=v(D,z,"namespace",B),W=v(D,z,"resolveDir",B),Q=v(D,z,"kind",B),fe=v(D,z,"pluginData",oe),Y=v(D,z,"with",$e);return Pe(D,z,"in resolve() call"),new Promise((ge,_e)=>{let de={command:"resolve",path:E,key:h,pluginName:k};if(ie!=null&&(de.pluginName=ie),g!=null&&(de.importer=g),M!=null&&(de.namespace=M),W!=null&&(de.resolveDir=W),Q!=null)de.kind=Q;else throw new Error('Must specify "kind" when calling "resolve"');fe!=null&&(de.pluginData=x.store(fe)),Y!=null&&(de.with=Ia(Y,"with")),m(S,de,(Fe,Ie)=>{Fe!==null?_e(new Error(Fe)):ge({errors:St(Ie.errors,x),warnings:St(Ie.warnings,x),path:Ie.path,external:Ie.external,sideEffects:Ie.sideEffects,namespace:Ie.namespace,suffix:Ie.suffix,pluginData:x.load(Ie.pluginData)})})})},onStart(E){let D='This error came from the "onStart" callback registered here:',z=gn(new Error(D),O,"onStart");N.push({name:k,callback:E,note:z}),I.onStart=!0},onEnd(E){let D='This error came from the "onEnd" callback registered here:',z=gn(new Error(D),O,"onEnd");G.push({name:k,callback:E,note:z}),I.onEnd=!0},onResolve(E,D){let z='This error came from the "onResolve" callback registered here:',ie=gn(new Error(z),O,"onResolve"),g={},M=v(E,g,"filter",xe),W=v(E,g,"namespace",B);if(Pe(E,g,`in onResolve() call for plugin ${X(k)}`),M==null)throw new Error("onResolve() call is missing a filter");let Q=pe++;Z[Q]={name:k,callback:D,note:ie},I.onResolve.push({id:Q,filter:wn(M),namespace:W||""})},onLoad(E,D){let z='This error came from the "onLoad" callback registered here:',ie=gn(new Error(z),O,"onLoad"),g={},M=v(E,g,"filter",xe),W=v(E,g,"namespace",B);if(Pe(E,g,`in onLoad() call for plugin ${X(k)}`),M==null)throw new Error("onLoad() call is missing a filter");let Q=pe++;he[Q]={name:k,callback:D,note:ie},I.onLoad.push({id:Q,filter:wn(M),namespace:W||""})},onDispose(E){ue.push(E)},esbuild:O.esbuild});J&&(yield J),ne.push(I)}catch(T){return{ok:!1,error:T,pluginName:k}}}$["on-start"]=(U,C)=>l(null,null,function*(){x.clear();let k={errors:[],warnings:[]};yield Promise.all(N.map(T=>l(null,[T],function*({name:I,callback:j,note:J}){try{let E=yield j();if(E!=null){if(typeof E!="object")throw new Error(`Expected onStart() callback in plugin ${X(I)} to return an object`);let D={},z=v(E,D,"errors",ae),ie=v(E,D,"warnings",ae);Pe(E,D,`from onStart() callback in plugin ${X(I)}`),z!=null&&k.errors.push(...Ke(z,"errors",x,I,void 0)),ie!=null&&k.warnings.push(...Ke(ie,"warnings",x,I,void 0))}}catch(E){k.errors.push(lt(E,O,x,J&&J(),I))}}))),b(U,k)}),$["on-resolve"]=(U,C)=>l(null,null,function*(){let k={},T="",I,j;for(let J of C.ids)try{({name:T,callback:I,note:j}=Z[J]);let E=yield I({path:C.path,importer:C.importer,namespace:C.namespace,resolveDir:C.resolveDir,kind:C.kind,pluginData:x.load(C.pluginData),with:C.with});if(E!=null){if(typeof E!="object")throw new Error(`Expected onResolve() callback in plugin ${X(T)} to return an object`);let D={},z=v(E,D,"pluginName",B),ie=v(E,D,"path",B),g=v(E,D,"namespace",B),M=v(E,D,"suffix",B),W=v(E,D,"external",K),Q=v(E,D,"sideEffects",K),fe=v(E,D,"pluginData",oe),Y=v(E,D,"errors",ae),ge=v(E,D,"warnings",ae),_e=v(E,D,"watchFiles",Ae),de=v(E,D,"watchDirs",Ae);Pe(E,D,`from onResolve() callback in plugin ${X(T)}`),k.id=J,z!=null&&(k.pluginName=z),ie!=null&&(k.path=ie),g!=null&&(k.namespace=g),M!=null&&(k.suffix=M),W!=null&&(k.external=W),Q!=null&&(k.sideEffects=Q),fe!=null&&(k.pluginData=x.store(fe)),Y!=null&&(k.errors=Ke(Y,"errors",x,T,void 0)),ge!=null&&(k.warnings=Ke(ge,"warnings",x,T,void 0)),_e!=null&&(k.watchFiles=bn(_e,"watchFiles")),de!=null&&(k.watchDirs=bn(de,"watchDirs"));break}}catch(E){k={id:J,errors:[lt(E,O,x,j&&j(),T)]};break}b(U,k)}),$["on-load"]=(U,C)=>l(null,null,function*(){let k={},T="",I,j;for(let J of C.ids)try{({name:T,callback:I,note:j}=he[J]);let E=yield I({path:C.path,namespace:C.namespace,suffix:C.suffix,pluginData:x.load(C.pluginData),with:C.with});if(E!=null){if(typeof E!="object")throw new Error(`Expected onLoad() callback in plugin ${X(T)} to return an object`);let D={},z=v(E,D,"pluginName",B),ie=v(E,D,"contents",pn),g=v(E,D,"resolveDir",B),M=v(E,D,"pluginData",oe),W=v(E,D,"loader",B),Q=v(E,D,"errors",ae),fe=v(E,D,"warnings",ae),Y=v(E,D,"watchFiles",Ae),ge=v(E,D,"watchDirs",Ae);Pe(E,D,`from onLoad() callback in plugin ${X(T)}`),k.id=J,z!=null&&(k.pluginName=z),ie instanceof Uint8Array?k.contents=ie:ie!=null&&(k.contents=_(ie)),g!=null&&(k.resolveDir=g),M!=null&&(k.pluginData=x.store(M)),W!=null&&(k.loader=W),Q!=null&&(k.errors=Ke(Q,"errors",x,T,void 0)),fe!=null&&(k.warnings=Ke(fe,"warnings",x,T,void 0)),Y!=null&&(k.watchFiles=bn(Y,"watchFiles")),ge!=null&&(k.watchDirs=bn(ge,"watchDirs"));break}}catch(E){k={id:J,errors:[lt(E,O,x,j&&j(),T)]};break}b(U,k)});let te=(U,C)=>C([],[]);G.length>0&&(te=(U,C)=>{l(null,null,function*(){let k=[],T=[];for(let{name:I,callback:j,note:J}of G){let E,D;try{let z=yield j(U);if(z!=null){if(typeof z!="object")throw new Error(`Expected onEnd() callback in plugin ${X(I)} to return an object`);let ie={},g=v(z,ie,"errors",ae),M=v(z,ie,"warnings",ae);Pe(z,ie,`from onEnd() callback in plugin ${X(I)}`),g!=null&&(E=Ke(g,"errors",x,I,void 0)),M!=null&&(D=Ke(M,"warnings",x,I,void 0))}}catch(z){E=[lt(z,O,x,J&&J(),I)]}if(E){k.push(...E);try{U.errors.push(...E)}catch{}}if(D){T.push(...D);try{U.warnings.push(...D)}catch{}}}C(k,T)})});let ee=()=>{for(let U of ue)setTimeout(()=>U(),0)};return Ee=!0,{ok:!0,requestPlugins:ne,runOnEndCallbacks:te,scheduleOnDisposeCallbacks:ee}});function ss(){let h=new Map,m=0;return{clear(){h.clear()},load(b){return h.get(b)},store(b){if(b===void 0)return-1;let S=m++;return h.set(S,b),S}}}function gn(h,m,b){let S,O=!1;return()=>{if(O)return S;O=!0;try{let $=(h.stack+"").split(`
8
- `);$.splice(1,1);let P=is(m,$,b);if(P)return S={text:h.message,location:P},S}catch{}}}function lt(h,m,b,S,O){let $="Internal error",P=null;try{$=(h&&h.message||h)+""}catch{}try{P=is(m,(h.stack+"").split(`
9
- `),"")}catch{}return{id:"",pluginName:O,text:$,location:P,notes:S?[S]:[],detail:b?b.store(h):-1}}function is(h,m,b){let S=" at ";if(h.readFileSync&&!m[0].startsWith(S)&&m[1].startsWith(S))for(let O=1;O<m.length;O++){let $=m[O];if($.startsWith(S))for($=$.slice(S.length);;){let P=/^(?:new |async )?\S+ \((.*)\)$/.exec($);if(P){$=P[1];continue}if(P=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec($),P){$=P[1];continue}if(P=/^(\S+):(\d+):(\d+)$/.exec($),P){let V;try{V=h.readFileSync(P[1],"utf8")}catch{break}let x=V.split(/\r\n|\r|\n|\u2028|\u2029/)[+P[2]-1]||"",N=+P[3]-1,G=x.slice(N,N+b.length)===b?b.length:0;return{file:P[1],namespace:"file",line:+P[2],column:_(x.slice(0,N)).length,length:_(x.slice(N,N+G)).length,lineText:x+`
6
+ `);function A(h,m){return(h[m++]|h[m++]<<8|h[m++]<<16|h[m++]<<24)>>>0}function B(h,m,b){h[b++]=m,h[b++]=m>>8,h[b++]=m>>16,h[b++]=m>>24}var L=String.fromCharCode;function V(h,m,b){let S=h[m],O=1,D=0;for(let I=0;I<m;I++)h[I]===10?(O++,D=0):D++;throw new SyntaxError(b||(m===h.length?"Unexpected end of input while parsing JSON":S>=32&&S<=126?`Unexpected character ${L(S)} in JSON at position ${m} (line ${O}, column ${D})`:`Unexpected byte 0x${S.toString(16)} in JSON at position ${m} (line ${O}, column ${D})`))}function se(h){if(!(h instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let m=[],b=[],S=[],O=h.length,D=null,I=0,z,x=0;for(;x<O;){let j=h[x++];if(j<=32)continue;let H;switch(I===2&&D===null&&j!==34&&j!==125&&V(h,--x),j){case 116:{(h[x++]!==114||h[x++]!==117||h[x++]!==101)&&V(h,--x),H=!0;break}case 102:{(h[x++]!==97||h[x++]!==108||h[x++]!==115||h[x++]!==101)&&V(h,--x),H=!1;break}case 110:{(h[x++]!==117||h[x++]!==108||h[x++]!==108)&&V(h,--x),H=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let Z=x;for(H=L(j),j=h[x];;){switch(j){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{H+=L(j),j=h[++x];continue}}break}H=+H,isNaN(H)&&V(h,--Z,"Invalid number");break}case 34:{for(H="";x>=O&&V(h,O),j=h[x++],j!==34;)if(j===92)switch(h[x++]){case 34:H+='"';break;case 47:H+="/";break;case 92:H+="\\";break;case 98:H+="\b";break;case 102:H+="\f";break;case 110:H+=`
7
+ `;break;case 114:H+="\r";break;case 116:H+=" ";break;case 117:{let Z=0;for(let _e=0;_e<4;_e++)j=h[x++],Z<<=4,j>=48&&j<=57?Z|=j-48:j>=97&&j<=102?Z|=j+-87:j>=65&&j<=70?Z|=j+-55:V(h,--x);H+=L(Z);break}default:V(h,--x);break}else if(j<=127)H+=L(j);else if((j&224)===192)H+=L((j&31)<<6|h[x++]&63);else if((j&240)===224)H+=L((j&15)<<12|(h[x++]&63)<<6|h[x++]&63);else if((j&248)==240){let Z=(j&7)<<18|(h[x++]&63)<<12|(h[x++]&63)<<6|h[x++]&63;Z>65535&&(Z-=65536,H+=L(Z>>10&1023|55296),Z=56320|Z&1023),H+=L(Z)}H[0];break}case 91:{H=[],m.push(D),b.push(z),S.push(I),D=null,z=H,I=1;continue}case 123:{H={},m.push(D),b.push(z),S.push(I),D=null,z=H,I=2;continue}case 93:{I!==1&&V(h,--x),H=z,D=m.pop(),z=b.pop(),I=S.pop();break}case 125:{I!==2&&V(h,--x),H=z,D=m.pop(),z=b.pop(),I=S.pop();break}default:V(h,--x)}for(j=h[x];j<=32;)j=h[++x];switch(I){case 0:{if(x===O)return H;break}case 1:{if(z.push(H),j===44){x++;continue}if(j===93)continue;break}case 2:{if(D===null){if(D=H,j===58){x++;continue}}else{if(z[D]=H,D=null,j===44){x++;continue}if(j===125)continue}break}}break}V(h,x)}var X=JSON.stringify,pe="warning",ue="silent";function q(h,m){let b=[];for(let S of h){if($e(S,m),S.indexOf(",")>=0)throw new Error(`Invalid ${m}: ${S}`);b.push(S)}return b.join(",")}var ae=()=>null,G=h=>typeof h=="boolean"?null:"a boolean",$=h=>typeof h=="string"?null:"a string",xe=h=>h instanceof RegExp?null:"a RegExp object",ve=h=>typeof h=="number"&&h===(h|0)?null:"an integer",Me=h=>typeof h=="number"&&h===(h|0)&&h>=0&&h<=65535?null:"a valid port number",Fe=h=>typeof h=="function"?null:"a function",de=h=>Array.isArray(h)?null:"an array",Ae=h=>Array.isArray(h)&&h.every(m=>typeof m=="string")?null:"an array of strings",De=h=>typeof h=="object"&&h!==null&&!Array.isArray(h)?null:"an object",At=h=>typeof h=="object"&&h!==null?null:"an array or an object",Tt=h=>h instanceof WebAssembly.Module?null:"a WebAssembly.Module",xn=h=>typeof h=="object"&&!Array.isArray(h)?null:"an object or null",kn=h=>typeof h=="string"||typeof h=="boolean"?null:"a string or a boolean",Mn=h=>typeof h=="string"||typeof h=="object"&&h!==null&&!Array.isArray(h)?null:"a string or an object",qt=h=>typeof h=="string"||Array.isArray(h)&&h.every(m=>typeof m=="string")?null:"a string or an array of strings",Sn=h=>typeof h=="string"||h instanceof Uint8Array?null:"a string or a Uint8Array",sr=h=>typeof h=="string"||h instanceof URL?null:"a string or a URL";function v(h,m,b,S){let O=h[b];if(m[b+""]=!0,O===void 0)return;let D=S(O);if(D!==null)throw new Error(`${X(b)} must be ${D}`);return O}function Te(h,m,b){for(let S in h)if(!(S in m))throw new Error(`Invalid option ${b}: ${X(S)}`)}function Ya(h){let m=Object.create(null),b=v(h,m,"wasmURL",sr),S=v(h,m,"wasmModule",Tt),O=v(h,m,"worker",G);return Te(h,m,"in initialize() call"),{wasmURL:b,wasmModule:S,worker:O}}function gs(h){let m;if(h!==void 0){m=Object.create(null);for(let b in h){let S=h[b];if(typeof S=="string"||S===!1)m[b]=S;else throw new Error(`Expected ${X(b)} in mangle cache to map to either a string or false`)}}return m}function En(h,m,b,S,O){let D=v(m,b,"color",G),I=v(m,b,"logLevel",$),z=v(m,b,"logLimit",ve),x=v(m,b,"logStyle",$);D!==void 0?h.push(`--color=${D}`):S&&h.push("--color=true"),h.push(`--log-level=${I||O}`),h.push(`--log-limit=${z||0}`),x&&h.push(`--log-style=${x}`)}function $e(h,m,b){if(typeof h!="string")throw new Error(`Expected value for ${m}${b!==void 0?" "+X(b):""} to be a string, got ${typeof h} instead`);return h}function bs(h,m,b){let S=v(m,b,"legalComments",$),O=v(m,b,"sourceRoot",$),D=v(m,b,"sourcesContent",G),I=v(m,b,"target",qt),z=v(m,b,"format",$),x=v(m,b,"globalName",$),j=v(m,b,"mangleProps",xe),H=v(m,b,"reserveProps",xe),Z=v(m,b,"mangleQuoted",G),_e=v(m,b,"minify",G),le=v(m,b,"minifySyntax",G),ge=v(m,b,"minifyWhitespace",G),be=v(m,b,"minifyIdentifiers",G),ne=v(m,b,"lineLimit",ve),Pe=v(m,b,"drop",Ae),te=v(m,b,"dropLabels",Ae),ee=v(m,b,"charset",$),U=v(m,b,"treeShaking",G),C=v(m,b,"ignoreAnnotations",G),k=v(m,b,"jsx",$),P=v(m,b,"jsxFactory",$),R=v(m,b,"jsxFragment",$),N=v(m,b,"jsxImportSource",$),J=v(m,b,"jsxDev",G),T=v(m,b,"jsxSideEffects",G),F=v(m,b,"define",De),K=v(m,b,"logOverride",De),ie=v(m,b,"supported",De),g=v(m,b,"pure",Ae),M=v(m,b,"keepNames",G),W=v(m,b,"platform",$),Q=v(m,b,"tsconfigRaw",Mn),fe=v(m,b,"absPaths",Ae);if(S&&h.push(`--legal-comments=${S}`),O!==void 0&&h.push(`--source-root=${O}`),D!==void 0&&h.push(`--sources-content=${D}`),I&&h.push(`--target=${q(Array.isArray(I)?I:[I],"target")}`),z&&h.push(`--format=${z}`),x&&h.push(`--global-name=${x}`),W&&h.push(`--platform=${W}`),Q&&h.push(`--tsconfig-raw=${typeof Q=="string"?Q:JSON.stringify(Q)}`),_e&&h.push("--minify"),le&&h.push("--minify-syntax"),ge&&h.push("--minify-whitespace"),be&&h.push("--minify-identifiers"),ne&&h.push(`--line-limit=${ne}`),ee&&h.push(`--charset=${ee}`),U!==void 0&&h.push(`--tree-shaking=${U}`),C&&h.push("--ignore-annotations"),Pe)for(let Y of Pe)h.push(`--drop:${$e(Y,"drop")}`);if(te&&h.push(`--drop-labels=${q(te,"drop label")}`),fe&&h.push(`--abs-paths=${q(fe,"abs paths")}`),j&&h.push(`--mangle-props=${Pn(j)}`),H&&h.push(`--reserve-props=${Pn(H)}`),Z!==void 0&&h.push(`--mangle-quoted=${Z}`),k&&h.push(`--jsx=${k}`),P&&h.push(`--jsx-factory=${P}`),R&&h.push(`--jsx-fragment=${R}`),N&&h.push(`--jsx-import-source=${N}`),J&&h.push("--jsx-dev"),T&&h.push("--jsx-side-effects"),F)for(let Y in F){if(Y.indexOf("=")>=0)throw new Error(`Invalid define: ${Y}`);h.push(`--define:${Y}=${$e(F[Y],"define",Y)}`)}if(K)for(let Y in K){if(Y.indexOf("=")>=0)throw new Error(`Invalid log override: ${Y}`);h.push(`--log-override:${Y}=${$e(K[Y],"log override",Y)}`)}if(ie)for(let Y in ie){if(Y.indexOf("=")>=0)throw new Error(`Invalid supported: ${Y}`);let we=ie[Y];if(typeof we!="boolean")throw new Error(`Expected value for supported ${X(Y)} to be a boolean, got ${typeof we} instead`);h.push(`--supported:${Y}=${we}`)}if(g)for(let Y of g)h.push(`--pure:${$e(Y,"pure")}`);M&&h.push("--keep-names")}function Xa(h,m,b,S,O){var D;let I=[],z=[],x=Object.create(null),j=null,H=null;En(I,m,x,b,S),bs(I,m,x);let Z=v(m,x,"sourcemap",kn),_e=v(m,x,"bundle",G),le=v(m,x,"splitting",G),ge=v(m,x,"preserveSymlinks",G),be=v(m,x,"metafile",G),ne=v(m,x,"outfile",$),Pe=v(m,x,"outdir",$),te=v(m,x,"outbase",$),ee=v(m,x,"tsconfig",$),U=v(m,x,"resolveExtensions",Ae),C=v(m,x,"nodePaths",Ae),k=v(m,x,"mainFields",Ae),P=v(m,x,"conditions",Ae),R=v(m,x,"external",Ae),N=v(m,x,"packages",$),J=v(m,x,"alias",De),T=v(m,x,"loader",De),F=v(m,x,"outExtension",De),K=v(m,x,"publicPath",$),ie=v(m,x,"entryNames",$),g=v(m,x,"chunkNames",$),M=v(m,x,"assetNames",$),W=v(m,x,"inject",Ae),Q=v(m,x,"banner",De),fe=v(m,x,"footer",De),Y=v(m,x,"entryPoints",At),we=v(m,x,"absWorkingDir",$),me=v(m,x,"stdin",De),he=(D=v(m,x,"write",G))!=null?D:O,Ue=v(m,x,"allowOverwrite",G),Ie=v(m,x,"mangleCache",De);if(x.plugins=!0,Te(m,x,`in ${h}() call`),Z&&I.push(`--sourcemap${Z===!0?"":`=${Z}`}`),_e&&I.push("--bundle"),Ue&&I.push("--allow-overwrite"),le&&I.push("--splitting"),ge&&I.push("--preserve-symlinks"),be&&I.push("--metafile"),ne&&I.push(`--outfile=${ne}`),Pe&&I.push(`--outdir=${Pe}`),te&&I.push(`--outbase=${te}`),ee&&I.push(`--tsconfig=${ee}`),N&&I.push(`--packages=${N}`),U&&I.push(`--resolve-extensions=${q(U,"resolve extension")}`),K&&I.push(`--public-path=${K}`),ie&&I.push(`--entry-names=${ie}`),g&&I.push(`--chunk-names=${g}`),M&&I.push(`--asset-names=${M}`),k&&I.push(`--main-fields=${q(k,"main field")}`),P&&I.push(`--conditions=${q(P,"condition")}`),R)for(let re of R)I.push(`--external:${$e(re,"external")}`);if(J)for(let re in J){if(re.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${re}`);I.push(`--alias:${re}=${$e(J[re],"alias",re)}`)}if(Q)for(let re in Q){if(re.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${re}`);I.push(`--banner:${re}=${$e(Q[re],"banner",re)}`)}if(fe)for(let re in fe){if(re.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${re}`);I.push(`--footer:${re}=${$e(fe[re],"footer",re)}`)}if(W)for(let re of W)I.push(`--inject:${$e(re,"inject")}`);if(T)for(let re in T){if(re.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${re}`);I.push(`--loader:${re}=${$e(T[re],"loader",re)}`)}if(F)for(let re in F){if(re.indexOf("=")>=0)throw new Error(`Invalid out extension: ${re}`);I.push(`--out-extension:${re}=${$e(F[re],"out extension",re)}`)}if(Y)if(Array.isArray(Y))for(let re=0,Qe=Y.length;re<Qe;re++){let je=Y[re];if(typeof je=="object"&&je!==null){let Ge=Object.create(null),et=v(je,Ge,"in",$),We=v(je,Ge,"out",$);if(Te(je,Ge,"in entry point at index "+re),et===void 0)throw new Error('Missing property "in" for entry point at index '+re);if(We===void 0)throw new Error('Missing property "out" for entry point at index '+re);z.push([We,et])}else z.push(["",$e(je,"entry point at index "+re)])}else for(let re in Y)z.push([re,$e(Y[re],"entry point",re)]);if(me){let re=Object.create(null),Qe=v(me,re,"contents",Sn),je=v(me,re,"resolveDir",$),Ge=v(me,re,"sourcefile",$),et=v(me,re,"loader",$);Te(me,re,'in "stdin" object'),Ge&&I.push(`--sourcefile=${Ge}`),et&&I.push(`--loader=${et}`),je&&(H=je),typeof Qe=="string"?j=p(Qe):Qe instanceof Uint8Array&&(j=Qe)}let Ze=[];if(C)for(let re of C)re+="",Ze.push(re);return{entries:z,flags:I,write:he,stdinContents:j,stdinResolveDir:H,absWorkingDir:we,nodePaths:Ze,mangleCache:gs(Ie)}}function Za(h,m,b,S){let O=[],D=Object.create(null);En(O,m,D,b,S),bs(O,m,D);let I=v(m,D,"sourcemap",kn),z=v(m,D,"sourcefile",$),x=v(m,D,"loader",$),j=v(m,D,"banner",$),H=v(m,D,"footer",$),Z=v(m,D,"mangleCache",De);return Te(m,D,`in ${h}() call`),I&&O.push(`--sourcemap=${I===!0?"external":I}`),z&&O.push(`--sourcefile=${z}`),x&&O.push(`--loader=${x}`),j&&O.push(`--banner=${j}`),H&&O.push(`--footer=${H}`),{flags:O,mangleCache:gs(Z)}}function Qa(h){let m={},b={didClose:!1,reason:""},S={},O=0,D=0,I=new Uint8Array(16*1024),z=0,x=ee=>{let U=z+ee.length;if(U>I.length){let k=new Uint8Array(U*2);k.set(I),I=k}I.set(ee,z),z+=ee.length;let C=0;for(;C+4<=z;){let k=A(I,C);if(C+4+k>z)break;C+=4,ge(I.subarray(C,C+k)),C+=k}C>0&&(I.copyWithin(0,C,z),z-=C)},j=ee=>{b.didClose=!0,ee&&(b.reason=": "+(ee.message||ee));let U="The service was stopped"+b.reason;for(let C in S)S[C](U,null);S={}},H=(ee,U,C)=>{if(b.didClose)return C("The service is no longer running"+b.reason,null);let k=O++;S[k]=(P,R)=>{try{C(P,R)}finally{ee&&ee.unref()}},ee&&ee.ref(),h.writeToStdin(u({id:k,isRequest:!0,value:U}))},Z=(ee,U)=>{if(b.didClose)throw new Error("The service is no longer running"+b.reason);h.writeToStdin(u({id:ee,isRequest:!1,value:U}))},_e=(ee,U)=>l(null,null,function*(){try{if(U.command==="ping"){Z(ee,{});return}if(typeof U.key=="number"){let C=m[U.key];if(!C)return;let k=C[U.command];if(k){yield k(ee,U);return}}throw new Error("Invalid command: "+U.command)}catch(C){let k=[ft(C,h,null,void 0,"")];try{Z(ee,{errors:k})}catch{}}}),le=!0,ge=ee=>{if(le){le=!1;let C=String.fromCharCode(...ee);if(C!=="0.28.2")throw new Error(`Cannot start service: Host version "0.28.2" does not match binary version ${X(C)}`);return}let U=f(ee);if(U.isRequest)_e(U.id,U.value);else{let C=S[U.id];delete S[U.id],U.value.error?C(U.value.error,{}):C(null,U.value)}};return{readFromStdout:x,afterClose:j,service:{buildOrContext:({callName:ee,refs:U,options:C,isTTY:k,defaultWD:P,callback:R})=>{let N=0,J=D++,T={},F={ref(){++N===1&&U&&U.ref()},unref(){--N===0&&(delete m[J],U&&U.unref())}};m[J]=T,F.ref(),eo(ee,J,H,Z,F,h,T,C,k,P,(K,ie)=>{try{R(K,ie)}finally{F.unref()}})},transform:({callName:ee,refs:U,input:C,options:k,isTTY:P,fs:R,callback:N})=>{let J=ws(),T=F=>{try{if(typeof C!="string"&&!(C instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:K,mangleCache:ie}=Za(ee,k,P,ue),g={command:"transform",flags:K,inputFS:F!==null,input:F!==null?p(F):typeof C=="string"?p(C):C};ie&&(g.mangleCache=ie),H(U,g,(M,W)=>{if(M)return N(new Error(M),null);let Q=Pt(W.errors,J),fe=Pt(W.warnings,J),Y=1,we=()=>{if(--Y===0){let me={warnings:fe,code:W.code,map:W.map,mangleCache:void 0,legalComments:void 0};"legalComments"in W&&(me.legalComments=W?.legalComments),W.mangleCache&&(me.mangleCache=W?.mangleCache),N(null,me)}};if(Q.length>0)return N(Jt("Transform failed",Q,fe),null);W.codeFS&&(Y++,R.readFile(W.code,(me,he)=>{me!==null?N(me,null):(W.code=he,we())})),W.mapFS&&(Y++,R.readFile(W.map,(me,he)=>{me!==null?N(me,null):(W.map=he,we())})),we()})}catch(K){let ie=[];try{En(ie,k,{},P,ue)}catch{}let g=ft(K,h,J,void 0,"");H(U,{command:"error",flags:ie,error:g},()=>{g.detail=J.load(g.detail),N(Jt("Transform failed",[g],[]),null)})}};if((typeof C=="string"||C instanceof Uint8Array)&&C.length>1024*1024){let F=T;T=()=>R.writeFile(C,F)}T(null)},formatMessages:({callName:ee,refs:U,messages:C,options:k,callback:P})=>{if(!k)throw new Error(`Missing second argument in ${ee}() call`);let R={},N=v(k,R,"kind",$),J=v(k,R,"color",G),T=v(k,R,"terminalWidth",ve),F=v(k,R,"logStyle",$);if(Te(k,R,`in ${ee}() call`),N===void 0)throw new Error(`Missing "kind" in ${ee}() call`);if(N!=="error"&&N!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${ee}() call`);let K={command:"format-msgs",messages:Xe(C,"messages",null,"",T),isWarning:N==="warning"};J!==void 0&&(K.color=J),T!==void 0&&(K.terminalWidth=T),F!==void 0&&(K.logStyle=F),H(U,K,(ie,g)=>{if(ie)return P(new Error(ie),null);P(null,g.messages)})},analyzeMetafile:({callName:ee,refs:U,metafile:C,options:k,callback:P})=>{k===void 0&&(k={});let R={},N=v(k,R,"color",G),J=v(k,R,"verbose",G);Te(k,R,`in ${ee}() call`);let T={command:"analyze-metafile",metafile:C};N!==void 0&&(T.color=N),J!==void 0&&(T.verbose=J),H(U,T,(F,K)=>{if(F)return P(new Error(F),null);P(null,K.result)})}}}}function eo(h,m,b,S,O,D,I,z,x,j,H){let Z=ws(),_e=h==="context",le=(ne,Pe)=>{let te=[];try{En(te,z,{},x,pe)}catch{}let ee=ft(ne,D,Z,void 0,Pe);b(O,{command:"error",flags:te,error:ee},()=>{ee.detail=Z.load(ee.detail),H(Jt(_e?"Context failed":"Build failed",[ee],[]),null)})},ge;if(typeof z=="object"){let ne=z.plugins;if(ne!==void 0){if(!Array.isArray(ne))return le(new Error('"plugins" must be an array'),"");ge=ne}}if(ge&&ge.length>0){if(D.isSync)return le(new Error("Cannot use plugins in synchronous API calls"),"");to(m,b,S,O,D,I,z,ge,Z).then(ne=>{if(!ne.ok)return le(ne.error,ne.pluginName);try{be(ne.requestPlugins,ne.runOnEndCallbacks,ne.scheduleOnDisposeCallbacks)}catch(Pe){le(Pe,"")}},ne=>le(ne,""));return}try{be(null,(ne,Pe)=>Pe([],[]),()=>{})}catch(ne){le(ne,"")}function be(ne,Pe,te){let ee=D.hasFS,{entries:U,flags:C,write:k,stdinContents:P,stdinResolveDir:R,absWorkingDir:N,nodePaths:J,mangleCache:T}=Xa(h,z,x,pe,ee);if(k&&!D.hasFS)throw new Error('The "write" option is unavailable in this environment');let F={command:"build",key:m,entries:U,flags:C,write:k,stdinContents:P,stdinResolveDir:R,absWorkingDir:N||j,nodePaths:J,context:_e};ne&&(F.plugins=ne),T&&(F.mangleCache=T);let K=(M,W)=>{let Q={errors:Pt(M.errors,Z),warnings:Pt(M.warnings,Z),outputFiles:void 0,metafile:void 0,mangleCache:void 0},fe=Q.errors.slice(),Y=Q.warnings.slice();M.outputFiles&&(Q.outputFiles=M.outputFiles.map(ro)),M.metafile&&M.metafile.length&&(Q.metafile=so(M.metafile)),M.mangleCache&&(Q.mangleCache=M.mangleCache),M.writeToStdout!==void 0&&console.log(_(M.writeToStdout).replace(/\n$/,"")),Pe(Q,(we,me)=>{if(fe.length>0||we.length>0){let he=Jt("Build failed",fe.concat(we),Y.concat(me));return W(he,null,we,me)}W(null,Q,we,me)})},ie,g;_e&&(I["on-end"]=(M,W)=>new Promise(Q=>{K(W,(fe,Y,we,me)=>{let he={errors:we,warnings:me};g&&g(fe,Y),ie=void 0,g=void 0,S(M,he),Q()})})),b(O,F,(M,W)=>{if(M)return H(new Error(M),null);if(!_e)return K(W,(Y,we)=>(te(),H(Y,we)));if(W.errors.length>0)return H(Jt("Context failed",W.errors,W.warnings),null);let Q=!1,fe={rebuild:()=>(ie||(ie=new Promise((Y,we)=>{let me;g=(Ue,Ie)=>{me||(me=()=>Ue?we(Ue):Y(Ie))};let he=()=>{b(O,{command:"rebuild",key:m},(Ie,Ze)=>{Ie?we(new Error(Ie)):me?me():he()})};he()})),ie),watch:(Y={})=>new Promise((we,me)=>{if(!D.hasFS)throw new Error('Cannot use the "watch" API in this environment');let he={},Ue=v(Y,he,"delay",ve);Te(Y,he,"in watch() call");let Ie={command:"watch",key:m};Ue&&(Ie.delay=Ue),b(O,Ie,Ze=>{Ze?me(new Error(Ze)):we(void 0)})}),serve:(Y={})=>new Promise((we,me)=>{if(!D.hasFS)throw new Error('Cannot use the "serve" API in this environment');let he={},Ue=v(Y,he,"port",Me),Ie=v(Y,he,"host",$),Ze=v(Y,he,"servedir",$),re=v(Y,he,"keyfile",$),Qe=v(Y,he,"certfile",$),je=v(Y,he,"fallback",$),Ge=v(Y,he,"cors",De),et=v(Y,he,"onRequest",Fe);Te(Y,he,"in serve() call");let We={command:"serve",key:m,onRequest:!!et};if(Ue!==void 0&&(We.port=Ue),Ie!==void 0&&(We.host=Ie),Ze!==void 0&&(We.servedir=Ze),re!==void 0&&(We.keyfile=re),Qe!==void 0&&(We.certfile=Qe),je!==void 0&&(We.fallback=je),Ge){let Xt={},It=v(Ge,Xt,"origin",qt);Te(Ge,Xt,'on "cors" object'),Array.isArray(It)?We.corsOrigin=It:It!==void 0&&(We.corsOrigin=[It])}b(O,We,(Xt,It)=>{if(Xt)return me(new Error(Xt));et&&(I["serve-request"]=(yo,vo)=>{et(vo.args),S(yo,{})}),we(It)})}),cancel:()=>new Promise(Y=>{if(Q)return Y();b(O,{command:"cancel",key:m},()=>{Y()})}),dispose:()=>new Promise(Y=>{if(Q)return Y();Q=!0,b(O,{command:"dispose",key:m},()=>{Y(),te(),O.unref()})})};O.ref(),H(null,fe)})}}var to=(h,m,b,S,O,D,I,z,x)=>l(null,null,function*(){let j=[],H=[],Z={},_e={},le=[],ge=0,be=0,ne=[],Pe=!1;z=[...z];for(let U of z){let C={};if(typeof U!="object")throw new Error(`Plugin at index ${be} must be an object`);let k=v(U,C,"name",$);if(typeof k!="string"||k==="")throw new Error(`Plugin at index ${be} is missing a name`);try{let P=v(U,C,"setup",Fe);if(typeof P!="function")throw new Error("Plugin is missing a setup function");Te(U,C,`on plugin ${X(k)}`);let R={name:k,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};be++;let J=P({initialOptions:I,resolve:(T,F={})=>{if(!Pe)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof T!="string")throw new Error("The path to resolve must be a string");let K=Object.create(null),ie=v(F,K,"pluginName",$),g=v(F,K,"importer",$),M=v(F,K,"namespace",$),W=v(F,K,"resolveDir",$),Q=v(F,K,"kind",$),fe=v(F,K,"pluginData",ae),Y=v(F,K,"with",De);return Te(F,K,"in resolve() call"),new Promise((we,me)=>{let he={command:"resolve",path:T,key:h,pluginName:k};if(ie!=null&&(he.pluginName=ie),g!=null&&(he.importer=g),M!=null&&(he.namespace=M),W!=null&&(he.resolveDir=W),Q!=null)he.kind=Q;else throw new Error('Must specify "kind" when calling "resolve"');fe!=null&&(he.pluginData=x.store(fe)),Y!=null&&(he.with=no(Y,"with")),m(S,he,(Ue,Ie)=>{Ue!==null?me(new Error(Ue)):we({errors:Pt(Ie.errors,x),warnings:Pt(Ie.warnings,x),path:Ie.path,external:Ie.external,sideEffects:Ie.sideEffects,namespace:Ie.namespace,suffix:Ie.suffix,pluginData:x.load(Ie.pluginData)})})})},onStart(T){let F='This error came from the "onStart" callback registered here:',K=An(new Error(F),O,"onStart");j.push({name:k,callback:T,note:K}),R.onStart=!0},onEnd(T){let F='This error came from the "onEnd" callback registered here:',K=An(new Error(F),O,"onEnd");H.push({name:k,callback:T,note:K}),R.onEnd=!0},onResolve(T,F){let K='This error came from the "onResolve" callback registered here:',ie=An(new Error(K),O,"onResolve"),g={},M=v(T,g,"filter",xe),W=v(T,g,"namespace",$);if(Te(T,g,`in onResolve() call for plugin ${X(k)}`),M==null)throw new Error("onResolve() call is missing a filter");let Q=ge++;Z[Q]={name:k,callback:F,note:ie},R.onResolve.push({id:Q,filter:Pn(M),namespace:W||""})},onLoad(T,F){let K='This error came from the "onLoad" callback registered here:',ie=An(new Error(K),O,"onLoad"),g={},M=v(T,g,"filter",xe),W=v(T,g,"namespace",$);if(Te(T,g,`in onLoad() call for plugin ${X(k)}`),M==null)throw new Error("onLoad() call is missing a filter");let Q=ge++;_e[Q]={name:k,callback:F,note:ie},R.onLoad.push({id:Q,filter:Pn(M),namespace:W||""})},onDispose(T){le.push(T)},esbuild:O.esbuild});J&&(yield J),ne.push(R)}catch(P){return{ok:!1,error:P,pluginName:k}}}D["on-start"]=(U,C)=>l(null,null,function*(){x.clear();let k={errors:[],warnings:[]};yield Promise.all(j.map(P=>l(null,[P],function*({name:R,callback:N,note:J}){try{let T=yield N();if(T!=null){if(typeof T!="object")throw new Error(`Expected onStart() callback in plugin ${X(R)} to return an object`);let F={},K=v(T,F,"errors",de),ie=v(T,F,"warnings",de);Te(T,F,`from onStart() callback in plugin ${X(R)}`),K!=null&&k.errors.push(...Xe(K,"errors",x,R,void 0)),ie!=null&&k.warnings.push(...Xe(ie,"warnings",x,R,void 0))}}catch(T){k.errors.push(ft(T,O,x,J&&J(),R))}}))),b(U,k)}),D["on-resolve"]=(U,C)=>l(null,null,function*(){let k={},P="",R,N;for(let J of C.ids)try{({name:P,callback:R,note:N}=Z[J]);let T=yield R({path:C.path,importer:C.importer,namespace:C.namespace,resolveDir:C.resolveDir,kind:C.kind,pluginData:x.load(C.pluginData),with:C.with});if(T!=null){if(typeof T!="object")throw new Error(`Expected onResolve() callback in plugin ${X(P)} to return an object`);let F={},K=v(T,F,"pluginName",$),ie=v(T,F,"path",$),g=v(T,F,"namespace",$),M=v(T,F,"suffix",$),W=v(T,F,"external",G),Q=v(T,F,"sideEffects",G),fe=v(T,F,"pluginData",ae),Y=v(T,F,"errors",de),we=v(T,F,"warnings",de),me=v(T,F,"watchFiles",Ae),he=v(T,F,"watchDirs",Ae);Te(T,F,`from onResolve() callback in plugin ${X(P)}`),k.id=J,K!=null&&(k.pluginName=K),ie!=null&&(k.path=ie),g!=null&&(k.namespace=g),M!=null&&(k.suffix=M),W!=null&&(k.external=W),Q!=null&&(k.sideEffects=Q),fe!=null&&(k.pluginData=x.store(fe)),Y!=null&&(k.errors=Xe(Y,"errors",x,P,void 0)),we!=null&&(k.warnings=Xe(we,"warnings",x,P,void 0)),me!=null&&(k.watchFiles=Tn(me,"watchFiles")),he!=null&&(k.watchDirs=Tn(he,"watchDirs"));break}}catch(T){k={id:J,errors:[ft(T,O,x,N&&N(),P)]};break}b(U,k)}),D["on-load"]=(U,C)=>l(null,null,function*(){let k={},P="",R,N;for(let J of C.ids)try{({name:P,callback:R,note:N}=_e[J]);let T=yield R({path:C.path,namespace:C.namespace,suffix:C.suffix,pluginData:x.load(C.pluginData),with:C.with});if(T!=null){if(typeof T!="object")throw new Error(`Expected onLoad() callback in plugin ${X(P)} to return an object`);let F={},K=v(T,F,"pluginName",$),ie=v(T,F,"contents",Sn),g=v(T,F,"resolveDir",$),M=v(T,F,"pluginData",ae),W=v(T,F,"loader",$),Q=v(T,F,"errors",de),fe=v(T,F,"warnings",de),Y=v(T,F,"watchFiles",Ae),we=v(T,F,"watchDirs",Ae);Te(T,F,`from onLoad() callback in plugin ${X(P)}`),k.id=J,K!=null&&(k.pluginName=K),ie instanceof Uint8Array?k.contents=ie:ie!=null&&(k.contents=p(ie)),g!=null&&(k.resolveDir=g),M!=null&&(k.pluginData=x.store(M)),W!=null&&(k.loader=W),Q!=null&&(k.errors=Xe(Q,"errors",x,P,void 0)),fe!=null&&(k.warnings=Xe(fe,"warnings",x,P,void 0)),Y!=null&&(k.watchFiles=Tn(Y,"watchFiles")),we!=null&&(k.watchDirs=Tn(we,"watchDirs"));break}}catch(T){k={id:J,errors:[ft(T,O,x,N&&N(),P)]};break}b(U,k)});let te=(U,C)=>C([],[]);H.length>0&&(te=(U,C)=>{l(null,null,function*(){let k=[],P=[];for(let{name:R,callback:N,note:J}of H){let T,F;try{let K=yield N(U);if(K!=null){if(typeof K!="object")throw new Error(`Expected onEnd() callback in plugin ${X(R)} to return an object`);let ie={},g=v(K,ie,"errors",de),M=v(K,ie,"warnings",de);Te(K,ie,`from onEnd() callback in plugin ${X(R)}`),g!=null&&(T=Xe(g,"errors",x,R,void 0)),M!=null&&(F=Xe(M,"warnings",x,R,void 0))}}catch(K){T=[ft(K,O,x,J&&J(),R)]}if(T){k.push(...T);try{U.errors.push(...T)}catch{}}if(F){P.push(...F);try{U.warnings.push(...F)}catch{}}}C(k,P)})});let ee=()=>{for(let U of le)setTimeout(()=>U(),0)};return Pe=!0,{ok:!0,requestPlugins:ne,runOnEndCallbacks:te,scheduleOnDisposeCallbacks:ee}});function ws(){let h=new Map,m=0;return{clear(){h.clear()},load(b){return h.get(b)},store(b){if(b===void 0)return-1;let S=m++;return h.set(S,b),S}}}function An(h,m,b){let S,O=!1;return()=>{if(O)return S;O=!0;try{let D=(h.stack+"").split(`
8
+ `);D.splice(1,1);let I=ys(m,D,b);if(I)return S={text:h.message,location:I},S}catch{}}}function ft(h,m,b,S,O){let D="Internal error",I=null;try{D=(h&&h.message||h)+""}catch{}try{I=ys(m,(h.stack+"").split(`
9
+ `),"")}catch{}return{id:"",pluginName:O,text:D,location:I,notes:S?[S]:[],detail:b?b.store(h):-1}}function ys(h,m,b){let S=" at ";if(h.readFileSync&&!m[0].startsWith(S)&&m[1].startsWith(S))for(let O=1;O<m.length;O++){let D=m[O];if(D.startsWith(S))for(D=D.slice(S.length);;){let I=/^(?:new |async )?\S+ \((.*)\)$/.exec(D);if(I){D=I[1];continue}if(I=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(D),I){D=I[1];continue}if(I=/^(\S+):(\d+):(\d+)$/.exec(D),I){let z;try{z=h.readFileSync(I[1],"utf8")}catch{break}let x=z.split(/\r\n|\r|\n|\u2028|\u2029/)[+I[2]-1]||"",j=+I[3]-1,H=x.slice(j,j+b.length)===b?b.length:0;return{file:I[1],namespace:"file",line:+I[2],column:p(x.slice(0,j)).length,length:p(x.slice(j,j+H)).length,lineText:x+`
10
10
  `+m.slice(1).join(`
11
- `),suggestion:""}}break}}return null}function Vt(h,m,b){let S=5;h+=m.length<1?"":` with ${m.length} error${m.length<2?"":"s"}:`+m.slice(0,S+1).map(($,P)=>{if(P===S)return`
12
- ...`;if(!$.location)return`
13
- error: ${$.text}`;let{file:V,line:x,column:N}=$.location,G=$.pluginName?`[plugin: ${$.pluginName}] `:"";return`
14
- ${V}:${x}:${N}: ERROR: ${G}${$.text}`}).join("");let O=new Error(h);for(let[$,P]of[["errors",m],["warnings",b]])Object.defineProperty(O,$,{configurable:!0,enumerable:!0,get:()=>P,set:V=>Object.defineProperty(O,$,{configurable:!0,enumerable:!0,value:V})});return O}function St(h,m){for(let b of h)b.detail=m.load(b.detail);return h}function as(h,m,b){if(h==null)return null;let S={},O=v(h,S,"file",B),$=v(h,S,"namespace",B),P=v(h,S,"line",we),V=v(h,S,"column",we),x=v(h,S,"length",we),N=v(h,S,"lineText",B),G=v(h,S,"suggestion",B);if(Pe(h,S,m),N){let Z=N.slice(0,(V&&V>0?V:0)+(x&&x>0?x:0)+(b&&b>0?b:80));!/[\x7F-\uFFFF]/.test(Z)&&!/\n/.test(N)&&(N=Z)}return{file:O||"",namespace:$||"",line:P||0,column:V||0,length:x||0,lineText:N||"",suggestion:G||""}}function Ke(h,m,b,S,O){let $=[],P=0;for(let V of h){let x={},N=v(V,x,"id",B),G=v(V,x,"pluginName",B),Z=v(V,x,"text",B),he=v(V,x,"location",Nt),ue=v(V,x,"notes",ae),pe=v(V,x,"detail",oe),me=`in element ${P} of "${m}"`;Pe(V,x,me);let ne=[];if(ue)for(let Ee of ue){let te={},ee=v(Ee,te,"text",B),U=v(Ee,te,"location",Nt);Pe(Ee,te,me),ne.push({text:ee||"",location:as(U,me,O)})}$.push({id:N||"",pluginName:G||S,text:Z||"",location:as(he,me,O),notes:ne,detail:b?b.store(pe):-1}),P++}return $}function bn(h,m){let b=[];for(let S of h){if(typeof S!="string")throw new Error(`${X(m)} must be an array of strings`);b.push(S)}return b}function Ia(h,m){let b=Object.create(null);for(let S in h){let O=h[S];if(typeof O!="string")throw new Error(`key ${X(S)} in object ${X(m)} must be a string`);b[S]=O}return b}function Ra({path:h,contents:m,hash:b}){let S=null;return{path:h,contents:m,hash:b,get text(){let O=this.contents;return(S===null||O!==m)&&(m=O,S=p(O)),S}}}function wn(h){let m=h.source;return h.flags&&(m=`(?${h.flags})${m}`),m}function Ca(h){let m;try{m=p(h)}catch{return se(h)}return JSON.parse(m)}var Oa="0.28.2",$a=h=>Gt().build(h),Da=h=>Gt().context(h),La=(h,m)=>Gt().transform(h,m),Fa=(h,m)=>Gt().formatMessages(h,m),Ba=(h,m)=>Gt().analyzeMetafile(h,m),Ua=()=>{throw new Error('The "buildSync" API only works in node')},ja=()=>{throw new Error('The "transformSync" API only works in node')},Na=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Wa=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Va=()=>(yn&&yn(),Promise.resolve()),ct,yn,vn,Gt=()=>{if(vn)return vn;throw ct?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Ga=h=>{h=Ma(h||{});let m=h.wasmURL,b=h.wasmModule,S=h.worker!==!1;if(!m&&!b)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ct)throw new Error('Cannot call "initialize" more than once');return ct=za(m||"",b,S),ct.catch(()=>{ct=void 0}),ct},za=(h,m,b)=>l(null,null,function*(){let S,O,$=new Promise(Z=>O=Z);if(b){let Z=new Blob([`onmessage=((postMessage) => {
11
+ `),suggestion:""}}break}}return null}function Jt(h,m,b){let S=5;h+=m.length<1?"":` with ${m.length} error${m.length<2?"":"s"}:`+m.slice(0,S+1).map((D,I)=>{if(I===S)return`
12
+ ...`;if(!D.location)return`
13
+ error: ${D.text}`;let{file:z,line:x,column:j}=D.location,H=D.pluginName?`[plugin: ${D.pluginName}] `:"";return`
14
+ ${z}:${x}:${j}: ERROR: ${H}${D.text}`}).join("");let O=new Error(h);for(let[D,I]of[["errors",m],["warnings",b]])Object.defineProperty(O,D,{configurable:!0,enumerable:!0,get:()=>I,set:z=>Object.defineProperty(O,D,{configurable:!0,enumerable:!0,value:z})});return O}function Pt(h,m){for(let b of h)b.detail=m.load(b.detail);return h}function vs(h,m,b){if(h==null)return null;let S={},O=v(h,S,"file",$),D=v(h,S,"namespace",$),I=v(h,S,"line",ve),z=v(h,S,"column",ve),x=v(h,S,"length",ve),j=v(h,S,"lineText",$),H=v(h,S,"suggestion",$);if(Te(h,S,m),j){let Z=j.slice(0,(z&&z>0?z:0)+(x&&x>0?x:0)+(b&&b>0?b:80));!/[\x7F-\uFFFF]/.test(Z)&&!/\n/.test(j)&&(j=Z)}return{file:O||"",namespace:D||"",line:I||0,column:z||0,length:x||0,lineText:j||"",suggestion:H||""}}function Xe(h,m,b,S,O){let D=[],I=0;for(let z of h){let x={},j=v(z,x,"id",$),H=v(z,x,"pluginName",$),Z=v(z,x,"text",$),_e=v(z,x,"location",xn),le=v(z,x,"notes",de),ge=v(z,x,"detail",ae),be=`in element ${I} of "${m}"`;Te(z,x,be);let ne=[];if(le)for(let Pe of le){let te={},ee=v(Pe,te,"text",$),U=v(Pe,te,"location",xn);Te(Pe,te,be),ne.push({text:ee||"",location:vs(U,be,O)})}D.push({id:j||"",pluginName:H||S,text:Z||"",location:vs(_e,be,O),notes:ne,detail:b?b.store(ge):-1}),I++}return D}function Tn(h,m){let b=[];for(let S of h){if(typeof S!="string")throw new Error(`${X(m)} must be an array of strings`);b.push(S)}return b}function no(h,m){let b=Object.create(null);for(let S in h){let O=h[S];if(typeof O!="string")throw new Error(`key ${X(S)} in object ${X(m)} must be a string`);b[S]=O}return b}function ro({path:h,contents:m,hash:b}){let S=null;return{path:h,contents:m,hash:b,get text(){let O=this.contents;return(S===null||O!==m)&&(m=O,S=_(O)),S}}}function Pn(h){let m=h.source;return h.flags&&(m=`(?${h.flags})${m}`),m}function so(h){let m;try{m=_(h)}catch{return se(h)}return JSON.parse(m)}var io="0.28.2",ao=h=>Yt().build(h),oo=h=>Yt().context(h),co=(h,m)=>Yt().transform(h,m),lo=(h,m)=>Yt().formatMessages(h,m),uo=(h,m)=>Yt().analyzeMetafile(h,m),fo=()=>{throw new Error('The "buildSync" API only works in node')},ho=()=>{throw new Error('The "transformSync" API only works in node')},po=()=>{throw new Error('The "formatMessagesSync" API only works in node')},_o=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},mo=()=>(In&&In(),Promise.resolve()),dt,In,Rn,Yt=()=>{if(Rn)return Rn;throw dt?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},go=h=>{h=Ya(h||{});let m=h.wasmURL,b=h.wasmModule,S=h.worker!==!1;if(!m&&!b)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(dt)throw new Error('Cannot call "initialize" more than once');return dt=bo(m||"",b,S),dt.catch(()=>{dt=void 0}),dt},bo=(h,m,b)=>l(null,null,function*(){let S,O,D=new Promise(Z=>O=Z);if(b){let Z=new Blob([`onmessage=((postMessage) => {
15
15
  // Copyright 2018 The Go Authors. All rights reserved.
16
16
  // Use of this source code is governed by a BSD-style
17
17
  // license that can be found in the LICENSE file.
@@ -689,18 +689,18 @@ ${V}:${x}:${N}: ERROR: ${G}${$.text}`}).join("");let O=new Error(h);for(let[$,P]
689
689
  });
690
690
  }
691
691
  return (m) => onmessage(m);
692
- })(postMessage)`],{type:"text/javascript"});S=new Worker(URL.createObjectURL(Z))}else{let Z=(ue=>{var pe=(te,ee,U)=>new Promise((C,k)=>{var T=J=>{try{j(U.next(J))}catch(E){k(E)}},I=J=>{try{j(U.throw(J))}catch(E){k(E)}},j=J=>J.done?C(J.value):Promise.resolve(J.value).then(T,I);j((U=U.apply(te,ee)).next())});let me,ne={};for(let te=self;te;te=Object.getPrototypeOf(te))for(let ee of Object.getOwnPropertyNames(te))ee in ne||Object.defineProperty(ne,ee,{get:()=>self[ee]});(()=>{let te=()=>{let C=new Error("not implemented");return C.code="ENOSYS",C};if(!ne.fs){let C="";ne.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(k,T){C+=U.decode(T);let I=C.lastIndexOf(`
693
- `);return I!=-1&&(console.log(C.substring(0,I)),C=C.substring(I+1)),T.length},write(k,T,I,j,J,E){if(I!==0||j!==T.length||J!==null){E(te());return}let D=this.writeSync(k,T);E(null,D)},chmod(k,T,I){I(te())},chown(k,T,I,j){j(te())},close(k,T){T(te())},fchmod(k,T,I){I(te())},fchown(k,T,I,j){j(te())},fstat(k,T){T(te())},fsync(k,T){T(null)},ftruncate(k,T,I){I(te())},lchown(k,T,I,j){j(te())},link(k,T,I){I(te())},lstat(k,T){T(te())},mkdir(k,T,I){I(te())},open(k,T,I,j){j(te())},read(k,T,I,j,J,E){E(te())},readdir(k,T){T(te())},readlink(k,T){T(te())},rename(k,T,I){I(te())},rmdir(k,T){T(te())},stat(k,T){T(te())},symlink(k,T,I){I(te())},truncate(k,T,I){I(te())},unlink(k,T){T(te())},utimes(k,T,I,j){j(te())}}}if(ne.process||(ne.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw te()},pid:-1,ppid:-1,umask(){throw te()},cwd(){throw te()},chdir(){throw te()}}),ne.path||(ne.path={resolve(...C){return C.join("/")}}),!ne.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!ne.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!ne.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!ne.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");let ee=new TextEncoder("utf-8"),U=new TextDecoder("utf-8");ne.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=g=>{g!==0&&console.warn("exit code:",g)},this._exitPromise=new Promise(g=>{this._resolveExitPromise=g}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;let C=(g,M)=>{this.mem.setUint32(g+0,M,!0),this.mem.setUint32(g+4,Math.floor(M/4294967296),!0)},k=(g,M)=>{this.mem.setUint32(g+0,M,!0)},T=g=>{let M=this.mem.getUint32(g+0,!0),W=this.mem.getInt32(g+4,!0);return M+W*4294967296},I=g=>{let M=this.mem.getFloat64(g,!0);if(M===0)return;if(!isNaN(M))return M;let W=this.mem.getUint32(g,!0);return this._values[W]},j=(g,M)=>{if(typeof M=="number"&&M!==0){if(isNaN(M)){this.mem.setUint32(g+4,2146959360,!0),this.mem.setUint32(g,0,!0);return}this.mem.setFloat64(g,M,!0);return}if(M===void 0){this.mem.setFloat64(g,0,!0);return}let Q=this._ids.get(M);Q===void 0&&(Q=this._idPool.pop(),Q===void 0&&(Q=this._values.length),this._values[Q]=M,this._goRefCounts[Q]=0,this._ids.set(M,Q)),this._goRefCounts[Q]++;let fe=0;switch(typeof M){case"object":M!==null&&(fe=1);break;case"string":fe=2;break;case"symbol":fe=3;break;case"function":fe=4;break}this.mem.setUint32(g+4,2146959360|fe,!0),this.mem.setUint32(g,Q,!0)},J=g=>{let M=T(g+0),W=T(g+8);return new Uint8Array(this._inst.exports.mem.buffer,M,W)},E=g=>{let M=T(g+0),W=T(g+8),Q=new Array(W);for(let fe=0;fe<W;fe++)Q[fe]=I(M+fe*8);return Q},D=g=>{let M=T(g+0),W=T(g+8);return U.decode(new DataView(this._inst.exports.mem.buffer,M,W))},z=(g,M)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(g,M)),ie=Date.now()-performance.now();this.importObject={_gotest:{add:(g,M)=>g+M,callExport:z},gojs:{"runtime.wasmExit":g=>{g>>>=0;let M=this.mem.getInt32(g+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(M)},"runtime.wasmWrite":g=>{g>>>=0;let M=T(g+8),W=T(g+16),Q=this.mem.getInt32(g+24,!0);ne.fs.writeSync(M,new Uint8Array(this._inst.exports.mem.buffer,W,Q))},"runtime.resetMemoryDataView":g=>{g>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":g=>{g>>>=0,C(g+8,(ie+performance.now())*1e6)},"runtime.walltime":g=>{g>>>=0;let M=new Date().getTime();C(g+8,M/1e3),this.mem.setInt32(g+16,M%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":g=>{g>>>=0;let M=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(M,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(M);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},T(g+8))),this.mem.setInt32(g+16,M,!0)},"runtime.clearTimeoutEvent":g=>{g>>>=0;let M=this.mem.getInt32(g+8,!0);clearTimeout(this._scheduledTimeouts.get(M)),this._scheduledTimeouts.delete(M)},"runtime.getRandomData":g=>{g>>>=0,crypto.getRandomValues(J(g+8))},"syscall/js.finalizeRef":g=>{g>>>=0;let M=this.mem.getUint32(g+8,!0);if(this._goRefCounts[M]--,this._goRefCounts[M]===0){let W=this._values[M];this._values[M]=null,this._ids.delete(W),this._idPool.push(M)}},"syscall/js.stringVal":g=>{g>>>=0,j(g+24,D(g+8))},"syscall/js.valueGet":g=>{g>>>=0;let M=Reflect.get(I(g+8),D(g+16));g=this._inst.exports.getsp()>>>0,j(g+32,M)},"syscall/js.valueSet":g=>{g>>>=0,Reflect.set(I(g+8),D(g+16),I(g+32))},"syscall/js.valueDelete":g=>{g>>>=0,Reflect.deleteProperty(I(g+8),D(g+16))},"syscall/js.valueIndex":g=>{g>>>=0,j(g+24,Reflect.get(I(g+8),T(g+16)))},"syscall/js.valueSetIndex":g=>{g>>>=0,Reflect.set(I(g+8),T(g+16),I(g+24))},"syscall/js.valueCall":g=>{g>>>=0;try{let M=I(g+8),W=Reflect.get(M,D(g+16)),Q=E(g+32),fe=Reflect.apply(W,M,Q);g=this._inst.exports.getsp()>>>0,j(g+56,fe),this.mem.setUint8(g+64,1)}catch(M){g=this._inst.exports.getsp()>>>0,j(g+56,M),this.mem.setUint8(g+64,0)}},"syscall/js.valueInvoke":g=>{g>>>=0;try{let M=I(g+8),W=E(g+16),Q=Reflect.apply(M,void 0,W);g=this._inst.exports.getsp()>>>0,j(g+40,Q),this.mem.setUint8(g+48,1)}catch(M){g=this._inst.exports.getsp()>>>0,j(g+40,M),this.mem.setUint8(g+48,0)}},"syscall/js.valueNew":g=>{g>>>=0;try{let M=I(g+8),W=E(g+16),Q=Reflect.construct(M,W);g=this._inst.exports.getsp()>>>0,j(g+40,Q),this.mem.setUint8(g+48,1)}catch(M){g=this._inst.exports.getsp()>>>0,j(g+40,M),this.mem.setUint8(g+48,0)}},"syscall/js.valueLength":g=>{g>>>=0,C(g+16,parseInt(I(g+8).length))},"syscall/js.valuePrepareString":g=>{g>>>=0;let M=ee.encode(String(I(g+8)));j(g+16,M),C(g+24,M.length)},"syscall/js.valueLoadString":g=>{g>>>=0;let M=I(g+8);J(g+16).set(M)},"syscall/js.valueInstanceOf":g=>{g>>>=0,this.mem.setUint8(g+24,I(g+8)instanceof I(g+16)?1:0)},"syscall/js.copyBytesToGo":g=>{g>>>=0;let M=J(g+8),W=I(g+32);if(!(W instanceof Uint8Array||W instanceof Uint8ClampedArray)){this.mem.setUint8(g+48,0);return}let Q=W.subarray(0,M.length);M.set(Q),C(g+40,Q.length),this.mem.setUint8(g+48,1)},"syscall/js.copyBytesToJS":g=>{g>>>=0;let M=I(g+8),W=J(g+16);if(!(M instanceof Uint8Array||M instanceof Uint8ClampedArray)){this.mem.setUint8(g+48,0);return}let Q=W.subarray(0,M.length);M.set(Q),C(g+40,Q.length),this.mem.setUint8(g+48,1)},debug:g=>{console.log(g)}}}}run(C){return pe(this,null,function*(){if(!(C instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=C,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,ne,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[ne,5],[this,6]]),this._idPool=[],this.exited=!1;let k=4096,T=z=>{let ie=k,g=ee.encode(z+"\0");return new Uint8Array(this.mem.buffer,k,g.length).set(g),k+=g.length,k%8!==0&&(k+=8-k%8),ie},I=this.argv.length,j=[];this.argv.forEach(z=>{j.push(T(z))}),j.push(0),Object.keys(this.env).sort().forEach(z=>{j.push(T(`${z}=${this.env[z]}`))}),j.push(0);let E=k;if(j.forEach(z=>{this.mem.setUint32(k,z,!0),this.mem.setUint32(k+4,0,!0),k+=8}),k>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(I,E),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(C){let k=this;return function(){let T={id:C,this:this,args:arguments};return k._pendingEvent=T,k._resume(),T.result}}}})(),me=({data:te})=>{let ee=new TextDecoder,U=ne.fs,C="";U.writeSync=(J,E)=>{if(J===1)ue(E);else if(J===2){C+=ee.decode(E);let D=C.split(`
694
- `);D.length>1&&console.log(D.slice(0,-1).join(`
695
- `)),C=D[D.length-1]}else throw new Error("Bad write");return E.length};let k=[],T,I=0;me=({data:J})=>(J.length>0&&(k.push(J),T&&T()),j),U.read=(J,E,D,z,ie,g)=>{if(J!==0||D!==0||z!==E.length||ie!==null)throw new Error("Bad read");if(k.length===0){T=()=>U.read(J,E,D,z,ie,g);return}let M=k[0],W=Math.max(0,Math.min(z,M.length-I));E.set(M.subarray(I,I+W),D),I+=W,I===M.length&&(k.shift(),I=0),g(null,W)};let j=new ne.Go;return j.argv=["","--service=0.28.2"],Ee(te,j).then(J=>{ue(null),j.run(J)},J=>{ue(J)}),j};function Ee(te,ee){return pe(this,null,function*(){if(te instanceof WebAssembly.Module)return WebAssembly.instantiate(te,ee.importObject);let U=yield fetch(te);if(!U.ok)throw new Error(`Failed to download ${JSON.stringify(te)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(U.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(U,ee.importObject)).instance;let C=yield U.arrayBuffer();return(yield WebAssembly.instantiate(C,ee.importObject)).instance})}return te=>me(te)})(ue=>S.onmessage({data:ue})),he;S={onmessage:null,postMessage:ue=>setTimeout(()=>{try{he=Z({data:ue})}catch(pe){O(pe)}}),terminate(){if(he)for(let ue of he._scheduledTimeouts.values())clearTimeout(ue)}}}let P,V,x=new Promise((Z,he)=>{P=Z,V=he});S.onmessage=({data:Z})=>{S.onmessage=({data:he})=>N(he),Z?V(Z):P()},S.postMessage(m||new URL(h,location.href).toString());let{readFromStdout:N,service:G}=Ea({writeToStdin(Z){S.postMessage(Z)},isSync:!1,hasFS:!1,esbuild:c});yield x,yn=()=>{S.terminate(),ct=void 0,yn=void 0,vn=void 0},vn={build:Z=>new Promise((he,ue)=>{$.then(ue),G.buildOrContext({callName:"build",refs:null,options:Z,isTTY:!1,defaultWD:"/",callback:(pe,me)=>pe?ue(pe):he(me)})}),context:Z=>new Promise((he,ue)=>{$.then(ue),G.buildOrContext({callName:"context",refs:null,options:Z,isTTY:!1,defaultWD:"/",callback:(pe,me)=>pe?ue(pe):he(me)})}),transform:(Z,he)=>new Promise((ue,pe)=>{$.then(pe),G.transform({callName:"transform",refs:null,input:Z,options:he||{},isTTY:!1,fs:{readFile(me,ne){ne(new Error("Internal error"),null)},writeFile(me,ne){ne(null)}},callback:(me,ne)=>me?pe(me):ue(ne)})}),formatMessages:(Z,he)=>new Promise((ue,pe)=>{$.then(pe),G.formatMessages({callName:"formatMessages",refs:null,messages:Z,options:he,callback:(me,ne)=>me?pe(me):ue(ne)})}),analyzeMetafile:(Z,he)=>new Promise((ue,pe)=>{$.then(pe),G.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof Z=="string"?Z:JSON.stringify(Z),options:he,callback:(me,ne)=>me?pe(me):ue(ne)})})}}),Ha=c})(typeof es=="object"?es:{set exports(e){(typeof self<"u"?self:this).esbuild=e}})});import{DEFAULT_OUTPUT as Wd,ManifestAssetCatalog as Vd,Registry as Gd,resolveProjectDocument as zd}from"@motionscript/core";import{AssetManager as xs,AudioSink as so,ClipStore as io,AssetTimeline as ao,isFatalRenderIssue as oo,RenderBackendError as lo,renderIssueKey as co,renderSettled as uo,SETTLE_PASSES as fo,setTheme as ho,toRenderIssue as _o,spansCovering as ks,StateEvaluator as po,yieldToScheduler as mo}from"@motionscript/core";var kn=class extends so{get schedulesAudio(){return!1}has(t){return!0}async append(t,n){}retain(t){}schedule(t){}syncTo(t){}play(t,n,r){}stop(){}};function er(e,t,n){for(let r of e.takeRenderIssues()){let s=_o(r);if(oo(s))throw new lo(s);let i=co(s);t.has(i)||(t.add(i),n?.(s))}}async function Ms({renderContext:e,storageAdapter:t},n,r){await uo(()=>e.execute(n),t,()=>!0)==="exhausted"&&console.warn(`[export] frame ${r} still had pending decodes after ${fo} renders; it may not be exact.`)}function Ss(e){let t=e.getDecodePolicy();return e.setDecodePolicy("exact"),()=>e.setDecodePolicy(t)}function go(e){let{fps:t,viewport:n}=e;if(t===void 0||n===void 0)throw new Error("Rendering takes a project whose fps and viewport are resolved \u2014 see Session.");return{fps:t,viewport:n}}function bo(e,t){if(!e)return{start:0,end:t};let{start:n,end:r}=e;if(!Number.isInteger(n)||!Number.isInteger(r)||n<0||r<=n||r>t)throw new RangeError(`Frames ${n} to ${r} are not a range inside this timeline's ${t} frames.`);return{start:n,end:r}}function As(e){let{project:t,registry:n,assetCatalog:r,renderContext:s}=e,{fps:i,viewport:a}=go(t),o=()=>ho(t.theme??e.theme);o();let l=s,c={registry:n,viewport:a,fps:i,assets:r,measurer:l},u={},f=new io(t,c,{isReady:p=>u.manager?.isReady(p)??!1}),d=new ao(t,c,{store:f}),_=new po(t,c,f);return{store:f,precomper:d,stateEvaluator:_,measurer:l,fps:i,viewport:a,loads:u,applyTheme:o}}async function Es(e,t,n){let r=n.flatMap(s=>e.layoutGates(s).filter(i=>!t.isReady(i.src)));r.length>0&&await t.loadRecords(r),e.settleGates(n)}function tr(e){let t=[];for(let n of e.tracks){let r=n.startFrame/e.fps;for(let s of n.audioRequests)t.push({request:s,globalOffset:r})}return t}async function Sn(e){let{scale:t=1,sink:n,mixer:r,onProgress:s,signal:i,includeAudio:a=!0}=e,o=e,{renderContext:l,storageAdapter:c}=o;if(e.project.tracks.length===0)return;i?.throwIfAborted(),l.pixelRatio=t;let{store:u,precomper:f,stateEvaluator:d,measurer:_,fps:p,viewport:w,loads:R,applyTheme:L}=As(e),F=Ss(c),H=new Set;try{l.takeRenderIssues();let{start:se,end:X}=bo(e.frames,f.result().totalFrames),ye=e.frames?u.spans.filter(ae=>ae.startFrame<X&&ae.endFrame>=se).map(ae=>ae.id):e.project.tracks.map(ae=>ae.id);if(e.frames)for(let ae of ye)u.discover(ae);let ve=e.frames?f.result():f.run(),{totalDuration:q}=ve,oe=X-se;Ps(u,ve,se,X-1);let K=R.manager=new xs(ve,c,new kn);await Es(u,K,ye);let B=tr(ve),xe=a&&!e.frames&&B.length>0&&r!==void 0;await n.start({width:w.width*t,height:w.height*t,fps:p,totalFrames:oe,hasAudio:xe});let we=1/p,Te=0;c.setPlaying(!0);try{for(let ae=se;ae<X;ae++){i?.throwIfAborted(),await K.loadAt(ae),L(),d.stateAt(ae),d.layout(_),await Ms(o,()=>d.render(l),ae),er(l,H,e.onIssue),await n.addFrame(Te,we),Te+=we;let Ae=ae-se+1;s?.(Ae/oe*(xe?.85:1)),(ae+1)%4===0&&await mo()}}finally{c.setPlaying(!1)}if(xe){let ae=await r.mix(B,q);ae!==null&&n.addAudio&&await n.addAudio(ae),s?.(.97)}er(l,H,e.onIssue);let Ue=await n.finalize();return s?.(1),Ue}finally{F(),d.dispose(),u.dispose()}}var Mn=class extends Error{frame;failures;name="NothingToDrawError";constructor(t,n){let r=n.map(s=>` ${s.trackId}: ${s.message}`).join(`
692
+ })(postMessage)`],{type:"text/javascript"});S=new Worker(URL.createObjectURL(Z))}else{let Z=(le=>{var ge=(te,ee,U)=>new Promise((C,k)=>{var P=J=>{try{N(U.next(J))}catch(T){k(T)}},R=J=>{try{N(U.throw(J))}catch(T){k(T)}},N=J=>J.done?C(J.value):Promise.resolve(J.value).then(P,R);N((U=U.apply(te,ee)).next())});let be,ne={};for(let te=self;te;te=Object.getPrototypeOf(te))for(let ee of Object.getOwnPropertyNames(te))ee in ne||Object.defineProperty(ne,ee,{get:()=>self[ee]});(()=>{let te=()=>{let C=new Error("not implemented");return C.code="ENOSYS",C};if(!ne.fs){let C="";ne.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(k,P){C+=U.decode(P);let R=C.lastIndexOf(`
693
+ `);return R!=-1&&(console.log(C.substring(0,R)),C=C.substring(R+1)),P.length},write(k,P,R,N,J,T){if(R!==0||N!==P.length||J!==null){T(te());return}let F=this.writeSync(k,P);T(null,F)},chmod(k,P,R){R(te())},chown(k,P,R,N){N(te())},close(k,P){P(te())},fchmod(k,P,R){R(te())},fchown(k,P,R,N){N(te())},fstat(k,P){P(te())},fsync(k,P){P(null)},ftruncate(k,P,R){R(te())},lchown(k,P,R,N){N(te())},link(k,P,R){R(te())},lstat(k,P){P(te())},mkdir(k,P,R){R(te())},open(k,P,R,N){N(te())},read(k,P,R,N,J,T){T(te())},readdir(k,P){P(te())},readlink(k,P){P(te())},rename(k,P,R){R(te())},rmdir(k,P){P(te())},stat(k,P){P(te())},symlink(k,P,R){R(te())},truncate(k,P,R){R(te())},unlink(k,P){P(te())},utimes(k,P,R,N){N(te())}}}if(ne.process||(ne.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw te()},pid:-1,ppid:-1,umask(){throw te()},cwd(){throw te()},chdir(){throw te()}}),ne.path||(ne.path={resolve(...C){return C.join("/")}}),!ne.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!ne.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!ne.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!ne.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");let ee=new TextEncoder("utf-8"),U=new TextDecoder("utf-8");ne.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=g=>{g!==0&&console.warn("exit code:",g)},this._exitPromise=new Promise(g=>{this._resolveExitPromise=g}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;let C=(g,M)=>{this.mem.setUint32(g+0,M,!0),this.mem.setUint32(g+4,Math.floor(M/4294967296),!0)},k=(g,M)=>{this.mem.setUint32(g+0,M,!0)},P=g=>{let M=this.mem.getUint32(g+0,!0),W=this.mem.getInt32(g+4,!0);return M+W*4294967296},R=g=>{let M=this.mem.getFloat64(g,!0);if(M===0)return;if(!isNaN(M))return M;let W=this.mem.getUint32(g,!0);return this._values[W]},N=(g,M)=>{if(typeof M=="number"&&M!==0){if(isNaN(M)){this.mem.setUint32(g+4,2146959360,!0),this.mem.setUint32(g,0,!0);return}this.mem.setFloat64(g,M,!0);return}if(M===void 0){this.mem.setFloat64(g,0,!0);return}let Q=this._ids.get(M);Q===void 0&&(Q=this._idPool.pop(),Q===void 0&&(Q=this._values.length),this._values[Q]=M,this._goRefCounts[Q]=0,this._ids.set(M,Q)),this._goRefCounts[Q]++;let fe=0;switch(typeof M){case"object":M!==null&&(fe=1);break;case"string":fe=2;break;case"symbol":fe=3;break;case"function":fe=4;break}this.mem.setUint32(g+4,2146959360|fe,!0),this.mem.setUint32(g,Q,!0)},J=g=>{let M=P(g+0),W=P(g+8);return new Uint8Array(this._inst.exports.mem.buffer,M,W)},T=g=>{let M=P(g+0),W=P(g+8),Q=new Array(W);for(let fe=0;fe<W;fe++)Q[fe]=R(M+fe*8);return Q},F=g=>{let M=P(g+0),W=P(g+8);return U.decode(new DataView(this._inst.exports.mem.buffer,M,W))},K=(g,M)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(g,M)),ie=Date.now()-performance.now();this.importObject={_gotest:{add:(g,M)=>g+M,callExport:K},gojs:{"runtime.wasmExit":g=>{g>>>=0;let M=this.mem.getInt32(g+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(M)},"runtime.wasmWrite":g=>{g>>>=0;let M=P(g+8),W=P(g+16),Q=this.mem.getInt32(g+24,!0);ne.fs.writeSync(M,new Uint8Array(this._inst.exports.mem.buffer,W,Q))},"runtime.resetMemoryDataView":g=>{g>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":g=>{g>>>=0,C(g+8,(ie+performance.now())*1e6)},"runtime.walltime":g=>{g>>>=0;let M=new Date().getTime();C(g+8,M/1e3),this.mem.setInt32(g+16,M%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":g=>{g>>>=0;let M=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(M,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(M);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},P(g+8))),this.mem.setInt32(g+16,M,!0)},"runtime.clearTimeoutEvent":g=>{g>>>=0;let M=this.mem.getInt32(g+8,!0);clearTimeout(this._scheduledTimeouts.get(M)),this._scheduledTimeouts.delete(M)},"runtime.getRandomData":g=>{g>>>=0,crypto.getRandomValues(J(g+8))},"syscall/js.finalizeRef":g=>{g>>>=0;let M=this.mem.getUint32(g+8,!0);if(this._goRefCounts[M]--,this._goRefCounts[M]===0){let W=this._values[M];this._values[M]=null,this._ids.delete(W),this._idPool.push(M)}},"syscall/js.stringVal":g=>{g>>>=0,N(g+24,F(g+8))},"syscall/js.valueGet":g=>{g>>>=0;let M=Reflect.get(R(g+8),F(g+16));g=this._inst.exports.getsp()>>>0,N(g+32,M)},"syscall/js.valueSet":g=>{g>>>=0,Reflect.set(R(g+8),F(g+16),R(g+32))},"syscall/js.valueDelete":g=>{g>>>=0,Reflect.deleteProperty(R(g+8),F(g+16))},"syscall/js.valueIndex":g=>{g>>>=0,N(g+24,Reflect.get(R(g+8),P(g+16)))},"syscall/js.valueSetIndex":g=>{g>>>=0,Reflect.set(R(g+8),P(g+16),R(g+24))},"syscall/js.valueCall":g=>{g>>>=0;try{let M=R(g+8),W=Reflect.get(M,F(g+16)),Q=T(g+32),fe=Reflect.apply(W,M,Q);g=this._inst.exports.getsp()>>>0,N(g+56,fe),this.mem.setUint8(g+64,1)}catch(M){g=this._inst.exports.getsp()>>>0,N(g+56,M),this.mem.setUint8(g+64,0)}},"syscall/js.valueInvoke":g=>{g>>>=0;try{let M=R(g+8),W=T(g+16),Q=Reflect.apply(M,void 0,W);g=this._inst.exports.getsp()>>>0,N(g+40,Q),this.mem.setUint8(g+48,1)}catch(M){g=this._inst.exports.getsp()>>>0,N(g+40,M),this.mem.setUint8(g+48,0)}},"syscall/js.valueNew":g=>{g>>>=0;try{let M=R(g+8),W=T(g+16),Q=Reflect.construct(M,W);g=this._inst.exports.getsp()>>>0,N(g+40,Q),this.mem.setUint8(g+48,1)}catch(M){g=this._inst.exports.getsp()>>>0,N(g+40,M),this.mem.setUint8(g+48,0)}},"syscall/js.valueLength":g=>{g>>>=0,C(g+16,parseInt(R(g+8).length))},"syscall/js.valuePrepareString":g=>{g>>>=0;let M=ee.encode(String(R(g+8)));N(g+16,M),C(g+24,M.length)},"syscall/js.valueLoadString":g=>{g>>>=0;let M=R(g+8);J(g+16).set(M)},"syscall/js.valueInstanceOf":g=>{g>>>=0,this.mem.setUint8(g+24,R(g+8)instanceof R(g+16)?1:0)},"syscall/js.copyBytesToGo":g=>{g>>>=0;let M=J(g+8),W=R(g+32);if(!(W instanceof Uint8Array||W instanceof Uint8ClampedArray)){this.mem.setUint8(g+48,0);return}let Q=W.subarray(0,M.length);M.set(Q),C(g+40,Q.length),this.mem.setUint8(g+48,1)},"syscall/js.copyBytesToJS":g=>{g>>>=0;let M=R(g+8),W=J(g+16);if(!(M instanceof Uint8Array||M instanceof Uint8ClampedArray)){this.mem.setUint8(g+48,0);return}let Q=W.subarray(0,M.length);M.set(Q),C(g+40,Q.length),this.mem.setUint8(g+48,1)},debug:g=>{console.log(g)}}}}run(C){return ge(this,null,function*(){if(!(C instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=C,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,ne,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[ne,5],[this,6]]),this._idPool=[],this.exited=!1;let k=4096,P=K=>{let ie=k,g=ee.encode(K+"\0");return new Uint8Array(this.mem.buffer,k,g.length).set(g),k+=g.length,k%8!==0&&(k+=8-k%8),ie},R=this.argv.length,N=[];this.argv.forEach(K=>{N.push(P(K))}),N.push(0),Object.keys(this.env).sort().forEach(K=>{N.push(P(`${K}=${this.env[K]}`))}),N.push(0);let T=k;if(N.forEach(K=>{this.mem.setUint32(k,K,!0),this.mem.setUint32(k+4,0,!0),k+=8}),k>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(R,T),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(C){let k=this;return function(){let P={id:C,this:this,args:arguments};return k._pendingEvent=P,k._resume(),P.result}}}})(),be=({data:te})=>{let ee=new TextDecoder,U=ne.fs,C="";U.writeSync=(J,T)=>{if(J===1)le(T);else if(J===2){C+=ee.decode(T);let F=C.split(`
694
+ `);F.length>1&&console.log(F.slice(0,-1).join(`
695
+ `)),C=F[F.length-1]}else throw new Error("Bad write");return T.length};let k=[],P,R=0;be=({data:J})=>(J.length>0&&(k.push(J),P&&P()),N),U.read=(J,T,F,K,ie,g)=>{if(J!==0||F!==0||K!==T.length||ie!==null)throw new Error("Bad read");if(k.length===0){P=()=>U.read(J,T,F,K,ie,g);return}let M=k[0],W=Math.max(0,Math.min(K,M.length-R));T.set(M.subarray(R,R+W),F),R+=W,R===M.length&&(k.shift(),R=0),g(null,W)};let N=new ne.Go;return N.argv=["","--service=0.28.2"],Pe(te,N).then(J=>{le(null),N.run(J)},J=>{le(J)}),N};function Pe(te,ee){return ge(this,null,function*(){if(te instanceof WebAssembly.Module)return WebAssembly.instantiate(te,ee.importObject);let U=yield fetch(te);if(!U.ok)throw new Error(`Failed to download ${JSON.stringify(te)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(U.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(U,ee.importObject)).instance;let C=yield U.arrayBuffer();return(yield WebAssembly.instantiate(C,ee.importObject)).instance})}return te=>be(te)})(le=>S.onmessage({data:le})),_e;S={onmessage:null,postMessage:le=>setTimeout(()=>{try{_e=Z({data:le})}catch(ge){O(ge)}}),terminate(){if(_e)for(let le of _e._scheduledTimeouts.values())clearTimeout(le)}}}let I,z,x=new Promise((Z,_e)=>{I=Z,z=_e});S.onmessage=({data:Z})=>{S.onmessage=({data:_e})=>j(_e),Z?z(Z):I()},S.postMessage(m||new URL(h,location.href).toString());let{readFromStdout:j,service:H}=Qa({writeToStdin(Z){S.postMessage(Z)},isSync:!1,hasFS:!1,esbuild:c});yield x,In=()=>{S.terminate(),dt=void 0,In=void 0,Rn=void 0},Rn={build:Z=>new Promise((_e,le)=>{D.then(le),H.buildOrContext({callName:"build",refs:null,options:Z,isTTY:!1,defaultWD:"/",callback:(ge,be)=>ge?le(ge):_e(be)})}),context:Z=>new Promise((_e,le)=>{D.then(le),H.buildOrContext({callName:"context",refs:null,options:Z,isTTY:!1,defaultWD:"/",callback:(ge,be)=>ge?le(ge):_e(be)})}),transform:(Z,_e)=>new Promise((le,ge)=>{D.then(ge),H.transform({callName:"transform",refs:null,input:Z,options:_e||{},isTTY:!1,fs:{readFile(be,ne){ne(new Error("Internal error"),null)},writeFile(be,ne){ne(null)}},callback:(be,ne)=>be?ge(be):le(ne)})}),formatMessages:(Z,_e)=>new Promise((le,ge)=>{D.then(ge),H.formatMessages({callName:"formatMessages",refs:null,messages:Z,options:_e,callback:(be,ne)=>be?ge(be):le(ne)})}),analyzeMetafile:(Z,_e)=>new Promise((le,ge)=>{D.then(ge),H.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof Z=="string"?Z:JSON.stringify(Z),options:_e,callback:(be,ne)=>be?ge(be):le(ne)})})}}),wo=c})(typeof _s=="object"?_s:{set exports(e){(typeof self<"u"?self:this).esbuild=e}})});import{DEFAULT_OUTPUT as gh,ManifestAssetCatalog as bh,Registry as wh,resolveProjectDocument as yh}from"@motionscript/core";import{AssetManager as Fs,AudioSink as Ro,ClipStore as Co,AssetTimeline as Oo,isFatalRenderIssue as Do,RenderBackendError as Lo,renderIssueKey as Fo,renderSettled as Bo,SETTLE_PASSES as $o,setTheme as Uo,toRenderIssue as No,spansCovering as Bs,StateEvaluator as jo,yieldToScheduler as Wo}from"@motionscript/core";var Dn=class extends Ro{get schedulesAudio(){return!1}has(t){return!0}async append(t,n){}retain(t){}schedule(t){}syncTo(t){}play(t,n,r){}stop(){}};function fr(e,t,n){for(let r of e.takeRenderIssues()){let s=No(r);if(Do(s))throw new Lo(s);let i=Fo(s);t.has(i)||(t.add(i),n?.(s))}}async function $s({renderContext:e,storageAdapter:t},n,r){await Bo(()=>e.execute(n),t,()=>!0)==="exhausted"&&console.warn(`[export] frame ${r} still had pending decodes after ${$o} renders; it may not be exact.`)}function Us(e){let t=e.getDecodePolicy();return e.setDecodePolicy("exact"),()=>e.setDecodePolicy(t)}function Vo(e){let{fps:t,viewport:n}=e;if(t===void 0||n===void 0)throw new Error("Rendering takes a project whose fps and viewport are resolved \u2014 see Session.");return{fps:t,viewport:n}}function zo(e,t){if(!e)return{start:0,end:t};let{start:n,end:r}=e;if(!Number.isInteger(n)||!Number.isInteger(r)||n<0||r<=n||r>t)throw new RangeError(`Frames ${n} to ${r} are not a range inside this timeline's ${t} frames.`);return{start:n,end:r}}function Ns(e){let{project:t,registry:n,assetCatalog:r,renderContext:s}=e,{fps:i,viewport:a}=Vo(t),o=()=>Uo(t.theme??e.theme);o();let l=s,c={registry:n,viewport:a,fps:i,assets:r,measurer:l},u={},f=new Co(t,c,{isReady:_=>u.manager?.isReady(_)??!1}),d=new Oo(t,c,{store:f}),p=new jo(t,c,f);return{store:f,precomper:d,stateEvaluator:p,measurer:l,fps:i,viewport:a,loads:u,applyTheme:o}}async function js(e,t,n){let r=n.flatMap(s=>e.layoutGates(s).filter(i=>!t.isReady(i.src)));r.length>0&&await t.loadRecords(r),e.settleGates(n)}function dr(e){let t=[];for(let n of e.tracks){let r=n.startFrame/e.fps;for(let s of n.audioRequests)t.push({request:s,globalOffset:r})}return t}async function Ot(e){let{scale:t=1,sink:n,mixer:r,onProgress:s,signal:i,includeAudio:a=!0}=e,o=e,{renderContext:l,storageAdapter:c}=o;if(e.project.tracks.length===0)return;i?.throwIfAborted(),l.pixelRatio=t;let{store:u,precomper:f,stateEvaluator:d,measurer:p,fps:_,viewport:w,loads:A,applyTheme:B}=Ns(e),L=Us(c),V=new Set;try{l.takeRenderIssues();let{start:se,end:X}=zo(e.frames,f.result().totalFrames),pe=e.frames?u.spans.filter(de=>de.startFrame<X&&de.endFrame>=se).map(de=>de.id):e.project.tracks.map(de=>de.id);if(e.frames)for(let de of pe)u.discover(de);let ue=e.frames?f.result():f.run(),{totalDuration:q}=ue,ae=X-se;Vs(u,ue,se,X-1);let G=A.manager=new Fs(ue,c,new Dn);await js(u,G,pe);let $=dr(ue),xe=a&&!e.frames&&$.length>0&&r!==void 0;await n.start({width:w.width*t,height:w.height*t,fps:_,totalFrames:ae,hasAudio:xe});let ve=1/_,Me=0;c.setPlaying(!0);try{for(let de=se;de<X;de++){i?.throwIfAborted(),await G.loadAt(de),B(),d.stateAt(de),d.layout(p),await $s(o,()=>d.render(l),de),fr(l,V,e.onIssue),await n.addFrame(Me,ve),Me+=ve;let Ae=de-se+1;s?.(Ae/ae*(xe?.85:1)),(de+1)%4===0&&await Wo()}}finally{c.setPlaying(!1)}if(xe){let de=await r.mix($,q);de!==null&&n.addAudio&&await n.addAudio(de),s?.(.97)}fr(l,V,e.onIssue);let Fe=await n.finalize();return s?.(1),Fe}finally{L(),d.dispose(),u.dispose()}}var Ln=class extends Error{frame;failures;name="NothingToDrawError";constructor(t,n){let r=n.map(s=>` ${s.trackId}: ${s.message}`).join(`
696
696
  `);super(`Frame ${t} has nothing to draw \u2014 every track on it failed to build:
697
- ${r}`),this.frame=t,this.failures=n}};async function Ts(e){let{scale:t=1,frame:n,project:r}=e,s=e,{renderContext:i,storageAdapter:a}=s;if(r.tracks.length===0)throw new Error("The project has no tracks to render.");i.pixelRatio=t;let{store:o,precomper:l,stateEvaluator:c,measurer:u,loads:f}=As(e),d=Ss(a);try{let{totalFrames:_}=l.result(),p=n.kind==="first"?0:n.kind==="last"?_-1:n.frame,w=Math.max(0,Math.min(_-1,Math.floor(p))),R=l.ensureCovering(w);Ps(o,R,w);let L=f.manager=new xs(R,a,new kn);return await Es(o,L,ks(o.spans,w).map(F=>F.id)),await L.loadAt(w),c.stateAt(w),c.layout(u),i.takeRenderIssues(),await Ms(s,()=>c.render(i),w),er(i,new Set,e.onIssue),{frame:w,totalFrames:_}}finally{d(),c.dispose(),o.dispose()}}function Ps(e,t,n,r=n){let s=new Map(t.buildErrors.filter(i=>e.failed(i.trackId)).map(i=>[i.trackId,i]));if(s.size!==0)for(let i=n;i<=r;i++){let a=ks(e.spans,i);if(a.length>0&&a.every(o=>s.has(o.id)))throw new Mn(i,a.map(o=>s.get(o.id)))}}import{CanvasRenderContext2D as wo,Effects as A,StorageAdapter as yo,WGSL_CONTRACT as Is,alignmentOps as vo,cornerRadiusOps as Rs,cornerStyleOps as xo,cylinderRadii as ko,describeEffect as Mo,evaluateParametric as So,evaluateRoundedBox as Ao,fillOps as Eo,forEachTexture3D as To,isStrokeMarker as Dt,isSurfaceTexture3D as Po,isWgslShader as ki,normalizeUniforms as Mi,parseColor as Si,pathOps as Ai,renderIssueKey as Io,resolveAsciiCharset as Ro,resolveCameraPlacement as Co,resolveEffectAxis as vt,resolveEffectColor as xt,resolveMotionBlurAlignment as Oo,resolvePivotPosition as $o,resolveShadowOptions3D as Do,resolveShapeAlignment as Lo,resolveShapePivot as Fo,resolveSurfaceSource as Bo,resolveTexture3D as Ei,resolveVideoTimestamp as Uo,segmentsOf as Cs,shaderContractOf as jo,shadowOps as No,stripShapeAlignmentKeys as Wo,strokeOps as Vo,toPathString as Ti,withEllipseDescriptor as Go,withLineDescriptor as zo,withPathDescriptor as Ho,withPolygonDescriptor as Ko,withPolygramDescriptor as qo,withRectDescriptor as Jo,withRichTextDescriptor as Yo,withTextDescriptor as Pi}from"@motionscript/core";var Os=Object.defineProperty,le=(e,t)=>{let n={};for(var r in e)Os(n,r,{get:e[r],enumerable:!0});return t||Os(n,Symbol.toStringTag,{value:"Module"}),n},Xo=1379091505;function gt(e){if(e===void 0)return{x:0,y:0,z:0};if(typeof e=="number")return{x:e,y:e,z:e};if(Array.isArray(e))return{x:e[0]??0,y:e[1]??0,z:e[2]??0};let t=e;return{x:t.x??0,y:t.y??0,z:t.z??0}}var Zo={XYZ:0,YXZ:1,ZXY:2,ZYX:3,YZX:4,XZY:5},Qo={none:0,linear:1,reinhard:2,cineon:3,aces:4,agx:5,neutral:6},De={box:0,sphere:1,plane:2,cylinder:3,cone:4,torus:5,torusKnot:6,circle:7,ring:8,buffer:9,capsule:10,polyhedron:11,lathe:12,tube:13,edges:14,wireframe:15},el={tetrahedron:0,octahedron:1,icosahedron:2,dodecahedron:3},tl={basic:0,standard:1,physical:2,lambert:3,phong:4,normal:5,points:6,lineBasic:7,lineDashed:8,sprite:9,shadow:10,toon:11,matcap:12,depth:13,shader:14},nl={ambient:0,hemisphere:1,directional:2,point:3,spot:4,area:5},rl={front:0,back:1,both:2},sl={normal:0,additive:1,subtractive:2,multiply:3,none:4},il=["map","gradientMap","alphaMap","aoMap","normalMap","roughnessMap","metalnessMap","emissionMap","envMap","lightMap","displacementMap"],al=class{byKey=new Map;next=1;pending=[];all=new Map;id(e,t){let n=Ei(e),r="src"in n?n.src:n,s=this.byKey.get(r);s||this.byKey.set(r,s=new Map);let i=s.get(t);if(i===void 0){i=this.next++,s.set(t,i);let a={id:i,srgb:t,texture:n};this.pending.push(a),this.all.set(i,a)}return i}},Ii=class{buf=new ArrayBuffer(65536);u32=new Uint32Array(this.buf);f32=new Float32Array(this.buf);n=0;room(e){if(this.n+e<=this.u32.length)return;let t=this.buf.byteLength*2;for(;t/4<this.n+e;)t*=2;let n=new ArrayBuffer(t);new Uint32Array(n).set(this.u32.subarray(0,this.n)),this.buf=n,this.u32=new Uint32Array(n),this.f32=new Float32Array(n)}u(e){this.room(1),this.u32[this.n++]=e>>>0}f(e){this.room(1),this.f32[this.n++]=e===void 0?NaN:e}v3(e){this.f(e.x),this.f(e.y),this.f(e.z)}floats(e){this.room(e.length);for(let t=0;t<e.length;t++)this.f32[this.n++]=e[t]}words(e){this.room(e.length);for(let t=0;t<e.length;t++)this.u32[this.n++]=e[t]>>>0}color(e){if(e===void 0){this.u(0),this.f(0),this.f(0),this.f(0),this.f(0);return}let[t,n,r,s]=typeof e=="string"?Si(e):e;this.u(1),this.f(t),this.f(n),this.f(r),this.f(s??1)}segments(e){if(e===void 0){this.u(0),this.f(NaN),this.f(NaN),this.f(NaN);return}if(typeof e=="number"){this.u(1),this.f(e),this.f(NaN),this.f(NaN);return}this.u(2),this.f(e[0]),this.f(e[1]),this.f(e[2])}result(){return this.u32.slice(0,this.n)}key(e){return Array.prototype.join.call(this.u32.subarray(e,this.n),",")}copy(e){return this.u32.slice(e,this.n)}same(e,t){if(this.n-e!==t.length)return!1;let n=this.u32;for(let r=0;r<t.length;r++)if(n[e+r]!==t[r])return!1;return!0}set(e,t){this.u32[e]=t>>>0}append(e){this.room(e.n),this.u32.set(e.u32.subarray(0,e.n),this.n),this.n+=e.n}};function ze(e,t){if(!t){e.u(0);return}let n=0;if(t.position!==void 0&&(n|=1),t.rotation!==void 0&&(n|=2),t.quaternion!==void 0&&(n|=4),t.scale!==void 0&&(n|=8),t.lookAt!==void 0&&(n|=16),t.visible===!1&&(n|=32),t.shadow!==void 0&&(n|=64),t.renderOrder!==void 0&&(n|=128),e.u(n),n&1&&e.v3(gt(t.position)),n&2&&(e.v3(gt(t.rotation)),e.u(Zo[t.rotation.order??"XYZ"]??0)),n&4){let r=t.quaternion;e.f(r.x),e.f(r.y),e.f(r.z),e.f(r.w)}if(n&8&&e.v3(gt(t.scale)),n&16&&e.v3(gt(t.lookAt)),n&64){let r=t.shadow;e.u(r===!1?0:r===!0?1:r==="cast"?2:r==="receive"?3:4)}n&128&&e.f(t.renderOrder)}function nr(e,t){let n=Math.floor(t.position.length/3),r=(t.normal?1:0)|(t.uv?2:0)|(t.color?4:0)|(t.index?8:0)|(t.computeNormals?16:0);e.u(De.buffer),e.u(r),e.u(n),e.u(t.index?.length??0),e.floats(t.position),t.normal&&e.floats(t.normal),t.uv&&e.floats(t.uv),t.color&&e.floats(t.color),t.index&&e.words(t.index)}function on(e,t,n){switch(t.type){case"box":if((t.cornerRadius??0)>0){let[r,s,i]=Cs(t.segments,[1,1,1]);nr(e,Ao({width:t.width??1,height:t.height??1,depth:t.depth??1,radius:t.cornerRadius,segments:[r,s,i]}));return}e.u(De.box),e.f(t.width),e.f(t.height),e.f(t.depth),e.segments(t.segments);return;case"sphere":e.u(De.sphere),e.f(t.radius),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep),e.f(t.startLatitude),e.f(t.latitudeSweep);return;case"plane":e.u(De.plane),e.f(t.width),e.f(t.height),e.segments(t.segments);return;case"cylinder":{let[r,s]=ko(t.radius);e.u(De.cylinder),e.f(r),e.f(s),e.f(t.height),e.segments(t.segments),e.u(t.capped===!1?0:1),e.f(t.startAngle),e.f(t.sweep);return}case"cone":e.u(De.cone),e.f(t.radius),e.f(t.height),e.segments(t.segments),e.u(t.capped===!1?0:1),e.f(t.startAngle),e.f(t.sweep);return;case"torus":e.u(De.torus),e.f(t.radius),e.f(t.thickness),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"torusKnot":e.u(De.torusKnot),e.f(t.radius),e.f(t.thickness),e.segments(t.segments),e.f(t.windings?.[0]),e.f(t.windings?.[1]);return;case"circle":e.u(De.circle),e.f(t.radius),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"ring":e.u(De.ring),e.f(t.radius),e.f(t.innerRadius),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"buffer":nr(e,t);return;case"parametric":nr(e,So(t));return;case"capsule":e.u(De.capsule),e.f(t.radius),e.f(t.height),e.segments(t.segments);return;case"polyhedron":e.u(De.polyhedron),e.u(el[t.shape??"icosahedron"]??2),e.f(t.radius),e.f(t.segments===void 0?0:Cs(t.segments,[1])[0]);return;case"lathe":e.u(De.lathe),e.u(t.points.length);for(let r of t.points){let s=gt(r);e.f(s.x),e.f(s.y)}e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"tube":e.u(De.tube),e.u(t.points.length);for(let r of t.points)e.v3(gt(r));e.u(t.closed?1:0),e.f(t.radius),e.segments(t.segments);return;case"edges":e.u(De.edges),e.f(t.thresholdAngle),on(e,t.source,n);return;case"wireframe":e.u(De.wireframe),on(e,t.source,n);return;default:n.unsupported.add(`geometry:${t.type}`),e.u(255)}}function Ri(e){switch(e.type){case"buffer":case"parametric":return"slot";case"box":return(e.cornerRadius??0)>0?"rounded":"fixed";case"edges":case"wireframe":return Ri(e.source)==="fixed"?"fixed":"slot";default:return"fixed"}}function Ci(e){let t=e,n=e.type;for(let r of Object.keys(t).sort()){let s=t[r];r==="type"||r==="revision"||r==="staticData"||s===void 0||typeof s=="function"||(r==="source"?n+=`|source=${Ci(s)}`:ArrayBuffer.isView(s)||Array.isArray(s)&&s.length>3?n+=`|${r}#${s.length}`:n+=`|${r}=${typeof s=="object"?JSON.stringify(s):String(s)}`)}return n}function ol(e){return e.type!=="buffer"?[]:[e.position,e.normal,e.uv,e.color,e.index,e.computeNormals]}var ll=class{next=1;byKey=new Map;slots=new Map;live=new Set;nth=new Map;defs=new Ii;count=0;begin(){this.live.clear(),this.nth.clear(),this.defs.n=0,this.count=0}end(e){e.u(this.count),e.append(this.defs);for(let[t,n]of this.byKey)this.live.has(n)||this.byKey.delete(t);for(let[t,n]of this.slots)this.live.has(n.id)||this.slots.delete(t)}ref(e,t,n,r){let s=this.defs,i=Ri(e);if(i!=="slot"){let p;if(i==="rounded"){let F=e;p=`rounded|${F.width}|${F.height}|${F.depth}|${F.cornerRadius}|${JSON.stringify(F.segments)}`;let H=this.byKey.get(p);if(H!==void 0)return this.use(H)}let w=s.n;s.u(0),on(s,e,r),p??=s.key(w+1);let R=this.byKey.get(p);if(R!==void 0)return s.n=w,this.use(R);let L=this.add(w);return this.byKey.set(p,L),L}let a=`${t}|${n}|${Ci(e)}`,o=this.nth.get(a)??0;this.nth.set(a,o+1);let l=`${a}|${o}`,c=this.slots.get(l),u=e.revision,f=ol(e);if(c&&c.revision===u){if(e.type==="parametric"&&u!==void 0)return this.use(c.id);if(e.type==="buffer"&&(u!==void 0||e.staticData===!0)&&f.every((p,w)=>p===c.arrays[w]))return this.use(c.id)}let d=s.n;if(s.u(0),on(s,e,r),c&&s.same(d+1,c.words))return s.n=d,c.revision=u,c.arrays=f,this.use(c.id);let _=this.add(d);return this.slots.set(l,{id:_,revision:u,arrays:f,words:s.copy(d+1)}),_}use(e){return this.live.add(e),e}add(e){let t=this.next++;return this.defs.set(e,t),this.count++,this.use(t)}},$s={clamp:0,repeat:1,mirror:2};function rr(e,t){if(e===void 0)return[t,t];if(Array.isArray(e))return[e[0]??t,e[1]??t];let n=e;return[n.x??t,n.y??t]}function Ds(e,t,n,r){if(t===void 0||!n){t!==void 0&&r.unsupported.add("texture:map"),e.u(0),e.u(0),e.f(1),e.f(0),e.f(0),e.f(0),e.f(1),e.f(0),e.u(0);return}let s=Ei(t),i=s.colorSpace!=="linear";e.u(1),e.u(n.id(t,i));let[a,o]=rr(s.offset,0),[l,c]=rr(s.repeat,1),[u,f]=rr(s.center,0),d=(s.rotation??0)*Math.PI/180,_=Math.cos(d),p=Math.sin(d);e.f(l*_),e.f(l*p),e.f(-l*(_*u+p*f)+u+a),e.f(-c*p),e.f(c*_),e.f(-c*(-p*u+_*f)+f+o);let w=s.flipY??!("data"in s);e.u(($s[s.wrapS??"clamp"]??0)|($s[s.wrapT??"clamp"]??0)<<2|(w?16:0)|(s.magFilter==="nearest"?32:0)|(s.minFilter==="nearest"?64:0))}function Ht(e,t,n,r){let s=t;e.u(tl[t.type]??1),["basic","standard","physical","lambert","phong","normal","lineBasic","lineDashed","sprite","shadow","points","toon","depth"].includes(t.type)||n.unsupported.add(`material:${t.type}`);for(let a of il)a!=="map"&&a!=="gradientMap"&&s[a]!==void 0&&n.unsupported.add(`texture:${a}`);s.gradientMap!==void 0&&t.type!=="toon"&&n.unsupported.add("texture:gradientMap");for(let a of["sheen","iridescence","anisotropy","dispersion"])typeof s[a]=="number"&&s[a]>0&&n.unsupported.add(`physical:${a}`);e.color(s.color),e.f(s.opacity),e.f(s.roughness),e.f(s.metalness),e.color(s.emission),e.f(s.emissionStrength),e.f(s.envMapIntensity);let i=0;s.transparent===!0&&(i|=1),s.wireframe===!0&&(i|=4),s.vertexColors===!0&&(i|=8),s.shading==="flat"&&(i|=16),s.toneMapped===!1&&(i|=32),s.visible===!1&&(i|=64),s.depthTest===!1&&(i|=128),s.depthWrite!==void 0&&(i|=256|(s.depthWrite?512:0)),s.sizeAttenuation===!1&&(i|=1024),e.u(i),e.u(rl[s.faces??"front"]??0),e.u(sl[s.blend??"normal"]??0),e.f(s.alphaTest),e.f(s.size),e.color(s.specular),e.f(s.shininess),Ds(e,s.map,r,n),e.f(s.clearcoat),e.f(s.clearcoatRoughness),e.f(s.transmission),e.f(s.thickness),e.f(s.ior),e.f(s.attenuationDistance),e.color(s.attenuationColor),e.f(s.dashSize),e.f(s.gapSize),e.f(s.scale),Ds(e,t.type==="toon"?s.gradientMap:void 0,r,n)}function cl(e,t,n){let r=t;e.u(nl[t.type]??0),e.color(r.color),e.f(t.intensity),e.color(r.sky),e.color(r.ground),e.f(r.distance),e.f(r.decay),e.f(r.angle),e.f(r.penumbra);let s=r.target;e.u(s===void 0?0:1),e.v3(gt(s));let i=r.shadow,a=i===void 0?null:Do(i);e.u(a?1:0),e.f(a?.softness),e.f(a?.extent),e.f(r.width),e.f(r.height),ze(e,n)}function ul(e,t){e.u(t.type==="orthographic"?1:0);let n=Co(t);ze(e,{...t,position:n.position,lookAt:n.lookAt}),e.f(t.type==="perspective"?t.fov:void 0),e.f(t.zoom),e.f(t.type==="orthographic"?t.frustumHeight:void 0),e.f(t.near),e.f(t.far),e.f(t.distance)}function fl(e,t={unsupported:new Set},n,r){let s=new Ii;r?.begin();let i=[""],a=(d,_)=>{if(!r)return on(s,d,t);s.u(16),s.u(r.ref(d,i[i.length-1],_,t))};s.u(Xo),s.u(3);let o=e.toneSettings();s.u(Qo[o?.mapping??"aces"]??4),s.f(o?.exposure);let l=e.shadowSettings();s.u(l?.enabled===!0?1:0),s.u(l?.quality==="low"?0:l?.quality==="high"?2:1);let c=e.fogDescriptor();s.u(c?c.density!==void 0?2:1:0),s.color(c?.color),s.f(c?.near),s.f(c?.far),s.f(c?.density);let u=e.environmentDescriptor();s.u(u?.preset==="studio"?1:0),s.f(u?.intensity),s.u(u?.background?1:0),s.f(u?.blur),e.postEffects().length>0&&t.unsupported.add("post");let f=e.ops();s.u(f.length);for(let d of f)switch(d.kind){case"push":{let _=d.transform?.key;i.push(_===void 0?`${i[i.length-1]}/${i.length}`:String(_)),s.u(1),ze(s,d.transform);break}case"pop":i.length>1&&i.pop(),s.u(2);break;case"light":s.u(3),cl(s,d.light,d.transform);break;case"camera":s.u(4),ul(s,d.camera);break;case"mesh":{s.u(5),a(d.geometry,d.kind);let _=Array.isArray(d.material)?d.material:[d.material];s.u(Array.isArray(d.material)?_.length:1);for(let p of _)Ht(s,p,t,n);ze(s,d.transform);break}case"instances":{s.u(6),a(d.geometry,d.kind),Ht(s,d.material,t,n),ze(s,d.transform),s.u(d.instances.length);for(let p of d.instances)ze(s,p);let _=d.colors??[];s.u(_.length);for(let p of _){let[w,R,L,F]=typeof p=="string"?Si(p):p;s.f(w),s.f(R),s.f(L),s.f(F??1)}break}case"points":s.u(7),a(d.geometry,d.kind),Ht(s,d.material,t,n),ze(s,d.transform);break;case"line":s.u(8),a(d.geometry,d.kind),Ht(s,d.material,t,n),s.u(d.mode==="segments"?1:d.mode==="loop"?2:0),ze(s,d.transform);break;case"sprite":s.u(9),Ht(s,d.material,t,n),ze(s,d.transform);break;case"model":t.unsupported.add("model"),s.u(10),ze(s,d.transform);break}return r?r.end(s):s.u(0),s.result()}var Pr=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,js.unregister(this),e}free(){let e=this.__destroy_into_raw();y.__wbg_mstext_free(e,0)}glyph_path(e,t,n,r){let s=y.mstext_glyph_path(this.__wbg_ptr,e,t,n,r);var i=mt(s[0],s[1]).slice();return y.__wbindgen_free(s[0],s[1]*4,4),i}layout(e,t,n,r,s,i,a){let o=+r,l=+s,c=+i,u=+a,f,d,_,p,w,R;try{f=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),d=be,_=An(t,y.__wbindgen_malloc),p=be,w=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),R=be}catch(H){throw w&&y.__wbindgen_free(w,R*1,1),_&&y.__wbindgen_free(_,p*4,4),f&&y.__wbindgen_free(f,d*1,1),H}let L=y.mstext_layout(this.__wbg_ptr,f,d,_,p,w,R,o,l,c,u);var F=mt(L[0],L[1]).slice();return y.__wbindgen_free(L[0],L[1]*4,4),F}measure_text(e,t,n,r,s,i){let a=+t,o=+r,l=+s,c=+i,u,f,d,_;try{u=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),f=be,d=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),_=be}catch(R){throw d&&y.__wbindgen_free(d,_*1,1),u&&y.__wbindgen_free(u,f*1,1),R}let p=y.mstext_measure_text(this.__wbg_ptr,u,f,a,d,_,o,l,c);var w=mt(p[0],p[1]).slice();return y.__wbindgen_free(p[0],p[1]*4,4),w}constructor(){let e=y.mstext_new();return this.__wbg_ptr=e,js.register(this,this.__wbg_ptr,this),this}register_font(e,t){let n,r,s,i;try{n=Rr(e,y.__wbindgen_malloc),r=be,s=Oe(t,y.__wbindgen_malloc,y.__wbindgen_realloc),i=be}catch(a){throw s&&y.__wbindgen_free(s,i*1,1),n&&y.__wbindgen_free(n,r*1,1),a}return y.mstext_register_font(this.__wbg_ptr,n,r,s,i)}set_default_fallbacks(e){let t=Ir(e,y.__wbindgen_malloc),n=be;y.mstext_set_default_fallbacks(this.__wbg_ptr,t,n)}set_family_fallbacks(e,t){let n,r,s,i;try{n=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),r=be,s=Ir(t,y.__wbindgen_malloc),i=be}catch(a){throw s&&y.__wbindgen_free(s,i*4,4),n&&y.__wbindgen_free(n,r*1,1),a}y.mstext_set_family_fallbacks(this.__wbg_ptr,n,r,s,i)}text_block(e,t,n,r,s,i,a,o,l,c,u){let f=+r,d=+s,_=+i,p=+a,w=+o,R=+l,L=+c,F=+u,H,se,X,ye,ve,q;try{H=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),se=be,X=An(t,y.__wbindgen_malloc),ye=be,ve=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),q=be}catch(B){throw ve&&y.__wbindgen_free(ve,q*1,1),X&&y.__wbindgen_free(X,ye*4,4),H&&y.__wbindgen_free(H,se*1,1),B}let oe=y.mstext_text_block(this.__wbg_ptr,H,se,X,ye,ve,q,f,d,_,p,w,R,L,F);var K=mt(oe[0],oe[1]).slice();return y.__wbindgen_free(oe[0],oe[1]*4,4),K}text_on_path(e,t,n,r,s,i){let a=+r,o=+s,l,c,u,f,d,_,p,w;try{l=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),c=be,u=An(t,y.__wbindgen_malloc),f=be,d=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),_=be,p=An(i,y.__wbindgen_malloc),w=be}catch(F){throw p&&y.__wbindgen_free(p,w*4,4),d&&y.__wbindgen_free(d,_*1,1),u&&y.__wbindgen_free(u,f*4,4),l&&y.__wbindgen_free(l,c*1,1),F}let R=y.mstext_text_on_path(this.__wbg_ptr,l,c,u,f,d,_,a,o,p,w);var L=mt(R[0],R[1]).slice();return y.__wbindgen_free(R[0],R[1]*4,4),L}};Symbol.dispose&&(Pr.prototype[Symbol.dispose]=Pr.prototype.free);var Lt=class Oi{static __wrap(t){let n=Object.create(Oi.prototype);return n.__wbg_ptr=t,Ns.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Ns.unregister(this),t}free(){let t=this.__destroy_into_raw();y.__wbg_renderer_free(t,0)}adapter_info(){let t,n;try{let r=y.renderer_adapter_info(this.__wbg_ptr);return t=r[0],n=r[1],Se(r[0],r[1])}finally{y.__wbindgen_free(t,n,1)}}apply(t){let n=y.renderer_apply(this.__wbg_ptr,t);if(n[1])throw nt(n[0])}static create(t,n,r){return y.renderer_create(t,n,r)}delta_buffer(t){return y.renderer_delta_buffer(this.__wbg_ptr,t)>>>0}delta_capacity(){return y.renderer_delta_capacity(this.__wbg_ptr)>>>0}effect_names(){let t=y.renderer_effect_names(this.__wbg_ptr);var n=fr(t[0],t[1]);return y.__wbindgen_free(t[0],t[1]*4,4),n}static forget_device(){y.renderer_forget_device()}free_image(t){y.renderer_free_image(this.__wbg_ptr,t)}gpu_device(){return y.renderer_gpu_device(this.__wbg_ptr)}invalidate(){y.renderer_invalidate(this.__wbg_ptr)}measure_text(t,n,r,s,i,a){let o=+n,l=+s,c=+i,u=+a,f,d,_,p;try{f=Oe(t,y.__wbindgen_malloc,y.__wbindgen_realloc),d=be,_=Oe(r,y.__wbindgen_malloc,y.__wbindgen_realloc),p=be}catch(L){throw _&&y.__wbindgen_free(_,p*1,1),f&&y.__wbindgen_free(f,d*1,1),L}let w=y.renderer_measure_text(this.__wbg_ptr,f,d,o,_,p,l,c,u);var R=mt(w[0],w[1]).slice();return y.__wbindgen_free(w[0],w[1]*4,4),R}static prewarm(){return y.renderer_prewarm()}read_pixels(){return y.renderer_read_pixels(this.__wbg_ptr)}register_font(t,n){let r,s,i,a;try{r=Rr(t,y.__wbindgen_malloc),s=be,i=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),a=be}catch(o){throw i&&y.__wbindgen_free(i,a*1,1),r&&y.__wbindgen_free(r,s*1,1),o}return y.renderer_register_font(this.__wbg_ptr,r,s,i,a)}render(){let t=y.renderer_render(this.__wbg_ptr);if(t[1])throw nt(t[0])}resize(t,n){y.renderer_resize(this.__wbg_ptr,t,n)}scene3d_bind(t,n,r,s){y.renderer_scene3d_bind(this.__wbg_ptr,t,n,r,s)}scene3d_pixels(t,n,r,s,i,a){let o=+t,l=+n,c=+s,u=+i,f=+a,d=Rr(r,y.__wbindgen_malloc),_=be;y.renderer_scene3d_pixels(this.__wbg_ptr,o,l,d,_,c,u,f)}scene3d_skipped(t){let n=y.renderer_scene3d_skipped(this.__wbg_ptr,t);var r=fr(n[0],n[1]);return y.__wbindgen_free(n[0],n[1]*4,4),r}set_options(t,n){y.renderer_set_options(this.__wbg_ptr,t,n)}set_scene3d(t,n,r,s){let i=+t,a=+n,o=+r,l=Ir(s,y.__wbindgen_malloc),c=be,u=y.renderer_set_scene3d(this.__wbg_ptr,i,a,o,l,c);if(u[1])throw nt(u[0])}set_surface(t,n,r,s){y.renderer_set_surface(this.__wbg_ptr,t,n,r,s)}shader_add(t,n,r){let s,i;try{let a=+t,o=+n,l=Oe(r,y.__wbindgen_malloc,y.__wbindgen_realloc),c=be,u=y.renderer_shader_add(this.__wbg_ptr,a,o,l,c);return s=u[0],i=u[1],Se(u[0],u[1])}finally{y.__wbindgen_free(s,i,1)}}shader_build(t){y.renderer_shader_build(this.__wbg_ptr,t)}shader_formats(t){let n=y.renderer_shader_formats(this.__wbg_ptr,t);var r=fr(n[0],n[1]);return y.__wbindgen_free(n[0],n[1]*4,4),r}shader_remove(t){y.renderer_shader_remove(this.__wbg_ptr,t)}stats(){let t=y.renderer_stats(this.__wbg_ptr);var n=Fl(t[0],t[1]).slice();return y.__wbindgen_free(t[0],t[1]*8,8),n}text_block_layout(t){let n=y.renderer_text_block_layout(this.__wbg_ptr,t);var r=mt(n[0],n[1]).slice();return y.__wbindgen_free(n[0],n[1]*4,4),r}upload_image(t,n,r){let s=y.renderer_upload_image(this.__wbg_ptr,t,n,r);if(s[1])throw nt(s[0])}wait_gpu(){return y.renderer_wait_gpu(this.__wbg_ptr)}};Symbol.dispose&&(Lt.prototype[Symbol.dispose]=Lt.prototype.free);function dl(e){y.set_panic_listener(Xe(e)?0:He(e))}function hl(e,t){let n,r;try{let s=+e,i=Oe(t,y.__wbindgen_malloc,y.__wbindgen_realloc),a=be,o=y.validate_shader(s,i,a);return n=o[0],r=o[1],Se(o[0],o[1])}finally{y.__wbindgen_free(n,r,1)}}function _l(){return{__proto__:null,"./ms_renderer_bg.js":{__proto__:null,__wbg_Error_208446807d0d1e30:function(e,t){return Error(Se(e,t))},__wbg_Window_2805651c516cb7aa:function(e){return e.Window},__wbg_WorkerGlobalScope_174390815d0a4893:function(e){return e.WorkerGlobalScope},__wbg___wbindgen_debug_string_f249a2a76caa9a55:function(e,t){let n=Oe($i(t),y.__wbindgen_malloc,y.__wbindgen_realloc),r=be;We().setInt32((e>>>0)+4,r,!0),We().setInt32((e>>>0)+0,n,!0)},__wbg___wbindgen_is_function_741ff2bb612836f5:function(e){return typeof e=="function"},__wbg___wbindgen_is_null_c22311b1cc228e3a:function(e){return e===null},__wbg___wbindgen_is_string_fc456fee5d3317de:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_be5b34249ff1fc15:function(e){return e===void 0},__wbg___wbindgen_throw_4c88d8bf264fd984:function(e,t){throw new Error(Se(e,t))},__wbg__wbg_cb_unref_09736879a3f67559:function(e){e._wbg_cb_unref()},__wbg_beginRenderPass_597e3973321fd369:function(){return Re(function(e,t){return e.beginRenderPass(t)},arguments)},__wbg_call_40b008ba32f73991:function(){return Re(function(e,t){return e.call(t)},arguments)},__wbg_call_a410eb4b59ed5965:function(){return Re(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearBuffer_3d5a3057c3c8a9bf:function(e,t,n,r){e.clearBuffer(t,n,r)},__wbg_clearBuffer_82ba999c294f42fb:function(e,t,n){e.clearBuffer(t,n)},__wbg_configure_8e04ab1a867d31e1:function(){return Re(function(e,t){e.configure(t)},arguments)},__wbg_copyExternalImageToTexture_9d1383f644366eae:function(){return Re(function(e,t,n,r){e.copyExternalImageToTexture(t,n,r)},arguments)},__wbg_copyTextureToBuffer_2a1eda98bb347f8c:function(){return Re(function(e,t,n,r){e.copyTextureToBuffer(t,n,r)},arguments)},__wbg_createBindGroupLayout_5699617270d84042:function(){return Re(function(e,t){return e.createBindGroupLayout(t)},arguments)},__wbg_createBindGroup_f539b26ca341308f:function(e,t){return e.createBindGroup(t)},__wbg_createBuffer_b8c5b520d2c822b8:function(){return Re(function(e,t){return e.createBuffer(t)},arguments)},__wbg_createCommandEncoder_3352d1ffc36c6fc0:function(e,t){return e.createCommandEncoder(t)},__wbg_createPipelineLayout_6eab52c327118937:function(e,t){return e.createPipelineLayout(t)},__wbg_createRenderPipeline_58390ba302107691:function(){return Re(function(e,t){return e.createRenderPipeline(t)},arguments)},__wbg_createSampler_9bd91d7e928c0060:function(e,t){return e.createSampler(t)},__wbg_createShaderModule_cefa51336cb288ae:function(e,t){return e.createShaderModule(t)},__wbg_createTexture_2c95e64f50008aea:function(){return Re(function(e,t){return e.createTexture(t)},arguments)},__wbg_createView_96e5e405cc3c01e8:function(){return Re(function(e,t){return e.createView(t)},arguments)},__wbg_description_7a568e202a00293f:function(e,t){let n=t.description,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=be;We().setInt32((e>>>0)+4,s,!0),We().setInt32((e>>>0)+0,r,!0)},__wbg_destroy_249478e98a7943d5:function(e){e.destroy()},__wbg_destroy_637537007d9eaa44:function(e){e.destroy()},__wbg_displayHeight_fb2700c23cca6739:function(e){return e.displayHeight},__wbg_displayWidth_9e9d6031a3036613:function(e){return e.displayWidth},__wbg_document_3b5c3071b43e97ee:function(e){let t=e.document;return Xe(t)?0:He(t)},__wbg_drawIndexed_638959aae942557c:function(e,t,n,r,s,i){e.drawIndexed(t>>>0,n>>>0,r>>>0,s,i>>>0)},__wbg_draw_086a9578fc9898c2:function(e,t,n,r,s){e.draw(t>>>0,n>>>0,r>>>0,s>>>0)},__wbg_end_b57473834b877409:function(e){e.end()},__wbg_error_757e9472f8410341:function(e,t){let n,r;try{n=e,r=t,console.error(Se(e,t))}finally{y.__wbindgen_free(n,r,1)}},__wbg_finish_09ec094c10f41e7b:function(e){return e.finish()},__wbg_finish_ec1c191f66a895b1:function(e,t){return e.finish(t)},__wbg_getContext_1938edb9a972f63d:function(){return Re(function(e,t,n){let r=e.getContext(Se(t,n));return Xe(r)?0:He(r)},arguments)},__wbg_getContext_d93f904b714852ae:function(){return Re(function(e,t,n){let r=e.getContext(Se(t,n));return Xe(r)?0:He(r)},arguments)},__wbg_getCurrentTexture_c3b1727224d7f6e6:function(){return Re(function(e){return e.getCurrentTexture()},arguments)},__wbg_getMappedRange_28e816a763520e01:function(){return Re(function(e,t,n){return e.getMappedRange(t,n)},arguments)},__wbg_getPreferredCanvasFormat_0ef5034c8902201b:function(e){let t=e.getPreferredCanvasFormat();return(ut.indexOf(t)+1||102)-1},__wbg_get_0c55869fe53c7d14:function(e,t){let n=e[t>>>0];return Xe(n)?0:He(n)},__wbg_gpu_514705c6dd1f0dab:function(e){return e.gpu},__wbg_height_a587c99454238459:function(e){return e.height},__wbg_height_a6466ebf29036658:function(e){return e.height},__wbg_height_ac6f1c3f49c13fe2:function(e){return e.height},__wbg_info_8554cb7af37427b6:function(e){return e.info},__wbg_instanceof_HtmlCanvasElement_89f280683e987b9e:function(e){let t;try{t=e instanceof HTMLCanvasElement}catch{t=!1}return t},__wbg_instanceof_HtmlImageElement_f22acd64d72ae23a:function(e){let t;try{t=e instanceof HTMLImageElement}catch{t=!1}return t},__wbg_instanceof_HtmlVideoElement_64f13b58baf30810:function(e){let t;try{t=e instanceof HTMLVideoElement}catch{t=!1}return t},__wbg_instanceof_ImageBitmap_536fdba57df2c6ac:function(e){let t;try{t=e instanceof ImageBitmap}catch{t=!1}return t},__wbg_instanceof_OffscreenCanvas_fcf6ec01367f54ec:function(e){let t;try{t=e instanceof OffscreenCanvas}catch{t=!1}return t},__wbg_instanceof_VideoFrame_cd5d3aac6098cfc2:function(e){let t;try{t=e instanceof VideoFrame}catch{t=!1}return t},__wbg_instanceof_Window_5cf453f5639aa1a2:function(e){let t;try{t=e instanceof Window}catch{t=!1}return t},__wbg_isFallbackAdapter_6a4fa7356d18310b:function(e){return e.isFallbackAdapter},__wbg_label_fceb40a43a358e62:function(e,t){let n=t.label,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=be;We().setInt32((e>>>0)+4,s,!0),We().setInt32((e>>>0)+0,r,!0)},__wbg_length_186163212ffe79c3:function(e){return e.length},__wbg_limits_4e444eb8c2e61c45:function(e){return e.limits},__wbg_limits_98515cc885d709ef:function(e){return e.limits},__wbg_lost_25273dba897db03c:function(e){return e.lost},__wbg_mapAsync_b0597127f5037286:function(e,t,n,r){return e.mapAsync(t>>>0,n,r)},__wbg_maxBindGroupsPlusVertexBuffers_1face4afb5363937:function(e){return e.maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_a0b7e55762f095b9:function(e){return e.maxBindGroups},__wbg_maxBindingsPerBindGroup_ec9067be38d6ec72:function(e){return e.maxBindingsPerBindGroup},__wbg_maxBufferSize_a9ce15e541c64cd2:function(e){return e.maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_44089e129e1a2a1d:function(e){return e.maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_6bd8156394ba618c:function(e){return e.maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_7b086f15ef868934:function(e){return e.maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_8bbe505e0ac8dc18:function(e){return e.maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_7228ed3935eecc31:function(e){return e.maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_6092b56a967f6f8d:function(e){return e.maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_4773e3bd3936df36:function(e){return e.maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_79222bf8e8a90fbd:function(e){return e.maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_3ab5762b1b2c7fc2:function(e){return e.maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_722da31d0de1c256:function(e){return e.maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_821096d4b3020715:function(e){return e.maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_c6aea9e05c0a02ca:function(e){return e.maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_3aa30f6c002d3a99:function(e){return e.maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_84a2c2433627fca2:function(e){return e.maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_25b96748df28dc20:function(e){return e.maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_53ed734f26e6c1ad:function(e){return e.maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_9ec487f1ce102992:function(e){return e.maxTextureArrayLayers},__wbg_maxTextureDimension1D_faef91b2e9fa6740:function(e){return e.maxTextureDimension1D},__wbg_maxTextureDimension2D_3a923eb2df4d9124:function(e){return e.maxTextureDimension2D},__wbg_maxTextureDimension3D_943321fe5945464e:function(e){return e.maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_21e89ff761d576db:function(e){return e.maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_19a0bfb0189f7254:function(e){return e.maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_49aef6c51d07a280:function(e){return e.maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f68c4029e6f047ec:function(e){return e.maxVertexBufferArrayStride},__wbg_maxVertexBuffers_ce9f15a623f9aac7:function(e){return e.maxVertexBuffers},__wbg_message_5223ba7df7256eac:function(e,t){let n=t.message,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=be;We().setInt32((e>>>0)+4,s,!0),We().setInt32((e>>>0)+0,r,!0)},__wbg_minStorageBufferOffsetAlignment_529f1f52e61188fc:function(e){return e.minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_519e26287e1996a3:function(e){return e.minUniformBufferOffsetAlignment},__wbg_naturalHeight_fb7d27a9642e796c:function(e){return e.naturalHeight},__wbg_naturalWidth_c3b5a9ac32cd185e:function(e){return e.naturalWidth},__wbg_navigator_9641ab32fa612dd1:function(e){return e.navigator},__wbg_navigator_c17f443a6fe5d38d:function(e){return e.navigator},__wbg_new_2bfd0f45e60518b1:function(){return Re(function(e,t){return new OffscreenCanvas(e>>>0,t>>>0)},arguments)},__wbg_new_ba40181b3f24ac80:function(e,t){try{var n={a:e,b:t},r=(s,i)=>{let a=n.a;n.a=0;try{return Ls(a,n.b,s,i)}finally{n.a=a}};return new Promise(r)}finally{n.a=0}},__wbg_new_bb74001155cb8ca8:function(){return new Error},__wbg_new_cd4348290afae586:function(){return new Object},__wbg_new_typed_6b60b99917da27d6:function(){return new Object},__wbg_new_typed_e09da9dae6ee5935:function(e,t){try{var n={a:e,b:t},r=(s,i)=>{let a=n.a;n.a=0;try{return Ls(a,n.b,s,i)}finally{n.a=a}};return new Promise(r)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_3cd32055a417f095:function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},__wbg_new_with_length_01b143a7e5dd5a3e:function(e){return new Uint8Array(e>>>0)},__wbg_now_84237b99fa85a391:function(){return performance.now()},__wbg_onSubmittedWorkDone_1190213cee1ecf7e:function(e){return e.onSubmittedWorkDone()},__wbg_prototypesetcall_13162965d1fe7aa3:function(e,t,n){Uint8Array.prototype.set.call(Kt(e,t),n)},__wbg_querySelectorAll_6c1bd81d448fb480:function(){return Re(function(e,t,n){return e.querySelectorAll(Se(t,n))},arguments)},__wbg_queueMicrotask_1e8503a8a690f0a3:function(e){return e.queueMicrotask},__wbg_queueMicrotask_4a1a4d8dd332373b:function(e){queueMicrotask(e)},__wbg_queue_e250e2ebc49b39e0:function(e){return e.queue},__wbg_reason_53e762e714b67b72:function(e){let t=e.reason;return(Al.indexOf(t)+1||3)-1},__wbg_renderer_new:function(e){return Lt.__wrap(e)},__wbg_requestAdapter_a539af006419f2e9:function(e,t){return e.requestAdapter(t)},__wbg_requestDevice_5cb8a582e55d08cb:function(e,t){return e.requestDevice(t)},__wbg_resolve_dbf78ab4942478b0:function(e){return Promise.resolve(e)},__wbg_setBindGroup_418c3e0eb6943ce0:function(e,t,n){e.setBindGroup(t>>>0,n)},__wbg_setBindGroup_82d014e8f799f053:function(){return Re(function(e,t,n,r,s,i,a){e.setBindGroup(t>>>0,n,Bl(r,s),i,a>>>0)},arguments)},__wbg_setIndexBuffer_241097e303986c14:function(e,t,n,r,s){e.setIndexBuffer(t,Us[n],r,s)},__wbg_setPipeline_b6f981027e02cd16:function(e,t){e.setPipeline(t)},__wbg_setScissorRect_889235eeb784732b:function(e,t,n,r,s){e.setScissorRect(t>>>0,n>>>0,r>>>0,s>>>0)},__wbg_setVertexBuffer_6db3b60e99280744:function(e,t,n,r){e.setVertexBuffer(t>>>0,n,r)},__wbg_setVertexBuffer_cbf4ca1627c02f4c:function(e,t,n,r,s){e.setVertexBuffer(t>>>0,n,r,s)},__wbg_setViewport_c0be08dcc8965ccf:function(e,t,n,r,s,i,a){e.setViewport(t,n,r,s,i,a)},__wbg_set_118fefd528ab0a79:function(e,t,n){e.set(t,n>>>0)},__wbg_set_2793479888329cb6:function(){return Re(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_a_1c94f1413a06c773:function(e,t){e.a=t},__wbg_set_access_b0a6fbebfbe53242:function(e,t){e.access=Cl[t]},__wbg_set_address_mode_u_a39aefdf030758ae:function(e,t){e.addressModeU=sr[t]},__wbg_set_address_mode_v_999ec6ed4d587e8c:function(e,t){e.addressModeV=sr[t]},__wbg_set_address_mode_w_a936c884ccf08234:function(e,t){e.addressModeW=sr[t]},__wbg_set_alpha_84214d12347c6647:function(e,t){e.alpha=t},__wbg_set_alpha_mode_278c6649365aff36:function(e,t){e.alphaMode=kl[t]},__wbg_set_alpha_to_coverage_enabled_1e879520cab4bb05:function(e,t){e.alphaToCoverageEnabled=t!==0},__wbg_set_array_layer_count_bd7a074559a0abaa:function(e,t){e.arrayLayerCount=t>>>0},__wbg_set_array_stride_f64_b132c6a79afeae43:function(e,t){e.arrayStride=t},__wbg_set_aspect_1db857832468d61f:function(e,t){e.aspect=cr[t]},__wbg_set_aspect_3b0dceed92671cc1:function(e,t){e.aspect=cr[t]},__wbg_set_aspect_8c866a3891032753:function(e,t){e.aspect=cr[t]},__wbg_set_attributes_67bbc44b08e038d6:function(e,t,n){e.attributes=Ve(t,n)},__wbg_set_b_a93bcfdd1c29a0bd:function(e,t){e.b=t},__wbg_set_base_array_layer_e745f84c2e5437e2:function(e,t){e.baseArrayLayer=t>>>0},__wbg_set_base_mip_level_fe08854fab09de85:function(e,t){e.baseMipLevel=t>>>0},__wbg_set_beginning_of_pass_write_index_a13b608f19d6a2f0:function(e,t){e.beginningOfPassWriteIndex=t>>>0},__wbg_set_bind_group_layouts_383f681565a30d8a:function(e,t,n){e.bindGroupLayouts=Ve(t,n)},__wbg_set_binding_bd7d6b01bb08823a:function(e,t){e.binding=t>>>0},__wbg_set_binding_dbed4a234264971a:function(e,t){e.binding=t>>>0},__wbg_set_blend_1f3e5b36f9c246cb:function(e,t){e.blend=t},__wbg_set_buffer_292fb3c30928dc50:function(e,t){e.buffer=t},__wbg_set_buffer_76841cdbff393f1d:function(e,t){e.buffer=t},__wbg_set_buffer_91f4e8e05066c37a:function(e,t){e.buffer=t},__wbg_set_buffers_47665c552e27672c:function(e,t,n){e.buffers=Ve(t,n)},__wbg_set_bytes_per_row_4ef9c2c51932b041:function(e,t){e.bytesPerRow=t>>>0},__wbg_set_bytes_per_row_75441352f606ebc8:function(e,t){e.bytesPerRow=t>>>0},__wbg_set_clear_value_gpu_color_dict_303e0009591e5d26:function(e,t){e.clearValue=t},__wbg_set_code_130aebc49c4cadd3:function(e,t,n){e.code=Se(t,n)},__wbg_set_color_6d2de56a2224ec57:function(e,t){e.color=t},__wbg_set_color_attachments_e83f79badceda8b4:function(e,t,n){e.colorAttachments=Ve(t,n)},__wbg_set_compare_159af15eb77dbcd2:function(e,t){e.compare=ir[t]},__wbg_set_compare_4db27ced1edc0322:function(e,t){e.compare=ir[t]},__wbg_set_count_4d1e9559a7f1b993:function(e,t){e.count=t>>>0},__wbg_set_cull_mode_31293d13bc064271:function(e,t){e.cullMode=Sl[t]},__wbg_set_depth_bias_b30728f3ab3f643e:function(e,t){e.depthBias=t},__wbg_set_depth_bias_clamp_5b58fd4819283038:function(e,t){e.depthBiasClamp=t},__wbg_set_depth_bias_slope_scale_8b8b20db6b43c43b:function(e,t){e.depthBiasSlopeScale=t},__wbg_set_depth_clear_value_1165941523836019:function(e,t){e.depthClearValue=t},__wbg_set_depth_compare_81dd71de7e433cc2:function(e,t){e.depthCompare=ir[t]},__wbg_set_depth_fail_op_ddf822c573cdf0c1:function(e,t){e.depthFailOp=or[t]},__wbg_set_depth_load_op_ca270acab0c1ca69:function(e,t){e.depthLoadOp=ar[t]},__wbg_set_depth_or_array_layers_e59f3988a095ccac:function(e,t){e.depthOrArrayLayers=t>>>0},__wbg_set_depth_read_only_49ca399f98b97955:function(e,t){e.depthReadOnly=t!==0},__wbg_set_depth_stencil_41e94739225cb2c3:function(e,t){e.depthStencil=t},__wbg_set_depth_stencil_attachment_36ce3695dfcb6b85:function(e,t){e.depthStencilAttachment=t},__wbg_set_depth_store_op_6cd6bdde49f9050d:function(e,t){e.depthStoreOp=lr[t]},__wbg_set_depth_write_enabled_4b5da11c77fbdab7:function(e,t){e.depthWriteEnabled=t!==0},__wbg_set_device_1940fd5f9e2a7fee:function(e,t){e.device=t},__wbg_set_dimension_88d0c9f16bb079fb:function(e,t){e.dimension=Ol[t]},__wbg_set_dimension_bab9530fa3e311d8:function(e,t){e.dimension=ur[t]},__wbg_set_dst_factor_80c13f29a3e117cb:function(e,t){e.dstFactor=Fs[t]},__wbg_set_end_of_pass_write_index_793fcfe3141dc357:function(e,t){e.endOfPassWriteIndex=t>>>0},__wbg_set_entries_552f52b2aa3b346d:function(e,t,n){e.entries=Ve(t,n)},__wbg_set_entries_d9929dbfa2aaa9a7:function(e,t,n){e.entries=Ve(t,n)},__wbg_set_entry_point_0eacf7b26b3637b0:function(e,t,n){e.entryPoint=Se(t,n)},__wbg_set_entry_point_bb3692db4a6065d0:function(e,t,n){e.entryPoint=Se(t,n)},__wbg_set_external_texture_1bef5ba626275d0a:function(e,t){e.externalTexture=t},__wbg_set_fail_op_739cc3815d38c95f:function(e,t){e.failOp=or[t]},__wbg_set_feb3714f475485ba:function(e,t,n){e.set(Kt(t,n))},__wbg_set_flip_y_ab62f34abbe69be1:function(e,t){e.flipY=t!==0},__wbg_set_format_1119b9930bd324e1:function(e,t){e.format=ut[t]},__wbg_set_format_443ea19e2d25a1e2:function(e,t){e.format=ut[t]},__wbg_set_format_459792306baadae5:function(e,t){e.format=ut[t]},__wbg_set_format_46b1c6b3acc10b24:function(e,t){e.format=ut[t]},__wbg_set_format_5a62f31a4690f935:function(e,t){e.format=Dl[t]},__wbg_set_format_efec4f7d9471ddbb:function(e,t){e.format=ut[t]},__wbg_set_format_fd579d96fa4e468c:function(e,t){e.format=ut[t]},__wbg_set_fragment_bea523f8973c326e:function(e,t){e.fragment=t},__wbg_set_front_face_30951d0404e9e6d4:function(e,t){e.frontFace=El[t]},__wbg_set_g_90eacc6608e549f8:function(e,t){e.g=t},__wbg_set_has_dynamic_offset_6e5f3385eb579529:function(e,t){e.hasDynamicOffset=t!==0},__wbg_set_height_3f64e19acf29f5fb:function(e,t){e.height=t>>>0},__wbg_set_height_ae0610d318c3428c:function(e,t){e.height=t>>>0},__wbg_set_height_ae24c2f7d580ae0a:function(e,t){e.height=t>>>0},__wbg_set_label_08745022b1ec7b66:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_11c9eb57693a8459:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_20c42b4ebeb250d5:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_22e3966c8d513ba6:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_5347fc976d15e94c:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_644bc1b32c7917b0:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_73c99dab6708c962:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_85a21b5fdd57fd91:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_89d2ffaf598df6a4:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_9e68078b9533426b:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_a80ced9a51c33d0f:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_cba03ffef7ae90a3:function(e,t,n){e.label=Se(t,n)},__wbg_set_label_f654bcb731d4d9ca:function(e,t,n){e.label=Se(t,n)},__wbg_set_layout_200fc3b143da0a9e:function(e,t){e.layout=t},__wbg_set_layout_3f0cb99635c33123:function(e,t){e.layout=t},__wbg_set_layout_gpu_auto_layout_mode_2e8a53f8643b4f69:function(e,t){e.layout=yl[t]},__wbg_set_load_op_e8c33d4bdd2772aa:function(e,t){e.loadOp=ar[t]},__wbg_set_lod_max_clamp_fcbef26e87120fac:function(e,t){e.lodMaxClamp=t},__wbg_set_lod_min_clamp_f5b6ddca1e4d813f:function(e,t){e.lodMinClamp=t},__wbg_set_mag_filter_ba0a2f25ad41eea8:function(e,t){e.magFilter=Bs[t]},__wbg_set_mapped_at_creation_8af5b87ccb898bbe:function(e,t){e.mappedAtCreation=t!==0},__wbg_set_mask_0de0e782abec3c25:function(e,t){e.mask=t>>>0},__wbg_set_max_anisotropy_8361213d3df93532:function(e,t){e.maxAnisotropy=t},__wbg_set_min_binding_size_f64_c6d68d773b7051d3:function(e,t){e.minBindingSize=t},__wbg_set_min_filter_8aa8b0f7523a0281:function(e,t){e.minFilter=Bs[t]},__wbg_set_mip_level_102afeb158e4f728:function(e,t){e.mipLevel=t>>>0},__wbg_set_mip_level_count_c0ac46de264d83ec:function(e,t){e.mipLevelCount=t>>>0},__wbg_set_mip_level_count_cd650972803ed9eb:function(e,t){e.mipLevelCount=t>>>0},__wbg_set_mip_level_f0c5ed95eedda453:function(e,t){e.mipLevel=t>>>0},__wbg_set_mipmap_filter_1cbdec28d1b54d9d:function(e,t){e.mipmapFilter=Tl[t]},__wbg_set_mode_51d2c5a5ac0f7ac9:function(e,t){e.mode=Ml[t]},__wbg_set_module_3dec1a50bca7870a:function(e,t){e.module=t},__wbg_set_module_b42baf3925e2a94a:function(e,t){e.module=t},__wbg_set_multisample_6af76792fae6efb1:function(e,t){e.multisample=t},__wbg_set_multisampled_ae3f9f01a324f57c:function(e,t){e.multisampled=t!==0},__wbg_set_offset_f64_15176b737de7dde0:function(e,t){e.offset=t},__wbg_set_offset_f64_18de9c771f307302:function(e,t){e.offset=t},__wbg_set_offset_f64_52f728fc5c98a52c:function(e,t){e.offset=t},__wbg_set_offset_f64_9374d9e912985773:function(e,t){e.offset=t},__wbg_set_operation_e103287df7ac9cf6:function(e,t){e.operation=vl[t]},__wbg_set_origin_gpu_origin_2d_dict_0e541bd50713ae04:function(e,t){e.origin=t},__wbg_set_origin_gpu_origin_3d_dict_26016670147a706c:function(e,t){e.origin=t},__wbg_set_origin_gpu_origin_3d_dict_4e6802818d9d43c7:function(e,t){e.origin=t},__wbg_set_pass_op_4d08c3105f64a17a:function(e,t){e.passOp=or[t]},__wbg_set_power_preference_6bc1d2697a0e7374:function(e,t){e.powerPreference=Pl[t]},__wbg_set_premultiplied_alpha_3625f78af5f2fed6:function(e,t){e.premultipliedAlpha=t!==0},__wbg_set_primitive_ef867d733c4efb1c:function(e,t){e.primitive=t},__wbg_set_query_set_765c4c9ab99342cb:function(e,t){e.querySet=t},__wbg_set_r_1116d6a5f656263d:function(e,t){e.r=t},__wbg_set_required_features_5bda1420e19461b2:function(e,t,n){e.requiredFeatures=Ve(t,n)},__wbg_set_required_limits_e78b923d73f9b596:function(e,t){e.requiredLimits=t},__wbg_set_resolve_target_gpu_texture_view_a7a97a7c04d84698:function(e,t){e.resolveTarget=t},__wbg_set_resource_0f960a4279e7e400:function(e,t){e.resource=t},__wbg_set_resource_gpu_buffer_binding_53a2189a77dd38be:function(e,t){e.resource=t},__wbg_set_resource_gpu_texture_view_9153a2356b958667:function(e,t){e.resource=t},__wbg_set_rows_per_image_11e9552fb5c5c5ab:function(e,t){e.rowsPerImage=t>>>0},__wbg_set_rows_per_image_df6af33a5492c1cf:function(e,t){e.rowsPerImage=t>>>0},__wbg_set_sample_count_8262aacc91878e4d:function(e,t){e.sampleCount=t>>>0},__wbg_set_sample_type_563589178fc892fe:function(e,t){e.sampleType=$l[t]},__wbg_set_sampler_ccdca76ef8e642ca:function(e,t){e.sampler=t},__wbg_set_shader_location_31dc427c303a32aa:function(e,t){e.shaderLocation=t>>>0},__wbg_set_size_f64_3ff72c0d736c42a1:function(e,t){e.size=t},__wbg_set_size_f64_9b65e4916b2eb111:function(e,t){e.size=t},__wbg_set_size_gpu_extent_3d_dict_bba6669c79c26190:function(e,t){e.size=t},__wbg_set_source_b5f82926b86ec9d9:function(e,t){e.source=t},__wbg_set_source_html_canvas_element_a9840c24a328a44e:function(e,t){e.source=t},__wbg_set_source_html_image_element_b2803013cdaaa4f6:function(e,t){e.source=t},__wbg_set_source_html_video_element_9fd22376f74c9aff:function(e,t){e.source=t},__wbg_set_source_image_data_2d6a4979315db9d8:function(e,t){e.source=t},__wbg_set_source_offscreen_canvas_ef8e002b1f9c1fd8:function(e,t){e.source=t},__wbg_set_source_video_frame_e98ea9a6467ae147:function(e,t){e.source=t},__wbg_set_src_factor_7e90d4b7d8227fc5:function(e,t){e.srcFactor=Fs[t]},__wbg_set_stencil_back_6b5aeefbb90ae3ae:function(e,t){e.stencilBack=t},__wbg_set_stencil_clear_value_56fa848198a9b430:function(e,t){e.stencilClearValue=t>>>0},__wbg_set_stencil_front_4ffeca9473bca095:function(e,t){e.stencilFront=t},__wbg_set_stencil_load_op_b7a9fe3ad789b6c6:function(e,t){e.stencilLoadOp=ar[t]},__wbg_set_stencil_read_mask_7cfe0945679de134:function(e,t){e.stencilReadMask=t>>>0},__wbg_set_stencil_read_only_0dde0c073192b5fa:function(e,t){e.stencilReadOnly=t!==0},__wbg_set_stencil_store_op_d320bcbb72456a4c:function(e,t){e.stencilStoreOp=lr[t]},__wbg_set_stencil_write_mask_765017d5830ee98a:function(e,t){e.stencilWriteMask=t>>>0},__wbg_set_step_mode_2b1318f00e2ddc02:function(e,t){e.stepMode=Ll[t]},__wbg_set_storage_texture_b9e95e260c9d49a3:function(e,t){e.storageTexture=t},__wbg_set_store_op_e2b740eddfd2713f:function(e,t){e.storeOp=lr[t]},__wbg_set_strip_index_format_22ddab1b8f352c1d:function(e,t){e.stripIndexFormat=Us[t]},__wbg_set_targets_07e15f3cca640faf:function(e,t,n){e.targets=Ve(t,n)},__wbg_set_texture_7b9ace323bfe7938:function(e,t){e.texture=t},__wbg_set_texture_84a5f84f0f451291:function(e,t){e.texture=t},__wbg_set_texture_b35a4d6a35c491fa:function(e,t){e.texture=t},__wbg_set_timestamp_writes_1d304b9eb09ff227:function(e,t){e.timestampWrites=t},__wbg_set_tone_mapping_23fcd4f846a61048:function(e,t){e.toneMapping=t},__wbg_set_topology_b29804e5549370f5:function(e,t){e.topology=Il[t]},__wbg_set_type_ac87cc570da17000:function(e,t){e.type=xl[t]},__wbg_set_type_f3d1ad35dc7889f9:function(e,t){e.type=Rl[t]},__wbg_set_unclipped_depth_59155eb615f193fe:function(e,t){e.unclippedDepth=t!==0},__wbg_set_usage_5ba672bf81ba9859:function(e,t){e.usage=t>>>0},__wbg_set_usage_b0070c2ce47149a6:function(e,t){e.usage=t>>>0},__wbg_set_usage_bac3cabe90090275:function(e,t){e.usage=t>>>0},__wbg_set_usage_f3e1a48118ff483a:function(e,t){e.usage=t>>>0},__wbg_set_vertex_00b1e17dc3fe7fb3:function(e,t){e.vertex=t},__wbg_set_view_dimension_e9e9cd07d7ad686d:function(e,t){e.viewDimension=ur[t]},__wbg_set_view_dimension_eb197c35c45e572c:function(e,t){e.viewDimension=ur[t]},__wbg_set_view_formats_2540cdb8dde31055:function(e,t,n){e.viewFormats=Ve(t,n)},__wbg_set_view_formats_845b425c1d19e1af:function(e,t,n){e.viewFormats=Ve(t,n)},__wbg_set_view_gpu_texture_view_9a3c34ba4d1969b8:function(e,t){e.view=t},__wbg_set_view_gpu_texture_view_efa644c1ce3c4deb:function(e,t){e.view=t},__wbg_set_visibility_65413465e7b24eb6:function(e,t){e.visibility=t>>>0},__wbg_set_width_5f89a551b5472887:function(e,t){e.width=t>>>0},__wbg_set_width_a2410cafbdefeb5a:function(e,t){e.width=t>>>0},__wbg_set_width_eb3001e1dcabb909:function(e,t){e.width=t>>>0},__wbg_set_write_mask_39ce121635fd4296:function(e,t){e.writeMask=t>>>0},__wbg_set_x_b078c58009aa57bd:function(e,t){e.x=t>>>0},__wbg_set_x_d851b2611b154969:function(e,t){e.x=t>>>0},__wbg_set_y_3df92c4bcff23616:function(e,t){e.y=t>>>0},__wbg_set_y_76a6f85fc60d74e5:function(e,t){e.y=t>>>0},__wbg_set_z_3633c53887a9ff5e:function(e,t){e.z=t>>>0},__wbg_stack_575c4e0918581b9c:function(e,t){let n=t.stack,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=be;We().setInt32((e>>>0)+4,s,!0),We().setInt32((e>>>0)+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc:function(){let e=typeof globalThis>"u"?void 0:globalThis;return Xe(e)?0:He(e)},__wbg_static_accessor_GLOBAL_e4293fb22cbe77da:function(){let e=typeof global>"u"?void 0:global;return Xe(e)?0:He(e)},__wbg_static_accessor_SELF_53bb20457401453d:function(){let e=typeof self>"u"?void 0:self;return Xe(e)?0:He(e)},__wbg_static_accessor_WINDOW_b5e0810bfecb7feb:function(){let e=typeof window>"u"?void 0:window;return Xe(e)?0:He(e)},__wbg_subgroupMaxSize_3586e822dc3603f6:function(e){return e.subgroupMaxSize},__wbg_subgroupMinSize_17f758985cdd1dab:function(e){return e.subgroupMinSize},__wbg_submit_077c85cc28e36892:function(e,t,n){e.submit(Ve(t,n))},__wbg_then_3a4f899454bcf8c9:function(e,t){return e.then(t)},__wbg_then_656f253a5dd7d8ea:function(e,t,n){return e.then(t,n)},__wbg_then_e3f7f2d365708be8:function(e,t){return e.then(t)},__wbg_unconfigure_835307f58dc68d80:function(e){e.unconfigure()},__wbg_unmap_6a96b14c9ef5f7f5:function(e){e.unmap()},__wbg_videoHeight_0d108b7f03cde4ef:function(e){return e.videoHeight},__wbg_videoWidth_34b4e257cb35c6ca:function(e){return e.videoWidth},__wbg_width_000813f5f73b7341:function(e){return e.width},__wbg_width_babc5dc7654771b1:function(e){return e.width},__wbg_width_f84552448726a9a9:function(e){return e.width},__wbg_writeBuffer_d7640e64ceb69371:function(){return Re(function(e,t,n,r,s,i,a){e.writeBuffer(t,n,Kt(r,s),i,a)},arguments)},__wbg_writeTexture_dba1e801af087dfd:function(){return Re(function(e,t,n,r,s,i){e.writeTexture(t,Kt(n,r),s,i)},arguments)},__wbindgen_generic_0000000000000001:function(e,t){return qt(e,t,ml)},__wbindgen_generic_0000000000000002:function(e,t){return qt(e,t,gl)},__wbindgen_generic_0000000000000003:function(e,t){return qt(e,t,pl)},__wbindgen_generic_0000000000000004:function(e,t){return qt(e,t,bl)},__wbindgen_generic_0000000000000005:function(e,t){return qt(e,t,wl)},__wbindgen_generic_0000000000000006:function(e){return e},__wbindgen_generic_0000000000000007:function(e,t){return Kt(e,t)},__wbindgen_generic_0000000000000008:function(e,t){return Se(e,t)},__wbindgen_init_externref_table:function(){let e=y.__wbindgen_externrefs;e.set(0,void 0),e.set(1024,void 0),e.set(1025,null),e.set(1026,!0),e.set(1027,!1)}}}}function pl(e,t,n){y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_(e,t,n)}function ml(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true_(e,t,n);if(r[1])throw nt(r[0])}function gl(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___sys__JsNullable_wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true_(e,t,n);if(r[1])throw nt(r[0])}function bl(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___sys__JsNullable_wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true__46(e,t,n);if(r[1])throw nt(r[0])}function wl(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___sys__JsNullable_wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true__47(e,t,n);if(r[1])throw nt(r[0])}function Ls(e,t,n,r){y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___js_sys_aa8f45fc28b2b0aa___Function_fn_wasm_bindgen_5bb76fec55d7fe60___JsValue_____wasm_bindgen_5bb76fec55d7fe60___sys__Undefined___js_sys_aa8f45fc28b2b0aa___Function_fn_wasm_bindgen_5bb76fec55d7fe60___JsValue_____wasm_bindgen_5bb76fec55d7fe60___sys__Undefined_______true_(e,t,n,r)}var sr=["clamp-to-edge","repeat","mirror-repeat"],yl=["auto"],Fs=["zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1-alpha","one-minus-src1-alpha"],vl=["add","subtract","reverse-subtract","min","max"],xl=["uniform","storage","read-only-storage"],kl=["opaque","premultiplied"],Ml=["standard","extended"],ir=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Sl=["none","front","back"],Al=["unknown","destroyed"],Bs=["nearest","linear"],El=["ccw","cw"],Us=["uint16","uint32"],ar=["load","clear"],Tl=["nearest","linear"],Pl=["low-power","high-performance"],Il=["point-list","line-list","line-strip","triangle-list","triangle-strip"],Rl=["filtering","non-filtering","comparison"],or=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],Cl=["write-only","read-only","read-write"],lr=["store","discard"],cr=["all","stencil-only","depth-only"],Ol=["1d","2d","3d"],ut=["r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],$l=["float","unfilterable-float","depth","sint","uint"],ur=["1d","2d","2d-array","cube","cube-array","3d"],Dl=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Ll=["vertex","instance"],js=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbg_mstext_free(e,1)),Ns=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbg_renderer_free(e,1));function He(e){let t=y.__externref_table_alloc();return y.__wbindgen_externrefs.set(t,e),t}var Ws=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbindgen_destroy_closure(e.a,e.b));function $i(e){switch(typeof e){case"number":case"boolean":case"undefined":return`${e}`;case"string":return JSON.stringify(e);case"bigint":return`${e}n`;case"symbol":return e.description!==void 0?`Symbol(${e.description})`:"Symbol";case"function":return typeof e.name=="string"&&e.name!==""?`Function(${e.name})`:"Function";case"object":{if(e===null)return"null";if(Array.isArray(e))return"["+Array.from(e,$i).join(", ")+"]";if(e instanceof Error)return`${e.name}: ${e.message}
698
- ${e.stack}`;let t=toString.call(e),n=/\[object ([^\]]+)\]/.exec(t)?.[1];if(n===void 0)return t;if(n==="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return n}}}function mt(e,t){return e=e>>>0,Di().subarray(e/4,e/4+t)}function Fl(e,t){return e=e>>>0,Ul().subarray(e/8,e/8+t)}function fr(e,t){e=e>>>0;let n=We(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(y.__wbindgen_externrefs.get(n.getUint32(s,!0)));return y.__externref_drop_slice(e,t),r}function Ve(e,t){e=e>>>0;let n=We(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(y.__wbindgen_externrefs.get(n.getUint32(s,!0)));return r}function Bl(e,t){return e=e>>>0,Li().subarray(e/4,e/4+t)}function Kt(e,t){return e=e>>>0,$t().subarray(e/1,e/1+t)}var pt=null;function We(){return(pt===null||pt.buffer.detached===!0||pt.buffer.detached===void 0&&pt.buffer!==y.memory.buffer)&&(pt=new DataView(y.memory.buffer)),pt}var en=null;function Di(){return(en===null||en.byteLength===0)&&(en=new Float32Array(y.memory.buffer)),en}var tn=null;function Ul(){return(tn===null||tn.byteLength===0)&&(tn=new Float64Array(y.memory.buffer)),tn}function Se(e,t){return e=e>>>0,Nl($t().subarray(e,e+t))}var nn=null;function Li(){return(nn===null||nn.byteLength===0)&&(nn=new Uint32Array(y.memory.buffer)),nn}var rn=null;function $t(){return(rn===null||rn.byteLength===0)&&(rn=new Uint8Array(y.memory.buffer)),rn}function Re(e,t){try{return e.apply(this,t)}catch(n){let r=He(n);y.__wbindgen_exn_store(r)}}function Xe(e){return e==null}function qt(e,t,n){let r={a:e,b:t,cnt:1},s=(...i)=>{r.cnt++;let a=r.a;r.a=0;try{return n(a,r.b,...i)}finally{r.a=a,s._wbg_cb_unref()}};return s._wbg_cb_unref=()=>{--r.cnt===0&&(y.__wbindgen_destroy_closure(r.a,r.b),r.a=0,Ws.unregister(r))},Ws.register(s,r,r),s}function Ir(e,t){let n=t(e.length*4,4)>>>0;return Li().set(e,n/4),be=e.length,n}function Rr(e,t){let n=t(e.length*1,1)>>>0;return $t().set(e,n/1),be=e.length,n}function An(e,t){let n=t(e.length*4,4)>>>0;return Di().set(e,n/4),be=e.length,n}function Oe(e,t,n){if(n===void 0){let o=an.encode(e),l=t(o.length,1)>>>0;return $t().subarray(l,l+o.length).set(o),be=o.length,l}let r=e.length,s=t(r,1)>>>0,i=$t(),a=0;for(;a<r;a++){let o=e.charCodeAt(a);if(o>127)break;i[s+a]=o}if(a!==r){a!==0&&(e=e.slice(a)),s=n(s,r,r=a+e.length*3,1)>>>0;let o=$t().subarray(s+a,s+r),l=an.encodeInto(e,o);a+=l.written,s=n(s,r,a,1)>>>0}return be=a,s}function nt(e){let t=y.__wbindgen_externrefs.get(e);return y.__externref_table_dealloc(e),t}var Cn=new TextDecoder("utf-8",{ignoreBOM:!0});Cn.decode();var jl=2146435072,dr=0;function Nl(e){return dr+=e.length,dr>=jl&&(Cn=new TextDecoder("utf-8",{ignoreBOM:!0}),Cn.decode(),dr=e.length),Cn.decode(e)}var an=new TextEncoder;"encodeInto"in an||(an.encodeInto=function(e,t){let n=an.encode(e);return t.set(n),{read:e.length,written:n.length}});var be=0,y;function Wl(e,t){return y=e.exports,pt=null,en=null,tn=null,nn=null,rn=null,y.__wbindgen_start(),y}async function Vl(e,t){if(typeof Response=="function"&&e instanceof Response){if(!e.ok)throw new Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(s){if(n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}var Jt;async function Gl(e){return y!==void 0?y:(Jt===void 0&&(Jt=zl(e),Jt.catch(()=>{Jt=void 0})),Jt)}async function zl(e){e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("ms_renderer_bg.wasm",import.meta.url));let t=_l();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Vl(await e,t);return Wl(n,r)}var Fi=["normal","multiply","screen","overlay","darken","lighten","colorDodge","colorBurn","hardLight","softLight","difference","exclusion","hue","saturation","color","luminosity","plus"],Ce={move:0,line:1,quad:2,cubic:3,close:4},Hl={group:0,rect:1,ellipse:2,path:3,compound:4,text:5},Kl={union:0,cut:1,intersect:2,exclude:3},ql={alpha:1,luminance:2,invertAlpha:3,invertLuminance:4,invertAlphaEroded:5,alphaDilated:6},ke={CREATE:1,CHILDREN:2,TRANSFORM:4,SIZE:8,RADII:16,FILL:32,STROKE:64,SHADOWS:128,OPACITY:256,BLEND:512,CLIP:1024,FILTER:2048,PATH:4096,MEMBERS:8192,MASK:16384,TEXT:32768,EFFECTS:65536,ALL:(1<<17)-1},Jl=class{id;kind;children=[];transform=[1,0,0,1,0,0];opacity=1;blend="normal";w=0;h=0;radii=[0,0,0,0];fill;stroke;shadows=[];clip;mask;members;text;effects;effectTime;effectBox;filter;path;evenOdd=!1;dirty=ke.ALL;constructor(e,t){this.id=e,this.kind=t}},Bi=class{width;height;background;root;nodes=[];images=[];dirty=new Set;nextId=0;constructor(e,t,n){this.width=e,this.height=t,this.background=n,this.root=this.make("group",{})}make(e,t){let n=new Jl(this.nextId++,e);return Object.assign(n,t),this.nodes.push(n),this.dirty.add(n),n}add(e,t,n){let r=this.make(t,n);return e.children.push(r),this.touch(e,ke.CHILDREN),r}group(e,t={}){return this.add(e,"group",t)}rect(e,t){return this.add(e,"rect",t)}ellipse(e,t){return this.add(e,"ellipse",t)}pathNode(e,t){return this.add(e,"path",t)}compound(e,t){return this.add(e,"compound",t)}textNode(e,t){return this.add(e,"text",t)}addImage(e,t,n,r={}){let s={id:this.images.length,width:t,height:n,source:e,mipmaps:r.mipmaps??!0,version:1};return this.images.push(s),s}addScene3D(e,t,n,r){let s={id:this.images.length,width:t,height:n,source:null,mipmaps:!1,version:1,scene3d:e,links3d:r};return this.images.push(s),s}detached(e={}){return this.make("group",e)}addSurface(e,t,n){let r={id:this.images.length,width:t,height:n,source:null,mipmaps:!1,version:1,surface:e};return this.images.push(r),r}touch(e,t){e.dirty|=t,this.dirty.add(e)}touchAll(){for(let e of this.nodes)this.touch(e,ke.ALL)}};function On(e){return e.length===9&&(e[6]!==0||e[7]!==0||e[8]!==1)}function Vs(e){return e.length===9?[e[0],e[2],e[4],e[1],e[3],e[5],e[6],e[7],e[8]]:[e[0],e[2],e[4],e[1],e[3],e[5],0,0,1]}function Yl(e,t){let n=Vs(e),r=Vs(t),s=new Array(9);for(let i=0;i<3;i++)for(let a=0;a<3;a++)s[i*3+a]=n[i*3]*r[a]+n[i*3+1]*r[3+a]+n[i*3+2]*r[6+a];return[s[0],s[3],s[1],s[4],s[2],s[5],s[6],s[7],s[8]]}function hr(e,t){return e.length===9||t.length===9?Yl(e,t):[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}var at=class{verbs=[];pts=[];moveTo(e,t){return this.verbs.push(Ce.move),this.pts.push(e,t),this}lineTo(e,t){return this.verbs.push(Ce.line),this.pts.push(e,t),this}quadTo(e,t,n,r){return this.verbs.push(Ce.quad),this.pts.push(e,t,n,r),this}cubicTo(e,t,n,r,s,i){return this.verbs.push(Ce.cubic),this.pts.push(e,t,n,r,s,i),this}close(){return this.verbs.push(Ce.close),this}build(){return{verbs:Uint8Array.from(this.verbs),points:Float32Array.from(this.pts)}}};function Gs(e,t){let n=new Float32Array(e.points.length);for(let r=0;r<n.length;r+=2){let s=e.points[r],i=e.points[r+1];n[r]=t[0]*s+t[2]*i+t[4],n[r+1]=t[1]*s+t[3]*i+t[5]}return{verbs:e.verbs,points:n}}function et(e){let t=1/0,n=1/0,r=-1/0,s=-1/0;for(let i=0;i<e.points.length;i+=2)t=Math.min(t,e.points[i]),r=Math.max(r,e.points[i]),n=Math.min(n,e.points[i+1]),s=Math.max(s,e.points[i+1]);return Number.isFinite(t)?[t,n,r,s]:[0,0,0,0]}function Xl(e){return e.op??(e.cut?"cut":"union")}function Zl(e){if(e.matrix)return{m:e.matrix,tile:e.tile??"clamp"};let{sx:t,sy:n,ox:r,oy:s,tile:i}=Ql(e);return{m:[t,0,0,n,r,s],tile:i}}function Ql(e){let[t,n,r,s]=e.box,i=e.image.width,a=e.image.height,o=e.fit??"fill";if(o==="stretch")return{sx:r/i,sy:s/a,ox:t,oy:n,tile:"clamp"};if(o==="tile")return{sx:1,sy:1,ox:t,oy:n,tile:"repeat"};let l=o==="fill"?Math.max(r/i,s/a):Math.min(r/i,s/a);return{sx:l,sy:l,ox:t+(r-i*l)/2,oy:n+(s-a*l)/2,tile:o==="fill"?"clamp":"decal"}}var Me={CREATE:1,DESTROY:2,CHILDREN:3,TRANSFORM:4,SIZE:5,RADII:6,FILL:7,STROKE:8,SHADOWS:9,OPACITY:10,BLEND:11,CLIP:12,FILTER:13,PATH:14,MEMBERS:15,MASK:16,TEXT:17,EFFECTS:18,TRANSFORM3:19,DEF_PAINT:20,DEF_PATH:21,DEF_DASH:22,FREE_PATH:24,ROOT:30,VIEWPORT:31},ft=4294967295,ec=class{sink;memory;u32;f32;pos=0;cap=0;written=0;constructor(e,t){this.sink=e,this.memory=t,this.refresh(0)}refresh(e){let t=this.sink.delta_buffer(e);this.cap=this.sink.delta_capacity(),this.u32=new Uint32Array(this.memory.buffer,t,this.cap),this.f32=new Float32Array(this.memory.buffer,t,this.cap)}begin(e){this.u32.buffer!==this.memory.buffer&&this.refresh(0),this.pos+e>this.cap&&(this.flush(),e>this.cap&&this.refresh(e))}u(e){this.u32[this.pos++]=e>>>0}f(e){this.f32[this.pos++]=e}flush(){this.pos>0&&(this.written+=this.pos,this.sink.apply(this.pos),this.pos=0),this.u32.buffer!==this.memory.buffer&&this.refresh(0)}takeCount(){let e=this.written;return this.written=0,e}},tc=le({MAX_PARAMS:()=>64,definePort:()=>ce,fieldFloats:()=>Ui,layout:()=>Wi}),zs={f32:1,vec2f:2,vec3f:3,vec4f:4},Ui=e=>typeof e=="string"?zs[e]:e.array*zs[e.of],ji={number:"f32",boolean:"f32",enum:"f32",color:"vec4f",vec2:"vec2f",axis:"vec2f"};function nc(e,t){switch(e.kind){case"number":return t;case"boolean":return t?1:0;case"enum":return Math.max(0,e.options.indexOf(t));case"color":return xt(t);case"vec2":{let n=t;return[n.x,n.y]}case"axis":{let n=vt(t);return[n.x,n.y]}default:throw new Error(`effect param "${e.name}" (${e.kind}) has no default encoding; give it a value()`)}}function Ni(e,t){let n=Mo(e)?.params.find(r=>r.name===t);if(!n)throw new Error(`effect "${e}": "${t}" is not a parameter of its core spec`);if(!ji[n.kind])throw new Error(`effect "${e}": "${t}" (${n.kind}) has no default encoding`);return n}function Wi(e){let t=0,n=Object.entries(e.params).map(([r,s])=>{let i=s==="param"?ji[Ni(e.type,r).kind]:s.type,a=Ui(i),o={name:r,type:i,offset:t,floats:a};return t+=a,o});if(t>64)throw new Error(`effect "${e.type}" lays out ${t} params; a pass takes 64`);return n}function ce(e){let t=Wi(e),n=t.reduce((s,i)=>s+i.floats,0),r=t.map(s=>{let i=e.params[s.name];if(i!=="param")return i.value;let a=Ni(e.type,s.name);return o=>nc(a,o[s.name])});return{type:e.type,surface:e.surface,backdropOnly:e.backdropOnly,spec:e,cases:e.cases,pack(s){let i=e.prepare?e.prepare(s):{};if(i===null)return null;let a=new Array(n).fill(0);return t.forEach((o,l)=>{let c=r[l](s,i),u=typeof c=="number"?1:c.length;if(u>o.floats)throw new Error(`effect "${e.type}": "${o.name}" is ${u} floats, laid out as ${o.floats}`);if(typeof c=="number")a[o.offset]=c;else for(let f=0;f<u;f++)a[o.offset+f]=c[f]}),{params:a,...e.extras?e.extras(s,i):{}}}}}var rc=le({default:()=>sc}),sc=ce({type:"alpha",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},value:e=>[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,Math.max(0,Math.min(1,e.amount)),0]}},cases:()=>[]}),ic=le({default:()=>uc}),ac="Inter",oc=e=>typeof document<"u"&&document.fonts.check(`12px "${e}"`),lc=e=>Math.max(4,Math.min(64,Math.round(Math.max(8,e*2)))),Qe=1;function cc(e,t,n){let r=[...e].slice(0,256),s=n*Qe,i=new OffscreenCanvas(s*r.length,s),a=i.getContext("2d",{willReadFrequently:!0});a.fillStyle="#000",a.fillRect(0,0,i.width,i.height),a.fillStyle="#fff",a.font=`${n*.8*Qe}px "${t}"`,a.textBaseline="alphabetic",a.textAlign="left",a.fontKerning="none",r.forEach((u,f)=>{let d=a.measureText(u).width;a.fillText(u,f*s+(s-d)/2,s*.78)});let o=a.getImageData(0,0,i.width,i.height).data,l=n*r.length,c=new Uint8ClampedArray(l*n*4);for(let u=0;u<n;u++)for(let f=0;f<l;f++){let d=0;for(let w=0;w<Qe;w++)for(let R=0;R<Qe;R++)d+=o[((u*Qe+w)*i.width+f*Qe+R)*4];let _=d/(Qe*Qe),p=(u*l+f)*4;c[p]=c[p+1]=c[p+2]=_,c[p+3]=255}return{glyphs:r.length,pixels:c,width:l}}var uc=ce({type:"ascii",surface:"shader",params:{size:"param",glyphs:{type:"f32",uses:["charset","fontFamily"],value:(e,t)=>t.atlas.glyphs},cell:{type:"f32",value:(e,t)=>t.cell},ink:"param",background:"param",colored:"param"},prepare(e){let t=Ro(e.charset);if(t.length===0)return null;let n=oc(e.fontFamily)?e.fontFamily:ac,r=lc(e.size);return{family:n,cell:r,charset:t,atlas:cc(t,n,r)}},extras:(e,t)=>({aux:{key:`ascii|${t.family}|${t.cell}|${t.charset}`,width:t.atlas.width,height:t.cell,pixels:t.atlas.pixels}}),cases:()=>[A.ascii().list[0],A.ascii({size:10,charset:"hex",fontFamily:"Fira Mono",ink:"#6f6",background:"#001",colored:!1}).list[0],A.ascii({size:14,colored:!0,background:"transparent",ink:"white"}).list[0],A.ascii({size:8,ink:"black",background:"white",charset:" .oO@"}).list[0]]}),fc=le({default:()=>_c}),dc={gameboy:["#0f380f","#306230","#8bac0f","#9bbc0f"],cga:["#000000","#55ffff","#ff55ff","#ffffff"],nes:["#000000","#fcfcfc","#bcbcbc","#7c7c7c","#0000fc","#0078f8","#3cbcfc","#a4e4fc","#b8f818","#00b800","#005800","#f83800","#e40058","#f878f8","#f8b800","#503000"]},hc=e=>{let t=parseInt(e.slice(1),16);return[16,8,0].map(n=>Number(((t>>n&255)/255).toFixed(4)))},_c=ce({type:"bitCrush",surface:"shader",params:{bits:"param",amount:"param",count:{type:"f32",uses:["palette"],value:(e,t)=>t.palette.length},palette:{type:{array:16,of:"vec3f"},value:(e,t)=>t.palette.flatMap(hc)}},prepare(e){return!(e.amount>0)||e.palette==="none"&&e.bits>=8?null:{palette:e.palette==="none"?[]:dc[e.palette]}},cases:()=>[A.bitCrush().list[0],A.bitCrush({palette:"gameboy"}).list[0],A.bitCrush({palette:"nes",amount:.7}).list[0],A.bitCrush({palette:"cga"}).list[0]]}),pc=le({default:()=>mc}),mc=ce({type:"blockDisplace",surface:"shader",params:{amount:"param",size:"param",density:"param",seed:"param",axis:"param"},prepare(e){if(!(e.amount>0)||!(e.density>0))return null;let t=vt(e.axis);return t.x===0&&t.y===0?null:{}},extras(e){let t=vt(e.axis);return{reach:e.amount*Math.max(Math.abs(t.x),Math.abs(t.y))}},cases:()=>[A.blockDisplace().list[0],A.blockDisplace({amount:40,size:10,density:.6,seed:3}).list[0],A.blockDisplace({amount:30,size:24,axis:"y",seed:1}).list[0]]}),gc=le({default:()=>bc}),bc=ce({type:"bloom",surface:"filter",params:{scale:{type:"f32",uses:["threshold"],value:(e,t)=>t.scale},bias:{type:"f32",value:(e,t)=>-t.t*t.scale},intensity:"param"},uses:["radius"],prepare(e){if(e.radius<=0||e.intensity<=0)return null;let t=Math.max(0,Math.min(1,e.threshold));return{t,scale:t<1?1/(1-t):1,sigma:e.radius/2}},extras:(e,t)=>({blur:[t.sigma,t.sigma,0],reach:3*t.sigma}),cases:()=>[A.bloom().list[0],A.bloom({threshold:.4,radius:24,intensity:1.5}).list[0],A.bloom({threshold:0,radius:6,intensity:.6}).list[0]]}),wc=le({default:()=>yc}),yc=ce({type:"blur",surface:"filter",params:{},uses:["radius"],prepare:e=>e.radius>0?{}:null,extras(e){let t=e.radius/2;return{blur:[t,t,0],reach:3*t}},cases:()=>[A.blur(8).list[0],A.blur(24).list[0],A.blur(2).list[0]]}),vc=le({default:()=>xc}),xc=ce({type:"bulge",surface:"shader",params:{strength:"param",center:"param"},prepare:e=>e.strength===0?null:{},extras(e){let t=2*Math.hypot(e.center.x-.5,e.center.y-.5)*360;if(e.strength<0){let n=e.strength*.8,r=1;for(;r<4&&r*(1+n*r*r)/(1+n)>-1;)r+=.01;t=Math.min((r-1+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}return{reach:t}},cases:()=>[A.bulge(.6).list[0],A.bulge(-.7).list[0],A.bulge({strength:.9,center:{x:.3,y:.6}}).list[0]]}),kc=le({default:()=>Ac}),Mc=[1.4,-.2,-.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],Sc=[0,0,0,0,0,0,0,0,0,0,-.2,-.2,1.4,0,0,0,0,0,1,0],Ac=ce({type:"chromaticAberration",surface:"filter",params:{red:{type:{array:20,of:"f32"},value:()=>Mc},blue:{type:{array:20,of:"f32"},value:()=>Sc},offset:{type:"vec2f",uses:["amount","angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t)*e.amount,Math.sin(t)*e.amount]}}},prepare:e=>e.amount<=0?null:{},extras:e=>({reach:e.amount}),cases:()=>[A.chromaticAberration().list[0],A.chromaticAberration({amount:8,angle:45}).list[0],A.chromaticAberration({amount:2.5,angle:200}).list[0]]}),Ec=le({default:()=>Ic}),bt=.2126,tt=.7152,Ze=.0722;function Tc(e,t){let n=new Array(20).fill(0);for(let r=0;r<4;r++)for(let s=0;s<5;s++){let i=0;for(let a=0;a<4;a++)i+=e[r*5+a]*t[a*5+s];s===4&&(i+=e[r*5+4]),n[r*5+s]=i}return n}var Yt=(e,t)=>[e,0,0,0,t,0,e,0,0,t,0,0,e,0,t,0,0,0,1,0],Hs=(e,t,n)=>[1,0,0,0,e,0,1,0,0,t,0,0,1,0,n,0,0,0,1,0];function Ks(e){let t=1-e;return[e+t*bt,t*tt,t*Ze,0,0,t*bt,e+t*tt,t*Ze,0,0,t*bt,t*tt,e+t*Ze,0,0,0,0,0,1,0]}function Pc(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return[bt+n*(1-bt)+r*-.2126,tt+n*-.7152+r*-.7152,Ze+n*-.0722+r*(1-Ze),0,0,bt+n*-.2126+r*.143,tt+n*(1-tt)+r*.14,Ze+n*-.0722+r*-.283,0,0,bt+n*-.2126+r*-.7874,tt+n*-.7152+r*tt,Ze+n*(1-Ze)+r*Ze,0,0,0,0,0,1,0]}var Ic=ce({type:"colorAdjustment",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["brightness","contrast","saturation","hue","vibrance","temperature","tint","shadows","highlights"],value:(e,t)=>t.matrix}},prepare(e){let t=Yt(1,0),n=!1,r=_=>{t=Tc(_,t),n=!0},s=e.brightness??0;s!==0&&r(Yt(1,s));let i=e.contrast??1;i!==1&&r(Yt(i,.5*(1-i)));let a=e.saturation??1;a!==1&&r(Ks(a));let o=((e.hue??0)%360+360)%360;o!==0&&r(Pc(o));let l=e.vibrance??0;l!==0&&r(Ks(1+l*.7));let c=e.temperature??0;c!==0&&r(Hs(c*.1,0,-c*.1));let u=e.tint??0;u!==0&&r(Hs(u*.05,-u*.1,u*.05));let f=e.shadows??0;f!==0&&r(Yt(1-.2*f,.2*f));let d=e.highlights??0;return d!==0&&r(Yt(1+.2*d,-.1*d)),n?{matrix:t}:null},cases:()=>[A.colorAdjustment({brightness:.1,contrast:1.3,saturation:1.4}).list[0],A.colorAdjustment({hue:120,vibrance:.5}).list[0],A.colorAdjustment({temperature:.6,tint:-.4,shadows:.5,highlights:-.5}).list[0],A.colorAdjustment({contrast:.6,saturation:0}).list[0]]}),Rc=le({default:()=>Cc}),Cc=ce({type:"colorMatrix",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},value:e=>Array.from(e.matrix).slice(0,20)}},cases:()=>[]}),Oc=le({default:()=>Fc}),$n=32;function $c(e,t){if(e.length===0)return t;if(t<=e[0][0])return e[0][1];let n=e[e.length-1];if(t>=n[0])return n[1];for(let r=0;r<e.length-1;r++){let[s,i]=e[r],[a,o]=e[r+1];if(t>=s&&t<=a)return i+(o-i)*(a===s?0:(t-s)/(a-s))}return t}function Dc(e){let t=[...e].sort((r,s)=>r[0]-s[0]),n=[];for(let r=0;r<=$n;r++){let s=$c(t,r/$n);n.push(Number.isFinite(s)?Math.max(0,Math.min(1,s)):r/$n)}return n}var Lc={r:[1,0,0,0],g:[0,1,0,0],b:[0,0,1,0],a:[0,0,0,1]},Fc=ce({type:"curves",surface:"shader",params:{mask:{type:"vec4f",uses:["channel"],value:e=>Lc[e.channel??"rgb"]??[1,1,1,0]},curve:{type:{array:33,of:"f32"},uses:["points"],value:(e,t)=>t.values}},prepare(e){let t=Dc(e.points??[]);return t.every((n,r)=>Math.abs(n-r/$n)<1e-4)?null:{values:t}},cases:()=>[A.curves({points:[[0,0],[.25,.15],[.75,.88],[1,1]]}).list[0],A.curves({points:[[0,.2],[.5,.7],[1,1]],channel:"r"}).list[0],A.curves({points:[[0,0],[.6,.3],[1,.8]],channel:"a"}).list[0]]}),Bc=le({default:()=>Uc}),Uc=ce({type:"directionalBlur",surface:"filter",params:{sigma:{type:"f32",uses:["radius"],value:(e,t)=>t.sigma},axis:{type:"vec2f",uses:["angle"],value:(e,t)=>[Math.cos(t.rad),Math.sin(t.rad)]}},prepare:e=>e.radius<=0?null:{sigma:e.radius/2,rad:e.angle*Math.PI/180},extras:(e,t)=>({blur:[t.sigma,0,t.rad],reach:3*t.sigma}),cases:()=>[A.directionalBlur(20).list[0],A.directionalBlur({radius:30,angle:45}).list[0],A.directionalBlur({radius:12,angle:100}).list[0],A.directionalBlur({radius:120,angle:-20}).list[0]]}),jc=le({default:()=>Gc}),Nc="e8yOVglJi3jaB+U3jl3KakXertJzm985bcTcngPJTPc8ddJT6mIl7ztdoQdH8wxyKr6F1wCTXqg8aZ50OCCKRakgO9+09jbERrJS0AzsM7J9JxY+6i5arBCOK3w3qXHAXOWPG4DYqhCT3HXpkSay25w//61F4y53670E4MOiZtlQ/51iK5hqGewpmmeAvRmQ516kirgCftDuUbn5YOcTLZ0ORqXDOHhRshw0VcBmglDGCV0he6MZyUyQLFmCDewWwG4DzYQO0qVdhv4gQqRT0gfB/2xP8p8+HWmaC0SRuOCAyP0rWwj4yGrxz6oV+jcc72+Wu9RU74cQ27LyR886kieB5Eu58D962ACryeNs+Dx0Sy8SyiRfvIvmJ8XXax1UOGKvct+YgyhCiQB7RZbVrYtG3jUMaz63cDplGZxxsGDuP6cadVkgvTBNcjgRliaEtZvggJfcdArTS3WrNIP4n9ADjBm5RugUuqBh58tuDl3nJaSB+MifJf+ojcgp+QrUFI/EL96wjPmZ4cCMYNnDC/EfWr40Ra/7MKQQ8VEItSl47lDWNWWn0Vj8Oh6jLbw+ewPATReSWwPUUg/mXYVMnm1T+mWbEEdsDFoe964yVaZHz24F9IkaWH7LXojamGPiP74jmfQFdC2TC8SGUduK9KnQYuZ3N+2+fzZ2rD3cvzC00waFO8nqKdGmekUFf+1rjzHonLZk4JlC6xe6I0PIFo9srVp/weNNfddoru8FZhlSMZcfttdrK5rqvSCVAnbnQ3wovORffbSJOee33Jkhyw6sfBZPKsgAsyyea/57qlb3Cc84Fa8hnfUYSSV4QcaR2XD3QaJTFbBKDF76zVaoG5r1qEwdoQJQ8hVfJ21Psz71Vtw90oZz6GGGTs43AtUtoEnhiP9FbMk5tJjou5v9LbQPhsgHfPvMhNxxRIIv8WEKN2rZj/42w26dzY7EFuVjhyi6ZvumHzy+9RSrjeZph8B2KKNh1I0LXd1wCTNaG35I6idh4pUjYjuiKK8TwI3P4onID1p0qyHgPwf/NXybAceiGJEJwkufDGrdJlW2Qx/yElXDAjGo8CiJTsuE3ahkzZirTbk02qwD9Y7T625MJndEsCvnQNORXLaFU6nZRflxN+x6MV7wgteWQHf2D57eXrGV6XffSnDDrhz4QsEU5zUBbvYSdUmIwk8XXTkForsY8GKfvxiACfYrb+kRZyu0WNhKzJjesSpZHLHKiWTBNIDWLUQetJYPPeRhoCZqk0+1hNg7ksrzGm7lfcWqh/xamdUFek7yY8RMotMjwIPOG44LsGsaRAFuwvlPBTHtF5NIBm31gstf+4GZA3q38Al1+x1YsSVioC+wPZwn30fOMbM+j+Eyl6053g6QPp5N6KV38yaf/X7Okjh6mtmndFLN+6nBmlIVNNIkVMjgTjKlz0HDnOt9C+JZ1Qj0ZRlyDIL3HVa8EdEfiWu7VnbxBGE2wkVivzJYqeAR6idgQOG5JXlcGznjr45xte07II/WXIkrbA9J1L1DkHa+UoW17MNj0HuoaP51VOku+hrXtiiL1RCW3QmM6hdLZ72LshyGDqE96YjVZALxRBOfZK9zDuwYqvKOMmmlJ/EWmCvYPJ0kSQI27CZGk8IBqXuYOGmo/nBP7Xk80G8oxqE9B/zQaOxW0gq8KH6gxVveegn3x0i4ft1QzLD9BoRjzkf9qhRWi67jlcaDDLU01V5Fyw/kQxm5LK0cpE23kPd/3Fd4Rp41iq9smFH/PR6HLr6TVTSfImY7AHUeV5njNa5xAWF9yfNxYBtQ26DlbIoi7LSMVn2Z0FuE2mXzBThdEi/Kqya+BPcgQusUs3DXqu1G1Bziif3Kmr2K5zDWScEg5oy74DIPQKC+dDpdGUv1owhtLdPsATzwDcAjmXjSnuJvkBnogVvXdsVfzTOUVAdlI3KtXXYNUyvzQWC4chSBWqE5Th2Us9so8Aez+Y3IL37fTZ8eumGxdJQ0WN9DuiFJtPBSask9lCykC4XkGfbDm4X6AM8wqNl/FqXODJKs9NIN7sxt+lh7SIrWLnqqDGS3OcL0c0SIJNZL+KyBFGr9hwA6nw2o5RK5+k1qrUd9Mdw8tk2N70G3W+RuJvpRLmpClSqBpjoG0BlqnFYe6kjZjxZdkg3L/aQQwm0Ey+szplzZxIX6Jk9nfzuZ3ie/Y6oMXMsXom0fkwfCSZ14vOEbs3TDVRfWjqzE/j250W+aJv130SmuVzdo5iqQP6BUjb8beSxIb7iQ0eofywKJ8RXnknTyLV/gx3r3MoveAj2CzFn+Aea3aelcgQ7aiAM1xlgJoT3vg+Eam4JXutkicQviTvWx1BXiNwdXrndfQJ9PzSRGp4G4DFE8q2kesFvupBCMNZxIhh1BLLVSJaRg9oKt42i9TQJrv9Q9+RZ68KzRKJppCY5bpHzElzP1vdotbYS14RnUN/6e2BXsxTfTbSlO161wJtyj9pVr7nfkQ7QZRy5/F9qUpyhTCK1jmks2ZoQ/6Kc08iFH/WwYS40OqfQGOmWWVG6MJWKBl1F8Epi/82Uc68ZUdQTIGjeXwRNy35HJ87BgM+564pHNLOgBvv2xD8hQfsxlsxHUouMlfblZksf5EMLsAK/HPgjgqPxHhwa1PYMQtDTZSuCxB0/SM6JiBlAjh8xIFbJpQ4DGX5EYVdtvJLoC3pAvf1rDZ+041CBKc6YoRnjkU/S2LGYgyTZ44pxM9JFgp4hYfPNmjf8dvOhxof4IvFv3Id4OqTHge6EzivqXPnVS6aw8AZZHEnib2jODt9KTNRuLdddMkuerXCXOayvWDP8izj+lKbh4Vz+IMNRAZ55/NoqeT/hxRCLrwkoVYOykDcci+XLepcH9XrME8VoRZtupWxCdwABsGPWMC7ehfENyuwrlGNdGAsfdpg26fRzsxA/Wb70alNa0Zgec17Ah0DeVVobNKVWIMBrib5Q96aAnvv5A4zB/01G8P91XG8foLZltkVp/oPCUJ2brWZfcK1OqQfEuXMUMiFL0ey5yU4T1br4RQrEK6mxAn0zEIbt5SIAYb69e+JoteaZp+TuMXa9MxST7uzNeFn21OxXJRXWSz2UCrX7jPKYnuUDlxQS1SBfcnfBmkdW2gM4N+4hYBvDHltEKjUQRx+gFJoK+CNIY9IKrQwtz58xL+4tw8aUJ+COF6ZdGIPxw2oQaomGT2CqqYTF8wiNNFvMqrmQ13aNoIjdW7ijbpWRLktirUO12njkDZsrdjK8rowXFJFUyv188uhjLZLOPVwDHS/sUOu10kP9RBN86pGKXVHrllhvOQa7jgbVrv30h+7U1bh2UKmHW7ZYuWB1Fbt1anOa2h+Kb23hSMeEL0C/vZ6+JcMtMCbshyY2ub+rJBtg7EcFRg/d2AqE/F1LkOogTWfHPROO8TyJ15qPB8ROHN3lGDWkfTAWx+qCIdEqlkzof2iydsFvZhELoVRKDMriK+KJvK7oTWccq/s+bBKvNc7+bBLJ7EqdCug06Y5XPsfUX06f6fNCQKmAWO/HCEuR2u1TqEHz2M2kXnSu9/ElxImBH0+iVOuCYaU6McPBiQ+EsTYZoMfWLZ/6I1nsCTi5nwJJZL7k77nLK3rdoKIVZ0weXZcVDHZK48HnYYJUY4bDMAIQfZbJ/HNS3EzK9JJYNqPcf38FWz6AXUKsl+KR/4SQ/6wqfXhKmQo8DU63/HadH9jCL4abVSgypPgDMplSRNO+nPvkKTO03efVI24DrVXjRkECYByneM8Bf3D+8Ww6vhG/LiOXEUyN37ZnZcDLBfRa1cQRfK3TIV/aHazjzDna+TnDLmsFipwaTsFwWrMkyZRFcruuDs3jpCXGOFdSX/1DaHUosef+y0S9BFU2O212f0E/9v4btH5kvu+Igg8ZfJI7dGTOHIdhVzCJzkUEA76C7/DVsSA6UQ57JMO9IczQEs2ScuAWVGGOJus2k6gQ87h80nRQ9sWLedxJSrkHaoOkIq1zjbP9BgeY4xv+5bIlLKXvIHtL0ZSP5Ua1qHsyj54s59tVAa+FK9Ah8YSZ4uZBjhNpX5Y8GR6vWj/9rF1E5wX5CsgSduhJpowlYLd8czuMGj6JUMbjXfQ+K37eBYCnGeg9bjMGpKp5V5zis+UwT4sRzqCNq+sgiYTUFmLaF92gq74rQWC6V8ErZeZlHp3RZr0DmdYkDoT7GLFgIQPMWVOCtIu02C3bKHJPXDWfOoUMqAUnTtjiAou19w+QvzQ6U1hNOIuh3wx6GsRTK7wrCM/JoEcRO6Vtw45n8qNWPv5w0a89/U9f7X7dGgMSYJXv2s5TueBOaVAvSQlcdYHZGtFefx22qQNxhMfZlJYFflx6K2CeqNs4hshI5dB9mL3MB/EahEbiUPoct7BhZPOYJVW01ylct88BtJ7KDnfOq4CH8fzXyFIkAodFEkbw41PpDu1F+/mSWgfZPwIfKSO6xWsONKvJkHq4C251x/b2IptjBEYKj24VF3ZD7D9E2AYo8agi2lFm8/E5/Ct+jUxGtdgHPmxSvCkKi2mEF5KER2IIc3XbJSeVzxmhPrA8sYz8dl0r8IGMEqBk4ZE25clS/06TlSiThNmqwKcVvHuqNZealOW7gx+95LxuTtzFYkic/qFUKOaeGMfgbNs1+3bL0eeNnszrOvHLtxqXhIpTuFnkqXsNzzoMb645c9EJ7zDAgWvYaSyRcuMxw8EV++2/I6Wn3vZPcDVubvY3yRJkBVirLCIvoUZYlWXsGhkTXY5xC848arAWdQdMPty6pBbhL25PAd4w/lAHmU6kMxRqxTgaXMHlQJLnrQ3UIYCNs0Ye6Rp8uehf4QtWeL/WtCy7NtgrYRftj51amck3Wkl7+noAIL6za/qZsOyGD2mScNonftR3T72Z+qyXK5KO/6zKlE/ld0appsoITu09oxXb6UoVno3cwix7CLPqDGOdzORXJaulRFH0p1bSb+EEl0/MTXn5IpAQ9zRBXlTJOEnxJ4WaBG+RIAN408m7mEDyRpho47CTLtEzba5IDxkCzIr9U8T6b0GPFS+5bE262jlVyujvK/W3EnOWL/GjUg/i2HJbFO7WRJ8aaTY8mqYXOI1/ZwJdXB/KaDrg+32edWYzZfKkghg2yH4wHgMIz6gOsH+mbCi2NGl4sSh67A6oob9VWBu5xUvx6XdELwlrdSvG0AXNE4oJiNnT3V6ww6g/1MwZnvE73OuKj0UWW1lB8z0SHZN2xU+u3c9yjeT7lX5w16IsppRG5Ohyl5HUyF6B5No38FafDGrDQIoATkM9xRKLK5jDVlXJSaDD5HGcpofsuxhVJetI5hBLFMfSQUMwKrne7QdJi24bvaEGK/LhoDuVQr2ctQN+KSaLpx0wmhbpYjhSAXgOu7hC8d6fkvhRclXCr9iOgAPmVUGMNviCG/kkbXPKCI5gIsCm9A5pHzYW/JNV+ypha7xBkMm22+AvYIf1Ks/LHLA==",Wc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ot=64,_r=null;function Vc(){if(_r)return _r;let e=Nc.replace(/[^A-Za-z0-9+/]/g,""),t=new Uint8Array(e.length*3>>2),n=0,r=0,s=0;for(let a=0;a<e.length;a++)n=n<<6|Wc.indexOf(e[a]),r+=6,r>=8&&(r-=8,t[s++]=n>>r&255);let i=new Uint8ClampedArray(Ot*Ot*4);for(let a=0;a<Ot*Ot;a++)i.fill(t[a],a*4,a*4+3),i[a*4+3]=255;return _r=i}var Gc=ce({type:"dither",surface:"shader",params:{levels:"param",scale:"param",monochrome:"param",noise:"param",matrix:{type:"f32",value:e=>e.matrix}},prepare:e=>e.levels>=256?null:{},extras:e=>({aux:e.noise==="blue"?{key:"dither-blue-noise",width:Ot,height:Ot,pixels:Vc()}:void 0}),cases:()=>[A.dither().list[0],A.dither({levels:4,matrix:8,scale:2,monochrome:!0}).list[0],A.dither({noise:"blue",levels:3}).list[0],A.dither({matrix:2,levels:6,scale:3}).list[0]]}),zc=le({default:()=>Hc}),Hc=ce({type:"dropShadow",surface:"shader",params:{offset:{type:"vec2f",uses:["offsetX","offsetY"],value:(e,t)=>[t.ox,t.oy]},sigma:{type:"f32",uses:["blur"],value:(e,t)=>t.sigma},color:"param",spread:{type:"f32",value:(e,t)=>t.spread}},prepare(e){if(xt(e.color)[3]<=0)return null;let t=e.offsetX,n=-e.offsetY,r=Math.max(0,e.blur)/2,s=Math.max(0,e.spread);return t===0&&n===0&&r===0&&s===0?null:{ox:t,oy:n,sigma:r,spread:s}},extras:(e,t)=>({reach:Math.hypot(t.ox,t.oy)+3*t.sigma+t.spread}),cases:()=>[A.dropShadow().list[0],A.dropShadow({offsetX:10,offsetY:10,blur:24,color:"#0008"}).list[0],A.dropShadow({offsetX:0,offsetY:0,blur:0,spread:6,color:"#f40"}).list[0],A.dropShadow({offsetX:-12,offsetY:-6,blur:40,spread:4,color:"#04f"}).list[0]]}),Kc=le({default:()=>Xc}),qc=.2126,Jc=.7152,Yc=.0722,Xc=ce({type:"duotone",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["amount","shadows","highlights"],value(e){let t=Math.max(0,Math.min(1,e.amount)),n=xt(e.shadows),r=xt(e.highlights),s=i=>{let a=(r[i]-n[i])*t,o=[a*qc,a*Jc,a*Yc,0,n[i]*t];return o[i]+=1-t,o};return[...s(0),...s(1),...s(2),0,0,0,1,0]}}},prepare:e=>e.amount<=0?null:{},cases:()=>[A.duotone().list[0],A.duotone({shadows:"#1a0b3d",highlights:"#ffcc66"}).list[0],A.duotone({amount:.5,shadows:"#003344",highlights:"#ff6699"}).list[0]]}),Zc=le({default:()=>Qc}),Qc=ce({type:"edges",surface:"shader",params:{strength:"param",kernel:"param",colored:"param"},prepare:e=>e.strength>0?{}:null,extras:()=>({reach:1}),cases:()=>[A.edges().list[0],A.edges({strength:2,kernel:"prewitt",colored:!0}).list[0],A.edges({strength:1.5,kernel:"laplacian"}).list[0]]}),eu=le({default:()=>tu}),tu=ce({type:"exposure",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},value:e=>[e.amount,0,0,0,0,0,e.amount,0,0,0,0,0,e.amount,0,0,0,0,0,1,0]}},cases:()=>[]}),nu=le({default:()=>cu}),qs=e=>Math.min(1,Math.max(0,e)),ru=.35,su=1,iu=.1,au=.06,ou=.7,lu=.3,Js=.25,cu=ce({type:"glass",surface:"shader",backdropOnly:!0,params:{depth:"param",refraction:{type:"f32",value:e=>Math.max(0,e.refraction/100)},spread:{type:"f32",uses:["dispersion"],value:e=>qs(e.dispersion/100)*ru},light:{type:"vec2f",uses:["lightAngle"],value(e){let t=e.lightAngle*Math.PI/180;return[Math.sin(t),-Math.cos(t)]}},rim:{type:"f32",uses:["lightIntensity"],value:(e,t)=>t.light*su},shade_near:{type:"f32",uses:["splay"],value:(e,t)=>t.light*iu*(1-Js*t.splay)},shade_far:{type:"f32",value:(e,t)=>t.light*au*(1-Js*t.splay)},shade_reach:{type:"f32",value:(e,t)=>ou+lu*t.splay},frost:{type:"f32",value:(e,t)=>t.frost}},prepare(e){return e.depth>0?{light:Math.max(0,e.lightIntensity/100),splay:qs(e.splay/100),frost:Math.max(0,e.frost)*.5}:null},extras:(e,t)=>({reach:3*t.frost+2,blur:t.frost>0?[t.frost,t.frost,0]:void 0,field:!0}),cases:()=>[A.glass().list[0],A.glass({dispersion:0,frost:0,depth:30}).list[0]]}),uu=le({default:()=>du}),fu=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],du=ce({type:"glow",surface:"shader",params:{channel:"param",threshold:"param",spread:{type:"f32",value:e=>Math.max(0,e.spread)},intensity:"param",tint:"param",original:"param",blend:{type:"f32",value:e=>Math.max(0,fu.indexOf(e.blend))},count:{type:"f32",value:(e,t)=>t.colors.length},cycles:"param",phase:{type:"f32",value:e=>e.phase/360},mirror:{type:"f32",uses:["loopStyle"],value:e=>e.loopStyle==="mirror"?1:0},stops:{type:{array:8,of:"f32"},value(e,t){let n=[],r=0;for(let s=0;s<t.colors.length;s++)r=Math.max(r,Math.min(1,e.stops[s]??s/Math.max(1,t.colors.length-1))),n.push(r);return n}},colors:{type:{array:8,of:"vec4f"},uses:["color"],value:(e,t)=>t.colors.flatMap(n=>xt(n))}},uses:["radius","axis"],prepare(e){return e.radius<=0&&e.spread<=0||e.intensity<=0?null:{colors:(e.tint==="solid"?[e.color]:e.colors).slice(0,8)}},extras(e){let t=vt(e.axis),n=Math.max(0,e.radius)/2;return{blur:[n*t.x,n*t.y,0],reach:3*n+Math.max(0,e.spread)}},cases:()=>[A.glow().list[0],A.glow({radius:12,threshold:.3,intensity:1.5,original:"front"}).list[0],A.glow({channel:"alpha",radius:20,spread:4,tint:"solid",color:"#4cf"}).list[0],A.glow({radius:30,tint:"ramp",colors:["#ff3","#f0f","#0ff"],stops:[0,.5,1],blend:"lighten"}).list[0]]}),hu=le({default:()=>_u}),_u=ce({type:"grain",surface:"shader",params:{amount:"param",size:"param",seed:"param",colored:"param",animated:"param"},prepare:e=>e.amount>0?{}:null,cases:()=>[A.grain().list[0],A.grain({amount:.5,size:3,seed:7,colored:!0}).list[0],A.grain({amount:.15,size:2}).list[0]]}),pu=le({default:()=>mu}),pr=.2126,mr=.7152,gr=.0722,mu=ce({type:"grayscale",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["amount"],value(e){let t=Math.max(0,Math.min(1,e.amount));return[1-t+t*pr,t*mr,t*gr,0,0,t*pr,1-t+t*mr,t*gr,0,0,t*pr,t*mr,1-t+t*gr,0,0,0,0,0,1,0]}}},cases:()=>[A.grayscale(1).list[0],A.grayscale(.5).list[0]]}),gu=le({default:()=>bu}),bu=ce({type:"halftone",surface:"shader",params:{size:"param",angle:{type:"f32",value:e=>e.angle*Math.PI/180},shape:"param",separation:"param"},extras:e=>({reach:e.size}),cases:()=>[A.halftone().list[0],A.halftone({size:10,angle:20,shape:"line",separation:"rgb"}).list[0],A.halftone({size:12,shape:"cross",separation:"cmyk"}).list[0]]}),wu=le({default:()=>xu}),Pt=.2126,It=.7152,Rt=.0722,yu=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];function vu(e){switch(e){case"red":return[-1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];case"green":return[1,0,0,0,0,0,-1,0,0,1,0,0,1,0,0,0,0,0,1,0];case"blue":return[1,0,0,0,0,0,1,0,0,0,0,0,-1,0,1,0,0,0,1,0];case"alpha":return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,-1,1];case"hue":return[2*Pt-1,2*It,2*Rt,0,0,2*Pt,2*It-1,2*Rt,0,0,2*Pt,2*It,2*Rt-1,0,0,0,0,0,1,0];case"luminance":return[1-2*Pt,-2*It,-2*Rt,0,1,-2*Pt,1-2*It,-2*Rt,0,1,-2*Pt,-2*It,1-2*Rt,0,1,0,0,0,1,0];default:return[-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,1,0,0,0,1,0]}}var xu=ce({type:"invert",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["channel","strength"],value:(e,t)=>t.matrix}},prepare(e){let t=Math.max(0,Math.min(1,e.strength));if(t===0)return null;let n=vu(e.channel);return{matrix:yu.map((r,s)=>r+(n[s]-r)*t)}},extras:(e,t)=>t.matrix[19]>0?{reach:4096}:{},cases:()=>[A.invert().list[0],A.invert({channel:"hue",strength:.7}).list[0],A.invert({channel:"luminance"}).list[0],A.invert({channel:"alpha",strength:.5}).list[0]]}),ku=le({default:()=>Mu}),Mu=ce({type:"kaleidoscope",surface:"shader",params:{wedge:{type:"f32",uses:["segments"],value:(e,t)=>2*Math.PI/t.segments},angle:{type:"f32",value:e=>e.angle*Math.PI/180},offset:"param",amount:{type:"f32",value:e=>Math.max(0,Math.min(1,e.amount))},center:"param"},prepare(e){let t=Math.round(e.segments);return t<2||e.amount<=0?null:{segments:t}},extras:e=>({reach:Math.min((Math.SQRT2-1+Math.abs(e.offset)+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}),cases:()=>[A.kaleidoscope().list[0],A.kaleidoscope({segments:8,angle:20,offset:.15}).list[0],A.kaleidoscope({segments:3,amount:.6,center:{x:.4,y:.55}}).list[0]]}),Su=le({default:()=>Tu}),Ys=new WeakMap,Au=0,br=e=>Number.isFinite(e)?Math.max(0,Math.min(255,Math.round(e*255))):0;function Eu(e,t){let n=Ys.get(e);if(n&&n.height===t)return n;let r=t*t,s=new Uint8ClampedArray(r*t*4);for(let a=0;a<t;a++)for(let o=0;o<t;o++)for(let l=0;l<t;l++){let c=((a*t+o)*t+l)*3,u=(o*r+a*t+l)*4;s[u+3]=255,!(c+2>=e.length)&&(s[u]=br(e[c]),s[u+1]=br(e[c+1]),s[u+2]=br(e[c+2]))}let i={key:`lut-${Au++}`,width:r,height:t,pixels:s};return Ys.set(e,i),i}function Xs(e){let t=new Float32Array(e*e*e*3);for(let n=0;n<e;n++)for(let r=0;r<e;r++)for(let s=0;s<e;s++){let[i,a,o]=[s/(e-1),r/(e-1),n/(e-1)],l=((n*e+r)*e+s)*3;t[l]=.05+.95*Math.pow(i,.8),t[l+1]=.85*a+.1*o+.03,t[l+2]=1-Math.pow(1-o,1.4)*.9-.08*i}return t}var wr=null,Tu=ce({type:"lut",surface:"shader",params:{size:"param",amount:"param"},uses:["table"],prepare:e=>e.amount<=0||!Number.isInteger(e.size)||e.size<2?null:{},extras:e=>({aux:Eu(e.table,e.size)}),cases:()=>(wr??=[Xs(17),Xs(33)],[A.lut({table:wr[1],size:33}).list[0],A.lut({table:wr[0],size:17,amount:.6}).list[0]])}),Pu=le({default:()=>Iu}),Iu=ce({type:"magnify",surface:"shader",backdropOnly:!0,params:{scale:"param",center:"param"},prepare:e=>e.scale===1||e.scale<=0?null:{},extras:e=>({reach:e.scale<1?Math.min((1/e.scale-1)*360,800):0}),cases:()=>[A.magnify({scale:2}).list[0],A.magnify({scale:1.6,center:{x:.3,y:.7}}).list[0]]}),Ru=le({default:()=>Cu}),Cu=ce({type:"oilPaint",surface:"shader",params:{radius:"param"},prepare:e=>e.radius>0?{}:null,extras:e=>({reach:e.radius}),cases:()=>[A.oilPaint().list[0],A.oilPaint({radius:5}).list[0],A.oilPaint({radius:1.5}).list[0]]}),Ou=le({default:()=>Du}),$u={outside:0,inside:1,center:2},Du=ce({type:"outline",surface:"shader",params:{width:"param",position:{type:"f32",value:(e,t)=>t.position},color:"param"},prepare(e){return!(e.width>0)||xt(e.color)[3]<=0?null:{position:$u[e.position]??0}},extras:(e,t)=>({reach:t.position===1?0:t.position===2?e.width/2:e.width}),cases:()=>[A.outline().list[0],A.outline({width:8,color:"#f80",position:"inside"}).list[0],A.outline({width:6,color:"#0cf",position:"center"}).list[0]]}),Lu=le({default:()=>Fu}),Fu=ce({type:"pixelate",surface:"filter",params:{blocks:"param",sharpColors:"param"},extras:e=>({reach:e.sharpColors?0:100}),cases:()=>[A.pixelate(40).list[0],A.pixelate({blocks:{x:40,y:24},sharpColors:!1}).list[0],A.pixelate({blocks:{x:12.5,y:40/3}}).list[0]]}),Bu=le({default:()=>Uu}),Uu=ce({type:"posterize",surface:"shader",params:{levels:"param"},prepare:e=>e.levels<2?null:{},cases:()=>[A.posterize().list[0],A.posterize(2).list[0],A.posterize(7).list[0]]}),ju=le({default:()=>Nu}),Nu=ce({type:"progressiveBlur",surface:"shader",params:{center:"param",direction:{type:"vec2f",uses:["angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t),Math.sin(t)]}},radius:"param",start_radius:{type:"f32",uses:["startRadius"],value:(e,t)=>t.start0},start:"param",end:"param",shape:"param",samples:{type:"f32",value:e=>Math.max(2,Math.min(32,Math.round(e.samples)))}},prepare(e){let t=e.startRadius??0;return e.radius<=0&&t<=0?null:{start0:t}},extras:(e,t)=>({reach:Math.max(e.radius,t.start0,0)}),cases:()=>[A.progressiveBlur().list[0],A.progressiveBlur({radius:30,angle:0,start:.3,end:.9,samples:28}).list[0],A.progressiveBlur({radius:28,startRadius:4,shape:"radial",center:{x:.4,y:.5}}).list[0]]}),Wu=le({default:()=>Vu}),Vu=ce({type:"radialBlur",surface:"shader",params:{amount:"param",style:"param",center:"param",samples:{type:"f32",value:e=>Math.round(Math.max(2,Math.min(32,e.samples)))}},prepare:e=>e.amount>0?{}:null,extras(e){let t=e.style==="spin"?Math.SQRT2-1:1/Math.max(1-e.amount/2,.25)-1;return{reach:Math.min((t+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}},cases:()=>[A.radialBlur().list[0],A.radialBlur({amount:.8,style:"spin",samples:24}).list[0],A.radialBlur({amount:.3,center:{x:.3,y:.4},samples:8}).list[0]]}),Gu=le({default:()=>zu}),zu=ce({type:"rgbShift",surface:"shader",params:{red:"param",green:"param",blue:"param"},prepare(e){let{red:t,green:n,blue:r}=e;return!t.x&&!t.y&&!n.x&&!n.y&&!r.x&&!r.y?null:{}},extras:({red:e,green:t,blue:n})=>({reach:Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(t.x),Math.abs(t.y),Math.abs(n.x),Math.abs(n.y))}),cases:()=>[A.rgbShift().list[0],A.rgbShift({amount:12}).list[0],A.rgbShift({red:{x:6,y:-4},green:{x:-3,y:5},blue:{x:0,y:9}}).list[0]]}),Hu=le({default:()=>Ku}),Ku=ce({type:"scanlines",surface:"shader",params:{spacing:"param",thickness:"param",darkness:"param",offset:"param",direction:{type:"vec2f",uses:["angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t),Math.sin(t)]}}},prepare:e=>e.darkness>0?{}:null,cases:()=>[A.scanlines().list[0],A.scanlines({spacing:7,thickness:.3,darkness:.8,offset:2,angle:30}).list[0],A.scanlines({spacing:5,thickness:.7,angle:90}).list[0]]}),qu=le({default:()=>Ju}),Ju=ce({type:"scatter",surface:"shader",params:{offset:{type:"vec2f",uses:["strength","axis"],value(e){let t=vt(e.axis);return[e.strength*t.x,e.strength*t.y]}}},prepare:e=>e.strength>0?{}:null,extras(e){let t=vt(e.axis);return{reach:e.strength*Math.max(Math.abs(t.x),Math.abs(t.y))}},cases:()=>[A.scatter().list[0],A.scatter({strength:24,axis:"x"}).list[0],A.scatter({strength:6,axis:"y"}).list[0]]}),Yu=le({default:()=>Xu}),Xu=ce({type:"sharpen",surface:"shader",params:{amount:"param",radius:{type:"f32",value:e=>Math.max(e.radius,0)}},prepare:e=>e.amount===0?null:{},cases:()=>[A.sharpen().list[0],A.sharpen({amount:2.5,radius:3}).list[0]]}),Zu=le({default:()=>Qu}),Qu=ce({type:"streak",surface:"filter",params:{scale:{type:"f32",uses:["threshold"],value:(e,t)=>t.scale},bias:{type:"f32",value:(e,t)=>-t.t*t.scale},intensity:"param",sigma:{type:"f32",uses:["length"],value:(e,t)=>t.sigma},axis:{type:"vec2f",uses:["angle"],value:(e,t)=>[Math.cos(t.rad),Math.sin(t.rad)]}},prepare(e){if(e.intensity<=0||e.length<=0)return null;let t=Math.max(0,Math.min(1,e.threshold));return{t,scale:t<1?1/(1-t):1,sigma:e.length/2,rad:e.angle*Math.PI/180}},extras:(e,t)=>({blur:[t.sigma,.01,t.rad],reach:3*t.sigma}),cases:()=>[A.streak().list[0],A.streak({angle:30,length:80,threshold:.5,intensity:1.5}).list[0],A.streak({angle:90,length:60,threshold:.3,intensity:.7}).list[0]]}),ef=le({default:()=>tf}),tf=ce({type:"threshold",surface:"shader",params:{level:"param",smoothness:"param"},cases:()=>[A.threshold().list[0],A.threshold({level:.3,smoothness:0}).list[0],A.threshold({level:.6,smoothness:.4}).list[0]]}),nf=le({default:()=>rf}),rf=ce({type:"twirl",surface:"shader",params:{angle:{type:"f32",value:e=>e.angle*Math.PI/180},radius:"param",center:"param"},prepare:e=>e.angle===0||e.radius<=0?null:{},extras(e){let t=Math.min(e.radius,Math.SQRT2);return{reach:Math.min((Math.max(t-1,0)+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}},cases:()=>[A.twirl().list[0],A.twirl({angle:-120,radius:.6}).list[0],A.twirl({angle:300,radius:1.4,center:{x:.35,y:.55}}).list[0]]}),sf=le({default:()=>af}),af=ce({type:"vignette",surface:"shader",params:{color:"param",amount:"param",radius:"param",softness:"param"},prepare:e=>e.amount<=0||xt(e.color)[3]<=0?null:{},cases:()=>[A.vignette().list[0],A.vignette({amount:.9,radius:.4,softness:.3}).list[0],A.vignette({amount:.7,color:"#ff8800",radius:.6,softness:.8}).list[0]]}),of=le({default:()=>lf}),lf=ce({type:"vintage",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["amount","warmth"],value(e){let t=Math.max(0,Math.min(1,e.amount)),n=Math.max(-1,Math.min(1,e.warmth)),r=(l,c)=>l+(c-l)*t,s=n>0?n*.15:0,i=n<0?-n*.15:0,a=n<0?-n*.05:0,o=n>0?n*.05:0;return[r(1,.393),r(0,.769),r(0,.189),0,s-a,r(0,.349),r(1,.686),r(0,.168),0,0,r(0,.272),r(0,.534),r(1,.131),0,-i+o,0,0,0,1,0]}}},prepare:e=>e.amount<=0&&e.warmth===0?null:{},cases:()=>[A.vintage().list[0],A.vintage({amount:.5,warmth:-.8}).list[0],A.vintage({amount:0,warmth:1}).list[0]]}),cf=le({default:()=>uf}),uf=ce({type:"wave",surface:"shader",params:{amplitude:"param",wavelength:{type:"f32",value:e=>Math.max(e.wavelength,.01)},phase:{type:"f32",value:e=>(e.phase%360+360)%360*Math.PI/180},direction:{type:"vec2f",uses:["angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t),Math.sin(t)]}},shape:"param",center:"param"},prepare:e=>e.amplitude.x===0&&e.amplitude.y===0?null:{},extras:e=>({reach:Math.max(Math.abs(e.amplitude.x),Math.abs(e.amplitude.y))}),cases:()=>[A.wave().list[0],A.wave({amplitude:{x:8,y:14},wavelength:60,phase:70,angle:35}).list[0],A.wave({amplitude:16,shape:"radial",wavelength:80,center:{x:.4,y:.6}}).list[0]]}),Zs=new Map(Object.entries(Object.assign({"./_pack.ts":tc,"./alpha.ts":rc,"./ascii.ts":ic,"./bitCrush.ts":fc,"./blockDisplace.ts":pc,"./bloom.ts":gc,"./blur.ts":wc,"./bulge.ts":vc,"./chromaticAberration.ts":kc,"./colorAdjustment.ts":Ec,"./colorMatrix.ts":Rc,"./curves.ts":Oc,"./directionalBlur.ts":Bc,"./dither.ts":jc,"./dropShadow.ts":zc,"./duotone.ts":Kc,"./edges.ts":Zc,"./exposure.ts":eu,"./glass.ts":nu,"./glow.ts":uu,"./grain.ts":hu,"./grayscale.ts":pu,"./halftone.ts":gu,"./invert.ts":wu,"./kaleidoscope.ts":ku,"./lut.ts":Su,"./magnify.ts":Pu,"./oilPaint.ts":Ru,"./outline.ts":Ou,"./pixelate.ts":Lu,"./posterize.ts":Bu,"./progressiveBlur.ts":ju,"./radialBlur.ts":Wu,"./rgbShift.ts":Gu,"./scanlines.ts":Hu,"./scatter.ts":qu,"./sharpen.ts":Yu,"./streak.ts":Zu,"./threshold.ts":ef,"./twirl.ts":nf,"./vignette.ts":sf,"./vintage.ts":of,"./wave.ts":cf})).filter(([e])=>!e.includes("/_")).map(([,e])=>[e.default.type,e.default])),Cr={fill:0,effect:1};function Vi(e){let t=JSON.parse(e);for(let n of t.diagnostics)n.source="naga";return t}function Gi(e,t){return Vi(hl(Cr[e],t))}function Qs(e,t,n){let r=new Uint32Array(Math.ceil(t/4)),s=new Float32Array(r.buffer),i=new Int32Array(r.buffer);for(let a of e){let o=n[a.name];if(o===void 0)continue;let l=typeof o=="number"?[o]:o.flat(1/0);for(let c=0;c<a.elements;c++)for(let u=0;u<a.components;u++){let f=l[c*a.components+u];if(f===void 0)continue;let d=a.offset+c*a.stride+u*4>>2;d>=r.length||(a.scalar===0?s[d]=f:a.scalar===1?i[d]=Math.round(f):r[d]=Math.max(0,Math.round(f)))}}return r}var ff=64,ei=1e4;function ti(e,t){let n,r=new Promise((s,i)=>{n=setTimeout(()=>i(new Error(`the browser took over ${ei/1e3} s to ${t}`)),ei)});return Promise.race([e,r]).finally(()=>clearTimeout(n))}var df=class{r;onReady;programs=new Map;nextId=0;pending=new Set;constructor(e,t){this.r=e,this.onReady=t}program(e,t){let n=`${e}
699
- ${t}`,r=this.programs.get(n);if(r)return this.programs.delete(n),this.programs.set(n,r),r;if(this.programs.size>=ff){let[o,l]=this.programs.entries().next().value;this.programs.delete(o),l.state!=="compiling"&&this.r.shader_remove(l.id)}let s=this.nextId++,i=Vi(this.r.shader_add(s,Cr[e],t)),a={id:s,scope:e,report:i,state:i.ok?"compiling":"failed",browser:[],settled:Promise.resolve()};if(i.ok){let o=this.compile(a).finally(()=>this.pending.delete(o));this.pending.add(o),a.settled=o}return this.programs.set(n,a),a}hasPending(){return this.pending.size>0}async whenReady(){for(;this.pending.size;)await Promise.all([...this.pending])}async compile(e){let t=this.r.gpu_device(),n=e.report.wgsl;try{if(t){let r=t.createShaderModule({code:n}),s=await ti(r.getCompilationInfo(),"compile it");if(e.browser=hf(s.messages,n),s.messages.some(a=>a.type==="error")){e.state="failed",this.r.shader_remove(e.id);return}let i=this.r.shader_formats(Cr[e.scope]);await ti(Promise.all(i.map(a=>t.createRenderPipelineAsync(bf(t,r,e.scope,a)).catch(()=>null))),"build its pipelines"),this.r.shader_build(e.id)}else this.r.shader_build(e.id);e.state="ready",this.onReady()}catch(r){e.state="failed",e.browser.push({line:0,column:0,length:0,message:`error: ${String(r?.message??r)}`,source:"browser"})}}};function hf(e,t){let n=t.indexOf(`// \u2500\u2500 the author's code \u2500\u2500
697
+ ${r}`),this.frame=t,this.failures=n}};async function Ws(e){let{scale:t=1,frame:n,project:r}=e,s=e,{renderContext:i,storageAdapter:a}=s;if(r.tracks.length===0)throw new Error("The project has no tracks to render.");i.pixelRatio=t;let{store:o,precomper:l,stateEvaluator:c,measurer:u,loads:f}=Ns(e),d=Us(a);try{let{totalFrames:p}=l.result(),_=n.kind==="first"?0:n.kind==="last"?p-1:n.frame,w=Math.max(0,Math.min(p-1,Math.floor(_))),A=l.ensureCovering(w);Vs(o,A,w);let B=f.manager=new Fs(A,a,new Dn);return await js(o,B,Bs(o.spans,w).map(L=>L.id)),await B.loadAt(w),c.stateAt(w),c.layout(u),i.takeRenderIssues(),await $s(s,()=>c.render(i),w),fr(i,new Set,e.onIssue),{frame:w,totalFrames:p}}finally{d(),c.dispose(),o.dispose()}}function Vs(e,t,n,r=n){let s=new Map(t.buildErrors.filter(i=>e.failed(i.trackId)).map(i=>[i.trackId,i]));if(s.size!==0)for(let i=n;i<=r;i++){let a=Bs(e.spans,i);if(a.length>0&&a.every(o=>s.has(o.id)))throw new Ln(i,a.map(o=>s.get(o.id)))}}import{AUTOFIT_PROBE_SIZE as Fn,CanvasRenderContext2D as Go,Effects as E,StorageAdapter as Ho,WGSL_CONTRACT as zs,alignmentOps as Ko,cornerRadiusOps as Gs,cornerStyleOps as qo,cylinderRadii as Jo,describeEffect as Yo,evaluateParametric as Xo,evaluateRoundedBox as Zo,fillOps as Qo,forEachTexture3D as ec,isStrokeMarker as Wt,isSurfaceTexture3D as tc,isWgslShader as Ni,normalizeUniforms as ji,parseColor as Wi,pathOps as Vi,renderIssueKey as zi,resolveAsciiCharset as nc,resolveCameraPlacement as rc,resolveEffectAxis as kt,resolveEffectColor as Mt,resolveMotionBlurAlignment as sc,resolvePivotPosition as ic,resolveShadowOptions3D as ac,resolveShapeAlignment as oc,resolveShapePivot as cc,resolveSurfaceSource as lc,resolveTexture3D as Gi,resolveVideoTimestamp as uc,segmentsOf as Hs,shaderContractOf as fc,shadowOps as dc,stripShapeAlignmentKeys as hc,strokeOps as pc,toPathString as Hi,withEllipseDescriptor as _c,withLineDescriptor as mc,withPathDescriptor as gc,withPolygonDescriptor as bc,withPolygramDescriptor as wc,withRectDescriptor as yc,withRichTextDescriptor as vc,withTextDescriptor as Ki}from"@motionscript/core";var Ks=Object.defineProperty,oe=(e,t)=>{let n={};for(var r in e)Ks(n,r,{get:e[r],enumerable:!0});return t||Ks(n,Symbol.toStringTag,{value:"Module"}),n},qi=["normal","multiply","screen","overlay","darken","lighten","colorDodge","colorBurn","hardLight","softLight","difference","exclusion","hue","saturation","color","luminosity","plus"],Ce={move:0,line:1,quad:2,cubic:3,close:4},xc={group:0,rect:1,ellipse:2,path:3,compound:4,text:5},kc={union:0,cut:1,intersect:2,exclude:3},Mc={alpha:1,luminance:2,invertAlpha:3,invertLuminance:4,invertAlphaEroded:5,alphaDilated:6},ke={CREATE:1,CHILDREN:2,TRANSFORM:4,SIZE:8,RADII:16,FILL:32,STROKE:64,SHADOWS:128,OPACITY:256,BLEND:512,CLIP:1024,FILTER:2048,PATH:4096,MEMBERS:8192,MASK:16384,TEXT:32768,EFFECTS:65536,ALL:(1<<17)-1},Sc=class{id;kind;children=[];transform=[1,0,0,1,0,0];opacity=1;blend="normal";w=0;h=0;radii=[0,0,0,0];fill;stroke;shadows=[];clip;mask;members;text;effects;effectTime;effectBox;filter;path;evenOdd=!1;dirty=ke.ALL;constructor(e,t){this.id=e,this.kind=t}},Ji=class{width;height;background;root;nodes=[];images=[];dirty=new Set;nextId=0;constructor(e,t,n){this.width=e,this.height=t,this.background=n,this.root=this.make("group",{})}make(e,t){let n=new Sc(this.nextId++,e);return Object.assign(n,t),this.nodes.push(n),this.dirty.add(n),n}add(e,t,n){let r=this.make(t,n);return e.children.push(r),this.touch(e,ke.CHILDREN),r}group(e,t={}){return this.add(e,"group",t)}rect(e,t){return this.add(e,"rect",t)}ellipse(e,t){return this.add(e,"ellipse",t)}pathNode(e,t){return this.add(e,"path",t)}compound(e,t){return this.add(e,"compound",t)}textNode(e,t){return this.add(e,"text",t)}addImage(e,t,n,r={}){let s={id:this.images.length,width:t,height:n,source:e,mipmaps:r.mipmaps??!0,version:1};return this.images.push(s),s}addScene3D(e,t,n,r){let s={id:this.images.length,width:t,height:n,source:null,mipmaps:!1,version:1,scene3d:e,links3d:r};return this.images.push(s),s}detached(e={}){return this.make("group",e)}addSurface(e,t,n){let r={id:this.images.length,width:t,height:n,source:null,mipmaps:!1,version:1,surface:e};return this.images.push(r),r}touch(e,t){e.dirty|=t,this.dirty.add(e)}touchAll(){for(let e of this.nodes)this.touch(e,ke.ALL)}};function Vn(e){return e.length===9&&(e[6]!==0||e[7]!==0||e[8]!==1)}function qs(e){return e.length===9?[e[0],e[2],e[4],e[1],e[3],e[5],e[6],e[7],e[8]]:[e[0],e[2],e[4],e[1],e[3],e[5],0,0,1]}function Ec(e,t){let n=qs(e),r=qs(t),s=new Array(9);for(let i=0;i<3;i++)for(let a=0;a<3;a++)s[i*3+a]=n[i*3]*r[a]+n[i*3+1]*r[3+a]+n[i*3+2]*r[6+a];return[s[0],s[3],s[1],s[4],s[2],s[5],s[6],s[7],s[8]]}function hr(e,t){return e.length===9||t.length===9?Ec(e,t):[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}var rt=class{verbs=[];pts=[];moveTo(e,t){return this.verbs.push(Ce.move),this.pts.push(e,t),this}lineTo(e,t){return this.verbs.push(Ce.line),this.pts.push(e,t),this}quadTo(e,t,n,r){return this.verbs.push(Ce.quad),this.pts.push(e,t,n,r),this}cubicTo(e,t,n,r,s,i){return this.verbs.push(Ce.cubic),this.pts.push(e,t,n,r,s,i),this}close(){return this.verbs.push(Ce.close),this}build(){return{verbs:Uint8Array.from(this.verbs),points:Float32Array.from(this.pts)}}};function Js(e,t){let n=new Float32Array(e.points.length);for(let r=0;r<n.length;r+=2){let s=e.points[r],i=e.points[r+1];n[r]=t[0]*s+t[2]*i+t[4],n[r+1]=t[1]*s+t[3]*i+t[5]}return{verbs:e.verbs,points:n}}function it(e){let t=1/0,n=1/0,r=-1/0,s=-1/0;for(let i=0;i<e.points.length;i+=2)t=Math.min(t,e.points[i]),r=Math.max(r,e.points[i]),n=Math.min(n,e.points[i+1]),s=Math.max(s,e.points[i+1]);return Number.isFinite(t)?[t,n,r,s]:[0,0,0,0]}function Ac(e){return e.op??(e.cut?"cut":"union")}function Tc(e){if(e.matrix)return{m:e.matrix,tile:e.tile??"clamp"};let{sx:t,sy:n,ox:r,oy:s,tile:i}=Pc(e);return{m:[t,0,0,n,r,s],tile:i}}function Pc(e){let[t,n,r,s]=e.box,i=e.image.width,a=e.image.height,o=e.fit??"fill";if(o==="stretch")return{sx:r/i,sy:s/a,ox:t,oy:n,tile:"clamp"};if(o==="tile")return{sx:1,sy:1,ox:t,oy:n,tile:"repeat"};let l=o==="fill"?Math.max(r/i,s/a):Math.min(r/i,s/a);return{sx:l,sy:l,ox:t+(r-i*l)/2,oy:n+(s-a*l)/2,tile:o==="fill"?"clamp":"decal"}}var wt=e=>e.replace(/^\.?\//,"");function Ys(e,t,n,r){if(n.matrix)return n.matrix instanceof Float32Array?Array.from(n.matrix):n.matrix.flat();let s=n.zoom??1;if(!r)return[s,0,0,0,s,0,0,0,1];let i=n.fit??"fill",a=r.right-r.left,o=r.bottom-r.top,l=i==="tile"?void 0:n.crop,c=l?l.left*e:0,u=l?l.top*t:0,f=l?e*(1-l.left-l.right):e,d=l?t*(1-l.top-l.bottom):t;if(f<=0||d<=0)return[s,0,r.left,0,s,r.top,0,0,1];let p,_;if(i==="fit"?p=_=Math.min(a/f,o/d):i==="stretch"?(p=a/f,_=o/d):i==="tile"?p=_=1:p=_=Math.max(a/f,o/d),p*=s,_*=s,i==="tile")return[p,0,r.left,0,_,r.top,0,0,1];let w=n.anchor??{x:0,y:0},A=(w.x+1)/2,B=(1-w.y)/2,L=r.left+A*(a-f*p)-c*p,V=r.top+B*(o-d*_)-u*_;return[p,0,L,0,_,V,0,0,1]}function Bn(e,t,n){let r=(n[0]+n[2])/2,s=(n[1]+n[3])/2;return[r+e*((n[2]-n[0])/2),s-t*((n[3]-n[1])/2)]}function pr(e,t){return e.map((n,r)=>({offset:t[r]??r/Math.max(1,e.length-1),color:[n[0],n[1],n[2],n[3]]}))}function He(e,t,n,r){let s=e,i=r?a=>r.image(a):void 0;switch(s.type){case"video":{let a=r?.video(s);if(!a)return n.add("fill:video-not-decoded"),null;let o=Ys(a.width,a.height,s,{left:t[0],top:t[1],right:t[2],bottom:t[3]}),l=s.fit??"fill",c=l==="tile"?"repeat":l!=="fit"&&(s.zoom??1)>=1?"clamp":"decal";return{kind:"image",image:a,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]],matrix:[o[0],o[3],o[1],o[4],o[2],o[5]],tile:c}}case"canvas3D":{if(!r)return null;let a=t[2]-t[0],o=t[3]-t[1];if(!(a>0)||!(o>0))return null;let l=Math.min(s.maxPixelRatio??2,Math.max(r.deviceScale(),1));return{kind:"image",image:r.scene3d(s.scene,a,o,l),box:[t[0],t[1],a,o],fit:"stretch"}}case"image":{let a=i?.(s.src);if(!a)return n.add("fill:image-not-loaded"),null;let o=Ys(a.width,a.height,s,{left:t[0],top:t[1],right:t[2],bottom:t[3]}),l=[o[0],o[3],o[1],o[4],o[2],o[5]];if(r?.imageEdge){let f=r.deviceScale();r.imageEdge(s.src,Math.max(a.width*Math.hypot(l[0],l[1]),a.height*Math.hypot(l[2],l[3]))*f)}let c=s.fit??"fill",u=c==="tile"?"repeat":c!=="fit"&&(s.zoom??1)>=1?"clamp":"decal";return{kind:"image",image:a,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]],matrix:l,tile:u}}case"solid":return{kind:"solid",color:[s.color[0],s.color[1],s.color[2],s.color[3]]};case"linear-gradient":return{kind:"linear",from:Bn(s.start.x,s.start.y,t),to:Bn(s.end.x,s.end.y,t),stops:pr(s.colors,s.stops)};case"conic-gradient":{let a=s.startAngle??0,o=s.stops.length===s.colors.length?s.stops:[];return{kind:"sweep",center:Bn(s.center.x,s.center.y,t),startAngle:a,endAngle:a+360,stops:pr(s.colors,o)}}case"radial-gradient":return{kind:"radial",center:Bn(s.center.x,s.center.y,t),radius:s.radius,stops:pr(s.colors,s.stops)};case"shader":{if(!s.source?.trim())return null;if(!Ni(s))break;r?.checkShader?.(s);let a=s.textures?.[0]?i?.(s.textures[0].src):void 0;return s.textures?.[0]&&!a?(n.add("fill:image-not-loaded"),null):{kind:"shader",source:s.source,uniforms:s.uniforms??{},time:r?.time?.()??0,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]],...a?{texture:a}:{}}}case"dotGrid":case"grid":case"stripe":case"noise":case"fractalNoise":return{kind:"procedural",fill:s,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]]}}return n.add(s.type==="shader"?"fill:shader-sksl":`fill:${s.type}`),null}function Ic(e,t){let n=e.fill[0],r=n?.type==="solid"?n.color:[0,0,0,1];return{dx:e.offset?.x??0,dy:-(e.offset?.y??0),sigma:e.blur/2,spread:e.spread,color:[r[0],r[1],r[2],r[3]*(n?.opacity??1)]}}var Ur=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ti.unregister(this),e}free(){let e=this.__destroy_into_raw();y.__wbg_mstext_free(e,0)}glyph_path(e,t,n,r){let s=y.mstext_glyph_path(this.__wbg_ptr,e,t,n,r);var i=bt(s[0],s[1]).slice();return y.__wbindgen_free(s[0],s[1]*4,4),i}layout(e,t,n,r,s,i,a){let o=+r,l=+s,c=+i,u=+a,f,d,p,_,w,A;try{f=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),d=ye,p=$n(t,y.__wbindgen_malloc),_=ye,w=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),A=ye}catch(V){throw w&&y.__wbindgen_free(w,A*1,1),p&&y.__wbindgen_free(p,_*4,4),f&&y.__wbindgen_free(f,d*1,1),V}let B=y.mstext_layout(this.__wbg_ptr,f,d,p,_,w,A,o,l,c,u);var L=bt(B[0],B[1]).slice();return y.__wbindgen_free(B[0],B[1]*4,4),L}measure_text(e,t,n,r,s,i){let a=+t,o=+r,l=+s,c=+i,u,f,d,p;try{u=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),f=ye,d=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),p=ye}catch(A){throw d&&y.__wbindgen_free(d,p*1,1),u&&y.__wbindgen_free(u,f*1,1),A}let _=y.mstext_measure_text(this.__wbg_ptr,u,f,a,d,p,o,l,c);var w=bt(_[0],_[1]).slice();return y.__wbindgen_free(_[0],_[1]*4,4),w}constructor(){let e=y.mstext_new();return this.__wbg_ptr=e,ti.register(this,this.__wbg_ptr,this),this}register_font(e,t){let n,r,s,i;try{n=jr(e,y.__wbindgen_malloc),r=ye,s=Oe(t,y.__wbindgen_malloc,y.__wbindgen_realloc),i=ye}catch(a){throw s&&y.__wbindgen_free(s,i*1,1),n&&y.__wbindgen_free(n,r*1,1),a}return y.mstext_register_font(this.__wbg_ptr,n,r,s,i)}set_default_fallbacks(e){let t=Nr(e,y.__wbindgen_malloc),n=ye;y.mstext_set_default_fallbacks(this.__wbg_ptr,t,n)}set_family_fallbacks(e,t){let n,r,s,i;try{n=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),r=ye,s=Nr(t,y.__wbindgen_malloc),i=ye}catch(a){throw s&&y.__wbindgen_free(s,i*4,4),n&&y.__wbindgen_free(n,r*1,1),a}y.mstext_set_family_fallbacks(this.__wbg_ptr,n,r,s,i)}text_block(e,t,n,r,s,i,a,o,l,c,u){let f=+r,d=+s,p=+i,_=+a,w=+o,A=+l,B=+c,L=+u,V,se,X,pe,ue,q;try{V=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),se=ye,X=$n(t,y.__wbindgen_malloc),pe=ye,ue=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),q=ye}catch($){throw ue&&y.__wbindgen_free(ue,q*1,1),X&&y.__wbindgen_free(X,pe*4,4),V&&y.__wbindgen_free(V,se*1,1),$}let ae=y.mstext_text_block(this.__wbg_ptr,V,se,X,pe,ue,q,f,d,p,_,w,A,B,L);var G=bt(ae[0],ae[1]).slice();return y.__wbindgen_free(ae[0],ae[1]*4,4),G}text_on_path(e,t,n,r,s,i){let a=+r,o=+s,l,c,u,f,d,p,_,w;try{l=Oe(e,y.__wbindgen_malloc,y.__wbindgen_realloc),c=ye,u=$n(t,y.__wbindgen_malloc),f=ye,d=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),p=ye,_=$n(i,y.__wbindgen_malloc),w=ye}catch(L){throw _&&y.__wbindgen_free(_,w*4,4),d&&y.__wbindgen_free(d,p*1,1),u&&y.__wbindgen_free(u,f*4,4),l&&y.__wbindgen_free(l,c*1,1),L}let A=y.mstext_text_on_path(this.__wbg_ptr,l,c,u,f,d,p,a,o,_,w);var B=bt(A[0],A[1]).slice();return y.__wbindgen_free(A[0],A[1]*4,4),B}};Symbol.dispose&&(Ur.prototype[Symbol.dispose]=Ur.prototype.free);var Vt=class Yi{static __wrap(t){let n=Object.create(Yi.prototype);return n.__wbg_ptr=t,ni.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ni.unregister(this),t}free(){let t=this.__destroy_into_raw();y.__wbg_renderer_free(t,0)}adapter_info(){let t,n;try{let r=y.renderer_adapter_info(this.__wbg_ptr);return t=r[0],n=r[1],Ee(r[0],r[1])}finally{y.__wbindgen_free(t,n,1)}}apply(t){let n=y.renderer_apply(this.__wbg_ptr,t);if(n[1])throw ot(n[0])}static create(t,n,r){return y.renderer_create(t,n,r)}delta_buffer(t){return y.renderer_delta_buffer(this.__wbg_ptr,t)>>>0}delta_capacity(){return y.renderer_delta_capacity(this.__wbg_ptr)>>>0}effect_names(){let t=y.renderer_effect_names(this.__wbg_ptr);var n=xr(t[0],t[1]);return y.__wbindgen_free(t[0],t[1]*4,4),n}static forget_device(){y.renderer_forget_device()}free_image(t){y.renderer_free_image(this.__wbg_ptr,t)}gpu_device(){return y.renderer_gpu_device(this.__wbg_ptr)}invalidate(){y.renderer_invalidate(this.__wbg_ptr)}measure_text(t,n,r,s,i,a){let o=+n,l=+s,c=+i,u=+a,f,d,p,_;try{f=Oe(t,y.__wbindgen_malloc,y.__wbindgen_realloc),d=ye,p=Oe(r,y.__wbindgen_malloc,y.__wbindgen_realloc),_=ye}catch(B){throw p&&y.__wbindgen_free(p,_*1,1),f&&y.__wbindgen_free(f,d*1,1),B}let w=y.renderer_measure_text(this.__wbg_ptr,f,d,o,p,_,l,c,u);var A=bt(w[0],w[1]).slice();return y.__wbindgen_free(w[0],w[1]*4,4),A}static prewarm(){return y.renderer_prewarm()}read_pixels(){return y.renderer_read_pixels(this.__wbg_ptr)}register_font(t,n){let r,s,i,a;try{r=jr(t,y.__wbindgen_malloc),s=ye,i=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),a=ye}catch(o){throw i&&y.__wbindgen_free(i,a*1,1),r&&y.__wbindgen_free(r,s*1,1),o}return y.renderer_register_font(this.__wbg_ptr,r,s,i,a)}render(){let t=y.renderer_render(this.__wbg_ptr);if(t[1])throw ot(t[0])}resize(t,n){y.renderer_resize(this.__wbg_ptr,t,n)}scene3d_bind(t,n,r,s){y.renderer_scene3d_bind(this.__wbg_ptr,t,n,r,s)}scene3d_pixels(t,n,r,s,i,a){let o=+t,l=+n,c=+s,u=+i,f=+a,d=jr(r,y.__wbindgen_malloc),p=ye;y.renderer_scene3d_pixels(this.__wbg_ptr,o,l,d,p,c,u,f)}scene3d_skipped(t){let n=y.renderer_scene3d_skipped(this.__wbg_ptr,t);var r=xr(n[0],n[1]);return y.__wbindgen_free(n[0],n[1]*4,4),r}set_options(t,n){y.renderer_set_options(this.__wbg_ptr,t,n)}set_scene3d(t,n,r,s){let i=+t,a=+n,o=+r,l=Nr(s,y.__wbindgen_malloc),c=ye,u=y.renderer_set_scene3d(this.__wbg_ptr,i,a,o,l,c);if(u[1])throw ot(u[0])}set_surface(t,n,r,s){y.renderer_set_surface(this.__wbg_ptr,t,n,r,s)}shader_add(t,n,r){let s,i;try{let a=+t,o=+n,l=Oe(r,y.__wbindgen_malloc,y.__wbindgen_realloc),c=ye,u=y.renderer_shader_add(this.__wbg_ptr,a,o,l,c);return s=u[0],i=u[1],Ee(u[0],u[1])}finally{y.__wbindgen_free(s,i,1)}}shader_build(t){y.renderer_shader_build(this.__wbg_ptr,t)}shader_formats(t){let n=y.renderer_shader_formats(this.__wbg_ptr,t);var r=xr(n[0],n[1]);return y.__wbindgen_free(n[0],n[1]*4,4),r}shader_remove(t){y.renderer_shader_remove(this.__wbg_ptr,t)}stats(){let t=y.renderer_stats(this.__wbg_ptr);var n=tl(t[0],t[1]).slice();return y.__wbindgen_free(t[0],t[1]*8,8),n}text_block_layout(t){let n=y.renderer_text_block_layout(this.__wbg_ptr,t);var r=bt(n[0],n[1]).slice();return y.__wbindgen_free(n[0],n[1]*4,4),r}upload_image(t,n,r){let s=y.renderer_upload_image(this.__wbg_ptr,t,n,r);if(s[1])throw ot(s[0])}wait_gpu(){return y.renderer_wait_gpu(this.__wbg_ptr)}};Symbol.dispose&&(Vt.prototype[Symbol.dispose]=Vt.prototype.free);function Rc(e){y.set_panic_listener(tt(e)?0:Ke(e))}function Xi(e,t){let n,r;try{let s=+e,i=Oe(t,y.__wbindgen_malloc,y.__wbindgen_realloc),a=ye,o=y.validate_shader(s,i,a);return n=o[0],r=o[1],Ee(o[0],o[1])}finally{y.__wbindgen_free(n,r,1)}}function Cc(){return{__proto__:null,"./ms_renderer_bg.js":{__proto__:null,__wbg_Error_208446807d0d1e30:function(e,t){return Error(Ee(e,t))},__wbg_Window_2805651c516cb7aa:function(e){return e.Window},__wbg_WorkerGlobalScope_174390815d0a4893:function(e){return e.WorkerGlobalScope},__wbg___wbindgen_debug_string_f249a2a76caa9a55:function(e,t){let n=Oe(Zi(t),y.__wbindgen_malloc,y.__wbindgen_realloc),r=ye;Ve().setInt32((e>>>0)+4,r,!0),Ve().setInt32((e>>>0)+0,n,!0)},__wbg___wbindgen_is_function_741ff2bb612836f5:function(e){return typeof e=="function"},__wbg___wbindgen_is_null_c22311b1cc228e3a:function(e){return e===null},__wbg___wbindgen_is_string_fc456fee5d3317de:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_be5b34249ff1fc15:function(e){return e===void 0},__wbg___wbindgen_throw_4c88d8bf264fd984:function(e,t){throw new Error(Ee(e,t))},__wbg__wbg_cb_unref_09736879a3f67559:function(e){e._wbg_cb_unref()},__wbg_beginRenderPass_597e3973321fd369:function(){return Re(function(e,t){return e.beginRenderPass(t)},arguments)},__wbg_call_40b008ba32f73991:function(){return Re(function(e,t){return e.call(t)},arguments)},__wbg_call_a410eb4b59ed5965:function(){return Re(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearBuffer_3d5a3057c3c8a9bf:function(e,t,n,r){e.clearBuffer(t,n,r)},__wbg_clearBuffer_82ba999c294f42fb:function(e,t,n){e.clearBuffer(t,n)},__wbg_configure_8e04ab1a867d31e1:function(){return Re(function(e,t){e.configure(t)},arguments)},__wbg_copyExternalImageToTexture_9d1383f644366eae:function(){return Re(function(e,t,n,r){e.copyExternalImageToTexture(t,n,r)},arguments)},__wbg_copyTextureToBuffer_2a1eda98bb347f8c:function(){return Re(function(e,t,n,r){e.copyTextureToBuffer(t,n,r)},arguments)},__wbg_createBindGroupLayout_5699617270d84042:function(){return Re(function(e,t){return e.createBindGroupLayout(t)},arguments)},__wbg_createBindGroup_f539b26ca341308f:function(e,t){return e.createBindGroup(t)},__wbg_createBuffer_b8c5b520d2c822b8:function(){return Re(function(e,t){return e.createBuffer(t)},arguments)},__wbg_createCommandEncoder_3352d1ffc36c6fc0:function(e,t){return e.createCommandEncoder(t)},__wbg_createPipelineLayout_6eab52c327118937:function(e,t){return e.createPipelineLayout(t)},__wbg_createRenderPipeline_58390ba302107691:function(){return Re(function(e,t){return e.createRenderPipeline(t)},arguments)},__wbg_createSampler_9bd91d7e928c0060:function(e,t){return e.createSampler(t)},__wbg_createShaderModule_cefa51336cb288ae:function(e,t){return e.createShaderModule(t)},__wbg_createTexture_2c95e64f50008aea:function(){return Re(function(e,t){return e.createTexture(t)},arguments)},__wbg_createView_96e5e405cc3c01e8:function(){return Re(function(e,t){return e.createView(t)},arguments)},__wbg_description_7a568e202a00293f:function(e,t){let n=t.description,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=ye;Ve().setInt32((e>>>0)+4,s,!0),Ve().setInt32((e>>>0)+0,r,!0)},__wbg_destroy_249478e98a7943d5:function(e){e.destroy()},__wbg_destroy_637537007d9eaa44:function(e){e.destroy()},__wbg_displayHeight_fb2700c23cca6739:function(e){return e.displayHeight},__wbg_displayWidth_9e9d6031a3036613:function(e){return e.displayWidth},__wbg_document_3b5c3071b43e97ee:function(e){let t=e.document;return tt(t)?0:Ke(t)},__wbg_drawIndexed_638959aae942557c:function(e,t,n,r,s,i){e.drawIndexed(t>>>0,n>>>0,r>>>0,s,i>>>0)},__wbg_draw_086a9578fc9898c2:function(e,t,n,r,s){e.draw(t>>>0,n>>>0,r>>>0,s>>>0)},__wbg_end_b57473834b877409:function(e){e.end()},__wbg_error_757e9472f8410341:function(e,t){let n,r;try{n=e,r=t,console.error(Ee(e,t))}finally{y.__wbindgen_free(n,r,1)}},__wbg_finish_09ec094c10f41e7b:function(e){return e.finish()},__wbg_finish_ec1c191f66a895b1:function(e,t){return e.finish(t)},__wbg_getContext_1938edb9a972f63d:function(){return Re(function(e,t,n){let r=e.getContext(Ee(t,n));return tt(r)?0:Ke(r)},arguments)},__wbg_getContext_d93f904b714852ae:function(){return Re(function(e,t,n){let r=e.getContext(Ee(t,n));return tt(r)?0:Ke(r)},arguments)},__wbg_getCurrentTexture_c3b1727224d7f6e6:function(){return Re(function(e){return e.getCurrentTexture()},arguments)},__wbg_getMappedRange_28e816a763520e01:function(){return Re(function(e,t,n){return e.getMappedRange(t,n)},arguments)},__wbg_getPreferredCanvasFormat_0ef5034c8902201b:function(e){let t=e.getPreferredCanvasFormat();return(ht.indexOf(t)+1||102)-1},__wbg_get_0c55869fe53c7d14:function(e,t){let n=e[t>>>0];return tt(n)?0:Ke(n)},__wbg_gpu_514705c6dd1f0dab:function(e){return e.gpu},__wbg_height_a587c99454238459:function(e){return e.height},__wbg_height_a6466ebf29036658:function(e){return e.height},__wbg_height_ac6f1c3f49c13fe2:function(e){return e.height},__wbg_info_8554cb7af37427b6:function(e){return e.info},__wbg_instanceof_HtmlCanvasElement_89f280683e987b9e:function(e){let t;try{t=e instanceof HTMLCanvasElement}catch{t=!1}return t},__wbg_instanceof_HtmlImageElement_f22acd64d72ae23a:function(e){let t;try{t=e instanceof HTMLImageElement}catch{t=!1}return t},__wbg_instanceof_HtmlVideoElement_64f13b58baf30810:function(e){let t;try{t=e instanceof HTMLVideoElement}catch{t=!1}return t},__wbg_instanceof_ImageBitmap_536fdba57df2c6ac:function(e){let t;try{t=e instanceof ImageBitmap}catch{t=!1}return t},__wbg_instanceof_OffscreenCanvas_fcf6ec01367f54ec:function(e){let t;try{t=e instanceof OffscreenCanvas}catch{t=!1}return t},__wbg_instanceof_VideoFrame_cd5d3aac6098cfc2:function(e){let t;try{t=e instanceof VideoFrame}catch{t=!1}return t},__wbg_instanceof_Window_5cf453f5639aa1a2:function(e){let t;try{t=e instanceof Window}catch{t=!1}return t},__wbg_isFallbackAdapter_6a4fa7356d18310b:function(e){return e.isFallbackAdapter},__wbg_label_fceb40a43a358e62:function(e,t){let n=t.label,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=ye;Ve().setInt32((e>>>0)+4,s,!0),Ve().setInt32((e>>>0)+0,r,!0)},__wbg_length_186163212ffe79c3:function(e){return e.length},__wbg_limits_4e444eb8c2e61c45:function(e){return e.limits},__wbg_limits_98515cc885d709ef:function(e){return e.limits},__wbg_lost_25273dba897db03c:function(e){return e.lost},__wbg_mapAsync_b0597127f5037286:function(e,t,n,r){return e.mapAsync(t>>>0,n,r)},__wbg_maxBindGroupsPlusVertexBuffers_1face4afb5363937:function(e){return e.maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_a0b7e55762f095b9:function(e){return e.maxBindGroups},__wbg_maxBindingsPerBindGroup_ec9067be38d6ec72:function(e){return e.maxBindingsPerBindGroup},__wbg_maxBufferSize_a9ce15e541c64cd2:function(e){return e.maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_44089e129e1a2a1d:function(e){return e.maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_6bd8156394ba618c:function(e){return e.maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_7b086f15ef868934:function(e){return e.maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_8bbe505e0ac8dc18:function(e){return e.maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_7228ed3935eecc31:function(e){return e.maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_6092b56a967f6f8d:function(e){return e.maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_4773e3bd3936df36:function(e){return e.maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_79222bf8e8a90fbd:function(e){return e.maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_3ab5762b1b2c7fc2:function(e){return e.maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_722da31d0de1c256:function(e){return e.maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_821096d4b3020715:function(e){return e.maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_c6aea9e05c0a02ca:function(e){return e.maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_3aa30f6c002d3a99:function(e){return e.maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_84a2c2433627fca2:function(e){return e.maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_25b96748df28dc20:function(e){return e.maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_53ed734f26e6c1ad:function(e){return e.maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_9ec487f1ce102992:function(e){return e.maxTextureArrayLayers},__wbg_maxTextureDimension1D_faef91b2e9fa6740:function(e){return e.maxTextureDimension1D},__wbg_maxTextureDimension2D_3a923eb2df4d9124:function(e){return e.maxTextureDimension2D},__wbg_maxTextureDimension3D_943321fe5945464e:function(e){return e.maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_21e89ff761d576db:function(e){return e.maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_19a0bfb0189f7254:function(e){return e.maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_49aef6c51d07a280:function(e){return e.maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f68c4029e6f047ec:function(e){return e.maxVertexBufferArrayStride},__wbg_maxVertexBuffers_ce9f15a623f9aac7:function(e){return e.maxVertexBuffers},__wbg_message_5223ba7df7256eac:function(e,t){let n=t.message,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=ye;Ve().setInt32((e>>>0)+4,s,!0),Ve().setInt32((e>>>0)+0,r,!0)},__wbg_minStorageBufferOffsetAlignment_529f1f52e61188fc:function(e){return e.minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_519e26287e1996a3:function(e){return e.minUniformBufferOffsetAlignment},__wbg_naturalHeight_fb7d27a9642e796c:function(e){return e.naturalHeight},__wbg_naturalWidth_c3b5a9ac32cd185e:function(e){return e.naturalWidth},__wbg_navigator_9641ab32fa612dd1:function(e){return e.navigator},__wbg_navigator_c17f443a6fe5d38d:function(e){return e.navigator},__wbg_new_2bfd0f45e60518b1:function(){return Re(function(e,t){return new OffscreenCanvas(e>>>0,t>>>0)},arguments)},__wbg_new_ba40181b3f24ac80:function(e,t){try{var n={a:e,b:t},r=(s,i)=>{let a=n.a;n.a=0;try{return Xs(a,n.b,s,i)}finally{n.a=a}};return new Promise(r)}finally{n.a=0}},__wbg_new_bb74001155cb8ca8:function(){return new Error},__wbg_new_cd4348290afae586:function(){return new Object},__wbg_new_typed_6b60b99917da27d6:function(){return new Object},__wbg_new_typed_e09da9dae6ee5935:function(e,t){try{var n={a:e,b:t},r=(s,i)=>{let a=n.a;n.a=0;try{return Xs(a,n.b,s,i)}finally{n.a=a}};return new Promise(r)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_3cd32055a417f095:function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},__wbg_new_with_length_01b143a7e5dd5a3e:function(e){return new Uint8Array(e>>>0)},__wbg_now_84237b99fa85a391:function(){return performance.now()},__wbg_onSubmittedWorkDone_1190213cee1ecf7e:function(e){return e.onSubmittedWorkDone()},__wbg_prototypesetcall_13162965d1fe7aa3:function(e,t,n){Uint8Array.prototype.set.call(Zt(e,t),n)},__wbg_querySelectorAll_6c1bd81d448fb480:function(){return Re(function(e,t,n){return e.querySelectorAll(Ee(t,n))},arguments)},__wbg_queueMicrotask_1e8503a8a690f0a3:function(e){return e.queueMicrotask},__wbg_queueMicrotask_4a1a4d8dd332373b:function(e){queueMicrotask(e)},__wbg_queue_e250e2ebc49b39e0:function(e){return e.queue},__wbg_reason_53e762e714b67b72:function(e){let t=e.reason;return(zc.indexOf(t)+1||3)-1},__wbg_renderer_new:function(e){return Vt.__wrap(e)},__wbg_requestAdapter_a539af006419f2e9:function(e,t){return e.requestAdapter(t)},__wbg_requestDevice_5cb8a582e55d08cb:function(e,t){return e.requestDevice(t)},__wbg_resolve_dbf78ab4942478b0:function(e){return Promise.resolve(e)},__wbg_setBindGroup_418c3e0eb6943ce0:function(e,t,n){e.setBindGroup(t>>>0,n)},__wbg_setBindGroup_82d014e8f799f053:function(){return Re(function(e,t,n,r,s,i,a){e.setBindGroup(t>>>0,n,nl(r,s),i,a>>>0)},arguments)},__wbg_setIndexBuffer_241097e303986c14:function(e,t,n,r,s){e.setIndexBuffer(t,ei[n],r,s)},__wbg_setPipeline_b6f981027e02cd16:function(e,t){e.setPipeline(t)},__wbg_setScissorRect_889235eeb784732b:function(e,t,n,r,s){e.setScissorRect(t>>>0,n>>>0,r>>>0,s>>>0)},__wbg_setVertexBuffer_6db3b60e99280744:function(e,t,n,r){e.setVertexBuffer(t>>>0,n,r)},__wbg_setVertexBuffer_cbf4ca1627c02f4c:function(e,t,n,r,s){e.setVertexBuffer(t>>>0,n,r,s)},__wbg_setViewport_c0be08dcc8965ccf:function(e,t,n,r,s,i,a){e.setViewport(t,n,r,s,i,a)},__wbg_set_118fefd528ab0a79:function(e,t,n){e.set(t,n>>>0)},__wbg_set_2793479888329cb6:function(){return Re(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_a_1c94f1413a06c773:function(e,t){e.a=t},__wbg_set_access_b0a6fbebfbe53242:function(e,t){e.access=Yc[t]},__wbg_set_address_mode_u_a39aefdf030758ae:function(e,t){e.addressModeU=_r[t]},__wbg_set_address_mode_v_999ec6ed4d587e8c:function(e,t){e.addressModeV=_r[t]},__wbg_set_address_mode_w_a936c884ccf08234:function(e,t){e.addressModeW=_r[t]},__wbg_set_alpha_84214d12347c6647:function(e,t){e.alpha=t},__wbg_set_alpha_mode_278c6649365aff36:function(e,t){e.alphaMode=jc[t]},__wbg_set_alpha_to_coverage_enabled_1e879520cab4bb05:function(e,t){e.alphaToCoverageEnabled=t!==0},__wbg_set_array_layer_count_bd7a074559a0abaa:function(e,t){e.arrayLayerCount=t>>>0},__wbg_set_array_stride_f64_b132c6a79afeae43:function(e,t){e.arrayStride=t},__wbg_set_aspect_1db857832468d61f:function(e,t){e.aspect=yr[t]},__wbg_set_aspect_3b0dceed92671cc1:function(e,t){e.aspect=yr[t]},__wbg_set_aspect_8c866a3891032753:function(e,t){e.aspect=yr[t]},__wbg_set_attributes_67bbc44b08e038d6:function(e,t,n){e.attributes=ze(t,n)},__wbg_set_b_a93bcfdd1c29a0bd:function(e,t){e.b=t},__wbg_set_base_array_layer_e745f84c2e5437e2:function(e,t){e.baseArrayLayer=t>>>0},__wbg_set_base_mip_level_fe08854fab09de85:function(e,t){e.baseMipLevel=t>>>0},__wbg_set_beginning_of_pass_write_index_a13b608f19d6a2f0:function(e,t){e.beginningOfPassWriteIndex=t>>>0},__wbg_set_bind_group_layouts_383f681565a30d8a:function(e,t,n){e.bindGroupLayouts=ze(t,n)},__wbg_set_binding_bd7d6b01bb08823a:function(e,t){e.binding=t>>>0},__wbg_set_binding_dbed4a234264971a:function(e,t){e.binding=t>>>0},__wbg_set_blend_1f3e5b36f9c246cb:function(e,t){e.blend=t},__wbg_set_buffer_292fb3c30928dc50:function(e,t){e.buffer=t},__wbg_set_buffer_76841cdbff393f1d:function(e,t){e.buffer=t},__wbg_set_buffer_91f4e8e05066c37a:function(e,t){e.buffer=t},__wbg_set_buffers_47665c552e27672c:function(e,t,n){e.buffers=ze(t,n)},__wbg_set_bytes_per_row_4ef9c2c51932b041:function(e,t){e.bytesPerRow=t>>>0},__wbg_set_bytes_per_row_75441352f606ebc8:function(e,t){e.bytesPerRow=t>>>0},__wbg_set_clear_value_gpu_color_dict_303e0009591e5d26:function(e,t){e.clearValue=t},__wbg_set_code_130aebc49c4cadd3:function(e,t,n){e.code=Ee(t,n)},__wbg_set_color_6d2de56a2224ec57:function(e,t){e.color=t},__wbg_set_color_attachments_e83f79badceda8b4:function(e,t,n){e.colorAttachments=ze(t,n)},__wbg_set_compare_159af15eb77dbcd2:function(e,t){e.compare=mr[t]},__wbg_set_compare_4db27ced1edc0322:function(e,t){e.compare=mr[t]},__wbg_set_count_4d1e9559a7f1b993:function(e,t){e.count=t>>>0},__wbg_set_cull_mode_31293d13bc064271:function(e,t){e.cullMode=Vc[t]},__wbg_set_depth_bias_b30728f3ab3f643e:function(e,t){e.depthBias=t},__wbg_set_depth_bias_clamp_5b58fd4819283038:function(e,t){e.depthBiasClamp=t},__wbg_set_depth_bias_slope_scale_8b8b20db6b43c43b:function(e,t){e.depthBiasSlopeScale=t},__wbg_set_depth_clear_value_1165941523836019:function(e,t){e.depthClearValue=t},__wbg_set_depth_compare_81dd71de7e433cc2:function(e,t){e.depthCompare=mr[t]},__wbg_set_depth_fail_op_ddf822c573cdf0c1:function(e,t){e.depthFailOp=br[t]},__wbg_set_depth_load_op_ca270acab0c1ca69:function(e,t){e.depthLoadOp=gr[t]},__wbg_set_depth_or_array_layers_e59f3988a095ccac:function(e,t){e.depthOrArrayLayers=t>>>0},__wbg_set_depth_read_only_49ca399f98b97955:function(e,t){e.depthReadOnly=t!==0},__wbg_set_depth_stencil_41e94739225cb2c3:function(e,t){e.depthStencil=t},__wbg_set_depth_stencil_attachment_36ce3695dfcb6b85:function(e,t){e.depthStencilAttachment=t},__wbg_set_depth_store_op_6cd6bdde49f9050d:function(e,t){e.depthStoreOp=wr[t]},__wbg_set_depth_write_enabled_4b5da11c77fbdab7:function(e,t){e.depthWriteEnabled=t!==0},__wbg_set_device_1940fd5f9e2a7fee:function(e,t){e.device=t},__wbg_set_dimension_88d0c9f16bb079fb:function(e,t){e.dimension=Xc[t]},__wbg_set_dimension_bab9530fa3e311d8:function(e,t){e.dimension=vr[t]},__wbg_set_dst_factor_80c13f29a3e117cb:function(e,t){e.dstFactor=Zs[t]},__wbg_set_end_of_pass_write_index_793fcfe3141dc357:function(e,t){e.endOfPassWriteIndex=t>>>0},__wbg_set_entries_552f52b2aa3b346d:function(e,t,n){e.entries=ze(t,n)},__wbg_set_entries_d9929dbfa2aaa9a7:function(e,t,n){e.entries=ze(t,n)},__wbg_set_entry_point_0eacf7b26b3637b0:function(e,t,n){e.entryPoint=Ee(t,n)},__wbg_set_entry_point_bb3692db4a6065d0:function(e,t,n){e.entryPoint=Ee(t,n)},__wbg_set_external_texture_1bef5ba626275d0a:function(e,t){e.externalTexture=t},__wbg_set_fail_op_739cc3815d38c95f:function(e,t){e.failOp=br[t]},__wbg_set_feb3714f475485ba:function(e,t,n){e.set(Zt(t,n))},__wbg_set_flip_y_ab62f34abbe69be1:function(e,t){e.flipY=t!==0},__wbg_set_format_1119b9930bd324e1:function(e,t){e.format=ht[t]},__wbg_set_format_443ea19e2d25a1e2:function(e,t){e.format=ht[t]},__wbg_set_format_459792306baadae5:function(e,t){e.format=ht[t]},__wbg_set_format_46b1c6b3acc10b24:function(e,t){e.format=ht[t]},__wbg_set_format_5a62f31a4690f935:function(e,t){e.format=Qc[t]},__wbg_set_format_efec4f7d9471ddbb:function(e,t){e.format=ht[t]},__wbg_set_format_fd579d96fa4e468c:function(e,t){e.format=ht[t]},__wbg_set_fragment_bea523f8973c326e:function(e,t){e.fragment=t},__wbg_set_front_face_30951d0404e9e6d4:function(e,t){e.frontFace=Gc[t]},__wbg_set_g_90eacc6608e549f8:function(e,t){e.g=t},__wbg_set_has_dynamic_offset_6e5f3385eb579529:function(e,t){e.hasDynamicOffset=t!==0},__wbg_set_height_3f64e19acf29f5fb:function(e,t){e.height=t>>>0},__wbg_set_height_ae0610d318c3428c:function(e,t){e.height=t>>>0},__wbg_set_height_ae24c2f7d580ae0a:function(e,t){e.height=t>>>0},__wbg_set_label_08745022b1ec7b66:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_11c9eb57693a8459:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_20c42b4ebeb250d5:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_22e3966c8d513ba6:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_5347fc976d15e94c:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_644bc1b32c7917b0:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_73c99dab6708c962:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_85a21b5fdd57fd91:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_89d2ffaf598df6a4:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_9e68078b9533426b:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_a80ced9a51c33d0f:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_cba03ffef7ae90a3:function(e,t,n){e.label=Ee(t,n)},__wbg_set_label_f654bcb731d4d9ca:function(e,t,n){e.label=Ee(t,n)},__wbg_set_layout_200fc3b143da0a9e:function(e,t){e.layout=t},__wbg_set_layout_3f0cb99635c33123:function(e,t){e.layout=t},__wbg_set_layout_gpu_auto_layout_mode_2e8a53f8643b4f69:function(e,t){e.layout=$c[t]},__wbg_set_load_op_e8c33d4bdd2772aa:function(e,t){e.loadOp=gr[t]},__wbg_set_lod_max_clamp_fcbef26e87120fac:function(e,t){e.lodMaxClamp=t},__wbg_set_lod_min_clamp_f5b6ddca1e4d813f:function(e,t){e.lodMinClamp=t},__wbg_set_mag_filter_ba0a2f25ad41eea8:function(e,t){e.magFilter=Qs[t]},__wbg_set_mapped_at_creation_8af5b87ccb898bbe:function(e,t){e.mappedAtCreation=t!==0},__wbg_set_mask_0de0e782abec3c25:function(e,t){e.mask=t>>>0},__wbg_set_max_anisotropy_8361213d3df93532:function(e,t){e.maxAnisotropy=t},__wbg_set_min_binding_size_f64_c6d68d773b7051d3:function(e,t){e.minBindingSize=t},__wbg_set_min_filter_8aa8b0f7523a0281:function(e,t){e.minFilter=Qs[t]},__wbg_set_mip_level_102afeb158e4f728:function(e,t){e.mipLevel=t>>>0},__wbg_set_mip_level_count_c0ac46de264d83ec:function(e,t){e.mipLevelCount=t>>>0},__wbg_set_mip_level_count_cd650972803ed9eb:function(e,t){e.mipLevelCount=t>>>0},__wbg_set_mip_level_f0c5ed95eedda453:function(e,t){e.mipLevel=t>>>0},__wbg_set_mipmap_filter_1cbdec28d1b54d9d:function(e,t){e.mipmapFilter=Hc[t]},__wbg_set_mode_51d2c5a5ac0f7ac9:function(e,t){e.mode=Wc[t]},__wbg_set_module_3dec1a50bca7870a:function(e,t){e.module=t},__wbg_set_module_b42baf3925e2a94a:function(e,t){e.module=t},__wbg_set_multisample_6af76792fae6efb1:function(e,t){e.multisample=t},__wbg_set_multisampled_ae3f9f01a324f57c:function(e,t){e.multisampled=t!==0},__wbg_set_offset_f64_15176b737de7dde0:function(e,t){e.offset=t},__wbg_set_offset_f64_18de9c771f307302:function(e,t){e.offset=t},__wbg_set_offset_f64_52f728fc5c98a52c:function(e,t){e.offset=t},__wbg_set_offset_f64_9374d9e912985773:function(e,t){e.offset=t},__wbg_set_operation_e103287df7ac9cf6:function(e,t){e.operation=Uc[t]},__wbg_set_origin_gpu_origin_2d_dict_0e541bd50713ae04:function(e,t){e.origin=t},__wbg_set_origin_gpu_origin_3d_dict_26016670147a706c:function(e,t){e.origin=t},__wbg_set_origin_gpu_origin_3d_dict_4e6802818d9d43c7:function(e,t){e.origin=t},__wbg_set_pass_op_4d08c3105f64a17a:function(e,t){e.passOp=br[t]},__wbg_set_power_preference_6bc1d2697a0e7374:function(e,t){e.powerPreference=Kc[t]},__wbg_set_premultiplied_alpha_3625f78af5f2fed6:function(e,t){e.premultipliedAlpha=t!==0},__wbg_set_primitive_ef867d733c4efb1c:function(e,t){e.primitive=t},__wbg_set_query_set_765c4c9ab99342cb:function(e,t){e.querySet=t},__wbg_set_r_1116d6a5f656263d:function(e,t){e.r=t},__wbg_set_required_features_5bda1420e19461b2:function(e,t,n){e.requiredFeatures=ze(t,n)},__wbg_set_required_limits_e78b923d73f9b596:function(e,t){e.requiredLimits=t},__wbg_set_resolve_target_gpu_texture_view_a7a97a7c04d84698:function(e,t){e.resolveTarget=t},__wbg_set_resource_0f960a4279e7e400:function(e,t){e.resource=t},__wbg_set_resource_gpu_buffer_binding_53a2189a77dd38be:function(e,t){e.resource=t},__wbg_set_resource_gpu_texture_view_9153a2356b958667:function(e,t){e.resource=t},__wbg_set_rows_per_image_11e9552fb5c5c5ab:function(e,t){e.rowsPerImage=t>>>0},__wbg_set_rows_per_image_df6af33a5492c1cf:function(e,t){e.rowsPerImage=t>>>0},__wbg_set_sample_count_8262aacc91878e4d:function(e,t){e.sampleCount=t>>>0},__wbg_set_sample_type_563589178fc892fe:function(e,t){e.sampleType=Zc[t]},__wbg_set_sampler_ccdca76ef8e642ca:function(e,t){e.sampler=t},__wbg_set_shader_location_31dc427c303a32aa:function(e,t){e.shaderLocation=t>>>0},__wbg_set_size_f64_3ff72c0d736c42a1:function(e,t){e.size=t},__wbg_set_size_f64_9b65e4916b2eb111:function(e,t){e.size=t},__wbg_set_size_gpu_extent_3d_dict_bba6669c79c26190:function(e,t){e.size=t},__wbg_set_source_b5f82926b86ec9d9:function(e,t){e.source=t},__wbg_set_source_html_canvas_element_a9840c24a328a44e:function(e,t){e.source=t},__wbg_set_source_html_image_element_b2803013cdaaa4f6:function(e,t){e.source=t},__wbg_set_source_html_video_element_9fd22376f74c9aff:function(e,t){e.source=t},__wbg_set_source_image_data_2d6a4979315db9d8:function(e,t){e.source=t},__wbg_set_source_offscreen_canvas_ef8e002b1f9c1fd8:function(e,t){e.source=t},__wbg_set_source_video_frame_e98ea9a6467ae147:function(e,t){e.source=t},__wbg_set_src_factor_7e90d4b7d8227fc5:function(e,t){e.srcFactor=Zs[t]},__wbg_set_stencil_back_6b5aeefbb90ae3ae:function(e,t){e.stencilBack=t},__wbg_set_stencil_clear_value_56fa848198a9b430:function(e,t){e.stencilClearValue=t>>>0},__wbg_set_stencil_front_4ffeca9473bca095:function(e,t){e.stencilFront=t},__wbg_set_stencil_load_op_b7a9fe3ad789b6c6:function(e,t){e.stencilLoadOp=gr[t]},__wbg_set_stencil_read_mask_7cfe0945679de134:function(e,t){e.stencilReadMask=t>>>0},__wbg_set_stencil_read_only_0dde0c073192b5fa:function(e,t){e.stencilReadOnly=t!==0},__wbg_set_stencil_store_op_d320bcbb72456a4c:function(e,t){e.stencilStoreOp=wr[t]},__wbg_set_stencil_write_mask_765017d5830ee98a:function(e,t){e.stencilWriteMask=t>>>0},__wbg_set_step_mode_2b1318f00e2ddc02:function(e,t){e.stepMode=el[t]},__wbg_set_storage_texture_b9e95e260c9d49a3:function(e,t){e.storageTexture=t},__wbg_set_store_op_e2b740eddfd2713f:function(e,t){e.storeOp=wr[t]},__wbg_set_strip_index_format_22ddab1b8f352c1d:function(e,t){e.stripIndexFormat=ei[t]},__wbg_set_targets_07e15f3cca640faf:function(e,t,n){e.targets=ze(t,n)},__wbg_set_texture_7b9ace323bfe7938:function(e,t){e.texture=t},__wbg_set_texture_84a5f84f0f451291:function(e,t){e.texture=t},__wbg_set_texture_b35a4d6a35c491fa:function(e,t){e.texture=t},__wbg_set_timestamp_writes_1d304b9eb09ff227:function(e,t){e.timestampWrites=t},__wbg_set_tone_mapping_23fcd4f846a61048:function(e,t){e.toneMapping=t},__wbg_set_topology_b29804e5549370f5:function(e,t){e.topology=qc[t]},__wbg_set_type_ac87cc570da17000:function(e,t){e.type=Nc[t]},__wbg_set_type_f3d1ad35dc7889f9:function(e,t){e.type=Jc[t]},__wbg_set_unclipped_depth_59155eb615f193fe:function(e,t){e.unclippedDepth=t!==0},__wbg_set_usage_5ba672bf81ba9859:function(e,t){e.usage=t>>>0},__wbg_set_usage_b0070c2ce47149a6:function(e,t){e.usage=t>>>0},__wbg_set_usage_bac3cabe90090275:function(e,t){e.usage=t>>>0},__wbg_set_usage_f3e1a48118ff483a:function(e,t){e.usage=t>>>0},__wbg_set_vertex_00b1e17dc3fe7fb3:function(e,t){e.vertex=t},__wbg_set_view_dimension_e9e9cd07d7ad686d:function(e,t){e.viewDimension=vr[t]},__wbg_set_view_dimension_eb197c35c45e572c:function(e,t){e.viewDimension=vr[t]},__wbg_set_view_formats_2540cdb8dde31055:function(e,t,n){e.viewFormats=ze(t,n)},__wbg_set_view_formats_845b425c1d19e1af:function(e,t,n){e.viewFormats=ze(t,n)},__wbg_set_view_gpu_texture_view_9a3c34ba4d1969b8:function(e,t){e.view=t},__wbg_set_view_gpu_texture_view_efa644c1ce3c4deb:function(e,t){e.view=t},__wbg_set_visibility_65413465e7b24eb6:function(e,t){e.visibility=t>>>0},__wbg_set_width_5f89a551b5472887:function(e,t){e.width=t>>>0},__wbg_set_width_a2410cafbdefeb5a:function(e,t){e.width=t>>>0},__wbg_set_width_eb3001e1dcabb909:function(e,t){e.width=t>>>0},__wbg_set_write_mask_39ce121635fd4296:function(e,t){e.writeMask=t>>>0},__wbg_set_x_b078c58009aa57bd:function(e,t){e.x=t>>>0},__wbg_set_x_d851b2611b154969:function(e,t){e.x=t>>>0},__wbg_set_y_3df92c4bcff23616:function(e,t){e.y=t>>>0},__wbg_set_y_76a6f85fc60d74e5:function(e,t){e.y=t>>>0},__wbg_set_z_3633c53887a9ff5e:function(e,t){e.z=t>>>0},__wbg_stack_575c4e0918581b9c:function(e,t){let n=t.stack,r=Oe(n,y.__wbindgen_malloc,y.__wbindgen_realloc),s=ye;Ve().setInt32((e>>>0)+4,s,!0),Ve().setInt32((e>>>0)+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc:function(){let e=typeof globalThis>"u"?void 0:globalThis;return tt(e)?0:Ke(e)},__wbg_static_accessor_GLOBAL_e4293fb22cbe77da:function(){let e=typeof global>"u"?void 0:global;return tt(e)?0:Ke(e)},__wbg_static_accessor_SELF_53bb20457401453d:function(){let e=typeof self>"u"?void 0:self;return tt(e)?0:Ke(e)},__wbg_static_accessor_WINDOW_b5e0810bfecb7feb:function(){let e=typeof window>"u"?void 0:window;return tt(e)?0:Ke(e)},__wbg_subgroupMaxSize_3586e822dc3603f6:function(e){return e.subgroupMaxSize},__wbg_subgroupMinSize_17f758985cdd1dab:function(e){return e.subgroupMinSize},__wbg_submit_077c85cc28e36892:function(e,t,n){e.submit(ze(t,n))},__wbg_then_3a4f899454bcf8c9:function(e,t){return e.then(t)},__wbg_then_656f253a5dd7d8ea:function(e,t,n){return e.then(t,n)},__wbg_then_e3f7f2d365708be8:function(e,t){return e.then(t)},__wbg_unconfigure_835307f58dc68d80:function(e){e.unconfigure()},__wbg_unmap_6a96b14c9ef5f7f5:function(e){e.unmap()},__wbg_videoHeight_0d108b7f03cde4ef:function(e){return e.videoHeight},__wbg_videoWidth_34b4e257cb35c6ca:function(e){return e.videoWidth},__wbg_width_000813f5f73b7341:function(e){return e.width},__wbg_width_babc5dc7654771b1:function(e){return e.width},__wbg_width_f84552448726a9a9:function(e){return e.width},__wbg_writeBuffer_d7640e64ceb69371:function(){return Re(function(e,t,n,r,s,i,a){e.writeBuffer(t,n,Zt(r,s),i,a)},arguments)},__wbg_writeTexture_dba1e801af087dfd:function(){return Re(function(e,t,n,r,s,i){e.writeTexture(t,Zt(n,r),s,i)},arguments)},__wbindgen_generic_0000000000000001:function(e,t){return Qt(e,t,Dc)},__wbindgen_generic_0000000000000002:function(e,t){return Qt(e,t,Lc)},__wbindgen_generic_0000000000000003:function(e,t){return Qt(e,t,Oc)},__wbindgen_generic_0000000000000004:function(e,t){return Qt(e,t,Fc)},__wbindgen_generic_0000000000000005:function(e,t){return Qt(e,t,Bc)},__wbindgen_generic_0000000000000006:function(e){return e},__wbindgen_generic_0000000000000007:function(e,t){return Zt(e,t)},__wbindgen_generic_0000000000000008:function(e,t){return Ee(e,t)},__wbindgen_init_externref_table:function(){let e=y.__wbindgen_externrefs;e.set(0,void 0),e.set(1024,void 0),e.set(1025,null),e.set(1026,!0),e.set(1027,!1)}}}}function Oc(e,t,n){y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_(e,t,n)}function Dc(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true_(e,t,n);if(r[1])throw ot(r[0])}function Lc(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___sys__JsNullable_wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true_(e,t,n);if(r[1])throw ot(r[0])}function Fc(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___sys__JsNullable_wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true__46(e,t,n);if(r[1])throw ot(r[0])}function Bc(e,t,n){let r=y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___wasm_bindgen_5bb76fec55d7fe60___sys__JsNullable_wgpu_86078daaf2a035a0___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_5bb76fec55d7fe60___JsError___true__47(e,t,n);if(r[1])throw ot(r[0])}function Xs(e,t,n,r){y.wasm_bindgen_5bb76fec55d7fe60___convert__closures_____invoke___js_sys_aa8f45fc28b2b0aa___Function_fn_wasm_bindgen_5bb76fec55d7fe60___JsValue_____wasm_bindgen_5bb76fec55d7fe60___sys__Undefined___js_sys_aa8f45fc28b2b0aa___Function_fn_wasm_bindgen_5bb76fec55d7fe60___JsValue_____wasm_bindgen_5bb76fec55d7fe60___sys__Undefined_______true_(e,t,n,r)}var _r=["clamp-to-edge","repeat","mirror-repeat"],$c=["auto"],Zs=["zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1-alpha","one-minus-src1-alpha"],Uc=["add","subtract","reverse-subtract","min","max"],Nc=["uniform","storage","read-only-storage"],jc=["opaque","premultiplied"],Wc=["standard","extended"],mr=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Vc=["none","front","back"],zc=["unknown","destroyed"],Qs=["nearest","linear"],Gc=["ccw","cw"],ei=["uint16","uint32"],gr=["load","clear"],Hc=["nearest","linear"],Kc=["low-power","high-performance"],qc=["point-list","line-list","line-strip","triangle-list","triangle-strip"],Jc=["filtering","non-filtering","comparison"],br=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],Yc=["write-only","read-only","read-write"],wr=["store","discard"],yr=["all","stencil-only","depth-only"],Xc=["1d","2d","3d"],ht=["r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],Zc=["float","unfilterable-float","depth","sint","uint"],vr=["1d","2d","2d-array","cube","cube-array","3d"],Qc=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],el=["vertex","instance"],ti=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbg_mstext_free(e,1)),ni=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbg_renderer_free(e,1));function Ke(e){let t=y.__externref_table_alloc();return y.__wbindgen_externrefs.set(t,e),t}var ri=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbindgen_destroy_closure(e.a,e.b));function Zi(e){switch(typeof e){case"number":case"boolean":case"undefined":return`${e}`;case"string":return JSON.stringify(e);case"bigint":return`${e}n`;case"symbol":return e.description!==void 0?`Symbol(${e.description})`:"Symbol";case"function":return typeof e.name=="string"&&e.name!==""?`Function(${e.name})`:"Function";case"object":{if(e===null)return"null";if(Array.isArray(e))return"["+Array.from(e,Zi).join(", ")+"]";if(e instanceof Error)return`${e.name}: ${e.message}
698
+ ${e.stack}`;let t=toString.call(e),n=/\[object ([^\]]+)\]/.exec(t)?.[1];if(n===void 0)return t;if(n==="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return n}}}function bt(e,t){return e=e>>>0,Qi().subarray(e/4,e/4+t)}function tl(e,t){return e=e>>>0,rl().subarray(e/8,e/8+t)}function xr(e,t){e=e>>>0;let n=Ve(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(y.__wbindgen_externrefs.get(n.getUint32(s,!0)));return y.__externref_drop_slice(e,t),r}function ze(e,t){e=e>>>0;let n=Ve(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(y.__wbindgen_externrefs.get(n.getUint32(s,!0)));return r}function nl(e,t){return e=e>>>0,ea().subarray(e/4,e/4+t)}function Zt(e,t){return e=e>>>0,Nt().subarray(e/1,e/1+t)}var gt=null;function Ve(){return(gt===null||gt.buffer.detached===!0||gt.buffer.detached===void 0&&gt.buffer!==y.memory.buffer)&&(gt=new DataView(y.memory.buffer)),gt}var on=null;function Qi(){return(on===null||on.byteLength===0)&&(on=new Float32Array(y.memory.buffer)),on}var cn=null;function rl(){return(cn===null||cn.byteLength===0)&&(cn=new Float64Array(y.memory.buffer)),cn}function Ee(e,t){return e=e>>>0,il(Nt().subarray(e,e+t))}var ln=null;function ea(){return(ln===null||ln.byteLength===0)&&(ln=new Uint32Array(y.memory.buffer)),ln}var un=null;function Nt(){return(un===null||un.byteLength===0)&&(un=new Uint8Array(y.memory.buffer)),un}function Re(e,t){try{return e.apply(this,t)}catch(n){let r=Ke(n);y.__wbindgen_exn_store(r)}}function tt(e){return e==null}function Qt(e,t,n){let r={a:e,b:t,cnt:1},s=(...i)=>{r.cnt++;let a=r.a;r.a=0;try{return n(a,r.b,...i)}finally{r.a=a,s._wbg_cb_unref()}};return s._wbg_cb_unref=()=>{--r.cnt===0&&(y.__wbindgen_destroy_closure(r.a,r.b),r.a=0,ri.unregister(r))},ri.register(s,r,r),s}function Nr(e,t){let n=t(e.length*4,4)>>>0;return ea().set(e,n/4),ye=e.length,n}function jr(e,t){let n=t(e.length*1,1)>>>0;return Nt().set(e,n/1),ye=e.length,n}function $n(e,t){let n=t(e.length*4,4)>>>0;return Qi().set(e,n/4),ye=e.length,n}function Oe(e,t,n){if(n===void 0){let o=hn.encode(e),l=t(o.length,1)>>>0;return Nt().subarray(l,l+o.length).set(o),ye=o.length,l}let r=e.length,s=t(r,1)>>>0,i=Nt(),a=0;for(;a<r;a++){let o=e.charCodeAt(a);if(o>127)break;i[s+a]=o}if(a!==r){a!==0&&(e=e.slice(a)),s=n(s,r,r=a+e.length*3,1)>>>0;let o=Nt().subarray(s+a,s+r),l=hn.encodeInto(e,o);a+=l.written,s=n(s,r,a,1)>>>0}return ye=a,s}function ot(e){let t=y.__wbindgen_externrefs.get(e);return y.__externref_table_dealloc(e),t}var zn=new TextDecoder("utf-8",{ignoreBOM:!0});zn.decode();var sl=2146435072,kr=0;function il(e){return kr+=e.length,kr>=sl&&(zn=new TextDecoder("utf-8",{ignoreBOM:!0}),zn.decode(),kr=e.length),zn.decode(e)}var hn=new TextEncoder;"encodeInto"in hn||(hn.encodeInto=function(e,t){let n=hn.encode(e);return t.set(n),{read:e.length,written:n.length}});var ye=0,y;function al(e,t){return y=e.exports,gt=null,on=null,cn=null,ln=null,un=null,y.__wbindgen_start(),y}async function ol(e,t){if(typeof Response=="function"&&e instanceof Response){if(!e.ok)throw new Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(s){if(n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}var en;async function cl(e){return y!==void 0?y:(en===void 0&&(en=ll(e),en.catch(()=>{en=void 0})),en)}async function ll(e){e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("ms_renderer_bg.wasm",import.meta.url));let t=Cc();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ol(await e,t);return al(n,r)}var Wr={fill:0,effect:1};function ta(e){let t=JSON.parse(e);for(let n of t.diagnostics)n.source="naga";return t}function na(e,t){return ta(Xi(Wr[e],t))}function si(e,t,n){let r=new Uint32Array(Math.ceil(t/4)),s=new Float32Array(r.buffer),i=new Int32Array(r.buffer);for(let a of e){let o=n[a.name];if(o===void 0)continue;let l=typeof o=="number"?[o]:o.flat(1/0);for(let c=0;c<a.elements;c++)for(let u=0;u<a.components;u++){let f=l[c*a.components+u];if(f===void 0)continue;let d=a.offset+c*a.stride+u*4>>2;d>=r.length||(a.scalar===0?s[d]=f:a.scalar===1?i[d]=Math.round(f):r[d]=Math.max(0,Math.round(f)))}}return r}var ul=64,ii=1e4;function ai(e,t){let n,r=new Promise((s,i)=>{n=setTimeout(()=>i(new Error(`the browser took over ${ii/1e3} s to ${t}`)),ii)});return Promise.race([e,r]).finally(()=>clearTimeout(n))}var fl=class{r;onReady;programs=new Map;nextId=0;pending=new Set;constructor(e,t){this.r=e,this.onReady=t}program(e,t){let n=`${e}
699
+ ${t}`,r=this.programs.get(n);if(r)return this.programs.delete(n),this.programs.set(n,r),r;if(this.programs.size>=ul){let[o,l]=this.programs.entries().next().value;this.programs.delete(o),l.state!=="compiling"&&this.r.shader_remove(l.id)}let s=this.nextId++,i=ta(this.r.shader_add(s,Wr[e],t)),a={id:s,scope:e,report:i,state:i.ok?"compiling":"failed",browser:[],settled:Promise.resolve()};if(i.ok){let o=this.compile(a).finally(()=>this.pending.delete(o));this.pending.add(o),a.settled=o}return this.programs.set(n,a),a}hasPending(){return this.pending.size>0}async whenReady(){for(;this.pending.size;)await Promise.all([...this.pending])}async compile(e){let t=this.r.gpu_device(),n=e.report.wgsl;try{if(t){let r=t.createShaderModule({code:n}),s=await ai(r.getCompilationInfo(),"compile it");if(e.browser=dl(s.messages,n),s.messages.some(a=>a.type==="error")){e.state="failed",this.r.shader_remove(e.id);return}let i=this.r.shader_formats(Wr[e.scope]);await ai(Promise.all(i.map(a=>t.createRenderPipelineAsync(gl(t,r,e.scope,a)).catch(()=>null))),"build its pipelines"),this.r.shader_build(e.id)}else this.r.shader_build(e.id);e.state="ready",this.onReady()}catch(r){e.state="failed",e.browser.push({line:0,column:0,length:0,message:`error: ${String(r?.message??r)}`,source:"browser"})}}};function dl(e,t){let n=t.indexOf(`// \u2500\u2500 the author's code \u2500\u2500
700
700
  `),r=n<0?0:t.slice(0,n).split(`
701
- `).length+1;return e.map(s=>{let i=s.lineNum>=r&&r>0?s.lineNum-r+1:0;return{line:i,column:i?s.linePos:0,length:s.length??0,message:`${s.type}: ${s.message}`,source:"browser"}})}var _f=3,pf={fill:[["uniform","storage","storage","storage","storage","storage","unfilterable-2d-array","storage"],["texture","sampler"],["uniform"]],effect:[["texture","texture","texture","sampler","sampler","uniform","texture"],["uniform"]]},mf={uniform:{buffer:{type:"uniform",hasDynamicOffset:!0}},storage:{buffer:{type:"read-only-storage"}},texture:{texture:{sampleType:"float",viewDimension:"2d"}},sampler:{sampler:{type:"filtering"}},"unfilterable-2d-array":{texture:{sampleType:"unfilterable-float",viewDimension:"2d-array"}}};function gf(e,t){return pf[t].map(n=>e.createBindGroupLayout({entries:n.map((r,s)=>({binding:s,visibility:_f,...mf[r]}))}))}function bf(e,t,n,r){let s={srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},i=n==="fill";return{layout:e.createPipelineLayout({bindGroupLayouts:gf(e,n)}),vertex:{module:t,entryPoint:i?"ms_vs_quad":"ms_vs_effect",buffers:[]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:1},fragment:{module:t,entryPoint:i?"ms_fs_prim":"ms_fs_effect",targets:[{format:r,...i?{blend:{color:s,alpha:s}}:{},writeMask:15}]}}}var wf={normal:0,multiply:1,screen:2,overlay:3,darken:4,lighten:5,"color-dodge":6,"color-burn":7,"hard-light":8,"soft-light":9,difference:10,exclusion:11,hue:12,saturation:13,color:14,luminosity:15},yf="A shader fill is written in SkSL, which Motion Script no longer runs, so it draws nothing. Port it to WGSL (fn fill(in: FillIn) -> vec4f).",vf="A shader effect is written in SkSL, which Motion Script no longer runs, so it is skipped. Port it to WGSL (fn effect(in: EffectIn) -> vec4f).",xf=1073741824,Or=null;function cn(e){return Or??=Gl(e?{module_or_path:e}:void 0),Or}var Dn=null;function Br(){return Dn??=cn().then(()=>Lt.prewarm()).catch(e=>{throw Dn=null,e}),Dn}function kf(){Dn=null,Or&&Lt.forget_device()}var Mf={miter:0,round:1,bevel:2},Sf={butt:0,round:1,square:2},ni={clamp:0,repeat:1,mirror:2,decal:3},Af={rect:1,ellipse:2,path:3},Ef={left:0,right:1,center:2,justify:3},Tf={top:0,center:1,bottom:2},ri=new TextEncoder,Pf=120;function If(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e[n],16777619);return t>>>0}function Rf(e){let t=new Uint32Array(e.points.buffer,e.points.byteOffset,e.points.length),n=2166136261,r=16777619^e.points.length;for(let s=0;s<e.verbs.length;s++)n=Math.imul(n^e.verbs[s],16777619),r=Math.imul(r^e.verbs[s],1540483477);for(let s=0;s<t.length;s++)n=Math.imul(n^t[s],16777619),r=Math.imul(r^t[s],1540483477);return`${e.verbs.length}:${t.length}:${n>>>0}:${r>>>0}`}var zi=class{name="wgpu";r;w;paintIds=new WeakMap;paintByKey=new Map;freePaints=[];pathIds=new WeakMap;pathByKey=new Map;freePaths=[];generation=0;collectUnused=!1;dashIds=new Map;nextPaint=0;nextPath=0;nextDash=0;synced=!1;viewport={w:0,h:0};lastDeltaWords=0;async init(e,t,n){let r=await cn();await Br().catch(()=>{}),this.r=await Lt.create(e,t,n),this.w=new ec(this.r,r.memory),this.effectIndex=new Map(this.r.effect_names().map((s,i)=>[s,i])),this.viewport={w:t,h:n},this.shaders=new df(this.r,()=>this.onShaderReady?.())}shaders;onShaderReady;shaderIssues=new Set;whenShadersReady(){return this.shaders.whenReady()}userProgram(e,t){let n=this.shaders.program(e,t),r=n.report.diagnostics[0]??n.browser.find(s=>s.message.startsWith("error"));return n.state==="failed"&&r&&this.shaderIssues.add(`A WGSL shader ${e} does not compile${r.line?` (line ${r.line}:${r.column})`:""}: ${r.message}`),n}adapterInfo(){return this.r.adapter_info()}gpuDevice(){return this.r.gpu_device()}setOptions(e,t){this.r.set_options(e,t)}resize(e,t){this.r.resize(e,t),this.viewport={w:e,h:t},this.synced=!1}paint(e){if(!e)return ft;let t=this.paintIds.get(e);if(t?.live)return t.used=this.generation,t.id;let n=e.kind==="image"?`image:${e.image.id}:${e.fit??"fill"}:${e.box.join(",")}:${e.matrix?.join(",")??""}:${e.tile??""}`:e.kind==="shader"?`shader:${this.userProgram("fill",e.source).id}:${e.box.join(",")}:${e.time}:${e.texture?.id??""}:${JSON.stringify(e.uniforms)}`:JSON.stringify(e),r=this.paintByKey.get(n);if(r)r.used=this.generation;else{r={id:this.freePaints.pop()??this.nextPaint++,used:this.generation,live:!0},this.paintByKey.set(n,r);let s=r.id,i=this.w;if(e.kind==="procedural")return this.procedural(s,e),this.paintIds.set(e,r),s;if(e.kind==="shader")return this.shaderPaint(s,e),this.paintIds.set(e,r),s;let a=e.kind==="solid"||e.kind==="image"?[]:e.stops;if(i.begin(12+a.length*5),i.u(Me.DEF_PAINT),i.u(s),e.kind==="solid"){i.u(0);for(let o=0;o<4;o++)i.f(0);for(let o of e.color)i.f(o)}else if(e.kind==="image"){let{m:o,tile:l}=Zl(e),c=o[0]*o[3]-o[1]*o[2]||1,u=e.image.width,f=e.image.height,d=o[3]/c,_=-o[1]/c,p=-o[2]/c,w=o[0]/c,R=(o[2]*o[5]-o[3]*o[4])/c,L=(o[1]*o[4]-o[0]*o[5])/c;i.u(4|ni[l]<<8),i.f(d/u),i.f(_/f),i.f(p/u),i.f(w/f),i.f(R/u),i.f(L/f),i.f(e.image.id),i.f(0)}else{let o=e.kind==="linear"?1:e.kind==="radial"?2:3;i.u(o|ni[e.tile??"clamp"]<<8),e.kind==="linear"?(i.f(e.from[0]),i.f(e.from[1]),i.f(e.to[0]),i.f(e.to[1])):e.kind==="radial"?(i.f(e.center[0]),i.f(e.center[1]),i.f(e.radius),i.f(0)):(i.f(e.center[0]),i.f(e.center[1]),i.f(e.startAngle),i.f(e.endAngle));for(let l of a[0].color)i.f(l)}i.u(a.length);for(let o of a){i.f(o.offset);for(let l of o.color)i.f(l)}}return this.paintIds.set(e,r),r.id}shaderPaint(e,t){let n=this.userProgram("fill",t.source),r=n.report.ok?Qs(n.report.fields,n.report.size,t.uniforms):new Uint32Array(0),s=Math.ceil(r.length/4),i=this.w;i.begin(12+s*5),i.u(Me.DEF_PAINT),i.u(e),i.u(10);for(let a of t.box)i.f(a);i.f(t.time),i.f(t.texture?t.texture.id:-1),i.f(n.id),i.f(0),i.u(s);for(let a=0;a<s;a++){i.f(0);for(let o=0;o<4;o++)i.u(r[a*4+o]??0)}}procedural(e,t){let n=t.fill,[r,s,i,a]=t.box,o,l,c,u=[],f=[],d=w=>[Math.round(w[0]*255)/255,Math.round(w[1]*255)/255,Math.round(w[2]*255)/255,w[3]];if(n.type==="dotGrid")o=5,l=[r+n.offset.x,s+n.offset.y,Math.max(.01,n.spacing),Math.max(0,n.radius)],c=[...n.color];else if(n.type==="grid")o=6,l=[r+n.offset.x,s+n.offset.y,i,a],c=[...n.color],u.push([Math.max(1e-4,n.divisions),Math.max(1,Math.round(n.subdivisions)),Math.max(0,n.strokeWidth)*.5,Math.max(0,n.subdivisionWidth)*.5]);else if(n.type==="stripe"){o=7;let w=(n.angle??-45)*Math.PI/180;l=[r,s,Math.max(1,Math.round(n.gap??8)),n.strokeWidth??1],c=d(n.color??[0,0,0,1]),u.push([Math.cos(w),Math.sin(w),r,0])}else if(n.type==="noise"){o=8,l=[r,s,Math.ceil(i),Math.ceil(a)];let w=d(n.color);c=[w[0],w[1],w[2],Math.round(n.color[3]*255)/255],u.push([Math.max(1,Math.round(n.size.x)),Math.max(1,Math.round(n.size.y)),Math.min(1,Math.max(0,n.density)),Math.round(n.seed)])}else{o=9,l=[r,s,i,a];let w=n.angle*Math.PI/180,R={value:0,simplex:1,ridged:2,worley:3}[n.basis]??1;u.push([n.frequency.x,n.frequency.y,n.offset.x,n.offset.y]),u.push([n.lacunarity,n.gain,n.seed,n.contrast]),u.push([Math.cos(w),Math.sin(w),R,n.octaves]);let L=Math.max(2,Math.min(8,n.colors.length));for(let F=0;F<L;F++)f.push({offset:n.stops[Math.min(F,n.stops.length-1)]??F/(L-1),color:[...n.colors[Math.min(F,n.colors.length-1)]]});c=f[0].color}let _=u.length+f.length,p=this.w;p.begin(12+_*5),p.u(Me.DEF_PAINT),p.u(e),p.u(o);for(let w of l)p.f(w);for(let w of c)p.f(w);p.u(_);for(let w of u){p.f(0);for(let R of w)p.f(R)}for(let w of f){p.f(w.offset);for(let R of w.color)p.f(R)}}pathId(e){let t=this.pathIds.get(e);if(t?.live)return t.used=this.generation,t.id;let n=Rf(e),r=this.pathByKey.get(n);if(r)return r.used=this.generation,this.pathIds.set(e,r),r.id;let s={id:this.freePaths.pop()??this.nextPath++,used:this.generation,live:!0};this.pathByKey.set(n,s);let i=s.id,a=this.w,o=Math.ceil(e.verbs.length/4);a.begin(4+o+e.points.length),a.u(Me.DEF_PATH),a.u(i),a.u(e.verbs.length),a.u(e.points.length/2);for(let l=0;l<o;l++){let c=e.verbs,u=l*4;a.u((c[u]??0)|(c[u+1]??0)<<8|(c[u+2]??0)<<16|(c[u+3]??0)<<24)}for(let l=0;l<e.points.length;l++)a.f(e.points[l]);return this.pathIds.set(e,s),i}sweep(){let e=this.generation-Pf;for(let[t,n]of this.pathByKey)n.used>=e||(n.live=!1,this.pathByKey.delete(t),this.w.begin(2),this.w.u(Me.FREE_PATH),this.w.u(n.id),this.freePaths.push(n.id));for(let[t,n]of this.paintByKey)n.used>=e||(n.live=!1,this.paintByKey.delete(t),this.freePaints.push(n.id))}dash(e,t=0){if(!e||e.length===0)return ft;let n=e.join(",")+"@"+t,r=this.dashIds.get(n);if(r===void 0){r=this.nextDash++,this.dashIds.set(n,r);let s=this.w;s.begin(4+e.length),s.u(Me.DEF_DASH),s.u(r),s.u(e.length),s.f(t);for(let i of e)s.f(i)}return r}writeNode(e,t){let n=this.w,r=e.id;if(t&ke.CREATE&&(n.begin(3),n.u(Me.CREATE),n.u(r),n.u(Hl[e.kind])),t&ke.TRANSFORM){let s=e.transform;if(On(s)){n.begin(11),n.u(Me.TRANSFORM3),n.u(r);for(let i of s)n.f(i)}else{n.begin(8),n.u(Me.TRANSFORM),n.u(r);for(let i=0;i<6;i++)n.f(s[i])}}if(t&ke.EFFECTS&&(e.effects?.length||!(t&ke.CREATE))&&this.writeEffects(e),t&ke.OPACITY&&(e.opacity!==1||!(t&ke.CREATE))&&(n.begin(3),n.u(Me.OPACITY),n.u(r),n.f(e.opacity)),t&ke.BLEND&&(e.blend!=="normal"||!(t&ke.CREATE))&&(n.begin(3),n.u(Me.BLEND),n.u(r),n.u(Fi.indexOf(e.blend))),e.kind==="group"){if(t&ke.CLIP&&(e.clip||!(t&ke.CREATE))){let s=e.clip,i=s?.path?this.pathId(s.path):ft,a=s?.path?et(s.path):[s?.x??0,s?.y??0,(s?.x??0)+(s?.w??0),(s?.y??0)+(s?.h??0)];n.begin(10),n.u(Me.CLIP),n.u(r),n.u(s?1:0);for(let o of a)n.f(o);n.f(s?.r??0),n.u(i),n.u(s?.evenOdd?1:0)}if(t&ke.MASK&&(e.mask||!(t&ke.CREATE))&&(n.begin(3),n.u(Me.MASK),n.u(r),n.u(e.mask?ql[e.mask]:0)),t&ke.FILTER&&(e.filter||!(t&ke.CREATE))){let s=e.filter;if(n.begin(10),n.u(Me.FILTER),n.u(r),s)if(s.kind==="blur"){n.u(1),n.f(s.sigma);for(let i=0;i<6;i++)n.f(0)}else{n.u(2),n.f(s.sigma),n.f(s.dx),n.f(s.dy);for(let i of s.color)n.f(i)}else{n.u(0);for(let i=0;i<7;i++)n.f(0)}}if(t&ke.CHILDREN){n.begin(3+e.children.length),n.u(Me.CHILDREN),n.u(r),n.u(e.children.length);for(let s of e.children)n.u(s.id)}return}if(t&ke.SIZE&&(n.begin(4),n.u(Me.SIZE),n.u(r),n.f(e.w),n.f(e.h)),t&ke.RADII&&e.kind==="rect"){n.begin(6),n.u(Me.RADII),n.u(r);for(let s of e.radii)n.f(s)}if(t&ke.MEMBERS&&e.members){let s=e.members,i=s.map(a=>a.kind==="path"&&a.path?this.pathId(a.path):ft);n.begin(3+s.length*16),n.u(Me.MEMBERS),n.u(r),n.u(s.length),s.forEach((a,o)=>{n.u(Af[a.kind]),n.u(Kl[Xl(a)]);for(let l of a.transform??[1,0,0,1,0,0])n.f(l);n.f(a.w??0),n.f(a.h??0);for(let l of a.radii??[0,0,0,0])n.f(l);n.u(i[o]),n.u(a.evenOdd?1:0)})}if(t&ke.TEXT&&e.text){let s=e.text,i=s.runs.map(c=>[ri.encode(c.family),ri.encode(c.text)]),a=i.reduce((c,[u,f])=>c+2+Math.ceil(u.length/4)+Math.ceil(f.length/4)+6,0),o=s.path?this.pathId(s.path):ft,l=s.runs.map(c=>this.paint(c.paint));n.begin(12+a),n.u(Me.TEXT),n.u(r),n.u(Ef[s.align??"center"]),n.u(Tf[s.verticalAlign??"center"]),n.u(s.wrap?1:0),n.f(s.fontSize==="autofit"?0:s.runs.length===1?s.runs[0].size:0),n.f(s.minFontSize??0),n.f(s.lineHeight??0),n.f(s.width??0),n.f(s.height??0),n.u(s.runs.length),s.runs.forEach((c,u)=>{n.u(c.decoration==="underline"?1:c.decoration==="lineThrough"?2:0),n.u(l[u]),n.f(c.size),n.f(c.weight??400),n.u(c.italic?1:0),n.f(c.letterSpacing??0);for(let f of i[u]){n.u(f.length);for(let d=0;d<f.length;d+=4)n.u((f[d]??0)|(f[d+1]??0)<<8|(f[d+2]??0)<<16|(f[d+3]??0)<<24)}}),n.u(o)}if(t&ke.PATH&&e.path){let s=this.pathId(e.path);n.begin(4),n.u(Me.PATH),n.u(r),n.u(s),n.u(e.evenOdd?1:0)}if(t&ke.FILL){let s=this.paint(e.fill);n.begin(3),n.u(Me.FILL),n.u(r),n.u(s)}if(t&ke.STROKE&&(e.stroke||!(t&ke.CREATE))){let s=e.stroke,i=this.paint(s?.paint),a=this.dash(s?.dash,s?.dashPhase);n.begin(8),n.u(Me.STROKE),n.u(r),n.u(i),n.f(s?.width??0),n.u(Mf[s?.join??"miter"]),n.u(Sf[s?.cap??"butt"]),n.f(s?.miter??4),n.u(a)}if(t&ke.SHADOWS&&(e.shadows.length||!(t&ke.CREATE))){n.begin(3+e.shadows.length*8),n.u(Me.SHADOWS),n.u(r),n.u(e.shadows.length);for(let s of e.shadows){n.f(s.dx),n.f(s.dy),n.f(s.sigma),n.f(s.spread);for(let i of s.color)n.f(i)}}}uploaded=new Map;missing3d=new Set;textures3d=new Map;geometries3d=new Map;bindTextures3d(e,t){for(let n of t.pending.splice(0)){let r=n.texture;if("data"in r){this.r.scene3d_pixels(e.id,n.id,Uint8Array.from(r.data),r.width,r.height,n.srgb);continue}let s="src"in r?e.links3d?.images?.[r.src]:e.links3d?.surfaces?.get(r);s?this.r.scene3d_bind(e.id,n.id,s.id,n.srgb):this.missing3d.add("src"in r?`image:${r.src}`:"surface")}}scene3dSigs=new Map;encode3dMs=0;words3d=0;effectIndex=new Map;auxIds=new Map;missing=new Set;effectTypes(){return[...this.effectIndex.keys()].filter(e=>Zs.has(e))}auxId(e){if(!e)return ft;let t=this.auxIds.get(e.key);if(t===void 0){t=1e6+this.auxIds.size;let n=new OffscreenCanvas(e.width,e.height);n.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(e.pixels),e.width,e.height),0,0),this.r.upload_image(t,n,!1),this.auxIds.set(e.key,t)}return t}writeEffects(e){let t=e.effects??[],n=[];for(let[i,a]of[["shader",!1],["filter",!1],["filter",!0],["shader",!0]])for(let o of t){if(o.type==="shader"){if(o.mode==="backdrop"!==a||(a?"shader":"filter")!==i)continue;let f=this.userEffect(o);f&&n.push({...f,flags:(o.clip?1:0)|(a?2:0)});continue}let l=Zs.get(o.type),c=this.effectIndex.get(o.type);if(!l||c===void 0){this.missing.has(o.type)||console.info(`effect "${o.type}" has no WGSL port yet; skipped`),this.missing.add(o.type);continue}if(l.surface!==i||o.mode==="backdrop"!==a||l.backdropOnly&&!a)continue;let u=l.pack(o);u&&n.push({index:c,flags:(o.clip?1:0)|(a?2:0)|(a&&i==="filter"?4:0)|(u.field?8:0),aux:this.auxId(u.aux),p:u})}let r=this.w,s=e.effectBox??[0,0,0,0];r.begin(8+n.reduce((i,a)=>i+8+a.p.params.length+(a.words?.length??0),0)),r.u(Me.EFFECTS),r.u(e.id);for(let i of s)r.f(i);r.f(e.effectTime??0),r.u(n.length);for(let i of n){r.u(i.index),r.u(i.flags),r.u(i.aux),r.f(i.p.reach??0);let a=i.p.blur??[0,0,0];r.f(a[0]),r.f(a[1]),r.f(a[2]),r.u(i.p.params.length+(i.words?.length??0));for(let o of i.p.params)r.f(o);if(i.words)for(let o of i.words)r.u(o)}}userEffect(e){if(!e.source?.trim())return null;if(!ki(e))return this.shaderIssues.add(vf),null;let t=this.userProgram("effect",e.source);if(!t.report.ok)return null;let n=Mi(e.uniforms),r=e.mode!=="backdrop"&&e.blendMode?(wf[e.blendMode]??-1)+1:0;return{index:xf+t.id,aux:ft,p:{params:[r],reach:Math.max(0,e.reach??0)},words:Qs(t.report.fields,t.report.size,n)}}frameCanvases=new Map;colorCorrect(e){if(typeof VideoFrame>"u"||!(e.source instanceof VideoFrame))return e.source;let t=this.frameCanvases.get(e.id);return(!t||t.width!==e.width||t.height!==e.height)&&(t=new OffscreenCanvas(e.width,e.height),this.frameCanvases.set(e.id,t)),t.getContext("2d").drawImage(e.source,0,0),t}sync(e){this.generation++,this.encode3dMs=0,this.words3d=0;for(let n of e.images)if(this.uploaded.get(n.id)!==n.version){if(n.surface)this.r.set_surface(n.id,n.surface.id,n.width,n.height);else if(n.scene3d){let r=this.viewport.w/e.width,s={unsupported:new Set},i=this.textures3d.get(n.id);i||this.textures3d.set(n.id,i=new al);let[a,o]=n.scale3d?[Math.ceil(n.width*n.scale3d),Math.ceil(n.height*n.scale3d)]:[Math.round(n.width*r),Math.round(n.height*r)],l=performance.now(),c=this.geometries3d.get(n.id);c||this.geometries3d.set(n.id,c=new ll);let u=fl(n.scene3d,s,i,c),f=`${a}x${o}:${u.length}:${If(u)}`;if(this.encode3dMs+=performance.now()-l,this.words3d+=u.length,this.scene3dSigs.get(n.id)!==f){try{this.r.set_scene3d(n.id,a,o,u)}catch(d){throw this.geometries3d.delete(n.id),this.scene3dSigs.delete(n.id),d}this.scene3dSigs.set(n.id,f)}for(let d of s.unsupported)this.missing3d.add(d);this.bindTextures3d(n,i)}else this.r.upload_image(n.id,this.colorCorrect(n),n.mipmaps);this.uploaded.set(n.id,n.version)}let t=this.w;if(this.synced)for(let n of e.dirty)this.writeNode(n,n.dirty);else{for(let n of e.nodes)this.writeNode(n,ke.ALL);t.begin(2),t.u(Me.ROOT),t.u(e.root.id),t.begin(8),t.u(Me.VIEWPORT),t.u(this.viewport.w),t.u(this.viewport.h),t.f(this.viewport.w/e.width);for(let n of e.background)t.f(n);this.synced=!0}for(let n of e.dirty)n.dirty=0;e.dirty.clear(),this.collectUnused&&this.generation%30===0&&this.sweep(),t.flush(),this.lastDeltaWords=t.takeCount()}render(){this.r.render()}invalidate(){this.r.invalidate()}waitGpu(){return this.r.wait_gpu()}async readPixels(){return await this.r.read_pixels()}stats(){let e=this.r.stats();return{buildMs:e[0],encodeMs:e[1],applyMs:e[2],prims:e[3],ops:e[4],layers:e[5],passes:e[6],draws:e[7],culled:e[8],tessellated:e[9],poolTextures:e[10],poolMiB:e[11],geomVertices:e[12],reusedPrims:e[13],cleanPrims:e[14],deltaWords:this.lastDeltaWords,scene3dEncodeMs:this.encode3dMs,scene3dWords:this.words3d,scene3dSetMs:e[15],scene3dDrawMs:e[16],scene3dMapsMs:e[17],surfacesDrawn:e[18],surfaces:e[19]}}registerFont(e,t){this.r.register_font(e,t)}destroy(){this.r.free()}},wt=e=>e.replace(/^\.?\//,""),yr=8192,Cf=12,vr=e=>e.toFixed(4);async function Of(e){let t=await fetch(e);if(!t.ok)throw new Error(`${e}: HTTP ${t.status}`);return t.blob()}var $f=class extends yo{fps;loadBytes;images=new Map;videos=new Map;fonts=[];fontListeners=new Set;registeredFamilies=new Set;pending=new Map;vectors=new Map;upgrades=new Map;settlers=new Set;audioData=new Map;constructor(e,t,n,r=Of){super(e,t),this.fps=n,this.loadBytes=r}get size(){return this.viewport}addSettler(e){return this.settlers.add(e),()=>this.settlers.delete(e)}onFont(e){return this.fontListeners.add(e),()=>this.fontListeners.delete(e)}async loadImage(e){let t=wt(e);if(this.images.has(t))return;let n=this.url(e,a=>a.getImageMeta(e)),r=await this.loadBytes(n),s;if(r.type==="image/svg+xml"||/\.svg(\?|#|$)/i.test(n)){let a=new Image;a.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await r.text())}`,await a.decode(),s=await createImageBitmap(a),this.vectors.set(t,{img:a,edge:Math.max(s.width,s.height)})}else s=await createImageBitmap(r,{colorSpaceConversion:"none"});let i=Math.max(s.width,s.height);if(i>yr){let a=yr/i,o=await createImageBitmap(s,{resizeWidth:Math.max(1,Math.round(s.width*a)),resizeHeight:Math.max(1,Math.round(s.height*a)),resizeQuality:"high"});s.close(),s=o}this.images.set(t,{bitmap:s,bytes:new Uint8Array(0),width:s.width,height:s.height})}async loadVideo(e){let t=wt(e);if(this.videos.has(t))return;let n=this.url(e,a=>a.getVideoMeta(e)),r=new xn({source:new ls(await this.loadBytes(n)),formats:us}),s=await r.getPrimaryVideoTrack();if(!s)throw r.dispose(),new Error(`loadVideo(${e}): no video track`);let i=await r.computeDuration();this.videos.set(t,{duration:i,sink:new hs(s),input:r,frames:new Map,last:null})}videoFrame(e,t){let n=wt(e),r=this.videos.get(n);if(!r)return null;let s=r.frames.get(vr(t));return s||(this.pending.set(`${n}@${vr(t)}`,{src:n,time:t}),r.last)}wantImageEdge(e,t){let n=wt(e),r=this.vectors.get(n),s=this.images.get(n);if(!r||!s||t<=r.edge)return;let i=Math.max(s.width,s.height),a=Math.min(yr,i*2**Math.ceil(Math.log2(t/i)));a>r.edge&&a>(this.upgrades.get(n)??0)&&this.upgrades.set(n,a)}hasPendingUpgrades(){return this.upgrades.size>0}async warmPendingUpgrades(){if(this.upgrades.size===0)return!1;let e=[...this.upgrades];this.upgrades.clear();for(let[t,n]of e){let r=this.vectors.get(t),s=this.images.get(t);if(!r||!s)continue;let i=n/Math.max(s.width,s.height),a=new OffscreenCanvas(Math.max(1,Math.round(s.width*i)),Math.max(1,Math.round(s.height*i)));a.getContext("2d").drawImage(r.img,0,0,a.width,a.height);let o=s.bitmap;s.bitmap=await createImageBitmap(a),r.edge=n,queueMicrotask(()=>o.close())}return!0}hasPendingDecodes(){return this.pending.size>0}async warmPendingDecodes(){let e=[...this.settlers].map(n=>n()).filter(n=>n!==null);if(this.pending.size===0&&e.length===0)return!1;let t=[...this.pending.values()];return this.pending.clear(),await Promise.all([...t.map(({src:n,time:r})=>this.decodeFrame(n,r)),...e]),!0}async decodeFrame(e,t){let n=this.videos.get(e);if(!n)return;let r=await n.sink.getSample(t);if(!r)return;let s=r.toVideoFrame(),i;try{i=await createImageBitmap(s)}finally{s.close(),r.close()}for(n.frames.set(vr(t),i),n.last=i;n.frames.size>Cf;){let[a,o]=n.frames.entries().next().value;n.frames.delete(a),o!==n.last&&queueMicrotask(()=>o.close())}}async loadAudio(){}fetchAudioData(e){let t=this.audioData.get(e);if(!t){let n=this.url(e,r=>{try{return r.getAudioMeta(e)}catch{return r.getVideoMeta(e)}});t=(async()=>(await this.loadBytes(n)).arrayBuffer())(),this.audioData.set(e,t),t.catch(()=>this.audioData.delete(e))}return t.then(n=>n.slice(0))}async loadFont(e,t){if(this.registeredFamilies.has(t))return!0;let n=this.catalog.getFontFamilyMetas(t);if(n.length===0)return this.getDecodePolicy()==="interactive"&&console.warn(`[WgpuStorageAdapter] No font manifest entry for "${e}".`),!1;let r=[...new Set(n.map(i=>i.src))],s=await Promise.all(r.map(async i=>new Uint8Array(await(await this.loadBytes(i)).arrayBuffer())));if(this.registeredFamilies.has(t))return!0;for(let i of s){let a={bytes:i,family:t};this.fonts.push(a);for(let o of this.fontListeners)o(a)}return this.registeredFamilies.add(t),!0}dispose(){for(let e of this.images.values())e.bitmap.close();this.images.clear();for(let e of this.videos.values()){for(let t of e.frames.values())t.close();e.input.dispose()}this.videos.clear(),this.pending.clear(),this.vectors.clear(),this.upgrades.clear(),this.fontListeners.clear(),super.dispose()}url(e,t){try{return t(this.catalog).src||e}catch{return e}}};function si(e,t,n,r){if(n.matrix)return n.matrix instanceof Float32Array?Array.from(n.matrix):n.matrix.flat();let s=n.zoom??1;if(!r)return[s,0,0,0,s,0,0,0,1];let i=n.fit??"fill",a=r.right-r.left,o=r.bottom-r.top,l=i==="tile"?void 0:n.crop,c=l?l.left*e:0,u=l?l.top*t:0,f=l?e*(1-l.left-l.right):e,d=l?t*(1-l.top-l.bottom):t;if(f<=0||d<=0)return[s,0,r.left,0,s,r.top,0,0,1];let _,p;if(i==="fit"?_=p=Math.min(a/f,o/d):i==="stretch"?(_=a/f,p=o/d):i==="tile"?_=p=1:_=p=Math.max(a/f,o/d),_*=s,p*=s,i==="tile")return[_,0,r.left,0,p,r.top,0,0,1];let w=n.anchor??{x:0,y:0},R=(w.x+1)/2,L=(1-w.y)/2,F=r.left+R*(a-f*_)-c*_,H=r.top+L*(o-d*p)-u*p;return[_,0,F,0,p,H,0,0,1]}function En(e,t,n){let r=(n[0]+n[2])/2,s=(n[1]+n[3])/2;return[r+e*((n[2]-n[0])/2),s-t*((n[3]-n[1])/2)]}function xr(e,t){return e.map((n,r)=>({offset:t[r]??r/Math.max(1,e.length-1),color:[n[0],n[1],n[2],n[3]]}))}function dt(e,t,n,r){let s=e,i=r?a=>r.image(a):void 0;switch(s.type){case"video":{let a=r?.video(s);if(!a)return n.add("fill:video-not-decoded"),null;let o=si(a.width,a.height,s,{left:t[0],top:t[1],right:t[2],bottom:t[3]}),l=s.fit??"fill",c=l==="tile"?"repeat":l!=="fit"&&(s.zoom??1)>=1?"clamp":"decal";return{kind:"image",image:a,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]],matrix:[o[0],o[3],o[1],o[4],o[2],o[5]],tile:c}}case"canvas3D":{if(!r)return null;let a=t[2]-t[0],o=t[3]-t[1];if(!(a>0)||!(o>0))return null;let l=Math.min(s.maxPixelRatio??2,Math.max(r.deviceScale(),1));return{kind:"image",image:r.scene3d(s.scene,a,o,l),box:[t[0],t[1],a,o],fit:"stretch"}}case"image":{let a=i?.(s.src);if(!a)return n.add("fill:image-not-loaded"),null;let o=si(a.width,a.height,s,{left:t[0],top:t[1],right:t[2],bottom:t[3]}),l=[o[0],o[3],o[1],o[4],o[2],o[5]];if(r?.imageEdge){let f=r.deviceScale();r.imageEdge(s.src,Math.max(a.width*Math.hypot(l[0],l[1]),a.height*Math.hypot(l[2],l[3]))*f)}let c=s.fit??"fill",u=c==="tile"?"repeat":c!=="fit"&&(s.zoom??1)>=1?"clamp":"decal";return{kind:"image",image:a,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]],matrix:l,tile:u}}case"solid":return{kind:"solid",color:[s.color[0],s.color[1],s.color[2],s.color[3]]};case"linear-gradient":return{kind:"linear",from:En(s.start.x,s.start.y,t),to:En(s.end.x,s.end.y,t),stops:xr(s.colors,s.stops)};case"conic-gradient":{let a=s.startAngle??0,o=s.stops.length===s.colors.length?s.stops:[];return{kind:"sweep",center:En(s.center.x,s.center.y,t),startAngle:a,endAngle:a+360,stops:xr(s.colors,o)}}case"radial-gradient":return{kind:"radial",center:En(s.center.x,s.center.y,t),radius:s.radius,stops:xr(s.colors,s.stops)};case"shader":{if(!s.source?.trim())return null;if(!ki(s))break;r?.checkShader?.(s);let a=s.textures?.[0]?i?.(s.textures[0].src):void 0;return s.textures?.[0]&&!a?(n.add("fill:image-not-loaded"),null):{kind:"shader",source:s.source,uniforms:s.uniforms??{},time:r?.time?.()??0,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]],...a?{texture:a}:{}}}case"dotGrid":case"grid":case"stripe":case"noise":case"fractalNoise":return{kind:"procedural",fill:s,box:[t[0],t[1],t[2]-t[0],t[3]-t[1]]}}return n.add(s.type==="shader"?"fill:shader-sksl":`fill:${s.type}`),null}function Df(e,t){let n=e.fill[0],r=n?.type==="solid"?n.color:[0,0,0,1];return{dx:e.offset?.x??0,dy:-(e.offset?.y??0),sigma:e.blur/2,spread:e.spread,color:[r[0],r[1],r[2],r[3]*(n?.opacity??1)]}}var Ct=new Map,Lf=64;function Ff(e,t){let n=`${e}
702
- ${t}`,r=Ct.get(n);if(r===void 0){try{let s=Gi(e,t);r=s.ok?s.fields.map(i=>i.name):null}catch{return null}Ct.size>=Lf&&Ct.delete(Ct.keys().next().value)}else Ct.delete(n);return Ct.set(n,r),r}function Bf(e,t){let n=t.source??"",r=jo(t);if(!n.trim()||r===void 0)return[];let s=[];r>Is&&s.push({kind:"shader",feature:`${e}:contract-${r}`,message:`A WGSL shader ${e} is written for shader contract ${r}; this renderer implements ${Is}, so it may not draw as intended.`});let i=Ff(e,n);if(!i)return s;let a=Mi(t.uniforms??{});for(let o of Object.keys(a))i.includes(o)||s.push({kind:"params",feature:`params:${o}`,message:`A WGSL shader ${e} is given "${o}", which names no member of its struct Params, so the value is ignored.`});for(let o of i)o in a||s.push({kind:"params",feature:`params:${o}`,message:`A WGSL shader ${e}'s Params.${o} is given no value, so it reads 0.`});return s}var Uf=32;function yt(e,t){let n=e.p,r=1-t;return e.kind==="line"?[n[0]+(n[2]-n[0])*t,n[1]+(n[3]-n[1])*t]:e.kind==="quad"?[r*r*n[0]+2*r*t*n[2]+t*t*n[4],r*r*n[1]+2*r*t*n[3]+t*t*n[5]]:[r*r*r*n[0]+3*r*r*t*n[2]+3*r*t*t*n[4]+t*t*t*n[6],r*r*r*n[1]+3*r*r*t*n[3]+3*r*t*t*n[5]+t*t*t*n[7]]}function Tn(e,t){let n=[0],r=e==="line"?1:Uf,s={kind:e,p:t,len:0,table:n},i=yt(s,0);for(let a=1;a<=r;a++){let o=yt(s,a/r);n.push(n[a-1]+Math.hypot(o[0]-i[0],o[1]-i[1])),i=o}return s.len=n[r],s}function $r(e,t){let n=e.table.length-1;if(t<=0)return 0;if(t>=e.len)return 1;let r=1;for(;e.table[r]<t;)r++;let s=e.table[r-1],i=e.table[r];return(r-1+(i>s?(t-s)/(i-s):0))/n}function jf(e,t,n){let r=e.p;if(e.kind==="line")return[...yt(e,t),...yt(e,n)];let s=(a,o)=>{let l=a.length/2,c=[a];for(let d=1;d<l;d++){let _=c[d-1],p=[];for(let w=0;w<_.length-2;w+=2)p.push(_[w]+(_[w+2]-_[w])*o,_[w+1]+(_[w+3]-_[w+1])*o);c.push(p)}let u=[],f=[];for(let d=0;d<l;d++)u.push(c[d][0],c[d][1]);for(let d=l-1;d>=0;d--)f.push(c[d][c[d].length-2],c[d][c[d].length-1]);return[u,f]},[i]=n<1?s(r,n):[r];return t<=0?i:s(i,t/n)[1]}function Ur(e){let t=[],n=null,r=0,s=0,i=0,a=0,o=0,l=e.points;for(let c of e.verbs)if(c===Ce.move)r=i=l[o++],s=a=l[o++],n={segs:[],closed:!1},t.push(n);else if(c===Ce.line){let u=l[o++],f=l[o++];n.segs.push(Tn("line",[r,s,u,f])),r=u,s=f}else if(c===Ce.quad){let u=[r,s,l[o],l[o+1],l[o+2],l[o+3]];o+=4,n.segs.push(Tn("quad",u)),r=u[4],s=u[5]}else if(c===Ce.cubic){let u=[r,s,l[o],l[o+1],l[o+2],l[o+3],l[o+4],l[o+5]];o+=6,n.segs.push(Tn("cubic",u)),r=u[6],s=u[7]}else c===Ce.close&&(n&&((r!==i||s!==a)&&n.segs.push(Tn("line",[r,s,i,a])),n.closed=!0),r=i,s=a);return t.filter(c=>c.segs.length>0)}function Nf(e){let t=0,n=0,r=0,s=0,i=0,a=0,o=e.points,l=(c,u)=>{t+=i*u-c*a,i=c,a=u};for(let c of e.verbs)if(c===Ce.move)l(r,s),r=i=o[n++],s=a=o[n++];else if(c!==Ce.close){let u=c===Ce.line?1:c===Ce.quad?2:3;for(let f=0;f<u;f++,n+=2)l(o[n],o[n+1])}return l(r,s),t/2}function Wf(e){let t=new at,n=e.points,r=0,s=0,i=e.verbs;for(;s<i.length;){if(i[s]!==Ce.move){s++;continue}let a=n[r++],o=n[r++],l=[],c=!1;for(s++;s<i.length&&i[s]!==Ce.move;s++){let u=i[s];if(u===Ce.close){c=!0;continue}let f=u===Ce.line?1:u===Ce.quad?2:3,d=[a,o];for(let _=0;_<f;_++,r+=2)d.push(n[r],n[r+1]);a=d[d.length-2],o=d[d.length-1],l.push({v:u,p:d})}t.moveTo(a,o);for(let u=l.length-1;u>=0;u--){let{v:f,p:d}=l[u];f===Ce.line?t.lineTo(d[0],d[1]):f===Ce.quad?t.quadTo(d[2],d[3],d[0],d[1]):t.cubicTo(d[4],d[5],d[2],d[3],d[0],d[1])}c&&t.close()}return t.build()}function ii(e){let t=Ur(e);return t.length>0&&t.every(n=>n.closed)}function Hi(e,t,n,r){let s=0,i=!1;for(let a of e){let o=s,l=s+a.len;if(s=l,l<=t||o>=n)continue;let c=jf(a,$r(a,t-o),$r(a,n-o));i||(r.moveTo(c[0],c[1]),i=!0),a.kind==="line"?r.lineTo(c[2],c[3]):a.kind==="quad"?r.quadTo(c[2],c[3],c[4],c[5]):r.cubicTo(c[2],c[3],c[4],c[5],c[6],c[7])}return i}function Dr(e,t,n){let r=Ur(e),s=r.reduce((u,f)=>u+f.segs.reduce((d,_)=>d+_.len,0),0);if(s<=0)return e;let i=t*s,a=n*s,o=new at,l=0,c=!1;for(let u of r){let f=u.segs.reduce((p,w)=>p+w.len,0),d=l,_=l+f;l=_,_>i&&d<a&&(c=Hi(u.segs,Math.max(0,i-d),Math.min(f,a-d),o)||c)}return c?o.build():{verbs:new Uint8Array(0),points:new Float32Array(0)}}function Vf(e,t){let n=e.p,r=1-t;return e.kind==="line"?[n[2]-n[0],n[3]-n[1]]:e.kind==="quad"?[2*(r*(n[2]-n[0])+t*(n[4]-n[2])),2*(r*(n[3]-n[1])+t*(n[5]-n[3]))]:[3*(r*r*(n[2]-n[0])+2*r*t*(n[4]-n[2])+t*t*(n[6]-n[4])),3*(r*r*(n[3]-n[1])+2*r*t*(n[5]-n[3])+t*t*(n[7]-n[5]))]}function Gf(e){return Ur(e).map(t=>{let n=t.segs.filter(s=>s.len>0),r=n.reduce((s,i)=>s+i.len,0);return{length:r,closed:t.closed,posTan(s){s=Math.max(0,Math.min(r,s));let i=0,a=n[n.length-1];for(let _ of n){if(i+_.len>=s){a=_;break}i+=_.len}let o=$r(a,s-i),[l,c]=yt(a,o),[u,f]=Vf(a,o);if(Math.hypot(u,f)<1e-9){let _=yt(a,Math.max(0,o-.001)),p=yt(a,Math.min(1,o+.001));u=p[0]-_[0],f=p[1]-_[1]}let d=Math.hypot(u,f)||1;return[l,c,u/d,f/d]},segment:(s,i,a)=>Hi(n,s,i,a)}}).filter(t=>t.length>0)}var Ln=.001;function zf(e,t){let n=0,r=!1;for(let i of e)n+=i.length,i.closed||(r=!0);let s=Ai.dashScale(t,{length:n,closed:!0},n);return s===null?null:{scale:s,total:n,open:r}}function Ki(e,t,n){return e.closed?n.scale:Ai.dashScale(t,{length:e.length,closed:!1},n.total)??n.scale}function qi(e,t,n,r){let s=t.map(_=>_*r),i=s.reduce((_,p)=>_+p,0),a=[];if(!(i>0))return a;let o=(n*r%i+i)%i,l=0,c=0;for(;c+s[l]<=o&&l<s.length&&!(s[l]<=Ln&&Math.abs(o-c)<1e-6||(c+=s[l],l=(l+1)%s.length,l===0)););let u=s[l]-(o-c),f=l%2===0,d=0;for(;d<e.length-1e-6;){let _=Math.min(u,e.length-d);f&&a.push([d,d+_]),d+=_,u-=_,u<=1e-6&&(l=(l+1)%s.length,u=s[l],f=!f)}return f&&u<=1e-6&&!e.closed&&a.push([e.length,e.length]),a}function Hf(e,t,n,r,s){let i=new at,a=!1;for(let o of e)for(let[l,c]of qi(o,t,n,Ki(o,t,s)))if(c-l>Ln)a=o.segment(l,c,i)||a;else if(r){let[u,f,d,_]=o.posTan(l),p=l>o.length-Ln?-.001:Ln;i.moveTo(u,f).lineTo(u+d*p,f+_*p),a=!0}return a?i.build():null}var Bt=class{fullState;geo;constructor(e){this.fullState=this.resolveState(e)}get geometry(){return this.geo??=this.computeGeometry()}needsTrim(){return this.fullState.start!==0||this.fullState.end!==1}getTrimRange(){return{start:this.fullState.start,end:this.fullState.end}}buildSVGAlignInterior(e){return null}supportsSpread(){return!1}buildSpreadSVGPath(e,t){return null}computeBounds(e){}};function rt(e){return e.radius>0?e.radius:0}function Pn(e,t,n,r,s,i,a){return a.radius<=0?"":Ji(e,t,n,r,s,i,a.radius,a.radius,a.style)}function Ji(e,t,n,r,s,i,a,o,l){let c=e+s*a,u=t+i*a;return l==="angled"?`L ${c} ${u}`:`A ${o} ${o} 0 0 ${n*i-r*s<0?1:0} ${c} ${u}`}var st=Math.PI/180,Yi=class extends Bt{resolveState(e){return Go(e)}computeGeometry(){let e=this.fullState,t=e.sweep??360;return{cx:e.x,cy:e.y,halfWidth:e.width/2,halfHeight:e.height/2,sweep:t,isFullShape:Math.abs(t)>=360,startAngle:e.startAngle??0,ratio:Math.max(0,Math.min(1,e.ratio??0))}}buildSVGPath(e){let{cx:t,cy:n,halfWidth:r,halfHeight:s,ratio:i}=e;if(i>=1)return"";if(!e.isFullShape)return i<=0?ai(e):oi(e);let a=Xt(t,n,r,s,0);return i<=0?a:`${a} ${Xt(t,n,r*i,s*i,1)}`}ringOutline(e){return e.ratio<1?null:e.isFullShape?Xt(e.cx,e.cy,e.halfWidth,e.halfHeight,0):Kf(e)}buildSVGAlignInterior(e){return e.isFullShape?e.ratio>=1?Xt(e.cx,e.cy,e.halfWidth,e.halfHeight,0):null:e.ratio>=1||e.ratio<=0?ai(e):oi(e)}supportsSpread(){return!0}buildSpreadSVGPath(e,t){if(!e.isFullShape||e.ratio>=1)return null;let n=e.halfWidth+t,r=e.halfHeight+t;return n<=0||r<=0?null:Xt(e.cx,e.cy,n,r,0)}computeBounds(e){let{cx:t,cy:n,halfWidth:r,halfHeight:s}=e;return{left:t-r,top:n-s,right:t+r,bottom:n+s}}};function Xt(e,t,n,r,s){let i=e-n;return`M ${i} ${t} A ${n} ${r} 0 1 ${s} ${e+n} ${t} A ${n} ${r} 0 1 ${s} ${i} ${t} Z`}function jr(e){let{cx:t,cy:n,halfWidth:r,halfHeight:s,startAngle:i,sweep:a}=e,o=i+a,l=Math.abs(a)>180?1:0,c=a>0?1:0,u=t+r*Math.cos(i*st),f=n+s*Math.sin(i*st),d=t+r*Math.cos(o*st),_=n+s*Math.sin(o*st);return{start:`${u} ${f}`,arc:`A ${r} ${s} 0 ${l} ${c} ${d} ${_}`}}function Kf(e){let{start:t,arc:n}=jr(e);return`M ${t} ${n}`}function ai(e){let{start:t,arc:n}=jr(e);return`M ${e.cx} ${e.cy} L ${t} ${n} Z`}function oi(e){let{cx:t,cy:n,halfWidth:r,halfHeight:s,startAngle:i,sweep:a,ratio:o}=e,{start:l,arc:c}=jr(e),u=i+a,f=r*o,d=s*o,_=t+f*Math.cos(i*st),p=n+d*Math.sin(i*st);return`M ${l} ${c} L ${t+f*Math.cos(u*st)} ${n+d*Math.sin(u*st)} A ${f} ${d} 0 ${Math.abs(a)>180?1:0} ${a>0?0:1} ${_} ${p} Z`}function qf(e,t,n){if(e.length===0)return"M 0 0";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;let r=Math.max(0,t),s=[],i=e.length,a=(o,l)=>{let c=l.x-o.x,u=l.y-o.y,f=Math.sqrt(c*c+u*u);return f>0?{dx:c/f,dy:u/f,len:f}:{dx:0,dy:0,len:0}};if(r===0){s.push(`M ${e[0].x} ${e[0].y}`);for(let o=1;o<i;o++)s.push(`L ${e[o].x} ${e[o].y}`)}else{let o=n?i:i-1;for(let l=0;l<=o;l++){let c=e[(l-1+i)%i],u=e[l%i],f=e[(l+1)%i];if(!n&&l===0){s.push(`M ${u.x} ${u.y}`);continue}if(!n&&l===i-1){s.push(`L ${u.x} ${u.y}`);continue}let d=a(c,u),_=a(u,f),p=Math.min(r,d.len/2),w=Math.min(r,_.len/2),R=u.x-d.dx*p,L=u.y-d.dy*p,F=u.x+_.dx*w,H=u.y+_.dy*w;s.push(`${l===0&&n?"M":"L"} ${R} ${L}`),s.push(`Q ${u.x} ${u.y} ${F} ${H}`)}}return n&&s.push("Z"),s.join(" ")}var Jf=class extends Bt{resolveState(e){return zo(e)}computeGeometry(){let{points:e,radius:t,closed:n}=this.fullState;return{points:e,radius:t,closed:n}}buildSVGPath(e){return qf(e.points,e.radius,e.closed)}},Yf=class extends Bt{resolveState(e){return Ho(e)}computeGeometry(){return{data:this.fullState.data}}buildSVGPath(e){return Ti(e.data)}};function Xi(e,t,n){if(t.cornerRadius<=0){let i=e.map(([a,o],l)=>`${l===0?"M":"L"} ${a} ${o}`);return i.push("Z"),i.join(" ")}let r=e.length,s=[];for(let i=0;i<r;i++){let a=e[i];if(!n(i)){s.push(`${s.length===0?"M":"L"} ${a[0]} ${a[1]}`);continue}let o=e[(i-1+r)%r],l=e[(i+1)%r],c=o[0]-a[0],u=o[1]-a[1],f=Math.hypot(c,u),d=c/f,_=u/f,p=l[0]-a[0],w=l[1]-a[1],R=Math.hypot(p,w),L=p/R,F=w/R,H=Math.max(-1,Math.min(1,d*L+_*F)),se=Math.tan(Math.acos(H)/2),X=Math.min(t.cornerRadius/se,Math.min(f,R)/2),ye=X*se;s.push(`${s.length===0?"M":"L"} ${a[0]+d*X} ${a[1]+_*X}`),s.push(Ji(a[0],a[1],d,_,L,F,X,ye,t.cornerStyle))}return s.push("Z"),s.join(" ")}var Zi=e=>({left:e.cx-e.rx,top:e.cy-e.ry,right:e.cx+e.rx,bottom:e.cy+e.ry}),Xf=class extends Bt{resolveState(e){return Ko(e)}computeGeometry(){let e=this.fullState;return{cx:e.x,cy:e.y,rx:e.width/2,ry:e.height/2,sides:Math.max(3,Math.round(e.sides)),ratio:1,cornerRadius:e.cornerRadius,cornerStyle:e.cornerStyle}}buildSVGPath(e){let t=2*Math.PI/e.sides,n=[];for(let r=0;r<e.sides;r++){let s=-Math.PI/2+r*t;n.push([e.cx+e.rx*Math.cos(s),e.cy+e.ry*Math.sin(s)])}return Xi(n,e,()=>!0)}computeBounds(e){return Zi(e)}},Zf=class extends Bt{resolveState(e){return qo(e)}computeGeometry(){let e=this.fullState;return{cx:e.x,cy:e.y,rx:e.width/2,ry:e.height/2,sides:Math.max(3,Math.round(e.sides)),ratio:Math.max(0,Math.min(1,e.ratio)),cornerRadius:e.cornerRadius,cornerStyle:e.cornerStyle}}buildSVGPath(e){let t=Math.PI/e.sides,n=[];for(let r=0;r<e.sides*2;r++){let s=-Math.PI/2+r*t,i=r%2===0?1:e.ratio;n.push([e.cx+e.rx*i*Math.cos(s),e.cy+e.ry*i*Math.sin(s)])}return Xi(n,e,r=>r%2===0)}computeBounds(e){return Zi(e)}};function li(e,t,n,r,s,i,a,o){let l=rt(s),c=rt(i),u=rt(a),f=rt(o);return[`M ${e+l} ${t}`,`L ${n-c} ${t}`,Pn(n,t,-1,0,0,1,i),`L ${n} ${r-u}`,Pn(n,r,0,-1,-1,0,a),`L ${e+f} ${r}`,Pn(e,r,1,0,0,-1,o),`L ${e} ${t+l}`,Pn(e,t,0,1,1,0,s),"Z"].filter(Boolean).join(" ")}var ci=(e,t,n,r)=>`M ${e} ${t} L ${n} ${t} L ${n} ${r} L ${e} ${r} Z`,Qf=class extends Bt{resolveState(e){return Jo(e)}computeGeometry(){let e=this.fullState,t=e.x-e.width/2,n=e.y-e.height/2,r=e.x+e.width/2,s=e.y+e.height/2,i=Rs.resolve(e.cornerRadius),a=xo.resolve(e.cornerStyle),o={radius:Math.max(0,i.topLeft),style:a.topLeft},l={radius:Math.max(0,i.topRight),style:a.topRight},c={radius:Math.max(0,i.bottomRight),style:a.bottomRight},u={radius:Math.max(0,i.bottomLeft),style:a.bottomLeft},f=ui(e.width,e.height,o,l,c,u);return o.radius*=f,l.radius*=f,c.radius*=f,u.radius*=f,{left:t,top:n,right:r,bottom:s,tl:o,tr:l,br:c,bl:u,isZero:Rs.isZero({topLeft:o.radius,topRight:l.radius,bottomRight:c.radius,bottomLeft:u.radius})}}buildSVGPath(e){let{left:t,top:n,right:r,bottom:s,tl:i,tr:a,br:o,bl:l,isZero:c}=e;return c?ci(t,n,r,s):li(t,n,r,s,i,a,o,l)}supportsSpread(){return!0}buildSpreadSVGPath(e,t){let n=e.left-t,r=e.top-t,s=e.right+t,i=e.bottom+t,a=s-n,o=i-r;if(a<=0||o<=0)return null;let l={...e.tl,radius:Math.max(0,e.tl.radius+t)},c={...e.tr,radius:Math.max(0,e.tr.radius+t)},u={...e.br,radius:Math.max(0,e.br.radius+t)},f={...e.bl,radius:Math.max(0,e.bl.radius+t)},d=ui(a,o,l,c,u,f);return l.radius*=d,c.radius*=d,u.radius*=d,f.radius*=d,l.radius===0&&c.radius===0&&u.radius===0&&f.radius===0?ci(n,r,s,i):li(n,r,s,i,l,c,u,f)}computeBounds(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}};function ui(e,t,n,r,s,i){let a=rt(n),o=rt(r),l=rt(s),c=rt(i),u=a+o>0?Math.min(1,e/(a+o)):1,f=c+l>0?Math.min(1,e/(c+l)):1,d=a+c>0?Math.min(1,t/(a+c)):1,_=o+l>0?Math.min(1,t/(o+l)):1;return Math.min(u,f,d,_)}function ed(e,t,n,r,s,i,a,o,l,c){if(r===0||s===0){e.lineTo(l,c);return}r=Math.abs(r),s=Math.abs(s);let u=Math.cos(i),f=Math.sin(i),d=(t-l)/2,_=(n-c)/2,p=u*d+f*_,w=-f*d+u*_,R=p*p/(r*r)+w*w/(s*s);R>1&&(r*=Math.sqrt(R),s*=Math.sqrt(R));let L=r*r*s*s-r*r*w*w-s*s*p*p,F=r*r*w*w+s*s*p*p,H=Math.sqrt(Math.max(0,L/F));a===o&&(H=-H);let se=H*r*w/s,X=-H*s*p/r,ye=u*se-f*X+(t+l)/2,ve=f*se+u*X+(n+c)/2,q=(ae,Ae,$e,Mt)=>Math.atan2(ae*Mt-Ae*$e,ae*$e+Ae*Mt),oe=q(1,0,(p-se)/r,(w-X)/s),K=q((p-se)/r,(w-X)/s,(-p-se)/r,(-w-X)/s);!o&&K>0?K-=2*Math.PI:o&&K<0&&(K+=2*Math.PI);let B=Math.ceil(Math.abs(K)/(Math.PI/2)-1e-9),xe=K/B,we=4/3*Math.tan(xe/4),Te=ae=>[ye+r*Math.cos(ae)*u-s*Math.sin(ae)*f,ve+r*Math.cos(ae)*f+s*Math.sin(ae)*u],Ue=ae=>[-r*Math.sin(ae)*u-s*Math.cos(ae)*f,-r*Math.sin(ae)*f+s*Math.cos(ae)*u];for(let ae=0;ae<B;ae++){let Ae=oe+ae*xe,$e=Ae+xe,[Mt,zn]=Te(Ae),[Nt,Wt]=Te($e),[Hn,_n]=Ue(Ae),[pn,Kn]=Ue($e);e.cubicTo(Mt+we*Hn,zn+we*_n,Nt-we*pn,Wt-we*Kn,ae===B-1?l:Nt,ae===B-1?c:Wt)}}function Nr(e){let t=new at,n=e.match(/[a-zA-Z]|-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g)??[],r=0,s="",i=0,a=0,o=0,l=0,c=0,u=0,f=0,d=0,_="",p=()=>Number(n[r++]),w=()=>r<n.length&&!/[a-zA-Z]/.test(n[r]);for(;r<n.length;){/[a-zA-Z]/.test(n[r])&&(s=n[r++]);let R=s===s.toLowerCase(),L=s.toUpperCase(),F=R?i:0,H=R?a:0;switch(L){case"M":i=F+p(),a=H+p(),t.moveTo(i,a),o=i,l=a,s=R?"l":"L";break;case"L":i=F+p(),a=H+p(),t.lineTo(i,a);break;case"H":i=(R?i:0)+p(),t.lineTo(i,a);break;case"V":a=(R?a:0)+p(),t.lineTo(i,a);break;case"C":{let se=F+p(),X=H+p(),ye=F+p(),ve=H+p();i=F+p(),a=H+p(),t.cubicTo(se,X,ye,ve,i,a),c=ye,u=ve;break}case"S":{let se=_==="C"||_==="S",X=se?2*i-c:i,ye=se?2*a-u:a,ve=F+p(),q=H+p();i=F+p(),a=H+p(),t.cubicTo(X,ye,ve,q,i,a),c=ve,u=q;break}case"Q":f=F+p(),d=H+p(),i=F+p(),a=H+p(),t.quadTo(f,d,i,a);break;case"T":{let se=_==="Q"||_==="T";f=se?2*i-f:i,d=se?2*a-d:a,i=F+p(),a=H+p(),t.quadTo(f,d,i,a);break}case"A":{let se=p(),X=p(),ye=p()*Math.PI/180,ve=p()!==0,q=p()!==0,oe=F+p(),K=H+p();ed(t,i,a,se,X,ye,ve,q,oe,K),i=oe,a=K;break}case"Z":t.close(),i=o,a=l;break;default:r++}_=L,L==="Z"&&w()&&(s="L")}return t.build()}function sn(e,t,n){let r=$o(e,t,n),{x:s,y:i,pivot:a}=Lo(r,t,n);return{...Wo(r),x:s,y:-i,pivot:a}}var Qi=e=>e==null?e:-e;function ea(e,t){let n=new Float32Array(e.points.length);for(let r=0;r<n.length;r+=2){let s=e.points[r],i=e.points[r+1];n[r]=t[0]*s+t[2]*i+t[4],n[r+1]=t[1]*s+t[3]*i+t[5]}return{...e,points:n}}function ta(e,t){let n=e.rotation??0,r=e.scale??1;if(n===0&&r===1)return t;let s=e.pivot??{x:0,y:0},i=(e.x??0)+s.x*((e.width??0)/2),a=(e.y??0)-s.y*((e.height??0)/2),o=n*Math.PI/180,l=Math.cos(o)*r,c=Math.sin(o)*r,u=l,f=-c,d=c,_=l;return ea(t,[u,d,f,_,i-u*i-f*a,a-d*i-_*a])}var td={left:"left",right:"right",center:"center",justify:"justify",start:"left",end:"right"};function nd(e,t){let n=Pi(sn(e,e.width??0,e.height??0)),r=n.path!=null?Nr(Ti(n.path)):void 0,s=n.fontSize==="autofit",i={runs:[{text:n.text,family:n.fontFamily,size:s?100:n.fontSize,weight:n.fontWeight,italic:n.fontStyle==="italic"||n.fontStyle==="oblique",letterSpacing:n.letterSpacing,decoration:n.textDecoration==="underline"?"underline":n.textDecoration==="line-through"?"lineThrough":void 0}],align:td[n.textAlign]??"left",verticalAlign:n.verticalAlign,wrap:n.wrap&&n.width>0,width:n.width,height:n.height,lineHeight:n.lineHeight,fontSize:s?"autofit":void 0,minFontSize:n.minFontSize,path:r};if(r)return{spec:i,transform:[1,0,0,1,0,0],size:[n.width,n.height]};let[a,o]=t(i),l=Fo(n.pivot),c=n.width>0&&n.height>0,u=c?n.width:a,f=c?n.height:o,d=!c&&l.x!==0?n.x-l.x*(a/2):n.x,_=!c&&l.y!==0?n.y+l.y*(o/2):n.y,p=[1,0,0,1,d,_];if((n.rotation??0)!==0||(n.scale??1)!==1){let w=d+l.x*(u/2),R=_-l.y*(f/2),L=(n.rotation??0)*Math.PI/180,F=n.scale??1,H=Math.cos(L)*F,se=Math.sin(L)*F;p=[H,se,-se,H,w+H*(d-w)-se*(_-R),R+se*(d-w)+H*(_-R)]}return{spec:i,transform:p,size:[u,f]}}function In(e,t){return e?ta(t,Nr(e)):null}function Zt(e,t){let n=new e(t),r=n.fullState,s=n.geometry,i=In(n.buildSVGPath(s),r),a=n.needsTrim(),o=a?n.getTrimRange():null,l=i&&o?Dr(i,o.start,o.end):i,c=l,u=n instanceof Yi?n.ringOutline(s):null;if(u!=null){let w=In(u,r);c=w&&o?Dr(w,o.start,o.end):w}let f=n.buildSVGAlignInterior(s),d=f!=null?In(f,r):a?i:l,_=n.computeBounds(s),p=n.supportsSpread()?w=>In(n.buildSpreadSVGPath(s,w),r):void 0;return{fill:l,stroke:c,interior:d,bounds:_?[_.left,_.top,_.right,_.bottom]:null,spread:p,trimmed:!!o}}function rd(e){let t=new Yf(e),n=t.fullState,r=Nr(t.buildSVGPath(t.geometry)),[s,i,a,o]=n.centerBounds??et(r),l=ea(r,[1,0,0,1,-(s+(a-s)/2),-(i+(o-i)/2)]),c=ta({...n,x:0,y:0},l),u=t.needsTrim()?t.getTrimRange():null,f=u?Dr(c,u.start,u.end):c;return{fill:f,stroke:f,interior:u?c:f,bounds:null,trimmed:!!u}}var sd=e=>{let t={...e,y:Qi(e.y)};if(Array.isArray(e.data)&&(t.data=e.data.map(n=>{switch(n.type){case"M":case"m":case"L":case"l":case"T":case"t":case"V":case"v":return{...n,y:-n.y};case"C":case"c":return{...n,y1:-n.y1,y2:-n.y2,y:-n.y};case"S":case"s":return{...n,y2:-n.y2,y:-n.y};case"Q":case"q":return{...n,y1:-n.y1,y:-n.y};case"A":case"a":return{...n,y:-n.y,sweep:n.sweep===1?0:1};default:return n}}),e.centerBounds)){let[n,r,s,i]=e.centerBounds;t.centerBounds=[n,-i,s,-r]}return t};function kr(e){let t=e.state;switch(e.kind){case"rect":return Zt(Qf,sn(t,t.width??0,t.height??0));case"ellipse":{let n=sn(t,t.width??0,t.height??0);return t.startAngle!=null&&(n.startAngle=-t.startAngle),t.sweep!=null&&(n.sweep=-t.sweep),Zt(Yi,n)}case"polygon":return Zt(Xf,sn(t,t.width??0,t.height??0));case"polygram":return Zt(Zf,sn(t,t.width??0,t.height??0));case"line":{let n=t.points?t.points.map(r=>({x:r.x,y:-r.y})):t.points;return Zt(Jf,{...t,y:Qi(t.y),points:n})}case"path":return rd(sd(t))}return null}function id(e,t,n){if(n<=0||e.strength<=0||e.length<=0)return null;let r=vt(e.axis),s=e.length/100,i=t.x*n*r.x*s*e.strength,a=t.y*n*r.y*s*e.strength,o=Math.hypot(i,a);return o<.01?null:{angle:Math.atan2(a,i)*180/Math.PI,radius:o,phase:Oo(e.alignment),samples:e.samples}}var it=.5,na=Math.hypot(1,it),fi=it/na,ad=1/na,od=.35;function ra(e){return e==="arrow"||e==="triangle"||e==="stealth"}function ld(e,t,n){return ra(e)?Math.min(t,n/(2*it)):0}function cd(e,t,n){let r=t/2;switch(e){case"dot":return null;case"triangle":return[0,0,-t,t*it,-t,-t*it];case"stealth":return[0,0,-t,t*it,-t*(1-od),0,-t,-t*it];case"arrow":return ud(t,n);case"box":return[-r,-r,r,-r,r,r,-r,r];case"diamond":return[r,0,0,r,-r,0,0,-r];case"bar":return[-n/2,-r,n/2,-r,n/2,r,-n/2,r]}}function ud(e,t){let n=e*it,r=-e-t*fi,s=n-t*ad;if(s<=0)return[0,0,-e,n,-e,-n];let i=-t/fi;return[0,0,-e,n,r,s,i,0,r,-s,-e,-n]}function fd(e,t,n,r){let s=!!e.dash?.length,i=e.startCap??e.cap,a=e.endCap??e.cap,o=s?e.cap:Dt(a)?"butt":a,l=i!==o||a!==o;if(!s&&!l)return{cap:o,ends:[]};let c=Gf(t),u=s?zf(c,e.dash):null;if(s&&!u)return{cap:o,ends:l?Mr(c,e,i,a,o,n,null):[]};if(!u)return{cap:o,ends:Mr(c,e,i,a,o,n,null)};let d=l?Mr(c,e,i,a,o,n,_=>qi(_,e.dash,e.dashOffset??0,Ki(_,e.dash,u))):[];if(r||d.length||u.open){let _=Hf(c,e.dash,e.dashOffset??0,e.cap!=="butt",u);return _?{cap:o,ends:d,source:_}:null}return{cap:o,ends:d,dash:e.dash.map(_=>_*u.scale),dashPhase:(e.dashOffset??0)*u.scale}}function Mr(e,t,n,r,s,i,a){let o=[],l=(Dt(n)?1:0)+(Dt(r)?1:0),c=i/2,u=Math.min(c,1)/2,f=t.cap!=="butt"?c:0;for(let d of e){if(d.closed)continue;let _=Math.min(t.capScale*i,d.length/Math.max(1,l)),p=a?.(d),w=R=>!p||p.some(([L,F])=>R>=L-f-1e-6&&R<=F+f+1e-6);n!==s&&di(o,d.posTan(0),d.posTan(_),-1,n,_,i,w(u)),r!==s&&di(o,d.posTan(d.length),d.posTan(d.length-_),1,r,_,i,w(d.length-u))}return o}function di(e,[t,n,r,s],i,a,o,l,c,u){let f=a*r,d=a*s;Dt(o)&&ra(o)&&Math.hypot(t-i[0],n-i[1])>1e-6&&(f=t-i[0],d=n-i[1]);let _=Math.hypot(f,d);_<1e-9||e.push({x:t,y:n,dx:f/_,dy:d/_,cap:o,size:l,weight:c,reached:u})}function Sr({x:e,y:t,dx:n,dy:r},s,i){let a=-r*i,o=n*i,l=n*s,c=r*s;return new at().moveTo(e-a,t-o).lineTo(e-a+l,t-o+c).lineTo(e+a+l,t+o+c).lineTo(e+a,t+o).close().build()}function dd({x:e,y:t,dx:n,dy:r},s){let i=new at,a=32;for(let o=0;o<=a;o++){let l=-Math.PI/2+Math.PI*o/a,c=Math.cos(l)*s,u=Math.sin(l)*s,f=e+c*n-u*r,d=t+c*r+u*n;o===0?i.moveTo(f,d):i.lineTo(f,d)}return i.close().build()}function hd(e,t){let{x:n,y:r,dx:s,dy:i,size:a,weight:o}=e,l=cd(t,a,o),c=new at;if(!l){let u=a/2,f=.5522848*u;return c.moveTo(n+u,r).cubicTo(n+u,r+f,n+f,r+u,n,r+u).cubicTo(n-f,r+u,n-u,r+f,n-u,r).cubicTo(n-u,r-f,n-f,r-u,n,r-u).cubicTo(n+f,r-u,n+u,r-f,n+u,r),c.close().build()}for(let u=0;u<l.length;u+=2){let f=n+l[u]*s-l[u+1]*i,d=r+l[u]*i+l[u+1]*s;u===0?c.moveTo(f,d):c.lineTo(f,d)}return c.close().build()}function ht(e){if(e.length===1)return e[0];let t=new Uint8Array(e.reduce((i,a)=>i+a.verbs.length,0)),n=new Float32Array(e.reduce((i,a)=>i+a.points.length,0)),r=0,s=0;for(let i of e)t.set(i.verbs,r),r+=i.verbs.length,n.set(i.points,s),s+=i.points.length;return{verbs:t,points:n}}var _d=class extends Set{node;nodes=new Map;constructor(e){super(),this.node=e}add(e){super.add(e);let t=this.node?.();if(t!==void 0){let n=this.nodes.get(e);n||this.nodes.set(e,n=new Set),n.add(t)}return this}clear(){super.clear(),this.nodes.clear()}},hi=new Set(["rect","ellipse","path","line","polygon","polygram","text","richText"]),_t={kind:"solid",color:[0,0,0,1]},_i={union:"union",subtract:"cut",intersect:"intersect",exclude:"exclude"};function Ar(e){let t=null;for(let n of e){let r=et(n.path),s=n.op??"union";t?s==="union"||s==="exclude"?t=[Math.min(t[0],r[0]),Math.min(t[1],r[1]),Math.max(t[2],r[2]),Math.max(t[3],r[3])]:s==="intersect"&&(t=[Math.max(t[0],r[0]),Math.max(t[1],r[1]),Math.min(t[2],r[2]),Math.min(t[3],r[3])],(t[2]<t[0]||t[3]<t[1])&&(t=[t[0],t[1],t[0],t[1]])):(s==="union"||s==="exclude")&&(t=r)}return t}function pd(e){let t=e[0]*e[3]-e[1]*e[2];if(!t)return null;let n=e[3]/t,r=-e[1]/t,s=-e[2]/t,i=e[0]/t;return[n,r,s,i,-(n*e[4]+s*e[5]),-(r*e[4]+i*e[5])]}var pi=1<<20;function Er(e){let t=(e==="plus-lighter"?"plus":e).replace(/-(\w)/g,(n,r)=>r.toUpperCase());return Fi.includes(t)?t:null}var mi=new WeakMap,md=1<<24;function gi(e){let t=mi.get(e);return t===void 0&&mi.set(e,t=md++),t}var gd=class extends wo{width;height;measure;readsSpaceRects=!0;drawsVisibleOnly=!0;pixelRatio=1;doc;missing=new _d(()=>this.currentNodeStack[this.currentNodeStack.length-1]);shaderIssues=[];storage=null;images=new Map;frameImages=new Map;assets={image:e=>this.image(e),scene3d:(e,t,n,r)=>{let s=new Map;To(e,o=>{if(Po(o)&&!s.has(o)){let l=this.surfaceOf(o);l&&s.set(o,l)}});let i=new Proxy({},{get:(o,l)=>typeof l=="string"?this.image(l)??void 0:void 0}),a=this.doc.addScene3D(e,t,n,{images:i,surfaces:s});return a.scale3d=r,a.version=++pi,a},video:(e,t)=>{let n=this.storage,r=t??this.videoTime(e);if(!n||r===null)return null;let s=n.videoFrame(e.src,r);if(!s)return null;let i=`${wt(e.src)}@${r.toFixed(6)}`,a=this.frameImages.get(i);return a||(a=this.doc.addImage(s,s.width,s.height,{mipmaps:!1}),a.version=gi(s),this.frameImages.set(i,a)),a},imageEdge:(e,t)=>this.storage?.wantImageEdge?.(e,t),deviceScale:()=>{let e=this.device();return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))},time:()=>this.elapsed(),checkShader:e=>this.checkShader("fill",e)};image=e=>{let t=wt(e),n=this.frameImages.get(t);if(n)return n;let r=this.images.get(t);return r?(n=this.doc.addImage(r.bitmap,r.width,r.height),n.version=gi(r.bitmap),this.frameImages.set(t,n),n):null};stack=[];scopes=[];worldAlpha=1;shapes=[];painted=!1;shadows=[];constructor(e,t,n){super(),this.width=e,this.height=t,this.measure=n}get cur(){return this.stack[this.stack.length-1]}measureText(e,t,n,r=400,s=0,i){return this.measure(e,t,n,r,s,i)}execute(e){this.doc=new Bi(this.width,this.height,this.clearColor()),this.frameImages.clear(),this.missing.clear(),this.shaderIssues.length=0;let t=this.doc.group(this.doc.root,{transform:this.rootTransform()}),n=this.frameGroup(t);this.stack=n===t?[t]:[t,n],this.scopes=[],this.worldAlpha=1,this.masks=[],this.cameras=[],this.clips=[],this.booleans=[],this.resetSurface(),e()}rootTransform(){return[1,0,0,1,this.width/2,this.height/2]}clearColor(){return[0,0,0,1]}frameGroup(e){return e}screenshot(){}unmount(){}begin(e){super.begin(e),this.scopes.push({groups:1,worldAlpha:this.worldAlpha}),this.stack.push(this.doc.group(this.cur)),this.resetSurface()}end(){let e=this.scopes.pop();if(e){for(let t=0;t<e.groups;t++)this.stack.pop();this.worldAlpha=e.worldAlpha}super.end()}transform(e){let t=e.x??0,n=e.y??0,r=e.width??0,s=e.height??0,i=e.opacity??1,a=e.blend??"pass-through",o,l=e.matrix;if(l)o=[l.a,l.b,l.c,l.d,l.e,l.f,l.g??0,l.h??0,l.i??1];else{let f=e.pivot??{x:0,y:0},d=f.x*(r/2),_=-f.y*(s/2),p=(e.rotation??0)*Math.PI/180,w=e.scale??1,R=Math.cos(p)*w,L=Math.sin(p)*w;o=[R,L,-L,R,t+d-(R*d-L*_),n+_-(L*d+R*_)]}let c=this.cur;c.transform=hr(c.transform,On(o)?o:o.slice(0,6));let u=this.motionBlur((e.effects??[]).filter(f=>f.mode!=="backdrop"));for(let f of u)f.type==="shader"&&this.checkShader("effect",f);if(u.length&&(c.effects=u,c.effectBox=[-r/2,-s/2,r,s],c.effectTime=this.elapsed()),a!=="pass-through"){let f=Er(a);f||this.missing.add(`blend:${a}`),this.stack.push(this.doc.group(c,{opacity:this.worldAlpha*(i<1?i:1),blend:f??"normal"})),this.scopes[this.scopes.length-1].groups++,this.worldAlpha=1}else i<1&&(this.worldAlpha*=i);return this}resetSurface(){this.shapes=[],this.painted=!1,this.shadows=[]}drawGraphics(e){let t=this.worldAlpha,n=e;if(n.needsGroupLayer?.()){let c=n.groupOpacity();c<1&&(this.worldAlpha*=c)}let r=n.groupTransform?.(),s=null;if(r){let{x:c,y:u}=this.groupCenter(e,r.center),f=r.rotation*Math.PI/180,d=Math.cos(f)*r.scale,_=Math.sin(f)*r.scale;s=this.doc.group(this.cur,{transform:[d,_,-_,d,c-(d*c-_*u),u-(_*c+d*u)]}),this.stack.push(s)}let i=e.ops(),a=this.effectSegments(i),o=null;for(let c=0;c<i.length;c++){let u=i[c],f=a.get(c);switch(f&&(o=this.doc.group(this.cur,{effects:f,effectBox:this.viewportBox(),effectTime:this.elapsed()}),this.stack.push(o)),u.kind){case"rect":case"ellipse":case"polygon":case"polygram":case"line":case"path":{this.painted&&this.resetSurface();let d=kr(u);if(!d)break;this.booleans.length?this.collect(d):this.shapes.push(d);break}case"cut":this.cut();break;case"richText":this.painted&&this.resetSurface(),this.richText(u.state);break;case"text":{this.painted&&this.resetSurface();let d=nd(u.state,_=>{let p=_.runs[0],w=this.measureText(p.text,p.size,p.family,p.weight,p.letterSpacing,p.italic?"italic":"normal");return[w.width,w.height]});if(d){let[_,p]=d.size,w=d.transform[4],R=d.transform[5];this.shapes.push({fill:null,stroke:null,interior:null,bounds:[w-_/2,R-p/2,w+_/2,R+p/2],text:d})}else this.missing.add("text:path");break}case"fill":this.fill(Eo.resolve(u.fills));break;case"stroke":this.stroke(Vo.resolve(u.strokes));break;case"shadow":this.shadows=No.resolve(u.shadows);break;case"effects":o&&(this.stack.splice(this.stack.lastIndexOf(o)),o=null),this.resetSurface();break;case"mask":this.beginMask(u.options);break;case"applyMask":this.applyMask();break;case"endMask":this.endMask();break;default:this.missing.add(`op:${u.kind}`)}}let l=s??o;l&&this.stack.splice(this.stack.lastIndexOf(l)),this.worldAlpha=t}effectSegments(e){let t=new Map,n=0,r=!1;return e.forEach((s,i)=>{if(hi.has(s.kind))r&&(n=i,r=!1);else if(s.kind==="fill"||s.kind==="stroke"||s.kind==="shadow")r=!0;else if(s.kind==="effects"){let a=this.motionBlur(s.effects.filter(o=>o.mode!=="backdrop"));a.length&&t.set(n,a),n=i+1,r=!1}}),t}motionBlur(e){if(!e.some(n=>n.type==="motionBlur"))return e;let t=this.currentRenderState();return e.flatMap(n=>{if(n.type!=="motionBlur")return[n];let r=t?id(n,t.velocity,t.dt):null;return r?((r.phase!==0||Math.round(r.samples)>32)&&this.missing.add("effect:motionBlur-shutter"),[{type:"directionalBlur",radius:r.radius,angle:r.angle}]):[]})}groupCenter(e,t){if(t!==void 0&&typeof t!="string")return{x:t.x,y:t.y};let n=null;for(let a of e.ops()){let o=hi.has(a.kind)&&a.kind!=="text"&&a.kind!=="richText"?kr(a)?.fill:null;if(!o||!o.verbs.length)continue;let l=et(o);n=n?[Math.min(n[0],l[0]),Math.min(n[1],l[1]),Math.max(n[2],l[2]),Math.max(n[3],l[3])]:l}if(!n)return{x:0,y:0};let r=(n[0]+n[2])/2,s=(n[1]+n[3])/2;if(t===void 0)return{x:r,y:s};let i=vo.resolve(t);return{x:r+i.x*((n[2]-n[0])/2),y:s-i.y*((n[3]-n[1])/2)}}viewportBox(){let[e,t,n,r]=this.spaceBounds({space:"global"},[0,0,0,0]);return[e,t,n-e,r-t]}surface(e){let t=this.shapes.map(n=>n[e]).filter(n=>!!n&&n.verbs.length>0);return e==="fill"&&t.length>1&&(t=t.map(n=>Nf(n)<0?Wf(n):n)),t.length?ht(t):null}bounds(e){let t=this.shapes.map(n=>n.bounds).filter(n=>n!==null);return e&&t.length!==this.shapes.length?et(e):t.length?t.reduce((n,r)=>[Math.min(n[0],r[0]),Math.min(n[1],r[1]),Math.max(n[2],r[2]),Math.max(n[3],r[3])]):[0,0,0,0]}leaf(e,t,n){return"members"in t?this.doc.compound(e,{...n,members:t.members}):this.doc.pathNode(e,{...n,path:t.path})}geomBounds(e){return"members"in e?Ar(e.members)??[0,0,0,0]:et(e.path)}spreadGeom(e,t,n){if(!t||"members"in e)return e;let r=[];for(let s of this.shapes){if(s.members||!s.fill||!s.fill.verbs.length)continue;let i=s.spread?s.spread(t):s.fill;i&&i.verbs.length?r.push(i):n||r.push(s.fill)}return r.length?{path:ht(r)}:null}clipTo(e,t){if("path"in t){let[r,s,i,a]=et(t.path);return this.doc.group(e,{clip:{x:r,y:s,w:i-r,h:a-s,r:0,path:t.path}})}let n=this.doc.group(e,{mask:"alpha"});return this.doc.compound(n,{members:t.members,fill:_t}),n}clipOutside(e,t){let n=this.doc.group(e,{mask:"invertAlpha"});return this.leaf(n,t,{fill:_t}),n}fill(e){this.painted=!0,!this.booleans.length&&this.deferring("fill",()=>this.paintFill(e))}deferring(e,t){let n=this.masks[this.masks.length-1],r=n?.apply&&!n.apply.has(e)&&!this.inVectorMask?n.after:null;if(!r)return t();this.stack.push(r);try{t()}finally{this.stack.splice(this.stack.lastIndexOf(r))}}paintFill(e){if(this.paintText(e,null),!e.length)return;let t=this.surface("fill"),n=t?[{path:t}]:[];for(let i of this.shapes)i.members&&n.push({members:i.members});if(!n.length)return;let r=this.bounds(t),s=this.shadows;this.shadows=[];for(let i of n)this.fillGeom(i,r,e,s)}fillGeom(e,t,n,r){if(this.inVectorMask){this.leaf(this.cur,e,{fill:_t});return}let s=[];for(let i of r){if(i.inner)continue;if(i.fill.length===1&&i.fill[0].type==="solid"){let u=Df(i,this.missing);u&&s.push(u);continue}let a=i.offset?.x??0,o=-(i.offset?.y??0),l=this.doc.group(this.cur,{transform:[1,0,0,1,a,o],filter:i.blur>0?{kind:"blur",sigma:i.blur/2}:void 0}),c=this.spreadGeom(e,i.spread??0,!1);for(let u of i.fill){let f=dt(u,this.spaceBounds(u,t),this.missing,this.assets);f&&this.leaf(l,c,{fill:f,opacity:this.worldAlpha*(u.opacity??1)})}}n.forEach((i,a)=>{let o=this.spaceBounds(i,t),l=dt(i,o,this.missing,this.assets);if(!l)return;let c=this.worldAlpha*(i.opacity??1),u=a===0?s:[],f=i.type==="video"?i.preset?.adjustments?.find(_=>_.type==="echo"):void 0;if(f&&f.echoes>0&&f.delay>0){this.echoStack(e,i,o,t,l,c,u,f);return}let d=i.preset?.intensity??1;if(d>0&&d<1&&this.pixelAdjustments(i).length){let _=this.doc.group(this.cur,{opacity:c,blend:this.blendOf(i)});this.mediaPreset(this.leaf(_,e,{fill:l,shadows:u}),i,t),this.leaf(_,e,{fill:l,opacity:1-d});return}this.mediaPreset(this.leaf(this.cur,e,{fill:l,opacity:c,shadows:u,blend:this.blendOf(i)}),i,t)});for(let i of r){if(!i.inner)continue;let a=this.spreadGeom(e,-(i.spread??0),!0),o=i.offset?.x??0,l=-(i.offset?.y??0),[c,u,f,d]=this.geomBounds(e),_=Math.abs(o)+Math.abs(l)+i.blur*2+2,p=this.clipTo(this.cur,e);for(let w of i.fill){let R=dt(w,this.spaceBounds(w,t),this.missing,this.assets);if(!R)continue;let L=this.doc.group(p,{opacity:this.worldAlpha*(w.opacity??1),filter:i.blur>0?{kind:"blur",sigma:i.blur/2}:void 0}),F=this.doc.group(L,a?{mask:"invertAlpha"}:{});a&&this.leaf(F,a,{transform:[1,0,0,1,o,l],fill:_t}),this.doc.rect(F,{transform:[1,0,0,1,c-_,u-_],w:f-c+2*_,h:d-u+2*_,fill:R})}}}richText(e){let t=Yo(e),n=t.spans;if(!n.length)return;let r=[-t.width/2,-t.height/2,t.width/2,t.height/2],s={kind:"solid",color:[0,0,0,0]},i=u=>(u[0]?dt(u[0],r,this.missing,this.assets):null)??s,a=n.map(u=>({text:u.text,family:u.fontFamily,size:u.fontSize,weight:u.fontWeight,italic:u.fontStyle==="italic"||u.fontStyle==="oblique",letterSpacing:u.letterSpacing})),o={runs:a,align:{start:"left",end:"right"}[t.textAlign]??t.textAlign,wrap:t.width>0,width:t.width,lineHeight:t.lineHeight},l=Math.max(1,...n.map(u=>u.fill.length));for(let u=0;u<l;u++){let f=a.map((d,_)=>({...d,paint:i(n[_].fill.slice(u,u+1))}));this.doc.textNode(this.cur,{text:{...o,runs:f},fill:s,opacity:this.worldAlpha})}let c=new Map;n.forEach((u,f)=>u.stroke.forEach((d,_)=>{let p=`${_}|${d.weight}|${d.join}|${d.cap}|${d.miterLimit}`,w=c.get(p);w||c.set(p,w={k:_,st:d,paints:n.map(()=>s)}),w.paints[f]=i(d.fill)}));for(let{st:u,paints:f}of[...c.values()].sort((d,_)=>d.k-_.k)){let d=a.map((_,p)=>({..._,paint:f[p]}));this.doc.textNode(this.cur,{text:{...o,runs:d},opacity:this.worldAlpha,stroke:{paint:s,width:u.weight,join:u.join,cap:u.cap,miter:u.miterLimit}})}}paintText(e,t){for(let n of this.shapes){let r=n.text;if(!r)continue;let s=n.bounds,i=[s[0]-r.transform[4],s[1]-r.transform[5],s[2]-r.transform[4],s[3]-r.transform[5]];for(let a of e){let o=dt(a,i,this.missing,this.assets);if(!o)continue;let l=this.worldAlpha*(a.opacity??1);if(t){let c=p=>({paint:o,width:p,join:t.join,cap:t.cap,miter:t.miterLimit,dash:t.dash,dashPhase:t.dashOffset}),u=Math.max(-1,Math.min(1,t.align??0));if(u===0){this.doc.textNode(this.cur,{transform:r.transform,text:r.spec,opacity:l,stroke:c(t.weight)});continue}let f=p=>this.doc.textNode(p,{transform:r.transform,text:r.spec,fill:_t}),d=(p,w)=>this.doc.textNode(p,{transform:r.transform,text:r.spec,stroke:{paint:_t,width:w,join:t.join,miter:t.miterLimit}}),_=p=>{if(u>0){let L=this.doc.group(this.cur,{mask:"invertAlpha"}),F=this.doc.group(L,{mask:"invertAlpha"});return d(F,p),f(F),L}let w=this.doc.group(this.cur,{mask:"alpha"}),R=this.doc.group(w);return f(R),d(R,p),w};if(Math.abs(u)>=1){let p=this.doc.group(this.cur,{mask:u>0?"invertAlphaEroded":"alphaDilated"});f(p),this.doc.textNode(p,{transform:r.transform,text:r.spec,opacity:l,stroke:c(2*t.weight)})}else{let p=(1+u)*t.weight/2,w=(1-u)*t.weight/2;this.doc.textNode(_(2*(u>0?w:p)),{transform:r.transform,text:r.spec,opacity:l,stroke:c(2*Math.max(p,w))})}}else this.doc.textNode(this.cur,{transform:r.transform,text:r.spec,opacity:l,fill:o})}}}surfaceOf(e){let t=Math.max(1,Math.min(e.maxPixelRatio??1,4)),n=e.width??512,r=e.height??512,s=Math.max(1,Math.ceil(n*t)),i=Math.max(1,Math.ceil(r*t)),a=this.doc.detached({transform:[t,0,0,t,n*t/2,r*t/2]}),o={stack:this.stack,scopes:this.scopes,alpha:this.worldAlpha,shapes:this.shapes,painted:this.painted,shadows:this.shadows,masks:this.masks,clips:this.clips,cameras:this.cameras};this.stack=[a],this.scopes=[],this.worldAlpha=1,this.masks=[],this.clips=[],this.cameras=[],this.resetSurface();try{let c=Bo(e.source);c.kind==="graphics"?this.draw(c.graphics):(c.node.layout({x:0,y:0,width:n,height:r},this),c.node.render(this))}catch(c){this.missing.add("surface:error"),console.warn(c)}finally{Object.assign(this,{stack:o.stack,scopes:o.scopes,worldAlpha:o.alpha,shapes:o.shapes,painted:o.painted,shadows:o.shadows,masks:o.masks,clips:o.clips,cameras:o.cameras})}let l=this.doc.addSurface(a,s,i);return l.version=++pi,l}mediaPreset(e,t,n){let r=this.pixelAdjustments(t);!r.length||(t.preset.intensity??1)<=0||(e.effects=r.map(s=>({...s,clip:!0})),e.effectBox=[n[0],n[1],n[2]-n[0],n[3]-n[1]],e.effectTime=this.elapsed())}pixelAdjustments(e){let t=e;return t.type!=="image"&&t.type!=="video"||!t.preset?[]:(t.preset.adjustments??[]).filter(n=>n.type!=="echo"&&n.type!=="posterizeTime")}echoStack(e,t,n,r,s,i,a,o){let l=Er(o.blend??"screen")??"screen",c=o.decay??.5,u=Math.min(Math.max(0,Math.floor(o.echoes)),32),f=this.videoTime(t);a.length&&this.leaf(this.cur,e,{fill:{kind:"solid",color:[0,0,0,0]},opacity:i,shadows:a});for(let d=u;d>=1&&f!==null;d--){let _=f-d*o.delay;if(_<0)continue;let p=dt(t,n,this.missing,{...this.assets,video:w=>this.assets.video(w,_)});p&&this.leaf(this.cur,e,{fill:p,opacity:i*Math.pow(c,d),blend:l})}this.mediaPreset(this.leaf(this.cur,e,{fill:s,opacity:i,blend:l}),t,r)}videoTime(e){let t=this.storage?.videos.get(wt(e.src));return t?Uo(e,this.currentRenderState()?.elapsed??0,t.duration):null}elapsed(){return this.currentRenderState()?.elapsed??0}spaceBounds(e,t){let n=e.space??"local";if(n==="parent"){let r=this.currentSpaceRects().parent;return r?[r.left,r.top,r.right,r.bottom]:t}if(n==="global"){let r=this.device(),s=r[0]*r[3]-r[1]*r[2];if(!s)return t;let i=(u,f)=>{let d=u-r[4],_=f-r[5];return[(r[3]*d-r[2]*_)/s,(-r[1]*d+r[0]*_)/s]},a=this.width*this.pixelRatio,o=this.height*this.pixelRatio,l=i(0,0),c=i(a,o);return[Math.min(l[0],c[0]),Math.min(l[1],c[1]),Math.max(l[0],c[0]),Math.max(l[1],c[1])]}return t}blendOf(e){let t=e.blend;if(!t||t==="normal")return"normal";let n=Er(t);return n||this.missing.add(`fill:blend:${t}`),n??"normal"}device(){let e=[this.pixelRatio,0,0,this.pixelRatio,0,0];for(let t of this.stack)e=hr(e,t.transform);return e}snap(e,t,n){if(t<=0||Math.abs(n[1])>1e-6||Math.abs(n[2])>1e-6||n[0]===0||n[3]===0)return null;let[r,s,i,a]=et(e);if(i-r<=0||a-s<=0)return null;let o=n[0],l=n[3],c=n[4],u=n[5],f=c+o*r,d=u+l*s,_=c+o*i,p=u+l*a,w=t%2===0?0:.5,R=Math.round(f-w)+w,L=Math.round(d-w)+w,F=Math.round(_-w)+w,H=Math.round(p-w)+w;if(F-R<1||H-L<1)return null;let se=(F-R)/(_-f),X=(H-L)/(p-d);return Math.abs(se-1)<1e-4&&Math.abs(X-1)<1e-4&&Math.abs(R-f)<1e-4&&Math.abs(L-d)<1e-4?null:[se,0,0,X,(R-c)/o-se*r,(L-u)/l-X*s]}stroke(e){this.painted=!0,!this.booleans.length&&this.deferring("stroke",()=>this.paintStroke(e))}paintStroke(e){for(let i of e)this.paintText(i.fill,i);let t=this.surface("fill"),n=this.device(),r=Math.sqrt(Math.abs(n[0]*n[3]-n[1]*n[2])),s=On(n)||Math.abs(n[1])>1e-6||Math.abs(n[2])>1e-6;for(let i of e){let a=i.weight,o=-1;!s&&a>0&&r>0&&a*r<2.5&&(o=Math.max(1,Math.round(a*r)),a=o/r);for(let l of this.strokeShapes()){let c,u,f={cap:i.cap,ends:[],dash:i.dash,dashPhase:i.dashOffset};if(l.members)c=u={members:l.members};else{if(!l.stroke||!l.stroke.verbs.length)continue;let L=fd(i,l.stroke,a,o>0);if(!L)continue;f=L,c={path:L.source??l.stroke},u=l.alignInterior?{members:l.alignInterior}:l.interior&&ii(l.interior)?{path:l.interior}:null}let d=this.bounds(t??("path"in c?c.path:null)),_=Math.max(-1,Math.min(1,i.align??0)),p=_!==0&&u!==null&&!f.ends.some(L=>Dt(L.cap))?[[(1+_)*a,"out"],[(1-_)*a,"in"]]:[[a,"both"]],w=l.fill?this.snap(l.fill,o,n):null,R=w?this.doc.group(this.cur,{transform:w}):this.cur;for(let L of i.fill){let F=dt(L,this.spaceBounds(L,d),this.missing,this.assets);if(!F)continue;let H=this.worldAlpha*(L.opacity??1);for(let[se,X]of p){if(se<=0)continue;let ye={paint:F,width:se,join:i.join,cap:f.cap,miter:i.miterLimit,dash:f.dash,dashPhase:f.dashPhase};X==="both"?this.strokeLeaf(R,c,{opacity:H,stroke:ye,blend:this.blendOf(L)},f.ends):this.strokeLeaf(X==="in"?this.clipTo(R,u):this.clipOutside(R,u),c,{opacity:H,stroke:ye},f.ends)}}}}}strokeShapes(){if(this.shapes.some(r=>r.text))return this.shapes;let e=this.shapes.filter(r=>r.members||r.fill&&r.fill.verbs.length).sort((r,s)=>(s.members?1:0)-(r.members?1:0));if(e.length<2)return this.shapes;let t=[];for(let r of e)r.members?r.members.forEach((s,i)=>t.push({...s,op:i===0?"union":s.op})):t.push({kind:"path",path:r.fill,op:"union"});e.filter(r=>r.members).length>1&&this.missing.add("stroke:union-of-booleans");let n=e.every(r=>r.bounds)?e.map(r=>r.bounds).reduce((r,s)=>[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]):null;return e.some(r=>!r.members&&(r.stroke!==r.fill||r.trimmed||!ii(r.fill)))?e.some(r=>r.members)?this.shapes:[{fill:ht(e.map(r=>r.fill)),stroke:ht(e.map(r=>r.stroke??r.fill)),interior:null,alignInterior:t,bounds:n}]:[{fill:null,stroke:null,interior:null,bounds:n,members:t}]}strokeLeaf(e,t,n,r){if(!r.length)return this.leaf(e,t,n);let s=n.stroke.width/2,i=s*1.01+.5,a=n.stroke.cap!=="butt",o=[],l=[];for(let f of r){if(Dt(f.cap)){let d=ld(f.cap,f.size,f.weight);(d>0||a)&&o.push(Sr({...f,x:f.x-f.dx*d,y:f.y-f.dy*d},d+i,i)),l.push(hd(f,f.cap));continue}a&&o.push(Sr(f,i,i)),f.reached&&f.cap!=="butt"&&l.push(f.cap==="round"?dd(f,s):Sr(f,s,s))}let c=this.doc.group(e,{opacity:n.opacity??1,blend:n.blend??"normal"}),u={...n,opacity:1,blend:"normal"};if(o.length){let f=this.doc.group(c,{mask:"invertAlpha"});this.doc.pathNode(f,{path:ht(o),fill:_t}),this.leaf(f,t,u)}else this.leaf(c,t,u);return l.length&&this.doc.pathNode(c,{path:ht(l),fill:n.stroke.paint}),c}booleans=[];beginBoolean(e){this.booleans.push({op:e,base:pd(this.device()),members:[]}),this.resetSurface()}endBoolean(){let e=this.booleans.pop();if(this.resetSurface(),!e||!e.members.length)return;let t=this.booleans[this.booleans.length-1];if(!t){this.shapes.push({fill:null,stroke:null,interior:null,bounds:Ar(e.members),members:e.members});return}let n=this.relative(t.base),r=_i[t.op],s=!t.members.length;!s&&!e.members.slice(1).every(i=>i.op===(r==="cut"?"union":r))&&this.missing.add("boolean:nested"),e.members.forEach((i,a)=>{let o=i.op??"union",l=s?o:a===0||r==="cut"?r:o;t.members.push({kind:"path",path:n?Gs(i.path,n):i.path,op:l})})}relative(e){let t=this.device();return!e||On(t)?null:hr(e,t)}collect(e){let t=this.booleans[this.booleans.length-1],n=e.fill;if(!n||!n.verbs.length)return;let r=this.relative(t.base);r||this.missing.add("boolean:projective"),t.members.push({kind:"path",path:r?Gs(n,r):n,op:t.members.length?_i[t.op]:"union"})}cut(){let e=this.shapes.filter(n=>n.members||n.fill&&n.fill.verbs.length);if(this.resetSurface(),!e.length)return;let t=[];e.forEach((n,r)=>{let s=r>0&&r===e.length-1?"cut":"union";if(!n.members){t.push({kind:"path",path:n.fill,op:s});return}r>0&&this.missing.add("cut:compound"),n.members.forEach((i,a)=>t.push({...i,op:a===0?s:i.op}))}),this.shapes.push({fill:null,stroke:null,interior:null,bounds:Ar(t),members:t})}masks=[];get inVectorMask(){let e=this.masks[this.masks.length-1];return!!e&&e.open&&e.vector}beginMask(e){let t=e?.mode??"alpha",n=t==="luminance",r=e?.inverted?n?"invertLuminance":"invertAlpha":n?"luminance":"alpha",s=this.doc.group(this.cur,{mask:r}),i=e?.apply?new Set(Array.isArray(e.apply)?e.apply:[e.apply]):null,a=i?this.doc.group(this.cur):null;this.stack.push(s,this.doc.group(s)),this.masks.push({vector:t==="vector",open:!0,apply:i,after:a}),this.resetSurface()}applyMask(){let e=this.masks[this.masks.length-1];e?.open&&(e.open=!1,this.stack.pop(),this.resetSurface())}endMask(){let e=this.masks.pop();e&&(e.open&&this.stack.pop(),this.stack.pop(),this.resetSurface())}clips=[];clipGeom(e){let t=[];for(let n of e.ops()){if(n.kind==="cut"){t.length>1&&(t[t.length-1].op="cut");continue}let r=kr(n)?.fill;r&&r.verbs.length&&t.push({kind:"path",path:r,op:"union"})}return t.length?t.some(n=>n.op==="cut")?{members:t}:{path:ht(t.map(n=>n.path))}:null}beginClip(e){let t=this.clipGeom(e);if(!t){this.clips.push({pushed:0,geom:null});return}let n=this.clipTo(this.cur,t);"members"in t?this.stack.push(n,this.doc.group(n)):this.stack.push(n),this.clips.push({pushed:"members"in t?2:1,geom:t})}endClip(){let e=this.clips.pop()?.pushed??0;for(let t=0;t<e;t++)this.stack.pop()}cameras=[];beginCamera(e,t,n,r){let s=this.doc.group(this.cur,{clip:{x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,r:0}}),i=-r*Math.PI/180,a=Math.cos(i)*n,o=Math.sin(i)*n,l=-t.x,c=t.y,u=this.doc.group(s,{transform:[a,o,-o,a,e.x+a*l-o*c,e.y+o*l+a*c]});this.stack.push(s,u),this.cameras.push(2)}endCamera(){let e=this.cameras.pop()??0;for(let t=0;t<e;t++)this.stack.pop()}beginEffects(e,t,n,r){if(t!=="backdrop")return;for(let i of e)i?.type==="shader"&&this.checkShader("effect",i);let s=this.clips[this.clips.length-1]?.geom;if(!s){let[i,a,o,l]=this.viewportBox();s={path:new at().moveTo(i,a).lineTo(i+o,a).lineTo(i+o,a+l).lineTo(i,a+l).close().build()}}this.leaf(this.cur,s,{effects:e,effectBox:[-n/2,-r/2,n,r],effectTime:this.elapsed()})}endEffects(){}checkShader(e,t){let n=this.currentNodeStack[this.currentNodeStack.length-1];for(let r of Bf(e,t))this.shaderIssues.push(n===void 0?r:{...r,nodeId:n})}rasterize(){return this.missing.add("rasterize"),null}},sa={normal:0,italic:1,oblique:2},bd={left:0,right:1,center:2,justify:3,start:4,end:5},wd={top:0,center:1,bottom:2},bi=new WeakMap;function ia(e){let t=bi.get(e);if(!t){let n=t=new Pr;for(let r of e.fonts)n.register_font(r.bytes,r.family);e.onFont(r=>n.register_font(r.bytes,r.family)),bi.set(e,n)}return t}function aa(e,t,n,r,s=400,i=0,a){let[o,l]=e.measure_text(t,n,r,s,i,sa[a??"normal"]??0);return{width:o,height:l}}function yd(e,t){let n=Pi(t);if(n.path!=null)return null;let r=n.fontSize==="autofit",s={text:String(n.text??""),fontFamily:n.fontFamily,fontSize:r?100:n.fontSize,fontWeight:n.fontWeight,fontStyle:n.fontStyle,letterSpacing:n.letterSpacing},i=Array.isArray(n.segments)&&n.segments.length?n.segments:[s];if(i.some(p=>(p.x??0)!==0||(p.y??0)!==0||(p.rotation??0)!==0||(p.scale??1)!==1))return null;let a=[],o=[],l="";for(let p of i){let w=p.fontFamily??s.fontFamily??"",R=a.indexOf(w);R<0&&(R=a.push(w)-1);let L=String(p.text??"");l+=L,o.push(L.length,p.fontSize??s.fontSize,p.fontWeight??s.fontWeight??400,sa[p.fontStyle??s.fontStyle??"normal"]??0,p.letterSpacing??s.letterSpacing??0,R)}let c=n.width??0,u=n.height??0,f=e.text_block(l,new Float32Array(o),a.join(`
703
- `),r?NaN:s.fontSize,n.minFontSize??0,n.lineHeight??0,bd[n.textAlign??"center"]??2,wd[n.verticalAlign??"center"]??1,!!n.wrap&&c>0,c,u);if(!f.length)return null;let d=[],_=3;for(let p=0;p<f[2];p++){let[w,R,L,F,H]=f.subarray(_,_+5);d.push({start:w,end:R,top:L,bottom:F,carets:Array.from(f.subarray(_+5,_+5+H))}),_+=5+H}return{lines:d,width:f[0],height:f[1]}}var vd=3,xd=6e4,kd=32,Lr=new Set,ln=new Set,wi=new WeakSet,Qt=[],Md=0,Ft=null,yi=!1;function Sd(e){return Lr.add(e),()=>Lr.delete(e)}function Ad(){return Ft}function Ed(e){return Rd(),ln.add(e),Ft!==null&&(e.queueIssue(oa(Ft)),e.halt()),()=>ln.delete(e)}function Td(e){let t=e;!t||wi.has(t)||(wi.add(t),t.addEventListener?.("uncapturederror",n=>Pd(n.error)),t.lost.then(n=>Id(n.reason??"unknown",n.message??"")))}function Fn(e){for(let t of[...Lr])try{t(e)}catch(n){console.error("[wgpu] a fault listener threw:",n)}}function Wr(e){for(let t of ln)t.queueIssue(e)}function Pd(e){if(++Md>kd)return;let t=e?.constructor?.name??"",n=t==="GPUOutOfMemoryError"?"out-of-memory":t==="GPUInternalError"?"internal":"validation",r=`WebGPU ${n} error: ${e?.message??String(e)}`;Wr({kind:"gpu",feature:`gpu:${n}`,message:r}),Fn({type:"gpu-error",error:n,message:r})}function Id(e,t){if(Ft!==null)return;kf();let n=performance.now();for(;Qt.length&&n-Qt[0]>xd;)Qt.shift();let r=`The GPU device was lost (${e}${t?`: ${t}`:""}); the renderer is drawing on a new one.`;if(Fn({type:"device-lost",reason:e,message:r}),Qt.length>=vd){Fr("The GPU device was lost 4 times within a minute; the renderer stopped asking for a new one.");return}Qt.push(n),Wr({kind:"device-lost",message:r});for(let s of[...ln])s.remount();Br().then(()=>Fn({type:"device-restored"}),s=>Fr(`No GPU device after a loss: ${String(s?.message??s)}`))}function oa(e){return{kind:"crashed",message:e}}function Fr(e){Ft===null&&(Ft=e,queueMicrotask(()=>{Wr(oa(e));for(let t of[...ln])t.halt();Fn({type:"crashed",message:e})}))}function Rd(){yi||(yi=!0,dl(e=>Fr(`The renderer panicked and draws nothing more on this page (reload to recover): ${e}`)))}var vi=new Set,Cd=/-not-(?:decoded|loaded)$/,Rn={"text:path":"Text on a path",rasterize:"rasterize()","boolean:nested":"A boolean nested in one of another kind","boolean:projective":"A boolean under a 3D (projective) transform","cut:compound":"A cut through a compound shape","stroke:union-of-booleans":"One stroke around several booleans","effect:motionBlur-shutter":"Motion blur with an off-centre shutter or over 32 samples","surface:error":"A surface texture that failed to draw","blend:":"The blend mode","fill:blend:":"The fill blend mode","op:":"The drawing op","fill:":"The fill","effect:":"The effect","3d:":"In 3D,"};function Tr(e){if(Rn[e])return`${Rn[e]} is not drawn by the WebGPU renderer.`;let t=Object.keys(Rn).filter(n=>n.endsWith(":")&&e.startsWith(n)).sort((n,r)=>r.length-n.length)[0];return t?`${Rn[t]} "${e.slice(t.length)}" is not drawn by the WebGPU renderer.`:`Not drawn by the WebGPU renderer: ${e}.`}var Od=class extends gd{store;view={zoom:1,x:0,y:0};frame=null;clipToFrame=!0;frameBackground="black";canvas=null;size={width:1,height:1};backend=null;starting=null;startFailed=!1;startToken=null;lastDoc=null;viewportKey="";shaper;stopFonts;stopSettle;stopFaults;faults=[];halted=!1;constructor(e,t){let n=ia(e);super(t.width,t.height,(r,s,i,a,o,l)=>aa(n,r,s,i,a,o,l)),this.store=e,this.shaper=n,this.storage=e,this.images=e.images,this.stopFonts=e.onFont(r=>this.backend?.registerFont(r.bytes,r.family)),this.stopSettle=e.addSettler(()=>this.starting&&!this.startFailed?this.starting.catch(()=>{}):this.backend?.shaders.hasPending()?this.backend.whenShadersReady():null),this.stopFaults=Ed({queueIssue:r=>this.faults.push(r),remount:()=>this.remount(),halt:()=>this.halt()})}stats(){return this.backend?.stats()??null}mount(e){let t=e;if(this.size={width:Math.max(1,t.width),height:Math.max(1,t.height)},t===this.canvas&&(this.backend||this.starting)){this.present();return}if(this.releaseBackend(),this.canvas=t,this.halted||Ad()!==null)return;let n={};this.startToken=n,this.startFailed=!1;let r=this.starting=(async()=>{let s=new zi;if(await s.init(t,this.size.width,this.size.height),this.startToken!==n){this.halted||s.destroy();return}Td(s.gpuDevice()),s.setOptions(!1,!1),s.collectUnused=!0,s.onShaderReady=()=>this.present();for(let i of this.store.fonts)s.registerFont(i.bytes,i.family);this.backend=s,this.starting=null,this.present()})();r.catch(s=>{this.starting===r&&(this.startFailed=!0),console.error("[wgpu] the renderer failed to start:",s)})}whenMounted(){return this.starting??Promise.resolve()}unmount(){this.releaseBackend(),this.canvas=null}execute(e){if(!(!this.canvas||this.isDisposed())){this.width=this.size.width/this.pixelRatio,this.height=this.size.height/this.pixelRatio;try{super.execute(e)}finally{this.lastDoc=this.doc,this.present();for(let t of this.missing)vi.has(t)||t.endsWith("-not-decoded")||(vi.add(t),console.warn(`[wgpu] not drawn yet: ${t}`))}}}takeRenderIssues(){let e=new Map,t=r=>e.set(Io(r),r);for(let r of this.faults.splice(0))t(r);let n=this.halted?null:this.backend;for(let r of n?.shaderIssues??[])t({kind:"shader",...r==="A shader effect is written in SkSL, which Motion Script no longer runs, so it is skipped. Port it to WGSL (fn effect(in: EffectIn) -> vec4f)."&&{feature:"effect:shader-sksl"},message:r});n?.shaderIssues.clear();for(let r of this.shaderIssues)t(r);for(let r of this.missing){if(Cd.test(r))continue;let s=r==="fill:shader-sksl"?{kind:"shader",feature:r,message:yf}:{kind:"missing",feature:r,message:Tr(r)},i=this.missing.nodes.get(r);if(!i?.size)t(s);else for(let a of i)t({...s,nodeId:a})}for(let r of n?.missing??[])t({kind:"missing",feature:`effect:${r}`,message:Tr(`effect:${r}`)});for(let r of n?.missing3d??[])t({kind:"missing",feature:`3d:${r}`,message:Tr(`3d:${r}`)});return[...e.values()]}whenShadersReady(){return this.backend?.whenShadersReady()??Promise.resolve()}layoutTextBlock(e){return yd(this.shaper,e)}screenshot(e="image/png",t){return this.snapshotCanvas()?.toDataURL(e,t)}snapshotCanvas(){let e=this.canvas;if(!e||!this.backend||!this.lastDoc)return;this.present();let[t,n,r,s]=[0,0,e.width,e.height];if(this.frame){let o=this.pixelRatio,l=this.view.zoom,c=e.width/2+this.view.x*o,u=e.height/2+this.view.y*o,f=this.frame.width*l*o,d=this.frame.height*l*o;t=Math.max(0,Math.round(c-f/2)),n=Math.max(0,Math.round(u-d/2)),r=Math.max(1,Math.min(e.width-t,Math.round(f))),s=Math.max(1,Math.min(e.height-n,Math.round(d)))}let i=document.createElement("canvas");i.width=r,i.height=s;let a=i.getContext("2d");if(a)return a.drawImage(e,t,n,r,s,0,0,r,s),i}dispose(){this.releaseBackend(),this.stopFonts(),this.stopSettle(),this.stopFaults(),this.canvas=null,this.lastDoc=null,this.store.dispose(),super.dispose()}rootTransform(){let e=this.view.zoom;return[e,0,0,e,this.width/2+this.view.x,this.height/2+this.view.y]}clearColor(){return this.frame?[0,0,0,0]:[0,0,0,1]}frameGroup(e){let t=this.frame;if(!t)return e;let n={x:-t.width/2,y:-t.height/2,w:t.width,h:t.height};return this.frameBackground==="black"&&this.doc.rect(e,{transform:[1,0,0,1,n.x,n.y],w:n.w,h:n.h,fill:{kind:"solid",color:[0,0,0,1]}}),this.clipToFrame?this.doc.group(e,{clip:{...n,r:0}}):e}present(){let e=this.backend,t=this.canvas,n=this.lastDoc;if(!e||!t||!n||this.halted)return;let{width:r,height:s}=this.size,i=`${r}x${s}/${n.width}/${n.background.join(",")}`;(i!==this.viewportKey||t.width!==r||t.height!==s)&&(e.resize(r,s),this.viewportKey=i);try{e.sync(n),e.render()}catch(a){console.error("[wgpu] frame failed:",a)}}releaseBackend(){this.starting=null,this.startToken=null,this.halted||this.backend?.destroy(),this.backend=null,this.viewportKey=""}remount(){let e=this.canvas;!e||this.isDisposed()||this.halted||(this.releaseBackend(),this.mount(e))}halt(){this.halted=!0,this.releaseBackend()}};async function $d(e,t,n){return await cn(n),Gi(e,t)}var Dd={fill:`// Provided to every WGSL fill:
701
+ `).length+1;return e.map(s=>{let i=s.lineNum>=r&&r>0?s.lineNum-r+1:0;return{line:i,column:i?s.linePos:0,length:s.length??0,message:`${s.type}: ${s.message}`,source:"browser"}})}var hl=3,pl={fill:[["uniform","storage","storage","storage","storage","storage","unfilterable-2d-array","storage"],["texture","sampler"],["uniform"]],effect:[["texture","texture","texture","sampler","sampler","uniform","texture"],["uniform"]]},_l={uniform:{buffer:{type:"uniform",hasDynamicOffset:!0}},storage:{buffer:{type:"read-only-storage"}},texture:{texture:{sampleType:"float",viewDimension:"2d"}},sampler:{sampler:{type:"filtering"}},"unfilterable-2d-array":{texture:{sampleType:"unfilterable-float",viewDimension:"2d-array"}}};function ml(e,t){return pl[t].map(n=>e.createBindGroupLayout({entries:n.map((r,s)=>({binding:s,visibility:hl,..._l[r]}))}))}function gl(e,t,n,r){let s={srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},i=n==="fill";return{layout:e.createPipelineLayout({bindGroupLayouts:ml(e,n)}),vertex:{module:t,entryPoint:i?"ms_vs_quad":"ms_vs_effect",buffers:[]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:1},fragment:{module:t,entryPoint:i?"ms_fs_prim":"ms_fs_effect",targets:[{format:r,...i?{blend:{color:s,alpha:s}}:{},writeMask:15}]}}}var bl={normal:0,multiply:1,screen:2,overlay:3,darken:4,lighten:5,"color-dodge":6,"color-burn":7,"hard-light":8,"soft-light":9,difference:10,exclusion:11,hue:12,saturation:13,color:14,luminosity:15},ra="A shader fill is written in SkSL, which Motion Script no longer runs, so it draws nothing. Port it to WGSL (fn fill(in: FillIn) -> vec4f).",wl="A shader effect is written in SkSL, which Motion Script no longer runs, so it is skipped. Port it to WGSL (fn effect(in: EffectIn) -> vec4f).",Dt=new Map,yl=64;function vl(e,t){let n=`${e}
702
+ ${t}`,r=Dt.get(n);if(r===void 0){try{let s=na(e,t);r=s.ok?s.fields.map(i=>i.name):null}catch{return null}Dt.size>=yl&&Dt.delete(Dt.keys().next().value)}else Dt.delete(n);return Dt.set(n,r),r}function xl(e,t){let n=t.source??"",r=fc(t);if(!n.trim()||r===void 0)return[];let s=[];r>zs&&s.push({kind:"shader",feature:`${e}:contract-${r}`,message:`A WGSL shader ${e} is written for shader contract ${r}; this renderer implements ${zs}, so it may not draw as intended.`});let i=vl(e,n);if(!i)return s;let a=ji(t.uniforms??{});for(let o of Object.keys(a))i.includes(o)||s.push({kind:"params",feature:`params:${o}`,message:`A WGSL shader ${e} is given "${o}", which names no member of its struct Params, so the value is ignored.`});for(let o of i)o in a||s.push({kind:"params",feature:`params:${o}`,message:`A WGSL shader ${e}'s Params.${o} is given no value, so it reads 0.`});return s}var kl=32;function xt(e,t){let n=e.p,r=1-t;return e.kind==="line"?[n[0]+(n[2]-n[0])*t,n[1]+(n[3]-n[1])*t]:e.kind==="quad"?[r*r*n[0]+2*r*t*n[2]+t*t*n[4],r*r*n[1]+2*r*t*n[3]+t*t*n[5]]:[r*r*r*n[0]+3*r*r*t*n[2]+3*r*t*t*n[4]+t*t*t*n[6],r*r*r*n[1]+3*r*r*t*n[3]+3*r*t*t*n[5]+t*t*t*n[7]]}function Un(e,t){let n=[0],r=e==="line"?1:kl,s={kind:e,p:t,len:0,table:n},i=xt(s,0);for(let a=1;a<=r;a++){let o=xt(s,a/r);n.push(n[a-1]+Math.hypot(o[0]-i[0],o[1]-i[1])),i=o}return s.len=n[r],s}function Vr(e,t){let n=e.table.length-1;if(t<=0)return 0;if(t>=e.len)return 1;let r=1;for(;e.table[r]<t;)r++;let s=e.table[r-1],i=e.table[r];return(r-1+(i>s?(t-s)/(i-s):0))/n}function Ml(e,t,n){let r=e.p;if(e.kind==="line")return[...xt(e,t),...xt(e,n)];let s=(a,o)=>{let l=a.length/2,c=[a];for(let d=1;d<l;d++){let p=c[d-1],_=[];for(let w=0;w<p.length-2;w+=2)_.push(p[w]+(p[w+2]-p[w])*o,p[w+1]+(p[w+3]-p[w+1])*o);c.push(_)}let u=[],f=[];for(let d=0;d<l;d++)u.push(c[d][0],c[d][1]);for(let d=l-1;d>=0;d--)f.push(c[d][c[d].length-2],c[d][c[d].length-1]);return[u,f]},[i]=n<1?s(r,n):[r];return t<=0?i:s(i,t/n)[1]}function qr(e){let t=[],n=null,r=0,s=0,i=0,a=0,o=0,l=e.points;for(let c of e.verbs)if(c===Ce.move)r=i=l[o++],s=a=l[o++],n={segs:[],closed:!1},t.push(n);else if(c===Ce.line){let u=l[o++],f=l[o++];n.segs.push(Un("line",[r,s,u,f])),r=u,s=f}else if(c===Ce.quad){let u=[r,s,l[o],l[o+1],l[o+2],l[o+3]];o+=4,n.segs.push(Un("quad",u)),r=u[4],s=u[5]}else if(c===Ce.cubic){let u=[r,s,l[o],l[o+1],l[o+2],l[o+3],l[o+4],l[o+5]];o+=6,n.segs.push(Un("cubic",u)),r=u[6],s=u[7]}else c===Ce.close&&(n&&((r!==i||s!==a)&&n.segs.push(Un("line",[r,s,i,a])),n.closed=!0),r=i,s=a);return t.filter(c=>c.segs.length>0)}function Sl(e){let t=0,n=0,r=0,s=0,i=0,a=0,o=e.points,l=(c,u)=>{t+=i*u-c*a,i=c,a=u};for(let c of e.verbs)if(c===Ce.move)l(r,s),r=i=o[n++],s=a=o[n++];else if(c!==Ce.close){let u=c===Ce.line?1:c===Ce.quad?2:3;for(let f=0;f<u;f++,n+=2)l(o[n],o[n+1])}return l(r,s),t/2}function El(e){let t=new rt,n=e.points,r=0,s=0,i=e.verbs;for(;s<i.length;){if(i[s]!==Ce.move){s++;continue}let a=n[r++],o=n[r++],l=[],c=!1;for(s++;s<i.length&&i[s]!==Ce.move;s++){let u=i[s];if(u===Ce.close){c=!0;continue}let f=u===Ce.line?1:u===Ce.quad?2:3,d=[a,o];for(let p=0;p<f;p++,r+=2)d.push(n[r],n[r+1]);a=d[d.length-2],o=d[d.length-1],l.push({v:u,p:d})}t.moveTo(a,o);for(let u=l.length-1;u>=0;u--){let{v:f,p:d}=l[u];f===Ce.line?t.lineTo(d[0],d[1]):f===Ce.quad?t.quadTo(d[2],d[3],d[0],d[1]):t.cubicTo(d[4],d[5],d[2],d[3],d[0],d[1])}c&&t.close()}return t.build()}function oi(e){let t=qr(e);return t.length>0&&t.every(n=>n.closed)}function sa(e,t,n,r){let s=0,i=!1;for(let a of e){let o=s,l=s+a.len;if(s=l,l<=t||o>=n)continue;let c=Ml(a,Vr(a,t-o),Vr(a,n-o));i||(r.moveTo(c[0],c[1]),i=!0),a.kind==="line"?r.lineTo(c[2],c[3]):a.kind==="quad"?r.quadTo(c[2],c[3],c[4],c[5]):r.cubicTo(c[2],c[3],c[4],c[5],c[6],c[7])}return i}function zr(e,t,n){let r=qr(e),s=r.reduce((u,f)=>u+f.segs.reduce((d,p)=>d+p.len,0),0);if(s<=0)return e;let i=t*s,a=n*s,o=new rt,l=0,c=!1;for(let u of r){let f=u.segs.reduce((_,w)=>_+w.len,0),d=l,p=l+f;l=p,p>i&&d<a&&(c=sa(u.segs,Math.max(0,i-d),Math.min(f,a-d),o)||c)}return c?o.build():{verbs:new Uint8Array(0),points:new Float32Array(0)}}function Al(e,t){let n=e.p,r=1-t;return e.kind==="line"?[n[2]-n[0],n[3]-n[1]]:e.kind==="quad"?[2*(r*(n[2]-n[0])+t*(n[4]-n[2])),2*(r*(n[3]-n[1])+t*(n[5]-n[3]))]:[3*(r*r*(n[2]-n[0])+2*r*t*(n[4]-n[2])+t*t*(n[6]-n[4])),3*(r*r*(n[3]-n[1])+2*r*t*(n[5]-n[3])+t*t*(n[7]-n[5]))]}function Tl(e){return qr(e).map(t=>{let n=t.segs.filter(s=>s.len>0),r=n.reduce((s,i)=>s+i.len,0);return{length:r,closed:t.closed,posTan(s){s=Math.max(0,Math.min(r,s));let i=0,a=n[n.length-1];for(let p of n){if(i+p.len>=s){a=p;break}i+=p.len}let o=Vr(a,s-i),[l,c]=xt(a,o),[u,f]=Al(a,o);if(Math.hypot(u,f)<1e-9){let p=xt(a,Math.max(0,o-.001)),_=xt(a,Math.min(1,o+.001));u=_[0]-p[0],f=_[1]-p[1]}let d=Math.hypot(u,f)||1;return[l,c,u/d,f/d]},segment:(s,i,a)=>sa(n,s,i,a)}}).filter(t=>t.length>0)}var Gn=.001;function Pl(e,t){let n=0,r=!1;for(let i of e)n+=i.length,i.closed||(r=!0);let s=Vi.dashScale(t,{length:n,closed:!0},n);return s===null?null:{scale:s,total:n,open:r}}function ia(e,t,n){return e.closed?n.scale:Vi.dashScale(t,{length:e.length,closed:!1},n.total)??n.scale}function aa(e,t,n,r){let s=t.map(p=>p*r),i=s.reduce((p,_)=>p+_,0),a=[];if(!(i>0))return a;let o=(n*r%i+i)%i,l=0,c=0;for(;c+s[l]<=o&&l<s.length&&!(s[l]<=Gn&&Math.abs(o-c)<1e-6||(c+=s[l],l=(l+1)%s.length,l===0)););let u=s[l]-(o-c),f=l%2===0,d=0;for(;d<e.length-1e-6;){let p=Math.min(u,e.length-d);f&&a.push([d,d+p]),d+=p,u-=p,u<=1e-6&&(l=(l+1)%s.length,u=s[l],f=!f)}return f&&u<=1e-6&&!e.closed&&a.push([e.length,e.length]),a}function Il(e,t,n,r,s){let i=new rt,a=!1;for(let o of e)for(let[l,c]of aa(o,t,n,ia(o,t,s)))if(c-l>Gn)a=o.segment(l,c,i)||a;else if(r){let[u,f,d,p]=o.posTan(l),_=l>o.length-Gn?-.001:Gn;i.moveTo(u,f).lineTo(u+d*_,f+p*_),a=!0}return a?i.build():null}function oa(e,t,n,r,s,i,a,o,l,c){if(r===0||s===0){e.lineTo(l,c);return}r=Math.abs(r),s=Math.abs(s);let u=Math.cos(i),f=Math.sin(i),d=(t-l)/2,p=(n-c)/2,_=u*d+f*p,w=-f*d+u*p,A=_*_/(r*r)+w*w/(s*s);A>1&&(r*=Math.sqrt(A),s*=Math.sqrt(A));let B=r*r*s*s-r*r*w*w-s*s*_*_,L=r*r*w*w+s*s*_*_,V=Math.sqrt(Math.max(0,B/L));a===o&&(V=-V);let se=V*r*w/s,X=-V*s*_/r,pe=u*se-f*X+(t+l)/2,ue=f*se+u*X+(n+c)/2,q=(Me,Fe,de,Ae)=>Math.atan2(Me*Ae-Fe*de,Me*de+Fe*Ae),ae=q(1,0,(_-se)/r,(w-X)/s),G=q((_-se)/r,(w-X)/s,(-_-se)/r,(-w-X)/s);!o&&G>0?G-=2*Math.PI:o&&G<0&&(G+=2*Math.PI);let $=Math.ceil(Math.abs(G)/(Math.PI/2)-1e-9),xe=G/$,ve=4/3*Math.tan(xe/4);for(let Me=0;Me<$;Me++){let Fe=ae+Me*xe,de=Fe+xe,Ae=Math.cos(Fe),De=Math.sin(Fe),At=Math.cos(de),Tt=Math.sin(de),xn=pe+r*Ae*u-s*De*f,kn=ue+r*Ae*f+s*De*u,Mn=pe+r*At*u-s*Tt*f,qt=ue+r*At*f+s*Tt*u,Sn=-r*De*u-s*Ae*f,sr=-r*De*f+s*Ae*u,v=-r*Tt*u-s*At*f,Te=-r*Tt*f+s*At*u;e.cubicTo(xn+ve*Sn,kn+ve*sr,Mn-ve*v,qt-ve*Te,Me===$-1?l:Mn,Me===$-1?c:qt)}}function gn(e){let t=new rt,n=e.match(/[a-zA-Z]|-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g)??[],r=0,s="",i=0,a=0,o=0,l=0,c=0,u=0,f=0,d=0,p="",_=()=>Number(n[r++]),w=()=>r<n.length&&!/[a-zA-Z]/.test(n[r]);for(;r<n.length;){/[a-zA-Z]/.test(n[r])&&(s=n[r++]);let A=s===s.toLowerCase(),B=s.toUpperCase(),L=A?i:0,V=A?a:0;switch(B){case"M":i=L+_(),a=V+_(),t.moveTo(i,a),o=i,l=a,s=A?"l":"L";break;case"L":i=L+_(),a=V+_(),t.lineTo(i,a);break;case"H":i=(A?i:0)+_(),t.lineTo(i,a);break;case"V":a=(A?a:0)+_(),t.lineTo(i,a);break;case"C":{let se=L+_(),X=V+_(),pe=L+_(),ue=V+_();i=L+_(),a=V+_(),t.cubicTo(se,X,pe,ue,i,a),c=pe,u=ue;break}case"S":{let se=p==="C"||p==="S",X=se?2*i-c:i,pe=se?2*a-u:a,ue=L+_(),q=V+_();i=L+_(),a=V+_(),t.cubicTo(X,pe,ue,q,i,a),c=ue,u=q;break}case"Q":f=L+_(),d=V+_(),i=L+_(),a=V+_(),t.quadTo(f,d,i,a);break;case"T":{let se=p==="Q"||p==="T";f=se?2*i-f:i,d=se?2*a-d:a,i=L+_(),a=V+_(),t.quadTo(f,d,i,a);break}case"A":{let se=_(),X=_(),pe=_()*Math.PI/180,ue=_()!==0,q=_()!==0,ae=L+_(),G=V+_();oa(t,i,a,se,X,pe,ue,q,ae,G),i=ae,a=G;break}case"Z":t.close(),i=o,a=l;break;default:r++}p=B,B==="Z"&&w()&&(s="L")}return t.build()}var Rl=class{parts=[];move(e,t){this.parts.push(`M ${e} ${t}`)}line(e,t){this.parts.push(`L ${e} ${t}`)}arc(e,t,n,r,s,i){this.parts.push(`A ${e} ${t} 0 ${n} ${r} ${s} ${i}`)}close(){this.parts.push("Z")}toString(){return this.parts.join(" ")}},Cl=class{ok=!0;b=new rt;empty=!0;x=0;y=0;sx=0;sy=0;move(e,t){this.check(e,t),this.x=this.sx=0+e,this.y=this.sy=0+t,this.b.moveTo(this.x,this.y)}line(e,t){this.check(e,t),this.x=0+e,this.y=0+t,this.b.lineTo(this.x,this.y)}arc(e,t,n,r,s,i){this.check(e,t,s,i);let a=0+s,o=0+i;oa(this.b,this.x,this.y,e+0,t+0,0,n!==0,r!==0,a,o),this.x=a,this.y=o}close(){this.empty=!1,this.b.close(),this.x=this.sx,this.y=this.sy}result(){return this.empty?null:this.b.build()}check(...e){this.empty=!1;for(let t of e)Number.isFinite(t)||(this.ok=!1)}};function Je(e){let t=new Rl;return e(t),t.toString()}function ca(e){let t=new Cl;if(e(t),t.ok)return t.result();let n=Je(e);return n?gn(n):null}var Gt=class{fullState;geo;constructor(e){this.fullState=this.resolveState(e)}buildPathData(e){let t=this.buildSVGPath(e);return t?gn(t):null}get geometry(){return this.geo??=this.computeGeometry()}needsTrim(){return this.fullState.start!==0||this.fullState.end!==1}getTrimRange(){return{start:this.fullState.start,end:this.fullState.end}}buildSVGAlignInterior(e){return null}supportsSpread(){return!1}buildSpreadSVGPath(e,t){return null}computeBounds(e){}};function ct(e){return e.radius>0?e.radius:0}function Nn(e,t,n,r,s,i,a,o){o.radius<=0||la(e,t,n,r,s,i,a,o.radius,o.radius,o.style)}function la(e,t,n,r,s,i,a,o,l,c){let u=t+i*o,f=n+a*o;if(c==="angled")return e.line(u,f);let d=r*a-s*i;e.arc(l,l,0,d<0?1:0,u,f)}function Ol(e,t,n,r,s,i,a,o,l){return Je(c=>la(c,e,t,n,r,s,i,a,o,l))}var lt=Math.PI/180,Jr=class extends Gt{resolveState(e){return _c(e)}computeGeometry(){let e=this.fullState,t=e.sweep??360;return{cx:e.x,cy:e.y,halfWidth:e.width/2,halfHeight:e.height/2,sweep:t,isFullShape:Math.abs(t)>=360,startAngle:e.startAngle??0,ratio:Math.max(0,Math.min(1,e.ratio??0))}}buildSVGPath(e){return Je(t=>ci(t,e))}buildPathData(e){return ca(t=>ci(t,e))}ringOutline(e){return e.ratio<1?null:Je(t=>e.isFullShape?pn(t,e.cx,e.cy,e.halfWidth,e.halfHeight,0):Dl(t,e))}buildSVGAlignInterior(e){return e.isFullShape?e.ratio>=1?Je(t=>pn(t,e.cx,e.cy,e.halfWidth,e.halfHeight,0)):null:Je(t=>e.ratio>=1||e.ratio<=0?ua(t,e):fa(t,e))}supportsSpread(){return!0}buildSpreadSVGPath(e,t){if(!e.isFullShape||e.ratio>=1)return null;let n=e.halfWidth+t,r=e.halfHeight+t;return n<=0||r<=0?null:Je(s=>pn(s,e.cx,e.cy,n,r,0))}computeBounds(e){let{cx:t,cy:n,halfWidth:r,halfHeight:s}=e;return{left:t-r,top:n-s,right:t+r,bottom:n+s}}};function ci(e,t){let{cx:n,cy:r,halfWidth:s,halfHeight:i,ratio:a}=t;if(!(a>=1)){if(!t.isFullShape)return a<=0?ua(e,t):fa(e,t);pn(e,n,r,s,i,0),a>0&&pn(e,n,r,s*a,i*a,1)}}function pn(e,t,n,r,s,i){let a=t-r,o=t+r;e.move(a,n),e.arc(r,s,1,i,o,n),e.arc(r,s,1,i,a,n),e.close()}function Yr(e){let{cx:t,cy:n,halfWidth:r,halfHeight:s,startAngle:i,sweep:a}=e,o=i+a,l=Math.abs(a)>180?1:0,c=a>0?1:0,u=t+r*Math.cos(i*lt),f=n+s*Math.sin(i*lt),d=t+r*Math.cos(o*lt),p=n+s*Math.sin(o*lt);return{sx:u,sy:f,arc:_=>_.arc(r,s,l,c,d,p)}}function Dl(e,t){let{sx:n,sy:r,arc:s}=Yr(t);e.move(n,r),s(e)}function ua(e,t){let{sx:n,sy:r,arc:s}=Yr(t);e.move(t.cx,t.cy),e.line(n,r),s(e),e.close()}function fa(e,t){let{cx:n,cy:r,halfWidth:s,halfHeight:i,startAngle:a,sweep:o,ratio:l}=t,{sx:c,sy:u,arc:f}=Yr(t),d=a+o,p=s*l,_=i*l,w=n+p*Math.cos(a*lt),A=r+_*Math.sin(a*lt),B=n+p*Math.cos(d*lt),L=r+_*Math.sin(d*lt),V=Math.abs(o)>180?1:0,se=o>0?0:1;e.move(c,u),f(e),e.line(B,L),e.arc(p,_,V,se,w,A),e.close()}function Ll(e,t,n){if(e.length===0)return"M 0 0";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;let r=Math.max(0,t),s=[],i=e.length,a=(o,l)=>{let c=l.x-o.x,u=l.y-o.y,f=Math.sqrt(c*c+u*u);return f>0?{dx:c/f,dy:u/f,len:f}:{dx:0,dy:0,len:0}};if(r===0){s.push(`M ${e[0].x} ${e[0].y}`);for(let o=1;o<i;o++)s.push(`L ${e[o].x} ${e[o].y}`)}else{let o=n?i:i-1;for(let l=0;l<=o;l++){let c=e[(l-1+i)%i],u=e[l%i],f=e[(l+1)%i];if(!n&&l===0){s.push(`M ${u.x} ${u.y}`);continue}if(!n&&l===i-1){s.push(`L ${u.x} ${u.y}`);continue}let d=a(c,u),p=a(u,f),_=Math.min(r,d.len/2),w=Math.min(r,p.len/2),A=u.x-d.dx*_,B=u.y-d.dy*_,L=u.x+p.dx*w,V=u.y+p.dy*w;s.push(`${l===0&&n?"M":"L"} ${A} ${B}`),s.push(`Q ${u.x} ${u.y} ${L} ${V}`)}}return n&&s.push("Z"),s.join(" ")}var Fl=class extends Gt{resolveState(e){return mc(e)}computeGeometry(){let{points:e,radius:t,closed:n}=this.fullState;return{points:e,radius:t,closed:n}}buildSVGPath(e){return Ll(e.points,e.radius,e.closed)}},Bl=class extends Gt{resolveState(e){return gc(e)}computeGeometry(){return{data:this.fullState.data}}buildSVGPath(e){return Hi(e.data)}};function da(e,t,n){if(t.cornerRadius<=0){let i=e.map(([a,o],l)=>`${l===0?"M":"L"} ${a} ${o}`);return i.push("Z"),i.join(" ")}let r=e.length,s=[];for(let i=0;i<r;i++){let a=e[i];if(!n(i)){s.push(`${s.length===0?"M":"L"} ${a[0]} ${a[1]}`);continue}let o=e[(i-1+r)%r],l=e[(i+1)%r],c=o[0]-a[0],u=o[1]-a[1],f=Math.hypot(c,u),d=c/f,p=u/f,_=l[0]-a[0],w=l[1]-a[1],A=Math.hypot(_,w),B=_/A,L=w/A,V=Math.max(-1,Math.min(1,d*B+p*L)),se=Math.tan(Math.acos(V)/2),X=Math.min(t.cornerRadius/se,Math.min(f,A)/2),pe=X*se;s.push(`${s.length===0?"M":"L"} ${a[0]+d*X} ${a[1]+p*X}`),s.push(Ol(a[0],a[1],d,p,B,L,X,pe,t.cornerStyle))}return s.push("Z"),s.join(" ")}var ha=e=>({left:e.cx-e.rx,top:e.cy-e.ry,right:e.cx+e.rx,bottom:e.cy+e.ry}),$l=class extends Gt{resolveState(e){return bc(e)}computeGeometry(){let e=this.fullState;return{cx:e.x,cy:e.y,rx:e.width/2,ry:e.height/2,sides:Math.max(3,Math.round(e.sides)),ratio:1,cornerRadius:e.cornerRadius,cornerStyle:e.cornerStyle}}buildSVGPath(e){let t=2*Math.PI/e.sides,n=[];for(let r=0;r<e.sides;r++){let s=-Math.PI/2+r*t;n.push([e.cx+e.rx*Math.cos(s),e.cy+e.ry*Math.sin(s)])}return da(n,e,()=>!0)}computeBounds(e){return ha(e)}},Ul=class extends Gt{resolveState(e){return wc(e)}computeGeometry(){let e=this.fullState;return{cx:e.x,cy:e.y,rx:e.width/2,ry:e.height/2,sides:Math.max(3,Math.round(e.sides)),ratio:Math.max(0,Math.min(1,e.ratio)),cornerRadius:e.cornerRadius,cornerStyle:e.cornerStyle}}buildSVGPath(e){let t=Math.PI/e.sides,n=[];for(let r=0;r<e.sides*2;r++){let s=-Math.PI/2+r*t,i=r%2===0?1:e.ratio;n.push([e.cx+e.rx*i*Math.cos(s),e.cy+e.ry*i*Math.sin(s)])}return da(n,e,r=>r%2===0)}computeBounds(e){return ha(e)}};function pa(e,t,n,r,s,i,a,o,l){let c=ct(i),u=ct(a),f=ct(o),d=ct(l);e.move(t+c,n),e.line(r-u,n),Nn(e,r,n,-1,0,0,1,a),e.line(r,s-f),Nn(e,r,s,0,-1,-1,0,o),e.line(t+d,s),Nn(e,t,s,1,0,0,-1,l),e.line(t,n+c),Nn(e,t,n,0,1,1,0,i),e.close()}function _a(e,t,n,r,s){e.move(t,n),e.line(r,n),e.line(r,s),e.line(t,s),e.close()}function li(e,t){let{left:n,top:r,right:s,bottom:i,tl:a,tr:o,br:l,bl:c,isZero:u}=t;u?_a(e,n,r,s,i):pa(e,n,r,s,i,a,o,l,c)}var ma=class extends Gt{resolveState(e){return yc(e)}computeGeometry(){let e=this.fullState,t=e.x-e.width/2,n=e.y-e.height/2,r=e.x+e.width/2,s=e.y+e.height/2,i=Gs.resolve(e.cornerRadius),a=qo.resolve(e.cornerStyle),o={radius:Math.max(0,i.topLeft),style:a.topLeft},l={radius:Math.max(0,i.topRight),style:a.topRight},c={radius:Math.max(0,i.bottomRight),style:a.bottomRight},u={radius:Math.max(0,i.bottomLeft),style:a.bottomLeft},f=ui(e.width,e.height,o,l,c,u);return o.radius*=f,l.radius*=f,c.radius*=f,u.radius*=f,{left:t,top:n,right:r,bottom:s,tl:o,tr:l,br:c,bl:u,isZero:Gs.isZero({topLeft:o.radius,topRight:l.radius,bottomRight:c.radius,bottomLeft:u.radius})}}buildSVGPath(e){return Je(t=>li(t,e))}buildPathData(e){return ca(t=>li(t,e))}supportsSpread(){return!0}buildSpreadSVGPath(e,t){let n=e.left-t,r=e.top-t,s=e.right+t,i=e.bottom+t,a=s-n,o=i-r;if(a<=0||o<=0)return null;let l={...e.tl,radius:Math.max(0,e.tl.radius+t)},c={...e.tr,radius:Math.max(0,e.tr.radius+t)},u={...e.br,radius:Math.max(0,e.br.radius+t)},f={...e.bl,radius:Math.max(0,e.bl.radius+t)},d=ui(a,o,l,c,u,f);return l.radius*=d,c.radius*=d,u.radius*=d,f.radius*=d,l.radius===0&&c.radius===0&&u.radius===0&&f.radius===0?Je(p=>_a(p,n,r,s,i)):Je(p=>pa(p,n,r,s,i,l,c,u,f))}computeBounds(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}};function ui(e,t,n,r,s,i){let a=ct(n),o=ct(r),l=ct(s),c=ct(i),u=a+o>0?Math.min(1,e/(a+o)):1,f=c+l>0?Math.min(1,e/(c+l)):1,d=a+c>0?Math.min(1,t/(a+c)):1,p=o+l>0?Math.min(1,t/(o+l)):1;return Math.min(u,f,d,p)}function fn(e,t,n){let r=ic(e,t,n),{x:s,y:i,pivot:a}=oc(r,t,n);return{...hc(r),x:s,y:-i,pivot:a}}var ga=e=>e==null?e:-e;function ba(e,t){let n=new Float32Array(e.points.length);for(let r=0;r<n.length;r+=2){let s=e.points[r],i=e.points[r+1];n[r]=t[0]*s+t[2]*i+t[4],n[r+1]=t[1]*s+t[3]*i+t[5]}return{...e,points:n}}function Xr(e,t){let n=e.rotation??0,r=e.scale??1;if(n===0&&r===1)return t;let s=e.pivot??{x:0,y:0},i=(e.x??0)+s.x*((e.width??0)/2),a=(e.y??0)-s.y*((e.height??0)/2),o=n*Math.PI/180,l=Math.cos(o)*r,c=Math.sin(o)*r,u=l,f=-c,d=c,p=l;return ba(t,[u,d,f,p,i-u*i-f*a,a-d*i-p*a])}var Nl={left:"left",right:"right",center:"center",justify:"justify",start:"left",end:"right"};function jl(e,t){let n=Ki(fn(e,e.width??0,e.height??0)),r=n.path!=null?gn(Hi(n.path)):void 0,s=n.fontSize==="autofit",i={runs:[{text:n.text,family:n.fontFamily,size:s?100:n.fontSize,weight:n.fontWeight,italic:n.fontStyle==="italic"||n.fontStyle==="oblique",letterSpacing:n.letterSpacing,decoration:n.textDecoration==="underline"?"underline":n.textDecoration==="line-through"?"lineThrough":void 0}],align:Nl[n.textAlign]??"left",verticalAlign:n.verticalAlign,wrap:n.wrap&&n.width>0,width:n.width,height:n.height,lineHeight:n.lineHeight,fontSize:s?"autofit":void 0,minFontSize:n.minFontSize,path:r};if(r)return{spec:i,transform:[1,0,0,1,0,0],size:[n.width,n.height]};let[a,o]=t(i),l=cc(n.pivot),c=n.width>0&&n.height>0,u=c?n.width:a,f=c?n.height:o,d=!c&&l.x!==0?n.x-l.x*(a/2):n.x,p=!c&&l.y!==0?n.y+l.y*(o/2):n.y,_=[1,0,0,1,d,p];if((n.rotation??0)!==0||(n.scale??1)!==1){let w=d+l.x*(u/2),A=p-l.y*(f/2),B=(n.rotation??0)*Math.PI/180,L=n.scale??1,V=Math.cos(B)*L,se=Math.sin(B)*L;_=[V,se,-se,V,w+V*(d-w)-se*(p-A),A+se*(d-w)+V*(p-A)]}return{spec:i,transform:_,size:[u,f]}}function Mr(e,t){return e?Xr(t,gn(e)):null}function tn(e,t){let n=new e(t),r=n.fullState,s=n.geometry,i=n.needsTrim()?n.getTrimRange():null,a=jn(()=>{let d=n.buildPathData(s);return d&&Xr(r,d)}),o=jn(()=>{let d=a();return d&&i?zr(d,i.start,i.end):d}),l=jn(()=>{let d=n instanceof Jr?n.ringOutline(s):null;if(d==null)return o();let p=Mr(d,r);return p&&i?zr(p,i.start,i.end):p}),c=jn(()=>{let d=n.buildSVGAlignInterior(s);return d!=null?Mr(d,r):i?a():o()}),u=n.computeBounds(s),f=n.supportsSpread()?d=>Mr(n.buildSpreadSVGPath(s,d),r):void 0;return{get fill(){return o()},get stroke(){return l()},get interior(){return c()},bounds:u?[u.left,u.top,u.right,u.bottom]:null,spread:f,trimmed:!!i,native:i?void 0:Wl(n,r,s)}}function jn(e){let t=!1,n;return()=>(t||(n=e(),t=!0),n)}function Wl(e,t,n){if(!((t.rotation??0)!==0||(t.scale??1)!==1)){if(e instanceof Jr){if(!n.isFullShape||n.ratio>0)return;let r=n.halfWidth*2,s=n.halfHeight*2;return!(r>0&&s>0)||!Number.isFinite(r+s+n.cx+n.cy)?void 0:{kind:"ellipse",x:n.cx-n.halfWidth,y:n.cy-n.halfHeight,w:r,h:s,radii:[0,0,0,0]}}if(e instanceof ma){let r=n.right-n.left,s=n.bottom-n.top;if(!(r>0&&s>0)||!Number.isFinite(r+s+n.left+n.top))return;let i=[n.tl,n.tr,n.br,n.bl],a=Math.min(r,s)/2;return i.some(o=>!(o.radius>=0&&o.radius<=a)||o.radius>0&&o.style==="angled")?void 0:{kind:"rect",x:n.left,y:n.top,w:r,h:s,radii:i.map(o=>o.radius)}}}}function Vl(e){let t=new Bl(e),n=t.fullState,r=gn(t.buildSVGPath(t.geometry)),[s,i,a,o]=n.centerBounds??it(r),l=ba(r,[1,0,0,1,-(s+(a-s)/2),-(i+(o-i)/2)]),c=Xr({...n,x:0,y:0},l),u=t.needsTrim()?t.getTrimRange():null,f=u?zr(c,u.start,u.end):c;return{fill:f,stroke:f,interior:u?c:f,bounds:null,trimmed:!!u}}var zl=e=>{let t={...e,y:ga(e.y)};if(Array.isArray(e.data)&&(t.data=e.data.map(n=>{switch(n.type){case"M":case"m":case"L":case"l":case"T":case"t":case"V":case"v":return{...n,y:-n.y};case"C":case"c":return{...n,y1:-n.y1,y2:-n.y2,y:-n.y};case"S":case"s":return{...n,y2:-n.y2,y:-n.y};case"Q":case"q":return{...n,y1:-n.y1,y:-n.y};case"A":case"a":return{...n,y:-n.y,sweep:n.sweep===1?0:1};default:return n}}),e.centerBounds)){let[n,r,s,i]=e.centerBounds;t.centerBounds=[n,-i,s,-r]}return t};function Sr(e){let t=e.state;switch(e.kind){case"rect":return tn(ma,fn(t,t.width??0,t.height??0));case"ellipse":{let n=fn(t,t.width??0,t.height??0);return t.startAngle!=null&&(n.startAngle=-t.startAngle),t.sweep!=null&&(n.sweep=-t.sweep),tn(Jr,n)}case"polygon":return tn($l,fn(t,t.width??0,t.height??0));case"polygram":return tn(Ul,fn(t,t.width??0,t.height??0));case"line":{let n=t.points?t.points.map(r=>({x:r.x,y:-r.y})):t.points;return tn(Fl,{...t,y:ga(t.y),points:n})}case"path":return Vl(zl(t))}return null}function Gl(e,t,n){if(n<=0||e.strength<=0||e.length<=0)return null;let r=kt(e.axis),s=e.length/100,i=t.x*n*r.x*s*e.strength,a=t.y*n*r.y*s*e.strength,o=Math.hypot(i,a);return o<.01?null:{angle:Math.atan2(a,i)*180/Math.PI,radius:o,phase:sc(e.alignment),samples:e.samples}}var ut=.5,wa=Math.hypot(1,ut),fi=ut/wa,Hl=1/wa,Kl=.35;function ya(e){return e==="arrow"||e==="triangle"||e==="stealth"}function ql(e,t,n){return ya(e)?Math.min(t,n/(2*ut)):0}function Jl(e,t,n){let r=t/2;switch(e){case"dot":return null;case"triangle":return[0,0,-t,t*ut,-t,-t*ut];case"stealth":return[0,0,-t,t*ut,-t*(1-Kl),0,-t,-t*ut];case"arrow":return Yl(t,n);case"box":return[-r,-r,r,-r,r,r,-r,r];case"diamond":return[r,0,0,r,-r,0,0,-r];case"bar":return[-n/2,-r,n/2,-r,n/2,r,-n/2,r]}}function Yl(e,t){let n=e*ut,r=-e-t*fi,s=n-t*Hl;if(s<=0)return[0,0,-e,n,-e,-n];let i=-t/fi;return[0,0,-e,n,r,s,i,0,r,-s,-e,-n]}function Xl(e,t,n,r){let s=!!e.dash?.length,i=e.startCap??e.cap,a=e.endCap??e.cap,o=s?e.cap:Wt(a)?"butt":a,l=i!==o||a!==o;if(!s&&!l)return{cap:o,ends:[]};let c=Tl(t),u=s?Pl(c,e.dash):null;if(s&&!u)return{cap:o,ends:l?Er(c,e,i,a,o,n,null):[]};if(!u)return{cap:o,ends:Er(c,e,i,a,o,n,null)};let d=l?Er(c,e,i,a,o,n,p=>aa(p,e.dash,e.dashOffset??0,ia(p,e.dash,u))):[];if(r||d.length||u.open){let p=Il(c,e.dash,e.dashOffset??0,e.cap!=="butt",u);return p?{cap:o,ends:d,source:p}:null}return{cap:o,ends:d,dash:e.dash.map(p=>p*u.scale),dashPhase:(e.dashOffset??0)*u.scale}}function Er(e,t,n,r,s,i,a){let o=[],l=(Wt(n)?1:0)+(Wt(r)?1:0),c=i/2,u=Math.min(c,1)/2,f=t.cap!=="butt"?c:0;for(let d of e){if(d.closed)continue;let p=Math.min(t.capScale*i,d.length/Math.max(1,l)),_=a?.(d),w=A=>!_||_.some(([B,L])=>A>=B-f-1e-6&&A<=L+f+1e-6);n!==s&&di(o,d.posTan(0),d.posTan(p),-1,n,p,i,w(u)),r!==s&&di(o,d.posTan(d.length),d.posTan(d.length-p),1,r,p,i,w(d.length-u))}return o}function di(e,[t,n,r,s],i,a,o,l,c,u){let f=a*r,d=a*s;Wt(o)&&ya(o)&&Math.hypot(t-i[0],n-i[1])>1e-6&&(f=t-i[0],d=n-i[1]);let p=Math.hypot(f,d);p<1e-9||e.push({x:t,y:n,dx:f/p,dy:d/p,cap:o,size:l,weight:c,reached:u})}function Ar({x:e,y:t,dx:n,dy:r},s,i){let a=-r*i,o=n*i,l=n*s,c=r*s;return new rt().moveTo(e-a,t-o).lineTo(e-a+l,t-o+c).lineTo(e+a+l,t+o+c).lineTo(e+a,t+o).close().build()}function Zl({x:e,y:t,dx:n,dy:r},s){let i=new rt,a=32;for(let o=0;o<=a;o++){let l=-Math.PI/2+Math.PI*o/a,c=Math.cos(l)*s,u=Math.sin(l)*s,f=e+c*n-u*r,d=t+c*r+u*n;o===0?i.moveTo(f,d):i.lineTo(f,d)}return i.close().build()}function Ql(e,t){let{x:n,y:r,dx:s,dy:i,size:a,weight:o}=e,l=Jl(t,a,o),c=new rt;if(!l){let u=a/2,f=.5522848*u;return c.moveTo(n+u,r).cubicTo(n+u,r+f,n+f,r+u,n,r+u).cubicTo(n-f,r+u,n-u,r+f,n-u,r).cubicTo(n-u,r-f,n-f,r-u,n,r-u).cubicTo(n+f,r-u,n+u,r-f,n+u,r),c.close().build()}for(let u=0;u<l.length;u+=2){let f=n+l[u]*s-l[u+1]*i,d=r+l[u]*i+l[u+1]*s;u===0?c.moveTo(f,d):c.lineTo(f,d)}return c.close().build()}function pt(e){if(e.length===1)return e[0];let t=new Uint8Array(e.reduce((i,a)=>i+a.verbs.length,0)),n=new Float32Array(e.reduce((i,a)=>i+a.points.length,0)),r=0,s=0;for(let i of e)t.set(i.verbs,r),r+=i.verbs.length,n.set(i.points,s),s+=i.points.length;return{verbs:t,points:n}}var eu=class extends Set{node;nodes=new Map;constructor(e){super(),this.node=e}add(e){super.add(e);let t=this.node?.();if(t!==void 0){let n=this.nodes.get(e);n||this.nodes.set(e,n=new Set),n.add(t)}return this}clear(){super.clear(),this.nodes.clear()}},hi=new Set(["rect","ellipse","path","line","polygon","polygram","text","richText"]),pi=e=>e.type==="solid";function tu(e,t){if(t===0)return e;let n=e.w+2*t,r=e.h+2*t;return n>0&&r>0?e.kind==="ellipse"?{...e,x:e.x-t,y:e.y-t,w:n,h:r}:e.radii.some(s=>s>0&&!(s+t>0))?null:{...e,x:e.x-t,y:e.y-t,w:n,h:r,radii:e.radii.map(s=>s>0?s+t:0)}:null}var _t={kind:"solid",color:[0,0,0,1]},Lt={kind:"solid",color:[0,0,0,0]},_i=e=>[-e.size[0]/2,-e.size[1]/2,e.size[0]/2,e.size[1]/2],mi=(e,t)=>`${e}|${t.weight}|${t.align}|${t.join}|${t.cap}|${t.miterLimit}|${t.dash}|${t.dashOffset}`,gi={union:"union",subtract:"cut",intersect:"intersect",exclude:"exclude"};function Tr(e){let t=null;for(let n of e){let r=it(n.path),s=n.op??"union";t?s==="union"||s==="exclude"?t=[Math.min(t[0],r[0]),Math.min(t[1],r[1]),Math.max(t[2],r[2]),Math.max(t[3],r[3])]:s==="intersect"&&(t=[Math.max(t[0],r[0]),Math.max(t[1],r[1]),Math.min(t[2],r[2]),Math.min(t[3],r[3])],(t[2]<t[0]||t[3]<t[1])&&(t=[t[0],t[1],t[0],t[1]])):(s==="union"||s==="exclude")&&(t=r)}return t}function nu(e){let t=e[0]*e[3]-e[1]*e[2];if(!t)return null;let n=e[3]/t,r=-e[1]/t,s=-e[2]/t,i=e[0]/t;return[n,r,s,i,-(n*e[4]+s*e[5]),-(r*e[4]+i*e[5])]}var bi=1<<20;function Pr(e){let t=(e==="plus-lighter"?"plus":e).replace(/-(\w)/g,(n,r)=>r.toUpperCase());return qi.includes(t)?t:null}var wi=new WeakMap,ru=1<<24;function yi(e){let t=wi.get(e);return t===void 0&&wi.set(e,t=ru++),t}var va=class extends Go{width;height;measure;readsSpaceRects=!0;drawsVisibleOnly=!0;pixelRatio=1;doc;missing=new eu(()=>this.currentNodeStack[this.currentNodeStack.length-1]);shaderIssues=[];storage=null;images=new Map;frameImages=new Map;assets={image:e=>this.image(e),scene3d:(e,t,n,r)=>{let s=new Map;ec(e,o=>{if(tc(o)&&!s.has(o)){let l=this.surfaceOf(o);l&&s.set(o,l)}});let i=new Proxy({},{get:(o,l)=>typeof l=="string"?this.image(l)??void 0:void 0}),a=this.doc.addScene3D(e,t,n,{images:i,surfaces:s});return a.scale3d=r,a.version=++bi,a},video:(e,t)=>{let n=this.storage,r=t??this.videoTime(e);if(!n||r===null)return null;let s=n.videoFrame(e.src,r);if(!s)return null;let i=`${wt(e.src)}@${r.toFixed(6)}`,a=this.frameImages.get(i);return a||(a=this.doc.addImage(s,s.width,s.height,{mipmaps:!1}),a.version=yi(s),this.frameImages.set(i,a)),a},imageEdge:(e,t)=>this.storage?.wantImageEdge?.(e,t),deviceScale:()=>{let e=this.device();return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))},time:()=>this.elapsed(),checkShader:e=>this.checkShader("fill",e)};image=e=>{let t=wt(e),n=this.frameImages.get(t);if(n)return n;let r=this.images.get(t);return r?(n=this.doc.addImage(r.bitmap,r.width,r.height),n.version=yi(r.bitmap),this.frameImages.set(t,n),n):null};stack=[];scopes=[];worldAlpha=1;shapes=[];painted=!1;shadows=[];constructor(e,t,n){super(),this.width=e,this.height=t,this.measure=n}get cur(){return this.stack[this.stack.length-1]}measureText(e,t,n,r=400,s=0,i){return this.measure(e,t,n,r,s,i)}execute(e){this.doc=new Ji(this.width,this.height,this.clearColor()),this.frameImages.clear(),this.missing.clear(),this.shaderIssues.length=0;let t=this.doc.group(this.doc.root,{transform:this.rootTransform()}),n=this.frameGroup(t);this.stack=n===t?[t]:[t,n],this.scopes=[],this.worldAlpha=1,this.masks=[],this.cameras=[],this.clips=[],this.booleans=[],this.resetSurface(),e()}rootTransform(){return[1,0,0,1,this.width/2,this.height/2]}clearColor(){return[0,0,0,1]}frameGroup(e){return e}screenshot(){}unmount(){}begin(e){super.begin(e),this.scopes.push({groups:1,worldAlpha:this.worldAlpha}),this.stack.push(this.doc.group(this.cur)),this.resetSurface()}end(){let e=this.scopes.pop();if(e){for(let t=0;t<e.groups;t++)this.stack.pop();this.worldAlpha=e.worldAlpha}super.end()}transform(e){let t=e.x??0,n=e.y??0,r=e.width??0,s=e.height??0,i=e.opacity??1,a=e.blend??"pass-through",o,l=e.matrix;if(l)o=[l.a,l.b,l.c,l.d,l.e,l.f,l.g??0,l.h??0,l.i??1];else{let f=e.pivot??{x:0,y:0},d=f.x*(r/2),p=-f.y*(s/2),_=(e.rotation??0)*Math.PI/180,w=e.scale??1,A=Math.cos(_)*w,B=Math.sin(_)*w;o=[A,B,-B,A,t+d-(A*d-B*p),n+p-(B*d+A*p)]}let c=this.cur;c.transform=hr(c.transform,Vn(o)?o:o.slice(0,6));let u=this.motionBlur((e.effects??[]).filter(f=>f.mode!=="backdrop"));for(let f of u)f.type==="shader"&&this.checkShader("effect",f);if(u.length&&(c.effects=u,c.effectBox=[-r/2,-s/2,r,s],c.effectTime=this.elapsed()),a!=="pass-through"){let f=Pr(a);f||this.missing.add(`blend:${a}`),this.stack.push(this.doc.group(c,{opacity:this.worldAlpha*(i<1?i:1),blend:f??"normal"})),this.scopes[this.scopes.length-1].groups++,this.worldAlpha=1}else i<1&&(this.worldAlpha*=i);return this}resetSurface(){this.shapes=[],this.painted=!1,this.shadows=[]}drawGraphics(e){let t=this.worldAlpha,n=e;if(n.needsGroupLayer?.()){let c=n.groupOpacity();c<1&&(this.worldAlpha*=c)}let r=n.groupTransform?.(),s=null;if(r){let{x:c,y:u}=this.groupCenter(e,r.center),f=r.rotation*Math.PI/180,d=Math.cos(f)*r.scale,p=Math.sin(f)*r.scale;s=this.doc.group(this.cur,{transform:[d,p,-p,d,c-(d*c-p*u),u-(p*c+d*u)]}),this.stack.push(s)}let i=e.ops(),a=this.effectSegments(i),o=null;for(let c=0;c<i.length;c++){let u=i[c],f=a.get(c);switch(f&&(o=this.doc.group(this.cur,{effects:f,effectBox:this.viewportBox(),effectTime:this.elapsed()}),this.stack.push(o)),u.kind){case"rect":case"ellipse":case"polygon":case"polygram":case"line":case"path":{this.painted&&this.resetSurface();let d=Sr(u);if(!d)break;this.booleans.length?this.collect(d):this.shapes.push(d);break}case"cut":this.cut();break;case"richText":this.painted&&this.resetSurface(),this.richText(u.state);break;case"text":{this.painted&&this.resetSurface();let d=jl(u.state,_=>{let w=_.runs[0],A=this.measureText(w.text,w.size,w.family,w.weight,w.letterSpacing,w.italic?"italic":"normal");return[A.width,A.height]}),p=u.state.segments;if(d&&p?.length&&!d.spec.path)this.paintSegments(d,p);else if(d){let[_,w]=d.size,A=d.transform[4],B=d.transform[5];this.shapes.push({fill:null,stroke:null,interior:null,bounds:[A-_/2,B-w/2,A+_/2,B+w/2],text:d})}else this.missing.add("text:path");break}case"fill":this.fill(Qo.resolve(u.fills));break;case"stroke":this.stroke(pc.resolve(u.strokes));break;case"shadow":this.shadows=dc.resolve(u.shadows);break;case"effects":o&&(this.stack.splice(this.stack.lastIndexOf(o)),o=null),this.resetSurface();break;case"mask":this.beginMask(u.options);break;case"applyMask":this.applyMask();break;case"endMask":this.endMask();break;default:this.missing.add(`op:${u.kind}`)}}let l=s??o;l&&this.stack.splice(this.stack.lastIndexOf(l)),this.worldAlpha=t}effectSegments(e){let t=new Map,n=0,r=!1;return e.forEach((s,i)=>{if(hi.has(s.kind))r&&(n=i,r=!1);else if(s.kind==="fill"||s.kind==="stroke"||s.kind==="shadow")r=!0;else if(s.kind==="effects"){let a=this.motionBlur(s.effects.filter(o=>o.mode!=="backdrop"));a.length&&t.set(n,a),n=i+1,r=!1}}),t}motionBlur(e){if(!e.some(n=>n.type==="motionBlur"))return e;let t=this.currentRenderState();return e.flatMap(n=>{if(n.type!=="motionBlur")return[n];let r=t?Gl(n,t.velocity,t.dt):null;return r?((r.phase!==0||Math.round(r.samples)>32)&&this.missing.add("effect:motionBlur-shutter"),[{type:"directionalBlur",radius:r.radius,angle:r.angle}]):[]})}groupCenter(e,t){if(t!==void 0&&typeof t!="string")return{x:t.x,y:t.y};let n=null;for(let a of e.ops()){let o=hi.has(a.kind)&&a.kind!=="text"&&a.kind!=="richText"?Sr(a)?.fill:null;if(!o||!o.verbs.length)continue;let l=it(o);n=n?[Math.min(n[0],l[0]),Math.min(n[1],l[1]),Math.max(n[2],l[2]),Math.max(n[3],l[3])]:l}if(!n)return{x:0,y:0};let r=(n[0]+n[2])/2,s=(n[1]+n[3])/2;if(t===void 0)return{x:r,y:s};let i=Ko.resolve(t);return{x:r+i.x*((n[2]-n[0])/2),y:s-i.y*((n[3]-n[1])/2)}}viewportBox(){let[e,t,n,r]=this.spaceBounds({space:"global"},[0,0,0,0]);return[e,t,n-e,r-t]}surface(e){let t=this.shapes.map(n=>n[e]).filter(n=>!!n&&n.verbs.length>0);return e==="fill"&&t.length>1&&(t=t.map(n=>Sl(n)<0?El(n):n)),t.length?pt(t):null}bounds(e){let t=this.shapes.map(n=>n.bounds).filter(n=>n!==null);return e&&t.length!==this.shapes.length?it(e):t.length?t.reduce((n,r)=>[Math.min(n[0],r[0]),Math.min(n[1],r[1]),Math.max(n[2],r[2]),Math.max(n[3],r[3])]):[0,0,0,0]}leaf(e,t,n){return"members"in t?this.doc.compound(e,{...n,members:t.members}):this.doc.pathNode(e,{...n,path:t.path})}geomBounds(e){return"members"in e?Tr(e.members)??[0,0,0,0]:it(e.path)}spreadGeom(e,t,n){if(!t||"members"in e)return e;let r=[];for(let s of this.shapes){if(s.members||!s.fill||!s.fill.verbs.length)continue;let i=s.spread?s.spread(t):s.fill;i&&i.verbs.length?r.push(i):n||r.push(s.fill)}return r.length?{path:pt(r)}:null}clipTo(e,t){if("path"in t){let[r,s,i,a]=it(t.path);return this.doc.group(e,{clip:{x:r,y:s,w:i-r,h:a-s,r:0,path:t.path}})}let n=this.doc.group(e,{mask:"alpha"});return this.doc.compound(n,{members:t.members,fill:_t}),n}clipOutside(e,t){let n=this.doc.group(e,{mask:"invertAlpha"});return this.leaf(n,t,{fill:_t}),n}fill(e){this.painted=!0,!this.booleans.length&&this.deferring("fill",()=>this.paintFill(e))}deferring(e,t){let n=this.masks[this.masks.length-1],r=n?.apply&&!n.apply.has(e)&&!this.inVectorMask?n.after:null;if(!r)return t();this.stack.push(r);try{t()}finally{this.stack.splice(this.stack.lastIndexOf(r))}}paintFill(e){if(this.paintText(e,null),!e.length||this.fillNative(e))return;let t=this.surface("fill"),n=t?[{path:t}]:[];for(let i of this.shapes)i.members&&n.push({members:i.members});if(!n.length)return;let r=this.bounds(t),s=this.shadows;this.shadows=[];for(let i of n)this.fillGeom(i,r,e,s)}fillNative(e){let t=this.shapes.length===1?this.shapes[0]:null,n=t?.native;if(!t||!n||this.inVectorMask||this.shadows.length||!e.every(pi))return!1;for(let r of e){let s=He(r,t.bounds,this.missing,this.assets);s&&this.native(this.cur,n,{fill:s,opacity:this.worldAlpha*(r.opacity??1),blend:this.blendOf(r)})}return!0}strokeNative(e,t,n,r){let s=this.shapes.length===1?this.shapes[0]:null,i=s?.native;if(!s||!i||t<=0||(e.dash?.length??0)>0||!e.fill.every(pi)||i.kind==="ellipse"&&Math.abs(i.w-i.h)>.001||i.kind==="rect"&&i.radii.some(f=>f===0)&&(e.join!=="miter"||!(e.miterLimit>=Math.SQRT2)))return!1;let a=Math.max(-1,Math.min(1,e.align??0)),o=tu(i,a*t/2);if(!o)return!1;let l=s.bounds,c=this.snapBounds([Math.fround(l[0]),Math.fround(l[1]),Math.fround(l[2]),Math.fround(l[3])],n,r),u=c?this.doc.group(this.cur,{transform:c}):this.cur;for(let f of e.fill){let d=He(f,l,this.missing,this.assets);if(!d)continue;let p={paint:d,width:t,join:e.join,cap:e.cap,miter:e.miterLimit};this.native(u,o,{opacity:this.worldAlpha*(f.opacity??1),stroke:p,...a===0&&{blend:this.blendOf(f)}})}return!0}native(e,t,n){let r={...n,transform:[1,0,0,1,t.x,t.y],w:t.w,h:t.h,radii:t.radii};return t.kind==="rect"?this.doc.rect(e,r):this.doc.ellipse(e,r)}fillGeom(e,t,n,r){if(this.inVectorMask){this.leaf(this.cur,e,{fill:_t});return}let s=[];for(let i of r){if(i.inner)continue;if(i.fill.length===1&&i.fill[0].type==="solid"){let u=Ic(i,this.missing);u&&s.push(u);continue}let a=i.offset?.x??0,o=-(i.offset?.y??0),l=this.doc.group(this.cur,{transform:[1,0,0,1,a,o],filter:i.blur>0?{kind:"blur",sigma:i.blur/2}:void 0}),c=this.spreadGeom(e,i.spread??0,!1);for(let u of i.fill){let f=He(u,this.spaceBounds(u,t),this.missing,this.assets);f&&this.leaf(l,c,{fill:f,opacity:this.worldAlpha*(u.opacity??1)})}}n.forEach((i,a)=>{let o=this.spaceBounds(i,t),l=He(i,o,this.missing,this.assets);if(!l)return;let c=this.worldAlpha*(i.opacity??1),u=a===0?s:[],f=i.type==="video"?i.preset?.adjustments?.find(p=>p.type==="echo"):void 0;if(f&&f.echoes>0&&f.delay>0){this.echoStack(e,i,o,t,l,c,u,f);return}let d=i.preset?.intensity??1;if(d>0&&d<1&&this.pixelAdjustments(i).length){let p=this.doc.group(this.cur,{opacity:c,blend:this.blendOf(i)});this.mediaPreset(this.leaf(p,e,{fill:l,shadows:u}),i,t),this.leaf(p,e,{fill:l,opacity:1-d});return}this.mediaPreset(this.leaf(this.cur,e,{fill:l,opacity:c,shadows:u,blend:this.blendOf(i)}),i,t)});for(let i of r){if(!i.inner)continue;let a=this.spreadGeom(e,-(i.spread??0),!0),o=i.offset?.x??0,l=-(i.offset?.y??0),[c,u,f,d]=this.geomBounds(e),p=Math.abs(o)+Math.abs(l)+i.blur*2+2,_=this.clipTo(this.cur,e);for(let w of i.fill){let A=He(w,this.spaceBounds(w,t),this.missing,this.assets);if(!A)continue;let B=this.doc.group(_,{opacity:this.worldAlpha*(w.opacity??1),filter:i.blur>0?{kind:"blur",sigma:i.blur/2}:void 0}),L=this.doc.group(B,a?{mask:"invertAlpha"}:{});a&&this.leaf(L,a,{transform:[1,0,0,1,o,l],fill:_t}),this.doc.rect(L,{transform:[1,0,0,1,c-p,u-p],w:f-c+2*p,h:d-u+2*p,fill:A})}}}richText(e){let t=vc(e),n=t.spans;if(!n.length)return;let r=[-t.width/2,-t.height/2,t.width/2,t.height/2],s={kind:"solid",color:[0,0,0,0]},i=u=>(u[0]?He(u[0],r,this.missing,this.assets):null)??s,a=n.map(u=>({text:u.text,family:u.fontFamily,size:u.fontSize,weight:u.fontWeight,italic:u.fontStyle==="italic"||u.fontStyle==="oblique",letterSpacing:u.letterSpacing})),o={runs:a,align:{start:"left",end:"right"}[t.textAlign]??t.textAlign,wrap:t.width>0,width:t.width,lineHeight:t.lineHeight},l=Math.max(1,...n.map(u=>u.fill.length));for(let u=0;u<l;u++){let f=a.map((d,p)=>({...d,paint:i(n[p].fill.slice(u,u+1))}));this.doc.textNode(this.cur,{text:{...o,runs:f},fill:s,opacity:this.worldAlpha})}let c=new Map;n.forEach((u,f)=>u.stroke.forEach((d,p)=>{let _=`${p}|${d.weight}|${d.join}|${d.cap}|${d.miterLimit}`,w=c.get(_);w||c.set(_,w={k:p,st:d,paints:n.map(()=>s)}),w.paints[f]=i(d.fill)}));for(let{st:u,paints:f}of[...c.values()].sort((d,p)=>d.k-p.k)){let d=a.map((p,_)=>({...p,paint:f[_]}));this.doc.textNode(this.cur,{text:{...o,runs:d},opacity:this.worldAlpha,stroke:{paint:s,width:u.weight,join:u.join,cap:u.cap,miter:u.miterLimit}})}}paintText(e,t){for(let n of this.shapes){let r=n.text;if(r)for(let s of e){let i=He(s,_i(r),this.missing,this.assets);i&&this.textLayer(r,r.spec,r.spec,i,this.worldAlpha*(s.opacity??1),t)}}}paintSegments(e,t){let n=this.segmentSpec(e,t),r=_i(e),s=(c,u)=>{if(!u||!(c.opacity>0))return Lt;let f=He(u,r,this.missing,this.assets);return f?this.fadePaint(f,c.opacity*(u.opacity??1)):Lt},i=c=>({...n,runs:n.runs.map((u,f)=>({...u,paint:c(t[f])}))}),a={...n,runs:n.runs.map((c,u)=>t[u].opacity>0?c:{...c,paint:Lt})},o=Math.max(0,...t.map(c=>c.fill?.length??0));for(let c=0;c<o;c++)this.textLayer(e,i(u=>s(u,u.fill?.[c])),a,Lt,this.worldAlpha,null);let l=new Map;t.forEach(c=>c.stroke?.forEach((u,f)=>{let d=mi(f,u);l.has(d)||l.set(d,{k:f,st:u})}));for(let[c,{k:u,st:f}]of[...l].sort((d,p)=>d[1].k-p[1].k)){let d=Math.max(...t.map(p=>p.stroke?.[u]?.fill.length??0));for(let p=0;p<d;p++){let _=w=>{let A=w.stroke?.[u];return A&&mi(u,A)===c?s(w,A.fill[p]):Lt};this.textLayer(e,i(_),a,Lt,this.worldAlpha,f)}}}segmentSpec(e,t){let n=e.spec.runs[0],r=1,s=e.spec.wrap,{width:i=0,height:a=0,minFontSize:o=0}=e.spec;if(e.spec.fontSize==="autofit"&&i>0&&a>0){let c=this.measureText(n.text,Fn,n.family,n.weight,n.letterSpacing,n.italic?"italic":"normal"),u=Fn*Math.min(c.width>0?i/c.width:1,c.height>0?a/c.height:1);s&&u<o?r=o/Fn:(r=u/Fn,s=!1)}let l=t.map(c=>({text:c.text,family:c.fontFamily??n.family,size:(c.fontSize??n.size)*r,weight:c.fontWeight,italic:c.fontStyle===void 0?n.italic:c.fontStyle==="italic"||c.fontStyle==="oblique",letterSpacing:c.letterSpacing,decoration:c.textDecoration===void 0?n.decoration:c.textDecoration==="underline"?"underline":c.textDecoration==="line-through"?"lineThrough":void 0}));return{...e.spec,runs:l,wrap:s,fontSize:void 0}}fadePaint(e,t){return t>=1?e:e.kind==="solid"?{...e,color:[e.color[0],e.color[1],e.color[2],e.color[3]*t]}:"stops"in e?{...e,stops:e.stops.map(n=>({...n,color:[n.color[0],n.color[1],n.color[2],n.color[3]*t]}))}:(this.missing.add("text:run-opacity"),e)}textLayer(e,t,n,r,s,i){if(!i){this.doc.textNode(this.cur,{transform:e.transform,text:t,opacity:s,fill:r});return}let a=f=>({paint:r,width:f,join:i.join,cap:i.cap,miter:i.miterLimit,dash:i.dash,dashPhase:i.dashOffset}),o=Math.max(-1,Math.min(1,i.align??0));if(o===0){this.doc.textNode(this.cur,{transform:e.transform,text:t,opacity:s,stroke:a(i.weight)});return}let l=f=>this.doc.textNode(f,{transform:e.transform,text:n,fill:_t}),c=(f,d)=>this.doc.textNode(f,{transform:e.transform,text:n,stroke:{paint:_t,width:d,join:i.join,miter:i.miterLimit}}),u=f=>{if(o>0){let _=this.doc.group(this.cur,{mask:"invertAlpha"}),w=this.doc.group(_,{mask:"invertAlpha"});return c(w,f),l(w),_}let d=this.doc.group(this.cur,{mask:"alpha"}),p=this.doc.group(d);return l(p),c(p,f),d};if(Math.abs(o)>=1){let f=this.doc.group(this.cur,{mask:o>0?"invertAlphaEroded":"alphaDilated"});l(f),this.doc.textNode(f,{transform:e.transform,text:t,opacity:s,stroke:a(2*i.weight)})}else{let f=(1+o)*i.weight/2,d=(1-o)*i.weight/2;this.doc.textNode(u(2*(o>0?d:f)),{transform:e.transform,text:t,opacity:s,stroke:a(2*Math.max(f,d))})}}surfaceOf(e){let t=Math.max(1,Math.min(e.maxPixelRatio??1,4)),n=e.width??512,r=e.height??512,s=Math.max(1,Math.ceil(n*t)),i=Math.max(1,Math.ceil(r*t)),a=this.doc.detached({transform:[t,0,0,t,n*t/2,r*t/2]}),o={stack:this.stack,scopes:this.scopes,alpha:this.worldAlpha,shapes:this.shapes,painted:this.painted,shadows:this.shadows,masks:this.masks,clips:this.clips,cameras:this.cameras};this.stack=[a],this.scopes=[],this.worldAlpha=1,this.masks=[],this.clips=[],this.cameras=[],this.resetSurface();try{let c=lc(e.source);c.kind==="graphics"?this.draw(c.graphics):(c.node.layout({x:0,y:0,width:n,height:r},this),c.node.render(this))}catch(c){this.missing.add("surface:error"),console.warn(c)}finally{Object.assign(this,{stack:o.stack,scopes:o.scopes,worldAlpha:o.alpha,shapes:o.shapes,painted:o.painted,shadows:o.shadows,masks:o.masks,clips:o.clips,cameras:o.cameras})}let l=this.doc.addSurface(a,s,i);return l.version=++bi,l}mediaPreset(e,t,n){let r=this.pixelAdjustments(t);!r.length||(t.preset.intensity??1)<=0||(e.effects=r.map(s=>({...s,clip:!0})),e.effectBox=[n[0],n[1],n[2]-n[0],n[3]-n[1]],e.effectTime=this.elapsed())}pixelAdjustments(e){let t=e;return t.type!=="image"&&t.type!=="video"||!t.preset?[]:(t.preset.adjustments??[]).filter(n=>n.type!=="echo"&&n.type!=="posterizeTime")}echoStack(e,t,n,r,s,i,a,o){let l=Pr(o.blend??"screen")??"screen",c=o.decay??.5,u=Math.min(Math.max(0,Math.floor(o.echoes)),32),f=this.videoTime(t);a.length&&this.leaf(this.cur,e,{fill:{kind:"solid",color:[0,0,0,0]},opacity:i,shadows:a});for(let d=u;d>=1&&f!==null;d--){let p=f-d*o.delay;if(p<0)continue;let _=He(t,n,this.missing,{...this.assets,video:w=>this.assets.video(w,p)});_&&this.leaf(this.cur,e,{fill:_,opacity:i*Math.pow(c,d),blend:l})}this.mediaPreset(this.leaf(this.cur,e,{fill:s,opacity:i,blend:l}),t,r)}videoTime(e){let t=this.storage?.videos.get(wt(e.src));return t?uc(e,this.currentRenderState()?.elapsed??0,t.duration):null}elapsed(){return this.currentRenderState()?.elapsed??0}spaceBounds(e,t){let n=e.space??"local";if(n==="parent"){let r=this.currentSpaceRects().parent;return r?[r.left,r.top,r.right,r.bottom]:t}if(n==="global"){let r=this.device(),s=r[0]*r[3]-r[1]*r[2];if(!s)return t;let i=(u,f)=>{let d=u-r[4],p=f-r[5];return[(r[3]*d-r[2]*p)/s,(-r[1]*d+r[0]*p)/s]},a=this.width*this.pixelRatio,o=this.height*this.pixelRatio,l=i(0,0),c=i(a,o);return[Math.min(l[0],c[0]),Math.min(l[1],c[1]),Math.max(l[0],c[0]),Math.max(l[1],c[1])]}return t}blendOf(e){let t=e.blend;if(!t||t==="normal")return"normal";let n=Pr(t);return n||this.missing.add(`fill:blend:${t}`),n??"normal"}device(){let e=[this.pixelRatio,0,0,this.pixelRatio,0,0];for(let t of this.stack)e=hr(e,t.transform);return e}snap(e,t,n){return this.snapBounds(it(e),t,n)}snapBounds([e,t,n,r],s,i){if(s<=0||Math.abs(i[1])>1e-6||Math.abs(i[2])>1e-6||i[0]===0||i[3]===0||n-e<=0||r-t<=0)return null;let a=i[0],o=i[3],l=i[4],c=i[5],u=l+a*e,f=c+o*t,d=l+a*n,p=c+o*r,_=s%2===0?0:.5,w=Math.round(u-_)+_,A=Math.round(f-_)+_,B=Math.round(d-_)+_,L=Math.round(p-_)+_;if(B-w<1||L-A<1)return null;let V=(B-w)/(d-u),se=(L-A)/(p-f);return Math.abs(V-1)<1e-4&&Math.abs(se-1)<1e-4&&Math.abs(w-u)<1e-4&&Math.abs(A-f)<1e-4?null:[V,0,0,se,(w-l)/a-V*e,(A-c)/o-se*t]}stroke(e){this.painted=!0,!this.booleans.length&&this.deferring("stroke",()=>this.paintStroke(e))}paintStroke(e){for(let a of e)this.paintText(a.fill,a);let t,n=()=>t===void 0?t=this.surface("fill"):t,r=this.device(),s=Math.sqrt(Math.abs(r[0]*r[3]-r[1]*r[2])),i=Vn(r)||Math.abs(r[1])>1e-6||Math.abs(r[2])>1e-6;for(let a of e){let o=a.weight,l=-1;if(!i&&o>0&&s>0&&o*s<2.5&&(l=Math.max(1,Math.round(o*s)),o=l/s),!this.strokeNative(a,o,l,r))for(let c of this.strokeShapes()){let u,f,d={cap:a.cap,ends:[],dash:a.dash,dashPhase:a.dashOffset};if(c.members)u=f={members:c.members};else{if(!c.stroke||!c.stroke.verbs.length)continue;let L=Xl(a,c.stroke,o,l>0);if(!L)continue;d=L,u={path:L.source??c.stroke},f=c.alignInterior?{members:c.alignInterior}:c.interior&&oi(c.interior)?{path:c.interior}:null}let p=this.bounds(n()??("path"in u?u.path:null)),_=Math.max(-1,Math.min(1,a.align??0)),w=_!==0&&f!==null&&!d.ends.some(L=>Wt(L.cap))?[[(1+_)*o,"out"],[(1-_)*o,"in"]]:[[o,"both"]],A=c.fill?this.snap(c.fill,l,r):null,B=A?this.doc.group(this.cur,{transform:A}):this.cur;for(let L of a.fill){let V=He(L,this.spaceBounds(L,p),this.missing,this.assets);if(!V)continue;let se=this.worldAlpha*(L.opacity??1);for(let[X,pe]of w){if(X<=0)continue;let ue={paint:V,width:X,join:a.join,cap:d.cap,miter:a.miterLimit,dash:d.dash,dashPhase:d.dashPhase};pe==="both"?this.strokeLeaf(B,u,{opacity:se,stroke:ue,blend:this.blendOf(L)},d.ends):this.strokeLeaf(pe==="in"?this.clipTo(B,f):this.clipOutside(B,f),u,{opacity:se,stroke:ue},d.ends)}}}}}strokeShapes(){if(this.shapes.length<2||this.shapes.some(r=>r.text))return this.shapes;let e=this.shapes.filter(r=>r.members||r.fill&&r.fill.verbs.length).sort((r,s)=>(s.members?1:0)-(r.members?1:0));if(e.length<2)return this.shapes;let t=[];for(let r of e)r.members?r.members.forEach((s,i)=>t.push({...s,op:i===0?"union":s.op})):t.push({kind:"path",path:r.fill,op:"union"});e.filter(r=>r.members).length>1&&this.missing.add("stroke:union-of-booleans");let n=e.every(r=>r.bounds)?e.map(r=>r.bounds).reduce((r,s)=>[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]):null;return e.some(r=>!r.members&&(r.stroke!==r.fill||r.trimmed||!oi(r.fill)))?e.some(r=>r.members)?this.shapes:[{fill:pt(e.map(r=>r.fill)),stroke:pt(e.map(r=>r.stroke??r.fill)),interior:null,alignInterior:t,bounds:n}]:[{fill:null,stroke:null,interior:null,bounds:n,members:t}]}strokeLeaf(e,t,n,r){if(!r.length)return this.leaf(e,t,n);let s=n.stroke.width/2,i=s*1.01+.5,a=n.stroke.cap!=="butt",o=[],l=[];for(let f of r){if(Wt(f.cap)){let d=ql(f.cap,f.size,f.weight);(d>0||a)&&o.push(Ar({...f,x:f.x-f.dx*d,y:f.y-f.dy*d},d+i,i)),l.push(Ql(f,f.cap));continue}a&&o.push(Ar(f,i,i)),f.reached&&f.cap!=="butt"&&l.push(f.cap==="round"?Zl(f,s):Ar(f,s,s))}let c=this.doc.group(e,{opacity:n.opacity??1,blend:n.blend??"normal"}),u={...n,opacity:1,blend:"normal"};if(o.length){let f=this.doc.group(c,{mask:"invertAlpha"});this.doc.pathNode(f,{path:pt(o),fill:_t}),this.leaf(f,t,u)}else this.leaf(c,t,u);return l.length&&this.doc.pathNode(c,{path:pt(l),fill:n.stroke.paint}),c}booleans=[];beginBoolean(e){this.booleans.push({op:e,base:nu(this.device()),members:[]}),this.resetSurface()}endBoolean(){let e=this.booleans.pop();if(this.resetSurface(),!e||!e.members.length)return;let t=this.booleans[this.booleans.length-1];if(!t){this.shapes.push({fill:null,stroke:null,interior:null,bounds:Tr(e.members),members:e.members});return}let n=this.relative(t.base),r=gi[t.op],s=!t.members.length;!s&&!e.members.slice(1).every(i=>i.op===(r==="cut"?"union":r))&&this.missing.add("boolean:nested"),e.members.forEach((i,a)=>{let o=i.op??"union",l=s?o:a===0||r==="cut"?r:o;t.members.push({kind:"path",path:n?Js(i.path,n):i.path,op:l})})}relative(e){let t=this.device();return!e||Vn(t)?null:hr(e,t)}collect(e){let t=this.booleans[this.booleans.length-1],n=e.fill;if(!n||!n.verbs.length)return;let r=this.relative(t.base);r||this.missing.add("boolean:projective"),t.members.push({kind:"path",path:r?Js(n,r):n,op:t.members.length?gi[t.op]:"union"})}cut(){let e=this.shapes.filter(n=>n.members||n.fill&&n.fill.verbs.length);if(this.resetSurface(),!e.length)return;let t=[];e.forEach((n,r)=>{let s=r>0&&r===e.length-1?"cut":"union";if(!n.members){t.push({kind:"path",path:n.fill,op:s});return}r>0&&this.missing.add("cut:compound"),n.members.forEach((i,a)=>t.push({...i,op:a===0?s:i.op}))}),this.shapes.push({fill:null,stroke:null,interior:null,bounds:Tr(t),members:t})}masks=[];get inVectorMask(){let e=this.masks[this.masks.length-1];return!!e&&e.open&&e.vector}beginMask(e){let t=e?.mode??"alpha",n=t==="luminance",r=e?.inverted?n?"invertLuminance":"invertAlpha":n?"luminance":"alpha",s=this.doc.group(this.cur,{mask:r}),i=e?.apply?new Set(Array.isArray(e.apply)?e.apply:[e.apply]):null,a=i?this.doc.group(this.cur):null;this.stack.push(s,this.doc.group(s)),this.masks.push({vector:t==="vector",open:!0,apply:i,after:a}),this.resetSurface()}applyMask(){let e=this.masks[this.masks.length-1];e?.open&&(e.open=!1,this.stack.pop(),this.resetSurface())}endMask(){let e=this.masks.pop();e&&(e.open&&this.stack.pop(),this.stack.pop(),this.resetSurface())}clips=[];clipGeom(e){let t=[];for(let n of e.ops()){if(n.kind==="cut"){t.length>1&&(t[t.length-1].op="cut");continue}let r=Sr(n)?.fill;r&&r.verbs.length&&t.push({kind:"path",path:r,op:"union"})}return t.length?t.some(n=>n.op==="cut")?{members:t}:{path:pt(t.map(n=>n.path))}:null}beginClip(e){let t=this.clipGeom(e);if(!t){this.clips.push({pushed:0,geom:null});return}let n=this.clipTo(this.cur,t);"members"in t?this.stack.push(n,this.doc.group(n)):this.stack.push(n),this.clips.push({pushed:"members"in t?2:1,geom:t})}endClip(){let e=this.clips.pop()?.pushed??0;for(let t=0;t<e;t++)this.stack.pop()}cameras=[];beginCamera(e,t,n,r){let s=this.doc.group(this.cur,{clip:{x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,r:0}}),i=-r*Math.PI/180,a=Math.cos(i)*n,o=Math.sin(i)*n,l=-t.x,c=t.y,u=this.doc.group(s,{transform:[a,o,-o,a,e.x+a*l-o*c,e.y+o*l+a*c]});this.stack.push(s,u),this.cameras.push(2)}endCamera(){let e=this.cameras.pop()??0;for(let t=0;t<e;t++)this.stack.pop()}beginEffects(e,t,n,r){if(t!=="backdrop")return;for(let i of e)i?.type==="shader"&&this.checkShader("effect",i);let s=this.clips[this.clips.length-1]?.geom;if(!s){let[i,a,o,l]=this.viewportBox();s={path:new rt().moveTo(i,a).lineTo(i+o,a).lineTo(i+o,a+l).lineTo(i,a+l).close().build()}}this.leaf(this.cur,s,{effects:e,effectBox:[-n/2,-r/2,n,r],effectTime:this.elapsed()})}endEffects(){}checkShader(e,t){let n=this.currentNodeStack[this.currentNodeStack.length-1];for(let r of xl(e,t))this.shaderIssues.push(n===void 0?r:{...r,nodeId:n})}rasterize(){return this.missing.add("rasterize"),null}},su=1379091505;function yt(e){if(e===void 0)return{x:0,y:0,z:0};if(typeof e=="number")return{x:e,y:e,z:e};if(Array.isArray(e))return{x:e[0]??0,y:e[1]??0,z:e[2]??0};let t=e;return{x:t.x??0,y:t.y??0,z:t.z??0}}var iu={XYZ:0,YXZ:1,ZXY:2,ZYX:3,YZX:4,XZY:5},au={none:0,linear:1,reinhard:2,cineon:3,aces:4,agx:5,neutral:6},Be={box:0,sphere:1,plane:2,cylinder:3,cone:4,torus:5,torusKnot:6,circle:7,ring:8,buffer:9,capsule:10,polyhedron:11,lathe:12,tube:13,edges:14,wireframe:15},ou={tetrahedron:0,octahedron:1,icosahedron:2,dodecahedron:3},cu={basic:0,standard:1,physical:2,lambert:3,phong:4,normal:5,points:6,lineBasic:7,lineDashed:8,sprite:9,shadow:10,toon:11,matcap:12,depth:13,shader:14},lu={ambient:0,hemisphere:1,directional:2,point:3,spot:4,area:5},uu={front:0,back:1,both:2},fu={normal:0,additive:1,subtractive:2,multiply:3,none:4},du=["map","gradientMap","alphaMap","aoMap","normalMap","roughnessMap","metalnessMap","emissionMap","envMap","lightMap","displacementMap"],hu=class{byKey=new Map;next=1;pending=[];all=new Map;id(e,t){let n=Gi(e),r="src"in n?n.src:n,s=this.byKey.get(r);s||this.byKey.set(r,s=new Map);let i=s.get(t);if(i===void 0){i=this.next++,s.set(t,i);let a={id:i,srgb:t,texture:n};this.pending.push(a),this.all.set(i,a)}return i}},xa=class{buf=new ArrayBuffer(65536);u32=new Uint32Array(this.buf);f32=new Float32Array(this.buf);n=0;room(e){if(this.n+e<=this.u32.length)return;let t=this.buf.byteLength*2;for(;t/4<this.n+e;)t*=2;let n=new ArrayBuffer(t);new Uint32Array(n).set(this.u32.subarray(0,this.n)),this.buf=n,this.u32=new Uint32Array(n),this.f32=new Float32Array(n)}u(e){this.room(1),this.u32[this.n++]=e>>>0}f(e){this.room(1),this.f32[this.n++]=e===void 0?NaN:e}v3(e){this.f(e.x),this.f(e.y),this.f(e.z)}floats(e){this.room(e.length);for(let t=0;t<e.length;t++)this.f32[this.n++]=e[t]}words(e){this.room(e.length);for(let t=0;t<e.length;t++)this.u32[this.n++]=e[t]>>>0}color(e){if(e===void 0){this.u(0),this.f(0),this.f(0),this.f(0),this.f(0);return}let[t,n,r,s]=typeof e=="string"?Wi(e):e;this.u(1),this.f(t),this.f(n),this.f(r),this.f(s??1)}segments(e){if(e===void 0){this.u(0),this.f(NaN),this.f(NaN),this.f(NaN);return}if(typeof e=="number"){this.u(1),this.f(e),this.f(NaN),this.f(NaN);return}this.u(2),this.f(e[0]),this.f(e[1]),this.f(e[2])}result(){return this.u32.slice(0,this.n)}key(e){return Array.prototype.join.call(this.u32.subarray(e,this.n),",")}copy(e){return this.u32.slice(e,this.n)}same(e,t){if(this.n-e!==t.length)return!1;let n=this.u32;for(let r=0;r<t.length;r++)if(n[e+r]!==t[r])return!1;return!0}set(e,t){this.u32[e]=t>>>0}append(e){this.room(e.n),this.u32.set(e.u32.subarray(0,e.n),this.n),this.n+=e.n}};function qe(e,t){if(!t){e.u(0);return}let n=0;if(t.position!==void 0&&(n|=1),t.rotation!==void 0&&(n|=2),t.quaternion!==void 0&&(n|=4),t.scale!==void 0&&(n|=8),t.lookAt!==void 0&&(n|=16),t.visible===!1&&(n|=32),t.shadow!==void 0&&(n|=64),t.renderOrder!==void 0&&(n|=128),e.u(n),n&1&&e.v3(yt(t.position)),n&2&&(e.v3(yt(t.rotation)),e.u(iu[t.rotation.order??"XYZ"]??0)),n&4){let r=t.quaternion;e.f(r.x),e.f(r.y),e.f(r.z),e.f(r.w)}if(n&8&&e.v3(yt(t.scale)),n&16&&e.v3(yt(t.lookAt)),n&64){let r=t.shadow;e.u(r===!1?0:r===!0?1:r==="cast"?2:r==="receive"?3:4)}n&128&&e.f(t.renderOrder)}function Ir(e,t){let n=Math.floor(t.position.length/3),r=(t.normal?1:0)|(t.uv?2:0)|(t.color?4:0)|(t.index?8:0)|(t.computeNormals?16:0);e.u(Be.buffer),e.u(r),e.u(n),e.u(t.index?.length??0),e.floats(t.position),t.normal&&e.floats(t.normal),t.uv&&e.floats(t.uv),t.color&&e.floats(t.color),t.index&&e.words(t.index)}function _n(e,t,n){switch(t.type){case"box":if((t.cornerRadius??0)>0){let[r,s,i]=Hs(t.segments,[1,1,1]);Ir(e,Zo({width:t.width??1,height:t.height??1,depth:t.depth??1,radius:t.cornerRadius,segments:[r,s,i]}));return}e.u(Be.box),e.f(t.width),e.f(t.height),e.f(t.depth),e.segments(t.segments);return;case"sphere":e.u(Be.sphere),e.f(t.radius),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep),e.f(t.startLatitude),e.f(t.latitudeSweep);return;case"plane":e.u(Be.plane),e.f(t.width),e.f(t.height),e.segments(t.segments);return;case"cylinder":{let[r,s]=Jo(t.radius);e.u(Be.cylinder),e.f(r),e.f(s),e.f(t.height),e.segments(t.segments),e.u(t.capped===!1?0:1),e.f(t.startAngle),e.f(t.sweep);return}case"cone":e.u(Be.cone),e.f(t.radius),e.f(t.height),e.segments(t.segments),e.u(t.capped===!1?0:1),e.f(t.startAngle),e.f(t.sweep);return;case"torus":e.u(Be.torus),e.f(t.radius),e.f(t.thickness),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"torusKnot":e.u(Be.torusKnot),e.f(t.radius),e.f(t.thickness),e.segments(t.segments),e.f(t.windings?.[0]),e.f(t.windings?.[1]);return;case"circle":e.u(Be.circle),e.f(t.radius),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"ring":e.u(Be.ring),e.f(t.radius),e.f(t.innerRadius),e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"buffer":Ir(e,t);return;case"parametric":Ir(e,Xo(t));return;case"capsule":e.u(Be.capsule),e.f(t.radius),e.f(t.height),e.segments(t.segments);return;case"polyhedron":e.u(Be.polyhedron),e.u(ou[t.shape??"icosahedron"]??2),e.f(t.radius),e.f(t.segments===void 0?0:Hs(t.segments,[1])[0]);return;case"lathe":e.u(Be.lathe),e.u(t.points.length);for(let r of t.points){let s=yt(r);e.f(s.x),e.f(s.y)}e.segments(t.segments),e.f(t.startAngle),e.f(t.sweep);return;case"tube":e.u(Be.tube),e.u(t.points.length);for(let r of t.points)e.v3(yt(r));e.u(t.closed?1:0),e.f(t.radius),e.segments(t.segments);return;case"edges":e.u(Be.edges),e.f(t.thresholdAngle),_n(e,t.source,n);return;case"wireframe":e.u(Be.wireframe),_n(e,t.source,n);return;default:n.unsupported.add(`geometry:${t.type}`),e.u(255)}}function ka(e){switch(e.type){case"buffer":case"parametric":return"slot";case"box":return(e.cornerRadius??0)>0?"rounded":"fixed";case"edges":case"wireframe":return ka(e.source)==="fixed"?"fixed":"slot";default:return"fixed"}}function Ma(e){let t=e,n=e.type;for(let r of Object.keys(t).sort()){let s=t[r];r==="type"||r==="revision"||r==="staticData"||s===void 0||typeof s=="function"||(r==="source"?n+=`|source=${Ma(s)}`:ArrayBuffer.isView(s)||Array.isArray(s)&&s.length>3?n+=`|${r}#${s.length}`:n+=`|${r}=${typeof s=="object"?JSON.stringify(s):String(s)}`)}return n}function pu(e){return e.type!=="buffer"?[]:[e.position,e.normal,e.uv,e.color,e.index,e.computeNormals]}var _u=class{next=1;byKey=new Map;slots=new Map;live=new Set;nth=new Map;defs=new xa;count=0;begin(){this.live.clear(),this.nth.clear(),this.defs.n=0,this.count=0}end(e){e.u(this.count),e.append(this.defs);for(let[t,n]of this.byKey)this.live.has(n)||this.byKey.delete(t);for(let[t,n]of this.slots)this.live.has(n.id)||this.slots.delete(t)}ref(e,t,n,r){let s=this.defs,i=ka(e);if(i!=="slot"){let _;if(i==="rounded"){let L=e;_=`rounded|${L.width}|${L.height}|${L.depth}|${L.cornerRadius}|${JSON.stringify(L.segments)}`;let V=this.byKey.get(_);if(V!==void 0)return this.use(V)}let w=s.n;s.u(0),_n(s,e,r),_??=s.key(w+1);let A=this.byKey.get(_);if(A!==void 0)return s.n=w,this.use(A);let B=this.add(w);return this.byKey.set(_,B),B}let a=`${t}|${n}|${Ma(e)}`,o=this.nth.get(a)??0;this.nth.set(a,o+1);let l=`${a}|${o}`,c=this.slots.get(l),u=e.revision,f=pu(e);if(c&&c.revision===u){if(e.type==="parametric"&&u!==void 0)return this.use(c.id);if(e.type==="buffer"&&(u!==void 0||e.staticData===!0)&&f.every((_,w)=>_===c.arrays[w]))return this.use(c.id)}let d=s.n;if(s.u(0),_n(s,e,r),c&&s.same(d+1,c.words))return s.n=d,c.revision=u,c.arrays=f,this.use(c.id);let p=this.add(d);return this.slots.set(l,{id:p,revision:u,arrays:f,words:s.copy(d+1)}),p}use(e){return this.live.add(e),e}add(e){let t=this.next++;return this.defs.set(e,t),this.count++,this.use(t)}},vi={clamp:0,repeat:1,mirror:2};function Rr(e,t){if(e===void 0)return[t,t];if(Array.isArray(e))return[e[0]??t,e[1]??t];let n=e;return[n.x??t,n.y??t]}function xi(e,t,n,r){if(t===void 0||!n){t!==void 0&&r.unsupported.add("texture:map"),e.u(0),e.u(0),e.f(1),e.f(0),e.f(0),e.f(0),e.f(1),e.f(0),e.u(0);return}let s=Gi(t),i=s.colorSpace!=="linear";e.u(1),e.u(n.id(t,i));let[a,o]=Rr(s.offset,0),[l,c]=Rr(s.repeat,1),[u,f]=Rr(s.center,0),d=(s.rotation??0)*Math.PI/180,p=Math.cos(d),_=Math.sin(d);e.f(l*p),e.f(l*_),e.f(-l*(p*u+_*f)+u+a),e.f(-c*_),e.f(c*p),e.f(-c*(-_*u+p*f)+f+o);let w=s.flipY??!("data"in s);e.u((vi[s.wrapS??"clamp"]??0)|(vi[s.wrapT??"clamp"]??0)<<2|(w?16:0)|(s.magFilter==="nearest"?32:0)|(s.minFilter==="nearest"?64:0))}function nn(e,t,n,r){let s=t;e.u(cu[t.type]??1),["basic","standard","physical","lambert","phong","normal","lineBasic","lineDashed","sprite","shadow","points","toon","depth"].includes(t.type)||n.unsupported.add(`material:${t.type}`);for(let a of du)a!=="map"&&a!=="gradientMap"&&s[a]!==void 0&&n.unsupported.add(`texture:${a}`);s.gradientMap!==void 0&&t.type!=="toon"&&n.unsupported.add("texture:gradientMap");for(let a of["sheen","iridescence","anisotropy","dispersion"])typeof s[a]=="number"&&s[a]>0&&n.unsupported.add(`physical:${a}`);e.color(s.color),e.f(s.opacity),e.f(s.roughness),e.f(s.metalness),e.color(s.emission),e.f(s.emissionStrength),e.f(s.envMapIntensity);let i=0;s.transparent===!0&&(i|=1),s.wireframe===!0&&(i|=4),s.vertexColors===!0&&(i|=8),s.shading==="flat"&&(i|=16),s.toneMapped===!1&&(i|=32),s.visible===!1&&(i|=64),s.depthTest===!1&&(i|=128),s.depthWrite!==void 0&&(i|=256|(s.depthWrite?512:0)),s.sizeAttenuation===!1&&(i|=1024),e.u(i),e.u(uu[s.faces??"front"]??0),e.u(fu[s.blend??"normal"]??0),e.f(s.alphaTest),e.f(s.size),e.color(s.specular),e.f(s.shininess),xi(e,s.map,r,n),e.f(s.clearcoat),e.f(s.clearcoatRoughness),e.f(s.transmission),e.f(s.thickness),e.f(s.ior),e.f(s.attenuationDistance),e.color(s.attenuationColor),e.f(s.dashSize),e.f(s.gapSize),e.f(s.scale),xi(e,t.type==="toon"?s.gradientMap:void 0,r,n)}function mu(e,t,n){let r=t;e.u(lu[t.type]??0),e.color(r.color),e.f(t.intensity),e.color(r.sky),e.color(r.ground),e.f(r.distance),e.f(r.decay),e.f(r.angle),e.f(r.penumbra);let s=r.target;e.u(s===void 0?0:1),e.v3(yt(s));let i=r.shadow,a=i===void 0?null:ac(i);e.u(a?1:0),e.f(a?.softness),e.f(a?.extent),e.f(r.width),e.f(r.height),qe(e,n)}function gu(e,t){e.u(t.type==="orthographic"?1:0);let n=rc(t);qe(e,{...t,position:n.position,lookAt:n.lookAt}),e.f(t.type==="perspective"?t.fov:void 0),e.f(t.zoom),e.f(t.type==="orthographic"?t.frustumHeight:void 0),e.f(t.near),e.f(t.far),e.f(t.distance)}function bu(e,t={unsupported:new Set},n,r){let s=new xa;r?.begin();let i=[""],a=(d,p)=>{if(!r)return _n(s,d,t);s.u(16),s.u(r.ref(d,i[i.length-1],p,t))};s.u(su),s.u(3);let o=e.toneSettings();s.u(au[o?.mapping??"aces"]??4),s.f(o?.exposure);let l=e.shadowSettings();s.u(l?.enabled===!0?1:0),s.u(l?.quality==="low"?0:l?.quality==="high"?2:1);let c=e.fogDescriptor();s.u(c?c.density!==void 0?2:1:0),s.color(c?.color),s.f(c?.near),s.f(c?.far),s.f(c?.density);let u=e.environmentDescriptor();s.u(u?.preset==="studio"?1:0),s.f(u?.intensity),s.u(u?.background?1:0),s.f(u?.blur),e.postEffects().length>0&&t.unsupported.add("post");let f=e.ops();s.u(f.length);for(let d of f)switch(d.kind){case"push":{let p=d.transform?.key;i.push(p===void 0?`${i[i.length-1]}/${i.length}`:String(p)),s.u(1),qe(s,d.transform);break}case"pop":i.length>1&&i.pop(),s.u(2);break;case"light":s.u(3),mu(s,d.light,d.transform);break;case"camera":s.u(4),gu(s,d.camera);break;case"mesh":{s.u(5),a(d.geometry,d.kind);let p=Array.isArray(d.material)?d.material:[d.material];s.u(Array.isArray(d.material)?p.length:1);for(let _ of p)nn(s,_,t,n);qe(s,d.transform);break}case"instances":{s.u(6),a(d.geometry,d.kind),nn(s,d.material,t,n),qe(s,d.transform),s.u(d.instances.length);for(let _ of d.instances)qe(s,_);let p=d.colors??[];s.u(p.length);for(let _ of p){let[w,A,B,L]=typeof _=="string"?Wi(_):_;s.f(w),s.f(A),s.f(B),s.f(L??1)}break}case"points":s.u(7),a(d.geometry,d.kind),nn(s,d.material,t,n),qe(s,d.transform);break;case"line":s.u(8),a(d.geometry,d.kind),nn(s,d.material,t,n),s.u(d.mode==="segments"?1:d.mode==="loop"?2:0),qe(s,d.transform);break;case"sprite":s.u(9),nn(s,d.material,t,n),qe(s,d.transform);break;case"model":t.unsupported.add("model"),s.u(10),qe(s,d.transform);break}return r?r.end(s):s.u(0),s.result()}var Se={CREATE:1,DESTROY:2,CHILDREN:3,TRANSFORM:4,SIZE:5,RADII:6,FILL:7,STROKE:8,SHADOWS:9,OPACITY:10,BLEND:11,CLIP:12,FILTER:13,PATH:14,MEMBERS:15,MASK:16,TEXT:17,EFFECTS:18,TRANSFORM3:19,DEF_PAINT:20,DEF_PATH:21,DEF_DASH:22,FREE_PATH:24,ROOT:30,VIEWPORT:31},mt=4294967295,wu=class{sink;memory;u32;f32;pos=0;cap=0;written=0;constructor(e,t){this.sink=e,this.memory=t,this.refresh(0)}refresh(e){let t=this.sink.delta_buffer(e);this.cap=this.sink.delta_capacity(),this.u32=new Uint32Array(this.memory.buffer,t,this.cap),this.f32=new Float32Array(this.memory.buffer,t,this.cap)}begin(e){this.u32.buffer!==this.memory.buffer&&this.refresh(0),this.pos+e>this.cap&&(this.flush(),e>this.cap&&this.refresh(e))}u(e){this.u32[this.pos++]=e>>>0}f(e){this.f32[this.pos++]=e}flush(){this.pos>0&&(this.written+=this.pos,this.sink.apply(this.pos),this.pos=0),this.u32.buffer!==this.memory.buffer&&this.refresh(0)}takeCount(){let e=this.written;return this.written=0,e}},yu=oe({MAX_PARAMS:()=>64,definePort:()=>ce,fieldFloats:()=>Sa,layout:()=>Ta}),ki={f32:1,vec2f:2,vec3f:3,vec4f:4},Sa=e=>typeof e=="string"?ki[e]:e.array*ki[e.of],Ea={number:"f32",boolean:"f32",enum:"f32",color:"vec4f",vec2:"vec2f",axis:"vec2f"};function vu(e,t){switch(e.kind){case"number":return t;case"boolean":return t?1:0;case"enum":return Math.max(0,e.options.indexOf(t));case"color":return Mt(t);case"vec2":{let n=t;return[n.x,n.y]}case"axis":{let n=kt(t);return[n.x,n.y]}default:throw new Error(`effect param "${e.name}" (${e.kind}) has no default encoding; give it a value()`)}}function Aa(e,t){let n=Yo(e)?.params.find(r=>r.name===t);if(!n)throw new Error(`effect "${e}": "${t}" is not a parameter of its core spec`);if(!Ea[n.kind])throw new Error(`effect "${e}": "${t}" (${n.kind}) has no default encoding`);return n}function Ta(e){let t=0,n=Object.entries(e.params).map(([r,s])=>{let i=s==="param"?Ea[Aa(e.type,r).kind]:s.type,a=Sa(i),o={name:r,type:i,offset:t,floats:a};return t+=a,o});if(t>64)throw new Error(`effect "${e.type}" lays out ${t} params; a pass takes 64`);return n}function ce(e){let t=Ta(e),n=t.reduce((s,i)=>s+i.floats,0),r=t.map(s=>{let i=e.params[s.name];if(i!=="param")return i.value;let a=Aa(e.type,s.name);return o=>vu(a,o[s.name])});return{type:e.type,surface:e.surface,backdropOnly:e.backdropOnly,spec:e,cases:e.cases,pack(s){let i=e.prepare?e.prepare(s):{};if(i===null)return null;let a=new Array(n).fill(0);return t.forEach((o,l)=>{let c=r[l](s,i),u=typeof c=="number"?1:c.length;if(u>o.floats)throw new Error(`effect "${e.type}": "${o.name}" is ${u} floats, laid out as ${o.floats}`);if(typeof c=="number")a[o.offset]=c;else for(let f=0;f<u;f++)a[o.offset+f]=c[f]}),{params:a,...e.extras?e.extras(s,i):{}}}}}var xu=oe({default:()=>ku}),ku=ce({type:"alpha",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},value:e=>[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,Math.max(0,Math.min(1,e.amount)),0]}},cases:()=>[]}),Mu=oe({default:()=>Pu}),Su="Inter",Eu=e=>typeof document<"u"&&document.fonts.check(`12px "${e}"`),Au=e=>Math.max(4,Math.min(64,Math.round(Math.max(8,e*2)))),st=1;function Tu(e,t,n){let r=[...e].slice(0,256),s=n*st,i=new OffscreenCanvas(s*r.length,s),a=i.getContext("2d",{willReadFrequently:!0});a.fillStyle="#000",a.fillRect(0,0,i.width,i.height),a.fillStyle="#fff",a.font=`${n*.8*st}px "${t}"`,a.textBaseline="alphabetic",a.textAlign="left",a.fontKerning="none",r.forEach((u,f)=>{let d=a.measureText(u).width;a.fillText(u,f*s+(s-d)/2,s*.78)});let o=a.getImageData(0,0,i.width,i.height).data,l=n*r.length,c=new Uint8ClampedArray(l*n*4);for(let u=0;u<n;u++)for(let f=0;f<l;f++){let d=0;for(let w=0;w<st;w++)for(let A=0;A<st;A++)d+=o[((u*st+w)*i.width+f*st+A)*4];let p=d/(st*st),_=(u*l+f)*4;c[_]=c[_+1]=c[_+2]=p,c[_+3]=255}return{glyphs:r.length,pixels:c,width:l}}var Pu=ce({type:"ascii",surface:"shader",params:{size:"param",glyphs:{type:"f32",uses:["charset","fontFamily"],value:(e,t)=>t.atlas.glyphs},cell:{type:"f32",value:(e,t)=>t.cell},ink:"param",background:"param",colored:"param"},prepare(e){let t=nc(e.charset);if(t.length===0)return null;let n=Eu(e.fontFamily)?e.fontFamily:Su,r=Au(e.size);return{family:n,cell:r,charset:t,atlas:Tu(t,n,r)}},extras:(e,t)=>({aux:{key:`ascii|${t.family}|${t.cell}|${t.charset}`,width:t.atlas.width,height:t.cell,pixels:t.atlas.pixels}}),cases:()=>[E.ascii().list[0],E.ascii({size:10,charset:"hex",fontFamily:"Fira Mono",ink:"#6f6",background:"#001",colored:!1}).list[0],E.ascii({size:14,colored:!0,background:"transparent",ink:"white"}).list[0],E.ascii({size:8,ink:"black",background:"white",charset:" .oO@"}).list[0]]}),Iu=oe({default:()=>Ou}),Ru={gameboy:["#0f380f","#306230","#8bac0f","#9bbc0f"],cga:["#000000","#55ffff","#ff55ff","#ffffff"],nes:["#000000","#fcfcfc","#bcbcbc","#7c7c7c","#0000fc","#0078f8","#3cbcfc","#a4e4fc","#b8f818","#00b800","#005800","#f83800","#e40058","#f878f8","#f8b800","#503000"]},Cu=e=>{let t=parseInt(e.slice(1),16);return[16,8,0].map(n=>Number(((t>>n&255)/255).toFixed(4)))},Ou=ce({type:"bitCrush",surface:"shader",params:{bits:"param",amount:"param",count:{type:"f32",uses:["palette"],value:(e,t)=>t.palette.length},palette:{type:{array:16,of:"vec3f"},value:(e,t)=>t.palette.flatMap(Cu)}},prepare(e){return!(e.amount>0)||e.palette==="none"&&e.bits>=8?null:{palette:e.palette==="none"?[]:Ru[e.palette]}},cases:()=>[E.bitCrush().list[0],E.bitCrush({palette:"gameboy"}).list[0],E.bitCrush({palette:"nes",amount:.7}).list[0],E.bitCrush({palette:"cga"}).list[0]]}),Du=oe({default:()=>Lu}),Lu=ce({type:"blockDisplace",surface:"shader",params:{amount:"param",size:"param",density:"param",seed:"param",axis:"param"},prepare(e){if(!(e.amount>0)||!(e.density>0))return null;let t=kt(e.axis);return t.x===0&&t.y===0?null:{}},extras(e){let t=kt(e.axis);return{reach:e.amount*Math.max(Math.abs(t.x),Math.abs(t.y))}},cases:()=>[E.blockDisplace().list[0],E.blockDisplace({amount:40,size:10,density:.6,seed:3}).list[0],E.blockDisplace({amount:30,size:24,axis:"y",seed:1}).list[0]]}),Fu=oe({default:()=>Bu}),Bu=ce({type:"bloom",surface:"filter",params:{scale:{type:"f32",uses:["threshold"],value:(e,t)=>t.scale},bias:{type:"f32",value:(e,t)=>-t.t*t.scale},intensity:"param"},uses:["radius"],prepare(e){if(e.radius<=0||e.intensity<=0)return null;let t=Math.max(0,Math.min(1,e.threshold));return{t,scale:t<1?1/(1-t):1,sigma:e.radius/2}},extras:(e,t)=>({blur:[t.sigma,t.sigma,0],reach:3*t.sigma}),cases:()=>[E.bloom().list[0],E.bloom({threshold:.4,radius:24,intensity:1.5}).list[0],E.bloom({threshold:0,radius:6,intensity:.6}).list[0]]}),$u=oe({default:()=>Uu}),Uu=ce({type:"blur",surface:"filter",params:{},uses:["radius"],prepare:e=>e.radius>0?{}:null,extras(e){let t=e.radius/2;return{blur:[t,t,0],reach:3*t}},cases:()=>[E.blur(8).list[0],E.blur(24).list[0],E.blur(2).list[0]]}),Nu=oe({default:()=>ju}),ju=ce({type:"bulge",surface:"shader",params:{strength:"param",center:"param"},prepare:e=>e.strength===0?null:{},extras(e){let t=2*Math.hypot(e.center.x-.5,e.center.y-.5)*360;if(e.strength<0){let n=e.strength*.8,r=1;for(;r<4&&r*(1+n*r*r)/(1+n)>-1;)r+=.01;t=Math.min((r-1+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}return{reach:t}},cases:()=>[E.bulge(.6).list[0],E.bulge(-.7).list[0],E.bulge({strength:.9,center:{x:.3,y:.6}}).list[0]]}),Wu=oe({default:()=>Gu}),Vu=[1.4,-.2,-.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],zu=[0,0,0,0,0,0,0,0,0,0,-.2,-.2,1.4,0,0,0,0,0,1,0],Gu=ce({type:"chromaticAberration",surface:"filter",params:{red:{type:{array:20,of:"f32"},value:()=>Vu},blue:{type:{array:20,of:"f32"},value:()=>zu},offset:{type:"vec2f",uses:["amount","angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t)*e.amount,Math.sin(t)*e.amount]}}},prepare:e=>e.amount<=0?null:{},extras:e=>({reach:e.amount}),cases:()=>[E.chromaticAberration().list[0],E.chromaticAberration({amount:8,angle:45}).list[0],E.chromaticAberration({amount:2.5,angle:200}).list[0]]}),Hu=oe({default:()=>Ju}),vt=.2126,at=.7152,nt=.0722;function Ku(e,t){let n=new Array(20).fill(0);for(let r=0;r<4;r++)for(let s=0;s<5;s++){let i=0;for(let a=0;a<4;a++)i+=e[r*5+a]*t[a*5+s];s===4&&(i+=e[r*5+4]),n[r*5+s]=i}return n}var rn=(e,t)=>[e,0,0,0,t,0,e,0,0,t,0,0,e,0,t,0,0,0,1,0],Mi=(e,t,n)=>[1,0,0,0,e,0,1,0,0,t,0,0,1,0,n,0,0,0,1,0];function Si(e){let t=1-e;return[e+t*vt,t*at,t*nt,0,0,t*vt,e+t*at,t*nt,0,0,t*vt,t*at,e+t*nt,0,0,0,0,0,1,0]}function qu(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return[vt+n*(1-vt)+r*-.2126,at+n*-.7152+r*-.7152,nt+n*-.0722+r*(1-nt),0,0,vt+n*-.2126+r*.143,at+n*(1-at)+r*.14,nt+n*-.0722+r*-.283,0,0,vt+n*-.2126+r*-.7874,at+n*-.7152+r*at,nt+n*(1-nt)+r*nt,0,0,0,0,0,1,0]}var Ju=ce({type:"colorAdjustment",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["brightness","contrast","saturation","hue","vibrance","temperature","tint","shadows","highlights"],value:(e,t)=>t.matrix}},prepare(e){let t=rn(1,0),n=!1,r=p=>{t=Ku(p,t),n=!0},s=e.brightness??0;s!==0&&r(rn(1,s));let i=e.contrast??1;i!==1&&r(rn(i,.5*(1-i)));let a=e.saturation??1;a!==1&&r(Si(a));let o=((e.hue??0)%360+360)%360;o!==0&&r(qu(o));let l=e.vibrance??0;l!==0&&r(Si(1+l*.7));let c=e.temperature??0;c!==0&&r(Mi(c*.1,0,-c*.1));let u=e.tint??0;u!==0&&r(Mi(u*.05,-u*.1,u*.05));let f=e.shadows??0;f!==0&&r(rn(1-.2*f,.2*f));let d=e.highlights??0;return d!==0&&r(rn(1+.2*d,-.1*d)),n?{matrix:t}:null},cases:()=>[E.colorAdjustment({brightness:.1,contrast:1.3,saturation:1.4}).list[0],E.colorAdjustment({hue:120,vibrance:.5}).list[0],E.colorAdjustment({temperature:.6,tint:-.4,shadows:.5,highlights:-.5}).list[0],E.colorAdjustment({contrast:.6,saturation:0}).list[0]]}),Yu=oe({default:()=>Xu}),Xu=ce({type:"colorMatrix",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},value:e=>Array.from(e.matrix).slice(0,20)}},cases:()=>[]}),Zu=oe({default:()=>nf}),Hn=32;function Qu(e,t){if(e.length===0)return t;if(t<=e[0][0])return e[0][1];let n=e[e.length-1];if(t>=n[0])return n[1];for(let r=0;r<e.length-1;r++){let[s,i]=e[r],[a,o]=e[r+1];if(t>=s&&t<=a)return i+(o-i)*(a===s?0:(t-s)/(a-s))}return t}function ef(e){let t=[...e].sort((r,s)=>r[0]-s[0]),n=[];for(let r=0;r<=Hn;r++){let s=Qu(t,r/Hn);n.push(Number.isFinite(s)?Math.max(0,Math.min(1,s)):r/Hn)}return n}var tf={r:[1,0,0,0],g:[0,1,0,0],b:[0,0,1,0],a:[0,0,0,1]},nf=ce({type:"curves",surface:"shader",params:{mask:{type:"vec4f",uses:["channel"],value:e=>tf[e.channel??"rgb"]??[1,1,1,0]},curve:{type:{array:33,of:"f32"},uses:["points"],value:(e,t)=>t.values}},prepare(e){let t=ef(e.points??[]);return t.every((n,r)=>Math.abs(n-r/Hn)<1e-4)?null:{values:t}},cases:()=>[E.curves({points:[[0,0],[.25,.15],[.75,.88],[1,1]]}).list[0],E.curves({points:[[0,.2],[.5,.7],[1,1]],channel:"r"}).list[0],E.curves({points:[[0,0],[.6,.3],[1,.8]],channel:"a"}).list[0]]}),rf=oe({default:()=>sf}),sf=ce({type:"directionalBlur",surface:"filter",params:{sigma:{type:"f32",uses:["radius"],value:(e,t)=>t.sigma},axis:{type:"vec2f",uses:["angle"],value:(e,t)=>[Math.cos(t.rad),Math.sin(t.rad)]}},prepare:e=>e.radius<=0?null:{sigma:e.radius/2,rad:e.angle*Math.PI/180},extras:(e,t)=>({blur:[t.sigma,0,t.rad],reach:3*t.sigma}),cases:()=>[E.directionalBlur(20).list[0],E.directionalBlur({radius:30,angle:45}).list[0],E.directionalBlur({radius:12,angle:100}).list[0],E.directionalBlur({radius:120,angle:-20}).list[0]]}),af=oe({default:()=>uf}),of="e8yOVglJi3jaB+U3jl3KakXertJzm985bcTcngPJTPc8ddJT6mIl7ztdoQdH8wxyKr6F1wCTXqg8aZ50OCCKRakgO9+09jbERrJS0AzsM7J9JxY+6i5arBCOK3w3qXHAXOWPG4DYqhCT3HXpkSay25w//61F4y53670E4MOiZtlQ/51iK5hqGewpmmeAvRmQ516kirgCftDuUbn5YOcTLZ0ORqXDOHhRshw0VcBmglDGCV0he6MZyUyQLFmCDewWwG4DzYQO0qVdhv4gQqRT0gfB/2xP8p8+HWmaC0SRuOCAyP0rWwj4yGrxz6oV+jcc72+Wu9RU74cQ27LyR886kieB5Eu58D962ACryeNs+Dx0Sy8SyiRfvIvmJ8XXax1UOGKvct+YgyhCiQB7RZbVrYtG3jUMaz63cDplGZxxsGDuP6cadVkgvTBNcjgRliaEtZvggJfcdArTS3WrNIP4n9ADjBm5RugUuqBh58tuDl3nJaSB+MifJf+ojcgp+QrUFI/EL96wjPmZ4cCMYNnDC/EfWr40Ra/7MKQQ8VEItSl47lDWNWWn0Vj8Oh6jLbw+ewPATReSWwPUUg/mXYVMnm1T+mWbEEdsDFoe964yVaZHz24F9IkaWH7LXojamGPiP74jmfQFdC2TC8SGUduK9KnQYuZ3N+2+fzZ2rD3cvzC00waFO8nqKdGmekUFf+1rjzHonLZk4JlC6xe6I0PIFo9srVp/weNNfddoru8FZhlSMZcfttdrK5rqvSCVAnbnQ3wovORffbSJOee33Jkhyw6sfBZPKsgAsyyea/57qlb3Cc84Fa8hnfUYSSV4QcaR2XD3QaJTFbBKDF76zVaoG5r1qEwdoQJQ8hVfJ21Psz71Vtw90oZz6GGGTs43AtUtoEnhiP9FbMk5tJjou5v9LbQPhsgHfPvMhNxxRIIv8WEKN2rZj/42w26dzY7EFuVjhyi6ZvumHzy+9RSrjeZph8B2KKNh1I0LXd1wCTNaG35I6idh4pUjYjuiKK8TwI3P4onID1p0qyHgPwf/NXybAceiGJEJwkufDGrdJlW2Qx/yElXDAjGo8CiJTsuE3ahkzZirTbk02qwD9Y7T625MJndEsCvnQNORXLaFU6nZRflxN+x6MV7wgteWQHf2D57eXrGV6XffSnDDrhz4QsEU5zUBbvYSdUmIwk8XXTkForsY8GKfvxiACfYrb+kRZyu0WNhKzJjesSpZHLHKiWTBNIDWLUQetJYPPeRhoCZqk0+1hNg7ksrzGm7lfcWqh/xamdUFek7yY8RMotMjwIPOG44LsGsaRAFuwvlPBTHtF5NIBm31gstf+4GZA3q38Al1+x1YsSVioC+wPZwn30fOMbM+j+Eyl6053g6QPp5N6KV38yaf/X7Okjh6mtmndFLN+6nBmlIVNNIkVMjgTjKlz0HDnOt9C+JZ1Qj0ZRlyDIL3HVa8EdEfiWu7VnbxBGE2wkVivzJYqeAR6idgQOG5JXlcGznjr45xte07II/WXIkrbA9J1L1DkHa+UoW17MNj0HuoaP51VOku+hrXtiiL1RCW3QmM6hdLZ72LshyGDqE96YjVZALxRBOfZK9zDuwYqvKOMmmlJ/EWmCvYPJ0kSQI27CZGk8IBqXuYOGmo/nBP7Xk80G8oxqE9B/zQaOxW0gq8KH6gxVveegn3x0i4ft1QzLD9BoRjzkf9qhRWi67jlcaDDLU01V5Fyw/kQxm5LK0cpE23kPd/3Fd4Rp41iq9smFH/PR6HLr6TVTSfImY7AHUeV5njNa5xAWF9yfNxYBtQ26DlbIoi7LSMVn2Z0FuE2mXzBThdEi/Kqya+BPcgQusUs3DXqu1G1Bziif3Kmr2K5zDWScEg5oy74DIPQKC+dDpdGUv1owhtLdPsATzwDcAjmXjSnuJvkBnogVvXdsVfzTOUVAdlI3KtXXYNUyvzQWC4chSBWqE5Th2Us9so8Aez+Y3IL37fTZ8eumGxdJQ0WN9DuiFJtPBSask9lCykC4XkGfbDm4X6AM8wqNl/FqXODJKs9NIN7sxt+lh7SIrWLnqqDGS3OcL0c0SIJNZL+KyBFGr9hwA6nw2o5RK5+k1qrUd9Mdw8tk2N70G3W+RuJvpRLmpClSqBpjoG0BlqnFYe6kjZjxZdkg3L/aQQwm0Ey+szplzZxIX6Jk9nfzuZ3ie/Y6oMXMsXom0fkwfCSZ14vOEbs3TDVRfWjqzE/j250W+aJv130SmuVzdo5iqQP6BUjb8beSxIb7iQ0eofywKJ8RXnknTyLV/gx3r3MoveAj2CzFn+Aea3aelcgQ7aiAM1xlgJoT3vg+Eam4JXutkicQviTvWx1BXiNwdXrndfQJ9PzSRGp4G4DFE8q2kesFvupBCMNZxIhh1BLLVSJaRg9oKt42i9TQJrv9Q9+RZ68KzRKJppCY5bpHzElzP1vdotbYS14RnUN/6e2BXsxTfTbSlO161wJtyj9pVr7nfkQ7QZRy5/F9qUpyhTCK1jmks2ZoQ/6Kc08iFH/WwYS40OqfQGOmWWVG6MJWKBl1F8Epi/82Uc68ZUdQTIGjeXwRNy35HJ87BgM+564pHNLOgBvv2xD8hQfsxlsxHUouMlfblZksf5EMLsAK/HPgjgqPxHhwa1PYMQtDTZSuCxB0/SM6JiBlAjh8xIFbJpQ4DGX5EYVdtvJLoC3pAvf1rDZ+041CBKc6YoRnjkU/S2LGYgyTZ44pxM9JFgp4hYfPNmjf8dvOhxof4IvFv3Id4OqTHge6EzivqXPnVS6aw8AZZHEnib2jODt9KTNRuLdddMkuerXCXOayvWDP8izj+lKbh4Vz+IMNRAZ55/NoqeT/hxRCLrwkoVYOykDcci+XLepcH9XrME8VoRZtupWxCdwABsGPWMC7ehfENyuwrlGNdGAsfdpg26fRzsxA/Wb70alNa0Zgec17Ah0DeVVobNKVWIMBrib5Q96aAnvv5A4zB/01G8P91XG8foLZltkVp/oPCUJ2brWZfcK1OqQfEuXMUMiFL0ey5yU4T1br4RQrEK6mxAn0zEIbt5SIAYb69e+JoteaZp+TuMXa9MxST7uzNeFn21OxXJRXWSz2UCrX7jPKYnuUDlxQS1SBfcnfBmkdW2gM4N+4hYBvDHltEKjUQRx+gFJoK+CNIY9IKrQwtz58xL+4tw8aUJ+COF6ZdGIPxw2oQaomGT2CqqYTF8wiNNFvMqrmQ13aNoIjdW7ijbpWRLktirUO12njkDZsrdjK8rowXFJFUyv188uhjLZLOPVwDHS/sUOu10kP9RBN86pGKXVHrllhvOQa7jgbVrv30h+7U1bh2UKmHW7ZYuWB1Fbt1anOa2h+Kb23hSMeEL0C/vZ6+JcMtMCbshyY2ub+rJBtg7EcFRg/d2AqE/F1LkOogTWfHPROO8TyJ15qPB8ROHN3lGDWkfTAWx+qCIdEqlkzof2iydsFvZhELoVRKDMriK+KJvK7oTWccq/s+bBKvNc7+bBLJ7EqdCug06Y5XPsfUX06f6fNCQKmAWO/HCEuR2u1TqEHz2M2kXnSu9/ElxImBH0+iVOuCYaU6McPBiQ+EsTYZoMfWLZ/6I1nsCTi5nwJJZL7k77nLK3rdoKIVZ0weXZcVDHZK48HnYYJUY4bDMAIQfZbJ/HNS3EzK9JJYNqPcf38FWz6AXUKsl+KR/4SQ/6wqfXhKmQo8DU63/HadH9jCL4abVSgypPgDMplSRNO+nPvkKTO03efVI24DrVXjRkECYByneM8Bf3D+8Ww6vhG/LiOXEUyN37ZnZcDLBfRa1cQRfK3TIV/aHazjzDna+TnDLmsFipwaTsFwWrMkyZRFcruuDs3jpCXGOFdSX/1DaHUosef+y0S9BFU2O212f0E/9v4btH5kvu+Igg8ZfJI7dGTOHIdhVzCJzkUEA76C7/DVsSA6UQ57JMO9IczQEs2ScuAWVGGOJus2k6gQ87h80nRQ9sWLedxJSrkHaoOkIq1zjbP9BgeY4xv+5bIlLKXvIHtL0ZSP5Ua1qHsyj54s59tVAa+FK9Ah8YSZ4uZBjhNpX5Y8GR6vWj/9rF1E5wX5CsgSduhJpowlYLd8czuMGj6JUMbjXfQ+K37eBYCnGeg9bjMGpKp5V5zis+UwT4sRzqCNq+sgiYTUFmLaF92gq74rQWC6V8ErZeZlHp3RZr0DmdYkDoT7GLFgIQPMWVOCtIu02C3bKHJPXDWfOoUMqAUnTtjiAou19w+QvzQ6U1hNOIuh3wx6GsRTK7wrCM/JoEcRO6Vtw45n8qNWPv5w0a89/U9f7X7dGgMSYJXv2s5TueBOaVAvSQlcdYHZGtFefx22qQNxhMfZlJYFflx6K2CeqNs4hshI5dB9mL3MB/EahEbiUPoct7BhZPOYJVW01ylct88BtJ7KDnfOq4CH8fzXyFIkAodFEkbw41PpDu1F+/mSWgfZPwIfKSO6xWsONKvJkHq4C251x/b2IptjBEYKj24VF3ZD7D9E2AYo8agi2lFm8/E5/Ct+jUxGtdgHPmxSvCkKi2mEF5KER2IIc3XbJSeVzxmhPrA8sYz8dl0r8IGMEqBk4ZE25clS/06TlSiThNmqwKcVvHuqNZealOW7gx+95LxuTtzFYkic/qFUKOaeGMfgbNs1+3bL0eeNnszrOvHLtxqXhIpTuFnkqXsNzzoMb645c9EJ7zDAgWvYaSyRcuMxw8EV++2/I6Wn3vZPcDVubvY3yRJkBVirLCIvoUZYlWXsGhkTXY5xC848arAWdQdMPty6pBbhL25PAd4w/lAHmU6kMxRqxTgaXMHlQJLnrQ3UIYCNs0Ye6Rp8uehf4QtWeL/WtCy7NtgrYRftj51amck3Wkl7+noAIL6za/qZsOyGD2mScNonftR3T72Z+qyXK5KO/6zKlE/ld0appsoITu09oxXb6UoVno3cwix7CLPqDGOdzORXJaulRFH0p1bSb+EEl0/MTXn5IpAQ9zRBXlTJOEnxJ4WaBG+RIAN408m7mEDyRpho47CTLtEzba5IDxkCzIr9U8T6b0GPFS+5bE262jlVyujvK/W3EnOWL/GjUg/i2HJbFO7WRJ8aaTY8mqYXOI1/ZwJdXB/KaDrg+32edWYzZfKkghg2yH4wHgMIz6gOsH+mbCi2NGl4sSh67A6oob9VWBu5xUvx6XdELwlrdSvG0AXNE4oJiNnT3V6ww6g/1MwZnvE73OuKj0UWW1lB8z0SHZN2xU+u3c9yjeT7lX5w16IsppRG5Ohyl5HUyF6B5No38FafDGrDQIoATkM9xRKLK5jDVlXJSaDD5HGcpofsuxhVJetI5hBLFMfSQUMwKrne7QdJi24bvaEGK/LhoDuVQr2ctQN+KSaLpx0wmhbpYjhSAXgOu7hC8d6fkvhRclXCr9iOgAPmVUGMNviCG/kkbXPKCI5gIsCm9A5pHzYW/JNV+ypha7xBkMm22+AvYIf1Ks/LHLA==",cf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ut=64,Cr=null;function lf(){if(Cr)return Cr;let e=of.replace(/[^A-Za-z0-9+/]/g,""),t=new Uint8Array(e.length*3>>2),n=0,r=0,s=0;for(let a=0;a<e.length;a++)n=n<<6|cf.indexOf(e[a]),r+=6,r>=8&&(r-=8,t[s++]=n>>r&255);let i=new Uint8ClampedArray(Ut*Ut*4);for(let a=0;a<Ut*Ut;a++)i.fill(t[a],a*4,a*4+3),i[a*4+3]=255;return Cr=i}var uf=ce({type:"dither",surface:"shader",params:{levels:"param",scale:"param",monochrome:"param",noise:"param",matrix:{type:"f32",value:e=>e.matrix}},prepare:e=>e.levels>=256?null:{},extras:e=>({aux:e.noise==="blue"?{key:"dither-blue-noise",width:Ut,height:Ut,pixels:lf()}:void 0}),cases:()=>[E.dither().list[0],E.dither({levels:4,matrix:8,scale:2,monochrome:!0}).list[0],E.dither({noise:"blue",levels:3}).list[0],E.dither({matrix:2,levels:6,scale:3}).list[0]]}),ff=oe({default:()=>df}),df=ce({type:"dropShadow",surface:"shader",params:{offset:{type:"vec2f",uses:["offsetX","offsetY"],value:(e,t)=>[t.ox,t.oy]},sigma:{type:"f32",uses:["blur"],value:(e,t)=>t.sigma},color:"param",spread:{type:"f32",value:(e,t)=>t.spread}},prepare(e){if(Mt(e.color)[3]<=0)return null;let t=e.offsetX,n=-e.offsetY,r=Math.max(0,e.blur)/2,s=Math.max(0,e.spread);return t===0&&n===0&&r===0&&s===0?null:{ox:t,oy:n,sigma:r,spread:s}},extras:(e,t)=>({reach:Math.hypot(t.ox,t.oy)+3*t.sigma+t.spread}),cases:()=>[E.dropShadow().list[0],E.dropShadow({offsetX:10,offsetY:10,blur:24,color:"#0008"}).list[0],E.dropShadow({offsetX:0,offsetY:0,blur:0,spread:6,color:"#f40"}).list[0],E.dropShadow({offsetX:-12,offsetY:-6,blur:40,spread:4,color:"#04f"}).list[0]]}),hf=oe({default:()=>gf}),pf=.2126,_f=.7152,mf=.0722,gf=ce({type:"duotone",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["amount","shadows","highlights"],value(e){let t=Math.max(0,Math.min(1,e.amount)),n=Mt(e.shadows),r=Mt(e.highlights),s=i=>{let a=(r[i]-n[i])*t,o=[a*pf,a*_f,a*mf,0,n[i]*t];return o[i]+=1-t,o};return[...s(0),...s(1),...s(2),0,0,0,1,0]}}},prepare:e=>e.amount<=0?null:{},cases:()=>[E.duotone().list[0],E.duotone({shadows:"#1a0b3d",highlights:"#ffcc66"}).list[0],E.duotone({amount:.5,shadows:"#003344",highlights:"#ff6699"}).list[0]]}),bf=oe({default:()=>wf}),wf=ce({type:"edges",surface:"shader",params:{strength:"param",kernel:"param",colored:"param"},prepare:e=>e.strength>0?{}:null,extras:()=>({reach:1}),cases:()=>[E.edges().list[0],E.edges({strength:2,kernel:"prewitt",colored:!0}).list[0],E.edges({strength:1.5,kernel:"laplacian"}).list[0]]}),yf=oe({default:()=>vf}),vf=ce({type:"exposure",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},value:e=>[e.amount,0,0,0,0,0,e.amount,0,0,0,0,0,e.amount,0,0,0,0,0,1,0]}},cases:()=>[]}),xf=oe({default:()=>Pf}),Ei=e=>Math.min(1,Math.max(0,e)),kf=.35,Mf=1,Sf=.1,Ef=.06,Af=.7,Tf=.3,Ai=.25,Pf=ce({type:"glass",surface:"shader",backdropOnly:!0,params:{depth:"param",refraction:{type:"f32",value:e=>Math.max(0,e.refraction/100)},spread:{type:"f32",uses:["dispersion"],value:e=>Ei(e.dispersion/100)*kf},light:{type:"vec2f",uses:["lightAngle"],value(e){let t=e.lightAngle*Math.PI/180;return[Math.sin(t),-Math.cos(t)]}},rim:{type:"f32",uses:["lightIntensity"],value:(e,t)=>t.light*Mf},shade_near:{type:"f32",uses:["splay"],value:(e,t)=>t.light*Sf*(1-Ai*t.splay)},shade_far:{type:"f32",value:(e,t)=>t.light*Ef*(1-Ai*t.splay)},shade_reach:{type:"f32",value:(e,t)=>Af+Tf*t.splay},frost:{type:"f32",value:(e,t)=>t.frost}},prepare(e){return e.depth>0?{light:Math.max(0,e.lightIntensity/100),splay:Ei(e.splay/100),frost:Math.max(0,e.frost)*.5}:null},extras:(e,t)=>({reach:3*t.frost+2,blur:t.frost>0?[t.frost,t.frost,0]:void 0,field:!0}),cases:()=>[E.glass().list[0],E.glass({dispersion:0,frost:0,depth:30}).list[0]]}),If=oe({default:()=>Cf}),Rf=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Cf=ce({type:"glow",surface:"shader",params:{channel:"param",threshold:"param",spread:{type:"f32",value:e=>Math.max(0,e.spread)},intensity:"param",tint:"param",original:"param",blend:{type:"f32",value:e=>Math.max(0,Rf.indexOf(e.blend))},count:{type:"f32",value:(e,t)=>t.colors.length},cycles:"param",phase:{type:"f32",value:e=>e.phase/360},mirror:{type:"f32",uses:["loopStyle"],value:e=>e.loopStyle==="mirror"?1:0},stops:{type:{array:8,of:"f32"},value(e,t){let n=[],r=0;for(let s=0;s<t.colors.length;s++)r=Math.max(r,Math.min(1,e.stops[s]??s/Math.max(1,t.colors.length-1))),n.push(r);return n}},colors:{type:{array:8,of:"vec4f"},uses:["color"],value:(e,t)=>t.colors.flatMap(n=>Mt(n))}},uses:["radius","axis"],prepare(e){return e.radius<=0&&e.spread<=0||e.intensity<=0?null:{colors:(e.tint==="solid"?[e.color]:e.colors).slice(0,8)}},extras(e){let t=kt(e.axis),n=Math.max(0,e.radius)/2;return{blur:[n*t.x,n*t.y,0],reach:3*n+Math.max(0,e.spread)}},cases:()=>[E.glow().list[0],E.glow({radius:12,threshold:.3,intensity:1.5,original:"front"}).list[0],E.glow({channel:"alpha",radius:20,spread:4,tint:"solid",color:"#4cf"}).list[0],E.glow({radius:30,tint:"ramp",colors:["#ff3","#f0f","#0ff"],stops:[0,.5,1],blend:"lighten"}).list[0]]}),Of=oe({default:()=>Df}),Df=ce({type:"grain",surface:"shader",params:{amount:"param",size:"param",seed:"param",colored:"param",animated:"param"},prepare:e=>e.amount>0?{}:null,cases:()=>[E.grain().list[0],E.grain({amount:.5,size:3,seed:7,colored:!0}).list[0],E.grain({amount:.15,size:2}).list[0]]}),Lf=oe({default:()=>Ff}),Or=.2126,Dr=.7152,Lr=.0722,Ff=ce({type:"grayscale",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["amount"],value(e){let t=Math.max(0,Math.min(1,e.amount));return[1-t+t*Or,t*Dr,t*Lr,0,0,t*Or,1-t+t*Dr,t*Lr,0,0,t*Or,t*Dr,1-t+t*Lr,0,0,0,0,0,1,0]}}},cases:()=>[E.grayscale(1).list[0],E.grayscale(.5).list[0]]}),Bf=oe({default:()=>$f}),$f=ce({type:"halftone",surface:"shader",params:{size:"param",angle:{type:"f32",value:e=>e.angle*Math.PI/180},shape:"param",separation:"param"},extras:e=>({reach:e.size}),cases:()=>[E.halftone().list[0],E.halftone({size:10,angle:20,shape:"line",separation:"rgb"}).list[0],E.halftone({size:12,shape:"cross",separation:"cmyk"}).list[0]]}),Uf=oe({default:()=>Wf}),Ft=.2126,Bt=.7152,$t=.0722,Nf=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];function jf(e){switch(e){case"red":return[-1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];case"green":return[1,0,0,0,0,0,-1,0,0,1,0,0,1,0,0,0,0,0,1,0];case"blue":return[1,0,0,0,0,0,1,0,0,0,0,0,-1,0,1,0,0,0,1,0];case"alpha":return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,-1,1];case"hue":return[2*Ft-1,2*Bt,2*$t,0,0,2*Ft,2*Bt-1,2*$t,0,0,2*Ft,2*Bt,2*$t-1,0,0,0,0,0,1,0];case"luminance":return[1-2*Ft,-2*Bt,-2*$t,0,1,-2*Ft,1-2*Bt,-2*$t,0,1,-2*Ft,-2*Bt,1-2*$t,0,1,0,0,0,1,0];default:return[-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,1,0,0,0,1,0]}}var Wf=ce({type:"invert",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["channel","strength"],value:(e,t)=>t.matrix}},prepare(e){let t=Math.max(0,Math.min(1,e.strength));if(t===0)return null;let n=jf(e.channel);return{matrix:Nf.map((r,s)=>r+(n[s]-r)*t)}},extras:(e,t)=>t.matrix[19]>0?{reach:4096}:{},cases:()=>[E.invert().list[0],E.invert({channel:"hue",strength:.7}).list[0],E.invert({channel:"luminance"}).list[0],E.invert({channel:"alpha",strength:.5}).list[0]]}),Vf=oe({default:()=>zf}),zf=ce({type:"kaleidoscope",surface:"shader",params:{wedge:{type:"f32",uses:["segments"],value:(e,t)=>2*Math.PI/t.segments},angle:{type:"f32",value:e=>e.angle*Math.PI/180},offset:"param",amount:{type:"f32",value:e=>Math.max(0,Math.min(1,e.amount))},center:"param"},prepare(e){let t=Math.round(e.segments);return t<2||e.amount<=0?null:{segments:t}},extras:e=>({reach:Math.min((Math.SQRT2-1+Math.abs(e.offset)+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}),cases:()=>[E.kaleidoscope().list[0],E.kaleidoscope({segments:8,angle:20,offset:.15}).list[0],E.kaleidoscope({segments:3,amount:.6,center:{x:.4,y:.55}}).list[0]]}),Gf=oe({default:()=>qf}),Ti=new WeakMap,Hf=0,Fr=e=>Number.isFinite(e)?Math.max(0,Math.min(255,Math.round(e*255))):0;function Kf(e,t){let n=Ti.get(e);if(n&&n.height===t)return n;let r=t*t,s=new Uint8ClampedArray(r*t*4);for(let a=0;a<t;a++)for(let o=0;o<t;o++)for(let l=0;l<t;l++){let c=((a*t+o)*t+l)*3,u=(o*r+a*t+l)*4;s[u+3]=255,!(c+2>=e.length)&&(s[u]=Fr(e[c]),s[u+1]=Fr(e[c+1]),s[u+2]=Fr(e[c+2]))}let i={key:`lut-${Hf++}`,width:r,height:t,pixels:s};return Ti.set(e,i),i}function Pi(e){let t=new Float32Array(e*e*e*3);for(let n=0;n<e;n++)for(let r=0;r<e;r++)for(let s=0;s<e;s++){let[i,a,o]=[s/(e-1),r/(e-1),n/(e-1)],l=((n*e+r)*e+s)*3;t[l]=.05+.95*Math.pow(i,.8),t[l+1]=.85*a+.1*o+.03,t[l+2]=1-Math.pow(1-o,1.4)*.9-.08*i}return t}var Br=null,qf=ce({type:"lut",surface:"shader",params:{size:"param",amount:"param"},uses:["table"],prepare:e=>e.amount<=0||!Number.isInteger(e.size)||e.size<2?null:{},extras:e=>({aux:Kf(e.table,e.size)}),cases:()=>(Br??=[Pi(17),Pi(33)],[E.lut({table:Br[1],size:33}).list[0],E.lut({table:Br[0],size:17,amount:.6}).list[0]])}),Jf=oe({default:()=>Yf}),Yf=ce({type:"magnify",surface:"shader",backdropOnly:!0,params:{scale:"param",center:"param"},prepare:e=>e.scale===1||e.scale<=0?null:{},extras:e=>({reach:e.scale<1?Math.min((1/e.scale-1)*360,800):0}),cases:()=>[E.magnify({scale:2}).list[0],E.magnify({scale:1.6,center:{x:.3,y:.7}}).list[0]]}),Xf=oe({default:()=>Zf}),Zf=ce({type:"oilPaint",surface:"shader",params:{radius:"param"},prepare:e=>e.radius>0?{}:null,extras:e=>({reach:e.radius}),cases:()=>[E.oilPaint().list[0],E.oilPaint({radius:5}).list[0],E.oilPaint({radius:1.5}).list[0]]}),Qf=oe({default:()=>td}),ed={outside:0,inside:1,center:2},td=ce({type:"outline",surface:"shader",params:{width:"param",position:{type:"f32",value:(e,t)=>t.position},color:"param"},prepare(e){return!(e.width>0)||Mt(e.color)[3]<=0?null:{position:ed[e.position]??0}},extras:(e,t)=>({reach:t.position===1?0:t.position===2?e.width/2:e.width}),cases:()=>[E.outline().list[0],E.outline({width:8,color:"#f80",position:"inside"}).list[0],E.outline({width:6,color:"#0cf",position:"center"}).list[0]]}),nd=oe({default:()=>rd}),rd=ce({type:"pixelate",surface:"filter",params:{blocks:"param",sharpColors:"param"},extras:e=>({reach:e.sharpColors?0:100}),cases:()=>[E.pixelate(40).list[0],E.pixelate({blocks:{x:40,y:24},sharpColors:!1}).list[0],E.pixelate({blocks:{x:12.5,y:40/3}}).list[0]]}),sd=oe({default:()=>id}),id=ce({type:"posterize",surface:"shader",params:{levels:"param"},prepare:e=>e.levels<2?null:{},cases:()=>[E.posterize().list[0],E.posterize(2).list[0],E.posterize(7).list[0]]}),ad=oe({default:()=>od}),od=ce({type:"progressiveBlur",surface:"shader",params:{center:"param",direction:{type:"vec2f",uses:["angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t),Math.sin(t)]}},radius:"param",start_radius:{type:"f32",uses:["startRadius"],value:(e,t)=>t.start0},start:"param",end:"param",shape:"param",samples:{type:"f32",value:e=>Math.max(2,Math.min(32,Math.round(e.samples)))}},prepare(e){let t=e.startRadius??0;return e.radius<=0&&t<=0?null:{start0:t}},extras:(e,t)=>({reach:Math.max(e.radius,t.start0,0)}),cases:()=>[E.progressiveBlur().list[0],E.progressiveBlur({radius:30,angle:0,start:.3,end:.9,samples:28}).list[0],E.progressiveBlur({radius:28,startRadius:4,shape:"radial",center:{x:.4,y:.5}}).list[0]]}),cd=oe({default:()=>ld}),ld=ce({type:"radialBlur",surface:"shader",params:{amount:"param",style:"param",center:"param",samples:{type:"f32",value:e=>Math.round(Math.max(2,Math.min(32,e.samples)))}},prepare:e=>e.amount>0?{}:null,extras(e){let t=e.style==="spin"?Math.SQRT2-1:1/Math.max(1-e.amount/2,.25)-1;return{reach:Math.min((t+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}},cases:()=>[E.radialBlur().list[0],E.radialBlur({amount:.8,style:"spin",samples:24}).list[0],E.radialBlur({amount:.3,center:{x:.3,y:.4},samples:8}).list[0]]}),ud=oe({default:()=>fd}),fd=ce({type:"rgbShift",surface:"shader",params:{red:"param",green:"param",blue:"param"},prepare(e){let{red:t,green:n,blue:r}=e;return!t.x&&!t.y&&!n.x&&!n.y&&!r.x&&!r.y?null:{}},extras:({red:e,green:t,blue:n})=>({reach:Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(t.x),Math.abs(t.y),Math.abs(n.x),Math.abs(n.y))}),cases:()=>[E.rgbShift().list[0],E.rgbShift({amount:12}).list[0],E.rgbShift({red:{x:6,y:-4},green:{x:-3,y:5},blue:{x:0,y:9}}).list[0]]}),dd=oe({default:()=>hd}),hd=ce({type:"scanlines",surface:"shader",params:{spacing:"param",thickness:"param",darkness:"param",offset:"param",direction:{type:"vec2f",uses:["angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t),Math.sin(t)]}}},prepare:e=>e.darkness>0?{}:null,cases:()=>[E.scanlines().list[0],E.scanlines({spacing:7,thickness:.3,darkness:.8,offset:2,angle:30}).list[0],E.scanlines({spacing:5,thickness:.7,angle:90}).list[0]]}),pd=oe({default:()=>_d}),_d=ce({type:"scatter",surface:"shader",params:{offset:{type:"vec2f",uses:["strength","axis"],value(e){let t=kt(e.axis);return[e.strength*t.x,e.strength*t.y]}}},prepare:e=>e.strength>0?{}:null,extras(e){let t=kt(e.axis);return{reach:e.strength*Math.max(Math.abs(t.x),Math.abs(t.y))}},cases:()=>[E.scatter().list[0],E.scatter({strength:24,axis:"x"}).list[0],E.scatter({strength:6,axis:"y"}).list[0]]}),md=oe({default:()=>gd}),gd=ce({type:"sharpen",surface:"shader",params:{amount:"param",radius:{type:"f32",value:e=>Math.max(e.radius,0)}},prepare:e=>e.amount===0?null:{},cases:()=>[E.sharpen().list[0],E.sharpen({amount:2.5,radius:3}).list[0]]}),bd=oe({default:()=>wd}),wd=ce({type:"streak",surface:"filter",params:{scale:{type:"f32",uses:["threshold"],value:(e,t)=>t.scale},bias:{type:"f32",value:(e,t)=>-t.t*t.scale},intensity:"param",sigma:{type:"f32",uses:["length"],value:(e,t)=>t.sigma},axis:{type:"vec2f",uses:["angle"],value:(e,t)=>[Math.cos(t.rad),Math.sin(t.rad)]}},prepare(e){if(e.intensity<=0||e.length<=0)return null;let t=Math.max(0,Math.min(1,e.threshold));return{t,scale:t<1?1/(1-t):1,sigma:e.length/2,rad:e.angle*Math.PI/180}},extras:(e,t)=>({blur:[t.sigma,.01,t.rad],reach:3*t.sigma}),cases:()=>[E.streak().list[0],E.streak({angle:30,length:80,threshold:.5,intensity:1.5}).list[0],E.streak({angle:90,length:60,threshold:.3,intensity:.7}).list[0]]}),yd=oe({default:()=>vd}),vd=ce({type:"threshold",surface:"shader",params:{level:"param",smoothness:"param"},cases:()=>[E.threshold().list[0],E.threshold({level:.3,smoothness:0}).list[0],E.threshold({level:.6,smoothness:.4}).list[0]]}),xd=oe({default:()=>kd}),kd=ce({type:"twirl",surface:"shader",params:{angle:{type:"f32",value:e=>e.angle*Math.PI/180},radius:"param",center:"param"},prepare:e=>e.angle===0||e.radius<=0?null:{},extras(e){let t=Math.min(e.radius,Math.SQRT2);return{reach:Math.min((Math.max(t-1,0)+2*Math.hypot(e.center.x-.5,e.center.y-.5))*360,800)}},cases:()=>[E.twirl().list[0],E.twirl({angle:-120,radius:.6}).list[0],E.twirl({angle:300,radius:1.4,center:{x:.35,y:.55}}).list[0]]}),Md=oe({default:()=>Sd}),Sd=ce({type:"vignette",surface:"shader",params:{color:"param",amount:"param",radius:"param",softness:"param"},prepare:e=>e.amount<=0||Mt(e.color)[3]<=0?null:{},cases:()=>[E.vignette().list[0],E.vignette({amount:.9,radius:.4,softness:.3}).list[0],E.vignette({amount:.7,color:"#ff8800",radius:.6,softness:.8}).list[0]]}),Ed=oe({default:()=>Ad}),Ad=ce({type:"vintage",surface:"filter",params:{matrix:{type:{array:20,of:"f32"},uses:["amount","warmth"],value(e){let t=Math.max(0,Math.min(1,e.amount)),n=Math.max(-1,Math.min(1,e.warmth)),r=(l,c)=>l+(c-l)*t,s=n>0?n*.15:0,i=n<0?-n*.15:0,a=n<0?-n*.05:0,o=n>0?n*.05:0;return[r(1,.393),r(0,.769),r(0,.189),0,s-a,r(0,.349),r(1,.686),r(0,.168),0,0,r(0,.272),r(0,.534),r(1,.131),0,-i+o,0,0,0,1,0]}}},prepare:e=>e.amount<=0&&e.warmth===0?null:{},cases:()=>[E.vintage().list[0],E.vintage({amount:.5,warmth:-.8}).list[0],E.vintage({amount:0,warmth:1}).list[0]]}),Td=oe({default:()=>Pd}),Pd=ce({type:"wave",surface:"shader",params:{amplitude:"param",wavelength:{type:"f32",value:e=>Math.max(e.wavelength,.01)},phase:{type:"f32",value:e=>(e.phase%360+360)%360*Math.PI/180},direction:{type:"vec2f",uses:["angle"],value(e){let t=e.angle*Math.PI/180;return[Math.cos(t),Math.sin(t)]}},shape:"param",center:"param"},prepare:e=>e.amplitude.x===0&&e.amplitude.y===0?null:{},extras:e=>({reach:Math.max(Math.abs(e.amplitude.x),Math.abs(e.amplitude.y))}),cases:()=>[E.wave().list[0],E.wave({amplitude:{x:8,y:14},wavelength:60,phase:70,angle:35}).list[0],E.wave({amplitude:16,shape:"radial",wavelength:80,center:{x:.4,y:.6}}).list[0]]}),Ii=new Map(Object.entries(Object.assign({"./_pack.ts":yu,"./alpha.ts":xu,"./ascii.ts":Mu,"./bitCrush.ts":Iu,"./blockDisplace.ts":Du,"./bloom.ts":Fu,"./blur.ts":$u,"./bulge.ts":Nu,"./chromaticAberration.ts":Wu,"./colorAdjustment.ts":Hu,"./colorMatrix.ts":Yu,"./curves.ts":Zu,"./directionalBlur.ts":rf,"./dither.ts":af,"./dropShadow.ts":ff,"./duotone.ts":hf,"./edges.ts":bf,"./exposure.ts":yf,"./glass.ts":xf,"./glow.ts":If,"./grain.ts":Of,"./grayscale.ts":Lf,"./halftone.ts":Bf,"./invert.ts":Uf,"./kaleidoscope.ts":Vf,"./lut.ts":Gf,"./magnify.ts":Jf,"./oilPaint.ts":Xf,"./outline.ts":Qf,"./pixelate.ts":nd,"./posterize.ts":sd,"./progressiveBlur.ts":ad,"./radialBlur.ts":cd,"./rgbShift.ts":ud,"./scanlines.ts":dd,"./scatter.ts":pd,"./sharpen.ts":md,"./streak.ts":bd,"./threshold.ts":yd,"./twirl.ts":xd,"./vignette.ts":Md,"./vintage.ts":Ed,"./wave.ts":Td})).filter(([e])=>!e.includes("/_")).map(([,e])=>[e.default.type,e.default])),Id=1073741824,Gr=null;function bn(e){return Gr??=cl(e?{module_or_path:e}:void 0),Gr}var Kn=null;function Zr(){return Kn??=bn().then(()=>Vt.prewarm()).catch(e=>{throw Kn=null,e}),Kn}function Rd(){Kn=null,Gr&&Vt.forget_device()}var Cd={miter:0,round:1,bevel:2},Od={butt:0,round:1,square:2},Ri={clamp:0,repeat:1,mirror:2,decal:3},Dd={rect:1,ellipse:2,path:3},Ld={left:0,right:1,center:2,justify:3},Fd={top:0,center:1,bottom:2},Ci=new TextEncoder,Bd=120;function $d(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e[n],16777619);return t>>>0}function Ud(e){let t=new Uint32Array(e.points.buffer,e.points.byteOffset,e.points.length),n=2166136261,r=16777619^e.points.length;for(let s=0;s<e.verbs.length;s++)n=Math.imul(n^e.verbs[s],16777619),r=Math.imul(r^e.verbs[s],1540483477);for(let s=0;s<t.length;s++)n=Math.imul(n^t[s],16777619),r=Math.imul(r^t[s],1540483477);return`${e.verbs.length}:${t.length}:${n>>>0}:${r>>>0}`}var Qr=class{name="wgpu";r;w;paintIds=new WeakMap;paintByKey=new Map;freePaints=[];pathIds=new WeakMap;pathByKey=new Map;freePaths=[];generation=0;collectUnused=!1;dashIds=new Map;nextPaint=0;nextPath=0;nextDash=0;synced=!1;viewport={w:0,h:0};lastDeltaWords=0;async init(e,t,n){let r=await bn();await Zr().catch(()=>{}),this.attach(await Vt.create(e,t,n),r.memory,t,n)}attach(e,t,n,r){this.r=e,this.w=new wu(this.r,t),this.effectIndex=new Map(this.r.effect_names().map((s,i)=>[s,i])),this.viewport={w:n,h:r},this.shaders=new fl(this.r,()=>this.onShaderReady?.())}shaders;onShaderReady;shaderIssues=new Set;whenShadersReady(){return this.shaders.whenReady()}userProgram(e,t){let n=this.shaders.program(e,t),r=n.report.diagnostics[0]??n.browser.find(s=>s.message.startsWith("error"));return n.state==="failed"&&r&&this.shaderIssues.add(`A WGSL shader ${e} does not compile${r.line?` (line ${r.line}:${r.column})`:""}: ${r.message}`),n}adapterInfo(){return this.r.adapter_info()}gpuDevice(){return this.r.gpu_device()}setOptions(e,t){this.r.set_options(e,t)}resize(e,t){this.r.resize(e,t),this.viewport={w:e,h:t},this.synced=!1}paint(e){if(!e)return mt;let t=this.paintIds.get(e);if(t?.live)return t.used=this.generation,t.id;let n=e.kind==="image"?`image:${e.image.id}:${e.fit??"fill"}:${e.box.join(",")}:${e.matrix?.join(",")??""}:${e.tile??""}`:e.kind==="shader"?`shader:${this.userProgram("fill",e.source).id}:${e.box.join(",")}:${e.time}:${e.texture?.id??""}:${JSON.stringify(e.uniforms)}`:JSON.stringify(e),r=this.paintByKey.get(n);if(r)r.used=this.generation;else{r={id:this.freePaints.pop()??this.nextPaint++,used:this.generation,live:!0},this.paintByKey.set(n,r);let s=r.id,i=this.w;if(e.kind==="procedural")return this.procedural(s,e),this.paintIds.set(e,r),s;if(e.kind==="shader")return this.shaderPaint(s,e),this.paintIds.set(e,r),s;let a=e.kind==="solid"||e.kind==="image"?[]:e.stops;if(i.begin(12+a.length*5),i.u(Se.DEF_PAINT),i.u(s),e.kind==="solid"){i.u(0);for(let o=0;o<4;o++)i.f(0);for(let o of e.color)i.f(o)}else if(e.kind==="image"){let{m:o,tile:l}=Tc(e),c=o[0]*o[3]-o[1]*o[2]||1,u=e.image.width,f=e.image.height,d=o[3]/c,p=-o[1]/c,_=-o[2]/c,w=o[0]/c,A=(o[2]*o[5]-o[3]*o[4])/c,B=(o[1]*o[4]-o[0]*o[5])/c;i.u(4|Ri[l]<<8),i.f(d/u),i.f(p/f),i.f(_/u),i.f(w/f),i.f(A/u),i.f(B/f),i.f(e.image.id),i.f(0)}else{let o=e.kind==="linear"?1:e.kind==="radial"?2:3;i.u(o|Ri[e.tile??"clamp"]<<8),e.kind==="linear"?(i.f(e.from[0]),i.f(e.from[1]),i.f(e.to[0]),i.f(e.to[1])):e.kind==="radial"?(i.f(e.center[0]),i.f(e.center[1]),i.f(e.radius),i.f(0)):(i.f(e.center[0]),i.f(e.center[1]),i.f(e.startAngle),i.f(e.endAngle));for(let l of a[0].color)i.f(l)}i.u(a.length);for(let o of a){i.f(o.offset);for(let l of o.color)i.f(l)}}return this.paintIds.set(e,r),r.id}shaderPaint(e,t){let n=this.userProgram("fill",t.source),r=n.report.ok?si(n.report.fields,n.report.size,t.uniforms):new Uint32Array(0),s=Math.ceil(r.length/4),i=this.w;i.begin(12+s*5),i.u(Se.DEF_PAINT),i.u(e),i.u(10);for(let a of t.box)i.f(a);i.f(t.time),i.f(t.texture?t.texture.id:-1),i.f(n.id),i.f(0),i.u(s);for(let a=0;a<s;a++){i.f(0);for(let o=0;o<4;o++)i.u(r[a*4+o]??0)}}procedural(e,t){let n=t.fill,[r,s,i,a]=t.box,o,l,c,u=[],f=[],d=w=>[Math.round(w[0]*255)/255,Math.round(w[1]*255)/255,Math.round(w[2]*255)/255,w[3]];if(n.type==="dotGrid")o=5,l=[r+n.offset.x,s+n.offset.y,Math.max(.01,n.spacing),Math.max(0,n.radius)],c=[...n.color];else if(n.type==="grid")o=6,l=[r+n.offset.x,s+n.offset.y,i,a],c=[...n.color],u.push([Math.max(1e-4,n.divisions),Math.max(1,Math.round(n.subdivisions)),Math.max(0,n.strokeWidth)*.5,Math.max(0,n.subdivisionWidth)*.5]);else if(n.type==="stripe"){o=7;let w=(n.angle??-45)*Math.PI/180;l=[r,s,Math.max(1,Math.round(n.gap??8)),n.strokeWidth??1],c=d(n.color??[0,0,0,1]),u.push([Math.cos(w),Math.sin(w),r,0])}else if(n.type==="noise"){o=8,l=[r,s,Math.ceil(i),Math.ceil(a)];let w=d(n.color);c=[w[0],w[1],w[2],Math.round(n.color[3]*255)/255],u.push([Math.max(1,Math.round(n.size.x)),Math.max(1,Math.round(n.size.y)),Math.min(1,Math.max(0,n.density)),Math.round(n.seed)])}else{o=9,l=[r,s,i,a];let w=n.angle*Math.PI/180,A={value:0,simplex:1,ridged:2,worley:3}[n.basis]??1;u.push([n.frequency.x,n.frequency.y,n.offset.x,n.offset.y]),u.push([n.lacunarity,n.gain,n.seed,n.contrast]),u.push([Math.cos(w),Math.sin(w),A,n.octaves]);let B=Math.max(2,Math.min(8,n.colors.length));for(let L=0;L<B;L++)f.push({offset:n.stops[Math.min(L,n.stops.length-1)]??L/(B-1),color:[...n.colors[Math.min(L,n.colors.length-1)]]});c=f[0].color}let p=u.length+f.length,_=this.w;_.begin(12+p*5),_.u(Se.DEF_PAINT),_.u(e),_.u(o);for(let w of l)_.f(w);for(let w of c)_.f(w);_.u(p);for(let w of u){_.f(0);for(let A of w)_.f(A)}for(let w of f){_.f(w.offset);for(let A of w.color)_.f(A)}}pathId(e){let t=this.pathIds.get(e);if(t?.live)return t.used=this.generation,t.id;let n=Ud(e),r=this.pathByKey.get(n);if(r)return r.used=this.generation,this.pathIds.set(e,r),r.id;let s={id:this.freePaths.pop()??this.nextPath++,used:this.generation,live:!0};this.pathByKey.set(n,s);let i=s.id,a=this.w,o=Math.ceil(e.verbs.length/4);a.begin(4+o+e.points.length),a.u(Se.DEF_PATH),a.u(i),a.u(e.verbs.length),a.u(e.points.length/2);for(let l=0;l<o;l++){let c=e.verbs,u=l*4;a.u((c[u]??0)|(c[u+1]??0)<<8|(c[u+2]??0)<<16|(c[u+3]??0)<<24)}for(let l=0;l<e.points.length;l++)a.f(e.points[l]);return this.pathIds.set(e,s),i}sweep(){let e=this.generation-Bd;for(let[t,n]of this.pathByKey)n.used>=e||(n.live=!1,this.pathByKey.delete(t),this.w.begin(2),this.w.u(Se.FREE_PATH),this.w.u(n.id),this.freePaths.push(n.id));for(let[t,n]of this.paintByKey)n.used>=e||(n.live=!1,this.paintByKey.delete(t),this.freePaints.push(n.id))}dash(e,t=0){if(!e||e.length===0)return mt;let n=e.join(",")+"@"+t,r=this.dashIds.get(n);if(r===void 0){r=this.nextDash++,this.dashIds.set(n,r);let s=this.w;s.begin(4+e.length),s.u(Se.DEF_DASH),s.u(r),s.u(e.length),s.f(t);for(let i of e)s.f(i)}return r}writeNode(e,t){let n=this.w,r=e.id;if(t&ke.CREATE&&(n.begin(3),n.u(Se.CREATE),n.u(r),n.u(xc[e.kind])),t&ke.TRANSFORM){let s=e.transform;if(Vn(s)){n.begin(11),n.u(Se.TRANSFORM3),n.u(r);for(let i of s)n.f(i)}else{n.begin(8),n.u(Se.TRANSFORM),n.u(r);for(let i=0;i<6;i++)n.f(s[i])}}if(t&ke.EFFECTS&&(e.effects?.length||!(t&ke.CREATE))&&this.writeEffects(e),t&ke.OPACITY&&(e.opacity!==1||!(t&ke.CREATE))&&(n.begin(3),n.u(Se.OPACITY),n.u(r),n.f(e.opacity)),t&ke.BLEND&&(e.blend!=="normal"||!(t&ke.CREATE))&&(n.begin(3),n.u(Se.BLEND),n.u(r),n.u(qi.indexOf(e.blend))),e.kind==="group"){if(t&ke.CLIP&&(e.clip||!(t&ke.CREATE))){let s=e.clip,i=s?.path?this.pathId(s.path):mt,a=s?.path?it(s.path):[s?.x??0,s?.y??0,(s?.x??0)+(s?.w??0),(s?.y??0)+(s?.h??0)];n.begin(10),n.u(Se.CLIP),n.u(r),n.u(s?1:0);for(let o of a)n.f(o);n.f(s?.r??0),n.u(i),n.u(s?.evenOdd?1:0)}if(t&ke.MASK&&(e.mask||!(t&ke.CREATE))&&(n.begin(3),n.u(Se.MASK),n.u(r),n.u(e.mask?Mc[e.mask]:0)),t&ke.FILTER&&(e.filter||!(t&ke.CREATE))){let s=e.filter;if(n.begin(10),n.u(Se.FILTER),n.u(r),s)if(s.kind==="blur"){n.u(1),n.f(s.sigma);for(let i=0;i<6;i++)n.f(0)}else{n.u(2),n.f(s.sigma),n.f(s.dx),n.f(s.dy);for(let i of s.color)n.f(i)}else{n.u(0);for(let i=0;i<7;i++)n.f(0)}}if(t&ke.CHILDREN){n.begin(3+e.children.length),n.u(Se.CHILDREN),n.u(r),n.u(e.children.length);for(let s of e.children)n.u(s.id)}return}if(t&ke.SIZE&&(n.begin(4),n.u(Se.SIZE),n.u(r),n.f(e.w),n.f(e.h)),t&ke.RADII&&e.kind==="rect"){n.begin(6),n.u(Se.RADII),n.u(r);for(let s of e.radii)n.f(s)}if(t&ke.MEMBERS&&e.members){let s=e.members,i=s.map(a=>a.kind==="path"&&a.path?this.pathId(a.path):mt);n.begin(3+s.length*16),n.u(Se.MEMBERS),n.u(r),n.u(s.length),s.forEach((a,o)=>{n.u(Dd[a.kind]),n.u(kc[Ac(a)]);for(let l of a.transform??[1,0,0,1,0,0])n.f(l);n.f(a.w??0),n.f(a.h??0);for(let l of a.radii??[0,0,0,0])n.f(l);n.u(i[o]),n.u(a.evenOdd?1:0)})}if(t&ke.TEXT&&e.text){let s=e.text,i=s.runs.map(c=>[Ci.encode(c.family),Ci.encode(c.text)]),a=i.reduce((c,[u,f])=>c+2+Math.ceil(u.length/4)+Math.ceil(f.length/4)+6,0),o=s.path?this.pathId(s.path):mt,l=s.runs.map(c=>this.paint(c.paint));n.begin(12+a),n.u(Se.TEXT),n.u(r),n.u(Ld[s.align??"center"]),n.u(Fd[s.verticalAlign??"center"]),n.u(s.wrap?1:0),n.f(s.fontSize==="autofit"?0:s.runs.length===1?s.runs[0].size:0),n.f(s.minFontSize??0),n.f(s.lineHeight??0),n.f(s.width??0),n.f(s.height??0),n.u(s.runs.length),s.runs.forEach((c,u)=>{n.u(c.decoration==="underline"?1:c.decoration==="lineThrough"?2:0),n.u(l[u]),n.f(c.size),n.f(c.weight??400),n.u(c.italic?1:0),n.f(c.letterSpacing??0);for(let f of i[u]){n.u(f.length);for(let d=0;d<f.length;d+=4)n.u((f[d]??0)|(f[d+1]??0)<<8|(f[d+2]??0)<<16|(f[d+3]??0)<<24)}}),n.u(o)}if(t&ke.PATH&&e.path){let s=this.pathId(e.path);n.begin(4),n.u(Se.PATH),n.u(r),n.u(s),n.u(e.evenOdd?1:0)}if(t&ke.FILL){let s=this.paint(e.fill);n.begin(3),n.u(Se.FILL),n.u(r),n.u(s)}if(t&ke.STROKE&&(e.stroke||!(t&ke.CREATE))){let s=e.stroke,i=this.paint(s?.paint),a=this.dash(s?.dash,s?.dashPhase);n.begin(8),n.u(Se.STROKE),n.u(r),n.u(i),n.f(s?.width??0),n.u(Cd[s?.join??"miter"]),n.u(Od[s?.cap??"butt"]),n.f(s?.miter??4),n.u(a)}if(t&ke.SHADOWS&&(e.shadows.length||!(t&ke.CREATE))){n.begin(3+e.shadows.length*8),n.u(Se.SHADOWS),n.u(r),n.u(e.shadows.length);for(let s of e.shadows){n.f(s.dx),n.f(s.dy),n.f(s.sigma),n.f(s.spread);for(let i of s.color)n.f(i)}}}uploaded=new Map;missing3d=new Set;textures3d=new Map;geometries3d=new Map;bindTextures3d(e,t){let n=new Set(t.pending.splice(0));for(let r of n){let s=r.texture;"data"in s&&this.r.scene3d_pixels(e.id,r.id,Uint8Array.from(s.data),s.width,s.height,r.srgb)}for(let r of t.all.values()){let s=r.texture;if("data"in s)continue;let i="src"in s?e.links3d?.images?.[s.src]:e.links3d?.surfaces?.get(s);i?this.r.scene3d_bind(e.id,r.id,i.id,r.srgb):n.has(r)&&this.missing3d.add("src"in s?`image:${s.src}`:"surface")}}scene3dSigs=new Map;forgetScene3d(e){this.textures3d.delete(e),this.geometries3d.delete(e),this.scene3dSigs.delete(e)}encode3dMs=0;words3d=0;effectIndex=new Map;auxIds=new Map;missing=new Set;effectTypes(){return[...this.effectIndex.keys()].filter(e=>Ii.has(e))}auxId(e){if(!e)return mt;let t=this.auxIds.get(e.key);if(t===void 0){t=1e6+this.auxIds.size;let n=new OffscreenCanvas(e.width,e.height);n.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(e.pixels),e.width,e.height),0,0),this.r.upload_image(t,n,!1),this.auxIds.set(e.key,t)}return t}writeEffects(e){let t=e.effects??[],n=[];for(let[i,a]of[["shader",!1],["filter",!1],["filter",!0],["shader",!0]])for(let o of t){if(o.type==="shader"){if(o.mode==="backdrop"!==a||(a?"shader":"filter")!==i)continue;let f=this.userEffect(o);f&&n.push({...f,flags:(o.clip?1:0)|(a?2:0)});continue}let l=Ii.get(o.type),c=this.effectIndex.get(o.type);if(!l||c===void 0){this.missing.has(o.type)||console.info(`effect "${o.type}" has no WGSL port yet; skipped`),this.missing.add(o.type);continue}if(l.surface!==i||o.mode==="backdrop"!==a||l.backdropOnly&&!a)continue;let u=l.pack(o);u&&n.push({index:c,flags:(o.clip?1:0)|(a?2:0)|(a&&i==="filter"?4:0)|(u.field?8:0),aux:this.auxId(u.aux),p:u})}let r=this.w,s=e.effectBox??[0,0,0,0];r.begin(8+n.reduce((i,a)=>i+8+a.p.params.length+(a.words?.length??0),0)),r.u(Se.EFFECTS),r.u(e.id);for(let i of s)r.f(i);r.f(e.effectTime??0),r.u(n.length);for(let i of n){r.u(i.index),r.u(i.flags),r.u(i.aux),r.f(i.p.reach??0);let a=i.p.blur??[0,0,0];r.f(a[0]),r.f(a[1]),r.f(a[2]),r.u(i.p.params.length+(i.words?.length??0));for(let o of i.p.params)r.f(o);if(i.words)for(let o of i.words)r.u(o)}}userEffect(e){if(!e.source?.trim())return null;if(!Ni(e))return this.shaderIssues.add(wl),null;let t=this.userProgram("effect",e.source);if(!t.report.ok)return null;let n=ji(e.uniforms),r=e.mode!=="backdrop"&&e.blendMode?(bl[e.blendMode]??-1)+1:0;return{index:Id+t.id,aux:mt,p:{params:[r],reach:Math.max(0,e.reach??0)},words:si(t.report.fields,t.report.size,n)}}frameCanvases=new Map;colorCorrect(e){if(typeof VideoFrame>"u"||!(e.source instanceof VideoFrame))return e.source;let t=this.frameCanvases.get(e.id);return(!t||t.width!==e.width||t.height!==e.height)&&(t=new OffscreenCanvas(e.width,e.height),this.frameCanvases.set(e.id,t)),t.getContext("2d").drawImage(e.source,0,0),t}sync(e){this.generation++,this.encode3dMs=0,this.words3d=0;for(let n of e.images)if(this.uploaded.get(n.id)!==n.version){if(n.surface)this.forgetScene3d(n.id),this.r.set_surface(n.id,n.surface.id,n.width,n.height);else if(n.scene3d){let r=this.viewport.w/e.width,s={unsupported:new Set},i=this.textures3d.get(n.id);i||this.textures3d.set(n.id,i=new hu);let[a,o]=n.scale3d?[Math.ceil(n.width*n.scale3d),Math.ceil(n.height*n.scale3d)]:[Math.round(n.width*r),Math.round(n.height*r)],l=performance.now(),c=this.geometries3d.get(n.id);c||this.geometries3d.set(n.id,c=new _u);let u=bu(n.scene3d,s,i,c),f=`${a}x${o}:${u.length}:${$d(u)}`;if(this.encode3dMs+=performance.now()-l,this.words3d+=u.length,this.scene3dSigs.get(n.id)!==f){try{this.r.set_scene3d(n.id,a,o,u)}catch(d){throw this.geometries3d.delete(n.id),this.scene3dSigs.delete(n.id),d}this.scene3dSigs.set(n.id,f)}for(let d of s.unsupported)this.missing3d.add(d);this.bindTextures3d(n,i)}else this.forgetScene3d(n.id),this.r.upload_image(n.id,this.colorCorrect(n),n.mipmaps);this.uploaded.set(n.id,n.version)}let t=this.w;if(this.synced)for(let n of e.dirty)this.writeNode(n,n.dirty);else{for(let n of e.nodes)this.writeNode(n,ke.ALL);t.begin(2),t.u(Se.ROOT),t.u(e.root.id),t.begin(8),t.u(Se.VIEWPORT),t.u(this.viewport.w),t.u(this.viewport.h),t.f(this.viewport.w/e.width);for(let n of e.background)t.f(n);this.synced=!0}for(let n of e.dirty)n.dirty=0;e.dirty.clear(),this.collectUnused&&this.generation%30===0&&this.sweep(),t.flush(),this.lastDeltaWords=t.takeCount()}render(){this.r.render()}invalidate(){this.r.invalidate()}waitGpu(){return this.r.wait_gpu()}async readPixels(){return await this.r.read_pixels()}stats(){let e=this.r.stats();return{buildMs:e[0],encodeMs:e[1],applyMs:e[2],prims:e[3],ops:e[4],layers:e[5],passes:e[6],draws:e[7],culled:e[8],tessellated:e[9],poolTextures:e[10],poolMiB:e[11],geomVertices:e[12],reusedPrims:e[13],cleanPrims:e[14],deltaWords:this.lastDeltaWords,scene3dEncodeMs:this.encode3dMs,scene3dWords:this.words3d,scene3dSetMs:e[15],scene3dDrawMs:e[16],scene3dMapsMs:e[17],surfacesDrawn:e[18],surfaces:e[19]}}registerFont(e,t){this.r.register_font(e,t)}destroy(){this.r.free()}},Pa={normal:0,italic:1,oblique:2},Nd={left:0,right:1,center:2,justify:3,start:4,end:5},jd={top:0,center:1,bottom:2},Oi=new WeakMap;function es(e){let t=Oi.get(e);if(!t){let n=t=new Ur;for(let r of e.fonts)n.register_font(r.bytes,r.family);e.onFont(r=>n.register_font(r.bytes,r.family)),Oi.set(e,n)}return t}function ts(e,t,n,r,s=400,i=0,a){let[o,l]=e.measure_text(t,n,r,s,i,Pa[a??"normal"]??0);return{width:o,height:l}}function Ia(e,t){let n=Ki(t);if(n.path!=null)return null;let r=n.fontSize==="autofit",s={text:String(n.text??""),fontFamily:n.fontFamily,fontSize:r?100:n.fontSize,fontWeight:n.fontWeight,fontStyle:n.fontStyle,letterSpacing:n.letterSpacing},i=Array.isArray(n.segments)&&n.segments.length?n.segments:[s];if(i.some(_=>(_.x??0)!==0||(_.y??0)!==0||(_.rotation??0)!==0||(_.scale??1)!==1))return null;let a=[],o=[],l="";for(let _ of i){let w=_.fontFamily??s.fontFamily??"",A=a.indexOf(w);A<0&&(A=a.push(w)-1);let B=String(_.text??"");l+=B,o.push(B.length,_.fontSize??s.fontSize,_.fontWeight??s.fontWeight??400,Pa[_.fontStyle??s.fontStyle??"normal"]??0,_.letterSpacing??s.letterSpacing??0,A)}let c=n.width??0,u=n.height??0,f=e.text_block(l,new Float32Array(o),a.join(`
703
+ `),r?NaN:s.fontSize,n.minFontSize??0,n.lineHeight??0,Nd[n.textAlign??"center"]??2,jd[n.verticalAlign??"center"]??1,!!n.wrap&&c>0,c,u);if(!f.length)return null;let d=[],p=3;for(let _=0;_<f[2];_++){let[w,A,B,L,V]=f.subarray(p,p+5);d.push({start:w,end:A,top:B,bottom:L,carets:Array.from(f.subarray(p+5,p+5+V))}),p+=5+V}return{lines:d,width:f[0],height:f[1]}}var Wd=3,Vd=6e4,zd=32,Hr=new Set,mn=new Set,Di=new WeakSet,sn=[],Gd=0,zt=null,Li=!1;function Hd(e){return Hr.add(e),()=>Hr.delete(e)}function Kd(){return zt}function qd(e){return Zd(),mn.add(e),zt!==null&&(e.queueIssue(Ra(zt)),e.halt()),()=>mn.delete(e)}function Jd(e){let t=e;!t||Di.has(t)||(Di.add(t),t.addEventListener?.("uncapturederror",n=>Yd(n.error)),t.lost.then(n=>Xd(n.reason??"unknown",n.message??"")))}function qn(e){for(let t of[...Hr])try{t(e)}catch(n){console.error("[wgpu] a fault listener threw:",n)}}function ns(e){for(let t of mn)t.queueIssue(e)}function Yd(e){if(++Gd>zd)return;let t=e?.constructor?.name??"",n=t==="GPUOutOfMemoryError"?"out-of-memory":t==="GPUInternalError"?"internal":"validation",r=`WebGPU ${n} error: ${e?.message??String(e)}`;ns({kind:"gpu",feature:`gpu:${n}`,message:r}),qn({type:"gpu-error",error:n,message:r})}function Xd(e,t){if(zt!==null)return;Rd();let n=performance.now();for(;sn.length&&n-sn[0]>Vd;)sn.shift();let r=`The GPU device was lost (${e}${t?`: ${t}`:""}); the renderer is drawing on a new one.`;if(qn({type:"device-lost",reason:e,message:r}),sn.length>=Wd){Kr("The GPU device was lost 4 times within a minute; the renderer stopped asking for a new one.");return}sn.push(n),ns({kind:"device-lost",message:r});for(let s of[...mn])s.remount();Zr().then(()=>qn({type:"device-restored"}),s=>Kr(`No GPU device after a loss: ${String(s?.message??s)}`))}function Ra(e){return{kind:"crashed",message:e}}function Kr(e){zt===null&&(zt=e,queueMicrotask(()=>{ns(Ra(e));for(let t of[...mn])t.halt();qn({type:"crashed",message:e})}))}function Zd(){Li||(Li=!0,Rc(e=>Kr(`The renderer panicked and draws nothing more on this page (reload to recover): ${e}`)))}var Fi=new Set,Ca=/-not-(?:decoded|loaded)$/,Wn={"text:path":"Text on a path",rasterize:"rasterize()","boolean:nested":"A boolean nested in one of another kind","boolean:projective":"A boolean under a 3D (projective) transform","cut:compound":"A cut through a compound shape","stroke:union-of-booleans":"One stroke around several booleans","effect:motionBlur-shutter":"Motion blur with an off-centre shutter or over 32 samples","surface:error":"A surface texture that failed to draw","blend:":"The blend mode","fill:blend:":"The fill blend mode","op:":"The drawing op","fill:":"The fill","effect:":"The effect","3d:":"In 3D,"};function jt(e){if(Wn[e])return`${Wn[e]} is not drawn by the WebGPU renderer.`;let t=Object.keys(Wn).filter(n=>n.endsWith(":")&&e.startsWith(n)).sort((n,r)=>r.length-n.length)[0];return t?`${Wn[t]} "${e.slice(t.length)}" is not drawn by the WebGPU renderer.`:`Not drawn by the WebGPU renderer: ${e}.`}var Qd=class extends va{store;view={zoom:1,x:0,y:0};frame=null;clipToFrame=!0;frameBackground="black";canvas=null;size={width:1,height:1};backend=null;starting=null;startFailed=!1;startToken=null;lastDoc=null;viewportKey="";shaper;stopFonts;stopSettle;stopFaults;faults=[];halted=!1;constructor(e,t){let n=es(e);super(t.width,t.height,(r,s,i,a,o,l)=>ts(n,r,s,i,a,o,l)),this.store=e,this.shaper=n,this.storage=e,this.images=e.images,this.stopFonts=e.onFont(r=>this.backend?.registerFont(r.bytes,r.family)),this.stopSettle=e.addSettler(()=>this.starting&&!this.startFailed?this.starting.catch(()=>{}):this.backend?.shaders.hasPending()?this.backend.whenShadersReady():null),this.stopFaults=qd({queueIssue:r=>this.faults.push(r),remount:()=>this.remount(),halt:()=>this.halt()})}stats(){return this.backend?.stats()??null}mount(e){let t=e;if(this.size={width:Math.max(1,t.width),height:Math.max(1,t.height)},t===this.canvas&&(this.backend||this.starting)){this.present();return}if(this.releaseBackend(),this.canvas=t,this.halted||Kd()!==null)return;let n={};this.startToken=n,this.startFailed=!1;let r=this.starting=(async()=>{let s=new Qr;if(await s.init(t,this.size.width,this.size.height),this.startToken!==n){this.halted||s.destroy();return}Jd(s.gpuDevice()),s.setOptions(!1,!1),s.collectUnused=!0,s.onShaderReady=()=>this.present();for(let i of this.store.fonts)s.registerFont(i.bytes,i.family);this.backend=s,this.starting=null,this.present()})();r.catch(s=>{this.starting===r&&(this.startFailed=!0),console.error("[wgpu] the renderer failed to start:",s)})}whenMounted(){return this.starting??Promise.resolve()}unmount(){this.releaseBackend(),this.canvas=null}execute(e){if(!(!this.canvas||this.isDisposed())){this.width=this.size.width/this.pixelRatio,this.height=this.size.height/this.pixelRatio;try{super.execute(e)}finally{this.lastDoc=this.doc,this.present();for(let t of this.missing)Fi.has(t)||t.endsWith("-not-decoded")||(Fi.add(t),console.warn(`[wgpu] not drawn yet: ${t}`))}}}takeRenderIssues(){let e=new Map,t=r=>e.set(zi(r),r);for(let r of this.faults.splice(0))t(r);let n=this.halted?null:this.backend;for(let r of n?.shaderIssues??[])t({kind:"shader",...r==="A shader effect is written in SkSL, which Motion Script no longer runs, so it is skipped. Port it to WGSL (fn effect(in: EffectIn) -> vec4f)."&&{feature:"effect:shader-sksl"},message:r});n?.shaderIssues.clear();for(let r of this.shaderIssues)t(r);for(let r of this.missing){if(Ca.test(r))continue;let s=r==="fill:shader-sksl"?{kind:"shader",feature:r,message:ra}:{kind:"missing",feature:r,message:jt(r)},i=this.missing.nodes.get(r);if(!i?.size)t(s);else for(let a of i)t({...s,nodeId:a})}for(let r of n?.missing??[])t({kind:"missing",feature:`effect:${r}`,message:jt(`effect:${r}`)});for(let r of n?.missing3d??[])t({kind:"missing",feature:`3d:${r}`,message:jt(`3d:${r}`)});return[...e.values()]}whenShadersReady(){return this.backend?.whenShadersReady()??Promise.resolve()}layoutTextBlock(e){return Ia(this.shaper,e)}screenshot(e="image/png",t){return this.snapshotCanvas()?.toDataURL(e,t)}snapshotCanvas(){let e=this.canvas;if(!e||!this.backend||!this.lastDoc)return;this.present();let[t,n,r,s]=[0,0,e.width,e.height];if(this.frame){let o=this.pixelRatio,l=this.view.zoom,c=e.width/2+this.view.x*o,u=e.height/2+this.view.y*o,f=this.frame.width*l*o,d=this.frame.height*l*o;t=Math.max(0,Math.round(c-f/2)),n=Math.max(0,Math.round(u-d/2)),r=Math.max(1,Math.min(e.width-t,Math.round(f))),s=Math.max(1,Math.min(e.height-n,Math.round(d)))}let i=document.createElement("canvas");i.width=r,i.height=s;let a=i.getContext("2d");if(a)return a.drawImage(e,t,n,r,s,0,0,r,s),i}dispose(){this.releaseBackend(),this.stopFonts(),this.stopSettle(),this.stopFaults(),this.canvas=null,this.lastDoc=null,this.store.dispose(),super.dispose()}rootTransform(){let e=this.view.zoom;return[e,0,0,e,this.width/2+this.view.x,this.height/2+this.view.y]}clearColor(){return this.frame?[0,0,0,0]:[0,0,0,1]}frameGroup(e){let t=this.frame;if(!t)return e;let n={x:-t.width/2,y:-t.height/2,w:t.width,h:t.height};return this.frameBackground==="black"&&this.doc.rect(e,{transform:[1,0,0,1,n.x,n.y],w:n.w,h:n.h,fill:{kind:"solid",color:[0,0,0,1]}}),this.clipToFrame?this.doc.group(e,{clip:{...n,r:0}}):e}present(){let e=this.backend,t=this.canvas,n=this.lastDoc;if(!e||!t||!n||this.halted)return;let{width:r,height:s}=this.size,i=`${r}x${s}/${n.width}/${n.background.join(",")}`;(i!==this.viewportKey||t.width!==r||t.height!==s)&&(e.resize(r,s),this.viewportKey=i);try{e.sync(n),e.render()}catch(a){console.error("[wgpu] frame failed:",a)}}releaseBackend(){this.starting=null,this.startToken=null,this.halted||this.backend?.destroy(),this.backend=null,this.viewportKey=""}remount(){let e=this.canvas;!e||this.isDisposed()||this.halted||(this.releaseBackend(),this.mount(e))}halt(){this.halted=!0,this.releaseBackend()}},eh=827872077;var Le={BEGIN:1,APPLY:2,FONT:3,IMAGE:4,SURFACE:5,SCENE3D:6,SCENE3D_BIND:7,SCENE3D_PIXELS:8,FREE_IMAGE:9,SHADER_ADD:10,SHADER_BUILD:11,SHADER_REMOVE:12,OPTIONS:13,RESIZE:14,FRAME:15,AUDIO:16,END:17,INVALIDATE:18,CREATE:19},Jn=Le,Bi=new TextEncoder,th=class{buf=new Uint8Array(1<<20);view=new DataView(this.buf.buffer);pos=0;taken=0;constructor(){this.u32(eh),this.u32(1)}get size(){return this.pos}reserve(e){if(this.pos+e<=this.buf.length)return;let t=this.buf.length*2;for(;t<this.pos+e;)t*=2;let n=new Uint8Array(t);n.set(this.buf.subarray(0,this.pos)),this.buf=n,this.view=new DataView(n.buffer)}u32(e){this.reserve(4),this.view.setUint32(this.pos,e>>>0,!0),this.pos+=4}record(e,t,n){let r=t.length*4+(n?.length??0),s=r+3&-4;this.reserve(8+s),this.view.setUint32(this.pos,e,!0),this.view.setUint32(this.pos+4,r,!0),this.pos+=8;for(let i=0;i<t.length;i++)this.view.setUint32(this.pos,t[i]>>>0,!0),this.pos+=4;n&&(this.buf.set(n,this.pos),this.pos+=n.length),this.buf.fill(0,this.pos,this.pos+s-r),this.pos+=s-r}recordWords(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,n.length*4);this.record(e,t,r)}take(){let e=this.buf.slice(0,this.pos);return this.taken+=this.pos,this.pos=0,e}};function nh(e,t){let n=e,r=n.displayWidth??n.naturalWidth??n.videoWidth??n.width??0,s=n.displayHeight??n.naturalHeight??n.videoHeight??n.height??0;if(!r||!s)throw new Error("upload_image: empty source");let i=t.c;(!i||i.width!==r||i.height!==s)&&(i=t.c=new OffscreenCanvas(r,s));let a=i.getContext("2d",{willReadFrequently:!0});a.clearRect(0,0,r,s),a.drawImage(e,0,0);let o=a.getImageData(0,0,r,s).data;return{w:r,h:s,rgba:new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}}var rh=class{out;effects;memory=new WebAssembly.Memory({initial:4});scratch={};imageUploads=0;imageMs=0;constructor(e,t,n,r){this.out=e,this.effects=t,e.record(Le.CREATE,[n,r])}delta_buffer(e){let t=e*4;return this.memory.buffer.byteLength<t&&this.memory.grow(Math.ceil((t-this.memory.buffer.byteLength)/65536)),0}delta_capacity(){return this.memory.buffer.byteLength/4}apply(e){e>0&&this.out.recordWords(Le.APPLY,[],new Uint32Array(this.memory.buffer,0,e))}effect_names(){return[...this.effects]}adapter_info(){return"native export sidecar"}gpu_device(){return null}set_options(e,t){this.out.record(Le.OPTIONS,[+e,+t])}resize(e,t){this.out.record(Le.RESIZE,[e,t])}register_font(e,t){let n=Bi.encode(t),r=new Uint8Array((n.length+3&-4)+e.length);return r.set(n),r.set(e,n.length+3&-4),this.out.record(Le.FONT,[n.length],r),0}upload_image(e,t,n){let r=performance.now(),{w:s,h:i,rgba:a}=nh(t,this.scratch);this.out.record(Le.IMAGE,[e,s,i,n?1:0],a),this.imageUploads++,this.imageMs+=performance.now()-r}set_scene3d(e,t,n,r){this.out.recordWords(Le.SCENE3D,[e,t,n],r instanceof Uint32Array?r:Uint32Array.from(r))}set_surface(e,t,n,r){this.out.record(Le.SURFACE,[e,t,n,r])}scene3d_bind(e,t,n,r){this.out.record(Le.SCENE3D_BIND,[e,t,n,+r])}scene3d_pixels(e,t,n,r,s,i){this.out.record(Le.SCENE3D_PIXELS,[e,t,r,s,+i],n)}scene3d_skipped(e){return[]}free_image(e){this.out.record(Le.FREE_IMAGE,[e])}shader_add(e,t,n){let r=Xi(t,n);return JSON.parse(r).ok&&this.out.record(Le.SHADER_ADD,[e,t],Bi.encode(n)),r}shader_build(e){this.out.record(Le.SHADER_BUILD,[e])}shader_remove(e){this.out.record(Le.SHADER_REMOVE,[e])}shader_formats(e){return[]}render(){}invalidate(){this.out.record(Le.INVALIDATE,[])}wait_gpu(){return Promise.resolve()}read_pixels(){return Promise.reject(new Error("A native export surface cannot be read back."))}stats(){return new Float64Array(20)}free(){}},sh=class extends va{store;out;size;recorder;backend=new Qr;shaper;stopFonts;stopSettle;viewportKey="";frameCount=0;constructor(e,t,n,r,s){let i=es(e);super(t.width,t.height,(o,l,c,u,f,d)=>ts(i,o,l,c,u,f,d)),this.store=e,this.out=n,this.size=s,this.shaper=i,this.storage=e,this.images=e.images,this.recorder=new rh(n,r,s.width,s.height);let a=this.recorder.memory;this.backend.attach(this.recorder,a,s.width,s.height),this.backend.setOptions(!1,!1),this.backend.collectUnused=!0;for(let o of e.fonts)this.backend.registerFont(o.bytes,o.family);this.stopFonts=e.onFont(o=>this.backend.registerFont(o.bytes,o.family)),this.stopSettle=e.addSettler(()=>this.backend.shaders.hasPending()?this.backend.whenShadersReady():null)}mount(){}unmount(){}whenMounted(){return Promise.resolve()}execute(e){if(!this.isDisposed()){this.width=this.size.width/this.pixelRatio,this.height=this.size.height/this.pixelRatio;try{super.execute(e)}finally{let t=this.doc,n=`${this.size.width}x${this.size.height}/${t.width}/${t.background.join(",")}`;n!==this.viewportKey&&(this.backend.resize(this.size.width,this.size.height),this.viewportKey=n),this.backend.sync(t)}}}frameDone(){this.out.record(Le.FRAME,[this.frameCount++])}takeRenderIssues(){let e=new Map,t=n=>e.set(zi(n),n);for(let n of this.backend.shaderIssues)t({kind:"shader",...n==="A shader effect is written in SkSL, which Motion Script no longer runs, so it is skipped. Port it to WGSL (fn effect(in: EffectIn) -> vec4f)."&&{feature:"effect:shader-sksl"},message:n});this.backend.shaderIssues.clear();for(let n of this.shaderIssues)t(n);for(let n of this.missing){if(Ca.test(n))continue;let r=n==="fill:shader-sksl"?{kind:"shader",feature:n,message:ra}:{kind:"missing",feature:n,message:jt(n)},s=this.missing.nodes.get(n);if(!s?.size)t(r);else for(let i of s)t({...r,nodeId:i})}for(let n of this.backend.missing)t({kind:"missing",feature:`effect:${n}`,message:jt(`effect:${n}`)});for(let n of this.backend.missing3d)t({kind:"missing",feature:`3d:${n}`,message:jt(`3d:${n}`)});return[...e.values()]}layoutTextBlock(e){return Ia(this.shaper,e)}dispose(){this.stopFonts(),this.stopSettle(),this.store.dispose(),super.dispose()}},$r=8192,ih=12,an=e=>e.toFixed(4);function dn(e,t,n){let r=e.get(t);if(r)return r;let s=n().finally(()=>e.delete(t));return e.set(t,s),s}async function ah(e){let t=await fetch(e);if(!t.ok)throw new Error(`${e}: HTTP ${t.status}`);return t.blob()}var $i=new WeakMap;function oh(e){let t=$i.get(e);if(!t){let n=new Map;t=r=>dn(n,r,()=>e(r)),$i.set(e,t)}return t}var ch=class extends Ho{fps;images=new Map;videos=new Map;fonts=[];fontListeners=new Set;registeredFamilies=new Set;pending=new Map;vectors=new Map;upgrades=new Map;settlers=new Set;audioData=new Map;imageLoads=new Map;videoLoads=new Map;fontLoads=new Map;frameDecodes=new Map;loadBytes;constructor(e,t,n,r=ah){super(e,t),this.fps=n,this.loadBytes=oh(r)}get size(){return this.viewport}addSettler(e){return this.settlers.add(e),()=>this.settlers.delete(e)}onFont(e){return this.fontListeners.add(e),()=>this.fontListeners.delete(e)}loadImage(e){let t=wt(e);return this.images.has(t)?Promise.resolve():dn(this.imageLoads,t,()=>this.decodeImage(e,t))}async decodeImage(e,t){let n=this.url(e,a=>a.getImageMeta(e)),r=await this.loadBytes(n),s;if(r.type==="image/svg+xml"||/\.svg(\?|#|$)/i.test(n)){let a=new Image;a.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await r.text())}`,await a.decode(),s=await createImageBitmap(a),this.vectors.set(t,{img:a,edge:Math.max(s.width,s.height)})}else s=await createImageBitmap(r,{colorSpaceConversion:"none"});let i=Math.max(s.width,s.height);if(i>$r){let a=$r/i,o=await createImageBitmap(s,{resizeWidth:Math.max(1,Math.round(s.width*a)),resizeHeight:Math.max(1,Math.round(s.height*a)),resizeQuality:"high"});s.close(),s=o}this.images.set(t,{bitmap:s,bytes:new Uint8Array(0),width:s.width,height:s.height})}loadVideo(e){let t=wt(e);return this.videos.has(t)?Promise.resolve():dn(this.videoLoads,t,()=>this.openVideo(e,t))}async openVideo(e,t){let n=this.url(e,a=>a.getVideoMeta(e)),r=new Cn({source:new ks(await this.loadBytes(n)),formats:Ss}),s=await r.getPrimaryVideoTrack();if(!s)throw r.dispose(),new Error(`loadVideo(${e}): no video track`);let i=await r.computeDuration();this.videos.set(t,{duration:i,sink:new Ts(s),input:r,frames:new Map,last:null})}videoFrame(e,t){let n=wt(e),r=this.videos.get(n);if(!r)return null;let s=r.frames.get(an(t));return s||(this.pending.set(`${n}@${an(t)}`,{src:n,time:t}),r.last)}wantImageEdge(e,t){let n=wt(e),r=this.vectors.get(n),s=this.images.get(n);if(!r||!s||t<=r.edge)return;let i=Math.max(s.width,s.height),a=Math.min($r,i*2**Math.ceil(Math.log2(t/i)));a>r.edge&&a>(this.upgrades.get(n)??0)&&this.upgrades.set(n,a)}hasPendingUpgrades(){return this.upgrades.size>0}async warmPendingUpgrades(){if(this.upgrades.size===0)return!1;let e=[...this.upgrades];this.upgrades.clear();for(let[t,n]of e){let r=this.vectors.get(t),s=this.images.get(t);if(!r||!s)continue;let i=n/Math.max(s.width,s.height),a=new OffscreenCanvas(Math.max(1,Math.round(s.width*i)),Math.max(1,Math.round(s.height*i)));a.getContext("2d").drawImage(r.img,0,0,a.width,a.height);let o=s.bitmap;s.bitmap=await createImageBitmap(a),r.edge=n,queueMicrotask(()=>o.close())}return!0}hasPendingDecodes(){return this.pending.size>0}async warmPendingDecodes(){let e=[...this.settlers].map(n=>n()).filter(n=>n!==null);if(this.pending.size===0&&e.length===0)return!1;let t=[...this.pending.values()];return this.pending.clear(),await Promise.all([...t.map(({src:n,time:r})=>dn(this.frameDecodes,`${n}@${an(r)}`,()=>this.decodeFrame(n,r))),...e]),!0}async decodeFrame(e,t){let n=this.videos.get(e);if(!n||n.frames.has(an(t)))return;let r=await n.sink.getSample(t);if(!r)return;let s=r.toVideoFrame(),i;try{i=await createImageBitmap(s)}finally{s.close(),r.close()}for(n.frames.set(an(t),i),n.last=i;n.frames.size>ih;){let[a,o]=n.frames.entries().next().value;n.frames.delete(a),o!==n.last&&queueMicrotask(()=>o.close())}}async loadAudio(){}fetchAudioData(e){let t=this.audioData.get(e);if(!t){let n=this.url(e,r=>{try{return r.getAudioMeta(e)}catch{return r.getVideoMeta(e)}});t=(async()=>(await this.loadBytes(n)).arrayBuffer())(),this.audioData.set(e,t),t.catch(()=>this.audioData.delete(e))}return t.then(n=>n.slice(0))}loadFont(e,t){return this.registeredFamilies.has(t)?Promise.resolve(!0):dn(this.fontLoads,t,()=>this.registerFamily(e,t))}async registerFamily(e,t){let n=this.catalog.getFontFamilyMetas(t);if(n.length===0)return this.getDecodePolicy()==="interactive"&&console.warn(`[WgpuStorageAdapter] No font manifest entry for "${e}".`),!1;let r=[...new Set(n.map(i=>i.src))],s=await Promise.all(r.map(async i=>new Uint8Array(await(await this.loadBytes(i)).arrayBuffer())));if(this.registeredFamilies.has(t))return!0;for(let i of s){let a={bytes:i,family:t};this.fonts.push(a);for(let o of this.fontListeners)o(a)}return this.registeredFamilies.add(t),!0}dispose(){for(let e of this.images.values())e.bitmap.close();this.images.clear();for(let e of this.videos.values()){for(let t of e.frames.values())t.close();e.input.dispose()}this.videos.clear(),this.pending.clear(),this.vectors.clear(),this.upgrades.clear(),this.fontListeners.clear(),this.imageLoads.clear(),this.videoLoads.clear(),this.fontLoads.clear(),this.frameDecodes.clear(),super.dispose()}url(e,t){try{return t(this.catalog).src||e}catch{return e}}};async function lh(e,t,n){return await bn(n),na(e,t)}var uh={fill:`// Provided to every WGSL fill:
704
704
  struct FillIn {
705
705
  uv: vec2f, // 0\u20131 across the fill's box, y down
706
706
  local: vec2f, // px from the box's top-left
@@ -730,5 +730,5 @@ fn sample_src_px(px: vec2f) -> vec4f // the same at device px; clamped at the
730
730
 
731
731
  // You write:
732
732
  fn effect(in: EffectIn) -> vec4f // premultiplied rgba
733
- `},Ld=.14,Fd=.06,xi=[[.98,.45,.4],[.35,.8,.5],[.35,.65,.98]],Bd=class la{backend;canvas;onDraw=null;last=null;images=new WeakMap;version=0;size="";constructor(t,n){this.backend=t,this.canvas=n}static async create(t,n){await cn(n);let r=new zi;await r.init(t,Math.max(1,t.width),Math.max(1,t.height)),r.setOptions(!1,!1),r.collectUnused=!0;let s=new la(r,t);return r.onShaderReady=()=>{s.last&&(s.draw(s.last),s.onDraw?.())},s}draw(t){this.last=t;let n=Math.max(1,this.canvas.width),r=Math.max(1,this.canvas.height);this.size!==`${n}x${r}`&&(this.backend.resize(n,r),this.size=`${n}x${r}`);let s=this.build(t,n,r);return this.backend.sync(s),this.backend.render(),this.status(t.scope,t.source)}async pixels(t){this.draw(t),await this.whenReady(),this.draw(t);let n=await this.backend.readPixels(),r=Math.max(1,this.canvas.width),s=Math.max(1,this.canvas.height),i=Uint8ClampedArray.from(n.subarray(0,r*s*4));for(let a=0;a<i.length;a+=4){let o=i[a+3];o===0||o===255||(i[a]=i[a]*255/o,i[a+1]=i[a+1]*255/o,i[a+2]=i[a+2]*255/o)}return new ImageData(i,r,s)}async snapshot(t,n="image/png",r){let s=await this.pixels(t),i=new OffscreenCanvas(s.width,s.height);return i.getContext("2d").putImageData(s,0,0),i.convertToBlob({type:n,quality:r})}whenReady(){return this.backend.whenShadersReady()}status(t,n){if(!n.trim())return{state:"empty",diagnostics:[]};let r=this.backend.shaders.program(t,n);return{state:r.state,diagnostics:[...r.report.diagnostics,...r.browser]}}destroy(){this.backend.onShaderReady=void 0,this.backend.destroy(),this.last=null}build(t,n,r){let s=new Bi(n,r,[0,0,0,0]),i=s.root,a=w=>t.image?this.cover(s,w,t.image,n,r):Ud(s,w,n,r),o=t.split==null?0:Math.min(1,Math.max(0,t.split))*n;if(t.scope==="fill"){t.image&&a(i);let w={kind:"shader",source:t.source,uniforms:t.uniforms,box:[0,0,n,r],time:t.time,...t.texture?{texture:this.asset(s,t.texture)}:{}},R=o>0?s.group(i,{clip:{x:o,y:0,w:n-o,h:r,r:0}}):i;return s.rect(R,{w:n,h:r,fill:w}),s}a(i);let l=Math.min(n,r),c=t.frame==="inset",u=c?l*Ld:0,f={x:u,y:u,w:n-2*u,h:r-2*u,r:c?l*Fd:0},d={type:"shader",language:"wgsl",source:t.source,uniforms:t.uniforms,mode:t.backdrop?"backdrop":"foreground",...t.blendMode&&!t.backdrop?{blendMode:t.blendMode}:{},...t.reach?{reach:t.reach}:{}},_=o>0?s.group(i,{clip:{x:o,y:0,w:n-o,h:r,r:0}}):i,p=[f.x,f.y,f.w,f.h];return t.backdrop?s.rect(_,{transform:[1,0,0,1,f.x,f.y],w:f.w,h:f.h,radii:[f.r,f.r,f.r,f.r],effects:[d],effectBox:[0,0,f.w,f.h],effectTime:t.time}):a(s.group(_,{clip:f,effects:[d],effectBox:p,effectTime:t.time})),s}asset(t,n){let r=t.addImage(n,n.width,n.height,{mipmaps:!1}),s=this.images.get(n);return s===void 0&&this.images.set(n,s=++this.version),r.version=s,r}cover(t,n,r,s,i){t.rect(n,{w:s,h:i,fill:{kind:"image",image:this.asset(t,r),fit:"fill",box:[0,0,s,i]}})}};function Ud(e,t,n,r){e.rect(t,{w:n,h:r,fill:{kind:"linear",from:[0,0],to:[n,r],stops:[{offset:0,color:[.16,.2,.42,1]},{offset:1,color:[.55,.25,.45,1]}]}});let s=Math.min(n,r),i=Math.max(12,Math.round(s/12)),a={kind:"solid",color:[1,1,1,.3]};for(let f=i;f<n;f+=i)e.rect(t,{transform:[1,0,0,1,f-.5,0],w:1,h:r,fill:a});for(let f=i;f<r;f+=i)e.rect(t,{transform:[1,0,0,1,0,f-.5],w:n,h:1,fill:a});let o=n/2,l=r/2,c=s*.1;xi.forEach((f,d)=>{let _=-Math.PI/2+d*2*Math.PI/xi.length,p=o+Math.cos(_)*s*.17,w=l+Math.sin(_)*s*.17;e.ellipse(t,{transform:[1,0,0,1,p-c,w-c],w:2*c,h:2*c,fill:{kind:"solid",color:[...f,1]}})});let u=s*.3;e.ellipse(t,{transform:[1,0,0,1,o-u,l-u],w:2*u,h:2*u,stroke:{paint:{kind:"solid",color:[1,1,1,.85]},width:Math.max(1.5,s/90)}})}async function Vr(){let e=navigator.gpu;if(!e)return!1;try{return await e.requestAdapter()!=null}catch{return!1}}async function ca(e={}){await cn(e.wasmUrl),Br().catch(()=>{});let{loadBytes:t}=e;return{createStorageAdapter({catalog:n,viewport:r,fps:s}){return new $f(n,r,s,t)},createRenderContext(n){return new Od(n,n.size)},createMeasureContext(n){let r=ia(n);return{measureText:(...s)=>aa(r,...s)}}}}var Bn=class extends Error{constructor(){super("Motion Script draws with WebGPU, and this browser has no WebGPU adapter."),this.name="WebGpuUnavailableError"}};async function ot(e={},{gpu:t=!0}={}){if(t&&!await Vr())throw new Bn;return ca({wasmUrl:e.rendererWasmUrl,loadBytes:qn})}function Un(e,t){if(t.returnBytes)return e;let n=new Blob([e.buffer],{type:t.mimeType}),r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t.filename,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}var zr={mp4:{kind:"video",extension:"mp4",mimeType:"video/mp4",container:()=>new Xn,audioCodec:"aac",video:{codecs:["avc","hevc","av1","vp9"],fallback:"avc"}},webm:{kind:"video",extension:"webm",mimeType:"video/webm",container:()=>new bs,audioCodec:"opus",video:{codecs:["vp9","av1","vp8"],fallback:"vp8"}},wav:{kind:"audio",extension:"wav",mimeType:"audio/wav",container:()=>new ys,audioCodec:"pcm-s16"},mp3:{kind:"audio",extension:"mp3",mimeType:"audio/mpeg",container:()=>new ws,audioCodec:"mp3"},m4a:{kind:"audio",extension:"m4a",mimeType:"audio/mp4",container:()=>new Xn,audioCodec:"aac"}},jd=zr;function Be(e){let t=zr[e];if(!t)throw new RangeError(`"${String(e)}" is not an export format; expected one of ${Object.keys(zr).join(", ")}.`);return t}function ua(e){return Be(e).kind==="audio"}var Hr=192e3,Nd=48e3;function Ut(e,t=Hr){let n=Be(e).audioCodec;return new gs({codec:n,bitrate:t,...n==="opus"&&{transform:{sampleRate:Nd}}})}var Gr=null;async function jn(e){let t=Be(e).audioCodec;if(t==="mp3"){Gr??=(async()=>{if(await Yn("mp3"))return;let{registerMp3Encoder:n}=await import("./chunks/mediabunny-mp3-encoder-ZCIHVVTJ.js");n()})();try{await Gr}catch(n){throw Gr=null,n}return}if(!t.startsWith("pcm-")&&!await Yn(t))throw new Error(`This browser has no ${t.toUpperCase()} encoder, so it cannot export ${e.toUpperCase()} audio.`)}var Hd=.2,Kd=2e6,qd=1e8;function ha(e,t,n){let r=e*t*n*Hd;return Math.round(Math.min(qd,Math.max(Kd,r)))}var Jd=1,Yd=2,Xd={image:{},video:{},audio:{},font:{}},un=class{format;audioOptions;target=new Et;output;video;audio=null;constructor(t,n,r,s,i={}){this.format=r,this.audioOptions=i;let a=n.width!==t.width||n.height!==t.height;this.video=new ms(t,{codec:s.codec,bitrate:s.bitrate,hardwareAcceleration:s.hardwareAcceleration,keyFrameInterval:s.keyFrameInterval,latencyMode:s.latencyMode,contentHint:s.contentHint,...s.bitrateMode!==void 0&&{bitrateMode:s.bitrateMode},...a&&{transform:{width:n.width,height:n.height,fit:"fill"}}}),this.output=new Tt({format:Be(r).container(),target:this.target})}async start(t){this.output.addVideoTrack(this.video,{frameRate:t.fps}),t.hasAudio&&(await jn(this.format),this.audio=Ut(this.format,this.audioOptions.bitrate??Hr),this.output.addAudioTrack(this.audio)),await this.output.start()}async addFrame(t,n){await this.video.add(t,n)}async addAudio(t){this.audio&&await this.audio.add(t)}async finalize(){this.video.close(),this.audio?.close(),await this.output.finalize();let t=this.target.buffer;if(!t)throw new Error("Export produced no data");return new Uint8Array(t)}};function fa(e){let t=Math.round(e);return t%2===0?t:t+1}var Zd=8192;function Qd(e,t){let n=Math.max(t.width,t.height),r=Math.max(1,Math.round(e));for(;r>1&&n*r>Zd;)r--;return r}async function eh(e,t,n,r){let{codecs:s,fallback:i}=Be(t).video,a=e??s[0];s.includes(a)||(console.warn(`[motionscript] ${t.toUpperCase()} cannot hold ${a}; exporting as ${da[s[0]]} instead.`),a=s[0]);for(let o of new Set([a,s[0],i]))if(o===i||await th(o,n,r))return o!==a&&console.warn(`[motionscript] No ${a} encoder available; exporting as ${da[o]} instead.`),o;return i}var da={avc:"H.264",hevc:"HEVC",vp9:"VP9",av1:"AV1",vp8:"VP8"};async function th(e,t,n){try{return await fs(e,{width:t.width,height:t.height,bitrate:ha(t.width,t.height,n)})}catch{return!1}}async function Kr(e,t,n,r){return{codec:await eh(e?.codec,t,n,r),bitrate:e?.bitrate??ha(n.width,n.height,r),hardwareAcceleration:e?.hardwareAcceleration??"no-preference",keyFrameInterval:e?.keyFrameInterval??Jd,latencyMode:e?.latencyMode??"quality",contentHint:e?.contentHint??"detail",...e?.bitrateMode!==void 0&&{bitrateMode:e.bitrateMode}}}function _a(e,t){let{bitrate:n}=e;return typeof n=="number"?{...e,bitrate:n}:{...e,bitrate:n._toVideoBitrate(e.codec,t.width,t.height)}}function fn(e,t,n){let r={width:fa(e.width*t),height:fa(e.height*t)},s=Qd(n,r);return{output:r,oversample:s,renderScale:t*s}}async function qr(e){let t=document.createElement("canvas");t.width=e.canvasSize.width,t.height=e.canvasSize.height,t.style.display="none",document.body.appendChild(t);try{let n=new Vd(e.manifest),r=await ot(e),s=r.createStorageAdapter({catalog:n,viewport:e.viewport,fps:e.fps}),i=r.createRenderContext(s);return i.mount(t),await i.whenMounted?.(),{canvas:t,renderContext:i,storageAdapter:s,assetCatalog:n,dispose:()=>{i.dispose(),t.remove()}}}catch(n){throw t.remove(),n}}async function Jr(e){let{document:t,registry:n=new Gd,scale:r=1,format:s="mp4",manifest:i=Xd,theme:a,includeAudio:o=!0,video:l,audio:c={},frames:u,onProgress:f,signal:d,rendererWasmUrl:_,supersample:p=Yd,returnBytes:w=!1}=e,R=Be(s);if(R.kind!=="video")throw new RangeError(`exportVideo writes video; "${s}" is audio, which exportAudio writes.`);let L=e.filename??`export.${R.extension}`,F=zd(t,e,Wd);if(F.tracks.length===0)return;d?.throwIfAborted();let H=F.viewport,se=F.fps,{output:X,oversample:ye,renderScale:ve}=fn(H,r,p),q=await qr({canvasSize:{width:X.width*ye,height:X.height*ye},viewport:H,fps:se,manifest:i,rendererWasmUrl:_}),oe;try{let K=await Kr(l,s,X,se);oe=await Sn({project:F,registry:n,theme:a,scale:ve,includeAudio:o,frames:u,renderContext:q.renderContext,storageAdapter:q.storageAdapter,assetCatalog:q.assetCatalog,sink:new un(q.canvas,X,s,K,c),mixer:new vs(c.sampleRate,q.assetCatalog),onProgress:f,onIssue:e.onIssue,signal:d})}finally{q.dispose()}if(oe)return Un(oe,{returnBytes:w,filename:L,mimeType:R.mimeType})}import{DEFAULT_OUTPUT as nh,ManifestAssetCatalog as rh,AssetTimeline as sh,Registry as ih,resolveProjectDocument as ah}from"@motionscript/core";var oh={image:{},video:{},audio:{},font:{}};async function dn(e){let{registry:t=new ih,manifest:n=oh,sampleRate:r}=e,s=ah(e.document,e,nh);if(s.tracks.length===0)return null;let i=s.viewport,a=s.fps,o=await ot(e,{gpu:!1}),l=new rh(n),c=o.createStorageAdapter({catalog:l,viewport:i,fps:a}),u=o.createMeasureContext(c),f=new sh(s,{registry:t,viewport:i,fps:a,assets:l,measurer:u},{assets:!1});try{let d=f.run(),_=tr(d);return _.length===0?null:await Zn(_,d.totalDuration,{sampleRate:r,catalog:l})}finally{f.dispose(),c.dispose()}}var Nn=class extends Error{name="NoAudioError";constructor(){super("The timeline has no audio to export.")}};async function Yr(e){let{format:t="wav",audio:n={},onProgress:r,signal:s,returnBytes:i=!1}=e,a=Be(t);if(a.kind!=="audio")throw new RangeError(`exportAudio writes audio; "${t}" is video, which exportVideo writes.`);s?.throwIfAborted(),await jn(t);let o=await dn({document:e.document,registry:e.registry,viewport:e.viewport,fps:e.fps,manifest:e.manifest,sampleRate:n.sampleRate,rendererWasmUrl:e.rendererWasmUrl});if(o===null)throw new Nn;s?.throwIfAborted(),r?.(.5);let l=new Et,c=new Tt({format:a.container(),target:l}),u=Ut(t,n.bitrate);if(c.addAudioTrack(u),await c.start(),await u.add(o),u.close(),await c.finalize(),!l.buffer)throw new Error("Export produced no data");return r?.(1),Un(new Uint8Array(l.buffer),{returnBytes:i,filename:e.filename??`export.${a.extension}`,mimeType:a.mimeType})}import{DEFAULT_OUTPUT as hh,resolveProjectDocument as _h}from"@motionscript/core";import{DEFAULT_OUTPUT as pa,ManifestAssetCatalog as ma,frameSpecAtTime as lh,Registry as ch,resolveProjectDocument as uh}from"@motionscript/core";var fh={image:{},video:{},audio:{},font:{}};function dh(e,t){if(e?.time!==void 0)return lh(e.time,t);let n=e?.frame;return n===void 0||n==="first"?{kind:"first"}:n==="last"?{kind:"last"}:typeof n=="number"?{kind:"frame",frame:n}:n}function ga(e){return e==="jpeg"?"image/jpeg":"image/png"}var jt=class{canvas;renderContext;storageAdapter;catalog;backend;ownsCanvas;viewportValue;fpsValue;scaleValue;surfaceScale;manifest;theme;registry;disposed=!1;drawn=!1;constructor(t,n){this.backend=t,this.viewportValue=n.viewport??pa.viewport,this.fpsValue=n.fps??pa.fps,this.scaleValue=n.scale??1,this.surfaceScale=this.scaleValue,this.manifest=n.manifest??fh,this.theme=n.theme,this.registry=n.registry??new ch,this.ownsCanvas=n.canvas===void 0,this.canvas=n.canvas??document.createElement("canvas"),this.ownsCanvas&&(this.canvas.style.display="none",document.body.appendChild(this.canvas)),this.sizeCanvas(),this.catalog=new ma(this.manifest),this.storageAdapter=this.backend.createStorageAdapter({catalog:this.catalog,viewport:this.viewportValue,fps:this.fpsValue}),this.renderContext=this.backend.createRenderContext(this.storageAdapter),this.renderContext.mount(this.canvas)}get viewport(){return this.viewportValue}get fps(){return this.fpsValue}get scale(){return this.scaleValue}async render(t,n){this.assertLive();let r=n?.scale??this.scaleValue;r!==this.surfaceScale&&this.remount(r),await this.renderContext.whenMounted?.();let s=uh(t,{viewport:this.viewportValue},{viewport:this.viewportValue,fps:this.fpsValue}),i=await Ts({project:s,registry:this.registry,theme:this.theme,scale:r,renderContext:this.renderContext,storageAdapter:this.storageAdapter,assetCatalog:this.catalog,frame:dh(n,s.fps),onIssue:n?.onIssue});return this.drawn=!0,i}setTheme(t){this.theme=t}setManifest(t){this.assertLive(),this.manifest=t,this.catalog=new ma(t),this.storageAdapter.setCatalog(this.catalog)}setViewport(t){this.assertLive(),!(t.width===this.viewportValue.width&&t.height===this.viewportValue.height)&&(this.viewportValue=t,this.renderContext.dispose(),this.storageAdapter=this.backend.createStorageAdapter({catalog:this.catalog,viewport:t,fps:this.fpsValue}),this.renderContext=this.backend.createRenderContext(this.storageAdapter),this.remount(this.scaleValue))}async toBytes(t){let n=await this.toBlob(t);return new Uint8Array(await n.arrayBuffer())}toBlob(t){let n=this.snapshotToCanvas(),{format:r="png",quality:s=.92}=t??{};return new Promise((i,a)=>{n.toBlob(o=>o?i(o):a(new Error("Still encode produced no data.")),ga(r),s)})}toDataURL(t){let{format:n="png",quality:r=.92}=t??{};return this.snapshotToCanvas().toDataURL(ga(n),r)}dispose(){this.disposed||(this.disposed=!0,this.renderContext.dispose(),this.ownsCanvas&&this.canvas.remove())}snapshotToCanvas(){if(this.assertLive(),!this.drawn)throw new Error("Nothing has been rendered yet.");let t=this.renderContext.snapshotCanvas?.();if(!t)throw new Error("Still encode: could not read the surface into a 2d canvas.");return t}sizeCanvas(){this.canvas.width=this.viewportValue.width*this.surfaceScale,this.canvas.height=this.viewportValue.height*this.surfaceScale}remount(t){this.surfaceScale=t,this.drawn=!1,this.sizeCanvas(),this.renderContext.mount(this.canvas)}assertLive(){if(this.disposed)throw new Error("This StillRenderer has been disposed.")}};async function Xr(e={}){return new jt(await ot(e),e)}async function ph(e){let{registry:t,scale:n,manifest:r,theme:s,rendererWasmUrl:i,frame:a,format:o="png",quality:l=.92}=e,c=_h(e.document,e,hh);if(c.tracks.length===0)throw new Error("The project has no tracks to screenshot.");let u=await Xr({viewport:c.viewport,fps:c.fps,scale:n,manifest:r,theme:s,rendererWasmUrl:i,registry:t});try{return{...await u.render(c,{frame:a}),bytes:await u.toBytes({format:o,quality:l})}}finally{u.dispose()}}var kt=class extends Error{segment;constructor(t,n){super(n),this.segment=t,this.name="ConcatMismatchError"}};function mh(e,t){if(e.codec!==t.codec||e.codedWidth!==t.codedWidth||e.codedHeight!==t.codedHeight)return!1;let n=ba(e.description),r=ba(t.description);if(n===null||r===null)return n===r;if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(n[s]!==r[s])return!1;return!0}function ba(e){return e?ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e):null}function Wn(e={}){let t=null,n=null,r=null,s=null,i=null,a=0,o=0,l=async c=>{i=e.stream?new _s(e.stream):new Et,n=new Tt({format:Be(c.format).container(),target:i}),r=new ps(c.track.codec),n.addVideoTrack(r),s=e.audio?Ut(c.format,e.audioBitrate):null,s&&n.addAudioTrack(s),await n.start(),s&&e.audio&&await s.add(e.audio)};return{async append(c){let u=a++,f=new xn({source:new os(c),formats:[cs,Jn]});try{let d=await gh(f,u,t);t||(t=d,await l(d));let _=!0;for await(let p of new ds(d.track).packets())await r.add(p.clone({timestamp:p.timestamp+o}),_?{decoderConfig:d.config}:void 0),_=!1;o+=d.duration}finally{f.dispose()}},async finish(){if(!n)throw new Error("concatVideoSegments: no segments");if(r.close(),s?.close(),await n.finalize(),e.stream)return new Uint8Array(0);let c=i.buffer;if(!c)throw new Error("concatVideoSegments produced no data");return new Uint8Array(c)},async cancel(){n&&n.state!=="finalized"&&n.state!=="canceled"&&await n.cancel()}}}async function gh(e,t,n){let r=await e.getFormat()===Jn?"webm":"mp4";if(n&&r!==n.format)throw new kt(t,`Segment ${t} is ${r} and segment 0 is ${n.format}.`);let s=await e.getPrimaryVideoTrack();if(!s)throw new kt(t,`Segment ${t} has no video track.`);let i=await s.getDecoderConfig();if(!i)throw new kt(t,`Segment ${t} has no decoder configuration.`);if(n&&!mh(n.config,i))throw new kt(t,`Segment ${t} was encoded differently from segment 0 (${n.config.codec} ${n.config.codedWidth}x${n.config.codedHeight} vs ${i.codec} ${i.codedWidth}x${i.codedHeight}); joining them would decode as garbage.`);return{format:r,track:s,config:i,duration:await s.computeDuration()}}async function bh(e,t={}){if(e.length===0)throw new Error("concatVideoSegments: no segments");if(e.length===1&&!t.audio&&!t.stream)return e[0];let n=Wn(t);try{for(let r of e)await n.append(r);return await n.finish()}catch(r){throw await n.cancel().catch(()=>{}),r}}import{DEFAULT_OUTPUT as yh,placeTracks as vh,Registry as xh,renderIssueKey as kh,resolveProjectDocument as Mh,totalFramesOf as Sh}from"@motionscript/core";function wa(e,t){if(!Number.isInteger(e)||e<=0)return[];let n=Math.max(1,Math.round(t.fps*(t.keyFrameInterval>0?t.keyFrameInterval:1))),r=t.chunkSeconds??Math.min(6,Math.max(2,e/t.fps/(Math.max(1,t.lanes)*4))),s=Math.max(n,Math.round(r*t.fps/n)*n),i=[];for(let o=0;o<e;o+=s)i.push({index:i.length,start:o,end:Math.min(e,o+s)});let a=i[i.length-1];return i.length>1&&a.end-a.start<n&&(i.pop(),i[i.length-1].end=a.end),i}var Vn=class{_options;_active=1;_settled;_window=ya();_previousFps=0;_newestFirstAt=null;_windowMs;_minFrames;_maxWaitShare;_minGain;_warmupMs;constructor(t){this._options=t,this._windowMs=t.windowMs??1500,this._minFrames=t.minFrames??24,this._maxWaitShare=t.maxWaitShare??.45,this._minGain=t.minGain??1.1,this._warmupMs=t.warmupMs??300,this._settled=t.lanes<=1}get active(){return this._active}get settled(){return this._settled}laneLost(t){this._active=Math.max(1,Math.min(this._active,t)),this._settled=!0}record(t){if(this._settled||t.lane>=this._active)return null;let n=this._window;if(n.start===null)return t.lane!==this._active-1||(this._newestFirstAt??=t.at,t.at-this._newestFirstAt>=this._warmupMs&&(n.start=t.at)),null;n.frames+=t.frames,n.busyMs+=t.busyMs,n.waitMs+=t.waitMs;let r=t.at-n.start;if(r<this._windowMs||n.frames<this._minFrames)return null;let s=n.frames*1e3/r,i=n.waitMs/Math.max(1,n.busyMs+n.waitMs),a=this._active;return this._active>1&&s<this._previousFps*this._minGain?(this._active-=1,this._settled=!0):i<=this._maxWaitShare&&this._active<this._options.lanes?(this._previousFps=s,this._active+=1):this._settled=!0,this._window=ya(),this._newestFirstAt=null,this._active!==a?this._active:null}};function ya(){return{start:null,frames:0,busyMs:0,waitMs:0}}var wh=2;async function va(e){let{lanes:t,spec:n,chunks:r,signal:s}=e,i=e.now??(()=>performance.now());if(t.length===0)throw new Error("runLanes: no lanes");if(r.length===0)return;let a=new AbortController,o=()=>a.abort(s?.reason);s?.aborted&&o(),s?.addEventListener("abort",o,{once:!0});let l=new Vn({lanes:t.length,...e.governor}),c=r.map(q=>({chunk:q,attempts:0})),u=new Map,f=new Set,d=0,_=r.reduce((q,oe)=>q+(oe.end-oe.start),0),p=null,w=()=>{},R=new Promise(q=>w=q),L=()=>{let q=w;R=new Promise(oe=>w=oe),q()};a.signal.addEventListener("abort",L,{once:!0});let F=()=>t.length-f.size,H=q=>{let oe=0;for(let K=0;K<q;K++)f.has(K)||oe++;return oe<l.active},se=q=>{f.add(q),l.laneLost(F()),e.onActive?.(l.active),L()},X=()=>{let q=d;for(let oe of u.values())q+=oe;return q},ye=()=>{let q=c.shift();if(!l.settled||q.attempts>0)return q;let oe=c.reduce((xe,we)=>xe+(we.chunk.end-we.chunk.start),q.chunk.end-q.chunk.start),K=Math.ceil(oe/(l.active===1?1:l.active*2)),{end:B}=q.chunk;for(;c.length>0&&c[0].attempts===0&&c[0].chunk.start===B&&B-q.chunk.start<K;)B=c.shift().chunk.end;return{chunk:{...q.chunk,end:B},attempts:0}},ve=async q=>{for(;!H(q)&&_>0&&!a.signal.aborted&&!f.has(q);)await R;if(_===0||a.signal.aborted||f.has(q))return;let oe;try{oe=await t[q].open(n,a.signal)}catch(K){if(a.signal.aborted)return;if(F()<=1)throw K;console.warn(`[motionscript] export lane ${q} failed to open; continuing without it.`,K),se(q);return}try{for(;;){if(a.signal.throwIfAborted(),_===0)return;if(!H(q)||c.length===0){await R;continue}let K=ye(),B=K.chunk.end-K.chunk.start,xe={frames:0,busyMs:0,waitMs:0};u.set(K,0);try{let we=await oe.render(K.chunk,Te=>{let Ue=l.record({lane:q,frames:Te.frames-xe.frames,busyMs:Te.busyMs-xe.busyMs,waitMs:Te.waitMs-xe.waitMs,at:i()});for(let ae of Te.issues??[])e.onIssue?.(ae);Object.assign(xe,{frames:Te.frames,busyMs:Te.busyMs,waitMs:Te.waitMs}),u.set(K,Te.frames),e.onFrames?.(X()),Ue!==null&&(e.onActive?.(Ue),L())},a.signal);u.delete(K),d+=B,_-=B,e.onFrames?.(X()),e.onChunk(K.chunk,we),L()}catch(we){if(u.delete(K),a.signal.aborted||++K.attempts>=wh||F()<=1)throw we;console.warn(`[motionscript] export lane ${q} failed frames ${K.chunk.start} to ${K.chunk.end}; retrying on another lane.`,we),c.unshift(K),e.onFrames?.(X()),se(q);return}}}finally{oe.close()}};try{if(await Promise.all(t.map((q,oe)=>ve(oe).catch(K=>{p??=K,a.abort(K)}))),p)throw p;if(_>0)throw new Error(`runLanes: ${_} frames were never rendered.`)}finally{s?.removeEventListener("abort",o)}}var Ah={image:{},video:{},audio:{},font:{}},Eh=2,Th=.97;async function Ph(e){let{registry:t=new xh,scale:n=1,format:r="mp4",manifest:s=Ah,includeAudio:i=!0,audio:a={},signal:o,onProgress:l,supersample:c=Eh}=e;if(Be(r).kind!=="video")throw new RangeError(`exportVideoParallel writes video; "${r}" is audio, which exportAudio writes.`);let u=Mh(e.document,e,yh);if(u.tracks.length===0)throw new Error("exportVideoParallel: the project has no tracks.");o?.throwIfAborted();let f=u.fps,d=Sh(vh(u.tracks,f)),{output:_}=fn(u.viewport,n,c),p=_a(await Kr(e.video,r,_,f),_),w={project:u,manifest:s,theme:e.theme,scale:n,supersample:c,format:r,encoding:p,host:e.host},R=wa(d,{fps:f,keyFrameInterval:p.keyFrameInterval,lanes:e.lanes.length,chunkSeconds:e.chunkSeconds}),L=i?dn({document:u,registry:t,manifest:s,sampleRate:a.sampleRate,rendererWasmUrl:e.rendererWasmUrl}):Promise.resolve(null);L.catch(()=>{});let F=0,H=new Set,se=xe=>{xe<=F||(F=xe,l?.(xe))},X=new AbortController,ye=()=>X.abort(o?.reason);o?.aborted&&ye(),o?.addEventListener("abort",ye,{once:!0});let ve=new Map,q=0,oe=Promise.resolve(),K=null,B=()=>(oe=oe.then(async()=>{for(;ve.has(q);){K??=Wn({stream:e.stream,audio:await L,audioBitrate:a.bitrate});let{end:xe,bytes:we}=ve.get(q);ve.delete(q),q=xe,await K.append(we)}}),oe);try{if(await va({lanes:e.lanes,spec:w,chunks:R,signal:X.signal,onIssue:we=>{let Te=kh(we);H.has(Te)||(H.add(Te),e.onIssue?.(we))},onFrames:we=>se(Th*Math.min(1,we/d)),onActive:e.onLanes,onChunk:(we,Te)=>{ve.set(we.start,{end:we.end,bytes:Te}),B().catch(Ue=>X.abort(Ue))}}),await B(),q!==d)throw new Error(`exportVideoParallel: joined ${q} of ${d} frames.`);let xe=await K.finish();return se(1),xe}catch(xe){throw await oe.catch(()=>{}),await K?.cancel().catch(()=>{}),xe}finally{o?.removeEventListener("abort",ye)}}import{Registry as Ih}from"@motionscript/core";var Rh=100;async function Qr(e,t){let{project:n}=e,r=n.viewport,s=n.fps,i=t.registry??new Ih,{output:a,oversample:o,renderScale:l}=fn(r,e.scale,e.supersample),c=await qr({canvasSize:{width:a.width*o,height:a.height*o},viewport:r,fps:s,manifest:e.manifest,rendererWasmUrl:t.rendererWasmUrl});return{async render(u,f,d){let _=new Zr(new un(c.canvas,a,e.format,e.encoding),f),p=await Sn({project:n,registry:i,theme:e.theme,scale:l,includeAudio:!1,frames:{start:u.start,end:u.end},renderContext:c.renderContext,storageAdapter:c.storageAdapter,assetCatalog:c.assetCatalog,sink:_,signal:d,onIssue:w=>_.issues.push(w)});if(_.flush(),!p)throw new Error(`Frames ${u.start} to ${u.end} produced no bytes.`);return p},close:()=>c.dispose()}}var Zr=class{_inner;_onReport;issues=[];_frames=0;_busyMs=0;_waitMs=0;_lastEnd=0;_lastReport=0;constructor(t,n){this._inner=t,this._onReport=n}async start(t){await this._inner.start(t),this._lastEnd=this._lastReport=performance.now()}async addFrame(t,n){let r=performance.now();this._busyMs+=r-this._lastEnd,await this._inner.addFrame(t,n);let s=performance.now();this._waitMs+=s-r,this._lastEnd=s,this._frames++,s-this._lastReport>=Rh&&(this._lastReport=s,this.flush())}finalize(){return this._inner.finalize()}flush(){let t=this.issues.splice(0);this._onReport({frames:this._frames,busyMs:this._busyMs,waitMs:this._waitMs,...t.length>0&&{issues:t}})}};function Ch(e={}){return{open:t=>Qr(t,e)}}function Oh(e,t){let n=new Error(e);return n.name=t,n}function $h(e,t={}){let n=1,r=null,s=new Map;e.addEventListener("message",o=>{let l=o.data,c=s.get(l.id);if(c){if(l.t==="report"){c.onReport?.(l.report);return}s.delete(l.id),l.t==="error"?c.reject(Oh(l.message,l.name)):c.resolve(l)}}),e.start();let i=o=>{r??=new Error(o);for(let l of s.values())l.reject(r);s.clear()};e.addEventListener("close",()=>i("The export lane closed.")),t.lost?.then(()=>i("The export lane was lost."),()=>i("The export lane was lost."));let a=(o,l,c)=>new Promise((u,f)=>{if(r)return f(r);if(l.aborted)return f(l.reason);let d=()=>{s.delete(o.id),e.postMessage({t:"abort",id:o.id}),f(l.reason)};l.addEventListener("abort",d,{once:!0}),s.set(o.id,{resolve:_=>{l.removeEventListener("abort",d),u(_)},reject:_=>{l.removeEventListener("abort",d),f(_)},onReport:c}),e.postMessage(o)});return{async open(o,l){let c=n++;return await a({t:"open",id:c,spec:o},l),{async render(u,f,d){return(await a({t:"render",id:n++,session:c,chunk:u},d,f)).bytes},close(){r||e.postMessage({t:"close",id:c})}}}}}function Dh(e,t){let n=new Map,r=new Map,s=(o,l=[])=>e.postMessage(o,l),i=(o,l)=>s({t:"error",id:o,message:l instanceof Error?l.message:String(l),name:l instanceof Error?l.name:"Error"}),a=async o=>{let l=o.data;switch(l.t){case"open":{let c=Promise.resolve(t(l.spec)).then(u=>Qr(l.spec,u));n.set(l.id,c);try{await c,s({t:"opened",id:l.id})}catch(u){n.delete(l.id),i(l.id,u)}return}case"render":{let c=new AbortController;r.set(l.id,c);try{let u=await n.get(l.session);if(!u)throw new Error(`No open export session ${l.session}.`);let f=await u.render(l.chunk,_=>s({t:"report",id:l.id,report:_}),c.signal),d=f.byteOffset===0&&f.byteLength===f.buffer.byteLength?f:f.slice();s({t:"done",id:l.id,bytes:d},[d.buffer])}catch(u){c.signal.aborted||i(l.id,u)}finally{r.delete(l.id)}return}case"abort":r.get(l.id)?.abort(new DOMException("Export cancelled.","AbortError"));return;case"close":{let c=n.get(l.id);n.delete(l.id),c?.then(u=>u.close(),()=>{});return}}};return e.addEventListener("message",a),e.start(),()=>{e.removeEventListener("message",a);for(let o of r.values())o.abort(new DOMException("Export cancelled.","AbortError"));for(let o of n.values())o.then(l=>l.close(),()=>{});n.clear()}}import{Ticker as Lh}from"@motionscript/core";var hn=class extends Lh{contextOf;ownsContext;_context=null;fps;playStartCtxTime=0;seekOffset=0;speed=1;reverse=!1;rafId=null;seekEpoch=0;silentSource=null;constructor(t){super();let{context:n}=t;this.contextOf=typeof n=="function"?n:()=>n??new AudioContext,this.ownsContext=!n,this.fps=t.fps}getContext(){return this._context??=this.contextOf(),this._context}get context(){return this.getContext()}seek(t){let n=Math.max(0,Math.min(t,this.duration));this.seekOffset=n,this.isPlaying&&(this.playStartCtxTime=this.context.currentTime),this.seekEpoch++,this.setCurrentTime(n)}play(t=1,n=!1){this.speed=t,this.reverse=n,this.seekOffset=this.currentTime,this.context.state==="suspended"&&this.context.resume().then(()=>{!this.isPlaying&&this.context.state==="running"&&this.context.suspend()},r=>{console.error("[WebTicker] The audio context could not resume:",r),this.pause()}),this.playStartCtxTime=this.context.currentTime,this.startSilentTicker(),super.play(t,n),this.startLoop()}pause(){this.seekOffset=this.currentTime,this.stopLoop(),this.stopSilentTicker(),this._context?.state==="running"&&this._context.suspend(),super.pause()}startSilentTicker(){this.stopSilentTicker();let t=Math.max(.001,this.duration-this.seekOffset),n=this.context.sampleRate,r=this.context.createBuffer(1,Math.ceil(t*n),n),s=this.context.createBufferSource();s.buffer=r,s.connect(this.context.destination),s.start(),this.silentSource=s}stopSilentTicker(){if(this.silentSource){try{this.silentSource.onended=null,this.silentSource.stop(),this.silentSource.disconnect()}catch{}this.silentSource=null}}position(){let t=(this.context.currentTime-this.playStartCtxTime)*this.speed,n=this.reverse?this.seekOffset-t:this.seekOffset+t,r=Math.max(0,Math.min(n,this.duration));return{time:r,ended:this.reverse?r<=0:r>=this.duration}}startLoop(){if(this.rafId!==null)return;let t=a=>Math.floor(a*this.fps+1e-6),n=t(this.currentTime),r=null,s=a=>{let o=this.position(),l=o.time;if(!o.ended&&r&&r.epoch===this.seekEpoch){let c=(a-r.at)/1e3*this.speed,u=this.reverse?r.time-c:r.time+c,f=o.time-u,d=u+f*.05;Math.abs(f)<=.05&&d>0&&d<this.duration&&(l=d)}return r={time:l,at:a,epoch:this.seekEpoch},{time:l,ended:o.ended}},i=async a=>{let o=this.seekEpoch,l=s(a),c=l.ended,f=t(l.time)!==n||c;this.setCurrentTime(l.time,f);let d=()=>{this.seekEpoch!==o&&(o=this.seekEpoch,n=t(this.currentTime),c=this.position().ended)};if(d(),f&&(n=t(this.currentTime),await this.tick(),d()),this.rafId!==null){if(c){this.pause();return}this.rafId=requestAnimationFrame(i)}};this.rafId=requestAnimationFrame(i)}stopLoop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}dispose(){this.stopLoop(),this.stopSilentTicker(),this.ownsContext&&this._context?.close(),super.dispose()}};import{Engine as Nh}from"@motionscript/core";var Gn=Ya(xa(),1);import*as Fh from"@motionscript/core/sdk";function Bh(){return new URL("esbuild-wasm/esbuild.wasm",import.meta.url).href}var Uh;function jh(e){return Uh??=(async()=>(await Gn.initialize({wasmURL:e??Bh()}),async t=>{let{code:n}=await Gn.transform(t,{loader:"ts",format:"cjs",target:"es2020"});return n}))()}function ka(e,t){return{sdk:e?.sdk??Fh,modules:e?.modules,compile:e?.compile??(async n=>(await jh(t))(n))}}var ts=class{backend;defaults;still=null;stillRegistry=null;stillQueue=Promise.resolve();constructor(t,n){this.backend=t,this.defaults=n}async exportVideo(t){let n=t.encode??{};return n.format&&ua(n.format)?Yr({document:t.project,registry:t.registry,manifest:t.manifest,format:n.format,audio:n.audio??this.defaults.audio,filename:n.filename,returnBytes:n.download!==!0,onProgress:t.onProgress,signal:t.signal,rendererWasmUrl:this.defaults.rendererWasmUrl}):Jr({document:t.project,registry:t.registry,scale:t.scale,manifest:t.manifest,includeAudio:t.includeAudio,frames:t.frames,format:n.format,video:n.video??this.defaults.video,audio:n.audio??this.defaults.audio,supersample:n.supersample,filename:n.filename,returnBytes:n.download!==!0,onProgress:t.onProgress,onIssue:t.onIssue,signal:t.signal,rendererWasmUrl:this.defaults.rendererWasmUrl})}exportStill(t){let n=this.stillQueue.then(()=>this.drawStill(t));return this.stillQueue=n.catch(()=>{}),n}dispose(){this.still?.dispose(),this.still=null}async drawStill(t){let n=this.renderer(t),r=await n.render(t.project,{scale:t.scale,onIssue:t.onIssue,...Wh(t.frame)});return{bytes:await n.toBytes({format:t.format,quality:t.quality}),frame:r.frame,totalFrames:r.totalFrames}}renderer(t){let{project:n,registry:r}=t;if(n.viewport===void 0||n.fps===void 0)throw new Error("exportStill takes a project whose fps and viewport are resolved \u2014 see Session.");return this.still&&this.stillRegistry!==r&&this.dispose(),this.still??=new jt(this.backend,{viewport:n.viewport,fps:n.fps,manifest:t.manifest,registry:r}),this.stillRegistry=r,this.still.setViewport(n.viewport),t.manifest&&this.still.setManifest(t.manifest),this.still}};function Wh(e){return e.kind==="frame"?{frame:e.frame}:{frame:e.kind}}async function Vh(e={}){let t=e.nodes,n=Array.isArray(t)?t.filter(c=>typeof c!="string"):t,r=Array.isArray(t)?t.filter(c=>typeof c=="string"):[],s=ka(e.dynamicNodes,e.compilerWasmUrl),i=await ot(e),a=new ts(i,{video:e.video,audio:e.audio,rendererWasmUrl:e.rendererWasmUrl}),o={createStorageAdapter:c=>i.createStorageAdapter(c),createRenderContext:c=>i.createRenderContext(c),createMeasureContext:c=>i.createMeasureContext(c),createAudioSink(){return new Qn},createTicker(c,u){let f=u;return new hn({context:()=>f.getContext(),fps:c})},createExporter(){return a},dispose(){a.dispose(),i.dispose?.()}},l=new Nh(o,{...e,nodes:n,dynamicNodes:s});for(let c of r)await l.registerNode(c);return l}export{kt as ConcatMismatchError,jd as EXPORT_FORMATS,Nn as NoAudioError,Mn as NothingToDrawError,to as QUALITY_HIGH,Qa as QUALITY_LOW,eo as QUALITY_MEDIUM,no as QUALITY_VERY_HIGH,Za as QUALITY_VERY_LOW,Bd as ShaderPreview,jt as StillRenderer,Dd as WGSL_PRELUDE,Qn as WebAudioPlayer,Bn as WebGpuUnavailableError,hn as WebTicker,bh as concatVideoSegments,Vh as createBrowserEngine,Wn as createSegmentJoiner,Xr as createStillRenderer,ro as encodeWav,Yr as exportAudio,ph as exportScreenshot,Jr as exportVideo,Ph as exportVideoParallel,Vr as isWgpuSupported,qn as loadAssetBytes,Ch as localLane,$h as messagePortLane,Zn as mixAudio,dn as mixTimelineAudio,Sd as onWgpuEvent,Dh as serveExportLane,Xa as setAssetByteSource,$d as validateShader};
733
+ `},fh=.14,dh=.06,Ui=[[.98,.45,.4],[.35,.8,.5],[.35,.65,.98]],hh=class Oa{backend;canvas;onDraw=null;last=null;images=new WeakMap;version=0;size="";constructor(t,n){this.backend=t,this.canvas=n}static async create(t,n){await bn(n);let r=new Qr;await r.init(t,Math.max(1,t.width),Math.max(1,t.height)),r.setOptions(!1,!1),r.collectUnused=!0;let s=new Oa(r,t);return r.onShaderReady=()=>{s.last&&(s.draw(s.last),s.onDraw?.())},s}draw(t){this.last=t;let n=Math.max(1,this.canvas.width),r=Math.max(1,this.canvas.height);this.size!==`${n}x${r}`&&(this.backend.resize(n,r),this.size=`${n}x${r}`);let s=this.build(t,n,r);return this.backend.sync(s),this.backend.render(),this.status(t.scope,t.source)}async pixels(t){this.draw(t),await this.whenReady(),this.draw(t);let n=await this.backend.readPixels(),r=Math.max(1,this.canvas.width),s=Math.max(1,this.canvas.height),i=Uint8ClampedArray.from(n.subarray(0,r*s*4));for(let a=0;a<i.length;a+=4){let o=i[a+3];o===0||o===255||(i[a]=i[a]*255/o,i[a+1]=i[a+1]*255/o,i[a+2]=i[a+2]*255/o)}return new ImageData(i,r,s)}async snapshot(t,n="image/png",r){let s=await this.pixels(t),i=new OffscreenCanvas(s.width,s.height);return i.getContext("2d").putImageData(s,0,0),i.convertToBlob({type:n,quality:r})}whenReady(){return this.backend.whenShadersReady()}status(t,n){if(!n.trim())return{state:"empty",diagnostics:[]};let r=this.backend.shaders.program(t,n);return{state:r.state,diagnostics:[...r.report.diagnostics,...r.browser]}}destroy(){this.backend.onShaderReady=void 0,this.backend.destroy(),this.last=null}build(t,n,r){let s=new Ji(n,r,[0,0,0,0]),i=s.root,a=w=>t.image?this.cover(s,w,t.image,n,r):ph(s,w,n,r),o=t.split==null?0:Math.min(1,Math.max(0,t.split))*n;if(t.scope==="fill"){t.image&&a(i);let w={kind:"shader",source:t.source,uniforms:t.uniforms,box:[0,0,n,r],time:t.time,...t.texture?{texture:this.asset(s,t.texture)}:{}},A=o>0?s.group(i,{clip:{x:o,y:0,w:n-o,h:r,r:0}}):i;return s.rect(A,{w:n,h:r,fill:w}),s}a(i);let l=Math.min(n,r),c=t.frame==="inset",u=c?l*fh:0,f={x:u,y:u,w:n-2*u,h:r-2*u,r:c?l*dh:0},d={type:"shader",language:"wgsl",source:t.source,uniforms:t.uniforms,mode:t.backdrop?"backdrop":"foreground",...t.blendMode&&!t.backdrop?{blendMode:t.blendMode}:{},...t.reach?{reach:t.reach}:{}},p=o>0?s.group(i,{clip:{x:o,y:0,w:n-o,h:r,r:0}}):i,_=[f.x,f.y,f.w,f.h];return t.backdrop?s.rect(p,{transform:[1,0,0,1,f.x,f.y],w:f.w,h:f.h,radii:[f.r,f.r,f.r,f.r],effects:[d],effectBox:[0,0,f.w,f.h],effectTime:t.time}):a(s.group(p,{clip:f,effects:[d],effectBox:_,effectTime:t.time})),s}asset(t,n){let r=t.addImage(n,n.width,n.height,{mipmaps:!1}),s=this.images.get(n);return s===void 0&&this.images.set(n,s=++this.version),r.version=s,r}cover(t,n,r,s,i){t.rect(n,{w:s,h:i,fill:{kind:"image",image:this.asset(t,r),fit:"fill",box:[0,0,s,i]}})}};function ph(e,t,n,r){e.rect(t,{w:n,h:r,fill:{kind:"linear",from:[0,0],to:[n,r],stops:[{offset:0,color:[.16,.2,.42,1]},{offset:1,color:[.55,.25,.45,1]}]}});let s=Math.min(n,r),i=Math.max(12,Math.round(s/12)),a={kind:"solid",color:[1,1,1,.3]};for(let f=i;f<n;f+=i)e.rect(t,{transform:[1,0,0,1,f-.5,0],w:1,h:r,fill:a});for(let f=i;f<r;f+=i)e.rect(t,{transform:[1,0,0,1,0,f-.5],w:n,h:1,fill:a});let o=n/2,l=r/2,c=s*.1;Ui.forEach((f,d)=>{let p=-Math.PI/2+d*2*Math.PI/Ui.length,_=o+Math.cos(p)*s*.17,w=l+Math.sin(p)*s*.17;e.ellipse(t,{transform:[1,0,0,1,_-c,w-c],w:2*c,h:2*c,fill:{kind:"solid",color:[...f,1]}})});let u=s*.3;e.ellipse(t,{transform:[1,0,0,1,o-u,l-u],w:2*u,h:2*u,stroke:{paint:{kind:"solid",color:[1,1,1,.85]},width:Math.max(1.5,s/90)}})}async function rs(){let e=navigator.gpu;if(!e)return!1;try{return await e.requestAdapter()!=null}catch{return!1}}async function Da(e={}){await bn(e.wasmUrl),Zr().catch(()=>{});let{loadBytes:t}=e;return{createStorageAdapter({catalog:n,viewport:r,fps:s}){return new ch(n,r,s,t)},createRenderContext(n){return new Qd(n,n.size)},createMeasureContext(n){let r=es(n);return{measureText:(...s)=>ts(r,...s)}}}}function La(e,t){return new sh(e,t.viewport,new th,t.effects,t.size)}var Yn=class extends Error{constructor(){super("Motion Script draws with WebGPU, and this browser has no WebGPU adapter."),this.name="WebGpuUnavailableError"}};async function Ye(e={},{gpu:t=!0}={}){if(t&&!await rs())throw new Yn;return Da({wasmUrl:e.rendererWasmUrl,loadBytes:ir})}function Xn(e,t){if(t.returnBytes)return e;let n=new Blob([e.buffer],{type:t.mimeType}),r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t.filename,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}var is={mp4:{kind:"video",extension:"mp4",mimeType:"video/mp4",container:()=>new cr,audioCodec:"aac",video:{codecs:["avc","hevc","av1","vp9"],fallback:"avc"}},webm:{kind:"video",extension:"webm",mimeType:"video/webm",container:()=>new Os,audioCodec:"opus",video:{codecs:["vp9","av1","vp8"],fallback:"vp8"}},wav:{kind:"audio",extension:"wav",mimeType:"audio/wav",container:()=>new Ls,audioCodec:"pcm-s16"},mp3:{kind:"audio",extension:"mp3",mimeType:"audio/mpeg",container:()=>new Ds,audioCodec:"mp3"},m4a:{kind:"audio",extension:"m4a",mimeType:"audio/mp4",container:()=>new cr,audioCodec:"aac"}},_h=is;function Ne(e){let t=is[e];if(!t)throw new RangeError(`"${String(e)}" is not an export format; expected one of ${Object.keys(is).join(", ")}.`);return t}function Fa(e){return Ne(e).kind==="audio"}var as=192e3,mh=48e3;function Ht(e,t=as){let n=Ne(e).audioCodec;return new Cs({codec:n,bitrate:t,...n==="opus"&&{transform:{sampleRate:mh}}})}var ss=null;async function Zn(e){let t=Ne(e).audioCodec;if(t==="mp3"){ss??=(async()=>{if(await or("mp3"))return;let{registerMp3Encoder:n}=await import("./chunks/mediabunny-mp3-encoder-ZCIHVVTJ.js");n()})();try{await ss}catch(n){throw ss=null,n}return}if(!t.startsWith("pcm-")&&!await or(t))throw new Error(`This browser has no ${t.toUpperCase()} encoder, so it cannot export ${e.toUpperCase()} audio.`)}var vh=.2,xh=2e6,kh=1e8;function Qn(e,t,n){let r=e*t*n*vh;return Math.round(Math.min(kh,Math.max(xh,r)))}var Mh=1,Sh=2,Eh={image:{},video:{},audio:{},font:{}},wn=class{format;audioOptions;target=new Rt;output;video;audio=null;constructor(t,n,r,s,i={}){this.format=r,this.audioOptions=i;let a=n.width!==t.width||n.height!==t.height;this.video=new Rs(t,{codec:s.codec,bitrate:s.bitrate,hardwareAcceleration:s.hardwareAcceleration,keyFrameInterval:s.keyFrameInterval,latencyMode:s.latencyMode,contentHint:s.contentHint,...s.bitrateMode!==void 0&&{bitrateMode:s.bitrateMode},...a&&{transform:{width:n.width,height:n.height,fit:"fill"}}}),this.output=new Ct({format:Ne(r).container(),target:this.target})}async start(t){this.output.addVideoTrack(this.video,{frameRate:t.fps}),t.hasAudio&&(await Zn(this.format),this.audio=Ht(this.format,this.audioOptions.bitrate??as),this.output.addAudioTrack(this.audio)),await this.output.start()}async addFrame(t,n){await this.video.add(t,n)}async addAudio(t){this.audio&&await this.audio.add(t)}async finalize(){this.video.close(),this.audio?.close(),await this.output.finalize();let t=this.target.buffer;if(!t)throw new Error("Export produced no data");return new Uint8Array(t)}};function Ba(e){let t=Math.round(e);return t%2===0?t:t+1}var Ah=8192;function Th(e,t){let n=Math.max(t.width,t.height),r=Math.max(1,Math.round(e));for(;r>1&&n*r>Ah;)r--;return r}async function Ph(e,t,n,r){let{codecs:s,fallback:i}=Ne(t).video,a=e??s[0];s.includes(a)||(console.warn(`[motionscript] ${t.toUpperCase()} cannot hold ${a}; exporting as ${$a[s[0]]} instead.`),a=s[0]);for(let o of new Set([a,s[0],i]))if(o===i||await Ih(o,n,r))return o!==a&&console.warn(`[motionscript] No ${a} encoder available; exporting as ${$a[o]} instead.`),o;return i}var $a={avc:"H.264",hevc:"HEVC",vp9:"VP9",av1:"AV1",vp8:"VP8"};async function Ih(e,t,n){try{return await Es(e,{width:t.width,height:t.height,bitrate:Qn(t.width,t.height,n)})}catch{return!1}}async function os(e,t,n,r){return{codec:await Ph(e?.codec,t,n,r),bitrate:e?.bitrate??Qn(n.width,n.height,r),hardwareAcceleration:e?.hardwareAcceleration??"no-preference",keyFrameInterval:e?.keyFrameInterval??Mh,latencyMode:e?.latencyMode??"quality",contentHint:e?.contentHint??"detail",...e?.bitrateMode!==void 0&&{bitrateMode:e.bitrateMode}}}function Ua(e,t){let{bitrate:n}=e;return typeof n=="number"?{...e,bitrate:n}:{...e,bitrate:n._toVideoBitrate(e.codec,t.width,t.height)}}function St(e,t,n){let r={width:Ba(e.width*t),height:Ba(e.height*t)},s=Th(n,r);return{output:r,oversample:s,renderScale:t*s}}async function cs(e){let t=document.createElement("canvas");t.width=e.canvasSize.width,t.height=e.canvasSize.height,t.style.display="none",document.body.appendChild(t);try{let n=new bh(e.manifest),r=await Ye(e),s=r.createStorageAdapter({catalog:n,viewport:e.viewport,fps:e.fps}),i=r.createRenderContext(s);return i.mount(t),await i.whenMounted?.(),{canvas:t,renderContext:i,storageAdapter:s,assetCatalog:n,dispose:()=>{i.dispose(),t.remove()}}}catch(n){throw t.remove(),n}}async function ls(e){let{document:t,registry:n=new wh,scale:r=1,format:s="mp4",manifest:i=Eh,theme:a,includeAudio:o=!0,video:l,audio:c={},frames:u,onProgress:f,signal:d,rendererWasmUrl:p,supersample:_=Sh,returnBytes:w=!1}=e,A=Ne(s);if(A.kind!=="video")throw new RangeError(`exportVideo writes video; "${s}" is audio, which exportAudio writes.`);let B=e.filename??`export.${A.extension}`,L=yh(t,e,gh);if(L.tracks.length===0)return;d?.throwIfAborted();let V=L.viewport,se=L.fps,{output:X,oversample:pe,renderScale:ue}=St(V,r,_),q=await cs({canvasSize:{width:X.width*pe,height:X.height*pe},viewport:V,fps:se,manifest:i,rendererWasmUrl:p}),ae;try{let G=await os(l,s,X,se);ae=await Ot({project:L,registry:n,theme:a,scale:ue,includeAudio:o,frames:u,renderContext:q.renderContext,storageAdapter:q.storageAdapter,assetCatalog:q.assetCatalog,sink:new wn(q.canvas,X,s,G,c),mixer:new On(c.sampleRate,q.assetCatalog),onProgress:f,onIssue:e.onIssue,signal:d})}finally{q.dispose()}if(ae)return Xn(ae,{returnBytes:w,filename:B,mimeType:A.mimeType})}import{DEFAULT_OUTPUT as Rh,ManifestAssetCatalog as Ch,AssetTimeline as Oh,Registry as Dh,resolveProjectDocument as Lh}from"@motionscript/core";var Fh={image:{},video:{},audio:{},font:{}};async function yn(e){let{registry:t=new Dh,manifest:n=Fh,sampleRate:r}=e,s=Lh(e.document,e,Rh);if(s.tracks.length===0)return null;let i=s.viewport,a=s.fps,o=await Ye(e,{gpu:!1}),l=new Ch(n),c=o.createStorageAdapter({catalog:l,viewport:i,fps:a}),u=o.createMeasureContext(c),f=new Oh(s,{registry:t,viewport:i,fps:a,assets:l,measurer:u},{assets:!1});try{let d=f.run(),p=dr(d);return p.length===0?null:await lr(p,d.totalDuration,{sampleRate:r,catalog:l})}finally{f.dispose(),c.dispose()}}var er=class extends Error{name="NoAudioError";constructor(){super("The timeline has no audio to export.")}};async function us(e){let{format:t="wav",audio:n={},onProgress:r,signal:s,returnBytes:i=!1}=e,a=Ne(t);if(a.kind!=="audio")throw new RangeError(`exportAudio writes audio; "${t}" is video, which exportVideo writes.`);s?.throwIfAborted(),await Zn(t);let o=await yn({document:e.document,registry:e.registry,viewport:e.viewport,fps:e.fps,manifest:e.manifest,sampleRate:n.sampleRate,rendererWasmUrl:e.rendererWasmUrl});if(o===null)throw new er;s?.throwIfAborted(),r?.(.5);let l=new Rt,c=new Ct({format:a.container(),target:l}),u=Ht(t,n.bitrate);if(c.addAudioTrack(u),await c.start(),await u.add(o),u.close(),await c.finalize(),!l.buffer)throw new Error("Export produced no data");return r?.(1),Xn(new Uint8Array(l.buffer),{returnBytes:i,filename:e.filename??`export.${a.extension}`,mimeType:a.mimeType})}import{DEFAULT_OUTPUT as Wh,resolveProjectDocument as Vh}from"@motionscript/core";import{DEFAULT_OUTPUT as Na,ManifestAssetCatalog as ja,frameSpecAtTime as Bh,Registry as $h,resolveProjectDocument as Uh}from"@motionscript/core";var Nh={image:{},video:{},audio:{},font:{}};function jh(e,t){if(e?.time!==void 0)return Bh(e.time,t);let n=e?.frame;return n===void 0||n==="first"?{kind:"first"}:n==="last"?{kind:"last"}:typeof n=="number"?{kind:"frame",frame:n}:n}function Wa(e){return e==="jpeg"?"image/jpeg":"image/png"}var Kt=class{canvas;renderContext;storageAdapter;catalog;backend;ownsCanvas;viewportValue;fpsValue;scaleValue;surfaceScale;manifest;theme;registry;disposed=!1;drawn=!1;constructor(t,n){this.backend=t,this.viewportValue=n.viewport??Na.viewport,this.fpsValue=n.fps??Na.fps,this.scaleValue=n.scale??1,this.surfaceScale=this.scaleValue,this.manifest=n.manifest??Nh,this.theme=n.theme,this.registry=n.registry??new $h,this.ownsCanvas=n.canvas===void 0,this.canvas=n.canvas??document.createElement("canvas"),this.ownsCanvas&&(this.canvas.style.display="none",document.body.appendChild(this.canvas)),this.sizeCanvas(),this.catalog=new ja(this.manifest),this.storageAdapter=this.backend.createStorageAdapter({catalog:this.catalog,viewport:this.viewportValue,fps:this.fpsValue}),this.renderContext=this.backend.createRenderContext(this.storageAdapter),this.renderContext.mount(this.canvas)}get viewport(){return this.viewportValue}get fps(){return this.fpsValue}get scale(){return this.scaleValue}async render(t,n){this.assertLive();let r=n?.scale??this.scaleValue;r!==this.surfaceScale&&this.remount(r),await this.renderContext.whenMounted?.();let s=Uh(t,{viewport:this.viewportValue},{viewport:this.viewportValue,fps:this.fpsValue}),i=await Ws({project:s,registry:this.registry,theme:this.theme,scale:r,renderContext:this.renderContext,storageAdapter:this.storageAdapter,assetCatalog:this.catalog,frame:jh(n,s.fps),onIssue:n?.onIssue});return this.drawn=!0,i}setTheme(t){this.theme=t}setManifest(t){this.assertLive(),this.manifest=t,this.catalog=new ja(t),this.storageAdapter.setCatalog(this.catalog)}setViewport(t){this.assertLive(),!(t.width===this.viewportValue.width&&t.height===this.viewportValue.height)&&(this.viewportValue=t,this.renderContext.dispose(),this.storageAdapter=this.backend.createStorageAdapter({catalog:this.catalog,viewport:t,fps:this.fpsValue}),this.renderContext=this.backend.createRenderContext(this.storageAdapter),this.remount(this.scaleValue))}async toBytes(t){let n=await this.toBlob(t);return new Uint8Array(await n.arrayBuffer())}toBlob(t){let n=this.snapshotToCanvas(),{format:r="png",quality:s=.92}=t??{};return new Promise((i,a)=>{n.toBlob(o=>o?i(o):a(new Error("Still encode produced no data.")),Wa(r),s)})}toDataURL(t){let{format:n="png",quality:r=.92}=t??{};return this.snapshotToCanvas().toDataURL(Wa(n),r)}dispose(){this.disposed||(this.disposed=!0,this.renderContext.dispose(),this.ownsCanvas&&this.canvas.remove())}snapshotToCanvas(){if(this.assertLive(),!this.drawn)throw new Error("Nothing has been rendered yet.");let t=this.renderContext.snapshotCanvas?.();if(!t)throw new Error("Still encode: could not read the surface into a 2d canvas.");return t}sizeCanvas(){this.canvas.width=this.viewportValue.width*this.surfaceScale,this.canvas.height=this.viewportValue.height*this.surfaceScale}remount(t){this.surfaceScale=t,this.drawn=!1,this.sizeCanvas(),this.renderContext.mount(this.canvas)}assertLive(){if(this.disposed)throw new Error("This StillRenderer has been disposed.")}};async function fs(e={}){return new Kt(await Ye(e),e)}async function zh(e){let{registry:t,scale:n,manifest:r,theme:s,rendererWasmUrl:i,frame:a,format:o="png",quality:l=.92}=e,c=Vh(e.document,e,Wh);if(c.tracks.length===0)throw new Error("The project has no tracks to screenshot.");let u=await fs({viewport:c.viewport,fps:c.fps,scale:n,manifest:r,theme:s,rendererWasmUrl:i,registry:t});try{return{...await u.render(c,{frame:a}),bytes:await u.toBytes({format:o,quality:l})}}finally{u.dispose()}}var Et=class extends Error{segment;constructor(t,n){super(n),this.segment=t,this.name="ConcatMismatchError"}};function Gh(e,t){if(e.codec!==t.codec||e.codedWidth!==t.codedWidth||e.codedHeight!==t.codedHeight)return!1;let n=Va(e.description),r=Va(t.description);if(n===null||r===null)return n===r;if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(n[s]!==r[s])return!1;return!0}function Va(e){return e?ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e):null}function tr(e={}){let t=null,n=null,r=null,s=null,i=null,a=0,o=0,l=async c=>{i=e.stream?new Ps(e.stream):new Rt,n=new Ct({format:Ne(c.format).container(),target:i}),r=new Is(c.track.codec),n.addVideoTrack(r),s=e.audio?Ht(c.format,e.audioBitrate):null,s&&n.addAudioTrack(s),await n.start(),s&&e.audio&&await s.add(e.audio)};return{async append(c){let u=a++,f=new Cn({source:new xs(c),formats:[Ms,ar]});try{let d=await Hh(f,u,t);t||(t=d,await l(d));let p=!0;for await(let _ of new As(d.track).packets())await r.add(_.clone({timestamp:_.timestamp+o}),p?{decoderConfig:d.config}:void 0),p=!1;o+=d.duration}finally{f.dispose()}},async finish(){if(!n)throw new Error("concatVideoSegments: no segments");if(r.close(),s?.close(),await n.finalize(),e.stream)return new Uint8Array(0);let c=i.buffer;if(!c)throw new Error("concatVideoSegments produced no data");return new Uint8Array(c)},async cancel(){n&&n.state!=="finalized"&&n.state!=="canceled"&&await n.cancel()}}}async function Hh(e,t,n){let r=await e.getFormat()===ar?"webm":"mp4";if(n&&r!==n.format)throw new Et(t,`Segment ${t} is ${r} and segment 0 is ${n.format}.`);let s=await e.getPrimaryVideoTrack();if(!s)throw new Et(t,`Segment ${t} has no video track.`);let i=await s.getDecoderConfig();if(!i)throw new Et(t,`Segment ${t} has no decoder configuration.`);if(n&&!Gh(n.config,i))throw new Et(t,`Segment ${t} was encoded differently from segment 0 (${n.config.codec} ${n.config.codedWidth}x${n.config.codedHeight} vs ${i.codec} ${i.codedWidth}x${i.codedHeight}); joining them would decode as garbage.`);return{format:r,track:s,config:i,duration:await s.computeDuration()}}async function Kh(e,t={}){if(e.length===0)throw new Error("concatVideoSegments: no segments");if(e.length===1&&!t.audio&&!t.stream)return e[0];let n=tr(t);try{for(let r of e)await n.append(r);return await n.finish()}catch(r){throw await n.cancel().catch(()=>{}),r}}import{DEFAULT_OUTPUT as Jh,placeTracks as Yh,Registry as Xh,renderIssueKey as Zh,resolveProjectDocument as Qh,totalFramesOf as ep}from"@motionscript/core";function za(e,t){if(!Number.isInteger(e)||e<=0)return[];let n=Math.max(1,Math.round(t.fps*(t.keyFrameInterval>0?t.keyFrameInterval:1))),r=t.chunkSeconds??Math.min(6,Math.max(2,e/t.fps/(Math.max(1,t.lanes)*4))),s=Math.max(n,Math.round(r*t.fps/n)*n),i=[];for(let o=0;o<e;o+=s)i.push({index:i.length,start:o,end:Math.min(e,o+s)});let a=i[i.length-1];return i.length>1&&a.end-a.start<n&&(i.pop(),i[i.length-1].end=a.end),i}var nr=class{_options;_active=1;_settled;_window=Ga();_previousFps=0;_newestFirstAt=null;_windowMs;_minFrames;_maxWaitShare;_minGain;_warmupMs;constructor(t){this._options=t,this._windowMs=t.windowMs??1500,this._minFrames=t.minFrames??24,this._maxWaitShare=t.maxWaitShare??.45,this._minGain=t.minGain??1.1,this._warmupMs=t.warmupMs??300,this._settled=t.lanes<=1}get active(){return this._active}get settled(){return this._settled}laneLost(t){this._active=Math.max(1,Math.min(this._active,t)),this._settled=!0}record(t){if(this._settled||t.lane>=this._active)return null;let n=this._window;if(n.start===null)return t.lane!==this._active-1||(this._newestFirstAt??=t.at,t.at-this._newestFirstAt>=this._warmupMs&&(n.start=t.at)),null;n.frames+=t.frames,n.busyMs+=t.busyMs,n.waitMs+=t.waitMs;let r=t.at-n.start;if(r<this._windowMs||n.frames<this._minFrames)return null;let s=n.frames*1e3/r,i=n.waitMs/Math.max(1,n.busyMs+n.waitMs),a=this._active;return this._active>1&&s<this._previousFps*this._minGain?(this._active-=1,this._settled=!0):i<=this._maxWaitShare&&this._active<this._options.lanes?(this._previousFps=s,this._active+=1):this._settled=!0,this._window=Ga(),this._newestFirstAt=null,this._active!==a?this._active:null}};function Ga(){return{start:null,frames:0,busyMs:0,waitMs:0}}var qh=2;async function Ha(e){let{lanes:t,spec:n,chunks:r,signal:s}=e,i=e.now??(()=>performance.now());if(t.length===0)throw new Error("runLanes: no lanes");if(r.length===0)return;let a=new AbortController,o=()=>a.abort(s?.reason);s?.aborted&&o(),s?.addEventListener("abort",o,{once:!0});let l=new nr({lanes:t.length,...e.governor}),c=r.map(q=>({chunk:q,attempts:0})),u=new Map,f=new Set,d=0,p=r.reduce((q,ae)=>q+(ae.end-ae.start),0),_=null,w=()=>{},A=new Promise(q=>w=q),B=()=>{let q=w;A=new Promise(ae=>w=ae),q()};a.signal.addEventListener("abort",B,{once:!0});let L=()=>t.length-f.size,V=q=>{let ae=0;for(let G=0;G<q;G++)f.has(G)||ae++;return ae<l.active},se=q=>{f.add(q),l.laneLost(L()),e.onActive?.(l.active),B()},X=()=>{let q=d;for(let ae of u.values())q+=ae;return q},pe=()=>{let q=c.shift();if(!l.settled||q.attempts>0)return q;let ae=c.reduce((xe,ve)=>xe+(ve.chunk.end-ve.chunk.start),q.chunk.end-q.chunk.start),G=Math.ceil(ae/(l.active===1?1:l.active*2)),{end:$}=q.chunk;for(;c.length>0&&c[0].attempts===0&&c[0].chunk.start===$&&$-q.chunk.start<G;)$=c.shift().chunk.end;return{chunk:{...q.chunk,end:$},attempts:0}},ue=async q=>{for(;!V(q)&&p>0&&!a.signal.aborted&&!f.has(q);)await A;if(p===0||a.signal.aborted||f.has(q))return;let ae;try{ae=await t[q].open(n,a.signal)}catch(G){if(a.signal.aborted)return;if(L()<=1)throw G;console.warn(`[motionscript] export lane ${q} failed to open; continuing without it.`,G),se(q);return}try{for(;;){if(a.signal.throwIfAborted(),p===0)return;if(!V(q)||c.length===0){await A;continue}let G=pe(),$=G.chunk.end-G.chunk.start,xe={frames:0,busyMs:0,waitMs:0};u.set(G,0);try{let ve=await ae.render(G.chunk,Me=>{let Fe=l.record({lane:q,frames:Me.frames-xe.frames,busyMs:Me.busyMs-xe.busyMs,waitMs:Me.waitMs-xe.waitMs,at:i()});for(let de of Me.issues??[])e.onIssue?.(de);Object.assign(xe,{frames:Me.frames,busyMs:Me.busyMs,waitMs:Me.waitMs}),u.set(G,Me.frames),e.onFrames?.(X()),Fe!==null&&(e.onActive?.(Fe),B())},a.signal);u.delete(G),d+=$,p-=$,e.onFrames?.(X()),e.onChunk(G.chunk,ve),B()}catch(ve){if(u.delete(G),a.signal.aborted||++G.attempts>=qh||L()<=1)throw ve;console.warn(`[motionscript] export lane ${q} failed frames ${G.chunk.start} to ${G.chunk.end}; retrying on another lane.`,ve),c.unshift(G),e.onFrames?.(X()),se(q);return}}}finally{ae.close()}};try{if(await Promise.all(t.map((q,ae)=>ue(ae).catch(G=>{_??=G,a.abort(G)}))),_)throw _;if(p>0)throw new Error(`runLanes: ${p} frames were never rendered.`)}finally{s?.removeEventListener("abort",o)}}var tp={image:{},video:{},audio:{},font:{}},np=2,rp=.97;async function sp(e){let{registry:t=new Xh,scale:n=1,format:r="mp4",manifest:s=tp,includeAudio:i=!0,audio:a={},signal:o,onProgress:l,supersample:c=np}=e;if(Ne(r).kind!=="video")throw new RangeError(`exportVideoParallel writes video; "${r}" is audio, which exportAudio writes.`);let u=Qh(e.document,e,Jh);if(u.tracks.length===0)throw new Error("exportVideoParallel: the project has no tracks.");o?.throwIfAborted();let f=u.fps,d=ep(Yh(u.tracks,f)),{output:p}=St(u.viewport,n,c),_=Ua(await os(e.video,r,p,f),p),w={project:u,manifest:s,theme:e.theme,scale:n,supersample:c,format:r,encoding:_,host:e.host},A=za(d,{fps:f,keyFrameInterval:_.keyFrameInterval,lanes:e.lanes.length,chunkSeconds:e.chunkSeconds}),B=i?yn({document:u,registry:t,manifest:s,sampleRate:a.sampleRate,rendererWasmUrl:e.rendererWasmUrl}):Promise.resolve(null);B.catch(()=>{});let L=0,V=new Set,se=xe=>{xe<=L||(L=xe,l?.(xe))},X=new AbortController,pe=()=>X.abort(o?.reason);o?.aborted&&pe(),o?.addEventListener("abort",pe,{once:!0});let ue=new Map,q=0,ae=Promise.resolve(),G=null,$=()=>(ae=ae.then(async()=>{for(;ue.has(q);){G??=tr({stream:e.stream,audio:await B,audioBitrate:a.bitrate});let{end:xe,bytes:ve}=ue.get(q);ue.delete(q),q=xe,await G.append(ve)}}),ae);try{if(await Ha({lanes:e.lanes,spec:w,chunks:A,signal:X.signal,onIssue:ve=>{let Me=Zh(ve);V.has(Me)||(V.add(Me),e.onIssue?.(ve))},onFrames:ve=>se(rp*Math.min(1,ve/d)),onActive:e.onLanes,onChunk:(ve,Me)=>{ue.set(ve.start,{end:ve.end,bytes:Me}),$().catch(Fe=>X.abort(Fe))}}),await $(),q!==d)throw new Error(`exportVideoParallel: joined ${q} of ${d} frames.`);let xe=await G.finish();return se(1),xe}catch(xe){throw await ae.catch(()=>{}),await G?.cancel().catch(()=>{}),xe}finally{o?.removeEventListener("abort",pe)}}import{ManifestAssetCatalog as ip,Registry as ap,resolveProjectDocument as op,DEFAULT_OUTPUT as cp}from"@motionscript/core";var lp=1<<18,Ka={avc:0,hevc:1,av1:2},ds=class{context;transport;output;encoding;constructor(t,n,r,s){this.context=t,this.transport=n,this.output=r,this.encoding=s}async flush(t=!1){this.context.out.size>=(t?1:lp)&&await this.transport.write(this.context.out.take())}async start(t){let{width:n,height:r}=this.output,s=this.encoding.bitrate??Qn(n,r,t.fps);this.context.out.record(Jn.BEGIN,[n,r,Math.round(t.fps*1e3),t.totalFrames,s,this.encoding.codec,0]),await this.flush(!0)}async addFrame(){this.context.frameDone(),await this.flush()}async addAudio(t){let n=t.numberOfChannels,r=t.length,s=new Float32Array(r*n);for(let i=0;i<n;i++){let a=t.getChannelData(i);for(let o=0;o<r;o++)s[o*n+i]=a[o]}this.context.out.record(Jn.AUDIO,[t.sampleRate,n],new Uint8Array(s.buffer)),await this.flush(!0)}async finalize(){return this.context.out.record(Jn.END,[]),await this.flush(!0),this.transport.finish()}},up={image:{},video:{},audio:{},font:{}};async function fp(e){let{document:t,registry:n=new ap,scale:r=1,manifest:s=up,theme:i,includeAudio:a=!0,video:o,audio:l={},frames:c,onProgress:u,signal:f,supersample:d=2,transport:p}=e,_=op(t,e,cp);if(_.tracks.length===0)return;f?.throwIfAborted();let w=_.viewport,A=_.fps,{output:B,oversample:L,renderScale:V}=St(w,r,d);if(B.width%4!==0)throw new RangeError(`A native export's width must be a multiple of 4 (NV12 packing); ${B.width} is not.`);let se=await Ye({rendererWasmUrl:e.rendererWasmUrl},{gpu:!1}),X=new ip(s),pe=se.createStorageAdapter({catalog:X,viewport:w,fps:A}),ue=La(pe,{viewport:w,effects:p.effects,size:{width:B.width*L,height:B.height*L}}),q=o?.codec==="hevc"||o?.codec==="av1"?Ka[o.codec]:Ka.avc,ae=typeof o?.bitrate=="number"?o.bitrate:void 0;try{return await Ot({project:_,registry:n,theme:i,scale:V,includeAudio:a,frames:c,renderContext:ue,storageAdapter:pe,assetCatalog:X,sink:new ds(ue,p,B,{codec:q,bitrate:ae}),mixer:new On(l.sampleRate,X),onProgress:u,onIssue:e.onIssue,signal:f})}catch(G){throw p.abort?.(G),G}finally{ue.dispose()}}import{Registry as dp}from"@motionscript/core";var hp=100;async function ps(e,t){let{project:n}=e,r=n.viewport,s=n.fps,i=t.registry??new dp,{output:a,oversample:o,renderScale:l}=St(r,e.scale,e.supersample),c=await cs({canvasSize:{width:a.width*o,height:a.height*o},viewport:r,fps:s,manifest:e.manifest,rendererWasmUrl:t.rendererWasmUrl});return{async render(u,f,d){let p=new hs(new wn(c.canvas,a,e.format,e.encoding),f),_=await Ot({project:n,registry:i,theme:e.theme,scale:l,includeAudio:!1,frames:{start:u.start,end:u.end},renderContext:c.renderContext,storageAdapter:c.storageAdapter,assetCatalog:c.assetCatalog,sink:p,signal:d,onIssue:w=>p.issues.push(w)});if(p.flush(),!_)throw new Error(`Frames ${u.start} to ${u.end} produced no bytes.`);return _},close:()=>c.dispose()}}var hs=class{_inner;_onReport;issues=[];_frames=0;_busyMs=0;_waitMs=0;_lastEnd=0;_lastReport=0;constructor(t,n){this._inner=t,this._onReport=n}async start(t){await this._inner.start(t),this._lastEnd=this._lastReport=performance.now()}async addFrame(t,n){let r=performance.now();this._busyMs+=r-this._lastEnd,await this._inner.addFrame(t,n);let s=performance.now();this._waitMs+=s-r,this._lastEnd=s,this._frames++,s-this._lastReport>=hp&&(this._lastReport=s,this.flush())}finalize(){return this._inner.finalize()}flush(){let t=this.issues.splice(0);this._onReport({frames:this._frames,busyMs:this._busyMs,waitMs:this._waitMs,...t.length>0&&{issues:t}})}};function pp(e={}){return{open:t=>ps(t,e)}}function _p(e,t){let n=new Error(e);return n.name=t,n}function mp(e,t={}){let n=1,r=null,s=new Map;e.addEventListener("message",o=>{let l=o.data,c=s.get(l.id);if(c){if(l.t==="report"){c.onReport?.(l.report);return}s.delete(l.id),l.t==="error"?c.reject(_p(l.message,l.name)):c.resolve(l)}}),e.start();let i=o=>{r??=new Error(o);for(let l of s.values())l.reject(r);s.clear()};e.addEventListener("close",()=>i("The export lane closed.")),t.lost?.then(()=>i("The export lane was lost."),()=>i("The export lane was lost."));let a=(o,l,c)=>new Promise((u,f)=>{if(r)return f(r);if(l.aborted)return f(l.reason);let d=()=>{s.delete(o.id),e.postMessage({t:"abort",id:o.id}),f(l.reason)};l.addEventListener("abort",d,{once:!0}),s.set(o.id,{resolve:p=>{l.removeEventListener("abort",d),u(p)},reject:p=>{l.removeEventListener("abort",d),f(p)},onReport:c}),e.postMessage(o)});return{async open(o,l){let c=n++;return await a({t:"open",id:c,spec:o},l),{async render(u,f,d){return(await a({t:"render",id:n++,session:c,chunk:u},d,f)).bytes},close(){r||e.postMessage({t:"close",id:c})}}}}}function gp(e,t){let n=new Map,r=new Map,s=(o,l=[])=>e.postMessage(o,l),i=(o,l)=>s({t:"error",id:o,message:l instanceof Error?l.message:String(l),name:l instanceof Error?l.name:"Error"}),a=async o=>{let l=o.data;switch(l.t){case"open":{let c=Promise.resolve(t(l.spec)).then(u=>ps(l.spec,u));n.set(l.id,c);try{await c,s({t:"opened",id:l.id})}catch(u){n.delete(l.id),i(l.id,u)}return}case"render":{let c=new AbortController;r.set(l.id,c);try{let u=await n.get(l.session);if(!u)throw new Error(`No open export session ${l.session}.`);let f=await u.render(l.chunk,p=>s({t:"report",id:l.id,report:p}),c.signal),d=f.byteOffset===0&&f.byteLength===f.buffer.byteLength?f:f.slice();s({t:"done",id:l.id,bytes:d},[d.buffer])}catch(u){c.signal.aborted||i(l.id,u)}finally{r.delete(l.id)}return}case"abort":r.get(l.id)?.abort(new DOMException("Export cancelled.","AbortError"));return;case"close":{let c=n.get(l.id);n.delete(l.id),c?.then(u=>u.close(),()=>{});return}}};return e.addEventListener("message",a),e.start(),()=>{e.removeEventListener("message",a);for(let o of r.values())o.abort(new DOMException("Export cancelled.","AbortError"));for(let o of n.values())o.then(l=>l.close(),()=>{});n.clear()}}import{Ticker as bp}from"@motionscript/core";var vn=class extends bp{contextOf;ownsContext;_context=null;fps;playStartCtxTime=0;seekOffset=0;speed=1;reverse=!1;rafId=null;seekEpoch=0;silentSource=null;constructor(t){super();let{context:n}=t;this.contextOf=typeof n=="function"?n:()=>n??new AudioContext,this.ownsContext=!n,this.fps=t.fps}getContext(){return this._context??=this.contextOf(),this._context}get context(){return this.getContext()}seek(t){let n=Math.max(0,Math.min(t,this.duration));this.seekOffset=n,this.isPlaying&&(this.playStartCtxTime=this.context.currentTime),this.seekEpoch++,this.setCurrentTime(n)}play(t=1,n=!1){this.speed=t,this.reverse=n,this.seekOffset=this.currentTime,this.context.state==="suspended"&&this.context.resume().then(()=>{!this.isPlaying&&this.context.state==="running"&&this.context.suspend()},r=>{console.error("[WebTicker] The audio context could not resume:",r),this.pause()}),this.playStartCtxTime=this.context.currentTime,this.startSilentTicker(),super.play(t,n),this.startLoop()}pause(){this.seekOffset=this.currentTime,this.stopLoop(),this.stopSilentTicker(),this._context?.state==="running"&&this._context.suspend(),super.pause()}startSilentTicker(){this.stopSilentTicker();let t=Math.max(.001,this.duration-this.seekOffset),n=this.context.sampleRate,r=this.context.createBuffer(1,Math.ceil(t*n),n),s=this.context.createBufferSource();s.buffer=r,s.connect(this.context.destination),s.start(),this.silentSource=s}stopSilentTicker(){if(this.silentSource){try{this.silentSource.onended=null,this.silentSource.stop(),this.silentSource.disconnect()}catch{}this.silentSource=null}}position(){let t=(this.context.currentTime-this.playStartCtxTime)*this.speed,n=this.reverse?this.seekOffset-t:this.seekOffset+t,r=Math.max(0,Math.min(n,this.duration));return{time:r,ended:this.reverse?r<=0:r>=this.duration}}startLoop(){if(this.rafId!==null)return;let t=a=>Math.floor(a*this.fps+1e-6),n=t(this.currentTime),r=null,s=a=>{let o=this.position(),l=o.time;if(!o.ended&&r&&r.epoch===this.seekEpoch){let c=(a-r.at)/1e3*this.speed,u=this.reverse?r.time-c:r.time+c,f=o.time-u,d=u+f*.05;Math.abs(f)<=.05&&d>0&&d<this.duration&&(l=d)}return r={time:l,at:a,epoch:this.seekEpoch},{time:l,ended:o.ended}},i=async a=>{let o=this.seekEpoch,l=s(a),c=l.ended,f=t(l.time)!==n||c;this.setCurrentTime(l.time,f);let d=()=>{this.seekEpoch!==o&&(o=this.seekEpoch,n=t(this.currentTime),c=this.position().ended)};if(d(),f&&(n=t(this.currentTime),await this.tick(),d()),this.rafId!==null){if(c){this.pause();return}this.rafId=requestAnimationFrame(i)}};this.rafId=requestAnimationFrame(i)}stopLoop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}dispose(){this.stopLoop(),this.stopSilentTicker(),this.ownsContext&&this._context?.close(),super.dispose()}};import{Engine as kp}from"@motionscript/core";var rr=ko(qa(),1);import*as wp from"@motionscript/core/sdk";function yp(){return new URL("esbuild-wasm/esbuild.wasm",import.meta.url).href}var vp;function xp(e){return vp??=(async()=>(await rr.initialize({wasmURL:e??yp()}),async t=>{let{code:n}=await rr.transform(t,{loader:"ts",format:"cjs",target:"es2020"});return n}))()}function Ja(e,t){return{sdk:e?.sdk??wp,modules:e?.modules,compile:e?.compile??(async n=>(await xp(t))(n))}}var ms=class{backend;defaults;still=null;stillRegistry=null;stillQueue=Promise.resolve();constructor(t,n){this.backend=t,this.defaults=n}async exportVideo(t){let n=t.encode??{};return n.format&&Fa(n.format)?us({document:t.project,registry:t.registry,manifest:t.manifest,format:n.format,audio:n.audio??this.defaults.audio,filename:n.filename,returnBytes:n.download!==!0,onProgress:t.onProgress,signal:t.signal,rendererWasmUrl:this.defaults.rendererWasmUrl}):ls({document:t.project,registry:t.registry,scale:t.scale,manifest:t.manifest,includeAudio:t.includeAudio,frames:t.frames,format:n.format,video:n.video??this.defaults.video,audio:n.audio??this.defaults.audio,supersample:n.supersample,filename:n.filename,returnBytes:n.download!==!0,onProgress:t.onProgress,onIssue:t.onIssue,signal:t.signal,rendererWasmUrl:this.defaults.rendererWasmUrl})}exportStill(t){let n=this.stillQueue.then(()=>this.drawStill(t));return this.stillQueue=n.catch(()=>{}),n}dispose(){this.still?.dispose(),this.still=null}async drawStill(t){let n=this.renderer(t),r=await n.render(t.project,{scale:t.scale,onIssue:t.onIssue,...Mp(t.frame)});return{bytes:await n.toBytes({format:t.format,quality:t.quality}),frame:r.frame,totalFrames:r.totalFrames}}renderer(t){let{project:n,registry:r}=t;if(n.viewport===void 0||n.fps===void 0)throw new Error("exportStill takes a project whose fps and viewport are resolved \u2014 see Session.");return this.still&&this.stillRegistry!==r&&this.dispose(),this.still??=new Kt(this.backend,{viewport:n.viewport,fps:n.fps,manifest:t.manifest,registry:r}),this.stillRegistry=r,this.still.setViewport(n.viewport),t.manifest&&this.still.setManifest(t.manifest),this.still}};function Mp(e){return e.kind==="frame"?{frame:e.frame}:{frame:e.kind}}async function Sp(e={}){let t=e.nodes,n=Array.isArray(t)?t.filter(c=>typeof c!="string"):t,r=Array.isArray(t)?t.filter(c=>typeof c=="string"):[],s=Ja(e.dynamicNodes,e.compilerWasmUrl),i=await Ye(e),a=new ms(i,{video:e.video,audio:e.audio,rendererWasmUrl:e.rendererWasmUrl}),o={createStorageAdapter:c=>i.createStorageAdapter(c),createRenderContext:c=>i.createRenderContext(c),createMeasureContext:c=>i.createMeasureContext(c),createAudioSink(){return new ur},createTicker(c,u){let f=u;return new vn({context:()=>f.getContext(),fps:c})},createExporter(){return a},dispose(){a.dispose(),i.dispose?.()}},l=new kp(o,{...e,nodes:n,dynamicNodes:s});for(let c of r)await l.registerNode(c);return l}export{Et as ConcatMismatchError,_h as EXPORT_FORMATS,er as NoAudioError,Ln as NothingToDrawError,To as QUALITY_HIGH,Eo as QUALITY_LOW,Ao as QUALITY_MEDIUM,Po as QUALITY_VERY_HIGH,So as QUALITY_VERY_LOW,hh as ShaderPreview,Kt as StillRenderer,uh as WGSL_PRELUDE,ur as WebAudioPlayer,Yn as WebGpuUnavailableError,vn as WebTicker,Kh as concatVideoSegments,Sp as createBrowserEngine,tr as createSegmentJoiner,fs as createStillRenderer,Io as encodeWav,us as exportAudio,zh as exportScreenshot,ls as exportVideo,fp as exportVideoNative,sp as exportVideoParallel,rs as isWgpuSupported,ir as loadAssetBytes,pp as localLane,mp as messagePortLane,lr as mixAudio,yn as mixTimelineAudio,Hd as onWgpuEvent,gp as serveExportLane,Mo as setAssetByteSource,lh as validateShader};
734
734
  //# sourceMappingURL=index.js.map