import{s as ae,e as H,i as N,d as m,A as ie,B as er,C as q,D as se,r as be,f as G,g as U,h as D,E as ze,F as Gr,G as Z,u as me,v as pe,w as he,H as Ur,I as Or,J as Ir,K as F,p as $r,L as Wr,M as Cr,a as $,c as W,N as Me,x,l as L,m as S,j as R,n as we,O as Ge,P as Ue,Q as Kr,R as Pr,S as Xe,z as $e,k as rr,y as ke}from"../chunks/scheduler.8df65e6b.js";import{S as ue,i as de,a as _,g as te,t as w,c as oe,f as We,b as K,d as P,m as B,e as V}from"../chunks/index.fcb0c12b.js";import{w as Tr}from"../chunks/index.7d4c7b1f.js";function Oe(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Ce(t,e){const r={},o={},n={$$scope:1};let l=t.length;for(;l--;){const a=t[l],i=e[l];if(i){for(const c in a)c in i||(o[c]=1);for(const c in i)n[c]||(r[c]=i[c],n[c]=1);t[l]=i}else for(const c in a)n[c]=1}for(const a in o)a in r||(r[a]=void 0);return r}function xr(t){return typeof t=="object"&&t!==null?t:{}}const Br=!1,Vr=!1,$o=Object.freeze(Object.defineProperty({__proto__:null,prerender:Br,ssr:Vr},Symbol.toStringTag,{value:"Module"})),Ne=Tr("DISCONNECTED"),Se=Tr(["","","",""]),Rr="941758d2-eae2-0697-9944-f9fbb0",jr=Rr+"000000",Ye=Rr+"01",Be=Ye+"0000",Lr=new TextDecoder("utf-8"),Ke=["","","",""];let ge,De,ve={d1l1:void 0,d1l2:void 0,d2l1:void 0,d2l2:void 0,buttons:void 0};async function Yr(){Ne.set("CONNECTING");try{ge=await navigator.bluetooth.requestDevice({filters:[{services:[jr]},{services:[Be]}],optionalServices:[Be]})}catch{Ne.set("DISCONNECTED");return}console.log("> Requested "+ge.name+" ("+ge.id+")");let t;try{t=await ge.gatt.connect()}catch{console.log("> Error connecting to "+ge.name+" ("+ge.id+")"),Ne.set("DISCONNECTED");return}ge.addEventListener("gattserverdisconnected",Hr),De=await t.getPrimaryService(Be);let e=[];for(let r=0;r<4;r++)e.push(await De.getCharacteristic(Ye+"000"+(r+1))),Ke[r]=await e[r].readValue().then(o=>Lr.decode(o)),await e[r].startNotifications(),e[r].addEventListener("characteristicvaluechanged",qr);ve.d1l1=e[0],ve.d1l2=e[1],ve.d2l1=e[2],ve.d2l2=e[3],ve.buttons=await De.getCharacteristic(Ye+"0005"),Se.set(Ke),Ne.set("CONNECTED")}function Hr(){console.log("> Bluetooth Device disconnected"),ge=void 0,De=void 0,Ne.set("DISCONNECTED")}function qr(t){if(!t.target)return;const e=t.target,r=Lr.decode(e.value),o=parseInt(e.uuid.slice(-1))-1;Ke[o]=r;const[n,l,a,i]=Ke;Se.set([n,l,a,i])}function Xr(t){switch(t){case"OK":return 0;case"ESC":return 1;case"+":return 2;case"-":return 3;case"RDY":return 4;case"RST":return 6;case"FULL_RESET":return 5}}async function re(t){if(ve.buttons===void 0)return!1;const e=new ArrayBuffer(1),r=new Int8Array(e),o=Xr(t);return r[0]=o,console.log("Writing buttons: ",o),await ve.buttons.writeValueWithResponse(e),!0}function Jr(){for(var t=0,e,r,o="";tt&&(e=0,o=r,r=new Map)}return{get:function(a){var i=r.get(a);if(i!==void 0)return i;if((i=o.get(a))!==void 0)return n(a,i),i},set:function(a,i){r.has(a)?r.set(a,i):n(a,i)}}}var Fr="!";function nt(t){var e=t.separator||":",r=e.length===1,o=e[0],n=e.length;return function(a){for(var i=[],c=0,f=0,g,s=0;sf?g-f:void 0;return{modifiers:i,hasImportantModifier:b,baseClassName:k,maybePostfixModifierPosition:v}}}function lt(t){if(t.length<=1)return t;var e=[],r=[];return t.forEach(function(o){var n=o[0]==="[";n?(e.push.apply(e,r.sort().concat([o])),r=[]):r.push(o)}),e.push.apply(e,r.sort()),e}function at(t){return{cache:ot(t.cacheSize),splitModifiers:nt(t),...Zr(t)}}var it=/\s+/;function st(t,e){var r=e.splitModifiers,o=e.getClassGroupId,n=e.getConflictingClassGroupIds,l=new Set;return t.trim().split(it).map(function(a){var i=r(a),c=i.modifiers,f=i.hasImportantModifier,g=i.baseClassName,s=i.maybePostfixModifierPosition,u=o(s?g.substring(0,s):g),d=!!s;if(!u){if(!s)return{isTailwindClass:!1,originalClassName:a};if(u=o(g),!u)return{isTailwindClass:!1,originalClassName:a};d=!1}var b=lt(c).join(":"),k=f?b+Fr:b;return{isTailwindClass:!0,modifierId:k,classGroupId:u,originalClassName:a,hasPostfixModifier:d}}).reverse().filter(function(a){if(!a.isTailwindClass)return!0;var i=a.modifierId,c=a.classGroupId,f=a.hasPostfixModifier,g=i+c;return l.has(g)?!1:(l.add(g),n(c,f).forEach(function(s){return l.add(i+s)}),!0)}).reverse().map(function(a){return a.originalClassName}).join(" ")}function ct(){for(var t=arguments.length,e=new Array(t),r=0;r{n&&(o||(o=We(e,t[2],t[3],!0)),o.run(1))}),n=!0)},o(s){w(c,s),s&&(o||(o=We(e,t[2],t[3],!1)),o.run(0)),n=!1},d(s){s&&m(e),c&&c.d(s),t[20](null),s&&o&&o.end(),l=!1,Ir(a)}}}function Nt(t){let e=t[1],r,o=!1,n,l=t[1]&&Ve(t);return{c(){l&&l.c(),r=H()},l(a){l&&l.l(a),r=H()},m(a,i){l&&l.m(a,i),N(a,r,i),n=!0},p(a,[i]){a[1]?e?ae(e,a[1])?(l.d(1),l=Ve(a),e=a[1],l.c(),o&&(o=!1,_(l)),l.m(r.parentNode,r)):(o&&(o=!1,_(l)),l.p(a,i)):(l=Ve(a),e=a[1],l.c(),_(l),l.m(r.parentNode,r)):e&&(o=!0,te(),w(l,1,1,()=>{l=null,e=a[1],o=!1}),oe())},i(a){n||(_(l,a),n=!0)},o(a){w(l,a),n=!1},d(a){a&&m(r),l&&l.d(a)}}}function Ot(t,e,r){const o=["tag","color","rounded","border","shadow","transition","params","node","use","options","role"];let n=ie(e,o),{$$slots:l={},$$scope:a}=e;const i=()=>({duration:0}),c=()=>{};er("background",!0);let{tag:f=n.href?"a":"div"}=e,{color:g="default"}=e,{rounded:s=!1}=e,{border:u=!1}=e,{shadow:d=!1}=e,{transition:b=i}=e,{params:k={}}=e,{node:v=void 0}=e,{use:h=c}=e,{options:y={}}=e,{role:z=void 0}=e;const j={gray:"bg-gray-50 dark:bg-gray-800",red:"bg-red-50 dark:bg-gray-800",yellow:"bg-yellow-50 dark:bg-gray-800 ",green:"bg-green-50 dark:bg-gray-800 ",indigo:"bg-indigo-50 dark:bg-gray-800 ",purple:"bg-purple-50 dark:bg-gray-800 ",pink:"bg-pink-50 dark:bg-gray-800 ",blue:"bg-blue-50 dark:bg-gray-800 ",light:"bg-gray-50 dark:bg-gray-700",dark:"bg-gray-50 dark:bg-gray-800",default:"bg-white dark:bg-gray-800",dropdown:"bg-white dark:bg-gray-700",navbar:"bg-white dark:bg-gray-900",navbarUl:"bg-gray-50 dark:bg-gray-800",form:"bg-gray-50 dark:bg-gray-700",primary:"bg-primary-50 dark:bg-gray-800 ",orange:"bg-orange-50 dark:bg-orange-800",none:""},M={gray:"text-gray-800 dark:text-gray-300",red:"text-red-800 dark:text-red-400",yellow:"text-yellow-800 dark:text-yellow-300",green:"text-green-800 dark:text-green-400",indigo:"text-indigo-800 dark:text-indigo-400",purple:"text-purple-800 dark:text-purple-400",pink:"text-pink-800 dark:text-pink-400",blue:"text-blue-800 dark:text-blue-400",light:"text-gray-700 dark:text-gray-300",dark:"text-gray-700 dark:text-gray-300",default:"text-gray-500 dark:text-gray-400",dropdown:"text-gray-700 dark:text-gray-200",navbar:"text-gray-700 dark:text-gray-200",navbarUl:"text-gray-700 dark:text-gray-400",form:"text-gray-900 dark:text-white",primary:"text-primary-800 dark:text-primary-400",orange:"text-orange-800 dark:text-orange-400",none:""},p={gray:"border-gray-300 dark:border-gray-800 divide-gray-300 dark:divide-gray-800",red:"border-red-300 dark:border-red-800 divide-red-300 dark:divide-red-800",yellow:"border-yellow-300 dark:border-yellow-800 divide-yellow-300 dark:divide-yellow-800",green:"border-green-300 dark:border-green-800 divide-green-300 dark:divide-green-800",indigo:"border-indigo-300 dark:border-indigo-800 divide-indigo-300 dark:divide-indigo-800",purple:"border-purple-300 dark:border-purple-800 divide-purple-300 dark:divide-purple-800",pink:"border-pink-300 dark:border-pink-800 divide-pink-300 dark:divide-pink-800",blue:"border-blue-300 dark:border-blue-800 divide-blue-300 dark:divide-blue-800",light:"border-gray-500 divide-gray-500",dark:"border-gray-500 divide-gray-500",default:"border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700",dropdown:"border-gray-100 dark:border-gray-600 divide-gray-100 dark:divide-gray-600",navbar:"border-gray-100 dark:border-gray-700 divide-gray-100 dark:divide-gray-700",navbarUl:"border-gray-100 dark:border-gray-700 divide-gray-100 dark:divide-gray-700",form:"border-gray-300 dark:border-gray-700 divide-gray-300 dark:divide-gray-700",primary:"border-primary-500 dark:border-primary-200 divide-primary-500 dark:divide-primary-200 ",orange:"border-orange-300 dark:border-orange-800 divide-orange-300 dark:divide-orange-800",none:""};let I;function Y(O){F.call(this,t,O)}function X(O){F.call(this,t,O)}function J(O){F.call(this,t,O)}function Q(O){F.call(this,t,O)}function T(O){F.call(this,t,O)}function ce(O){$r[O?"unshift":"push"](()=>{v=O,r(0,v)})}return t.$$set=O=>{r(26,e=q(q({},e),se(O))),r(8,n=ie(e,o)),"tag"in O&&r(1,f=O.tag),"color"in O&&r(9,g=O.color),"rounded"in O&&r(10,s=O.rounded),"border"in O&&r(11,u=O.border),"shadow"in O&&r(12,d=O.shadow),"transition"in O&&r(2,b=O.transition),"params"in O&&r(3,k=O.params),"node"in O&&r(0,v=O.node),"use"in O&&r(4,h=O.use),"options"in O&&r(5,y=O.options),"role"in O&&r(6,z=O.role),"$$scope"in O&&r(13,a=O.$$scope)},t.$$.update=()=>{t.$$.dirty&512&&r(9,g=g??"default"),t.$$.dirty&512&&er("color",g),r(7,I=Ie(j[g],M[g],s&&"rounded-lg",u&&"border",p[g],d&&"shadow-md",e.class))},e=se(e),[v,f,b,k,h,y,z,I,n,g,s,u,d,a,l,Y,X,J,Q,T,ce]}class It extends ue{constructor(e){super(),de(this,e,Ot,Nt,ae,{tag:1,color:9,rounded:10,border:11,shadow:12,transition:2,params:3,node:0,use:4,options:5,role:6})}}function Ct(t){const e=t-1;return e*e*e+1}function Tt(t,{delay:e=0,duration:r=400,easing:o=Wr}={}){const n=+getComputedStyle(t).opacity;return{delay:e,duration:r,easing:o,css:l=>`opacity: ${l*n}`}}function lr(t,{delay:e=0,duration:r=400,easing:o=Ct,axis:n="y"}={}){const l=getComputedStyle(t),a=+l.opacity,i=n==="y"?"height":"width",c=parseFloat(l[i]),f=n==="y"?["top","bottom"]:["left","right"],g=f.map(h=>`${h[0].toUpperCase()}${h.slice(1)}`),s=parseFloat(l[`padding${g[0]}`]),u=parseFloat(l[`padding${g[1]}`]),d=parseFloat(l[`margin${g[0]}`]),b=parseFloat(l[`margin${g[1]}`]),k=parseFloat(l[`border${g[0]}Width`]),v=parseFloat(l[`border${g[1]}Width`]);return{delay:e,duration:r,easing:o,css:h=>`overflow: hidden;opacity: ${Math.min(h*20,1)*a};${i}: ${h*c}px;padding-${f[0]}: ${h*s}px;padding-${f[1]}: ${h*u}px;margin-${f[0]}: ${h*d}px;margin-${f[1]}: ${h*b}px;border-${f[0]}-width: ${h*k}px;border-${f[1]}-width: ${h*v}px;`}}const xt=t=>({svgSize:t&4}),ar=t=>({svgSize:t[5][t[2]]}),Rt=t=>({svgSize:t&4}),ir=t=>({svgSize:t[5][t[2]]});function Lt(t){let e,r,o,n,l,a,i=t[0]&&sr(t);const c=t[9].default,f=be(c,t,t[8],ar);let g=[{type:"button"},t[6],{class:t[4]},{"aria-label":o=t[1]??t[0]}],s={};for(let u=0;u{a[g]=null}),oe(),r=a[e],r?r.p(c,f):(r=a[e]=l[e](c),r.c()),_(r,1),r.m(o.parentNode,o))},i(c){n||(_(r),n=!0)},o(c){w(r),n=!1},d(c){c&&m(o),a[e].d(c)}}}function Ft(t,e,r){const o=["color","name","ariaLabel","size","href"];let n=ie(e,o),{$$slots:l={},$$scope:a}=e;const i=Cr("background");let{color:c="default"}=e,{name:f=void 0}=e,{ariaLabel:g=void 0}=e,{size:s="md"}=e,{href:u=void 0}=e;const d={dark:"text-gray-500 hover:text-gray-900 hover:bg-gray-200 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600",gray:"text-gray-500 focus:ring-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-gray-300",red:"text-red-500 focus:ring-red-400 hover:bg-red-200 dark:hover:bg-red-800 dark:hover:text-red-300",yellow:"text-yellow-500 focus:ring-yellow-400 hover:bg-yellow-200 dark:hover:bg-yellow-800 dark:hover:text-yellow-300",green:"text-green-500 focus:ring-green-400 hover:bg-green-200 dark:hover:bg-green-800 dark:hover:text-green-300",indigo:"text-indigo-500 focus:ring-indigo-400 hover:bg-indigo-200 dark:hover:bg-indigo-800 dark:hover:text-indigo-300",purple:"text-purple-500 focus:ring-purple-400 hover:bg-purple-200 dark:hover:bg-purple-800 dark:hover:text-purple-300",pink:"text-pink-500 focus:ring-pink-400 hover:bg-pink-200 dark:hover:bg-pink-800 dark:hover:text-pink-300",blue:"text-blue-500 focus:ring-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800 dark:hover:text-blue-300",primary:"text-primary-500 focus:ring-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800 dark:hover:text-primary-300",default:"focus:ring-gray-400"},b={xs:"m-0.5 rounded-sm focus:ring-1 p-0.5",sm:"m-0.5 rounded focus:ring-1 p-0.5",md:"m-0.5 rounded-lg focus:ring-2 p-1.5",lg:"m-0.5 rounded-lg focus:ring-2 p-2.5"};let k;const v={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-5 h-5",lg:"w-5 h-5"};function h(y){F.call(this,t,y)}return t.$$set=y=>{r(14,e=q(q({},e),se(y))),r(6,n=ie(e,o)),"color"in y&&r(7,c=y.color),"name"in y&&r(0,f=y.name),"ariaLabel"in y&&r(1,g=y.ariaLabel),"size"in y&&r(2,s=y.size),"href"in y&&r(3,u=y.href),"$$scope"in y&&r(8,a=y.$$scope)},t.$$.update=()=>{r(4,k=Ie("focus:outline-none whitespace-normal",b[s],d[c],c==="default"&&(i?"hover:bg-gray-100 dark:hover:bg-gray-600":"hover:bg-gray-100 dark:hover:bg-gray-700"),e.class))},e=se(e),[f,g,s,u,k,v,n,c,a,l,h]}class Dt extends ue{constructor(e){super(),de(this,e,Ft,At,ae,{color:7,name:0,ariaLabel:1,size:2,href:3})}}function zt(t){let e,r,o;return{c(){e=Ge("svg"),r=Ge("path"),this.h()},l(n){e=Ue(n,"svg",{class:!0,fill:!0,viewBox:!0,xmlns:!0});var l=D(e);r=Ue(l,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),D(r).forEach(m),l.forEach(m),this.h()},h(){R(r,"fill-rule","evenodd"),R(r,"d","M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"),R(r,"clip-rule","evenodd"),R(e,"class",o=t[4]),R(e,"fill","currentColor"),R(e,"viewBox","0 0 20 20"),R(e,"xmlns","http://www.w3.org/2000/svg")},m(n,l){N(n,e,l),x(e,r)},p(n,l){l&16&&o!==(o=n[4])&&R(e,"class",o)},d(n){n&&m(e)}}}function Mt(t){let e,r;const o=[{name:t[0]},t[1],{class:Ie("ml-auto",t[2].class)}];let n={$$slots:{default:[zt,({svgSize:l})=>({4:l}),({svgSize:l})=>l?16:0]},$$scope:{ctx:t}};for(let l=0;l{r(2,e=q(q({},e),se(i))),r(1,n=ie(e,o)),"name"in i&&r(0,l=i.name)},e=se(e),[l,n,e,a]}class Ut extends ue{constructor(e){super(),de(this,e,Gt,Mt,ae,{name:0})}}const $t=t=>({}),ur=t=>({close:t[3]}),Wt=t=>({}),dr=t=>({});function fr(t){let e,r;const o=[t[4],{class:t[2]},{role:"alert"}];let n={$$slots:{default:[Vt]},$$scope:{ctx:t}};for(let l=0;l{i=null}),oe());let b=r;r=g(u),r===b?f[r].p(u,d):(te(),w(f[b],1,1,()=>{f[b]=null}),oe(),o=f[r],o?o.p(u,d):(o=f[r]=c[r](u),o.c()),_(o,1),o.m(n.parentNode,n)),u[0]?s?(s.p(u,d),d&1&&_(s,1)):(s=br(u),s.c(),_(s,1),s.m(l.parentNode,l)):s&&(te(),w(s,1,1,()=>{s=null}),oe())},i(u){a||(_(i),_(o),_(s),a=!0)},o(u){w(i),w(o),w(s),a=!1},d(u){u&&(m(e),m(n),m(l)),i&&i.d(u),f[r].d(u),s&&s.d(u)}}}function jt(t){let e,r,o=t[1]&&fr(t);return{c(){o&&o.c(),e=H()},l(n){o&&o.l(n),e=H()},m(n,l){o&&o.m(n,l),N(n,e,l),r=!0},p(n,[l]){n[1]?o?(o.p(n,l),l&2&&_(o,1)):(o=fr(n),o.c(),_(o,1),o.m(e.parentNode,e)):o&&(te(),w(o,1,1,()=>{o=null}),oe())},i(n){r||(_(o),r=!0)},o(n){w(o),r=!1},d(n){n&&m(e),o&&o.d(n)}}}function Yt(t,e,r){const o=["dismissable","defaultClass"];let n=ie(e,o),{$$slots:l={},$$scope:a}=e;const i=Kr(l);let{dismissable:c=!1}=e,{defaultClass:f="p-4 gap-3 text-sm"}=e;const g=Pr();let s=!0;const u=()=>{r(1,s=!1),g("close")};let d;function b(p){F.call(this,t,p)}function k(p){F.call(this,t,p)}function v(p){F.call(this,t,p)}function h(p){F.call(this,t,p)}function y(p){F.call(this,t,p)}function z(p){F.call(this,t,p)}function j(p){F.call(this,t,p)}function M(p){F.call(this,t,p)}return t.$$set=p=>{r(18,e=q(q({},e),se(p))),r(4,n=ie(e,o)),"dismissable"in p&&r(0,c=p.dismissable),"defaultClass"in p&&r(6,f=p.defaultClass),"$$scope"in p&&r(16,a=p.$$scope)},t.$$.update=()=>{r(2,d=Ie(f,(i.icon||c)&&"flex items-center",e.class)),r(4,n.color=n.color??"primary",n),r(4,n.rounded=n.rounded??!0,n),c&&r(4,n.transition=n.transition??Tt,n)},e=se(e),[c,s,d,u,n,i,f,l,b,k,v,h,y,z,j,M,a]}class Mr extends ue{constructor(e){super(),de(this,e,Yt,jt,ae,{dismissable:0,defaultClass:6})}}function je(t){let e,r,o,n,l,a;const i=t[10].default,c=be(i,t,t[9],null);let f=[{type:r=t[0]?void 0:t[1]},{href:t[0]},{role:o=t[0]?"link":"button"},t[3],{class:t[2]}],g={};for(let s=0;sf||d==="alternative"||d==="light";let M;function p(E){F.call(this,t,E)}function I(E){F.call(this,t,E)}function Y(E){F.call(this,t,E)}function X(E){F.call(this,t,E)}function J(E){F.call(this,t,E)}function Q(E){F.call(this,t,E)}function T(E){F.call(this,t,E)}function ce(E){F.call(this,t,E)}function O(E){F.call(this,t,E)}return t.$$set=E=>{r(27,e=q(q({},e),se(E))),r(3,n=ie(e,o)),"pill"in E&&r(4,c=E.pill),"outline"in E&&r(5,f=E.outline),"size"in E&&r(6,g=E.size),"href"in E&&r(0,s=E.href),"type"in E&&r(1,u=E.type),"color"in E&&r(7,d=E.color),"shadow"in E&&r(8,b=E.shadow),"$$scope"in E&&r(9,a=E.$$scope)},t.$$.update=()=>{r(2,M=Ie("text-center font-medium",i?"focus:ring-2":"focus:ring-4",i&&"focus:z-10",i||"focus:outline-none","inline-flex items-center justify-center "+z[g],f?y[d]:k[d],d==="alternative"&&(i?"dark:bg-gray-700 dark:text-white dark:border-gray-700 dark:hover:border-gray-600 dark:hover:bg-gray-600":"dark:bg-transparent dark:border-gray-600 dark:hover:border-gray-700"),f&&d==="dark"&&(i?"dark:text-white dark:border-white":"dark:text-gray-400 dark:border-gray-700"),v[d],j()&&i&&"border-l-0 first:border-l",i?c&&"first:rounded-l-full last:rounded-r-full"||"first:rounded-l-lg last:rounded-r-lg":c&&"rounded-full"||"rounded-lg",b&&"shadow-lg",b&&h[d],e.disabled&&"cursor-not-allowed opacity-50",e.class))},e=se(e),[s,u,M,n,c,f,g,d,b,a,l,p,I,Y,X,J,Q,T,ce,O]}class ne extends ue{constructor(e){super(),de(this,e,qt,Ht,ae,{pill:4,outline:5,size:6,href:0,type:1,color:7,shadow:8})}}function mr(t,e,r){const o=t.slice();return o[8]=e[r],o}function pr(t,e,r){const o=t.slice();return o[11]=e[r],o}function hr(t){let e,r=t[0][t[11]+t[8]*2].replaceAll(" "," ")+"",o;return{c(){e=Ge("text"),o=L(r),this.h()},l(n){e=Ue(n,"text",{x:!0,y:!0,"font-size":!0,"font-family":!0,fill:!0});var l=D(e);o=S(l,r),l.forEach(m),this.h()},h(){R(e,"x","0"),R(e,"y",9*t[11]),R(e,"font-size","8px"),R(e,"font-family","lcd"),R(e,"fill","#ffffff")},m(n,l){N(n,e,l),x(e,o)},p(n,l){l&1&&r!==(r=n[0][n[11]+n[8]*2].replaceAll(" "," ")+"")&&we(o,r)},d(n){n&&m(e)}}}function _r(t){let e,r,o,n=Oe([0,1]),l=[];for(let a=0;a<2;a+=1)l[a]=hr(pr(t,n,a));return{c(){e=G("div"),r=Ge("svg");for(let a=0;a<2;a+=1)l[a].c();o=$(),this.h()},l(a){e=U(a,"DIV",{class:!0});var i=D(e);r=Ue(i,"svg",{viewBox:!0,preserveAspectRatio:!0});var c=D(r);for(let f=0;f<2;f+=1)l[f].l(c);c.forEach(m),o=W(i),i.forEach(m),this.h()},h(){R(r,"viewBox","0 -8 110 18"),R(r,"preserveAspectRatio","xMaxYMax meet"),R(e,"class","bg-blue-600 flex flex-col py-2 px-3 grow min-w-[200px]")},m(a,i){N(a,e,i),x(e,r);for(let c=0;c<2;c+=1)l[c]&&l[c].m(r,null);x(e,o)},p(a,i){if(i&1){n=Oe([0,1]);let c;for(c=0;c<2;c+=1){const f=pr(a,n,c);l[c]?l[c].p(f,i):(l[c]=hr(f),l[c].c(),l[c].m(r,null))}for(;c<2;c+=1)l[c].d(1)}},d(a){a&&m(e),Xe(l,a)}}}function Xt(t){let e;return{c(){e=L("READY")},l(r){e=S(r,"READY")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function Jt(t){let e;return{c(){e=L("RESET")},l(r){e=S(r,"RESET")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function Zt(t){let e;return{c(){e=L("+")},l(r){e=S(r,"+")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function Qt(t){let e;return{c(){e=L("-")},l(r){e=S(r,"-")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function eo(t){let e;return{c(){e=L("OK")},l(r){e=S(r,"OK")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function ro(t){let e;return{c(){e=L("ESC")},l(r){e=S(r,"ESC")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function to(t){let e;return{c(){e=L("RESET CONTROLLER")},l(r){e=S(r,"RESET CONTROLLER")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function oo(t){let e,r,o,n,l,a,i,c,f,g,s,u,d,b,k,v,h,y,z,j=Oe([0,1]),M=[];for(let p=0;p<2;p+=1)M[p]=_r(mr(t,j,p));return n=new ne({props:{size:"xl",color:"green",class:"w-full bg-primary-50",$$slots:{default:[Xt]},$$scope:{ctx:t}}}),n.$on("click",t[1]),a=new ne({props:{size:"xl",color:"red",class:"w-full bg-primary-50",$$slots:{default:[Jt]},$$scope:{ctx:t}}}),a.$on("click",t[2]),f=new ne({props:{color:"yellow",class:"grow",$$slots:{default:[Zt]},$$scope:{ctx:t}}}),f.$on("click",t[3]),s=new ne({props:{color:"yellow",class:"grow",$$slots:{default:[Qt]},$$scope:{ctx:t}}}),s.$on("click",t[4]),b=new ne({props:{color:"yellow",class:"grow",$$slots:{default:[eo]},$$scope:{ctx:t}}}),b.$on("click",t[5]),v=new ne({props:{color:"yellow",class:"grow",$$slots:{default:[ro]},$$scope:{ctx:t}}}),v.$on("click",t[6]),y=new ne({props:{size:"xl",color:"red",class:"w-full bg-primary-50",$$slots:{default:[to]},$$scope:{ctx:t}}}),y.$on("click",t[7]),{c(){e=G("div"),r=G("div");for(let p=0;p<2;p+=1)M[p].c();o=$(),K(n.$$.fragment),l=$(),K(a.$$.fragment),i=$(),c=G("div"),K(f.$$.fragment),g=$(),K(s.$$.fragment),u=$(),d=G("div"),K(b.$$.fragment),k=$(),K(v.$$.fragment),h=$(),K(y.$$.fragment),this.h()},l(p){e=U(p,"DIV",{class:!0});var I=D(e);r=U(I,"DIV",{class:!0});var Y=D(r);for(let Q=0;Q<2;Q+=1)M[Q].l(Y);Y.forEach(m),o=W(I),P(n.$$.fragment,I),l=W(I),P(a.$$.fragment,I),i=W(I),c=U(I,"DIV",{class:!0});var X=D(c);P(f.$$.fragment,X),g=W(X),P(s.$$.fragment,X),X.forEach(m),u=W(I),d=U(I,"DIV",{class:!0});var J=D(d);P(b.$$.fragment,J),k=W(J),P(v.$$.fragment,J),J.forEach(m),h=W(I),P(y.$$.fragment,I),I.forEach(m),this.h()},h(){R(r,"class","w-full flex flex-row flex-wrap gap-3 justify-center"),R(c,"class","w-full flex gap-3"),R(d,"class","w-full flex gap-3"),R(e,"class","flex flex-col items-center gap-3")},m(p,I){N(p,e,I),x(e,r);for(let Y=0;Y<2;Y+=1)M[Y]&&M[Y].m(r,null);x(e,o),B(n,e,null),x(e,l),B(a,e,null),x(e,i),x(e,c),B(f,c,null),x(c,g),B(s,c,null),x(e,u),x(e,d),B(b,d,null),x(d,k),B(v,d,null),x(e,h),B(y,e,null),z=!0},p(p,[I]){if(I&1){j=Oe([0,1]);let E;for(E=0;E<2;E+=1){const _e=mr(p,j,E);M[E]?M[E].p(_e,I):(M[E]=_r(_e),M[E].c(),M[E].m(r,null))}for(;E<2;E+=1)M[E].d(1)}const Y={};I&16384&&(Y.$$scope={dirty:I,ctx:p}),n.$set(Y);const X={};I&16384&&(X.$$scope={dirty:I,ctx:p}),a.$set(X);const J={};I&16384&&(J.$$scope={dirty:I,ctx:p}),f.$set(J);const Q={};I&16384&&(Q.$$scope={dirty:I,ctx:p}),s.$set(Q);const T={};I&16384&&(T.$$scope={dirty:I,ctx:p}),b.$set(T);const ce={};I&16384&&(ce.$$scope={dirty:I,ctx:p}),v.$set(ce);const O={};I&16384&&(O.$$scope={dirty:I,ctx:p}),y.$set(O)},i(p){z||(_(n.$$.fragment,p),_(a.$$.fragment,p),_(f.$$.fragment,p),_(s.$$.fragment,p),_(b.$$.fragment,p),_(v.$$.fragment,p),_(y.$$.fragment,p),z=!0)},o(p){w(n.$$.fragment,p),w(a.$$.fragment,p),w(f.$$.fragment,p),w(s.$$.fragment,p),w(b.$$.fragment,p),w(v.$$.fragment,p),w(y.$$.fragment,p),z=!1},d(p){p&&m(e),Xe(M,p),V(n),V(a),V(f),V(s),V(b),V(v),V(y)}}}function no(t,e,r){let o;return $e(t,Se,s=>r(0,o=s)),[o,()=>re("RDY"),()=>re("RST"),()=>re("+"),()=>re("-"),()=>re("OK"),()=>re("ESC"),()=>re("FULL_RESET")]}class lo extends ue{constructor(e){super(),de(this,e,no,oo,ae,{})}}function vr(t,e,r){const o=t.slice();return o[5]=e[r],o[7]=r,o}function ao(t){let e=(t[5].time/1e3).toFixed(3)+"",r;return{c(){r=L(e)},l(o){r=S(o,e)},m(o,n){N(o,r,n)},p(o,n){n&1&&e!==(e=(o[5].time/1e3).toFixed(3)+"")&&we(r,e)},d(o){o&&m(r)}}}function io(t){let e;return{c(){e=L("FALSE")},l(r){e=S(r,"FALSE")},m(r,o){N(r,e,o)},p:ke,d(r){r&&m(e)}}}function yr(t){let e,r,o=(t[5].reactionTime/1e3).toFixed(3)+"",n;return{c(){e=L("reaction time: "),r=G("b"),n=L(o)},l(l){e=S(l,"reaction time: "),r=U(l,"B",{});var a=D(r);n=S(a,o),a.forEach(m)},m(l,a){N(l,e,a),N(l,r,a),x(r,n)},p(l,a){a&1&&o!==(o=(l[5].reactionTime/1e3).toFixed(3)+"")&&we(n,o)},d(l){l&&(m(e),m(r))}}}function so(t){let e,r;function o(){return t[4](t[7])}return e=new ne({props:{disabled:t[0].timers[t[7]===0?"b":"a"].state==="OFFLINE",class:"mt-3",color:"light",$$slots:{default:[go]},$$scope:{ctx:t}}}),e.$on("click",o),{c(){K(e.$$.fragment)},l(n){P(e.$$.fragment,n)},m(n,l){B(e,n,l),r=!0},p(n,l){t=n;const a={};l&1&&(a.disabled=t[0].timers[t[7]===0?"b":"a"].state==="OFFLINE"),l&256&&(a.$$scope={dirty:l,ctx:t}),e.$set(a)},i(n){r||(_(e.$$.fragment,n),r=!0)},o(n){w(e.$$.fragment,n),r=!1},d(n){V(e,n)}}}function co(t){let e;return{c(){e=L("READY")},l(r){e=S(r,"READY")},m(r,o){N(r,e,o)},p:ke,i:ke,o:ke,d(r){r&&m(e)}}}function uo(t){let e;return{c(){e=L("FOOT OK")},l(r){e=S(r,"FOOT OK")},m(r,o){N(r,e,o)},p:ke,i:ke,o:ke,d(r){r&&m(e)}}}function fo(t){let e,r,o,n,l,a=(t[0].state==="IDLE"||t[0].state==="FOOT_OK")&&kr(t);return{c(){e=L("OFFLINE"),r=G("br"),o=$(),a&&a.c(),n=H()},l(i){e=S(i,"OFFLINE"),r=U(i,"BR",{}),o=W(i),a&&a.l(i),n=H()},m(i,c){N(i,e,c),N(i,r,c),N(i,o,c),a&&a.m(i,c),N(i,n,c),l=!0},p(i,c){i[0].state==="IDLE"||i[0].state==="FOOT_OK"?a?c&1&&_(a,1):(a=kr(i),a.c(),_(a,1),a.m(n.parentNode,n)):a&&(te(),w(a,1,1,()=>{a=null}),oe())},i(i){l||(_(a),l=!0)},o(i){w(a),l=!1},d(i){i&&(m(e),m(r),m(o),m(n)),a&&a.d(i)}}}function go(t){let e;return{c(){e=L("disable")},l(r){e=S(r,"disable")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function kr(t){let e,r;function o(){return t[3](t[7])}return e=new ne({props:{class:"mt-3",color:"light",$$slots:{default:[bo]},$$scope:{ctx:t}}}),e.$on("click",o),{c(){K(e.$$.fragment)},l(n){P(e.$$.fragment,n)},m(n,l){B(e,n,l),r=!0},p(n,l){t=n;const a={};l&256&&(a.$$scope={dirty:l,ctx:t}),e.$set(a)},i(n){r||(_(e.$$.fragment,n),r=!0)},o(n){w(e.$$.fragment,n),r=!1},d(n){V(e,n)}}}function bo(t){let e;return{c(){e=L("enable")},l(r){e=S(r,"enable")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function wr(t){let e,r,o,n,l,a,i,c,f;function g(h,y){return h[5].state==="LOSER"&&h[5].reactionTime<100?io:ao}let s=g(t),u=s(t),d=t[5].reactionTime>0&&yr(t);const b=[fo,uo,co,so],k=[];function v(h,y){return h[5].state==="OFFLINE"?0:h[5].state==="FOOT_OK"?1:h[5].state==="READY"?2:h[5].state==="IDLE"?3:-1}return~(a=v(t))&&(i=k[a]=b[a](t)),{c(){e=G("div"),r=G("span"),u.c(),o=$(),n=G("span"),d&&d.c(),l=$(),i&&i.c(),c=$(),this.h()},l(h){e=U(h,"DIV",{class:!0});var y=D(e);r=U(y,"SPAN",{class:!0,style:!0});var z=D(r);u.l(z),z.forEach(m),o=W(y),n=U(y,"SPAN",{class:!0});var j=D(n);d&&d.l(j),l=W(j),i&&i.l(j),j.forEach(m),c=W(y),y.forEach(m),this.h()},h(){R(r,"class","text-9xl font-bold"),rr(r,"color",t[1](t[5])),R(n,"class","text-3xl"),R(e,"class","flex flex-grow flex-col items-center")},m(h,y){N(h,e,y),x(e,r),u.m(r,null),x(e,o),x(e,n),d&&d.m(n,null),x(n,l),~a&&k[a].m(n,null),x(e,c),f=!0},p(h,y){s===(s=g(h))&&u?u.p(h,y):(u.d(1),u=s(h),u&&(u.c(),u.m(r,null))),(!f||y&1)&&rr(r,"color",h[1](h[5])),h[5].reactionTime>0?d?d.p(h,y):(d=yr(h),d.c(),d.m(n,l)):d&&(d.d(1),d=null);let z=a;a=v(h),a===z?~a&&k[a].p(h,y):(i&&(te(),w(k[z],1,1,()=>{k[z]=null}),oe()),~a?(i=k[a],i?i.p(h,y):(i=k[a]=b[a](h),i.c()),_(i,1),i.m(n,null)):i=null)},i(h){f||(_(i),f=!0)},o(h){w(i),f=!1},d(h){h&&m(e),u.d(),d&&d.d(),~a&&k[a].d()}}}function mo(t){let e;return{c(){e=L("RESET")},l(r){e=S(r,"RESET")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function po(t){let e;return{c(){e=L("READY")},l(r){e=S(r,"READY")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function ho(t){let e,r;function o(a,i){return i&1&&(e=null),e==null&&(e=!!["IDLE","FOOT_OK"].includes(a[0].state)),e?po:mo}let n=o(t,-1),l=n(t);return{c(){l.c(),r=H()},l(a){l.l(a),r=H()},m(a,i){l.m(a,i),N(a,r,i)},p(a,i){n!==(n=o(a,i))&&(l.d(1),l=n(a),l&&(l.c(),l.m(r.parentNode,r)))},d(a){a&&m(r),l.d(a)}}}function _o(t){let e,r,o=t[0].state+"",n,l,a,i,c,f,g=Oe([t[0].timers.a,t[0].timers.b]),s=[];for(let d=0;d<2;d+=1)s[d]=wr(vr(t,g,d));const u=d=>w(s[d],1,1,()=>{s[d]=null});return c=new ne({props:{size:"xl",class:"w-full py-10 mt-6",disabled:!["FOOT_OK","RUNNING","FINISHED"].includes(t[0].state),$$slots:{default:[ho]},$$scope:{ctx:t}}}),c.$on("click",t[2]),{c(){e=G("div"),r=L("Race state: "),n=L(o),l=$(),a=G("div");for(let d=0;d<2;d+=1)s[d].c();i=$(),K(c.$$.fragment),this.h()},l(d){e=U(d,"DIV",{class:!0});var b=D(e);r=S(b,"Race state: "),n=S(b,o),l=W(b),a=U(b,"DIV",{class:!0});var k=D(a);for(let v=0;v<2;v+=1)s[v].l(k);k.forEach(m),i=W(b),P(c.$$.fragment,b),b.forEach(m),this.h()},h(){R(a,"class","w-full flex flex-row flex-wrap gap-3 justify-center"),R(e,"class","flex flex-col items-center gap-3")},m(d,b){N(d,e,b),x(e,r),x(e,n),x(e,l),x(e,a);for(let k=0;k<2;k+=1)s[k]&&s[k].m(a,null);x(e,i),B(c,e,null),f=!0},p(d,[b]){if((!f||b&1)&&o!==(o=d[0].state+"")&&we(n,o),b&3){g=Oe([d[0].timers.a,d[0].timers.b]);let v;for(v=0;v<2;v+=1){const h=vr(d,g,v);s[v]?(s[v].p(h,b),_(s[v],1)):(s[v]=wr(h),s[v].c(),_(s[v],1),s[v].m(a,null))}for(te(),v=2;v<2;v+=1)u(v);oe()}const k={};b&1&&(k.disabled=!["FOOT_OK","RUNNING","FINISHED"].includes(d[0].state)),b&257&&(k.$$scope={dirty:b,ctx:d}),c.$set(k)},i(d){if(!f){for(let b=0;b<2;b+=1)_(s[b]);_(c.$$.fragment,d),f=!0}},o(d){s=s.filter(Boolean);for(let b=0;b<2;b+=1)w(s[b]);w(c.$$.fragment,d),f=!1},d(d){d&&m(e),Xe(s,d),V(c)}}}function vo(t,e,r){let{raceState:o}=e;const n=c=>{switch(c.state){case"UNKNOWN":return"gray";case"IDLE":return"red";case"FOOT_OK":return"yellow";case"READY":return"yellow";case"RUNNING":return"red";case"WINNER":return"green";case"LOSER":return"red";case"OFFLINE":return"gray"}},l=()=>{o.state==="FOOT_OK"?re("RDY"):re("RST")},a=c=>{re(c===0?"+":"-")},i=c=>{re(c===0?"+":"-")};return t.$$set=c=>{"raceState"in c&&r(0,o=c.raceState)},[o,n,l,a,i]}class yo extends ue{constructor(e){super(),de(this,e,vo,_o,ae,{raceState:0})}}function ko(t){let e,r;return e=new yo({props:{raceState:t[0]}}),{c(){K(e.$$.fragment)},l(o){P(e.$$.fragment,o)},m(o,n){B(e,o,n),r=!0},p(o,n){const l={};n&1&&(l.raceState=o[0]),e.$set(l)},i(o){r||(_(e.$$.fragment,o),r=!0)},o(o){w(e.$$.fragment,o),r=!1},d(o){V(e,o)}}}function wo(t){let e,r;return e=new Mr({props:{color:"yellow",class:"pb-3",$$slots:{default:[Eo]},$$scope:{ctx:t}}}),{c(){K(e.$$.fragment)},l(o){P(e.$$.fragment,o)},m(o,n){B(e,o,n),r=!0},p(o,n){const l={};n&256&&(l.$$scope={dirty:n,ctx:o}),e.$set(l)},i(o){r||(_(e.$$.fragment,o),r=!0)},o(o){w(e.$$.fragment,o),r=!1},d(o){V(e,o)}}}function Eo(t){let e;return{c(){e=L("Could not determine timer state!")},l(r){e=S(r,"Could not determine timer state!")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function Er(t){let e,r;return e=new ne({props:{color:"dark",class:"mt-3",$$slots:{default:[No]},$$scope:{ctx:t}}}),e.$on("click",t[3]),{c(){K(e.$$.fragment)},l(o){P(e.$$.fragment,o)},m(o,n){B(e,o,n),r=!0},p(o,n){const l={};n&258&&(l.$$scope={dirty:n,ctx:o}),e.$set(l)},i(o){r||(_(e.$$.fragment,o),r=!0)},o(o){w(e.$$.fragment,o),r=!1},d(o){V(e,o)}}}function No(t){let e=t[1]?"Hide raw controls":"Show raw controls",r;return{c(){r=L(e)},l(o){r=S(o,e)},m(o,n){N(o,r,n)},p(o,n){n&2&&e!==(e=o[1]?"Hide raw controls":"Show raw controls")&&we(r,e)},d(o){o&&m(r)}}}function Nr(t){let e,r,o,n;return r=new lo({}),{c(){e=G("div"),K(r.$$.fragment),this.h()},l(l){e=U(l,"DIV",{class:!0});var a=D(e);P(r.$$.fragment,a),a.forEach(m),this.h()},h(){R(e,"class","pt-3")},m(l,a){N(l,e,a),B(r,e,null),n=!0},i(l){n||(_(r.$$.fragment,l),l&&Or(()=>{n&&(o||(o=We(e,lr,{duration:200},!0)),o.run(1))}),n=!0)},o(l){w(r.$$.fragment,l),l&&(o||(o=We(e,lr,{duration:200},!1)),o.run(0)),n=!1},d(l){l&&m(e),V(r),l&&o&&o.end()}}}function Oo(t){let e,r,o,n,l,a;const i=[wo,ko],c=[];function f(u,d){return u[0].state==="UNKNOWN"?0:1}e=f(t),r=c[e]=i[e](t);let g=t[0].state!=="UNKNOWN"&&Er(t),s=(t[1]||t[0].state==="UNKNOWN")&&Nr();return{c(){r.c(),o=$(),g&&g.c(),n=$(),s&&s.c(),l=H()},l(u){r.l(u),o=W(u),g&&g.l(u),n=W(u),s&&s.l(u),l=H()},m(u,d){c[e].m(u,d),N(u,o,d),g&&g.m(u,d),N(u,n,d),s&&s.m(u,d),N(u,l,d),a=!0},p(u,[d]){let b=e;e=f(u),e===b?c[e].p(u,d):(te(),w(c[b],1,1,()=>{c[b]=null}),oe(),r=c[e],r?r.p(u,d):(r=c[e]=i[e](u),r.c()),_(r,1),r.m(o.parentNode,o)),u[0].state!=="UNKNOWN"?g?(g.p(u,d),d&1&&_(g,1)):(g=Er(u),g.c(),_(g,1),g.m(n.parentNode,n)):g&&(te(),w(g,1,1,()=>{g=null}),oe()),u[1]||u[0].state==="UNKNOWN"?s?d&3&&_(s,1):(s=Nr(),s.c(),_(s,1),s.m(l.parentNode,l)):s&&(te(),w(s,1,1,()=>{s=null}),oe())},i(u){a||(_(r),_(g),_(s),a=!0)},o(u){w(r),w(g),w(s),a=!1},d(u){u&&(m(o),m(n),m(l)),c[e].d(u),g&&g.d(u),s&&s.d(u)}}}const Io=/(?\d+)'(?\d\d)"(?\d\d\d)/,Co=/ (?\d+)"(?\d\d\d) /;function To(t,e,r){let o;$e(t,Se,s=>r(2,o=s));let n={state:"UNKNOWN",timers:{a:{state:"IDLE",time:0,reactionTime:0},b:{state:"IDLE",time:0,reactionTime:0}}},l=!1;const a=s=>{const u=s.match(Co);if(!(!u||!u.groups))return parseInt(u.groups.seconds)*1e3+parseInt(u.groups.milliseconds)},i=(s,u)=>{const d=s.match(Io);if(!d||!d.groups)return console.log(s,"does not seem to be a time"),{state:"UNKNOWN",time:0,reactionTime:0};if(u.includes("OFFLINE"))return{state:"OFFLINE",time:0,reactionTime:0};if(u.includes("FALSE_START")){const v=a(s);return v===void 0?{state:"LOSER",time:0,reactionTime:0}:{state:"LOSER",time:0,reactionTime:v}}const b=parseInt(d.groups.minutes)*60*1e3+parseInt(d.groups.seconds)*1e3+parseInt(d.groups.milliseconds);if(b===0&&s.includes("READY"))return{state:"READY",time:0,reactionTime:0};if(b===0&&u.includes("FOOT OK"))return{state:"FOOT_OK",time:0,reactionTime:0};const k=a(u);return k===void 0?b>0?{state:"RUNNING",time:b,reactionTime:0}:{state:"IDLE",time:0,reactionTime:0}:u.indexOf("WINNER")!==-1?{state:"WINNER",time:b,reactionTime:k}:u.indexOf("LOSER")!==-1?{state:"LOSER",time:b,reactionTime:k}:b===0?{state:"IDLE",time:0,reactionTime:0}:{state:"RUNNING",time:b,reactionTime:k}},c=(s,u)=>s.state==="UNKNOWN"||u.state==="UNKNOWN"?"UNKNOWN":s.state==="IDLE"&&u.state==="IDLE"||s.state==="OFFLINE"&&u.state==="IDLE"||s.state==="IDLE"&&u.state==="OFFLINE"||s.state==="FOOT_OK"&&u.state==="IDLE"||s.state==="IDLE"&&u.state==="FOOT_OK"?"IDLE":s.state==="FOOT_OK"&&u.state==="FOOT_OK"||s.state==="FOOT_OK"&&u.state==="OFFLINE"||s.state==="OFFLINE"&&u.state==="FOOT_OK"?"FOOT_OK":s.state==="READY"||u.state==="READY"?"READY":s.state==="RUNNING"||u.state==="RUNNING"?"RUNNING":s.state==="WINNER"&&(u.state==="LOSER"||u.state==="OFFLINE")||(s.state==="OFFLINE"||s.state==="LOSER")&&u.state==="WINNER"||s.state==="LOSER"&&(u.state==="WINNER"||u.state==="OFFLINE")||(s.state==="OFFLINE"||s.state==="WINNER")&&u.state==="LOSER"?"FINISHED":"UNKNOWN",f=s=>{const[u,d,b,k]=s,v=i(u,d),h=i(b,k);return{state:c(v,h),timers:{a:v,b:h}}},g=()=>{r(1,l=!l)};return t.$$.update=()=>{t.$$.dirty&4&&r(0,n=f(o))},[n,l,o,g]}class xo extends ue{constructor(e){super(),de(this,e,To,Oo,ae,{})}}function Ro(t){let e,r;return e=new xo({}),{c(){K(e.$$.fragment)},l(o){P(e.$$.fragment,o)},m(o,n){B(e,o,n),r=!0},i(o){r||(_(e.$$.fragment,o),r=!0)},o(o){w(e.$$.fragment,o),r=!1},d(o){V(e,o)}}}function Lo(t){let e,r;return e=new Mr({props:{color:"yellow",$$slots:{default:[Ao]},$$scope:{ctx:t}}}),{c(){K(e.$$.fragment)},l(o){P(e.$$.fragment,o)},m(o,n){B(e,o,n),r=!0},i(o){r||(_(e.$$.fragment,o),r=!0)},o(o){w(e.$$.fragment,o),r=!1},d(o){V(e,o)}}}function So(t){let e,r;return e=new ne({props:{$$slots:{default:[Fo]},$$scope:{ctx:t}}}),e.$on("click",t[2]),{c(){K(e.$$.fragment)},l(o){P(e.$$.fragment,o)},m(o,n){B(e,o,n),r=!0},i(o){r||(_(e.$$.fragment,o),r=!0)},o(o){w(e.$$.fragment,o),r=!1},d(o){V(e,o)}}}function Ao(t){let e;return{c(){e=L("Connecting...")},l(r){e=S(r,"Connecting...")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function Fo(t){let e;return{c(){e=L("Connect")},l(r){e=S(r,"Connect")},m(r,o){N(r,e,o)},d(r){r&&m(e)}}}function Do(t){let e,r,o,n;const l=[So,Lo,Ro],a=[];function i(c,f){return c[0]=="DISCONNECTED"?0:c[0]=="CONNECTING"?1:c[0]=="CONNECTED"?2:-1}return~(r=i(t))&&(o=a[r]=l[r](t)),{c(){e=G("div"),o&&o.c(),this.h()},l(c){e=U(c,"DIV",{class:!0});var f=D(e);o&&o.l(f),f.forEach(m),this.h()},h(){R(e,"class","p-8")},m(c,f){N(c,e,f),~r&&a[r].m(e,null),n=!0},p(c,[f]){let g=r;r=i(c),r!==g&&(o&&(te(),w(a[g],1,1,()=>{a[g]=null}),oe()),~r?(o=a[r],o||(o=a[r]=l[r](c),o.c()),_(o,1),o.m(e,null)):o=null)},i(c){n||(_(o),n=!0)},o(c){w(o),n=!1},d(c){c&&m(e),~r&&a[r].d()}}}function zo(t,e,r){let o,n;$e(t,Se,a=>r(1,o=a)),$e(t,Ne,a=>r(0,n=a));const l=()=>{Yr()};return t.$$.update=()=>{t.$$.dirty&2&&console.log(o)},[n,o,l]}class Wo extends ue{constructor(e){super(),de(this,e,zo,Do,ae,{})}}export{Wo as component,$o as universal};