lowlander 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dashboard/client/crud.js +12 -12
- package/build/dashboard/client/crud.js.map +1 -1
- package/build/dashboard/client/main.js +8 -8
- package/build/dashboard/client/main.js.map +1 -1
- package/build/dashboard/dashboard.html +8 -8
- package/build/examples/helloworld/.edinburgh/commit_worker.log +44 -0
- package/build/examples/helloworld/.edinburgh/data.mdb +0 -0
- package/build/examples/helloworld/.edinburgh/lock.mdb +0 -0
- package/build/examples/helloworld/client/js/base.js +8 -8
- package/build/examples/helloworld/client/js/base.js.map +1 -1
- package/build/tsconfig.client.tsbuildinfo +1 -1
- package/dashboard/client/crud.ts +14 -14
- package/dashboard/client/main.ts +11 -11
- package/package.json +2 -2
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
<title>Lowlander Dashboard</title>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
|
-
<script type="module">var Ee=class{keyProp;tail;symbols;constructor(t){this.keyProp=t,this.tail={},this.symbols=[Symbol(0)]}add(t){if(this.symbols[0]in t)return!1;let r=1+(Math.clz32(Math.random()*4294967295)>>2);for(let l=this.symbols.length;l<r;l++)this.symbols.push(Symbol(l));let s=this.keyProp,o=t[s],i,a=this.tail;for(let l=this.symbols.length-1;l>=0;l--){let c=this.symbols[l];for(;(i=a[c])&&i[s]>o;)a=i;l<r&&(t[c]=a[c],a[c]=t)}return!0}has(t){return this.symbols[0]in t}fetchLast(){let t=this.tail[this.symbols[0]];if(t)return this.remove(t),t}isEmpty(){return this.tail[this.symbols[0]]===void 0}get(t){let r=this.keyProp,s,o=this.tail;for(let i=this.symbols.length-1;i>=0;i--){let a=this.symbols[i];for(;(s=o[a])&&s[r]>t;)o=s}return o[this.symbols[0]]?.[r]===t?o[this.symbols[0]]:void 0}*[Symbol.iterator](){let t=this.symbols[0],r=this.tail[t];for(;r;)yield r,r=r[t]}prev(t){return t[this.symbols[0]]}remove(t){if(!(this.symbols[0]in t))return!1;let r=this.keyProp,s=t[r],o,i=this.tail;for(let a=this.symbols.length-1;a>=0;a--){let l=this.symbols[a];for(;(o=i[l])&&o[r]>=s&&o!==t;)i=o;o===t&&(i[l]=o[l],delete o[l])}return o===t}clear(){let t=this.symbols[0],r=this.tail;for(;r;){let s=r[t];for(let o of this.symbols){if(!(o in r))break;delete r[o]}r=s}this.tail={}}},H,se=0,L,T;function ne(e,t,r,s){(e.sideEffects||=[]).push(t,r,s)}function Jr(e,t){for(let r=t.length-3;r>=0;r-=3){let s=t[r+1],o=t[r+2];switch(t[r]){case 0:o?e.classList.add(s):e.classList.remove(s);break;case 1:e.style[s]=o??"";break;case 2:e[s]=o;break;case 3:o==null?e.removeAttribute(s):e.setAttribute(s,o);break;case 4:e.removeEventListener(s,o);break}}}function yt(e){if(!H)H=new Ee("prio"),queueMicrotask(Qt);else if(!(se&1)&&(se++,se>98))throw new Error("Too many recursive updates from observes");H.add(e)}function Qt(){let e=Date.now();for(;H;){let t=H.fetchLast();if(!t)break;se&1&&se++,t.queueRun()}H=void 0,se=0,e=Date.now()-e,e>9&&console.debug(`Aberdeen queue took ${e}ms`)}function Gt(e){let t="";for(let r of e){if(typeof r=="string"){t+=`${r}`;continue}if(typeof r!="number")throw new Error("onEach() sort key must be a string, number or an array of such");let s="",o=Math.abs(Math.round(r)),i=r<0;for(;o>0;)s=String.fromCharCode(i?65534-o%65533:2+o%65533)+s,o=Math.floor(o/65533);t+=String.fromCharCode(128+(i?-s.length:s.length))+s}return t}function Qr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(65535-e.charCodeAt(r));return t}var Xt=0,Ie=class{prio=--Xt;remove(){let t=this.getLastNode();t&&Oe(t,this.getPrecedingNode());let r=T;T=this.el,this.delete(),T=r}},at=class{queueRun;prio=--Xt;constructor(t){this.queueRun=t,yt(this)}},ie=class extends Ie{cleaners;sideEffects;changes;constructor(t=[]){super(),this.cleaners=t}lastChild;redraw(){}getLastNode(){return we(this.lastChild)}delete(){let t=this.cleaners;for(let s=t.length-1;s>=0;s--){let o=t[s];typeof o=="function"?o():o.delete(this)}this.cleaners.length=0;let r=this.sideEffects;r&&(this.el===T&&Jr(this.el,r),this.sideEffects=void 0),H?.remove(this),this.lastChild=void 0}onChange(t,r,s,o){this.changes||(this.changes=new Map,yt(this));let i=this.changes.get(t);i||(i=new Map,this.changes.set(t,i)),i.has(r)?i.get(r)===s&&i.delete(r):i.set(r,o)}fetchHasChanges(){if(!this.changes)return!1;for(let t of this.changes.values())if(t.size>0)return delete this.changes,!0;return delete this.changes,!1}queueRun(){this.fetchHasChanges()&&(this.remove(),L=this,this.redraw(),L=void 0)}getInsertAfterNode(){return this.getLastNode()||this.getPrecedingNode()}getChildPrevSibling(){return this.lastChild}},xe=class extends ie{el;svg;prevSibling;constructor(t,r,s=!1){super(s?m.cleaners:[]),this.el=t,this.svg=r,t===m.el?(this.prevSibling=m.getChildPrevSibling(),m.lastChild=this):this.prevSibling=t.lastChild||void 0,s||m.cleaners.push(this)}getPrecedingNode(){return we(this.prevSibling)}getChildPrevSibling(){return this.lastChild||this.prevSibling}},Te=class extends xe{renderer;constructor(t,r,s){super(t,r),this.renderer=s,this.redraw()}redraw(){let t=m;m=this;try{this.renderer()}catch(r){kt(r,!0)}m=t}},Me=class extends ie{el=document.body;svg=!1;getPrecedingNode(){}},lt=class extends ie{el;renderer;svg;constructor(t,r){super(),this.el=t,this.renderer=r,this.svg=t.namespaceURI==="http://www.w3.org/2000/svg";let s=L;L=this,this.redraw(),L=s,m.cleaners.push(this)}redraw(){Te.prototype.redraw.call(this)}getPrecedingNode(){}delete(){Oe(this.getLastNode(),this.getPrecedingNode());let t=T;T=this.el,super.delete(),T=t}remove(){this.delete()}};function Oe(e,t){for(;e&&e!==t;){let r=e.previousSibling,s=gt.get(e);s&&e instanceof Element?s!==!0&&(typeof s=="function"?s(e):on(e,s),gt.set(e,!0)):e.remove(),e=r}}function we(e){return!e||e instanceof Node?e:e.getLastNode()||e.getPrecedingNode()}var ct=class extends xe{renderer;result=S({value:void 0});constructor(t){super(m.el,m.svg),this.renderer=t,this.redraw()}redraw(){let t=m;m=this;try{this.result.value=this.renderer()}catch(r){kt(r,!0)}m=t}},ft=class extends xe{key;target;svg=!1;constructor(t,r,s){super(t,t.namespaceURI==="http://www.w3.org/2000/svg"),this.key=r,this.target=s,this.redraw()}redraw(){let t=m;m=this,j(this.el,this.key,this.target.value),m=t}},ut=class extends Ie{renderer;makeSortKey;parentElement=m.el;prevSibling;target;byIndex=new Map;sortedSet=new Ee("sortKey");changedIndexes=new Map;constructor(t,r,s){super(),this.renderer=r,this.makeSortKey=s;let o=this.target=t[y]||t;if(k(o,C,this),this.prevSibling=m.getChildPrevSibling(),m.lastChild=this,m.cleaners.push(this),o instanceof Array)for(let i=0;i<o.length;i++)new ge(this,i,!1);else for(let i of o instanceof Map?o.keys():o instanceof Set?o.values():Object.keys(o))new ge(this,i,!1)}getPrecedingNode(){return we(this.prevSibling)}onChange(t,r,s,o){(!(t instanceof Array)||typeof r=="number")&&(this.changedIndexes.has(r)?this.changedIndexes.get(r)===s&&this.changedIndexes.delete(r):(this.changedIndexes.set(r,o),yt(this)))}queueRun(){let t=this.changedIndexes;this.changedIndexes=new Map;for(let r of t.keys()){let s=this.byIndex.get(r);s&&s.remove(),(this.target instanceof Set||this.target instanceof Map?this.target.has(r):r in this.target)?new ge(this,r,!0):this.byIndex.delete(r)}L=void 0}delete(){for(let t of this.byIndex.values())t.delete();H?.remove(this),this.byIndex.clear(),setTimeout(()=>{this.sortedSet.clear()},1)}getLastNode(){for(let t of this.sortedSet){let r=t.getActualLastNode();if(r)return r}}},ge=class extends ie{parent;itemIndex;sortKey;el;svg;constructor(t,r,s){super(),this.parent=t,this.itemIndex=r,this.el=t.parentElement,this.svg=m.svg,this.parent.byIndex.set(this.itemIndex,this),this.lastChild=this,s&&(L=this),this.redraw()}getPrecedingNode(){this.parent.sortedSet.add(this);let t=this.parent.sortedSet.prev(this);return t?we(t.lastChild):this.parent.getPrecedingNode()}getLastNode(){return this.getPrecedingNode()}getActualLastNode(){let t=this.lastChild;for(;t&&t!==this;){if(t instanceof Node)return t;let r=t.getLastNode();if(r)return r;t=t.getPrecedingNode()}}queueRun(){if(m!==ae&&Jt(4),!this.fetchHasChanges())return;if(this.sortKey!==void 0){let r=this.getActualLastNode();r&&Oe(r,this.getPrecedingNode())}let t=T;T=this.el,this.delete(),T=t,this.lastChild=this,L=this,this.redraw(),L=void 0}redraw(){let t,r=this.parent.target,s=this.itemIndex;r instanceof Set?t=s=S(s):r instanceof Map?(t=S(r.get(s)),s=S(s)):t=S(r[s]);let o=m;m=this;let i;try{this.parent.makeSortKey?i=this.parent.makeSortKey(t,s):i=s,i instanceof Array?i=Gt(i):typeof i!="string"&&i!=null&&(i=Gt([i])),this.sortKey!==i&&(this.parent.sortedSet.remove(this),this.sortKey=i),i!=null&&this.parent.renderer(t,s)}catch(a){kt(a,i!=null)}m=o}getInsertAfterNode(){return this.sortKey==null&&Jt(1),we(this.lastChild)}remove(){if(this.sortKey!==void 0){let r=this.getActualLastNode();r&&Oe(r,this.getPrecedingNode()),this.parent.sortedSet.remove(this),this.sortKey=void 0}let t=T;T=this.el,this.delete(),T=t}};function Q(e,t){if(e!==m.el){e.appendChild(t);return}let r=m.el,s=m.getInsertAfterNode();r.insertBefore(t,s?s.nextSibling:r.firstChild),m.lastChild=t}var ae=new Me,m=ae;function xt(e){let t=m;m=new Me;try{return e()}finally{m=t}}var C=Symbol("any"),y=Symbol("target"),U=Symbol("mapSize"),dt=new WeakMap,ve=0;function k(e,t,r=m){if(r===ae||ve)return;let s=dt.get(e);if(s||dt.set(e,s=new Map),t!==C&&s.get(C)?.has(r))return;let o=s.get(t);o||s.set(t,o=new Set),!o.has(r)&&(o.add(r),r===m?m.cleaners.push(o):m.cleaners.push(()=>{o.delete(r)}))}function le(e,t,r){if(!e||typeof e!="object")throw new Error("A.onEach requires an object");e=e[y]||e,new ut(e,t,r)}function ht(e){for(let t of Object.keys(e))return!1;return!0}var v=Symbol("empty");function Ce(e){let t=e[y]||e,r=m;if(t instanceof Array)return k(t,"length",(o,i,a)=>{!i!=!a&&r.onChange(t,v,!i,!a)}),!t.length;if(t instanceof Map||t instanceof Set)return k(t,U,(o,i,a)=>{!i!=!a&&r.onChange(t,v,!i,!a)}),!t.size;let s=ht(t);return k(t,C,(o,i,a)=>{if(i===v!=(a===v)){let l=ht(t);l!==s&&(r.onChange(t,v,l,s),s=l)}}),s}function Xr(e){if(e instanceof Array)return je(e,"length");if(e instanceof Map||e instanceof Set)return je(e,"size");let t=e[y]||e,r=0;for(let o of Object.keys(t))t[o]!==void 0&&r++;let s=Ue(r);return k(t,C,(o,i,a)=>{a===i||(a===v?s.value=++r:i===v&&(s.value=--r))}),s}function Zr(e,t,r,s){if(r===s&&r!==void 0)return;let o=dt.get(e);if(o!==void 0)for(let i of[t,C]){let a=o.get(i);if(a)for(let l of a)typeof l=="function"?l(t,r,s):l.onChange(e,t,r,s)}}var $=Zr,en={get(e,t){return t===y?e:(k(e,t),S(e[t]))},set(e,t,r){typeof r=="object"&&r&&(r=r[y]||r);let s=e.hasOwnProperty(t)?e[t]:v;return r!==s&&(e[t]=r,$(e,t,r,s)),!0},deleteProperty(e,t){let r=e.hasOwnProperty(t)?e[t]:v;return delete e[t],$(e,t,v,r),!0},has(e,t){return k(e,t),e.hasOwnProperty(t)},ownKeys(e){return k(e,C),Reflect.ownKeys(e)}};function tn(e,t,r){typeof r=="object"&&r&&(r=r[y]||r);let s=e[t];if(s===void 0&&!e.hasOwnProperty(t)&&(s=v),r!==s){let o=e.length;if(t==="length"){e.length=r;for(let i=r;i<o;i++)$(e,i,v,e[i])}else{if(typeof t=="string"){let i=0|t;String(i)===t&&i>=0&&(t=i)}e[t]=r,$(e,t,r,s)}e.length!==o&&$(e,"length",e.length,o)}return!0}var rn={get(e,t){if(t===y)return e;if(typeof t=="string"){let r=0|t;String(r)===t&&r>=0&&(t=r)}return k(e,t),S(e[t])},set:tn,deleteProperty(e,t){if(typeof t=="string"){let s=0|t;String(s)===t&&s>=0&&(t=s)}let r=e[t];return r===void 0&&!e.hasOwnProperty(t)&&(r=v),delete e[t],$(e,t,v,r),!0}};function pe(e){return{[Symbol.iterator](){return this},next(){let t=e.next();return t.done?t:{done:!1,value:S(t.value)}}}}function mt(e){return{[Symbol.iterator](){return this},next(){let t=e.next();return t.done?t:{done:!1,value:[S(t.value[0]),S(t.value[1])]}}}}function V(e){return typeof e=="object"&&e&&e[y]||e}var Wt={get(e){let t=this[y];return e=V(e),k(t,e),S(t.get(e))},set(e,t){let r=this[y];e=V(e),t=V(t);let s=r.get(e);if(s===void 0&&!r.has(e)&&(s=v),t!==s){let o=r.size;r.set(e,t),$(r,e,t,s),$(r,U,r.size,o)}return this},delete(e){let t=this[y];e=V(e);let r=t.get(e);r===void 0&&!t.has(e)&&(r=v);let s=t.delete(e);return s&&($(t,e,v,r),$(t,U,t.size,t.size+1)),s},clear(){let e=this[y],t=e.size;for(let r of e.keys())$(e,r,void 0,e.get(r));e.clear(),$(e,U,0,t)},has(e){let t=this[y];return e=V(e),k(t,e),t.has(e)},keys(){let e=this[y];return k(e,C),pe(e.keys())},values(){let e=this[y];return k(e,C),pe(e.values())},entries(){let e=this[y];return k(e,C),mt(e.entries())},[Symbol.iterator](){let e=this[y];return k(e,C),mt(e[Symbol.iterator]())}},Vt={add(e){let t=this[y];if(e=V(e),!t.has(e)){let r=t.size;t.add(e),$(t,e,e,v),$(t,U,t.size,r)}return this},delete(e){let t=this[y];if(e=V(e),!t.has(e))return!1;let r=t.size;return t.delete(e),$(t,e,v,e),$(t,U,t.size,r),!0},clear(){let e=this[y],t=e.size;if(t){for(let r of e.values())$(e,r,v,r);e.clear(),$(e,U,0,t)}},has(e){let t=this[y];return e=V(e),k(t,e),t.has(e)},keys(){let e=this[y];return k(e,C),pe(e.keys())},values(){let e=this[y];return k(e,C),pe(e.values())},entries(){let e=this[y];return k(e,C),mt(e.entries())},[Symbol.iterator](){let e=this[y];return k(e,C),pe(e[Symbol.iterator]())}},nn={get(e,t){return t===y?e:Wt.hasOwnProperty(t)?Wt[t]:t==="size"?(k(e,U),e.size):e[t]}},sn={get(e,t){return t===y?e:Vt.hasOwnProperty(t)?Vt[t]:t==="size"?(k(e,U),e.size):e[t]}},Ht=new WeakMap;function S(e){if(typeof e!="object"||e===null||e[y]!==void 0||e[O])return e;let t=Ht.get(e);if(t)return t;let r;return e instanceof Array?r=rn:e instanceof Map?r=nn:e instanceof Set?r=sn:r=en,t=new Proxy(e,r),Ht.set(e,t),t}function Ue(e){if(e instanceof Promise){let t=S({busy:!0});return e.then(r=>{t.value=r,t.busy=!1}).catch(r=>{t.error=r,t.busy=!1}),t}return S(typeof e=="object"&&e!==null?e:{value:e})}function wt(e){return e&&(e[y]||e)}var gt=new WeakMap;function on(e,t){let r=t.split(".").filter(s=>s);e.classList.add(...r),setTimeout(()=>e.remove(),2e3)}function an(e,t,r){return arguments.length>2?Zt(e,t,r,0):vt(e,t,0)}function Zt(e,t,r,s){let o=cr(e,t);return r===o?!1:typeof o=="object"&&o!==null&&typeof r=="object"&&r!==null&&o.constructor===r.constructor?vt(o,r,s):(r=pt(r),e instanceof Map?e.set(t,r):e[t]=pt(r),!0)}function ln(e,t,r){return arguments.length>2?Zt(e,t,r,Ne):vt(e,t,Ne)}function vt(e,t,r){let s=e[y];return s&&(e=s,r|=W),s=t[y],s&&(t=s,m!==ae&&!ve&&(r|=X)),Re(e,t,r)}function Re(e,t,r){r&X&&k(t,C);let s=!1;if(t instanceof Array&&e instanceof Array){let o=e.length,i=t.length;for(let a=0;a<i;a++){let l=e[a];l===void 0&&!e.hasOwnProperty(a)&&(l=v);let c=t[a];if(c===void 0&&!t.hasOwnProperty(a))delete e[a],r&W&&$(e,a,v,l),s=!0;else if(l!==c){if(typeof c=="object"&&c!==null){if(typeof l=="object"&&l!==null&&c.constructor===l.constructor&&!(O in c)){s=Re(l,c,r)||s;continue}c=ye(c,r&X)}e[a]=c,r&W&&$(e,a,c,l),s=!0}}if(i!==o){if(r&W){for(let a=i;a<o;a++){let l=e[a];delete e[a],$(e,a,v,l)}e.length=i,$(e,"length",i,o)}else e.length=i;s=!0}}else if(t instanceof Map&&e instanceof Map){for(let o of t.keys()){let i=t.get(o),a=e.get(o);if(a===void 0&&!e.has(o)&&(a=v),a!==i){if(typeof i=="object"&&i!==null){if(typeof a=="object"&&a!==null&&i.constructor===a.constructor&&!(O in i)){s=Re(a,i,r)||s;continue}i=ye(i,r&X)}e.set(o,i),r&W&&$(e,o,i,a),s=!0}}if(!(r&Ne)){for(let o of e.keys())if(!t.has(o)){let i=e.get(o);e.delete(o),r&W&&$(e,o,v,i),s=!0}}}else if(t.constructor===e.constructor){for(let o of Object.keys(t)){let i=t[o],a=e.hasOwnProperty(o)?e[o]:v;if(a!==i){if(typeof i=="object"&&i!==null){if(typeof a=="object"&&a!==null&&i.constructor===a.constructor&&!(O in i)){s=Re(a,i,r)||s;continue}i=ye(i,r&X)}e[o]=i,r&W&&$(e,o,i,a),s=!0}}if(!(r&Ne)){for(let o of Object.keys(e))if(!t.hasOwnProperty(o)){let i=e[o];delete e[o],r&W&&i!==void 0&&$(e,o,v,i),s=!0}}}else throw new Error(`Incompatible or non-object types: ${t?.constructor?.name||typeof t} vs ${e?.constructor?.name||typeof e}`);return s}var Ne=1,X=32,W=64,O=Symbol("OPAQUE"),cn=O;Promise.prototype[O]=!0;Date.prototype[O]=!0;Node.prototype[O]=!0;if(typeof Temporal<"u")for(let e of"Duration Instant PlainDate PlainDateTime PlainMonthDay PlainTime PlainYearMonth ZonedDateTime".split(" ")){let t=Temporal[e];t&&(t.prototype[O]=!0)}var be=S({});function fn(e=1,t="rem"){for(let r=0;r<=12;r++)be[r]=2**(r-3)*e+t}var un=/(\burl\([^)]*\))|("[^"]*")|(^| )\$([\w-]+)/g,er=/^\d/;function tr(e){return e.indexOf("$")<0?e:e.replace(un,(t,r,s,o,i)=>{if(r||s)return t;let a=er.test(i)?`m${i}`:i;return`${o}var(--${a})`})}var Ae;function dn(){if(!Ae){if(typeof window>"u"||!window.matchMedia)return!1;let e=window.matchMedia("(prefers-color-scheme: dark)");Ae=Ue({value:e.matches}),e.addEventListener("change",()=>Ae.value=e.matches)}return Ae.value}function ye(e,t){if(O in e)return e;if(t&X&&k(e,C),e instanceof Array)return e.map(s=>it(s,t));if(e instanceof Map){let s=new Map;for(let[o,i]of e)s.set(o,it(i,t));return s}let r=Object.create(Object.getPrototypeOf(e));for(let s of Object.keys(e))r[s]=it(e[s],t);return r}function it(e,t){return typeof e=="object"&&e!==null?ye(e,t):e}function pt(e){if(typeof e!="object"||e===null)return e;let t=0,r=e[y];return r&&(e=r,m!==ae&&!ve&&(t=X)),ye(e,t)}var hn={get(e,t){if(t===y)return je(wt(e.proxy),e.index);if(t==="value")return e.proxy[e.index]},set(e,t,r){return t==="value"?(e.proxy[e.index]=r,!0):!1}};function je(e,t){return new Proxy({proxy:e,index:t},hn)}function mn(e,t){let r,s,o=e.getAttribute("type"),i=wt(t).value;o==="checkbox"?(i===void 0&&(t.value=e.checked),r=()=>{e.checked=t.value},s=()=>{t.value=e.checked}):o==="radio"?(i===void 0&&e.checked&&(t.value=e.value),r=()=>{e.checked=t.value===e.value},s=()=>{e.checked&&(t.value=e.value)}):(s=()=>{t.value=o==="number"||o==="range"?e.value===""?null:+e.value:e.value},i===void 0&&s(),r=()=>{e.value=t.value,e.tagName==="SELECT"&&e.value!=t.value&&new at(()=>e.value=t.value)}),ar(r),e.addEventListener("input",s),_(()=>{e.removeEventListener("input",s)})}var ot=/\*\*(.+?)\*\*|\*(.+?)\*|`(.+?)`|\[(.+?)\]\((.+?)\)/g,Le={create:(e,t)=>{if(m===L)if(typeof t=="function")t(e);else{let r=t.split(".").filter(s=>s);e.classList.add(...r),(async()=>(e.offsetHeight,e.classList.remove(...r)))()}},destroy:(e,t)=>{gt.set(e,t)},html:(e,t)=>{if(e===m.el&&!e.firstChild)e.innerHTML=`${t}`;else{let r=document.createElement(m.el.tagName);for(r.innerHTML=`${t}`;r.firstChild;)Q(e,r.firstChild)}},text:(e,t)=>{Q(e,document.createTextNode(t))},rich:(e,t)=>{let r=0,s,o=String(t);for(ot.lastIndex=0;(s=ot.exec(o))!==null;){s.index>r&&Q(e,document.createTextNode(o.slice(r,s.index)));let i;if(s[1]!==void 0)i=document.createElement("strong"),i.textContent=s[1];else if(s[2]!==void 0)i=document.createElement("em"),i.textContent=s[2];else if(s[3]!==void 0)i=document.createElement("code"),i.textContent=s[3];else{let a=document.createElement("a");a.textContent=s[4],a.href=s[5],i=a}Q(e,i),r=ot.lastIndex}r<o.length&&Q(e,document.createTextNode(o.slice(r)))}};function gn(){Le.create=Le.destroy=()=>{}}function E(...e){let t=m.el,r=m.svg,s=e.length;for(let o=0;o<s;o++){let i=e[o];if(!(i==null||i===!1))if(typeof i=="string"){let a=i.length,l=0;for(let c=0;c<a;c=l+1){l=re(i," .=:#",c);let f=i[l];if(f===":"){let u="$"+i.substring(c,l);if(l+1>=a){j(t,u,e[++o]);break}if(i[l+1]===" "){let d=re(i,";",l+2),h=i.substring(l+2,d).trim();j(t,u,h),l=d}else{let d=re(i," ",l+1),h=i.substring(l+1,d);j(t,u,h),l=d}}else if(f==="="){let u=i.substring(c,l);if(l+1>=a){j(t,u,e[++o]);break}let d=i[l+1];if(d==='"'||d==="'"||d==="`"){let h=re(i,d,l+2),b=i.substring(l+2,h);j(t,u,b),l=h}else{let h=re(i," ",l+1),b=i.substring(l+1,h);j(t,u,b),l=h}}else{if(l>c){let u=i.substring(c,l);r||=u==="svg";let d=r?document.createElementNS("http://www.w3.org/2000/svg",u):document.createElement(u);Q(t,d),t=d}if(f==="#"){let u=l+1<a?i.substring(l+1):e[++o];j(t,"text",u);break}if(f==="."){let u=re(i," #=.",l+1);if(i[u]==="="&&u+1>=a)j(t,i.substring(l,u),e[++o]),l=u;else{let h=i.substring(l+1,u)||e[++o];t.classList.contains(h)||(t===m.el&&ne(m,0,h,!1),t.classList.add(h)),l=u-1}}}}}else if(typeof i=="object")if(i.constructor!==Object)if(i instanceof Node)Q(t,i),i instanceof Element&&(t=i,r=i.namespaceURI==="http://www.w3.org/2000/svg");else throw new Error(`Unexpected argument: ${i}`);else for(let a of Object.keys(i))j(t,a,i[a]);else if(typeof i=="function")new Te(t,r,i);else throw new Error(`Unexpected argument: ${i}`)}return t}function re(e,t,r){if(t.length===1){let o=e.indexOf(t,r);return o>=0?o:e.length}let s=e.length;for(let o=r;o<s;o++)if(t.indexOf(e[o])>=0)return o;return s}var rr=0;function pn(e){let t=`.AbdStl${++rr}`,r=typeof e=="string"?bt(e,t):qe(e,t);if(r){let s=nr++;oe[s]=r,_(()=>delete oe[s])}return t}var oe=Ue({}),nr=0;function Yt(e,t){let r=[];for(let s of e.split(","))for(let o of t.split(","))r.push(o.includes("&")?o.trim().replace(/&/g,s):`${s} ${o.trim()}`.trim());return r.join(",")}function qe(e,t){let r="";for(let[s,o]of Object.entries(e))o&&typeof o=="object"?s.startsWith("@")?r+=`${s}{
|
|
11
|
-
${
|
|
12
|
-
`:r+=
|
|
13
|
-
${
|
|
14
|
-
`:r+=
|
|
15
|
-
`:""}function
|
|
16
|
-
`,E("#",e)})})})})});var n=Object.assign(E,{clean:_,clone:pt,copy:an,count:Xr,cssVars:be,CUSTOM_DUMP:$t,darkMode:dn,derive:ar,disableCreateDestroy:gn,dump:Sn,insertCss:pn,insertGlobalCss:wn,invertString:Qr,isEmpty:Ce,map:kn,merge:ln,mount:lr,multiMap:Pn,OPAQUE:O,NO_COPY:cn,onEach:le,partition:An,peek:cr,proxy:Ue,ref:je,runQueue:Qt,setErrorHandler:vn,setSpacingCssVars:fn,unmountAll:$n,unproxy:wt});var _e=()=>{};var St=typeof ABERDEEN_FAKE_WINDOW<"u"?ABERDEEN_FAKE_WINDOW:window,z=St.location,K=St.history;function ur(){return Ct({path:z.pathname,hash:z.hash,search:Object.fromEntries(new URLSearchParams(z.search)),state:K.state?.state||{}},"load",(K.state?.stack?.length||0)+1)}function Pt(e,t,r){if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t||e.constructor!==t.constructor)return!1;if(t instanceof Array){if(e.length!==t.length)return!1;for(let s=0;s<t.length;s++)if(!Pt(e[s],t[s],r))return!1}else{for(let s of Object.keys(t))if(!Pt(e[s],t[s],r))return!1;if(!r){for(let s of Object.keys(e))if(!t.hasOwnProperty(s))return!1}}return!0}function dr(e){let t=new URLSearchParams(e.search).toString();return(t?`${e.path}?${t}`:e.path)+e.hash}function Ct(e,t,r){let s=e.path||(e.p||[]).join("/")||"/";return s=(""+s).replace(/\/+$/,""),s.startsWith("/")||(s=`/${s}`),{path:s,hash:e.hash&&e.hash!=="#"?e.hash.startsWith("#")?e.hash:"#"+e.hash:"",p:s.length>1?s.slice(1).replace(/\/+$/,"").split("/"):[],nav:t,search:typeof e.search=="object"&&e.search?n.clone(e.search):{},state:typeof e.state=="object"&&e.state?n.clone(e.state):{},depth:r}}function hr(e,t=!1){if(typeof e=="string"){let r=new URL(e,z.href);if(r.host!==z.host){if(t)return;throw new Error(`Unexpected external URL: ${r.host} != ${z.host}`)}e={path:r.pathname,search:Object.fromEntries(r.searchParams),hash:r.hash}}else e instanceof Array&&(e={p:e});if(e.p&&(e.p=e.p.map(String)),e.search)for(let r of Object.keys(e.search))e.search[r]=String(e.search[r]);return e}function De(e,t="go"){gr=0,D=(K.state?.stack||[]).concat(JSON.stringify(n.unproxy(P)));let s=Ct(hr(e),t,D.length+1);n.copy(P,s),_e(t,s),K.pushState({state:s.state,stack:D},"",dr(s)),n.runQueue()}function mr(e){let t=hr(e,!0);if(!t)return!1;if(t.path!=null||t.p!=null){let r=t.path||(t.p||[]).join("/")||"/";if(r=(""+r).replace(/\/+$/,""),r.startsWith("/")||(r=`/${r}`),!At[r])return!1}if(t.search){for(let[r,s]of Object.entries(t.search))if(!At[`${r}=${s}`])return!1}return!0}var D,gr=0;var P=n.proxy({}),At=n.proxy({});function Cn(){D=K.state?.stack||[];let e=ur();_e("initial",e),n.copy(n.unproxy(P),e)}Cn();St.addEventListener("popstate",function(e){gr=0;let t=ur(),r=K.state?.stack||[];if(r.length!==D.length){let s=Math.min(D.length,r.length)-1;(s<0||r[s]===D[s])&&(t.nav=r.length<D.length?"back":"forward")}D=r,_e("popstate",t),n.copy(P,t),n.runQueue()});xt(()=>{n(()=>{P.path="/"+Array.from(P.p).join("/")}),n(()=>{let e=K.state?.stack||[],t=Ct(P,n.unproxy(P).nav,e.length+1);n.copy(P,t);let r={state:t.state,stack:e},s=dr(t);(s!==z.pathname+z.search+z.hash||!Pt(K.state,r,!1))&&(_e("replaceState",t,r,s),K.replaceState(r,"",s))}),n(()=>{let e={};e[P.path]=!0;for(let[t,r]of Object.entries(P.search))e[`${t}=${r}`]=!0;n.copy(At,e)})});var Rt="staffa:darkMode",pr=n.proxy({value:En()});function En(){try{let e=localStorage.getItem(Rt);if(e==="dark")return!0;if(e==="light")return!1}catch{}}function Et(e){pr.value=e;try{e===void 0?localStorage.removeItem(Rt):localStorage.setItem(Rt,e?"dark":"light")}catch{}}function ze(e=!1){let t=pr.value;return t===void 0&&!e?n.darkMode():t}n(()=>{ze()?n.insertGlobalCss({":root":"--s-primary:#8b7bff --s-secondary:#ef7fd0 --s-danger:#ff6b6b --s-success:#46d39a --s-warning:#fbbf24 --s-neutral:#3c4352 --s-page:#0e1015 --s-panel:#181b22 --s-raised:#222632 --s-ink:#e8eaf0 --s-on-accent:#0c0a14 --s-focus:rgba(139,123,255,0.45) --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 34px rgba(0,0,0,0.5);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#6db3ff"}):n.insertGlobalCss({":root":"--s-primary:#6c5ce7 --s-secondary:#d6459e --s-danger:#e23b3b --s-success:#1f9d6b --s-warning:#d97706 --s-neutral:#c7ccda --s-page:#f3f4f8 --s-panel:#ffffff --s-raised:#eceef4 --s-ink:#1b1e27 --s-on-accent:#0c0a14 --s-focus:rgba(108,92,231,0.35) --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 30px rgba(20,24,40,0.13);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#2563eb"})});n.setSpacingCssVars();n.insertGlobalCss({":root":"--s-gradient: linear-gradient(135deg, $s-primary, $s-secondary); --s-glow: 0 8px 24px color-mix(in srgb, $s-primary 32%, transparent); --s-page-bg: radial-gradient(120% 80% at 100% 0%, color-mix(in oklab, $s-secondary, transparent 86%), transparent 56%), radial-gradient(120% 80% at 0% 0%, color-mix(in oklab, $s-primary, transparent 87%), transparent 56%), $s-page;",":root, .s-s.base":"--s-a:$s-ink --s-b:$s-page",".s-s.base":"background: $s-page-bg;",".s-s.panel":"--s-a:$s-ink --s-b:$s-panel",".s-s.raised":"--s-a:$s-ink --s-b:$s-raised",".s-s.neutral":"--s-a:$s-ink --s-b:$s-neutral",".s-s.primary":"--s-a:$s-on-accent --s-b:$s-primary",".s-s.secondary":"--s-a:$s-on-accent --s-b:$s-secondary",".s-s.danger":"--s-a:$s-on-accent --s-b:$s-danger",".s-s.success":"--s-a:$s-on-accent --s-b:$s-success",".s-s.warning":"--s-a:$s-on-accent --s-b:$s-warning",".s-s.gradient":"--s-a:$s-on-accent --s-b:$s-primary",":root, .s-s":"--s-fg:$s-a --s-bg:$s-b --s-fg-muted: color-mix(in oklab, $s-fg, $s-bg 42%); --s-fg-faint: color-mix(in oklab, $s-fg, $s-bg 64%); --s-border: color-mix(in oklab, $s-fg, $s-bg 82%); --s-border-strong: color-mix(in oklab, $s-fg, $s-bg 68%); scrollbar-width:thin scrollbar-color: $s-border-strong transparent; background:$s-bg color:$s-fg",".s-s::-webkit-scrollbar, .s-s ::-webkit-scrollbar":"width:10px height:10px",".s-s::-webkit-scrollbar-track, .s-s ::-webkit-scrollbar-track":"background:transparent",".s-s::-webkit-scrollbar-thumb, .s-s ::-webkit-scrollbar-thumb":"background:$s-border-strong border-radius:99px border: 2px solid transparent; background-clip:padding-box",".s-s::-webkit-scrollbar-thumb:hover, .s-s ::-webkit-scrollbar-thumb:hover":"background:$s-fg-faint background-clip:padding-box",".s-s.tonal":"--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent);",".s-s.outlined":"--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg);",".s-s.filled":"--s-fg:$s-a --s-bg:$s-b background:$s-bg;",".s-s.gradient:not(.tonal):not(.outlined)":"background: $s-gradient;",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-accent:$s-primary",".s-s.primary, .s-s.secondary, .s-s.danger, .s-s.success, .s-s.warning, .s-s.gradient":"--s-accent:$s-fg --s-link:$s-fg"});n.insertGlobalCss({"*, *::before, *::after":"box-sizing:border-box",html:"text-size-adjust:100%",body:"m:0 line-height:1.5 font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing:antialiased",a:"color: $s-link; text-decoration:underline text-underline-offset:2px; transition: color 0.12s, filter 0.12s;","a:hover":"filter: brightness(1.15)","input, button, textarea, select":"font:inherit color:inherit","code, kbd, samp, pre":"font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;",code:"background: color-mix(in oklab, $s-fg, $s-bg 86%); padding: 0.12em 0.34em; r:4px font-size:0.9em",pre:"background: color-mix(in oklab, $s-fg, $s-bg 92%); p:$3 r: $s-radius; overflow:auto","pre code":"background:transparent p:0","img, svg, video, canvas":"max-width:100% h:auto",hr:"border:0 border-top: 1px solid $s-border;","::placeholder":"color: $s-fg-faint; opacity:1",":focus-visible":"outline: 2px solid $s-focus; outline-offset:2px",small:"color:$s-fg-muted font-size:0.9em","@media (prefers-reduced-motion: reduce)":{"*, *::before, *::after":"transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important;"}});n.insertGlobalCss({".s-preload, .s-preload *, .s-preload *::before, .s-preload *::after":"transition: none !important; animation: none !important;"});if(typeof document<"u"&&typeof requestAnimationFrame=="function"){let e=document.documentElement;e.classList.add("s-preload"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("s-preload")))}var In="p, ul, ol, dl, blockquote, pre, table, figure, hr, h1, h2, h3, h4, h5, h6";n.insertGlobalCss({[`${In}`]:{"&":"margin:0","&:not(:first-child)":"margin-top:$3"},"h1, h2, h3, h4, h5, h6":{"&":"line-height:1.15 font-weight:700 text-wrap:balance","&:not(:first-child)":"margin-top:1.4em"},h1:"font-size:2em font-weight:800 letter-spacing:-0.022em",h2:"font-size:1.55em letter-spacing:-0.018em",h3:"font-size:1.3em letter-spacing:-0.011em",h4:"font-size:1.1em",h5:"font-size:0.95em letter-spacing:0.005em",h6:"font-size:0.8em fg:$s-fg-muted text-transform:uppercase letter-spacing:0.07em","ul, ol":{"&":"padding-left:1.5em","> li:not(:first-child), li > &:not(:first-child)":"margin-top:$1"},blockquote:"border-left: 3px solid $s-border; padding-left: $3; fg: $s-fg-muted",table:"border-collapse:collapse","th, td":"text-align:left padding: $1 $2; border-bottom: 1px solid $s-border; vertical-align:top",th:"font-weight:600","thead th":"border-bottom: 2px solid $s-border-strong;",dt:"font-weight:600",dd:"margin-left: 1.5em",figcaption:"fg:$s-fg-muted font-size:0.9em margin-top:$1 text-align:center"});var Tn=0;function B(e="s"){return`${e}-${++Tn}`}function x(e,...t){e!=null&&(typeof e=="function"?e(...t):n("rich=",e))}n.insertGlobalCss({".s-field":{"&":"display:flex flex-direction:column gap:$1","> label":"font-weight:600 font-size:0.9em fg:$s-fg user-select:none"},".s-req":"fg:$s-danger margin-left:2px",".s-help":"font-size:0.82em fg:$s-fg-muted",".s-error":"font-size:0.82em fg:$s-danger",".s-input":{"&":"w:100% bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.55em 0.7em; transition: border-color 0.15s, box-shadow 0.15s;","&:hover:not(:disabled)":"border-color:$s-border-strong","&:focus-visible":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus; outline:none","&:disabled":"opacity:0.6 cursor:not-allowed","&[aria-invalid=true]":"border-color:$s-danger"}});function Y(e,t){let r=e.id??B("field"),s=()=>!!e.error;n("div.s-field",e.attrs,()=>{n(()=>{e.label!=null&&n(`label for=${r}`,()=>{x(e.label),e.required&&n("span.s-req aria-hidden=true #*")})}),t(r,s),n(()=>{e.help!=null&&!e.error&&n("div.s-help",()=>x(e.help))}),n(()=>{e.error&&n("div.s-error role=alert #",e.error)})})}function ce(e,t,r,s){n(`id=${t}`),e.name&&n(`name=${e.name}`),n(()=>{e.disabled&&n("disabled=true")}),n(()=>{e.required&&n("aria-required=true")}),n(()=>n("aria-invalid=",r()?"true":"false")),s&&n("bind=",s)}n.insertGlobalCss({".s-ac":{"&":"position:relative","> .s-control":"display:flex flex-wrap:wrap align-items:center gap:$1 bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.3em 0.4em; cursor:text; transition: border-color 0.15s, box-shadow 0.15s;","> .s-control:hover":"border-color:$s-border-strong","> .s-control:focus-within":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus;","&[aria-invalid=true] > .s-control":"border-color:$s-danger",".s-chip":"display:inline-flex align-items:center gap:$1 font-size:0.85em bg:$s-raised border: 1px solid $s-border; r:$s-radius padding: 0.1em 0.2em 0.1em 0.5em;",".s-chip > button":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.2em; r:4px",".s-chip > button:hover":"fg:$s-fg background:$s-border",input:"flex:1 min-width:6ch border:0 background:transparent color:inherit outline:none padding:0.25em","> .s-menu":"position:absolute top:100% left:0 right:0 z-index:20 margin-top:4px max-height:15rem overflow-y:auto list-style:none p:$1 margin-bottom:0 bg:$s-panel border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow","> .s-menu li":"margin:0",".s-option":"padding: 0.45em 0.6em; r:6px cursor:pointer transition: background 0.1s;",".s-option[aria-selected=true]":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-add":"fg:$s-accent font-style:italic",".s-empty":"padding: 0.45em 0.6em; fg:$s-fg-muted"}});function Mn(e){return typeof e=="string"?{value:e,label:e}:{value:e.value,label:e.label??e.value}}function br(e){let t=B("ac-menu"),r=n.proxy({query:"",open:!1,active:0}),s=()=>(typeof e.options=="function"?e.options():e.options).map(Mn),o=()=>{let d=e.bind?.value;return d==null||d===""?[]:Array.isArray(d)?d:[d]},i=d=>s().find(h=>h.value===d)?.label??d;if(!e.multi){let d=e.bind?n.peek(e.bind,"value"):void 0;typeof d=="string"&&d&&(r.query=n.peek(()=>i(d)))}let a=()=>{let d=new Set(o()),h=s();e.multi&&(h=h.filter(A=>!d.has(A.value)));let b=r.query.trim().toLowerCase();return b&&(h=h.filter(A=>A.label.toLowerCase().includes(b))),h},l=(d,h)=>{if(e.multi){let b=Array.isArray(e.bind?.value)?[...e.bind.value]:[];b.includes(d)||b.push(d),e.bind&&(e.bind.value=b),r.query=""}else e.bind&&(e.bind.value=d),r.query=i(d),r.open=!1;r.active=0,h?.focus()},c=d=>{if(!e.bind)return;let h=e.bind.value??[];e.bind.value=h.filter(b=>b!==d)};Y(e,(d,h)=>{n("div.s-ac",e.inputAttrs,()=>{n(()=>n("aria-invalid=",h()?"true":"false"));let b;n("div.s-control",()=>{n("click=",()=>b?.focus()),n(()=>{if(e.multi)for(let A of o())n("span.s-chip",()=>{n("span #",n.peek(()=>i(A))),n("button type=button aria-label=",`Remove ${A}`,()=>{n("#\xD7"),n("click=",R=>{R.stopPropagation(),c(A),b?.focus()})})})}),b=n("input type=text role=combobox autocomplete=off",()=>{n(`id=${d} aria-controls=${t} aria-autocomplete=list`),e.placeholder!=null&&n("placeholder=",e.placeholder),e.disabled&&n("disabled=true"),e.required&&n("aria-required=true"),n("bind=",n.ref(r,"query")),n(()=>n("aria-expanded=",r.open?"true":"false")),n(()=>{let R=a()[r.active];n("aria-activedescendant=",r.open&&R?`${t}-opt-${r.active}`:"")}),n("input=",()=>{r.open=!0,r.active=0}),n("focus=",()=>{r.open=!0}),n("blur=",()=>{setTimeout(()=>u(),150)}),n("keydown=",A=>f(A,b))})}),n(()=>{if(!r.open)return;let A=a(),R=r.query.trim(),Ft=e.allowCustom!==!1&&R!==""&&!A.some(te=>te.label.toLowerCase()===R.toLowerCase());n("ul.s-menu role=listbox",`id=${t}`,()=>{A.forEach((te,st)=>{n("li.s-option role=option",`id=${t}-opt-${st}`,()=>{n(()=>n("aria-selected=",r.active===st?"true":"false")),n("#",te.label),n("mousedown=",Yr=>Yr.preventDefault()),n("click=",()=>l(te.value,b)),n("mousemove=",()=>{r.active=st})})}),Ft&&n("li.s-option.s-add role=option",()=>{n("#",`Add "${R}"`),n("mousedown=",te=>te.preventDefault()),n("click=",()=>l(R,b))}),A.length===0&&!Ft&&n("li.s-empty #No matches")})}),n(()=>{if(e.name)if(e.multi)for(let A of o())n("input type=hidden",()=>{n("name=",e.name),n("value=",A)});else n("input type=hidden",()=>{n("name=",e.name),n("value=",o()[0]??"")})})})});function f(d,h){let b=a(),A=b.length-1;if(d.key==="ArrowDown")d.preventDefault(),r.open=!0,r.active=Math.min(A,r.active+1);else if(d.key==="ArrowUp")d.preventDefault(),r.active=Math.max(0,r.active-1);else if(d.key==="Enter"){d.preventDefault();let R=b[r.active];R?l(R.value,h):e.allowCustom!==!1&&r.query.trim()?l(r.query.trim(),h):r.open&&(r.open=!1)}else if(d.key==="Escape")r.open=!1,e.multi||(r.query=i(o()[0]??""));else if(d.key==="Backspace"&&e.multi&&r.query===""){let R=o();R.length&&c(R[R.length-1])}}function u(){r.open=!1,e.multi?r.query="":e.allowCustom!==!1&&r.query.trim()?l(r.query.trim()):r.query=i(o()[0]??"")}}n.insertGlobalCss({".s-box":{"&":"display:flex flex-direction:column border: 1px solid $s-border; r: $s-radius-lg; overflow:hidden box-shadow: $s-shadow;","&:not(:first-child)":"margin-top: $3","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600","> footer":"display:flex align-items:center gap:$2 padding: $2 $3; border-top: 1px solid $s-border;","> div":"p:$3 gap:$3"}});function yr(e={}){let t=typeof e=="function"?{content:e}:e;n("section.s-box.s-s.panel",t.attrs,()=>{n(()=>{t.header!=null&&n("header.s-s.raised",t.headerAttrs,()=>x(t.header))}),n("div",t.contentAttrs,()=>{t.content&&t.content()}),n(()=>{t.footer!=null&&n("footer.s-s.raised",t.footerAttrs,()=>x(t.footer))})})}n.insertGlobalCss({".s-btn":{"&":"display:inline-flex align-items:center justify-content:center gap:$2 font-weight:600 line-height:1.2 white-space:nowrap cursor:pointer text-decoration:none border: 1px solid $s-border; r: $s-radius; padding: 0.5em 1em; transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s, transform 0.08s;","&:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus;","&:disabled, &[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none filter:saturate(0.6)","&:hover":"filter: brightness(1.08); transform: translateY(-1px)","&.tonal:hover, &.outlined:hover":"background: color-mix(in srgb, $s-b 26%, transparent);","&.gradient:not(.tonal):not(.outlined)":"border:0 box-shadow: $s-glow;","&.gradient:not(.tonal):not(.outlined):hover":"filter: brightness(1.06); box-shadow: 0 10px 28px color-mix(in srgb, $s-primary 42%, transparent); transform: translateY(-1px);","&:active:not(:disabled):not([aria-disabled=true])":"transform: translateY(1px)","&.small, .small > &":"padding: 0.32em 0.7em; font-size:0.85em","&.large, .large > &":"padding: 0.66em 1.3em; font-size:1.1em"}});var On=/\.(gradient|primary|secondary|neutral|danger|success|warning|base|panel|raised)(\.|\s|$)/;function M(e={}){let t=typeof e=="string"?{text:e}:typeof e=="function"?{content:e}:e,r=t.href!=null?"a":"button",s=t.attrs&&On.test(t.attrs)?"":".gradient";n(`${r}.s-btn.s-s${s}`,t.attrs,()=>{t.href!=null?(n(`href=${t.href} role=button`),t.disabled&&n("aria-disabled=true")):(n("type=",t.type??"button"),t.disabled&&n("disabled=true")),t.ariaLabel&&n("aria-label=",t.ariaLabel),t.click&&n("click=",t.click),x(t.icon),t.content?t.content():t.text!=null&&n("#",t.text)})}n.insertGlobalCss({".s-bgroup":{"&":"display:inline-flex align-items:stretch","&.s-spaced":"gap:$2 flex-wrap:wrap","&.s-vertical":"flex-direction:column","&.s-attached":"gap:0","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child)":"margin-left:-1px","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached:not(.s-vertical) > .s-btn:first-child:not(:last-child)":"border-top-right-radius:0 border-bottom-right-radius:0","&.s-attached:not(.s-vertical) > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-bottom-left-radius:0","&.s-attached.s-vertical > .s-btn:not(:first-child)":"margin-top:-1px","&.s-attached.s-vertical > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached.s-vertical > .s-btn:first-child:not(:last-child)":"border-bottom-left-radius:0 border-bottom-right-radius:0","&.s-attached.s-vertical > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-top-right-radius:0","&.s-attached > .s-btn:hover, &.s-attached > .s-btn:focus-visible":"z-index:1"}});function J(e={}){let r=`.s-${e.layout??"attached"}${e.vertical?".s-vertical":""}`;n(`div.s-bgroup${r} role=group`,e.attrs,()=>{if(e.buttons)for(let s of e.buttons)M(s);e.content&&e.content()})}function xr(e){n(()=>{let t=e.bind.value;J({attrs:e.attrs,buttons:Object.entries(e.options).map(([r,s])=>({text:typeof s=="string"?s:void 0,content:typeof s=="function"?s:void 0,attrs:t===r?".primary":".neutral .outlined",click:()=>{e.bind.value=e.allowDeselect&&t===r?null:r}}))})}),e.name&&n(()=>n(`input type=hidden name=${e.name} value=`,e.bind.value??""))}n.insertGlobalCss({".s-check":{"&":"display:flex flex-direction:column gap:$1","> label":"display:flex align-items:center gap:$2 cursor:pointer user-select:none","> label:has(input:disabled)":"cursor:not-allowed opacity:0.6",input:"width:1.15em height:1.15em accent-color:$s-accent cursor:inherit m:0"}});function wr(e={}){let t=e.id??B("check");n("div.s-check",e.attrs,()=>{n(`label for=${t}`,()=>{n("input type=checkbox",e.inputAttrs,()=>{n(`id=${t}`),e.name&&n(`name=${e.name}`),e.checked&&!e.bind&&n("checked=true"),e.change&&n("change=",e.change),n(()=>{e.disabled&&n("disabled=true")}),n(()=>{e.required&&n("aria-required=true")}),e.bind&&n("bind=",e.bind)}),n(()=>{e.label!=null&&x(e.label),e.required&&n("span.s-req aria-hidden=true #*")})}),n(()=>{e.help!=null&&!e.error&&n("div.s-help",()=>x(e.help))}),n(()=>{e.error&&n("div.s-error role=alert #",e.error)})})}n.insertGlobalCss({".s-form":{"&":"display:flex flex-direction:column gap:$3","&.grid":"display:grid grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap:$3","&.grid > .s-wide, &.grid > footer":"grid-column: 1 / -1;","> footer":"display:flex align-items:center gap:$2 flex-wrap:wrap margin-top:$1"}});function vr(e={}){let t=typeof e=="function"?{content:e}:e;n("form.s-form",t.attrs,()=>{n(()=>{n(".grid=",t.layout==="grid")}),n("submit=",r=>{if(r.preventDefault(),t.submit){let s=new FormData(r.target),o={};for(let i of new Set(s.keys())){let a=s.getAll(i);o[i]=a.length===1?a[0]:a}t.submit(o,r)}}),t.content&&t.content(),n(()=>{t.actions&&n("footer",t.actionsAttrs,()=>t.actions?.())})})}n.insertGlobalCss({".s-menu-list":"position:fixed z-index:350 min-width:10rem display:flex flex-direction:column p:$1 border: 1px solid $s-border; r:$s-radius-lg box-shadow:$s-shadow overflow-y:auto max-height:min(80vh,28rem) transition: opacity 0.15s, transform 0.15s;",".s-menu-list.hidden":"opacity:0 pointer-events:none transform:translateY(-6px)",".s-menu-item, .s-menu-item-link":"display:flex align-items:center gap:$2 w:100% padding: 0.5em 0.65em; r:$s-radius cursor:pointer text-align:left font-size:0.9em border:0 background:transparent fg:$s-fg text-decoration:none transition: background 0.12s, color 0.12s, transform 0.12s, box-shadow 0.12s;",".s-menu-item:hover:not([aria-disabled=true]):not([aria-current=page]), .s-menu-item-link:hover:not([aria-current=page])":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-menu-item[aria-current=page], .s-menu-item-link[aria-current=page]":"color:$s-on-accent font-weight:600 background: $s-gradient; box-shadow: 0 3px 10px color-mix(in srgb, $s-primary 38%, transparent);",".s-menu-item[aria-current=page] .s-menu-icon, .s-menu-item-link[aria-current=page] .s-menu-icon":"color:$s-on-accent",".s-menu-item[aria-current=page]:hover, .s-menu-item-link[aria-current=page]:hover":"filter:brightness(1.06)",".s-menu-item:focus-visible, .s-menu-item-link:focus-visible":"outline:none background: color-mix(in srgb, $s-fg 10%, transparent); box-shadow: 0 0 0 2px inset $s-focus;",".s-menu-item[aria-disabled=true], .s-menu-item-link[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none",".s-menu-icon":"fg:$s-fg-muted flex-shrink:0","hr.s-menu-sep":"border:0 height:1px margin: $1 0.6rem; background: linear-gradient(to right, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);"});function Ke(e,t){n("keydown=",r=>{if(r.key!=="ArrowDown"&&r.key!=="ArrowUp"&&r.key!=="Home"&&r.key!=="End")return;r.preventDefault();let o=[...r.currentTarget.querySelectorAll(".s-menu-item, .s-menu-item-link")].filter(c=>c.getAttribute("aria-disabled")!=="true");if(!o.length)return;let i=o.indexOf(document.activeElement),a=r.key==="ArrowUp"?-1:1,l=r.key==="Home"?0:r.key==="End"?o.length-1:i<0?a>0?0:o.length-1:(i+a+o.length)%o.length;o[l].focus()});for(let r of e){if(typeof r=="function"){r();continue}if("separator"in r){n("hr.s-menu-sep");continue}n(r.href?"a.s-menu-item-link":"button.s-menu-item type=button",r.attrs,()=>{r.href&&(n("href=",r.href),r.target&&n("target=",r.target),n(()=>{mr(r.href)&&n("aria-current=page")})),r.disabled&&n("aria-disabled=true"),n("click=",s=>{if(r.disabled){s.preventDefault();return}t?.(),r.click?.(s)}),r.icon&&n("span.s-menu-icon",()=>x(r.icon)),x(r.label)})}}var ue=n.proxy({opts:null});function fe(){let e=ue.opts?.anchor;ue.opts=null,e?.focus()}function Nn(e,t){let r=e.offsetWidth,s=e.offsetHeight,o=window.innerWidth,i=window.innerHeight,a=4,l=t.left;l+r>o-8&&(l=Math.max(8,t.right-r));let c=t.bottom+a;c+s>i-8&&t.top-s-a>=8&&(c=t.top-s-a),e.style.left=Math.max(8,l)+"px",e.style.top=Math.max(8,c)+"px"}n.mount(document.body,()=>{let e=ue.opts;if(!e)return;let t=n("div.s-menu-list.s-s.panel create=hidden destroy=hidden",e.dropdownAttrs,()=>{Ke(e.items,fe)}),r=o=>{let i=o.target;!t.contains(i)&&!e.anchor.contains(i)&&fe()},s=o=>{(o.key==="Escape"||o.key==="Tab")&&(o.preventDefault(),fe())};document.addEventListener("click",r,!0),document.addEventListener("keydown",s,!0),n.clean(()=>{document.removeEventListener("click",r,!0),document.removeEventListener("keydown",s,!0)}),requestAnimationFrame(()=>{document.body.contains(t)&&(Nn(t,e.anchor.getBoundingClientRect()),t.querySelector(".s-menu-item:not([aria-disabled=true]), .s-menu-item-link:not([aria-disabled=true])")?.focus())})});function It(e){return ue.opts=e,fe}function Be(e){let t=null;n.clean(()=>{ue.opts?.anchor===t&&fe()}),M({icon:()=>n("span aria-hidden=true #\u2630"),ariaLabel:"Open menu",attrs:".neutral .outlined",...e.button,click:r=>{if(t=r.currentTarget,ue.opts?.anchor===t){fe();return}It({items:e.items,anchor:t,dropdownAttrs:e.dropdownAttrs})}})}n.insertGlobalCss({".s-main":{"&":"display:flex flex-direction:column min-height:100vh max-height:100vh container-type:inline-size","> header":"border-bottom: 1px solid $s-border; position:sticky top:0 z-index:10","> footer":"border-top: 1px solid $s-border; fg:$s-fg-muted","> header > .s-bar, > footer > .s-bar":"display:flex align-items:center width:100% margin-inline:auto gap:$3 padding: $2 $3;","> header .s-header-icon":"display:flex align-items:center font-size:1.4em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent;","> header .s-titles":"display:flex flex-direction:column min-width:0 flex:1","> header .s-title":"font-weight:800 font-size:1.1em line-height:1.2 overflow:hidden text-overflow:ellipsis white-space:nowrap letter-spacing:-0.01em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent; width:fit-content max-width:100%","> header .s-subtitle":"fg:$s-fg-muted font-size:0.85em overflow:hidden text-overflow:ellipsis white-space:nowrap","> header .s-menu":"display:flex align-items:center gap:$2",".s-body":"flex:1 overflow:hidden display:flex flex-direction:row min-height:0 justify-content:center",".s-body-inner":"flex:1 display:flex flex-direction:row min-height:0","&.s-nav-right .s-body-inner":"flex-direction:row-reverse",".s-nav-sep":"width:1px flex-shrink:0 align-self:stretch margin: 0.6rem 0; border:0 background: linear-gradient(to bottom, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);","> main, .s-body main":"flex:1 overflow-y:auto display:flex flex-direction:column","> main > .s-content, .s-body main > .s-content":"width:100% flex:1 p:$3","> main.s-scroll-y, .s-body main.s-scroll-y":"margin-right:$3"},".s-nav-panel":{"&":"display:flex flex-direction:column overflow-y:auto flex-shrink:0 max-width:228px padding:$3 gap:$1 background:transparent"},".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:none",".s-main.s-nav-btn-only .s-nav-panel":"display:none",".s-main.s-nav-btn-only .s-nav-trigger":"display:flex","@container (max-width: 640px)":{".s-main.s-nav-left .s-nav-panel, .s-main.s-nav-right .s-nav-panel, .s-main .s-nav-sep":"display:none",".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:flex",".s-content > .s-box":"margin-inline: calc(-1 * $3); r:0 border-inline:0"}});function kr(e={}){let t=e.nav,r=e.navPosition??"left",s=t!=null&&t.items.length>0,o=s?r==="button"?".s-nav-btn-only":`.s-nav-${r}`:"";n(`div.s-main.s-s.base${o}`,e.attrs,()=>{n(()=>{(e.title!=null||e.subtitle!=null||e.icon!=null||e.menu!=null||s)&&n("header.s-s.raised",e.topbarAttrs,()=>{n("div.s-bar",()=>{n(()=>{e.maxWidth!=null&&n("max-width:",e.maxWidth)}),n(()=>{s&&n("div.s-nav-trigger",()=>{Be({...t,button:{icon:()=>n("span aria-hidden=true #\u2630"),ariaLabel:"Open navigation",attrs:".neutral .outlined .small",...t.button}})})}),n(()=>{e.icon!=null&&n("div.s-header-icon",()=>x(e.icon))}),n("div.s-titles",()=>{n(()=>{e.title!=null&&n("div.s-title",()=>x(e.title))}),n(()=>{e.subtitle!=null&&n("div.s-subtitle",()=>x(e.subtitle))})}),n(()=>{e.menu&&n("div.s-menu",()=>e.menu?.())})})})}),s&&r!=="button"?n("div.s-body",()=>{n("div.s-body-inner",()=>{n(()=>{e.maxWidth!=null&&n("max-width:",e.maxWidth)}),n(`nav.s-nav-panel.s-s.raised.s-nav-${r}`,e.navAttrs,()=>{Ke(t.items)}),n("div.s-nav-sep aria-hidden=true"),$r(e,!1)})}):$r(e,!0),n(()=>{e.footer!=null&&n("footer",()=>{n("div.s-bar",()=>{n(()=>{e.maxWidth!=null&&n("max-width:",e.maxWidth)}),x(e.footer)})})})})}function $r(e,t){let r=n("main",()=>{n("div.s-content",e.contentAttrs,()=>{t&&n(()=>{e.maxWidth!=null&&n("margin-inline:auto max-width:",e.maxWidth)}),e.content&&e.content()})});jn(r)}function jn(e){if(typeof ResizeObserver>"u")return;let t=()=>e.classList.toggle("s-scroll-y",e.offsetWidth>e.clientWidth),r=new ResizeObserver(t);r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),t(),n.clean(()=>r.disconnect())}function Fe(e={}){Y(e,(t,r)=>{n("input.s-input",e.inputAttrs,()=>{n("type=",e.type??"text"),e.placeholder!=null&&n("placeholder=",e.placeholder),e.autocomplete!=null&&n("autocomplete=",e.autocomplete),e.value!=null&&!e.bind&&n("value=",e.value),e.input&&n("input=",e.input),e.change&&n("change=",e.change),ce(e,t,r,e.bind)})})}n.insertGlobalCss({".s-backdrop":{"&":"position:fixed inset:0 z-index:200 display:block background: rgba(0,0,0,0.55); transition: opacity 0.4s ease-in-out;","&.hidden":"opacity:0 pointer-events:none"},".s-dialog":{"&":"position:fixed z-index:200 top:50% left:50% display:flex flex-direction:column transform:translate(-50%,-50%) min-width:20rem max-width:min(90vw,44rem) max-height:min(88vh,800px) border: 1px solid $s-border; r: $s-radius-lg; box-shadow: $s-shadow; overflow:hidden transition: opacity 0.2s ease-out, transform 0.2s ease-out;","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600 flex-shrink:0","> footer":"display:flex align-items:center gap:$2 padding: $2 $3; border-top: 1px solid $s-border; flex-shrink:0","> div":"p:$3 gap:$3 display:flex flex-direction:column overflow-y:auto flex:1 min-height:0","&.hidden":"opacity:0 pointer-events:none transform: translate(-50%, calc(-50% + 20px)); pointer-events:none"}});var Z=n.proxy({}),Tt=0,Ln=n.derive(()=>{let e=Object.keys(Z);if(e.length)return e[e.length-1]});n.mount(document.body,()=>{n.onEach(Z,({resolve:e,opts:t},r)=>{let s=()=>{delete Z[r]};n.clean(()=>{t.onClose?.(),e()});let o=n.derive(()=>Ln.value!=r);n("div.s-backdrop create=hidden destroy=hidden .hidden=",o,"click=",()=>{t.allowCancel!==!1&&s()}),n("div.s-dialog.s-s.panel create=hidden destroy=hidden",t.attrs,()=>{n(()=>{t.header!=null&&n("header.s-s.raised",t.headerAttrs,()=>x(t.header))}),n("div",t.contentAttrs,()=>{x(t.content,s)}),n(()=>{t.footer!=null&&n("footer.s-s.raised",t.footerAttrs,()=>x(t.footer))})})})});function $e(e){Tt||document.addEventListener("keydown",r=>{if(r.key==="Escape"&&e.allowCancel!==!1){let s=n.unproxy(Z);for(let o=Tt;o>0;o--)if(s[o]){s[o].opts.allowCancel!==!1&&delete Z[o];break}}});let t=++Tt;return e.cancelWithScope!==!1&&n.clean(()=>{delete Z[t]}),new Promise(r=>{Z[t]={resolve:r,opts:e}})}function Pr(e,t={}){return $e({header:"Alert",allowCancel:!0,content:r=>{n("p",()=>{n("#",e)}),J({layout:"spaced",attrs:"align-self:flex-end",content:()=>{M({text:"OK",click:r})}})},...t})}function Ar(e,t={}){return new Promise(r=>{let s=!1;$e({header:"Confirm",allowCancel:!0,content:o=>{n("p",()=>{n("#",e)}),J({layout:"spaced",attrs:"align-self:flex-end",content:()=>{M({text:"Cancel",attrs:".neutral .outlined",click:o}),M({text:"OK",click:()=>{s=!0,o()}})}})},...t,onClose:()=>{r(s),t.onClose?.()}})})}function Sr(e,t="",r={}){return new Promise(s=>{let o=null;$e({header:"Input",allowCancel:!0,content:i=>{n("p",()=>{n("#",e)});let a=n.proxy({value:t});n("form display:contents",()=>{n("submit=",l=>{l.preventDefault(),o=a.value,i()}),Fe({bind:n.ref(a,"value")}),J({layout:"spaced",attrs:"align-self:flex-end",content:()=>{M({text:"Cancel",attrs:".neutral .outlined",type:"button",click:i}),M({text:"OK",type:"submit"})}})})},...r,onClose:()=>{s(o),r.onClose?.()}})})}n.insertGlobalCss({".s-select_wrap":{"&":"position:relative display:block",select:"w:100% cursor:pointer padding-right:2.2em; appearance:none","&::after":"content: '\u25BE'; position:absolute right:0.7em top:50%; transform: translateY(-50%); pointer-events:none fg:$s-fg-muted font-size:0.85em"}});function Cr(e){Y(e,(t,r)=>{n("div.s-select_wrap",e.inputAttrs,()=>{n("select.s-input",()=>{ce(e,t,r),n("change=",s=>{e.bind&&(e.bind.value=s.target.value)}),n(()=>{let s=typeof e.options=="function"?e.options():e.options,o=e.bind?.value??"";e.placeholder!=null&&n("option",()=>{n("value= disabled=true hidden=true"),o||n("selected=true"),n("#",e.placeholder)});for(let i of s){let a=typeof i=="string"?{value:i,label:i}:{value:i.value,label:i.label??i.value};n("option",()=>{n("value=",a.value),a.value===o&&n("selected=true"),n("#",a.label)})}})})})})}n.insertGlobalCss({".s-tabs":{"&":"display:flex flex-direction:column gap:$3",".s-tablist":"display:flex gap:$1 align-items:stretch overflow-x:auto scrollbar-width:none border-bottom: 1px solid $s-border;",".s-tablist::-webkit-scrollbar":"display:none",".s-tab":"display:inline-flex align-items:center gap:$2 cursor:pointer background:transparent border:0 color: $s-fg-muted; font-weight:600 padding: 0.6em 0.9em; border-bottom: 3px solid transparent; margin-bottom:-1px transition: color 0.15s, background 0.15s, border-color 0.15s;",".s-tab:hover:not(:disabled), .s-tab[aria-selected=true]":"color: $s-fg;",".s-tab:disabled":"opacity:0.5 cursor:not-allowed",".s-tab:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; r: $s-radius;",".s-tab[aria-selected=true]":"border-image: $s-gradient 1;",".s-tabpanel":"display:block"}});function Rr(e){let t=B("tabs"),r=(i,a)=>i.id??String(a),s=e.bind??n.proxy(r(e.tabs[0]??{label:""},0)),o=(i,a)=>{i.disabled||(s.value=r(i,a))};n("div.s-tabs",e.attrs,()=>{n("div.s-tablist role=tablist",()=>{e.tabs.forEach((i,a)=>{let l=r(i,a);n("button.s-tab type=button role=tab",()=>{n(`id=${t}-tab-${l} aria-controls=${t}-panel-${l}`),n(()=>{let c=s.value===l;n("aria-selected=",c?"true":"false"),n("tabindex=",c?"0":"-1")}),i.disabled&&n("disabled=true"),n("click=",()=>o(i,a)),n("keydown=",c=>qn(c,e.tabs,a,o)),x(i.icon),x(i.label)})})}),n("div.s-tabpanel role=tabpanel",e.contentAttrs,()=>{n(()=>{let i=s.value,a=e.tabs.findIndex((c,f)=>r(c,f)===i),l=e.tabs[a]??e.tabs[0];l&&(n(`id=${t}-panel-${r(l,a)} aria-labelledby=${t}-tab-${r(l,a)}`),l.content?.())})})})}function qn(e,t,r,s){let o=r;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=(r+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=(r-1+t.length)%t.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=t.length-1;else return;e.preventDefault();let i=o>=r?1:-1;for(let a=0;a<t.length;a++){let l=t[o];if(l&&!l.disabled){s(l,o),e.currentTarget?.parentElement?.children[o]?.focus();return}o=(o+i+t.length)%t.length}}n.insertGlobalCss({"textarea.s-input":"resize:vertical min-height:3em line-height:1.45","textarea.s-input.s-autoGrow":"resize:none min-height:2.5em overflow-y:hidden"});function Ir(e={}){let t=e.autoGrow!==!1;Y(e,(r,s)=>{let o=n("textarea.s-input",e.inputAttrs,()=>{t?(n(".s-autoGrow"),n("input=",i=>{Er(i.currentTarget),e.input&&e.input(i)})):(n("rows=",e.rows??4),n("resize:",e.resize??"vertical"),e.input&&n("input=",e.input)),e.placeholder!=null&&n("placeholder=",e.placeholder),e.value!=null&&!e.bind&&n("value=",e.value),e.change&&n("change=",e.change),ce(e,r,s,e.bind)});t&&requestAnimationFrame(()=>Er(o))})}function Er(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}var Ge=400,Tr=`margin ${Ge}ms ease-out, transform ${Ge}ms ease-out`;function Mr(e){if(e.parentElement){let t=getComputedStyle(e.parentElement);if(t.display==="flex"&&(t.flexDirection||"").startsWith("row"))return{marginLeft:`-${e.offsetWidth/2}px`,marginRight:`-${e.offsetWidth/2}px`,transform:"scaleX(0)"}}return{marginBottom:`-${e.offsetHeight/2}px`,marginTop:`-${e.offsetHeight/2}px`,transform:"scaleY(0)"}}async function Or(e){let t=Mr(e);Object.assign(e.style,t),e.offsetHeight,e.style.transition=Tr;for(let r in t)e.style[r]="";setTimeout(()=>{e.style.transition=""},Ge)}async function Nr(e){let t=Mr(e);e.style.transition=Tr,Object.assign(e.style,t),setTimeout(()=>{e.remove()},Ge)}n.insertGlobalCss({".s-toasts":"position:fixed bottom:$3 right:$3 z-index:400 display:flex flex-direction:column gap:$2 pointer-events:none max-width:min(90vw,24rem) w:24rem",".s-toast":{"&":"display:flex align-items:flex-start gap:$2 padding: $3; border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow pointer-events:auto",".s-toast-body":"display:flex flex-direction:column gap:$1 flex:1 min-width:0",".s-toast-title":"font-weight:700 line-height:1.3",".s-toast-msg":"font-size:0.9em fg:$s-fg-muted line-height:1.4",".s-toast-close":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.15em; r:4px flex-shrink:0 align-self:flex-start",".s-toast-close:hover":"fg:$s-fg",".s-toast-close:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; fg:$s-fg"}});var Un=0,Ot=n.proxy({});n.mount(document.body,()=>{n("div.s-toasts aria-live=polite aria-atomic=false",()=>{n.onEach(Ot,e=>{let{opts:t}=e,r=t.type==="danger"||t.type==="warning"?"alert":"status",s=t.type??"neutral";n(`div.s-toast.s-s.${s} role=${r}`,"create=",Or,"destroy=",Nr,t.attrs,()=>{n("div.s-toast-body",()=>{n(()=>{t.title!=null&&n("div.s-toast-title",()=>x(t.title))}),n("div.s-toast-msg",()=>x(t.message))}),n(()=>{t.dismissible!==!1&&n("button.s-toast-close type=button aria-label=Dismiss",()=>{n("#\xD7"),n("click=",()=>Mt(e.id))})})})})})});function Mt(e){delete Ot[e]}function jr(e){let t=++Un;Ot[t]={id:t,opts:e};let r=e.duration??4e3,s;return r>0&&(s=setTimeout(()=>Mt(t),r)),()=>{s!=null&&clearTimeout(s),Mt(t)}}n.insertGlobalCss({".s-tt-tip":{"&":"position:fixed z-index:500 max-width:20rem w:max-content bg:$s-raised fg:$s-fg border: 1px solid $s-border-strong; r:$s-radius box-shadow:$s-shadow padding: 0.3em 0.65em; font-size:0.85em line-height:1.4 pointer-events:none"}});var de=n.proxy(void 0),q=null;typeof window<"u"&&window.addEventListener("scroll",()=>{de.value=void 0},{capture:!0,passive:!0});function _n(e,t,r,s){let i=window.innerWidth,a=window.innerHeight,l=0,c=0;return s==="bottom"?(l=e.left+(e.width-t)/2,c=e.bottom+7,c+r>a-8&&(c=e.top-r-7)):s==="left"?(l=e.left-t-7,c=e.top+(e.height-r)/2,l<8&&(l=e.right+7)):s==="right"?(l=e.right+7,c=e.top+(e.height-r)/2,l+t>i-8&&(l=e.left-t-7)):(l=e.left+(e.width-t)/2,c=e.top-r-7,c<8&&(c=e.bottom+7)),{x:Math.max(8,Math.min(l,i-t-8)),y:Math.max(8,Math.min(c,a-r-8))}}function Nt(){q&&clearTimeout(q),q=setTimeout(()=>{de.value=void 0,q=null},100)}n.mount(document.body,()=>{let e=de.value;if(!e)return;let{opts:t,anchor:r}=e,s=t.placement??"top",o=n("div.s-tt-tip role=tooltip visibility:hidden",t.attrs,()=>{n("mouseenter=",()=>{q&&(clearTimeout(q),q=null)}),n("mouseleave=",Nt),x(t.tip)});requestAnimationFrame(()=>{if(!document.body.contains(o))return;let{x:i,y:a}=_n(r.getBoundingClientRect(),o.offsetWidth,o.offsetHeight,s);o.style.left=i+"px",o.style.top=a+"px",o.style.visibility=""})});function Lr(e){let t=r=>{q&&(clearTimeout(q),q=null),de.value={opts:e,anchor:r.currentTarget}};n("mouseenter=",t),n("mouseleave=",Nt),n("focusin=",t),n("focusout=",Nt),n.clean(()=>{de.value?.opts===e&&(de.value=void 0)})}var Dn={main:kr,box:yr,dialog:$e,alert:Pr,confirm:Ar,prompt:Sr,form:vr,menuButton:Be,showFloatingMenu:It,textline:Fe,textarea:Ir,checkbox:wr,tabs:Rr,button:M,buttonChooser:xr,buttonGroup:J,autocomplete:br,select:Cr,toast:jr,addTooltip:Lr,setDarkMode:Et,getDarkMode:ze},g=Dn;var zn=new TextEncoder,jt=new TextDecoder("utf-8",{fatal:!0}),he=Symbol("EOD"),He="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$",_r=new Uint8Array(128).fill(255);for(let e=0;e<He.length;++e)_r[He.charCodeAt(e)]=e;var Lt=typeof process<"u"&&process?.stdout?.isTTY,We=Lt?["\x1B[32m","\x1B[33m","\x1B[34m","\x1B[35m"]:[""],Kn=Lt?"\x1B[0m":"",qr=Lt?"\x1B[31m":"",Ur={array:5,object:6,map:7,set:8,end:9},Ve=0,Bn=typeof process<"u"?!!process.env?.DATAPACK_EXTENDED_LOGGING:!1,F=class e{buffer;dataView;readPos=0;writePos=0;static EOD=he;get _buffer(){return this.buffer}constructor(t=1900){t instanceof Uint8Array?(this.buffer=t,this.writePos=t.length):this.buffer=new Uint8Array(t)}writeMultiByteNumber(t,r,s=!1,o=!1){let i=0,a=t;for(;a>0;)i++,a=Math.floor(a/256);let l=o?~i&31:i;this.buffer[this.writePos++]=r<<5|l;let c=1;for(let f=0;f<i;f++)c*=256;for(let f=0;f<i;f++){c=Math.floor(c/256);let u=Math.floor(t/c)%256;s&&(u^=255),this.buffer[this.writePos++]=u}}readMultiByteNumber(t,r=!1){this.readPos+t>this.writePos&&this.notEnoughData("number");let s=0,o=1;for(let i=t-1;i>=0;i--){let a=this.buffer[this.readPos+i];r&&(a^=255),s+=a*o,o*=256}return this.readPos+=t,s}notEnoughData(t){throw new Error(`Not enough data to read a ${t} at position ${this.readPos} in
|
|
17
|
-
${this.toString(!0)}`)}write(t){if(this.ensureCapacity(33),typeof t=="number")Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER?t>=0?t<32?this.buffer[this.writePos++]=32|t:t<64?this.buffer[this.writePos++]=64|t-32:this.writeMultiByteNumber(t-64,3):this.writeMultiByteNumber(-t,0,!0,!0):(this.buffer[this.writePos++]=128,this.dataView||=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.dataView.setFloat64(this.writePos,t),this.writePos+=8);else if(t===void 0)this.buffer[this.writePos++]=129;else if(t===null)this.buffer[this.writePos++]=130;else if(t===!0)this.buffer[this.writePos++]=131;else if(t===!1)this.buffer[this.writePos++]=132;else if(typeof t=="string"){let r=zn.encode(t);r.length<32?this.buffer[this.writePos++]=160|r.length:this.writeMultiByteNumber(r.length,6),this.ensureCapacity(r.length),this.buffer.set(r,this.writePos),this.writePos+=r.length}else if(t instanceof Uint8Array)this.writeMultiByteNumber(t.length,7),this.ensureCapacity(t.length),this.buffer.set(t,this.writePos),this.writePos+=t.length;else if(Array.isArray(t)||typeof t.length=="number"&&typeof t[Symbol.iterator]=="function"){this.buffer[this.writePos++]=133;for(let r of t)this.write(r);this.buffer[this.writePos++]=137}else if(t instanceof Map){this.buffer[this.writePos++]=135;for(let[r,s]of t)this.write(r),this.write(s);this.buffer[this.writePos++]=137}else if(t instanceof Set){this.buffer[this.writePos++]=136;for(let r of t)this.write(r);this.buffer[this.writePos++]=137}else if(t instanceof Date)this.buffer[this.writePos++]=140,this.write(Math.floor(t.getTime()/1e3));else if(typeof t=="object")t instanceof ke?this.writeCustom(t.name,t.data):typeof t.toDataPack=="function"?t.toDataPack(this):this.writeAsObject(t);else throw new Error(`Unsupported data type: ${typeof t}`);return this}read(t){if(this.readPos>this.writePos)throw new Error("Not enough data");let r=this.buffer[this.readPos++],s=r>>5&7,o=r&31;switch(s){case 0:{let i=~o&31;return-this.readMultiByteNumber(i,!0)}case 1:return o;case 2:return o+32;case 3:return this.readMultiByteNumber(o)+64;case 4:switch(o){case 0:{this.readPos+8>this.writePos&&this.notEnoughData("float64"),this.dataView||=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength);let i=this.dataView.getFloat64(this.readPos);return this.readPos+=8,i}case 1:return;case 2:return null;case 3:return!0;case 4:return!1;case 5:{let i=[];for(;;){let a=this.read(t);if(a===he)break;i.push(a)}return i}case 6:{let i={};for(;;){let a=this.read(t);if(a===he)break;let l=this.read(t);i[a]=l}return i}case 7:{let i=new Map;for(;;){let a=this.read(t);if(a===he)break;let l=this.read(t);i.set(a,l)}return i}case 8:{let i=new Set;for(;;){let a=this.read(t);if(a===he)break;i.add(a)}return i}case 9:return he;case 10:return--this.readPos,this.readIdentifier();case 11:{let i=this.readPos,a=i;for(;a>=this.writePos&&this.notEnoughData("null-terminated string"),this.buffer[a]!==0;)a++;return this.readPos=a+1,jt.decode(this.buffer.subarray(i,a))}case 12:{let i=this.readPositiveInt();return new Date(i*1e3)}case 13:{let i=this.readString(),a=this.read();return t&&i in t?t[i](a):new ke(i,a)}default:throw new Error(`Unknown type 4 subtype: ${o}`)}case 5:{let i=o;this.readPos+i>this.writePos&&this.notEnoughData("short string");let a=this.buffer.subarray(this.readPos,this.readPos+i);return this.readPos+=i,jt.decode(a)}case 6:{let i=this.readMultiByteNumber(o);this.readPos+i>this.writePos&&this.notEnoughData("string");let a=this.buffer.subarray(this.readPos,this.readPos+i);return this.readPos+=i,jt.decode(a)}case 7:{let i=this.readMultiByteNumber(o);this.readPos+i>this.writePos&&this.notEnoughData("blob");let a=this.buffer.slice(this.readPos,this.readPos+i);return this.readPos+=i,new Uint8Array(a)}default:throw new Error(`Unknown type: ${s}`)}}ensureCapacity(t){let r=this.writePos+t;if(r<=this.buffer.length)return;let s=Math.max(r,Math.floor(this.buffer.length*1.5)),o=new Uint8Array(s);o.set(this.buffer.subarray(0,this.writePos)),this.buffer=o,delete this.dataView}readNumber(){let t=this.read();if(typeof t!="number")throw new Error("Expected number but got "+typeof t);return t}readDate(){let t=this.read();if(!(t instanceof Date))throw new Error("Expected Date but got "+typeof t);return t}readPositiveInt(t){let r=this.read();if(typeof r!="number"||!Number.isInteger(r)||r<0||t!==void 0&&r>=t)throw new Error(`Expected positive integer < ${t} but got ${r}`);return r}readBoolean(){let t=this.read();if(typeof t!="boolean")throw new Error("Expected boolean but got "+typeof t);return t}readUint8Array(){let t=this.read();if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array but got "+typeof t);return t}readString(){let t=this.read();if(typeof t!="string")throw new Error("Expected string but got "+typeof t);return t}writeIdentifier(t){let r=0;if(typeof t=="number")r=t;else{if(t.length!==8)throw new Error(`Identifier must be exactly 8 characters, got ${t.length}`);let s;for(let o=0;o<8;o++){let i=t.charCodeAt(o);if(i>127||(s=_r[i])===255)throw new Error(`Invalid base64 character: ${t[o]}`);r=r*64+s}}this.ensureCapacity(7),this.buffer[this.writePos++]=138;for(let s=5;s>=0;s--)this.buffer[this.writePos+s]=r%256,r=Math.floor(r/256);return this.writePos+=6,this}readIdentifier(){let t=this.readIdentifierNumber(),r="";for(let s=0;s<8;s++)r=He[t%64]+r,t=Math.floor(t/64);return r}readIdentifierNumber(){if(this.readPos+7>this.writePos&&this.notEnoughData("identifier"),this.buffer[this.readPos++]!==138)throw new Error("Invalid identifier header");let r=0;for(let s=0;s<6;s++)r=r*256+this.buffer[this.readPos++];return r}writeOrderedString(t){let r=new TextEncoder().encode(t);if(r.includes(0))throw new Error("String contains null character");return this.ensureCapacity(r.length+2),this.buffer[this.writePos++]=139,this.buffer.set(r,this.writePos),this.writePos+=r.length,this.buffer[this.writePos++]=0,this}toUint8Array(t=!0,r=0,s=this.writePos){return t?this.buffer.slice(r,s):this.buffer.subarray(r,s)}toBuffer(){return this.buffer.buffer.slice(0,this.writePos)}clone(t,r=0,s=this.writePos){if(t)return new e(this.buffer.slice(r,s));{let o=new e(this.buffer);return o.readPos=r,o.writePos=s,o}}writeCustom(t,r){this.buffer[this.writePos++]=141,this.write(t),this.write(r)}writeAsObject(t){this.buffer[this.writePos++]=134;for(let r of Object.keys(t))this.write(r),this.write(t[r]);return this.buffer[this.writePos++]=137,this}writeCollection(t,r){return this.writeCollectionBoundary(t),r(t==="array"||t==="set"?s=>{this.write(s)}:t==="object"?(s,o)=>{this.writeObjectKey(s),this.write(o)}:(s,o)=>{this.write(s),this.write(o)}),this.writeCollectionBoundary("end")}writeCollectionBoundary(t){let r=Ur[t];if(!r)throw new Error(`Invalid collection type: ${t}`);return this.buffer[this.writePos++]=128|r,this}writeObjectKey(t){if(typeof t=="string"){let r=parseInt(t,10);r.toString()==t&&(t=r)}else typeof t!="number"&&(t=""+t);this.write(t)}readCollectionBoundary(t){this.readPos>=this.writePos&&this.notEnoughData("collection boundary");let r=this.buffer[this.readPos++],s=128|Ur[t];if(r!==s)throw new Error(`Expected ${t} boundary but got byte ${r}`)}increment(){for(let t=this.writePos-1;t>=0;t--)if(this.buffer[t]===255)this.buffer[t]=0;else return this.buffer[t]++,this}toString(t=void 0,r=0,s=this.writePos){t===void 0&&(t=Bn);let o=this.readPos;this.readPos=r;let i=0,a="",l="",c=Ve,f=c>0?We[(c-1)%We.length]:Kn;try{for(;this.readPos<s;){let u=We[Ve++%We.length];if(a+=u+me(this.read())+" ",t)for(l+=u;i<this.readPos;)l+=this.buffer[i].toString(16).padStart(2,"0")+" ",i++}}catch{if(!t)return this.readPos=o,Ve=c,this.toString(!0,r,s);for(a+=qr+"ERROR ",l+=qr;i<this.writePos;)l+=this.buffer[i].toString(16).padStart(2,"0")+" ",i++}return this.readPos=o,c||(Ve=0),t?"DataPack{"+l+f+"\u2192 "+a.trimEnd()+f+"}":"DataPack{"+a.trimEnd()+f+"}"}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}readAvailable(){return this.readPos<this.writePos}static generateIdentifier(){let t=Math.floor(+new Date*256+Math.random()*16384),r="";for(let s=0;s<8;s++)r=He[t&63]+r,t=Math.floor(t/64);return r}static createBuffer(...t){let r=new e;for(let s of t)r.write(s);return r.toBuffer()}static createUint8Array(...t){let r=new e;for(let s of t)r.write(s);return r.toUint8Array(!1)}};function me(e){if(e===void 0)return"undefined";if(typeof e=="object"&&e!==null){if(e instanceof Uint8Array)return new F(e).toString();if(e instanceof Array)return"["+e.map(t=>me(t)).join(", ")+"]";if(e instanceof Map)return"Map{"+Array.from(e.entries()).map(([t,r])=>`${me(t)}=>${me(r)}`).join(", ")+"}";if(e instanceof Set)return"Set{"+Array.from(e.values()).map(t=>me(t)).join(", ")+"}";if(typeof e=="object"&&e!==null)return"{"+Object.entries(e).map(([t,r])=>`${t}:${me(r)}`).join(", ")+"}"}return JSON.stringify(e)}var ke=class{name;data;constructor(t,r){this.name=t,this.data=r}};F.prototype.CustomData=ke;var G={error:"e",response:"r",response_proxy:"p",response_model:"m",response_proxy_model:"q",model_data:"d"},qt={call:1,cancel:2};var I=0;var Ye=Symbol(),Je=class{constructor(t){this.url=t;this.api=new Proxy({connection:this,requestId:void 0},Dr),this.connect()}url;ws;activeRequests=new Map;requestCounter=0;reconnectAttempts=0;_proxyCounter=0;$state=n.proxy({online:!1,error:void 0});streamCache=new Map;get[n.OPAQUE](){return!0}api;isOnline(){return this.$state.online}getError(){return this.$state.error}connect(){let t;try{t=this.ws=typeof this.url=="string"?new WebSocket(this.url):this.url()}catch(r){console.error("WebSocket connection error:",r),this.$state.error=r?.message||"WebSocket connection error";return}t.binaryType="arraybuffer",I>=1&&console.log(`[lowlander] Connecting to WebSocket at ${typeof this.url=="string"?this.url:"[custom WebSocket]"}`),t.onopen=()=>{if(t===this.ws){I>=1&&console.log("[lowlander] WebSocket connected"),this.$state.online=!0,this.$state.error=void 0,this.reconnectAttempts=0;for(let r of this.activeRequests.values())r.$result.busy=!0,this.ws.send(r.requestBuffer)}},t.onclose=()=>{t===this.ws&&(I>=1&&console.log("[lowlander] WebSocket disconnected"),this.reconnect())},t.onerror=r=>{t===this.ws&&(console.error("WebSocket error:",r),this.$state.error=r?.message||"WebSocket connection error",this.reconnect())},t.onmessage=r=>{if(t!==this.ws)return;let s=new F(new Uint8Array(r.data)),o=s.readPositiveInt(),i=this.activeRequests.get(o);if(!i)return;let a=n.unproxy(i.$result),l=s.read();if(typeof l=="number"){let c=i.callbacks?.[l],f=[];for(;s.readAvailable();)f.push(s.read());c(...f);return}if(l===G.model_data){i.database||=new Map,i.commitIds||=new Map;let c=s.readNumber(),f=s.readNumber(),u=s.read({model:function(b){let A=i.database.get(b);return A||console.error("Unknown linked model hash "+b),A}});I>=3&&console.log("[lowlander] incoming model_data",o,c,f,u),setTimeout(()=>this.pruneCommitIds(i,f),15e3);let d=i.commitIds.get(c);if(!u){if(d&&f<Math.max(...d.values()))return;i.database.delete(c),i.commitIds.set(c,new Map([[Ye,f]]));return}let h=i.database.get(c);if(h){d||(d=new Map,i.commitIds.set(c,d));for(let b of Object.keys(u))f<(d.get(b)??d.get(Ye)??-1)||(u[b]&&typeof u[b]=="object"?n.copy(h,b,u[b]):h[b]=u[b],d.set(b,f))}else{if(d&&f<(d.get(Ye)??-1))return;let b=n.proxy(u);n.unproxy(b)[n.OPAQUE]=!1,i.database.set(c,b),i.commitIds.set(c,new Map([[Ye,f]]))}return}if(l===G.error){let c=s.readString();i.$result.error=new Error(c),I>=2&&console.log(`[lowlander] incoming error requestId=${o} message=${c}`)}else if(l===G.response||l===G.response_proxy)i.$result.value=s.read(),i.virtualSocketIds=s.read(),i.hasServerProxy=l===G.response_proxy,I>=2&&console.log(`[lowlander] incoming response requestId=${o} value=${a.value} virtualSocketIds=${i.virtualSocketIds} hasServerProxy=${i.hasServerProxy}`);else if(l===G.response_model||l===G.response_proxy_model){i.virtualSocketIds=s.read();let c=s.readNumber(),f=s.read(),u=i.database?.get(c);i.hasServerProxy=l===G.response_proxy_model,I>=2&&console.log(`[lowlander] incoming ${i.hasServerProxy?"response_proxy_model":"response_model"} requestId=${o} dbKey=${c} cacheMs=${f} obj=${u}`),u?i.$result.value=n.proxy(u):i.$result.error=new Error("Unknown database key "+c),f!==void 0&&i.cacheKey&&!this.streamCache.has(i.cacheKey)&&this.streamCache.set(i.cacheKey,{request:i,cacheKey:i.cacheKey,cacheMs:f,refCount:1})}else throw new Error("Unknown message type "+l);!i.hasServerProxy&&!i.virtualSocketIds?.length&&this.activeRequests.delete(o),i.hasServerProxy||delete i.$result.serverProxy,i.$result.busy=!1,i.resolve&&(a.error!=null?(console.error(a.error),i.reject(a.error)):i.resolve(a.value),delete i.resolve,delete i.reject)}}reconnect(){if(this.ws=void 0,this.$state.online=!1,typeof this.url!="string")return;let t=Math.min(500*Math.pow(2,this.reconnectAttempts),2e4);this.reconnectAttempts++,I>=1&&console.log(`[lowlander] Reconnecting in ${t}ms (attempt ${this.reconnectAttempts})`),setTimeout(this.connect.bind(this),t)}pruneCommitIds(t,r){if(t.commitIds)for(let[s,o]of t.commitIds){for(let[i,a]of o)a<=r&&o.delete(i);o.size||t.commitIds.delete(s)}}_createMethodStub(t,r){return(...s)=>{let i=s.some(h=>typeof h=="function")?void 0:(r??"")+":"+t+":"+JSON.stringify(s);if(i){let h=this.streamCache.get(i);if(h)return h.lingerTimeout&&(clearTimeout(h.lingerTimeout),h.lingerTimeout=void 0),h.refCount++,I>=2&&console.log(`[lowlander] reusing cached stream cacheKey=${i} refCount=${h.refCount}`),n.clean(()=>{h.refCount--,I>=2&&console.log(`[lowlander] clean cached consumer cacheKey=${i} refCount=${h.refCount}`),h.refCount<=0&&this.startLinger(h)}),h.request.$result}let a={busy:!0},l=n.proxy(a),c=++this.requestCounter,f=new F;f.write(c).write(qt.call).write(r).write(t);let u;f.writeCollection("array",()=>{for(let h of s)typeof h=="function"?(u||=[],f.writeCustom("cb",u.length),u.push(h)):f.write(h)});let d={$result:l,requestBuffer:f.toUint8Array(!0),requestId:c,connection:this,callbacks:u,cacheKey:i};return a.serverProxy=new Proxy(d,Dr),a.promise=new Promise((h,b)=>{d.resolve=h,d.reject=b}),this.activeRequests.set(c,d),I>=2&&console.log(`[lowlander] outgoing call requestId=${c} method=${t} params=`,s),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(d.requestBuffer),n.clean(()=>{let h=i?this.streamCache.get(i):void 0;if(h&&h.request===d){h.refCount--,I>=2&&console.log(`[lowlander] clean stream owner cacheKey=${i} refCount=${h.refCount}`),h.refCount<=0&&this.startLinger(h);return}this.cancelRequest(d)}),l}}cancelRequest(t){if(this.activeRequests.delete(t.requestId),t.virtualSocketIds?.length||t.hasServerProxy){I>=2&&console.log(`[lowlander] outgoing cancel requestId=${t.requestId} virtualSocketIds=${t.virtualSocketIds} hasServerProxy=${t.hasServerProxy}`);let r=F.createUint8Array(++this.requestCounter,qt.cancel,t.requestId,t.virtualSocketIds);this.ws?.send(r)}}startLinger(t){t.lingerTimeout&&clearTimeout(t.lingerTimeout),I>=2&&console.log(`[lowlander] start linger cacheKey=${t.cacheKey} cacheMs=${t.cacheMs}`),t.lingerTimeout=setTimeout(()=>{t.refCount>0||(I>=2&&console.log(`[lowlander] linger expired cacheKey=${t.cacheKey}`),this.streamCache.delete(t.cacheKey),this.cancelRequest(t.request))},t.cacheMs)}},Dr={get(e,t){if(typeof t=="symbol")return t===n.OPAQUE?!0:t===n.CUSTOM_DUMP?`<ServerProxy for #${e.requestId}>`:void 0;if(e.serverProxyCache?.has(t))return e.serverProxyCache.get(t);if(t==="then"||t==="catch"||t==="finally")return;if(t==="constructor")return{name:"ServerProxy-"+e.requestId};let r=e.connection._createMethodStub(t,e.requestId);return e.serverProxyCache||(e.serverProxyCache=new Map),e.serverProxyCache.set(t,r),r},has(e,t){return typeof t=="string"||t===n.NO_COPY}};function Qe(e,t){if(t==null)return null;switch(e.kind){case"dateTime":return typeof t=="string"?t.slice(0,16):t;case"link":return t?.__ref!=null?t.pk:t;case"array":case"set":return Array.isArray(t)?t.map(s=>Qe(e.inner,s)):[];case"record":if(!t||typeof t!="object")return{};let r={};for(let[s,o]of Object.entries(t))r[s]=Qe(e.innerValue,o);return r;case"or":return e.isOptional&&e.inner?t===null?null:Qe(e.inner,t):t;default:return t}}function Xe(e){if(e.isOptional)return null;switch(e.kind){case"string":return"";case"number":return 0;case"boolean":return!1;case"dateTime":return new Date().toISOString().slice(0,16);case"array":case"set":return[];case"record":return{};case"link":return null;case"or":case"literal":return null;default:return""}}function Ze(e,t){n("div.s-field",()=>{e!=null&&n("label",()=>n("#",e)),t()})}function et(e,t,r,s,o=!1){if(e.isOptional&&e.inner){Fn(e.inner,t,r,s,o);return}switch(e.kind){case"string":g.textline({label:s,disabled:o,bind:t});return;case"id":g.textline({label:s,disabled:!0,bind:t,help:o?"auto-generated":void 0});return;case"number":g.textline({label:s,type:"number",disabled:o,bind:t});return;case"boolean":g.checkbox({label:s??"Yes",disabled:o,bind:t});return;case"dateTime":g.textline({label:s,type:"datetime-local",disabled:o,bind:t});return;case"link":Wn(e,t,r,s,o);return;case"array":case"set":Vn(e,t,r,s,o);return;case"record":Hn(e,t,r,s,o);return;case"or":{let i=e.choices??[];if(i.length&&i.every(a=>a.kind==="literal")){Gn(i,t,s,o);return}Ut(t,s,o);return}case"literal":g.textline({label:s,disabled:!0,value:e.literalValue??""});return;default:Ut(t,s,o)}}function Fn(e,t,r,s,o=!1){let i=n.peek(()=>t.value!==null&&t.value!==void 0),a=n.proxy({v:i?"set":"undefined"});n(()=>{a.v==="set"?(n.peek(()=>t.value)===null||n.peek(()=>t.value)===void 0)&&(t.value=Xe(e)):t.value=null}),Ze(s,()=>{g.buttonChooser({attrs:o?"pointer-events:none opacity:0.6":void 0,options:{set:"set",undefined:"undefined"},bind:n.ref(a,"v")}),n(()=>{a.v==="set"&&et(e,t,r,void 0,o)})})}function Gn(e,t,r,s=!1){let o=f=>f==null?"undefined":JSON.stringify(f),i=f=>f===null||f==="undefined"?null:JSON.parse(f),a={},l=!1;for(let f of e){let u=f.literalValue??"undefined";u==="undefined"?(l=!0,a[u]="(none)"):a[u]=String(i(u))}let c=n.proxy({v:o(n.peek(()=>t.value))});n(()=>{t.value=i(c.v)}),Ze(r,()=>{g.buttonChooser({attrs:s?"pointer-events:none opacity:0.6":void 0,options:a,bind:n.ref(c,"v"),allowDeselect:!l})})}function Wn(e,t,r,s,o=!1){let i=e.linkedModel;if(!i){Ut(t,s,o);return}let a=n.peek(()=>t.value),l=n.proxy({v:a==null?"":String(a)});n(()=>{let f=l.v;if(f==="")t.value=null;else{let u=Number(f);t.value=!isNaN(u)&&!/[^0-9.\-]/.test(f)?u:f}});let c=n.proxy({rows:[]});n(()=>{let f=r.serverProxy.findRecords(i,"(primary)",{limit:100});n(()=>{f.value&&(c.rows=f.value.rows)})}),g.autocomplete({label:s,disabled:o,allowCustom:!1,placeholder:`Search ${i}\u2026`,bind:n.ref(l,"v"),options:()=>c.rows.map(f=>({value:_t(f.pk),label:_t(f.pk)}))})}function Vn(e,t,r,s,o=!1){let i=e.inner,[a,l]=n.peek(()=>{let c=t.value,f=Array.isArray(c)?c:[],u=n.proxy(f.map(h=>({v:h}))),d=n.proxy({v:u.length});return[u,d]});n(()=>{t.value=a.map(c=>c.v)}),Ze(s,()=>{n("div.s-s.raised","display:flex flex-direction:column gap:$2 p:$2 r:$s-radius-lg border: 1px solid $s-border;",()=>{n(()=>{let c=l.v;c===0&&n("span","fg:$s-fg-faint font-size:0.9em","#(empty)");for(let f=0;f<c;f++){let u=f;n("div","display:flex gap:$2 align-items:flex-start",()=>{n("div","flex:1",()=>{let d=n.ref(a[u],"v");et(i,d,r,void 0,o)}),o||g.button({text:"\xD7",attrs:".outlined.danger .small flex-shrink:0 mt:$3",click:()=>{a.splice(u,1),l.v=a.length}})})}}),o||g.button({text:`+ Add ${i.display}`,attrs:".tonal .small",click:()=>{a.push({v:Xe(i)}),l.v=a.length}})})})}function Hn(e,t,r,s,o=!1){let i=e.innerValue,[a,l]=n.peek(()=>{let c=t.value,f=c&&typeof c=="object"&&!Array.isArray(c)?c:{},u=n.proxy(Object.entries(f).map(([h,b])=>({k:h,v:b}))),d=n.proxy({v:u.length});return[u,d]});n(()=>{let c={};for(let f of a)f.k!==""&&(c[f.k]=f.v);t.value=c}),Ze(s,()=>{n("div.s-s.raised","display:flex flex-direction:column gap:$4 p:$2 r:$s-radius-lg border: 1px solid $s-border;",()=>{n(()=>{let c=l.v;c===0&&n("span","fg:$s-fg-faint font-size:0.9em","#(empty)");for(let f=0;f<c;f++){let u=f;n("div","display:flex flex-direction:column gap:$1",()=>{n("div","display:flex gap:$2 align-items:center",()=>{o?n("code","flex:1 font-size:0.85em fg:$s-fg-muted","#",n.peek(()=>a[u].k)):n("div","flex:1",()=>{g.textline({placeholder:"key",bind:n.ref(a[u],"k")})}),o||g.button({text:"\xD7",attrs:".outlined.danger .small flex-shrink:0",click:()=>{a.splice(u,1),l.v=a.length}})}),n("div",()=>{let d=n.ref(a[u],"v");et(i,d,r,void 0,o)})})}}),o||g.button({text:"+ Add entry",attrs:".tonal .small",click:()=>{a.push({k:"",v:Xe(i)}),l.v=a.length}})})})}function Ut(e,t,r=!1){let s=n.peek(()=>e.value),o=n.proxy({v:s===void 0?"":_t(s)}),i=n.proxy({v:""});n(()=>{let a=o.v;if(a.trim()===""){e.value=void 0,i.v="";return}try{e.value=JSON.parse(a),i.v=""}catch{i.v="Invalid JSON"}}),g.textarea({label:t,disabled:r,rows:3,bind:n.ref(o,"v")}),n(()=>{i.v&&n("div","fg:$s-danger font-size:0.82em mt:$1","#",i.v)})}function zr(e,t,r,s,o,i,a){let l={};for(let f of r)l[f.name]=n.proxy({v:s(f)});let c=n.proxy({saving:!1});g.dialog({header:t,attrs:"width:800px",content:f=>{g.form({content:()=>{for(let u of r)et(u.type,n.ref(l[u.name],"v"),e,u.name,o(u))},layout:"grid",actions:()=>{g.button({text:"Cancel",attrs:".outlined.neutral",click:f}),n(()=>{g.button({text:i,type:"button",disabled:c.saving,click:async()=>{c.saving=!0;try{await a(l,f)}catch(u){g.toast({message:u?.message??String(u),type:"danger"})}finally{c.saving=!1}}})})}})}})}function Kr(e,t,r,s){let o=r.filter(i=>i.type.kind!=="id");zr(e,`New ${t}`,o,i=>Xe(i.type),()=>!1,"Create",async(i,a)=>{let l={};for(let f of o)l[f.name]=i[f.name].v;let c=await e.serverProxy.createRecord(t,l).promise;a(),s?.(c)})}function Br(e,t,r,s,o,i){zr(e,`Edit ${t}`,r,a=>Qe(a.type,o[a.name]),a=>a.isPk,"Save",async(a,l)=>{let c={};for(let f of r)f.isPk||(c[f.name]=a[f.name].v);await e.serverProxy.updateRecord(t,s,c).promise,l(),i?.()})}function Fr(e,t,r,s,o){let i=n.proxy({deleting:!1,error:""});g.dialog({header:`Delete ${t}`,content:a=>{n("p","fg:$s-fg m:0",()=>{n("#Delete "),n("strong","#",s),n("#? This cannot be undone.")}),n(()=>{i.error&&n("p","fg:$s-danger m:0","#",i.error)}),n("div","display:flex gap:$2 mt:$3",()=>{g.button({text:"Delete",attrs:".danger",disabled:n.peek(()=>i.deleting),click:async()=>{i.deleting=!0,i.error="";try{await e.serverProxy.deleteRecord(t,r).promise,a(),o?.()}catch(l){i.error=l?.message??String(l),i.deleting=!1}}}),g.button({text:"Cancel",attrs:".outlined.neutral",click:a})})}})}function _t(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}var Wr="lowlander-dashboard";function Yn(){try{return JSON.parse(localStorage.getItem(Wr)||"{}")}catch{return{}}}function Vr(e){localStorage.setItem(Wr,JSON.stringify(e))}var Jn=()=>`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/`,Gr=Yn(),p=n.proxy({wsUrl:Gr.wsUrl||Jn(),password:Gr.password||"",loginError:"",connected:!1,authed:!1,indexRefreshKey:0,connecting:!1,connection:void 0}),tt,N,w={get debug(){return P.search.debug==="1"},set debug(e){ee("debug",e?"1":"")},get model(){return P.search.model||""},set model(e){ee("model",e)},get index(){return P.search.index||""},set index(e){ee("index",e)},get search(){return P.search.search||""},set search(e){ee("search",e)},get reverse(){return P.search.reverse==="1"},set reverse(e){ee("reverse",e?"1":"")},get limit(){return parseInt(P.search.limit||"10",10)||10},set limit(e){ee("limit",e===10?"":String(e))},get pk(){return P.search.pk||""},set pk(e){ee("pk",e)}};function ee(e,t){let r=P.search;t===""||t===void 0?delete r[e]:r[e]=t}function zt(){return w.index||"(primary)"}function rt(){return w.pk==="-"?"":w.pk}var Pe=n.insertCss({"&":"w:100% font-size:12.5px","& tbody tr":"cursor:default","& tbody tr:hover":"background: color-mix(in srgb, $s-fg 5%, transparent);","& tbody tr.selectable":"cursor:pointer","& tbody tr.selected":"background: color-mix(in srgb, $s-accent 15%, transparent);","& tbody tr.selected td:first-child":"border-left: 3px solid $s-accent; padding-left: 5px;"});function Qn(){g.main({title:"Lowlander Dashboard",maxWidth:"24rem",content:()=>{n(()=>{if(p.connecting&&!p.connection?.getError()){n("p","text-align:center fg:$s-fg-muted","#Connecting\u2026");return}g.form({submit:()=>Hr(),content:()=>{g.textline({label:"WebSocket URL",bind:n.ref(p,"wsUrl")}),g.textline({label:"Password",type:"password",bind:n.ref(p,"password"),inputAttrs:"autofocus=autofocus"}),n(()=>{let e=p.connection?.getError()||p.loginError;e&&n("p","fg:$s-danger m:0","text=",e)})},actions:()=>g.button({text:p.connected&&!p.authed?"Checking\u2026":"Log in",type:"submit",disabled:p.connected&&!p.authed})})})}})}async function Hr(){p.connecting=!0,p.loginError="",Vr({wsUrl:p.wsUrl,password:p.password});try{p.connection&&p.connection.ws?.close?.()}catch{}p.connection=new Je(p.wsUrl),tt=p.connection.api,p.connected=!1,p.authed=!1;let e=tt._dashboard(p.password);N=e;try{await e.promise,p.connected=!0,p.authed=!0,p.connecting=!1}catch(t){p.connecting=!1,p.loginError=t?.message||"Login failed",p.connected=!1,p.authed=!1,p.connection=void 0,tt=void 0,N=void 0}}function Xn(){p.authed=!1,p.connected=!1,p.password="",Vr({wsUrl:p.wsUrl,password:""});try{p.connection?.ws?.close?.()}catch{}p.connection=void 0,tt=void 0,N=void 0}var Zn=()=>{let e=N.serverProxy.listModels();n(()=>{if(e.busy){n("p","p:$2 fg:$s-fg-muted font-size:0.9em m:0","#Loading\u2026");return}if(e.error){n("p","p:$2 fg:$s-danger font-size:0.9em m:0","text=",e.error.message);return}for(let t of e.value??[])n("button.s-menu-item type=button","justify-content:space-between",()=>{n(()=>{!w.debug&&w.model===t.tableName&&n("aria-current=page")}),n("click=",()=>De({path:P.path,search:{model:t.tableName}})),n("span","text=",t.tableName),n("span","font-size:0.78em opacity:0.65","text=",`${t.fieldCount}f ${t.indexCount}i ${t.streamTypeCount}s`)})})},es=()=>{n("button.s-menu-item type=button",()=>{n(()=>{w.debug&&n("aria-current=page")}),n("click=",()=>De({path:P.path,search:{debug:"1"}})),n("span.s-menu-icon aria-hidden=true #\u2B21"),n("#WarpSocket debug")})};function ts(){g.main({icon:"\u2B21",title:"Lowlander",menu:()=>g.button({text:"Logout",attrs:".neutral .outlined .small",click:Xn}),nav:{items:[Zn,{separator:!0},es]},content:()=>{w.debug?cs():w.model?rs():n("p","fg:$s-fg-muted text-align:center mt:$4","#Select a model from the sidebar")}})}function rs(){let e=w.model,t=N.serverProxy.getModel(e);n(()=>{if(t.busy){n("p","fg:$s-fg-muted","#Loading\u2026");return}if(t.error){n("p","fg:$s-danger","text=",t.error.message);return}let r=t.value;r&&(g.box({header:r.tableName,content:()=>{n("table",Pe,()=>{n("thead tr",()=>{n("th#Name"),n("th#Type"),n("th#Linked"),n("th#Default"),n("th#Description")}),n("tbody",()=>{for(let s of r.fields)n("tr",()=>{n("td",()=>n("code","text=",s.name)),n("td","fg:$s-success","text=",s.type.display),n("td",()=>{let o=s.type.linkedModel;o&&Bt(o)}),n("td","text=",s.hasDefault?"\u2713":""),n("td","fg:$s-fg-muted","text=",s.description||"")})})})}}),g.box({header:"Indexes",content:()=>ns(r)}),n(()=>{let s=zt(),o=r.indexes.find(i=>i.name===s);o&&g.box({header:()=>{n("span","flex:1","text=",`Data \xB7 ${s}`),g.button({text:"+ New",attrs:".outlined .small",click:()=>{Kr(N,r.tableName,r.fields,()=>{p.indexRefreshKey++})}})},content:()=>as(r,o)})}),r.streamTypes.length&&g.box({header:"Stream types",content:()=>ss(r)}))})}function Bt(e,t,r){n("a","click=",s=>{s.preventDefault(),s.stopPropagation();let o={model:e};t!==void 0&&(o.search=nt(t),o.limit=1),De({path:P.path,search:o})},"text=",r??e)}function nt(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function ns(e){n("table",Pe,()=>{n("thead tr",()=>{n("th#Name"),n("th#Kind"),n("th#Fields")}),n("tbody",()=>{for(let t of e.indexes)n("tr.selectable","click=",()=>{zt()!==t.name&&(w.index=t.name==="(primary)"?"":t.name,w.pk="",w.search="")},()=>{n(()=>n(".selected=",zt()===t.name)),n("td",()=>n("code","text=",t.name)),n("td","fg:$s-success","text=",t.info.kind),n("td","text=",t.info.fields.join(", ")||"(computed)")})})})}function ss(e){let t={};for(let o of e.fields)t[o.name]=o;let r=new Set,s=e.streamTypes.filter(o=>r.has(o.id)?!1:(r.add(o.id),!0));n("table",Pe,()=>{n("thead tr",()=>{n("th#id"),n("th#cache"),n("th#fields"),n("th","w:100%","#live view for selected row")}),n("tbody",()=>{for(let o of s)n("tr",()=>{n("td",()=>n("code","text=",String(o.id))),n("td","text=",o.cache?`${o.cache}s`:""),n("td",()=>is(o.fields,t)),n("td",()=>os(e.tableName,o.id))})})})}function is(e,t){if(e===!0){n("span","fg:$s-fg-muted","#(scalar)");return}if(!e||typeof e!="object"){n("span","text=",String(e));return}for(let[r,s]of Object.entries(e))if(typeof s=="number"){let o=t[r]?.type?.linkedModel;n(`div#${r}\u2192`,()=>{o?Bt(o,void 0,s.toString()):n("#?")})}else s===!1?n(`div#${r}*`):n(`div#${r}`)}function os(e,t){n(()=>{let r=rt();if(!r){n("span","fg:$s-fg-muted","#(select a row)");return}let s;try{s=JSON.parse(r)}catch{s=r}let o=N.serverProxy.streamRecord(e,t,s);n(()=>{if(o.busy){n("span","fg:$s-fg-muted","#\u2026");return}if(o.error){n("span","fg:$s-danger","text=",o.error.message);return}n.dump(o.value)})})}function as(e,t){let r=e.tableName,s=t.name,o={get value(){return w.search},set value(a){w.search=String(a),w.limit=10}},i={get value(){return w.reverse},set value(a){w.reverse=!!a}};n("div","display:flex flex-direction:column gap:$3",()=>{n("div","display:flex flex-wrap:wrap gap:$2 align-items:center",()=>{g.textline({placeholder:"search",attrs:"flex:1 min-w:180px",bind:o}),g.checkbox({label:"reverse",bind:i}),g.button({text:"\u21BA",attrs:".outlined .small",ariaLabel:"Refresh",click:()=>p.indexRefreshKey++})}),n(()=>{p.indexRefreshKey;let a={search:ls(w.search),reverse:w.reverse,limit:w.limit},l=N.serverProxy.findRecords(r,s,a);n(()=>{if(l.busy){n("p","fg:$s-fg-muted","#Loading\u2026");return}if(l.error){n("p","fg:$s-danger","text=",l.error.message);return}let c=l.value;if(c){if(!w.pk&&c.rows.length>0){w.pk=nt(c.rows[0].pk);return}if(n("p","fg:$s-fg-muted font-size:0.85em m:0","text=",`${c.rows.length} rows (scanned ${c.scanned})`),!c.rows.length){n("p","fg:$s-fg-muted m:0","#(empty)");return}n("div","overflow:auto",()=>{n("table",Pe,()=>{let f=Object.keys(c.rows[0].values);n("thead tr",()=>{for(let u of f)n("th","text=",u);n("th","w:1px")}),n("tbody",()=>{for(let u of c.rows){let d=nt(u.pk);n("tr.selectable","click=",()=>{w.pk=rt()===d?"-":d},()=>{n(()=>n(".selected=",rt()===d));for(let h of f)n("td",()=>n.dump(Kt(u.values[h])));n("td","text-align:right white-space:nowrap",()=>{g.button({text:"\u270E",attrs:".outlined .small mr:$1",ariaLabel:"Edit",click:h=>{h.stopPropagation(),Br(N,r,e.fields,u.pk,u.values,()=>{p.indexRefreshKey++})}}),g.button({text:"\u2715",attrs:".danger .outlined .small",ariaLabel:"Delete",click:h=>{h.stopPropagation(),Fr(N,r,u.pk,d,()=>{p.indexRefreshKey++,rt()===d&&(w.pk="-")})}})})})}})})}),c.rows.length>=w.limit&&n(()=>g.button({text:`+ more (currently limit ${w.limit})`,attrs:".outlined .small",click:()=>{let f=w.limit;w.limit=Math.min(f*5,f+250)}}))}})})})}function Kt(e){if(e==null||typeof e!="object"||e instanceof Date)return e;if(e.__ref){let r=e.__ref,s=e.pk;return{[n.CUSTOM_DUMP](){Bt(r,s,`<${r} ${nt(s)}>`)}}}if(Array.isArray(e))return e.map(Kt);let t={};for(let[r,s]of Object.entries(e))t[r]=Kt(s);return t}function ls(e){if(e!==""){if(e==="true")return!0;if(e==="false")return!1;if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);try{return JSON.parse(e)}catch{}return e}}function cs(){let e=n.proxy({value:"channels"});g.tabs({bind:e,tabs:["channels","sockets","workers","kv"].map(t=>({id:t,label:t,content:()=>{let r=N.serverProxy.getDebugState(t);n(()=>{if(r.busy){n("p","fg:$s-fg-muted","#Loading\u2026");return}if(r.error){n("p","fg:$s-danger","text=",r.error.message);return}let s=n.unproxy(r.value);if(!s)return;let o=new Set;for(let a of Object.values(s))if(a&&typeof a=="object"&&!(a instanceof Uint8Array))for(let l of Object.keys(a))o.add(l);let i=[...o];n("div","overflow:auto",()=>{n("table",Pe,()=>{n("thead tr",()=>{n("th##");for(let a of i)n("th","text=",a)}),n("tbody",()=>{for(let[a,l]of Object.entries(s))n("tr",()=>{n("td",()=>n("code","text=",a));for(let c of i)n("td","font-size:12px font-family:monospace","text=",fs(l?.[c]))})})})})})}}))})}function fs(e){if(e==null)return"";if(e instanceof Uint8Array)return Dt([...e]);if(typeof e=="object"){if(e.type==="Buffer"&&Array.isArray(e.data))return Dt(e.data);let t=Object.keys(e);if(!Array.isArray(e)&&t.length>0&&t.length<=4096&&t.every((r,s)=>r===String(s))){let r=[];for(let s of t){let o=e[s];if(typeof o!="number"||o<0||o>255)return JSON.stringify(e);r.push(o)}return Dt(r)}return JSON.stringify(e)}return String(e)}function Dt(e){let t="";for(let r of e)r>=32&&r<127&&r!==34&&r!==92?t+=String.fromCharCode(r):r===9?t+="\\t":r===10?t+="\\n":r===13?t+="\\r":r===34?t+='\\"':r===92?t+="\\\\":t+="\\x"+r.toString(16).padStart(2,"0");return t}n.mount(document.body,()=>{if(!p.authed){Qn();return}ts()});p.password&&Hr();
|
|
10
|
+
<script type="module">var Te=class{keyProp;tail;symbols;constructor(t){this.keyProp=t,this.tail={},this.symbols=[Symbol(0)]}add(t){if(this.symbols[0]in t)return!1;let r=1+(Math.clz32(Math.random()*4294967295)>>2);for(let l=this.symbols.length;l<r;l++)this.symbols.push(Symbol(l));let s=this.keyProp,o=t[s],i,a=this.tail;for(let l=this.symbols.length-1;l>=0;l--){let c=this.symbols[l];for(;(i=a[c])&&i[s]>o;)a=i;l<r&&(t[c]=a[c],a[c]=t)}return!0}has(t){return this.symbols[0]in t}fetchLast(){let t=this.tail[this.symbols[0]];if(t)return this.remove(t),t}isEmpty(){return this.tail[this.symbols[0]]===void 0}get(t){let r=this.keyProp,s,o=this.tail;for(let i=this.symbols.length-1;i>=0;i--){let a=this.symbols[i];for(;(s=o[a])&&s[r]>t;)o=s}return o[this.symbols[0]]?.[r]===t?o[this.symbols[0]]:void 0}*[Symbol.iterator](){let t=this.symbols[0],r=this.tail[t];for(;r;)yield r,r=r[t]}prev(t){return t[this.symbols[0]]}remove(t){if(!(this.symbols[0]in t))return!1;let r=this.keyProp,s=t[r],o,i=this.tail;for(let a=this.symbols.length-1;a>=0;a--){let l=this.symbols[a];for(;(o=i[l])&&o[r]>=s&&o!==t;)i=o;o===t&&(i[l]=o[l],delete o[l])}return o===t}clear(){let t=this.symbols[0],r=this.tail;for(;r;){let s=r[t];for(let o of this.symbols){if(!(o in r))break;delete r[o]}r=s}this.tail={}}},W,se=0,L,T;function ne(e,t,r,s){(e.sideEffects||=[]).push(t,r,s)}function Dr(e,t){for(let r=t.length-3;r>=0;r-=3){let s=t[r+1],o=t[r+2];switch(t[r]){case 0:o?e.classList.add(s):e.classList.remove(s);break;case 1:e.style[s]=o??"";break;case 2:e[s]=o;break;case 3:o==null?e.removeAttribute(s):e.setAttribute(s,o);break;case 4:e.removeEventListener(s,o);break}}}function wt(e){if(!W)W=new Te("prio"),queueMicrotask(tr);else if(!(se&1)&&(se++,se>98))throw new Error("Too many recursive updates from observes");W.add(e)}function tr(){let e=Date.now();for(;W;){let t=W.fetchLast();if(!t)break;se&1&&se++,t.queueRun()}W=void 0,se=0,e=Date.now()-e,e>9&&console.debug(`Aberdeen queue took ${e}ms`)}function Jt(e){let t="";for(let r of e){if(typeof r=="string"){t+=`${r}`;continue}if(typeof r!="number")throw new Error("onEach() sort key must be a string, number or an array of such");let s="",o=Math.abs(Math.round(r)),i=r<0;for(;o>0;)s=String.fromCharCode(i?65534-o%65533:2+o%65533)+s,o=Math.floor(o/65533);t+=String.fromCharCode(128+(i?-s.length:s.length))+s}return t}function Kr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(65535-e.charCodeAt(r));return t}var rr=0,Me=class{prio=--rr;remove(){let t=this.getLastNode();t&&je(t,this.getPrecedingNode());let r=T;T=this.el,this.delete(),T=r}},ct=class{queueRun;prio=--rr;constructor(t){this.queueRun=t,wt(this)}},ie=class extends Me{cleaners;sideEffects;changes;constructor(t=[]){super(),this.cleaners=t}lastChild;redraw(){}getLastNode(){return xe(this.lastChild)}delete(){let t=this.cleaners;for(let s=t.length-1;s>=0;s--){let o=t[s];typeof o=="function"?o():o.delete(this)}this.cleaners.length=0;let r=this.sideEffects;r&&(this.el===T&&Dr(this.el,r),this.sideEffects=void 0),W?.remove(this),this.lastChild=void 0}onChange(t,r,s,o){this.changes||(this.changes=new Map,wt(this));let i=this.changes.get(t);i||(i=new Map,this.changes.set(t,i)),i.has(r)?i.get(r)===s&&i.delete(r):i.set(r,o)}fetchHasChanges(){if(!this.changes)return!1;for(let t of this.changes.values())if(t.size>0)return delete this.changes,!0;return delete this.changes,!1}queueRun(){this.fetchHasChanges()&&(this.remove(),L=this,this.redraw(),L=void 0)}getInsertAfterNode(){return this.getLastNode()||this.getPrecedingNode()}getChildPrevSibling(){return this.lastChild}},ye=class extends ie{el;svg;prevSibling;constructor(t,r,s=!1){super(s?g.cleaners:[]),this.el=t,this.svg=r,t===g.el?(this.prevSibling=g.getChildPrevSibling(),g.lastChild=this):this.prevSibling=t.lastChild||void 0,s||g.cleaners.push(this)}getPrecedingNode(){return xe(this.prevSibling)}getChildPrevSibling(){return this.lastChild||this.prevSibling}},Oe=class extends ye{renderer;constructor(t,r,s){super(t,r),this.renderer=s,this.redraw()}redraw(){let t=g;g=this;try{this.renderer()}catch(r){St(r,!0)}g=t}},Ne=class extends ie{el=document.body;svg=!1;getPrecedingNode(){}},ft=class extends ie{el;renderer;svg;constructor(t,r){super(),this.el=t,this.renderer=r,this.svg=t.namespaceURI==="http://www.w3.org/2000/svg";let s=L;L=this,this.redraw(),L=s,g.cleaners.push(this)}redraw(){Oe.prototype.redraw.call(this)}getPrecedingNode(){}delete(){je(this.getLastNode(),this.getPrecedingNode());let t=T;T=this.el,super.delete(),T=t}remove(){this.delete()}};function je(e,t){for(;e&&e!==t;){let r=e.previousSibling,s=bt.get(e);s&&e instanceof Element?s!==!0&&(typeof s=="function"?s(e):Yr(e,s),bt.set(e,!0)):e.remove(),e=r}}function xe(e){return!e||e instanceof Node?e:e.getLastNode()||e.getPrecedingNode()}var ut=class extends ye{renderer;result=A({value:void 0});constructor(t){super(g.el,g.svg),this.renderer=t,this.redraw()}redraw(){let t=g;g=this;try{this.result.value=this.renderer()}catch(r){St(r,!0)}g=t}},dt=class extends ye{key;target;svg=!1;constructor(t,r,s){super(t,t.namespaceURI==="http://www.w3.org/2000/svg"),this.key=r,this.target=s,this.redraw()}redraw(){let t=g;g=this,j(this.el,this.key,this.target.value),g=t}},ht=class extends Me{renderer;makeSortKey;parentElement=g.el;prevSibling;target;byIndex=new Map;sortedSet=new Te("sortKey");changedIndexes=new Map;constructor(t,r,s){super(),this.renderer=r,this.makeSortKey=s;let o=this.target=t[y]||t;if($(o,C,this),this.prevSibling=g.getChildPrevSibling(),g.lastChild=this,g.cleaners.push(this),o instanceof Array)for(let i=0;i<o.length;i++)new ge(this,i,!1);else for(let i of o instanceof Map?o.keys():o instanceof Set?o.values():Object.keys(o))new ge(this,i,!1)}getPrecedingNode(){return xe(this.prevSibling)}onChange(t,r,s,o){(!(t instanceof Array)||typeof r=="number")&&(this.changedIndexes.has(r)?this.changedIndexes.get(r)===s&&this.changedIndexes.delete(r):(this.changedIndexes.set(r,o),wt(this)))}queueRun(){let t=this.changedIndexes;this.changedIndexes=new Map;for(let r of t.keys()){let s=this.byIndex.get(r);s&&s.remove(),(this.target instanceof Set||this.target instanceof Map?this.target.has(r):r in this.target)?new ge(this,r,!0):this.byIndex.delete(r)}L=void 0}delete(){for(let t of this.byIndex.values())t.delete();W?.remove(this),this.byIndex.clear(),setTimeout(()=>{this.sortedSet.clear()},1)}getLastNode(){for(let t of this.sortedSet){let r=t.getActualLastNode();if(r)return r}}},ge=class extends ie{parent;itemIndex;sortKey;el;svg;constructor(t,r,s){super(),this.parent=t,this.itemIndex=r,this.el=t.parentElement,this.svg=g.svg,this.parent.byIndex.set(this.itemIndex,this),this.lastChild=this,s&&(L=this),this.redraw()}getPrecedingNode(){this.parent.sortedSet.add(this);let t=this.parent.sortedSet.prev(this);return t?xe(t.lastChild):this.parent.getPrecedingNode()}getLastNode(){return this.getPrecedingNode()}getActualLastNode(){let t=this.lastChild;for(;t&&t!==this;){if(t instanceof Node)return t;let r=t.getLastNode();if(r)return r;t=t.getPrecedingNode()}}queueRun(){if(g!==ae&&er(4),!this.fetchHasChanges())return;if(this.sortKey!==void 0){let r=this.getActualLastNode();r&&je(r,this.getPrecedingNode())}let t=T;T=this.el,this.delete(),T=t,this.lastChild=this,L=this,this.redraw(),L=void 0}redraw(){let t,r=this.parent.target,s=this.itemIndex;r instanceof Set?t=s=A(s):r instanceof Map?(t=A(r.get(s)),s=A(s)):t=A(r[s]);let o=g;g=this;let i;try{this.parent.makeSortKey?i=this.parent.makeSortKey(t,s):i=s,i instanceof Array?i=Jt(i):typeof i!="string"&&i!=null&&(i=Jt([i])),this.sortKey!==i&&(this.parent.sortedSet.remove(this),this.sortKey=i),i!=null&&this.parent.renderer(t,s)}catch(a){St(a,i!=null)}g=o}getInsertAfterNode(){return this.sortKey==null&&er(1),xe(this.lastChild)}remove(){if(this.sortKey!==void 0){let r=this.getActualLastNode();r&&je(r,this.getPrecedingNode()),this.parent.sortedSet.remove(this),this.sortKey=void 0}let t=T;T=this.el,this.delete(),T=t}};function J(e,t){if(e!==g.el){e.appendChild(t);return}let r=g.el,s=g.getInsertAfterNode();r.insertBefore(t,s?s.nextSibling:r.firstChild),g.lastChild=t}var ae=new Ne,g=ae;function vt(e){let t=g;g=new Ne;try{return e()}finally{g=t}}var C=Symbol("any"),y=Symbol("target"),q=Symbol("mapSize"),gt=new WeakMap,we=0;function $(e,t,r=g){if(r===ae||we)return;let s=gt.get(e);if(s||gt.set(e,s=new Map),t!==C&&s.get(C)?.has(r))return;let o=s.get(t);o||s.set(t,o=new Set),!o.has(r)&&(o.add(r),r===g?g.cleaners.push(o):g.cleaners.push(()=>{o.delete(r)}))}function le(e,t,r){if(!e||typeof e!="object")throw new Error("A.onEach requires an object");e=e[y]||e,new ht(e,t,r)}function mt(e){for(let t of Object.keys(e))return!1;return!0}var w=Symbol("empty");function Re(e){let t=e[y]||e,r=g;if(t instanceof Array)return $(t,"length",(o,i,a)=>{!i!=!a&&r.onChange(t,w,!i,!a)}),!t.length;if(t instanceof Map||t instanceof Set)return $(t,q,(o,i,a)=>{!i!=!a&&r.onChange(t,w,!i,!a)}),!t.size;let s=mt(t);return $(t,C,(o,i,a)=>{if(i===w!=(a===w)){let l=mt(t);l!==s&&(r.onChange(t,w,l,s),s=l)}}),s}function Br(e){if(e instanceof Array)return qe(e,"length");if(e instanceof Map||e instanceof Set)return qe(e,"size");let t=e[y]||e,r=0;for(let o of Object.keys(t))t[o]!==void 0&&r++;let s=ze(r);return $(t,C,(o,i,a)=>{a===i||(a===w?s.value=++r:i===w&&(s.value=--r))}),s}function Fr(e,t,r,s){if(r===s&&r!==void 0)return;let o=gt.get(e);if(o!==void 0)for(let i of[t,C]){let a=o.get(i);if(a)for(let l of a)typeof l=="function"?l(t,r,s):l.onChange(e,t,r,s)}}var v=Fr,Gr={get(e,t){return t===y?e:($(e,t),A(e[t]))},set(e,t,r){typeof r=="object"&&r&&(r=r[y]||r);let s=e.hasOwnProperty(t)?e[t]:w;return r!==s&&(e[t]=r,v(e,t,r,s)),!0},deleteProperty(e,t){let r=e.hasOwnProperty(t)?e[t]:w;return delete e[t],v(e,t,w,r),!0},has(e,t){return $(e,t),e.hasOwnProperty(t)},ownKeys(e){return $(e,C),Reflect.ownKeys(e)}};function Wr(e,t,r){typeof r=="object"&&r&&(r=r[y]||r);let s=e[t];if(s===void 0&&!e.hasOwnProperty(t)&&(s=w),r!==s){let o=e.length;if(t==="length"){e.length=r;for(let i=r;i<o;i++)v(e,i,w,e[i])}else{if(typeof t=="string"){let i=0|t;String(i)===t&&i>=0&&(t=i)}e[t]=r,v(e,t,r,s)}e.length!==o&&v(e,"length",e.length,o)}return!0}var Vr={get(e,t){if(t===y)return e;if(typeof t=="string"){let r=0|t;String(r)===t&&r>=0&&(t=r)}return $(e,t),A(e[t])},set:Wr,deleteProperty(e,t){if(typeof t=="string"){let s=0|t;String(s)===t&&s>=0&&(t=s)}let r=e[t];return r===void 0&&!e.hasOwnProperty(t)&&(r=w),delete e[t],v(e,t,w,r),!0}};function me(e){return{[Symbol.iterator](){return this},next(){let t=e.next();return t.done?t:{done:!1,value:A(t.value)}}}}function pt(e){return{[Symbol.iterator](){return this},next(){let t=e.next();return t.done?t:{done:!1,value:[A(t.value[0]),A(t.value[1])]}}}}function G(e){return typeof e=="object"&&e&&e[y]||e}var Yt={get(e){let t=this[y];return e=G(e),$(t,e),A(t.get(e))},set(e,t){let r=this[y];e=G(e),t=G(t);let s=r.get(e);if(s===void 0&&!r.has(e)&&(s=w),t!==s){let o=r.size;r.set(e,t),v(r,e,t,s),v(r,q,r.size,o)}return this},delete(e){let t=this[y];e=G(e);let r=t.get(e);r===void 0&&!t.has(e)&&(r=w);let s=t.delete(e);return s&&(v(t,e,w,r),v(t,q,t.size,t.size+1)),s},clear(){let e=this[y],t=e.size;for(let r of e.keys())v(e,r,void 0,e.get(r));e.clear(),v(e,q,0,t)},has(e){let t=this[y];return e=G(e),$(t,e),t.has(e)},keys(){let e=this[y];return $(e,C),me(e.keys())},values(){let e=this[y];return $(e,C),me(e.values())},entries(){let e=this[y];return $(e,C),pt(e.entries())},[Symbol.iterator](){let e=this[y];return $(e,C),pt(e[Symbol.iterator]())}},Qt={add(e){let t=this[y];if(e=G(e),!t.has(e)){let r=t.size;t.add(e),v(t,e,e,w),v(t,q,t.size,r)}return this},delete(e){let t=this[y];if(e=G(e),!t.has(e))return!1;let r=t.size;return t.delete(e),v(t,e,w,e),v(t,q,t.size,r),!0},clear(){let e=this[y],t=e.size;if(t){for(let r of e.values())v(e,r,w,r);e.clear(),v(e,q,0,t)}},has(e){let t=this[y];return e=G(e),$(t,e),t.has(e)},keys(){let e=this[y];return $(e,C),me(e.keys())},values(){let e=this[y];return $(e,C),me(e.values())},entries(){let e=this[y];return $(e,C),pt(e.entries())},[Symbol.iterator](){let e=this[y];return $(e,C),me(e[Symbol.iterator]())}},Hr={get(e,t){return t===y?e:Yt.hasOwnProperty(t)?Yt[t]:t==="size"?($(e,q),e.size):e[t]}},Jr={get(e,t){return t===y?e:Qt.hasOwnProperty(t)?Qt[t]:t==="size"?($(e,q),e.size):e[t]}},Xt=new WeakMap;function A(e){if(typeof e!="object"||e===null||e[y]!==void 0||e[O])return e;let t=Xt.get(e);if(t)return t;let r;return e instanceof Array?r=Vr:e instanceof Map?r=Hr:e instanceof Set?r=Jr:r=Gr,t=new Proxy(e,r),Xt.set(e,t),t}function ze(e){if(e instanceof Promise){let t=A({busy:!0});return e.then(r=>{t.value=r,t.busy=!1}).catch(r=>{t.error=r,t.busy=!1}),t}return A(typeof e=="object"&&e!==null?e:{value:e})}function $t(e){return e&&(e[y]||e)}var bt=new WeakMap;function Yr(e,t){let r=t.split(".").filter(s=>s);e.classList.add(...r),setTimeout(()=>e.remove(),2e3)}function Qr(e,t,r){return arguments.length>2?nr(e,t,r,0):kt(e,t,0)}function nr(e,t,r,s){let o=hr(e,t);return r===o?!1:typeof o=="object"&&o!==null&&typeof r=="object"&&r!==null&&o.constructor===r.constructor?kt(o,r,s):(r=yt(r),e instanceof Map?e.set(t,r):e[t]=yt(r),!0)}function Xr(e,t,r){return arguments.length>2?nr(e,t,r,Le):kt(e,t,Le)}function kt(e,t,r){let s=e[y];return s&&(e=s,r|=F),s=t[y],s&&(t=s,g!==ae&&!we&&(r|=Y)),Ie(e,t,r)}function Ie(e,t,r){r&Y&&$(t,C);let s=!1;if(t instanceof Array&&e instanceof Array){let o=e.length,i=t.length;for(let a=0;a<i;a++){let l=e[a];l===void 0&&!e.hasOwnProperty(a)&&(l=w);let c=t[a];if(c===void 0&&!t.hasOwnProperty(a))delete e[a],r&F&&v(e,a,w,l),s=!0;else if(l!==c){if(typeof c=="object"&&c!==null){if(typeof l=="object"&&l!==null&&c.constructor===l.constructor&&!(O in c)){s=Ie(l,c,r)||s;continue}c=be(c,r&Y)}e[a]=c,r&F&&v(e,a,c,l),s=!0}}if(i!==o){if(r&F){for(let a=i;a<o;a++){let l=e[a];delete e[a],v(e,a,w,l)}e.length=i,v(e,"length",i,o)}else e.length=i;s=!0}}else if(t instanceof Map&&e instanceof Map){for(let o of t.keys()){let i=t.get(o),a=e.get(o);if(a===void 0&&!e.has(o)&&(a=w),a!==i){if(typeof i=="object"&&i!==null){if(typeof a=="object"&&a!==null&&i.constructor===a.constructor&&!(O in i)){s=Ie(a,i,r)||s;continue}i=be(i,r&Y)}e.set(o,i),r&F&&v(e,o,i,a),s=!0}}if(!(r&Le)){for(let o of e.keys())if(!t.has(o)){let i=e.get(o);e.delete(o),r&F&&v(e,o,w,i),s=!0}}}else if(t.constructor===e.constructor){for(let o of Object.keys(t)){let i=t[o],a=e.hasOwnProperty(o)?e[o]:w;if(a!==i){if(typeof i=="object"&&i!==null){if(typeof a=="object"&&a!==null&&i.constructor===a.constructor&&!(O in i)){s=Ie(a,i,r)||s;continue}i=be(i,r&Y)}e[o]=i,r&F&&v(e,o,i,a),s=!0}}if(!(r&Le)){for(let o of Object.keys(e))if(!t.hasOwnProperty(o)){let i=e[o];delete e[o],r&F&&i!==void 0&&v(e,o,w,i),s=!0}}}else throw new Error(`Incompatible or non-object types: ${t?.constructor?.name||typeof t} vs ${e?.constructor?.name||typeof e}`);return s}var Le=1,Y=32,F=64,O=Symbol("OPAQUE"),Zr=O;Promise.prototype[O]=!0;Date.prototype[O]=!0;Node.prototype[O]=!0;if(typeof Temporal<"u")for(let e of"Duration Instant PlainDate PlainDateTime PlainMonthDay PlainTime PlainYearMonth ZonedDateTime".split(" ")){let t=Temporal[e];t&&(t.prototype[O]=!0)}var pe=A({});function en(e=1,t="rem"){for(let r=0;r<=12;r++)pe[r]=2**(r-3)*e+t}var tn=/(\burl\([^)]*\))|("[^"]*")|(^| )\$([\w-]+)/g,sr=/^\d/;function ir(e){return e.indexOf("$")<0?e:e.replace(tn,(t,r,s,o,i)=>{if(r||s)return t;let a=sr.test(i)?`m${i}`:i;return`${o}var(--${a})`})}var Ce;function rn(){if(!Ce){if(typeof window>"u"||!window.matchMedia)return!1;let e=window.matchMedia("(prefers-color-scheme: dark)");Ce=ze({value:e.matches}),e.addEventListener("change",()=>Ce.value=e.matches)}return Ce.value}function be(e,t){if(O in e)return e;if(t&Y&&$(e,C),e instanceof Array)return e.map(s=>at(s,t));if(e instanceof Map){let s=new Map;for(let[o,i]of e)s.set(o,at(i,t));return s}let r=Object.create(Object.getPrototypeOf(e));for(let s of Object.keys(e))r[s]=at(e[s],t);return r}function at(e,t){return typeof e=="object"&&e!==null?be(e,t):e}function yt(e){if(typeof e!="object"||e===null)return e;let t=0,r=e[y];return r&&(e=r,g!==ae&&!we&&(t=Y)),be(e,t)}var nn={get(e,t){if(t===y)return qe($t(e.proxy),e.index);if(t==="value")return e.proxy[e.index]},set(e,t,r){return t==="value"?(e.proxy[e.index]=r,!0):!1}};function qe(e,t){return new Proxy({proxy:e,index:t},nn)}function sn(e,t){let r,s,o=e.getAttribute("type"),i=$t(t).value;o==="checkbox"?(i===void 0&&(t.value=e.checked),r=()=>{e.checked=t.value},s=()=>{t.value=e.checked}):o==="radio"?(i===void 0&&e.checked&&(t.value=e.value),r=()=>{e.checked=t.value===e.value},s=()=>{e.checked&&(t.value=e.value)}):(s=()=>{t.value=o==="number"||o==="range"?e.value===""?null:+e.value:e.value},i===void 0&&s(),r=()=>{e.value=t.value,e.tagName==="SELECT"&&e.value!=t.value&&new ct(()=>e.value=t.value)}),ur(r),e.addEventListener("input",s),U(()=>{e.removeEventListener("input",s)})}var lt=/\*\*(.+?)\*\*|\*(.+?)\*|`(.+?)`|\[(.+?)\]\((.+?)\)/g,Ue={create:(e,t)=>{if(g===L)if(typeof t=="function")t(e);else{let r=t.split(".").filter(s=>s);e.classList.add(...r),(async()=>(e.offsetHeight,e.classList.remove(...r)))()}},destroy:(e,t)=>{bt.set(e,t)},html:(e,t)=>{if(e===g.el&&!e.firstChild)e.innerHTML=`${t}`;else{let r=document.createElement(g.el.tagName);for(r.innerHTML=`${t}`;r.firstChild;)J(e,r.firstChild)}},text:(e,t)=>{J(e,document.createTextNode(t))},rich:(e,t)=>{let r=0,s,o=String(t);for(lt.lastIndex=0;(s=lt.exec(o))!==null;){s.index>r&&J(e,document.createTextNode(o.slice(r,s.index)));let i;if(s[1]!==void 0)i=document.createElement("strong"),i.textContent=s[1];else if(s[2]!==void 0)i=document.createElement("em"),i.textContent=s[2];else if(s[3]!==void 0)i=document.createElement("code"),i.textContent=s[3];else{let a=document.createElement("a");a.textContent=s[4],a.href=s[5],i=a}J(e,i),r=lt.lastIndex}r<o.length&&J(e,document.createTextNode(o.slice(r)))}};function on(){Ue.create=Ue.destroy=()=>{}}function R(...e){let t=g.el,r=g.svg,s=e.length;for(let o=0;o<s;o++){let i=e[o];if(!(i==null||i===!1))if(typeof i=="string"){let a=i.length,l=0;for(let c=0;c<a;c=l+1){l=re(i," .=:#",c);let f=i[l];if(f===":"){let u="$"+i.substring(c,l);if(l+1>=a){j(t,u,e[++o]);break}if(i[l+1]===" "){let d=re(i,";",l+2),h=i.substring(l+2,d).trim();j(t,u,h),l=d}else{let d=re(i," ",l+1),h=i.substring(l+1,d);j(t,u,h),l=d}}else if(f==="="){let u=i.substring(c,l);if(l+1>=a){j(t,u,e[++o]);break}let d=i[l+1];if(d==='"'||d==="'"||d==="`"){let h=re(i,d,l+2),b=i.substring(l+2,h);j(t,u,b),l=h}else{let h=re(i," ",l+1),b=i.substring(l+1,h);j(t,u,b),l=h}}else{if(l>c){let u=i.substring(c,l);r||=u==="svg";let d=r?document.createElementNS("http://www.w3.org/2000/svg",u):document.createElement(u);J(t,d),t=d}if(f==="#"){let u=l+1<a?i.substring(l+1):e[++o];j(t,"text",u);break}if(f==="."){let u=re(i," #=.",l+1);if(i[u]==="="&&u+1>=a)j(t,i.substring(l,u),e[++o]),l=u;else{let h=i.substring(l+1,u)||e[++o];t.classList.contains(h)||(t===g.el&&ne(g,0,h,!1),t.classList.add(h)),l=u-1}}}}}else if(typeof i=="object")if(i.constructor!==Object)if(i instanceof Node)J(t,i),i instanceof Element&&(t=i,r=i.namespaceURI==="http://www.w3.org/2000/svg");else throw new Error(`Unexpected argument: ${i}`);else for(let a of Object.keys(i))j(t,a,i[a]);else if(typeof i=="function")new Oe(t,r,i);else throw new Error(`Unexpected argument: ${i}`)}return t}function re(e,t,r){if(t.length===1){let o=e.indexOf(t,r);return o>=0?o:e.length}let s=e.length;for(let o=r;o<s;o++)if(t.indexOf(e[o])>=0)return o;return s}var or=0;function an(e){let t=`.AbdStl${++or}`,r=typeof e=="string"?xt(e,t):_e(e,t);if(r){let s=ar++;oe[s]=r,U(()=>delete oe[s])}return t}var oe=ze({}),ar=0;function Zt(e,t){let r=[];for(let s of e.split(","))for(let o of t.split(","))r.push(o.includes("&")?o.trim().replace(/&/g,s):`${s} ${o.trim()}`.trim());return r.join(",")}function _e(e,t){let r="";for(let[s,o]of Object.entries(e))o&&typeof o=="object"?s.startsWith("@")?r+=`${s}{
|
|
11
|
+
${_e(o,t)}}
|
|
12
|
+
`:r+=_e(o,Zt(t,s)):typeof o=="string"&&(s.startsWith("@")?r+=`${s}{
|
|
13
|
+
${xt(o,t)}}
|
|
14
|
+
`:r+=xt(o,Zt(t,s)));return r}var ln=/-([a-z])/g;function cn(e){return e.replace(ln,(t,r)=>r.toUpperCase())}var fn=/^[a-zA-Z-]+$/;function xt(e,t){let r="";for(let s=0,o=e.length;s<o;){for(;e[s]===" ";)s++;if(s>=o)break;let i=e.indexOf(":",s);if(i===-1)throw new Error(`Trailing data in style string: "${e.substring(s)}"`);let a=e.substring(s,i);if(!fn.test(a))throw new Error(`Invalid CSS key: "${a}" in style string: "${e}"`);s=i+1;let l;if(e[s]===" "){s++;let u=e.indexOf(";",s);l=e.substring(s,u===-1?o:u).trim(),s=u===-1?o:u+1}else{let u=e.indexOf(" ",s);l=e.substring(s,u===-1?o:u),s=u===-1?o:u}let c=ir(l),f=lr[a]||a;r+=typeof f=="string"?`${f}:${c};`:f.map(u=>`${u}:${c};`).join("")}return r?`${t}{${r}}
|
|
15
|
+
`:""}function un(e){let t=_e(e,"");if(t){let r=ar++;oe[r]=t,U(()=>delete oe[r])}}var lr={m:"margin",mt:"margin-top",mb:"margin-bottom",ml:"margin-left",mr:"margin-right",mh:["margin-left","margin-right"],mv:["margin-top","margin-bottom"],p:"padding",pt:"padding-top",pb:"padding-bottom",pl:"padding-left",pr:"padding-right",ph:["padding-left","padding-right"],pv:["padding-top","padding-bottom"],w:"width",h:"height",bg:"background",fg:"color",r:"border-radius"};function j(e,t,r){if(typeof r=="object"&&r!==null&&r[y])t==="bind"?sn(e,r):new dt(e,t,r);else if(t[0]==="."){let s=t.substring(1).split("."),o=e.classList,i=!!r;if(e===g.el)for(let a of s){let l=o.contains(a);l!==i&&ne(g,0,a,l)}i?o.add(...s):o.remove(...s)}else if(t[0]==="$"){t=t.substring(1);let s=r==null||r===!1?"":typeof r=="string"?ir(r):String(r),o=lr[t]||t,i=e.style,a=e===g.el,l=typeof o=="string"?[o]:o;for(let c of l){let f=cn(c);a&&ne(g,1,f,i[f]),i[f]=s}}else r==null||(t in Ue?Ue[t](e,r):typeof r=="function"?(e.addEventListener(t,r),e===g.el&&ne(g,4,t,r)):r===!0||r===!1||t==="value"||t==="selectedIndex"?(e===g.el&&ne(g,2,t,e[t]),e[t]=r):(e===g.el&&ne(g,3,t,e.getAttribute(t)),e.setAttribute(t,r)))}function cr(e){return console.error("Error while in Aberdeen render:",e),!0}var fr=cr;function dn(e){fr=e||cr}function U(e){g.cleaners.push(e)}function ur(e){return new ut(e).result}function dr(e,t){new ft(e,t)}function hn(){ae.remove(),or=0}function hr(e,t){we++;try{return arguments.length===1?e():e instanceof Map?e.get(t):e[t]}finally{we--}}function gn(e,t){let r;return e instanceof Array?r=A([]):e instanceof Map?r=A(new Map):r=A({}),le(e,(s,o)=>{let i=t(s,o);i!==void 0&&(r instanceof Map?(r.set(o,i),U(()=>{r.delete(o)})):(r[o]=i,U(()=>{delete r[o]})))}),r}function mn(e,t){let r=A({});return le(e,(s,o)=>{let i=t(s,o);if(i){for(let a of Object.keys(i))r[a]=i[a];U(()=>{for(let a of Object.keys(i))delete r[a]})}}),r}function pn(e,t){let r={},s=A(r);return le(e,(o,i)=>{let a=t(o,i);if(a!=null){let l=a instanceof Array?a:[a];if(l.length){for(let c of l)r[c]?s[c][i]=o:s[c]={[i]:o};U(()=>{for(let c of l)delete s[c][i],mt(r[c])&&delete s[c]})}}}),s}function bn(e){let t=Ee;Ee||=new Set;try{gr(e,Ee)}finally{Ee=t}return e}var Ee;function gr(e,t){if(e&&typeof e=="object"){let r=e.constructor.name||"unknown object";if(t.has(e)){R(`#<${r}: circular reference>`);return}t.add(e),U(()=>t.delete(e));let s=e[Pt];s!==void 0?typeof s=="function"?s.call(e):R(`#${s}`):R(`#<${r}>`,"ul",()=>{le(e,(o,i)=>{R("li",()=>{e instanceof Array||R(`#${JSON.stringify(i)}: `),gr(o,t)})})})}else R(e===void 0?"#undefined":"#"+JSON.stringify(e))}var Pt=Symbol("CUSTOM_DUMP");Date.prototype[Pt]=function(){R("#<Date> "+this.toISOString())};function er(e){throw new Error(`Aberdeen internal error ${e}`)}function St(e,t){try{fr(e)===!1&&(t=!1)}catch(r){console.error(r)}try{t&&R("div.aberdeen-error#Error")}catch{}}typeof document<"u"&&vt(()=>{R(()=>{Re(oe)&&Re(pe)||dr(document.head,()=>{R("style.abd",()=>{le(oe,e=>{R("#",e)}),R(()=>{if(Re(pe))return;let e=":root{";for(let[t,r]of Object.entries(pe)){let s=sr.test(String(t))?`m${t}`:t;e+=`--${s}:${r};`}e+=`}
|
|
16
|
+
`,R("#",e)})})})})});var n=Object.assign(R,{clean:U,clone:yt,copy:Qr,count:Br,cssVars:pe,CUSTOM_DUMP:Pt,darkMode:rn,derive:ur,disableCreateDestroy:on,dump:bn,insertCss:an,insertGlobalCss:un,invertString:Kr,isEmpty:Re,map:gn,merge:Xr,mount:dr,multiMap:mn,OPAQUE:O,NO_COPY:Zr,onEach:le,partition:pn,peek:hr,proxy:ze,ref:qe,runQueue:tr,setErrorHandler:dn,setSpacingCssVars:en,unmountAll:hn,unproxy:$t});var De=()=>{};var Et=typeof ABERDEEN_FAKE_WINDOW<"u"?ABERDEEN_FAKE_WINDOW:window,z=Et.location,D=Et.history;function mr(){return Rt({path:z.pathname,hash:z.hash,search:Object.fromEntries(new URLSearchParams(z.search)),state:D.state?.state||{}},"load",(D.state?.stack?.length||0)+1)}function At(e,t,r){if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t||e.constructor!==t.constructor)return!1;if(t instanceof Array){if(e.length!==t.length)return!1;for(let s=0;s<t.length;s++)if(!At(e[s],t[s],r))return!1}else{for(let s of Object.keys(t))if(!At(e[s],t[s],r))return!1;if(!r){for(let s of Object.keys(e))if(!t.hasOwnProperty(s))return!1}}return!0}function pr(e){let t=new URLSearchParams(e.search).toString();return(t?`${e.path}?${t}`:e.path)+e.hash}function Rt(e,t,r){let s=e.path||(e.p||[]).join("/")||"/";return s=(""+s).replace(/\/+$/,""),s.startsWith("/")||(s=`/${s}`),{path:s,hash:e.hash&&e.hash!=="#"?e.hash.startsWith("#")?e.hash:"#"+e.hash:"",p:s.length>1?s.slice(1).replace(/\/+$/,"").split("/"):[],nav:t,search:typeof e.search=="object"&&e.search?n.clone(e.search):{},state:typeof e.state=="object"&&e.state?n.clone(e.state):{},depth:r}}function br(e,t=!1){if(typeof e=="string"){let r=new URL(e,z.href);if(r.host!==z.host){if(t)return;throw new Error(`Unexpected external URL: ${r.host} != ${z.host}`)}e={path:r.pathname,search:Object.fromEntries(r.searchParams),hash:r.hash}}else e instanceof Array&&(e={p:e});if(e.p&&(e.p=e.p.map(String)),e.search)for(let r of Object.keys(e.search))e.search[r]=String(e.search[r]);return e}function Ke(e,t="go"){xr=0,_=(D.state?.stack||[]).concat(JSON.stringify(n.unproxy(k)));let s=Rt(br(e),t,_.length+1);n.copy(k,s),De(t,s),D.pushState({state:s.state,stack:_},"",pr(s)),n.runQueue()}function yr(e){let t=br(e,!0);if(!t)return!1;if(t.path!=null||t.p!=null){let r=t.path||(t.p||[]).join("/")||"/";if(r=(""+r).replace(/\/+$/,""),r.startsWith("/")||(r=`/${r}`),!Ct[r])return!1}if(t.search){for(let[r,s]of Object.entries(t.search))if(!Ct[`${r}=${s}`])return!1}return!0}var _,xr=0;var k=n.proxy({}),Ct=n.proxy({});function yn(){_=D.state?.stack||[];let e=mr();De("initial",e),n.copy(n.unproxy(k),e)}yn();Et.addEventListener("popstate",function(e){xr=0;let t=mr(),r=D.state?.stack||[];if(r.length!==_.length){let s=Math.min(_.length,r.length)-1;(s<0||r[s]===_[s])&&(t.nav=r.length<_.length?"back":"forward")}_=r,De("popstate",t),n.copy(k,t),n.runQueue()});vt(()=>{n(()=>{k.path="/"+Array.from(k.p).join("/")}),n(()=>{let e=D.state?.stack||[],t=Rt(k,n.unproxy(k).nav,e.length+1);n.copy(k,t);let r={state:t.state,stack:e},s=pr(t);(s!==z.pathname+z.search+z.hash||!At(D.state,r,!1))&&(De("replaceState",t,r,s),D.replaceState(r,"",s))}),n(()=>{let e={};e[k.path]=!0;for(let[t,r]of Object.entries(k.search))e[`${t}=${r}`]=!0;n.copy(Ct,e)})});var wn="staffa:darkMode",vn=n.proxy({value:$n()});function $n(){try{let e=localStorage.getItem(wn);if(e==="dark")return!0;if(e==="light")return!1}catch{}}function wr(e=!1){let t=vn.value;return t===void 0&&!e?n.darkMode():t}n(()=>{wr()?n.insertGlobalCss({":root":"--s-primary:#8b7bff --s-secondary:#ef7fd0 --s-danger:#ff6b6b --s-success:#46d39a --s-warning:#fbbf24 --s-neutral: color-mix(in oklab, #3d4047, $s-tint 14%); --s-page: color-mix(in oklab, #0e0f12, $s-tint 5%); --s-panel: color-mix(in oklab, #17181c, $s-tint 6%); --s-raised: color-mix(in oklab, #212327, $s-tint 8%); --s-ink: color-mix(in oklab, #e9eaec, $s-tint 8%); --s-on-accent:#0c0a14 --s-focus: color-mix(in srgb, $s-primary 45%, transparent); --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 34px rgba(0,0,0,0.5);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#6db3ff"}):n.insertGlobalCss({":root":"--s-primary:#6c5ce7 --s-secondary:#d6459e --s-danger:#e23b3b --s-success:#1f9d6b --s-warning:#d97706 --s-neutral: color-mix(in oklab, #c9cbd0, $s-tint 14%); --s-page: color-mix(in oklab, #f3f4f6, $s-tint 5%); --s-panel: color-mix(in oklab, #ffffff, $s-tint 2%); --s-raised: color-mix(in oklab, #edeef0, $s-tint 7%); --s-ink: color-mix(in oklab, #1d1f24, $s-tint 7%); --s-on-accent:#0c0a14 --s-focus: color-mix(in srgb, $s-primary 35%, transparent); --s-radius:12px --s-radius-lg:18px --s-shadow: 0 10px 30px rgba(20,24,40,0.13);",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-link:#2563eb"})});n.setSpacingCssVars();n.insertGlobalCss({":root":"--s-tint: color-mix(in oklab, $s-primary, $s-secondary); --s-gradient: linear-gradient(135deg, $s-primary, $s-secondary); --s-gradient-surface: linear-gradient(170deg, color-mix(in oklab, $s-primary 85%, $s-secondary), color-mix(in oklab, $s-primary 30%, $s-secondary)); --s-glow: 0 5px 16px color-mix(in srgb, $s-primary 26%, transparent); --s-page-bg: radial-gradient(120% 80% at 100% 0%, color-mix(in oklab, $s-secondary, transparent 86%), transparent 56%), radial-gradient(120% 80% at 0% 0%, color-mix(in oklab, $s-primary, transparent 87%), transparent 56%), $s-page;",":root, .s-s.base":"--s-a:$s-ink --s-b:$s-page",".s-s.base":"background: $s-page-bg;",".s-s.panel":"--s-a:$s-ink --s-b:$s-panel",".s-s.raised":"--s-a:$s-ink --s-b:$s-raised",".s-s.neutral":"--s-a:$s-ink --s-b:$s-neutral",".s-s.primary":"--s-a:$s-on-accent --s-b:$s-primary",".s-s.secondary":"--s-a:$s-on-accent --s-b:$s-secondary",".s-s.danger":"--s-a:$s-on-accent --s-b:$s-danger",".s-s.success":"--s-a:$s-on-accent --s-b:$s-success",".s-s.warning":"--s-a:$s-on-accent --s-b:$s-warning",".s-s.gradient":"--s-a:$s-on-accent --s-b:$s-primary",":root, .s-s":"--s-fg:$s-a --s-bg:$s-b --s-fg-muted: color-mix(in oklab, $s-fg, $s-bg 42%); --s-fg-faint: color-mix(in oklab, $s-fg, $s-bg 64%); --s-border: color-mix(in oklab, $s-fg, $s-bg 82%); --s-border-strong: color-mix(in oklab, $s-fg, $s-bg 68%); scrollbar-width:thin scrollbar-color: $s-border-strong transparent; background:$s-bg color:$s-fg r:$s-radius",".s-s::-webkit-scrollbar, .s-s ::-webkit-scrollbar":"width:10px height:10px",".s-s::-webkit-scrollbar-track, .s-s ::-webkit-scrollbar-track":"background:transparent",".s-s::-webkit-scrollbar-thumb, .s-s ::-webkit-scrollbar-thumb":"background:$s-border-strong border-radius:99px border: 2px solid transparent; background-clip:padding-box",".s-s::-webkit-scrollbar-thumb:hover, .s-s ::-webkit-scrollbar-thumb:hover":"background:$s-fg-faint background-clip:padding-box",".s-s.tonal":"--s-fg:$s-b --s-bg: color-mix(in srgb, $s-b 16%, transparent); border: 1px solid $s-border;",".s-s.outlined":"--s-fg:$s-b --s-bg:inherit background:transparent --s-border: color-mix(in srgb, $s-fg 55%, $s-bg); border: 1px solid $s-border;",".s-s.filled":"--s-fg:$s-a --s-bg:$s-b background:$s-bg;",".s-s.gradient:not(.tonal):not(.outlined)":"background: $s-gradient-surface;",":root, .s-s.base, .s-s.panel, .s-s.raised, .s-s.neutral":"--s-accent:$s-primary",".s-s.primary, .s-s.secondary, .s-s.danger, .s-s.success, .s-s.warning, .s-s.gradient":"--s-accent:$s-fg --s-link:$s-fg",".s-s.primary .s-s.tonal, .s-s.secondary .s-s.tonal, .s-s.gradient .s-s.tonal, .s-s.danger .s-s.tonal, .s-s.success .s-s.tonal, .s-s.warning .s-s.tonal, .s-s.primary .s-s.outlined, .s-s.secondary .s-s.outlined, .s-s.gradient .s-s.outlined, .s-s.danger .s-s.outlined, .s-s.success .s-s.outlined, .s-s.warning .s-s.outlined":"--s-bg: $s-panel; background: $s-panel;"});n.insertGlobalCss({"*, *::before, *::after":"box-sizing:border-box",html:"text-size-adjust:100%",body:"m:0 line-height:1.5 font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing:antialiased",a:"color: $s-link; text-decoration:underline text-underline-offset:2px; transition: color 0.12s, filter 0.12s;","a:hover":"filter: brightness(1.15)","input, button, textarea, select":"font:inherit color:inherit","code, kbd, samp, pre":"font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;",code:"background: color-mix(in oklab, $s-fg, $s-bg 86%); padding: 0.12em 0.34em; r:4px font-size:0.9em",pre:"background: color-mix(in oklab, $s-fg, $s-bg 92%); p:$3 r: $s-radius; overflow:auto","pre code":"background:transparent p:0","img, svg, video, canvas":"max-width:100% h:auto",hr:"border:0 border-top: 1px solid $s-border;","::placeholder":"color: $s-fg-faint; opacity:1",":focus-visible":"outline: 2px solid $s-focus; outline-offset:2px",small:"color:$s-fg-muted font-size:0.9em","@media (prefers-reduced-motion: reduce)":{"*, *::before, *::after":"transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important;"}});n.insertGlobalCss({".s-preload, .s-preload *, .s-preload *::before, .s-preload *::after":"transition: none !important; animation: none !important;"});if(typeof document<"u"&&typeof requestAnimationFrame=="function"){let e=document.documentElement;e.classList.add("s-preload"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("s-preload")))}n.insertGlobalCss({":disabled, [aria-disabled=true]":"opacity:0.45 filter:saturate(0.6) user-select:none",":disabled, [aria-disabled=true], :disabled *, [aria-disabled=true] *":"pointer-events:none cursor:not-allowed"});var kn="p, ul, ol, dl, blockquote, pre, table, figure, hr, h1, h2, h3, h4, h5, h6";n.insertGlobalCss({[`${kn}`]:{"&":"margin:0","&:not(:first-child)":"margin-top:$3"},"h1, h2, h3, h4, h5, h6":{"&":"line-height:1.15 font-weight:700 text-wrap:balance","&:not(:first-child)":"margin-top:1.4em"},h1:"font-size:2em font-weight:800 letter-spacing:-0.022em",h2:"font-size:1.55em letter-spacing:-0.018em",h3:"font-size:1.3em letter-spacing:-0.011em",h4:"font-size:1.1em",h5:"font-size:0.95em letter-spacing:0.005em",h6:"font-size:0.8em fg:$s-fg-muted text-transform:uppercase letter-spacing:0.07em","ul, ol":{"&":"padding-left:1.5em","> li:not(:first-child), li > &:not(:first-child)":"margin-top:$1"},blockquote:"border-left: 3px solid $s-border; padding-left: $3; fg: $s-fg-muted",table:"border-collapse:collapse","th, td":"text-align:left padding: $1 $2; border-bottom: 1px solid $s-border; vertical-align:top",th:"font-weight:600","thead th":"border-bottom: 2px solid $s-border-strong;",dt:"font-weight:600",dd:"margin-left: 1.5em",figcaption:"fg:$s-fg-muted font-size:0.9em margin-top:$1 text-align:center"});var Pn=0;function V(e="s"){return`${e}-${++Pn}`}function p(e,...t){e!=null&&(typeof e=="function"?e(...t):n("rich=",e))}function H(e){queueMicrotask(()=>n(e))}n.insertGlobalCss({".s-field":{"&":"display:flex flex-direction:column gap:$1","> label":"font-weight:600 font-size:0.9em fg:$s-fg user-select:none"},".s-req":"fg:$s-danger margin-left:2px",".s-help":"font-size:0.82em fg:$s-fg-muted",".s-error":"font-size:0.82em fg:$s-danger",".s-input":{"&":"w:100% bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.55em 0.7em; transition: border-color 0.15s, box-shadow 0.15s;","&:hover:not(:disabled)":"border-color:$s-border-strong","&:focus-visible":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus; outline:none","&[aria-invalid=true]":"border-color:$s-danger"}});function Q(e,t){let r=e.id??V("field"),s=()=>!!e.error;n("div.s-field",e.attrs,()=>{n(()=>{e.label!=null&&n(`label for=${r}`,()=>{p(e.label),e.required&&n("span.s-req aria-hidden=true #*")})}),t(r,s),n(()=>{e.help!=null&&!e.error&&n("div.s-help",()=>p(e.help))}),n(()=>{e.error&&n("div.s-error role=alert #",e.error)})})}function ve(e,t,r,s){n(`id=${t}`),e.name&&n(`name=${e.name}`),n(()=>{e.disabled&&n("disabled=true")}),n(()=>{e.required&&n("aria-required=true")}),n(()=>n("aria-invalid=",r()?"true":"false")),s&&n("bind=",s)}n.insertGlobalCss({".s-ac":{"&":"position:relative","> .s-control":"display:flex flex-wrap:wrap align-items:center gap:$1 bg:$s-panel fg:$s-ink border: 1px solid $s-border; r:$s-radius padding: 0.3em 0.4em; cursor:text; transition: border-color 0.15s, box-shadow 0.15s;","> .s-control:hover":"border-color:$s-border-strong","> .s-control:focus-within":"border-color:$s-accent box-shadow: 0 0 0 3px $s-focus;","&[aria-invalid=true] > .s-control":"border-color:$s-danger",".s-chip":"display:inline-flex align-items:center gap:$1 font-size:0.85em bg:$s-raised border: 1px solid $s-border; r:$s-radius padding: 0.1em 0.2em 0.1em 0.5em;",".s-chip > button":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.2em; r:4px",".s-chip > button:hover":"fg:$s-fg background:$s-border",input:"flex:1 min-width:6ch border:0 background:transparent color:inherit outline:none padding:0.25em","> .s-menu":"position:absolute top:100% left:0 right:0 z-index:20 margin-top:4px max-height:15rem overflow-y:auto list-style:none p:$1 margin-bottom:0 bg:$s-panel border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow","> .s-menu li":"margin:0",".s-option":"padding: 0.45em 0.6em; r:6px cursor:pointer transition: background 0.1s;",".s-option[aria-selected=true]":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-add":"fg:$s-accent font-style:italic",".s-empty":"padding: 0.45em 0.6em; fg:$s-fg-muted"}});function Sn(e){return typeof e=="string"?{value:e,label:e}:{value:e.value,label:e.label??e.value}}function It(e){let t=V("ac-menu"),r=n.proxy({query:"",open:!1,active:0}),s=()=>(typeof e.options=="function"?e.options():e.options).map(Sn),o=()=>{let d=e.bind?.value;return d==null||d===""?[]:Array.isArray(d)?d:[d]},i=d=>s().find(h=>h.value===d)?.label??d;if(!e.multi){let d=e.bind?n.peek(e.bind,"value"):void 0;typeof d=="string"&&d&&(r.query=n.peek(()=>i(d)))}let a=()=>{let d=new Set(o()),h=s();e.multi&&(h=h.filter(S=>!d.has(S.value)));let b=r.query.trim().toLowerCase();return b&&(h=h.filter(S=>S.label.toLowerCase().includes(b))),h},l=(d,h)=>{if(e.multi){let b=Array.isArray(e.bind?.value)?[...e.bind.value]:[];b.includes(d)||b.push(d),e.bind&&(e.bind.value=b),r.query=""}else e.bind&&(e.bind.value=d),r.query=i(d),r.open=!1;r.active=0,h?.focus()},c=d=>{if(!e.bind)return;let h=e.bind.value??[];e.bind.value=h.filter(b=>b!==d)};Q(e,(d,h)=>{n("div.s-ac",e.inputAttrs,()=>{n(()=>n("aria-invalid=",h()?"true":"false"));let b;n("div.s-control",()=>{n("click=",()=>b?.focus()),n(()=>{if(e.multi)for(let S of o())n("span.s-chip",()=>{n("span #",n.peek(()=>i(S))),n("button type=button aria-label=",`Remove ${S}`,()=>{n("#\xD7"),n("click=",E=>{E.stopPropagation(),c(S),b?.focus()})})})}),b=n("input type=text role=combobox autocomplete=off",()=>{n(`id=${d} aria-controls=${t} aria-autocomplete=list`),e.placeholder!=null&&n("placeholder=",e.placeholder),e.disabled&&n("disabled=true"),e.required&&n("aria-required=true"),n("bind=",n.ref(r,"query")),n(()=>n("aria-expanded=",r.open?"true":"false")),n(()=>{let E=a()[r.active];n("aria-activedescendant=",r.open&&E?`${t}-opt-${r.active}`:"")}),n("input=",()=>{r.open=!0,r.active=0}),n("focus=",()=>{r.open=!0}),n("blur=",()=>{setTimeout(()=>u(),150)}),n("keydown=",S=>f(S,b))})}),n(()=>{if(!r.open)return;let S=a(),E=r.query.trim(),Ht=e.allowCustom!==!1&&E!==""&&!S.some(te=>te.label.toLowerCase()===E.toLowerCase());n("ul.s-menu role=listbox",`id=${t}`,()=>{S.forEach((te,ot)=>{n("li.s-option role=option",`id=${t}-opt-${ot}`,()=>{n(()=>n("aria-selected=",r.active===ot?"true":"false")),n("#",te.label),n("mousedown=",zr=>zr.preventDefault()),n("click=",()=>l(te.value,b)),n("mousemove=",()=>{r.active=ot})})}),Ht&&n("li.s-option.s-add role=option",()=>{n("#",`Add "${E}"`),n("mousedown=",te=>te.preventDefault()),n("click=",()=>l(E,b))}),S.length===0&&!Ht&&n("li.s-empty #No matches")})}),n(()=>{if(e.name)if(e.multi)for(let S of o())n("input type=hidden",()=>{n("name=",e.name),n("value=",S)});else n("input type=hidden",()=>{n("name=",e.name),n("value=",o()[0]??"")})})})});function f(d,h){let b=a(),S=b.length-1;if(d.key==="ArrowDown")d.preventDefault(),r.open=!0,r.active=Math.min(S,r.active+1);else if(d.key==="ArrowUp")d.preventDefault(),r.active=Math.max(0,r.active-1);else if(d.key==="Enter"){d.preventDefault();let E=b[r.active];E?l(E.value,h):e.allowCustom!==!1&&r.query.trim()?l(r.query.trim(),h):r.open&&(r.open=!1)}else if(d.key==="Escape")r.open=!1,e.multi||(r.query=i(o()[0]??""));else if(d.key==="Backspace"&&e.multi&&r.query===""){let E=o();E.length&&c(E[E.length-1])}}function u(){r.open=!1,e.multi?r.query="":e.allowCustom!==!1&&r.query.trim()?l(r.query.trim()):r.query=i(o()[0]??"")}}n.insertGlobalCss({".s-box":{"&":"display:flex flex-direction:column border: 1px solid $s-border; r: $s-radius-lg; overflow:hidden box-shadow: $s-shadow;","&:not(:first-child)":"margin-top: $3","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 padding: $2 $3; border-top: 1px solid $s-border;","> div":"p:$3 gap:$3"}});function ce(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e;n("section.s-box.s-s.panel",t.attrs,()=>{n(()=>{t.header!=null&&n("header.s-s.raised",t.headerAttrs,()=>p(t.header))}),n("div",t.contentAttrs,()=>{p(t.content)}),n(()=>{t.footer!=null&&n("footer.s-s.raised",t.footerAttrs,()=>p(t.footer))})})}n.insertGlobalCss({".s-btn":{"&":"display:inline-flex align-items:center justify-content:center gap:$2 font-weight:600 line-height:1.2 white-space:nowrap cursor:pointer text-decoration:none border:0 padding: 0.5em 1em; transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s, transform 0.08s;","&:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus;","&:hover":"filter: brightness(1.08)","&.tonal:hover, &.outlined:hover":"background: color-mix(in srgb, $s-b 26%, transparent);","&.gradient:not(.tonal):not(.outlined)":"box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), $s-glow;","&.gradient:not(.tonal):not(.outlined):hover":"filter: brightness(1.05); box-shadow: inset 0 1px 0 color-mix(in srgb, white 25%, transparent), 0 7px 18px color-mix(in srgb, $s-primary 34%, transparent);","&:active:not(:disabled)":"transform: translateY(1px)","&.small, .small > &":"padding: 0.32em 0.7em; font-size:0.85em","&.large, .large > &":"padding: 0.66em 1.3em; font-size:1.1em"}});var An=/\.(gradient|primary|secondary|neutral|danger|success|warning|base|panel|raised)(\.|\s|$)/;function P(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e,r=t.href!=null?"a":"button",s=t.attrs&&An.test(t.attrs)?"":".gradient";n(`${r}.s-btn.s-s${s}`,t.attrs,()=>{t.href!=null?(n(`href=${t.href} role=button`),t.disabled&&n("aria-disabled=true")):(n("type=",t.type??"button"),t.disabled&&n("disabled=true")),t.ariaLabel&&n("aria-label=",t.ariaLabel),t.click&&n("click=",t.click),p(t.icon),p(t.content)})}n.insertGlobalCss({".s-bgroup":{"&":"display:inline-flex align-items:stretch","&.s-spaced":"gap:$2 flex-wrap:wrap","&.s-vertical":"flex-direction:column","&.s-attached":"gap:0","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child)":"margin-left:-1px","&.s-attached:not(.s-vertical) > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached:not(.s-vertical) > .s-btn:first-child:not(:last-child)":"border-top-right-radius:0 border-bottom-right-radius:0","&.s-attached:not(.s-vertical) > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-bottom-left-radius:0","&.s-attached.s-vertical > .s-btn:not(:first-child)":"margin-top:-1px","&.s-attached.s-vertical > .s-btn:not(:first-child):not(:last-child)":"r:0","&.s-attached.s-vertical > .s-btn:first-child:not(:last-child)":"border-bottom-left-radius:0 border-bottom-right-radius:0","&.s-attached.s-vertical > .s-btn:last-child:not(:first-child)":"border-top-left-radius:0 border-top-right-radius:0","&.s-attached > .s-btn:hover, &.s-attached > .s-btn:focus-visible":"z-index:1"}});function Be(e={}){let r=`.s-${e.layout??"attached"}${e.vertical?".s-vertical":""}`;n(`div.s-bgroup${r} role=group`,e.attrs,()=>{if(e.buttons)for(let s of e.buttons)P(s);p(e.content)})}function Fe(e){n(()=>{let t=e.bind.value;Be({attrs:e.attrs,buttons:Object.entries(e.options).map(([r,s])=>({content:s,ariaLabel:typeof s=="function"?r:void 0,attrs:t===r?".primary":".neutral .outlined",click:()=>{e.bind.value=e.allowDeselect&&t===r?void 0:r}}))})}),e.name&&n(()=>n(`input type=hidden name=${e.name} value=`,e.bind.value??""))}n.insertGlobalCss({".s-check":{"&":"display:flex flex-direction:column gap:$1","> label":"display:flex align-items:center gap:$2 cursor:pointer user-select:none","> label:has(input:disabled)":"cursor:not-allowed opacity:0.45 filter:saturate(0.6)",input:"width:1.15em height:1.15em accent-color:$s-accent cursor:inherit m:0"}});function $e(e={}){let t=e.id??V("check");n("div.s-check",e.attrs,()=>{n(`label for=${t}`,()=>{n("input type=checkbox",e.inputAttrs,()=>{n(`id=${t}`),e.name&&n(`name=${e.name}`),e.checked&&!e.bind&&n("checked=true"),e.change&&n("change=",e.change),n(()=>{e.disabled&&n("disabled=true")}),n(()=>{e.required&&n("aria-required=true")}),e.bind&&n("bind=",e.bind)}),n(()=>{e.label!=null&&p(e.label),e.required&&n("span.s-req aria-hidden=true #*")})}),n(()=>{e.help!=null&&!e.error&&n("div.s-help",()=>p(e.help))}),n(()=>{e.error&&n("div.s-error role=alert #",e.error)})})}n.insertGlobalCss({".s-form":{"&":"display:flex flex-direction:column gap:$3","&.grid":"display:grid grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap:$3","&.grid > .s-wide, &.grid > footer":"grid-column: 1 / -1;","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 flex-wrap:wrap margin-top:$1"}});function ke(e={}){let t=typeof e=="string"||typeof e=="function"?{content:e}:e;n("form.s-form",t.attrs,()=>{n(()=>{n(".grid=",t.layout==="grid")}),n("submit=",r=>{if(r.preventDefault(),t.submit){let s=new FormData(r.target),o={};for(let i of new Set(s.keys())){let a=s.getAll(i);o[i]=a.length===1?a[0]:a}t.submit(o,r)}}),p(t.content),n(()=>{t.actions&&n("footer",t.actionsAttrs,()=>p(t.actions))})})}n.insertGlobalCss({".s-menu-list":"position:fixed z-index:350 min-width:10rem display:flex flex-direction:column p:$1 border: 1px solid $s-border; r:$s-radius-lg box-shadow:$s-shadow overflow-y:auto max-height:min(80vh,28rem) transition: opacity 0.15s, transform 0.15s;",".s-menu-list.hidden":"opacity:0 pointer-events:none transform:translateY(-6px)",".s-menu-item, .s-menu-item-link":"display:flex align-items:center gap:$2 w:100% padding: 0.5em 0.65em; r:$s-radius cursor:pointer text-align:left font-size:0.9em border:0 background:transparent fg:$s-fg text-decoration:none transition: background 0.12s, color 0.12s, transform 0.12s, box-shadow 0.12s;",".s-menu-item:hover:not([aria-disabled=true]):not([aria-current=page]), .s-menu-item-link:hover:not([aria-current=page])":"background: color-mix(in srgb, $s-fg 10%, transparent);",".s-menu-item[aria-current=page], .s-menu-item-link[aria-current=page]":"color:$s-on-accent font-weight:600 background: $s-gradient; box-shadow: 0 3px 10px color-mix(in srgb, $s-primary 38%, transparent);",".s-menu-item[aria-current=page] .s-menu-icon, .s-menu-item-link[aria-current=page] .s-menu-icon":"color:$s-on-accent",".s-menu-item[aria-current=page]:hover, .s-menu-item-link[aria-current=page]:hover":"filter:brightness(1.06)",".s-menu-item:focus-visible, .s-menu-item-link:focus-visible":"outline:none background: color-mix(in srgb, $s-fg 10%, transparent); box-shadow: 0 0 0 2px inset $s-focus;",".s-menu-item[aria-disabled=true], .s-menu-item-link[aria-disabled=true]":"opacity:0.45 cursor:not-allowed pointer-events:none",".s-menu-icon":"fg:$s-fg-muted flex-shrink:0","hr.s-menu-sep":"border:0 height:1px margin: $1 0.6rem; background: linear-gradient(to right, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);"});function Tt(e,t){n("keydown=",r=>{if(r.key!=="ArrowDown"&&r.key!=="ArrowUp"&&r.key!=="Home"&&r.key!=="End")return;r.preventDefault();let o=[...r.currentTarget.querySelectorAll(".s-menu-item, .s-menu-item-link")].filter(c=>c.getAttribute("aria-disabled")!=="true");if(!o.length)return;let i=o.indexOf(document.activeElement),a=r.key==="ArrowUp"?-1:1,l=r.key==="Home"?0:r.key==="End"?o.length-1:i<0?a>0?0:o.length-1:(i+a+o.length)%o.length;o[l].focus()});for(let r of e){if(typeof r=="string"||typeof r=="function"){p(r);continue}if("separator"in r){n("hr.s-menu-sep");continue}n(r.href?"a.s-menu-item-link":"button.s-menu-item type=button",r.attrs,()=>{r.href&&(n("href=",r.href),r.target&&n("target=",r.target),n(()=>{yr(r.href)&&n("aria-current=page")})),r.disabled&&n("aria-disabled=true"),n("click=",s=>{if(r.disabled){s.preventDefault();return}t?.(),r.click?.(s)}),r.icon&&n("span.s-menu-icon",()=>p(r.icon)),p(r.label)})}}var ue=n.proxy({opts:null});function fe(){let e=ue.opts?.anchor;ue.opts=null,e?.focus()}function Cn(e,t){let r=e.offsetWidth,s=e.offsetHeight,o=window.innerWidth,i=window.innerHeight,a=4,l=t.left;l+r>o-8&&(l=Math.max(8,t.right-r));let c=t.bottom+a;c+s>i-8&&t.top-s-a>=8&&(c=t.top-s-a),e.style.left=Math.max(8,l)+"px",e.style.top=Math.max(8,c)+"px"}H(()=>{let e=ue.opts;if(!e)return;let t=n("div.s-menu-list.s-s.panel create=hidden destroy=hidden",e.dropdownAttrs,()=>{Tt(e.items,fe)}),r=o=>{let i=o.target;!t.contains(i)&&!e.anchor.contains(i)&&fe()},s=o=>{(o.key==="Escape"||o.key==="Tab")&&(o.preventDefault(),fe())};document.addEventListener("click",r,!0),document.addEventListener("keydown",s,!0),n.clean(()=>{document.removeEventListener("click",r,!0),document.removeEventListener("keydown",s,!0)}),requestAnimationFrame(()=>{document.body.contains(t)&&(Cn(t,e.anchor.getBoundingClientRect()),t.querySelector(".s-menu-item:not([aria-disabled=true]), .s-menu-item-link:not([aria-disabled=true])")?.focus())})});function vr(e){return ue.opts=e,fe}function Mt(e){let t=null;n.clean(()=>{ue.opts?.anchor===t&&fe()}),P({icon:()=>n("span aria-hidden=true #\u2630"),...e.button?.content==null?{ariaLabel:"Open menu"}:null,attrs:".neutral .outlined",...e.button,click:r=>{if(t=r.currentTarget,ue.opts?.anchor===t){fe();return}vr({items:e.items,anchor:t,dropdownAttrs:e.dropdownAttrs})}})}n.insertGlobalCss({".s-main":{"&":"display:flex flex-direction:column min-height:100vh max-height:100vh container-type:inline-size","> header":"border-bottom: 1px solid $s-border; position:sticky top:0 z-index:10","> footer":"border-top: 1px solid $s-border; fg:$s-fg-muted","> header > .s-bar, > footer > .s-bar":"display:flex align-items:center width:100% margin-inline:auto gap:$3 padding: $2 $3;","> header .s-header-icon":"display:flex align-items:center font-size:1.4em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent;","> header .s-titles":"display:flex flex-direction:column min-width:0 flex:1","> header .s-title":"font-weight:800 font-size:1.1em line-height:1.2 overflow:hidden text-overflow:ellipsis white-space:nowrap letter-spacing:-0.01em background: $s-gradient; -webkit-background-clip:text; background-clip:text; color:transparent; width:fit-content max-width:100%","> header .s-subtitle":"fg:$s-fg-muted font-size:0.85em overflow:hidden text-overflow:ellipsis white-space:nowrap","> header .s-menu":"display:flex align-items:center gap:$2",".s-body":"flex:1 overflow:hidden display:flex flex-direction:row min-height:0 justify-content:center",".s-body-inner":"flex:1 display:flex flex-direction:row min-height:0","&.s-nav-right .s-body-inner":"flex-direction:row-reverse",".s-nav-sep":"width:1px flex-shrink:0 align-self:stretch margin: 0.6rem 0; border:0 background: linear-gradient(to bottom, transparent, $s-border-strong 18%, $s-border-strong 82%, transparent);",".s-body main":"flex:1 min-height:0 overflow-y:auto display:flex flex-direction:column",".s-body main > .s-content":"width:100% flex:1 p:$3",".s-body main.s-scroll-y":"margin-right:$3"},".s-nav-panel":{"&":"display:flex flex-direction:column overflow-y:auto flex-shrink:0 max-width:228px padding:$3 gap:$1 background:transparent"},".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:none",".s-main.s-nav-btn-only .s-nav-panel":"display:none",".s-main.s-nav-btn-only .s-nav-trigger":"display:flex","@container (max-width: 640px)":{".s-main.s-nav-left .s-nav-panel, .s-main.s-nav-right .s-nav-panel, .s-main .s-nav-sep":"display:none",".s-main.s-nav-left .s-nav-trigger, .s-main.s-nav-right .s-nav-trigger":"display:flex",".s-content > .s-box":"margin-inline: calc(-1 * $3); r:0 border-inline:0",".s-main .s-body main.s-scroll-y":"margin-right:0"}});function Ge(e={}){let t=e.nav,r=e.navPosition??"left",s=t!=null&&t.items.length>0,o=s?r==="button"?".s-nav-btn-only":`.s-nav-${r}`:"";n(`div.s-main.s-s.base${o}`,e.attrs,()=>{n(()=>{(e.title!=null||e.subtitle!=null||e.icon!=null||e.menu!=null||s)&&n("header.s-s.raised",e.topbarAttrs,()=>{n("div.s-bar",()=>{n(()=>{e.maxWidth!=null&&n("max-width:",e.maxWidth)}),n(()=>{s&&n("div.s-nav-trigger",()=>{Mt({...t,button:{icon:()=>n("span aria-hidden=true #\u2630"),ariaLabel:"Open navigation",attrs:".neutral .outlined .small",...t.button}})})}),n(()=>{e.icon!=null&&n("div.s-header-icon",()=>p(e.icon))}),n("div.s-titles",()=>{n(()=>{e.title!=null&&n("div.s-title",()=>p(e.title))}),n(()=>{e.subtitle!=null&&n("div.s-subtitle",()=>p(e.subtitle))})}),n(()=>{e.menu&&n("div.s-menu",()=>p(e.menu))})})})}),n("div.s-body",()=>{n("div.s-body-inner",()=>{n(()=>{e.maxWidth!=null&&n("max-width:",e.maxWidth)}),s&&r!=="button"&&(n(`nav.s-nav-panel.s-s.raised.s-nav-${r}`,e.navAttrs,()=>{Tt(t.items)}),n("div.s-nav-sep aria-hidden=true")),En(e)})}),n(()=>{e.footer!=null&&n("footer",()=>{n("div.s-bar",()=>{n(()=>{e.maxWidth!=null&&n("max-width:",e.maxWidth)}),p(e.footer)})})})})}function En(e){let t=n("main",()=>{n("div.s-content",e.contentAttrs,()=>{p(e.content)})});Rn(t)}function Rn(e){if(typeof ResizeObserver>"u")return;let t=()=>e.classList.toggle("s-scroll-y",e.offsetWidth>e.clientWidth),r=new ResizeObserver(t);r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),t(),n.clean(()=>r.disconnect())}function M(e={}){Q(e,(t,r)=>{n("input.s-input",e.inputAttrs,()=>{n("type=",e.type??"text"),e.placeholder!=null&&n("placeholder=",e.placeholder),e.autocomplete!=null&&n("autocomplete=",e.autocomplete),e.value!=null&&!e.bind&&n("value=",e.value),e.input&&n("input=",e.input),e.change&&n("change=",e.change),ve(e,t,r,e.bind)})})}n.insertGlobalCss({".s-backdrop":{"&":"position:fixed inset:0 z-index:200 display:block background: rgba(0,0,0,0.55); transition: opacity 0.4s ease-in-out;","&.hidden":"opacity:0 pointer-events:none"},".s-dialog":{"&":"position:fixed z-index:200 top:50% left:50% display:flex flex-direction:column transform:translate(-50%,-50%) min-width:20rem max-width:min(90vw,44rem) max-height:min(88vh,800px) border: 1px solid $s-border; r: $s-radius-lg; box-shadow: $s-shadow; overflow:hidden transition: opacity 0.2s ease-out, transform 0.2s ease-out;","> header":"display:flex align-items:center gap:$2 padding: $2 $3; border-bottom: 1px solid $s-border; font-weight:600 flex-shrink:0","> footer":"display:flex align-items:center justify-content:flex-end gap:$2 padding: $2 $3; border-top: 1px solid $s-border; flex-shrink:0","> div":"p:$3 gap:$3 display:flex flex-direction:column overflow-y:auto flex:1 min-height:0","&.hidden":"opacity:0 pointer-events:none transform: translate(-50%, calc(-50% + 20px)); pointer-events:none"}});var X=n.proxy({}),Ot=0,In=n.derive(()=>{let e=Object.keys(X);if(e.length)return e[e.length-1]});H(()=>{n.onEach(X,({resolve:e,opts:t},r)=>{let s=()=>{delete X[r]};n.clean(()=>{t.onClose?.(),e()});let o=n.derive(()=>In.value!=r);n("div.s-backdrop create=hidden destroy=hidden .hidden=",o,"click=",()=>{t.allowCancel!==!1&&s()}),n("div.s-dialog.s-s.panel create=hidden destroy=hidden",t.attrs,()=>{n(()=>{t.header!=null&&n("header.s-s.raised",t.headerAttrs,()=>p(t.header))}),n("div",t.contentAttrs,()=>{p(t.content,s)}),n(()=>{t.footer!=null&&n("footer.s-s.raised",t.footerAttrs,()=>p(t.footer))})})})});function We(e){Ot||document.addEventListener("keydown",r=>{if(r.key==="Escape"&&e.allowCancel!==!1){let s=n.unproxy(X);for(let o=Ot;o>0;o--)if(s[o]){s[o].opts.allowCancel!==!1&&delete X[o];break}}});let t=++Ot;return e.cancelWithScope!==!1&&n.clean(()=>{delete X[t]}),new Promise(r=>{X[t]={resolve:r,opts:e}})}n.insertGlobalCss({".s-select_wrap":{"&":"position:relative display:block",select:"w:100% cursor:pointer padding-right:2.2em; appearance:none","&::after":"content: '\u25BE'; position:absolute right:0.7em top:50%; transform: translateY(-50%); pointer-events:none fg:$s-fg-muted font-size:0.85em"}});n.insertGlobalCss({".s-tabs":{"&":"display:flex flex-direction:column gap:$3",".s-tablist":"display:flex gap:$1 align-items:stretch overflow-x:auto scrollbar-width:none border-bottom: 1px solid $s-border;",".s-tablist::-webkit-scrollbar":"display:none",".s-tab":"display:inline-flex align-items:center gap:$2 cursor:pointer background:transparent border:0 color: $s-fg-muted; font-weight:600 padding: 0.6em 0.9em; border-bottom: 3px solid transparent; margin-bottom:-1px transition: color 0.15s, background 0.15s, border-color 0.15s;",".s-tab:hover:not(:disabled), .s-tab[aria-selected=true]":"color: $s-fg;",".s-tab:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; r: $s-radius;",".s-tab[aria-selected=true]":"border-image: $s-gradient 1;",".s-tabpanel":"display:block"}});function Nt(e){let t=V("tabs"),r=(i,a)=>i.id??String(a),s=e.bind??n.proxy(r(e.tabs[0]??{label:""},0));e.tabs.length>0&&!e.tabs.some((i,a)=>r(i,a)===n.peek(()=>s.value))&&(s.value=r(e.tabs[0],0));let o=(i,a)=>{i.disabled||(s.value=r(i,a))};n("div.s-tabs",e.attrs,()=>{n("div.s-tablist role=tablist",()=>{e.tabs.forEach((i,a)=>{let l=r(i,a);n("button.s-tab type=button role=tab",()=>{n(`id=${t}-tab-${l} aria-controls=${t}-panel-${l}`),n(()=>{let c=s.value===l;n("aria-selected=",c?"true":"false"),n("tabindex=",c?"0":"-1")}),i.disabled&&n("disabled=true"),n("click=",()=>o(i,a)),n("keydown=",c=>Tn(c,e.tabs,a,o)),p(i.icon),p(i.label)})})}),n("div.s-tabpanel role=tabpanel",e.contentAttrs,()=>{n(()=>{let i=s.value,a=e.tabs.findIndex((c,f)=>r(c,f)===i),l=e.tabs[a]??e.tabs[0];l&&(n(`id=${t}-panel-${r(l,a)} aria-labelledby=${t}-tab-${r(l,a)}`),p(l.content))})})})}function Tn(e,t,r,s){let o=r;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=(r+1)%t.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=(r-1+t.length)%t.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=t.length-1;else return;e.preventDefault();let i=o>=r?1:-1;for(let a=0;a<t.length;a++){let l=t[o];if(l&&!l.disabled){s(l,o),e.currentTarget?.parentElement?.children[o]?.focus();return}o=(o+i+t.length)%t.length}}n.insertGlobalCss({"textarea.s-input":"resize:vertical min-height:3em line-height:1.45","textarea.s-input.s-autoGrow":"resize:none min-height:2.5em overflow-y:hidden"});function jt(e={}){let t=e.autoGrow!==!1;Q(e,(r,s)=>{let o=n("textarea.s-input",e.inputAttrs,()=>{t?(n(".s-autoGrow"),n("input=",i=>{$r(i.currentTarget),e.input&&e.input(i)})):(n("rows=",e.rows??4),n("resize:",e.resize??"vertical"),e.input&&n("input=",e.input)),e.placeholder!=null&&n("placeholder=",e.placeholder),e.value!=null&&!e.bind&&n("value=",e.value),e.change&&n("change=",e.change),ve(e,r,s,e.bind)});t&&requestAnimationFrame(()=>$r(o))})}function $r(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}var Ve=400,kr=`margin ${Ve}ms ease-out, transform ${Ve}ms ease-out`;function Pr(e){if(e.parentElement){let t=getComputedStyle(e.parentElement);if(t.display==="flex"&&(t.flexDirection||"").startsWith("row"))return{marginLeft:`-${e.offsetWidth/2}px`,marginRight:`-${e.offsetWidth/2}px`,transform:"scaleX(0)"}}return{marginBottom:`-${e.offsetHeight/2}px`,marginTop:`-${e.offsetHeight/2}px`,transform:"scaleY(0)"}}async function Sr(e){let t=Pr(e);Object.assign(e.style,t),e.offsetHeight,e.style.transition=kr;for(let r in t)e.style[r]="";setTimeout(()=>{e.style.transition=""},Ve)}async function Ar(e){let t=Pr(e);e.style.transition=kr,Object.assign(e.style,t),setTimeout(()=>{e.remove()},Ve)}n.insertGlobalCss({".s-toasts":"position:fixed bottom:$3 right:$3 z-index:400 display:flex flex-direction:column gap:$2 pointer-events:none max-width:min(90vw,24rem) w:24rem",".s-toast":{"&":"display:flex align-items:flex-start gap:$2 padding: $3; border: 1px solid $s-border; r:$s-radius box-shadow:$s-shadow pointer-events:auto position:relative overflow:hidden",".s-toast-body":"display:flex flex-direction:column gap:$1 flex:1 min-width:0",".s-toast-title":"font-weight:700 line-height:1.3",".s-toast-msg":"font-size:0.9em fg:$s-fg-muted line-height:1.4",".s-toast-close":"cursor:pointer border:0 background:transparent fg:$s-fg-muted font-size:1.1em line-height:1 padding: 0 0.15em; r:4px flex-shrink:0 align-self:flex-start",".s-toast-close:hover":"fg:$s-fg",".s-toast-close:focus-visible":"outline:none box-shadow: 0 0 0 3px $s-focus; fg:$s-fg",".s-toast-progress":"position:absolute bottom:0 left:0 right:0 height:2px background:$s-accent width:100%"}});var Mn=0,Pe=n.proxy({});H(()=>{n.peek(()=>n.isEmpty(Pe))&&n.isEmpty(Pe)||n("div.s-toasts aria-live=polite aria-atomic=false",()=>{n.onEach(Pe,e=>{let{opts:t,id:r}=e,s=t.type==="danger"||t.type==="warning"?"alert":"status",o=t.type??"neutral",i=t.duration??6e3,a,l=null,c=()=>{clearTimeout(a),l&&(l.style.transition="none",l.style.width="100%",l.offsetWidth,l.style.transition=`width ${i}ms linear`,l.style.width="0%"),a=setTimeout(()=>Lt(r),i)},f=()=>{clearTimeout(a),a=void 0,l&&(l.style.transition="none",l.style.width="100%")};n.clean(()=>clearTimeout(a)),n(`div.s-toast.s-s.${o} role=${s}`,"create=",Sr,"destroy=",Ar,t.attrs,()=>{i>0&&(n("mouseenter=",f),n("mouseleave=",c)),n("div.s-toast-body",()=>{n(()=>{t.title!=null&&n("div.s-toast-title",()=>p(t.title))}),n("div.s-toast-msg",()=>p(t.message))}),n(()=>{t.dismissible!==!1&&n("button.s-toast-close type=button aria-label=Dismiss",()=>{n("#\xD7"),n("click=",()=>Lt(r))})}),i>0&&(l=n("div.s-toast-progress"))}),i>0&&requestAnimationFrame(c)})})});function Lt(e){delete Pe[e]}function qt(e){let t=++Mn;return Pe[t]={id:t,opts:e},()=>Lt(t)}n.insertGlobalCss({".s-tt-tip":{"&":"position:fixed z-index:500 max-width:20rem w:max-content bg:$s-raised fg:$s-fg border: 1px solid $s-border-strong; r:$s-radius box-shadow:$s-shadow padding: 0.3em 0.65em; font-size:0.85em line-height:1.4 pointer-events:none"}});var Ut=n.proxy(void 0),Z=null;typeof window<"u"&&window.addEventListener("scroll",()=>{Ut.value=void 0},{capture:!0,passive:!0});function On(e,t,r,s){let i=window.innerWidth,a=window.innerHeight,l=0,c=0;return s==="bottom"?(l=e.left+(e.width-t)/2,c=e.bottom+7,c+r>a-8&&(c=e.top-r-7)):s==="left"?(l=e.left-t-7,c=e.top+(e.height-r)/2,l<8&&(l=e.right+7)):s==="right"?(l=e.right+7,c=e.top+(e.height-r)/2,l+t>i-8&&(l=e.left-t-7)):(l=e.left+(e.width-t)/2,c=e.top-r-7,c<8&&(c=e.bottom+7)),{x:Math.max(8,Math.min(l,i-t-8)),y:Math.max(8,Math.min(c,a-r-8))}}function Nn(){Z&&clearTimeout(Z),Z=setTimeout(()=>{Ut.value=void 0,Z=null},100)}H(()=>{let e=Ut.value;if(!e)return;let{opts:t,anchor:r}=e,s=t.placement??"top",o=n("div.s-tt-tip role=tooltip visibility:hidden",t.attrs,()=>{n("mouseenter=",()=>{Z&&(clearTimeout(Z),Z=null)}),n("mouseleave=",Nn),p(t.tip)});requestAnimationFrame(()=>{if(!document.body.contains(o))return;let{x:i,y:a}=On(r.getBoundingClientRect(),o.offsetWidth,o.offsetHeight,s);o.style.left=i+"px",o.style.top=a+"px",o.style.visibility=""})});var jn=new TextEncoder,_t=new TextDecoder("utf-8",{fatal:!0}),de=Symbol("EOD"),Ye="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$",Ir=new Uint8Array(128).fill(255);for(let e=0;e<Ye.length;++e)Ir[Ye.charCodeAt(e)]=e;var zt=typeof process<"u"&&process?.stdout?.isTTY,He=zt?["\x1B[32m","\x1B[33m","\x1B[34m","\x1B[35m"]:[""],Ln=zt?"\x1B[0m":"",Er=zt?"\x1B[31m":"",Rr={array:5,object:6,map:7,set:8,end:9},Je=0,qn=typeof process<"u"?!!process.env?.DATAPACK_EXTENDED_LOGGING:!1,K=class e{buffer;dataView;readPos=0;writePos=0;static EOD=de;get _buffer(){return this.buffer}constructor(t=1900){t instanceof Uint8Array?(this.buffer=t,this.writePos=t.length):this.buffer=new Uint8Array(t)}writeMultiByteNumber(t,r,s=!1,o=!1){let i=0,a=t;for(;a>0;)i++,a=Math.floor(a/256);let l=o?~i&31:i;this.buffer[this.writePos++]=r<<5|l;let c=1;for(let f=0;f<i;f++)c*=256;for(let f=0;f<i;f++){c=Math.floor(c/256);let u=Math.floor(t/c)%256;s&&(u^=255),this.buffer[this.writePos++]=u}}readMultiByteNumber(t,r=!1){this.readPos+t>this.writePos&&this.notEnoughData("number");let s=0,o=1;for(let i=t-1;i>=0;i--){let a=this.buffer[this.readPos+i];r&&(a^=255),s+=a*o,o*=256}return this.readPos+=t,s}notEnoughData(t){throw new Error(`Not enough data to read a ${t} at position ${this.readPos} in
|
|
17
|
+
${this.toString(!0)}`)}write(t){if(this.ensureCapacity(33),typeof t=="number")Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER?t>=0?t<32?this.buffer[this.writePos++]=32|t:t<64?this.buffer[this.writePos++]=64|t-32:this.writeMultiByteNumber(t-64,3):this.writeMultiByteNumber(-t,0,!0,!0):(this.buffer[this.writePos++]=128,this.dataView||=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.dataView.setFloat64(this.writePos,t),this.writePos+=8);else if(t===void 0)this.buffer[this.writePos++]=129;else if(t===null)this.buffer[this.writePos++]=130;else if(t===!0)this.buffer[this.writePos++]=131;else if(t===!1)this.buffer[this.writePos++]=132;else if(typeof t=="string"){let r=jn.encode(t);r.length<32?this.buffer[this.writePos++]=160|r.length:this.writeMultiByteNumber(r.length,6),this.ensureCapacity(r.length),this.buffer.set(r,this.writePos),this.writePos+=r.length}else if(t instanceof Uint8Array)this.writeMultiByteNumber(t.length,7),this.ensureCapacity(t.length),this.buffer.set(t,this.writePos),this.writePos+=t.length;else if(Array.isArray(t)||typeof t.length=="number"&&typeof t[Symbol.iterator]=="function"){this.buffer[this.writePos++]=133;for(let r of t)this.write(r);this.buffer[this.writePos++]=137}else if(t instanceof Map){this.buffer[this.writePos++]=135;for(let[r,s]of t)this.write(r),this.write(s);this.buffer[this.writePos++]=137}else if(t instanceof Set){this.buffer[this.writePos++]=136;for(let r of t)this.write(r);this.buffer[this.writePos++]=137}else if(t instanceof Date)this.buffer[this.writePos++]=140,this.write(Math.floor(t.getTime()/1e3));else if(typeof t=="object")t instanceof Se?this.writeCustom(t.name,t.data):typeof t.toDataPack=="function"?t.toDataPack(this):this.writeAsObject(t);else throw new Error(`Unsupported data type: ${typeof t}`);return this}read(t){if(this.readPos>this.writePos)throw new Error("Not enough data");let r=this.buffer[this.readPos++],s=r>>5&7,o=r&31;switch(s){case 0:{let i=~o&31;return-this.readMultiByteNumber(i,!0)}case 1:return o;case 2:return o+32;case 3:return this.readMultiByteNumber(o)+64;case 4:switch(o){case 0:{this.readPos+8>this.writePos&&this.notEnoughData("float64"),this.dataView||=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength);let i=this.dataView.getFloat64(this.readPos);return this.readPos+=8,i}case 1:return;case 2:return null;case 3:return!0;case 4:return!1;case 5:{let i=[];for(;;){let a=this.read(t);if(a===de)break;i.push(a)}return i}case 6:{let i={};for(;;){let a=this.read(t);if(a===de)break;let l=this.read(t);i[a]=l}return i}case 7:{let i=new Map;for(;;){let a=this.read(t);if(a===de)break;let l=this.read(t);i.set(a,l)}return i}case 8:{let i=new Set;for(;;){let a=this.read(t);if(a===de)break;i.add(a)}return i}case 9:return de;case 10:return--this.readPos,this.readIdentifier();case 11:{let i=this.readPos,a=i;for(;a>=this.writePos&&this.notEnoughData("null-terminated string"),this.buffer[a]!==0;)a++;return this.readPos=a+1,_t.decode(this.buffer.subarray(i,a))}case 12:{let i=this.readPositiveInt();return new Date(i*1e3)}case 13:{let i=this.readString(),a=this.read();return t&&i in t?t[i](a):new Se(i,a)}default:throw new Error(`Unknown type 4 subtype: ${o}`)}case 5:{let i=o;this.readPos+i>this.writePos&&this.notEnoughData("short string");let a=this.buffer.subarray(this.readPos,this.readPos+i);return this.readPos+=i,_t.decode(a)}case 6:{let i=this.readMultiByteNumber(o);this.readPos+i>this.writePos&&this.notEnoughData("string");let a=this.buffer.subarray(this.readPos,this.readPos+i);return this.readPos+=i,_t.decode(a)}case 7:{let i=this.readMultiByteNumber(o);this.readPos+i>this.writePos&&this.notEnoughData("blob");let a=this.buffer.slice(this.readPos,this.readPos+i);return this.readPos+=i,new Uint8Array(a)}default:throw new Error(`Unknown type: ${s}`)}}ensureCapacity(t){let r=this.writePos+t;if(r<=this.buffer.length)return;let s=Math.max(r,Math.floor(this.buffer.length*1.5)),o=new Uint8Array(s);o.set(this.buffer.subarray(0,this.writePos)),this.buffer=o,delete this.dataView}readNumber(){let t=this.read();if(typeof t!="number")throw new Error("Expected number but got "+typeof t);return t}readDate(){let t=this.read();if(!(t instanceof Date))throw new Error("Expected Date but got "+typeof t);return t}readPositiveInt(t){let r=this.read();if(typeof r!="number"||!Number.isInteger(r)||r<0||t!==void 0&&r>=t)throw new Error(`Expected positive integer < ${t} but got ${r}`);return r}readBoolean(){let t=this.read();if(typeof t!="boolean")throw new Error("Expected boolean but got "+typeof t);return t}readUint8Array(){let t=this.read();if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array but got "+typeof t);return t}readString(){let t=this.read();if(typeof t!="string")throw new Error("Expected string but got "+typeof t);return t}writeIdentifier(t){let r=0;if(typeof t=="number")r=t;else{if(t.length!==8)throw new Error(`Identifier must be exactly 8 characters, got ${t.length}`);let s;for(let o=0;o<8;o++){let i=t.charCodeAt(o);if(i>127||(s=Ir[i])===255)throw new Error(`Invalid base64 character: ${t[o]}`);r=r*64+s}}this.ensureCapacity(7),this.buffer[this.writePos++]=138;for(let s=5;s>=0;s--)this.buffer[this.writePos+s]=r%256,r=Math.floor(r/256);return this.writePos+=6,this}readIdentifier(){let t=this.readIdentifierNumber(),r="";for(let s=0;s<8;s++)r=Ye[t%64]+r,t=Math.floor(t/64);return r}readIdentifierNumber(){if(this.readPos+7>this.writePos&&this.notEnoughData("identifier"),this.buffer[this.readPos++]!==138)throw new Error("Invalid identifier header");let r=0;for(let s=0;s<6;s++)r=r*256+this.buffer[this.readPos++];return r}writeOrderedString(t){let r=new TextEncoder().encode(t);if(r.includes(0))throw new Error("String contains null character");return this.ensureCapacity(r.length+2),this.buffer[this.writePos++]=139,this.buffer.set(r,this.writePos),this.writePos+=r.length,this.buffer[this.writePos++]=0,this}toUint8Array(t=!0,r=0,s=this.writePos){return t?this.buffer.slice(r,s):this.buffer.subarray(r,s)}toBuffer(){return this.buffer.buffer.slice(0,this.writePos)}clone(t,r=0,s=this.writePos){if(t)return new e(this.buffer.slice(r,s));{let o=new e(this.buffer);return o.readPos=r,o.writePos=s,o}}writeCustom(t,r){this.buffer[this.writePos++]=141,this.write(t),this.write(r)}writeAsObject(t){this.buffer[this.writePos++]=134;for(let r of Object.keys(t))this.write(r),this.write(t[r]);return this.buffer[this.writePos++]=137,this}writeCollection(t,r){return this.writeCollectionBoundary(t),r(t==="array"||t==="set"?s=>{this.write(s)}:t==="object"?(s,o)=>{this.writeObjectKey(s),this.write(o)}:(s,o)=>{this.write(s),this.write(o)}),this.writeCollectionBoundary("end")}writeCollectionBoundary(t){let r=Rr[t];if(!r)throw new Error(`Invalid collection type: ${t}`);return this.buffer[this.writePos++]=128|r,this}writeObjectKey(t){if(typeof t=="string"){let r=parseInt(t,10);r.toString()==t&&(t=r)}else typeof t!="number"&&(t=""+t);this.write(t)}readCollectionBoundary(t){this.readPos>=this.writePos&&this.notEnoughData("collection boundary");let r=this.buffer[this.readPos++],s=128|Rr[t];if(r!==s)throw new Error(`Expected ${t} boundary but got byte ${r}`)}increment(){for(let t=this.writePos-1;t>=0;t--)if(this.buffer[t]===255)this.buffer[t]=0;else return this.buffer[t]++,this}toString(t=void 0,r=0,s=this.writePos){t===void 0&&(t=qn);let o=this.readPos;this.readPos=r;let i=0,a="",l="",c=Je,f=c>0?He[(c-1)%He.length]:Ln;try{for(;this.readPos<s;){let u=He[Je++%He.length];if(a+=u+he(this.read())+" ",t)for(l+=u;i<this.readPos;)l+=this.buffer[i].toString(16).padStart(2,"0")+" ",i++}}catch{if(!t)return this.readPos=o,Je=c,this.toString(!0,r,s);for(a+=Er+"ERROR ",l+=Er;i<this.writePos;)l+=this.buffer[i].toString(16).padStart(2,"0")+" ",i++}return this.readPos=o,c||(Je=0),t?"DataPack{"+l+f+"\u2192 "+a.trimEnd()+f+"}":"DataPack{"+a.trimEnd()+f+"}"}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}readAvailable(){return this.readPos<this.writePos}static generateIdentifier(){let t=Math.floor(+new Date*256+Math.random()*16384),r="";for(let s=0;s<8;s++)r=Ye[t&63]+r,t=Math.floor(t/64);return r}static createBuffer(...t){let r=new e;for(let s of t)r.write(s);return r.toBuffer()}static createUint8Array(...t){let r=new e;for(let s of t)r.write(s);return r.toUint8Array(!1)}};function he(e){if(e===void 0)return"undefined";if(typeof e=="object"&&e!==null){if(e instanceof Uint8Array)return new K(e).toString();if(e instanceof Array)return"["+e.map(t=>he(t)).join(", ")+"]";if(e instanceof Map)return"Map{"+Array.from(e.entries()).map(([t,r])=>`${he(t)}=>${he(r)}`).join(", ")+"}";if(e instanceof Set)return"Set{"+Array.from(e.values()).map(t=>he(t)).join(", ")+"}";if(typeof e=="object"&&e!==null)return"{"+Object.entries(e).map(([t,r])=>`${t}:${he(r)}`).join(", ")+"}"}return JSON.stringify(e)}var Se=class{name;data;constructor(t,r){this.name=t,this.data=r}};K.prototype.CustomData=Se;var B={error:"e",response:"r",response_proxy:"p",response_model:"m",response_proxy_model:"q",model_data:"d"},Dt={call:1,cancel:2};var I=0;var Qe=Symbol(),Xe=class{constructor(t){this.url=t;this.api=new Proxy({connection:this,requestId:void 0},Tr),this.connect()}url;ws;activeRequests=new Map;requestCounter=0;reconnectAttempts=0;_proxyCounter=0;$state=n.proxy({online:!1,error:void 0});streamCache=new Map;get[n.OPAQUE](){return!0}api;isOnline(){return this.$state.online}getError(){return this.$state.error}connect(){let t;try{t=this.ws=typeof this.url=="string"?new WebSocket(this.url):this.url()}catch(r){console.error("WebSocket connection error:",r),this.$state.error=r?.message||"WebSocket connection error";return}t.binaryType="arraybuffer",I>=1&&console.log(`[lowlander] Connecting to WebSocket at ${typeof this.url=="string"?this.url:"[custom WebSocket]"}`),t.onopen=()=>{if(t===this.ws){I>=1&&console.log("[lowlander] WebSocket connected"),this.$state.online=!0,this.$state.error=void 0,this.reconnectAttempts=0;for(let r of this.activeRequests.values())r.$result.busy=!0,this.ws.send(r.requestBuffer)}},t.onclose=()=>{t===this.ws&&(I>=1&&console.log("[lowlander] WebSocket disconnected"),this.reconnect())},t.onerror=r=>{t===this.ws&&(console.error("WebSocket error:",r),this.$state.error=r?.message||"WebSocket connection error",this.reconnect())},t.onmessage=r=>{if(t!==this.ws)return;let s=new K(new Uint8Array(r.data)),o=s.readPositiveInt(),i=this.activeRequests.get(o);if(!i)return;let a=n.unproxy(i.$result),l=s.read();if(typeof l=="number"){let c=i.callbacks?.[l],f=[];for(;s.readAvailable();)f.push(s.read());c(...f);return}if(l===B.model_data){i.database||=new Map,i.commitIds||=new Map;let c=s.readNumber(),f=s.readNumber(),u=s.read({model:function(b){let S=i.database.get(b);return S||console.error("Unknown linked model hash "+b),S}});I>=3&&console.log("[lowlander] incoming model_data",o,c,f,u),setTimeout(()=>this.pruneCommitIds(i,f),15e3);let d=i.commitIds.get(c);if(!u){if(d&&f<Math.max(...d.values()))return;i.database.delete(c),i.commitIds.set(c,new Map([[Qe,f]]));return}let h=i.database.get(c);if(h){d||(d=new Map,i.commitIds.set(c,d));for(let b of Object.keys(u))f<(d.get(b)??d.get(Qe)??-1)||(u[b]&&typeof u[b]=="object"?n.copy(h,b,u[b]):h[b]=u[b],d.set(b,f))}else{if(d&&f<(d.get(Qe)??-1))return;let b=n.proxy(u);n.unproxy(b)[n.OPAQUE]=!1,i.database.set(c,b),i.commitIds.set(c,new Map([[Qe,f]]))}return}if(l===B.error){let c=s.readString();i.$result.error=new Error(c),I>=2&&console.log(`[lowlander] incoming error requestId=${o} message=${c}`)}else if(l===B.response||l===B.response_proxy)i.$result.value=s.read(),i.virtualSocketIds=s.read(),i.hasServerProxy=l===B.response_proxy,I>=2&&console.log(`[lowlander] incoming response requestId=${o} value=${a.value} virtualSocketIds=${i.virtualSocketIds} hasServerProxy=${i.hasServerProxy}`);else if(l===B.response_model||l===B.response_proxy_model){i.virtualSocketIds=s.read();let c=s.readNumber(),f=s.read(),u=i.database?.get(c);i.hasServerProxy=l===B.response_proxy_model,I>=2&&console.log(`[lowlander] incoming ${i.hasServerProxy?"response_proxy_model":"response_model"} requestId=${o} dbKey=${c} cacheMs=${f} obj=${u}`),u?i.$result.value=n.proxy(u):i.$result.error=new Error("Unknown database key "+c),f!==void 0&&i.cacheKey&&!this.streamCache.has(i.cacheKey)&&this.streamCache.set(i.cacheKey,{request:i,cacheKey:i.cacheKey,cacheMs:f,refCount:1})}else throw new Error("Unknown message type "+l);!i.hasServerProxy&&!i.virtualSocketIds?.length&&this.activeRequests.delete(o),i.hasServerProxy||delete i.$result.serverProxy,i.$result.busy=!1,i.resolve&&(a.error!=null?(console.error(a.error),i.reject(a.error)):i.resolve(a.value),delete i.resolve,delete i.reject)}}reconnect(){if(this.ws=void 0,this.$state.online=!1,typeof this.url!="string")return;let t=Math.min(500*Math.pow(2,this.reconnectAttempts),2e4);this.reconnectAttempts++,I>=1&&console.log(`[lowlander] Reconnecting in ${t}ms (attempt ${this.reconnectAttempts})`),setTimeout(this.connect.bind(this),t)}pruneCommitIds(t,r){if(t.commitIds)for(let[s,o]of t.commitIds){for(let[i,a]of o)a<=r&&o.delete(i);o.size||t.commitIds.delete(s)}}_createMethodStub(t,r){return(...s)=>{let i=s.some(h=>typeof h=="function")?void 0:(r??"")+":"+t+":"+JSON.stringify(s);if(i){let h=this.streamCache.get(i);if(h)return h.lingerTimeout&&(clearTimeout(h.lingerTimeout),h.lingerTimeout=void 0),h.refCount++,I>=2&&console.log(`[lowlander] reusing cached stream cacheKey=${i} refCount=${h.refCount}`),n.clean(()=>{h.refCount--,I>=2&&console.log(`[lowlander] clean cached consumer cacheKey=${i} refCount=${h.refCount}`),h.refCount<=0&&this.startLinger(h)}),h.request.$result}let a={busy:!0},l=n.proxy(a),c=++this.requestCounter,f=new K;f.write(c).write(Dt.call).write(r).write(t);let u;f.writeCollection("array",()=>{for(let h of s)typeof h=="function"?(u||=[],f.writeCustom("cb",u.length),u.push(h)):f.write(h)});let d={$result:l,requestBuffer:f.toUint8Array(!0),requestId:c,connection:this,callbacks:u,cacheKey:i};return a.serverProxy=new Proxy(d,Tr),a.promise=new Promise((h,b)=>{d.resolve=h,d.reject=b}),this.activeRequests.set(c,d),I>=2&&console.log(`[lowlander] outgoing call requestId=${c} method=${t} params=`,s),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(d.requestBuffer),n.clean(()=>{let h=i?this.streamCache.get(i):void 0;if(h&&h.request===d){h.refCount--,I>=2&&console.log(`[lowlander] clean stream owner cacheKey=${i} refCount=${h.refCount}`),h.refCount<=0&&this.startLinger(h);return}this.cancelRequest(d)}),l}}cancelRequest(t){if(this.activeRequests.delete(t.requestId),t.virtualSocketIds?.length||t.hasServerProxy){I>=2&&console.log(`[lowlander] outgoing cancel requestId=${t.requestId} virtualSocketIds=${t.virtualSocketIds} hasServerProxy=${t.hasServerProxy}`);let r=K.createUint8Array(++this.requestCounter,Dt.cancel,t.requestId,t.virtualSocketIds);this.ws?.send(r)}}startLinger(t){t.lingerTimeout&&clearTimeout(t.lingerTimeout),I>=2&&console.log(`[lowlander] start linger cacheKey=${t.cacheKey} cacheMs=${t.cacheMs}`),t.lingerTimeout=setTimeout(()=>{t.refCount>0||(I>=2&&console.log(`[lowlander] linger expired cacheKey=${t.cacheKey}`),this.streamCache.delete(t.cacheKey),this.cancelRequest(t.request))},t.cacheMs)}},Tr={get(e,t){if(typeof t=="symbol")return t===n.OPAQUE?!0:t===n.CUSTOM_DUMP?`<ServerProxy for #${e.requestId}>`:void 0;if(e.serverProxyCache?.has(t))return e.serverProxyCache.get(t);if(t==="then"||t==="catch"||t==="finally")return;if(t==="constructor")return{name:"ServerProxy-"+e.requestId};let r=e.connection._createMethodStub(t,e.requestId);return e.serverProxyCache||(e.serverProxyCache=new Map),e.serverProxyCache.set(t,r),r},has(e,t){return typeof t=="string"||t===n.NO_COPY}};function Ze(e,t){if(t==null)return null;switch(e.kind){case"dateTime":return typeof t=="string"?t.slice(0,16):t;case"link":return t?.__ref!=null?t.pk:t;case"array":case"set":return Array.isArray(t)?t.map(s=>Ze(e.inner,s)):[];case"record":if(!t||typeof t!="object")return{};let r={};for(let[s,o]of Object.entries(t))r[s]=Ze(e.innerValue,o);return r;case"or":return e.isOptional&&e.inner?t===null?null:Ze(e.inner,t):t;default:return t}}function et(e){if(e.isOptional)return null;switch(e.kind){case"string":return"";case"number":return 0;case"boolean":return!1;case"dateTime":return new Date().toISOString().slice(0,16);case"array":case"set":return[];case"record":return{};case"link":return null;case"or":case"literal":return null;default:return""}}function tt(e,t){n("div.s-field",()=>{e!=null&&n("label",()=>n("#",e)),t()})}function rt(e,t,r,s,o=!1){if(e.isOptional&&e.inner){Un(e.inner,t,r,s,o);return}switch(e.kind){case"string":M({label:s,disabled:o,bind:t});return;case"id":M({label:s,disabled:!0,bind:t,help:o?"auto-generated":void 0});return;case"number":M({label:s,type:"number",disabled:o,bind:t});return;case"boolean":$e({label:s??"Yes",disabled:o,bind:t});return;case"dateTime":M({label:s,type:"datetime-local",disabled:o,bind:t});return;case"link":zn(e,t,r,s,o);return;case"array":case"set":Dn(e,t,r,s,o);return;case"record":Kn(e,t,r,s,o);return;case"or":{let i=e.choices??[];if(i.length&&i.every(a=>a.kind==="literal")){_n(i,t,s,o);return}Kt(t,s,o);return}case"literal":M({label:s,disabled:!0,value:e.literalValue??""});return;default:Kt(t,s,o)}}function Un(e,t,r,s,o=!1){let i=n.peek(()=>t.value!==null&&t.value!==void 0),a=n.proxy({v:i?"set":"undefined"});n(()=>{a.v==="set"?(n.peek(()=>t.value)===null||n.peek(()=>t.value)===void 0)&&(t.value=et(e)):t.value=null}),tt(s,()=>{Fe({attrs:o?"pointer-events:none opacity:0.6":void 0,options:{set:"set",undefined:"undefined"},bind:n.ref(a,"v")}),n(()=>{a.v==="set"&&rt(e,t,r,void 0,o)})})}function _n(e,t,r,s=!1){let o=f=>f==null?"undefined":JSON.stringify(f),i=f=>f==null||f==="undefined"?null:JSON.parse(f),a={},l=!1;for(let f of e){let u=f.literalValue??"undefined";u==="undefined"?(l=!0,a[u]="(none)"):a[u]=String(i(u))}let c=n.proxy({v:o(n.peek(()=>t.value))});n(()=>{t.value=i(c.v)}),tt(r,()=>{Fe({attrs:s?"pointer-events:none opacity:0.6":void 0,options:a,bind:n.ref(c,"v"),allowDeselect:!l})})}function zn(e,t,r,s,o=!1){let i=e.linkedModel;if(!i){Kt(t,s,o);return}let a=n.peek(()=>t.value),l=n.proxy({v:a==null?"":String(a)});n(()=>{let f=l.v;if(f==="")t.value=null;else{let u=Number(f);t.value=!isNaN(u)&&!/[^0-9.\-]/.test(f)?u:f}});let c=n.proxy({rows:[]});n(()=>{let f=r.serverProxy.findRecords(i,"(primary)",{limit:100});n(()=>{f.value&&(c.rows=f.value.rows)})}),It({label:s,disabled:o,allowCustom:!1,placeholder:`Search ${i}\u2026`,bind:n.ref(l,"v"),options:()=>c.rows.map(f=>({value:Bt(f.pk),label:Bt(f.pk)}))})}function Dn(e,t,r,s,o=!1){let i=e.inner,[a,l]=n.peek(()=>{let c=t.value,f=Array.isArray(c)?c:[],u=n.proxy(f.map(h=>({v:h}))),d=n.proxy({v:u.length});return[u,d]});n(()=>{t.value=a.map(c=>c.v)}),tt(s,()=>{n("div.s-s.raised","display:flex flex-direction:column gap:$2 p:$2 border: 1px solid $s-border;",()=>{n(()=>{let c=l.v;c===0&&n("span","fg:$s-fg-faint font-size:0.9em","#(empty)");for(let f=0;f<c;f++){let u=f;n("div","display:flex gap:$2 align-items:flex-start",()=>{n("div","flex:1",()=>{let d=n.ref(a[u],"v");rt(i,d,r,void 0,o)}),o||P({content:"\xD7",attrs:".outlined.danger .small flex-shrink:0 mt:$3",click:()=>{a.splice(u,1),l.v=a.length}})})}}),o||P({content:`+ Add ${i.display}`,attrs:".tonal .small",click:()=>{a.push({v:et(i)}),l.v=a.length}})})})}function Kn(e,t,r,s,o=!1){let i=e.innerValue,[a,l]=n.peek(()=>{let c=t.value,f=c&&typeof c=="object"&&!Array.isArray(c)?c:{},u=n.proxy(Object.entries(f).map(([h,b])=>({k:h,v:b}))),d=n.proxy({v:u.length});return[u,d]});n(()=>{let c={};for(let f of a)f.k!==""&&(c[f.k]=f.v);t.value=c}),tt(s,()=>{n("div.s-s.raised","display:flex flex-direction:column gap:$4 p:$2 border: 1px solid $s-border;",()=>{n(()=>{let c=l.v;c===0&&n("span","fg:$s-fg-faint font-size:0.9em","#(empty)");for(let f=0;f<c;f++){let u=f;n("div","display:flex flex-direction:column gap:$1",()=>{n("div","display:flex gap:$2 align-items:center",()=>{o?n("code","flex:1 font-size:0.85em fg:$s-fg-muted","#",n.peek(()=>a[u].k)):n("div","flex:1",()=>{M({placeholder:"key",bind:n.ref(a[u],"k")})}),o||P({content:"\xD7",attrs:".outlined.danger .small flex-shrink:0",click:()=>{a.splice(u,1),l.v=a.length}})}),n("div",()=>{let d=n.ref(a[u],"v");rt(i,d,r,void 0,o)})})}}),o||P({content:"+ Add entry",attrs:".tonal .small",click:()=>{a.push({k:"",v:et(i)}),l.v=a.length}})})})}function Kt(e,t,r=!1){let s=n.peek(()=>e.value),o=n.proxy({v:s===void 0?"":Bt(s)}),i=n.proxy({v:""});n(()=>{let a=o.v;if(a.trim()===""){e.value=void 0,i.v="";return}try{e.value=JSON.parse(a),i.v=""}catch{i.v="Invalid JSON"}}),jt({label:t,disabled:r,rows:3,bind:n.ref(o,"v")}),n(()=>{i.v&&n("div","fg:$s-danger font-size:0.82em mt:$1","#",i.v)})}function Mr(e,t,r,s,o,i,a){let l={};for(let f of r)l[f.name]=n.proxy({v:s(f)});let c=n.proxy({saving:!1});We({header:t,attrs:"width:800px",content:f=>{ke({content:()=>{for(let u of r)rt(u.type,n.ref(l[u.name],"v"),e,u.name,o(u))},layout:"grid",actions:()=>{P({content:"Cancel",attrs:".outlined.neutral",click:f}),n(()=>{P({content:i,type:"button",disabled:c.saving,click:async()=>{c.saving=!0;try{await a(l,f)}catch(u){qt({message:u?.message??String(u),type:"danger"})}finally{c.saving=!1}}})})}})}})}function Or(e,t,r,s){let o=r.filter(i=>i.type.kind!=="id");Mr(e,`New ${t}`,o,i=>et(i.type),()=>!1,"Create",async(i,a)=>{let l={};for(let f of o)l[f.name]=i[f.name].v;let c=await e.serverProxy.createRecord(t,l).promise;a(),s?.(c)})}function Nr(e,t,r,s,o,i){Mr(e,`Edit ${t}`,r,a=>Ze(a.type,o[a.name]),a=>a.isPk,"Save",async(a,l)=>{let c={};for(let f of r)f.isPk||(c[f.name]=a[f.name].v);await e.serverProxy.updateRecord(t,s,c).promise,l(),i?.()})}function jr(e,t,r,s,o){let i=n.proxy({deleting:!1,error:""});We({header:`Delete ${t}`,content:a=>{n("p","fg:$s-fg m:0",()=>{n("#Delete "),n("strong","#",s),n("#? This cannot be undone.")}),n(()=>{i.error&&n("p","fg:$s-danger m:0","#",i.error)}),n("div","display:flex gap:$2 mt:$3",()=>{P({content:"Delete",attrs:".danger",disabled:n.peek(()=>i.deleting),click:async()=>{i.deleting=!0,i.error="";try{await e.serverProxy.deleteRecord(t,r).promise,a(),o?.()}catch(l){i.error=l?.message??String(l),i.deleting=!1}}}),P({content:"Cancel",attrs:".outlined.neutral",click:a})})}})}function Bt(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}var qr="lowlander-dashboard";function Bn(){try{return JSON.parse(localStorage.getItem(qr)||"{}")}catch{return{}}}function Ur(e){localStorage.setItem(qr,JSON.stringify(e))}var Fn=()=>`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/`,Lr=Bn(),m=n.proxy({wsUrl:Lr.wsUrl||Fn(),password:Lr.password||"",loginError:"",connected:!1,authed:!1,indexRefreshKey:0,connecting:!1,connection:void 0}),nt,N,x={get debug(){return k.search.debug==="1"},set debug(e){ee("debug",e?"1":"")},get model(){return k.search.model||""},set model(e){ee("model",e)},get index(){return k.search.index||""},set index(e){ee("index",e)},get search(){return k.search.search||""},set search(e){ee("search",e)},get reverse(){return k.search.reverse==="1"},set reverse(e){ee("reverse",e?"1":"")},get limit(){return parseInt(k.search.limit||"10",10)||10},set limit(e){ee("limit",e===10?"":String(e))},get pk(){return k.search.pk||""},set pk(e){ee("pk",e)}};function ee(e,t){let r=k.search;t===""||t===void 0?delete r[e]:r[e]=t}function Gt(){return x.index||"(primary)"}function st(){return x.pk==="-"?"":x.pk}var Ae=n.insertCss({"&":"w:100% font-size:12.5px","& tbody tr":"cursor:default","& tbody tr:hover":"background: color-mix(in srgb, $s-fg 5%, transparent);","& tbody tr.selectable":"cursor:pointer","& tbody tr.selected":"background: color-mix(in srgb, $s-accent 15%, transparent);","& tbody tr.selected td:first-child":"border-left: 3px solid $s-accent; padding-left: 5px;"});function Gn(){Ge({title:"Lowlander Dashboard",maxWidth:"24rem",content:()=>{n(()=>{if(m.connecting&&!m.connection?.getError()){n("p","text-align:center fg:$s-fg-muted","#Connecting\u2026");return}ke({submit:()=>_r(),content:()=>{M({label:"WebSocket URL",bind:n.ref(m,"wsUrl")}),M({label:"Password",type:"password",bind:n.ref(m,"password"),inputAttrs:"autofocus=autofocus"}),n(()=>{let e=m.connection?.getError()||m.loginError;e&&n("p","fg:$s-danger m:0","text=",e)})},actions:()=>P({content:m.connected&&!m.authed?"Checking\u2026":"Log in",type:"submit",disabled:m.connected&&!m.authed})})})}})}async function _r(){m.connecting=!0,m.loginError="",Ur({wsUrl:m.wsUrl,password:m.password});try{m.connection&&m.connection.ws?.close?.()}catch{}m.connection=new Xe(m.wsUrl),nt=m.connection.api,m.connected=!1,m.authed=!1;let e=nt._dashboard(m.password);N=e;try{await e.promise,m.connected=!0,m.authed=!0,m.connecting=!1}catch(t){m.connecting=!1,m.loginError=t?.message||"Login failed",m.connected=!1,m.authed=!1,m.connection=void 0,nt=void 0,N=void 0}}function Wn(){m.authed=!1,m.connected=!1,m.password="",Ur({wsUrl:m.wsUrl,password:""});try{m.connection?.ws?.close?.()}catch{}m.connection=void 0,nt=void 0,N=void 0}var Vn=()=>{let e=N.serverProxy.listModels();n(()=>{if(e.busy){n("p","p:$2 fg:$s-fg-muted font-size:0.9em m:0","#Loading\u2026");return}if(e.error){n("p","p:$2 fg:$s-danger font-size:0.9em m:0","text=",e.error.message);return}for(let t of e.value??[])n("button.s-menu-item type=button","justify-content:space-between",()=>{n(()=>{!x.debug&&x.model===t.tableName&&n("aria-current=page")}),n("click=",()=>Ke({path:k.path,search:{model:t.tableName}})),n("span","text=",t.tableName),n("span","font-size:0.78em opacity:0.65","text=",`${t.fieldCount}f ${t.indexCount}i ${t.streamTypeCount}s`)})})},Hn=()=>{n("button.s-menu-item type=button",()=>{n(()=>{x.debug&&n("aria-current=page")}),n("click=",()=>Ke({path:k.path,search:{debug:"1"}})),n("span.s-menu-icon aria-hidden=true #\u2B21"),n("#WarpSocket debug")})};function Jn(){Ge({icon:"\u2B21",title:"Lowlander",menu:()=>P({content:"Logout",attrs:".neutral .outlined .small",click:Wn}),nav:{items:[Vn,{separator:!0},Hn]},content:()=>{x.debug?ns():x.model?Yn():n("p","fg:$s-fg-muted text-align:center mt:$4","#Select a model from the sidebar")}})}function Yn(){let e=x.model,t=N.serverProxy.getModel(e);n(()=>{if(t.busy){n("p","fg:$s-fg-muted","#Loading\u2026");return}if(t.error){n("p","fg:$s-danger","text=",t.error.message);return}let r=t.value;r&&(ce({header:r.tableName,content:()=>{n("table",Ae,()=>{n("thead tr",()=>{n("th#Name"),n("th#Type"),n("th#Linked"),n("th#Default"),n("th#Description")}),n("tbody",()=>{for(let s of r.fields)n("tr",()=>{n("td",()=>n("code","text=",s.name)),n("td","fg:$s-success","text=",s.type.display),n("td",()=>{let o=s.type.linkedModel;o&&Vt(o)}),n("td","text=",s.hasDefault?"\u2713":""),n("td","fg:$s-fg-muted","text=",s.description||"")})})})}}),ce({header:"Indexes",content:()=>Qn(r)}),n(()=>{let s=Gt(),o=r.indexes.find(i=>i.name===s);o&&ce({header:()=>{n("span","flex:1","text=",`Data \xB7 ${s}`),P({content:"+ New",attrs:".outlined .small",click:()=>{Or(N,r.tableName,r.fields,()=>{m.indexRefreshKey++})}})},content:()=>ts(r,o)})}),r.streamTypes.length&&ce({header:"Stream types",content:()=>Xn(r)}))})}function Vt(e,t,r){n("a","click=",s=>{s.preventDefault(),s.stopPropagation();let o={model:e};t!==void 0&&(o.search=it(t),o.limit=1),Ke({path:k.path,search:o})},"text=",r??e)}function it(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Qn(e){n("table",Ae,()=>{n("thead tr",()=>{n("th#Name"),n("th#Kind"),n("th#Fields")}),n("tbody",()=>{for(let t of e.indexes)n("tr.selectable","click=",()=>{Gt()!==t.name&&(x.index=t.name==="(primary)"?"":t.name,x.pk="",x.search="")},()=>{n(()=>n(".selected=",Gt()===t.name)),n("td",()=>n("code","text=",t.name)),n("td","fg:$s-success","text=",t.info.kind),n("td","text=",t.info.fields.join(", ")||"(computed)")})})})}function Xn(e){let t={};for(let o of e.fields)t[o.name]=o;let r=new Set,s=e.streamTypes.filter(o=>r.has(o.id)?!1:(r.add(o.id),!0));n("table",Ae,()=>{n("thead tr",()=>{n("th#id"),n("th#cache"),n("th#fields"),n("th","w:100%","#live view for selected row")}),n("tbody",()=>{for(let o of s)n("tr",()=>{n("td",()=>n("code","text=",String(o.id))),n("td","text=",o.cache?`${o.cache}s`:""),n("td",()=>Zn(o.fields,t)),n("td",()=>es(e.tableName,o.id))})})})}function Zn(e,t){if(e===!0){n("span","fg:$s-fg-muted","#(scalar)");return}if(!e||typeof e!="object"){n("span","text=",String(e));return}for(let[r,s]of Object.entries(e))if(typeof s=="number"){let o=t[r]?.type?.linkedModel;n(`div#${r}\u2192`,()=>{o?Vt(o,void 0,s.toString()):n("#?")})}else s===!1?n(`div#${r}*`):n(`div#${r}`)}function es(e,t){n(()=>{let r=st();if(!r){n("span","fg:$s-fg-muted","#(select a row)");return}let s;try{s=JSON.parse(r)}catch{s=r}let o=N.serverProxy.streamRecord(e,t,s);n(()=>{if(o.busy){n("span","fg:$s-fg-muted","#\u2026");return}if(o.error){n("span","fg:$s-danger","text=",o.error.message);return}n.dump(o.value)})})}function ts(e,t){let r=e.tableName,s=t.name,o={get value(){return x.search},set value(a){x.search=String(a),x.limit=10}},i={get value(){return x.reverse},set value(a){x.reverse=!!a}};n("div","display:flex flex-direction:column gap:$3",()=>{n("div","display:flex flex-wrap:wrap gap:$2 align-items:center",()=>{M({placeholder:"search",attrs:"flex:1 min-w:180px",bind:o}),$e({label:"reverse",bind:i}),P({content:"\u21BA",attrs:".outlined .small",ariaLabel:"Refresh",click:()=>m.indexRefreshKey++})}),n(()=>{m.indexRefreshKey;let a={search:rs(x.search),reverse:x.reverse,limit:x.limit},l=N.serverProxy.findRecords(r,s,a);n(()=>{if(l.busy){n("p","fg:$s-fg-muted","#Loading\u2026");return}if(l.error){n("p","fg:$s-danger","text=",l.error.message);return}let c=l.value;if(c){if(!x.pk&&c.rows.length>0){x.pk=it(c.rows[0].pk);return}if(n("p","fg:$s-fg-muted font-size:0.85em m:0","text=",`${c.rows.length} rows (scanned ${c.scanned})`),!c.rows.length){n("p","fg:$s-fg-muted m:0","#(empty)");return}n("div","overflow:auto",()=>{n("table",Ae,()=>{let f=Object.keys(c.rows[0].values);n("thead tr",()=>{for(let u of f)n("th","text=",u);n("th","w:1px")}),n("tbody",()=>{for(let u of c.rows){let d=it(u.pk);n("tr.selectable","click=",()=>{x.pk=st()===d?"-":d},()=>{n(()=>n(".selected=",st()===d));for(let h of f)n("td",()=>n.dump(Wt(u.values[h])));n("td","text-align:right white-space:nowrap",()=>{P({content:"\u270E",attrs:".outlined .small mr:$1",ariaLabel:"Edit",click:h=>{h.stopPropagation(),Nr(N,r,e.fields,u.pk,u.values,()=>{m.indexRefreshKey++})}}),P({content:"\u2715",attrs:".danger .outlined .small",ariaLabel:"Delete",click:h=>{h.stopPropagation(),jr(N,r,u.pk,d,()=>{m.indexRefreshKey++,st()===d&&(x.pk="-")})}})})})}})})}),c.rows.length>=x.limit&&n(()=>P({content:`+ more (currently limit ${x.limit})`,attrs:".outlined .small",click:()=>{let f=x.limit;x.limit=Math.min(f*5,f+250)}}))}})})})}function Wt(e){if(e==null||typeof e!="object"||e instanceof Date)return e;if(e.__ref){let r=e.__ref,s=e.pk;return{[n.CUSTOM_DUMP](){Vt(r,s,`<${r} ${it(s)}>`)}}}if(Array.isArray(e))return e.map(Wt);let t={};for(let[r,s]of Object.entries(e))t[r]=Wt(s);return t}function rs(e){if(e!==""){if(e==="true")return!0;if(e==="false")return!1;if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);try{return JSON.parse(e)}catch{}return e}}function ns(){let e=n.proxy({value:"channels"});Nt({bind:e,tabs:["channels","sockets","workers","kv"].map(t=>({id:t,label:t,content:()=>{let r=N.serverProxy.getDebugState(t);n(()=>{if(r.busy){n("p","fg:$s-fg-muted","#Loading\u2026");return}if(r.error){n("p","fg:$s-danger","text=",r.error.message);return}let s=n.unproxy(r.value);if(!s)return;let o=new Set;for(let a of Object.values(s))if(a&&typeof a=="object"&&!(a instanceof Uint8Array))for(let l of Object.keys(a))o.add(l);let i=[...o];n("div","overflow:auto",()=>{n("table",Ae,()=>{n("thead tr",()=>{n("th##");for(let a of i)n("th","text=",a)}),n("tbody",()=>{for(let[a,l]of Object.entries(s))n("tr",()=>{n("td",()=>n("code","text=",a));for(let c of i)n("td","font-size:12px font-family:monospace","text=",ss(l?.[c]))})})})})})}}))})}function ss(e){if(e==null)return"";if(e instanceof Uint8Array)return Ft([...e]);if(typeof e=="object"){if(e.type==="Buffer"&&Array.isArray(e.data))return Ft(e.data);let t=Object.keys(e);if(!Array.isArray(e)&&t.length>0&&t.length<=4096&&t.every((r,s)=>r===String(s))){let r=[];for(let s of t){let o=e[s];if(typeof o!="number"||o<0||o>255)return JSON.stringify(e);r.push(o)}return Ft(r)}return JSON.stringify(e)}return String(e)}function Ft(e){let t="";for(let r of e)r>=32&&r<127&&r!==34&&r!==92?t+=String.fromCharCode(r):r===9?t+="\\t":r===10?t+="\\n":r===13?t+="\\r":r===34?t+='\\"':r===92?t+="\\\\":t+="\\x"+r.toString(16).padStart(2,"0");return t}n.mount(document.body,()=>{if(!m.authed){Gn();return}Jn()});m.password&&_r();
|
|
18
18
|
</script>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|