From 34c62b78cc61447ae5bb86e4f4e89a15ff24ae17 Mon Sep 17 00:00:00 2001 From: teamchong <25894545+teamchong@users.noreply.github.com> Date: Sun, 24 May 2026 20:45:52 -0400 Subject: [PATCH] fix(dashboard): baseline-% denominator + multi-image thumb strip SessionSummary: divide saved_$ by baseline_input_$ (was actual_input + output, which produced 719% on cheap sessions). Math now matches the user-stated analogy: baseline=10, actual=5 -> saved=5, 50%. RecentRequests: stamp full imagePngs[] in TransformInfo so each rendered PNG gets a ring-buffer id. Row shows a strip of 28px thumbs (one per image) instead of a single 'view' button, so multi-image requests are visible at a glance. Thumbs are '),Ol=z('-'),Il=z(' '),Dl=z('no requests yet'),Ml=z('
#statuspathcccrbaselineactualsavedimg
'),Ll={hash:"svelte-hn7ohq",code:\`table.svelte-hn7ohq {width:100%;border-collapse:collapse;font-size:12px;}th.svelte-hn7ohq {text-align:left;color:#6e7681;font-weight:500;padding:6px 8px;border-bottom:1px solid #30363d;}td.svelte-hn7ohq {padding:6px 8px;border-bottom:1px solid #21262d;font-variant-numeric:tabular-nums;}tr.svelte-hn7ohq:last-child td:where(.svelte-hn7ohq) {border-bottom:none;}th.num.svelte-hn7ohq, - td.num.svelte-hn7ohq {text-align:right;}.small.svelte-hn7ohq {font-size:11px;color:#6e7681;}td.good.svelte-hn7ohq {color:#3fb950;}td.warn.svelte-hn7ohq {color:#d29922;}td.bad.svelte-hn7ohq {color:#f85149;}td.pos.svelte-hn7ohq {color:#3fb950;}.muted.svelte-hn7ohq {color:#6e7681;}.view-btn.svelte-hn7ohq {font-size:11px;background:#21262d;color:#58a6ff;border:1px solid #30363d;border-radius:4px;padding:1px 6px;cursor:pointer;}.view-btn.svelte-hn7ohq:hover {background:#30363d;}\`};function Yo(e,t){le(t,!1),Re(e,Ll);let r=()=>he(pr,"$recent",n),[n,i]=Ae(),o=D();function s(p){return p>=500?"bad":p>=400?"warn":"good"}function a(p){if(!p)return"-";let d=p.split("/");return d[d.length-1]||p}P(()=>r(),()=>{S(o,r().data?.recent??[])}),Ve(),Ce();var f=Ml(),c=w(b(f));ur(c,7,()=>(l(o),$(()=>l(o).slice().reverse())),(p,d)=>p.ts+":"+d,(p,d,u)=>{var _=Il(),v=b(_),x=b(v,!0);g(v);var h=w(v),A=b(h,!0);g(h);var B=w(h),L=b(B,!0);g(B);var j=w(B),k=b(j,!0);g(j);var y=w(j),N=b(y,!0);g(y);var Y=w(y),X=b(Y,!0);g(Y);var ee=w(Y),H=b(ee,!0);g(ee);var re=w(ee),V=b(re,!0);g(re);var ye=w(re),Ge=b(ye);{var Zt=ze=>{var Ue=Cl();Bt("click",Ue,()=>tn.set(l(d).img_id??null)),M(ze,Ue)},St=ze=>{var Ue=Ol();M(ze,Ue)};Ne(Ge,ze=>{l(d),$(()=>l(d).img_id!=null)?ze(Zt):ze(St,-1)})}g(ye),g(_),K((ze,Ue,zt,_r,At,gt)=>{O(x,l(u)+1),Kt(h,1,\`num \${ze??""}\`,"svelte-hn7ohq"),O(A,(l(d),$(()=>l(d).status))),O(L,Ue),O(k,(l(d),$(()=>l(d).cc_added?"\\u2713":"-"))),O(N,zt),O(X,_r),O(H,At),O(V,gt)},[()=>(l(d),$(()=>s(l(d).status))),()=>(l(d),$(()=>a(l(d).path))),()=>(l(d),Q(F),$(()=>l(d).cache_read!=null?F(l(d).cache_read):"-")),()=>(l(d),Q(F),$(()=>l(d).baseline_input!=null?F(l(d).baseline_input):"-")),()=>(l(d),Q(F),$(()=>l(d).actual_input!=null?F(l(d).actual_input):"-")),()=>(l(d),Q(F),$(()=>(l(d).session_saved_so_far_delta??0)>0?"+"+F(l(d).session_saved_so_far_delta??0):"-"))]),M(p,_)},p=>{var d=Dl();M(p,d)}),g(c),g(f),M(e,f),fe(),i()}var Fl=z('
'),Pl=z('
'),Bl=z('
',1),ql=z('
latest rendered
'),zl=z('
(none yet)
'),Yl=z('
',1),Hl={hash:"svelte-3whs73",code:\`.wrap.svelte-3whs73 {margin-top:0;} +\`)}}}function qi(e){let t=ro.get(e);t&&(_e(e,"message",{value:t.message}),_e(e,"stack",{value:t.stack}))}var ba=-7169;function V(e,t){e.f=e.f&ba|t}function yr(e){(e.f&512)!==0||e.deps===null?V(e,1024):V(e,4096)}function Bi(e){if(e!==null)for(let t of e)(t.f&2)===0||(t.f&65536)===0||(t.f^=65536,Bi(t.deps))}function bn(e,t,r){(e.f&2048)!==0?t.add(e):(e.f&4096)!==0&&r.add(e),Bi(e.deps),V(e,1024)}function $n(e,t,r){if(e==null)return t(void 0),r&&r(void 0),Oe;let n=x(()=>e.subscribe(t,r));return n.unsubscribe?()=>n.unsubscribe():n}var wr=[];function no(e,t){return{subscribe:Er(e,t).subscribe}}function Er(e,t=Oe){let r=null,n=new Set;function o(a){if(pn(e,a)&&(e=a,r)){let f=!wr.length;for(let u of n)u[1](),wr.push(u,e);if(f){for(let u=0;u{n.delete(u),n.size===0&&r&&(r(),r=null)}}return{set:o,update:i,subscribe:s}}function xn(e){let t;return $n(e,r=>t=r)(),t}var zi=!1;var oo=Symbol();function he(e,t,r){let n=r[t]??={store:null,source:M(void 0),unsubscribe:Oe};if(m&&(n.source.label=t),n.store!==e&&!(oo in r))if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=Oe;else{var o=!0;n.unsubscribe=$n(e,i=>{o?n.source.v=i:A(n.source,i)}),o=!1}return e&&oo in r?xn(e):l(n.source)}function Ae(){let e={};function t(){ge(()=>{for(var r in e)e[r].unsubscribe();_e(e,oo,{enumerable:!1,value:!0})})}return[e,t]}var yn=null,kr=null,R=null,Sr=null,be=null,ao=null,ar=!1,io=!1,lr=null,Vr=null,Yi=0,so=new Set,xa=1,Xe=class e{id=xa++;#e=!1;linked=!0;#t=null;#r=null;async_deriveds=new Map;current=new Map;previous=new Map;unblocked=new Set;#l=new Set;#n=new Set;#i=new Set;#o=0;#s=new Map;#d=null;#a=[];#_=[];#p=new Set;#c=new Set;#u=new Map;#f=new Set;is_fork=!1;#h=!1;#x(){if(this.is_fork)return!0;for(let n of this.#s.keys()){for(var t=n,r=!1;t.parent!==null;){if(this.#u.has(t)){r=!0;break}t=t.parent}if(!r)return!0}return!1}skip_effect(t){this.#u.has(t)||this.#u.set(t,{d:[],m:[]}),this.#f.delete(t)}unskip_effect(t,r=n=>this.schedule(n)){var n=this.#u.get(t);if(n){this.#u.delete(t);for(var o of n.d)V(o,2048),r(o);for(o of n.m)V(o,4096),r(o)}this.#f.add(t)}#v(){if(this.#e=!0,Yi++>1e3&&(this.#$(),ya()),m)for(let f of this.current.keys())so.add(f);if(!this.#x()){for(let f of this.#p)this.#c.delete(f),V(f,2048),this.schedule(f);for(let f of this.#c)V(f,4096),this.schedule(f)}let t=this.#a;this.#a=[],this.apply();var r=lr=[],n=[],o=Vr=[];for(let f of t)try{this.#y(f,r,n)}catch(u){throw ji(f),u}if(R=null,o.length>0){var i=e.ensure();for(let f of o)i.schedule(f)}if(lr=null,Vr=null,this.#x()){this.#m(n),this.#m(r);for(let[f,u]of this.#u)Ui(f,u);o.length>0&&R.#v();return}let s=this.#w();if(s){s.#g(this);return}this.#p.clear(),this.#c.clear();for(let f of this.#l)f(this);this.#l.clear(),Sr=this,Hi(n),Hi(r),Sr=null,this.#d?.resolve();var a=R;if(this.linked&&this.#o===0&&this.#$(),me&&!this.linked&&(this.#E(),R=a),this.#a.length>0){a===null&&(a=this,this.#b());let f=a;f.#a.push(...this.#a.filter(u=>!f.#a.includes(u)))}a!==null&&a.#v()}#y(t,r,n){t.f^=1024;for(var o=t.first;o!==null;){var i=o.f,s=(i&96)!==0,a=s&&(i&1024)!==0,f=a||(i&8192)!==0||this.#u.has(o);if(!f&&o.fn!==null){s?o.f^=1024:(i&4)!==0?r.push(o):me&&(i&16777224)!==0?n.push(o):Pt(o)&&((i&16)!==0&&this.#c.add(o),gt(o));var u=o.first;if(u!==null){o=u;continue}}for(;o!==null;){var p=o.next;if(p!==null){o=p;break}o=o.parent}}}#w(){for(var t=this.#t;t!==null;){if(!t.is_fork){for(let[r,[,n]]of this.current)if(t.current.has(r)&&!n)return t}t=t.#t}return null}#g(t){for(let[n,o]of t.current)!this.previous.has(n)&&t.previous.has(n)&&this.previous.set(n,t.previous.get(n)),this.current.set(n,o);for(let[n,o]of t.async_deriveds){let i=this.async_deriveds.get(n);i&&o.promise.then(i.resolve)}let r=n=>{var o=n.reactions;if(o!==null)for(let a of o){var i=a.f;if((i&2)!==0)r(a);else{var s=a;i&4194320&&!this.async_deriveds.has(s)&&(this.#c.delete(s),V(s,2048),this.schedule(s))}}};for(let n of this.current.keys())r(n);this.oncommit(()=>t.discard()),t.#$(),R=this,this.#v()}#m(t){for(var r=0;r!this.current.has(c));if(o.length===0)t&&p.discard();else if(r.length>0){if(m&&Mi(p.#a.length===0,"Batch has scheduled roots"),t)for(let c of this.#f)p.unskip_effect(c,d=>{(d.f&4194320)!==0?p.schedule(d):p.#m([d])});p.activate();var i=new Set,s=new Map;for(var a of r)Vi(a,o,i,s);s=new Map;var f=[...p.current.keys()].filter(c=>this.current.has(c)?this.current.get(c)[0]!==c.v:!0);if(f.length>0)for(let c of this.#_)(c.f&155648)===0&&lo(c,f,s)&&((c.f&4194320)!==0?(V(c,2048),p.schedule(c)):p.#p.add(c));if(p.#a.length>0){p.apply();for(var u of p.#a)p.#y(u,[],[]);p.#a=[]}p.deactivate()}}}}increment(t,r){if(this.#o+=1,t){let n=this.#s.get(r)??0;this.#s.set(r,n+1)}}decrement(t,r){if(this.#o-=1,t){let n=this.#s.get(r)??0;n===1?this.#s.delete(r):this.#s.set(r,n-1)}this.#h||(this.#h=!0,ve(()=>{this.#h=!1,this.linked&&this.flush()}))}transfer_effects(t,r){for(let n of t)this.#p.add(n);for(let n of r)this.#c.add(n);t.clear(),r.clear()}oncommit(t){this.#l.add(t)}ondiscard(t){this.#n.add(t)}on_fork_commit(t){this.#i.add(t)}run_fork_commit_callbacks(){for(let t of this.#i)t(this);this.#i.clear()}settled(){return(this.#d??=sn()).promise}static ensure(){if(R===null){let t=R=new e;t.#b(),!io&&!ar&&ve(()=>{t.#e||t.flush()})}return R}apply(){if(!me||!this.is_fork&&this.#t===null&&this.#r===null){be=null;return}be=new Map;for(let[r,[n]]of this.current)be.set(r,n);for(let r=yn;r!==null;r=r.#r)if(!(r===this||r.is_fork)){var t=!1;if(r.id0)){Ft.clear();for(let o of lt){if((o.f&24576)!==0)continue;let i=[o],s=o.parent;for(;s!==null;)lt.has(s)&&(lt.delete(s),i.push(s)),s=s.parent;for(let a=i.length-1;a>=0;a--){let f=i[a];(f.f&24576)===0&>(f)}}lt.clear()}}lt=null}}function Vi(e,t,r,n){if(!r.has(e)&&(r.add(e),e.reactions!==null))for(let o of e.reactions){let i=o.f;(i&2)!==0?Vi(o,t,r,n):(i&4194320)!==0&&(i&2048)===0&&lo(o,t,n)&&(V(o,2048),Ur(o))}}function lo(e,t,r){let n=r.get(e);if(n!==void 0)return n;if(e.deps!==null)for(let o of e.deps){if(pt.call(t,o))return!0;if((o.f&2)!==0&&lo(o,t,r))return r.set(o,!0),!0}return r.set(e,!1),!1}function Ur(e){R.schedule(e)}function Ui(e,t){if(!((e.f&32)!==0&&(e.f&1024)!==0)){(e.f&2048)!==0?t.d.push(e):(e.f&4096)!==0&&t.m.push(e),V(e,1024);for(var r=e.first;r!==null;)Ui(r,t),r=r.next}}function ji(e){V(e,1024);for(var t=e.first;t!==null;)ji(t),t=t.next}function co(e){let t=0,r=qe(0),n;return m&&Me(r,"createSubscriber version"),()=>{Dt()&&(l(r),$e(()=>(t===0&&(n=x(()=>e(()=>cr(r)))),t+=1,()=>{ve(()=>{t-=1,t===0&&(n?.(),n=void 0,cr(r))})})))}}var Ea=589824;function po(e,t,r,n){new uo(e,t,r,n)}var uo=class{parent;is_pending=!1;transform_error;#e;#t=k?I:null;#r;#l;#n;#i=null;#o=null;#s=null;#d=null;#a=0;#_=0;#p=!1;#c=new Set;#u=new Set;#f=null;#h=co(()=>(this.#f=qe(this.#a),m&&Me(this.#f,"$effect.pending()"),()=>{this.#f=null}));constructor(t,r,n,o){this.#e=t,this.#r=r,this.#l=i=>{var s=E;s.b=this,s.f|=128,n(i)},this.parent=E.b,this.transform_error=o??this.parent?.transform_error??(i=>i),this.#n=Je(()=>{if(k){let i=this.#t;De();let s=i.data==="[!";if(i.data.startsWith("[?")){let f=JSON.parse(i.data.slice("[?".length));this.#v(f)}else s?this.#y():this.#x()}else this.#w()},Ea),k&&(this.#e=I)}#x(){try{this.#i=pe(()=>this.#l(this.#e))}catch(t){this.error(t)}}#v(t){let r=this.#r.failed;r&&(this.#s=pe(()=>{r(this.#e,()=>t,()=>()=>{})}))}#y(){let t=this.#r.pending;t&&(this.is_pending=!0,this.#o=pe(()=>t(this.#e)),ve(()=>{var r=this.#d=document.createDocumentFragment(),n=ie();r.append(n),this.#i=this.#m(()=>pe(()=>this.#l(n))),this.#_===0&&(this.#e.before(r),this.#d=null,Tt(this.#o,()=>{this.#o=null}),this.#g(R))}))}#w(){try{if(this.is_pending=this.has_pending_snippet(),this.#_=0,this.#a=0,this.#i=pe(()=>{this.#l(this.#e)}),this.#_>0){var t=this.#d=document.createDocumentFragment();Rr(this.#i,t);let r=this.#r.pending;this.#o=pe(()=>r(this.#e))}else this.#g(R)}catch(r){this.error(r)}}#g(t){this.is_pending=!1,t.transfer_effects(this.#c,this.#u)}defer_effect(t){bn(t,this.#c,this.#u)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#r.pending}#m(t){var r=E,n=N,o=q;oe(this.#n),se(this.#n),Mt(this.#n.ctx);try{return Xe.ensure(),t()}catch(i){return gn(i),null}finally{oe(r),se(n),Mt(o)}}#E(t,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#E(t,r);return}this.#_+=t,this.#_===0&&(this.#g(r),this.#o&&Tt(this.#o,()=>{this.#o=null}),this.#d&&(this.#e.before(this.#d),this.#d=null))}update_pending_count(t,r){this.#E(t,r),this.#a+=t,!(!this.#f||this.#p)&&(this.#p=!0,ve(()=>{this.#p=!1,this.#f&&bt(this.#f,this.#a)}))}get_effect_pending(){return this.#h(),l(this.#f)}error(t){if(!this.#r.onerror&&!this.#r.failed)throw t;R?.is_fork?(this.#i&&R.skip_effect(this.#i),this.#o&&R.skip_effect(this.#o),this.#s&&R.skip_effect(this.#s),R.on_fork_commit(()=>{this.#b(t)})):this.#b(t)}#b(t){this.#i&&(ne(this.#i),this.#i=null),this.#o&&(ne(this.#o),this.#o=null),this.#s&&(ne(this.#s),this.#s=null),k&&(U(this.#t),qr(),U(yt()));var r=this.#r.onerror;let n=this.#r.failed;var o=!1,i=!1;let s=()=>{if(o){Ii();return}o=!0,i&&Ti(),this.#s!==null&&Tt(this.#s,()=>{this.#s=null}),this.#m(()=>{this.#w()})},a=f=>{try{i=!0,r?.(f,s),i=!1}catch(u){st(u,this.#n&&this.#n.parent)}n&&(this.#s=this.#m(()=>{try{return pe(()=>{var u=E;u.b=this,u.f|=128,n(this.#e,()=>f,()=>s)})}catch(u){return st(u,this.#n.parent),null}}))};ve(()=>{var f;try{f=this.transform_error(t)}catch(u){st(u,this.#n&&this.#n.parent);return}f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(a,u=>st(u,this.#n&&this.#n.parent)):a(f)})}};function kn(e,t,r,n){let o=Et()?ur:jt;var i=e.filter(d=>!d.settled);if(r.length===0&&i.length===0){n(t.map(o));return}var s=E,a=Ki(),f=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(d=>d.promise)):null;function u(d){if((s.f&16384)===0){a();try{n(d)}catch(_){st(_,s)}Cr()}}var p=_o();if(r.length===0){f.then(()=>u(t.map(o))).finally(p);return}function c(){Promise.all(r.map(d=>vo(d))).then(d=>u([...t.map(o),...d])).catch(d=>st(d,s)).finally(p)}f?f.then(()=>{a(),c(),Cr()}):c()}function Ki(){var e=E,t=N,r=q,n=R;if(m)var o=wt;return function(s=!0){oe(e),se(t),Mt(r),s&&(e.f&16384)===0&&(n?.activate(),n?.apply()),m&&(mo(null),xr(o))}}function Cr(e=!0){oe(null),se(null),Mt(null),e&&R?.deactivate(),m&&(mo(null),xr(null))}function _o(){var e=E,t=e.b,r=R,n=t.is_rendered();return t.update_pending_count(1,r),r.increment(n,e),()=>{t.update_pending_count(-1,r),r.decrement(n,e)}}var je=null;function mo(e){je=e}var jr=new Set;function ur(e){var t=2050;E!==null&&(E.f|=524288);let r={ctx:q,deps:null,effects:null,equals:dn,f:t,fn:e,reactions:null,rv:0,v:J,wv:0,parent:E,ac:null};return m&&_t&&(r.created=mt("created at")),r}var Sn=Symbol("obsolete");function vo(e,t,r){let n=E;n===null&&pi();var o=void 0,i=qe(J);m&&(i.label=t??e.toString());var s=!N,a=new Set;return Ji(()=>{var f=E;m&&(je={effect:f,effect_deps:new Set,warned:!1});var u=sn();o=u.promise;try{Promise.resolve(e()).then(u.resolve,_=>{_!==Ht&&u.reject(_)}).finally(Cr)}catch(_){u.reject(_),Cr()}if(m){if(je){if(f.deps!==null)for(let _=0;_{m&&(je=null),c?.(),a.delete(u),v!==Sn&&(p.activate(),v?(i.f|=8388608,bt(i,v)):((i.f&8388608)!==0&&(i.f^=8388608),bt(i,_),m&&r!==void 0&&(jr.add(i),setTimeout(()=>{jr.has(i)&&(f.f&16384)===0&&(Si(i.label,r),jr.delete(i))}))),p.deactivate())};u.promise.then(d,_=>d(null,_||"unknown"))}),ge(()=>{for(let f of a)f.reject(Sn)}),m&&(i.f|=4194304),new Promise(f=>{function u(p){function c(){p===o?f(i):u(o)}p.then(c,c)}u(o)})}function go(e){let t=ur(e);return me||Nn(t),t}function jt(e){let t=ur(e);return t.equals=_n,t}function Xi(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r5){let i=mt("updated at");if(i!==null){let s=e.updated.get(i.stack);s||(s={error:i,count:0},e.updated.set(i.stack,s)),s.count++}}}E!==null&&(e.set_during_effect=!0)}if((e.f&2)!==0){let o=e;(e.f&2048)!==0&&Gr(o),be===null&&yr(o)}e.wv=Nr(),es(e,2048,r),Et()&&E!==null&&(E.f&1024)!==0&&(E.f&96)===0&&(et===null?ts([e]):et.push(e)),!n.is_fork&&dr.size>0&&!xo&&Tn()}return t}function Tn(){xo=!1;for(let e of dr){(e.f&1024)!==0&&V(e,4096);let t;try{t=Pt(e)}catch{t=!0}t&>(e)}dr.clear()}function cr(e){A(e,e.v+1)}function es(e,t,r){var n=e.reactions;if(n!==null)for(var o=Et(),i=n.length,s=0;s{if(Wt===s)return c();var d=N,_=Wt;se(null),yo(s);var v=c();return se(d),yo(_),v};n&&(r.set("length",kt(e.length,i)),m&&(e=Aa(e)));var f="";let u=!1;function p(c){if(!u){u=!0,f=c,Me(o,\`\${f} version\`);for(let[d,_]of r)Me(_,_r(f,d));u=!1}}return new Proxy(e,{defineProperty(c,d,_){(!("value"in _)||_.configurable===!1||_.enumerable===!1||_.writable===!1)&&yi();var v=r.get(d);return v===void 0?a(()=>{var y=kt(_.value,i);return r.set(d,y),m&&typeof d=="string"&&Me(y,_r(f,d)),y}):A(v,_.value,!0),!0},deleteProperty(c,d){var _=r.get(d);if(_===void 0){if(d in c){let v=a(()=>kt(J,i));r.set(d,v),cr(o),m&&Me(v,_r(f,d))}}else A(_,J),cr(o);return!0},get(c,d,_){if(d===we)return e;if(m&&d===ln)return p;var v=r.get(d),y=d in c;if(v===void 0&&(!y||We(c,d)?.writable)&&(v=a(()=>{var S=Gt(y?c[d]:J),z=kt(S,i);return m&&Me(z,_r(f,d)),z}),r.set(d,v)),v!==void 0){var h=l(v);return h===J?void 0:h}return Reflect.get(c,d,_)},getOwnPropertyDescriptor(c,d){var _=Reflect.getOwnPropertyDescriptor(c,d);if(_&&"value"in _){var v=r.get(d);v&&(_.value=l(v))}else if(_===void 0){var y=r.get(d),h=y?.v;if(y!==void 0&&h!==J)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return _},has(c,d){if(d===we)return!0;var _=r.get(d),v=_!==void 0&&_.v!==J||Reflect.has(c,d);if(_!==void 0||E!==null&&(!v||We(c,d)?.writable)){_===void 0&&(_=a(()=>{var h=v?Gt(c[d]):J,S=kt(h,i);return m&&Me(S,_r(f,d)),S}),r.set(d,_));var y=l(_);if(y===J)return!1}return v},set(c,d,_,v){var y=r.get(d),h=d in c;if(n&&d==="length")for(var S=_;Skt(J,i)),r.set(S+"",z),m&&Me(z,_r(f,S)))}if(y===void 0)(!h||We(c,d)?.writable)&&(y=a(()=>kt(void 0,i)),m&&Me(y,_r(f,d)),A(y,Gt(_)),r.set(d,y));else{h=y.v!==J;var F=a(()=>Gt(_));A(y,F)}var P=Reflect.getOwnPropertyDescriptor(c,d);if(P?.set&&P.set.call(v,_),!h){if(n&&typeof d=="string"){var T=r.get("length"),$=Number(d);Number.isInteger($)&&$>=T.v&&A(T,$+1)}cr(o)}return!0},ownKeys(c){l(o);var d=Reflect.ownKeys(c).filter(y=>{var h=r.get(y);return h===void 0||h.v!==J});for(var[_,v]of r)v.v!==J&&!(_ in c)&&d.push(_);return d},setPrototypeOf(){wi()}})}function _r(e,t){return typeof t=="symbol"?\`\${e}[Symbol(\${t.description??""})]\`:ka.test(t)?\`\${e}.\${t}\`:/^\\d+$/.test(t)?\`\${e}[\${t}]\`:\`\${e}['\${t}']\`}function Rn(e){try{if(e!==null&&typeof e=="object"&&we in e)return e[we]}catch{}return e}var Sa=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Aa(e){return new Proxy(e,{get(t,r,n){var o=Reflect.get(t,r,n);return Sa.has(r)?function(...i){Qi();var s=o.apply(this,i);return Tn(),s}:o}})}function rs(){let e=Array.prototype,t=Array.__svelte_cleanup;t&&t();let{indexOf:r,lastIndexOf:n,includes:o}=e;e.indexOf=function(i,s){let a=r.call(this,i,s);if(a===-1){for(let f=s??0;f{e.indexOf=r,e.lastIndexOf=n,e.includes=o}}var wo,ns,Hr,os,is;function Cn(){if(wo===void 0){wo=window,ns=document,Hr=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;os=We(t,"firstChild").get,is=We(t,"nextSibling").get,Zn(e)&&(e[Mr]=void 0,e[fn]=null,e[Lr]=void 0,e.__e=void 0),Zn(r)&&(r[Fr]=void 0),m&&(e.__svelte_meta=null,rs())}}function ie(e=""){return document.createTextNode(e)}function Be(e){return os.call(e)}function ke(e){return is.call(e)}function b(e,t){if(!k)return Be(e);var r=Be(I);if(r===null)r=I.appendChild(ie());else if(t&&r.nodeType!==or){var n=ie();return r?.before(n),U(n),n}return t&&Xr(r),U(r),r}function ze(e,t=!1){if(!k){var r=Be(e);return r instanceof Comment&&r.data===""?ke(r):r}if(t){if(I?.nodeType!==or){var n=ie();return I?.before(n),U(n),n}Xr(I)}return I}function w(e,t=1,r=!1){let n=k?I:e;for(var o;t--;)o=n,n=ke(n);if(!k)return n;if(r){if(n?.nodeType!==or){var i=ie();return n===null?o?.after(i):n.before(i),U(i),i}Xr(n)}return U(n),n}function Kr(e){e.textContent=""}function In(){if(!me||lt!==null)return!1;var e=E.f;return(e&32768)!==0}function St(e,t,r){let n=r?{is:r}:void 0;return document.createElementNS(t??cn,e,n)}function Xr(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===or;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Kt(e){var t=N,r=E;se(null),oe(null);try{return e()}finally{se(t),oe(r)}}function To(e){E===null&&(N===null&&gi(e),hi()),ft&&vi(e)}function Ra(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function $t(e,t){var r=E;if(m)for(;r!==null&&(r.f&131072)!==0;)r=r.parent;r!==null&&(r.f&8192)!==0&&(e|=8192);var n={ctx:q,deps:null,nodes:null,f:e|2048|512,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};m&&(n.component_function=vt),R?.register_created_effect(n);var o=n;if((e&4)!==0)lr!==null?lr.push(n):Xe.ensure().schedule(n);else if(t!==null){try{gt(n)}catch(s){throw ne(n),s}o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&(o.f&524288)===0&&(o=o.first,(e&16)!==0&&(e&65536)!==0&&o!==null&&(o.f|=65536))}if(o!==null&&(o.parent=r,r!==null&&Ra(o,r),N!==null&&(N.f&2)!==0&&(e&64)===0)){var i=N;(i.effects??=[]).push(o)}return n}function Dt(){return N!==null&&!He}function ge(e){let t=$t(8,null);return V(t,1024),t.teardown=e,t}function Zr(e){To("$effect"),m&&_e(e,"name",{value:"$effect"});var t=E.f,r=!N&&(t&32)!==0&&(t&32768)===0;if(r){var n=q;(n.e??=[]).push(e)}else return to(e)}function to(e){return $t(1048580,e)}function Jr(e){return To("$effect.pre"),m&&_e(e,"name",{value:"$effect.pre"}),$t(1048584,e)}function On(e){Xe.ensure();let t=$t(524352,e);return()=>{ne(t)}}function fs(e){Xe.ensure();let t=$t(524352,e);return(r={})=>new Promise(n=>{r.outro?Tt(t,()=>{ne(t),n(void 0)}):(ne(t),n(void 0))})}function ct(e){return $t(4,e)}function B(e,t){var r=q,n={effect:null,ran:!1,deps:e};r.l.$.push(n),n.effect=$e(()=>{if(e(),!n.ran){n.ran=!0;var o=E;try{oe(o.parent),x(t)}finally{oe(o)}}})}function Ve(){var e=q;$e(()=>{for(var t of e.l.$){t.deps();var r=t.effect;(r.f&1024)!==0&&r.deps!==null&&V(r,4096),Pt(r)&>(r),t.ran=!1}})}function Ji(e){return $t(4718592,e)}function $e(e,t=0){return $t(8|t,e)}function j(e,t=[],r=[],n=[]){kn(n,t,r,o=>{$t(8,()=>e(...o.map(l)))})}function Je(e,t=0){var r=$t(16|t,e);return m&&(r.dev_stack=wt),r}function pe(e){return $t(524320,e)}function ko(e){var t=e.teardown;if(t!==null){let r=ft,n=N;Eo(!0),se(null);try{t.call(null)}finally{Eo(r),se(n)}}}function Wr(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){let o=r.ac;o!==null&&Kt(()=>{o.abort(Ht)});var n=r.next;(r.f&64)!==0?r.parent=null:ne(r,t),r=n}}function cs(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&32)===0&&ne(t),t=r}}function ne(e,t=!0){var r=!1;(t||(e.f&262144)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(us(e.nodes.start,e.nodes.end),r=!0),V(e,33554432),Wr(e,t&&!r),pr(e,0);var n=e.nodes&&e.nodes.t;if(n!==null)for(let i of n)i.stop();ko(e),e.f^=33554432,e.f|=16384;var o=e.parent;o!==null&&o.first!==null&&fo(e),m&&(e.component_function=null),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function us(e,t){for(;e!==null;){var r=e===t?null:ke(e);e.remove(),e=r}}function fo(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function Tt(e,t,r=!0){var n=[];ds(e,n,!0);var o=()=>{r&&ne(e),t&&t()},i=n.length;if(i>0){var s=()=>--i||o();for(var a of n)a.out(s)}else o()}function ds(e,t,r){if((e.f&8192)===0){e.f^=8192;var n=e.nodes&&e.nodes.t;if(n!==null)for(let a of n)(a.is_global||r)&&t.push(a);for(var o=e.first;o!==null;){var i=o.next;if((o.f&64)===0){var s=(o.f&65536)!==0||(o.f&32)!==0&&(e.f&16)!==0;ds(o,t,s?r:!1)}o=i}}}function Qr(e){ps(e,!0)}function ps(e,t){if((e.f&8192)!==0){e.f^=8192,(e.f&1024)===0&&(V(e,2048),Xe.ensure().schedule(e));for(var r=e.first;r!==null;){var n=r.next,o=(r.f&65536)!==0||(r.f&32)!==0;ps(r,o?t:!1),r=n}var i=e.nodes&&e.nodes.t;if(i!==null)for(let s of i)(s.is_global||t)&&s.in()}}function Rr(e,t){if(e.nodes)for(var r=e.nodes.start,n=e.nodes.end;r!==null;){var o=r===n?null:ke(r);t.append(r),r=o}}var _s=null;var Dn=!1,ft=!1;function Eo(e){ft=e}var N=null,He=!1;function se(e){N=e}var E=null;function oe(e){E=e}var Qe=null;function Nn(e){N!==null&&(!me||(N.f&2)!==0)&&(Qe===null?Qe=[e]:Qe.push(e))}var xe=null,Ye=0,et=null;function ts(e){et=e}var ms=1,mr=0,Wt=mr;function yo(e){Wt=e}function Nr(){return++ms}function Pt(e){var t=e.f;if((t&2048)!==0)return!0;if(t&2&&(e.f&=-65537),(t&4096)!==0){for(var r=e.deps,n=r.length,o=0;oe.wv)return!0}(t&512)!==0&&be===null&&V(e,1024)}return!1}function vs(e,t,r=!0){var n=e.reactions;if(n!==null&&!(!me&&Qe!==null&&pt.call(Qe,e)))for(var o=0;o{e.ac.abort(Ht)}),e.ac=null);try{e.f|=2097152;var p=e.fn,c=p();e.f|=32768;var d=e.deps,_=R?.is_fork;if(xe!==null){var v;if(_||pr(e,Ye),d!==null&&Ye>0)for(d.length=Ye+xe.length,v=0;vr?.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ve(()=>{t.addEventListener(e,o,n)}):t.addEventListener(e,o,n),o}function Bt(e,t,r,n,o){var i={capture:n,passive:o},s=ks(e,t,r,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&ge(()=>{t.removeEventListener(e,s,i)})}var Es=null;function Fn(e){var t=this,r=t.ownerDocument,n=e.type,o=e.composedPath?.()||[],i=o[0]||e.target;Es=e;var s=0,a=Es===e&&e[Ln];if(a){var f=o.indexOf(a);if(f!==-1&&(t===document||t===window)){e[Ln]=t;return}var u=o.indexOf(t);if(u===-1)return;f<=u&&(s=f)}if(i=o[s]||e.target,i!==t){_e(e,"currentTarget",{configurable:!0,get(){return i||r}});var p=N,c=E;se(null),oe(null);try{for(var d,_=[];i!==null;){var v=i.assignedSlot||i.parentNode||i.host||null;try{var y=i[Ln]?.[n];y!=null&&(!i.disabled||e.target===i)&&y.call(i,e)}catch(h){d?_.push(h):d=h}if(e.cancelBubble||v===t||v===null)break;i=v}if(d){for(let h of _)queueMicrotask(()=>{throw h});throw d}}finally{e[Ln]=t,delete e.currentTarget,se(p),oe(c)}}}var Fa=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Ss(e){return Fa?.createHTML(e)??e}function Ao(e){var t=St("template");return t.innerHTML=Ss(e.replaceAll("","")),t.content}function ut(e,t){var r=E;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function Y(e,t){var r=(t&1)!==0,n=(t&2)!==0,o,i=!e.startsWith("");return()=>{if(k)return ut(I,null),I;o===void 0&&(o=Ao(i?e:""+e),r||(o=Be(o)));var s=n||Hr?document.importNode(o,!0):o.cloneNode(!0);if(r){var a=Be(s),f=s.lastChild;ut(a,f)}else ut(s,s);return s}}function At(e=""){if(!k){var t=ie(e+"");return ut(t,t),t}var r=I;return r.nodeType!==or?(r.before(r=ie()),U(r)):Xr(r),ut(r,r),r}function Ro(){if(k)return ut(I,null),I;var e=document.createDocumentFragment(),t=document.createComment(""),r=ie();return e.append(t,r),ut(t,r),e}function O(e,t){if(k){var r=E;((r.f&32768)===0||r.nodes.end===null)&&(r.nodes.end=I),De();return}e!==null&&e.before(t)}var Co=!0;function C(e,t){var r=t==null?"":typeof t=="object"?\`\${t}\`:t;r!==(e[Fr]??=e.nodeValue)&&(e[Fr]=r,e.nodeValue=\`\${r}\`)}function Or(e,t){return As(e,t)}function Oo(e,t){Cn(),t.intro=t.intro??!1;let r=t.target,n=k,o=I;try{for(var i=Be(r);i&&(i.nodeType!==nt||i.data!=="[");)i=ke(i);if(!i)throw Ct;ae(!0),U(i);let s=As(e,{...t,anchor:i});return ae(!1),s}catch(s){if(s instanceof Error&&s.message.split(\` +\`).some(a=>a.startsWith("https://svelte.dev/e/")))throw s;return s!==Ct&&console.warn("Failed to hydrate: ",s),t.recover===!1&&$i(),Cn(),Kr(r),ae(!1),Or(e,t)}finally{ae(n),U(o)}}var Pn=new Map;function As(e,{target:t,anchor:r,props:n={},events:o,context:i,intro:s=!0,transformError:a}){Cn();var f=void 0,u=fs(()=>{var p=r??t.appendChild(ie());po(p,{pending:()=>{}},_=>{le({});var v=q;if(i&&(v.c=i),o&&(n.$$events=o),k&&ut(_,null),Co=s,f=e(_,n)||{},Co=!0,k&&(E.nodes.end=I,I===null||I.nodeType!==nt||I.data!=="]"))throw ir(),Ct;fe()},a);var c=new Set,d=_=>{for(var v=0;v<_.length;v++){var y=_[v];if(!c.has(y)){c.add(y);var h=bs(y);for(let F of[t,document]){var S=Pn.get(F);S===void 0&&(S=new Map,Pn.set(F,S));var z=S.get(y);z===void 0?(F.addEventListener(y,Fn,{passive:h}),S.set(y,1)):S.set(y,z+1)}}}};return d(hr(Ts)),So.add(d),()=>{for(var _ of c)for(let h of[t,document]){var v=Pn.get(h),y=v.get(_);--y==0?(h.removeEventListener(_,Fn),v.delete(_),v.size===0&&Pn.delete(h)):v.set(_,y)}So.delete(d),p!==r&&p.parentNode?.removeChild(p)}});return Io.set(f,u),f}var Io=new WeakMap;function Do(e,t){let r=Io.get(e);return r?(Io.delete(e),r(t)):(m&&(we in e?Ci():Ri()),Promise.resolve())}var zt=class{anchor;#e=new Map;#t=new Map;#r=new Map;#l=new Set;#n=!0;constructor(t,r=!0){this.anchor=t,this.#n=r}#i=t=>{if(this.#e.has(t)){var r=this.#e.get(t),n=this.#t.get(r);if(n)Qr(n),this.#l.delete(r);else{var o=this.#r.get(r);o&&(this.#t.set(r,o.effect),this.#r.delete(r),m&&(o.fragment.lastChild[Jn]=this.anchor),o.fragment.lastChild.remove(),this.anchor.before(o.fragment),n=o.effect)}for(let[i,s]of this.#e){if(this.#e.delete(i),i===t)break;let a=this.#r.get(s);a&&(ne(a.effect),this.#r.delete(s))}for(let[i,s]of this.#t){if(i===r||this.#l.has(i))continue;let a=()=>{if(Array.from(this.#e.values()).includes(i)){var u=document.createDocumentFragment();Rr(s,u),u.append(ie()),this.#r.set(i,{effect:s,fragment:u})}else ne(s);this.#l.delete(i),this.#t.delete(i)};this.#n||!n?(this.#l.add(i),Tt(s,a,!1)):a()}}};#o=t=>{this.#e.delete(t);let r=Array.from(this.#e.values());for(let[n,o]of this.#r)r.includes(n)||(ne(o.effect),this.#r.delete(n))};ensure(t,r){var n=R,o=In();if(r&&!this.#t.has(t)&&!this.#r.has(t))if(o){var i=document.createDocumentFragment(),s=ie();i.append(s),this.#r.set(t,{effect:pe(()=>r(s)),fragment:i})}else this.#t.set(t,pe(()=>r(this.anchor)));if(this.#e.set(n,t),o){for(let[a,f]of this.#t)a===t?n.unskip_effect(f):n.skip_effect(f);for(let[a,f]of this.#r)a===t?n.unskip_effect(f.effect):n.skip_effect(f.effect);n.oncommit(this.#i),n.ondiscard(this.#o)}else k&&(this.anchor=I),this.#i(n)}};function Ne(e,t,r=!1){var n;k&&(n=I,De());var o=new zt(e),i=r?65536:0;function s(a,f){if(k){var u=Br(n);if(a!==parseInt(u.substring(1))){var p=yt();U(p),o.anchor=p,ae(!1),o.ensure(a,f),ae(!0);return}}o.ensure(a,f)}Je(()=>{var a=!1;t((f,u=0)=>{a=!0,s(u,f)}),a||s(-1,null)},i)}function Lo(e,t){return t}function Wa(e,t,r){for(var n=[],o=t.length,i,s=t.length,a=0;a{if(i){if(i.pending.delete(c),i.done.add(c),i.pending.size===0){var d=e.outrogroups;Mo(e,hr(i.done)),d.delete(i),d.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var f=n.length===0&&r!==null;if(f){var u=r,p=u.parentNode;Kr(p),p.append(u),e.items.clear()}Mo(e,t,!f)}else i={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(i)}function Mo(e,t,r=!0){var n;if(e.pending.size>0){n=new Set;for(let s of e.pending.values())for(let a of s)n.add(e.items.get(a).e)}for(var o=0;o{var F=r();return Rt(F)?F:F==null?[]:hr(F)});m&&Me(c,"{#each ...}");var d,_=new Map,v=!0;function y(F){(z.effect.f&16384)===0&&(z.pending.delete(F),z.fallback=p,Ka(z,d,s,t,n),p!==null&&(d.length===0?(p.f&33554432)===0?Qr(p):(p.f^=33554432,tn(p,null,s)):Tt(p,()=>{p=null})))}function h(F){z.pending.delete(F)}var S=Je(()=>{d=l(c);var F=d.length;let P=!1;if(k){var T=Br(s)==="[!";T!==(F===0)&&(s=yt(),U(s),ae(!1),P=!0)}for(var $=new Set,D=R,G=In(),te=0;tei(s)):(p=pe(()=>i(Ns??=ie())),p.f|=33554432)),F>$.size&&(m?Za(d,n):eo("","","")),k&&F>0&&U(yt()),!v)if(_.set(D,$),G){for(let[ye,tt]of a)$.has(ye)||D.skip_effect(tt.e);D.oncommit(y),D.ondiscard(h)}else y(D);P&&ae(!0),l(c)}),z={effect:S,flags:t,items:a,pending:_,outrogroups:null,fallback:p};v=!1,k&&(s=I)}function en(e){for(;e!==null&&(e.f&32)===0;)e=e.next;return e}function Ka(e,t,r,n,o){var i=(n&8)!==0,s=t.length,a=e.items,f=en(e.effect.first),u,p=null,c,d=[],_=[],v,y,h,S;if(i)for(S=0;S0){var te=(n&4)!==0&&s===0?r:null;if(i){for(S=0;S{if(c!==void 0)for(h of c)h.nodes?.a?.apply()})}function Xa(e,t,r,n,o,i,s,a){var f=(s&1)!==0?(s&16)===0?M(r,!1,!1):qe(r):null,u=(s&2)!==0?qe(o):null;return m&&f&&(f.trace=()=>{a()[u?.v??o]}),{v:f,i:u,e:pe(()=>(i(t,f??r,u??o,a),()=>{e.delete(n)}))}}function tn(e,t,r){if(e.nodes)for(var n=e.nodes.start,o=e.nodes.end,i=t&&(t.f&33554432)===0?t.nodes.start:r;n!==null;){var s=ke(n);if(i.before(n),n===o)return;n=s}}function Xt(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}function Za(e,t){let r=new Map,n=e.length;for(let o=0;o{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){let o=St("style");o.id=t.hash,o.textContent=t.code,n.appendChild(o),m&&ys(t.hash,o)}})}var Cs=[...\` +\\r\\f\\xA0\\v\\uFEFF\`];function Os(e,t,r){var n=e==null?"":""+e;if(t&&(n=n?n+" "+t:t),r){for(var o of Object.keys(r))if(r[o])n=n?n+" "+o:o;else if(n.length)for(var i=o.length,s=0;(s=n.indexOf(o,s))>=0;){var a=s+i;(s===0||Cs.includes(n[s-1]))&&(a===n.length||Cs.includes(n[a]))?n=(s===0?"":n.substring(0,s))+n.substring(a+1):s=a}}return n===""?null:n}function Is(e,t=!1){var r=t?" !important;":";",n="";for(var o of Object.keys(e)){var i=e[o];i!=null&&i!==""&&(n+=" "+o+": "+i+r)}return n}function Fo(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Ds(e,t){if(t){var r="",n,o;if(Array.isArray(t)?(n=t[0],o=t[1]):n=t,e){e=String(e).replaceAll(/\\s*\\/\\*.*?\\*\\/\\s*/g,"").trim();var i=!1,s=0,a=!1,f=[];n&&f.push(...Object.keys(n).map(Fo)),o&&f.push(...Object.keys(o).map(Fo));var u=0,p=-1;let y=e.length;for(var c=0;ct.trim().split(" ").filter(Boolean))}function hl(e,t){var r=Ls(e.srcset),n=Ls(t);return n.length===r.length&&n.every(([o,i],s)=>i===r[s][1]&&(qo(r[s][0],o)||qo(o,r[s][0])))}function Ce(e=!1){let t=q,r=t.l.u;if(!r)return;let n=()=>Q(t.s);if(e){let o=0,i={},s=ur(()=>{let a=!1,f=t.s;for(let u in f)f[u]!==i[u]&&(i[u]=f[u],a=!0);return a&&o++,o});n=()=>l(s)}r.b.length&&Jr(()=>{qs(t,n),gr(r.b)}),Zr(()=>{let o=x(()=>r.m.map(fi));return()=>{for(let i of o)typeof i=="function"&&i()}}),r.a.length&&Zr(()=>{qs(t,n),gr(r.a)})}function qs(e,t){if(e.l.s)for(let r of e.l.s)l(r);t()}function Bs(e){return new Bo(e)}var Bo=class{#e;#t;constructor(t){var r=new Map,n=(i,s)=>{var a=M(s,!1,!1);return r.set(i,a),a};let o=new Proxy({...t.props||{},$$events:{}},{get(i,s){return l(r.get(s)??n(s,Reflect.get(i,s)))},has(i,s){return s===an?!0:(l(r.get(s)??n(s,Reflect.get(i,s))),Reflect.has(i,s))},set(i,s,a){return A(r.get(s)??n(s,a),a),Reflect.set(i,s,a)}});this.#t=(t.hydrate?Oo:Or)(t.component,{target:t.target,anchor:t.anchor,props:o,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),!me&&(!t?.props?.$$host||t.sync===!1)&&Ar(),this.#e=o.$$events;for(let i of Object.keys(this.#t))i==="$set"||i==="$destroy"||i==="$on"||_e(this,i,{get(){return this.#t[i]},set(s){this.#t[i]=s},enumerable:!0});this.#t.$set=i=>{Object.assign(o,i)},this.#t.$destroy=()=>{Do(this.#t)}}$set(t){this.#t.$set(t)}$on(t,r){this.#e[t]=this.#e[t]||[];let n=(...o)=>r.call(this,...o);return this.#e[t].push(n),()=>{this.#e[t]=this.#e[t].filter(o=>o!==n)}}$destroy(){this.#t.$destroy()}};var kl;typeof HTMLElement=="function"&&(kl=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){let n=this.$$l_u.get(t);n&&(n(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return o=>{let i=St("slot");n!=="default"&&(i.name=n),O(o,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},r=Sl(this);for(let n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),t.default=!0):t[n]=e(n));for(let n of this.attributes){let o=this.$$g_p(n.name);o in this.$$d||(this.$$d[o]=zo(o,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=Bs({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=On(()=>{$e(()=>{this.$$r=!0;for(let n of Kn(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];let o=zo(n,this.$$d[n],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,o)}this.$$r=!1})});for(let n in this.$$l)for(let o of this.$$l[n]){let i=this.$$c.$on(n,o);this.$$l_u.set(o,i)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=zo(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Kn(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function zo(e,t,r,n){let o=r[e]?.type;if(t=o==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(o){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(o){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Sl(e){let t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}if(m){let e=function(t){if(!(t in globalThis)){let r;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(r!==void 0)return r;xi(t)},set:n=>{r=n}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");Oi();var Nl={stats:"/proxy-stats",recent:"/proxy-recent",latestPng:"/proxy-latest-png",sessions:"/api/sessions.json",fullStats:"/api/stats.json",currentSession:"/api/current-session.json",compressionToggle:"/api/compression"};async function Yo(e,t){let r=await fetch(e,t);if(!r.ok){let n="";try{n=await r.text()}catch{}throw new Error(\`\${e}: \${r.status} \${r.statusText}\${n?\` \\u2014 \${n.slice(0,200)}\`:""}\`)}return r.json()}async function Rl(e,t){return Yo(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}async function zs(e){return Rl(Nl.compressionToggle,{enabled:e})}function Dr(e,t){let r=()=>{};return{subscribe:no({data:null,error:null,loading:!0},o=>{let i=!1,s=null,a=null,f=async()=>{try{let u=await Yo(e);if(i)return;a=u,o({data:u,error:null,loading:!1})}catch(u){if(i)return;o({data:a,error:u.message,loading:!1})}};return r=()=>{f()},f(),s=setInterval(f,t),()=>{i=!0,r=()=>{},s&&clearInterval(s)}}).subscribe,run:()=>r()}}var zn=Dr("/proxy-stats",2e3),vr=Dr("/proxy-recent",2e3),Ys=Dr("/api/sessions.json",5e3),f0=Dr("/api/stats.json",5e3),Hs=Dr("/api/current-session.json",2e3),rn=Er(null);function Cl(){let{subscribe:e,update:t}=Er([]),r=1;return{subscribe:e,push(n,o){let i=r++;t(s=>[...s,{id:i,level:n,text:o}]),setTimeout(()=>t(s=>s.filter(a=>a.id!==i)),5e3)},dismiss(n){t(o=>o.filter(i=>i.id!==n))}}}var nn=Cl();function L(e){return Math.round(Number(e)||0).toLocaleString()}function Vs(e){if(!e)return"-";let t=String(e).split("/");return t[t.length-1]||e}var Il=Y(''),Ol=Y('
'),Dl=Y('-'),Ml=Y(' '),Ll=Y('no requests yet'),Fl=Y('
#statuspathcccrbaselineactualsavedimg
'),Pl={hash:"svelte-hn7ohq",code:\`table.svelte-hn7ohq {width:100%;border-collapse:collapse;font-size:12px;}th.svelte-hn7ohq {text-align:left;color:#6e7681;font-weight:500;padding:6px 8px;border-bottom:1px solid #30363d;}td.svelte-hn7ohq {padding:6px 8px;border-bottom:1px solid #21262d;font-variant-numeric:tabular-nums;}tr.svelte-hn7ohq:last-child td:where(.svelte-hn7ohq) {border-bottom:none;}th.num.svelte-hn7ohq, + td.num.svelte-hn7ohq {text-align:right;}.small.svelte-hn7ohq {font-size:11px;color:#6e7681;}td.good.svelte-hn7ohq {color:#3fb950;}td.warn.svelte-hn7ohq {color:#d29922;}td.bad.svelte-hn7ohq {color:#f85149;}td.pos.svelte-hn7ohq {color:#3fb950;}.muted.svelte-hn7ohq {color:#6e7681;}.thumb-strip.svelte-hn7ohq {display:flex;gap:3px;align-items:center;justify-content:flex-end;}.thumb-btn.svelte-hn7ohq {padding:0;border:1px solid #30363d;border-radius:3px;background:#fff;cursor:pointer;line-height:0;}.thumb-btn.svelte-hn7ohq:hover, + .thumb-btn.svelte-hn7ohq:focus-visible {border-color:#58a6ff;outline:none;}.thumb.svelte-hn7ohq {height:28px;width:auto;max-width:28px;object-fit:cover;object-position:top left;display:block;image-rendering:pixelated;}.img-cell.svelte-hn7ohq {text-align:right;}\`};function Ho(e,t){le(t,!1),Re(e,Pl);let r=()=>he(vr,"$recent",n),[n,o]=Ae(),i=M();function s(p){return p>=500?"bad":p>=400?"warn":"good"}function a(p){if(!p)return"-";let c=p.split("/");return c[c.length-1]||p}B(()=>r(),()=>{A(i,r().data?.recent??[])}),Ve(),Ce();var f=Fl(),u=w(b(f));Zt(u,7,()=>(l(i),x(()=>l(i).slice().reverse())),(p,c)=>p.ts+":"+c,(p,c,d)=>{var _=Ml(),v=b(_),y=b(v,!0);g(v);var h=w(v),S=b(h,!0);g(h);var z=w(h),F=b(z,!0);g(z);var P=w(z),T=b(P,!0);g(P);var $=w(P),D=b($,!0);g($);var G=w($),te=b(G,!0);g(G);var X=w(G),H=b(X,!0);g(X);var re=w(X),W=b(re,!0);g(re);var ye=w(re),tt=b(ye);{var er=Ge=>{let dt=jt(()=>(l(c),x(()=>l(c).img_ids??(l(c).img_id!=null?[l(c).img_id]:[]))));var rt=Ol();Zt(rt,5,()=>l(dt),Lo,(Yt,Ue)=>{var Ie=Il(),rr=b(Ie);g(Ie),j(()=>{xt(Ie,"title",\`image #\${l(Ue)??""}\`),xt(rr,"src",\`/proxy-latest-png?id=\${l(Ue)??""}\`),xt(rr,"alt",\`img \${l(Ue)??""}\`)}),Bt("click",Ie,()=>rn.set(l(Ue))),O(Yt,Ie)}),g(rt),O(Ge,rt)},tr=Ge=>{var dt=Dl();O(Ge,dt)};Ne(tt,Ge=>{l(c),x(()=>l(c).img_ids&&l(c).img_ids.length>0||l(c).img_id!=null)?Ge(er):Ge(tr,-1)})}g(ye),g(_),j((Ge,dt,rt,Yt,Ue,Ie)=>{C(y,l(d)+1),Jt(h,1,\`num \${Ge??""}\`,"svelte-hn7ohq"),C(S,(l(c),x(()=>l(c).status))),C(F,dt),C(T,(l(c),x(()=>l(c).cc_added?"\\u2713":"-"))),C(D,rt),C(te,Yt),C(H,Ue),C(W,Ie)},[()=>(l(c),x(()=>s(l(c).status))),()=>(l(c),x(()=>a(l(c).path))),()=>(l(c),Q(L),x(()=>l(c).cache_read!=null?L(l(c).cache_read):"-")),()=>(l(c),Q(L),x(()=>l(c).baseline_input!=null?L(l(c).baseline_input):"-")),()=>(l(c),Q(L),x(()=>l(c).actual_input!=null?L(l(c).actual_input):"-")),()=>(l(c),Q(L),x(()=>(l(c).session_saved_so_far_delta??0)>0?"+"+L(l(c).session_saved_so_far_delta??0):"-"))]),O(p,_)},p=>{var c=Ll();O(p,c)}),g(u),g(f),O(e,f),fe(),o()}var ql=Y('
'),Bl=Y('
'),zl=Y('
',1),Yl=Y('
latest rendered
'),Hl=Y('
(none yet)
'),Vl=Y('
',1),Ul={hash:"svelte-3whs73",code:\`.wrap.svelte-3whs73 {margin-top:0;} /* Crop is done client-side via CSS (object-position + overflow:hidden). The legacy dashboard pulled a separately-cropped PNG which doubled image traffic. The full 1466\\xD71568 image lives on disk; we just show - the top-left corner at native res. */.preview-crop.svelte-3whs73 {width:100%;height:400px;overflow:hidden;background:#fff;border:1px solid #30363d;border-radius:4px;padding:4px;box-sizing:border-box;}.preview-crop.svelte-3whs73 img:where(.svelte-3whs73) {display:block;width:auto;height:auto;max-width:none;image-rendering:pixelated;}.sub.svelte-3whs73 {color:#6e7681;font-size:12px;}.small.svelte-3whs73 {font-size:11px;color:#6e7681;margin-top:8px;}.pin-bar.svelte-3whs73 {margin-bottom:8px;}.back-btn.svelte-3whs73 {font-size:11px;background:#21262d;color:#58a6ff;border:1px solid #30363d;border-radius:4px;padding:2px 8px;cursor:pointer;}.back-btn.svelte-3whs73:hover {background:#30363d;}.evicted.svelte-3whs73 {font-size:11px;color:#6e7681;padding:12px 0;}\`};function Ho(e,t){le(t,!1),Re(e,Hl);let r=()=>he(pr,"$recent",i),n=()=>he(tn,"$selectedImageId",i),[i,o]=Ae(),s=D(),a=D(),f=D(),c=D(),p=D(),d=D(),u=D();P(()=>r(),()=>{S(s,r().data?.has_preview===!0)}),P(()=>r(),()=>{S(a,r().data?.preview_meta??"")}),P(()=>r(),()=>{S(f,r().data?.image_ids??[])}),P(()=>n(),()=>{S(c,n())}),P(()=>(l(c),l(f)),()=>{S(p,l(c)!=null&&!l(f).includes(l(c)))}),P(()=>(l(c),l(s),l(a)),()=>{S(d,l(c)!=null?\`/proxy-latest-png?id=\${l(c)}\`:l(s)?"/proxy-latest-png?t="+encodeURIComponent(l(a)):"")}),P(()=>(l(c),l(a)),()=>{S(u,l(c)!=null?\`image #\${l(c)}\`:l(a)?l(a)+" - showing top-left at native resolution":"")}),Ve(),Ce();var _=Yl(),v=qe(_),x=b(v);{var h=k=>{var y=Bl(),N=qe(y),Y=b(N);g(N);var X=w(N,2);{var ee=re=>{var V=Fl(),ye=b(V);g(V),K(()=>O(ye,\`(image #\${l(c)??""} no longer in buffer)\`)),M(re,V)},H=re=>{var V=Pl(),ye=b(V);g(V),K(()=>{dr(ye,"src",l(d)),dr(ye,"alt",\`image #\${l(c)??""}\`)}),M(re,V)};Ne(X,re=>{l(p)?re(ee):re(H,-1)})}Bt("click",Y,()=>tn.set(null)),M(k,y)},A=k=>{var y=ql(),N=b(y);g(y),K(()=>dr(N,"src",l(d))),M(k,y)},B=k=>{var y=zl();M(k,y)};Ne(x,k=>{l(c)!=null?k(h):l(s)?k(A,1):k(B,-1)})}g(v);var L=w(v,2),j=b(L,!0);g(L),K(()=>O(j,l(u))),M(e,_),fe(),o()}var Vl=z('
'),Ul=z('
'),jl=z('
',1),Gl=z('
no sessions yet
'),Wl=z('
',1),Kl={hash:"svelte-c2rstm",code:".status.svelte-c2rstm {margin-bottom:12px;color:#6e7681;font-size:12px;}.chart.svelte-c2rstm {display:flex;flex-direction:column;gap:8px;}.bar-row.svelte-c2rstm {display:flex;align-items:center;gap:10px;font-size:12px;}.label.svelte-c2rstm {width:132px;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#c9d1d9;}.track.svelte-c2rstm {flex:1;min-width:0;height:14px;background:#21262d;border-radius:3px;overflow:hidden;}.fill.svelte-c2rstm {height:100%;background:#3fb950;border-radius:3px;}.value.svelte-c2rstm {width:72px;flex:none;text-align:right;font-variant-numeric:tabular-nums;color:#3fb950;}.value.neg.svelte-c2rstm {color:#f85149;}.axis.svelte-c2rstm {margin-top:12px;color:#6e7681;font-size:11px;}.empty.svelte-c2rstm {text-align:center;color:#6e7681;padding:24px;font-size:12px;}"};function Vo(e,t){le(t,!1),Re(e,Kl);let r=()=>he(zs,"$sessions",n),[n,i]=Ae(),o=D(),s=D(),a=D(),f=8;function c(k){let y=k.claudeCode?.projectPath||k.project;return y?Hs(y):k.id.slice(0,8)}function p(k){return Math.round(k).toLocaleString("en-US")}function d(k){return l(a)<=0||k<=0?0:k/l(a)*100}P(()=>r(),()=>{S(o,r().data?.sessions??[])}),P(()=>l(o),()=>{S(s,[...l(o)].sort((k,y)=>(y.tokensSavedEst??0)-(k.tokensSavedEst??0)).slice(0,f))}),P(()=>l(s),()=>{S(a,l(s).reduce((k,y)=>Math.max(k,y.tokensSavedEst??0),0))}),Ve(),Ce();var u=Wl(),_=qe(u),v=b(_);{var x=k=>{var y=Tt("loading\\u2026");M(k,y)},h=k=>{var y=Tt();K(()=>O(y,(r(),$(()=>r().error)))),M(k,y)},A=k=>{var y=Tt();K(()=>O(y,\`\${l(o),$(()=>l(o).length)??""} session\${l(o),$(()=>l(o).length===1?"":"s")??""}\`)),M(k,y)};Ne(v,k=>{r(),l(o),$(()=>r().loading&&l(o).length===0)?k(x):(r(),$(()=>r().error)?k(h,1):k(A,-1))})}g(_);var B=w(_,2);{var L=k=>{var y=jl(),N=qe(y);ur(N,5,()=>l(s),ee=>ee.id,(ee,H)=>{var re=Ul(),V=b(re),ye=b(V,!0);g(V);var Ge=w(V,2),Zt=b(Ge);{var St=At=>{var gt=Vl();K(nn=>Bn(gt,\`width:max(3px,\${nn??""}%)\`),[()=>(l(H),$(()=>d(l(H).tokensSavedEst??0)))]),M(At,gt)},ze=go(()=>(l(H),$(()=>d(l(H).tokensSavedEst??0)>0)));Ne(Zt,At=>{l(ze)&&At(St)})}g(Ge);var Ue=w(Ge,2);let zt;var _r=b(Ue,!0);g(Ue),g(re),K((At,gt)=>{dr(V,"title",(l(H),$(()=>l(H).claudeCode?.projectPath||l(H).project||l(H).id))),O(ye,At),zt=Kt(Ue,1,"value svelte-c2rstm",null,zt,{neg:(l(H).tokensSavedEst??0)<0}),O(_r,gt)},[()=>(l(H),$(()=>c(l(H)))),()=>(l(H),$(()=>p(l(H).tokensSavedEst??0)))]),M(ee,re)}),g(N);var Y=w(N,2),X=b(Y);g(Y),K(()=>O(X,\`input tokens saved (cache-aware) \\xB7 top \${l(s),$(()=>l(s).length)??""} of \${l(o),$(()=>l(o).length)??""}\`)),M(k,y)},j=k=>{var y=Gl();M(k,y)};Ne(B,k=>{l(s),$(()=>l(s).length>0)?k(L):(r(),$(()=>!r().loading&&!r().error)&&k(j,1))})}M(e,u),fe(),i()}var Xl=z('requests 2xx / 4xx / 5xx compressed passthrough input tokens cache create cache read cache hit (tok) cache hit (ev) orig chars image bytes bytes/char latency p50/p95 first-byte p50/p95 ',1),Zl=z('
',1),Jl={hash:"svelte-1bksro2",code:".status.svelte-1bksro2 {margin-bottom:12px;color:#6e7681;font-size:12px;}table.svelte-1bksro2 {width:100%;border-collapse:collapse;font-size:12px;}td.svelte-1bksro2 {padding:6px 8px;border-bottom:1px solid #21262d;vertical-align:top;font-variant-numeric:tabular-nums;}td.svelte-1bksro2:last-child {border-bottom:none;}.num.svelte-1bksro2 {text-align:right;}"};function Uo(e,t){le(t,!1),Re(e,Jl);let r=()=>he(zn,"$stats",n),[n,i]=Ae(),o=D(),s=D(),a=D(),f=D(),c=D(),p=D();P(()=>r(),()=>{S(o,r().data)}),P(()=>l(o),()=>{S(s,l(o)?.error)}),P(()=>l(o),()=>{S(a,l(o)?.summary)}),P(()=>l(a),()=>{S(f,(()=>{if(!l(a))return"-";let y=(l(a).inputTokensTotal||0)+(l(a).cacheCreateTokensTotal||0)+(l(a).cacheReadTokensTotal||0);return y>0?(l(a).cacheReadTokensTotal/y*100).toFixed(1)+"%":"-"})())}),P(()=>l(a),()=>{S(c,l(a)&&l(a).eventsWithBaseline>0?(l(a).cacheHitEvents/l(a).eventsWithBaseline*100).toFixed(1)+"%":"-")}),P(()=>l(a),()=>{S(p,l(a)&&l(a).origCharsTotal>0?(l(a).imageBytesTotal/l(a).origCharsTotal*100).toFixed(3)+"x":"-")}),Ve(),Ce();var d=Zl(),u=qe(d),_=b(u);{var v=y=>{var N=Tt("loading\\u2026");M(y,N)},x=y=>{var N=Tt();K(()=>O(N,l(s))),M(y,N)},h=y=>{var N=Tt();K(Y=>O(N,\`\${Y??""} events parsed\`),[()=>(Q(F),l(o),$(()=>F(l(o).parsed)))]),M(y,N)},A=y=>{var N=Tt("-");M(y,N)};Ne(_,y=>{r(),l(o),$(()=>r().loading&&!l(o))?y(v):l(s)?y(x,1):l(o)?y(h,2):y(A,-1)})}g(u);var B=w(u,2),L=b(B),j=b(L);{var k=y=>{var N=Xl(),Y=qe(N),X=w(b(Y)),ee=b(X,!0);g(X),g(Y);var H=w(Y,2),re=w(b(H)),V=b(re);g(re),g(H);var ye=w(H,2),Ge=w(b(ye)),Zt=b(Ge,!0);g(Ge),g(ye);var St=w(ye,2),ze=w(b(St)),Ue=b(ze,!0);g(ze),g(St);var zt=w(St,2),_r=w(b(zt)),At=b(_r,!0);g(_r),g(zt);var gt=w(zt,2),nn=w(b(gt)),Us=b(nn,!0);g(nn),g(gt);var Yn=w(gt,2),Xo=w(b(Yn)),js=b(Xo,!0);g(Xo),g(Yn);var Hn=w(Yn,2),Zo=w(b(Hn)),Gs=b(Zo,!0);g(Zo),g(Hn);var Vn=w(Hn,2),Jo=w(b(Vn)),Ws=b(Jo,!0);g(Jo),g(Vn);var Un=w(Vn,2),Qo=w(b(Un)),Ks=b(Qo,!0);g(Qo),g(Un);var jn=w(Un,2),ei=w(b(jn)),Xs=b(ei,!0);g(ei),g(jn);var Gn=w(jn,2),ti=w(b(Gn)),Zs=b(ti,!0);g(ti),g(Gn);var Wn=w(Gn,2),ri=w(b(Wn)),Js=b(ri);g(ri),g(Wn);var ni=w(Wn,2),oi=w(b(ni)),Qs=b(oi);g(oi),g(ni),K((ea,ta,ra,na,oa,ia,sa,aa,la,fa,ca,ua,da,pa,_a)=>{O(ee,ea),O(V,\`\${ta??""} / \${ra??""} / \${na??""}\`),O(Zt,oa),O(Ue,ia),O(At,sa),O(Us,aa),O(js,la),O(Gs,l(f)),O(Ws,l(c)),O(Ks,fa),O(Xs,ca),O(Zs,l(p)),O(Js,\`\${ua??""} / \${da??""} ms\`),O(Qs,\`\${pa??""} / \${_a??""} ms\`)},[()=>(Q(F),l(a),$(()=>F(l(a).total))),()=>(Q(F),l(a),$(()=>F(l(a).ok2xx))),()=>(Q(F),l(a),$(()=>F(l(a).err4xx))),()=>(Q(F),l(a),$(()=>F(l(a).err5xx))),()=>(Q(F),l(a),$(()=>F(l(a).compressed))),()=>(Q(F),l(a),$(()=>F(l(a).passthrough))),()=>(Q(F),l(a),$(()=>F(l(a).inputTokensTotal))),()=>(Q(F),l(a),$(()=>F(l(a).cacheCreateTokensTotal))),()=>(Q(F),l(a),$(()=>F(l(a).cacheReadTokensTotal))),()=>(Q(F),l(a),$(()=>F(l(a).origCharsTotal))),()=>(Q(F),l(a),$(()=>F(l(a).imageBytesTotal))),()=>(Q(F),l(a),$(()=>F(l(a).durationP50))),()=>(Q(F),l(a),$(()=>F(l(a).durationP95))),()=>(Q(F),l(a),$(()=>F(l(a).firstBytemsP50))),()=>(Q(F),l(a),$(()=>F(l(a).firstBytemsP95)))]),M(y,N)};Ne(j,y=>{l(a)&&y(k)})}g(L),g(B),M(e,d),fe(),i()}var Ql=z(\`\`),rf=Y('
runtime kill switch \\xB7 not persisted across restart
',1),nf={hash:"svelte-1mocmsr",code:".banner.svelte-1mocmsr {display:inline-block;margin:8px 0;padding:10px 14px;background:#21262d;border:1px solid #f85149;border-radius:6px;color:#f85149;font-size:12px;}.toggle-wrap.svelte-1mocmsr {margin-bottom:14px;display:flex;align-items:center;gap:10px;}.toggle.svelte-1mocmsr {background:#21262d;color:#c9d1d9;border:1px solid #30363d;padding:6px 12px;cursor:pointer;border-radius:6px;font:inherit;font-size:12px;}.toggle.svelte-1mocmsr:disabled {opacity:0.5;cursor:wait;}.hint.svelte-1mocmsr {color:#6e7681;font-size:11px;}"};function Go(e,t){le(t,!1),Re(e,nf);let r=()=>he(vr,"$recent",n),[n,o]=Ae(),i=M(),s=M(!1);async function a(){if(l(s))return;let v=!l(i);if(!(!v&&!window.confirm(\`Disable compression? -/v1/messages will forward unchanged to upstream. Use this when upstream is unhealthy or to A/B test the proxy. Restart resets to enabled.\`))){S(s,!0);try{await qs(v),pr.run()}catch(x){rn.push({level:"error",text:"failed to toggle: "+x.message})}finally{S(s,!1)}}}P(()=>r(),()=>{S(o,r().data?.compression_enabled!==!1)}),Ve(),Ce();var f=ef(),c=qe(f);{var p=v=>{var x=Ql();M(v,x)};Ne(c,v=>{l(o)||v(p)})}var d=w(c,2),u=b(d),_=b(u,!0);g(u),Pr(2),g(d),K(()=>{u.disabled=l(s),O(_,l(s)?"loading\\u2026":l(o)?"Disable compression":"Enable compression")}),Bt("click",u,a),M(e,f),fe(),i()}var rf=z('
'),nf=z(\`
THIS SESSION \\u2014 saved of total bill - ( ) - \\xB7
\`),of={hash:"svelte-1pvo6o9",code:".line.svelte-1pvo6o9 {font-size:14px;color:#c9d1d9;margin-bottom:12px;padding:8px 12px;background:#161b22;border:1px solid #30363d;border-radius:6px;}.label.svelte-1pvo6o9 {font-weight:600;color:#8b949e;letter-spacing:0.04em;}.num.svelte-1pvo6o9 {font-variant-numeric:tabular-nums;color:#3fb950;font-weight:600;}.muted.svelte-1pvo6o9 {color:#6e7681;}"};function Go(e,t){le(t,!1),Re(e,of);let r=()=>he(Ys,"$currentSession",n),[n,i]=Ae(),o=D(),s=D(),a=D(),f=D(),c=D(),p=D(),d=D(),u=D(),_=D(),v=D(),x=D(),h=5,A=5;function B(N){return"$"+N.toFixed(2)}P(()=>r(),()=>{S(o,r().data)}),P(()=>r(),()=>{S(s,r().error)}),P(()=>l(o),()=>{S(a,l(o)?.baselineInputWeighted??0)}),P(()=>l(o),()=>{S(f,l(o)?.actualInputWeighted??0)}),P(()=>(l(a),l(f)),()=>{S(c,Math.max(0,l(a)-l(f)))}),P(()=>l(c),()=>{S(p,l(c)*h/1e6)}),P(()=>l(o),()=>{S(d,l(o)?.allActualInputWeighted??0)}),P(()=>l(o),()=>{S(u,l(o)?.allOutputWeighted??0)}),P(()=>(l(d),l(u)),()=>{S(_,l(d)*h/1e6+l(u)*A/1e6)}),P(()=>(l(_),l(p)),()=>{S(v,l(_)>0?l(p)/l(_)*100:0)}),P(()=>l(o),()=>{S(x,l(o)?.baselineMeasuredCount??0)}),Ve(),Ce();var L=Ro(),j=qe(L);{var k=N=>{var Y=rf(),X=b(Y);g(Y),K(()=>O(X,\`session: \${l(s)??""}\`)),M(N,Y)},y=N=>{var Y=nf(),X=w(b(Y),2),ee=b(X,!0);g(X);var H=w(X,2),re=b(H,!0);g(H);var V=w(H,2),ye=b(V);g(V);var Ge=w(V,2),Zt=b(Ge);g(Ge),g(Y),K((St,ze,Ue)=>{O(ee,St),O(re,ze),O(ye,\`\${Ue??""}%\`),O(Zt,\`\${l(x)??""} requests\`)},[()=>(l(p),$(()=>B(l(p)))),()=>(l(_),$(()=>B(l(_)))),()=>(l(v),$(()=>l(v).toFixed(1)))]),M(N,Y)};Ne(j,N=>{l(s)?N(k):l(x)>0&&N(y,1)})}M(e,L),fe(),i()}var sf=z('
'),af=z('
'),lf={hash:"svelte-1c4to2y",code:".tray.svelte-1c4to2y {position:fixed;bottom:16px;right:16px;display:flex;flex-direction:column;gap:8px;z-index:1000;pointer-events:none;}.toast.svelte-1c4to2y {background:#21262d;color:#c9d1d9;border:1px solid #30363d;border-radius:6px;padding:10px 14px;font-size:12px;box-shadow:0 4px 12px rgba(0, 0, 0, 0.4);display:flex;align-items:center;gap:12px;pointer-events:auto;max-width:360px;}.toast.error.svelte-1c4to2y {border-color:#f85149;color:#f85149;}.toast.warn.svelte-1c4to2y {border-color:#d29922;color:#d29922;}.toast.info.svelte-1c4to2y {border-color:#58a6ff;}button.svelte-1c4to2y {background:transparent;color:inherit;border:0;cursor:pointer;font-size:16px;line-height:1;padding:0;}"};function Wo(e,t){le(t,!1),Re(e,lf);let r=()=>he(rn,"$toasts",n),[n,i]=Ae();Ce();var o=af();ur(o,5,r,s=>s.id,(s,a)=>{var f=sf(),c=b(f),p=b(c,!0);g(c);var d=w(c,2);g(f),K(()=>{Kt(f,1,\`toast \${l(a),$(()=>l(a).level)??""}\`,"svelte-1c4to2y"),O(p,(l(a),$(()=>l(a).text)))}),Bt("click",d,()=>rn.dismiss(l(a).id)),M(s,f)}),g(o),M(e,o),fe(),i()}var ff=z('

pixelpipe

recent requests

latest rendered image

sessions (top savers)

stats (full history)

',1),cf={hash:"svelte-1bzzuab",code:\` +/v1/messages will forward unchanged to upstream. Use this when upstream is unhealthy or to A/B test the proxy. Restart resets to enabled.\`))){A(s,!0);try{await zs(v),vr.run()}catch(y){nn.push({level:"error",text:"failed to toggle: "+y.message})}finally{A(s,!1)}}}B(()=>r(),()=>{A(i,r().data?.compression_enabled!==!1)}),Ve(),Ce();var f=rf(),u=ze(f);{var p=v=>{var y=tf();O(v,y)};Ne(u,v=>{l(i)||v(p)})}var c=w(u,2),d=b(c),_=b(d,!0);g(d),qr(2),g(c),j(()=>{d.disabled=l(s),C(_,l(s)?"loading\\u2026":l(i)?"Disable compression":"Enable compression")}),Bt("click",d,a),O(e,f),fe(),o()}var of=Y('
'),sf=Y(\`
THIS SESSION \\u2014 saved ( of baseline) + \\u2014
\`),af={hash:"svelte-1pvo6o9",code:".line.svelte-1pvo6o9 {font-size:14px;color:#c9d1d9;margin-bottom:12px;padding:8px 12px;background:#161b22;border:1px solid #30363d;border-radius:6px;}.label.svelte-1pvo6o9 {font-weight:600;color:#8b949e;letter-spacing:0.04em;}.num.svelte-1pvo6o9 {font-variant-numeric:tabular-nums;color:#3fb950;font-weight:600;}.muted.svelte-1pvo6o9 {color:#6e7681;}"};function Wo(e,t){le(t,!1),Re(e,af);let r=()=>he(Hs,"$currentSession",n),[n,o]=Ae(),i=M(),s=M(),a=M(),f=M(),u=M(),p=M(),c=M(),d=M(),_=M(),v=5;function y(P){return"$"+P.toFixed(2)}B(()=>r(),()=>{A(i,r().data)}),B(()=>r(),()=>{A(s,r().error)}),B(()=>l(i),()=>{A(a,l(i)?.baselineInputWeighted??0)}),B(()=>l(i),()=>{A(f,l(i)?.actualInputWeighted??0)}),B(()=>(l(a),l(f)),()=>{A(u,Math.max(0,l(a)-l(f)))}),B(()=>l(u),()=>{A(p,l(u)*v/1e6)}),B(()=>l(a),()=>{A(c,l(a)*v/1e6)}),B(()=>(l(c),l(p)),()=>{A(d,l(c)>0?l(p)/l(c)*100:0)}),B(()=>l(i),()=>{A(_,l(i)?.baselineMeasuredCount??0)}),Ve(),Ce();var h=Ro(),S=ze(h);{var z=P=>{var T=of(),$=b(T);g(T),j(()=>C($,\`session: \${l(s)??""}\`)),O(P,T)},F=P=>{var T=sf(),$=w(b(T),2),D=b($,!0);g($);var G=w($,2),te=b(G);g(G);var X=w(G,2),H=b(X,!0);g(X);var re=w(X,2),W=b(re);g(re),g(T),j((ye,tt,er)=>{C(D,ye),C(te,\`\${tt??""}%\`),C(H,er),C(W,\`\${l(_)??""} requests\`)},[()=>(l(p),x(()=>y(l(p)))),()=>(l(d),x(()=>l(d).toFixed(1))),()=>(l(c),x(()=>y(l(c))))]),O(P,T)};Ne(S,P=>{l(s)?P(z):l(_)>0&&P(F,1)})}O(e,h),fe(),o()}var lf=Y('
'),ff=Y('
'),cf={hash:"svelte-1c4to2y",code:".tray.svelte-1c4to2y {position:fixed;bottom:16px;right:16px;display:flex;flex-direction:column;gap:8px;z-index:1000;pointer-events:none;}.toast.svelte-1c4to2y {background:#21262d;color:#c9d1d9;border:1px solid #30363d;border-radius:6px;padding:10px 14px;font-size:12px;box-shadow:0 4px 12px rgba(0, 0, 0, 0.4);display:flex;align-items:center;gap:12px;pointer-events:auto;max-width:360px;}.toast.error.svelte-1c4to2y {border-color:#f85149;color:#f85149;}.toast.warn.svelte-1c4to2y {border-color:#d29922;color:#d29922;}.toast.info.svelte-1c4to2y {border-color:#58a6ff;}button.svelte-1c4to2y {background:transparent;color:inherit;border:0;cursor:pointer;font-size:16px;line-height:1;padding:0;}"};function Ko(e,t){le(t,!1),Re(e,cf);let r=()=>he(nn,"$toasts",n),[n,o]=Ae();Ce();var i=ff();Zt(i,5,r,s=>s.id,(s,a)=>{var f=lf(),u=b(f),p=b(u,!0);g(u);var c=w(u,2);g(f),j(()=>{Jt(f,1,\`toast \${l(a),x(()=>l(a).level)??""}\`,"svelte-1c4to2y"),C(p,(l(a),x(()=>l(a).text)))}),Bt("click",c,()=>nn.dismiss(l(a).id)),O(s,f)}),g(i),O(e,i),fe(),o()}var uf=Y('

pixelpipe

recent requests

latest rendered image

sessions (top savers)

stats (full history)

',1),df={hash:"svelte-1bzzuab",code:\` /* Match the legacy dashboard 1:1 \\u2014 same fonts, colors, spacing. The page looks identical pre/post rewrite to keep visual regression cheap. */body {margin:0;padding:24px;background:#0d1117;color:#c9d1d9;font:14px/1.45 -apple-system, BlinkMacSystemFont, @@ -80,5 +80,5 @@ https://svelte.dev/e/state_proxy_unmount\`,Ct,Ot):console.warn("https://svelte.d 50% { opacity: 0.4; } - }\`};function Ko(e,t){le(t,!1),Re(e,cf);let r=()=>he(zn,"$stats",n),[n,i]=Ae(),o=D();function s(y){y=Math.floor(y);let N=Math.floor(y/3600),Y=Math.floor(y%3600/60),X=y%60;return(N?N+"h ":"")+(Y||N?Y+"m ":"")+X+"s"}P(()=>r(),()=>{S(o,r().data?\`port \${location.port||"80"} \\xB7 uptime \${s(r().data.uptime_sec)} \\xB7 live\`:r().error?"proxy unreachable":"connecting...")}),Ve(),Ce();var a=ff(),f=w(qe(a),2),c=b(f,!0);g(f);var p=w(f,2);jo(p,{});var d=w(p,2);Go(d,{});var u=w(d,2),_=b(u),v=w(b(_),2);Yo(v,{}),g(_);var x=w(_,2),h=w(b(x),2);Ho(h,{}),g(x),g(u);var A=w(u,2),B=w(b(A),2);Vo(B,{}),g(A);var L=w(A,2),j=w(b(L),2);Uo(j,{}),g(L);var k=w(L,2);Wo(k,{}),K(()=>O(c,l(o))),M(e,a),fe(),i()}var Vs=document.getElementById("app");Vs?Or(Ko,{target:Vs}):document.body.textContent="pixelpipe dashboard: mount target #app missing";})(); + }\`};function Xo(e,t){le(t,!1),Re(e,df);let r=()=>he(zn,"$stats",n),[n,o]=Ae(),i=M();function s($){$=Math.floor($);let D=Math.floor($/3600),G=Math.floor($%3600/60),te=$%60;return(D?D+"h ":"")+(G||D?G+"m ":"")+te+"s"}B(()=>r(),()=>{A(i,r().data?\`port \${location.port||"80"} \\xB7 uptime \${s(r().data.uptime_sec)} \\xB7 live\`:r().error?"proxy unreachable":"connecting...")}),Ve(),Ce();var a=uf(),f=w(ze(a),2),u=b(f,!0);g(f);var p=w(f,2);Go(p,{});var c=w(p,2);Wo(c,{});var d=w(c,2),_=b(d),v=w(b(_),2);Ho(v,{}),g(_);var y=w(_,2),h=w(b(y),2);Vo(h,{}),g(y),g(d);var S=w(d,2),z=w(b(S),2);Uo(z,{}),g(S);var F=w(S,2),P=w(b(F),2);jo(P,{}),g(F);var T=w(F,2);Ko(T,{}),j(()=>C(u,l(i))),O(e,a),fe(),o()}var Us=document.getElementById("app");Us?Or(Xo,{target:Us}):document.body.textContent="pixelpipe dashboard: mount target #app missing";})(); `; diff --git a/src/dashboard.ts b/src/dashboard.ts index de3a79a..8f079eb 100644 --- a/src/dashboard.ts +++ b/src/dashboard.ts @@ -109,6 +109,7 @@ export interface RecentRow { * request rendered no image, or once the image has been evicted from the * ring (the id stays on the row but no longer fetches). */ img_id?: number; + img_ids?: number[]; } /** Aggregate over the whole session. Reset on process restart unless @@ -367,33 +368,42 @@ export class DashboardState { this.ccMapFn = ccMapFn ?? (() => claudeCodeMap()); } - /** Stash a rendered image into the ring (called from onRequest with the raw - * ProxyEvent before info.firstImagePng is dropped by toTrackEvent). - * Returns the assigned image id, or undefined when there's no image — - * the caller stamps it onto the RecentRow as `img_id`. */ - captureImage(info: NonNullable): number | undefined { - if (!info.firstImagePng) return undefined; - const id = this.nextImageId++; - const width = info.firstImageWidth ?? 0; - const height = info.firstImageHeight ?? 0; - const kb = (info.firstImagePng.length / 1024).toFixed(1); - const meta = - `${width}×${height} · ${kb} KB · ` + - `${info.imageCount ?? 0} image${info.imageCount === 1 ? '' : 's'} total`; - this.images.push({ - id, - png: info.firstImagePng, - meta, - width, - height, - ts: Date.now() / 1000, - }); + /** Stash every rendered image into the ring (called from onRequest with the + * raw ProxyEvent before info.firstImagePng is dropped by toTrackEvent). + * Returns the assigned image ids in render order; empty array when there + * are no images. The caller stamps ids[0] onto the RecentRow as `img_id` + * for back-compat and the full list as `img_ids`. */ + captureImage(info: NonNullable): number[] { + const pngs = info.imagePngs ?? (info.firstImagePng ? [info.firstImagePng] : []); + if (pngs.length === 0) return []; + const dims = + info.imageDims ?? + (info.firstImagePng + ? [{ width: info.firstImageWidth ?? 0, height: info.firstImageHeight ?? 0 }] + : []); + const ids: number[] = []; + for (let i = 0; i < pngs.length; i++) { + const id = this.nextImageId++; + const width = dims[i]?.width ?? 0; + const height = dims[i]?.height ?? 0; + const kb = (pngs[i]!.length / 1024).toFixed(1); + const meta = `${width}×${height} · ${kb} KB · image ${i + 1}/${pngs.length}`; + this.images.push({ + id, + png: pngs[i]!, + meta, + width, + height, + ts: Date.now() / 1000, + }); + ids.push(id); + } // Evict the oldest entries past the cap. splice() keeps insertion order // so images[images.length - 1] is always the latest render. if (this.images.length > IMAGE_RING_CAP) { this.images.splice(0, this.images.length - IMAGE_RING_CAP); } - return id; + return ids; } /** Fold one event into the running totals + ring buffer. @@ -406,7 +416,8 @@ export class DashboardState { // Stash the image bytes before they get GC'd by the request finishing. // The returned id (if any) is stamped onto this request's RecentRow so // the dashboard can pull the exact image that request rendered. - const imgId = ev.info ? this.captureImage(ev.info) : undefined; + const imgIds = ev.info ? this.captureImage(ev.info) : []; + const imgId = imgIds[0]; const u = ev.usage; const info = ev.info; @@ -580,6 +591,7 @@ export class DashboardState { session_saved_so_far_delta: haveBaseline && haveUsage ? round1(baselineInputEff - actualInputEff) : undefined, img_id: imgId, + img_ids: imgIds, }; this.recent.push(row); if (this.recent.length > RECENT_CAP) this.recent.splice(0, this.recent.length - RECENT_CAP); diff --git a/src/dashboard/components/RecentRequests.svelte b/src/dashboard/components/RecentRequests.svelte index 0c44936..0420660 100644 --- a/src/dashboard/components/RecentRequests.svelte +++ b/src/dashboard/components/RecentRequests.svelte @@ -50,9 +50,17 @@ ? '+' + numFmt(e.session_saved_so_far_delta ?? 0) : '-'} - - {#if e.img_id != null} - + + {#if (e.img_ids && e.img_ids.length > 0) || e.img_id != null} + {@const ids = e.img_ids ?? (e.img_id != null ? [e.img_id] : [])} +
+ {#each ids as id} + + {/each} +
{:else} - {/if} @@ -108,16 +116,35 @@ .muted { color: #6e7681; } - .view-btn { - font-size: 11px; - background: #21262d; - color: #58a6ff; - border: 1px solid #30363d; - border-radius: 4px; - padding: 1px 6px; - cursor: pointer; + .thumb-strip { + display: flex; + gap: 3px; + align-items: center; + justify-content: flex-end; } - .view-btn:hover { - background: #30363d; + .thumb-btn { + padding: 0; + border: 1px solid #30363d; + border-radius: 3px; + background: #fff; + cursor: pointer; + line-height: 0; + } + .thumb-btn:hover, + .thumb-btn:focus-visible { + border-color: #58a6ff; + outline: none; + } + .thumb { + height: 28px; + width: auto; + max-width: 28px; + object-fit: cover; + object-position: top left; + display: block; + image-rendering: pixelated; + } + .img-cell { + text-align: right; } diff --git a/src/dashboard/components/SessionSummary.svelte b/src/dashboard/components/SessionSummary.svelte index 12bdf71..9c728d4 100644 --- a/src/dashboard/components/SessionSummary.svelte +++ b/src/dashboard/components/SessionSummary.svelte @@ -28,23 +28,20 @@ $: err = $currentSession.error; // backend exposes raw weighted tokens; convert to $ at Opus 4.x rates. - // These MUST stay in lockstep with the server-side constants - // `ASSUMED_INPUT_USD_PER_MTOK` and `OUTPUT_TOKEN_RATE` in src/dashboard.ts. + // These MUST stay in lockstep with the server-side constant + // `ASSUMED_INPUT_USD_PER_MTOK` in src/dashboard.ts. const INPUT_USD_PER_MTOK = 5.0; - const OUTPUT_TOKEN_RATE = 5.0; // Numerator: honest savings over the MEASURED slice. $: baselineTok = data?.baselineInputWeighted ?? 0; $: actualTok = data?.actualInputWeighted ?? 0; $: savedTok = Math.max(0, baselineTok - actualTok); $: savedUsd = (savedTok * INPUT_USD_PER_MTOK) / 1_000_000; - // Denominator: ALL-rows session bill ($) = input + output across every - // request the proxy saw this session, measured or not. - $: allActualTok = data?.allActualInputWeighted ?? 0; - $: allOutputTok = data?.allOutputWeighted ?? 0; - $: totalBillUsd = - (allActualTok * INPUT_USD_PER_MTOK) / 1_000_000 + - (allOutputTok * OUTPUT_TOKEN_RATE) / 1_000_000; - $: savedPct = totalBillUsd > 0 ? (savedUsd / totalBillUsd) * 100 : 0; + // Denominator: BASELINE input $ over the same MEASURED slice. The proxy + // only touches input tokens — output is identical with/without proxy — so + // scoping both sides of the ratio to baseline input $ on measured rows + // gives an apples-to-apples "what fraction of the baseline did we save". + $: baselineUsd = (baselineTok * INPUT_USD_PER_MTOK) / 1_000_000; + $: savedPct = baselineUsd > 0 ? (savedUsd / baselineUsd) * 100 : 0; $: measuredReqs = data?.baselineMeasuredCount ?? 0; function fmtUsd(n: number): string { @@ -58,9 +55,9 @@
THIS SESSION — saved {fmtUsd(savedUsd)} - of {fmtUsd(totalBillUsd)} total bill - ({savedPct.toFixed(1)}%) - · {measuredReqs} requests + ({savedPct.toFixed(1)}% of + {fmtUsd(baselineUsd)} baseline) + — {measuredReqs} requests
{/if} diff --git a/src/dashboard/types.ts b/src/dashboard/types.ts index f81eaa2..962ed71 100644 --- a/src/dashboard/types.ts +++ b/src/dashboard/types.ts @@ -86,6 +86,7 @@ export interface RecentRow { baseline_input?: number; session_saved_so_far_delta?: number; img_id?: number; + img_ids?: number[]; } /** /api/sessions.json payload — bulk session aggregate + selection table. */