Files
Trackeep/static/assets/index-0VyYz8R-.js
T
Tomas Dvorak d27cf14110 first test
2026-02-08 14:14:55 +01:00

6 lines
47 KiB
JavaScript

(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(s){if(s.ep)return;s.ep=!0;const l=r(s);fetch(s.href,l)}})();const Rt=!1,Ot=(e,t)=>e===t,nt=Symbol("solid-proxy"),Dt=typeof Proxy=="function",Mt=Symbol("solid-track"),qe={equals:Ot};let $t=Et;const ue=1,Be=2,wt={owned:null,cleanups:null,context:null,owner:null};var m=null;let et=null,Nt=null,C=null,q=null,le=null,He=0;function Fe(e,t){const r=C,n=m,s=e.length===0,l=t===void 0?n:t,o=s?wt:{owned:null,cleanups:null,context:l?l.context:null,owner:l},i=s?e:()=>e(()=>ee(()=>Ee(o)));m=o,C=null;try{return ye(i,!0)}finally{C=r,m=n}}function k(e,t){t=t?Object.assign({},qe,t):qe;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=s=>(typeof s=="function"&&(s=s(r.value)),kt(r,s));return[St.bind(r),n]}function P(e,t,r){const n=at(e,t,!1,ue);Ae(n)}function Ut(e,t,r){$t=Ht;const n=at(e,t,!1,ue);n.user=!0,le?le.push(n):Ae(n)}function J(e,t,r){r=r?Object.assign({},qe,r):qe;const n=at(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,Ae(n),St.bind(n)}function ee(e){if(C===null)return e();const t=C;C=null;try{return e()}finally{C=t}}function Ft(e,t,r){const n=Array.isArray(e);let s;return l=>{let o;if(n){o=Array(e.length);for(let a=0;a<e.length;a++)o[a]=e[a]()}else o=e();const i=ee(()=>t(o,s,l));return s=o,i}}function lt(e){Ut(()=>ee(e))}function ot(e){return m===null||(m.cleanups===null?m.cleanups=[e]:m.cleanups.push(e)),e}function qt(){return m}function Bt(e,t){const r=m,n=C;m=e,C=null;try{return ye(t,!0)}catch(s){ct(s)}finally{m=r,C=n}}function Kt(e){const t=C,r=m;return Promise.resolve().then(()=>{C=t,m=r;let n;return ye(e,!1),C=m=null,n?n.done:void 0})}const[Wr,Yr]=k(!1);function _t(e,t){const r=Symbol("context");return{id:r,Provider:Jt(r),defaultValue:e}}function Vt(e){let t;return m&&m.context&&(t=m.context[e.id])!==void 0?t:e.defaultValue}function Ct(e){const t=J(e),r=J(()=>st(t()));return r.toArray=()=>{const n=r();return Array.isArray(n)?n:n!=null?[n]:[]},r}function St(){if(this.sources&&this.state)if(this.state===ue)Ae(this);else{const e=q;q=null,ye(()=>Ve(this),!1),q=e}if(C){const e=this.observers?this.observers.length:0;C.sources?(C.sources.push(this),C.sourceSlots.push(e)):(C.sources=[this],C.sourceSlots=[e]),this.observers?(this.observers.push(C),this.observerSlots.push(C.sources.length-1)):(this.observers=[C],this.observerSlots=[C.sources.length-1])}return this.value}function kt(e,t,r){let n=e.value;return(!e.comparator||!e.comparator(n,t))&&(e.value=t,e.observers&&e.observers.length&&ye(()=>{for(let s=0;s<e.observers.length;s+=1){const l=e.observers[s],o=et&&et.running;o&&et.disposed.has(l),(o?!l.tState:!l.state)&&(l.pure?q.push(l):le.push(l),l.observers&&At(l)),o||(l.state=ue)}if(q.length>1e6)throw q=[],new Error},!1)),t}function Ae(e){if(!e.fn)return;Ee(e);const t=He;zt(e,e.value,t)}function zt(e,t,r){let n;const s=m,l=C;C=m=e;try{n=e.fn(t)}catch(o){return e.pure&&(e.state=ue,e.owned&&e.owned.forEach(Ee),e.owned=null),e.updatedAt=r+1,ct(o)}finally{C=l,m=s}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?kt(e,n):e.value=n,e.updatedAt=r)}function at(e,t,r,n=ue,s){const l={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:m,context:m?m.context:null,pure:r};return m===null||m!==wt&&(m.owned?m.owned.push(l):m.owned=[l]),l}function Ke(e){if(e.state===0)return;if(e.state===Be)return Ve(e);if(e.suspense&&ee(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<He);)e.state&&t.push(e);for(let r=t.length-1;r>=0;r--)if(e=t[r],e.state===ue)Ae(e);else if(e.state===Be){const n=q;q=null,ye(()=>Ve(e,t[0]),!1),q=n}}function ye(e,t){if(q)return e();let r=!1;t||(q=[]),le?r=!0:le=[],He++;try{const n=e();return Gt(r),n}catch(n){r||(le=null),q=null,ct(n)}}function Gt(e){if(q&&(Et(q),q=null),e)return;const t=le;le=null,t.length&&ye(()=>$t(t),!1)}function Et(e){for(let t=0;t<e.length;t++)Ke(e[t])}function Ht(e){let t,r=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[r++]=n:Ke(n)}for(t=0;t<r;t++)Ke(e[t])}function Ve(e,t){e.state=0;for(let r=0;r<e.sources.length;r+=1){const n=e.sources[r];if(n.sources){const s=n.state;s===ue?n!==t&&(!n.updatedAt||n.updatedAt<He)&&Ke(n):s===Be&&Ve(n,t)}}}function At(e){for(let t=0;t<e.observers.length;t+=1){const r=e.observers[t];r.state||(r.state=Be,r.pure?q.push(r):le.push(r),r.observers&&At(r))}}function Ee(e){let t;if(e.sources)for(;e.sources.length;){const r=e.sources.pop(),n=e.sourceSlots.pop(),s=r.observers;if(s&&s.length){const l=s.pop(),o=r.observerSlots.pop();n<s.length&&(l.sourceSlots[o]=n,s[n]=l,r.observerSlots[n]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ee(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Xt(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function ct(e,t=m){throw Xt(e)}function st(e){if(typeof e=="function"&&!e.length)return st(e());if(Array.isArray(e)){const t=[];for(let r=0;r<e.length;r++){const n=st(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function Jt(e,t){return function(n){let s;return P(()=>s=ee(()=>(m.context={...m.context,[e]:n.value},Ct(()=>n.children))),void 0),s}}const Wt=Symbol("fallback");function gt(e){for(let t=0;t<e.length;t++)e[t]()}function Yt(e,t,r={}){let n=[],s=[],l=[],o=0,i=t.length>1?[]:null;return ot(()=>gt(l)),()=>{let a=e()||[],f=a.length,u,c;return a[Mt],ee(()=>{let _,M,O,E,L,j,p,x,y;if(f===0)o!==0&&(gt(l),l=[],n=[],s=[],o=0,i&&(i=[])),r.fallback&&(n=[Wt],s[0]=Fe(N=>(l[0]=N,r.fallback())),o=1);else if(o===0){for(s=new Array(f),c=0;c<f;c++)n[c]=a[c],s[c]=Fe(w);o=f}else{for(O=new Array(f),E=new Array(f),i&&(L=new Array(f)),j=0,p=Math.min(o,f);j<p&&n[j]===a[j];j++);for(p=o-1,x=f-1;p>=j&&x>=j&&n[p]===a[x];p--,x--)O[x]=s[p],E[x]=l[p],i&&(L[x]=i[p]);for(_=new Map,M=new Array(x+1),c=x;c>=j;c--)y=a[c],u=_.get(y),M[c]=u===void 0?-1:u,_.set(y,c);for(u=j;u<=p;u++)y=n[u],c=_.get(y),c!==void 0&&c!==-1?(O[c]=s[u],E[c]=l[u],i&&(L[c]=i[u]),c=M[c],_.set(y,c)):l[u]();for(c=j;c<f;c++)c in O?(s[c]=O[c],l[c]=E[c],i&&(i[c]=L[c],i[c](c))):s[c]=Fe(w);s=s.slice(0,o=f),n=a.slice(0)}return s});function w(_){if(l[c]=_,i){const[M,O]=k(c);return i[c]=O,t(a[c],M)}return t(a[c])}}}function S(e,t){return ee(()=>e(t||{}))}function Ne(){return!0}const Qt={get(e,t,r){return t===nt?r:e.get(t)},has(e,t){return t===nt?!0:e.has(t)},set:Ne,deleteProperty:Ne,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Ne,deleteProperty:Ne}},ownKeys(e){return e.keys()}};function tt(e){return(e=typeof e=="function"?e():e)?e:{}}function Zt(){for(let e=0,t=this.length;e<t;++e){const r=this[e]();if(r!==void 0)return r}}function er(...e){let t=!1;for(let o=0;o<e.length;o++){const i=e[o];t=t||!!i&&nt in i,e[o]=typeof i=="function"?(t=!0,J(i)):i}if(Dt&&t)return new Proxy({get(o){for(let i=e.length-1;i>=0;i--){const a=tt(e[i])[o];if(a!==void 0)return a}},has(o){for(let i=e.length-1;i>=0;i--)if(o in tt(e[i]))return!0;return!1},keys(){const o=[];for(let i=0;i<e.length;i++)o.push(...Object.keys(tt(e[i])));return[...new Set(o)]}},Qt);const r={},n=Object.create(null);for(let o=e.length-1;o>=0;o--){const i=e[o];if(!i)continue;const a=Object.getOwnPropertyNames(i);for(let f=a.length-1;f>=0;f--){const u=a[f];if(u==="__proto__"||u==="constructor")continue;const c=Object.getOwnPropertyDescriptor(i,u);if(!n[u])n[u]=c.get?{enumerable:!0,configurable:!0,get:Zt.bind(r[u]=[c.get.bind(i)])}:c.value!==void 0?c:void 0;else{const w=r[u];w&&(c.get?w.push(c.get.bind(i)):c.value!==void 0&&w.push(()=>c.value))}}}const s={},l=Object.keys(n);for(let o=l.length-1;o>=0;o--){const i=l[o],a=n[i];a&&a.get?Object.defineProperty(s,i,a):s[i]=a?a.value:void 0}return s}const tr=e=>`Stale read from <${e}>.`;function de(e){const t="fallback"in e&&{fallback:()=>e.fallback};return J(Yt(()=>e.each,e.children,t||void 0))}function re(e){const t=e.keyed,r=J(()=>e.when,void 0,void 0),n=t?r:J(r,void 0,{equals:(s,l)=>!s==!l});return J(()=>{const s=n();if(s){const l=e.children;return typeof l=="function"&&l.length>0?ee(()=>l(t?s:()=>{if(!ee(n))throw tr("Show");return r()})):l}return e.fallback},void 0,void 0)}function rr(e,t,r){let n=r.length,s=t.length,l=n,o=0,i=0,a=t[s-1].nextSibling,f=null;for(;o<s||i<l;){if(t[o]===r[i]){o++,i++;continue}for(;t[s-1]===r[l-1];)s--,l--;if(s===o){const u=l<n?i?r[i-1].nextSibling:r[l-i]:a;for(;i<l;)e.insertBefore(r[i++],u)}else if(l===i)for(;o<s;)(!f||!f.has(t[o]))&&t[o].remove(),o++;else if(t[o]===r[l-1]&&r[i]===t[s-1]){const u=t[--s].nextSibling;e.insertBefore(r[i++],t[o++].nextSibling),e.insertBefore(r[--l],u),t[s]=r[l]}else{if(!f){f=new Map;let c=i;for(;c<l;)f.set(r[c],c++)}const u=f.get(t[o]);if(u!=null)if(i<u&&u<l){let c=o,w=1,_;for(;++c<s&&c<l&&!((_=f.get(t[c]))==null||_!==u+w);)w++;if(w>u-i){const M=t[o];for(;i<u;)e.insertBefore(r[i++],M)}else e.replaceChild(r[i++],t[o++])}else o++;else t[o++].remove()}}}const ht="_$DX_DELEGATE";function nr(e,t,r,n={}){let s;return Fe(l=>{s=l,t===document?e():h(t,e(),t.firstChild?null:void 0,r)},n.owner),()=>{s(),t.textContent=""}}function T(e,t,r,n){let s;const l=()=>{const i=document.createElement("template");return i.innerHTML=e,i.content.firstChild},o=()=>(s||(s=l())).cloneNode(!0);return o.cloneNode=o,o}function Xe(e,t=window.document){const r=t[ht]||(t[ht]=new Set);for(let n=0,s=e.length;n<s;n++){const l=e[n];r.has(l)||(r.add(l),t.addEventListener(l,ir))}}function sr(e,t,r){r==null?e.removeAttribute(t):e.setAttribute(t,r)}function ze(e,t){t==null?e.removeAttribute("class"):e.className=t}function h(e,t,r,n){if(r!==void 0&&!n&&(n=[]),typeof t!="function")return Ge(e,t,n,r);P(s=>Ge(e,t(),s,r),n)}function ir(e){let t=e.target;const r=`$$${e.type}`,n=e.target,s=e.currentTarget,l=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),o=()=>{const a=t[r];if(a&&!t.disabled){const f=t[`${r}Data`];if(f!==void 0?a.call(t,f,e):a.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&l(t.host),!0},i=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),e.composedPath){const a=e.composedPath();l(a[0]);for(let f=0;f<a.length-2&&(t=a[f],!!o());f++){if(t._$host){t=t._$host,i();break}if(t.parentNode===s)break}}else i();l(n)}function Ge(e,t,r,n,s){for(;typeof r=="function";)r=r();if(t===r)return r;const l=typeof t,o=n!==void 0;if(e=o&&r[0]&&r[0].parentNode||e,l==="string"||l==="number"){if(l==="number"&&(t=t.toString(),t===r))return r;if(o){let i=r[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),r=Se(e,r,n,i)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||l==="boolean")r=Se(e,r,n);else{if(l==="function")return P(()=>{let i=t();for(;typeof i=="function";)i=i();r=Ge(e,i,r,n)}),()=>r;if(Array.isArray(t)){const i=[],a=r&&Array.isArray(r);if(it(i,t,r,s))return P(()=>r=Ge(e,i,r,n,!0)),()=>r;if(i.length===0){if(r=Se(e,r,n),o)return r}else a?r.length===0?pt(e,i,n):rr(e,r,i):(r&&Se(e),pt(e,i));r=i}else if(t.nodeType){if(Array.isArray(r)){if(o)return r=Se(e,r,n,t);Se(e,r,null,t)}else r==null||r===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);r=t}}return r}function it(e,t,r,n){let s=!1;for(let l=0,o=t.length;l<o;l++){let i=t[l],a=r&&r[e.length],f;if(!(i==null||i===!0||i===!1))if((f=typeof i)=="object"&&i.nodeType)e.push(i);else if(Array.isArray(i))s=it(e,i,a)||s;else if(f==="function")if(n){for(;typeof i=="function";)i=i();s=it(e,Array.isArray(i)?i:[i],Array.isArray(a)?a:[a])||s}else e.push(i),s=!0;else{const u=String(i);a&&a.nodeType===3&&a.data===u?e.push(a):e.push(document.createTextNode(u))}}return s}function pt(e,t,r=null){for(let n=0,s=t.length;n<s;n++)e.insertBefore(t[n],r)}function Se(e,t,r,n){if(r===void 0)return e.textContent="";const s=n||document.createTextNode("");if(t.length){let l=!1;for(let o=t.length-1;o>=0;o--){const i=t[o];if(s!==i){const a=i.parentNode===e;!l&&!o?a?e.replaceChild(s,i):e.insertBefore(s,r):a&&i.remove()}else l=!0}}else e.insertBefore(s,r);return[s]}const lr=!1;function or(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function ar([e,t],r,n){return[e,n?s=>t(n(s)):t]}function cr(e){if(e==="#")return null;try{return document.querySelector(e)}catch{return null}}function dr(e,t){const r=cr(`#${e}`);r?r.scrollIntoView():t&&window.scrollTo(0,0)}function ur(e,t,r,n){let s=!1;const l=i=>typeof i=="string"?{value:i}:i,o=ar(k(l(e()),{equals:(i,a)=>i.value===a.value}),void 0,i=>(!s&&t(i),i));return r&&ot(r((i=e())=>{s=!0,o[1](l(i)),s=!1})),{signal:o,utils:n}}function fr(e){if(e){if(Array.isArray(e))return{signal:e}}else return{signal:k({value:""})};return e}function gr(){return ur(()=>({value:window.location.pathname+window.location.search+window.location.hash,state:history.state}),({value:e,replace:t,scroll:r,state:n})=>{t?window.history.replaceState(n,"",e):window.history.pushState(n,"",e),dr(window.location.hash.slice(1),r)},e=>or(window,"popstate",()=>e()),{go:e=>window.history.go(e)})}function hr(){let e=new Set;function t(s){return e.add(s),()=>e.delete(s)}let r=!1;function n(s,l){if(r)return!(r=!1);const o={to:s,options:l,defaultPrevented:!1,preventDefault:()=>o.defaultPrevented=!0};for(const i of e)i.listener({...o,from:i.location,retry:a=>{a&&(r=!0),i.navigate(s,l)}});return!o.defaultPrevented}return{subscribe:t,confirm:n}}const pr=/^(?:[a-z0-9]+:)?\/\//i,br=/^\/+|(\/)\/+$/g;function bt(e,t=!1){const r=e.replace(br,"$1");return r?t||/^[?#]/.test(r)?r:"/"+r:""}function rt(e,t,r){if(pr.test(t))return;const n=bt(e);let s="";return s=n,(s||"/")+bt(t,!s)}function xr(e){const t={};return e.searchParams.forEach((r,n)=>{t[n]=r}),t}function vr(e){const t=new Map,r=qt();return new Proxy({},{get(n,s){return t.has(s)||Bt(r,()=>t.set(s,J(()=>e()[s]))),t.get(s)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())}})}const yr=100,mr=_t(),$r=_t();let xt;function wr(e,t){const r=new URL("http://sar"),n=J(a=>{const f=e();try{return new URL(f,r)}catch{return console.error(`Invalid path ${f}`),a}},r,{equals:(a,f)=>a.href===f.href}),s=J(()=>n().pathname),l=J(()=>n().search,!0),o=J(()=>n().hash),i=J(()=>"");return{get pathname(){return s()},get search(){return l()},get hash(){return o()},get state(){return t()},get key(){return i()},query:vr(Ft(l,()=>xr(n())))}}function _r(e,t="",r,n){const{signal:[s,l],utils:o={}}=fr(e),i=o.parsePath||(v=>v),a=o.renderPath||(v=>v),f=o.beforeLeave||hr(),u=rt("",t),c=void 0;if(u===void 0)throw new Error(`${u} is not a valid base path`);u&&!s().value&&l({value:u,replace:!0,scroll:!1});const[w,_]=k(!1),M=async v=>{_(!0);try{await Kt(v)}finally{_(!1)}},[O,E]=k(s().value),[L,j]=k(s().state),p=wr(O,L),x=[],y={pattern:u,params:{},path:()=>u,outlet:()=>null,resolvePath(v){return rt(u,v)}};if(r)try{xt=y,y.data=r({data:void 0,params:{},location:p,navigate:oe(y)})}finally{xt=void 0}function N(v,g,$){ee(()=>{if(typeof g=="number"){g&&(o.go?f.confirm(g,$)&&o.go(g):console.warn("Router integration does not support relative routing"));return}const{replace:B,resolve:W,scroll:D,state:U}={replace:!1,resolve:!0,scroll:!0,...$},d=W?v.resolvePath(g):rt("",g);if(d===void 0)throw new Error(`Path '${g}' is not a routable path`);if(x.length>=yr)throw new Error("Too many redirects");const b=O();if((d!==b||U!==L())&&!lr){if(f.confirm(d,$)){const I=x.push({value:b,replace:B,scroll:D,state:L()});M(()=>{E(d),j(U)}).then(()=>{x.length===I&&ne({value:d,state:U})})}}})}function oe(v){return v=v||Vt($r)||y,(g,$)=>N(v,g,$)}function ne(v){const g=x[0];g&&((v.value!==g.value||v.state!==g.state)&&l({...v,replace:g.replace,scroll:g.scroll}),x.length=0)}P(()=>{const{value:v,state:g}=s();ee(()=>{v!==O()&&M(()=>{E(v),j(g)})})});{let v=function(g){if(g.defaultPrevented||g.button!==0||g.metaKey||g.altKey||g.ctrlKey||g.shiftKey)return;const $=g.composedPath().find(b=>b instanceof Node&&b.nodeName.toUpperCase()==="A");if(!$||!$.hasAttribute("link"))return;const B=$.href;if($.target||!B&&!$.hasAttribute("state"))return;const W=($.getAttribute("rel")||"").split(/\s+/);if($.hasAttribute("download")||W&&W.includes("external"))return;const D=new URL(B);if(D.origin!==window.location.origin||u&&D.pathname&&!D.pathname.toLowerCase().startsWith(u.toLowerCase()))return;const U=i(D.pathname+D.search+D.hash),d=$.getAttribute("state");g.preventDefault(),N(y,U,{resolve:!1,replace:$.hasAttribute("replace"),scroll:!$.hasAttribute("noscroll"),state:d&&JSON.parse(d)})};var me=v;Xe(["click"]),document.addEventListener("click",v),ot(()=>document.removeEventListener("click",v))}return{base:y,out:c,location:p,isRouting:w,renderPath:a,parsePath:i,navigatorFactory:oe,beforeLeave:f}}const Tt=e=>{const{source:t,url:r,base:n,data:s,out:l}=e,o=t||gr(),i=_r(o,n,s);return S(mr.Provider,{value:i,get children(){return e.children}})},Ue=e=>{const t=Ct(()=>e.children);return er(e,{get children(){return t()}})};var Cr=T('<div class="text-center py-8 text-gray-500">Loading courses...'),Sr=T('<div class="text-center py-8 text-gray-500">Loading instances...'),kr=T('<div class="min-h-screen bg-gradient-to-br from-indigo-500 to-purple-600 p-6"><div class="max-w-7xl mx-auto"><header class="glass rounded-2xl p-6 mb-8 shadow-xl"><div class="flex justify-between items-center"><div class="flex items-center gap-3"><div class="w-10 h-10 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl flex items-center justify-center text-white font-bold">T</div><h1 class="text-2xl font-bold text-gray-900">Trackeep Controller</h1></div><nav class="flex gap-2"><a href=/dashboard class="px-4 py-2 rounded-lg bg-indigo-500 text-white hover:bg-indigo-600 transition-colors">Dashboard</a><a href=/dashboard/courses class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Courses</a><a href=/dashboard/instances class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Instances</a><a href=/api/v1/user/me class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Profile</a></nav></div></header><div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8"><div class="glass rounded-xl p-6 shadow-lg hover:shadow-xl transition-all duration-300"><div class="w-12 h-12 bg-gradient-to-r from-blue-500 to-blue-600 rounded-lg flex items-center justify-center text-white text-xl mb-4">👥</div><div class="text-3xl font-bold text-gray-900 mb-2"></div><div class="text-gray-600 font-medium">Total Users</div></div><div class="glass rounded-xl p-6 shadow-lg hover:shadow-xl transition-all duration-300"><div class="w-12 h-12 bg-gradient-to-r from-green-500 to-green-600 rounded-lg flex items-center justify-center text-white text-xl mb-4">📚</div><div class="text-3xl font-bold text-gray-900 mb-2"></div><div class="text-gray-600 font-medium">Active Courses</div></div><div class="glass rounded-xl p-6 shadow-lg hover:shadow-xl transition-all duration-300"><div class="w-12 h-12 bg-gradient-to-r from-purple-500 to-purple-600 rounded-lg flex items-center justify-center text-white text-xl mb-4">🖥️</div><div class="text-3xl font-bold text-gray-900 mb-2"></div><div class="text-gray-600 font-medium">Connected Instances</div></div><div class="glass rounded-xl p-6 shadow-lg hover:shadow-xl transition-all duration-300"><div class="w-12 h-12 bg-gradient-to-r from-orange-500 to-orange-600 rounded-lg flex items-center justify-center text-white text-xl mb-4">📈</div><div class="text-3xl font-bold text-gray-900 mb-2"></div><div class="text-gray-600 font-medium">Learning Progress</div></div></div><div class="grid grid-cols-1 lg:grid-cols-3 gap-8"><div class=lg:col-span-2><div class="glass rounded-2xl p-6 shadow-xl"><div class="flex justify-between items-center mb-6"><h2 class="text-xl font-semibold text-gray-900">Recent Courses</h2><a href=/dashboard/courses class="px-4 py-2 bg-indigo-500 text-white rounded-lg hover:bg-indigo-600 transition-colors">Manage Courses</a></div></div></div><div><div class="glass rounded-2xl p-6 shadow-xl"><div class="flex justify-between items-center mb-6"><h2 class="text-xl font-semibold text-gray-900">Active Instances</h2><a href=/dashboard/instances class="text-indigo-600 hover:text-indigo-700 text-sm font-medium">View All'),Er=T("<div class=space-y-4>"),Ar=T('<div class="text-center py-12 text-gray-500"><div class="text-5xl mb-4 opacity-50">📚</div><div class="text-lg font-semibold mb-2">No courses yet</div><p>Create your first course to get started!'),Tr=T('<div class="flex items-center gap-4 p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors"><div class="w-12 h-12 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-lg flex items-center justify-center text-white font-bold"></div><div class=flex-1><div class="font-medium text-gray-900"></div><div class="text-sm text-gray-600"> • <!> • <!>h</div></div><div class="flex gap-2"><button class="p-2 text-gray-600 hover:text-indigo-600 transition-colors"title=View>👁️</button><button class="p-2 text-gray-600 hover:text-indigo-600 transition-colors"title=Edit>✏️'),Pr=T("<div class=space-y-3>"),Ir=T('<div class="text-center py-12 text-gray-500"><div class="text-5xl mb-4 opacity-50">🖥️</div><div class="text-lg font-semibold mb-2">No instances</div><p>Register your first instance to get started!'),jr=T('<div class="flex items-center gap-3 p-3 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors"><div></div><div class=flex-1><div class="font-medium text-gray-900"></div><div class="text-sm text-gray-600"></div></div><button class="p-2 text-gray-600 hover:text-indigo-600 transition-colors"title=View>🔗');const vt=()=>{const[e,t]=k({total_users:0,total_courses:0,total_instances:0,active_courses:0,total_progress:0}),[r,n]=k([]),[s,l]=k([]),[o,i]=k(!0);lt(async()=>{await Promise.all([a(),f(),u()]),i(!1)});const a=async()=>{try{const w=await(await fetch("/api/v1/dashboard/stats")).json();t(w)}catch(c){console.error("Error loading stats:",c)}},f=async()=>{try{const w=await(await fetch("/api/v1/dashboard/courses")).json();n(w.courses||[])}catch(c){console.error("Error loading courses:",c)}},u=async()=>{try{const w=await(await fetch("/api/v1/instances")).json();l(w.instances||[])}catch(c){console.error("Error loading instances:",c)}};return(()=>{var c=kr(),w=c.firstChild,_=w.firstChild,M=_.nextSibling,O=M.firstChild,E=O.firstChild,L=E.nextSibling,j=O.nextSibling,p=j.firstChild,x=p.nextSibling,y=j.nextSibling,N=y.firstChild,oe=N.nextSibling,ne=y.nextSibling,me=ne.firstChild,v=me.nextSibling,g=M.nextSibling,$=g.firstChild,B=$.firstChild;B.firstChild;var W=$.nextSibling,D=W.firstChild;return D.firstChild,h(L,()=>e().total_users),h(x,()=>e().active_courses),h(oe,()=>e().total_instances),h(v,()=>e().total_progress),h(B,S(re,{get when(){return o()},get fallback(){return S(re,{get when(){return r().length>0},get fallback(){return Ar()},get children(){var U=Er();return h(U,S(de,{get each(){return r().slice(0,5)},children:d=>(()=>{var b=Tr(),I=b.firstChild,R=I.nextSibling,K=R.firstChild,H=K.nextSibling,Z=H.firstChild,X=Z.nextSibling,F=X.nextSibling,V=F.nextSibling;V.nextSibling;var Y=R.nextSibling,z=Y.firstChild,ae=z.nextSibling;return h(I,()=>d.title.charAt(0).toUpperCase()),h(K,()=>d.title),h(H,()=>d.category,Z),h(H,()=>d.difficulty,X),h(H,()=>d.duration,V),z.$$click=()=>window.open(`/api/v1/courses/${d.id}`,"_blank"),ae.$$click=()=>window.location.href=`/dashboard/courses?edit=${d.id}`,b})()})),U}})},get children(){return Cr()}}),null),h(D,S(re,{get when(){return o()},get fallback(){return S(re,{get when(){return s().length>0},get fallback(){return Ir()},get children(){var U=Pr();return h(U,S(de,{get each(){return s().slice(0,3)},children:d=>(()=>{var b=jr(),I=b.firstChild,R=I.nextSibling,K=R.firstChild,H=K.nextSibling,Z=R.nextSibling;return h(K,()=>d.name),h(H,()=>d.version),Z.$$click=()=>window.open(`/api/v1/instances/${d.id}`,"_blank"),P(()=>ze(I,`w-2 h-2 rounded-full ${d.is_active?"bg-green-500":"bg-red-500"}`)),b})()})),U}})},get children(){return Sr()}}),null),c})()};Xe(["click"]);var Lr=T('<div class="text-center py-8 text-gray-500">Loading courses...'),Rr=T('<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"><div class="bg-white rounded-2xl p-8 max-w-4xl w-full max-h-[90vh] overflow-y-auto"><div class="flex justify-between items-center mb-6"><h3 class="text-2xl font-semibold text-gray-900"></h3><button class="text-gray-500 hover:text-gray-700 text-2xl font-bold">&times;</button></div><div class=space-y-6><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label class="block text-sm font-medium text-gray-700 mb-2">Course Title *</label><input type=text placeholder="Course Title"class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Category *</label><select class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required><option value>Select Category</option></select></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Difficulty *</label><select class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required><option value>Select Difficulty</option><option value=beginner>Beginner</option><option value=intermediate>Intermediate</option><option value=advanced>Advanced</option></select></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Duration (hours) *</label><input type=number min=1 class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required></div></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Description *</label><textarea placeholder="Course description"rows=4 class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required></textarea></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Tags (press Enter to add)</label><div class="flex flex-wrap gap-2 p-3 border-2 border-gray-200 rounded-lg min-h-[50px] cursor-text"><input type=text placeholder="Add tags..."class="border-none outline-none flex-1 min-w-[100px] p-1"></div></div><div><div class="flex justify-between items-center mb-4"><h4 class="text-lg font-medium text-gray-900">Course Resources</h4><button type=button class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"><span>+</span> Add Resource</button></div><div class=space-y-3></div></div><div class="flex gap-3 justify-end"><button type=button class="px-6 py-3 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors">Cancel</button><button type=button class="px-6 py-3 bg-indigo-500 text-white rounded-lg hover:bg-indigo-600 transition-colors">Save Course'),Or=T('<div class="min-h-screen bg-gradient-to-br from-indigo-500 to-purple-600 p-6"><div class="max-w-7xl mx-auto"><header class="bg-white/95 backdrop-blur-sm rounded-2xl p-6 mb-8 shadow-xl"><div class="flex justify-between items-center"><div class="flex items-center gap-3"><div class="w-10 h-10 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl flex items-center justify-center text-white font-bold">T</div><h1 class="text-2xl font-bold text-gray-900">Trackeep Controller</h1></div><nav class="flex gap-2"><a href=/dashboard class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Dashboard</a><a href=/dashboard/courses class="px-4 py-2 rounded-lg bg-indigo-500 text-white hover:bg-indigo-600 transition-colors">Courses</a><a href=/dashboard/instances class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Instances</a><a href=/api/v1/user/me class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Profile</a></nav></div></header><div class="bg-white/95 backdrop-blur-sm rounded-2xl p-6 mb-8 shadow-xl"><div class="flex justify-between items-center mb-6"><h2 class="text-2xl font-semibold text-gray-900">Course Management</h2><button class="px-6 py-3 bg-indigo-500 text-white rounded-lg hover:bg-indigo-600 transition-colors flex items-center gap-2"><span>+</span> Create New Course'),Dr=T('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">'),Mr=T('<div class="text-center py-16 text-gray-500"><div class="text-6xl mb-4 opacity-50">📚</div><div class="text-xl font-semibold mb-2">No courses yet</div><p>Create your first learning course to get started!'),Nr=T('<div class="bg-white rounded-xl shadow-lg hover:shadow-xl transition-all duration-300 overflow-hidden group"><div class="h-48 bg-gradient-to-r from-indigo-500 to-purple-600 relative"><div class="absolute inset-0 flex items-center justify-center text-white text-5xl font-bold"></div><div class="absolute top-4 right-4 bg-white/90 backdrop-blur-sm px-3 py-1 rounded-full text-sm font-semibold text-gray-900">FREE</div></div><div class=p-6><h3 class="text-lg font-semibold text-gray-900 mb-2"></h3><p class="text-gray-600 text-sm mb-4 line-clamp-2"></p><div class="flex justify-between items-center mb-4 text-sm text-gray-500"><span></span><span></span><span>h</span></div><div class="flex gap-2"><button class="flex-1 px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors text-sm">👁️ View</button><button class="flex-1 px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors text-sm">✏️ Edit</button><button class="flex-1 px-3 py-2 border border-red-300 text-red-600 rounded-lg hover:bg-red-50 transition-colors text-sm">🗑️ Delete'),yt=T("<option>"),Ur=T('<span class="bg-indigo-500 text-white px-2 py-1 rounded-md text-sm flex items-center gap-1"><button type=button class=font-bold>&times;'),Fr=T('<div class="flex items-center gap-3 p-3 bg-gray-50 rounded-lg"><div class="flex-1 space-y-2"><input type=text placeholder="Resource Title"class="w-full p-2 border border-gray-200 rounded-md"><div class="flex gap-2"><select class="p-2 border border-gray-200 rounded-md"></select><input type=url placeholder=URL class="flex-1 p-2 border border-gray-200 rounded-md"><input type=number placeholder="Duration (min)"class="w-24 p-2 border border-gray-200 rounded-md"></div></div><button type=button class="px-3 py-2 border border-red-300 text-red-600 rounded-lg hover:bg-red-50">&times;');const qr=()=>{const[e,t]=k([]),[r,n]=k([]),[s,l]=k(!0),[o,i]=k(!1),[a,f]=k(null),[u,c]=k([]),[w,_]=k([]),[M,O]=k(""),[E,L]=k({title:"",category:"",difficulty:"",duration:"",description:""}),j=["programming","design","business","marketing","data-science","web-development","mobile-development","devops","other"],p=[{value:"youtube",label:"YouTube",color:"#ff0000"},{value:"ztm",label:"ZTM",color:"#3b82f6"},{value:"github",label:"GitHub",color:"#333"},{value:"fireship",label:"Fireship",color:"#f59e0b"},{value:"link",label:"Link",color:"#6b7280"}];lt(async()=>{await x(),await y()});const x=async()=>{try{const b=await(await fetch("/api/v1/courses")).json();t(b.courses||[])}catch(d){console.error("Error loading courses:",d)}finally{l(!1)}},y=async()=>{try{const b=await(await fetch("/api/v1/instances")).json();n(b.instances||[])}catch(d){console.error("Error loading instances:",d)}},N=()=>{f(null),L({title:"",category:"",difficulty:"",duration:"",description:""}),c([]),_([]),i(!0)},oe=d=>{f(d),L({title:d.title,category:d.category,difficulty:d.difficulty,duration:d.duration.toString(),description:d.description}),c(d.tags||[]),_(d.resources||[]),i(!0)},ne=()=>{i(!1),f(null),c([]),_([])},me=d=>{if(d.key==="Enter"){d.preventDefault();const b=M().trim();b&&!u().includes(b)&&(c([...u(),b]),O(""))}},v=d=>{c(u().filter(b=>b!==d))},g=()=>{var d;_([...w(),{id:Date.now(),course_id:((d=a())==null?void 0:d.id)||0,title:"",type:"link",url:"",description:"",duration:0,order:w().length+1,is_required:!1}])},$=(d,b,I)=>{const R=[...w()];R[d]={...R[d],[b]:I},_(R)},B=d=>{_(w().filter((b,I)=>I!==d))},W=async()=>{try{const d={...E(),duration:parseInt(E().duration),tags:u(),resources:w()},b=a()?`/api/v1/courses/${a().id}`:"/api/v1/courses",I=a()?"PUT":"POST",R=await fetch(b,{method:I,headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`},body:JSON.stringify(d)});if(R.ok)ne(),await x();else{const K=await R.json();alert("Error: "+(K.error||"Failed to save course"))}}catch(d){console.error("Error saving course:",d),alert("Error: Failed to save course")}},D=async d=>{if(confirm("Are you sure you want to delete this course?"))try{const b=await fetch(`/api/v1/courses/${d}`,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});if(b.ok)await x();else{const I=await b.json();alert("Error: "+(I.error||"Failed to delete course"))}}catch(b){console.error("Error deleting course:",b),alert("Error: Failed to delete course")}},U=d=>{switch(d){case"beginner":return"bg-green-100 text-green-800";case"intermediate":return"bg-orange-100 text-orange-800";case"advanced":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return(()=>{var d=Or(),b=d.firstChild,I=b.firstChild,R=I.nextSibling,K=R.firstChild,H=K.firstChild,Z=H.nextSibling;return Z.$$click=N,h(R,S(re,{get when(){return s()},get fallback(){return S(re,{get when(){return e().length>0},get fallback(){return Mr()},get children(){var X=Dr();return h(X,S(de,{get each(){return e()},children:F=>(()=>{var V=Nr(),Y=V.firstChild,z=Y.firstChild,ae=Y.nextSibling,fe=ae.firstChild,ge=fe.nextSibling,$e=ge.nextSibling,he=$e.firstChild,se=he.nextSibling,pe=se.nextSibling,ce=pe.firstChild,we=$e.nextSibling,be=we.firstChild,xe=be.nextSibling,_e=xe.nextSibling;return h(z,()=>F.title.charAt(0).toUpperCase()),h(fe,()=>F.title),h(ge,()=>F.description),h(he,()=>F.category),h(se,()=>F.difficulty),h(pe,()=>F.duration,ce),be.$$click=()=>window.open(`/api/v1/courses/${F.id}`,"_blank"),xe.$$click=()=>oe(F),_e.$$click=()=>D(F.id),P(()=>ze(se,`px-2 py-1 rounded-full text-xs font-medium ${U(F.difficulty)}`)),V})()})),X}})},get children(){return Lr()}}),null),h(d,S(re,{get when(){return o()},get children(){var X=Rr(),F=X.firstChild,V=F.firstChild,Y=V.firstChild,z=Y.nextSibling,ae=V.nextSibling,fe=ae.firstChild,ge=fe.firstChild,$e=ge.firstChild,he=$e.nextSibling,se=ge.nextSibling,pe=se.firstChild,ce=pe.nextSibling;ce.firstChild;var we=se.nextSibling,be=we.firstChild,xe=be.nextSibling,_e=we.nextSibling,Te=_e.firstChild,Pe=Te.nextSibling,ke=fe.nextSibling,Je=ke.firstChild,Ie=Je.nextSibling,je=ke.nextSibling,We=je.firstChild,Ce=We.nextSibling,ve=Ce.firstChild,Le=je.nextSibling,Q=Le.firstChild,Re=Q.firstChild,Oe=Re.nextSibling,De=Q.nextSibling,Pt=Le.nextSibling,dt=Pt.firstChild,It=dt.nextSibling;return h(Y,()=>a()?"Edit Course":"Create New Course"),z.$$click=ne,he.$$input=A=>L({...E(),title:A.currentTarget.value}),ce.addEventListener("change",A=>L({...E(),category:A.currentTarget.value})),h(ce,S(de,{each:j,children:A=>(()=>{var G=yt();return G.value=A,h(G,A),G})()}),null),xe.addEventListener("change",A=>L({...E(),difficulty:A.currentTarget.value})),Pe.$$input=A=>L({...E(),duration:A.currentTarget.value}),Ie.$$input=A=>L({...E(),description:A.currentTarget.value}),Ce.$$click=A=>{const ie=A.currentTarget.querySelector("input");ie==null||ie.focus()},h(Ce,S(de,{get each(){return u()},children:A=>(()=>{var G=Ur(),ie=G.firstChild;return h(G,A,ie),ie.$$click=()=>v(A),G})()}),ve),ve.$$keydown=me,ve.$$input=A=>O(A.currentTarget.value),Oe.$$click=g,h(De,S(de,{get each(){return w()},children:(A,G)=>(()=>{var ie=Fr(),ut=ie.firstChild,Ye=ut.firstChild,jt=Ye.nextSibling,Me=jt.firstChild,Qe=Me.nextSibling,ft=Qe.nextSibling,Lt=ut.nextSibling;return Ye.$$input=te=>$(G(),"title",te.currentTarget.value),Me.addEventListener("change",te=>$(G(),"type",te.currentTarget.value)),h(Me,S(de,{each:p,children:te=>(()=>{var Ze=yt();return h(Ze,()=>te.label),P(()=>Ze.value=te.value),Ze})()})),Qe.$$input=te=>$(G(),"url",te.currentTarget.value),ft.$$input=te=>$(G(),"duration",parseInt(te.currentTarget.value)||0),Lt.$$click=()=>B(G()),P(()=>Ye.value=A.title),P(()=>Me.value=A.type),P(()=>Qe.value=A.url),P(()=>ft.value=A.duration),ie})()})),dt.$$click=ne,It.$$click=W,P(()=>he.value=E().title),P(()=>ce.value=E().category),P(()=>xe.value=E().difficulty),P(()=>Pe.value=E().duration),P(()=>Ie.value=E().description),P(()=>ve.value=M()),X}}),null),d})()};Xe(["click","input","keydown"]);var Br=T('<div class="text-center py-8 text-gray-500">Loading instances...'),Kr=T('<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"><div class="bg-white rounded-2xl p-8 max-w-md w-full"><div class="flex justify-between items-center mb-6"><h3 class="text-2xl font-semibold text-gray-900"></h3><button class="text-gray-500 hover:text-gray-700 text-2xl font-bold">&times;</button></div><div class=space-y-4><div><label class="block text-sm font-medium text-gray-700 mb-2">Instance Name *</label><input type=text placeholder="My Trackeep Instance"class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Instance URL *</label><input type=url placeholder=https://myapp.trackeep.com class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"required></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Version</label><input type=text placeholder=1.0.0 class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div></div><div class="flex gap-3 justify-end mt-6"><button type=button class="px-6 py-3 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors">Cancel</button><button type=button class="px-6 py-3 bg-indigo-500 text-white rounded-lg hover:bg-indigo-600 transition-colors">'),Vr=T('<div class="min-h-screen bg-gradient-to-br from-indigo-500 to-purple-600 p-6"><div class="max-w-7xl mx-auto"><header class="glass rounded-2xl p-6 mb-8 shadow-xl"><div class="flex justify-between items-center"><div class="flex items-center gap-3"><div class="w-10 h-10 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl flex items-center justify-center text-white font-bold">T</div><h1 class="text-2xl font-bold text-gray-900">Trackeep Controller</h1></div><nav class="flex gap-2"><a href=/dashboard class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Dashboard</a><a href=/dashboard/courses class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Courses</a><a href=/dashboard/instances class="px-4 py-2 rounded-lg bg-indigo-500 text-white hover:bg-indigo-600 transition-colors">Instances</a><a href=/api/v1/user/me class="px-4 py-2 rounded-lg bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors">Profile</a></nav></div></header><div class="glass rounded-2xl p-6 shadow-xl"><div class="flex justify-between items-center mb-6"><h2 class="text-2xl font-semibold text-gray-900">Instance Management</h2><button class="px-6 py-3 bg-indigo-500 text-white rounded-lg hover:bg-indigo-600 transition-colors flex items-center gap-2"><span>+</span> Register New Instance'),zr=T('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">'),Gr=T('<div class="text-center py-16 text-gray-500"><div class="text-6xl mb-4 opacity-50">🖥️</div><div class="text-xl font-semibold mb-2">No instances registered</div><p>Register your first Trackeep instance to get started!'),Hr=T('<div class="bg-white rounded-xl shadow-lg hover:shadow-xl transition-all duration-300 overflow-hidden relative"><div></div><div class=p-6><div class="flex justify-between items-start mb-4"><div class=flex-1><h3 class="text-lg font-semibold text-gray-900 mb-1"></h3><a target=_blank rel="noopener noreferrer"class="text-indigo-600 hover:text-indigo-700 text-sm mb-2 block"></a><div class="flex items-center gap-2 text-sm text-gray-600"><div></div><span></span></div></div></div><div class="grid grid-cols-2 gap-3 mb-4"><div><div class="text-xs text-gray-500 uppercase tracking-wide">Version</div><div class="text-sm font-medium text-gray-900"></div></div><div><div class="text-xs text-gray-500 uppercase tracking-wide">Created</div><div class="text-sm font-medium text-gray-900"></div></div><div><div class="text-xs text-gray-500 uppercase tracking-wide">Last Sync</div><div class="text-sm font-medium text-gray-900"></div></div><div><div class="text-xs text-gray-500 uppercase tracking-wide">Instance ID</div><div class="text-sm font-medium text-gray-900">#</div></div></div><div class="bg-gray-50 rounded-lg p-3 mb-4"><div class="text-xs text-gray-500 uppercase tracking-wide mb-1">API Key</div><div class="flex items-center gap-2"><input type=text readonly class="flex-1 text-xs font-mono bg-transparent border-none outline-none text-gray-600"><button class="px-2 py-1 bg-indigo-500 text-white text-xs rounded hover:bg-indigo-600 transition-colors">Copy</button></div></div><div class="grid grid-cols-3 gap-2 pt-4 border-t border-gray-200"><div class=text-center><div class="text-lg font-semibold text-indigo-600"></div><div class="text-xs text-gray-500">Users</div></div><div class=text-center><div class="text-lg font-semibold text-indigo-600"></div><div class="text-xs text-gray-500">Courses</div></div><div class=text-center><div class="text-lg font-semibold text-indigo-600"></div><div class="text-xs text-gray-500">API Calls</div></div></div><div class="flex gap-2 mt-4"><button class="flex-1 p-2 text-gray-600 hover:text-indigo-600 hover:bg-gray-50 rounded-lg transition-colors text-sm"title="Test Connection">🔗</button><button class="flex-1 p-2 text-gray-600 hover:text-indigo-600 hover:bg-gray-50 rounded-lg transition-colors text-sm"title=Edit>✏️</button><button class="flex-1 p-2 text-red-600 hover:text-red-700 hover:bg-red-50 rounded-lg transition-colors text-sm"title=Delete>🗑️');const Xr=()=>{const[e,t]=k([]),[r,n]=k(!0),[s,l]=k(!1),[o,i]=k(null),[a,f]=k({name:"",url:"",version:""});lt(async()=>{await u(),n(!1)});const u=async()=>{try{const x=await(await fetch("/api/v1/instances")).json();t(x.instances||[])}catch(p){console.error("Error loading instances:",p)}},c=()=>{i(null),f({name:"",url:"",version:""}),l(!0)},w=p=>{i(p),f({name:p.name,url:p.url,version:p.version||""}),l(!0)},_=()=>{l(!1),i(null)},M=async()=>{try{const p=o()?`/api/v1/instances/${o().id}`:"/api/v1/instances",x=o()?"PUT":"POST",y=await fetch(p,{method:x,headers:{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`},body:JSON.stringify(a())});if(y.ok){if(_(),await u(),!o()){const N=await y.json();N.api_key&&alert(`🎉 Instance registered successfully!
API Key: ${N.api_key}
Save this key securely - it will not be shown again.`)}}else{const N=await y.json();alert("Error: "+(N.error||"Failed to save instance"))}}catch(p){console.error("Error saving instance:",p),alert("Error: Failed to save instance")}},O=async p=>{if(confirm("Are you sure you want to delete this instance? This action cannot be undone."))try{const x=await fetch(`/api/v1/instances/${p}`,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});if(x.ok)await u();else{const y=await x.json();alert("Error: "+(y.error||"Failed to delete instance"))}}catch(x){console.error("Error deleting instance:",x),alert("Error: Failed to delete instance")}},E=async p=>{try{(await fetch(`${p.url}/health`,{method:"GET",signal:AbortSignal.timeout(5e3)})).ok?alert("✅ Connection successful! Instance is responding."):alert("❌ Connection failed. Instance returned an error.")}catch{alert("❌ Connection failed. Unable to reach the instance.")}},L=(p,x)=>{navigator.clipboard.writeText(p).then(()=>{const y=x.target,N=y.textContent;y.textContent="Copied!",y.style.background="#10b981",setTimeout(()=>{y.textContent=N,y.style.background=""},2e3)})},j=p=>{if(!p)return"Never";const x=new Date(p);return x.toLocaleDateString()+" "+x.toLocaleTimeString()};return(()=>{var p=Vr(),x=p.firstChild,y=x.firstChild,N=y.nextSibling,oe=N.firstChild,ne=oe.firstChild,me=ne.nextSibling;return me.$$click=c,h(N,S(re,{get when(){return r()},get fallback(){return S(re,{get when(){return e().length>0},get fallback(){return Gr()},get children(){var v=zr();return h(v,S(de,{get each(){return e()},children:g=>(()=>{var $=Hr(),B=$.firstChild,W=B.nextSibling,D=W.firstChild,U=D.firstChild,d=U.firstChild,b=d.nextSibling,I=b.nextSibling,R=I.firstChild,K=R.nextSibling,H=D.nextSibling,Z=H.firstChild,X=Z.firstChild,F=X.nextSibling,V=Z.nextSibling,Y=V.firstChild,z=Y.nextSibling,ae=V.nextSibling,fe=ae.firstChild,ge=fe.nextSibling,$e=ae.nextSibling,he=$e.firstChild,se=he.nextSibling;se.firstChild;var pe=H.nextSibling,ce=pe.firstChild,we=ce.nextSibling,be=we.firstChild,xe=be.nextSibling,_e=pe.nextSibling,Te=_e.firstChild,Pe=Te.firstChild,ke=Te.nextSibling,Je=ke.firstChild,Ie=ke.nextSibling,je=Ie.firstChild,We=_e.nextSibling,Ce=We.firstChild,ve=Ce.nextSibling,Le=ve.nextSibling;return h(d,()=>g.name),h(b,()=>g.url),h(K,()=>g.is_active?"Active":"Inactive"),h(F,()=>g.version||"Unknown"),h(z,()=>j(g.created_at)),h(ge,()=>j(g.last_sync)),h(se,()=>g.id,null),xe.$$click=Q=>L(g.api_key,Q),h(Pe,()=>Math.floor(Math.random()*100)),h(Je,()=>Math.floor(Math.random()*50)),h(je,()=>Math.floor(Math.random()*1e3)),Ce.$$click=()=>E(g),ve.$$click=()=>w(g),Le.$$click=()=>O(g.id),P(Q=>{var Re=`absolute top-4 right-4 w-3 h-3 rounded-full ${g.is_active?"bg-green-500":"bg-red-500"} ${g.is_active?"animate-pulse":""}`,Oe=g.url,De=`w-2 h-2 rounded-full ${g.is_active?"bg-green-500":"bg-red-500"}`;return Re!==Q.e&&ze(B,Q.e=Re),Oe!==Q.t&&sr(b,"href",Q.t=Oe),De!==Q.a&&ze(R,Q.a=De),Q},{e:void 0,t:void 0,a:void 0}),P(()=>be.value=g.api_key),$})()})),v}})},get children(){return Br()}}),null),h(p,S(re,{get when(){return s()},get children(){var v=Kr(),g=v.firstChild,$=g.firstChild,B=$.firstChild,W=B.nextSibling,D=$.nextSibling,U=D.firstChild,d=U.firstChild,b=d.nextSibling,I=U.nextSibling,R=I.firstChild,K=R.nextSibling,H=I.nextSibling,Z=H.firstChild,X=Z.nextSibling,F=D.nextSibling,V=F.firstChild,Y=V.nextSibling;return h(B,()=>o()?"Edit Instance":"Register New Instance"),W.$$click=_,b.$$input=z=>f({...a(),name:z.currentTarget.value}),K.$$input=z=>f({...a(),url:z.currentTarget.value}),X.$$input=z=>f({...a(),version:z.currentTarget.value}),V.$$click=_,Y.$$click=M,h(Y,()=>o()?"Update Instance":"Register Instance"),P(()=>b.value=a().name),P(()=>K.value=a().url),P(()=>X.value=a().version),v}}),null),p})()};Xe(["click","input"]);function Jr(){return S(Tt,{get children(){return[S(Ue,{path:"/",component:vt}),S(Ue,{path:"/dashboard",component:vt}),S(Ue,{path:"/dashboard/courses",component:qr}),S(Ue,{path:"/dashboard/instances",component:Xr})]}})}const mt=document.getElementById("root");mt?nr(()=>S(Tt,{get children(){return S(Jr,{})}}),mt):console.error("Root element not found");