(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();const Gr=!1;var Zr=Array.isArray,ns=Array.prototype.indexOf,Rt=Array.prototype.includes,Xt=Array.from,Jr=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,ss=Object.getOwnPropertyDescriptors,is=Object.prototype,as=Array.prototype,$r=Object.getPrototypeOf,qr=Object.isExtensible;const os=()=>{};function ls(t){for(var e=0;e<t.length;e++)t[e]()}function Qr(){var t,e,r=new Promise((n,s)=>{t=n,e=s});return{promise:r,resolve:t,reject:e}}const pe=2,dt=4,Wt=8,en=1<<24,Se=16,Re=32,Ke=64,lr=128,Mr=256,Pe=512,le=1024,ae=2048,Me=4096,_e=8192,fe=16384,bt=32768,Ft=1<<25,vt=65536,Yt=1<<17,us=1<<18,wt=1<<19,cs=1<<20,Ie=1<<25,Ut=1<<21,ht=1<<22,We=1<<23,Tt=Symbol("$state"),tn=Symbol("component"),fs=Symbol("legacy props"),hs=Symbol(""),rn=Symbol("attributes"),ur=Symbol("class"),cr=Symbol("style"),fr=Symbol("text"),It=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ds=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml"),vs=1,ps=2,nn=4,ms=8,_s=16,gs=1,bs=4,ws=8,ys=16,ks=1,xs=2,sn={},oe=Symbol("uninitialized"),Ms="http://www.w3.org/1999/xhtml";function Es(){console.warn("https://svelte.dev/e/derived_inert")}function Ss(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function an(t){return t===this.v}function Ts(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function on(t){return!Ts(t,this.v)}function ln(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function As(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ps(t,e,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Rs(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Fs(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Cs(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Os(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Is(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function zs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function qs(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ns(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Ds(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let Ls=!1,he=null;function pt(t){he=t}function Ze(t,e=!1,r){he={p:he,i:!1,c:null,e:null,s:t,x:null,r:X,l:null}}function Je(t){var e=he,r=e.e;if(r!==null){e.e=null;for(var n of r)En(n)}return e.i=!0,he=e.p,Er(t)}function Er(t={}){return Jr(t,tn,{value:!0}),t}function un(){return!0}let ut=[];function Vs(){var t=ut;ut=[],ls(t)}function Le(t){if(ut.length===0){var e=ut;queueMicrotask(()=>{e===ut&&Vs()})}ut.push(t)}const Ys=-7169;function ie(t,e){t.f=t.f&Ys|e}function Sr(t){(t.f&Pe)!==0||t.deps===null?ie(t,le):ie(t,Me)}function cn(t,e,r){(t.f&ae)!==0?e.add(t):(t.f&Me)!==0&&r.add(t),ie(t,le)}function zt(t){var e=B,r=X;Ee(null),Ne(null);try{return t()}finally{Ee(e),Ne(r)}}function Us(t,e,r,n){const s=Ct;var i=t.filter(h=>!h.settled),a=e.map(s);if(r.length===0&&i.length===0){n(a);return}var l=X,o=js(),c=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(h=>h.promise)):null;function d(h){if((l.f&fe)===0){o();try{n([...a,...h])}catch(m){Oe(m,l)}jt()}}var v=fn();if(r.length===0){c.then(()=>d([])).finally(v);return}function p(){Promise.all(r.map(h=>Bs(h))).then(d).catch(h=>Oe(h,l)).finally(v)}c?c.then(()=>{if((l.f&fe)!==0){v();return}o(),p(),jt()}):p()}function js(){var t=X,e=B,r=he,n=K;return function(i=!0){Ne(t),Ee(e),pt(r),i&&(t.f&fe)===0&&(n?.activate(),n?.apply())}}function jt(t=!0){Ne(null),Ee(null),pt(null),t&&K?.deactivate()}function fn(){var t=X,e=t.b,r=K,n=!!e?.is_rendered();return e?.update_pending_count(1,r),r.increment(n,t),()=>{e?.update_pending_count(-1,r),r.decrement(n,t)}}function Ct(t){var e=pe|ae;return X!==null&&(X.f|=wt),{ctx:he,deps:null,effects:null,equals:an,f:e,fn:t,reactions:null,rv:0,v:oe,wv:0,parent:X,ac:null}}const Mt=Symbol("obsolete");function Bs(t,e,r){let n=X;n===null&&As();var s=void 0,i=it(oe),a=!B,l=new Set;return ii(()=>{var o=X,c=Qr();s=c.promise;try{Promise.resolve(t()).then(c.resolve,h=>{h!==It&&c.reject(h)}).finally(jt)}catch(h){c.reject(h),jt()}var d=K;if(a){if((o.f&bt)!==0)var v=fn();if(n.b?.is_rendered())d.async_deriveds.get(o)?.reject(Mt);else for(const h of l.values())h.reject(Mt);l.add(c),d.async_deriveds.set(o,c)}const p=(h,m=void 0)=>{v?.(),l.delete(c),m!==Mt&&(d.activate(),m?(i.f|=We,mt(i,m)):((i.f&We)!==0&&(i.f^=We),mt(i,h)),d.deactivate())};c.promise.then(p,h=>p(null,h||"unknown"))}),Mn(()=>{for(const o of l)o.reject(Mt)}),new Promise(o=>{function c(d){function v(){d===s?o(i):c(s)}d.then(v,v)}c(s)})}function ve(t){const e=Ct(t);return Cn(e),e}function hn(t){const e=Ct(t);return e.equals=on,e}function Hs(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)be(e[r])}}function Tr(t){var e,r=X,n=t.parent;if(!Ye&&n!==null&&t.v!==oe&&(n.f&(fe|_e))!==0)return Es(),t.v;Ne(n);try{Hs(t),e=qn(t)}finally{Ne(r)}return e}function dn(t){var e=Tr(t);if(!t.equals(e)&&(t.wv=In(),(!K?.is_fork||t.deps===null)&&(K!==null?(K.capture(t,e,!0),hr?.capture(t,e,!0)):t.v=e,t.deps===null))){ie(t,le);return}Ye||(Te!==null?(Rr()||K?.is_fork)&&Te.set(t,e):Sr(t))}function Xs(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&zt(()=>{e.ac.abort(It),e.ac=null}),e.fn!==null&&(e.teardown=os),Ot(e,0),Cr(e))}function vn(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&_t(e)}let tr=null,lt=null,K=null,hr=null,Te=null,dr=null,rr=!1,At=null,Vt=null;var Nr=0;let Ws=1;class Ge{id=Ws++;#e=!1;linked=!0;#s=null;#t=null;async_deriveds=new Map;current=new Map;previous=new Map;#o=new Set;#n=new Set;#a=0;#r=new Map;#l=null;#i=[];#m=[];#u=new Set;#c=new Set;#h=new Map;#_=new Set;is_fork=!1;#f=!1;constructor(){lt===null?tr=lt=this:(lt.#t=this,this.#s=lt),lt=this}#y(){if(this.is_fork)return!0;for(const n of this.#r.keys()){for(var e=n,r=!1;e.parent!==null;){if(this.#h.has(e)){r=!0;break}e=e.parent}if(!r)return!0}return!1}skip_effect(e){this.#h.has(e)||this.#h.set(e,{d:[],m:[]}),this.#_.delete(e)}unskip_effect(e,r=n=>this.schedule(n)){var n=this.#h.get(e);if(n){this.#h.delete(e);for(var s of n.d)ie(s,ae),r(s);for(s of n.m)ie(s,Me),r(s)}this.#_.add(e)}#k(){var e=[];for(const i of this.#i)if(!((i.f&fe)!==0||(i.f&(ae|Me))===0)){for(var r=i,n=!1;r.parent!==null;){r=r.parent;var s=r.f;if((s&(Ke|Re))!==0){if((s&le)===0){n=!0;break}r.f^=le}}n||e.push(r)}return this.#i=[],e}#g(){this.#e=!0;for(const l of this.#u)this.#c.delete(l),ie(l,ae),this.schedule(l);for(const l of this.#c)ie(l,Me),this.schedule(l);this.apply();for(var e=At=[],r=[],n=Vt=[];this.#i.length>0;){Nr++>1e3&&(this.#p(),Ks());for(const l of this.#k())try{this.#b(l,e,r)}catch(o){throw _n(l),this.#y()||this.discard(),o}}if(K=null,n.length>0){var s=Ge.ensure();for(const l of n)s.schedule(l)}if(At=null,Vt=null,this.#y()){this.#v(r),this.#v(e);for(const[l,o]of this.#h)mn(l,o);n.length>0&&K.#g();return}const i=this.#d();if(i){this.#v(r),this.#v(e),i.#x(this);return}this.#u.clear(),this.#c.clear();for(const l of this.#o)l(this);this.#o.clear(),hr=this,Dr(r),Dr(e),hr=null,this.#l?.resolve();var a=K;if(this.#a===0&&(this.#i.length===0||a!==null)&&this.#p(),this.#i.length>0)if(a!==null){for(const l of this.#i)a.#i.push(l);this.#i=[]}else a=this;a!==null&&(ze.clear(),a.#g())}#b(e,r,n){e.f^=le;for(var s=e.first;s!==null;){var i=s.f,a=(i&(Re|Ke))!==0,l=a&&(i&le)!==0,o=l||(i&_e)!==0||this.#h.has(s);if(!o&&s.fn!==null){a?s.f^=le:(i&dt)!==0?r.push(s):Nt(s)&&((i&Se)!==0&&this.#c.add(s),_t(s));var c=s.first;if(c!==null){s=c;continue}}for(;s!==null;){var d=s.next;if(d!==null){s=d;break}s=s.parent}}}#d(){for(var e=this.#s;e!==null;){if(!e.is_fork){for(const[r,[,n]]of this.current)if(e.current.has(r)&&!n)return e}e=e.#s}return null}#x(e){for(const[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(const[n,s]of e.async_deriveds){const i=this.async_deriveds.get(n);i&&s.promise.then(i.resolve).catch(i.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#c);const r=n=>{var s=n.reactions;if(s!==null&&!((n.f&pe)!==0&&(n.f&(ae|Me))===0))for(const l of s){var i=l.f;if((i&pe)!==0)r(l);else{var a=l;i&(ht|Se)&&!this.async_deriveds.has(a)&&(this.#c.delete(a),ie(a,ae),this.schedule(a))}}};for(const n of this.current.keys())r(n);this.oncommit(()=>e.discard()),e.#p(),K=this,this.#g()}#v(e){for(var r=0;r<e.length;r+=1)cn(e[r],this.#u,this.#c)}capture(e,r,n=!1){e.v!==oe&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&We)===0&&(this.current.set(e,[r,n]),Te?.set(e,r)),this.is_fork||(e.v=r)}activate(){K=this}deactivate(){K=null,Te=null}flush(){try{rr=!0,K=this,this.#g()}finally{Nr=0,dr=null,At=null,Vt=null,rr=!1,K=null,Te=null,ze.clear()}}discard(){for(const e of this.#n)e(this);this.#n.clear();for(const e of this.async_deriveds.values())e.reject(Mt);this.#p(),this.#l?.resolve()}register_created_effect(e){this.#m.push(e)}#w(){for(let v=tr;v!==null;v=v.#t){var e=v.id<this.id,r=[];for(const[p,[h,m]]of this.current){if(v.current.has(p)){var n=v.current.get(p)[0];if(e&&h!==n)v.current.set(p,[h,m]);else continue}r.push(p)}if(e)for(const[p,h]of this.async_deriveds){const m=v.async_deriveds.get(p);m&&h.promise.then(m.resolve).catch(m.reject)}var s=[...v.current.keys()].filter(p=>!v.current.get(p)[1]);if(!(!v.#e||s.length===0)){var i=s.filter(p=>!this.current.has(p));if(i.length===0)e&&v.discard();else if(r.length>0){if(e)for(const p of this.#_)v.unskip_effect(p,h=>{(h.f&(Se|ht))!==0?v.schedule(h):v.#v([h])});v.activate();var a=new Set,l=new Map;for(var o of r)pn(o,i,a,l);l=new Map;var c=[...v.current].filter(([p,h])=>{const m=this.current.get(p);return m?m[0]!==h[0]||m[1]!==h[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of this.#m)(p.f&(fe|_e|Yt))===0&&Ar(p,c,l)&&((p.f&(ht|Se))!==0?(ie(p,ae),v.schedule(p)):v.#u.add(p));if(v.#i.length>0&&!v.#f){v.apply();for(var d of v.#k())v.#b(d,[],[])}v.deactivate()}}}}increment(e,r){if(this.#a+=1,e){let n=this.#r.get(r)??0;this.#r.set(r,n+1)}}decrement(e,r){if(this.#a-=1,e){let n=this.#r.get(r)??0;n===1?this.#r.delete(r):this.#r.set(r,n-1)}this.#f||(this.#f=!0,Le(()=>{this.#f=!1,this.linked&&this.flush()}))}transfer_effects(e,r){for(const n of e)this.#u.add(n);for(const n of r)this.#c.add(n);e.clear(),r.clear()}oncommit(e){this.#o.add(e)}ondiscard(e){this.#n.add(e)}settled(){return(this.#l??=Qr()).promise}static ensure(){if(K===null){const e=K=new Ge;rr||Le(()=>{e.#e||e.flush()})}return K}apply(){{Te=null;return}}schedule(e){if(dr=e,e.b?.is_pending&&(e.f&(dt|Wt|en))!==0&&(e.f&bt)===0){e.b.defer_effect(e);return}this.#i.push(e)}#p(){if(this.linked){var e=this.#s,r=this.#t;e===null?tr=r:e.#t=r,r===null?lt=e:r.#s=e,this.linked=!1}}}function Ks(){try{Os()}catch(t){Oe(t,dr)}}let De=null;function Dr(t){var e=t.length;if(e!==0){for(var r=0;r<e;){var n=t[r++];if((n.f&(fe|_e))===0&&Nt(n)&&(De=new Set,_t(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&Pn(n),De?.size>0)){ze.clear();for(const s of De){if((s.f&(fe|_e))!==0)continue;const i=[s];let a=s.parent;for(;a!==null;)De.has(a)&&(De.delete(a),i.push(a)),a=a.parent;for(let l=i.length-1;l>=0;l--){const o=i[l];(o.f&(fe|_e))===0&&_t(o)}}De.clear()}}De=null}}function pn(t,e,r,n){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(const s of t.reactions){const i=s.f;(i&pe)!==0?pn(s,e,r,n):(i&(ht|Se))!==0&&(i&ae)===0&&Ar(s,e,n)&&(ie(s,ae),Pr(s))}}function Ar(t,e,r){const n=r.get(t);if(n!==void 0)return n;if(t.deps!==null)for(const s of t.deps){if(Rt.call(e,s))return!0;if((s.f&pe)!==0&&Ar(s,e,r))return r.set(s,!0),!0}return r.set(t,!1),!1}function Pr(t){K.schedule(t)}function mn(t,e){if(!((t.f&Re)!==0&&(t.f&le)!==0)){(t.f&ae)!==0?e.d.push(t):(t.f&Me)!==0&&e.m.push(t),ie(t,le);for(var r=t.first;r!==null;)mn(r,e),r=r.next}}function _n(t){ie(t,le);for(var e=t.first;e!==null;)_n(e),e=e.next}let Bt=new Set;const ze=new Map;let gn=!1;function it(t,e){var r={f:0,v:t,reactions:null,equals:an,rv:0,wv:0};return r}function N(t,e){const r=it(t);return Cn(r),r}function Gs(t,e=!1,r=!0){const n=it(t);return e||(n.equals=on),n}function z(t,e,r=!1){B!==null&&(!Ae||(B.f&Yt)!==0)&&un()&&(B.f&(pe|Se|ht|Yt))!==0&&(qe===null||!qe.has(t))&&Ns();let n=r?me(e):e;return mt(t,n,Vt)}var et=null,vr=0;function mt(t,e,r=null){if(!t.equals(e)){Ye?ze.set(t,e):ze.has(t)||ze.set(t,t.v);var n=Ge.ensure();if(n.capture(t,e),(t.f&pe)!==0){const s=t;(t.f&ae)!==0&&Tr(s),Te===null&&Sr(s)}t.wv=In(),et=null,vr=0,bn(t,ae,r),et=null,X!==null&&(X.f&le)!==0&&(X.f&(Re|Ke))===0&&(ke===null?li([t]):ke.push(t)),!n.is_fork&&Bt.size>0&&!gn&&Zs()}return e}function Zs(){gn=!1;for(const t of Bt){(t.f&le)!==0&&ie(t,Me);let e;try{e=Nt(t)}catch{e=!0}e&&_t(t)}Bt.clear()}function Pt(t){z(t,t.v+1)}function bn(t,e,r){var n=t.reactions;if(n!==null){var s=n.length;if(vr+=s,vr>1e5&&et===null&&(et=new Set),et!==null){if(et.has(t))return;et.add(t)}for(var i=0;i<s;i++){var a=n[i],l=a.f,o=(l&ae)===0;if(o&&ie(a,e),(l&Yt)!==0)Bt.add(a);else if((l&pe)!==0){var c=a;Te?.delete(c),bn(c,Me,r)}else if(o){var d=a;(l&Se)!==0&&De!==null&&De.add(d),r!==null?r.push(d):Pr(d)}}}}function me(t){if(typeof t!="object"||t===null||Tt in t||tn in t)return t;const e=$r(t);if(e!==is&&e!==as)return t;var r=new Map,n=Zr(t),s=N(0),i=st,a=l=>{if(st===i)return l();var o=B,c=st;Ee(null),Vr(i);var d=l();return Ee(o),Vr(c),d};return n&&r.set("length",N(t.length)),new Proxy(t,{defineProperty(l,o,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&zs();var d=r.get(o);return d===void 0?a(()=>{var v=N(c.value);return r.set(o,v),v}):z(d,c.value,!0),!0},deleteProperty(l,o){var c=r.get(o);if(c===void 0){if(o in l){const d=a(()=>N(oe));r.set(o,d),Pt(s)}}else z(c,oe),Pt(s);return!0},get(l,o,c){if(o===Tt)return t;var d=r.get(o),v=o in l;if(d===void 0&&(!v||ft(l,o)?.writable)&&(d=a(()=>{var h=me(v?l[o]:oe),m=N(h);return m}),r.set(o,d)),d!==void 0){var p=u(d);return p===oe?void 0:p}return Reflect.get(l,o,c)},getOwnPropertyDescriptor(l,o){this.has?.(l,o);var c=Reflect.getOwnPropertyDescriptor(l,o),d=r.get(o);if(d!==void 0){var v=u(d);if(v===oe)return;if(c&&"value"in c)c.value=v;else return{enumerable:!0,configurable:!0,value:v,writable:!0}}return c},has(l,o){if(o===Tt)return!0;var c=r.get(o),d=c!==void 0&&c.v!==oe||Reflect.has(l,o);if(c!==void 0||X!==null&&(!d||ft(l,o)?.writable)){c===void 0&&(c=a(()=>{var p=d?me(l[o]):oe,h=N(p);return h}),r.set(o,c));var v=u(c);if(v===oe)return!1}return d},set(l,o,c,d){var v=r.get(o),p=o in l;if(n&&o==="length")for(var h=c;h<v.v;h+=1){var m=r.get(h+"");m!==void 0?z(m,oe):h in l&&(m=a(()=>N(oe)),r.set(h+"",m))}if(v===void 0)(!p||ft(l,o)?.writable)&&(v=a(()=>N(void 0)),z(v,me(c)),r.set(o,v));else{p=v.v!==oe;var E=a(()=>me(c));z(v,E)}var f=Reflect.getOwnPropertyDescriptor(l,o);if(f?.set&&f.set.call(d,c),!p){if(n&&typeof o=="string"){var _=r.get("length"),y=Number(o);Number.isInteger(y)&&y>=_.v&&z(_,y+1)}Pt(s)}return!0},ownKeys(l){u(s);var o=Reflect.ownKeys(l).filter(v=>{var p=r.get(v);return p===void 0||p.v!==oe});for(var[c,d]of r)d.v!==oe&&!(c in l)&&o.push(c);return o},setPrototypeOf(){qs()}})}var pr,wn,yn,kn;function Js(){if(pr===void 0){pr=window,wn=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;yn=ft(e,"firstChild").get,kn=ft(e,"nextSibling").get,qr(t)&&(t[ur]=void 0,t[rn]=null,t[cr]=void 0,t.__e=void 0),qr(r)&&(r[fr]=void 0)}}function rt(t=""){return document.createTextNode(t)}function at(t){return yn.call(t)}function qt(t){return kn.call(t)}function W(t,e){return at(t)}function $s(t,e=!1){{var r=at(t);return r instanceof Comment&&r.data===""?qt(r):r}}function j(t,e=!1){return at(t)}function k(t,e=1,r=!1){let n=t;for(;e--;)n=qt(n);return n}function Qs(t){t.textContent=""}function xn(){return!1}function ei(t,e,r){return r?document.createElement(t,{is:r}):document.createElement(t)}function ti(t){var e=X;if(e===null)return B.f|=We,t;if((e.f&bt)===0&&(e.f&dt)===0)throw t;Oe(t,e)}function Oe(t,e){if(t===sn)throw t;if(!(e!==null&&(e.f&fe)!==0)){for(;e!==null;){if((e.f&lr)!==0&&(e.f&(fe|Ft))===0){if((e.f&bt)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw t}}function ri(t){X===null&&(B===null&&Cs(),Fs()),Ye&&Rs()}function ni(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Ue(t,e){var r=X;r!==null&&(r.f&_e)!==0&&(t|=_e);var n={ctx:he,deps:null,nodes:null,f:t|ae|Pe,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};K?.register_created_effect(n);var s=n;if((t&dt)!==0)At!==null?At.push(n):Ge.ensure().schedule(n);else if(e!==null){try{_t(n)}catch(a){throw be(n),a}s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&wt)===0&&(s=s.first,(t&Se)!==0&&(t&vt)!==0&&s!==null&&(s.f|=vt))}if(s!==null&&(s.parent=r,r!==null&&ni(s,r),B!==null&&(B.f&pe)!==0&&(t&Ke)===0)){var i=B;(i.effects??=[]).push(s)}return n}function Rr(){return B!==null&&!Ae}function Mn(t){const e=Ue(Wt,null);return ie(e,le),e.teardown=t,e}function Kt(t){ri();var e=X.f,r=!B&&(e&Re)!==0&&he!==null&&!he.i;if(r){var n=he;(n.e??=[]).push(t)}else return En(t)}function En(t){return Ue(dt|cs,t)}function si(t){Ge.ensure();const e=Ue(Ke|wt,t);return(r={})=>new Promise(n=>{r.outro?nt(e,()=>{be(e),n(void 0)}):(be(e),n(void 0))})}function Sn(t){return Ue(dt,t)}function ii(t){return Ue(ht|wt,t)}function Tn(t,e=0){return Ue(Wt|e,t)}function re(t,e=[],r=[],n=[]){Us(n,e,r,s=>{Ue(Wt,()=>{t(...s.map(u))})})}function Fr(t,e=0){var r=Ue(Se|e,t);return r}function xe(t){return Ue(Re|wt,t)}function An(t){var e=t.teardown;if(e!==null){const r=Ye,n=B;Lr(!0),Ee(null);try{e.call(null)}catch(s){Oe(s,t.parent)}finally{Lr(r),Ee(n)}}}function Cr(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){const s=r.ac;s!==null&&zt(()=>{s.abort(It)});var n=r.next;(r.f&Ke)!==0?r.parent=null:be(r,e),r=n}}function ai(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&Re)===0&&be(e),e=r}}function be(t,e=!0){var r=!1;(e||(t.f&us)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(oi(t.nodes.start,t.nodes.end),r=!0),t.f|=Ft,Cr(t,e&&!r),Ot(t,0);var n=t.nodes&&t.nodes.t;if(n!==null)for(const i of n)i.stop();An(t),t.f^=Ft,t.f|=fe;var s=t.parent;s!==null&&s.first!==null&&Pn(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function oi(t,e){for(;t!==null;){var r=t===e?null:qt(t);t.remove(),t=r}}function Pn(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function nt(t,e,r=!0){var n=[];t.f|=Mr,Rn(t,n,!0);var s=()=>{r&&be(t),e&&e()},i=n.length;if(i>0){var a=()=>--i||s();for(var l of n)l.out(a)}else s()}function Rn(t,e,r){if((t.f&_e)===0){t.f^=_e;var n=t.nodes&&t.nodes.t;if(n!==null)for(const l of n)(l.is_global||r)&&e.push(l);for(var s=t.first;s!==null;){var i=s.next;if((s.f&Ke)===0){var a=(s.f&vt)!==0||(s.f&Re)!==0&&(t.f&Se)!==0;Rn(s,e,a?r:!1)}s=i}}}function Ht(t){t.f&=~Mr,Fn(t,!0)}function Fn(t,e){if((t.f&Mr)===0&&(t.f&_e)!==0){t.f^=_e,(t.f&le)===0&&(ie(t,ae),Ge.ensure().schedule(t));for(var r=t.first;r!==null;){var n=r.next,s=(r.f&vt)!==0||(r.f&Re)!==0;Fn(r,s?e:!1),r=n}var i=t.nodes&&t.nodes.t;if(i!==null)for(const a of i)(a.is_global||e)&&a.in()}}function Or(t,e){if(t.nodes)for(var r=t.nodes.start,n=t.nodes.end;r!==null;){var s=r===n?null:qt(r);e.append(r),r=s}}let Ye=!1;function Lr(t){Ye=t}let B=null,Ae=!1;function Ee(t){B=t}let X=null;function Ne(t){X=t}let qe=null;function Cn(t){B!==null&&((B.f&Ut)!==0||(B.f&pe)!==0)&&(qe??=new Set).add(t)}let ge=null,we=0,ke=null;function li(t){ke=t}let On=1,tt=0,st=tt;function Vr(t){st=t}function In(){return++On}function Nt(t){var e=t.f;if((e&ae)!==0)return!0;if((e&Me)!==0){for(var r=t.deps,n=r.length,s=0;s<n;s++){var i=r[s];if(Nt(i)&&dn(i),i.wv>t.wv)return!0}(e&Pe)!==0&&Te===null&&ie(t,le)}return!1}function zn(t,e,r=!0){var n=t.reactions;if(n!==null&&!(qe!==null&&qe.has(t)))for(var s=0;s<n.length;s++){var i=n[s];(i.f&pe)!==0?zn(i,e,!1):e===i&&(r?ie(i,ae):(i.f&le)!==0&&ie(i,Me),Pr(i))}}function qn(t){var e=ge,r=we,n=ke,s=B,i=qe,a=he,l=Ae,o=st,c=t.f;ge=null,we=0,ke=null,B=(c&(Re|Ke))===0?t:null,qe=null,pt(t.ctx),Ae=!1,st=++tt,t.ac!==null&&(zt(()=>{t.ac.abort(It)}),t.ac=null);try{t.f|=Ut;var d=t.fn,v=d();t.f|=bt;var p=Yr(t);if(un()&&ke!==null&&!Ae&&p!==null&&(t.f&(pe|Me|ae))===0)for(var h=0;h<ke.length;h++)zn(ke[h],t);if(s!==null&&s!==t){if(tt++,s.deps!==null)for(let m=0;m<r;m+=1)s.deps[m].rv=tt;if(e!==null)for(const m of e)m.rv=tt;ke!==null&&(n===null?n=ke:n.push(...ke))}return(t.f&We)!==0&&(t.f^=We),v}catch(m){return Yr(t),ti(m)}finally{t.f^=Ut,ge=e,we=r,ke=n,B=s,qe=i,pt(a),Ae=l,st=o}}function Yr(t){var e=t.deps,r=K?.is_fork;if(ge!==null){var n;if(r||Ot(t,we),e!==null&&we>0)for(e.length=we+ge.length,n=0;n<ge.length;n++)e[we+n]=ge[n];else t.deps=e=ge;if(Rr()&&(t.f&Pe)!==0)for(n=we;n<e.length;n++)(e[n].reactions??=[]).push(t)}else!r&&e!==null&&we<e.length&&(Ot(t,we),e.length=we);return e}function ui(t,e){let r=e.reactions;if(r!==null){var n=ns.call(r,t);if(n!==-1){var s=r.length-1;s===0?r=e.reactions=null:(r[n]=r[s],r.pop())}}if(r===null&&(e.f&pe)!==0&&(ge===null||!Rt.call(ge,e))){var i=e;(i.f&Pe)!==0&&(i.f^=Pe),i.v!==oe&&Sr(i),i.ac!==null&&zt(()=>{i.ac.abort(It),i.ac=null,ie(i,ae)}),Xs(i),Ot(i,0)}}function Ot(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)ui(t,r[n])}function _t(t){var e=t.f;if((e&fe)===0){ie(t,le);var r=X;X=t;try{(e&(Se|en))!==0?ai(t):Cr(t),An(t);var n=qn(t);t.teardown=typeof n=="function"?n:null,t.wv=On;var s;Gr&&Ls&&(t.f&ae)!==0&&t.deps}finally{X=r}}}function u(t){var e=t.f,r=(e&pe)!==0;if(B!==null&&!Ae){var n=X!==null&&(X.f&fe)!==0;if(!n&&(qe===null||!qe.has(t))){var s=B.deps;if((B.f&Ut)!==0)t.rv<tt&&(t.rv=tt,ge===null&&s!==null&&s[we]===t?we++:ge===null?ge=[t]:ge.push(t));else{B.deps??=[],Rt.call(B.deps,t)||B.deps.push(t);var i=t.reactions;i===null?t.reactions=[B]:Rt.call(i,B)||i.push(B)}}}if(Ye&&ze.has(t))return ze.get(t);if(r){var a=t;if(Ye){var l=a.v;return((a.f&le)===0&&a.reactions!==null||Dn(a))&&(l=Tr(a)),ze.set(a,l),l}var o=(a.f&Pe)===0&&!Ae&&B!==null&&(B.f&Pe)!==0,c=(a.f&bt)===0;Nt(a)&&(o&&(a.f|=Pe),dn(a)),o&&!c&&(vn(a),Nn(a))}if(Te?.has(t))return Te.get(t);if((t.f&We)!==0)throw t.v;return t.v}function Nn(t){if(t.f|=Pe,t.deps!==null)for(const r of t.deps){var e=r.reactions;e===null?r.reactions=[t]:Rt.call(e,t)||e.push(t),(r.f&pe)!==0&&(r.f&Pe)===0&&(vn(r),Nn(r))}}function Dn(t){if(t.v===oe)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(ze.has(e)||(e.f&pe)!==0&&Dn(e))return!0;return!1}function ot(t){var e=Ae;try{return Ae=!0,t()}finally{Ae=e}}const ci=["touchstart","touchmove"];function fi(t){return ci.includes(t)}const Et=Symbol("events"),Ln=new Set,mr=new Set;function hi(t,e,r,n={}){function s(i){if(n.capture||_r.call(e,i),!i.cancelBubble)return zt(()=>r?.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?(s.__removed=!1,Le(()=>{s.__removed||e.addEventListener(t,s,n)})):e.addEventListener(t,s,n),s}function Ir(t,e,r,n,s){var i={capture:n,passive:s},a=hi(t,e,r,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Mn(()=>{a.__removed=!0,e.removeEventListener(t,a,i)})}function H(t,e,r){(e[Et]??={})[t]=r}function yt(t){for(var e=0;e<t.length;e++)Ln.add(t[e]);for(var r of mr)r(t)}let nr=null,sr=!1;function _r(t){var e=this,r=e.ownerDocument,n=t.type,s=t.composedPath?.()||[],i=s[0]||t.target;nr=t,sr||(sr=!0,setTimeout(()=>{sr=!1,nr=null}));var a=0,l=nr===t&&t[Et];if(l){var o=s.indexOf(l);if(o!==-1&&(e===document||e===window)){t[Et]=e;return}var c=s.indexOf(e);if(c===-1)return;o<=c&&(a=o)}if(i=s[a]||t.target,i!==e){Jr(t,"currentTarget",{configurable:!0,get(){return i||r}});var d=B,v=X;Ee(null),Ne(null);try{for(var p,h=[];i!==null&&i!==e;){try{var m=i[Et]?.[n];m!=null&&(!i.disabled||t.target===i)&&m.call(i,t)}catch(E){p?h.push(E):p=E}if(t.cancelBubble)break;a++,i=a<s.length?s[a]:null}if(p){for(let E of h)queueMicrotask(()=>{throw E});throw p}}finally{t[Et]=e,delete t.currentTarget,Ee(d),Ne(v)}}}const di=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function vi(t){return di?.createHTML(t)??t}function Vn(t){var e=ei("template");return e.innerHTML=vi(t.replaceAll("<!>","<!---->")),e.content}function gr(t,e){var r=X;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function se(t,e){var r=(e&ks)!==0,n=(e&xs)!==0,s,i=!t.startsWith("<!>");return()=>{s===void 0&&(s=Vn(i?t:"<!>"+t),r||(s=at(s)));var a=n||wn?document.importNode(s,!0):s.cloneNode(!0);if(r){var l=at(a),o=a.lastChild;gr(l,o)}else gr(a,a);return a}}function pi(t,e,r="svg"){var n=!t.startsWith("<!>"),s=`<${r}>${n?t:"<!>"+t}</${r}>`,i;return()=>{if(!i){var a=Vn(s),l=at(a);i=at(l)}var o=i.cloneNode(!0);return gr(o,o),o}}function mi(t,e){return pi(t,e,"svg")}function Q(t,e){t!==null&&t.before(e)}function _i(t){let e=0,r=it(0),n;return()=>{Rr()&&(u(r),Tn(()=>(e===0&&(n=ot(()=>t(()=>Pt(r)))),e+=1,()=>{Le(()=>{e-=1,e===0&&(n?.(),n=void 0,Pt(r))})})))}}var gi=vt|wt;function bi(t,e,r,n){new wi(t,e,r,n)}class wi{parent;is_pending=!1;transform_error;#e;#s=null;#t;#o;#n;#a=null;#r=null;#l=null;#i=null;#m=0;#u=0;#c=!1;#h=new Set;#_=new Set;#f=null;#y=_i(()=>(this.#f=it(this.#m),()=>{this.#f=null}));constructor(e,r,n,s){this.#e=e,this.#t=r,this.#o=i=>{var a=X;a.b=this,a.f|=lr,n(i)},this.parent=X.b,this.transform_error=s??this.parent?.transform_error??(i=>i),this.#n=Fr(()=>{this.#v()},gi)}#k(){try{this.#a=xe(()=>this.#o(this.#e))}catch(e){this.error(e)}}#g(e){const r=this.#t.failed,{reset:n,invoke_onerror:s}=this.#b(e);Le(s),r&&(this.#l=xe(()=>{r(this.#e,()=>e,()=>n)}))}#b(e){var r=!1,n=!1;const s=()=>{if(!this.#d()){if(r){Ss();return}r=!0,n&&Ds(),this.#l!==null&&nt(this.#l,()=>{this.#l=null}),this.#p(()=>{this.#v()})}};return{reset:s,invoke_onerror:()=>{if(!this.#d())try{n=!0,this.#t.onerror?.(e,s),n=!1}catch(a){Oe(a,this.#n&&this.#n.parent)}}}}#d(){return(this.#n.f&(fe|Ft))!==0}#x(){const e=this.#t.pending;e&&(this.is_pending=!0,this.#r=xe(()=>e(this.#e)),Le(()=>{if(!this.#d()){var r=this.#i=document.createDocumentFragment(),n=rt(),s=!1;if(r.append(n),this.#a=this.#p(()=>{try{return xe(()=>this.#o(n))}catch(i){try{this.error(i),s=!0}catch(a){Oe(a,this.#n.parent)}return null}}),this.#a===null){this.#i=null,s&&this.#w(K);return}this.#u===0&&(this.#e.before(r),this.#i=null,nt(this.#r,()=>{this.#r=null}),this.#w(K))}}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#m=0,this.#a=xe(()=>{this.#o(this.#e)}),this.#u>0){var e=this.#i=document.createDocumentFragment();Or(this.#a,e);const r=this.#t.pending;this.#r=xe(()=>r(this.#e))}else this.#w(K)}catch(r){this.error(r)}}#w(e){this.is_pending=!1,e.transfer_effects(this.#h,this.#_)}defer_effect(e){cn(e,this.#h,this.#_)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#p(e){var r=X,n=B,s=he;Ne(this.#n),Ee(this.#n),pt(this.#n.ctx);try{return Ge.ensure(),e()}finally{Ne(r),Ee(n),pt(s)}}#M(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#M(e,r);return}this.#u+=e,this.#u===0&&(this.#w(r),this.#r&&nt(this.#r,()=>{this.#r=null}),this.#i&&(this.#e.before(this.#i),this.#i=null))}update_pending_count(e,r){this.#M(e,r),this.#m+=e,!(!this.#f||this.#c)&&(this.#c=!0,Le(()=>{this.#c=!1,this.#f&&mt(this.#f,this.#m)}))}get_effect_pending(){return this.#y(),u(this.#f)}error(e){if(e===sn||!this.#t.onerror&&!this.#t.failed)throw e;K?.is_fork?(this.#a&&K.skip_effect(this.#a),this.#r&&K.skip_effect(this.#r),this.#l&&K.skip_effect(this.#l),K.oncommit(()=>{this.#d()||this.#E(e)})):this.#E(e)}#E(e){this.#a&&(be(this.#a),this.#a=null),this.#r&&(be(this.#r),this.#r=null),this.#l&&(be(this.#l),this.#l=null);let r=this.#t.failed;const n=s=>{if(this.#d())return;const{reset:i,invoke_onerror:a}=this.#b(s);a(),r&&!this.#d()&&(this.#l=this.#p(()=>{try{return xe(()=>{var l=X;l.b=this,l.f|=lr,r(this.#e,()=>s,()=>i)})}catch(l){return Oe(l,this.#n.parent),null}}))};Le(()=>{if(!this.#d()){var s;try{s=this.transform_error(e)}catch(i){Oe(i,this.#n&&this.#n.parent);return}s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(n,i=>Oe(i,this.#n&&this.#n.parent)):n(s)}})}}function V(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[fr]??=t.nodeValue)&&(t[fr]=r,t.nodeValue=`${r}`)}function yi(t,e){return ki(t,e)}const Dt=new Map;function ki(t,{target:e,anchor:r,props:n={},events:s,context:i,intro:a=!0,transformError:l}){Js();var o=void 0,c=si(()=>{var d=r??e.appendChild(rt());bi(d,{pending:()=>{}},h=>{Ze({});var m=he;i&&(m.c=i),s&&(n.$$events=s),o=t(h,n)||Er(),Je()},l);var v=new Set,p=h=>{for(var m=0;m<h.length;m++){var E=h[m];if(!v.has(E)){v.add(E);var f=fi(E);for(const C of[e,document]){var _=Dt.get(C);_===void 0&&(_=new Map,Dt.set(C,_));var y=_.get(E);y===void 0?(C.addEventListener(E,_r,{passive:f}),_.set(E,1)):_.set(E,y+1)}}}};return p(Xt(Ln)),mr.add(p),()=>{for(var h of v)for(const f of[e,document]){var m=Dt.get(f),E=m.get(h);--E==0?(f.removeEventListener(h,_r),m.delete(h),m.size===0&&Dt.delete(f)):m.set(h,E)}mr.delete(p),d!==r&&d.parentNode?.removeChild(d)}});return xi.set(o,c),o}let xi=new WeakMap;class Mi{anchor;#e=new Map;#s=new Map;#t=new Map;#o=new Set;#n=!0;constructor(e,r=!0){this.anchor=e,this.#n=r}#a=e=>{if(this.#e.has(e)){var r=this.#e.get(e),n=this.#s.get(r);if(n)Ht(n),this.#o.delete(r);else{var s=this.#t.get(r);s&&(Ht(s.effect),this.#s.set(r,s.effect),this.#t.delete(r),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),n=s.effect)}for(const[i,a]of this.#e){if(this.#e.delete(i),i===e)break;const l=this.#t.get(a);l&&(be(l.effect),this.#t.delete(a))}for(const[i,a]of this.#s){if(i===r||this.#o.has(i))continue;const l=()=>{if(Array.from(this.#e.values()).includes(i)){var c=document.createDocumentFragment();Or(a,c),c.append(rt()),this.#t.set(i,{effect:a,fragment:c})}else be(a);this.#o.delete(i),this.#s.delete(i)};this.#n||!n?(this.#o.add(i),nt(a,l,!1)):l()}}};#r=e=>{this.#e.delete(e);const r=Array.from(this.#e.values());for(const[n,s]of this.#t)r.includes(n)||(be(s.effect),this.#t.delete(n))};ensure(e,r){var n=K,s=xn();if(r&&!this.#s.has(e)&&!this.#t.has(e))if(s){var i=document.createDocumentFragment(),a=rt();i.append(a),this.#t.set(e,{effect:xe(()=>r(a)),fragment:i})}else this.#s.set(e,xe(()=>r(this.anchor)));if(this.#e.set(n,e),s){for(const[l,o]of this.#s)l===e?n.unskip_effect(o):n.skip_effect(o);for(const[l,o]of this.#t)l===e?n.unskip_effect(o.effect):n.skip_effect(o.effect);n.oncommit(this.#a),n.ondiscard(this.#r)}else this.#a(n)}}function ye(t,e,r=!1){var n=new Mi(t),s=r?vt:0;function i(a,l){n.ensure(a,l)}Fr(()=>{var a=!1;e((l,o=0)=>{a=!0,i(o,l)}),a||i(-1,null)},s)}function Ei(t,e){return e}function Si(t,e,r){for(var n=[],s=e.length,i,a=e.length,l=0;l<s;l++){let v=e[l];nt(v,()=>{if(i){if(i.pending.delete(v),i.done.add(v),i.pending.size===0){var p=t.outrogroups;br(t,Xt(i.done)),p.delete(i),p.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var o=n.length===0&&r!==null&&t.pending.size===0;if(o){var c=r,d=c.parentNode;Qs(d),d.append(c),t.items.clear()}br(t,e,!o)}else i={pending:new Set(e),done:new Set},(t.outrogroups??=new Set).add(i)}function br(t,e,r=!0){var n;if(t.pending.size>0){n=new Set;for(const a of t.pending.values())for(const l of a)n.add(t.items.get(l).e)}for(var s=0;s<e.length;s++){var i=e[s];if(n?.has(i)){i.f|=Ie;const a=document.createDocumentFragment();Or(i,a)}else be(e[s],r)}}var Ur;function Ve(t,e,r,n,s,i=null){var a=t,l=new Map,o=(e&nn)!==0;if(o){var c=t;a=c.appendChild(rt())}var d=null,v=hn(()=>{var y=r();return Zr(y)?y:y==null?[]:Xt(y)}),p=new Map,h=!0;function m(y){if((_.effect.f&fe)===0){_.pending.delete(y);var C=u(v);_.fallback=d,Ti(_,C,a,e,n),d!==null&&(C.length===0?(d.f&Ie)===0?Ht(d):(d.f^=Ie,St(d,null,a)):nt(d,()=>{d=null}))}}function E(y){_.pending.delete(y)}var f=Fr(()=>{for(var y=u(v),C=y.length,w=new Set,O=K,I=xn(),Y=0;Y<C;Y+=1){var ne=y[Y],P=n(ne,Y),D=h?null:l.get(P);D?(D.v&&mt(D.v,ne),D.i&&mt(D.i,Y),I&&O.unskip_effect(D.e)):(D=Ai(l,h?a:Ur??=rt(),ne,P,Y,s,e,r),h||(D.e.f|=Ie),l.set(P,D)),w.add(P)}if(C===0&&i&&!d&&(h?d=xe(()=>i(a)):(d=xe(()=>i(Ur??=rt())),d.f|=Ie)),C>w.size&&Ps(),!h)if(p.set(O,w),I){for(const[$,ue]of l)w.has($)||O.skip_effect(ue.e);O.oncommit(m),O.ondiscard(E)}else m(O);u(v)}),_={effect:f,items:l,pending:p,outrogroups:null,fallback:d};h=!1}function xt(t){for(;t!==null&&(t.f&Re)===0;)t=t.next;return t}function Ti(t,e,r,n,s){var i=(n&ms)!==0,a=e.length,l=t.items,o=xt(t.effect.first),c,d=null,v,p=[],h=[],m,E,f,_;if(i)for(_=0;_<a;_+=1)m=e[_],E=s(m,_),f=l.get(E).e,(f.f&Ie)===0&&(f.nodes?.a?.measure(),(v??=new Set).add(f));for(_=0;_<a;_+=1){if(m=e[_],E=s(m,_),f=l.get(E).e,t.outrogroups!==null)for(const D of t.outrogroups)D.pending.delete(f),D.done.delete(f);if((f.f&_e)!==0&&(Ht(f),i&&(f.nodes?.a?.unfix(),(v??=new Set).delete(f))),(f.f&Ie)!==0)if(f.f^=Ie,f===o)St(f,null,r);else{var y=d?d.next:o;f===t.effect.last&&(t.effect.last=f.prev),f.prev&&(f.prev.next=f.next),f.next&&(f.next.prev=f.prev),He(t,d,f),He(t,f,y),St(f,y,r),d=f,p=[],h=[],o=xt(d.next);continue}if(f!==o){if(c!==void 0&&c.has(f)){if(p.length<h.length){var C=h[0],w;d=C.prev;var O=p[0],I=p[p.length-1];for(w=0;w<p.length;w+=1)St(p[w],C,r);for(w=0;w<h.length;w+=1)c.delete(h[w]);He(t,O.prev,I.next),He(t,d,O),He(t,I,C),o=C,d=I,_-=1,p=[],h=[]}else c.delete(f),St(f,o,r),He(t,f.prev,f.next),He(t,f,d===null?t.effect.first:d.next),He(t,d,f),d=f;continue}for(p=[],h=[];o!==null&&o!==f;)(c??=new Set).add(o),h.push(o),o=xt(o.next);if(o===null)continue}(f.f&Ie)===0&&p.push(f),d=f,o=xt(f.next)}if(t.outrogroups!==null){for(const D of t.outrogroups)D.pending.size===0&&(br(t,Xt(D.done)),t.outrogroups?.delete(D));t.outrogroups.size===0&&(t.outrogroups=null)}if(o!==null||c!==void 0){var Y=[];if(c!==void 0)for(f of c)(f.f&_e)===0&&Y.push(f);for(;o!==null;)(o.f&_e)===0&&o!==t.fallback&&Y.push(o),o=xt(o.next);var ne=Y.length;if(ne>0){var P=(n&nn)!==0&&a===0?r:null;if(i){for(_=0;_<ne;_+=1)Y[_].nodes?.a?.measure();for(_=0;_<ne;_+=1)Y[_].nodes?.a?.fix()}Si(t,Y,P)}}i&&Le(()=>{if(v!==void 0)for(f of v)f.nodes?.a?.apply()})}function Ai(t,e,r,n,s,i,a,l){var o=(a&vs)!==0?(a&_s)===0?Gs(r,!1,!1):it(r):null,c=(a&ps)!==0?it(s):null;return{v:o,i:c,e:xe(()=>(i(e,o??r,c??s,l),()=>{t.delete(n)}))}}function St(t,e,r){if(t.nodes)for(var n=t.nodes.start,s=t.nodes.end,i=e&&(e.f&Ie)===0?e.nodes.start:r;n!==null;){var a=qt(n);if(i.before(n),n===s)return;n=a}}function He(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}const jr=[...`
\r\f \v\uFEFF`];function Pi(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var s of Object.keys(r))if(r[s])n=n?n+" "+s:s;else if(n.length)for(var i=s.length,a=0;(a=n.indexOf(s,a))>=0;){var l=a+i;(a===0||jr.includes(n[a-1]))&&(l===n.length||jr.includes(n[l]))?n=(a===0?"":n.substring(0,a))+n.substring(l+1):a=l}}return n===""?null:n}function Br(t,e=!1){var r=e?" !important;":";",n="";for(var s of Object.keys(t)){var i=t[s];i!=null&&i!==""&&(n+=" "+s+": "+i+r)}return n}function Ri(t,e){if(e){var r="",n,s;return Array.isArray(e)?(n=e[0],s=e[1]):n=e,n&&(r+=Br(n)),s&&(r+=Br(s,!0)),r=r.trim(),r===""?null:r}return String(t)}function Gt(t,e,r,n,s,i){var a=t[ur];if(a!==r||a===void 0){var l=Pi(r,n,i);l==null?t.removeAttribute("class"):t.className=l,t[ur]=r}else if(i&&s!==i)for(var o in i){var c=!!i[o];(s==null||c!==!!s[o])&&t.classList.toggle(o,c)}return i}function ir(t,e={},r,n){for(var s in r){var i=r[s];e[s]!==i&&(r[s]==null?t.style.removeProperty(s):t.style.setProperty(s,i,n))}}function ct(t,e,r,n){var s=t[cr];if(s!==e){var i=Ri(e,n);i==null?t.removeAttribute("style"):t.style.cssText=i,t[cr]=e}else n&&(Array.isArray(n)?(ir(t,r?.[0],n[0]),ir(t,r?.[1],n[1],"important")):ir(t,r,n));return n}const Fi=Symbol("is custom element"),Ci=Symbol("is html"),Oi=ds?"progress":"PROGRESS";function Hr(t,e){var r=Yn(t);r.value===(r.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!==Oi)||(t.value=e??"")}function b(t,e,r,n){var s=Yn(t);s[e]!==(s[e]=r)&&(e==="loading"&&(t[hs]=r),r==null?t.removeAttribute(e):typeof r!="string"&&Ii(t).has(e)?t[e]=r:t.setAttribute(e,r))}function Yn(t){return t[rn]??={[Fi]:t.nodeName.includes("-"),[Ci]:t.namespaceURI===Ms}}var Xr=new Map;function Ii(t){var e=t.getAttribute("is")||t.nodeName,r=Xr.get(e);if(r)return r;Xr.set(e,r=new Set);for(var n,s=t,i=Element.prototype;i!==s;){n=ss(s);for(var a in n)n[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.add(a);s=$r(s)}return r}class zr{#e=new WeakMap;#s;#t;static entries=new WeakMap;constructor(e){this.#t=e}observe(e,r){var n=this.#e.get(e)||new Set;return n.add(r),this.#e.set(e,n),this.#o().observe(e,this.#t),()=>{var s=this.#e.get(e);s.delete(r),s.size===0&&(this.#e.delete(e),this.#s.unobserve(e))}}#o(){return this.#s??(this.#s=new ResizeObserver(e=>{for(var r of e){zr.entries.set(r.target,r);for(var n of this.#e.get(r.target)||[])n(r)}}))}}var zi=new zr({box:"border-box"});function qi(t,e,r){var n=zi.observe(t,()=>r(t[e]));Sn(()=>(ot(()=>r(t[e])),n))}function ar(t,e){return t===e||t?.[Tt]===e}function gt(t=Er(),e,r,n){var s=he.r,i=X;return Sn(()=>{var a,l;return Tn(()=>{a=l,l=[],ot(()=>{ar(r(...l),t)||(e(t,...l),a&&ar(r(...a),t)&&e(null,...a))})}),()=>{let o=i;for(;o!==s&&o.parent!==null&&o.parent.f&Ft;)o=o.parent;const c=()=>{l&&ar(r(...l),t)&&e(null,...l)},d=o.teardown;o.teardown=()=>{c(),d?.()}}}),t}let Lt=!1;function Ni(t){var e=Lt;try{return Lt=!1,[t(),Lt]}finally{Lt=e}}function Xe(t,e,r,n){var s=!0,i=(r&ws)!==0,a=(r&ys)!==0,l=n,o=!0,c=void 0,d=()=>a&&s?(c??=Ct(n),u(c)):(o&&(o=!1,l=a?ot(n):n),l);let v;if(i){var p=Tt in t||fs in t;v=ft(t,e)?.set??(p&&e in t?w=>t[e]=w:void 0)}var h,m=!1;i?[h,m]=Ni(()=>t[e]):h=t[e],h===void 0&&n!==void 0&&(h=d(),v&&(Is(),v(h)));var E;if(E=()=>{var w=t[e];return w===void 0?d():(o=!0,w)},(r&bs)===0)return E;if(v){var f=t.$$legacy;return(function(w,O){return arguments.length>0?((!O||f||m)&&v(O?E():w),w):E()})}var _=!1,y=((r&gs)!==0?Ct:hn)(()=>(_=!1,E()));i&&u(y);var C=X;return(function(w,O){if(arguments.length>0){const I=O?u(y):i?me(w):w;return z(y,I),_=!0,l!==void 0&&(l=I),w}return Ye&&_||(C.f&fe)!==0?y.v:u(y)})}function Zt(t){he===null&&ln(),Kt(()=>{const e=ot(t);if(typeof e=="function")return e})}function Di(t){he===null&&ln(),Zt(()=>()=>ot(t))}const wr=1,yr={Webp:1,Jpeg:2,Rgba:3},Un=16;function Li(t){if(t.byteLength<Un)return null;const e=new DataView(t),r=e.getUint8(8);return r<1||r>4?null:{frame:e.getUint32(0,!0),width:e.getUint16(4,!0),height:e.getUint16(6,!0),format:r,len:e.getUint32(12,!0)}}const Vi={[yr.Jpeg]:"image/jpeg",[yr.Webp]:"image/webp"};async function Yi(t){const e=Li(t);if(!e)return null;const r=new Uint8Array(t,Un,e.len);let n;if(e.format===yr.Rgba){const s=new ImageData(new Uint8ClampedArray(r),e.width,e.height);n=await createImageBitmap(s)}else n=await createImageBitmap(new Blob([r],{type:Vi[e.format]}));return{header:e,image:n}}function Ui(t,e,r){const n=new URL(t,r);return n.protocol==="http:"&&(n.protocol="ws:"),n.protocol==="https:"&&(n.protocol="wss:"),e&&n.searchParams.set("token",e),n.toString()}const ji=4401,jn="unauthorized";function Bi(t,e,r){return Math.min(r,e*2**Math.max(0,t-1))}class Hi{kind="ws";ws=null;handlers=null;attempt=0;timer=null;closed=!1;latestFrame=-1;decodeChain=Promise.resolve();url;min;max;WS;constructor(e){const r=typeof location<"u"?location.href:"http://127.0.0.1/";this.url=Ui(e.url,e.token,r),this.min=e.minDelayMs??250,this.max=e.maxDelayMs??5e3,this.WS=e.WebSocketImpl??WebSocket}connect(e){this.handlers=e,this.closed=!1,this.open()}open(){const e=this.handlers;if(!e||this.closed)return;e.status(this.attempt===0?{state:"connecting"}:{state:"reconnecting",attempt:this.attempt,delayMs:0});const r=new this.WS(this.url);r.binaryType="arraybuffer",this.ws=r,r.onopen=()=>{this.attempt=0,e.status({state:"open"})},r.onmessage=n=>{if(typeof n.data=="string"){let i;try{i=JSON.parse(n.data)}catch{return}this.decodeChain=this.decodeChain.then(()=>e.event(i));return}const s=n.data;this.decodeChain=this.decodeChain.then(async()=>{const i=await Yi(s);i&&(this.latestFrame=i.header.frame,e.frame(i))})},r.onclose=n=>{if(this.ws=null,this.closed)return;if(n?.code===ji){this.closed=!0,e.status({state:"closed",reason:jn});return}this.attempt+=1;const s=Bi(this.attempt,this.min,this.max);e.status({state:"reconnecting",attempt:this.attempt,delayMs:s}),this.timer=setTimeout(()=>this.open(),s)},r.onerror=()=>r.close()}send(e){this.ws?.readyState===1&&this.ws.send(JSON.stringify(e))}close(){this.closed=!0,this.timer&&clearTimeout(this.timer),this.ws?.close(),this.handlers?.status({state:"closed",reason:"closed by editor"})}get lastFrame(){return this.latestFrame}}class Xi{kind="mock";h=null;frame=0;playing=null;viewport={w:640,h:360};selected=null;sent=[];fps=30;size=[1920,1080];scenes=[{name:"intro",start:0,frames:60},{name:"outro",start:60,frames:60}];metas={intro:{version:1,markers:{beat:1},eases:{slide:[.65,0,.35,1]},tunables:{speed:1.5}},outro:{version:1,markers:{fade:.5},eases:{},tunables:{}}};get total(){return 120}connect(e){this.h=e,e.status({state:"connecting"}),queueMicrotask(()=>e.status({state:"open"}))}emit(e){this.h?.event(e)}inject(e){this.emit(e)}markers(){return Object.entries(this.metas).flatMap(([e,r])=>Object.entries(r.markers??{}).map(([n,s])=>({scene:e,name:n,time:s})))}timeline(){this.emit({type:"Timeline",frames:this.total,markers:this.markers(),scenes:this.scenes,audio_waveform:Array.from({length:240},(e,r)=>Math.abs(Math.sin(r/7))*.8)})}squareX(e){return 200+e/this.total*1400}async show(){const e=this.frame;this.emit({type:"Frame",index:e});const[r,n]=this.size,s=Math.min(this.viewport.w/r,this.viewport.h/n,1),i=Math.max(1,Math.round(r*s)),a=Math.max(1,Math.round(n*s));let l=null;if(typeof OffscreenCanvas<"u"){const o=new OffscreenCanvas(i,a),c=o.getContext("2d");c.fillStyle="#141414",c.fillRect(0,0,i,a),c.fillStyle="#e13238",c.fillRect((this.squareX(e)-100)*s,440*s,200*s,200*s),c.fillStyle="#fff",c.font=`${Math.round(48*s)}px sans-serif`,c.fillText(`frame ${e}`,40*s,80*s),l=o.transferToImageBitmap()}if(l){const o={header:{frame:e,width:i,height:a,format:3,len:i*a*4},image:l};this.h?.frame(o)}if(this.selected!==null){const o=this.squareX(e);this.emit({type:"Signals",node_id:this.selected,values:[{name:"x",value:(o-960).toFixed(3)},{name:"y",value:"0.000"},{name:"fill",value:"#e13238ff"}],bounds:[o-100,440,o+100,440,o+100,640,o-100,640]})}}send(e){switch(this.sent.push(e),e.type){case"Hello":if(e.protocol_version!==wr){this.emit({type:"Error",kind:"Incompatible",message:"protocol mismatch",spans:[]});return}this.emit({type:"Ready",protocol_version:wr,engine_version:"mock",fps:this.fps,size:this.size,scenes:this.scenes});for(const[r,n]of Object.entries(this.metas))this.emit({type:"MetaChanged",scene:r,meta:n});this.timeline(),this.emit({type:"Tree",nodes:[{id:0,parent:null,kind:"Group",name:"view"},{id:1,parent:0,kind:"Rect",name:"square"}]}),this.show();break;case"Seek":this.frame=Math.max(0,Math.min(this.total-1,e.frame)),this.show();break;case"Step":this.stopPlayback(),this.frame=Math.max(0,Math.min(this.total-1,this.frame+e.delta)),this.emit({type:"Playback",playing:!1,frame:this.frame}),this.show();break;case"Play":this.stopPlayback(),this.emit({type:"Playback",playing:!0,frame:this.frame}),this.playing=setInterval(()=>{this.frame=(this.frame+1)%this.total,this.show()},1e3/this.fps);break;case"Pause":this.stopPlayback(),this.emit({type:"Playback",playing:!1,frame:this.frame});break;case"SetViewport":this.viewport={w:e.w*e.dpr,h:e.h*e.dpr},this.show();break;case"SetMarker":{const r=e.scene??Object.keys(this.metas).find(s=>e.name in(this.metas[s]?.markers??{})),n=r?this.metas[r]:void 0;if(!r||!n){this.emit({type:"Error",kind:"Meta",message:`no marker named \`${e.name}\``,spans:[]});return}n.markers={...n.markers,[e.name]:e.time},this.emit({type:"MetaChanged",scene:r,meta:n}),this.timeline(),this.show();break}case"SetEase":case"SetTunable":{const r=this.metas.intro;e.type==="SetEase"?r.eases={...r.eases,[e.name]:e.value}:r.tunables={...r.tunables,[e.name]:e.value},this.emit({type:"MetaChanged",scene:"intro",meta:r}),this.show();break}case"Pick":{const r=this.squareX(this.frame),n=Math.abs(e.x-r)<=100&&Math.abs(e.y-540)<=100;this.selected=n?1:null,this.emit({type:"Selected",node_id:this.selected}),this.show();break}case"Select":this.selected=e.node_id??null,this.emit({type:"Selected",node_id:this.selected}),this.show();break}}stopPlayback(){this.playing!==null&&clearInterval(this.playing),this.playing=null}close(){this.stopPlayback(),this.h?.status({state:"closed",reason:"closed"})}}const Wi="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Wi);const Ki={"app.title":"oxframe","conn.connecting":"Connecting…","conn.open":"Connected","conn.reconnecting":"Reconnecting…","conn.closed":"Disconnected","conn.unauthorized":"Link expired: open the URL printed by `oxframe dev`","status.building":"Building…","status.reloaded":"Reloaded","status.incompatible":"Version mismatch","error.build":"Build failed","error.runtime":"Runtime error","error.meta":"Could not apply the edit","error.incompatible":"Incompatible versions","error.dismiss":"Dismiss","error.previous":"The previous version keeps running.","transport.play":"Play (Space)","transport.pause":"Pause (Space)","transport.prev":"Previous frame (←, Shift+← for 10)","transport.next":"Next frame (→, Shift+→ for 10)","transport.start":"Go to start (Home)","transport.end":"Go to end (End)","timeline.label":"Timeline","timeline.marker":"Marker {name} at {time} s. Drag or use ←/→ to move.","timeline.addMarker":"Add marker at playhead (M)","inspector.tree":"Scene","inspector.signals":"Signals","inspector.noSelection":"Click a node in the viewport or the tree.","inspector.tunables":"Tunables","inspector.eases":"Eases","inspector.none":"None yet — use tune!() and ease!() in your scene.","curve.title":"Ease “{name}”","curve.presets":"Presets","curve.close":"Close","viewport.label":"Preview","viewport.axes":"Axes","viewport.fit":"Fit (double-click)","theme.toggle":"Toggle light/dark theme","help.title":"Shortcuts","help.keys":"Space play/pause · ←/→ step · Shift+←/→ 10 frames · Home/End · M marker · wheel zoom · Alt/middle-drag pan"},Gi=Ki;function F(t,e={}){return Gi[t].replace(/\{(\w+)\}/g,(r,n)=>String(e[n]??`{${n}}`))}var Zi=se('<span class="chip ok svelte-yic9pk" data-testid="reloaded"> </span>'),Ji=se('<span class="dim svelte-yic9pk"> </span>'),$i=se('<header class="svelte-yic9pk"><strong class="logo svelte-yic9pk"> </strong> <span role="status" aria-live="polite" data-testid="status"><span class="dot svelte-yic9pk" aria-hidden="true"></span> </span> <!> <span class="spacer svelte-yic9pk"></span> <!> <button> </button> <button>1:1</button> <button> </button> <span class="help svelte-yic9pk">?</span></header>');function Qi(t,e){Ze(e,!0);let r=Xe(e,"editor",7);const n=ve(()=>{const w=r().connection;if(r().error?.kind==="Incompatible")return{cls:"bad",text:F("status.incompatible")};if(r().building)return{cls:"busy",text:F("status.building")};switch(w.state){case"open":return{cls:"ok",text:F("conn.open")};case"connecting":return{cls:"busy",text:F("conn.connecting")};case"reconnecting":return{cls:"busy",text:F("conn.reconnecting")};default:return{cls:"bad",text:w.reason===jn?F("conn.unauthorized"):F("conn.closed")}}});let s=N(!1);Kt(()=>{if(!r().reloadedAt)return;z(s,!0);const w=setTimeout(()=>z(s,!1),1500);return()=>clearTimeout(w)});var i=$i(),a=W(i),l=j(a,!0),o=k(a,2),c=k(W(o),1,!0),d=k(o,2);{var v=w=>{var O=Zi(),I=j(O,!0);re(Y=>V(I,Y),[()=>F("status.reloaded")]),Q(w,O)};ye(d,w=>{u(s)&&w(v)})}var p=k(d,4);{var h=w=>{var O=Ji(),I=j(O);re(()=>V(I,`engine ${r().engineVersion??""} · ${r().size[0]??""}×${r().size[1]??""} · ${r().fps??""} fps`)),Q(w,O)};ye(p,w=>{r().engineVersion&&w(h)})}var m=k(p,2),E=j(m,!0),f=k(m,2),_=k(f,2),y=j(_,!0),C=k(_,2);re((w,O,I,Y,ne,P,D,$)=>{V(l,w),Gt(o,1,`chip ${u(n).cls??""}`,"svelte-yic9pk"),V(c,u(n).text),b(m,"aria-pressed",r().showAxes),b(m,"title",O),V(E,I),b(f,"title",Y),b(_,"title",ne),b(_,"aria-label",P),V(y,e.theme==="dark"?"☾":"☀"),b(C,"title",D),b(C,"aria-label",$)},[()=>F("app.title"),()=>F("viewport.axes"),()=>F("viewport.axes"),()=>F("viewport.fit"),()=>F("theme.toggle"),()=>F("theme.toggle"),()=>F("help.keys"),()=>F("help.keys")]),H("click",m,()=>r().showAxes=!r().showAxes),H("click",f,()=>r().resetView()),H("click",_,function(...w){e.onToggleTheme?.apply(this,w)}),Q(t,i),Je()}yt(["click"]);function kr(t,e,r,n,s){const a=Math.min(e.w/t[0],e.h/t[1])*r;return{scale:a,ox:e.w/2-t[0]*a/2+n,oy:e.h/2-t[1]*a/2+s}}function Bn(t,e,r){return[(e-t.ox)/t.scale,(r-t.oy)/t.scale]}function xr(t,e,r){return[t.ox+e*t.scale,t.oy+r*t.scale]}function ea(t,e,r,n,s,i,a,l){const o=kr(t,e,r,n,s),[c,d]=Bn(o,a,l),v=kr(t,e,i,0,0),[p,h]=xr(v,c,d);return{panX:a-p,panY:l-h}}var ta=se('<div class="viewport svelte-10js0q2" data-testid="viewport"><canvas class="svelte-10js0q2"></canvas> <span class="zoom svelte-10js0q2" aria-live="off"> </span></div>');function ra(t,e){Ze(e,!0);let r,n,s=N(me({w:0,h:0}));const i=ve(()=>kr(e.editor.size,u(s),e.editor.zoom,e.editor.panX,e.editor.panY));Zt(()=>{const f=new ResizeObserver(([_])=>{if(!_)return;const{width:y,height:C}=_.contentRect;z(s,{w:Math.round(y),h:Math.round(C)},!0),e.editor.setViewport(u(s).w,u(s).h)});return f.observe(r),()=>f.disconnect()}),Kt(()=>{const f=n?.getContext("2d");if(!f)return;const _=typeof devicePixelRatio=="number"?devicePixelRatio:1,{w:y,h:C}=u(s);(n.width!==Math.round(y*_)||n.height!==Math.round(C*_))&&(n.width=Math.round(y*_),n.height=Math.round(C*_)),f.setTransform(_,0,0,_,0,0),f.clearRect(0,0,y,C);const[w,O]=e.editor.size,I=u(i),Y=e.editor.image;f.fillStyle="#000",f.fillRect(I.ox,I.oy,w*I.scale,O*I.scale),Y&&(f.imageSmoothingQuality="high",f.drawImage(Y,I.ox,I.oy,w*I.scale,O*I.scale));const ne=getComputedStyle(r).getPropertyValue("--m-accent")||"#6cb2eb";if(e.editor.showAxes){const[D,$]=xr(I,w/2,O/2);f.strokeStyle="rgba(255,255,255,0.25)",f.lineWidth=1,f.setLineDash([4,4]),f.beginPath(),f.moveTo(I.ox,$+.5),f.lineTo(I.ox+w*I.scale,$+.5),f.moveTo(D+.5,I.oy),f.lineTo(D+.5,I.oy+O*I.scale),f.stroke(),f.setLineDash([])}const P=e.editor.bounds;if(P&&e.editor.selected!==null){f.strokeStyle=ne,f.lineWidth=2,f.beginPath();for(let D=0;D<4;D++){const[$,ue]=xr(I,P[2*D],P[2*D+1]);D===0?f.moveTo($,ue):f.lineTo($,ue)}f.closePath(),f.stroke()}});let a=null;function l(f){const _=n.getBoundingClientRect();return[f.clientX-_.left,f.clientY-_.top]}function o(f){n.setPointerCapture(f.pointerId),a={x:f.clientX,y:f.clientY,px:e.editor.panX,py:e.editor.panY,moved:!1}}function c(f){if(!a)return;const _=f.clientX-a.x,y=f.clientY-a.y;Math.abs(_)+Math.abs(y)>3&&(a.moved=!0),a.moved&&(f.altKey||f.buttons===4||f.buttons===2)&&e.editor.setZoom(e.editor.zoom,a.px+_,a.py+y)}function d(f){const _=a;if(a=null,!_||_.moved||f.button!==0)return;const[y,C]=l(f),[w,O]=Bn(u(i),y,C),[I,Y]=e.editor.size;if(w<0||O<0||w>I||O>Y){e.editor.select(null);return}e.editor.pick(w,O)}function v(f){f.preventDefault();const[_,y]=l(f),C=Math.exp(-f.deltaY*.0015),w=Math.max(.1,Math.min(16,e.editor.zoom*C)),O=ea(e.editor.size,u(s),e.editor.zoom,e.editor.panX,e.editor.panY,w,_,y);e.editor.setZoom(w,O.panX,O.panY)}var p=ta(),h=W(p);gt(h,f=>n=f,()=>n);var m=k(h,2),E=j(m);gt(p,f=>r=f,()=>r),re(f=>{b(h,"data-frame",e.editor.imageFrame),b(h,"aria-label",`frame ${e.editor.imageFrame??""}`),V(E,`${f??""}%`)},[()=>Math.round(e.editor.zoom*100)]),H("pointerdown",h,o),H("pointermove",h,c),H("pointerup",h,d),Ir("wheel",h,v),H("dblclick",h,()=>e.editor.resetView()),H("contextmenu",h,f=>f.preventDefault()),Q(t,p),Je()}yt(["pointerdown","pointermove","pointerup","dblclick","contextmenu"]);const Hn="oxframe-editor-view";function na(t){const e=new URLSearchParams(t.replace(/^#/,"")),r=o=>{const c=e.get(o);if(c===null||c==="")return;const d=Number(c);return Number.isFinite(d)?d:void 0},n={},s=r("f");s!==void 0&&(n.frame=Math.max(0,Math.round(s)));const i=r("z");i!==void 0&&i>0&&(n.zoom=i);const a=r("px");a!==void 0&&(n.panX=a);const l=r("py");if(l!==void 0&&(n.panY=l),e.has("s")){const o=r("s");n.selected=o===void 0?null:o}return n}function sa(t){const e=new URLSearchParams;return e.set("f",String(t.frame)),t.zoom!==1&&e.set("z",t.zoom.toFixed(3)),(t.panX!==0||t.panY!==0)&&(e.set("px",t.panX.toFixed(1)),e.set("py",t.panY.toFixed(1))),t.selected!==null&&e.set("s",String(t.selected)),`#${e.toString()}`}function ia(){let t={};try{t=JSON.parse(sessionStorage.getItem(Hn)??"{}")}catch{t={}}return{...t,...na(typeof location>"u"?"":location.hash)}}function aa(t){try{sessionStorage.setItem(Hn,JSON.stringify(t))}catch{}typeof history<"u"&&history.replaceState(history.state,"",`${location.pathname}${location.search}${sa(t)}`)}class oa{constructor(e,r={}){if(this.backend=e,this.persistEnabled=r.persist??!0,this.uiVersion=r.uiVersion??"0.1.0",this.persistEnabled){const n=ia();this.restoredFrame=n.frame??null,this.zoom=n.zoom??1,this.panX=n.panX??0,this.panY=n.panY??0,this.selected=n.selected??null}}backend;#e=N(me({state:"connecting"}));get connection(){return u(this.#e)}set connection(e){z(this.#e,e,!0)}#s=N(!1);get ready(){return u(this.#s)}set ready(e){z(this.#s,e,!0)}#t=N("");get engineVersion(){return u(this.#t)}set engineVersion(e){z(this.#t,e,!0)}#o=N(60);get fps(){return u(this.#o)}set fps(e){z(this.#o,e,!0)}#n=N(me([1920,1080]));get size(){return u(this.#n)}set size(e){z(this.#n,e,!0)}#a=N(0);get frames(){return u(this.#a)}set frames(e){z(this.#a,e,!0)}#r=N(0);get frame(){return u(this.#r)}set frame(e){z(this.#r,e,!0)}#l=N(!1);get playing(){return u(this.#l)}set playing(e){z(this.#l,e,!0)}#i=N(me([]));get scenes(){return u(this.#i)}set scenes(e){z(this.#i,e,!0)}#m=N(me([]));get markers(){return u(this.#m)}set markers(e){z(this.#m,e,!0)}#u=N(null);get waveform(){return u(this.#u)}set waveform(e){z(this.#u,e)}#c=N(me({}));get metas(){return u(this.#c)}set metas(e){z(this.#c,e,!0)}#h=N(me([]));get tree(){return u(this.#h)}set tree(e){z(this.#h,e,!0)}#_=N(null);get selected(){return u(this.#_)}set selected(e){z(this.#_,e,!0)}#f=N(me([]));get signals(){return u(this.#f)}set signals(e){z(this.#f,e,!0)}#y=N(null);get bounds(){return u(this.#y)}set bounds(e){z(this.#y,e,!0)}#k=N(!1);get building(){return u(this.#k)}set building(e){z(this.#k,e,!0)}#g=N(0);get reloadedAt(){return u(this.#g)}set reloadedAt(e){z(this.#g,e,!0)}#b=N(null);get error(){return u(this.#b)}set error(e){z(this.#b,e,!0)}#d=N(null);get image(){return u(this.#d)}set image(e){z(this.#d,e)}#x=N(-1);get imageFrame(){return u(this.#x)}set imageFrame(e){z(this.#x,e,!0)}#v=N(1);get zoom(){return u(this.#v)}set zoom(e){z(this.#v,e,!0)}#w=N(0);get panX(){return u(this.#w)}set panX(e){z(this.#w,e,!0)}#p=N(0);get panY(){return u(this.#p)}set panY(e){z(this.#p,e,!0)}#M=N(!0);get showAxes(){return u(this.#M)}set showAxes(e){z(this.#M,e,!0)}viewport={w:0,h:0};#E=N(null);get selectedMarker(){return u(this.#E)}set selectedMarker(e){z(this.#E,e,!0)}#S=N(null);get editingEase(){return u(this.#S)}set editingEase(e){z(this.#S,e,!0)}restoredFrame=null;persistEnabled;uiVersion;start(){this.backend.connect({event:e=>this.handle(e),frame:e=>this.onFrame(e),status:e=>this.onStatus(e)})}stop(){this.backend.close()}send(e){this.backend.send(e)}onStatus(e){this.connection=e,e.state==="open"?this.send({type:"Hello",protocol_version:wr,ui_version:this.uiVersion}):(this.ready=!1,this.playing=!1)}onFrame(e){this.image?.close?.(),this.image=e.image,this.imageFrame=e.header.frame}handle(e){switch(e.type){case"Ready":this.ready=!0,this.engineVersion=e.engine_version,this.fps=e.fps,this.size=e.size,this.scenes=e.scenes,this.building=!1,this.error?.kind==="Incompatible"&&(this.error=null),this.resync();break;case"Reloaded":this.reloadedAt=Date.now(),this.building=!1,this.error=null,this.resync();break;case"Building":this.building=!0;break;case"Error":this.building=!1,this.error={kind:e.kind,message:e.message,spans:e.spans??[]};break;case"Frame":this.frame=e.index,this.savePersist();break;case"Playback":this.playing=e.playing,this.frame=e.frame;break;case"Timeline":this.frames=e.frames,this.markers=e.markers,this.scenes=e.scenes,e.audio_waveform&&(this.waveform=e.audio_waveform);break;case"Tree":this.tree=e.nodes;break;case"Signals":e.node_id===this.selected&&(this.signals=e.values,this.bounds=e.bounds??null);break;case"Selected":this.selected=e.node_id,e.node_id===null&&(this.signals=[],this.bounds=null),this.savePersist();break;case"MetaChanged":this.metas={...this.metas,[e.scene]:e.meta},this.error?.kind==="Meta"&&(this.error=null);break}}resync(){this.viewport.w>0&&this.sendViewport();const e=this.restoredFrame??this.frame;this.restoredFrame=null,this.send({type:"Seek",frame:e}),this.selected!==null&&this.send({type:"Select",node_id:this.selected})}get lastFrame(){return Math.max(0,this.frames-1)}seek(e){const r=Math.max(0,Math.min(this.lastFrame,Math.round(e)));this.frame=r,this.send({type:"Seek",frame:r})}play(){this.send({type:"Play"})}pause(){this.send({type:"Pause"})}togglePlay(){this.playing?this.pause():this.play()}step(e){this.send({type:"Step",delta:e})}setViewport(e,r){this.viewport={w:e,h:r},this.sendViewport()}sendViewport(){const e=typeof devicePixelRatio=="number"?devicePixelRatio:1;this.send({type:"SetViewport",w:Math.max(1,Math.round(this.viewport.w*this.zoom)),h:Math.max(1,Math.round(this.viewport.h*this.zoom)),dpr:e})}setZoom(e,r=this.panX,n=this.panY){const s=Math.max(.1,Math.min(16,e)),i=Math.abs(s-this.zoom)>1e-6;this.zoom=s,this.panX=r,this.panY=n,i&&this.viewport.w>0&&this.sendViewport(),this.savePersist()}resetView(){this.setZoom(1,0,0)}sceneStart(e){const r=this.scenes.find(n=>n.name===e);return r?r.start/this.fps:0}sceneAt(e){return[...this.scenes].reverse().find(r=>r.start<=e)??this.scenes[0]}markerFrame(e){return Math.round((this.sceneStart(e.scene)+e.time)*this.fps)}moveMarker(e,r,n){const s=Math.max(0,n/this.fps-this.sceneStart(e));this.send({type:"SetMarker",name:r,time:Number(s.toFixed(6)),scene:e})}markerAtPlayhead(){const e=this.sceneAt(this.frame);if(!e)return;if(this.selectedMarker){this.moveMarker(this.selectedMarker.scene,this.selectedMarker.name,this.frame);return}const r=new Set(this.markers.filter(i=>i.scene===e.name).map(i=>i.name));let n=1;for(;r.has(`marker-${n}`);)n+=1;const s=`marker-${n}`;this.moveMarker(e.name,s,this.frame),this.selectedMarker={scene:e.name,name:s}}setEase(e,r){this.send({type:"SetEase",name:e,value:r})}setTunable(e,r){this.send({type:"SetTunable",name:e,value:r})}pick(e,r){this.send({type:"Pick",x:e,y:r})}select(e){this.selected=e,this.send({type:"Select",node_id:e})}dismissError(){this.error=null}savePersist(){this.persistEnabled&&aa({frame:this.frame,zoom:this.zoom,panX:this.panX,panY:this.panY,selected:this.selected})}}function Wr(t,e){const r=t/Math.max(1,e),n=Math.floor(r/60),s=Math.floor(r%60),i=t%Math.max(1,e);return`${n}:${String(s).padStart(2,"0")}.${String(i).padStart(2,"0")}`}var la=se('<div class="scene svelte-112n2zp"><span> </span></div>'),ua=se('<button><span class="flag svelte-112n2zp"> </span></button>'),ca=se('<section class="timeline svelte-112n2zp"><div class="transport svelte-112n2zp"><button>⏮</button> <button>◀︎</button> <button class="play svelte-112n2zp" data-testid="play"> </button> <button>▶︎</button> <button>⏭</button> <span class="time svelte-112n2zp" data-testid="time"> </span> <span class="frame svelte-112n2zp" data-testid="frame"> </span> <span class="spacer svelte-112n2zp"></span> <button>+ M</button></div> <div class="track svelte-112n2zp" role="slider" tabindex="0" data-testid="track"><div class="scenes svelte-112n2zp"></div> <canvas class="wave svelte-112n2zp" aria-hidden="true"></canvas> <!> <div class="playhead svelte-112n2zp" aria-hidden="true"></div></div></section>');function fa(t,e){Ze(e,!0);let r=Xe(e,"editor",7),n,s,i=N(0);const a=ve(()=>Math.max(1,r().frames)),l=g=>g/Math.max(1,u(a)-1)*u(i),o=g=>{const S=n.getBoundingClientRect(),U=Math.min(1,Math.max(0,(g-S.left)/Math.max(1,S.width)));return Math.round(U*(u(a)-1))};let c=!1,d=null;function v(g){d=g,requestAnimationFrame(()=>{d!==null&&r().seek(d),d=null})}function p(g){g.target.dataset.marker||(c=!0,n.setPointerCapture(g.pointerId),r().playing&&r().pause(),v(o(g.clientX)))}function h(g){c&&v(o(g.clientX))}function m(){c=!1}let E=N(null);const f=g=>u(E)&&u(E).m.name===g.name&&u(E).m.scene===g.scene?u(E).frame:r().markerFrame(g);function _(g,S){g.stopPropagation(),g.target.setPointerCapture(g.pointerId),r().selectedMarker={scene:S.scene,name:S.name},z(E,{m:S,frame:r().markerFrame(S)},!0)}function y(g){u(E)&&z(E,{...u(E),frame:o(g.clientX)},!0)}function C(){if(!u(E))return;const{m:g,frame:S}=u(E);z(E,null),S!==r().markerFrame(g)&&r().moveMarker(g.scene,g.name,S)}function w(g,S){const U=g.key==="ArrowLeft"?-1:g.key==="ArrowRight"?1:0;U?(g.preventDefault(),r().moveMarker(S.scene,S.name,r().markerFrame(S)+U*(g.shiftKey?10:1))):g.key==="Enter"&&r().seek(r().markerFrame(S))}Kt(()=>{const g=r().waveform,S=s?.getContext("2d");if(!S)return;const U=devicePixelRatio||1,A=28;if(s.width=Math.max(1,Math.round(u(i)*U)),s.height=Math.round(A*U),S.setTransform(U,0,0,U,0,0),S.clearRect(0,0,u(i),A),!g||g.length===0)return;S.fillStyle=getComputedStyle(s).getPropertyValue("--m-wave")||"#4b5563";const M=g.length;for(let q=0;q<u(i);q++){const J=g[Math.min(M-1,Math.floor(q/u(i)*M))]??0,G=Math.max(1,J*A);S.fillRect(q,(A-G)/2,1,G)}});var O=ca(),I=W(O),Y=W(I),ne=k(Y,2),P=k(ne,2),D=j(P,!0),$=k(P,2),ue=k($,2),Fe=k(ue,2),Ce=j(Fe,!0),$e=k(Fe,2),je=j($e),Be=k($e,4),de=k(I,2);b(de,"aria-valuemin",0);var x=W(de);Ve(x,21,()=>r().scenes,g=>g.name,(g,S)=>{var U=la();let A;var M=W(U),q=j(M,!0);re((J,G)=>{b(U,"title",u(S).name),A=ct(U,"",A,{left:J,width:G}),V(q,u(S).name)},[()=>`${l(u(S).start)??""}px`,()=>`${Math.max(0,l(u(S).start+u(S).frames-1)-l(u(S).start))}px`]),Q(g,U)});var T=k(x,2);let R;gt(T,g=>s=g,()=>s);var L=k(T,2);Ve(L,17,()=>r().markers,g=>g.scene+"/"+g.name,(g,S)=>{const U=ve(()=>f(u(S))),A=ve(()=>r().selectedMarker?.name===u(S).name&&r().selectedMarker?.scene===u(S).scene);var M=ua();let q,J;var G=W(M),te=j(G,!0);re((ce,Qe,kt)=>{q=Gt(M,1,"marker svelte-112n2zp",null,q,{selected:u(A)}),b(M,"data-marker",u(S).name),b(M,"data-testid",`marker-${u(S).name??""}`),b(M,"aria-label",ce),b(M,"title",`${u(S).name??""} · ${Qe??""} s`),J=ct(M,"",J,{left:kt}),V(te,u(S).name)},[()=>F("timeline.marker",{name:u(S).name,time:(u(U)/r().fps).toFixed(2)}),()=>(u(U)/r().fps).toFixed(2),()=>`${l(u(U))??""}px`]),H("pointerdown",M,ce=>_(ce,u(S))),H("pointermove",M,y),H("pointerup",M,C),H("keydown",M,ce=>w(ce,u(S))),Ir("focus",M,()=>r().selectedMarker={scene:u(S).scene,name:u(S).name}),Q(g,M)});var ee=k(L,2);let Z;gt(de,g=>n=g,()=>n),re((g,S,U,A,M,q,J,G,te,ce,Qe,kt,Jt,$t,Qt,er)=>{b(O,"aria-label",g),b(Y,"title",S),b(Y,"aria-label",U),b(ne,"title",A),b(ne,"aria-label",M),b(P,"title",q),b(P,"aria-label",J),V(D,r().playing?"❚❚":"▶"),b($,"title",G),b($,"aria-label",te),b(ue,"title",ce),b(ue,"aria-label",Qe),V(Ce,kt),V(je,`${r().frame??""} / ${r().lastFrame??""}`),b(Be,"title",Jt),b(de,"aria-label",$t),b(de,"aria-valuemax",r().lastFrame),b(de,"aria-valuenow",r().frame),b(de,"aria-valuetext",Qt),R=ct(T,"",R,{width:`${u(i)??""}px`}),Z=ct(ee,"",Z,{left:er})},[()=>F("timeline.label"),()=>F("transport.start"),()=>F("transport.start"),()=>F("transport.prev"),()=>F("transport.prev"),()=>r().playing?F("transport.pause"):F("transport.play"),()=>r().playing?F("transport.pause"):F("transport.play"),()=>F("transport.next"),()=>F("transport.next"),()=>F("transport.end"),()=>F("transport.end"),()=>Wr(r().frame,r().fps),()=>F("timeline.addMarker"),()=>F("timeline.label"),()=>Wr(r().frame,r().fps),()=>`${l(r().frame)??""}px`]),H("click",Y,()=>r().seek(0)),H("click",ne,()=>r().step(-1)),H("click",P,()=>r().togglePlay()),H("click",$,()=>r().step(1)),H("click",ue,()=>r().seek(r().lastFrame)),H("click",Be,()=>r().markerAtPlayhead()),H("pointerdown",de,p),H("pointermove",de,h),H("pointerup",de,m),qi(de,"clientWidth",g=>z(i,g)),Q(t,O),Je()}yt(["click","pointerdown","pointermove","pointerup","keydown"]);var ha=se('<span class="name"> </span>'),da=se('<li role="treeitem"><button><span class="kind svelte-gu3dqx"> </span> <!> <span class="id svelte-gu3dqx"> </span></button></li>'),or=se('<p class="dim svelte-gu3dqx"> </p>'),va=se('<span class="swatch svelte-gu3dqx"></span>'),pa=se('<tr><th scope="row" class="svelte-gu3dqx"> </th><td class="svelte-gu3dqx"><!> </td></tr>'),ma=se('<table data-testid="signals" class="svelte-gu3dqx"><tbody></tbody></table>'),_a=se('<label class="tunable svelte-gu3dqx"><span class="svelte-gu3dqx"> </span> <input type="range"/> <input type="number"/></label>'),ga=se('<button class="ease svelte-gu3dqx"><svg viewBox="-2 -2 28 28" width="28" height="28" aria-hidden="true" class="svelte-gu3dqx"><path fill="none" stroke="currentColor" stroke-width="2"></path></svg> <span> </span> <code class="svelte-gu3dqx"> </code></button>'),ba=se('<aside class="inspector svelte-gu3dqx"><section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <ul class="tree svelte-gu3dqx" role="tree" data-testid="tree"></ul></section> <section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <!></section> <section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <!> <!></section> <section class="svelte-gu3dqx"><h2 class="svelte-gu3dqx"> </h2> <!> <!></section></aside>');function wa(t,e){Ze(e,!0);let r=Xe(e,"editor",7);const n=ve(()=>{const x=new Map(r().tree.map(R=>[R.id,R])),T=R=>{let L=0,ee=R.parent;for(;ee!=null&&L<64;)L+=1,ee=x.get(ee)?.parent??null;return L};return r().tree.map(R=>({n:R,depth:T(R)}))}),s=ve(()=>Object.entries(r().metas).flatMap(([x,T])=>Object.entries(T.tunables??{}).map(([R,L])=>({scene:x,name:R,value:L})))),i=ve(()=>Object.entries(r().metas).flatMap(([x,T])=>Object.entries(T.eases??{}).map(([R,L])=>({scene:x,name:R,value:L}))));function a(x){const T=x===0?10:Math.abs(x)*2,R=x>=0?0:x-T,L=x>=0?Math.max(x*2,1):x+T;return[R,L,(L-R)/200]}const l=new Map;function o(x,T){clearTimeout(l.get(x)),l.set(x,setTimeout(()=>r().setTunable(x,T),60))}const c=new Map;function d(x,T){return c.has(x)||c.set(x,a(T)),c.get(x)}function v(x){const[T=0,R=0,L=1,ee=1]=x,Z=24;return`M0 ${Z} C${T*Z} ${Z-R*Z} ${L*Z} ${Z-ee*Z} ${Z} 0`}var p=ba(),h=W(p),m=W(h),E=j(m,!0),f=k(m,2);Ve(f,21,()=>u(n),({n:x,depth:T})=>x.id,(x,T)=>{let R=()=>u(T).n,L=()=>u(T).depth;var ee=da(),Z=W(ee);let g,S;var U=W(Z),A=j(U,!0),M=k(U,2);{var q=te=>{var ce=ha(),Qe=j(ce,!0);re(()=>V(Qe,R().name)),Q(te,ce)};ye(M,te=>{R().name&&te(q)})}var J=k(M,2),G=j(J);re(()=>{b(ee,"aria-selected",r().selected===R().id),g=Gt(Z,1,"node svelte-gu3dqx",null,g,{sel:r().selected===R().id}),S=ct(Z,"",S,{"padding-left":`${8+L()*12}px`}),V(A,R().kind),V(G,`#${R().id??""}`)}),H("click",Z,()=>r().select(R().id===r().selected?null:R().id)),Q(x,ee)});var _=k(h,2),y=W(_),C=j(y,!0),w=k(y,2);{var O=x=>{var T=or(),R=j(T,!0);re(L=>V(R,L),[()=>F("inspector.noSelection")]),Q(x,T)},I=x=>{var T=ma(),R=W(T);Ve(R,21,()=>r().signals,L=>L.name,(L,ee)=>{var Z=pa(),g=W(Z),S=j(g,!0),U=k(g),A=W(U);{var M=G=>{var te=va();let ce;re(()=>ce=ct(te,"",ce,{background:u(ee).value})),Q(G,te)},q=ve(()=>/^#[0-9a-f]{8}$/i.test(u(ee).value));ye(A,G=>{u(q)&&G(M)})}var J=k(A);re(()=>{V(S,u(ee).name),V(J,` ${u(ee).value??""}`)}),Q(L,Z)}),Q(x,T)};ye(w,x=>{r().selected===null?x(O):x(I,-1)})}var Y=k(_,2),ne=W(Y),P=j(ne,!0),D=k(ne,2);{var $=x=>{var T=or(),R=j(T,!0);re(L=>V(R,L),[()=>F("inspector.none")]),Q(x,T)};ye(D,x=>{u(s).length===0&&x($)})}var ue=k(D,2);Ve(ue,17,()=>u(s),x=>x.scene+x.name,(x,T)=>{const R=ve(()=>{const[U,A,M]=d(u(T).name,u(T).value);return{min:U,max:A,step:M}});var L=_a(),ee=W(L),Z=j(ee,!0),g=k(ee,2),S=k(g,2);re(()=>{V(Z,u(T).name),b(g,"min",u(R).min),b(g,"max",u(R).max),b(g,"step",u(R).step),Hr(g,u(T).value),b(g,"data-testid",`tunable-${u(T).name??""}`),b(S,"step",u(R).step),Hr(S,u(T).value),b(S,"aria-label",`${u(T).name??""} value`)}),H("input",g,U=>o(u(T).name,+U.currentTarget.value)),H("change",S,U=>r().setTunable(u(T).name,+U.currentTarget.value)),Q(x,L)});var Fe=k(Y,2),Ce=W(Fe),$e=j(Ce,!0),je=k(Ce,2);{var Be=x=>{var T=or(),R=j(T,!0);re(L=>V(R,L),[()=>F("inspector.none")]),Q(x,T)};ye(je,x=>{u(i).length===0&&x(Be)})}var de=k(je,2);Ve(de,17,()=>u(i),x=>x.scene+x.name,(x,T)=>{var R=ga(),L=W(R),ee=j(L),Z=k(L,2),g=j(Z,!0),S=k(Z,2),U=j(S,!0);re((A,M)=>{b(R,"data-testid",`ease-${u(T).name??""}`),b(ee,"d",A),V(g,u(T).name),V(U,M)},[()=>v(u(T).value),()=>u(T).value.map(A=>A.toFixed(2)).join(", ")]),H("click",R,()=>r().editingEase={scene:u(T).scene,name:u(T).name}),Q(x,R)}),re((x,T,R,L)=>{V(E,x),V(C,T),V(P,R),V($e,L)},[()=>F("inspector.tree"),()=>F("inspector.signals"),()=>F("inspector.tunables"),()=>F("inspector.eases")]),Q(t,p),Je()}yt(["click","input","change"]);var ya=se('<span class="dim svelte-1qw5yfa"> </span>'),ka=se("<li><code> </code> </li>"),xa=se('<ul class="svelte-1qw5yfa"></ul>'),Ma=se('<div class="overlay svelte-1qw5yfa" role="alert" data-testid="error-overlay"><header class="svelte-1qw5yfa"><strong class="svelte-1qw5yfa"> </strong> <!> <button class="svelte-1qw5yfa"> </button></header> <!> <pre class="svelte-1qw5yfa"> </pre></div>');function Ea(t,e){Ze(e,!0);const r=ve(()=>e.editor.error),n=ve(()=>u(r).kind==="Build"?F("error.build"):u(r).kind==="Incompatible"?F("error.incompatible"):u(r).kind==="Meta"?F("error.meta"):F("error.runtime"));var s=Ma(),i=W(s),a=W(i),l=j(a,!0),o=k(a,2);{var c=f=>{var _=ya(),y=j(_,!0);re(C=>V(y,C),[()=>F("error.previous")]),Q(f,_)};ye(o,f=>{u(r).kind==="Build"&&f(c)})}var d=k(o,2),v=j(d,!0),p=k(i,2);{var h=f=>{var _=xa();Ve(_,21,()=>u(r).spans,Ei,(y,C)=>{var w=ka(),O=W(w),I=j(O),Y=k(O);re(()=>{V(I,`${u(C).file??""}:${u(C).line??""}:${u(C).column??""}`),V(Y,` ${u(C).message??""}`)}),Q(y,w)}),Q(f,_)};ye(p,f=>{u(r).spans.length&&f(h)})}var m=k(p,2),E=j(m,!0);re(f=>{V(l,u(n)),V(v,f),V(E,u(r).message)},[()=>F("error.dismiss")]),H("click",d,()=>e.editor.dismissError()),Q(t,s),Je()}yt(["click"]);function Sa(t,e,r,n){const s=3*t,i=3*(r-t)-s,a=1-s-i,l=3*e,o=3*(n-e)-l,c=1-l-o,d=h=>((a*h+i)*h+s)*h,v=h=>((c*h+o)*h+l)*h,p=h=>(3*a*h+2*i)*h+s;return h=>{if(h<=0)return 0;if(h>=1)return 1;let m=h;for(let _=0;_<8;_++){const y=d(m)-h;if(Math.abs(y)<1e-7)return v(m);const C=p(m);if(Math.abs(C)<1e-6)break;m=Math.min(1,Math.max(0,m-y/C))}let E=0,f=1;m=h;for(let _=0;_<40;_++){const y=d(m);if(Math.abs(y-h)<1e-7)break;y<h?E=m:f=m,m=(E+f)/2}return v(m)}}const Kr={linear:[0,0,1,1],ease:[.25,.1,.25,1],"in-out-cubic":[.65,0,.35,1],"in-cubic":[.32,0,.67,0],"out-cubic":[.33,1,.68,1],"in-out-sine":[.37,0,.63,1],"in-out-expo":[.87,0,.13,1],"out-back":[.34,1.56,.64,1],"in-out-back":[.68,-.6,.32,1.6]};var Ta=mi('<circle r="8" class="handle svelte-12hhbkq" tabindex="0" role="slider"></circle>'),Aa=se("<option> </option>"),Pa=se('<div class="backdrop svelte-12hhbkq" role="presentation"></div> <div class="dialog svelte-12hhbkq" role="dialog" aria-modal="true" data-testid="curve-editor"><header class="svelte-12hhbkq"><strong> </strong> <button> </button></header> <svg role="group" class="svelte-12hhbkq"><rect class="unit svelte-12hhbkq"></rect><line class="arm svelte-12hhbkq"></line><line class="arm svelte-12hhbkq"></line><path class="curve svelte-12hhbkq"></path><circle r="4" class="fixed svelte-12hhbkq"></circle><circle r="4" class="fixed svelte-12hhbkq"></circle><!><circle r="5" class="dot svelte-12hhbkq"></circle></svg> <div class="row svelte-12hhbkq"><label> <select><option>—</option><!></select></label> <code class="svelte-12hhbkq"> </code></div></div>',1);function Ra(t,e){Ze(e,!0);let r=Xe(e,"editor",7);const n=ve(()=>r().editingEase),s=ve(()=>r().metas[u(n).scene]?.eases?.[u(n).name]??[.65,0,.35,1]);let i=ve(()=>[u(s)[0]??0,u(s)[1]??0,u(s)[2]??1,u(s)[3]??1]);const a=240,l=20,o=A=>l+A*a,c=A=>l+(1.5-A)*(a/2),d=(A,M)=>[Math.min(1,Math.max(0,(A-l)/a)),Math.min(1.5,Math.max(-.5,1.5-(M-l)/(a/2)))];let v,p=null,h;function m(){clearTimeout(h),h=setTimeout(()=>r().setEase(u(n).name,[...u(i)]),80)}function E(A){if(p===null)return;const M=v.getBoundingClientRect(),q=(l*2+a)/M.width,[J,G]=d((A.clientX-M.left)*q,(A.clientY-M.top)*q),te=[...u(i)];te[p*2]=Number(J.toFixed(3)),te[p*2+1]=Number(G.toFixed(3)),z(i,te),m()}function f(A,M){const q=A.shiftKey?.1:.01,G={ArrowLeft:[-q,0],ArrowRight:[q,0],ArrowUp:[0,q],ArrowDown:[0,-q]}[A.key];if(!G)return;A.preventDefault();const te=[...u(i)];te[M*2]=Math.min(1,Math.max(0,te[M*2]+G[0])),te[M*2+1]=Math.min(1.5,Math.max(-.5,te[M*2+1]+G[1])),z(i,te),m()}const _=ve(()=>`M${o(0)} ${c(0)} C${o(u(i)[0])} ${c(u(i)[1])} ${o(u(i)[2])} ${c(u(i)[3])} ${o(1)} ${c(1)}`);let y=N(0);Zt(()=>{let A=0;const M=performance.now(),q=J=>{const G=(J-M)/1400%1.4;z(y,Sa(...u(i))(Math.min(1,G)),!0),A=requestAnimationFrame(q)};return A=requestAnimationFrame(q),()=>cancelAnimationFrame(A)});var C=Pa(),w=$s(C),O=k(w,2),I=W(O),Y=W(I),ne=j(Y,!0),P=k(Y,2),D=j(P,!0),$=k(I,2);b($,"viewBox","0 0 280 280");var ue=W($);b(ue,"width",a),b(ue,"height",a/2);var Fe=k(ue),Ce=k(Fe),$e=k(Ce),je=k($e),Be=k(je),de=k(Be);Ve(de,16,()=>[0,1],A=>A,(A,M)=>{var q=Ta();re((J,G,te,ce)=>{b(q,"cx",J),b(q,"cy",G),b(q,"aria-label",`control point ${M+1}`),b(q,"aria-valuetext",`${te??""}, ${ce??""}`),b(q,"aria-valuenow",u(i)[M*2+1]),b(q,"data-testid",`handle-${M??""}`)},[()=>o(u(i)[M*2]),()=>c(u(i)[M*2+1]),()=>u(i)[M*2].toFixed(2),()=>u(i)[M*2+1].toFixed(2)]),H("pointerdown",q,J=>{p=M,v.setPointerCapture(J.pointerId)}),H("keydown",q,J=>f(J,M)),Q(A,q)});var x=k(de);b(x,"cy",a+l*2-6),gt($,A=>v=A,()=>v);var T=k($,2),R=W(T),L=W(R),ee=k(L),Z=W(ee);Z.value=Z.__value="";var g=k(Z);Ve(g,16,()=>Object.keys(Kr),A=>A,(A,M)=>{var q=Aa(),J=j(q,!0),G={};re(()=>{V(J,M),G!==(G=M)&&(q.value=(q.__value=G)??"")}),Q(A,q)});var S=k(R,2),U=j(S);re((A,M,q,J,G,te,ce,Qe,kt,Jt,$t,Qt,er,Zn,Jn,$n,Qn,es,ts,rs)=>{b(O,"aria-label",A),V(ne,M),V(D,q),b(ue,"x",J),b(ue,"y",G),b(Fe,"x1",te),b(Fe,"y1",ce),b(Fe,"x2",Qe),b(Fe,"y2",kt),b(Ce,"x1",Jt),b(Ce,"y1",$t),b(Ce,"x2",Qt),b(Ce,"y2",er),b($e,"d",u(_)),b(je,"cx",Zn),b(je,"cy",Jn),b(Be,"cx",$n),b(Be,"cy",Qn),b(x,"cx",es),V(L,`${ts??""} `),V(U,`[${rs??""}]`)},[()=>F("curve.title",{name:u(n).name}),()=>F("curve.title",{name:u(n).name}),()=>F("curve.close"),()=>o(0),()=>c(1),()=>o(0),()=>c(0),()=>o(u(i)[0]),()=>c(u(i)[1]),()=>o(1),()=>c(1),()=>o(u(i)[2]),()=>c(u(i)[3]),()=>o(0),()=>c(0),()=>o(1),()=>c(1),()=>o(u(y)),()=>F("curve.presets"),()=>u(i).map(A=>A.toFixed(2)).join(", ")]),H("click",w,()=>r().editingEase=null),H("click",P,()=>r().editingEase=null),H("pointermove",$,E),H("pointerup",$,()=>p=null),H("change",ee,A=>{const M=Kr[A.currentTarget.value];M&&(z(i,[...M]),m())}),Q(t,C),Je()}yt(["click","pointermove","pointerup","pointerdown","keydown","change"]);var Fa=se('<div data-testid="editor" tabindex="-1"><!> <main class="svelte-1ctqrjb"><section class="stage svelte-1ctqrjb"><!> <!></section> <!></main> <!> <!></div>');function Ca(t,e){Ze(e,!0);let r=Xe(e,"editor",7),n=Xe(e,"autostart",3,!0),s=Xe(e,"compact",3,!1),i=Xe(e,"scopedKeys",3,!1),a;function l(){try{const P=localStorage.getItem("oxframe-theme");if(P==="dark"||P==="light")return P}catch{}return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}let o=N(me(ot(()=>e.theme)??l()));function c(){z(o,u(o)==="dark"?"light":"dark",!0);try{localStorage.setItem("oxframe-theme",u(o))}catch{}}Zt(()=>{n()&&r().start()}),Di(()=>{n()&&r().stop()});function d(P){const D=P.target;if(i()&&!a?.contains(document.activeElement)||D&&(D.closest("input, textarea, select, [contenteditable]")||D.isContentEditable)||D?.dataset.marker&&(P.key==="ArrowLeft"||P.key==="ArrowRight"))return;const $=P.shiftKey?10:1;switch(P.key){case" ":r().togglePlay();break;case"ArrowLeft":r().step(-$);break;case"ArrowRight":r().step($);break;case"Home":r().seek(0);break;case"End":r().seek(r().lastFrame);break;case"m":case"M":r().markerAtPlayhead();break;case"Escape":r().editingEase?r().editingEase=null:r().error?r().dismissError():r().selectedMarker=null;break;default:return}P.preventDefault()}var v=Fa();Ir("keydown",pr,d);let p;var h=W(v);{var m=P=>{Qi(P,{get editor(){return r()},get theme(){return u(o)},onToggleTheme:c})};ye(h,P=>{s()||P(m)})}var E=k(h,2),f=W(E),_=W(f);ra(_,{get editor(){return r()}});var y=k(_,2);{var C=P=>{Ea(P,{get editor(){return r()}})};ye(y,P=>{r().error&&P(C)})}var w=k(f,2);{var O=P=>{wa(P,{get editor(){return r()}})};ye(w,P=>{s()||P(O)})}var I=k(E,2);fa(I,{get editor(){return r()}});var Y=k(I,2);{var ne=P=>{Ra(P,{get editor(){return r()}})};ye(Y,P=>{r().editingEase&&P(ne)})}gt(v,P=>a=P,()=>a),re(P=>{p=Gt(v,1,"oxframe-editor svelte-1ctqrjb",null,p,{compact:s()}),b(v,"data-theme",u(o)),b(f,"aria-label",P)},[()=>F("viewport.label")]),Q(t,v),Je()}const Xn=new URLSearchParams(location.search),Wn=window.__OXFRAME_CONFIG__??{},Oa=Xn.get("backend")??Wn.backend??"ws",Kn=Oa==="mock"?new Xi:new Hi({url:Wn.url??"/ws",token:Xn.get("token")??void 0}),Gn=new oa(Kn,{uiVersion:"0.1.1"});window.__oxframe={editor:Gn,backend:Kn};yi(Ca,{target:document.getElementById("app"),props:{editor:Gn}});